@gopowerteam/modal-render 0.0.29 → 0.0.31

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