%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/bitrix/www/bitrix/js/landing/ui/field/
Upload File :
Create Path :
Current File : /home/bitrix/www/bitrix/js/landing/ui/field/dropdown_preview_field.min.js

(function(){"use strict";BX.namespace("BX.Landing.UI.Field");var i=BX.Landing.UI.Tool.Menu;BX.Landing.UI.Field.DropdownPreview=function(i){this.items="items"in i&&i.items?i.items:{};BX.Landing.UI.Field.BaseField.apply(this,arguments);this.layout.classList.add("landing-ui-field-dropdown");this.layout.classList.add("landing-ui-field-dropdown-preview");this.frame=typeof i.frame==="object"?i.frame:null;this.format=typeof i.format==="function"?i.format:function(){};this.postfix=typeof i.postfix==="string"?i.postfix:"";this.property=typeof i.property==="string"?i.property:"";this.changeHandler=typeof i.onChange==="function"?i.onChange:function(){};this.elements=[];this.setValue(this.items[0].value,true);this.input.innerText=this.items[0].name;this.input.addEventListener("click",this.onInputClick.bind(this));this.onFrameLoad()};BX.Landing.UI.Field.DropdownPreview.CreateSelect=function(){return BX.create("select",{props:{className:"landing-ui-field-input landing-ui-field-dropdown"}})};BX.Landing.UI.Field.DropdownPreview.prototype={constructor:BX.Landing.UI.Field.DropdownPreview,__proto__:BX.Landing.UI.Field.BaseField.prototype,superClass:BX.Landing.UI.Field.BaseField,onInputClick:function(t){t.preventDefault();if(!this.popup){var e=this;var n=this.items.map(function(i){return{text:i.name,className:"landing-ui-field-dropdown-preview-item",menuShowDelay:0,subMenuOffsetX:10,items:[{text:'<div class="landing-ui-field-dropdown-preview-item-preview '+i.value+'">Text</div>',className:"landing-ui-field-dropdown-preview-item-child"}],onclick:function(){this.close();e.onChange(i)}}});this.popup=new i({id:this.selector+this.property,bindElement:this.input,autoHide:true,items:n,zIndex:9e3,angle:false,bindOptions:{forceBindPosition:true},events:{onPopupClose:function(){this.input.classList.remove("landing-ui-active")}.bind(this)}});this.input.parentNode.appendChild(this.popup.popupWindow.popupContainer)}this.input.classList.add("landing-ui-active");if(this.popup.popupWindow.isShown()){this.popup.close()}else{this.popup.show()}var s=BX.pos(this.input,this.input.parentNode);this.popup.popupWindow.popupContainer.style.top=s.bottom+"px";this.popup.popupWindow.popupContainer.style.left="0px";this.popup.popupWindow.popupContainer.style.right=""},onFrameLoad:function(){this.elements=[].slice.call(this.frame.document.querySelectorAll(this.selector));if(this.elements.length){this.items.some(function(i){if(this.elements[0].classList.contains(i.value)){this.setValue(i.value,true)}},this)}},onChange:function(i,t){this.setValue(i.value);this.input.innerText=i.name;if(!t){this.changeHandler(this.getValue(),this.items,this.postfix,this.property);BX.fireEvent(this.layout,"input")}},setValue:function(i){this.input.dataset.value=i},getValue:function(){return this.input.dataset.value}}})();

Zerion Mini Shell 1.0