// 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/array dojo/_base/declare dojo/on dojo/query ./settingComponents ./SettingObject".split(" "),function(m,p,e,q,f,r){return p(r,{_inputControl:null,_isFlagged:!0,constructor:function(a,b,c,d,t,n,g,h,k){a=[];d=[{name:"selected",title:"",width:"32px",type:"checkbox",editable:!1},{name:"item",title:d,width:"auto",type:"text",editable:!1},{name:"actions",title:"",width:"40px",type:"actions",actions:["up","down"]}];"function"===typeof h&&(this._isFlagged=!1,d=d.slice(1),d[1].width="60px",
d[1].actions.push("delete"));c=f.tableCtl(c,{autoHeight:!0,selectable:"function"===typeof g,fields:d},t);a.push(c.div);this._inputControl=c.ctl;g&&this.own(e(this._inputControl,"row-select",g));h&&this.own(e(this._inputControl,"row-delete",h));k&&(this.own(e(this._inputControl,"row-up",function(l){k(l,!0)})),this.own(e(this._inputControl,"row-down",function(l){k(l,!1)})));n&&a.push(f.text("hint",n));this._mainDiv=f.container(b||"","minorTrailingVertGap",a)},addRowToTable:function(a){this._inputControl&&
this._inputControl.addRow(a)},selectTableRow:function(a){(a=this._getRowTR(a))&&this._inputControl.selectRow(a)},renameTableRow:function(a,b){(a=this._getRowTR(a))&&this._inputControl.editRow(a,{item:b})},setValue:function(a){this._inputControl&&(this._inputControl.addRows(this._isFlagged?this._convertTableConfigToTableLines(a):a),this.selectTableRow(0))},getValue:function(){if(this._inputControl){var a=this._inputControl.getData();return this._isFlagged?this._convertTableLinesToTableConfig(a):a}return null},
setConfig:function(){this._inputControl&&this._config&&this.setValue(this._config)},getConfig:function(a,b){this._inputControl&&(this._config=this.getValue())},_getRowTR:function(a){if(this._inputControl&&0<=a){var b=q(".simple-table-row",this._inputControl.domNode);return a<b.length?b[a]:null}return null},_convertTableConfigToTableLines:function(a){var b=a[0];return m.map(a.slice(1),function(c,d){return{item:c,selected:"1"===b[d]}})},_convertTableLinesToTableConfig:function(a){var b="";a=m.map(a,
function(c){b+=c.selected?"1":"0";return c.item});return a=[b].concat(a)}})});