@gopowerteam/modal-render 0.0.22 → 0.0.24

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.
@@ -0,0 +1,9 @@
1
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>, {
2
+ default?(_: {}): any;
3
+ }>;
4
+ export default _default;
5
+ type __VLS_WithTemplateSlots<T, S> = T & {
6
+ new (): {
7
+ $slots: S;
8
+ };
9
+ };
@@ -14,9 +14,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
14
14
  maxWidth: string;
15
15
  maxHeight: string;
16
16
  sizes: () => {
17
- small: string;
18
- middle: string;
19
- large: string;
17
+ small: number;
18
+ middle: number;
19
+ large: number;
20
20
  };
21
21
  offset: () => {
22
22
  x: number;
@@ -43,9 +43,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
43
43
  maxWidth: string;
44
44
  maxHeight: string;
45
45
  sizes: () => {
46
- small: string;
47
- middle: string;
48
- large: string;
46
+ small: number;
47
+ middle: number;
48
+ large: number;
49
49
  };
50
50
  offset: () => {
51
51
  x: number;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue");const N=Symbol("__MODAL__");function F(n){return e.getCurrentScope()?(e.onScopeDispose(n),!0):!1}function w(n){return typeof n=="function"?n():e.unref(n)}const T=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const W=Object.prototype.toString,I=n=>W.call(n)==="[object Object]",H=()=>{};function j(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 i;if((i=w(s.replaceRef))!=null?i:!0)if(Array.isArray(n.value)){const v=[...n.value];v[t]=a,n.value=v}else{const v={...n.value,[t]:a};Object.setPrototypeOf(v,Object.getPrototypeOf(n.value)),n.value=v}else n.value[t]=a}}));return r}function G(n){var s;const r=w(n);return(s=r==null?void 0:r.$el)!=null?s:r}const z=T?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=z):[s,r,t,a]=n,!s)return H;Array.isArray(r)||(r=[r]),Array.isArray(t)||(t=[t]);const i=[],p=()=>{i.forEach(m=>m()),i.length=0},v=(m,h,l,f)=>(m.addEventListener(h,l,f),()=>m.removeEventListener(h,l,f)),C=e.watch(()=>[G(s),w(a)],([m,h])=>{if(p(),!m)return;const l=I(h)?{...h}:h;i.push(...r.flatMap(f=>t.map(c=>v(m,f,c,l))))},{immediate:!0,flush:"post"}),b=()=>{C(),p()};return F(b),b}function K(n,s={}){var r,t;const{pointerTypes:a,preventDefault:i,stopPropagation:p,exact:v,onMove:C,onEnd:b,onStart:m,initialValue:h,axis:l="both",draggingElement:f=z,containerElement:c,handle:y=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,B=u=>{w(i)&&u.preventDefault(),w(p)&&u.stopPropagation()},V=u=>{var S;if(!E(u)||w(v)&&u.target!==w(n))return;const _=w(c),x=(S=_==null?void 0:_.getBoundingClientRect)==null?void 0:S.call(_),o=w(n).getBoundingClientRect(),g={x:u.clientX-(_?o.left-x.left:o.left),y:u.clientY-(_?o.top-x.top:o.top)};(m==null?void 0:m(g,u))!==!1&&(k.value=g,B(u))},$=u=>{var S;if(!E(u)||!k.value)return;const _=w(c),x=(S=_==null?void 0:_.getBoundingClientRect)==null?void 0:S.call(_),o=w(n).getBoundingClientRect();let{x:g,y:M}=d.value;(l==="x"||l==="both")&&(g=u.clientX-k.value.x,_&&(g=Math.min(Math.max(0,g),x.width-o.width))),(l==="y"||l==="both")&&(M=u.clientY-k.value.y,_&&(M=Math.min(Math.max(0,M),x.height-o.height))),d.value={x:g,y:M},C==null||C(d.value,u),B(u)},A=u=>{E(u)&&k.value&&(k.value=void 0,b==null||b(d.value,u),B(u))};if(T){const u={capture:(t=s.capture)!=null?t:!0};P(y,"pointerdown",V,u),P(f,"pointermove",$,u),P(f,"pointerup",A,u)}return{...j(d),position:d,isDragging:e.computed(()=>!!k.value),style:e.computed(()=>`left:${d.value.x}px;top:${d.value.y}px;`)}}const X=n=>(e.pushScopeId("data-v-b6121e9b"),n=n(),e.popScopeId(),n),Y={class:"title text-16px font-bold"},q={class:"action"},U={key:1,class:"modal-footer space-x-2"},J=["form"],Q={key:2,class:"modal-loading"},Z=X(()=>e.createElementVNode("div",{class:"lds-ring"},[e.createElementVNode("div"),e.createElementVNode("div"),e.createElementVNode("div"),e.createElementVNode("div")],-1)),ee=[Z],te={name:"ModalContainer",inheritAttrs:!0},oe=e.defineComponent({...te,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,i=e.inject(N),p=e.ref(!1);let v=0,C=0;const b=e.shallowRef(),m=e.shallowRef(),h=e.shallowRef(),{x:l,y:f}=K(h,{initialValue:{x:0,y:0}});function c(){i==null||i.close(t.id)}function y(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=y(t.sizes[t.size])),t.width&&(o.width=y(t.width)),t.maxWidth&&(o.maxWidth=y(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(${l.value-v}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}),B=e.computed(()=>{var g;const o={};return t.maxHeight&&(o.maxHeight=`calc(${(g=y(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 V(){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 $(){i==null||i.close(t.id)}function A(){window&&window.addEventListener("resize",()=>{e.triggerRef(b),e.triggerRef(m),m.value&&(v=m.value.offsetLeft,C=m.value.offsetTop)})}function u(){if(t.closeable&&t.esc){const o=({key:g})=>{g==="Escape"&&(i==null||i.close(t.id),window.removeEventListener("keydown",o))};window.addEventListener("keydown",o)}}function S(){v=m.value.offsetLeft,C=m.value.offsetTop}e.onMounted(()=>{u(),A()}),e.onUnmounted(()=>{});function _(){return p.value=!0,()=>x()}function x(){p.value=!1}return s({showLoading:_,hideLoading:x}),(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),e.createElementVNode("div",{class:"modal-body",style:e.normalizeStyle(B.value)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.component),e.normalizeProps(e.guardReactiveProps(o.componentProps)),null,16))],4),o.footer?(e.openBlock(),e.createElementBlock("div",U,[e.createElementVNode("button",{class:"cancel-button",type:"button",onClick:$},e.toDisplayString(o.cancelText),1),e.createElementVNode("button",{class:"submit-button",form:o.form,type:"submit",onClick:V},e.toDisplayString(o.submitText),9,J)])):e.createCommentVNode("",!0),p.value?(e.openBlock(),e.createElementBlock("div",Q,ee)):e.createCommentVNode("",!0)],6)],4))}});const R=(n,s)=>{const r=n.__vccOpts||n;for(const[t,a]of s)r[t]=a;return r},D=R(oe,[["__scopeId","data-v-b6121e9b"]]),ne={class:"modal-dialog"},re={class:"dialog-body"},ie={class:"dialog-title"},le={class:"dialog-content"},se=e.defineComponent({__name:"modal-dialog",props:{type:{},title:{},content:{},okText:{default:"确定"},cancelText:{default:"取消"},onOk:{},onCancel:{},footer:{}},setup(n){const s=n,r=O(),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 i(){s.onCancel&&await s.onCancel(),r.close()}return(p,v)=>(e.openBlock(),e.createElementBlock("section",ne,[e.createElementVNode("div",re,[e.createElementVNode("div",ie,e.toDisplayString(t.value),1),e.createElementVNode("div",le,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:i},e.toDisplayString(p.cancelText),1)):e.createCommentVNode("",!0)],64))],4)]))}});const ae=R(se,[["__scopeId","data-v-8326e5a5"]]),ce={key:0,class:"modal-teleport"},de={name:"ModalProvider",inheritAttrs:!0},ue=e.defineComponent({...de,props:{appendToBody:{type:[Boolean,String],default:!1},sizes:{default:()=>({small:"50%",middle:"70%",large:"90%"})},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 i(l,f={},c={}){const y=e.defineAsyncComponent(()=>Promise.resolve(typeof l=="string"?ae:l));typeof l=="string"&&(f.type=l,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,B)=>{r.value.push({id:d,component:y,props:f||{},options:{...c,type:typeof l=="string"?l:"component"},resolve:E,reject:B,listeners:[]}),e.triggerRef(r)}).catch(E=>E==="CANCEL"?new Promise(()=>{}):Promise.reject(E));return Object.assign(k,{close:()=>p(d)})}function p(l,f){const c=r.value.findIndex(d=>d.id===l);if(c<0)return;const y=r.value[c];f===void 0?y==null||y.reject("CANCEL"):y==null||y.resolve(f),r.value.splice(c,1),e.triggerRef(r)}function v(){!r.value||r.value.length===0||(r.value.forEach(l=>{l==null||l.reject("CANCEL")}),r.value=[],e.triggerRef(r))}function C(l,f){const c=r.value.find(d=>d.id===l);if(!c)return;const y=c.listeners.find(d=>d.event===f);y&&y.callback({open:i,close:d=>p(c.id,d),closeAll:v,showLoading:()=>b(c.id),hideLoading:()=>m(c.id),confirm:d=>i("confirm",d),success:d=>i("success",d),error:d=>i("error",d),warning:d=>i("warning",d),info:d=>i("info",d)})}function b(l){if(!a)return;const[f]=a.refs[`modal-container_${l}`];if(f)return f.showLoading()}function m(l){if(!a)return;const[f]=a.refs[`modal-container_${l}`];if(f)return f.hideLoading()}function h(l,f,c){const y=r.value.find(d=>d.id===l);y&&y.listeners.push({event:f,callback:c})}return e.provide(N,{open:i,close:p,closeAll:v,addEventListener:h}),s({elements:r,open:i,close:p,closeAll:v}),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",ce,[(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(r.value,c=>(e.openBlock(),e.createBlock(D,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":l.maxHeight,"max-width":l.maxWidth,offset:l.offset,sizes:l.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 fe=R(ue,[["__scopeId","data-v-cdd9e7f0"]]);function L(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 O(){const n=e.inject(N),s=e.getCurrentInstance();function r(t,a,i){if(!n)throw new Error("Not Found Modal Provider Component");return n.open(t,a,i)}return{open:r,close(t){var p;if(!n)throw new Error("Not Found Modal Provider Component");const a=L(s,"ModalContainer"),i=(p=a==null?void 0:a.props)==null?void 0:p.id;if(!i)throw new Error("Not Found Current Modal Container");n.close(i,t)},closeAll(){if(!n)throw new Error("Not Found Modal Provider Component");n.closeAll()},showLoading(){var i;if(!n)throw new Error("Not Found Modal Provider Component");const t=L(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(!n)throw new Error("Not Found Modal Provider Component");const t=L(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 pe(n){var i;const s=e.inject(N),r=e.getCurrentInstance(),t=L(r,"ModalContainer"),a=(i=t==null?void 0:t.props)==null?void 0:i.id;s&&a&&s.addEventListener(a,"submit",n)}exports.ModalContainer=D;exports.ModalKey=N;exports.ModalProvider=fe;exports.onSubmit=pe;exports.useModal=O;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue");const N=Symbol("__MODAL__");function I(n){return e.getCurrentScope()?(e.onScopeDispose(n),!0):!1}function w(n){return typeof n=="function"?n():e.unref(n)}const R=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const W=Object.prototype.toString,H=n=>W.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 z=R?window:void 0;function T(...n){let s,r,t,a;if(typeof n[0]=="string"||Array.isArray(n[0])?([r,t,a]=n,s=z):[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=H(h)?{...h}:h;l.push(...r.flatMap(f=>t.map(c=>y(m,f,c,i))))},{immediate:!0,flush:"post"}),b=()=>{C(),p()};return I(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=z,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)},P=u=>{E(u)&&k.value&&(k.value=void 0,b==null||b(d.value,u),x(u))};if(R){const u={capture:(t=s.capture)!=null?t:!0};T(v,"pointerdown",L,u),T(f,"pointermove",A,u),T(f,"pointerup",P,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 D=n=>(e.pushScopeId("data-v-ea168324"),n=n(),e.popScopeId(),n),Y={class:"title text-16px font-bold"},q={class:"action"},U={key:1,class:"modal-footer space-x-2"},J=["form"],Q=D(()=>e.createElementVNode("div",{id:"modal-footer-slot"},null,-1)),Z={key:2,class:"modal-loading"},ee=D(()=>e.createElementVNode("div",{class:"lds-ring"},[e.createElementVNode("div"),e.createElementVNode("div"),e.createElementVNode("div"),e.createElementVNode("div")],-1)),te=[ee],oe={name:"ModalContainer",inheritAttrs:!0},ne=e.defineComponent({...oe,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 P(){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(),P()}),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),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),o.footer?(e.openBlock(),e.createElementBlock("div",U,[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,J)])):e.createCommentVNode("",!0),Q,p.value?(e.openBlock(),e.createElementBlock("div",Z,te)):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=$(ne,[["__scopeId","data-v-ea168324"]]),re={class:"modal-dialog"},le={class:"dialog-body"},ie={class:"dialog-title"},se={class:"dialog-content"},ae=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",re,[e.createElementVNode("div",le,[e.createElementVNode("div",ie,e.toDisplayString(t.value),1),e.createElementVNode("div",se,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 ce=$(ae,[["__scopeId","data-v-8326e5a5"]]),de={key:0,class:"modal-teleport"},ue={name:"ModalProvider",inheritAttrs:!0},fe=e.defineComponent({...ue,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"?ce: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",de,[(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 pe=$(fe,[["__scopeId","data-v-241a8304"]]);const me={},ve={class:"modal-footer"};function ye(n,s){return e.openBlock(),e.createBlock(e.Teleport,{to:"#modal-footer-slot"},[e.createElementVNode("div",ve,[e.renderSlot(n.$slots,"default",{},void 0,!0)])])}const ge=$(me,[["render",ye],["__scopeId","data-v-758ef59c"]]);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 he(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=ge;exports.ModalKey=N;exports.ModalProvider=pe;exports.onSubmit=he;exports.useModal=F;
@@ -1,7 +1,8 @@
1
1
  import ModalProvider from './components/modal-provider.vue';
2
2
  import ModalContainer from './components/modal-container.vue';
3
+ import ModalFooter from './components/modal-footer.vue';
3
4
  import { useModal } from './hooks/use-modal';
4
5
  import { ModalKey } from './constants';
5
6
  export { onSubmit } from './hooks/on-submit';
6
7
  export * from './interfaces';
7
- export { ModalContainer, ModalProvider, useModal, ModalKey, };
8
+ export { ModalContainer, ModalProvider, ModalFooter, useModal, ModalKey, };
@@ -1,9 +1,9 @@
1
1
  import type { CSSProperties, Component } from 'vue';
2
2
  import type { useModal } from './hooks/use-modal';
3
3
  export interface SizeOptions {
4
- small: string;
5
- middle: string;
6
- large: string;
4
+ small: string | number;
5
+ middle: string | number;
6
+ large: string | number;
7
7
  }
8
8
  export interface OpenModalOptions {
9
9
  closeable?: boolean;
@@ -0,0 +1,9 @@
1
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>, {
2
+ default?(_: {}): any;
3
+ }>;
4
+ export default _default;
5
+ type __VLS_WithTemplateSlots<T, S> = T & {
6
+ new (): {
7
+ $slots: S;
8
+ };
9
+ };
@@ -14,9 +14,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
14
14
  maxWidth: string;
15
15
  maxHeight: string;
16
16
  sizes: () => {
17
- small: string;
18
- middle: string;
19
- large: string;
17
+ small: number;
18
+ middle: number;
19
+ large: number;
20
20
  };
21
21
  offset: () => {
22
22
  x: number;
@@ -43,9 +43,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
43
43
  maxWidth: string;
44
44
  maxHeight: string;
45
45
  sizes: () => {
46
- small: string;
47
- middle: string;
48
- large: string;
46
+ small: number;
47
+ middle: number;
48
+ large: number;
49
49
  };
50
50
  offset: () => {
51
51
  x: number;
@@ -1,7 +1,8 @@
1
1
  import ModalProvider from './components/modal-provider.vue';
2
2
  import ModalContainer from './components/modal-container.vue';
3
+ import ModalFooter from './components/modal-footer.vue';
3
4
  import { useModal } from './hooks/use-modal';
4
5
  import { ModalKey } from './constants';
5
6
  export { onSubmit } from './hooks/on-submit';
6
7
  export * from './interfaces';
7
- export { ModalContainer, ModalProvider, useModal, ModalKey, };
8
+ export { ModalContainer, ModalProvider, ModalFooter, useModal, ModalKey, };
package/dist/es/index.mjs CHANGED
@@ -1,21 +1,21 @@
1
- import { unref as ee, isRef as te, toRefs as oe, customRef as ne, getCurrentScope as ie, onScopeDispose as re, ref as D, computed as A, watch as se, defineComponent as X, inject as Y, shallowRef as R, onMounted as U, onUnmounted as le, openBlock as g, createElementBlock as x, normalizeStyle as O, withModifiers as ae, createElementVNode as h, normalizeClass as de, toDisplayString as P, createCommentVNode as T, createBlock as W, resolveDynamicComponent as J, normalizeProps as ce, guardReactiveProps as ue, triggerRef as z, pushScopeId as fe, popScopeId as pe, Fragment as G, getCurrentInstance as K, provide as me, renderSlot as ve, Teleport as ye, createVNode as he, TransitionGroup as ge, withCtx as _e, renderList as we, mergeProps as be, defineAsyncComponent as Ce } from "vue";
2
- const F = Symbol("__MODAL__");
3
- function xe(o) {
4
- return ie() ? (re(o), !0) : !1;
1
+ import { unref as ne, isRef as ie, toRefs as re, customRef as se, getCurrentScope as le, onScopeDispose as ae, ref as F, computed as A, watch as de, defineComponent as Y, inject as K, shallowRef as N, onMounted as U, onUnmounted as ce, openBlock as g, createElementBlock as x, normalizeStyle as O, withModifiers as ue, createElementVNode as y, normalizeClass as fe, toDisplayString as P, createCommentVNode as T, createBlock as R, resolveDynamicComponent as J, normalizeProps as pe, guardReactiveProps as me, triggerRef as z, pushScopeId as ve, popScopeId as he, Fragment as X, getCurrentInstance as q, provide as ye, renderSlot as Q, Teleport as Z, 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;
5
5
  }
6
6
  function b(o) {
7
- return typeof o == "function" ? o() : ee(o);
7
+ return typeof o == "function" ? o() : ne(o);
8
8
  }
9
- const Q = typeof window < "u" && typeof document < "u";
9
+ const ee = typeof window < "u" && typeof document < "u";
10
10
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
11
- const ke = Object.prototype.toString, Me = (o) => ke.call(o) === "[object Object]", Ee = () => {
11
+ const Me = Object.prototype.toString, Ee = (o) => Me.call(o) === "[object Object]", Se = () => {
12
12
  };
13
- function Se(o, s = {}) {
14
- if (!te(o))
15
- return oe(o);
13
+ function $e(o, s = {}) {
14
+ if (!ie(o))
15
+ return re(o);
16
16
  const n = Array.isArray(o.value) ? Array.from({ length: o.value.length }) : {};
17
17
  for (const e in o.value)
18
- n[e] = ne(() => ({
18
+ n[e] = se(() => ({
19
19
  get() {
20
20
  return o.value[e];
21
21
  },
@@ -40,20 +40,20 @@ function Le(o) {
40
40
  const n = b(o);
41
41
  return (s = n == null ? void 0 : n.$el) != null ? s : n;
42
42
  }
43
- const Z = Q ? window : void 0;
44
- function j(...o) {
43
+ const te = ee ? window : void 0;
44
+ function G(...o) {
45
45
  let s, n, e, l;
46
- if (typeof o[0] == "string" || Array.isArray(o[0]) ? ([n, e, l] = o, s = Z) : [s, n, e, l] = o, !s)
47
- return Ee;
46
+ if (typeof o[0] == "string" || Array.isArray(o[0]) ? ([n, e, l] = o, s = te) : [s, n, e, l] = o, !s)
47
+ return Se;
48
48
  Array.isArray(n) || (n = [n]), Array.isArray(e) || (e = [e]);
49
49
  const i = [], f = () => {
50
50
  i.forEach((p) => p()), i.length = 0;
51
- }, v = (p, _, r, u) => (p.addEventListener(_, r, u), () => p.removeEventListener(_, r, u)), k = se(
51
+ }, v = (p, _, r, u) => (p.addEventListener(_, r, u), () => p.removeEventListener(_, r, u)), k = de(
52
52
  () => [Le(s), b(l)],
53
53
  ([p, _]) => {
54
54
  if (f(), !p)
55
55
  return;
56
- const r = Me(_) ? { ..._ } : _;
56
+ const r = Ee(_) ? { ..._ } : _;
57
57
  i.push(
58
58
  ...n.flatMap((u) => e.map((a) => v(p, u, a, r)))
59
59
  );
@@ -62,9 +62,9 @@ function j(...o) {
62
62
  ), M = () => {
63
63
  k(), f();
64
64
  };
65
- return xe(M), M;
65
+ return ke(M), M;
66
66
  }
67
- function $e(o, s = {}) {
67
+ function Ae(o, s = {}) {
68
68
  var n, e;
69
69
  const {
70
70
  pointerTypes: l,
@@ -76,41 +76,41 @@ function $e(o, s = {}) {
76
76
  onStart: p,
77
77
  initialValue: _,
78
78
  axis: r = "both",
79
- draggingElement: u = Z,
79
+ draggingElement: u = te,
80
80
  containerElement: a,
81
81
  handle: m = o
82
- } = s, d = D(
82
+ } = s, d = F(
83
83
  (n = b(_)) != null ? n : { x: 0, y: 0 }
84
- ), C = D(), E = (c) => l ? l.includes(c.pointerType) : !0, L = (c) => {
84
+ ), C = F(), E = (c) => l ? l.includes(c.pointerType) : !0, $ = (c) => {
85
85
  b(i) && c.preventDefault(), b(f) && c.stopPropagation();
86
- }, H = (c) => {
87
- var $;
86
+ }, I = (c) => {
87
+ var L;
88
88
  if (!E(c) || b(v) && c.target !== b(o))
89
89
  return;
90
- const w = b(a), S = ($ = w == null ? void 0 : w.getBoundingClientRect) == null ? void 0 : $.call(w), t = b(o).getBoundingClientRect(), y = {
90
+ const w = b(a), S = (L = w == null ? void 0 : w.getBoundingClientRect) == null ? void 0 : L.call(w), t = b(o).getBoundingClientRect(), h = {
91
91
  x: c.clientX - (w ? t.left - S.left : t.left),
92
92
  y: c.clientY - (w ? t.top - S.top : t.top)
93
93
  };
94
- (p == null ? void 0 : p(y, c)) !== !1 && (C.value = y, L(c));
95
- }, I = (c) => {
96
- var $;
94
+ (p == null ? void 0 : p(h, c)) !== !1 && (C.value = h, $(c));
95
+ }, V = (c) => {
96
+ var L;
97
97
  if (!E(c) || !C.value)
98
98
  return;
99
- const w = b(a), S = ($ = w == null ? void 0 : w.getBoundingClientRect) == null ? void 0 : $.call(w), t = b(o).getBoundingClientRect();
100
- let { x: y, y: B } = d.value;
101
- (r === "x" || r === "both") && (y = c.clientX - C.value.x, w && (y = Math.min(Math.max(0, y), S.width - t.width))), (r === "y" || r === "both") && (B = c.clientY - C.value.y, w && (B = Math.min(Math.max(0, B), S.height - t.height))), d.value = {
102
- x: y,
99
+ const w = b(a), S = (L = w == null ? void 0 : w.getBoundingClientRect) == null ? void 0 : L.call(w), t = b(o).getBoundingClientRect();
100
+ let { x: h, y: B } = d.value;
101
+ (r === "x" || r === "both") && (h = c.clientX - C.value.x, w && (h = Math.min(Math.max(0, h), S.width - t.width))), (r === "y" || r === "both") && (B = c.clientY - C.value.y, w && (B = Math.min(Math.max(0, B), S.height - t.height))), d.value = {
102
+ x: h,
103
103
  y: B
104
- }, k == null || k(d.value, c), L(c);
105
- }, V = (c) => {
106
- E(c) && C.value && (C.value = void 0, M == null || M(d.value, c), L(c));
104
+ }, k == null || k(d.value, c), $(c);
105
+ }, j = (c) => {
106
+ E(c) && C.value && (C.value = void 0, M == null || M(d.value, c), $(c));
107
107
  };
108
- if (Q) {
108
+ if (ee) {
109
109
  const c = { capture: (e = s.capture) != null ? e : !0 };
110
- j(m, "pointerdown", H, c), j(u, "pointermove", I, c), j(u, "pointerup", V, c);
110
+ G(m, "pointerdown", I, c), G(u, "pointermove", V, c), G(u, "pointerup", j, c);
111
111
  }
112
112
  return {
113
- ...Se(d),
113
+ ...$e(d),
114
114
  position: d,
115
115
  isDragging: A(() => !!C.value),
116
116
  style: A(
@@ -118,24 +118,24 @@ function $e(o, s = {}) {
118
118
  )
119
119
  };
120
120
  }
121
- const Ae = (o) => (fe("data-v-b6121e9b"), o = o(), pe(), o), Pe = { class: "title text-16px font-bold" }, Te = { class: "action" }, Be = {
121
+ const oe = (o) => (ve("data-v-ea168324"), o = o(), he(), o), Pe = { class: "title text-16px font-bold" }, Te = { class: "action" }, Be = {
122
122
  key: 1,
123
123
  class: "modal-footer space-x-2"
124
- }, Oe = ["form"], ze = {
124
+ }, Oe = ["form"], ze = /* @__PURE__ */ oe(() => /* @__PURE__ */ y("div", { id: "modal-footer-slot" }, null, -1)), Re = {
125
125
  key: 2,
126
126
  class: "modal-loading"
127
- }, Re = /* @__PURE__ */ Ae(() => /* @__PURE__ */ h("div", { class: "lds-ring" }, [
128
- /* @__PURE__ */ h("div"),
129
- /* @__PURE__ */ h("div"),
130
- /* @__PURE__ */ h("div"),
131
- /* @__PURE__ */ h("div")
132
- ], -1)), Ne = [
133
- Re
134
- ], De = {
127
+ }, Ne = /* @__PURE__ */ oe(() => /* @__PURE__ */ y("div", { class: "lds-ring" }, [
128
+ /* @__PURE__ */ y("div"),
129
+ /* @__PURE__ */ y("div"),
130
+ /* @__PURE__ */ y("div"),
131
+ /* @__PURE__ */ y("div")
132
+ ], -1)), De = [
133
+ Ne
134
+ ], Fe = {
135
135
  name: "ModalContainer",
136
136
  inheritAttrs: !0
137
- }, We = /* @__PURE__ */ X({
138
- ...De,
137
+ }, We = /* @__PURE__ */ Y({
138
+ ...Fe,
139
139
  props: {
140
140
  id: {},
141
141
  form: {},
@@ -164,9 +164,9 @@ const Ae = (o) => (fe("data-v-b6121e9b"), o = o(), pe(), o), Pe = { class: "titl
164
164
  },
165
165
  emits: ["submit"],
166
166
  setup(o, { expose: s, emit: n }) {
167
- const e = o, l = n, i = Y(F), f = D(!1);
167
+ const e = o, l = n, i = K(W), f = F(!1);
168
168
  let v = 0, k = 0;
169
- const M = R(), p = R(), _ = R(), { x: r, y: u } = $e(_, {
169
+ const M = N(), p = N(), _ = N(), { x: r, y: u } = Ae(_, {
170
170
  initialValue: { x: 0, y: 0 }
171
171
  });
172
172
  function a() {
@@ -187,41 +187,41 @@ const Ae = (o) => (fe("data-v-b6121e9b"), o = o(), pe(), o), Pe = { class: "titl
187
187
  }), E = A(() => {
188
188
  const t = {};
189
189
  return e.draggable && !e.fullscreen && e.mode === "dialog" && (t.cursor = "move"), t;
190
- }), L = A(() => {
191
- var y;
190
+ }), $ = A(() => {
191
+ var h;
192
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;
193
+ return e.maxHeight && (t.maxHeight = `calc(${(h = m(e.maxHeight)) == null ? void 0 : h.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;
194
194
  });
195
- function H() {
195
+ function I() {
196
196
  const t = p.value;
197
197
  if (e.form && t) {
198
- const y = t.querySelector(`form[name="${e.form}"]`);
199
- y && y.dispatchEvent(new Event("submit"));
198
+ const h = t.querySelector(`form[name="${e.form}"]`);
199
+ h && h.dispatchEvent(new Event("submit"));
200
200
  }
201
201
  l("submit");
202
202
  }
203
- function I() {
203
+ function V() {
204
204
  i == null || i.close(e.id);
205
205
  }
206
- function V() {
206
+ function j() {
207
207
  window && window.addEventListener("resize", () => {
208
208
  z(M), z(p), p.value && (v = p.value.offsetLeft, k = p.value.offsetTop);
209
209
  });
210
210
  }
211
211
  function c() {
212
212
  if (e.closeable && e.esc) {
213
- const t = ({ key: y }) => {
214
- y === "Escape" && (i == null || i.close(e.id), window.removeEventListener("keydown", t));
213
+ const t = ({ key: h }) => {
214
+ h === "Escape" && (i == null || i.close(e.id), window.removeEventListener("keydown", t));
215
215
  };
216
216
  window.addEventListener("keydown", t);
217
217
  }
218
218
  }
219
- function $() {
219
+ function L() {
220
220
  v = p.value.offsetLeft, k = p.value.offsetTop;
221
221
  }
222
222
  U(() => {
223
- c(), V();
224
- }), le(() => {
223
+ c(), j();
224
+ }), ce(() => {
225
225
  });
226
226
  function w() {
227
227
  return f.value = !0, () => S();
@@ -232,17 +232,17 @@ const Ae = (o) => (fe("data-v-b6121e9b"), o = o(), pe(), o), Pe = { class: "titl
232
232
  return s({
233
233
  showLoading: w,
234
234
  hideLoading: S
235
- }), (t, y) => (g(), x("div", {
235
+ }), (t, h) => (g(), x("div", {
236
236
  ref_key: "wrapperRef",
237
237
  ref: M,
238
238
  class: "modal-wrapper",
239
239
  style: O(d.value),
240
- onClick: y[0] || (y[0] = ae((B) => t.maskClosable && a(), ["self"]))
240
+ onClick: h[0] || (h[0] = ue((B) => t.maskClosable && a(), ["self"]))
241
241
  }, [
242
- h("div", {
242
+ y("div", {
243
243
  ref_key: "contentRef",
244
244
  ref: p,
245
- class: de(["modal-content", { [`${t.mode}-mode`]: !0 }]),
245
+ class: fe(["modal-content", { [`${t.mode}-mode`]: !0 }]),
246
246
  style: O(C.value)
247
247
  }, [
248
248
  t.header ? (g(), x("div", {
@@ -251,10 +251,10 @@ const Ae = (o) => (fe("data-v-b6121e9b"), o = o(), pe(), o), Pe = { class: "titl
251
251
  ref: _,
252
252
  class: "modal-header",
253
253
  style: O(E.value),
254
- onMousedown: $
254
+ onMousedown: L
255
255
  }, [
256
- h("div", Pe, P(t.title), 1),
257
- h("div", Te, [
256
+ y("div", Pe, P(t.title), 1),
257
+ y("div", Te, [
258
258
  t.closeable ? (g(), x("div", {
259
259
  key: 0,
260
260
  class: "i-icon-park-outline:close block cursor-pointer",
@@ -262,36 +262,37 @@ const Ae = (o) => (fe("data-v-b6121e9b"), o = o(), pe(), o), Pe = { class: "titl
262
262
  })) : T("", !0)
263
263
  ])
264
264
  ], 36)) : T("", !0),
265
- h("div", {
265
+ y("div", {
266
266
  class: "modal-body",
267
- style: O(L.value)
267
+ style: O($.value)
268
268
  }, [
269
- (g(), W(J(t.component), ce(ue(t.componentProps)), null, 16))
269
+ (g(), R(J(t.component), pe(me(t.componentProps)), null, 16))
270
270
  ], 4),
271
271
  t.footer ? (g(), x("div", Be, [
272
- h("button", {
272
+ y("button", {
273
273
  class: "cancel-button",
274
274
  type: "button",
275
- onClick: I
275
+ onClick: V
276
276
  }, P(t.cancelText), 1),
277
- h("button", {
277
+ y("button", {
278
278
  class: "submit-button",
279
279
  form: t.form,
280
280
  type: "submit",
281
- onClick: H
281
+ onClick: I
282
282
  }, P(t.submitText), 9, Oe)
283
283
  ])) : T("", !0),
284
- f.value ? (g(), x("div", ze, Ne)) : T("", !0)
284
+ ze,
285
+ f.value ? (g(), x("div", Re, De)) : T("", !0)
285
286
  ], 6)
286
287
  ], 4));
287
288
  }
288
289
  });
289
- const q = (o, s) => {
290
+ const H = (o, s) => {
290
291
  const n = o.__vccOpts || o;
291
292
  for (const [e, l] of s)
292
293
  n[e] = l;
293
294
  return n;
294
- }, Fe = /* @__PURE__ */ q(We, [["__scopeId", "data-v-b6121e9b"]]), He = { class: "modal-dialog" }, Ie = { class: "dialog-body" }, Ve = { class: "dialog-title" }, je = { class: "dialog-content" }, Ge = /* @__PURE__ */ X({
295
+ }, He = /* @__PURE__ */ H(We, [["__scopeId", "data-v-ea168324"]]), Ie = { class: "modal-dialog" }, Ve = { class: "dialog-body" }, je = { class: "dialog-title" }, Ge = { class: "dialog-content" }, Xe = /* @__PURE__ */ Y({
295
296
  __name: "modal-dialog",
296
297
  props: {
297
298
  type: {},
@@ -304,7 +305,7 @@ const q = (o, s) => {
304
305
  footer: {}
305
306
  },
306
307
  setup(o) {
307
- const s = o, n = Ue(), e = A(() => s.title ? s.title : {
308
+ const s = o, n = et(), e = A(() => s.title ? s.title : {
308
309
  confirm: "提示",
309
310
  info: "提示",
310
311
  warning: "警告",
@@ -317,17 +318,17 @@ const q = (o, s) => {
317
318
  async function i() {
318
319
  s.onCancel && await s.onCancel(), n.close();
319
320
  }
320
- return (f, v) => (g(), x("section", He, [
321
- h("div", Ie, [
322
- h("div", Ve, P(e.value), 1),
323
- h("div", je, P(f.content), 1)
321
+ return (f, v) => (g(), x("section", Ie, [
322
+ y("div", Ve, [
323
+ y("div", je, P(e.value), 1),
324
+ y("div", Ge, P(f.content), 1)
324
325
  ]),
325
- h("div", {
326
+ y("div", {
326
327
  class: "dialog-footer space-x-2",
327
328
  style: O(f.type === "confirm" ? { "justify-content": "end" } : { "border-top": "none" })
328
329
  }, [
329
- f.footer ? (g(), W(J(f.footer), { key: 0 })) : (g(), x(G, { key: 1 }, [
330
- h("button", {
330
+ f.footer ? (g(), R(J(f.footer), { key: 0 })) : (g(), x(X, { key: 1 }, [
331
+ y("button", {
331
332
  class: "submit-button",
332
333
  type: "submit",
333
334
  onClick: l
@@ -343,33 +344,33 @@ const q = (o, s) => {
343
344
  ]));
344
345
  }
345
346
  });
346
- const Xe = /* @__PURE__ */ q(Ge, [["__scopeId", "data-v-8326e5a5"]]), Ye = {
347
+ const Ye = /* @__PURE__ */ H(Xe, [["__scopeId", "data-v-8326e5a5"]]), Ke = {
347
348
  key: 0,
348
349
  class: "modal-teleport"
349
- }, Ke = {
350
+ }, qe = {
350
351
  name: "ModalProvider",
351
352
  inheritAttrs: !0
352
- }, qe = /* @__PURE__ */ X({
353
- ...Ke,
353
+ }, Ue = /* @__PURE__ */ Y({
354
+ ...qe,
354
355
  props: {
355
356
  appendToBody: { type: [Boolean, String], default: !1 },
356
357
  sizes: { default: () => ({
357
- small: "50%",
358
- middle: "70%",
359
- large: "90%"
358
+ small: 520,
359
+ middle: 860,
360
+ large: 1190
360
361
  }) },
361
362
  maxWidth: { default: "90%" },
362
363
  maxHeight: { default: "90%" },
363
364
  offset: { default: () => ({ x: 0, y: 0 }) }
364
365
  },
365
366
  setup(o, { expose: s }) {
366
- const n = R([]), e = D(!1), l = K();
367
+ const n = N([]), e = F(!1), l = q();
367
368
  function i(r, u = {}, a = {}) {
368
- const m = Ce(
369
- () => Promise.resolve(typeof r == "string" ? Xe : r)
369
+ const m = xe(
370
+ () => Promise.resolve(typeof r == "string" ? Ye : r)
370
371
  );
371
372
  typeof r == "string" && (u.type = r, a.size = "small", a.fullscreen = !1, a.mode = "dialog", a.footer = !1, a.header = !1);
372
- const d = Math.random().toString(32).slice(2), C = new Promise((E, L) => {
373
+ const d = Math.random().toString(32).slice(2), C = new Promise((E, $) => {
373
374
  n.value.push({
374
375
  id: d,
375
376
  component: m,
@@ -379,7 +380,7 @@ const Xe = /* @__PURE__ */ q(Ge, [["__scopeId", "data-v-8326e5a5"]]), Ye = {
379
380
  type: typeof r == "string" ? r : "component"
380
381
  },
381
382
  resolve: E,
382
- reject: L,
383
+ reject: $,
383
384
  listeners: []
384
385
  }), z(n);
385
386
  }).catch((E) => E === "CANCEL" ? new Promise(() => {
@@ -439,7 +440,7 @@ const Xe = /* @__PURE__ */ q(Ge, [["__scopeId", "data-v-8326e5a5"]]), Ye = {
439
440
  callback: a
440
441
  });
441
442
  }
442
- return me(F, {
443
+ return ye(W, {
443
444
  open: i,
444
445
  close: f,
445
446
  closeAll: v,
@@ -451,16 +452,16 @@ const Xe = /* @__PURE__ */ q(Ge, [["__scopeId", "data-v-8326e5a5"]]), Ye = {
451
452
  closeAll: v
452
453
  }), U(() => {
453
454
  e.value = !0;
454
- }), (r, u) => (g(), x(G, null, [
455
- ve(r.$slots, "default", {}, void 0, !0),
456
- e.value ? (g(), x("div", Ye, [
457
- (g(), W(ye, {
455
+ }), (r, u) => (g(), x(X, null, [
456
+ Q(r.$slots, "default", {}, void 0, !0),
457
+ e.value ? (g(), x("div", Ke, [
458
+ (g(), R(Z, {
458
459
  disabled: !r.appendToBody,
459
460
  to: typeof r.appendToBody == "string" ? r.appendToBody : "body"
460
461
  }, [
461
- he(ge, { name: "modal-fade" }, {
462
- default: _e(() => [
463
- (g(!0), x(G, null, we(n.value, (a) => (g(), W(Fe, be({
462
+ ge(_e, { name: "modal-fade" }, {
463
+ default: we(() => [
464
+ (g(!0), x(X, null, be(n.value, (a) => (g(), R(He, Ce({
464
465
  id: a.id,
465
466
  key: a.id,
466
467
  ref_for: !0,
@@ -482,16 +483,25 @@ const Xe = /* @__PURE__ */ q(Ge, [["__scopeId", "data-v-8326e5a5"]]), Ye = {
482
483
  ], 64));
483
484
  }
484
485
  });
485
- const Qe = /* @__PURE__ */ q(qe, [["__scopeId", "data-v-cdd9e7f0"]]);
486
- function N(o, s) {
486
+ const ot = /* @__PURE__ */ H(Ue, [["__scopeId", "data-v-241a8304"]]);
487
+ const Je = {}, Qe = { class: "modal-footer" };
488
+ function Ze(o, s) {
489
+ return g(), R(Z, { to: "#modal-footer-slot" }, [
490
+ y("div", Qe, [
491
+ Q(o.$slots, "default", {}, void 0, !0)
492
+ ])
493
+ ]);
494
+ }
495
+ const nt = /* @__PURE__ */ H(Je, [["render", Ze], ["__scopeId", "data-v-758ef59c"]]);
496
+ function D(o, s) {
487
497
  var e, l;
488
498
  let n = o == null ? void 0 : o.parent;
489
499
  for (; n && ((e = n == null ? void 0 : n.type) == null ? void 0 : e.name) !== s; )
490
500
  n = n.parent;
491
501
  return ((l = n == null ? void 0 : n.type) == null ? void 0 : l.name) === s ? n : null;
492
502
  }
493
- function Ue() {
494
- const o = Y(F), s = K();
503
+ function et() {
504
+ const o = K(W), s = q();
495
505
  function n(e, l, i) {
496
506
  if (!o)
497
507
  throw new Error("Not Found Modal Provider Component");
@@ -503,7 +513,7 @@ function Ue() {
503
513
  var f;
504
514
  if (!o)
505
515
  throw new Error("Not Found Modal Provider Component");
506
- const l = N(s, "ModalContainer"), i = (f = l == null ? void 0 : l.props) == null ? void 0 : f.id;
516
+ const l = D(s, "ModalContainer"), i = (f = l == null ? void 0 : l.props) == null ? void 0 : f.id;
507
517
  if (!i)
508
518
  throw new Error("Not Found Current Modal Container");
509
519
  o.close(i, e);
@@ -517,7 +527,7 @@ function Ue() {
517
527
  var i;
518
528
  if (!o)
519
529
  throw new Error("Not Found Modal Provider Component");
520
- const e = N(s, "ModalContainer");
530
+ const e = D(s, "ModalContainer");
521
531
  if (!((i = e == null ? void 0 : e.props) == null ? void 0 : i.id))
522
532
  throw new Error("Not Found Current Modal Container");
523
533
  e != null && e.exposed && (e == null || e.exposed.showLoading());
@@ -526,7 +536,7 @@ function Ue() {
526
536
  var i;
527
537
  if (!o)
528
538
  throw new Error("Not Found Modal Provider Component");
529
- const e = N(s, "ModalContainer");
539
+ const e = D(s, "ModalContainer");
530
540
  if (!((i = e == null ? void 0 : e.props) == null ? void 0 : i.id))
531
541
  throw new Error("Not Found Current Modal Container");
532
542
  e != null && e.exposed && (e == null || e.exposed.hideLoading());
@@ -548,15 +558,16 @@ function Ue() {
548
558
  }
549
559
  };
550
560
  }
551
- function Ze(o) {
561
+ function it(o) {
552
562
  var i;
553
- const s = Y(F), n = K(), e = N(n, "ModalContainer"), l = (i = e == null ? void 0 : e.props) == null ? void 0 : i.id;
563
+ const s = K(W), n = q(), e = D(n, "ModalContainer"), l = (i = e == null ? void 0 : e.props) == null ? void 0 : i.id;
554
564
  s && l && s.addEventListener(l, "submit", o);
555
565
  }
556
566
  export {
557
- Fe as ModalContainer,
558
- F as ModalKey,
559
- Qe as ModalProvider,
560
- Ze as onSubmit,
561
- Ue as useModal
567
+ He as ModalContainer,
568
+ nt as ModalFooter,
569
+ W as ModalKey,
570
+ ot as ModalProvider,
571
+ it as onSubmit,
572
+ et as useModal
562
573
  };
@@ -1,9 +1,9 @@
1
1
  import type { CSSProperties, Component } from 'vue';
2
2
  import type { useModal } from './hooks/use-modal';
3
3
  export interface SizeOptions {
4
- small: string;
5
- middle: string;
6
- large: string;
4
+ small: string | number;
5
+ middle: string | number;
6
+ large: string | number;
7
7
  }
8
8
  export interface OpenModalOptions {
9
9
  closeable?: boolean;
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-b6121e9b]{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-b6121e9b]{background:#ffffff;border-radius:5px;position:relative}.modal-header[data-v-b6121e9b]{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-b6121e9b]{padding:10px;box-sizing:border-box;max-height:10vw;overflow:auto;position:relative}.modal-footer[data-v-b6121e9b]{box-sizing:border-box;height:50px;border-top:solid 1px var(--color-border-1, #e8e8e8);display:flex;justify-content:end;padding:10px}.modal-footer button[data-v-b6121e9b]{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-b6121e9b]{color:#fff;background-color:rgb(var(--primary-6, 45, 106, 251))}.modal-footer button.submit-button[data-v-b6121e9b]:hover{background-color:rgb(var(--primary-5, 28, 76, 207))}.modal-footer button.cancel-button[data-v-b6121e9b]{color:rgb(var(--color-text-2, 78, 89, 105));background-color:var(--color-fill-1, #f5f5f5)}.modal-footer button.cancel-button[data-v-b6121e9b]:hover{background-color:var(--color-fill-4, #c9cdd4)}.modal-loading[data-v-b6121e9b]{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-b6121e9b]{display:inline-block;position:relative;width:80px;height:80px}.modal-loading .lds-ring div[data-v-b6121e9b]{box-sizing:border-box;display:block;position:absolute;width:48px;height:48px;margin:8px;border:5px solid #fff;border-radius:50%;animation:lds-ring-b6121e9b 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:#fff transparent transparent transparent}.modal-loading .lds-ring div[data-v-b6121e9b]:nth-child(1){animation-delay:-.45s}.modal-loading .lds-ring div[data-v-b6121e9b]:nth-child(2){animation-delay:-.3s}.modal-loading .lds-ring div[data-v-b6121e9b]:nth-child(3){animation-delay:-.15s}@keyframes lds-ring-b6121e9b{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-cdd9e7f0],.modal-fade-leave-active[data-v-cdd9e7f0]{transition:opacity .5s ease}.modal-fade-enter-active[data-v-cdd9e7f0] .modal-content.drawer-mode,.modal-fade-leave-active[data-v-cdd9e7f0] .modal-content.drawer-mode{transition:transform .5s ease}.modal-fade-enter-from[data-v-cdd9e7f0],.modal-fade-leave-to[data-v-cdd9e7f0]{opacity:0}.modal-fade-enter-from[data-v-cdd9e7f0] .modal-content.drawer-mode,.modal-fade-leave-to[data-v-cdd9e7f0] .modal-content.drawer-mode{transform:translate3d(100%,0,0)}
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-ea168324]{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-ea168324]{background:#ffffff;border-radius:5px;position:relative}.modal-header[data-v-ea168324]{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-ea168324]{padding:10px;box-sizing:border-box;max-height:10vw;overflow:auto;position:relative}.modal-footer[data-v-ea168324]{box-sizing:border-box;height:50px;border-top:solid 1px var(--color-border-1, #e8e8e8);display:flex;justify-content:end;padding:10px}.modal-footer button[data-v-ea168324]{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-ea168324]{color:#fff;background-color:rgb(var(--primary-6, 45, 106, 251))}.modal-footer button.submit-button[data-v-ea168324]:hover{background-color:rgb(var(--primary-5, 28, 76, 207))}.modal-footer button.cancel-button[data-v-ea168324]{color:rgb(var(--color-text-2, 78, 89, 105));background-color:var(--color-fill-1, #f5f5f5)}.modal-footer button.cancel-button[data-v-ea168324]:hover{background-color:var(--color-fill-4, #c9cdd4)}.modal-loading[data-v-ea168324]{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-ea168324]{display:inline-block;position:relative;width:80px;height:80px}.modal-loading .lds-ring div[data-v-ea168324]{box-sizing:border-box;display:block;position:absolute;width:48px;height:48px;margin:8px;border:5px solid #fff;border-radius:50%;animation:lds-ring-ea168324 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:#fff transparent transparent transparent}.modal-loading .lds-ring div[data-v-ea168324]:nth-child(1){animation-delay:-.45s}.modal-loading .lds-ring div[data-v-ea168324]:nth-child(2){animation-delay:-.3s}.modal-loading .lds-ring div[data-v-ea168324]:nth-child(3){animation-delay:-.15s}@keyframes lds-ring-ea168324{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-758ef59c]{box-sizing:border-box;height:50px;border-top:solid 1px var(--color-border-1, rgb(232, 232, 232));display:flex;justify-content:end;padding:10px}.modal-footer button[data-v-758ef59c]{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-758ef59c]{color:#fff;background-color:rgb(var(--primary-6, 45, 106, 251))}.modal-footer button.submit-button[data-v-758ef59c]:hover{background-color:rgb(var(--primary-5, 28, 76, 207))}.modal-footer button.cancel-button[data-v-758ef59c]{color:rgb(var(--color-text-2, 78, 89, 105));background-color:var(--color-fill-1, #f5f5f5)}.modal-footer button.cancel-button[data-v-758ef59c]:hover{background-color:var(--color-fill-4, #c9cdd4)}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gopowerteam/modal-render",
3
3
  "type": "module",
4
- "version": "0.0.22",
4
+ "version": "0.0.24",
5
5
  "author": {
6
6
  "name": "zhuchentong",
7
7
  "email": "2037630@gmail.com"