/////////////////////////////////////////////////////////////////////////// // Copyright © 2014 - 2018 Esri. All Rights Reserved. // // Licensed under the Apache License Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. /////////////////////////////////////////////////////////////////////////// define([ 'dojo/_base/html', 'dojo/_base/declare', 'dojo/text!./PredefinedValueProvider.html', 'dojo/_base/lang', 'dojo/on', 'jimu/dijit/Popup', // 'jimu/dijit/PopupSimple', './PredefinedValuePopup', './ValueProvider' ], function(html, declare, template, lang, on, Popup, PredefinedValuePopup, ValueProvider) { return declare([ValueProvider], { templateString: template, nls: null, url: '', layerDefinition: null, partObj: null, fieldInfo: null, codedValues: null, staticValues: null, layerInfo: null, popupInfo: null, operatorInfo: null, filterCodedValueIfPossible: false, runtime: false, providerType: null, //required valueProvider:null, postCreate: function(){ this.inherited(arguments); this.jimuNls = window.jimuNls; html.addClass(this.domNode, 'jimu-filter-indexBtn-value-provider'); html.addClass(this.valueProviderPopupNode, 'value-type-popup'); html.setStyle(this.valueProviderPopupNode, 'display', 'none'); var tips = ''; if(this.providerType === 'UNIQUE_PREDEFINED_VALUE_PROVIDER'){ tips = this.nls.predefinedUniqueTips; }else if(this.providerType === 'MULTIPLE_PREDEFINED_VALUE_PROVIDER'){ tips = this.nls.predefinedMultipleTips; } this.indexBtnTips.title = tips; this.indexBtnTips.innerText = tips + ' ...'; this._initProvider(); this._bindEvent(); }, _initProvider:function(){ var args = { preDefinedTips: this.indexBtnTips, nls: this.nls, url: this.url, layerDefinition: this.layerDefinition, partObj: this.partObj, fieldInfo: this.fieldInfo, codedValues: this.codedValues, staticValues: this.staticValues, layerInfo: this.layerInfo, popupInfo: this.popupInfo, operatorInfo: this.operatorInfo, filterCodedValueIfPossible: this.filterCodedValueIfPossible, runtime: this.runtime, selectUI: this.selectUI, providerType: this.providerType }; if(this.providerType === 'UNIQUE_PREDEFINED_VALUE_PROVIDER' || this.providerType === 'MULTIPLE_PREDEFINED_VALUE_PROVIDER'){ this.valueProvider = new PredefinedValuePopup(args); }else{ } //set applyBtn's state of popup. this.valueProvider.on("predefinedValuePopup_setApplyBtnState", lang.hitch(this, function(state){ if(this.popup){ if(state){ this.popup.enableButton(0); }else{ this.popup.disableButton(0); } } })); }, _bindEvent: function(){ // this.own(on(document, 'click', lang.hitch(this, function(){ // html.setStyle(this.valueProviderPopupNode, 'display', 'none'); // }))); //hover /* this.own(on(this.indexBtn, 'mouseenter', lang.hitch(this, function(){ var vals = lang.clone(this.valueObjEnd.value); if(vals.length === 0){ return; } var content = '', cList = '', suffix = ''; if(vals.length > 5){ suffix = '