| Current Path : /var/www/homesaver/www/bitrix/js/ui/popupcomponentsmaker/dist/ |
| Current File : /var/www/homesaver/www/bitrix/js/ui/popupcomponentsmaker/dist/popupcomponentsmaker.bundle.min.js |
this.BX=this.BX||{};(function(t,i,e,n,o){"use strict";let s=t=>t,a;class l extends e.EventEmitter{constructor(t={}){super();this.html=null;this.awaitContent=null;this.flex=null;this.withoutBackground=null;this.backgroundColor=null;this.backgroundImage=null;this.background=null;this.marginBottom=null;this.disabled=null;this.secondary=null;this.overflow=null;this.displayBlock=null;this.attrs=null;this.minHeight=null;this.sizeLoader=45;this.asyncSecondary=null;this.margin=null;this.setParams(t);this.layout={container:null};if(this.awaitContent){this.await()}}setParams(t={}){this.html=n.Type.isDomNode(t==null?void 0:t.html)?t.html:this.html;this.awaitContent=n.Type.isBoolean(t==null?void 0:t.awaitContent)?t==null?void 0:t.awaitContent:this.awaitContent;this.flex=n.Type.isNumber(t==null?void 0:t.flex)?t.flex:this.flex;this.withoutBackground=n.Type.isBoolean(t==null?void 0:t.withoutBackground)?t.withoutBackground:this.withoutBackground;this.background=n.Type.isString(t==null?void 0:t.background)?t.background:this.background;this.backgroundColor=n.Type.isString(t==null?void 0:t.backgroundColor)?t.backgroundColor:this.backgroundColor;this.backgroundImage=n.Type.isString(t==null?void 0:t.backgroundImage)?t.backgroundImage:this.backgroundImage;this.marginBottom=n.Type.isNumber(t==null?void 0:t.marginBottom)?t.marginBottom:this.marginBottom;this.disabled=n.Type.isBoolean(t==null?void 0:t.disabled)?t.disabled:this.disabled;this.secondary=n.Type.isBoolean(t==null?void 0:t.secondary)?t.secondary:this.secondary;this.overflow=n.Type.isBoolean(t==null?void 0:t.overflow)?t.overflow:this.overflow;this.displayBlock=n.Type.isBoolean(t==null?void 0:t.displayBlock)?t.displayBlock:this.displayBlock;this.attrs=n.Type.isPlainObject(t==null?void 0:t.attrs)?t.attrs:this.attrs;this.minHeight=n.Type.isString(t==null?void 0:t.minHeight)?t.minHeight:this.minHeight;this.margin=n.Type.isString(t.margin)?t.margin:this.margin;this.sizeLoader=n.Type.isNumber(t==null?void 0:t.sizeLoader)?t.sizeLoader:this.sizeLoader;this.asyncSecondary=(t==null?void 0:t.asyncSecondary)instanceof Promise?t.asyncSecondary:this.asyncSecondary}getLoader(){if(!this.loader){this.loader=new o.Loader({target:this.getContainer(),size:this.sizeLoader})}return this.loader}await(){this.getContainer().classList.add("--awaiting");this.showLoader()}stopAwait(){this.getContainer().classList.remove("--awaiting");this.hideLoader()}showLoader(){void this.getLoader().show()}hideLoader(){void this.getLoader().hide()}getContent(){if(this.html){return this.html}return""}updateContent(t){if(n.Type.isDomNode(t)){n.Dom.clean(this.getContainer());this.getContainer().appendChild(t)}}setBackgroundColor(t){if(n.Type.isString(t)){this.getContainer().style.backgroundColor=t}}getMarginBottom(){return this.marginBottom}getContainer(){if(!this.layout.container){this.layout.container=n.Tag.render(a||(a=s`
<div class="ui-popupcomponentmaker__content--section-item">${0}</div>
`),this.getContent())}if(this.background){this.layout.container.style.background=this.background}if(this.backgroundColor){this.layout.container.style.backgroundColor=this.backgroundColor}if(this.backgroundImage){this.layout.container.style.backgroundImage=this.backgroundImage}if(this.withoutBackground&&!this.backgroundColor&&!this.background){this.layout.container.classList.add("--transparent")}if(this.flex){this.layout.container.style.flex=this.flex}if(this.disabled){this.layout.container.classList.add("--disabled")}if(this.secondary){n.Dom.addClass(this.layout.container,"--secondary")}if(this.overflow){this.layout.container.classList.add("--overflow-hidden")}if(this.displayBlock){this.layout.container.classList.add("--block")}if(this.attrs){n.Dom.adjust(this.layout.container,{attrs:this.attrs})}if(this.minHeight){n.Dom.style(this.layout.container,"min-height",this.minHeight)}if(this.margin){n.Dom.style(this.layout.container,"margin",this.margin)}if(this.asyncSecondary){this.asyncSecondary.then((t=>{if(t===false){n.Dom.removeClass(this.layout.container,"--secondary")}else{n.Dom.addClass(this.layout.container,"--secondary")}}))}return this.layout.container}}let r=t=>t,d,h,u;class p{constructor({id:t,target:i,content:e,width:o,cacheable:s,contentPadding:a,padding:l,offsetTop:r,blurBackground:d,useAngle:h}){this.id=n.Type.isString(t)?t:null;this.target=n.Type.isElementNode(i)?i:null;this.content=e||null;this.contentWrapper=null;this.popup=null;this.loader=null;this.items=[];this.width=n.Type.isNumber(o)?o:null;this.cacheable=n.Type.isBoolean(s)?s:true;this.contentPadding=n.Type.isNumber(a)?a:0;this.padding=n.Type.isNumber(l)?l:13;this.offsetTop=n.Type.isNumber(r)?r:0;this.blurBlackground=n.Type.isBoolean(d)?d:false;this.useAngle=n.Type.isUndefined(h)||h!==false}getItems(){return this.items}getItem(t){if(t instanceof l){return t}t=new l(t);if(this.items.indexOf(t)===-1){this.items.push(t)}return t}getPopup(){if(!this.popup){const t=this.width?this.width:350;const o=this.id?this.id+"-popup":null;this.popup=new i.Popup(o,this.target,{className:"ui-popupcomponentmaker",contentBackground:"transparent",contentPadding:this.contentPadding,angle:this.useAngle?{offset:t/2-16}:false,offsetTop:this.offsetTop,width:t,offsetLeft:-(t/2)+(this.target?this.target.offsetWidth/2:0)+40,autoHide:true,closeByEsc:true,padding:this.padding,animation:"fading-slide",content:this.getContentWrapper(),cacheable:this.cacheable});if(this.blurBlackground){n.Dom.addClass(this.popup.getPopupContainer(),"popup-with-radius");this.setBlurBackground();e.EventEmitter.subscribe(e.EventEmitter.GLOBAL_TARGET,"BX.Intranet.Bitrix24:ThemePicker:onThemeApply",(()=>{setTimeout((()=>{this.setBlurBackground()}),200)}))}this.popup.getContentContainer().style.overflowX=null}return this.popup}isShown(){return this.getPopup().isShown()}getContentWrapper(){if(!this.contentWrapper){this.contentWrapper=n.Tag.render(d||(d=r`
<div class="ui-popupcomponentmaker__content"></div>
`));if(!this.content){return}this.content.map((t=>{var i;let e=this.getSection();if(t!=null&&t.marginBottom){n.Type.isNumber(t.marginBottom)?e.style.marginBottom=t.marginBottom+"px":null}if(t!=null&&t.className){n.Dom.addClass(e,t.className)}if(t!=null&&t.attrs){n.Dom.adjust(e,{attrs:t.attrs})}if(n.Type.isDomNode(t==null?void 0:t.html)){e.appendChild(this.getItem(t).getContainer());this.contentWrapper.appendChild(e)}if(n.Type.isArray(t==null?void 0:t.html)){let i=n.Tag.render(h||(h=r`
<div class="ui-popupcomponentmaker__content--section-item --flex-column --transparent"></div>
`));t.html.map((t=>{var o;if(t!=null&&(o=t.html)!=null&&o.then){this.adjustPromise(t,e);n.Type.isNumber(t==null?void 0:t.marginBottom)?e.style.marginBottom=t.marginBottom+"px":null}else{if(n.Type.isArray(t==null?void 0:t.html)){t.html.map((t=>{i.appendChild(this.getItem(t).getContainer())}));e.appendChild(i)}else{e.appendChild(this.getItem(t).getContainer())}}}));this.contentWrapper.appendChild(e)}if(n.Type.isFunction(t==null?void 0:(i=t.html)==null?void 0:i.then)){this.adjustPromise(t,e);this.contentWrapper.appendChild(e)}}))}return this.contentWrapper}adjustPromise(t,i){t.awaitContent=true;let e=this.getItem(t);if(i){var o;i.appendChild(e.getContainer());t==null?void 0:(o=t.html)==null?void 0:o.then((t=>{if(n.Type.isDomNode(t)){e.stopAwait();e.updateContent(t)}else if(n.Type.isPlainObject(t)&&n.Type.isDomNode(t.node)){if(n.Type.isPlainObject(t.options)){e.setParams(t.options)}e.stopAwait();e.updateContent(t.node)}}))}}getSection(){return n.Tag.render(u||(u=r`
<div class="ui-popupcomponentmaker__content--section"></div>
`))}setBlurBackground(){const t=this.getPopup().getPopupContainer();const i=window.getComputedStyle(document.body);const e=i.backgroundImage;const o=i.backgroundColor;if(n.Type.isDomNode(t)){n.Dom.addClass(t,"popup-window-blur")}let s=n.Dom.create("style",{attrs:{type:"text/css",id:"styles-widget-blur"}});let a=".popup-window-content:after { "+"background-image: "+e+";"+"background-color: "+o+"} ";a=document.createTextNode(a);s.appendChild(a);let l=".popup-window-angly:after { "+"background-color: "+o+"} ";l=document.createTextNode(l);s.appendChild(l);const r=document.head.querySelector("#styles-widget-blur");if(r){n.Dom.replace(r,s)}else{document.head.appendChild(s)}}show(){if(!n.Type.isDomNode(this.target)){return}this.getPopup().show()}close(){this.getPopup().close()}}t.PopupComponentsMakerItem=l;t.PopupComponentsMaker=p})(this.BX.UI=this.BX.UI||{},BX.Main,BX.Event,BX,BX);
//# sourceMappingURL=popupcomponentsmaker.bundle.map.js