@codeperate/app-asset
Version:
Codeperate App Asset
1 lines • 1.15 kB
JavaScript
import{r as t,h as s,H as e,a as i}from"./p-511e9258.js";import{m as a}from"./p-801ac344.js";const l=class{constructor(s){t(this,s),this.modals=[],this.markedClear=[]}componentWillLoad(){this.unsubscribe=a(this.config.store,this,(t=>({modals:t.CdpModalModel.modals})))}disconnectedCallback(){this.unsubscribe&&this.unsubscribe()}markedClearHandler(){this.markedClear.length>0&&(this.config.store.dispatch.CdpModalModel.clear(this.markedClear),this.markedClear.splice(0,this.markedClear.length))}async componentDidUpdate(){}render(){return s(e,{class:"absolute block top-0 left-0 w-full"+(this.modals.length>0?" h-full":"")},s("div",{class:"sticky w-full top-0 left-0"+(this.modals.length>0?" h-screen":"")},this.modals.map(((t,e)=>{var i,a;return s("cdp-modal",{props:{display:!t.close},config:null!==(i=t.config)&&void 0!==i?i:null===(a=this.config)||void 0===a?void 0:a.defaultModalConfig,onClosed:s=>{this.markedClear=[...this.markedClear,e],t.onClosed&&t.onClosed(s)},onOpened:s=>{t.onOpened&&t.onOpened(s)}},t.content)}))))}get rootEl(){return i(this)}static get watchers(){return{markedClear:["markedClearHandler"]}}};export{l as cdp_modal_rematch}