// 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/_base/lang dojo/dom-attr dojo/dom-class dojo/dom-construct dojo/dom-style dojo/on dojo/query jimu/dijit/CheckBox jimu/dijit/Popup ./settingComponents ./SettingObject".split(" "),function(f,r,g,t,h,u,m,v,k,w,x,e,y){return r(y,{_echoArea:null,_fieldMenuItems:[],_fieldsCheckBoxes:[],_fieldsPopup:null,_nls:null,_label:"",constructor:function(a,b,c,d,n,p,q,z){a=[];var l=[];this._nls=b;this._label=p;this._fieldMenuItems=z;this._echoArea=e.text("variable-width inline-block readOnlyTextField");
l.push(this._echoArea);b=e.iconButton("edit-button",b.tooltips.openFieldSelector);this.own(v(b,"click",g.hitch(this,this._onFieldsSelectorClick)));l.push(b);a.push(e.container("full-width flexbox","minorTrailingHorizGap",l));q&&a.push(e.text("hint",q));this._mainDiv=e.container("flexbox "+(c||""),"minorTrailingHorizGap",[e.container("inline-block "+(d?d:""),"",[e.text("static-text",p)]),e.container("inline-block "+(n?n:""),"minorTrailingVertGap",a)])},setDisplay:function(a){this._echoArea&&(this._echoArea.innerHTML=
Array.isArray(a)&&0<a.length?a.join(","):"")},setConfig:function(){var a=[];Array.isArray(this._config)&&0<this._config.length&&f.forEach(this._config,g.hitch(this,function(b){f.some(this._fieldMenuItems,function(c){return b===c.value?(a.push(c.label),!0):!1})}));this.setDisplay(a)},setFieldList:function(a){this._fieldMenuItems=a},_onFieldsSelectorClick:function(){var a=u.create("div",{style:{maxHeight:"480px"}});this._fieldsCheckBoxes=[];f.forEach(this._fieldMenuItems,g.hitch(this,function(b,c){var d=
new w({checked:this._arrayContains(this._config,b.value),label:b.label});h.add(d.domNode,"fields-checkbox");h.add(d.labelNode,"jimu-ellipsis");t.set(d.domNode,"title",b.label);0===c%3&&(window.isRTL?m.set(d.domNode,"marginRight",0):m.set(d.domNode,"marginLeft",0));d.placeAt(a);k(d.domNode).data("fieldName",b.value);this._fieldsCheckBoxes.push(d)}));this._fieldsPopup=new x({titleLabel:this._label,autoHeight:!0,content:a,container:window.jimuConfig.layoutId,width:640,maxHeight:600,buttons:[{label:jimuNls.common.ok,
onClick:g.hitch(this,"_onSearchFieldsOk")},{label:jimuNls.common.cancel,classNames:["jimu-btn-vacation"]}],onClose:g.hitch(this,function(){this._fieldsPopup=null})});h.add(this._fieldsPopup.domNode,"jimu-widget-public-notification-setting-fields")},_arrayContains:function(a,b){return f.some(a,function(c){return c===b})},_onSearchFieldsOk:function(){var a=[],b=[];f.forEach(this._fieldsCheckBoxes,function(c){if(c.getValue()){var d=k(c.domNode).data("fieldName");a.push(d[0]);k(c.domNode).removeData();
b.push(c.label)}});this._config=a;this.setDisplay(b);this._fieldsPopup.close()}})});