@gopowerteam/modal-render 0.0.10 → 0.0.11

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.
@@ -20,6 +20,10 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
20
20
  draggable?: boolean | undefined;
21
21
  mode?: "dialog" | "drawer" | undefined;
22
22
  type?: string | undefined;
23
+ offset?: {
24
+ x?: number | undefined;
25
+ y?: number | undefined;
26
+ } | undefined;
23
27
  }>, {
24
28
  header: boolean;
25
29
  closeable: boolean;
@@ -55,6 +59,10 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
55
59
  draggable?: boolean | undefined;
56
60
  mode?: "dialog" | "drawer" | undefined;
57
61
  type?: string | undefined;
62
+ offset?: {
63
+ x?: number | undefined;
64
+ y?: number | undefined;
65
+ } | undefined;
58
66
  }>, {
59
67
  header: boolean;
60
68
  closeable: boolean;
@@ -5,6 +5,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
5
5
  sizes: SizeOptions;
6
6
  maxWidth: string | number;
7
7
  maxHeight: string | number;
8
+ offset?: {
9
+ x?: number | undefined;
10
+ y?: number | undefined;
11
+ } | undefined;
8
12
  }>, {
9
13
  appendToBody: boolean;
10
14
  maxWidth: string;
@@ -14,6 +18,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
14
18
  middle: number;
15
19
  large: number;
16
20
  };
