2 lines
9.3 KiB
JavaScript
2 lines
9.3 KiB
JavaScript
|
/*! elementor - v3.18.0 - 20-12-2023 */
|
||
|
"use strict";(self.webpackChunkelementor=self.webpackChunkelementor||[]).push([[413],{8073:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;class GridContainer extends elementorModules.frontend.handlers.Base{__construct(e){super.__construct(e),this.onDeviceModeChange=this.onDeviceModeChange.bind(this),this.updateEmptyViewHeight=this.updateEmptyViewHeight.bind(this)}isActive(){return elementorFrontend.isEditMode()}getDefaultSettings(){return{selectors:{gridOutline:".e-grid-outline",directGridOverlay:":scope > .e-grid-outline",boxedContainer:":scope > .e-con-inner",emptyView:".elementor-empty-view"},classes:{outline:"e-grid-outline",outlineItem:"e-grid-outline-item"}}}getDefaultElements(){const e=this.getSettings("selectors");return{outlineParentContainer:null,gridOutline:this.findElement(e.gridOutline),directChildGridOverlay:this.findElement(e.directGridOverlay),emptyView:this.findElement(e.emptyView)[0],container:this.$element[0]}}onInit(){super.onInit(),this.initLayoutOverlay(),this.updateEmptyViewHeight()}bindEvents(){elementorFrontend.elements.$window.on("resize",this.onDeviceModeChange),elementorFrontend.elements.$window.on("resize",this.updateEmptyViewHeight),this.addChildLifeCycleEventListeners()}unbindEvents(){this.removeChildLifeCycleEventListeners(),elementorFrontend.elements.$window.off("resize",this.onDeviceModeChange),elementorFrontend.elements.$window.off("resize",this.updateEmptyViewHeight)}initLayoutOverlay(){this.getCorrectContainer();const e=this.getSettings("selectors"),t="grid"===this.getElementSettings("container_type");this.elements.emptyView=this.findElement(e.emptyView)[0],t&&this.elements?.emptyView&&(this.elements.emptyView.style.display=this.shouldRemoveEmptyView()?"none":"block"),this.shouldDrawOutline()&&(this.removeExistingOverlay(),this.createOverlayContainer(),this.createOverlayItems())}shouldDrawOutline(){const{grid_outline:e}=this.getElementSettings();return e}getCorrectContainer(){const e=this.elements.container,t=this.getDefaultSettings(),{selectors:{boxedContainer:i}}=t;this.elements.outlineParentContainer=e.querySelector(i)||e}removeExistingOverlay(){this.elements.gridOutline?.remove()}createOverlayContainer(){const{outlineParentContainer:e}=this.elements,{classes:{outline:t}}=this.getDefaultSettings(),i=document.createElement("div");i.classList.add(t),e.appendChild(i),this.elements.gridOutline=i,this.setGridOutlineDimensions()}createOverlayItems(){const{gridOutline:e}=this.elements,{classes:{outlineItem:t}}=this.getDefaultSettings(),i=this.getMaxOutlineElementsNumber();for(let n=0;n<i;n++){const i=document.createElement("div");i.classList.add(t),e.appendChild(i)}}getDeviceGridDimensions(){const e=elementor.channels.deviceMode.request("currentMode");return{rows:this.getControlValues("grid_rows_grid",e,"grid-template-rows")||1,columns:this.getControlValues("grid_columns_grid",e,"grid-template-columns")||1}}setGridOutlineDimensions(){const{gridOutline:e}=this.elements,{rows:t,columns:i}=this.getDeviceGridDimensions();e.style.gridTemplateColumns=i.value,e.style.gridTemplateRows=t.value}getControlValues(e,t,i){const n=this.getElementSettings(),{unit:s,size:o}=n[e],{outlineParentContainer:r}=this.elements,l=elementorFrontend.utils.controls.getResponsiveControlValue(n,e,"size",t),d=this.getComputedStyle(r,i),a=d.split(" ").length;let h;return h="custom"===s&&"string"==typeof l||o<a?{value:d}:{value:`repeat(${a}, 1fr)`},h={...h,length:a},h}getComputedStyle(e,t){return window?.getComputedStyle(e,null).getPropertyValue(t)}onElementChange(e){this.isControlThatMayAffectEmptyViewHeight(e)&&this.updateEmptyViewHeight();let t=["grid_rows_grid","grid_columns_grid","grid_gaps","container_type","boxed_width","content_width","width","height","min_height","padding","grid_auto_flow"];t=this.getResponsiveControlNames(t),t.includes(e)&&this.initLayoutOverlay()}isControlThatMayAffectEmptyViewHeight(e){return 0===e.indexOf("grid_rows_grid")||0===e.indexOf("grid_columns_grid")||0===e.indexOf("grid_auto_flow")}getResponsiveControlNames(e){const t=elementorFrontend.breakpoints.getActiv
|