Your IP : 18.216.161.178


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

BX.namespace("BX.UI");if(BX.Type.isUndefined(BX.UI.EntityFieldIcon)){BX.UI.EntityFieldIcon=function(e={}){this.editor=e.editor??{};this.mode=e.mode??null;this.fieldId=e.fieldId??null;this.fieldType=e.fieldType??null;this.isFieldMultiple=e.isFieldMultiple??null;this.fieldInnerWrapper=e.fieldInnerWrapper??null;this.isUserField=e.isUserField??false;this.target=e.target??null;this.context=undefined;this.isCheckedParams=BX.Type.isDomNode(this.fieldInnerWrapper)&&BX.Type.isStringFilled(this.fieldId);this.onAddressFieldInitiated=this.onAddressFieldInitiated.bind(this)};BX.UI.EntityFieldIcon.prototype={onAddressFieldInitiated({data:e}){const t=e.fieldConfig.fieldName.replace("[]","");if(t!==this.fieldId){return}if(this.mode===BX.UI.EntityEditorMode.edit){return}const i=this.getContextFromAdditionalFieldsData();if(!i){return}this.renderFieldValueIcon(i)},renderFieldValueIcon(){if(!this.isUserField&&!this.isFieldMultiple&&this.target){this.appendIcon(this.target,0);return}const e=this.fieldInnerWrapper.querySelectorAll(".fields");if(e.length===0){return}const t=e[0];if(!t.children){return}const i=this.getFieldTypesUsingDataset();const n=this.fieldType;const s=i.includes(n)&&this.isFieldMultiple;const d=[...t.children].filter((e=>BX.Dom.hasClass(e,"field-item")));d.forEach(((e,t)=>{const i=s?e.dataset.id:t;this.appendIcon(e,i)}))},getFieldTypesUsingDataset(){return[BX.UI.EntityUserFieldType.enumeration,BX.UI.EntityUserFieldType.employee,BX.UI.EntityUserFieldType.crm,BX.UI.EntityUserFieldType.crmStatus,BX.UI.EntityUserFieldType.iblockElement,BX.UI.EntityUserFieldType.iblockSection,BX.UI.EntityUserFieldType.file]},hasContextIconForFieldValue(e=0){const t=this.getContextFromAdditionalFieldsData();if(!BX.Type.isObjectLike(t)){return false}if(!this.isCheckedParams){return false}const i=this.fieldId;const n=t.fields[i];if(!n){return false}return BX.Type.isStringFilled(n[e])},appendIcon(e,t){const i=this.getIconNode(t);if(!BX.Type.isDomNode(i)){return}BX.Dom.append(i,e)},getIconNode(e=0){if(!this.hasContextIconForFieldValue(e)){return null}const t=this.getContextFromAdditionalFieldsData();const i=this.fieldId;const n=t.fields[i];const s=t.data.find((t=>Number(t.id)===Number(n[e])));return this.renderIcon(s)},getContextFromAdditionalFieldsData(){if(this.context===undefined){const e=this.editor.getAdditionalFieldsData();const t=e.context;this.context=BX.Type.isObjectLike(t)?t:null}return this.context},renderIcon(e){return BX.Tag.render`
				<img class="ui-entity-editor-content-block-field-context-icon" alt="" src="${e.iconSvg}" >
			`}}}
//# sourceMappingURL=field-icon.map.js