@gopowerteam/modal-render 0.0.17 → 0.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import type { Component } from 'vue';
1
+ import type { CSSProperties, Component } from 'vue';
2
2
  import type { SizeOptions } from '../interfaces';
3
3
  declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
4
4
  id: string;
@@ -25,6 +25,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
25
25
  y?: number | undefined;
26
26
  } | undefined;
27
27
  backgroundColor?: string | undefined;
28
+ bodyStyle?: CSSProperties | undefined;
28
29
  }>, {
29
30
  header: boolean;
30
31
  closeable: boolean;
@@ -65,6 +66,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
65
66
  y?: number | undefined;
66
67
  } | undefined;
67
68
  backgroundColor?: string | undefined;
69
+ bodyStyle?: CSSProperties | undefined;
68
70
  }>, {
69
71
  header: boolean;
70
72
  closeable: boolean;
@@ -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 z=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 g=[...n.value];g[t]=a,n.value=g}else{const g={...n.value,[t]:a};Object.setPrototypeOf(g,Object.getPrototypeOf(n.value)),n.value=g}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 D=z?window:void 0;function P(...n){let s,r,t,a;if(typeof n[0]=="string"||Array.isArray(n[0])?([r,t,a]=n,s=D):[s,r,t,a]=n,!s)return 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"}),b=()=>{C(),p()};return F(b),b}function K(n,s={}){var r,t;const{pointerTypes:a,preventDefault:i,stopPropagation:p,exact:g,onMove:C,onEnd:b,onStart:m,initialValue:h,axis:l="both",draggingElement:f=D,containerElement:c,handle:v=n}=s,d=e.ref((r=w(h))!=null?r:{x:0,y:0}),k=e.ref(),E=u=>a?a.includes(u.pointerType):!0,x=u=>{w(i)&&u.preventDefault(),w(p)&&u.stopPropagation()},V=u=>{var M;if(!E(u)||w(g)&&u.target!==w(n))return;const _=w(c),B=(M=_==null?void 0:_.getBoundingClientRect)==null?void 0:M.call(_),o=w(n).getBoundingClientRect(),y={x:u.clientX-(_?o.left-B.left:o.left),y:u.clientY-(_?o.top-B.top:o.top)};(m==null?void 0:m(y,u))!==!1&&(k.value=y,x(u))},$=u=>{var M;if(!E(u)||!k.value)return;const _=w(c),B=(M=_==null?void 0:_.getBoundingClientRect)==null?void 0:M.call(_),o=w(n).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-o.width))),(l==="y"||l==="both")&&(S=u.clientY-k.value.y,_&&(S=Math.min(Math.max(0,S),B.height-o.height))),d.value={x:y,y:S},C==null||C(d.value,u),x(u)},A=u=>{E(u)&&k.value&&(k.value=void 0,b==null||b(d.value,u),x(u))};if(z){const u={capture:(t=s.capture)!=null?t:!0};P(v,"pointerdown",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-c90d0279"),n=n(),e.popScopeId(),n),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:{},backgroundColor:{}},emits:["submit"],setup(n,{expose:s,emit:r}){const t=n,a=r,i=e.inject(N),p=e.ref(!1);let g=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 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(${l.value-g}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 y;const o={};return t.maxHeight&&(o.maxHeight=`calc(${(y=v(t.maxHeight))==null?void 0:y.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"),o});function V(){const o=m.value;if(t.form&&o){const y=o.querySelector(`form[name="${t.form}"]`);y&&y.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&&(g=m.value.offsetLeft,C=m.value.offsetTop)})}function u(){if(t.closeable&&t.esc){const o=({key:y})=>{y==="Escape"&&(i==null||i.close(t.id),window.removeEventListener("keydown",o))};window.addEventListener("keydown",o)}}function M(){g=m.value.offsetLeft,C=m.value.offsetTop}e.onMounted(()=>{u(),A()}),e.onUnmounted(()=>{});function _(){return p.value=!0,()=>B()}function B(){p.value=!1}return s({showLoading:_,hideLoading:B}),(o,y)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"wrapperRef",ref:b,class:"modal-wrapper",style:e.normalizeStyle(d.value),onClick:y[0]||(y[0]=e.withModifiers(S=>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:M},[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:$}," 取消 "),e.createElementVNode("button",{class:"submit-button",form:o.form,type:"submit",onClick:V}," 确定 ",8,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},T=R(oe,[["__scopeId","data-v-c90d0279"]]),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,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(n,{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((E,x)=>{r.value.push({id:d,component:v,props:f||{},options:{...c,type:typeof l=="string"?l:"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(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||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 v=c.listeners.find(d=>d.event===f);v&&v.callback({open:i,close:d=>p(c.id,d),closeAll:g,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 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,close:p,closeAll:g}),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-85b1d29d"]]);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=T;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 F(n){return e.getCurrentScope()?(e.onScopeDispose(n),!0):!1}function w(n){return typeof n=="function"?n():e.unref(n)}const z=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const 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 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 G(n){var s;const r=w(n);return(s=r==null?void 0:r.$el)!=null?s:r}const D=z?window:void 0;function P(...n){let s,r,t,a;if(typeof n[0]=="string"||Array.isArray(n[0])?([r,t,a]=n,s=D):[s,r,t,a]=n,!s)return H;Array.isArray(r)||(r=[r]),Array.isArray(t)||(t=[t]);const i=[],p=()=>{i.forEach(m=>m()),i.length=0},y=(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=>y(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:y,onMove:C,onEnd:b,onStart:m,initialValue:h,axis:l="both",draggingElement:f=D,containerElement:c,handle:v=n}=s,d=e.ref((r=w(h))!=null?r:{x:0,y:0}),k=e.ref(),E=u=>a?a.includes(u.pointerType):!0,x=u=>{w(i)&&u.preventDefault(),w(p)&&u.stopPropagation()},V=u=>{var M;if(!E(u)||w(y)&&u.target!==w(n))return;const _=w(c),B=(M=_==null?void 0:_.getBoundingClientRect)==null?void 0:M.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))},$=u=>{var M;if(!E(u)||!k.value)return;const _=w(c),B=(M=_==null?void 0:_.getBoundingClientRect)==null?void 0:M.call(_),o=w(n).getBoundingClientRect();let{x:g,y:S}=d.value;(l==="x"||l==="both")&&(g=u.clientX-k.value.x,_&&(g=Math.min(Math.max(0,g),B.width-o.width))),(l==="y"||l==="both")&&(S=u.clientY-k.value.y,_&&(S=Math.min(Math.max(0,S),B.height-o.height))),d.value={x:g,y:S},C==null||C(d.value,u),x(u)},A=u=>{E(u)&&k.value&&(k.value=void 0,b==null||b(d.value,u),x(u))};if(z){const u={capture:(t=s.capture)!=null?t:!0};P(v,"pointerdown",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-0982fb60"),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:{}},emits:["submit"],setup(n,{expose:s,emit:r}){const t=n,a=r,i=e.inject(N),p=e.ref(!1);let y=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 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(${l.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 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&&(y=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 M(){y=m.value.offsetLeft,C=m.value.offsetTop}e.onMounted(()=>{u(),A()}),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(S=>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:M},[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:$}," 取消 "),e.createElementVNode("button",{class:"submit-button",form:o.form,type:"submit",onClick:V}," 确定 ",8,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},O=R(oe,[["__scopeId","data-v-0982fb60"]]),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=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,y)=>(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(n,{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((E,x)=>{r.value.push({id:d,component:v,props:f||{},options:{...c,type:typeof l=="string"?l:"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(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 y(){!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 v=c.listeners.find(d=>d.event===f);v&&v.callback({open:i,close:d=>p(c.id,d),closeAll:y,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 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:y,addEventListener:h}),s({elements:r,open:i,close:p,closeAll:y}),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,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-85b1d29d"]]);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 T(){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=O;exports.ModalKey=N;exports.ModalProvider=fe;exports.onSubmit=pe;exports.useModal=T;
@@ -1,4 +1,4 @@
1
- import type { Component } from 'vue';
1
+ import type { CSSProperties, Component } from 'vue';
2
2
  import type { useModal } from './hooks/use-modal';
3
3
  export interface SizeOptions {
4
4
  small: number;
@@ -20,6 +20,7 @@ export interface OpenModalOptions {
20
20
  form?: string;
21
21
  mode?: 'dialog' | 'drawer';
22
22
  backgroundColor?: string;
23
+ bodyStyle?: CSSProperties;
23
24
  }
24
25
  export interface ModalElement extends OpenModalOptions {
25
26
  id: string;
@@ -1,4 +1,4 @@
1
- import type { Component } from 'vue';
1
+ import type { CSSProperties, Component } from 'vue';
2
2
  import type { SizeOptions } from '../interfaces';
3
3
  declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
4
4
  id: string;
@@ -25,6 +25,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
25
25
  y?: number | undefined;
26
26
  } | undefined;
27
27
  backgroundColor?: string | undefined;
28
+ bodyStyle?: CSSProperties | undefined;
28
29
  }>, {
29
30
  header: boolean;
30
31
  closeable: boolean;
@@ -65,6 +66,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
65
66
  y?: number | undefined;
66
67
  } | undefined;
67
68
  backgroundColor?: string | undefined;
69
+ bodyStyle?: CSSProperties | undefined;
68
70
  }>, {
69
71
  header: boolean;
70
72
  closeable: boolean;
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 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 k, 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 G, 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";
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 T, createCommentVNode as P, 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
2
  const F = Symbol("__MODAL__");
3
- function ke(o) {
3
+ function xe(o) {
4
4
  return ie() ? (re(o), !0) : !1;
5
5
  }
6
- function C(o) {
6
+ function b(o) {
7
7
  return typeof o == "function" ? o() : ee(o);
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 = (o) => xe.call(o) === "[object Object]", Ee = () => {
11
+ const ke = Object.prototype.toString, Me = (o) => ke.call(o) === "[object Object]", Ee = () => {
12
12
  };
13
- function Le(o, s = {}) {
13
+ function Se(o, s = {}) {
14
14
  if (!te(o))
15
15
  return oe(o);
16
16
  const n = Array.isArray(o.value) ? Array.from({ length: o.value.length }) : {};
@@ -21,7 +21,7 @@ function Le(o, s = {}) {
21
21
  },
22
22
  set(l) {
23
23
  var i;
24
- if ((i = C(s.replaceRef)) != null ? i : !0)
24
+ if ((i = b(s.replaceRef)) != null ? i : !0)
25
25
  if (Array.isArray(o.value)) {
26
26
  const v = [...o.value];
27
27
  v[e] = l, o.value = v;
@@ -35,9 +35,9 @@ function Le(o, s = {}) {
35
35
  }));
36
36
  return n;
37
37
  }
38
- function Se(o) {
38
+ function Le(o) {
39
39
  var s;
40
- const n = C(o);
40
+ const n = b(o);
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 j(...o) {
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)), x = se(
52
- () => [Se(s), C(l)],
51
+ }, v = (p, _, r, u) => (p.addEventListener(_, r, u), () => p.removeEventListener(_, r, u)), k = se(
52
+ () => [Le(s), b(l)],
53
53
  ([p, _]) => {
54
54
  if (f(), !p)
55
55
  return;
@@ -60,9 +60,9 @@ function j(...o) {
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(o, s = {}) {
68
68
  var n, e;
@@ -71,7 +71,7 @@ function $e(o, s = {}) {
71
71
  preventDefault: i,
72
72
  stopPropagation: f,
73
73
  exact: v,
74
- onMove: x,
74
+ onMove: k,
75
75
  onEnd: M,
76
76
  onStart: p,
77
77
  initialValue: _,
@@ -80,55 +80,55 @@ function $e(o, s = {}) {
80
80
  containerElement: a,
81
81
  handle: m = o
82
82
  } = s, d = D(
83
- (n = C(_)) != null ? n : { x: 0, y: 0 }
84
- ), b = D(), E = (c) => l ? l.includes(c.pointerType) : !0, S = (c) => {
85
- C(i) && c.preventDefault(), C(f) && c.stopPropagation();
83
+ (n = b(_)) != null ? n : { x: 0, y: 0 }
84
+ ), C = D(), E = (c) => l ? l.includes(c.pointerType) : !0, L = (c) => {
85
+ b(i) && c.preventDefault(), b(f) && c.stopPropagation();
86
86
  }, H = (c) => {
87
87
  var $;
88
- if (!E(c) || C(v) && c.target !== C(o))
88
+ if (!E(c) || b(v) && c.target !== b(o))
89
89
  return;
90
- const w = C(a), L = ($ = w == null ? void 0 : w.getBoundingClientRect) == null ? void 0 : $.call(w), t = C(o).getBoundingClientRect(), h = {
91
- x: c.clientX - (w ? t.left - L.left : t.left),
92
- y: c.clientY - (w ? t.top - L.top : t.top)
90
+ const w = b(a), S = ($ = w == null ? void 0 : w.getBoundingClientRect) == null ? void 0 : $.call(w), t = b(o).getBoundingClientRect(), y = {
91
+ x: c.clientX - (w ? t.left - S.left : t.left),
92
+ y: c.clientY - (w ? t.top - S.top : t.top)
93
93
  };
94
- (p == null ? void 0 : p(h, c)) !== !1 && (b.value = h, S(c));
94
+ (p == null ? void 0 : p(y, c)) !== !1 && (C.value = y, L(c));
95
95
  }, I = (c) => {
96
96
  var $;
97
- if (!E(c) || !b.value)
97
+ if (!E(c) || !C.value)
98
98
  return;
99
- const w = C(a), L = ($ = w == null ? void 0 : w.getBoundingClientRect) == null ? void 0 : $.call(w), t = C(o).getBoundingClientRect();
100
- let { x: h, y: B } = d.value;
101
- (r === "x" || r === "both") && (h = c.clientX - b.value.x, w && (h = Math.min(Math.max(0, h), L.width - t.width))), (r === "y" || r === "both") && (B = c.clientY - b.value.y, w && (B = Math.min(Math.max(0, B), L.height - t.height))), d.value = {
102
- x: h,
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,
103
103
  y: B
104
- }, x == null || x(d.value, c), S(c);
104
+ }, k == null || k(d.value, c), L(c);
105
105
  }, V = (c) => {
106
- E(c) && b.value && (b.value = void 0, M == null || M(d.value, c), S(c));
106
+ E(c) && C.value && (C.value = void 0, M == null || M(d.value, c), L(c));
107
107
  };
108
108
  if (Q) {
109
109
  const c = { capture: (e = s.capture) != null ? e : !0 };
110
110
  j(m, "pointerdown", H, c), j(u, "pointermove", I, c), j(u, "pointerup", V, c);
111
111
  }
112
112
  return {
113
- ...Le(d),
113
+ ...Se(d),
114
114
  position: d,
115
- isDragging: A(() => !!b.value),
115
+ isDragging: A(() => !!C.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 = (o) => (fe("data-v-c90d0279"), o = o(), pe(), o), Pe = { class: "title font-bold" }, Be = { class: "action" }, Te = {
121
+ const Ae = (o) => (fe("data-v-0982fb60"), o = o(), pe(), o), Pe = { class: "title text-16px font-bold" }, Be = { class: "action" }, Oe = {
122
122
  key: 1,
123
123
  class: "modal-footer space-x-2"
124
- }, ze = ["form"], Oe = {
124
+ }, Te = ["form"], ze = {
125
125
  key: 2,
126
126
  class: "modal-loading"
127
- }, Re = /* @__PURE__ */ Ae(() => /* @__PURE__ */ y("div", { class: "lds-ring" }, [
128
- /* @__PURE__ */ y("div"),
129
- /* @__PURE__ */ y("div"),
130
- /* @__PURE__ */ y("div"),
131
- /* @__PURE__ */ y("div")
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
132
  ], -1)), Ne = [
133
133
  Re
134
134
  ], De = {
@@ -157,12 +157,13 @@ const Ae = (o) => (fe("data-v-c90d0279"), o = o(), pe(), o), Pe = { class: "titl
157
157
  mode: { default: "dialog" },
158
158
  type: {},
159
159
  offset: {},
160
- backgroundColor: {}
160
+ backgroundColor: {},
161
+ bodyStyle: {}
161
162
  },
162
163
  emits: ["submit"],
163
164
  setup(o, { expose: s, emit: n }) {
164
165
  const e = o, l = n, i = Y(F), f = D(!1);
165
- let v = 0, x = 0;
166
+ let v = 0, k = 0;
166
167
  const M = R(), p = R(), _ = R(), { x: r, y: u } = $e(_, {
167
168
  initialValue: { x: 0, y: 0 }
168
169
  });
@@ -178,22 +179,22 @@ const Ae = (o) => (fe("data-v-c90d0279"), o = o(), pe(), o), Pe = { class: "titl
178
179
  const d = A(() => {
179
180
  const t = {};
180
181
  return e.mode === "dialog" && (t.justifyContent = "center"), e.mode === "drawer" && (t.justifyContent = "flex-end"), t;
181
- }), b = A(() => {
182
+ }), C = A(() => {
182
183
  const t = {};
183
- return e.size && (t.width = m(e.sizes[e.size])), e.width && (t.width = m(e.width)), e.maxWidth && (t.maxWidth = m(e.maxWidth)), e.fullscreen && (t.maxWidth = "unset", t.width = "100%", t.position = "fixed", t.top = 0, t.left = 0, t.bottom = 0, t.right = 0, t.borderRadius = 0), e.draggable && !e.fullscreen && e.mode === "dialog" && (t.transform = `translate3d(${r.value - v}px, ${u.value - x}px, 0px)`), e.mode === "drawer" && (t.borderRadius = 0, t.height = "100%"), e.offset && e.mode === "dialog" && (t.marginLeft = `${e.offset.x || 0}px`, t.marginTop = `${e.offset.y || 0}px`), e.backgroundColor && (t.backgroundColor = e.backgroundColor), t;
184
+ return e.size && (t.width = m(e.sizes[e.size])), e.width && (t.width = m(e.width)), e.maxWidth && (t.maxWidth = m(e.maxWidth)), e.fullscreen && (t.maxWidth = "unset", t.width = "100%", t.position = "fixed", t.top = 0, t.left = 0, t.bottom = 0, t.right = 0, t.borderRadius = 0), e.draggable && !e.fullscreen && e.mode === "dialog" && (t.transform = `translate3d(${r.value - v}px, ${u.value - k}px, 0px)`), e.mode === "drawer" && (t.borderRadius = 0, t.height = "100%"), e.offset && e.mode === "dialog" && (t.marginLeft = `${e.offset.x || 0}px`, t.marginTop = `${e.offset.y || 0}px`), e.backgroundColor && (t.backgroundColor = e.backgroundColor), t;
184
185
  }), E = A(() => {
185
186
  const t = {};
186
187
  return e.draggable && !e.fullscreen && e.mode === "dialog" && (t.cursor = "move"), t;
187
- }), S = A(() => {
188
- var h;
188
+ }), L = A(() => {
189
+ var y;
189
190
  const t = {};
190
- 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"), t;
191
+ 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;
191
192
  });
192
193
  function H() {
193
194
  const t = p.value;
194
195
  if (e.form && t) {
195
- const h = t.querySelector(`form[name="${e.form}"]`);
196
- h && h.dispatchEvent(new Event("submit"));
196
+ const y = t.querySelector(`form[name="${e.form}"]`);
197
+ y && y.dispatchEvent(new Event("submit"));
197
198
  }
198
199
  l("submit");
199
200
  }
@@ -202,83 +203,83 @@ const Ae = (o) => (fe("data-v-c90d0279"), o = o(), pe(), o), Pe = { class: "titl
202
203
  }
203
204
  function V() {
204
205
  window && window.addEventListener("resize", () => {
205
- O(M), O(p), p.value && (v = p.value.offsetLeft, x = p.value.offsetTop);
206
+ z(M), z(p), p.value && (v = p.value.offsetLeft, k = p.value.offsetTop);
206
207
  });
207
208
  }
208
209
  function c() {
209
210
  if (e.closeable && e.esc) {
210
- const t = ({ key: h }) => {
211
- h === "Escape" && (i == null || i.close(e.id), window.removeEventListener("keydown", t));
211
+ const t = ({ key: y }) => {
212
+ y === "Escape" && (i == null || i.close(e.id), window.removeEventListener("keydown", t));
212
213
  };
213
214
  window.addEventListener("keydown", t);
214
215
  }
215
216
  }
216
217
  function $() {
217
- v = p.value.offsetLeft, x = p.value.offsetTop;
218
+ v = p.value.offsetLeft, k = p.value.offsetTop;
218
219
  }
219
220
  U(() => {
220
221
  c(), V();
221
222
  }), le(() => {
222
223
  });
223
224
  function w() {
224
- return f.value = !0, () => L();
225
+ return f.value = !0, () => S();
225
226
  }
226
- function L() {
227
+ function S() {
227
228
  f.value = !1;
228
229
  }
229
230
  return s({
230
231
  showLoading: w,
231
- hideLoading: L
232
- }), (t, h) => (g(), k("div", {
232
+ hideLoading: S
233
+ }), (t, y) => (g(), x("div", {
233
234
  ref_key: "wrapperRef",
234
235
  ref: M,
235
236
  class: "modal-wrapper",
236
- style: T(d.value),
237
- onClick: h[0] || (h[0] = ae((B) => t.maskClosable && a(), ["self"]))
237
+ style: O(d.value),
238
+ onClick: y[0] || (y[0] = ae((B) => t.maskClosable && a(), ["self"]))
238
239
  }, [
239
- y("div", {
240
+ h("div", {
240
241
  ref_key: "contentRef",
241
242
  ref: p,
242
243
  class: de(["modal-content", { [`${t.mode}-mode`]: !0 }]),
243
- style: T(b.value)
244
+ style: O(C.value)
244
245
  }, [
245
- t.header ? (g(), k("div", {
246
+ t.header ? (g(), x("div", {
246
247
  key: 0,
247
248
  ref_key: "headerRef",
248
249
  ref: _,
249
250
  class: "modal-header",
250
- style: T(E.value),
251
+ style: O(E.value),
251
252
  onMousedown: $
252
253
  }, [
253
- y("div", Pe, z(t.title), 1),
254
- y("div", Be, [
255
- t.closeable ? (g(), k("div", {
254
+ h("div", Pe, T(t.title), 1),
255
+ h("div", Be, [
256
+ t.closeable ? (g(), x("div", {
256
257
  key: 0,
257
258
  class: "i-icon-park-outline:close block cursor-pointer",
258
259
  onClick: a
259
260
  })) : P("", !0)
260
261
  ])
261
262
  ], 36)) : P("", !0),
262
- y("div", {
263
+ h("div", {
263
264
  class: "modal-body",
264
- style: T(S.value)
265
+ style: O(L.value)
265
266
  }, [
266
267
  (g(), W(J(t.component), ce(ue(t.componentProps)), null, 16))
267
268
  ], 4),
268
- t.footer ? (g(), k("div", Te, [
269
- y("button", {
269
+ t.footer ? (g(), x("div", Oe, [
270
+ h("button", {
270
271
  class: "cancel-button",
271
272
  type: "button",
272
273
  onClick: I
273
274
  }, " 取消 "),
274
- y("button", {
275
+ h("button", {
275
276
  class: "submit-button",
276
277
  form: t.form,
277
278
  type: "submit",
278
279
  onClick: H
279
- }, " 确定 ", 8, ze)
280
+ }, " 确定 ", 8, Te)
280
281
  ])) : P("", !0),
281
- f.value ? (g(), k("div", Oe, Ne)) : P("", !0)
282
+ f.value ? (g(), x("div", ze, Ne)) : P("", !0)
282
283
  ], 6)
283
284
  ], 4));
284
285
  }
@@ -288,7 +289,7 @@ const q = (o, s) => {
288
289
  for (const [e, l] of s)
289
290
  n[e] = l;
290
291
  return n;
291
- }, Fe = /* @__PURE__ */ q(We, [["__scopeId", "data-v-c90d0279"]]), He = { class: "modal-dialog" }, Ie = { class: "dialog-body" }, Ve = { class: "dialog-title" }, je = { class: "dialog-content" }, Ge = /* @__PURE__ */ X({
292
+ }, Fe = /* @__PURE__ */ q(We, [["__scopeId", "data-v-0982fb60"]]), He = { class: "modal-dialog" }, Ie = { class: "dialog-body" }, Ve = { class: "dialog-title" }, je = { class: "dialog-content" }, Ge = /* @__PURE__ */ X({
292
293
  __name: "modal-dialog",
293
294
  props: {
294
295
  type: {},
@@ -314,27 +315,27 @@ const q = (o, s) => {
314
315
  async function i() {
315
316
  s.onCancel && await s.onCancel(), n.close();
316
317
  }
317
- return (f, v) => (g(), k("section", He, [
318
- y("div", Ie, [
319
- y("div", Ve, z(e.value), 1),
320
- y("div", je, z(f.content), 1)
318
+ return (f, v) => (g(), x("section", He, [
319
+ h("div", Ie, [
320
+ h("div", Ve, T(e.value), 1),
321
+ h("div", je, T(f.content), 1)
321
322
  ]),
322
- y("div", {
323
+ h("div", {
323
324
  class: "dialog-footer space-x-2",
324
- style: T(f.type === "confirm" ? { "justify-content": "end" } : { "border-top": "none" })
325
+ style: O(f.type === "confirm" ? { "justify-content": "end" } : { "border-top": "none" })
325
326
  }, [
326
- f.footer ? (g(), W(J(f.footer), { key: 0 })) : (g(), k(G, { key: 1 }, [
327
- y("button", {
327
+ f.footer ? (g(), W(J(f.footer), { key: 0 })) : (g(), x(G, { key: 1 }, [
328
+ h("button", {
328
329
  class: "submit-button",
329
330
  type: "submit",
330
331
  onClick: l
331
- }, z(f.okText), 1),
332
- f.type === "confirm" ? (g(), k("button", {
332
+ }, T(f.okText), 1),
333
+ f.type === "confirm" ? (g(), x("button", {
333
334
  key: 0,
334
335
  class: "cancel-button",
335
336
  type: "button",
336
337
  onClick: i
337
- }, z(f.cancelText), 1)) : P("", !0)
338
+ }, T(f.cancelText), 1)) : P("", !0)
338
339
  ], 64))
339
340
  ], 4)
340
341
  ]));
@@ -362,11 +363,11 @@ const Xe = /* @__PURE__ */ q(Ge, [["__scopeId", "data-v-8326e5a5"]]), Ye = {
362
363
  setup(o, { expose: s }) {
363
364
  const n = R([]), e = D(!1), l = K();
364
365
  function i(r, u = {}, a = {}) {
365
- const m = be(
366
+ const m = Ce(
366
367
  () => Promise.resolve(typeof r == "string" ? Xe : r)
367
368
  );
368
369
  typeof r == "string" && (u.type = r, a.size = "small", a.fullscreen = !1, a.mode = "dialog", a.footer = !1, a.header = !1);
369
- const d = Math.random().toString(32).slice(2), b = new Promise((E, S) => {
370
+ const d = Math.random().toString(32).slice(2), C = new Promise((E, L) => {
370
371
  n.value.push({
371
372
  id: d,
372
373
  component: m,
@@ -376,12 +377,12 @@ const Xe = /* @__PURE__ */ q(Ge, [["__scopeId", "data-v-8326e5a5"]]), Ye = {
376
377
  type: typeof r == "string" ? r : "component"
377
378
  },
378
379
  resolve: E,
379
- reject: S,
380
+ reject: L,
380
381
  listeners: []
381
- }), O(n);
382
+ }), z(n);
382
383
  }).catch((E) => E === "CANCEL" ? new Promise(() => {
383
384
  }) : Promise.reject(E));
384
- return Object.assign(b, {
385
+ return Object.assign(C, {
385
386
  close: () => f(d)
386
387
  });
387
388
  }
@@ -390,14 +391,14 @@ const Xe = /* @__PURE__ */ q(Ge, [["__scopeId", "data-v-8326e5a5"]]), Ye = {
390
391
  if (a < 0)
391
392
  return;
392
393
  const m = n.value[a];
393
- u === void 0 ? m == null || m.reject("CANCEL") : m == null || m.resolve(u), n.value.splice(a, 1), O(n);
394
+ u === void 0 ? m == null || m.reject("CANCEL") : m == null || m.resolve(u), n.value.splice(a, 1), z(n);
394
395
  }
395
396
  function v() {
396
397
  !n.value || n.value.length === 0 || (n.value.forEach((r) => {
397
398
  r == null || r.reject("CANCEL");
398
- }), n.value = [], O(n));
399
+ }), n.value = [], z(n));
399
400
  }
400
- function x(r, u) {
401
+ function k(r, u) {
401
402
  const a = n.value.find((d) => d.id === r);
402
403
  if (!a)
403
404
  return;
@@ -448,16 +449,16 @@ const Xe = /* @__PURE__ */ q(Ge, [["__scopeId", "data-v-8326e5a5"]]), Ye = {
448
449
  closeAll: v
449
450
  }), U(() => {
450
451
  e.value = !0;
451
- }), (r, u) => (g(), k(G, null, [
452
+ }), (r, u) => (g(), x(G, null, [
452
453
  ve(r.$slots, "default", {}, void 0, !0),
453
- e.value ? (g(), k("div", Ye, [
454
- (g(), W(he, {
454
+ e.value ? (g(), x("div", Ye, [
455
+ (g(), W(ye, {
455
456
  disabled: !r.appendToBody,
456
457
  to: typeof r.appendToBody == "string" ? r.appendToBody : "body"
457
458
  }, [
458
- ye(ge, { name: "modal-fade" }, {
459
+ he(ge, { name: "modal-fade" }, {
459
460
  default: _e(() => [
460
- (g(!0), k(G, null, we(n.value, (a) => (g(), W(Fe, Ce({
461
+ (g(!0), x(G, null, we(n.value, (a) => (g(), W(Fe, be({
461
462
  id: a.id,
462
463
  key: a.id,
463
464
  ref_for: !0,
@@ -469,7 +470,7 @@ const Xe = /* @__PURE__ */ q(Ge, [["__scopeId", "data-v-8326e5a5"]]), Ye = {
469
470
  offset: r.offset,
470
471
  sizes: r.sizes
471
472
  }, a.options, {
472
- onSubmit: () => x(a.id, "submit")
473
+ onSubmit: () => k(a.id, "submit")
473
474
  }), null, 16, ["id", "component", "component-props", "max-height", "max-width", "offset", "sizes", "onSubmit"]))), 128))
474
475
  ]),
475
476
  _: 1
@@ -1,4 +1,4 @@
1
- import type { Component } from 'vue';
1
+ import type { CSSProperties, Component } from 'vue';
2
2
  import type { useModal } from './hooks/use-modal';
3
3
  export interface SizeOptions {
4
4
  small: number;
@@ -20,6 +20,7 @@ export interface OpenModalOptions {
20
20
  form?: string;
21
21
  mode?: 'dialog' | 'drawer';
22
22
  backgroundColor?: string;
23
+ bodyStyle?: CSSProperties;
23
24
  }
24
25
  export interface ModalElement extends OpenModalOptions {
25
26
  id: string;
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-c90d0279]{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-c90d0279]{background:#ffffff;border-radius:5px;position:relative}.modal-header[data-v-c90d0279]{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-c90d0279]{padding:20px 10px;box-sizing:border-box;max-height:10vw;overflow:auto}.modal-footer[data-v-c90d0279]{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-c90d0279]{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-c90d0279]{color:#fff;background-color:rgb(var(--primary-6, 45, 106, 251))}.modal-footer button.submit-button[data-v-c90d0279]:hover{background-color:rgb(var(--primary-5, 28, 76, 207))}.modal-footer button.cancel-button[data-v-c90d0279]{color:rgb(var(--color-text-2, 78, 89, 105));background-color:var(--color-fill-1, #f5f5f5)}.modal-footer button.cancel-button[data-v-c90d0279]:hover{background-color:var(--color-fill-4, #c9cdd4)}.modal-loading[data-v-c90d0279]{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-c90d0279]{display:inline-block;position:relative;width:80px;height:80px}.modal-loading .lds-ring div[data-v-c90d0279]{box-sizing:border-box;display:block;position:absolute;width:48px;height:48px;margin:8px;border:5px solid #fff;border-radius:50%;animation:lds-ring-c90d0279 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:#fff transparent transparent transparent}.modal-loading .lds-ring div[data-v-c90d0279]:nth-child(1){animation-delay:-.45s}.modal-loading .lds-ring div[data-v-c90d0279]:nth-child(2){animation-delay:-.3s}.modal-loading .lds-ring div[data-v-c90d0279]:nth-child(3){animation-delay:-.15s}@keyframes lds-ring-c90d0279{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-85b1d29d],.modal-fade-leave-active[data-v-85b1d29d]{transition:opacity .5s ease}.modal-fade-enter-active[data-v-85b1d29d] .modal-content.drawer-mode,.modal-fade-leave-active[data-v-85b1d29d] .modal-content.drawer-mode{transition:transform .5s ease}.modal-fade-enter-from[data-v-85b1d29d],.modal-fade-leave-to[data-v-85b1d29d]{opacity:0}.modal-fade-enter-from[data-v-85b1d29d] .modal-content.drawer-mode,.modal-fade-leave-to[data-v-85b1d29d] .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-0982fb60]{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-0982fb60]{background:#ffffff;border-radius:5px;position:relative}.modal-header[data-v-0982fb60]{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-0982fb60]{padding:10px;box-sizing:border-box;max-height:10vw;overflow:auto}.modal-footer[data-v-0982fb60]{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-0982fb60]{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-0982fb60]{color:#fff;background-color:rgb(var(--primary-6, 45, 106, 251))}.modal-footer button.submit-button[data-v-0982fb60]:hover{background-color:rgb(var(--primary-5, 28, 76, 207))}.modal-footer button.cancel-button[data-v-0982fb60]{color:rgb(var(--color-text-2, 78, 89, 105));background-color:var(--color-fill-1, #f5f5f5)}.modal-footer button.cancel-button[data-v-0982fb60]:hover{background-color:var(--color-fill-4, #c9cdd4)}.modal-loading[data-v-0982fb60]{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-0982fb60]{display:inline-block;position:relative;width:80px;height:80px}.modal-loading .lds-ring div[data-v-0982fb60]{box-sizing:border-box;display:block;position:absolute;width:48px;height:48px;margin:8px;border:5px solid #fff;border-radius:50%;animation:lds-ring-0982fb60 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:#fff transparent transparent transparent}.modal-loading .lds-ring div[data-v-0982fb60]:nth-child(1){animation-delay:-.45s}.modal-loading .lds-ring div[data-v-0982fb60]:nth-child(2){animation-delay:-.3s}.modal-loading .lds-ring div[data-v-0982fb60]:nth-child(3){animation-delay:-.15s}@keyframes lds-ring-0982fb60{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-85b1d29d],.modal-fade-leave-active[data-v-85b1d29d]{transition:opacity .5s ease}.modal-fade-enter-active[data-v-85b1d29d] .modal-content.drawer-mode,.modal-fade-leave-active[data-v-85b1d29d] .modal-content.drawer-mode{transition:transform .5s ease}.modal-fade-enter-from[data-v-85b1d29d],.modal-fade-leave-to[data-v-85b1d29d]{opacity:0}.modal-fade-enter-from[data-v-85b1d29d] .modal-content.drawer-mode,.modal-fade-leave-to[data-v-85b1d29d] .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.17",
4
+ "version": "0.0.19",
5
5
  "author": {
6
6
  "name": "zhuchentong",
7
7
  "email": "2037630@gmail.com"