@gopowerteam/modal-render 0.0.29 → 0.0.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue");const N=Symbol("__MODAL__");function H(n){return e.getCurrentScope()?(e.onScopeDispose(n),!0):!1}function w(n){return typeof n=="function"?n():e.unref(n)}const z=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const I=Object.prototype.toString,W=n=>I.call(n)==="[object Object]",j=()=>{};function G(n,s={}){if(!e.isRef(n))return e.toRefs(n);const r=Array.isArray(n.value)?Array.from({length:n.value.length}):{};for(const t in n.value)r[t]=e.customRef(()=>({get(){return n.value[t]},set(a){var l;if((l=w(s.replaceRef))!=null?l:!0)if(Array.isArray(n.value)){const y=[...n.value];y[t]=a,n.value=y}else{const y={...n.value,[t]:a};Object.setPrototypeOf(y,Object.getPrototypeOf(n.value)),n.value=y}else n.value[t]=a}}));return r}function K(n){var s;const r=w(n);return(s=r==null?void 0:r.$el)!=null?s:r}const D=z?window:void 0;function P(...n){let s,r,t,a;if(typeof n[0]=="string"||Array.isArray(n[0])?([r,t,a]=n,s=D):[s,r,t,a]=n,!s)return j;Array.isArray(r)||(r=[r]),Array.isArray(t)||(t=[t]);const l=[],p=()=>{l.forEach(m=>m()),l.length=0},y=(m,h,i,f)=>(m.addEventListener(h,i,f),()=>m.removeEventListener(h,i,f)),C=e.watch(()=>[K(s),w(a)],([m,h])=>{if(p(),!m)return;const i=W(h)?{...h}:h;l.push(...r.flatMap(f=>t.map(c=>y(m,f,c,i))))},{immediate:!0,flush:"post"}),b=()=>{C(),p()};return H(b),b}function X(n,s={}){var r,t;const{pointerTypes:a,preventDefault:l,stopPropagation:p,exact:y,onMove:C,onEnd:b,onStart:m,initialValue:h,axis:i="both",draggingElement:f=D,containerElement:c,handle:v=n}=s,d=e.ref((r=w(h))!=null?r:{x:0,y:0}),k=e.ref(),E=u=>a?a.includes(u.pointerType):!0,x=u=>{w(l)&&u.preventDefault(),w(p)&&u.stopPropagation()},L=u=>{var S;if(!E(u)||w(y)&&u.target!==w(n))return;const _=w(c),B=(S=_==null?void 0:_.getBoundingClientRect)==null?void 0:S.call(_),o=w(n).getBoundingClientRect(),g={x:u.clientX-(_?o.left-B.left:o.left),y:u.clientY-(_?o.top-B.top:o.top)};(m==null?void 0:m(g,u))!==!1&&(k.value=g,x(u))},A=u=>{var S;if(!E(u)||!k.value)return;const _=w(c),B=(S=_==null?void 0:_.getBoundingClientRect)==null?void 0:S.call(_),o=w(n).getBoundingClientRect();let{x:g,y:M}=d.value;(i==="x"||i==="both")&&(g=u.clientX-k.value.x,_&&(g=Math.min(Math.max(0,g),B.width-o.width))),(i==="y"||i==="both")&&(M=u.clientY-k.value.y,_&&(M=Math.min(Math.max(0,M),B.height-o.height))),d.value={x:g,y:M},C==null||C(d.value,u),x(u)},T=u=>{E(u)&&k.value&&(k.value=void 0,b==null||b(d.value,u),x(u))};if(z){const u={capture:(t=s.capture)!=null?t:!0};P(v,"pointerdown",L,u),P(f,"pointermove",A,u),P(f,"pointerup",T,u)}return{...G(d),position:d,isDragging:e.computed(()=>!!k.value),style:e.computed(()=>`left:${d.value.x}px;top:${d.value.y}px;`)}}const R=n=>(e.pushScopeId("data-v-4af3c744"),n=n(),e.popScopeId(),n),Y={class:"title text-16px font-bold"},q={class:"action"},U=R(()=>e.createElementVNode("div",{id:"modal-header-slot"},null,-1)),J=R(()=>e.createElementVNode("div",{id:"modal-footer-slot"},null,-1)),Q={key:1,class:"modal-footer space-x-2"},Z=["form"],ee={key:2,class:"modal-loading"},te=R(()=>e.createElementVNode("div",{class:"lds-ring"},[e.createElementVNode("div"),e.createElementVNode("div"),e.createElementVNode("div"),e.createElementVNode("div")],-1)),oe=[te],ne={name:"ModalContainer",inheritAttrs:!0},re=e.defineComponent({...ne,props:{id:{},form:{},component:{},componentProps:{},width:{},maxWidth:{},maxHeight:{},sizes:{},size:{default:"middle"},fullscreen:{type:Boolean},title:{},header:{type:Boolean,default:!0},footer:{type:Boolean,default:!1},closeable:{type:Boolean,default:!0},esc:{type:Boolean,default:!1},maskClosable:{type:Boolean,default:!1},draggable:{type:Boolean,default:!1},mode:{default:"dialog"},type:{},offset:{},backgroundColor:{},bodyStyle:{},submitText:{default:"确定"},cancelText:{default:"取消"}},emits:["submit"],setup(n,{expose:s,emit:r}){const t=n,a=r,l=e.inject(N),p=e.ref(!1);let y=0,C=0;const b=e.shallowRef(),m=e.shallowRef(),h=e.shallowRef(),{x:i,y:f}=X(h,{initialValue:{x:0,y:0}});function c(){l==null||l.close(t.id)}function v(o){if(typeof o=="number")return`${o}px`;if(typeof o=="string")return o}const d=e.computed(()=>{const o={};return t.mode==="dialog"&&(o.justifyContent="center"),t.mode==="drawer"&&(o.justifyContent="flex-end"),o}),k=e.computed(()=>{const o={};return t.size&&(o.width=v(t.sizes[t.size])),t.width&&(o.width=v(t.width)),t.maxWidth&&(o.maxWidth=v(t.maxWidth)),t.fullscreen&&(o.maxWidth="unset",o.width="100%",o.position="fixed",o.top=0,o.left=0,o.bottom=0,o.right=0,o.borderRadius=0),t.draggable&&!t.fullscreen&&t.mode==="dialog"&&(o.transform=`translate3d(${i.value-y}px, ${f.value-C}px, 0px)`),t.mode==="drawer"&&(o.borderRadius=0,o.height="100%"),t.offset&&t.mode==="dialog"&&(o.marginLeft=`${t.offset.x||0}px`,o.marginTop=`${t.offset.y||0}px`),t.backgroundColor&&(o.backgroundColor=t.backgroundColor),o}),E=e.computed(()=>{const o={};return t.draggable&&!t.fullscreen&&t.mode==="dialog"&&(o.cursor="move"),o}),x=e.computed(()=>{var g;const o={};return t.maxHeight&&(o.maxHeight=`calc(${(g=v(t.maxHeight))==null?void 0:g.replace("%","vh")} - 50px)`),t.mode==="drawer"&&(o.maxHeight="unset",o.height=`calc(100% - ${(t.header?50:0)+(t.footer?50:0)}px)`),t.fullscreen&&(o.maxHeight="unset",o.height=`calc(100% - ${(t.header?50:0)+(t.footer?50:0)}px)`),t.type!=="component"&&(o.padding="0"),t.bodyStyle&&Object.assign(o,t.bodyStyle),o});function L(){const o=m.value;if(t.form&&o){const g=o.querySelector(`form[name="${t.form}"]`);g&&g.dispatchEvent(new Event("submit"))}a("submit")}function A(){l==null||l.close(t.id)}function T(){window&&window.addEventListener("resize",()=>{e.triggerRef(b),e.triggerRef(m),m.value&&(y=m.value.offsetLeft,C=m.value.offsetTop)})}function u(){if(t.closeable&&t.esc){const o=({key:g})=>{g==="Escape"&&(l==null||l.close(t.id),window.removeEventListener("keydown",o))};window.addEventListener("keydown",o)}}function S(){y=m.value.offsetLeft,C=m.value.offsetTop}e.onMounted(()=>{u(),T()}),e.onUnmounted(()=>{});function _(){return p.value=!0,()=>B()}function B(){p.value=!1}return s({showLoading:_,hideLoading:B}),(o,g)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"wrapperRef",ref:b,class:"modal-wrapper",style:e.normalizeStyle(d.value),onClick:g[0]||(g[0]=e.withModifiers(M=>o.maskClosable&&c(),["self"]))},[e.createElementVNode("div",{ref_key:"contentRef",ref:m,class:e.normalizeClass(["modal-content",{[`${o.mode}-mode`]:!0}]),style:e.normalizeStyle(k.value)},[o.header?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"headerRef",ref:h,class:"modal-header",style:e.normalizeStyle(E.value),onMousedown:S},[e.createElementVNode("div",Y,e.toDisplayString(o.title),1),e.createElementVNode("div",q,[o.closeable?(e.openBlock(),e.createElementBlock("div",{key:0,class:"i-icon-park-outline:close block cursor-pointer",onClick:c})):e.createCommentVNode("",!0)])],36)):e.createCommentVNode("",!0),U,e.createElementVNode("div",{class:"modal-body",style:e.normalizeStyle(x.value)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.component),e.normalizeProps(e.guardReactiveProps(o.componentProps)),null,16))],4),J,o.footer?(e.openBlock(),e.createElementBlock("div",Q,[e.createElementVNode("button",{class:"cancel-button",type:"button",onClick:A},e.toDisplayString(o.cancelText),1),e.createElementVNode("button",{class:"submit-button",form:o.form,type:"submit",onClick:L},e.toDisplayString(o.submitText),9,Z)])):e.createCommentVNode("",!0),p.value?(e.openBlock(),e.createElementBlock("div",ee,oe)):e.createCommentVNode("",!0)],6)],4))}});const $=(n,s)=>{const r=n.__vccOpts||n;for(const[t,a]of s)r[t]=a;return r},O=$(re,[["__scopeId","data-v-4af3c744"]]),le={class:"modal-dialog"},ie={class:"dialog-body"},se={class:"dialog-title"},ae={class:"dialog-content"},ce=e.defineComponent({__name:"modal-dialog",props:{type:{},title:{},content:{},okText:{default:"确定"},cancelText:{default:"取消"},onOk:{},onCancel:{},footer:{}},setup(n){const s=n,r=F(),t=e.computed(()=>s.title?s.title:{confirm:"提示",info:"提示",warning:"警告",error:"错误",success:"成功"}[s.type]);async function a(){s.onOk&&await s.onOk(),r.close()}async function l(){s.onCancel&&await s.onCancel(),r.close()}return(p,y)=>(e.openBlock(),e.createElementBlock("section",le,[e.createElementVNode("div",ie,[e.createElementVNode("div",se,e.toDisplayString(t.value),1),e.createElementVNode("div",ae,e.toDisplayString(p.content),1)]),e.createElementVNode("div",{class:"dialog-footer space-x-2",style:e.normalizeStyle(p.type==="confirm"?{"justify-content":"end"}:{"border-top":"none"})},[p.footer?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(p.footer),{key:0})):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("button",{class:"submit-button",type:"submit",onClick:a},e.toDisplayString(p.okText),1),p.type==="confirm"?(e.openBlock(),e.createElementBlock("button",{key:0,class:"cancel-button",type:"button",onClick:l},e.toDisplayString(p.cancelText),1)):e.createCommentVNode("",!0)],64))],4)]))}});const de=$(ce,[["__scopeId","data-v-8326e5a5"]]),ue={key:0,class:"modal-teleport"},fe={name:"ModalProvider",inheritAttrs:!0},pe=e.defineComponent({...fe,props:{appendToBody:{type:[Boolean,String],default:!1},sizes:{default:()=>({small:520,middle:860,large:1190})},maxWidth:{default:"90%"},maxHeight:{default:"90%"},offset:{default:()=>({x:0,y:0})}},setup(n,{expose:s}){const r=e.shallowRef([]),t=e.ref(!1),a=e.getCurrentInstance();function l(i,f={},c={}){const v=e.defineAsyncComponent(()=>Promise.resolve(typeof i=="string"?de:i));typeof i=="string"&&(f.type=i,c.size="small",c.fullscreen=!1,c.mode="dialog",c.footer=!1,c.header=!1);const d=Math.random().toString(32).slice(2),k=new Promise((E,x)=>{r.value.push({id:d,component:v,props:f||{},options:{...c,type:typeof i=="string"?i:"component"},resolve:E,reject:x,listeners:[]}),e.triggerRef(r)}).catch(E=>E==="CANCEL"?new Promise(()=>{}):Promise.reject(E));return Object.assign(k,{close:()=>p(d)})}function p(i,f){const c=r.value.findIndex(d=>d.id===i);if(c<0)return;const v=r.value[c];f===void 0?v==null||v.reject("CANCEL"):v==null||v.resolve(f),r.value.splice(c,1),e.triggerRef(r)}function y(){!r.value||r.value.length===0||(r.value.forEach(i=>{i==null||i.reject("CANCEL")}),r.value=[],e.triggerRef(r))}function C(i,f){const c=r.value.find(d=>d.id===i);if(!c)return;const v=c.listeners.find(d=>d.event===f);v&&v.callback({open:l,close:d=>p(c.id,d),closeAll:y,showLoading:()=>b(c.id),hideLoading:()=>m(c.id),confirm:d=>l("confirm",d),success:d=>l("success",d),error:d=>l("error",d),warning:d=>l("warning",d),info:d=>l("info",d)})}function b(i){if(!a)return;const[f]=a.refs[`modal-container_${i}`];if(f)return f.showLoading()}function m(i){if(!a)return;const[f]=a.refs[`modal-container_${i}`];if(f)return f.hideLoading()}function h(i,f,c){const v=r.value.find(d=>d.id===i);v&&v.listeners.push({event:f,callback:c})}return e.provide(N,{open:l,close:p,closeAll:y,addEventListener:h}),s({elements:r,open:l,close:p,closeAll:y}),e.onMounted(()=>{t.value=!0}),(i,f)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.renderSlot(i.$slots,"default",{},void 0,!0),t.value?(e.openBlock(),e.createElementBlock("div",ue,[(e.openBlock(),e.createBlock(e.Teleport,{disabled:!i.appendToBody,to:typeof i.appendToBody=="string"?i.appendToBody:"body"},[e.createVNode(e.TransitionGroup,{name:"modal-fade"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,c=>(e.openBlock(),e.createBlock(O,e.mergeProps({id:c.id,key:c.id,ref_for:!0,ref:`modal-container_${c.id}`,component:c.component,"component-props":c.props,"max-height":i.maxHeight,"max-width":i.maxWidth,offset:i.offset,sizes:i.sizes},c.options,{onSubmit:()=>C(c.id,"submit")}),null,16,["id","component","component-props","max-height","max-width","offset","sizes","onSubmit"]))),128))]),_:1})],8,["disabled","to"]))])):e.createCommentVNode("",!0)],64))}});const me=$(pe,[["__scopeId","data-v-241a8304"]]);const ve={},ye={class:"modal-footer"};function ge(n,s){return e.openBlock(),e.createBlock(e.Teleport,{to:"#modal-footer-slot"},[e.createElementVNode("div",ye,[e.renderSlot(n.$slots,"default",{},void 0,!0)])])}const he=$(ve,[["render",ge],["__scopeId","data-v-2080a86e"]]);const _e={},we={class:"modal-header"};function ke(n,s){return e.openBlock(),e.createBlock(e.Teleport,{to:"#modal-header-slot"},[e.createElementVNode("div",we,[e.renderSlot(n.$slots,"default",{},void 0,!0)])])}const Ce=$(_e,[["render",ke],["__scopeId","data-v-d0247172"]]);function V(n,s){var t,a;let r=n==null?void 0:n.parent;for(;r&&((t=r==null?void 0:r.type)==null?void 0:t.name)!==s;)r=r.parent;return((a=r==null?void 0:r.type)==null?void 0:a.name)===s?r:null}function F(){const n=e.inject(N),s=e.getCurrentInstance();function r(t,a,l){if(!n)throw new Error("Not Found Modal Provider Component");return n.open(t,a,l)}return{open:r,close(t){var p;if(!n)throw new Error("Not Found Modal Provider Component");const a=V(s,"ModalContainer"),l=(p=a==null?void 0:a.props)==null?void 0:p.id;if(!l)throw new Error("Not Found Current Modal Container");n.close(l,t)},closeAll(){if(!n)throw new Error("Not Found Modal Provider Component");n.closeAll()},showLoading(){var l;if(!n)throw new Error("Not Found Modal Provider Component");const t=V(s,"ModalContainer");if(!((l=t==null?void 0:t.props)==null?void 0:l.id))throw new Error("Not Found Current Modal Container");t!=null&&t.exposed&&(t==null||t.exposed.showLoading())},hideLoading(){var l;if(!n)throw new Error("Not Found Modal Provider Component");const t=V(s,"ModalContainer");if(!((l=t==null?void 0:t.props)==null?void 0:l.id))throw new Error("Not Found Current Modal Container");t!=null&&t.exposed&&(t==null||t.exposed.hideLoading())},confirm(t){return this.open("confirm",t)},info(t){return this.open("info",t)},error(t){return this.open("error",t)},warning(t){return this.open("warning",t)},success(t){return this.open("success",t)}}}function be(n){var l;const s=e.inject(N),r=e.getCurrentInstance(),t=V(r,"ModalContainer"),a=(l=t==null?void 0:t.props)==null?void 0:l.id;s&&a&&s.addEventListener(a,"submit",n)}exports.ModalContainer=O;exports.ModalFooter=he;exports.ModalHeader=Ce;exports.ModalKey=N;exports.ModalProvider=me;exports.onSubmit=be;exports.useModal=F;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue");const A=Symbol("__MODAL__");function W(o){return e.getCurrentScope()?(e.onScopeDispose(o),!0):!1}function k(o){return typeof o=="function"?o():e.unref(o)}const j=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const U=Object.prototype.toString,J=o=>U.call(o)==="[object Object]",Q=()=>{};function Z(o,s={}){if(!e.isRef(o))return e.toRefs(o);const n=Array.isArray(o.value)?Array.from({length:o.value.length}):{};for(const t in o.value)n[t]=e.customRef(()=>({get(){return o.value[t]},set(c){var i;if((i=k(s.replaceRef))!=null?i:!0)if(Array.isArray(o.value)){const m=[...o.value];m[t]=c,o.value=m}else{const m={...o.value,[t]:c};Object.setPrototypeOf(m,Object.getPrototypeOf(o.value)),o.value=m}else o.value[t]=c}}));return n}function ee(o,s=!0){e.getCurrentInstance()?e.onMounted(o):s?o():e.nextTick(o)}function R(o){var s;const n=k(o);return(s=n==null?void 0:n.$el)!=null?s:n}const O=j?window:void 0;function F(...o){let s,n,t,c;if(typeof o[0]=="string"||Array.isArray(o[0])?([n,t,c]=o,s=O):[s,n,t,c]=o,!s)return Q;Array.isArray(n)||(n=[n]),Array.isArray(t)||(t=[t]);const i=[],u=()=>{i.forEach(v=>v()),i.length=0},m=(v,d,l,f)=>(v.addEventListener(d,l,f),()=>v.removeEventListener(d,l,f)),y=e.watch(()=>[R(s),k(c)],([v,d])=>{if(u(),!v)return;const l=J(d)?{...d}:d;i.push(...n.flatMap(f=>t.map(a=>m(v,f,a,l))))},{immediate:!0,flush:"post"}),_=()=>{y(),u()};return W(_),_}function te(){const o=e.ref(!1);return e.getCurrentInstance()&&e.onMounted(()=>{o.value=!0}),o}function oe(o){const s=te();return e.computed(()=>(s.value,!!o()))}function ne(o,s={}){var n,t;const{pointerTypes:c,preventDefault:i,stopPropagation:u,exact:m,onMove:y,onEnd:_,onStart:v,initialValue:d,axis:l="both",draggingElement:f=O,containerElement:a,handle:g=o}=s,p=e.ref((n=k(d))!=null?n:{x:0,y:0}),b=e.ref(),E=h=>c?c.includes(h.pointerType):!0,B=h=>{k(i)&&h.preventDefault(),k(u)&&h.stopPropagation()},D=h=>{var M;if(!E(h)||k(m)&&h.target!==k(o))return;const w=k(a),N=(M=w==null?void 0:w.getBoundingClientRect)==null?void 0:M.call(w),x=k(o).getBoundingClientRect(),S={x:h.clientX-(w?x.left-N.left:x.left),y:h.clientY-(w?x.top-N.top:x.top)};(v==null?void 0:v(S,h))!==!1&&(b.value=S,B(h))},T=h=>{var M;if(!E(h)||!b.value)return;const w=k(a),N=(M=w==null?void 0:w.getBoundingClientRect)==null?void 0:M.call(w),x=k(o).getBoundingClientRect();let{x:S,y:V}=p.value;(l==="x"||l==="both")&&(S=h.clientX-b.value.x,w&&(S=Math.min(Math.max(0,S),N.width-x.width))),(l==="y"||l==="both")&&(V=h.clientY-b.value.y,w&&(V=Math.min(Math.max(0,V),N.height-x.height))),p.value={x:S,y:V},y==null||y(p.value,h),B(h)},$=h=>{E(h)&&b.value&&(b.value=void 0,_==null||_(p.value,h),B(h))};if(j){const h={capture:(t=s.capture)!=null?t:!0};F(g,"pointerdown",D,h),F(f,"pointermove",T,h),F(f,"pointerup",$,h)}return{...Z(p),position:p,isDragging:e.computed(()=>!!b.value),style:e.computed(()=>`left:${p.value.x}px;top:${p.value.y}px;`)}}function re(o,s,n={}){const{window:t=O,...c}=n;let i;const u=oe(()=>t&&"ResizeObserver"in t),m=()=>{i&&(i.disconnect(),i=void 0)},y=e.computed(()=>Array.isArray(o)?o.map(d=>R(d)):[R(o)]),_=e.watch(y,d=>{if(m(),u.value&&t){i=new ResizeObserver(s);for(const l of d)l&&i.observe(l,c)}},{immediate:!0,flush:"post",deep:!0}),v=()=>{m(),_()};return W(v),{isSupported:u,stop:v}}function z(o,s={width:0,height:0},n={}){const{window:t=O,box:c="content-box"}=n,i=e.computed(()=>{var d,l;return(l=(d=R(o))==null?void 0:d.namespaceURI)==null?void 0:l.includes("svg")}),u=e.ref(s.width),m=e.ref(s.height),{stop:y}=re(o,([d])=>{const l=c==="border-box"?d.borderBoxSize:c==="content-box"?d.contentBoxSize:d.devicePixelContentBoxSize;if(t&&i.value){const f=R(o);if(f){const a=t.getComputedStyle(f);u.value=Number.parseFloat(a.width),m.value=Number.parseFloat(a.height)}}else if(l){const f=Array.isArray(l)?l:[l];u.value=f.reduce((a,{inlineSize:g})=>a+g,0),m.value=f.reduce((a,{blockSize:g})=>a+g,0)}else u.value=d.contentRect.width,m.value=d.contentRect.height},n);ee(()=>{const d=R(o);d&&(u.value="offsetWidth"in d?d.offsetWidth:s.width,m.value="offsetHeight"in d?d.offsetHeight:s.height)});const _=e.watch(()=>R(o),d=>{u.value=d?s.width:0,m.value=d?s.height:0});function v(){y(),_()}return{width:u,height:m,stop:v}}const le=o=>(e.pushScopeId("data-v-eaa553bd"),o=o(),e.popScopeId(),o),se={class:"title text-16px font-bold"},ie={class:"action"},ae=["form"],ce={key:2,class:"modal-loading"},de=le(()=>e.createElementVNode("div",{class:"lds-ring"},[e.createElementVNode("div"),e.createElementVNode("div"),e.createElementVNode("div"),e.createElementVNode("div")],-1)),ue=[de],fe={name:"ModalContainer",inheritAttrs:!0},pe=e.defineComponent({...fe,props:{id:{},form:{},component:{},componentProps:{},width:{},maxWidth:{},maxHeight:{},sizes:{},size:{default:"middle"},fullscreen:{type:Boolean},title:{},header:{type:Boolean,default:!0},footer:{type:Boolean,default:!1},closeable:{type:Boolean,default:!0},esc:{type:Boolean,default:!1},maskClosable:{type:Boolean,default:!1},draggable:{type:Boolean,default:!1},mode:{default:"dialog"},type:{},offset:{},backgroundColor:{},bodyStyle:{},submitText:{default:"确定"},cancelText:{default:"取消"}},emits:["submit"],setup(o,{expose:s,emit:n}){const t=o,c=n,i=e.inject(A),u=e.ref(!1);let m=0,y=0;const _=e.shallowRef(),v=e.shallowRef(),d=e.shallowRef(),l=e.shallowRef(),f=e.shallowRef(),a=e.shallowRef(),{height:g}=z(d),{height:p}=z(l),{height:b}=z(f),{height:E}=z(a),{x:B,y:D}=ne(d,{initialValue:{x:0,y:0}});function T(){i==null||i.close(t.id)}function $(r){if(typeof r=="number")return`${r}px`;if(typeof r=="string")return r}const h=e.computed(()=>{const r={};return t.mode==="dialog"&&(r.justifyContent="center"),t.mode==="drawer"&&(r.justifyContent="flex-end"),r}),M=e.computed(()=>{const r={};return t.size&&(r.width=$(t.sizes[t.size])),t.width&&(r.width=$(t.width)),t.maxWidth&&(r.maxWidth=$(t.maxWidth)),t.fullscreen&&(r.maxWidth="unset",r.width="100%",r.position="fixed",r.top=0,r.left=0,r.bottom=0,r.right=0,r.borderRadius=0),t.draggable&&!t.fullscreen&&t.mode==="dialog"&&(r.transform=`translate3d(${B.value-m}px, ${D.value-y}px, 0px)`),t.mode==="drawer"&&(r.borderRadius=0,r.height="100%"),t.offset&&t.mode==="dialog"&&(r.marginLeft=`${t.offset.x||0}px`,r.marginTop=`${t.offset.y||0}px`),t.backgroundColor&&(r.backgroundColor=t.backgroundColor),r}),w=e.computed(()=>{const r={};return t.draggable&&!t.fullscreen&&t.mode==="dialog"&&(r.cursor="move"),r}),N=e.computed(()=>{var H;const r={},C=b.value+E.value+g.value+p.value;return t.maxHeight&&(r.maxHeight=`calc(${(H=$(t.maxHeight))==null?void 0:H.replace("%","vh")} - ${C}px)`),t.mode==="drawer"&&(r.maxHeight="unset",r.height=`calc(100% - ${C}px)`),t.fullscreen&&(r.maxHeight="unset",r.height=`calc(100% - ${C}px)`),t.type!=="component"&&(r.padding="0"),t.bodyStyle&&Object.assign(r,t.bodyStyle),r});function x(){const r=v.value;if(t.form&&r){const C=r.querySelector(`form[name="${t.form}"]`);C&&C.dispatchEvent(new Event("submit"))}c("submit")}function S(){i==null||i.close(t.id)}function V(){window&&window.addEventListener("resize",()=>{e.triggerRef(_),e.triggerRef(v),v.value&&(m=v.value.offsetLeft,y=v.value.offsetTop)})}function X(){if(t.closeable&&t.esc){const r=({key:C})=>{C==="Escape"&&(i==null||i.close(t.id),window.removeEventListener("keydown",r))};window.addEventListener("keydown",r)}}function Y(){m=v.value.offsetLeft,y=v.value.offsetTop}e.onMounted(()=>{X(),V()}),e.onUnmounted(()=>{});function q(){return u.value=!0,()=>I()}function I(){u.value=!1}return s({showLoading:q,hideLoading:I}),(r,C)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"wrapperRef",ref:_,class:"modal-wrapper",style:e.normalizeStyle(h.value),onClick:C[0]||(C[0]=e.withModifiers(H=>r.maskClosable&&T(),["self"]))},[e.createTextVNode(e.toDisplayString(e.unref(b))+" ",1),e.createElementVNode("div",{ref_key:"contentRef",ref:v,class:e.normalizeClass(["modal-content",{[`${r.mode}-mode`]:!0}]),style:e.normalizeStyle(M.value)},[r.header?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"headerRef",ref:d,class:"modal-header",style:e.normalizeStyle(w.value),onMousedown:Y},[e.createElementVNode("div",se,e.toDisplayString(r.title),1),e.createElementVNode("div",ie,[r.closeable?(e.openBlock(),e.createElementBlock("div",{key:0,class:"i-icon-park-outline:close block cursor-pointer",onClick:T})):e.createCommentVNode("",!0)])],36)):e.createCommentVNode("",!0),e.createElementVNode("div",{id:"modal-header-slot",ref_key:"headerSlotRef",ref:f},null,512),e.createElementVNode("div",{class:"modal-body",style:e.normalizeStyle(N.value)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.component),e.normalizeProps(e.guardReactiveProps(r.componentProps)),null,16))],4),e.createElementVNode("div",{id:"modal-footer-slot",ref_key:"footerSlotRef",ref:a},null,512),r.footer?(e.openBlock(),e.createElementBlock("div",{key:1,ref_key:"footerRef",ref:l,class:"modal-footer space-x-2"},[e.createElementVNode("button",{class:"cancel-button",type:"button",onClick:S},e.toDisplayString(r.cancelText),1),e.createElementVNode("button",{class:"submit-button",form:r.form,type:"submit",onClick:x},e.toDisplayString(r.submitText),9,ae)],512)):e.createCommentVNode("",!0),u.value?(e.openBlock(),e.createElementBlock("div",ce,ue)):e.createCommentVNode("",!0)],6)],4))}});const L=(o,s)=>{const n=o.__vccOpts||o;for(const[t,c]of s)n[t]=c;return n},G=L(pe,[["__scopeId","data-v-eaa553bd"]]),me={class:"modal-dialog"},he={class:"dialog-body"},ve={class:"dialog-title"},ge={class:"dialog-content"},ye=e.defineComponent({__name:"modal-dialog",props:{type:{},title:{},content:{},okText:{default:"确定"},cancelText:{default:"取消"},onOk:{},onCancel:{},footer:{}},setup(o){const s=o,n=K(),t=e.computed(()=>s.title?s.title:{confirm:"提示",info:"提示",warning:"警告",error:"错误",success:"成功"}[s.type]);async function c(){s.onOk&&await s.onOk(),n.close()}async function i(){s.onCancel&&await s.onCancel(),n.close()}return(u,m)=>(e.openBlock(),e.createElementBlock("section",me,[e.createElementVNode("div",he,[e.createElementVNode("div",ve,e.toDisplayString(t.value),1),e.createElementVNode("div",ge,e.toDisplayString(u.content),1)]),e.createElementVNode("div",{class:"dialog-footer space-x-2",style:e.normalizeStyle(u.type==="confirm"?{"justify-content":"end"}:{"border-top":"none"})},[u.footer?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(u.footer),{key:0})):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("button",{class:"submit-button",type:"submit",onClick:c},e.toDisplayString(u.okText),1),u.type==="confirm"?(e.openBlock(),e.createElementBlock("button",{key:0,class:"cancel-button",type:"button",onClick:i},e.toDisplayString(u.cancelText),1)):e.createCommentVNode("",!0)],64))],4)]))}});const _e=L(ye,[["__scopeId","data-v-8326e5a5"]]),we={key:0,class:"modal-teleport"},be={name:"ModalProvider",inheritAttrs:!0},ke=e.defineComponent({...be,props:{appendToBody:{type:[Boolean,String],default:!1},sizes:{default:()=>({small:520,middle:860,large:1190})},maxWidth:{default:"90%"},maxHeight:{default:"90%"},offset:{default:()=>({x:0,y:0})}},setup(o,{expose:s}){const n=e.shallowRef([]),t=e.ref(!1),c=e.getCurrentInstance();function i(l,f={},a={}){const g=e.defineAsyncComponent(()=>Promise.resolve(typeof l=="string"?_e:l));typeof l=="string"&&(f.type=l,a.size="small",a.fullscreen=!1,a.mode="dialog",a.footer=!1,a.header=!1);const p=Math.random().toString(32).slice(2),b=new Promise((E,B)=>{n.value.push({id:p,component:g,props:f||{},options:{...a,type:typeof l=="string"?l:"component"},resolve:E,reject:B,listeners:[]}),e.triggerRef(n)}).catch(E=>E==="CANCEL"?new Promise(()=>{}):Promise.reject(E));return Object.assign(b,{close:()=>u(p)})}function u(l,f){const a=n.value.findIndex(p=>p.id===l);if(a<0)return;const g=n.value[a];f===void 0?g==null||g.reject("CANCEL"):g==null||g.resolve(f),n.value.splice(a,1),e.triggerRef(n)}function m(){!n.value||n.value.length===0||(n.value.forEach(l=>{l==null||l.reject("CANCEL")}),n.value=[],e.triggerRef(n))}function y(l,f){const a=n.value.find(p=>p.id===l);if(!a)return;const g=a.listeners.find(p=>p.event===f);g&&g.callback({open:i,close:p=>u(a.id,p),closeAll:m,showLoading:()=>_(a.id),hideLoading:()=>v(a.id),confirm:p=>i("confirm",p),success:p=>i("success",p),error:p=>i("error",p),warning:p=>i("warning",p),info:p=>i("info",p)})}function _(l){if(!c)return;const[f]=c.refs[`modal-container_${l}`];if(f)return f.showLoading()}function v(l){if(!c)return;const[f]=c.refs[`modal-container_${l}`];if(f)return f.hideLoading()}function d(l,f,a){const g=n.value.find(p=>p.id===l);g&&g.listeners.push({event:f,callback:a})}return e.provide(A,{open:i,close:u,closeAll:m,addEventListener:d}),s({elements:n,open:i,close:u,closeAll:m}),e.onMounted(()=>{t.value=!0}),(l,f)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.renderSlot(l.$slots,"default",{},void 0,!0),t.value?(e.openBlock(),e.createElementBlock("div",we,[(e.openBlock(),e.createBlock(e.Teleport,{disabled:!l.appendToBody,to:typeof l.appendToBody=="string"?l.appendToBody:"body"},[e.createVNode(e.TransitionGroup,{name:"modal-fade"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,a=>(e.openBlock(),e.createBlock(G,e.mergeProps({id:a.id,key:a.id,ref_for:!0,ref:`modal-container_${a.id}`,component:a.component,"component-props":a.props,"max-height":l.maxHeight,"max-width":l.maxWidth,offset:l.offset,sizes:l.sizes},a.options,{onSubmit:()=>y(a.id,"submit")}),null,16,["id","component","component-props","max-height","max-width","offset","sizes","onSubmit"]))),128))]),_:1})],8,["disabled","to"]))])):e.createCommentVNode("",!0)],64))}});const Ce=L(ke,[["__scopeId","data-v-241a8304"]]);const Ee={},xe={class:"modal-footer"};function Se(o,s){return e.openBlock(),e.createBlock(e.Teleport,{to:"#modal-footer-slot"},[e.createElementVNode("div",xe,[e.renderSlot(o.$slots,"default",{},void 0,!0)])])}const Be=L(Ee,[["render",Se],["__scopeId","data-v-2080a86e"]]);const Me={},Ne={class:"modal-header"};function Re(o,s){return e.openBlock(),e.createBlock(e.Teleport,{to:"#modal-header-slot"},[e.createElementVNode("div",Ne,[e.renderSlot(o.$slots,"default",{},void 0,!0)])])}const $e=L(Me,[["render",Re],["__scopeId","data-v-d0247172"]]);function P(o,s){var t,c;let n=o==null?void 0:o.parent;for(;n&&((t=n==null?void 0:n.type)==null?void 0:t.name)!==s;)n=n.parent;return((c=n==null?void 0:n.type)==null?void 0:c.name)===s?n:null}function K(){const o=e.inject(A),s=e.getCurrentInstance();function n(t,c,i){if(!o)throw new Error("Not Found Modal Provider Component");return o.open(t,c,i)}return{open:n,close(t){var u;if(!o)throw new Error("Not Found Modal Provider Component");const c=P(s,"ModalContainer"),i=(u=c==null?void 0:c.props)==null?void 0:u.id;if(!i)throw new Error("Not Found Current Modal Container");o.close(i,t)},closeAll(){if(!o)throw new Error("Not Found Modal Provider Component");o.closeAll()},showLoading(){var i;if(!o)throw new Error("Not Found Modal Provider Component");const t=P(s,"ModalContainer");if(!((i=t==null?void 0:t.props)==null?void 0:i.id))throw new Error("Not Found Current Modal Container");t!=null&&t.exposed&&(t==null||t.exposed.showLoading())},hideLoading(){var i;if(!o)throw new Error("Not Found Modal Provider Component");const t=P(s,"ModalContainer");if(!((i=t==null?void 0:t.props)==null?void 0:i.id))throw new Error("Not Found Current Modal Container");t!=null&&t.exposed&&(t==null||t.exposed.hideLoading())},confirm(t){return this.open("confirm",t)},info(t){return this.open("info",t)},error(t){return this.open("error",t)},warning(t){return this.open("warning",t)},success(t){return this.open("success",t)}}}function Ve(o){var i;const s=e.inject(A),n=e.getCurrentInstance(),t=P(n,"ModalContainer"),c=(i=t==null?void 0:t.props)==null?void 0:i.id;s&&c&&s.addEventListener(c,"submit",o)}exports.ModalContainer=G;exports.ModalFooter=Be;exports.ModalHeader=$e;exports.ModalKey=A;exports.ModalProvider=Ce;exports.onSubmit=Ve;exports.useModal=K;
package/dist/es/index.mjs CHANGED
@@ -1,141 +1,215 @@
1
- import { unref as ne, isRef as re, toRefs as ie, customRef as se, getCurrentScope as le, onScopeDispose as ae, ref as H, computed as A, watch as de, defineComponent as Y, inject as K, shallowRef as D, onMounted as Z, onUnmounted as ce, openBlock as g, createElementBlock as x, normalizeStyle as z, withModifiers as ue, createElementVNode as v, normalizeClass as fe, toDisplayString as P, createCommentVNode as T, createBlock as B, resolveDynamicComponent as ee, normalizeProps as pe, guardReactiveProps as me, triggerRef as R, pushScopeId as ve, popScopeId as he, Fragment as X, getCurrentInstance as q, provide as ye, renderSlot as U, Teleport as J, createVNode as ge, TransitionGroup as _e, withCtx as we, renderList as be, mergeProps as Ce, defineAsyncComponent as xe } from "vue";
2
- const W = Symbol("__MODAL__");
3
- function ke(o) {
4
- return le() ? (ae(o), !0) : !1;
1
+ import { unref as le, isRef as ve, toRefs as he, customRef as me, getCurrentInstance as V, onMounted as K, nextTick as ye, getCurrentScope as ge, onScopeDispose as _e, ref as z, computed as $, watch as te, defineComponent as oe, inject as ne, shallowRef as T, onUnmounted as we, openBlock as g, createElementBlock as M, normalizeStyle as D, withModifiers as be, createTextVNode as xe, toDisplayString as L, createElementVNode as y, normalizeClass as Ce, createCommentVNode as F, createBlock as W, resolveDynamicComponent as ae, normalizeProps as ke, guardReactiveProps as Me, triggerRef as I, pushScopeId as Se, popScopeId as $e, Fragment as ee, provide as Ee, renderSlot as se, Teleport as re, createVNode as Ae, TransitionGroup as Le, withCtx as Re, renderList as Be, mergeProps as Pe, defineAsyncComponent as Te } from "vue";
2
+ const U = Symbol("__MODAL__");
3
+ function de(t) {
4
+ return ge() ? (_e(t), !0) : !1;
5
5
  }
6
- function b(o) {
7
- return typeof o == "function" ? o() : ne(o);
6
+ function C(t) {
7
+ return typeof t == "function" ? t() : le(t);
8
8
  }
9
- const te = typeof window < "u" && typeof document < "u";
9
+ const ce = typeof window < "u" && typeof document < "u";
10
10
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
11
- const Me = Object.prototype.toString, Ee = (o) => Me.call(o) === "[object Object]", $e = () => {
11
+ const Oe = Object.prototype.toString, ze = (t) => Oe.call(t) === "[object Object]", He = () => {
12
12
  };
13
- function Se(o, s = {}) {
14
- if (!re(o))
15
- return ie(o);
16
- const n = Array.isArray(o.value) ? Array.from({ length: o.value.length }) : {};
17
- for (const e in o.value)
18
- n[e] = se(() => ({
13
+ function Ne(t, r = {}) {
14
+ if (!ve(t))
15
+ return he(t);
16
+ const o = Array.isArray(t.value) ? Array.from({ length: t.value.length }) : {};
17
+ for (const e in t.value)
18
+ o[e] = me(() => ({
19
19
  get() {
20
- return o.value[e];
20
+ return t.value[e];
21
21
  },
22
- set(l) {
23
- var r;
24
- if ((r = b(s.replaceRef)) != null ? r : !0)
25
- if (Array.isArray(o.value)) {
26
- const h = [...o.value];
27
- h[e] = l, o.value = h;
22
+ set(a) {
23
+ var i;
24
+ if ((i = C(r.replaceRef)) != null ? i : !0)
25
+ if (Array.isArray(t.value)) {
26
+ const p = [...t.value];
27
+ p[e] = a, t.value = p;
28
28
  } else {
29
- const h = { ...o.value, [e]: l };
30
- Object.setPrototypeOf(h, Object.getPrototypeOf(o.value)), o.value = h;
29
+ const p = { ...t.value, [e]: a };
30
+ Object.setPrototypeOf(p, Object.getPrototypeOf(t.value)), t.value = p;
31
31
  }
32
32
  else
33
- o.value[e] = l;
33
+ t.value[e] = a;
34
34
  }
35
35
  }));
36
- return n;
36
+ return o;
37
37
  }
38
- function Le(o) {
39
- var s;
40
- const n = b(o);
41
- return (s = n == null ? void 0 : n.$el) != null ? s : n;
38
+ function Fe(t, r = !0) {
39
+ V() ? K(t) : r ? t() : ye(t);
42
40
  }
43
- const oe = te ? window : void 0;
44
- function G(...o) {
45
- let s, n, e, l;
46
- if (typeof o[0] == "string" || Array.isArray(o[0]) ? ([n, e, l] = o, s = oe) : [s, n, e, l] = o, !s)
47
- return $e;
48
- Array.isArray(n) || (n = [n]), Array.isArray(e) || (e = [e]);
49
- const r = [], f = () => {
50
- r.forEach((p) => p()), r.length = 0;
51
- }, h = (p, _, i, u) => (p.addEventListener(_, i, u), () => p.removeEventListener(_, i, u)), k = de(
52
- () => [Le(s), b(l)],
53
- ([p, _]) => {
54
- if (f(), !p)
41
+ function O(t) {
42
+ var r;
43
+ const o = C(t);
44
+ return (r = o == null ? void 0 : o.$el) != null ? r : o;
45
+ }
46
+ const q = ce ? window : void 0;
47
+ function Z(...t) {
48
+ let r, o, e, a;
49
+ if (typeof t[0] == "string" || Array.isArray(t[0]) ? ([o, e, a] = t, r = q) : [r, o, e, a] = t, !r)
50
+ return He;
51
+ Array.isArray(o) || (o = [o]), Array.isArray(e) || (e = [e]);
52
+ const i = [], c = () => {
53
+ i.forEach((h) => h()), i.length = 0;
54
+ }, p = (h, d, s, u) => (h.addEventListener(d, s, u), () => h.removeEventListener(d, s, u)), _ = te(
55
+ () => [O(r), C(a)],
56
+ ([h, d]) => {
57
+ if (c(), !h)
55
58
  return;
56
- const i = Ee(_) ? { ..._ } : _;
57
- r.push(
58
- ...n.flatMap((u) => e.map((a) => h(p, u, a, i)))
59
+ const s = ze(d) ? { ...d } : d;
60
+ i.push(
61
+ ...o.flatMap((u) => e.map((l) => p(h, u, l, s)))
59
62
  );
60
63
  },
61
64
  { immediate: !0, flush: "post" }
62
- ), M = () => {
63
- k(), f();
65
+ ), w = () => {
66
+ _(), c();
64
67
  };
65
- return ke(M), M;
68
+ return de(w), w;
69
+ }
70
+ function We() {
71
+ const t = z(!1);
72
+ return V() && K(() => {
73
+ t.value = !0;
74
+ }), t;
66
75
  }
67
- function Ae(o, s = {}) {
68
- var n, e;
76
+ function De(t) {
77
+ const r = We();
78
+ return $(() => (r.value, !!t()));
79
+ }
80
+ function Ie(t, r = {}) {
81
+ var o, e;
69
82
  const {
70
- pointerTypes: l,
71
- preventDefault: r,
72
- stopPropagation: f,
73
- exact: h,
74
- onMove: k,
75
- onEnd: M,
76
- onStart: p,
77
- initialValue: _,
78
- axis: i = "both",
79
- draggingElement: u = oe,
80
- containerElement: a,
81
- handle: m = o
82
- } = s, d = H(
83
- (n = b(_)) != null ? n : { x: 0, y: 0 }
84
- ), C = H(), E = (c) => l ? l.includes(c.pointerType) : !0, S = (c) => {
85
- b(r) && c.preventDefault(), b(f) && c.stopPropagation();
86
- }, I = (c) => {
87
- var L;
88
- if (!E(c) || b(h) && c.target !== b(o))
83
+ pointerTypes: a,
84
+ preventDefault: i,
85
+ stopPropagation: c,
86
+ exact: p,
87
+ onMove: _,
88
+ onEnd: w,
89
+ onStart: h,
90
+ initialValue: d,
91
+ axis: s = "both",
92
+ draggingElement: u = q,
93
+ containerElement: l,
94
+ handle: m = t
95
+ } = r, f = z(
96
+ (o = C(d)) != null ? o : { x: 0, y: 0 }
97
+ ), x = z(), S = (v) => a ? a.includes(v.pointerType) : !0, R = (v) => {
98
+ C(i) && v.preventDefault(), C(c) && v.stopPropagation();
99
+ }, J = (v) => {
100
+ var B;
101
+ if (!S(v) || C(p) && v.target !== C(t))
89
102
  return;
90
- const w = b(a), $ = (L = w == null ? void 0 : w.getBoundingClientRect) == null ? void 0 : L.call(w), t = b(o).getBoundingClientRect(), y = {
91
- x: c.clientX - (w ? t.left - $.left : t.left),
92
- y: c.clientY - (w ? t.top - $.top : t.top)
103
+ const b = C(l), P = (B = b == null ? void 0 : b.getBoundingClientRect) == null ? void 0 : B.call(b), E = C(t).getBoundingClientRect(), A = {
104
+ x: v.clientX - (b ? E.left - P.left : E.left),
105
+ y: v.clientY - (b ? E.top - P.top : E.top)
93
106
  };
94
- (p == null ? void 0 : p(y, c)) !== !1 && (C.value = y, S(c));
95
- }, V = (c) => {
96
- var L;
97
- if (!E(c) || !C.value)
107
+ (h == null ? void 0 : h(A, v)) !== !1 && (x.value = A, R(v));
108
+ }, G = (v) => {
109
+ var B;
110
+ if (!S(v) || !x.value)
98
111
  return;
99
- const w = b(a), $ = (L = w == null ? void 0 : w.getBoundingClientRect) == null ? void 0 : L.call(w), t = b(o).getBoundingClientRect();
100
- let { x: y, y: O } = d.value;
101
- (i === "x" || i === "both") && (y = c.clientX - C.value.x, w && (y = Math.min(Math.max(0, y), $.width - t.width))), (i === "y" || i === "both") && (O = c.clientY - C.value.y, w && (O = Math.min(Math.max(0, O), $.height - t.height))), d.value = {
102
- x: y,
103
- y: O
104
- }, k == null || k(d.value, c), S(c);
105
- }, j = (c) => {
106
- E(c) && C.value && (C.value = void 0, M == null || M(d.value, c), S(c));
112
+ const b = C(l), P = (B = b == null ? void 0 : b.getBoundingClientRect) == null ? void 0 : B.call(b), E = C(t).getBoundingClientRect();
113
+ let { x: A, y: N } = f.value;
114
+ (s === "x" || s === "both") && (A = v.clientX - x.value.x, b && (A = Math.min(Math.max(0, A), P.width - E.width))), (s === "y" || s === "both") && (N = v.clientY - x.value.y, b && (N = Math.min(Math.max(0, N), P.height - E.height))), f.value = {
115
+ x: A,
116
+ y: N
117
+ }, _ == null || _(f.value, v), R(v);
118
+ }, H = (v) => {
119
+ S(v) && x.value && (x.value = void 0, w == null || w(f.value, v), R(v));
107
120
  };
108
- if (te) {
109
- const c = { capture: (e = s.capture) != null ? e : !0 };
110
- G(m, "pointerdown", I, c), G(u, "pointermove", V, c), G(u, "pointerup", j, c);
121
+ if (ce) {
122
+ const v = { capture: (e = r.capture) != null ? e : !0 };
123
+ Z(m, "pointerdown", J, v), Z(u, "pointermove", G, v), Z(u, "pointerup", H, v);
111
124
  }
112
125
  return {
113
- ...Se(d),
114
- position: d,
115
- isDragging: A(() => !!C.value),
116
- style: A(
117
- () => `left:${d.value.x}px;top:${d.value.y}px;`
126
+ ...Ne(f),
127
+ position: f,
128
+ isDragging: $(() => !!x.value),
129
+ style: $(
130
+ () => `left:${f.value.x}px;top:${f.value.y}px;`
118
131
  )
119
132
  };
120
133
  }
121
- const Q = (o) => (ve("data-v-4af3c744"), o = o(), he(), o), Pe = { class: "title text-16px font-bold" }, Te = { class: "action" }, Be = /* @__PURE__ */ Q(() => /* @__PURE__ */ v("div", { id: "modal-header-slot" }, null, -1)), Oe = /* @__PURE__ */ Q(() => /* @__PURE__ */ v("div", { id: "modal-footer-slot" }, null, -1)), ze = {
122
- key: 1,
123
- class: "modal-footer space-x-2"
124
- }, Re = ["form"], Ne = {
134
+ function Ve(t, r, o = {}) {
135
+ const { window: e = q, ...a } = o;
136
+ let i;
137
+ const c = De(() => e && "ResizeObserver" in e), p = () => {
138
+ i && (i.disconnect(), i = void 0);
139
+ }, _ = $(() => Array.isArray(t) ? t.map((d) => O(d)) : [O(t)]), w = te(
140
+ _,
141
+ (d) => {
142
+ if (p(), c.value && e) {
143
+ i = new ResizeObserver(r);
144
+ for (const s of d)
145
+ s && i.observe(s, a);
146
+ }
147
+ },
148
+ { immediate: !0, flush: "post", deep: !0 }
149
+ ), h = () => {
150
+ p(), w();
151
+ };
152
+ return de(h), {
153
+ isSupported: c,
154
+ stop: h
155
+ };
156
+ }
157
+ function X(t, r = { width: 0, height: 0 }, o = {}) {
158
+ const { window: e = q, box: a = "content-box" } = o, i = $(() => {
159
+ var d, s;
160
+ return (s = (d = O(t)) == null ? void 0 : d.namespaceURI) == null ? void 0 : s.includes("svg");
161
+ }), c = z(r.width), p = z(r.height), { stop: _ } = Ve(
162
+ t,
163
+ ([d]) => {
164
+ const s = a === "border-box" ? d.borderBoxSize : a === "content-box" ? d.contentBoxSize : d.devicePixelContentBoxSize;
165
+ if (e && i.value) {
166
+ const u = O(t);
167
+ if (u) {
168
+ const l = e.getComputedStyle(u);
169
+ c.value = Number.parseFloat(l.width), p.value = Number.parseFloat(l.height);
170
+ }
171
+ } else if (s) {
172
+ const u = Array.isArray(s) ? s : [s];
173
+ c.value = u.reduce((l, { inlineSize: m }) => l + m, 0), p.value = u.reduce((l, { blockSize: m }) => l + m, 0);
174
+ } else
175
+ c.value = d.contentRect.width, p.value = d.contentRect.height;
176
+ },
177
+ o
178
+ );
179
+ Fe(() => {
180
+ const d = O(t);
181
+ d && (c.value = "offsetWidth" in d ? d.offsetWidth : r.width, p.value = "offsetHeight" in d ? d.offsetHeight : r.height);
182
+ });
183
+ const w = te(
184
+ () => O(t),
185
+ (d) => {
186
+ c.value = d ? r.width : 0, p.value = d ? r.height : 0;
187
+ }
188
+ );
189
+ function h() {
190
+ _(), w();
191
+ }
192
+ return {
193
+ width: c,
194
+ height: p,
195
+ stop: h
196
+ };
197
+ }
198
+ const je = (t) => (Se("data-v-eaa553bd"), t = t(), $e(), t), Ge = { class: "title text-16px font-bold" }, Xe = { class: "action" }, Ye = ["form"], Ke = {
125
199
  key: 2,
126
200
  class: "modal-loading"
127
- }, De = /* @__PURE__ */ Q(() => /* @__PURE__ */ v("div", { class: "lds-ring" }, [
128
- /* @__PURE__ */ v("div"),
129
- /* @__PURE__ */ v("div"),
130
- /* @__PURE__ */ v("div"),
131
- /* @__PURE__ */ v("div")
132
- ], -1)), Fe = [
133
- De
134
- ], He = {
201
+ }, Ue = /* @__PURE__ */ je(() => /* @__PURE__ */ y("div", { class: "lds-ring" }, [
202
+ /* @__PURE__ */ y("div"),
203
+ /* @__PURE__ */ y("div"),
204
+ /* @__PURE__ */ y("div"),
205
+ /* @__PURE__ */ y("div")
206
+ ], -1)), qe = [
207
+ Ue
208
+ ], Je = {
135
209
  name: "ModalContainer",
136
210
  inheritAttrs: !0
137
- }, We = /* @__PURE__ */ Y({
138
- ...He,
211
+ }, Qe = /* @__PURE__ */ oe({
212
+ ...Je,
139
213
  props: {
140
214
  id: {},
141
215
  form: {},
@@ -163,137 +237,151 @@ const Q = (o) => (ve("data-v-4af3c744"), o = o(), he(), o), Pe = { class: "title
163
237
  cancelText: { default: "取消" }
164
238
  },
165
239
  emits: ["submit"],
166
- setup(o, { expose: s, emit: n }) {
167
- const e = o, l = n, r = K(W), f = H(!1);
168
- let h = 0, k = 0;
169
- const M = D(), p = D(), _ = D(), { x: i, y: u } = Ae(_, {
240
+ setup(t, { expose: r, emit: o }) {
241
+ const e = t, a = o, i = ne(U), c = z(!1);
242
+ let p = 0, _ = 0;
243
+ const w = T(), h = T(), d = T(), s = T(), u = T(), l = T(), { height: m } = X(d), { height: f } = X(s), { height: x } = X(u), { height: S } = X(l), { x: R, y: J } = Ie(d, {
170
244
  initialValue: { x: 0, y: 0 }
171
245
  });
172
- function a() {
173
- r == null || r.close(e.id);
246
+ function G() {
247
+ i == null || i.close(e.id);
174
248
  }
175
- function m(t) {
176
- if (typeof t == "number")
177
- return `${t}px`;
178
- if (typeof t == "string")
179
- return t;
249
+ function H(n) {
250
+ if (typeof n == "number")
251
+ return `${n}px`;
252
+ if (typeof n == "string")
253
+ return n;
180
254
  }
181
- const d = A(() => {
182
- const t = {};
183
- return e.mode === "dialog" && (t.justifyContent = "center"), e.mode === "drawer" && (t.justifyContent = "flex-end"), t;
184
- }), C = A(() => {
185
- const t = {};
186
- return e.size && (t.width = m(e.sizes[e.size])), e.width && (t.width = m(e.width)), e.maxWidth && (t.maxWidth = m(e.maxWidth)), e.fullscreen && (t.maxWidth = "unset", t.width = "100%", t.position = "fixed", t.top = 0, t.left = 0, t.bottom = 0, t.right = 0, t.borderRadius = 0), e.draggable && !e.fullscreen && e.mode === "dialog" && (t.transform = `translate3d(${i.value - h}px, ${u.value - k}px, 0px)`), e.mode === "drawer" && (t.borderRadius = 0, t.height = "100%"), e.offset && e.mode === "dialog" && (t.marginLeft = `${e.offset.x || 0}px`, t.marginTop = `${e.offset.y || 0}px`), e.backgroundColor && (t.backgroundColor = e.backgroundColor), t;
187
- }), E = A(() => {
188
- const t = {};
189
- return e.draggable && !e.fullscreen && e.mode === "dialog" && (t.cursor = "move"), t;
190
- }), S = A(() => {
191
- var y;
192
- const t = {};
193
- return e.maxHeight && (t.maxHeight = `calc(${(y = m(e.maxHeight)) == null ? void 0 : y.replace("%", "vh")} - 50px)`), e.mode === "drawer" && (t.maxHeight = "unset", t.height = `calc(100% - ${(e.header ? 50 : 0) + (e.footer ? 50 : 0)}px)`), e.fullscreen && (t.maxHeight = "unset", t.height = `calc(100% - ${(e.header ? 50 : 0) + (e.footer ? 50 : 0)}px)`), e.type !== "component" && (t.padding = "0"), e.bodyStyle && Object.assign(t, e.bodyStyle), t;
255
+ const v = $(() => {
256
+ const n = {};
257
+ return e.mode === "dialog" && (n.justifyContent = "center"), e.mode === "drawer" && (n.justifyContent = "flex-end"), n;
258
+ }), B = $(() => {
259
+ const n = {};
260
+ return e.size && (n.width = H(e.sizes[e.size])), e.width && (n.width = H(e.width)), e.maxWidth && (n.maxWidth = H(e.maxWidth)), e.fullscreen && (n.maxWidth = "unset", n.width = "100%", n.position = "fixed", n.top = 0, n.left = 0, n.bottom = 0, n.right = 0, n.borderRadius = 0), e.draggable && !e.fullscreen && e.mode === "dialog" && (n.transform = `translate3d(${R.value - p}px, ${J.value - _}px, 0px)`), e.mode === "drawer" && (n.borderRadius = 0, n.height = "100%"), e.offset && e.mode === "dialog" && (n.marginLeft = `${e.offset.x || 0}px`, n.marginTop = `${e.offset.y || 0}px`), e.backgroundColor && (n.backgroundColor = e.backgroundColor), n;
261
+ }), b = $(() => {
262
+ const n = {};
263
+ return e.draggable && !e.fullscreen && e.mode === "dialog" && (n.cursor = "move"), n;
264
+ }), P = $(() => {
265
+ var Q;
266
+ const n = {}, k = x.value + S.value + m.value + f.value;
267
+ return e.maxHeight && (n.maxHeight = `calc(${(Q = H(e.maxHeight)) == null ? void 0 : Q.replace("%", "vh")} - ${k}px)`), e.mode === "drawer" && (n.maxHeight = "unset", n.height = `calc(100% - ${k}px)`), e.fullscreen && (n.maxHeight = "unset", n.height = `calc(100% - ${k}px)`), e.type !== "component" && (n.padding = "0"), e.bodyStyle && Object.assign(n, e.bodyStyle), n;
194
268
  });
195
- function I() {
196
- const t = p.value;
197
- if (e.form && t) {
198
- const y = t.querySelector(`form[name="${e.form}"]`);
199
- y && y.dispatchEvent(new Event("submit"));
269
+ function E() {
270
+ const n = h.value;
271
+ if (e.form && n) {
272
+ const k = n.querySelector(`form[name="${e.form}"]`);
273
+ k && k.dispatchEvent(new Event("submit"));
200
274
  }
201
- l("submit");
275
+ a("submit");
202
276
  }
203
- function V() {
204
- r == null || r.close(e.id);
277
+ function A() {
278
+ i == null || i.close(e.id);
205
279
  }
206
- function j() {
280
+ function N() {
207
281
  window && window.addEventListener("resize", () => {
208
- R(M), R(p), p.value && (h = p.value.offsetLeft, k = p.value.offsetTop);
282
+ I(w), I(h), h.value && (p = h.value.offsetLeft, _ = h.value.offsetTop);
209
283
  });
210
284
  }
211
- function c() {
285
+ function ue() {
212
286
  if (e.closeable && e.esc) {
213
- const t = ({ key: y }) => {
214
- y === "Escape" && (r == null || r.close(e.id), window.removeEventListener("keydown", t));
287
+ const n = ({ key: k }) => {
288
+ k === "Escape" && (i == null || i.close(e.id), window.removeEventListener("keydown", n));
215
289
  };
216
- window.addEventListener("keydown", t);
290
+ window.addEventListener("keydown", n);
217
291
  }
218
292
  }
219
- function L() {
220
- h = p.value.offsetLeft, k = p.value.offsetTop;
293
+ function fe() {
294
+ p = h.value.offsetLeft, _ = h.value.offsetTop;
221
295
  }
222
- Z(() => {
223
- c(), j();
224
- }), ce(() => {
296
+ K(() => {
297
+ ue(), N();
298
+ }), we(() => {
225
299
  });
226
- function w() {
227
- return f.value = !0, () => $();
300
+ function pe() {
301
+ return c.value = !0, () => ie();
228
302
  }
229
- function $() {
230
- f.value = !1;
303
+ function ie() {
304
+ c.value = !1;
231
305
  }
232
- return s({
233
- showLoading: w,
234
- hideLoading: $
235
- }), (t, y) => (g(), x("div", {
306
+ return r({
307
+ showLoading: pe,
308
+ hideLoading: ie
309
+ }), (n, k) => (g(), M("div", {
236
310
  ref_key: "wrapperRef",
237
- ref: M,
311
+ ref: w,
238
312
  class: "modal-wrapper",
239
- style: z(d.value),
240
- onClick: y[0] || (y[0] = ue((O) => t.maskClosable && a(), ["self"]))
313
+ style: D(v.value),
314
+ onClick: k[0] || (k[0] = be((Q) => n.maskClosable && G(), ["self"]))
241
315
  }, [
242
- v("div", {
316
+ xe(L(le(x)) + " ", 1),
317
+ y("div", {
243
318
  ref_key: "contentRef",
244
- ref: p,
245
- class: fe(["modal-content", { [`${t.mode}-mode`]: !0 }]),
246
- style: z(C.value)
319
+ ref: h,
320
+ class: Ce(["modal-content", { [`${n.mode}-mode`]: !0 }]),
321
+ style: D(B.value)
247
322
  }, [
248
- t.header ? (g(), x("div", {
323
+ n.header ? (g(), M("div", {
249
324
  key: 0,
250
325
  ref_key: "headerRef",
251
- ref: _,
326
+ ref: d,
252
327
  class: "modal-header",
253
- style: z(E.value),
254
- onMousedown: L
328
+ style: D(b.value),
329
+ onMousedown: fe
255
330
  }, [
256
- v("div", Pe, P(t.title), 1),
257
- v("div", Te, [
258
- t.closeable ? (g(), x("div", {
331
+ y("div", Ge, L(n.title), 1),
332
+ y("div", Xe, [
333
+ n.closeable ? (g(), M("div", {
259
334
  key: 0,
260
335
  class: "i-icon-park-outline:close block cursor-pointer",
261
- onClick: a
262
- })) : T("", !0)
336
+ onClick: G
337
+ })) : F("", !0)
263
338
  ])
264
- ], 36)) : T("", !0),
265
- Be,
266
- v("div", {
339
+ ], 36)) : F("", !0),
340
+ y("div", {
341
+ id: "modal-header-slot",
342
+ ref_key: "headerSlotRef",
343
+ ref: u
344
+ }, null, 512),
345
+ y("div", {
267
346
  class: "modal-body",
268
- style: z(S.value)
347
+ style: D(P.value)
269
348
  }, [
270
- (g(), B(ee(t.component), pe(me(t.componentProps)), null, 16))
349
+ (g(), W(ae(n.component), ke(Me(n.componentProps)), null, 16))
271
350
  ], 4),
272
- Oe,
273
- t.footer ? (g(), x("div", ze, [
274
- v("button", {
351
+ y("div", {
352
+ id: "modal-footer-slot",
353
+ ref_key: "footerSlotRef",
354
+ ref: l
355
+ }, null, 512),
356
+ n.footer ? (g(), M("div", {
357
+ key: 1,
358
+ ref_key: "footerRef",
359
+ ref: s,
360
+ class: "modal-footer space-x-2"
361
+ }, [
362
+ y("button", {
275
363
  class: "cancel-button",
276
364
  type: "button",
277
- onClick: V
278
- }, P(t.cancelText), 1),
279
- v("button", {
365
+ onClick: A
366
+ }, L(n.cancelText), 1),
367
+ y("button", {
280
368
  class: "submit-button",
281
- form: t.form,
369
+ form: n.form,
282
370
  type: "submit",
283
- onClick: I
284
- }, P(t.submitText), 9, Re)
285
- ])) : T("", !0),
286
- f.value ? (g(), x("div", Ne, Fe)) : T("", !0)
371
+ onClick: E
372
+ }, L(n.submitText), 9, Ye)
373
+ ], 512)) : F("", !0),
374
+ c.value ? (g(), M("div", Ke, qe)) : F("", !0)
287
375
  ], 6)
288
376
  ], 4));
289
377
  }
290
378
  });
291
- const N = (o, s) => {
292
- const n = o.__vccOpts || o;
293
- for (const [e, l] of s)
294
- n[e] = l;
295
- return n;
296
- }, Ie = /* @__PURE__ */ N(We, [["__scopeId", "data-v-4af3c744"]]), Ve = { class: "modal-dialog" }, je = { class: "dialog-body" }, Ge = { class: "dialog-title" }, Xe = { class: "dialog-content" }, Ye = /* @__PURE__ */ Y({
379
+ const j = (t, r) => {
380
+ const o = t.__vccOpts || t;
381
+ for (const [e, a] of r)
382
+ o[e] = a;
383
+ return o;
384
+ }, Ze = /* @__PURE__ */ j(Qe, [["__scopeId", "data-v-eaa553bd"]]), et = { class: "modal-dialog" }, tt = { class: "dialog-body" }, ot = { class: "dialog-title" }, nt = { class: "dialog-content" }, st = /* @__PURE__ */ oe({
297
385
  __name: "modal-dialog",
298
386
  props: {
299
387
  type: {},
@@ -305,54 +393,54 @@ const N = (o, s) => {
305
393
  onCancel: {},
306
394
  footer: {}
307
395
  },
308
- setup(o) {
309
- const s = o, n = rt(), e = A(() => s.title ? s.title : {
396
+ setup(t) {
397
+ const r = t, o = ht(), e = $(() => r.title ? r.title : {
310
398
  confirm: "提示",
311
399
  info: "提示",
312
400
  warning: "警告",
313
401
  error: "错误",
314
402
  success: "成功"
315
- }[s.type]);
316
- async function l() {
317
- s.onOk && await s.onOk(), n.close();
403
+ }[r.type]);
404
+ async function a() {
405
+ r.onOk && await r.onOk(), o.close();
318
406
  }
319
- async function r() {
320
- s.onCancel && await s.onCancel(), n.close();
407
+ async function i() {
408
+ r.onCancel && await r.onCancel(), o.close();
321
409
  }
322
- return (f, h) => (g(), x("section", Ve, [
323
- v("div", je, [
324
- v("div", Ge, P(e.value), 1),
325
- v("div", Xe, P(f.content), 1)
410
+ return (c, p) => (g(), M("section", et, [
411
+ y("div", tt, [
412
+ y("div", ot, L(e.value), 1),
413
+ y("div", nt, L(c.content), 1)
326
414
  ]),
327
- v("div", {
415
+ y("div", {
328
416
  class: "dialog-footer space-x-2",
329
- style: z(f.type === "confirm" ? { "justify-content": "end" } : { "border-top": "none" })
417
+ style: D(c.type === "confirm" ? { "justify-content": "end" } : { "border-top": "none" })
330
418
  }, [
331
- f.footer ? (g(), B(ee(f.footer), { key: 0 })) : (g(), x(X, { key: 1 }, [
332
- v("button", {
419
+ c.footer ? (g(), W(ae(c.footer), { key: 0 })) : (g(), M(ee, { key: 1 }, [
420
+ y("button", {
333
421
  class: "submit-button",
334
422
  type: "submit",
335
- onClick: l
336
- }, P(f.okText), 1),
337
- f.type === "confirm" ? (g(), x("button", {
423
+ onClick: a
424
+ }, L(c.okText), 1),
425
+ c.type === "confirm" ? (g(), M("button", {
338
426
  key: 0,
339
427
  class: "cancel-button",
340
428
  type: "button",
341
- onClick: r
342
- }, P(f.cancelText), 1)) : T("", !0)
429
+ onClick: i
430
+ }, L(c.cancelText), 1)) : F("", !0)
343
431
  ], 64))
344
432
  ], 4)
345
433
  ]));
346
434
  }
347
435
  });
348
- const Ke = /* @__PURE__ */ N(Ye, [["__scopeId", "data-v-8326e5a5"]]), qe = {
436
+ const rt = /* @__PURE__ */ j(st, [["__scopeId", "data-v-8326e5a5"]]), it = {
349
437
  key: 0,
350
438
  class: "modal-teleport"
351
- }, Ue = {
439
+ }, lt = {
352
440
  name: "ModalProvider",
353
441
  inheritAttrs: !0
354
- }, Je = /* @__PURE__ */ Y({
355
- ...Ue,
442
+ }, at = /* @__PURE__ */ oe({
443
+ ...lt,
356
444
  props: {
357
445
  appendToBody: { type: [Boolean, String], default: !1 },
358
446
  sizes: { default: () => ({
@@ -364,190 +452,190 @@ const Ke = /* @__PURE__ */ N(Ye, [["__scopeId", "data-v-8326e5a5"]]), qe = {
364
452
  maxHeight: { default: "90%" },
365
453
  offset: { default: () => ({ x: 0, y: 0 }) }
366
454
  },
367
- setup(o, { expose: s }) {
368
- const n = D([]), e = H(!1), l = q();
369
- function r(i, u = {}, a = {}) {
370
- const m = xe(
371
- () => Promise.resolve(typeof i == "string" ? Ke : i)
455
+ setup(t, { expose: r }) {
456
+ const o = T([]), e = z(!1), a = V();
457
+ function i(s, u = {}, l = {}) {
458
+ const m = Te(
459
+ () => Promise.resolve(typeof s == "string" ? rt : s)
372
460
  );
373
- typeof i == "string" && (u.type = i, a.size = "small", a.fullscreen = !1, a.mode = "dialog", a.footer = !1, a.header = !1);
374
- const d = Math.random().toString(32).slice(2), C = new Promise((E, S) => {
375
- n.value.push({
376
- id: d,
461
+ typeof s == "string" && (u.type = s, l.size = "small", l.fullscreen = !1, l.mode = "dialog", l.footer = !1, l.header = !1);
462
+ const f = Math.random().toString(32).slice(2), x = new Promise((S, R) => {
463
+ o.value.push({
464
+ id: f,
377
465
  component: m,
378
466
  props: u || {},
379
467
  options: {
380
- ...a,
381
- type: typeof i == "string" ? i : "component"
468
+ ...l,
469
+ type: typeof s == "string" ? s : "component"
382
470
  },
383
- resolve: E,
384
- reject: S,
471
+ resolve: S,
472
+ reject: R,
385
473
  listeners: []
386
- }), R(n);
387
- }).catch((E) => E === "CANCEL" ? new Promise(() => {
388
- }) : Promise.reject(E));
389
- return Object.assign(C, {
390
- close: () => f(d)
474
+ }), I(o);
475
+ }).catch((S) => S === "CANCEL" ? new Promise(() => {
476
+ }) : Promise.reject(S));
477
+ return Object.assign(x, {
478
+ close: () => c(f)
391
479
  });
392
480
  }
393
- function f(i, u) {
394
- const a = n.value.findIndex((d) => d.id === i);
395
- if (a < 0)
481
+ function c(s, u) {
482
+ const l = o.value.findIndex((f) => f.id === s);
483
+ if (l < 0)
396
484
  return;
397
- const m = n.value[a];
398
- u === void 0 ? m == null || m.reject("CANCEL") : m == null || m.resolve(u), n.value.splice(a, 1), R(n);
485
+ const m = o.value[l];
486
+ u === void 0 ? m == null || m.reject("CANCEL") : m == null || m.resolve(u), o.value.splice(l, 1), I(o);
399
487
  }
400
- function h() {
401
- !n.value || n.value.length === 0 || (n.value.forEach((i) => {
402
- i == null || i.reject("CANCEL");
403
- }), n.value = [], R(n));
488
+ function p() {
489
+ !o.value || o.value.length === 0 || (o.value.forEach((s) => {
490
+ s == null || s.reject("CANCEL");
491
+ }), o.value = [], I(o));
404
492
  }
405
- function k(i, u) {
406
- const a = n.value.find((d) => d.id === i);
407
- if (!a)
493
+ function _(s, u) {
494
+ const l = o.value.find((f) => f.id === s);
495
+ if (!l)
408
496
  return;
409
- const m = a.listeners.find((d) => d.event === u);
497
+ const m = l.listeners.find((f) => f.event === u);
410
498
  m && m.callback({
411
- open: r,
412
- close: (d) => f(a.id, d),
413
- closeAll: h,
414
- showLoading: () => M(a.id),
415
- hideLoading: () => p(a.id),
416
- confirm: (d) => r("confirm", d),
417
- success: (d) => r("success", d),
418
- error: (d) => r("error", d),
419
- warning: (d) => r("warning", d),
420
- info: (d) => r("info", d)
499
+ open: i,
500
+ close: (f) => c(l.id, f),
501
+ closeAll: p,
502
+ showLoading: () => w(l.id),
503
+ hideLoading: () => h(l.id),
504
+ confirm: (f) => i("confirm", f),
505
+ success: (f) => i("success", f),
506
+ error: (f) => i("error", f),
507
+ warning: (f) => i("warning", f),
508
+ info: (f) => i("info", f)
421
509
  });
422
510
  }
423
- function M(i) {
424
- if (!l)
511
+ function w(s) {
512
+ if (!a)
425
513
  return;
426
- const [u] = l.refs[`modal-container_${i}`];
514
+ const [u] = a.refs[`modal-container_${s}`];
427
515
  if (u)
428
516
  return u.showLoading();
429
517
  }
430
- function p(i) {
431
- if (!l)
518
+ function h(s) {
519
+ if (!a)
432
520
  return;
433
- const [u] = l.refs[`modal-container_${i}`];
521
+ const [u] = a.refs[`modal-container_${s}`];
434
522
  if (u)
435
523
  return u.hideLoading();
436
524
  }
437
- function _(i, u, a) {
438
- const m = n.value.find((d) => d.id === i);
525
+ function d(s, u, l) {
526
+ const m = o.value.find((f) => f.id === s);
439
527
  m && m.listeners.push({
440
528
  event: u,
441
- callback: a
529
+ callback: l
442
530
  });
443
531
  }
444
- return ye(W, {
445
- open: r,
446
- close: f,
447
- closeAll: h,
448
- addEventListener: _
449
- }), s({
450
- elements: n,
451
- open: r,
452
- close: f,
453
- closeAll: h
454
- }), Z(() => {
532
+ return Ee(U, {
533
+ open: i,
534
+ close: c,
535
+ closeAll: p,
536
+ addEventListener: d
537
+ }), r({
538
+ elements: o,
539
+ open: i,
540
+ close: c,
541
+ closeAll: p
542
+ }), K(() => {
455
543
  e.value = !0;
456
- }), (i, u) => (g(), x(X, null, [
457
- U(i.$slots, "default", {}, void 0, !0),
458
- e.value ? (g(), x("div", qe, [
459
- (g(), B(J, {
460
- disabled: !i.appendToBody,
461
- to: typeof i.appendToBody == "string" ? i.appendToBody : "body"
544
+ }), (s, u) => (g(), M(ee, null, [
545
+ se(s.$slots, "default", {}, void 0, !0),
546
+ e.value ? (g(), M("div", it, [
547
+ (g(), W(re, {
548
+ disabled: !s.appendToBody,
549
+ to: typeof s.appendToBody == "string" ? s.appendToBody : "body"
462
550
  }, [
463
- ge(_e, { name: "modal-fade" }, {
464
- default: we(() => [
465
- (g(!0), x(X, null, be(n.value, (a) => (g(), B(Ie, Ce({
466
- id: a.id,
467
- key: a.id,
551
+ Ae(Le, { name: "modal-fade" }, {
552
+ default: Re(() => [
553
+ (g(!0), M(ee, null, Be(o.value, (l) => (g(), W(Ze, Pe({
554
+ id: l.id,
555
+ key: l.id,
468
556
  ref_for: !0,
469
- ref: `modal-container_${a.id}`,
470
- component: a.component,
471
- "component-props": a.props,
472
- "max-height": i.maxHeight,
473
- "max-width": i.maxWidth,
474
- offset: i.offset,
475
- sizes: i.sizes
476
- }, a.options, {
477
- onSubmit: () => k(a.id, "submit")
557
+ ref: `modal-container_${l.id}`,
558
+ component: l.component,
559
+ "component-props": l.props,
560
+ "max-height": s.maxHeight,
561
+ "max-width": s.maxWidth,
562
+ offset: s.offset,
563
+ sizes: s.sizes
564
+ }, l.options, {
565
+ onSubmit: () => _(l.id, "submit")
478
566
  }), null, 16, ["id", "component", "component-props", "max-height", "max-width", "offset", "sizes", "onSubmit"]))), 128))
479
567
  ]),
480
568
  _: 1
481
569
  })
482
570
  ], 8, ["disabled", "to"]))
483
- ])) : T("", !0)
571
+ ])) : F("", !0)
484
572
  ], 64));
485
573
  }
486
574
  });
487
- const st = /* @__PURE__ */ N(Je, [["__scopeId", "data-v-241a8304"]]);
488
- const Qe = {}, Ze = { class: "modal-footer" };
489
- function et(o, s) {
490
- return g(), B(J, { to: "#modal-footer-slot" }, [
491
- v("div", Ze, [
492
- U(o.$slots, "default", {}, void 0, !0)
575
+ const yt = /* @__PURE__ */ j(at, [["__scopeId", "data-v-241a8304"]]);
576
+ const dt = {}, ct = { class: "modal-footer" };
577
+ function ut(t, r) {
578
+ return g(), W(re, { to: "#modal-footer-slot" }, [
579
+ y("div", ct, [
580
+ se(t.$slots, "default", {}, void 0, !0)
493
581
  ])
494
582
  ]);
495
583
  }
496
- const lt = /* @__PURE__ */ N(Qe, [["render", et], ["__scopeId", "data-v-2080a86e"]]);
497
- const tt = {}, ot = { class: "modal-header" };
498
- function nt(o, s) {
499
- return g(), B(J, { to: "#modal-header-slot" }, [
500
- v("div", ot, [
501
- U(o.$slots, "default", {}, void 0, !0)
584
+ const gt = /* @__PURE__ */ j(dt, [["render", ut], ["__scopeId", "data-v-2080a86e"]]);
585
+ const ft = {}, pt = { class: "modal-header" };
586
+ function vt(t, r) {
587
+ return g(), W(re, { to: "#modal-header-slot" }, [
588
+ y("div", pt, [
589
+ se(t.$slots, "default", {}, void 0, !0)
502
590
  ])
503
591
  ]);
504
592
  }
505
- const at = /* @__PURE__ */ N(tt, [["render", nt], ["__scopeId", "data-v-d0247172"]]);
506
- function F(o, s) {
507
- var e, l;
508
- let n = o == null ? void 0 : o.parent;
509
- for (; n && ((e = n == null ? void 0 : n.type) == null ? void 0 : e.name) !== s; )
510
- n = n.parent;
511
- return ((l = n == null ? void 0 : n.type) == null ? void 0 : l.name) === s ? n : null;
593
+ const _t = /* @__PURE__ */ j(ft, [["render", vt], ["__scopeId", "data-v-d0247172"]]);
594
+ function Y(t, r) {
595
+ var e, a;
596
+ let o = t == null ? void 0 : t.parent;
597
+ for (; o && ((e = o == null ? void 0 : o.type) == null ? void 0 : e.name) !== r; )
598
+ o = o.parent;
599
+ return ((a = o == null ? void 0 : o.type) == null ? void 0 : a.name) === r ? o : null;
512
600
  }
513
- function rt() {
514
- const o = K(W), s = q();
515
- function n(e, l, r) {
516
- if (!o)
601
+ function ht() {
602
+ const t = ne(U), r = V();
603
+ function o(e, a, i) {
604
+ if (!t)
517
605
  throw new Error("Not Found Modal Provider Component");
518
- return o.open(e, l, r);
606
+ return t.open(e, a, i);
519
607
  }
520
608
  return {
521
- open: n,
609
+ open: o,
522
610
  close(e) {
523
- var f;
524
- if (!o)
611
+ var c;
612
+ if (!t)
525
613
  throw new Error("Not Found Modal Provider Component");
526
- const l = F(s, "ModalContainer"), r = (f = l == null ? void 0 : l.props) == null ? void 0 : f.id;
527
- if (!r)
614
+ const a = Y(r, "ModalContainer"), i = (c = a == null ? void 0 : a.props) == null ? void 0 : c.id;
615
+ if (!i)
528
616
  throw new Error("Not Found Current Modal Container");
529
- o.close(r, e);
617
+ t.close(i, e);
530
618
  },
531
619
  closeAll() {
532
- if (!o)
620
+ if (!t)
533
621
  throw new Error("Not Found Modal Provider Component");
534
- o.closeAll();
622
+ t.closeAll();
535
623
  },
536
624
  showLoading() {
537
- var r;
538
- if (!o)
625
+ var i;
626
+ if (!t)
539
627
  throw new Error("Not Found Modal Provider Component");
540
- const e = F(s, "ModalContainer");
541
- if (!((r = e == null ? void 0 : e.props) == null ? void 0 : r.id))
628
+ const e = Y(r, "ModalContainer");
629
+ if (!((i = e == null ? void 0 : e.props) == null ? void 0 : i.id))
542
630
  throw new Error("Not Found Current Modal Container");
543
631
  e != null && e.exposed && (e == null || e.exposed.showLoading());
544
632
  },
545
633
  hideLoading() {
546
- var r;
547
- if (!o)
634
+ var i;
635
+ if (!t)
548
636
  throw new Error("Not Found Modal Provider Component");
549
- const e = F(s, "ModalContainer");
550
- if (!((r = e == null ? void 0 : e.props) == null ? void 0 : r.id))
637
+ const e = Y(r, "ModalContainer");
638
+ if (!((i = e == null ? void 0 : e.props) == null ? void 0 : i.id))
551
639
  throw new Error("Not Found Current Modal Container");
552
640
  e != null && e.exposed && (e == null || e.exposed.hideLoading());
553
641
  },
@@ -568,17 +656,17 @@ function rt() {
568
656
  }
569
657
  };
570
658
  }
571
- function dt(o) {
572
- var r;
573
- const s = K(W), n = q(), e = F(n, "ModalContainer"), l = (r = e == null ? void 0 : e.props) == null ? void 0 : r.id;
574
- s && l && s.addEventListener(l, "submit", o);
659
+ function wt(t) {
660
+ var i;
661
+ const r = ne(U), o = V(), e = Y(o, "ModalContainer"), a = (i = e == null ? void 0 : e.props) == null ? void 0 : i.id;
662
+ r && a && r.addEventListener(a, "submit", t);
575
663
  }
576
664
  export {
577
- Ie as ModalContainer,
578
- lt as ModalFooter,
579
- at as ModalHeader,
580
- W as ModalKey,
581
- st as ModalProvider,
582
- dt as onSubmit,
583
- rt as useModal
665
+ Ze as ModalContainer,
666
+ gt as ModalFooter,
667
+ _t as ModalHeader,
668
+ U as ModalKey,
669
+ yt as ModalProvider,
670
+ wt as onSubmit,
671
+ ht as useModal
584
672
  };
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- *,:before,:after{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / .5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }::backdrop{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / .5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }.i-icon-park-outline\:close{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 48 48' width='1em' height='1em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='4' d='m8 8l32 32M8 40L40 8'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1em;height:1em}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.transform{transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.cursor-pointer{cursor:pointer}.resize{resize:both}.space-x-2>:not([hidden])~:not([hidden]){--un-space-x-reverse:0;margin-left:calc(.5rem * calc(1 - var(--un-space-x-reverse)));margin-right:calc(.5rem * var(--un-space-x-reverse))}.border{border-width:1px}.px{padding-left:1rem;padding-right:1rem}.text-16px{font-size:16px}.font-bold{font-weight:700}.outline{outline-style:solid}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.ease{transition-timing-function:cubic-bezier(.4,0,.2,1)}.modal-wrapper[data-v-4af3c744]{z-index:1000;position:fixed;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;background:rgba(0,0,0,.3)}.modal-content[data-v-4af3c744]{background:#ffffff;border-radius:5px;position:relative}.modal-header[data-v-4af3c744]{box-sizing:border-box;padding:10px;height:50px;display:flex;justify-content:space-between;align-items:center;border-bottom:solid 1px var(--color-border-1, #e8e8e8);color:var(--color-text-2, #4E5969)}.modal-body[data-v-4af3c744]{padding:10px;box-sizing:border-box;max-height:10vw;overflow:auto;position:relative}.modal-footer[data-v-4af3c744]{box-sizing:border-box;height:50px;border-top:solid 1px var(--color-border-1, #e8e8e8);display:flex;justify-content:flex-end;padding:10px}.modal-footer button[data-v-4af3c744]{height:28px;line-height:28px;width:80px;outline:none;border-color:transparent;font-size:14px;border-radius:4px;padding:0;box-sizing:content-box}.modal-footer button.submit-button[data-v-4af3c744]{color:#fff;background-color:rgb(var(--primary-6, 45, 106, 251))}.modal-footer button.submit-button[data-v-4af3c744]:hover{background-color:rgb(var(--primary-5, 28, 76, 207))}.modal-footer button.cancel-button[data-v-4af3c744]{color:rgb(var(--color-text-2, 78, 89, 105));background-color:var(--color-fill-1, #f5f5f5)}.modal-footer button.cancel-button[data-v-4af3c744]:hover{background-color:var(--color-fill-4, #c9cdd4)}.modal-loading[data-v-4af3c744]{position:absolute;z-index:1001;top:0;right:0;bottom:0;left:0;display:flex;justify-content:center;align-items:center;background-color:#0000001a}.modal-loading .lds-ring[data-v-4af3c744]{display:inline-block;position:relative;width:80px;height:80px}.modal-loading .lds-ring div[data-v-4af3c744]{box-sizing:border-box;display:block;position:absolute;width:48px;height:48px;margin:8px;border:5px solid #fff;border-radius:50%;animation:lds-ring-4af3c744 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:#fff transparent transparent transparent}.modal-loading .lds-ring div[data-v-4af3c744]:nth-child(1){animation-delay:-.45s}.modal-loading .lds-ring div[data-v-4af3c744]:nth-child(2){animation-delay:-.3s}.modal-loading .lds-ring div[data-v-4af3c744]:nth-child(3){animation-delay:-.15s}@keyframes lds-ring-4af3c744{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.dialog-body[data-v-8326e5a5]{padding:20px 10px 10px}.dialog-title[data-v-8326e5a5]{padding:5px;font-weight:700;font-size:16px}.dialog-content[data-v-8326e5a5]{padding:5px}.dialog-footer[data-v-8326e5a5]{box-sizing:border-box;height:50px;border-top:solid 1px var(--color-border-1, #e8e8e8);display:flex;justify-content:center;align-items:center;padding:0 10px}.dialog-footer button[data-v-8326e5a5]{height:28px;line-height:28px;width:80px;outline:none;border-color:transparent;font-size:14px;border-radius:4px;padding:0;box-sizing:content-box}.dialog-footer button.submit-button[data-v-8326e5a5]{color:#fff;background-color:rgb(var(--primary-6, 45, 106, 251))}.dialog-footer button.submit-button[data-v-8326e5a5]:hover{background-color:rgb(var(--primary-5, 28, 76, 207))}.dialog-footer button.cancel-button[data-v-8326e5a5]{color:rgb(var(--color-text-2, 78, 89, 105));background-color:var(--color-fill-1, #f5f5f5)}.dialog-footer button.cancel-button[data-v-8326e5a5]:hover{background-color:var(--color-fill-4, #c9cdd4)}.modal-fade-enter-active[data-v-241a8304],.modal-fade-leave-active[data-v-241a8304]{transition:opacity .5s ease}.modal-fade-enter-active[data-v-241a8304] .modal-content.drawer-mode,.modal-fade-leave-active[data-v-241a8304] .modal-content.drawer-mode{transition:transform .5s ease}.modal-fade-enter-from[data-v-241a8304],.modal-fade-leave-to[data-v-241a8304]{opacity:0}.modal-fade-enter-from[data-v-241a8304] .modal-content.drawer-mode,.modal-fade-leave-to[data-v-241a8304] .modal-content.drawer-mode{transform:translate3d(100%,0,0)}.modal-footer[data-v-2080a86e]{box-sizing:border-box;min-height:50px;border-top:solid 1px var(--color-border-1, rgb(232, 232, 232));padding:10px}.modal-footer button[data-v-2080a86e]{height:28px;line-height:28px;width:80px;outline:none;border-color:transparent;font-size:14px;border-radius:4px;padding:0;box-sizing:content-box}.modal-footer button.submit-button[data-v-2080a86e]{color:#fff;background-color:rgb(var(--primary-6, 45, 106, 251))}.modal-footer button.submit-button[data-v-2080a86e]:hover{background-color:rgb(var(--primary-5, 28, 76, 207))}.modal-footer button.cancel-button[data-v-2080a86e]{color:rgb(var(--color-text-2, 78, 89, 105));background-color:var(--color-fill-1, #f5f5f5)}.modal-footer button.cancel-button[data-v-2080a86e]:hover{background-color:var(--color-fill-4, #c9cdd4)}.modal-header[data-v-d0247172]{box-sizing:border-box;padding:10px;min-height:50px;border-bottom:solid 1px var(--color-border-1, rgb(232, 232, 232));color:var(--color-text-2, #4E5969)}
1
+ *,:before,:after{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / .5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }::backdrop{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / .5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }.i-icon-park-outline\:close{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 48 48' width='1em' height='1em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='4' d='m8 8l32 32M8 40L40 8'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1em;height:1em}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.transform{transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.cursor-pointer{cursor:pointer}.resize{resize:both}.space-x-2>:not([hidden])~:not([hidden]){--un-space-x-reverse:0;margin-left:calc(.5rem * calc(1 - var(--un-space-x-reverse)));margin-right:calc(.5rem * var(--un-space-x-reverse))}.border{border-width:1px}.px{padding-left:1rem;padding-right:1rem}.text-16px{font-size:16px}.font-bold{font-weight:700}.outline{outline-style:solid}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.ease{transition-timing-function:cubic-bezier(.4,0,.2,1)}.modal-wrapper[data-v-eaa553bd]{z-index:1000;position:fixed;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;background:rgba(0,0,0,.3)}.modal-content[data-v-eaa553bd]{background:#ffffff;border-radius:5px;position:relative}.modal-header[data-v-eaa553bd]{box-sizing:border-box;padding:10px;height:50px;display:flex;justify-content:space-between;align-items:center;border-bottom:solid 1px var(--color-border-1, #e8e8e8);color:var(--color-text-2, #4E5969)}.modal-body[data-v-eaa553bd]{padding:10px;box-sizing:border-box;overflow:auto;position:relative}.modal-footer[data-v-eaa553bd]{box-sizing:border-box;height:50px;border-top:solid 1px var(--color-border-1, #e8e8e8);display:flex;justify-content:flex-end;padding:10px}.modal-footer button[data-v-eaa553bd]{height:28px;line-height:28px;width:80px;outline:none;border-color:transparent;font-size:14px;border-radius:4px;padding:0;box-sizing:content-box}.modal-footer button.submit-button[data-v-eaa553bd]{color:#fff;background-color:rgb(var(--primary-6, 45, 106, 251))}.modal-footer button.submit-button[data-v-eaa553bd]:hover{background-color:rgb(var(--primary-5, 28, 76, 207))}.modal-footer button.cancel-button[data-v-eaa553bd]{color:rgb(var(--color-text-2, 78, 89, 105));background-color:var(--color-fill-1, #f5f5f5)}.modal-footer button.cancel-button[data-v-eaa553bd]:hover{background-color:var(--color-fill-4, #c9cdd4)}.modal-loading[data-v-eaa553bd]{position:absolute;z-index:1001;top:0;right:0;bottom:0;left:0;display:flex;justify-content:center;align-items:center;background-color:#0000001a}.modal-loading .lds-ring[data-v-eaa553bd]{display:inline-block;position:relative;width:80px;height:80px}.modal-loading .lds-ring div[data-v-eaa553bd]{box-sizing:border-box;display:block;position:absolute;width:48px;height:48px;margin:8px;border:5px solid #fff;border-radius:50%;animation:lds-ring-eaa553bd 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:#fff transparent transparent transparent}.modal-loading .lds-ring div[data-v-eaa553bd]:nth-child(1){animation-delay:-.45s}.modal-loading .lds-ring div[data-v-eaa553bd]:nth-child(2){animation-delay:-.3s}.modal-loading .lds-ring div[data-v-eaa553bd]:nth-child(3){animation-delay:-.15s}@keyframes lds-ring-eaa553bd{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.dialog-body[data-v-8326e5a5]{padding:20px 10px 10px}.dialog-title[data-v-8326e5a5]{padding:5px;font-weight:700;font-size:16px}.dialog-content[data-v-8326e5a5]{padding:5px}.dialog-footer[data-v-8326e5a5]{box-sizing:border-box;height:50px;border-top:solid 1px var(--color-border-1, #e8e8e8);display:flex;justify-content:center;align-items:center;padding:0 10px}.dialog-footer button[data-v-8326e5a5]{height:28px;line-height:28px;width:80px;outline:none;border-color:transparent;font-size:14px;border-radius:4px;padding:0;box-sizing:content-box}.dialog-footer button.submit-button[data-v-8326e5a5]{color:#fff;background-color:rgb(var(--primary-6, 45, 106, 251))}.dialog-footer button.submit-button[data-v-8326e5a5]:hover{background-color:rgb(var(--primary-5, 28, 76, 207))}.dialog-footer button.cancel-button[data-v-8326e5a5]{color:rgb(var(--color-text-2, 78, 89, 105));background-color:var(--color-fill-1, #f5f5f5)}.dialog-footer button.cancel-button[data-v-8326e5a5]:hover{background-color:var(--color-fill-4, #c9cdd4)}.modal-fade-enter-active[data-v-241a8304],.modal-fade-leave-active[data-v-241a8304]{transition:opacity .5s ease}.modal-fade-enter-active[data-v-241a8304] .modal-content.drawer-mode,.modal-fade-leave-active[data-v-241a8304] .modal-content.drawer-mode{transition:transform .5s ease}.modal-fade-enter-from[data-v-241a8304],.modal-fade-leave-to[data-v-241a8304]{opacity:0}.modal-fade-enter-from[data-v-241a8304] .modal-content.drawer-mode,.modal-fade-leave-to[data-v-241a8304] .modal-content.drawer-mode{transform:translate3d(100%,0,0)}.modal-footer[data-v-2080a86e]{box-sizing:border-box;min-height:50px;border-top:solid 1px var(--color-border-1, rgb(232, 232, 232));padding:10px}.modal-footer button[data-v-2080a86e]{height:28px;line-height:28px;width:80px;outline:none;border-color:transparent;font-size:14px;border-radius:4px;padding:0;box-sizing:content-box}.modal-footer button.submit-button[data-v-2080a86e]{color:#fff;background-color:rgb(var(--primary-6, 45, 106, 251))}.modal-footer button.submit-button[data-v-2080a86e]:hover{background-color:rgb(var(--primary-5, 28, 76, 207))}.modal-footer button.cancel-button[data-v-2080a86e]{color:rgb(var(--color-text-2, 78, 89, 105));background-color:var(--color-fill-1, #f5f5f5)}.modal-footer button.cancel-button[data-v-2080a86e]:hover{background-color:var(--color-fill-4, #c9cdd4)}.modal-header[data-v-d0247172]{box-sizing:border-box;padding:10px;min-height:50px;border-bottom:solid 1px var(--color-border-1, rgb(232, 232, 232));color:var(--color-text-2, #4E5969)}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gopowerteam/modal-render",
3
3
  "type": "module",
4
- "version": "0.0.29",
4
+ "version": "0.0.30",
5
5
  "author": {
6
6
  "name": "zhuchentong",
7
7
  "email": "2037630@gmail.com"