21
+ offset: () => {
22
+ x: number;
23
+ y: number;
24
+ };
17
25
  }>, {
18
26
  elements: import("vue").ShallowRef<ModalElement[]>;
19
27
  open: (component: Component | 'confirm' | 'info' | 'warning' | 'error' | 'success', props?: Record<string, any>, options?: OpenModalOptions) => Promise<unknown> & {
@@ -24,6 +32,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
24
32
  sizes: SizeOptions;
25
33
  maxWidth: string | number;
26
34
  maxHeight: string | number;
35
+ offset?: {
36
+ x?: number | undefined;
37
+ y?: number | undefined;
38
+ } | undefined;
27
39
  }>, {
28
40
  appendToBody: boolean;
29
41
  maxWidth: string;
@@ -33,10 +45,18 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
33
45
  middle: number;
34
46
  large: number;
35
47
  };
48
+ offset: () => {
49
+ x: number;
50
+ y: number;
51
+ };
36
52
  }>>>, {
37
53
  maxWidth: string | number;
38
54
  maxHeight: string | number;
39
55
  sizes: SizeOptions;
56
+ offset: {
57
+ x?: number;
58
+ y?: number;
59
+ };
40
60
  appendToBody: boolean | string;
41
61
  }, {}>, {
42
62
  default?(_: {}): any;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue");const N=Symbol("__MODAL__");function F(o){return e.getCurrentScope()?(e.onScopeDispose(o),!0):!1}function w(o){return typeof o=="function"?o():e.unref(o)}const z=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const W=Object.prototype.toString,I=o=>W.call(o)==="[object Object]",H=()=>{};function j(o,s={}){if(!e.isRef(o))return e.toRefs(o);const r=Array.isArray(o.value)?Array.from({length:o.value.length}):{};for(const t in o.value)r[t]=e.customRef(()=>({get(){return o.value[t]},set(a){var i;if((i=w(s.replaceRef))!=null?i:!0)if(Array.isArray(o.value)){const h=[...o.value];h[t]=a,o.value=h}else{const h={...o.value,[t]:a};Object.setPrototypeOf(h,Object.getPrototypeOf(o.value)),o.value=h}else o.value[t]=a}}));return r}function G(o){var s;const r=w(o);return(s=r==null?void 0:r.$el)!=null?s:r}const D=z?window:void 0;function A(...o){let s,r,t,a;if(typeof o[0]=="string"||Array.isArray(o[0])?([r,t,a]=o,s=D):[s,r,t,a]=o,!s)return H;Array.isArray(r)||(r=[r]),Array.isArray(t)||(t=[t]);const i=[],p=()=>{i.forEach(m=>m()),i.length=0},h=(m,g,l,f)=>(m.addEventListener(g,l,f),()=>m.removeEventListener(g,l,f)),C=e.watch(()=>[G(s),w(a)],([m,g])=>{if(p(),!m)return;const l=I(g)?{...g}:g;i.push(...r.flatMap(f=>t.map(c=>h(m,f,c,l))))},{immediate:!0,flush:"post"}),E=()=>{C(),p()};return F(E),E}function K(o,s={}){var r,t;const{pointerTypes:a,preventDefault:i,stopPropagation:p,exact:h,onMove:C,onEnd:E,onStart:m,initialValue:g,axis:l="both",draggingElement:f=D,containerElement:c,handle:v=o}=s,d=e.ref((r=w(g))!=null?r:{x:0,y:0}),k=e.ref(),b=u=>a?a.includes(u.pointerType):!0,M=u=>{w(i)&&u.preventDefault(),w(p)&&u.stopPropagation()},L=u=>{var x;if(!b(u)||w(h)&&u.target!==w(o))return;const _=w(c),B=(x=_==null?void 0:_.getBoundingClientRect)==null?void 0:x.call(_),n=w(o).getBoundingClientRect(),y={x:u.clientX-(_?n.left-B.left:n.left),y:u.clientY-(_?n.top-B.top:n.top)};(m==null?void 0:m(y,u))!==!1&&(k.value=y,M(u))},$=u=>{var x;if(!b(u)||!k.value)return;const _=w(c),B=(x=_==null?void 0:_.getBoundingClientRect)==null?void 0:x.call(_),n=w(o).getBoundingClientRect();let{x:y,y:S}=d.value;(l==="x"||l==="both")&&(y=u.clientX-k.value.x,_&&(y=Math.min(Math.max(0,y),B.width-n.width))),(l==="y"||l==="both")&&(S=u.clientY-k.value.y,_&&(S=Math.min(Math.max(0,S),B.height-n.height))),d.value={x:y,y:S},C==null||C(d.value,u),M(u)},P=u=>{b(u)&&k.value&&(k.value=void 0,E==null||E(d.value,u),M(u))};if(z){const u={capture:(t=s.capture)!=null?t:!0};A(v,"pointerdown",L,u),A(f,"pointermove",$,u),A(f,"pointerup",P,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=o=>(e.pushScopeId("data-v-7f0b9287"),o=o(),e.popScopeId(),o),Y={class:"title 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:{}},emits:["submit"],setup(o,{expose:s,emit:r}){const t=o,a=r,i=e.inject(N),p=e.ref(!1);let h=0,C=0;const E=e.shallowRef(),m=e.shallowRef(),g=e.shallowRef(),{x:l,y:f}=K(g,{initialValue:{x:0,y:0}});function c(){i==null||i.close(t.id)}function v(n){if(typeof n=="number")return`${n}px`;if(typeof n=="string")return n}const d=e.computed(()=>{const n={};return t.mode==="dialog"&&(n.justifyContent="center"),t.mode==="drawer"&&(n.justifyContent="flex-end"),n}),k=e.computed(()=>{const n={};return t.size&&(n.width=v(t.sizes[t.size])),t.width&&(n.width=v(t.width)),t.maxWidth&&(n.maxWidth=v(t.maxWidth)),t.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),t.draggable&&!t.fullscreen&&t.mode==="dialog"&&(n.transform=`translate3d(${l.value-h}px, ${f.value-C}px, 0px)`),t.mode==="drawer"&&(n.borderRadius=0),n}),b=e.computed(()=>{const n={};return t.draggable&&!t.fullscreen&&t.mode==="dialog"&&(n.cursor="move"),n}),M=e.computed(()=>{var y;const n={};return t.maxHeight&&(n.maxHeight=`calc(${(y=v(t.maxHeight))==null?void 0:y.replace("%","vh")} - 50px)`),t.mode==="drawer"&&(n.maxHeight="unset",n.height=`calc(100vh - ${(t.header?50:0)+(t.footer?50:0)}px)`),t.fullscreen&&(n.maxHeight="unset",n.height=`calc(100vh - ${(t.header?50:0)+(t.footer?50:0)}px)`),t.type!=="component"&&(n.padding="0"),n});function L(){const n=m.value;if(t.form&&n){const y=n.querySelector(`form[name="${t.form}"]`);y&&y.dispatchEvent(new Event("submit"))}a("submit")}function $(){i==null||i.close(t.id)}function P(){window&&window.addEventListener("resize",()=>{e.triggerRef(E),e.triggerRef(m),m.value&&(h=m.value.offsetLeft,C=m.value.offsetTop)})}function u(){if(t.closeable&&t.esc){const n=({key:y})=>{y==="Escape"&&(i==null||i.close(t.id),window.removeEventListener("keydown",n))};window.addEventListener("keydown",n)}}function x(){h=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}),(n,y)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"wrapperRef",ref:E,class:"modal-wrapper",style:e.normalizeStyle(d.value),onClick:y[0]||(y[0]=e.withModifiers(S=>n.maskClosable&&c(),["self"]))},[e.createElementVNode("div",{ref_key:"contentRef",ref:m,class:e.normalizeClass(["modal-content",{[`${n.mode}-mode`]:!0}]),style:e.normalizeStyle(k.value)},[n.header?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"headerRef",ref:g,class:"modal-header",style:e.normalizeStyle(b.value),onMousedown:x},[e.createElementVNode("div",Y,e.toDisplayString(n.title),1),e.createElementVNode("div",q,[n.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(M.value)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.component),e.normalizeProps(e.guardReactiveProps(n.componentProps)),null,16))],4),n.footer?(e.openBlock(),e.createElementBlock("div",U,[e.createElementVNode("button",{class:"submit-button",form:n.form,type:"submit",onClick:L}," 确定 ",8,J),e.createElementVNode("button",{class:"cancel-button",type:"button",onClick:$}," 取消 ")])):e.createCommentVNode("",!0),p.value?(e.openBlock(),e.createElementBlock("div",Q,ee)):e.createCommentVNode("",!0)],6)],4))}});const R=(o,s)=>{const r=o.__vccOpts||o;for(const[t,a]of s)r[t]=a;return r},O=R(oe,[["__scopeId","data-v-7f0b9287"]]),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(o){const s=o,r=T(),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,h)=>(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:520,middle:860,large:1190})},maxWidth:{default:"80%"},maxHeight:{default:"80%"}},setup(o,{expose:s}){const r=e.shallowRef([]),t=e.ref(!1),a=e.getCurrentInstance();function i(l,f={},c={}){const v=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((b,M)=>{r.value.push({id:d,component:v,props:f||{},options:{...c,type:typeof l=="string"?l:"component"},resolve:b,reject:M,listeners:[]}),e.triggerRef(r)}).catch(b=>b==="CANCEL"?new Promise(()=>{}):Promise.reject(b));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 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 h(){r.value.forEach(l=>{l.resolve()}),r.value=[],e.triggerRef(r)}function C(l,f){const c=r.value.find(d=>d.id===l);if(!c)return;const v=c.listeners.find(d=>d.event===f);v&&v.callback({open:i,close:d=>p(c.id,d),closeAll:h,showLoading:()=>E(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 E(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 g(l,f,c){const v=r.value.find(d=>d.id===l);v&&v.listeners.push({event:f,callback:c})}return e.provide(N,{open:i,close:p,closeAll:h,addEventListener:g}),s({elements:r,open:i}),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(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":l.maxHeight,"max-width":l.maxWidth,sizes:l.sizes},c.options,{onSubmit:()=>C(c.id,"submit")}),null,16,["id","component","component-props","max-height","max-width","sizes","onSubmit"]))),128))]),_:1})],8,["disabled","to"]))])):e.createCommentVNode("",!0)],64))}});const fe=R(ue,[["__scopeId","data-v-4ee644e1"]]);function V(o,s){var t,a;let r=o==null?void 0:o.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 T(){const o=e.inject(N),s=e.getCurrentInstance();function r(t,a,i){if(!o)throw new Error("Not Found Modal Provider Component");return o.open(t,a,i)}return{open:r,close(t){var p;if(!o)throw new Error("Not Found Modal Provider Component");const a=V(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");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=V(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=V(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(o){var i;const s=e.inject(N),r=e.getCurrentInstance(),t=V(r,"ModalContainer"),a=(i=t==null?void 0:t.props)==null?void 0:i.id;s&&a&&s.addEventListener(a,"submit",o)}exports.ModalContainer=O;exports.ModalKey=N;exports.ModalProvider=fe;exports.onSubmit=pe;exports.useModal=T;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue");const N=Symbol("__MODAL__");function F(o){return e.getCurrentScope()?(e.onScopeDispose(o),!0):!1}function w(o){return typeof o=="function"?o():e.unref(o)}const z=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const W=Object.prototype.toString,I=o=>W.call(o)==="[object Object]",H=()=>{};function j(o,s={}){if(!e.isRef(o))return e.toRefs(o);const r=Array.isArray(o.value)?Array.from({length:o.value.length}):{};for(const t in o.value)r[t]=e.customRef(()=>({get(){return o.value[t]},set(a){var i;if((i=w(s.replaceRef))!=null?i:!0)if(Array.isArray(o.value)){const g=[...o.value];g[t]=a,o.value=g}else{const g={...o.value,[t]:a};Object.setPrototypeOf(g,Object.getPrototypeOf(o.value)),o.value=g}else o.value[t]=a}}));return r}function G(o){var s;const r=w(o);return(s=r==null?void 0:r.$el)!=null?s:r}const D=z?window:void 0;function A(...o){let s,r,t,a;if(typeof o[0]=="string"||Array.isArray(o[0])?([r,t,a]=o,s=D):[s,r,t,a]=o,!s)return H;Array.isArray(r)||(r=[r]),Array.isArray(t)||(t=[t]);const i=[],p=()=>{i.forEach(m=>m()),i.length=0},g=(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=>g(m,f,c,l))))},{immediate:!0,flush:"post"}),E=()=>{C(),p()};return F(E),E}function K(o,s={}){var r,t;const{pointerTypes:a,preventDefault:i,stopPropagation:p,exact:g,onMove:C,onEnd:E,onStart:m,initialValue:h,axis:l="both",draggingElement:f=D,containerElement:c,handle:v=o}=s,d=e.ref((r=w(h))!=null?r:{x:0,y:0}),k=e.ref(),b=u=>a?a.includes(u.pointerType):!0,x=u=>{w(i)&&u.preventDefault(),w(p)&&u.stopPropagation()},V=u=>{var M;if(!b(u)||w(g)&&u.target!==w(o))return;const _=w(c),B=(M=_==null?void 0:_.getBoundingClientRect)==null?void 0:M.call(_),n=w(o).getBoundingClientRect(),y={x:u.clientX-(_?n.left-B.left:n.left),y:u.clientY-(_?n.top-B.top:n.top)};(m==null?void 0:m(y,u))!==!1&&(k.value=y,x(u))},$=u=>{var M;if(!b(u)||!k.value)return;const _=w(c),B=(M=_==null?void 0:_.getBoundingClientRect)==null?void 0:M.call(_),n=w(o).getBoundingClientRect();let{x:y,y:S}=d.value;(l==="x"||l==="both")&&(y=u.clientX-k.value.x,_&&(y=Math.min(Math.max(0,y),B.width-n.width))),(l==="y"||l==="both")&&(S=u.clientY-k.value.y,_&&(S=Math.min(Math.max(0,S),B.height-n.height))),d.value={x:y,y:S},C==null||C(d.value,u),x(u)},P=u=>{b(u)&&k.value&&(k.value=void 0,E==null||E(d.value,u),x(u))};if(z){const u={capture:(t=s.capture)!=null?t:!0};A(v,"pointerdown",V,u),A(f,"pointermove",$,u),A(f,"pointerup",P,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=o=>(e.pushScopeId("data-v-88c1701f"),o=o(),e.popScopeId(),o),Y={class:"title 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:{}},emits:["submit"],setup(o,{expose:s,emit:r}){const t=o,a=r,i=e.inject(N),p=e.ref(!1);let g=0,C=0;const E=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 v(n){if(typeof n=="number")return`${n}px`;if(typeof n=="string")return n}const d=e.computed(()=>{const n={};return t.mode==="dialog"&&(n.justifyContent="center"),t.mode==="drawer"&&(n.justifyContent="flex-end"),n}),k=e.computed(()=>{const n={};return t.size&&(n.width=v(t.sizes[t.size])),t.width&&(n.width=v(t.width)),t.maxWidth&&(n.maxWidth=v(t.maxWidth)),t.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),t.draggable&&!t.fullscreen&&t.mode==="dialog"&&(n.transform=`translate3d(${l.value-g}px, ${f.value-C}px, 0px)`),t.mode==="drawer"&&(n.borderRadius=0),t.offset&&t.mode==="dialog"&&(n.marginLeft=`${t.offset.x||0}px`,n.marginTop=`${t.offset.y||0}px`),n}),b=e.computed(()=>{const n={};return t.draggable&&!t.fullscreen&&t.mode==="dialog"&&(n.cursor="move"),n}),x=e.computed(()=>{var y;const n={};return t.maxHeight&&(n.maxHeight=`calc(${(y=v(t.maxHeight))==null?void 0:y.replace("%","vh")} - 50px)`),t.mode==="drawer"&&(n.maxHeight="unset",n.height=`calc(100vh - ${(t.header?50:0)+(t.footer?50:0)}px)`),t.fullscreen&&(n.maxHeight="unset",n.height=`calc(100vh - ${(t.header?50:0)+(t.footer?50:0)}px)`),t.type!=="component"&&(n.padding="0"),n});function V(){const n=m.value;if(t.form&&n){const y=n.querySelector(`form[name="${t.form}"]`);y&&y.dispatchEvent(new Event("submit"))}a("submit")}function $(){i==null||i.close(t.id)}function P(){window&&window.addEventListener("resize",()=>{e.triggerRef(E),e.triggerRef(m),m.value&&(g=m.value.offsetLeft,C=m.value.offsetTop)})}function u(){if(t.closeable&&t.esc){const n=({key:y})=>{y==="Escape"&&(i==null||i.close(t.id),window.removeEventListener("keydown",n))};window.addEventListener("keydown",n)}}function M(){g=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}),(n,y)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"wrapperRef",ref:E,class:"modal-wrapper",style:e.normalizeStyle(d.value),onClick:y[0]||(y[0]=e.withModifiers(S=>n.maskClosable&&c(),["self"]))},[e.createElementVNode("div",{ref_key:"contentRef",ref:m,class:e.normalizeClass(["modal-content",{[`${n.mode}-mode`]:!0}]),style:e.normalizeStyle(k.value)},[n.header?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"headerRef",ref:h,class:"modal-header",style:e.normalizeStyle(b.value),onMousedown:M},[e.createElementVNode("div",Y,e.toDisplayString(n.title),1),e.createElementVNode("div",q,[n.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(n.component),e.normalizeProps(e.guardReactiveProps(n.componentProps)),null,16))],4),n.footer?(e.openBlock(),e.createElementBlock("div",U,[e.createElementVNode("button",{class:"submit-button",form:n.form,type:"submit",onClick:V}," 确定 ",8,J),e.createElementVNode("button",{class:"cancel-button",type:"button",onClick:$}," 取消 ")])):e.createCommentVNode("",!0),p.value?(e.openBlock(),e.createElementBlock("div",Q,ee)):e.createCommentVNode("",!0)],6)],4))}});const R=(o,s)=>{const r=o.__vccOpts||o;for(const[t,a]of s)r[t]=a;return r},T=R(oe,[["__scopeId","data-v-88c1701f"]]),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(o){const s=o,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,g)=>(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:520,middle:860,large:1190})},maxWidth:{default:"80%"},maxHeight:{default:"80%"},offset:{default:()=>({x:0,y:0})}},setup(o,{expose:s}){const r=e.shallowRef([]),t=e.ref(!1),a=e.getCurrentInstance();function i(l,f={},c={}){const v=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((b,x)=>{r.value.push({id:d,component:v,props:f||{},options:{...c,type:typeof l=="string"?l:"component"},resolve:b,reject:x,listeners:[]}),e.triggerRef(r)}).catch(b=>b==="CANCEL"?new Promise(()=>{}):Promise.reject(b));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 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 g(){r.value.forEach(l=>{l.resolve()}),r.value=[],e.triggerRef(r)}function C(l,f){const c=r.value.find(d=>d.id===l);if(!c)return;const v=c.listeners.find(d=>d.event===f);v&&v.callback({open:i,close:d=>p(c.id,d),closeAll:g,showLoading:()=>E(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 E(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 v=r.value.find(d=>d.id===l);v&&v.listeners.push({event:f,callback:c})}return e.provide(N,{open:i,close:p,closeAll:g,addEventListener:h}),s({elements:r,open:i}),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(T,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-9b4a189e"]]);function L(o,s){var t,a;let r=o==null?void 0:o.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 o=e.inject(N),s=e.getCurrentInstance();function r(t,a,i){if(!o)throw new Error("Not Found Modal Provider Component");return o.open(t,a,i)}return{open:r,close(t){var p;if(!o)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");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=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(!o)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(o){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",o)}exports.ModalContainer=T;exports.ModalKey=N;exports.ModalProvider=fe;exports.onSubmit=pe;exports.useModal=O;
@@ -20,6 +20,10 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
20
20
  draggable?: boolean | undefined;
21
21
  mode?: "dialog" | "drawer" | undefined;
22
22
  type?: string | undefined;
23
+ offset?: {
24
+ x?: number | undefined;
25
+ y?: number | undefined;
26
+ } | undefined;
23
27
  }>, {
24
28
  header: boolean;
25
29
  closeable: boolean;
@@ -55,6 +59,10 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
55
59
  draggable?: boolean | undefined;
56
60
  mode?: "dialog" | "drawer" | undefined;
57
61
  type?: string | undefined;
62
+ offset?: {
63
+ x?: number | undefined;
64
+ y?: number | undefined;
65
+ } | undefined;
58
66
  }>, {
59
67
  header: boolean;
60
68
  closeable: boolean;
@@ -5,6 +5,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
5
5
  sizes: SizeOptions;
6
6
  maxWidth: string | number;
7
7
  maxHeight: string | number;
8
+ offset?: {
9
+ x?: number | undefined;
10
+ y?: number | undefined;
11
+ } | undefined;
8
12
  }>, {
9
13
  appendToBody: boolean;
10
14
  maxWidth: string;
@@ -14,6 +18,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
14
18
  middle: number;
15
19
  large: number;
16
20
  };
21
+ offset: () => {
22
+ x: number;
23
+ y: number;
24
+ };
17
25
  }>, {
18
26
  elements: import("vue").ShallowRef<ModalElement[]>;
19
27
  open: (component: Component | 'confirm' | 'info' | 'warning' | 'error' | 'success', props?: Record<string, any>, options?: OpenModalOptions) => Promise<unknown> & {
@@ -24,6 +32,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
24
32
  sizes: SizeOptions;
25
33
  maxWidth: string | number;
26
34
  maxHeight: string | number;
35
+ offset?: {
36
+ x?: number | undefined;
37
+ y?: number | undefined;
38
+ } | undefined;
27
39
  }>, {
28
40
  appendToBody: boolean;
29
41
  maxWidth: string;
@@ -33,10 +45,18 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
33
45
  middle: number;
34
46
  large: number;
35
47
  };
48
+ offset: () => {
49
+ x: number;
50
+ y: number;
51
+ };
36
52
  }>>>, {
37
53
  maxWidth: string | number;
38
54
  maxHeight: string | number;
39
55
  sizes: SizeOptions;
56
+ offset: {
57
+ x?: number;
58
+ y?: number;
59
+ };
40
60
  appendToBody: boolean | string;
41
61
  }, {}>, {
42
62
  default?(_: {}): any;
package/dist/es/index.mjs CHANGED
@@ -1,16 +1,16 @@
1
- import { unref as ee, isRef as te, toRefs as oe, customRef as ne, getCurrentScope as ie, onScopeDispose as re, ref as N, computed as A, watch as se, defineComponent as Y, inject as j, shallowRef as T, onMounted as U, onUnmounted as le, openBlock as g, createElementBlock as k, normalizeStyle as z, withModifiers as ae, createElementVNode as y, normalizeClass as de, toDisplayString as O, createCommentVNode as P, createBlock as W, resolveDynamicComponent as J, normalizeProps as ce, guardReactiveProps as ue, triggerRef as R, pushScopeId as fe, popScopeId as pe, Fragment as X, getCurrentInstance as K, provide as me, renderSlot as ve, Teleport as he, createVNode as ye, TransitionGroup as ge, withCtx as _e, renderList as we, mergeProps as be, defineAsyncComponent as Ce } from "vue";
1
+ import { unref as ee, isRef as te, toRefs as oe, customRef as ne, getCurrentScope as ie, onScopeDispose as re, ref as N, computed as A, watch as se, defineComponent as Y, inject as j, shallowRef as R, onMounted as U, onUnmounted as le, openBlock as g, createElementBlock as x, normalizeStyle as T, withModifiers as ae, createElementVNode as y, normalizeClass as de, toDisplayString as z, createCommentVNode as P, createBlock as W, resolveDynamicComponent as J, normalizeProps as ce, guardReactiveProps as ue, triggerRef as O, pushScopeId as fe, popScopeId as pe, Fragment as X, getCurrentInstance as K, provide as me, renderSlot as ve, Teleport as he, createVNode as ye, TransitionGroup as ge, withCtx as _e, renderList as we, mergeProps as Ce, defineAsyncComponent as be } from "vue";
2
2
  const F = Symbol("__MODAL__");
3
- function ke(t) {
3
+ function xe(t) {
4
4
  return ie() ? (re(t), !0) : !1;
5
5
  }
6
- function b(t) {
6
+ function C(t) {
7
7
  return typeof t == "function" ? t() : ee(t);
8
8
  }
9
9
  const Q = typeof window < "u" && typeof document < "u";
10
10
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
11
- const xe = Object.prototype.toString, Me = (t) => xe.call(t) === "[object Object]", Ee = () => {
11
+ const ke = Object.prototype.toString, Me = (t) => ke.call(t) === "[object Object]", Ee = () => {
12
12
  };
13
- function Se(t, s = {}) {
13
+ function Le(t, s = {}) {
14
14
  if (!te(t))
15
15
  return oe(t);
16
16
  const n = Array.isArray(t.value) ? Array.from({ length: t.value.length }) : {};
@@ -21,7 +21,7 @@ function Se(t, s = {}) {
21
21
  },
22
22
  set(l) {
23
23
  var i;
24
- if ((i = b(s.replaceRef)) != null ? i : !0)
24
+ if ((i = C(s.replaceRef)) != null ? i : !0)
25
25
  if (Array.isArray(t.value)) {
26
26
  const h = [...t.value];
27
27
  h[e] = l, t.value = h;
@@ -35,9 +35,9 @@ function Se(t, s = {}) {
35
35
  }));
36
36
  return n;
37
37
  }
38
- function Le(t) {
38
+ function Se(t) {
39
39
  var s;
40
- const n = b(t);
40
+ const n = C(t);
41
41
  return (s = n == null ? void 0 : n.$el) != null ? s : n;
42
42
  }
43
43
  const Z = Q ? window : void 0;
@@ -48,8 +48,8 @@ function G(...t) {
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
- }, h = (p, _, r, u) => (p.addEventListener(_, r, u), () => p.removeEventListener(_, r, u)), x = se(
52
- () => [Le(s), b(l)],
51
+ }, h = (p, _, r, u) => (p.addEventListener(_, r, u), () => p.removeEventListener(_, r, u)), k = se(
52
+ () => [Se(s), C(l)],
53
53
  ([p, _]) => {
54
54
  if (f(), !p)
55
55
  return;
@@ -60,9 +60,9 @@ function G(...t) {
60
60
  },
61
61
  { immediate: !0, flush: "post" }
62
62
  ), M = () => {
63
- x(), f();
63
+ k(), f();
64
64
  };
65
- return ke(M), M;
65
+ return xe(M), M;
66
66
  }
67
67
  function $e(t, s = {}) {
68
68
  var n, e;
@@ -71,7 +71,7 @@ function $e(t, s = {}) {
71
71
  preventDefault: i,
72
72
  stopPropagation: f,
73
73
  exact: h,
74
- onMove: x,
74
+ onMove: k,
75
75
  onEnd: M,
76
76
  onStart: p,
77
77
  initialValue: _,
@@ -80,57 +80,57 @@ function $e(t, s = {}) {
80
80
  containerElement: a,
81
81
  handle: m = t
82
82
  } = s, d = N(
83
- (n = b(_)) != null ? n : { x: 0, y: 0 }
84
- ), C = N(), E = (c) => l ? l.includes(c.pointerType) : !0, L = (c) => {
85
- b(i) && c.preventDefault(), b(f) && c.stopPropagation();
83
+ (n = C(_)) != null ? n : { x: 0, y: 0 }
84
+ ), b = N(), E = (c) => l ? l.includes(c.pointerType) : !0, S = (c) => {
85
+ C(i) && c.preventDefault(), C(f) && c.stopPropagation();
86
86
  }, H = (c) => {
87
87
  var $;
88
- if (!E(c) || b(h) && c.target !== b(t))
88
+ if (!E(c) || C(h) && c.target !== C(t))
89
89
  return;
90
- const w = b(a), S = ($ = w == null ? void 0 : w.getBoundingClientRect) == null ? void 0 : $.call(w), o = b(t).getBoundingClientRect(), v = {
91
- x: c.clientX - (w ? o.left - S.left : o.left),
92
- y: c.clientY - (w ? o.top - S.top : o.top)
90
+ const w = C(a), L = ($ = w == null ? void 0 : w.getBoundingClientRect) == null ? void 0 : $.call(w), o = C(t).getBoundingClientRect(), v = {
91
+ x: c.clientX - (w ? o.left - L.left : o.left),
92
+ y: c.clientY - (w ? o.top - L.top : o.top)
93
93
  };
94
- (p == null ? void 0 : p(v, c)) !== !1 && (C.value = v, L(c));
94
+ (p == null ? void 0 : p(v, c)) !== !1 && (b.value = v, S(c));
95
95
  }, I = (c) => {
96
96
  var $;
97
- if (!E(c) || !C.value)
97
+ if (!E(c) || !b.value)
98
98
  return;
99
- const w = b(a), S = ($ = w == null ? void 0 : w.getBoundingClientRect) == null ? void 0 : $.call(w), o = b(t).getBoundingClientRect();
99
+ const w = C(a), L = ($ = w == null ? void 0 : w.getBoundingClientRect) == null ? void 0 : $.call(w), o = C(t).getBoundingClientRect();
100
100
  let { x: v, y: B } = d.value;
101
- (r === "x" || r === "both") && (v = c.clientX - C.value.x, w && (v = Math.min(Math.max(0, v), S.width - o.width))), (r === "y" || r === "both") && (B = c.clientY - C.value.y, w && (B = Math.min(Math.max(0, B), S.height - o.height))), d.value = {
101
+ (r === "x" || r === "both") && (v = c.clientX - b.value.x, w && (v = Math.min(Math.max(0, v), L.width - o.width))), (r === "y" || r === "both") && (B = c.clientY - b.value.y, w && (B = Math.min(Math.max(0, B), L.height - o.height))), d.value = {
102
102
  x: v,
103
103
  y: B
104
- }, x == null || x(d.value, c), L(c);
104
+ }, k == null || k(d.value, c), S(c);
105
105
  }, V = (c) => {
106
- E(c) && C.value && (C.value = void 0, M == null || M(d.value, c), L(c));
106
+ E(c) && b.value && (b.value = void 0, M == null || M(d.value, c), S(c));
107
107
  };
108
108
  if (Q) {
109
109
  const c = { capture: (e = s.capture) != null ? e : !0 };
110
110
  G(m, "pointerdown", H, c), G(u, "pointermove", I, c), G(u, "pointerup", V, c);
111
111
  }
112
112
  return {
113
- ...Se(d),
113
+ ...Le(d),
114
114
  position: d,
115
- isDragging: A(() => !!C.value),
115
+ isDragging: A(() => !!b.value),
116
116
  style: A(
117
117
  () => `left:${d.value.x}px;top:${d.value.y}px;`
118
118
  )
119
119
  };
120
120
  }
121
- const Ae = (t) => (fe("data-v-7f0b9287"), t = t(), pe(), t), Pe = { class: "title font-bold" }, Be = { class: "action" }, ze = {
121
+ const Ae = (t) => (fe("data-v-88c1701f"), t = t(), pe(), t), Pe = { class: "title font-bold" }, Be = { class: "action" }, Te = {
122
122
  key: 1,
123
123
  class: "modal-footer space-x-2"
124
- }, Oe = ["form"], Re = {
124
+ }, ze = ["form"], Oe = {
125
125
  key: 2,
126
126
  class: "modal-loading"
127
- }, Te = /* @__PURE__ */ Ae(() => /* @__PURE__ */ y("div", { class: "lds-ring" }, [
127
+ }, Re = /* @__PURE__ */ Ae(() => /* @__PURE__ */ y("div", { class: "lds-ring" }, [
128
128
  /* @__PURE__ */ y("div"),
129
129
  /* @__PURE__ */ y("div"),
130
130
  /* @__PURE__ */ y("div"),
131
131
  /* @__PURE__ */ y("div")
132
132
  ], -1)), De = [
133
- Te
133
+ Re
134
134
  ], Ne = {
135
135
  name: "ModalContainer",
136
136
  inheritAttrs: !0
@@ -155,13 +155,14 @@ const Ae = (t) => (fe("data-v-7f0b9287"), t = t(), pe(), t), Pe = { class: "titl
155
155
  maskClosable: { type: Boolean, default: !1 },
156
156
  draggable: { type: Boolean, default: !1 },
157
157
  mode: { default: "dialog" },
158
- type: {}
158
+ type: {},
159
+ offset: {}
159
160
  },
160
161
  emits: ["submit"],
161
162
  setup(t, { expose: s, emit: n }) {
162
163
  const e = t, l = n, i = j(F), f = N(!1);
163
- let h = 0, x = 0;
164
- const M = T(), p = T(), _ = T(), { x: r, y: u } = $e(_, {
164
+ let h = 0, k = 0;
165
+ const M = R(), p = R(), _ = R(), { x: r, y: u } = $e(_, {
165
166
  initialValue: { x: 0, y: 0 }
166
167
  });
167
168
  function a() {
@@ -176,13 +177,13 @@ const Ae = (t) => (fe("data-v-7f0b9287"), t = t(), pe(), t), Pe = { class: "titl
176
177
  const d = A(() => {
177
178
  const o = {};
178
179
  return e.mode === "dialog" && (o.justifyContent = "center"), e.mode === "drawer" && (o.justifyContent = "flex-end"), o;
179
- }), C = A(() => {
180
+ }), b = A(() => {
180
181
  const o = {};
181
- return e.size && (o.width = m(e.sizes[e.size])), e.width && (o.width = m(e.width)), e.maxWidth && (o.maxWidth = m(e.maxWidth)), e.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), e.draggable && !e.fullscreen && e.mode === "dialog" && (o.transform = `translate3d(${r.value - h}px, ${u.value - x}px, 0px)`), e.mode === "drawer" && (o.borderRadius = 0), o;
182
+ return e.size && (o.width = m(e.sizes[e.size])), e.width && (o.width = m(e.width)), e.maxWidth && (o.maxWidth = m(e.maxWidth)), e.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), e.draggable && !e.fullscreen && e.mode === "dialog" && (o.transform = `translate3d(${r.value - h}px, ${u.value - k}px, 0px)`), e.mode === "drawer" && (o.borderRadius = 0), e.offset && e.mode === "dialog" && (o.marginLeft = `${e.offset.x || 0}px`, o.marginTop = `${e.offset.y || 0}px`), o;
182
183
  }), E = A(() => {
183
184
  const o = {};
184
185
  return e.draggable && !e.fullscreen && e.mode === "dialog" && (o.cursor = "move"), o;
185
- }), L = A(() => {
186
+ }), S = A(() => {
186
187
  var v;
187
188
  const o = {};
188
189
  return e.maxHeight && (o.maxHeight = `calc(${(v = m(e.maxHeight)) == null ? void 0 : v.replace("%", "vh")} - 50px)`), e.mode === "drawer" && (o.maxHeight = "unset", o.height = `calc(100vh - ${(e.header ? 50 : 0) + (e.footer ? 50 : 0)}px)`), e.fullscreen && (o.maxHeight = "unset", o.height = `calc(100vh - ${(e.header ? 50 : 0) + (e.footer ? 50 : 0)}px)`), e.type !== "component" && (o.padding = "0"), o;
@@ -200,7 +201,7 @@ const Ae = (t) => (fe("data-v-7f0b9287"), t = t(), pe(), t), Pe = { class: "titl
200
201
  }
201
202
  function V() {
202
203
  window && window.addEventListener("resize", () => {
203
- R(M), R(p), p.value && (h = p.value.offsetLeft, x = p.value.offsetTop);
204
+ O(M), O(p), p.value && (h = p.value.offsetLeft, k = p.value.offsetTop);
204
205
  });
205
206
  }
206
207
  function c() {
@@ -212,45 +213,45 @@ const Ae = (t) => (fe("data-v-7f0b9287"), t = t(), pe(), t), Pe = { class: "titl
212
213
  }
213
214
  }
214
215
  function $() {
215
- h = p.value.offsetLeft, x = p.value.offsetTop;
216
+ h = p.value.offsetLeft, k = p.value.offsetTop;
216
217
  }
217
218
  U(() => {
218
219
  c(), V();
219
220
  }), le(() => {
220
221
  });
221
222
  function w() {
222
- return f.value = !0, () => S();
223
+ return f.value = !0, () => L();
223
224
  }
224
- function S() {
225
+ function L() {
225
226
  f.value = !1;
226
227
  }
227
228
  return s({
228
229
  showLoading: w,
229
- hideLoading: S
230
- }), (o, v) => (g(), k("div", {
230
+ hideLoading: L
231
+ }), (o, v) => (g(), x("div", {
231
232
  ref_key: "wrapperRef",
232
233
  ref: M,
233
234
  class: "modal-wrapper",
234
- style: z(d.value),
235
+ style: T(d.value),
235
236
  onClick: v[0] || (v[0] = ae((B) => o.maskClosable && a(), ["self"]))
236
237
  }, [
237
238
  y("div", {
238
239
  ref_key: "contentRef",
239
240
  ref: p,
240
241
  class: de(["modal-content", { [`${o.mode}-mode`]: !0 }]),
241
- style: z(C.value)
242
+ style: T(b.value)
242
243
  }, [
243
- o.header ? (g(), k("div", {
244
+ o.header ? (g(), x("div", {
244
245
  key: 0,
245
246
  ref_key: "headerRef",
246
247
  ref: _,
247
248
  class: "modal-header",
248
- style: z(E.value),
249
+ style: T(E.value),
249
250
  onMousedown: $
250
251
  }, [
251
- y("div", Pe, O(o.title), 1),
252
+ y("div", Pe, z(o.title), 1),
252
253
  y("div", Be, [
253
- o.closeable ? (g(), k("div", {
254
+ o.closeable ? (g(), x("div", {
254
255
  key: 0,
255
256
  class: "i-icon-park-outline:close block cursor-pointer",
256
257
  onClick: a
@@ -259,24 +260,24 @@ const Ae = (t) => (fe("data-v-7f0b9287"), t = t(), pe(), t), Pe = { class: "titl
259
260
  ], 36)) : P("", !0),
260
261
  y("div", {
261
262
  class: "modal-body",
262
- style: z(L.value)
263
+ style: T(S.value)
263
264
  }, [
264
265
  (g(), W(J(o.component), ce(ue(o.componentProps)), null, 16))
265
266
  ], 4),
266
- o.footer ? (g(), k("div", ze, [
267
+ o.footer ? (g(), x("div", Te, [
267
268
  y("button", {
268
269
  class: "submit-button",
269
270
  form: o.form,
270
271
  type: "submit",
271
272
  onClick: H
272
- }, " 确定 ", 8, Oe),
273
+ }, " 确定 ", 8, ze),
273
274
  y("button", {
274
275
  class: "cancel-button",
275
276
  type: "button",
276
277
  onClick: I
277
278
  }, " 取消 ")
278
279
  ])) : P("", !0),
279
- f.value ? (g(), k("div", Re, De)) : P("", !0)
280
+ f.value ? (g(), x("div", Oe, De)) : P("", !0)
280
281
  ], 6)
281
282
  ], 4));
282
283
  }
@@ -286,7 +287,7 @@ const q = (t, s) => {
286
287
  for (const [e, l] of s)
287
288
  n[e] = l;
288
289
  return n;
289
- }, Fe = /* @__PURE__ */ q(We, [["__scopeId", "data-v-7f0b9287"]]), He = { class: "modal-dialog" }, Ie = { class: "dialog-body" }, Ve = { class: "dialog-title" }, Ge = { class: "dialog-content" }, Xe = /* @__PURE__ */ Y({
290
+ }, Fe = /* @__PURE__ */ q(We, [["__scopeId", "data-v-88c1701f"]]), He = { class: "modal-dialog" }, Ie = { class: "dialog-body" }, Ve = { class: "dialog-title" }, Ge = { class: "dialog-content" }, Xe = /* @__PURE__ */ Y({
290
291
  __name: "modal-dialog",
291
292
  props: {
292
293
  type: {},
@@ -312,27 +313,27 @@ const q = (t, s) => {
312
313
  async function i() {
313
314
  s.onCancel && await s.onCancel(), n.close();
314
315
  }
315
- return (f, h) => (g(), k("section", He, [
316
+ return (f, h) => (g(), x("section", He, [
316
317
  y("div", Ie, [
317
- y("div", Ve, O(e.value), 1),
318
- y("div", Ge, O(f.content), 1)
318
+ y("div", Ve, z(e.value), 1),
319
+ y("div", Ge, z(f.content), 1)
319
320
  ]),
320
321
  y("div", {
321
322
  class: "dialog-footer space-x-2",
322
- style: z(f.type === "confirm" ? { "justify-content": "end" } : { "border-top": "none" })
323
+ style: T(f.type === "confirm" ? { "justify-content": "end" } : { "border-top": "none" })
323
324
  }, [
324
- f.footer ? (g(), W(J(f.footer), { key: 0 })) : (g(), k(X, { key: 1 }, [
325
+ f.footer ? (g(), W(J(f.footer), { key: 0 })) : (g(), x(X, { key: 1 }, [
325
326
  y("button", {
326
327
  class: "submit-button",
327
328
  type: "submit",
328
329
  onClick: l
329
- }, O(f.okText), 1),
330
- f.type === "confirm" ? (g(), k("button", {
330
+ }, z(f.okText), 1),
331
+ f.type === "confirm" ? (g(), x("button", {
331
332
  key: 0,
332
333
  class: "cancel-button",
333
334
  type: "button",
334
335
  onClick: i
335
- }, O(f.cancelText), 1)) : P("", !0)
336
+ }, z(f.cancelText), 1)) : P("", !0)
336
337
  ], 64))
337
338
  ], 4)
338
339
  ]));
@@ -354,16 +355,17 @@ const Ye = /* @__PURE__ */ q(Xe, [["__scopeId", "data-v-8326e5a5"]]), je = {
354
355
  large: 1190
355
356
  }) },
356
357
  maxWidth: { default: "80%" },
357
- maxHeight: { default: "80%" }
358
+ maxHeight: { default: "80%" },
359
+ offset: { default: () => ({ x: 0, y: 0 }) }
358
360
  },
359
361
  setup(t, { expose: s }) {
360
- const n = T([]), e = N(!1), l = K();
362
+ const n = R([]), e = N(!1), l = K();
361
363
  function i(r, u = {}, a = {}) {
362
- const m = Ce(
364
+ const m = be(
363
365
  () => Promise.resolve(typeof r == "string" ? Ye : r)
364
366
  );
365
367
  typeof r == "string" && (u.type = r, a.size = "small", a.fullscreen = !1, a.mode = "dialog", a.footer = !1, a.header = !1);
366
- const d = Math.random().toString(32).slice(2), C = new Promise((E, L) => {
368
+ const d = Math.random().toString(32).slice(2), b = new Promise((E, S) => {
367
369
  n.value.push({
368
370
  id: d,
369
371
  component: m,
@@ -373,12 +375,12 @@ const Ye = /* @__PURE__ */ q(Xe, [["__scopeId", "data-v-8326e5a5"]]), je = {
373
375
  type: typeof r == "string" ? r : "component"
374
376
  },
375
377
  resolve: E,
376
- reject: L,
378
+ reject: S,
377
379
  listeners: []
378
- }), R(n);
380
+ }), O(n);
379
381
  }).catch((E) => E === "CANCEL" ? new Promise(() => {
380
382
  }) : Promise.reject(E));
381
- return Object.assign(C, {
383
+ return Object.assign(b, {
382
384
  close: () => f(d)
383
385
  });
384
386
  }
@@ -387,14 +389,14 @@ const Ye = /* @__PURE__ */ q(Xe, [["__scopeId", "data-v-8326e5a5"]]), je = {
387
389
  if (a < 0)
388
390
  return;
389
391
  const m = n.value[a];
390
- u === void 0 ? m == null || m.reject("CANCEL") : m == null || m.resolve(u), n.value.splice(a, 1), R(n);
392
+ u === void 0 ? m == null || m.reject("CANCEL") : m == null || m.resolve(u), n.value.splice(a, 1), O(n);
391
393
  }
392
394
  function h() {
393
395
  n.value.forEach((r) => {
394
396
  r.resolve();
395
- }), n.value = [], R(n);
397
+ }), n.value = [], O(n);
396
398
  }
397
- function x(r, u) {
399
+ function k(r, u) {
398
400
  const a = n.value.find((d) => d.id === r);
399
401
  if (!a)
400
402
  return;
@@ -443,16 +445,16 @@ const Ye = /* @__PURE__ */ q(Xe, [["__scopeId", "data-v-8326e5a5"]]), je = {
443
445
  open: i
444
446
  }), U(() => {
445
447
  e.value = !0;
446
- }), (r, u) => (g(), k(X, null, [
448
+ }), (r, u) => (g(), x(X, null, [
447
449
  ve(r.$slots, "default", {}, void 0, !0),
448
- e.value ? (g(), k("div", je, [
450
+ e.value ? (g(), x("div", je, [
449
451
  (g(), W(he, {
450
452
  disabled: !r.appendToBody,
451
453
  to: typeof r.appendToBody == "string" ? r.appendToBody : "body"
452
454
  }, [
453
455
  ye(ge, { name: "modal-fade" }, {
454
456
  default: _e(() => [
455
- (g(!0), k(X, null, we(n.value, (a) => (g(), W(Fe, be({
457
+ (g(!0), x(X, null, we(n.value, (a) => (g(), W(Fe, Ce({
456
458
  id: a.id,
457
459
  key: a.id,
458
460
  ref_for: !0,
@@ -461,10 +463,11 @@ const Ye = /* @__PURE__ */ q(Xe, [["__scopeId", "data-v-8326e5a5"]]), je = {
461
463
  "component-props": a.props,
462
464
  "max-height": r.maxHeight,
463
465
  "max-width": r.maxWidth,
466
+ offset: r.offset,
464
467
  sizes: r.sizes
465
468
  }, a.options, {
466
- onSubmit: () => x(a.id, "submit")
467
- }), null, 16, ["id", "component", "component-props", "max-height", "max-width", "sizes", "onSubmit"]))), 128))
469
+ onSubmit: () => k(a.id, "submit")
470
+ }), null, 16, ["id", "component", "component-props", "max-height", "max-width", "offset", "sizes", "onSubmit"]))), 128))
468
471
  ]),
469
472
  _: 1
470
473
  })
@@ -473,7 +476,7 @@ const Ye = /* @__PURE__ */ q(Xe, [["__scopeId", "data-v-8326e5a5"]]), je = {
473
476
  ], 64));
474
477
  }
475
478
  });
476
- const Qe = /* @__PURE__ */ q(qe, [["__scopeId", "data-v-4ee644e1"]]);
479
+ const Qe = /* @__PURE__ */ q(qe, [["__scopeId", "data-v-9b4a189e"]]);
477
480
  function D(t, s) {
478
481
  var e, l;
479
482
  let n = t == null ? void 0 : t.parent;
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}.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-7f0b9287]{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-7f0b9287]{background:#ffffff;border-radius:5px;position:relative}.modal-header[data-v-7f0b9287]{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)}.modal-body[data-v-7f0b9287]{padding:20px 10px;box-sizing:border-box;max-height:10vw;overflow:auto}.modal-footer[data-v-7f0b9287]{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-7f0b9287]{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-7f0b9287]{color:#fff;background-color:rgb(var(--primary-6, 45, 106, 251))}.modal-footer button.submit-button[data-v-7f0b9287]:hover{background-color:rgb(var(--primary-5, 28, 76, 207))}.modal-footer button.cancel-button[data-v-7f0b9287]{color:rgb(var(--color-text-2, 78, 89, 105));background-color:var(--color-fill-1, #f5f5f5)}.modal-footer button.cancel-button[data-v-7f0b9287]:hover{background-color:var(--color-fill-4, #c9cdd4)}.modal-loading[data-v-7f0b9287]{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-7f0b9287]{display:inline-block;position:relative;width:80px;height:80px}.modal-loading .lds-ring div[data-v-7f0b9287]{box-sizing:border-box;display:block;position:absolute;width:48px;height:48px;margin:8px;border:5px solid #fff;border-radius:50%;animation:lds-ring-7f0b9287 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:#fff transparent transparent transparent}.modal-loading .lds-ring div[data-v-7f0b9287]:nth-child(1){animation-delay:-.45s}.modal-loading .lds-ring div[data-v-7f0b9287]:nth-child(2){animation-delay:-.3s}.modal-loading .lds-ring div[data-v-7f0b9287]:nth-child(3){animation-delay:-.15s}@keyframes lds-ring-7f0b9287{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-4ee644e1],.modal-fade-leave-active[data-v-4ee644e1]{transition:opacity .5s ease}.modal-fade-enter-active[data-v-4ee644e1] .modal-content.drawer-mode,.modal-fade-leave-active[data-v-4ee644e1] .modal-content.drawer-mode{transition:transform .5s ease}.modal-fade-enter-from[data-v-4ee644e1],.modal-fade-leave-to[data-v-4ee644e1]{opacity:0}.modal-fade-enter-from[data-v-4ee644e1] .modal-content.drawer-mode,.modal-fade-leave-to[data-v-4ee644e1] .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}.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-88c1701f]{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-88c1701f]{background:#ffffff;border-radius:5px;position:relative}.modal-header[data-v-88c1701f]{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)}.modal-body[data-v-88c1701f]{padding:20px 10px;box-sizing:border-box;max-height:10vw;overflow:auto}.modal-footer[data-v-88c1701f]{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-88c1701f]{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-88c1701f]{color:#fff;background-color:rgb(var(--primary-6, 45, 106, 251))}.modal-footer button.submit-button[data-v-88c1701f]:hover{background-color:rgb(var(--primary-5, 28, 76, 207))}.modal-footer button.cancel-button[data-v-88c1701f]{color:rgb(var(--color-text-2, 78, 89, 105));background-color:var(--color-fill-1, #f5f5f5)}.modal-footer button.cancel-button[data-v-88c1701f]:hover{background-color:var(--color-fill-4, #c9cdd4)}.modal-loading[data-v-88c1701f]{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-88c1701f]{display:inline-block;position:relative;width:80px;height:80px}.modal-loading .lds-ring div[data-v-88c1701f]{box-sizing:border-box;display:block;position:absolute;width:48px;height:48px;margin:8px;border:5px solid #fff;border-radius:50%;animation:lds-ring-88c1701f 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:#fff transparent transparent transparent}.modal-loading .lds-ring div[data-v-88c1701f]:nth-child(1){animation-delay:-.45s}.modal-loading .lds-ring div[data-v-88c1701f]:nth-child(2){animation-delay:-.3s}.modal-loading .lds-ring div[data-v-88c1701f]:nth-child(3){animation-delay:-.15s}@keyframes lds-ring-88c1701f{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-9b4a189e],.modal-fade-leave-active[data-v-9b4a189e]{transition:opacity .5s ease}.modal-fade-enter-active[data-v-9b4a189e] .modal-content.drawer-mode,.modal-fade-leave-active[data-v-9b4a189e] .modal-content.drawer-mode{transition:transform .5s ease}.modal-fade-enter-from[data-v-9b4a189e],.modal-fade-leave-to[data-v-9b4a189e]{opacity:0}.modal-fade-enter-from[data-v-9b4a189e] .modal-content.drawer-mode,.modal-fade-leave-to[data-v-9b4a189e] .modal-content.drawer-mode{transform:translate3d(100%,0,0)}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gopowerteam/modal-render",
3
3
  "type": "module",
4
- "version": "0.0.10",
4
+ "version": "0.0.11",
5
5
  "author": {
6
6
  "name": "zhuchentong",
7
7
  "email": "2037630@gmail.com"