(function(){"use strict";u8.Crm.Widgets.FieldValuePicker=function(e,t){this.ValuePicker(e,$.extend({},u8.Crm.Widgets.FieldValuePicker.defaults,t))};u8.Crm.Widgets.FieldValuePicker.defaults={keyProperty:"code",textProperty:"text",allowDeselect:true,emptyKey:0};u8.Crm.Widgets.FieldValuePicker.states=u8.Base.Widgets.ValuePicker.states;$.extend(u8.Crm.Widgets.FieldValuePicker.prototype,{getValue:function(){return this._model.getValue()},getParentValue:function(){return this._model.getParentValue()},setParentValue:function(e){this._model.setParentValue(e);return this},_onModelCreate:function(e,t){if(this._isDisposed){return}this.setItems(e.items)},_onModelUpdate:function(e,t){if(this._isDisposed){return}if(t.items){this.setItems(e.items)}}});u8.Crm.Widgets.FieldValuePicker.makeClass({name:"FieldValuePicker",deriveFrom:u8.Base.Widgets.ValuePicker,events:["Create","ItemsChange","ValueChange","SelectedItemChange"]});u8.Crm.Widgets.FieldValuePicker.override({setValue:function(e,t){if(!this._isCreated){this.value=t;return this}this._model.setValue(t);e(t);return this},_createModel:function(e,t){if(!("lockedCatalogMode"in this)){this.inheritProperty("lockedCatalogMode",u8.session.webConfigValues.get("Query_Analysis.ShowLockedCatalogValues")||u8.Crm.Catalogs.LockedCatalogMode.disable)}var i={id:this.id,allowNull:this.allowDeselect,infoAreaId:this.infoAreaId,fieldId:this.fieldId,value:this.value,order:this.itemsOrder,lockedCatalogMode:this.lockedCatalogMode,prependNullItem:this.allowDeselect,onCreate:function(i){this.setItems(i.items);e(t)}.ifAlive(this),onUpdate:this._onModelUpdate.bind(this)};if(typeof this.parentValue!="undefined"){i.parentValue=this.parentValue;delete this.parentValue}this._model=u8.services.catalogs.createItemsModel(i)}})})();