Your IP : 13.58.134.142


Current Path : /var/www/www-root/data/www/monolith-realty.ru/bitrix/js/ui/entity-editor/js/
Upload File :
Current File : /var/www/www-root/data/www/monolith-realty.ru/bitrix/js/ui/entity-editor/js/field-selector.min.js

BX.namespace("BX.UI");if(BX.Type.isUndefined(BX.UI.EntityEditorFieldSelector)){BX.UI.EntityEditorFieldSelector=function(){this._id="";this._settings={};this._scheme=null;this._excludedNames=null;this._currentSchemeElementName="";this.checkboxList=null;this.defaultSectionKey="default-section";this.categories=[];this.options=[]};BX.UI.EntityEditorFieldSelector.prototype={initialize:function(e,t){this._id=e;this._settings=t?t:{};this._scheme=BX.prop.get(this._settings,"scheme",null);if(!this._scheme){throw"BX.UI.EntityEditorFieldSelector. Parameter 'scheme' is not found."}this._excludedNames=BX.prop.getObject(this._settings,"excludedNames",{})},getMessage:function(e){return BX.prop.getString(BX.UI.EntityEditorFieldSelector.messages,e,e)},isSchemeElementEnabled:function(e,t){const i=e.getName();const s=t.getName();const n=this._excludedNames[i];if(BX.Type.isArrayFilled(n)){return!n.includes(s)}return true},addClosingListener:function(e){BX.Event.EventEmitter.subscribe("BX.UI.EntityEditorFieldSelector:close",e)},removeClosingListener:function(e){BX.Event.EventEmitter.unsubscribe("BX.UI.EntityEditorFieldSelector:close",e)},isOpened:function(){return this.checkboxList&&this.checkboxList.isShown()},setExcludedNames:function(e){this._excludedNames=e},setCurrentSchemeElementName:function(e){this._currentSchemeElementName=e},open:function(){if(this.isOpened()){return}BX.Runtime.loadExtension("ui.dialogs.checkbox-list").then((()=>{this.checkboxList=this.createFieldsSelector();this.checkboxList.show()}))},createFieldsSelector:function(){this.initCheckboxListParams();this.prepareElements();this.prepareHiddenElements();const{_settings:e,categories:t,options:i}=this;const s=this.getDefaultSections();return new BX.UI.CheckboxList({columnCount:3,lang:{title:BX.prop.getString(e,"title",""),acceptBtn:BX.Loc.getMessage("UI_ENTITY_EDITOR_SELECT"),placeholder:BX.Loc.getMessage("UI_ENTITY_EDITOR_FIELD_SEARCH_PLACEHOLDER"),emptyStateTitle:BX.Loc.getMessage("UI_ENTITY_EDITOR_FIELD_EMPTY_STATE_TITLE"),emptyStateDescription:BX.Loc.getMessage("UI_ENTITY_EDITOR_FIELD_EMPTY_STATE_DESCRIPTION"),allSectionsDisabledTitle:BX.Loc.getMessage("UI_ENTITY_EDITOR_FIELD_ALL_SECTIONS_DISABLED")},sections:s,categories:t,options:i,params:{destroyPopupAfterClose:true,useSearch:BX.prop.getBoolean(e,"useFieldsSearch",true),showBackToDefaultSettings:BX.prop.getBoolean(e,"showBackToDefaultSettings",false),useSectioning:BX.Type.isStringFilled(s[0].title)},events:{onApply:e=>this.onApplyCheckboxList(e.data.fields),onCancel:e=>this.onCancelCheckboxList()}})},initCheckboxListParams:function(){this.categories=[];this.options=[]},prepareElements:function(){const e=this._scheme.getElements();e.forEach((e=>{const t=e.getElements();t.forEach((e=>{const t=[];const i=e.getElements();i.forEach((i=>{if(!this.isSchemeElementEnabled(e,i)){return}if(i.isTransferable()&&i.getName()!==""){t.push(i)}}));if(!BX.Type.isArrayFilled(t)){return}this.categories.push({title:e.getTitle(),sectionKey:this.defaultSectionKey,key:e.getName()});t.forEach((t=>this.addOption(t,e)))}))}))},prepareHiddenElements:function(){const e=BX.prop.getArray(this._settings,"hiddenElements",[]);if(!BX.Type.isArrayFilled(e)){return}const t={title:BX.Loc.getMessage("UI_ENTITY_EDITOR_SECTION_WITH_HIDDEN_FIELDS"),sectionKey:this.defaultSectionKey,key:"hidden"};this.categories.push(t);e.forEach((e=>this.addOption(e,null,t)))},addOption:function(e,t=null,i=null){this.options.push({title:e.getTitle(),value:false,categoryKey:this.getSectionName(t,i),defaultValue:false,id:this.getElementId(e,t)})},getElementId:function(e,t=null){return this.getSectionName(t)+"\\"+e.getName()},getSectionName:function(e=null,t=null){if(t){return t.key}return e?e.getName():this._currentSchemeElementName},getDefaultSections:function(){return[{key:this.defaultSectionKey,title:BX.prop.getString(this._settings,"buttonTitle",null),value:true}]},onApplyCheckboxList:function(e){BX.Event.EventEmitter.emit("BX.UI.EntityEditorFieldSelector:close",{sender:this,isCanceled:false,items:this.getSelectedItems(e)})},onCancelCheckboxList:function(){BX.Event.EventEmitter.emit("BX.UI.EntityEditorFieldSelector:close",{sender:this,isCanceled:true})},getSelectedItems:function(e){const t=[];e.forEach((e=>{if(!BX.Type.isStringFilled(e)){return}const i=e.split("\\");if(i.length>=2){t.push({sectionName:i[0],fieldName:i[1]})}}));return t}};if(BX.Type.isUndefined(BX.UI.EntityEditorFieldSelector.messages)){BX.UI.EntityEditorFieldSelector.messages={}}BX.UI.EntityEditorFieldSelector.create=function(e,t){const i=new BX.UI.EntityEditorFieldSelector(e,t);i.initialize(e,t);return i}}if(typeof BX.UI.EntityEditorUserSelector==="undefined"){BX.UI.EntityEditorUserSelector=function(){this._id="";this._settings={}};BX.UI.EntityEditorUserSelector.prototype={initialize:function(e,t){this._id=e;this._settings=t?t:{};this._isInitialized=false;this._onlyUsers=BX.prop.getBoolean(this._settings,"onlyUsers",true)},getId:function(){return this._id},open:function(e){if(this._mainWindow&&this._mainWindow===BX.SocNetLogDestination.containerWindow){return}if(!this._isInitialized){BX.SocNetLogDestination.init({name:this._id,extranetUser:false,userSearchArea:"I",bindMainPopup:{node:e,offsetTop:"5px",offsetLeft:"15px"},callback:{select:BX.delegate(this.onSelect,this),unSelect:BX.delegate(this.onSelect,this)},showSearchInput:BX.prop.getBoolean(this._settings,"showSearchInput",true),departmentSelectDisable:this._onlyUsers?true:false,items:{users:BX.UI.EntityEditorUserSelector.users,groups:{},sonetgroups:this._onlyUsers?{}:BX.UI.EntityEditorUserSelector.socnetGroups,department:BX.UI.EntityEditorUserSelector.department,departmentRelation:BX.SocNetLogDestination.buildDepartmentRelation(BX.UI.EntityEditorUserSelector.department)},itemsLast:BX.UI.EntityEditorUserSelector.last,itemsSelected:BX.prop.getObject(this._settings,"itemsSelected",{}),isCrmFeed:false,useClientDatabase:false,destSort:{},allowAddUser:false,allowSearchCrmEmailUsers:false,allowUserSearch:true});this._isInitialized=true}BX.SocNetLogDestination.openDialog(this._id,{bindNode:e});this._mainWindow=BX.SocNetLogDestination.containerWindow},close:function(){if(this._mainWindow&&this._mainWindow===BX.SocNetLogDestination.containerWindow){BX.SocNetLogDestination.closeDialog();this._mainWindow=null;this._isInitialized=false}},onSelect:function(e,t,i,s){if(this._onlyUsers&&t!=="users"){return}var n=BX.prop.getFunction(this._settings,"callback",null);if(n){n(this,e)}}};BX.UI.EntityEditorUserSelector.items={};BX.UI.EntityEditorUserSelector.create=function(e,t){var i=new BX.UI.EntityEditorUserSelector(e,t);i.initialize(e,t);this.items[i.getId()]=i;return i}}
//# sourceMappingURL=field-selector.map.js