// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://@sbaseurl@/jsapi/jsapi/esri/copyright.txt and http://www.arcgis.com/apps/webappbuilder/copyright.txt for details.

//>>built
define("dojo/_base/declare dijit/_WidgetBase dijit/_TemplatedMixin dijit/_WidgetsInTemplateMixin dojo/_base/lang dojo/_base/array jimu/dijit/SimpleTable".split(" "),function(k,l,m,n,d,e,p){return k([l,m,n],{baseClass:"jimu-query-setting-relationships-selector",templateString:'\x3cdiv\x3e\x3cdiv data-dojo-attach-point\x3d"tableDiv"\x3e\x3c/div\x3e\x3c/div\x3e',nls:null,allRelationshipInfos:null,postCreate:function(){this.inherited(arguments);this._initTable()},setSelectedRelationshipInfos:function(a){if(a&&
0<=a.length){var b=d.clone(a),h=e.map(b,function(c){return c.relationship});a=this.table.getRows();var g={};e.forEach(a,d.hitch(this,function(c){var f=this.table.getRowData(c);f=h.indexOf(f.relationship);0<=f?(this.table.editRow(c,{cbx:!0,label:b[f].label}),g[f]=c):this.table.editRow(c,{cbx:!1})}));for(a=h.length-1;0<=a;a--)g[a]&&this.table.moveToTop(g[a])}},getSelectedRelationships:function(){var a=this.table.getData();a=e.filter(a,d.hitch(this,function(b){return b.cbx}));return e.map(a,d.hitch(this,
function(b){return{relationship:b.relationship,label:b.label}}))},_initTable:function(){this.table=new p({autoHeight:!1,style:"height:277px",fields:[{name:"cbx",title:"",type:"checkbox",width:"40px"},{name:"relationship",title:"",type:"text",hidden:!0},{name:"nls",title:this.nls.relationship,type:"text"},{name:"label",title:this.nls.label,type:"text",editable:!0},{name:"actions",title:this.nls.actions,type:"actions",actions:["up","down"],width:"120px"}]});this.table.placeAt(this.tableDiv);var a=e.map(this.allRelationshipInfos,
d.hitch(this,function(b){return{cbx:!0,relationship:b.relationship,nls:b.nls,label:b.label}}));this.table.addRows(a)}})});