// 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
require({cache:{"url:jimu/dijit/_filter/PredefinedValuePopup.html":'\x3cdiv\x3e\r\n   \x3c!--\r\n    \x3cselect data-dojo-attach-point\x3d"valProviderSelect" class\x3d"dijit-form-Select multiple-Select"  data-dojo-attach-event\x3d"onclick:_showPopup"\x3e\r\n    \x3c/select\x3e\r\n    --\x3e\r\n    \x3c!-- \x3cdiv class\x3d"subTitle"\x3e${CommonNls.layer}: \x3cspan data-dojo-attach-point\x3d"layerName"\x3e\x3c/span\x3e\x3c/div\x3e --\x3e\r\n    \x3cdiv class\x3d"jimu-filter-popup-btn jimu-not-selectable"\x3e\r\n      \x3c!-- \x3cdiv data-dojo-attach-point\x3d"listSelectStore" style\x3d"height:1px;visibility:hidden;overflow:hidden;"\x3e\x3c/div\x3e --\x3e\r\n\r\n      \x3c!-- for list select popup --\x3e\r\n      \x3c!-- \x3cdiv class\x3d"add-label-btn" data-dojo-attach-event\x3d"click:_showPopup"\x3e --\x3e\r\n      \x3c!-- for eidtTable --\x3e\r\n      \x3cdiv class\x3d"add-label-btn" data-dojo-attach-event\x3d"click:_createTarget"\x3e\r\n        \x3cdiv class\x3d"icon"\x3e\x3c/div\x3e\r\n        \x3cdiv class\x3d"tip"\x3e${CommonNls.add}\x3c/div\x3e\r\n      \x3c/div\x3e\r\n      \x3c!--\r\n      \x3cdiv class\x3d"add-btn" data-dojo-attach-event\x3d"click:_showPopup"\x3e\r\n        \x3cdiv class\x3d"tip"\x3eopenLayer-temp\x3c/div\x3e\r\n      \x3c/div\x3e\r\n\r\n      \x3cdiv class\x3d"add-btn add-btn-right" data-dojo-attach-event\x3d"click:_createTarget"\x3e\r\n        \x3cdiv class\x3d"tip"\x3e${CommonNls.add}\x3c/div\x3e\r\n      \x3c/div\x3e\r\n       --\x3e\r\n    \x3c/div\x3e\r\n    \x3cdiv data-dojo-attach-point\x3d"tableContent"\x3e\x3c/div\x3e\r\n    \x3cdiv class\x3d"displayTypes" data-dojo-attach-point\x3d"displayTypes" data-dojo-attach-event\x3d"click:_changeDisplayType"\x3e\r\n      \x3cdiv class\x3d"title jimu-ellipsis"\x3e${Nls.displayAs}\x3c/div\x3e\r\n      \x3cspan class\x3d"option dropdownOption"\x3e\r\n        \x3cdiv class\x3d"radio"\x3e\x3c/div\x3e\r\n        \x3cdiv class\x3d"label jimu-ellipsis"\x3e${Nls.aDrowdownList}\x3c/div\x3e\r\n      \x3c/span\x3e\r\n      \x3cspan class\x3d"option expandedOption"\x3e\r\n      \x3cdiv class\x3d"radio"\x3e\x3c/div\x3e\r\n      \x3cdiv class\x3d"label jimu-ellipsis"\x3e${Nls.aExpandedList}\x3c/div\x3e\r\n      \x3c/span\x3e\r\n    \x3c/div\x3e\r\n    \x3c!--\r\n    \x3cdiv class\x3d"jimu-multiple-set-container"\x3e\r\n      \x3cdiv data-dojo-attach-point\x3d"" class\x3d"items-list-content items-list-header"  \x3e\r\n        \x3cdiv class\x3d"item"\x3e\r\n          \x3cdiv class\x3d"label jimu-ellipsis"\x3e${CommonNls.name}\x3c/div\x3e\r\n          \x3cdiv class\x3d"label jimu-ellipsis"\x3e${CommonNls.label}\x3c/div\x3e\r\n          \x3cdiv class\x3d"label checkboxHeader jimu-ellipsis" title\x3d"set default?"\x3e${CommonNls.defaults}\x3c/div\x3e\r\n          \x3cdiv class\x3d"label lableR jimu-ellipsis"\x3e${CommonNls.actions}\x3c/div\x3e\r\n        \x3c/div\x3e\r\n      \x3c/div\x3e\r\n      \x3cdiv data-dojo-attach-point\x3d"listContent" class\x3d"items-list-content" data-dojo-attach-event\x3d"click:_onListContentClicked"\x3e\r\n      \x3c/div\x3e\r\n    \x3c/div\x3e\r\n    --\x3e\r\n\r\n    \x3cdiv class\x3d"value-type-popup" data-dojo-attach-point\x3d"valuesPopupNode" style\x3d"display:none;"\x3e\r\n      \x3c!-- \x3cdiv data-dojo-attach-point\x3d"mutiValuesSelect" multiple\x3d"true" data-dojo-type\x3d"dojox/form/CheckedMultiSelect" data-dojo-props\x3d\'searchAttr:"label",required:false,intermediateChanges:true\' style\x3d"width:100%;" \x3e\x3c/div\x3e --\x3e\r\n      \x3cdiv data-dojo-attach-point\x3d"pageControlContainer"\x3eLoad more data\x3c/div\x3e\r\n\r\n    \x3c/div\x3e\r\n\r\n    \x3c!-- \x3ca data-dojo-attach-event\x3d"onclick:_setSelectType" class\x3d"popupOper" style\x3d"display:none;"\x3etype\x3c/a\x3e --\x3e\r\n  \x3c/div\x3e'}});
define("dojo/_base/lang dojo/Deferred dojo/_base/html dojo/_base/array dojo/_base/declare dojo/Evented dojo/query ./ValueProvider ./EditTable ./AdvancedListValueSelect dijit/_TemplatedMixin dijit/_WidgetsInTemplateMixin dojo/text!./PredefinedValuePopup.html dojo/store/Memory jimu/utils jimu/dijit/Popup jimu/dijit/_filter/pageControlForQuery dojox/form/CheckedMultiSelect".split(" "),function(c,n,d,p,q,r,h,t,u,l,v,w,x,y,k,m,z,A){return q([t,v,w,r],{templateString:x,codedValues:null,staticValues:null,
showNullValues:!1,cbxPopup:null,pageSize:1E3,pageIndex:1,selectUI:null,postMixInProperties:function(){this.inherited(arguments);this.CommonNls=window.jimuNls.common;this.Nls=window.jimuNls.filterBuilder;this.emptyStr=window.apiNls.widgets.FeatureTable.empty},postCreate:function(){this.inherited(arguments);this.selectUI=this.selectUI?this.selectUI:"dropdown";d.addClass(this.domNode,"jimu-filter-mutcheck-list-value-provider");this.controlType="unique";"MULTIPLE_PREDEFINED_VALUE_PROVIDER"===this.providerType&&
(this.controlType="multiple");this.isNumberField=k.isNumberField(this.fieldInfo.type);this.editTable||(this.editTable=new u({tableType:this.controlType,dataList:[],codedValues:this.codedValues,emptyStr:this.emptyStr,customValue:this.Nls.addValuePlaceHolder,customLabel:this.Nls.addLabelPlaceHolder,isNumberField:this.isNumberField}),this.editTable.placeAt(this.tableContent),this.editTable.on("editTable_openListSelectByName",c.hitch(this,this._showListSelectByTable)),this.editTable.on("editTable_itemChanged",
c.hitch(this,this._editTableItemChanged)),this.editTable.on("editTable_getValLabelsArrayForNumber",c.hitch(this,this._getValLabelsArrayForNumber)));this.supportPaing=!0;this.pageControlForQuery||(this.pageControlForQuery=new z({pageSize:this.pageSize,pageIndex:1,layerUrl:this.url,fieldInfo:this.fieldInfo,queryWhere:"1\x3d1",layerDefinition:this.layerDefinition,fieldPopupInfo:this.fieldPopupInfo,isNumberField:this.isNumberField}));this.listSelect||(this.listSelect=new l({emptyStr:this.emptyStr,runtime:this.runtime,
pageSize:this.pageSize,selectType:"unique",controlType:"predefined",dataList:[],selectedDataList:[],isNumberField:this.isNumberField}),this.listSelect.on("advancedListValueSelect_itemChecked",c.hitch(this,this._createTarget)),this.listSelect.on("advancedListValueSelect_itemUnChecked",c.hitch(this,this._destoryTarget)),this.listSelect.on("advancedListValueSelect_addNextPage",c.hitch(this,this._addNextPage)),this.listSelect.on("advancedListValueSelect_searchKey",c.hitch(this,this._searchKey)),this.listSelect.on("advancedListValueSelect_searchKeyLocal",
c.hitch(this,this._searchKeyLocal)),this.listSelect.on("advancedListValueSelect_itemCheckedForPredefined",c.hitch(this,this._createTargetForPredefined)));this.mutiValuesSelect||(this.mutiValuesSelect=new A({multiple:!0,required:!1,intermediateChanges:!0,style:{width:"100%"}}));this._multipleSelectProviderEventHandler=c.hitch(this,this._multipleSelectProviderEvent);document.addEventListener("click",this._multipleSelectProviderEventHandler);var a=new y({idProperty:"id",data:[]});this.listSelect.set("store",
a)},_multipleSelectProviderEvent:function(a){var b=a.target||a.srcElement,e=d.isDescendant(b,this.editTable.searchBtn);this.editTable&&this.cbxPopup&&this.cbxPopup.domNode?(e?"block"===d.getStyle(this.cbxPopup.domNode,"display")?d.setStyle(this.cbxPopup.domNode,"display","none"):d.setStyle(this.cbxPopup.domNode,"display","block"):d.isDescendant(b,this.cbxPopup.domNode)||this._createTargetForPredefined(),a.stopPropagation()):this._isInSelectPopup(b)||this.runtime?a.stopPropagation():d.setStyle(this.valuesPopupNode,
"display","none")},_initAdvancedListValueSelect:function(){this.pageControlForQuery.pageIndex=1;this.pageControlForQuery.isKeyQueryLoader=!1;this.listSelect=new l({emptyStr:this.emptyStr,runtime:this.runtime,pageSize:this.pageSize,isCacheFinish:this.pageControlForQuery._isUniqueValueCacheFinish,selectType:"unique",controlType:"predefined",dataList:[],selectedDataList:[],isNumberField:this.isNumberField});this.listSelect.on("advancedListValueSelect_itemChecked",c.hitch(this,this._createTarget));this.listSelect.on("advancedListValueSelect_itemUnChecked",
c.hitch(this,this._destoryTarget));this.listSelect.on("advancedListValueSelect_addNextPage",c.hitch(this,this._addNextPage));this.listSelect.on("advancedListValueSelect_searchKey",c.hitch(this,this._searchKey));this.listSelect.on("advancedListValueSelect_searchKeyLocal",c.hitch(this,this._searchKeyLocal));this.listSelect.on("advancedListValueSelect_itemCheckedForPredefined",c.hitch(this,this._createTargetForPredefined))},_isInSelectPopup:function(a){for(var b="dijitCheckBoxInput dojoxMultiSelectItemLabel dojoxMultiSelectItemBox dojoxMultiSelectItem dojoxCheckedMultiSelectWrapper dojoxCheckedMultiSelect value-type-popup popupOper pageItem".split(" "),
e=!1,f=0;f<=b.length;f++)if(d.hasClass(a,b[f])){e=!0;break}return e},_createTarget:function(){this.editTable._createTarget("","","","",!0);this._editTableItemChanged()},_createTargetForPredefined:function(a,b){this.editTable._setNewLabel(a,b);this.cbxPopup.close();this._editTableItemChanged()},_destoryTarget:function(a){this.editTable._destroyTarget(a);this._editTableItemChanged()},_editTableItemChanged:function(){if(!this.runtime){var a=this.getValueObject();this._setApplyState(a.value.length)}},
_setApplyState:function(a){this.emit("predefinedValuePopup_setApplyBtnState",a)},_cbxWidth:245,_cbxHeight:340,isPopupLoading:!1,_showListSelectByTable:function(a){if(!this.isPopupLoading){this._initAdvancedListValueSelect();this.valueList=[a];this.getCheckedList(this.valueList);a=d.position(this.editTable.searchBtn);var b=a.x-226,e=a.y+30;window.isRTL&&(b=a.x);this.cbxPopup=new m({width:this._cbxWidth,height:this._cbxHeight,content:this.listSelect.domNode,enableMoveable:!1,hasTitle:!1,hasOverlay:!1,
contentHasNoMargin:!0,moveToCenter:!1,customPosition:{left:b,top:e},useFocusLogic:!1,buttons:[]});this.cbxPopup.setDomNodeStyls({"border-radius":0,border:"1px solid #999"});this.cbxPopup.on("popupHasInitedSuccessfully",c.hitch(this,function(){var f=d.position(this.editTable.searchBtn),g=f.x-226,B=f.y+30;window.isRTL&&(g=f.x);this.cbxPopup.setCustomPosition(g,B)}));this.listSelect.valueInput&&this.listSelect.valueInput.focus();this._showLoadingIcon();this.isPopupLoading=!0;this._valueLabels().then(c.hitch(this,
function(f){this.isPopupLoading=!1;this._hideLoadingIcon();if(!0!==f){var g=!1;this.valueList&&0!==this.valueList.length&&(g=!0);this.listSelect.setCBXData(f,g)}}))}},_valueLabels:function(){var a=new n;this.listSelect.codedValues=!1;this.listSelect.disPlayLabel="label";if(this.staticValues)return this._setValueForStaticValues(this.staticValues),a.resolve(!0),a;if(this.codedValues)if(this.filterCodedValue)this.listSelect.codedValues=!0;else return this._setValueForStaticValues(this.codedValues),a.resolve(!0),
a;this.pageControlForQuery.queryByPage(!0).then(c.hitch(this,function(b){a.resolve(b)}),c.hitch(this,function(b){console.log(b);this._hideLoadingIcon();a.reject(b)}));return a},_setValueForStaticValues:function(a){this.listSelect.codedValues=!0;a&&(this.pageControlForQuery._codedvalueCache=a,a=0<a.length?a:[],this.listSelect.setCBXData(a,!0,!0))},_changeDisplayType:function(a){a=a.target||a.srcElement;a=d.hasClass(a,"option")?a:k.getAncestorDom(a,function(b){return d.hasClass(b,"option")},2);d.hasClass(a,
"checked")||(d.addClass(a,"checked"),a=h("."+this.selectUI+"Option ",this.displayTypes)[0],d.removeClass(a,"checked"),this.selectUI="expanded"===this.selectUI?"dropdown":"expanded")},_setDisplayTypeStyle:function(){var a=h(".title",this.displayTypes)[0],b=h(".label",this.displayTypes);a=(d.getStyle(this.displayTypes,"width")-d.getStyle(a,"width")-80)/2;var e=d.getStyle(b[0],"width");e=e<a?e:a;var f=d.getStyle(b[1],"width");f=f<a?f:a;d.setStyle(b[0],"width",e+"px");d.setStyle(b[1],"width",f+"px")},
_addNextPage:function(){this.listSelect&&(this._showLoadingIcon(),this.pageControlForQuery.queryByPage(this.listSelect.ifFristPage).then(c.hitch(this,function(a){this.listSelect.isCacheFinish=this.pageControlForQuery._isUniqueValueCacheFinish;this.listSelect.setCBXData(a,!0);this._hideLoadingIcon()}),c.hitch(this,function(a){console.log(a);this._hideLoadingIcon()})))},_searchKey:function(a){this.listSelect&&(this._showLoadingIcon(),this.pageControlForQuery._searchKey(a).then(c.hitch(this,function(b){this.listSelect.setCBXContentBySearch(b);
this._hideLoadingIcon()}),c.hitch(this,function(b){console.log(b);this._hideLoadingIcon()})))},_searchKeyLocal:function(a){this.listSelect&&(this._showLoadingIcon(),a=this.pageControlForQuery._searchKeyLocal(a),this.listSelect.setCBXContentBySearch(a),this._hideLoadingIcon())},_handlerPageValues:function(){},getCheckedList:function(a){this.listSelect.checkedList=[];this.isNumberField?p.forEach(a,c.hitch(this,function(b){this.listSelect.checkedList.push(parseFloat(b))})):this.listSelect.checkedList=
a},_showPopup:function(){var a=this.getValueObject().valueList;this.valueList=null===a?void 0:a;this.getCheckedList(this.valueList);this.cbxPopup?(this.listSelect.checkCBXItems(!1),this.cbxPopup.show()):(this.cbxPopup=new m({width:355,height:596,content:this.listSelect.domNode,titleLabel:this.layerDefinition.name+"("+this.fieldName+")",isResize:!1,useFocusLogic:!1,onClose:c.hitch(this,function(){this.cbxPopup.hide();return!1}),buttons:[]}),this._showLoadingIcon(),this.pageControlForQuery.queryByPage().then(c.hitch(this,
function(b){this._hideLoadingIcon();var e=!1;this.valueList&&0!==this.valueList.length&&(e=!0);this.listSelect.setCBXData(b,e)})))},getDijits:function(){return[this.mutiValuesSelect]},setValueObject:function(a){a.value=a.value?a.value:[];var b=h("."+(a.selectUI?a.selectUI:this.selectUI)+"Option ",this.displayTypes)[0];d.addClass(b,"checked");b=null;if(this.isNumberField){b=[];for(var e=0;e<a.value.length;e++)b.push(a.value[e].value);b=this._getValLabelsArrayForNumber(!1,b)}this.editTable.emptyLabel=
a.emptyLabel;this.editTable.enableEmpty=a.enableEmpty;this.editTable.setListValues(a.value,b)},_getValLabelsArrayForNumber:function(a,b){b=k._getValues(this.layerDefinition,this.fieldPopupInfo,this.fieldName,b);a&&(this.editTable.currentValLabel=b[0].label);return b},tryGetValueObject:function(){return this.isValidValue()?this.getValueObject():this.isEmptyValue()?{isValid:!0,selectUI:this.selectUI,type:this.partObj.valueObj.type,value:[],valueList:[]}:null},getValueObject:function(){if(this.isValidValue()){var a=
this.editTable.getListValues(),b={isValid:!0,selectUI:this.selectUI,type:this.partObj.valueObj.type,value:a.list,valueList:a.valueList};"unique"===this.controlType&&(b.emptyLabel=a.emptyLabel,b.enableEmpty=a.enableEmpty);return b}return null},setRequired:function(a){this.mutiValuesSelect.set("required",a)},queryByPage:function(){var a=this.pageControlForQuery.queryByPage(this.listSelect.ifFristPage);a.then(c.hitch(this,function(b){a.resolve(b)}),c.hitch(this,function(b){console.log(b);a.reject(b)}))},
_showLoadingIcon:function(){this.listSelect&&this.listSelect.listContainer&&d.addClass(this.listSelect.listContainer,"jimu-circle-loading")},_hideLoadingIcon:function(){this.listSelect&&this.listSelect.listContainer&&d.removeClass(this.listSelect.listContainer,"jimu-circle-loading")},destroy:function(){this._multipleSelectProviderEventHandler&&document.removeEventListener("click",this._multipleSelectProviderEventHandler);this.inherited(arguments)},destroyProvider:function(){this.editTable&&this.editTable.destroy();
this.listSelect&&this.listSelect.destroy();this.listSelect=null;this.destroy();d.destroy(this.domNode)}})});