| Current Path : /var/www/homesaver/www/bitrix/js/ui/layout-form/dist/ |
| Current File : /var/www/homesaver/www/bitrix/js/ui/layout-form/dist/layout-form.bundle.min.js |
this.BX=this.BX||{};(function(e,t,i,n,s){"use strict";class o extends s.EventEmitter{constructor(e){var t;super();this.setEventNamespace("BX.UI.LayoutForm");this.params=e!=null?e:{};this.container=(t=this.params.container)!=null?t:document.documentElement;this.nodes=null;this.init()}init(){this.nodes=[].slice.call(this.container.querySelectorAll("["+o.HIDDEN_ATTRIBUTE+"]"));this.nodes.forEach((e=>{t.Event.bind(e,"click",(t=>{t.preventDefault();this.toggleBLock(e);this.emit("onToggle",{checkbox:e.querySelector(o.CHECKBOX_SELECTOR)})}));e.querySelector(o.CHECKBOX_SELECTOR).style.pointerEvents="none";this.checkInitialBlockVisibility(e)}))}checkInitialBlockVisibility(e){const i=e.querySelector(o.CHECKBOX_SELECTOR);if(i&&i.checked){const i=e.nextElementSibling;if(i){i.style.height="auto";t.Dom.addClass(i,o.SHOW_CLASS)}}}toggleBLock(e){const i=e.querySelector(o.CHECKBOX_SELECTOR);if(i){const n=e.nextElementSibling;if(n){const e=n.scrollHeight;if(e>0){if(!i.checked){i.checked=true;n.style.height=e+"px";t.Dom.addClass(n,o.SHOW_CLASS);const s=()=>{n.style.height="auto";t.Event.unbind(n,"transitionend",s)};t.Event.bind(n,"transitionend",s)}else{i.checked=false;n.style.height=e+"px";requestAnimationFrame((()=>{n.style.height=0;t.Dom.removeClass(n,o.SHOW_CLASS)}))}}}}}}o.HIDDEN_ATTRIBUTE="data-form-row-hidden";o.SHOW_CLASS="ui-form-row-hidden-show";o.CHECKBOX_SELECTOR='.ui-ctl-element[type="checkbox"]';e.LayoutForm=o})(this.BX.UI=this.BX.UI||{},BX,BX,BX,BX.Event);
//# sourceMappingURL=layout-form.bundle.map.js