@gopowerteam/modal-render 0.0.30 → 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 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;
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,33 +1,33 @@
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__");
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
3
  function de(t) {
4
- return ge() ? (_e(t), !0) : !1;
4
+ return _e() ? (be(t), !0) : !1;
5
5
  }
6
- function C(t) {
6
+ function x(t) {
7
7
  return typeof t == "function" ? t() : le(t);
8
8
  }
9
9
  const ce = typeof window < "u" && typeof document < "u";
10
10
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
11
- const Oe = Object.prototype.toString, ze = (t) => Oe.call(t) === "[object Object]", He = () => {
11
+ const He = Object.prototype.toString, ze = (t) => He.call(t) === "[object Object]", Ne = () => {
12
12
  };
13
- function Ne(t, r = {}) {
14
- if (!ve(t))
15
- return he(t);
13
+ function Fe(t, s = {}) {
14
+ if (!he(t))
15
+ return me(t);
16
16
  const o = Array.isArray(t.value) ? Array.from({ length: t.value.length }) : {};
17
17
  for (const e in t.value)
18
- o[e] = me(() => ({
18
+ o[e] = ge(() => ({
19
19
  get() {
20
20
  return t.value[e];
21
21
  },
22
22
  set(a) {
23
23
  var i;
24
- if ((i = C(r.replaceRef)) != null ? i : !0)
24
+ if ((i = x(s.replaceRef)) != null ? i : !0)
25
25
  if (Array.isArray(t.value)) {
26
- const p = [...t.value];
27
- p[e] = a, t.value = p;
26
+ const v = [...t.value];
27
+ v[e] = a, t.value = v;
28
28
  } else {
29
- const p = { ...t.value, [e]: a };
30
- Object.setPrototypeOf(p, Object.getPrototypeOf(t.value)), t.value = p;
29
+ const v = { ...t.value, [e]: a };
30
+ Object.setPrototypeOf(v, Object.getPrototypeOf(t.value)), t.value = v;
31
31
  }
32
32
  else
33
33
  t.value[e] = a;
@@ -35,181 +35,181 @@ function Ne(t, r = {}) {
35
35
  }));
36
36
  return o;
37
37
  }
38
- function Fe(t, r = !0) {
39
- V() ? K(t) : r ? t() : ye(t);
38
+ function We(t, s = !0) {
39
+ V() ? Y(t) : s ? t() : ye(t);
40
40
  }
41
41
  function O(t) {
42
- var r;
43
- const o = C(t);
44
- return (r = o == null ? void 0 : o.$el) != null ? r : o;
42
+ var s;
43
+ const o = x(t);
44
+ return (s = o == null ? void 0 : o.$el) != null ? s : o;
45
45
  }
46
- const q = ce ? window : void 0;
46
+ const U = ce ? window : void 0;
47
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;
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
51
  Array.isArray(o) || (o = [o]), Array.isArray(e) || (e = [e]);
52
52
  const i = [], c = () => {
53
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)],
54
+ }, v = (h, d, r, u) => (h.addEventListener(d, r, u), () => h.removeEventListener(d, r, u)), b = te(
55
+ () => [O(s), x(a)],
56
56
  ([h, d]) => {
57
57
  if (c(), !h)
58
58
  return;
59
- const s = ze(d) ? { ...d } : d;
59
+ const r = ze(d) ? { ...d } : d;
60
60
  i.push(
61
- ...o.flatMap((u) => e.map((l) => p(h, u, l, s)))
61
+ ...o.flatMap((u) => e.map((l) => v(h, u, l, r)))
62
62
  );
63
63
  },
64
64
  { immediate: !0, flush: "post" }
65
- ), w = () => {
66
- _(), c();
65
+ ), _ = () => {
66
+ b(), c();
67
67
  };
68
- return de(w), w;
68
+ return de(_), _;
69
69
  }
70
- function We() {
71
- const t = z(!1);
72
- return V() && K(() => {
70
+ function De() {
71
+ const t = H(!1);
72
+ return V() && Y(() => {
73
73
  t.value = !0;
74
74
  }), t;
75
75
  }
76
- function De(t) {
77
- const r = We();
78
- return $(() => (r.value, !!t()));
76
+ function Ie(t) {
77
+ const s = De();
78
+ return E(() => (s.value, !!t()));
79
79
  }
80
- function Ie(t, r = {}) {
80
+ function Ve(t, s = {}) {
81
81
  var o, e;
82
82
  const {
83
83
  pointerTypes: a,
84
84
  preventDefault: i,
85
85
  stopPropagation: c,
86
- exact: p,
87
- onMove: _,
88
- onEnd: w,
86
+ exact: v,
87
+ onMove: b,
88
+ onEnd: _,
89
89
  onStart: h,
90
90
  initialValue: d,
91
- axis: s = "both",
92
- draggingElement: u = q,
91
+ axis: r = "both",
92
+ draggingElement: u = U,
93
93
  containerElement: l,
94
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) => {
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
100
  var B;
101
- if (!S(v) || C(p) && v.target !== C(t))
101
+ if (!k(p) || x(v) && p.target !== x(t))
102
102
  return;
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)
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)
106
106
  };
107
- (h == null ? void 0 : h(A, v)) !== !1 && (x.value = A, R(v));
108
- }, G = (v) => {
107
+ (h == null ? void 0 : h(A, p)) !== !1 && (C.value = A, R(p));
108
+ }, J = (p) => {
109
109
  var B;
110
- if (!S(v) || !x.value)
110
+ if (!k(p) || !C.value)
111
111
  return;
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 = {
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
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));
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));
120
120
  };
121
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);
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);
124
124
  }
125
125
  return {
126
- ...Ne(f),
126
+ ...Fe(f),
127
127
  position: f,
128
- isDragging: $(() => !!x.value),
129
- style: $(
128
+ isDragging: E(() => !!C.value),
129
+ style: E(
130
130
  () => `left:${f.value.x}px;top:${f.value.y}px;`
131
131
  )
132
132
  };
133
133
  }
134
- function Ve(t, r, o = {}) {
135
- const { window: e = q, ...a } = o;
134
+ function je(t, s, o = {}) {
135
+ const { window: e = U, ...a } = o;
136
136
  let i;
137
- const c = De(() => e && "ResizeObserver" in e), p = () => {
137
+ const c = Ie(() => e && "ResizeObserver" in e), v = () => {
138
138
  i && (i.disconnect(), i = void 0);
139
- }, _ = $(() => Array.isArray(t) ? t.map((d) => O(d)) : [O(t)]), w = te(
140
- _,
139
+ }, b = E(() => Array.isArray(t) ? t.map((d) => O(d)) : [O(t)]), _ = te(
140
+ b,
141
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);
142
+ if (v(), c.value && e) {
143
+ i = new ResizeObserver(s);
144
+ for (const r of d)
145
+ r && i.observe(r, a);
146
146
  }
147
147
  },
148
148
  { immediate: !0, flush: "post", deep: !0 }
149
149
  ), h = () => {
150
- p(), w();
150
+ v(), _();
151
151
  };
152
152
  return de(h), {
153
153
  isSupported: c,
154
154
  stop: h
155
155
  };
156
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(
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
162
  t,
163
163
  ([d]) => {
164
- const s = a === "border-box" ? d.borderBoxSize : a === "content-box" ? d.contentBoxSize : d.devicePixelContentBoxSize;
164
+ const r = a === "border-box" ? d.borderBoxSize : a === "content-box" ? d.contentBoxSize : d.devicePixelContentBoxSize;
165
165
  if (e && i.value) {
166
166
  const u = O(t);
167
167
  if (u) {
168
168
  const l = e.getComputedStyle(u);
169
- c.value = Number.parseFloat(l.width), p.value = Number.parseFloat(l.height);
169
+ c.value = Number.parseFloat(l.width), v.value = Number.parseFloat(l.height);
170
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);
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
174
  } else
175
- c.value = d.contentRect.width, p.value = d.contentRect.height;
175
+ c.value = d.contentRect.width, v.value = d.contentRect.height;
176
176
  },
177
177
  o
178
178
  );
179
- Fe(() => {
179
+ We(() => {
180
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);
181
+ d && (c.value = "offsetWidth" in d ? d.offsetWidth : s.width, v.value = "offsetHeight" in d ? d.offsetHeight : s.height);
182
182
  });
183
- const w = te(
183
+ const _ = te(
184
184
  () => O(t),
185
185
  (d) => {
186
- c.value = d ? r.width : 0, p.value = d ? r.height : 0;
186
+ c.value = d ? s.width : 0, v.value = d ? s.height : 0;
187
187
  }
188
188
  );
189
189
  function h() {
190
- _(), w();
190
+ b(), _();
191
191
  }
192
192
  return {
193
193
  width: c,
194
- height: p,
194
+ height: v,
195
195
  stop: h
196
196
  };
197
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 = {
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 = {
199
199
  key: 2,
200
200
  class: "modal-loading"
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 = {
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 = {
209
209
  name: "ModalContainer",
210
210
  inheritAttrs: !0
211
- }, Qe = /* @__PURE__ */ oe({
212
- ...Je,
211
+ }, Ze = /* @__PURE__ */ oe({
212
+ ...Qe,
213
213
  props: {
214
214
  id: {},
215
215
  form: {},
@@ -217,7 +217,7 @@ const je = (t) => (Se("data-v-eaa553bd"), t = t(), $e(), t), Ge = { class: "titl
217
217
  componentProps: {},
218
218
  width: {},
219
219
  maxWidth: {},
220
- maxHeight: {},
220
+ maxHeight: { default: 90 },
221
221
  sizes: {},
222
222
  size: { default: "middle" },
223
223
  fullscreen: { type: Boolean },
@@ -237,151 +237,147 @@ const je = (t) => (Se("data-v-eaa553bd"), t = t(), $e(), t), Ge = { class: "titl
237
237
  cancelText: { default: "取消" }
238
238
  },
239
239
  emits: ["submit"],
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, {
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, {
244
244
  initialValue: { x: 0, y: 0 }
245
245
  });
246
246
  function G() {
247
247
  i == null || i.close(e.id);
248
248
  }
249
- function H(n) {
250
- if (typeof n == "number")
251
- return `${n}px`;
252
- if (typeof n == "string")
253
- return n;
249
+ function p(n) {
250
+ return typeof n == "number" ? `${n}px` : n;
254
251
  }
255
- const v = $(() => {
252
+ const B = E(() => {
256
253
  const n = {};
257
254
  return e.mode === "dialog" && (n.justifyContent = "center"), e.mode === "drawer" && (n.justifyContent = "flex-end"), n;
258
- }), B = $(() => {
255
+ }), w = E(() => {
259
256
  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 = $(() => {
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(() => {
262
259
  const n = {};
263
260
  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;
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;
268
264
  });
269
- function E() {
265
+ function A() {
270
266
  const n = h.value;
271
267
  if (e.form && n) {
272
- const k = n.querySelector(`form[name="${e.form}"]`);
273
- k && k.dispatchEvent(new Event("submit"));
268
+ const M = n.querySelector(`form[name="${e.form}"]`);
269
+ M && M.dispatchEvent(new Event("submit"));
274
270
  }
275
271
  a("submit");
276
272
  }
277
- function A() {
273
+ function z() {
278
274
  i == null || i.close(e.id);
279
275
  }
280
- function N() {
276
+ function ue() {
281
277
  window && window.addEventListener("resize", () => {
282
- I(w), I(h), h.value && (p = h.value.offsetLeft, _ = h.value.offsetTop);
278
+ I(_), I(h), h.value && (v = h.value.offsetLeft, b = h.value.offsetTop);
283
279
  });
284
280
  }
285
- function ue() {
281
+ function fe() {
286
282
  if (e.closeable && e.esc) {
287
- const n = ({ key: k }) => {
288
- k === "Escape" && (i == null || i.close(e.id), window.removeEventListener("keydown", n));
283
+ const n = ({ key: M }) => {
284
+ M === "Escape" && (i == null || i.close(e.id), window.removeEventListener("keydown", n));
289
285
  };
290
286
  window.addEventListener("keydown", n);
291
287
  }
292
288
  }
293
- function fe() {
294
- p = h.value.offsetLeft, _ = h.value.offsetTop;
289
+ function pe() {
290
+ v = h.value.offsetLeft, b = h.value.offsetTop;
295
291
  }
296
- K(() => {
297
- ue(), N();
292
+ Y(() => {
293
+ fe(), ue();
298
294
  }), we(() => {
299
295
  });
300
- function pe() {
296
+ function ve() {
301
297
  return c.value = !0, () => ie();
302
298
  }
303
299
  function ie() {
304
300
  c.value = !1;
305
301
  }
306
- return r({
307
- showLoading: pe,
302
+ return s({
303
+ showLoading: ve,
308
304
  hideLoading: ie
309
- }), (n, k) => (g(), M("div", {
305
+ }), (n, M) => (y(), S("div", {
310
306
  ref_key: "wrapperRef",
311
- ref: w,
307
+ ref: _,
312
308
  class: "modal-wrapper",
313
- style: D(v.value),
314
- onClick: k[0] || (k[0] = be((Q) => n.maskClosable && G(), ["self"]))
309
+ style: D(B.value),
310
+ onClick: M[0] || (M[0] = xe((Q) => n.maskClosable && G(), ["self"]))
315
311
  }, [
316
- xe(L(le(x)) + " ", 1),
317
- y("div", {
312
+ Ce(L(le(k)) + " ", 1),
313
+ g("div", {
318
314
  ref_key: "contentRef",
319
315
  ref: h,
320
- class: Ce(["modal-content", { [`${n.mode}-mode`]: !0 }]),
321
- style: D(B.value)
316
+ class: ke(["modal-content", { [`${n.mode}-mode`]: !0 }]),
317
+ style: D(w.value)
322
318
  }, [
323
- n.header ? (g(), M("div", {
319
+ n.header ? (y(), S("div", {
324
320
  key: 0,
325
321
  ref_key: "headerRef",
326
322
  ref: d,
327
323
  class: "modal-header",
328
- style: D(b.value),
329
- onMousedown: fe
324
+ style: D(P.value),
325
+ onMousedown: pe
330
326
  }, [
331
- y("div", Ge, L(n.title), 1),
332
- y("div", Xe, [
333
- n.closeable ? (g(), M("div", {
327
+ g("div", Xe, L(n.title), 1),
328
+ g("div", Ye, [
329
+ n.closeable ? (y(), S("div", {
334
330
  key: 0,
335
331
  class: "i-icon-park-outline:close block cursor-pointer",
336
332
  onClick: G
337
- })) : F("", !0)
333
+ })) : N("", !0)
338
334
  ])
339
- ], 36)) : F("", !0),
340
- y("div", {
335
+ ], 36)) : N("", !0),
336
+ g("div", {
341
337
  id: "modal-header-slot",
342
338
  ref_key: "headerSlotRef",
343
339
  ref: u
344
340
  }, null, 512),
345
- y("div", {
341
+ g("div", {
346
342
  class: "modal-body",
347
- style: D(P.value)
343
+ style: D($.value)
348
344
  }, [
349
- (g(), W(ae(n.component), ke(Me(n.componentProps)), null, 16))
345
+ (y(), F(ae(n.component), Me(Se(n.componentProps)), null, 16))
350
346
  ], 4),
351
- y("div", {
347
+ g("div", {
352
348
  id: "modal-footer-slot",
353
349
  ref_key: "footerSlotRef",
354
350
  ref: l
355
351
  }, null, 512),
356
- n.footer ? (g(), M("div", {
352
+ n.footer ? (y(), S("div", {
357
353
  key: 1,
358
354
  ref_key: "footerRef",
359
- ref: s,
355
+ ref: r,
360
356
  class: "modal-footer space-x-2"
361
357
  }, [
362
- y("button", {
358
+ g("button", {
363
359
  class: "cancel-button",
364
360
  type: "button",
365
- onClick: A
361
+ onClick: z
366
362
  }, L(n.cancelText), 1),
367
- y("button", {
363
+ g("button", {
368
364
  class: "submit-button",
369
365
  form: n.form,
370
366
  type: "submit",
371
- onClick: E
372
- }, L(n.submitText), 9, Ye)
373
- ], 512)) : F("", !0),
374
- c.value ? (g(), M("div", Ke, qe)) : F("", !0)
367
+ onClick: A
368
+ }, L(n.submitText), 9, Ke)
369
+ ], 512)) : N("", !0),
370
+ c.value ? (y(), S("div", Ue, Je)) : N("", !0)
375
371
  ], 6)
376
372
  ], 4));
377
373
  }
378
374
  });
379
- const j = (t, r) => {
375
+ const j = (t, s) => {
380
376
  const o = t.__vccOpts || t;
381
- for (const [e, a] of r)
377
+ for (const [e, a] of s)
382
378
  o[e] = a;
383
379
  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({
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({
385
381
  __name: "modal-dialog",
386
382
  props: {
387
383
  type: {},
@@ -394,53 +390,53 @@ const j = (t, r) => {
394
390
  footer: {}
395
391
  },
396
392
  setup(t) {
397
- const r = t, o = ht(), e = $(() => r.title ? r.title : {
393
+ const s = t, o = mt(), e = E(() => s.title ? s.title : {
398
394
  confirm: "提示",
399
395
  info: "提示",
400
396
  warning: "警告",
401
397
  error: "错误",
402
398
  success: "成功"
403
- }[r.type]);
399
+ }[s.type]);
404
400
  async function a() {
405
- r.onOk && await r.onOk(), o.close();
401
+ s.onOk && await s.onOk(), o.close();
406
402
  }
407
403
  async function i() {
408
- r.onCancel && await r.onCancel(), o.close();
404
+ s.onCancel && await s.onCancel(), o.close();
409
405
  }
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)
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)
414
410
  ]),
415
- y("div", {
411
+ g("div", {
416
412
  class: "dialog-footer space-x-2",
417
413
  style: D(c.type === "confirm" ? { "justify-content": "end" } : { "border-top": "none" })
418
414
  }, [
419
- c.footer ? (g(), W(ae(c.footer), { key: 0 })) : (g(), M(ee, { key: 1 }, [
420
- y("button", {
415
+ c.footer ? (y(), F(ae(c.footer), { key: 0 })) : (y(), S(ee, { key: 1 }, [
416
+ g("button", {
421
417
  class: "submit-button",
422
418
  type: "submit",
423
419
  onClick: a
424
420
  }, L(c.okText), 1),
425
- c.type === "confirm" ? (g(), M("button", {
421
+ c.type === "confirm" ? (y(), S("button", {
426
422
  key: 0,
427
423
  class: "cancel-button",
428
424
  type: "button",
429
425
  onClick: i
430
- }, L(c.cancelText), 1)) : F("", !0)
426
+ }, L(c.cancelText), 1)) : N("", !0)
431
427
  ], 64))
432
428
  ], 4)
433
429
  ]));
434
430
  }
435
431
  });
436
- const rt = /* @__PURE__ */ j(st, [["__scopeId", "data-v-8326e5a5"]]), it = {
432
+ const it = /* @__PURE__ */ j(st, [["__scopeId", "data-v-8326e5a5"]]), lt = {
437
433
  key: 0,
438
434
  class: "modal-teleport"
439
- }, lt = {
435
+ }, at = {
440
436
  name: "ModalProvider",
441
437
  inheritAttrs: !0
442
- }, at = /* @__PURE__ */ oe({
443
- ...lt,
438
+ }, dt = /* @__PURE__ */ oe({
439
+ ...at,
444
440
  props: {
445
441
  appendToBody: { type: [Boolean, String], default: !1 },
446
442
  sizes: { default: () => ({
@@ -452,54 +448,54 @@ const rt = /* @__PURE__ */ j(st, [["__scopeId", "data-v-8326e5a5"]]), it = {
452
448
  maxHeight: { default: "90%" },
453
449
  offset: { default: () => ({ x: 0, y: 0 }) }
454
450
  },
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)
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)
460
456
  );
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) => {
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) => {
463
459
  o.value.push({
464
460
  id: f,
465
461
  component: m,
466
462
  props: u || {},
467
463
  options: {
468
464
  ...l,
469
- type: typeof s == "string" ? s : "component"
465
+ type: typeof r == "string" ? r : "component"
470
466
  },
471
- resolve: S,
467
+ resolve: k,
472
468
  reject: R,
473
469
  listeners: []
474
470
  }), I(o);
475
- }).catch((S) => S === "CANCEL" ? new Promise(() => {
476
- }) : Promise.reject(S));
477
- return Object.assign(x, {
471
+ }).catch((k) => k === "CANCEL" ? new Promise(() => {
472
+ }) : Promise.reject(k));
473
+ return Object.assign(C, {
478
474
  close: () => c(f)
479
475
  });
480
476
  }
481
- function c(s, u) {
482
- const l = o.value.findIndex((f) => f.id === s);
477
+ function c(r, u) {
478
+ const l = o.value.findIndex((f) => f.id === r);
483
479
  if (l < 0)
484
480
  return;
485
481
  const m = o.value[l];
486
482
  u === void 0 ? m == null || m.reject("CANCEL") : m == null || m.resolve(u), o.value.splice(l, 1), I(o);
487
483
  }
488
- function p() {
489
- !o.value || o.value.length === 0 || (o.value.forEach((s) => {
490
- s == null || s.reject("CANCEL");
484
+ function v() {
485
+ !o.value || o.value.length === 0 || (o.value.forEach((r) => {
486
+ r == null || r.reject("CANCEL");
491
487
  }), o.value = [], I(o));
492
488
  }
493
- function _(s, u) {
494
- const l = o.value.find((f) => f.id === s);
489
+ function b(r, u) {
490
+ const l = o.value.find((f) => f.id === r);
495
491
  if (!l)
496
492
  return;
497
493
  const m = l.listeners.find((f) => f.event === u);
498
494
  m && m.callback({
499
495
  open: i,
500
496
  close: (f) => c(l.id, f),
501
- closeAll: p,
502
- showLoading: () => w(l.id),
497
+ closeAll: v,
498
+ showLoading: () => _(l.id),
503
499
  hideLoading: () => h(l.id),
504
500
  confirm: (f) => i("confirm", f),
505
501
  success: (f) => i("success", f),
@@ -508,98 +504,98 @@ const rt = /* @__PURE__ */ j(st, [["__scopeId", "data-v-8326e5a5"]]), it = {
508
504
  info: (f) => i("info", f)
509
505
  });
510
506
  }
511
- function w(s) {
507
+ function _(r) {
512
508
  if (!a)
513
509
  return;
514
- const [u] = a.refs[`modal-container_${s}`];
510
+ const [u] = a.refs[`modal-container_${r}`];
515
511
  if (u)
516
512
  return u.showLoading();
517
513
  }
518
- function h(s) {
514
+ function h(r) {
519
515
  if (!a)
520
516
  return;
521
- const [u] = a.refs[`modal-container_${s}`];
517
+ const [u] = a.refs[`modal-container_${r}`];
522
518
  if (u)
523
519
  return u.hideLoading();
524
520
  }
525
- function d(s, u, l) {
526
- const m = o.value.find((f) => f.id === s);
521
+ function d(r, u, l) {
522
+ const m = o.value.find((f) => f.id === r);
527
523
  m && m.listeners.push({
528
524
  event: u,
529
525
  callback: l
530
526
  });
531
527
  }
532
- return Ee(U, {
528
+ return Ae(K, {
533
529
  open: i,
534
530
  close: c,
535
- closeAll: p,
531
+ closeAll: v,
536
532
  addEventListener: d
537
- }), r({
533
+ }), s({
538
534
  elements: o,
539
535
  open: i,
540
536
  close: c,
541
- closeAll: p
542
- }), K(() => {
537
+ closeAll: v
538
+ }), Y(() => {
543
539
  e.value = !0;
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"
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"
550
546
  }, [
551
- Ae(Le, { name: "modal-fade" }, {
552
- default: Re(() => [
553
- (g(!0), M(ee, null, Be(o.value, (l) => (g(), W(Ze, Pe({
547
+ Le(Re, { name: "modal-fade" }, {
548
+ default: Be(() => [
549
+ (y(!0), S(ee, null, Pe(o.value, (l) => (y(), F(et, Te({
554
550
  id: l.id,
555
551
  key: l.id,
556
552
  ref_for: !0,
557
553
  ref: `modal-container_${l.id}`,
558
554
  component: l.component,
559
555
  "component-props": l.props,
560
- "max-height": s.maxHeight,
561
- "max-width": s.maxWidth,
562
- offset: s.offset,
563
- sizes: s.sizes
556
+ "max-height": r.maxHeight,
557
+ "max-width": r.maxWidth,
558
+ offset: r.offset,
559
+ sizes: r.sizes
564
560
  }, l.options, {
565
- onSubmit: () => _(l.id, "submit")
561
+ onSubmit: () => b(l.id, "submit")
566
562
  }), null, 16, ["id", "component", "component-props", "max-height", "max-width", "offset", "sizes", "onSubmit"]))), 128))
567
563
  ]),
568
564
  _: 1
569
565
  })
570
566
  ], 8, ["disabled", "to"]))
571
- ])) : F("", !0)
567
+ ])) : N("", !0)
572
568
  ], 64));
573
569
  }
574
570
  });
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)
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)
581
577
  ])
582
578
  ]);
583
579
  }
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)
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)
590
586
  ])
591
587
  ]);
592
588
  }
593
- const _t = /* @__PURE__ */ j(ft, [["render", vt], ["__scopeId", "data-v-d0247172"]]);
594
- function Y(t, r) {
589
+ const bt = /* @__PURE__ */ j(pt, [["render", ht], ["__scopeId", "data-v-d0247172"]]);
590
+ function X(t, s) {
595
591
  var e, a;
596
592
  let o = t == null ? void 0 : t.parent;
597
- for (; o && ((e = o == null ? void 0 : o.type) == null ? void 0 : e.name) !== r; )
593
+ for (; o && ((e = o == null ? void 0 : o.type) == null ? void 0 : e.name) !== s; )
598
594
  o = o.parent;
599
- return ((a = o == null ? void 0 : o.type) == null ? void 0 : a.name) === r ? o : null;
595
+ return ((a = o == null ? void 0 : o.type) == null ? void 0 : a.name) === s ? o : null;
600
596
  }
601
- function ht() {
602
- const t = ne(U), r = V();
597
+ function mt() {
598
+ const t = ne(K), s = V();
603
599
  function o(e, a, i) {
604
600
  if (!t)
605
601
  throw new Error("Not Found Modal Provider Component");
@@ -611,7 +607,7 @@ function ht() {
611
607
  var c;
612
608
  if (!t)
613
609
  throw new Error("Not Found Modal Provider Component");
614
- const a = Y(r, "ModalContainer"), i = (c = a == null ? void 0 : a.props) == null ? void 0 : c.id;
610
+ const a = X(s, "ModalContainer"), i = (c = a == null ? void 0 : a.props) == null ? void 0 : c.id;
615
611
  if (!i)
616
612
  throw new Error("Not Found Current Modal Container");
617
613
  t.close(i, e);
@@ -625,7 +621,7 @@ function ht() {
625
621
  var i;
626
622
  if (!t)
627
623
  throw new Error("Not Found Modal Provider Component");
628
- const e = Y(r, "ModalContainer");
624
+ const e = X(s, "ModalContainer");
629
625
  if (!((i = e == null ? void 0 : e.props) == null ? void 0 : i.id))
630
626
  throw new Error("Not Found Current Modal Container");
631
627
  e != null && e.exposed && (e == null || e.exposed.showLoading());
@@ -634,7 +630,7 @@ function ht() {
634
630
  var i;
635
631
  if (!t)
636
632
  throw new Error("Not Found Modal Provider Component");
637
- const e = Y(r, "ModalContainer");
633
+ const e = X(s, "ModalContainer");
638
634
  if (!((i = e == null ? void 0 : e.props) == null ? void 0 : i.id))
639
635
  throw new Error("Not Found Current Modal Container");
640
636
  e != null && e.exposed && (e == null || e.exposed.hideLoading());
@@ -658,15 +654,15 @@ function ht() {
658
654
  }
659
655
  function wt(t) {
660
656
  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);
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);
663
659
  }
664
660
  export {
665
- Ze as ModalContainer,
666
- gt as ModalFooter,
667
- _t as ModalHeader,
668
- U as ModalKey,
661
+ et as ModalContainer,
662
+ _t as ModalFooter,
663
+ bt as ModalHeader,
664
+ K as ModalKey,
669
665
  yt as ModalProvider,
670
666
  wt as onSubmit,
671
- ht as useModal
667
+ mt as useModal
672
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-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)}
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.30",
4
+ "version": "0.0.31",
5
5
  "author": {
6
6
  "name": "zhuchentong",
7
7
  "email": "2037630@gmail.com"