@gopowerteam/modal-render 0.0.43 → 0.0.45

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.
@@ -32,6 +32,10 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
32
32
  submitText?: string | undefined;
33
33
  cancelText?: string | undefined;
34
34
  zIndex?: number | undefined;
35
+ onOk?: ((options: {
36
+ close: () => void;
37
+ }) => void) | undefined;
38
+ onCancel?: (() => void) | undefined;
35
39
  }>, {
36
40
  header: boolean;
37
41
  closeable: boolean;
@@ -83,6 +87,10 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
83
87
  submitText?: string | undefined;
84
88
  cancelText?: string | undefined;
85
89
  zIndex?: number | undefined;
90
+ onOk?: ((options: {
91
+ close: () => void;
92
+ }) => void) | undefined;
93
+ onCancel?: (() => void) | undefined;
86
94
  }>, {
87
95
  header: boolean;
88
96
  closeable: boolean;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),L=Symbol("__MODAL__");function W(o){return e.getCurrentScope()?(e.onScopeDispose(o),!0):!1}function b(o){return typeof o=="function"?o():e.unref(o)}const F=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const J=Object.prototype.toString,Q=o=>J.call(o)==="[object Object]",Z=()=>{};function ee(o){return e.getCurrentInstance()}function te(o,l={}){if(!e.isRef(o))return e.toRefs(o);const n=Array.isArray(o.value)?Array.from({length:o.value.length}):{};for(const t in o.value)n[t]=e.customRef(()=>({get(){return o.value[t]},set(a){var s;if((s=b(l.replaceRef))!=null?s:!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 n}function oe(o,l=!0,n){ee()?e.onMounted(o,n):l?o():e.nextTick(o)}function N(o){var l;const n=b(o);return(l=n==null?void 0:n.$el)!=null?l:n}const O=F?window:void 0;function P(...o){let l,n,t,a;if(typeof o[0]=="string"||Array.isArray(o[0])?([n,t,a]=o,l=O):[l,n,t,a]=o,!l)return Z;Array.isArray(n)||(n=[n]),Array.isArray(t)||(t=[t]);const s=[],u=()=>{s.forEach(v=>v()),s.length=0},h=(v,f,i,d)=>(v.addEventListener(f,i,d),()=>v.removeEventListener(f,i,d)),w=e.watch(()=>[N(l),b(a)],([v,f])=>{if(u(),!v)return;const i=Q(f)?{...f}:f;s.push(...n.flatMap(d=>t.map(c=>h(v,d,c,i))))},{immediate:!0,flush:"post"}),y=()=>{w(),u()};return W(y),y}function ne(){const o=e.ref(!1),l=e.getCurrentInstance();return l&&e.onMounted(()=>{o.value=!0},l),o}function re(o){const l=ne();return e.computed(()=>(l.value,!!o()))}function le(o,l={}){var n,t;const{pointerTypes:a,preventDefault:s,stopPropagation:u,exact:h,onMove:w,onEnd:y,onStart:v,initialValue:f,axis:i="both",draggingElement:d=O,containerElement:c,handle:g=o}=l,p=e.ref((n=b(f))!=null?n:{x:0,y:0}),k=e.ref(),M=m=>a?a.includes(m.pointerType):!0,x=m=>{b(s)&&m.preventDefault(),b(u)&&m.stopPropagation()},$=m=>{var S;if(b(l.disabled)||!M(m)||b(h)&&m.target!==b(o))return;const _=b(c),B=(S=_==null?void 0:_.getBoundingClientRect)==null?void 0:S.call(_),C=b(o).getBoundingClientRect(),T={x:m.clientX-(_?C.left-B.left+_.scrollLeft:C.left),y:m.clientY-(_?C.top-B.top+_.scrollTop:C.top)};(v==null?void 0:v(T,m))!==!1&&(k.value=T,x(m))},H=m=>{if(b(l.disabled)||!M(m)||!k.value)return;const S=b(c),_=b(o).getBoundingClientRect();let{x:B,y:C}=p.value;(i==="x"||i==="both")&&(B=m.clientX-k.value.x,S&&(B=Math.min(Math.max(0,B),S.scrollWidth-_.width))),(i==="y"||i==="both")&&(C=m.clientY-k.value.y,S&&(C=Math.min(Math.max(0,C),S.scrollHeight-_.height))),p.value={x:B,y:C},w==null||w(p.value,m),x(m)},A=m=>{b(l.disabled)||!M(m)||k.value&&(k.value=void 0,y==null||y(p.value,m),x(m))};if(F){const m={capture:(t=l.capture)!=null?t:!0};P(g,"pointerdown",$,m),P(d,"pointermove",H,m),P(d,"pointerup",A,m)}return{...te(p),position:p,isDragging:e.computed(()=>!!k.value),style:e.computed(()=>`left:${p.value.x}px;top:${p.value.y}px;`)}}function ie(o,l,n={}){const{window:t=O,...a}=n;let s;const u=re(()=>t&&"ResizeObserver"in t),h=()=>{s&&(s.disconnect(),s=void 0)},w=e.computed(()=>Array.isArray(o)?o.map(f=>N(f)):[N(o)]),y=e.watch(w,f=>{if(h(),u.value&&t){s=new ResizeObserver(l);for(const i of f)i&&s.observe(i,a)}},{immediate:!0,flush:"post"}),v=()=>{h(),y()};return W(v),{isSupported:u,stop:v}}function R(o,l={width:0,height:0},n={}){const{window:t=O,box:a="content-box"}=n,s=e.computed(()=>{var f,i;return(i=(f=N(o))==null?void 0:f.namespaceURI)==null?void 0:i.includes("svg")}),u=e.ref(l.width),h=e.ref(l.height),{stop:w}=ie(o,([f])=>{const i=a==="border-box"?f.borderBoxSize:a==="content-box"?f.contentBoxSize:f.devicePixelContentBoxSize;if(t&&s.value){const d=N(o);if(d){const c=t.getComputedStyle(d);u.value=Number.parseFloat(c.width),h.value=Number.parseFloat(c.height)}}else if(i){const d=Array.isArray(i)?i:[i];u.value=d.reduce((c,{inlineSize:g})=>c+g,0),h.value=d.reduce((c,{blockSize:g})=>c+g,0)}else u.value=f.contentRect.width,h.value=f.contentRect.height},n);oe(()=>{const f=N(o);f&&(u.value="offsetWidth"in f?f.offsetWidth:l.width,h.value="offsetHeight"in f?f.offsetHeight:l.height)});const y=e.watch(()=>N(o),f=>{u.value=f?l.width:0,h.value=f?l.height:0});function v(){w(),y()}return{width:u,height:h,stop:v}}const se=o=>(e.pushScopeId("data-v-9a7af353"),o=o(),e.popScopeId(),o),ae={class:"title text-16px font-bold"},ce={class:"action"},de=["form"],ue={key:2,class:"modal-loading"},fe=se(()=>e.createElementVNode("div",{class:"lds-ring"},[e.createElementVNode("div"),e.createElementVNode("div"),e.createElementVNode("div"),e.createElementVNode("div")],-1)),pe=[fe],me={name:"ModalContainer",inheritAttrs:!0},he=e.defineComponent({...me,props:{id:{},form:{},component:{},componentProps:{},width:{},height:{},maxWidth:{},maxHeight:{default:90},sizes:{},size:{default:"middle"},fullscreen:{type:Boolean},title:{},header:{type:Boolean,default:!0},footer:{type:Boolean,default:!1},closeable:{type:Boolean,default:!0},esc:{type:Boolean,default:!1},maskClosable:{type:Boolean,default:!1},draggable:{type:Boolean,default:!1},mode:{default:"dialog"},position:{default:"right"},type:{},offset:{},backgroundColor:{},bodyStyle:{},submitText:{default:"确定"},cancelText:{default:"取消"},zIndex:{default:1e3}},emits:["submit"],setup(o,{expose:l,emit:n}){e.useCssVars(r=>({"5751bf6b":r.zIndex}));const t=o,a=n,s=e.inject(L),u=e.ref(!1);let h=0,w=0;const y=e.shallowRef(),v=e.shallowRef(),f=e.shallowRef(),i=e.shallowRef(),d=e.shallowRef(),c=e.shallowRef(),{height:g}=R(y),{height:p}=R(f,void 0,{box:"border-box"}),{height:k}=R(i,void 0,{box:"border-box"}),{height:M}=R(d),{height:x}=R(c),{x:$,y:H}=le(f,{initialValue:{x:0,y:0}});function A(){s==null||s.close(t.id)}function m(r){return typeof r=="number"?`${r}px`:r}const S=e.computed(()=>{const r={};return t.mode==="dialog"&&(r.justifyContent="center"),t.mode==="drawer"&&(r.justifyContent={left:"flex-start",right:"flex-end",top:"flex-start",bottom:"flex-end"}[t.position],r.flexDirection={left:"row",right:"row",top:"column",bottom:"column"}[t.position]),r}),_=e.computed(()=>{const r={};return t.mode==="drawer"&&["top","bottom"].includes(t.position)?r.maxHeight=m(t.maxHeight):(r.width=m(t.sizes[t.size]),r.maxWidth=m(t.maxWidth)),t.width&&(r.width=m(t.width)),t.height&&(r.height=m(t.height)),t.fullscreen&&(r.maxWidth="unset",r.width="100%",r.position="fixed",r.top=0,r.left=0,r.bottom=0,r.right=0,r.borderRadius=0),t.draggable&&!t.fullscreen&&t.mode==="dialog"&&(r.transform=`translate3d(${$.value-h}px, ${H.value-w}px, 0px)`),t.mode==="drawer"&&(r.borderRadius=0,["left","right"].includes(t.position)?r.height="100%":r.width="100%"),t.offset&&t.mode==="dialog"&&(r.marginLeft=`${t.offset.x||0}px`,r.marginTop=`${t.offset.y||0}px`),t.backgroundColor&&(r.backgroundColor=t.backgroundColor),r}),B=e.computed(()=>{const r={};return t.draggable&&!t.fullscreen&&t.mode==="dialog"&&(r.cursor="move"),r}),C=e.computed(()=>{const r={},E=M.value+x.value+p.value+k.value,D=Math.floor(g.value*(Number(m(t.maxHeight).replace("%",""))/100));return t.maxHeight&&(r.maxHeight=`${D-E}px`),t.mode==="drawer"&&(r.maxHeight="unset",["left","right"].includes(t.position)&&(r.height=`${g.value-E}px`)),t.fullscreen&&(r.maxHeight="unset",r.height=`calc(100% - ${E}px)`),t.type!=="component"&&(r.padding="0"),t.bodyStyle&&Object.assign(r,t.bodyStyle),r});function T(){const r=v.value;if(t.form&&r){const E=r.querySelector(`form[name="${t.form}"]`);E&&E.dispatchEvent(new Event("submit"))}a("submit")}function K(){s==null||s.close(t.id)}function X(){window&&window.addEventListener("resize",()=>{e.triggerRef(y),e.triggerRef(v),v.value&&(h=v.value.offsetLeft,w=v.value.offsetTop)})}function Y(){if(t.closeable&&t.esc){const r=({key:E})=>{E==="Escape"&&(s==null||s.close(t.id),window.removeEventListener("keydown",r))};window.addEventListener("keydown",r)}}function q(){h=v.value.offsetLeft,w=v.value.offsetTop}e.onMounted(()=>{Y(),X()}),e.onUnmounted(()=>{});function U(){return u.value=!0,()=>I()}function I(){u.value=!1}return l({showLoading:U,hideLoading:I}),(r,E)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"wrapperRef",ref:y,class:"modal-wrapper",style:e.normalizeStyle(S.value),onClick:E[0]||(E[0]=e.withModifiers(D=>r.maskClosable&&A(),["self"]))},[e.createElementVNode("div",{ref_key:"contentRef",ref:v,class:e.normalizeClass(["modal-content",{[`${r.mode}-mode`]:!0,[`${r.position}-position`]:!0}]),style:e.normalizeStyle(_.value)},[r.header?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"headerRef",ref:f,class:"modal-header",style:e.normalizeStyle(B.value),onMousedown:q},[e.createElementVNode("div",ae,e.toDisplayString(r.title),1),e.createElementVNode("div",ce,[r.closeable?(e.openBlock(),e.createElementBlock("div",{key:0,class:"i-icon-park-outline:close block cursor-pointer",onClick:A})):e.createCommentVNode("",!0)])],36)):e.createCommentVNode("",!0),e.createElementVNode("div",{id:"modal-header-slot",ref_key:"headerSlotRef",ref:d},null,512),e.createElementVNode("div",{class:"modal-body",style:e.normalizeStyle(C.value)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.component),e.normalizeProps(e.guardReactiveProps(r.componentProps)),null,16))],4),e.createElementVNode("div",{id:"modal-footer-slot",ref_key:"footerSlotRef",ref:c},null,512),r.footer?(e.openBlock(),e.createElementBlock("div",{key:1,ref_key:"footerRef",ref:i,class:"modal-footer space-x-2"},[e.createElementVNode("button",{class:"cancel-button",type:"button",onClick:K},e.toDisplayString(r.cancelText),1),e.createElementVNode("button",{class:"submit-button",form:r.form,type:"submit",onClick:T},e.toDisplayString(r.submitText),9,de)],512)):e.createCommentVNode("",!0),u.value?(e.openBlock(),e.createElementBlock("div",ue,pe)):e.createCommentVNode("",!0)],6)],4))}}),V=(o,l)=>{const n=o.__vccOpts||o;for(const[t,a]of l)n[t]=a;return n},j=V(he,[["__scopeId","data-v-9a7af353"]]),ve={class:"modal-dialog"},ge={class:"dialog-body"},ye={class:"dialog-title"},be={class:"dialog-content"},we=e.defineComponent({__name:"modal-dialog",props:{type:{},title:{},content:{},okText:{default:"确定"},cancelText:{default:"取消"},onOk:{},onCancel:{},footer:{}},setup(o){const l=o,n=G(),t=e.computed(()=>l.title?l.title:{confirm:"提示",info:"提示",warning:"警告",error:"错误",success:"成功"}[l.type]);async function a(){l.onOk&&await l.onOk(),n.close()}async function s(){l.onCancel&&await l.onCancel(),n.close()}return(u,h)=>(e.openBlock(),e.createElementBlock("section",ve,[e.createElementVNode("div",ge,[e.createElementVNode("div",ye,e.toDisplayString(t.value),1),e.createElementVNode("div",be,e.toDisplayString(u.content),1)]),e.createElementVNode("div",{class:"dialog-footer space-x-2",style:e.normalizeStyle(u.type==="confirm"?{"justify-content":"end"}:{"border-top":"none"})},[u.footer?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(u.footer),{key:0})):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("button",{class:"submit-button",type:"submit",onClick:a},e.toDisplayString(u.okText),1),u.type==="confirm"?(e.openBlock(),e.createElementBlock("button",{key:0,class:"cancel-button",type:"button",onClick:s},e.toDisplayString(u.cancelText),1)):e.createCommentVNode("",!0)],64))],4)]))}}),_e=V(we,[["__scopeId","data-v-0c6b8db2"]]),ke=o=>(e.pushScopeId("data-v-559bdf2e"),o=o(),e.popScopeId(),o),Ce={class:"flex-center"},Ee=ke(()=>e.createElementVNode("div",{class:"modal-loading"},[e.createElementVNode("div",{class:"lds-ring"},[e.createElementVNode("div"),e.createElementVNode("div"),e.createElementVNode("div"),e.createElementVNode("div")])],-1)),xe={class:"modal-loading-text"},Se=e.defineComponent({__name:"modal-loading",props:{text:{default:"加载中"}},setup(o){return(l,n)=>(e.openBlock(),e.createElementBlock("section",Ce,[Ee,e.createElementVNode("div",xe,e.toDisplayString(l.text),1)]))}}),Be=V(Se,[["__scopeId","data-v-559bdf2e"]]),Me={key:0,class:"modal-teleport"},Ne={name:"ModalProvider",inheritAttrs:!0},Ve=e.defineComponent({...Ne,props:{appendToBody:{type:[Boolean,String],default:!1},sizes:{default:()=>({small:"50%",middle:"70%",large:"90%"})},maxWidth:{default:"90%"},maxHeight:{default:"90%"},offset:{default:()=>({x:0,y:0})}},setup(o,{expose:l}){const n=e.shallowRef([]),t=e.ref(!1),a=e.getCurrentInstance();function s(i,d={},c={}){const g=e.defineAsyncComponent(()=>Promise.resolve(typeof i=="string"?_e:i));typeof i=="string"&&(d.type=i,c.size="small",c.fullscreen=!1,c.mode="dialog",c.footer=!1,c.header=!1);const p=Math.random().toString(32).slice(2),k=Object.assign({zIndex:typeof i=="string"?1100:1e3},c),M=new Promise((x,$)=>{n.value.push({id:p,component:g,props:d||{},options:{...k,type:typeof i=="string"?i:"component"},resolve:x,reject:$,listeners:[]}),e.triggerRef(n)}).catch(x=>x==="CANCEL"?new Promise(()=>{}):Promise.reject(x));return Object.assign(M,{close:()=>u(p)})}function u(i,d){const c=n.value.findIndex(p=>p.id===i);if(c<0)return;const g=n.value[c];d===void 0?g==null||g.reject("CANCEL"):g==null||g.resolve(d),n.value.splice(c,1),e.triggerRef(n)}function h(){!n.value||n.value.length===0||(n.value.forEach(i=>{i==null||i.reject("CANCEL")}),n.value=[],e.triggerRef(n))}function w(i,d){const c=n.value.find(p=>p.id===i);if(!c)return;const g=c.listeners.find(p=>p.event===d);g&&g.callback({open:s,close:p=>u(c.id,p),closeAll:h,showLoading:()=>y(c.id),hideLoading:()=>v(c.id),confirm:p=>s("confirm",p),success:p=>s("success",p),error:p=>s("error",p),warning:p=>s("warning",p),info:p=>s("info",p)})}function y(i,d){if(!a)return;const[c]=a.refs[`modal-container_${i}`]||[];if(c)return c.showLoading();{const{close:g}=s(Be,{text:d==null?void 0:d.text},{footer:!1,header:!1,closeable:!1,backgroundColor:"transparent"});return d!=null&&d.duration&&setTimeout(()=>{g()},d==null?void 0:d.duration),g}}function v(i){if(!a)return;const[d]=a.refs[`modal-container_${i}`];if(d)return d.hideLoading()}function f(i,d,c){const g=n.value.find(p=>p.id===i);g&&g.listeners.push({event:d,callback:c})}return e.provide(L,{open:s,close:u,closeAll:h,addEventListener:f,showLoading:y,hideLoading:v}),l({elements:n,open:s,close:u,closeAll:h}),e.onMounted(()=>{t.value=!0}),(i,d)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.renderSlot(i.$slots,"default",{},void 0,!0),t.value?(e.openBlock(),e.createElementBlock("div",Me,[(e.openBlock(),e.createBlock(e.Teleport,{disabled:!i.appendToBody,to:typeof i.appendToBody=="string"?i.appendToBody:"body"},[e.createVNode(e.TransitionGroup,{name:"modal-fade"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,c=>(e.openBlock(),e.createBlock(j,e.mergeProps({id:c.id,key:c.id,ref_for:!0,ref:`modal-container_${c.id}`,component:c.component,"component-props":c.props,"max-height":i.maxHeight,"max-width":i.maxWidth,offset:i.offset,sizes:i.sizes},c.options,{onSubmit:()=>w(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))}}),$e=V(Ve,[["__scopeId","data-v-60414811"]]),Re={},Le={class:"modal-footer"};function Ae(o,l){return e.openBlock(),e.createBlock(e.Teleport,{to:"#modal-footer-slot"},[e.createElementVNode("div",Le,[e.renderSlot(o.$slots,"default",{},void 0,!0)])])}const Te=V(Re,[["render",Ae],["__scopeId","data-v-46f8d703"]]),ze={},Oe={class:"modal-header"};function He(o,l){return e.openBlock(),e.createBlock(e.Teleport,{to:"#modal-header-slot"},[e.createElementVNode("div",Oe,[e.renderSlot(o.$slots,"default",{},void 0,!0)])])}const Pe=V(ze,[["render",He],["__scopeId","data-v-d0247172"]]);function z(o,l){var t,a;let n=o==null?void 0:o.parent;for(;n&&((t=n==null?void 0:n.type)==null?void 0:t.name)!==l;)n=n.parent;return((a=n==null?void 0:n.type)==null?void 0:a.name)===l?n:null}function G(){const o=e.inject(L),l=e.getCurrentInstance();function n(t,a,s){if(!o)throw new Error("Not Found Modal Provider Component");return o.open(t,a,s)}return{open:n,close(t){var u;if(!o)throw new Error("Not Found Modal Provider Component");const a=z(l,"ModalContainer"),s=(u=a==null?void 0:a.props)==null?void 0:u.id;if(!s)throw new Error("Not Found Current Modal Container");o.close(s,t)},closeAll(){if(!o)throw new Error("Not Found Modal Provider Component");o.closeAll()},showLoading(t){var u;if(!o)throw new Error("Not Found Modal Provider Component");const a=z(l,"ModalContainer"),s=(u=a==null?void 0:a.props)==null?void 0:u.id;return o.showLoading(s,t)},hideLoading(){var s;if(!o)throw new Error("Not Found Modal Provider Component");const t=z(l,"ModalContainer"),a=(s=t==null?void 0:t.props)==null?void 0:s.id;return o.hideLoading(a)},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 Ie(o){var s;const l=e.inject(L),n=e.getCurrentInstance(),t=z(n,"ModalContainer"),a=(s=t==null?void 0:t.props)==null?void 0:s.id;l&&a&&l.addEventListener(a,"submit",o)}exports.ModalContainer=j;exports.ModalFooter=Te;exports.ModalHeader=Pe;exports.ModalKey=L;exports.ModalProvider=$e;exports.onSubmit=Ie;exports.useModal=G;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),L=Symbol("__MODAL__");function W(o){return e.getCurrentScope()?(e.onScopeDispose(o),!0):!1}function b(o){return typeof o=="function"?o():e.unref(o)}const F=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const J=Object.prototype.toString,Q=o=>J.call(o)==="[object Object]",Z=()=>{};function ee(o){return e.getCurrentInstance()}function te(o,l={}){if(!e.isRef(o))return e.toRefs(o);const n=Array.isArray(o.value)?Array.from({length:o.value.length}):{};for(const t in o.value)n[t]=e.customRef(()=>({get(){return o.value[t]},set(a){var i;if((i=b(l.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 n}function oe(o,l=!0,n){ee()?e.onMounted(o,n):l?o():e.nextTick(o)}function N(o){var l;const n=b(o);return(l=n==null?void 0:n.$el)!=null?l:n}const z=F?window:void 0;function P(...o){let l,n,t,a;if(typeof o[0]=="string"||Array.isArray(o[0])?([n,t,a]=o,l=z):[l,n,t,a]=o,!l)return Z;Array.isArray(n)||(n=[n]),Array.isArray(t)||(t=[t]);const i=[],u=()=>{i.forEach(v=>v()),i.length=0},h=(v,f,s,d)=>(v.addEventListener(f,s,d),()=>v.removeEventListener(f,s,d)),w=e.watch(()=>[N(l),b(a)],([v,f])=>{if(u(),!v)return;const s=Q(f)?{...f}:f;i.push(...n.flatMap(d=>t.map(c=>h(v,d,c,s))))},{immediate:!0,flush:"post"}),y=()=>{w(),u()};return W(y),y}function ne(){const o=e.ref(!1),l=e.getCurrentInstance();return l&&e.onMounted(()=>{o.value=!0},l),o}function re(o){const l=ne();return e.computed(()=>(l.value,!!o()))}function le(o,l={}){var n,t;const{pointerTypes:a,preventDefault:i,stopPropagation:u,exact:h,onMove:w,onEnd:y,onStart:v,initialValue:f,axis:s="both",draggingElement:d=z,containerElement:c,handle:g=o}=l,p=e.ref((n=b(f))!=null?n:{x:0,y:0}),_=e.ref(),M=m=>a?a.includes(m.pointerType):!0,x=m=>{b(i)&&m.preventDefault(),b(u)&&m.stopPropagation()},$=m=>{var S;if(b(l.disabled)||!M(m)||b(h)&&m.target!==b(o))return;const k=b(c),B=(S=k==null?void 0:k.getBoundingClientRect)==null?void 0:S.call(k),C=b(o).getBoundingClientRect(),O={x:m.clientX-(k?C.left-B.left+k.scrollLeft:C.left),y:m.clientY-(k?C.top-B.top+k.scrollTop:C.top)};(v==null?void 0:v(O,m))!==!1&&(_.value=O,x(m))},H=m=>{if(b(l.disabled)||!M(m)||!_.value)return;const S=b(c),k=b(o).getBoundingClientRect();let{x:B,y:C}=p.value;(s==="x"||s==="both")&&(B=m.clientX-_.value.x,S&&(B=Math.min(Math.max(0,B),S.scrollWidth-k.width))),(s==="y"||s==="both")&&(C=m.clientY-_.value.y,S&&(C=Math.min(Math.max(0,C),S.scrollHeight-k.height))),p.value={x:B,y:C},w==null||w(p.value,m),x(m)},A=m=>{b(l.disabled)||!M(m)||_.value&&(_.value=void 0,y==null||y(p.value,m),x(m))};if(F){const m={capture:(t=l.capture)!=null?t:!0};P(g,"pointerdown",$,m),P(d,"pointermove",H,m),P(d,"pointerup",A,m)}return{...te(p),position:p,isDragging:e.computed(()=>!!_.value),style:e.computed(()=>`left:${p.value.x}px;top:${p.value.y}px;`)}}function ie(o,l,n={}){const{window:t=z,...a}=n;let i;const u=re(()=>t&&"ResizeObserver"in t),h=()=>{i&&(i.disconnect(),i=void 0)},w=e.computed(()=>Array.isArray(o)?o.map(f=>N(f)):[N(o)]),y=e.watch(w,f=>{if(h(),u.value&&t){i=new ResizeObserver(l);for(const s of f)s&&i.observe(s,a)}},{immediate:!0,flush:"post"}),v=()=>{h(),y()};return W(v),{isSupported:u,stop:v}}function R(o,l={width:0,height:0},n={}){const{window:t=z,box:a="content-box"}=n,i=e.computed(()=>{var f,s;return(s=(f=N(o))==null?void 0:f.namespaceURI)==null?void 0:s.includes("svg")}),u=e.ref(l.width),h=e.ref(l.height),{stop:w}=ie(o,([f])=>{const s=a==="border-box"?f.borderBoxSize:a==="content-box"?f.contentBoxSize:f.devicePixelContentBoxSize;if(t&&i.value){const d=N(o);if(d){const c=t.getComputedStyle(d);u.value=Number.parseFloat(c.width),h.value=Number.parseFloat(c.height)}}else if(s){const d=Array.isArray(s)?s:[s];u.value=d.reduce((c,{inlineSize:g})=>c+g,0),h.value=d.reduce((c,{blockSize:g})=>c+g,0)}else u.value=f.contentRect.width,h.value=f.contentRect.height},n);oe(()=>{const f=N(o);f&&(u.value="offsetWidth"in f?f.offsetWidth:l.width,h.value="offsetHeight"in f?f.offsetHeight:l.height)});const y=e.watch(()=>N(o),f=>{u.value=f?l.width:0,h.value=f?l.height:0});function v(){w(),y()}return{width:u,height:h,stop:v}}const se=o=>(e.pushScopeId("data-v-d520be96"),o=o(),e.popScopeId(),o),ae={class:"title text-16px font-bold"},ce={class:"action"},de=["form"],ue={key:2,class:"modal-loading"},fe=se(()=>e.createElementVNode("div",{class:"lds-ring"},[e.createElementVNode("div"),e.createElementVNode("div"),e.createElementVNode("div"),e.createElementVNode("div")],-1)),pe=[fe],me={name:"ModalContainer",inheritAttrs:!0},he=e.defineComponent({...me,props:{id:{},form:{},component:{},componentProps:{},width:{},height:{},maxWidth:{},maxHeight:{default:90},sizes:{},size:{default:"middle"},fullscreen:{type:Boolean},title:{},header:{type:Boolean,default:!0},footer:{type:Boolean,default:!1},closeable:{type:Boolean,default:!0},esc:{type:Boolean,default:!1},maskClosable:{type:Boolean,default:!1},draggable:{type:Boolean,default:!1},mode:{default:"dialog"},position:{default:"right"},type:{},offset:{},backgroundColor:{},bodyStyle:{},submitText:{default:"确定"},cancelText:{default:"取消"},zIndex:{default:1e3},onOk:{},onCancel:{}},emits:["submit"],setup(o,{expose:l,emit:n}){e.useCssVars(r=>({"053e5c1d":r.zIndex}));const t=o,a=n,i=e.inject(L),u=e.ref(!1);let h=0,w=0;const y=e.shallowRef(),v=e.shallowRef(),f=e.shallowRef(),s=e.shallowRef(),d=e.shallowRef(),c=e.shallowRef(),{height:g}=R(y),{height:p}=R(f,void 0,{box:"border-box"}),{height:_}=R(s,void 0,{box:"border-box"}),{height:M}=R(d),{height:x}=R(c),{x:$,y:H}=le(f,{initialValue:{x:0,y:0}});function A(){i==null||i.close(t.id)}function m(r){return typeof r=="number"?`${r}px`:r}const S=e.computed(()=>{const r={};return t.mode==="dialog"&&(r.justifyContent="center"),t.mode==="drawer"&&(r.justifyContent={left:"flex-start",right:"flex-end",top:"flex-start",bottom:"flex-end"}[t.position],r.flexDirection={left:"row",right:"row",top:"column",bottom:"column"}[t.position]),r}),k=e.computed(()=>{const r={};return t.mode==="drawer"&&["top","bottom"].includes(t.position)?r.maxHeight=m(t.maxHeight):(r.width=m(t.sizes[t.size]),r.maxWidth=m(t.maxWidth)),t.width&&(r.width=m(t.width)),t.height&&(r.height=m(t.height)),t.fullscreen&&(r.maxWidth="unset",r.width="100%",r.position="fixed",r.top=0,r.left=0,r.bottom=0,r.right=0,r.borderRadius=0),t.draggable&&!t.fullscreen&&t.mode==="dialog"&&(r.transform=`translate3d(${$.value-h}px, ${H.value-w}px, 0px)`),t.mode==="drawer"&&(r.borderRadius=0,["left","right"].includes(t.position)?r.height="100%":r.width="100%"),t.offset&&t.mode==="dialog"&&(r.marginLeft=`${t.offset.x||0}px`,r.marginTop=`${t.offset.y||0}px`),t.backgroundColor&&(r.backgroundColor=t.backgroundColor),r}),B=e.computed(()=>{const r={};return t.draggable&&!t.fullscreen&&t.mode==="dialog"&&(r.cursor="move"),r}),C=e.computed(()=>{const r={},E=M.value+x.value+p.value+_.value,D=Math.floor(g.value*(Number(m(t.maxHeight).replace("%",""))/100));return t.maxHeight&&(r.maxHeight=`${D-E}px`),t.mode==="drawer"&&(r.maxHeight="unset",["left","right"].includes(t.position)&&(r.height=`${g.value-E}px`)),t.fullscreen&&(r.maxHeight="unset",r.height=`calc(100% - ${E}px)`),t.type!=="component"&&(r.padding="0"),t.bodyStyle&&Object.assign(r,t.bodyStyle),r});function O(){const r=v.value;if(t.form&&r){const E=r.querySelector(`form[name="${t.form}"]`);E&&E.dispatchEvent(new Event("submit"))}t.onOk&&t.onOk({close:()=>i==null?void 0:i.close(t.id)}),a("submit")}function K(){i==null||i.close(t.id),t!=null&&t.onCancel&&t.onCancel()}function X(){window&&window.addEventListener("resize",()=>{e.triggerRef(y),e.triggerRef(v),v.value&&(h=v.value.offsetLeft,w=v.value.offsetTop)})}function Y(){if(t.closeable&&t.esc){const r=({key:E})=>{E==="Escape"&&(i==null||i.close(t.id),window.removeEventListener("keydown",r))};window.addEventListener("keydown",r)}}function q(){h=v.value.offsetLeft,w=v.value.offsetTop}e.onMounted(()=>{Y(),X()}),e.onUnmounted(()=>{});function U(){return u.value=!0,()=>I()}function I(){u.value=!1}return l({showLoading:U,hideLoading:I}),(r,E)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"wrapperRef",ref:y,class:"modal-wrapper",style:e.normalizeStyle(S.value),onClick:E[0]||(E[0]=e.withModifiers(D=>r.maskClosable&&A(),["self"]))},[e.createElementVNode("div",{ref_key:"contentRef",ref:v,class:e.normalizeClass(["modal-content",{[`${r.mode}-mode`]:!0,[`${r.position}-position`]:!0}]),style:e.normalizeStyle(k.value)},[r.header?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"headerRef",ref:f,class:"modal-header",style:e.normalizeStyle(B.value),onMousedown:q},[e.createElementVNode("div",ae,e.toDisplayString(r.title),1),e.createElementVNode("div",ce,[r.closeable?(e.openBlock(),e.createElementBlock("div",{key:0,class:"i-icon-park-outline:close block cursor-pointer",onClick:A})):e.createCommentVNode("",!0)])],36)):e.createCommentVNode("",!0),e.createElementVNode("div",{id:"modal-header-slot",ref_key:"headerSlotRef",ref:d},null,512),e.createElementVNode("div",{class:"modal-body",style:e.normalizeStyle(C.value)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.component),e.normalizeProps(e.guardReactiveProps(r.componentProps)),null,16))],4),e.createElementVNode("div",{id:"modal-footer-slot",ref_key:"footerSlotRef",ref:c},null,512),r.footer?(e.openBlock(),e.createElementBlock("div",{key:1,ref_key:"footerRef",ref:s,class:"modal-footer space-x-2"},[e.createElementVNode("button",{class:"cancel-button",type:"button",onClick:K},e.toDisplayString(r.cancelText),1),e.createElementVNode("button",{class:"submit-button",form:r.form,type:"submit",onClick:O},e.toDisplayString(r.submitText),9,de)],512)):e.createCommentVNode("",!0),u.value?(e.openBlock(),e.createElementBlock("div",ue,pe)):e.createCommentVNode("",!0)],6)],4))}}),V=(o,l)=>{const n=o.__vccOpts||o;for(const[t,a]of l)n[t]=a;return n},j=V(he,[["__scopeId","data-v-d520be96"]]),ve={class:"modal-dialog"},ge={class:"dialog-body"},ye={class:"dialog-title"},be={class:"dialog-content"},we=e.defineComponent({__name:"modal-dialog",props:{type:{},title:{},content:{},okText:{default:"确定"},cancelText:{default:"取消"},onOk:{},onCancel:{},footer:{}},setup(o){const l=o,n=G(),t=e.computed(()=>l.title?l.title:{confirm:"提示",info:"提示",warning:"警告",error:"错误",success:"成功"}[l.type]);async function a(){l.onOk&&await l.onOk(),n.close()}async function i(){l.onCancel&&await l.onCancel(),n.close()}return(u,h)=>(e.openBlock(),e.createElementBlock("section",ve,[e.createElementVNode("div",ge,[e.createElementVNode("div",ye,e.toDisplayString(t.value),1),e.createElementVNode("div",be,e.toDisplayString(u.content),1)]),e.createElementVNode("div",{class:"dialog-footer space-x-2",style:e.normalizeStyle(u.type==="confirm"?{"justify-content":"end"}:{"border-top":"none"})},[u.footer?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(u.footer),{key:0})):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("button",{class:"submit-button",type:"submit",onClick:a},e.toDisplayString(u.okText),1),u.type==="confirm"?(e.openBlock(),e.createElementBlock("button",{key:0,class:"cancel-button",type:"button",onClick:i},e.toDisplayString(u.cancelText),1)):e.createCommentVNode("",!0)],64))],4)]))}}),ke=V(we,[["__scopeId","data-v-0c6b8db2"]]),_e=o=>(e.pushScopeId("data-v-559bdf2e"),o=o(),e.popScopeId(),o),Ce={class:"flex-center"},Ee=_e(()=>e.createElementVNode("div",{class:"modal-loading"},[e.createElementVNode("div",{class:"lds-ring"},[e.createElementVNode("div"),e.createElementVNode("div"),e.createElementVNode("div"),e.createElementVNode("div")])],-1)),xe={class:"modal-loading-text"},Se=e.defineComponent({__name:"modal-loading",props:{text:{default:"加载中"}},setup(o){return(l,n)=>(e.openBlock(),e.createElementBlock("section",Ce,[Ee,e.createElementVNode("div",xe,e.toDisplayString(l.text),1)]))}}),Be=V(Se,[["__scopeId","data-v-559bdf2e"]]),Me={key:0,class:"modal-teleport"},Ne={name:"ModalProvider",inheritAttrs:!0},Ve=e.defineComponent({...Ne,props:{appendToBody:{type:[Boolean,String],default:!1},sizes:{default:()=>({small:"50%",middle:"70%",large:"90%"})},maxWidth:{default:"90%"},maxHeight:{default:"90%"},offset:{default:()=>({x:0,y:0})}},setup(o,{expose:l}){const n=e.shallowRef([]),t=e.ref(!1),a=e.getCurrentInstance();function i(s,d={},c={}){const g=e.defineAsyncComponent(()=>Promise.resolve(typeof s=="string"?ke:s));typeof s=="string"&&(d.type=s,c.size="small",c.fullscreen=!1,c.mode="dialog",c.footer=!1,c.header=!1);const p=Math.random().toString(32).slice(2),_=Object.assign({zIndex:typeof s=="string"?1100:1e3},c),M=new Promise((x,$)=>{n.value.push({id:p,component:g,props:d||{},options:{..._,type:typeof s=="string"?s:"component"},resolve:x,reject:$,listeners:[]}),e.triggerRef(n)}).catch(x=>x==="CANCEL"?new Promise(()=>{}):Promise.reject(x));return Object.assign(M,{close:()=>u(p)})}function u(s,d){const c=n.value.findIndex(p=>p.id===s);if(c<0)return;const g=n.value[c];d===void 0?g==null||g.reject("CANCEL"):g==null||g.resolve(d),n.value.splice(c,1),e.triggerRef(n)}function h(){!n.value||n.value.length===0||(n.value.forEach(s=>{s==null||s.reject("CANCEL")}),n.value=[],e.triggerRef(n))}function w(s,d){const c=n.value.find(p=>p.id===s);if(!c)return;const g=c.listeners.find(p=>p.event===d);g&&g.callback({open:i,close:p=>u(c.id,p),closeAll:h,showLoading:()=>y(c.id),hideLoading:()=>v(c.id),confirm:p=>i("confirm",p),success:p=>i("success",p),error:p=>i("error",p),warning:p=>i("warning",p),info:p=>i("info",p)})}function y(s,d){if(!a)return;const[c]=a.refs[`modal-container_${s}`]||[];if(c)return c.showLoading();{const{close:g}=i(Be,{text:d==null?void 0:d.text},{footer:!1,header:!1,closeable:!1,backgroundColor:"transparent"});return d!=null&&d.duration&&setTimeout(()=>{g()},d==null?void 0:d.duration),g}}function v(s){if(!a)return;const[d]=a.refs[`modal-container_${s}`];if(d)return d.hideLoading()}function f(s,d,c){const g=n.value.find(p=>p.id===s);g&&g.listeners.push({event:d,callback:c})}return e.provide(L,{open:i,close:u,closeAll:h,addEventListener:f,showLoading:y,hideLoading:v}),l({elements:n,open:i,close:u,closeAll:h}),e.onMounted(()=>{t.value=!0}),(s,d)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.renderSlot(s.$slots,"default",{},void 0,!0),t.value?(e.openBlock(),e.createElementBlock("div",Me,[(e.openBlock(),e.createBlock(e.Teleport,{disabled:!s.appendToBody,to:typeof s.appendToBody=="string"?s.appendToBody:"body"},[e.createVNode(e.TransitionGroup,{name:"modal-fade"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,c=>(e.openBlock(),e.createBlock(j,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":s.maxHeight,"max-width":s.maxWidth,offset:s.offset,sizes:s.sizes},c.options,{onSubmit:()=>w(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))}}),$e=V(Ve,[["__scopeId","data-v-60414811"]]),Re={},Le={class:"modal-footer"};function Ae(o,l){return e.openBlock(),e.createBlock(e.Teleport,{to:"#modal-footer-slot"},[e.createElementVNode("div",Le,[e.renderSlot(o.$slots,"default",{},void 0,!0)])])}const Oe=V(Re,[["render",Ae],["__scopeId","data-v-46f8d703"]]),Te={},ze={class:"modal-header"};function He(o,l){return e.openBlock(),e.createBlock(e.Teleport,{to:"#modal-header-slot"},[e.createElementVNode("div",ze,[e.renderSlot(o.$slots,"default",{},void 0,!0)])])}const Pe=V(Te,[["render",He],["__scopeId","data-v-d0247172"]]);function T(o,l){var t,a;let n=o==null?void 0:o.parent;for(;n&&((t=n==null?void 0:n.type)==null?void 0:t.name)!==l;)n=n.parent;return((a=n==null?void 0:n.type)==null?void 0:a.name)===l?n:null}function G(){const o=e.inject(L),l=e.getCurrentInstance();function n(t,a,i){if(!o)throw new Error("Not Found Modal Provider Component");return o.open(t,a,i)}return{open:n,close(t){var u;if(!o)throw new Error("Not Found Modal Provider Component");const a=T(l,"ModalContainer"),i=(u=a==null?void 0:a.props)==null?void 0:u.id;if(!i)throw new Error("Not Found Current Modal Container");o.close(i,t)},closeAll(){if(!o)throw new Error("Not Found Modal Provider Component");o.closeAll()},showLoading(t){var u;if(!o)throw new Error("Not Found Modal Provider Component");const a=T(l,"ModalContainer"),i=(u=a==null?void 0:a.props)==null?void 0:u.id;return o.showLoading(i,t)},hideLoading(){var i;if(!o)throw new Error("Not Found Modal Provider Component");const t=T(l,"ModalContainer"),a=(i=t==null?void 0:t.props)==null?void 0:i.id;return o.hideLoading(a)},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 Ie(o){var i;const l=e.inject(L),n=e.getCurrentInstance(),t=T(n,"ModalContainer"),a=(i=t==null?void 0:t.props)==null?void 0:i.id;l&&a&&l.addEventListener(a,"submit",o)}exports.ModalContainer=j;exports.ModalFooter=Oe;exports.ModalHeader=Pe;exports.ModalKey=L;exports.ModalProvider=$e;exports.onSubmit=Ie;exports.useModal=G;
@@ -30,6 +30,10 @@ export interface OpenModalOptions {
30
30
  bodyStyle?: CSSProperties;
31
31
  submitText?: string;
32
32
  cancelText?: string;
33
+ onOk?: (options: {
34
+ close: () => void;
35
+ }) => void;
36
+ onCancel?: () => void;
33
37
  }
34
38
  export interface ModalElement extends OpenModalOptions {
35
39
  id: string;
@@ -32,6 +32,10 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
32
32
  submitText?: string | undefined;
33
33
  cancelText?: string | undefined;
34
34
  zIndex?: number | undefined;
35
+ onOk?: ((options: {
36
+ close: () => void;
37
+ }) => void) | undefined;
38
+ onCancel?: (() => void) | undefined;
35
39
  }>, {
36
40
  header: boolean;
37
41
  closeable: boolean;
@@ -83,6 +87,10 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
83
87
  submitText?: string | undefined;
84
88
  cancelText?: string | undefined;
85
89
  zIndex?: number | undefined;
90
+ onOk?: ((options: {
91
+ close: () => void;
92
+ }) => void) | undefined;
93
+ onCancel?: (() => void) | undefined;
86
94
  }>, {
87
95
  header: boolean;
88
96
  closeable: boolean;
package/dist/es/index.mjs CHANGED
@@ -1,10 +1,10 @@
1
- import { unref as ve, isRef as ge, toRefs as ye, customRef as be, onMounted as Y, nextTick as we, getCurrentScope as _e, onScopeDispose as xe, getCurrentInstance as V, ref as H, computed as E, watch as ee, defineComponent as K, useCssVars as Ce, inject as te, shallowRef as O, onUnmounted as ke, openBlock as y, createElementBlock as C, normalizeStyle as D, withModifiers as Me, createElementVNode as v, normalizeClass as Se, toDisplayString as R, createCommentVNode as z, createBlock as P, resolveDynamicComponent as ie, normalizeProps as $e, guardReactiveProps as Ee, triggerRef as F, pushScopeId as le, popScopeId as ae, Fragment as Z, provide as Le, renderSlot as oe, Teleport as ne, createVNode as Ae, TransitionGroup as Re, withCtx as Te, renderList as Oe, mergeProps as Be, defineAsyncComponent as He } from "vue";
1
+ import { unref as me, isRef as ge, toRefs as ye, customRef as be, onMounted as Y, nextTick as we, getCurrentScope as _e, onScopeDispose as xe, getCurrentInstance as V, ref as H, computed as E, watch as ee, defineComponent as K, useCssVars as Ce, inject as te, shallowRef as T, onUnmounted as ke, openBlock as y, createElementBlock as C, normalizeStyle as D, withModifiers as Me, createElementVNode as m, normalizeClass as Se, toDisplayString as O, createCommentVNode as z, createBlock as P, resolveDynamicComponent as re, normalizeProps as $e, guardReactiveProps as Ee, triggerRef as F, pushScopeId as le, popScopeId as ae, Fragment as Z, provide as Le, renderSlot as oe, Teleport as ne, createVNode as Ae, TransitionGroup as Oe, withCtx as Re, renderList as Te, mergeProps as Be, defineAsyncComponent as He } from "vue";
2
2
  const U = Symbol("__MODAL__");
3
3
  function de(t) {
4
4
  return _e() ? (xe(t), !0) : !1;
5
5
  }
6
6
  function w(t) {
7
- return typeof t == "function" ? t() : ve(t);
7
+ return typeof t == "function" ? t() : me(t);
8
8
  }
9
9
  const ce = typeof window < "u" && typeof document < "u";
10
10
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
@@ -13,7 +13,7 @@ const ze = Object.prototype.toString, Pe = (t) => ze.call(t) === "[object Object
13
13
  function Ne(t) {
14
14
  return V();
15
15
  }
16
- function We(t, r = {}) {
16
+ function We(t, s = {}) {
17
17
  if (!ge(t))
18
18
  return ye(t);
19
19
  const o = Array.isArray(t.value) ? Array.from({ length: t.value.length }) : {};
@@ -24,7 +24,7 @@ function We(t, r = {}) {
24
24
  },
25
25
  set(l) {
26
26
  var i;
27
- if ((i = w(r.replaceRef)) != null ? i : !0)
27
+ if ((i = w(s.replaceRef)) != null ? i : !0)
28
28
  if (Array.isArray(t.value)) {
29
29
  const h = [...t.value];
30
30
  h[e] = l, t.value = h;
@@ -38,30 +38,30 @@ function We(t, r = {}) {
38
38
  }));
39
39
  return o;
40
40
  }
41
- function De(t, r = !0, o) {
42
- Ne() ? Y(t, o) : r ? t() : we(t);
41
+ function De(t, s = !0, o) {
42
+ Ne() ? Y(t, o) : s ? t() : we(t);
43
43
  }
44
44
  function B(t) {
45
- var r;
45
+ var s;
46
46
  const o = w(t);
47
- return (r = o == null ? void 0 : o.$el) != null ? r : o;
47
+ return (s = o == null ? void 0 : o.$el) != null ? s : o;
48
48
  }
49
49
  const q = ce ? window : void 0;
50
50
  function Q(...t) {
51
- let r, o, e, l;
52
- if (typeof t[0] == "string" || Array.isArray(t[0]) ? ([o, e, l] = t, r = q) : [r, o, e, l] = t, !r)
51
+ let s, o, e, l;
52
+ if (typeof t[0] == "string" || Array.isArray(t[0]) ? ([o, e, l] = t, s = q) : [s, o, e, l] = t, !s)
53
53
  return Ie;
54
54
  Array.isArray(o) || (o = [o]), Array.isArray(e) || (e = [e]);
55
55
  const i = [], c = () => {
56
- i.forEach((m) => m()), i.length = 0;
57
- }, h = (m, u, s, d) => (m.addEventListener(u, s, d), () => m.removeEventListener(u, s, d)), _ = ee(
58
- () => [B(r), w(l)],
59
- ([m, u]) => {
60
- if (c(), !m)
56
+ i.forEach((v) => v()), i.length = 0;
57
+ }, h = (v, u, r, d) => (v.addEventListener(u, r, d), () => v.removeEventListener(u, r, d)), _ = ee(
58
+ () => [B(s), w(l)],
59
+ ([v, u]) => {
60
+ if (c(), !v)
61
61
  return;
62
- const s = Pe(u) ? { ...u } : u;
62
+ const r = Pe(u) ? { ...u } : u;
63
63
  i.push(
64
- ...o.flatMap((d) => e.map((a) => h(m, d, a, s)))
64
+ ...o.flatMap((d) => e.map((a) => h(v, d, a, r)))
65
65
  );
66
66
  },
67
67
  { immediate: !0, flush: "post" }
@@ -71,16 +71,16 @@ function Q(...t) {
71
71
  return de(b), b;
72
72
  }
73
73
  function Fe() {
74
- const t = H(!1), r = V();
75
- return r && Y(() => {
74
+ const t = H(!1), s = V();
75
+ return s && Y(() => {
76
76
  t.value = !0;
77
- }, r), t;
77
+ }, s), t;
78
78
  }
79
79
  function Ve(t) {
80
- const r = Fe();
81
- return E(() => (r.value, !!t()));
80
+ const s = Fe();
81
+ return E(() => (s.value, !!t()));
82
82
  }
83
- function je(t, r = {}) {
83
+ function je(t, s = {}) {
84
84
  var o, e;
85
85
  const {
86
86
  pointerTypes: l,
@@ -89,39 +89,39 @@ function je(t, r = {}) {
89
89
  exact: h,
90
90
  onMove: _,
91
91
  onEnd: b,
92
- onStart: m,
92
+ onStart: v,
93
93
  initialValue: u,
94
- axis: s = "both",
94
+ axis: r = "both",
95
95
  draggingElement: d = q,
96
96
  containerElement: a,
97
97
  handle: g = t
98
- } = r, f = H(
98
+ } = s, f = H(
99
99
  (o = w(u)) != null ? o : { x: 0, y: 0 }
100
- ), k = H(), T = (p) => l ? l.includes(p.pointerType) : !0, $ = (p) => {
100
+ ), k = H(), R = (p) => l ? l.includes(p.pointerType) : !0, $ = (p) => {
101
101
  w(i) && p.preventDefault(), w(c) && p.stopPropagation();
102
102
  }, N = (p) => {
103
103
  var L;
104
- if (w(r.disabled) || !T(p) || w(h) && p.target !== w(t))
104
+ if (w(s.disabled) || !R(p) || w(h) && p.target !== w(t))
105
105
  return;
106
106
  const x = w(a), A = (L = x == null ? void 0 : x.getBoundingClientRect) == null ? void 0 : L.call(x), M = w(t).getBoundingClientRect(), G = {
107
107
  x: p.clientX - (x ? M.left - A.left + x.scrollLeft : M.left),
108
108
  y: p.clientY - (x ? M.top - A.top + x.scrollTop : M.top)
109
109
  };
110
- (m == null ? void 0 : m(G, p)) !== !1 && (k.value = G, $(p));
110
+ (v == null ? void 0 : v(G, p)) !== !1 && (k.value = G, $(p));
111
111
  }, J = (p) => {
112
- if (w(r.disabled) || !T(p) || !k.value)
112
+ if (w(s.disabled) || !R(p) || !k.value)
113
113
  return;
114
114
  const L = w(a), x = w(t).getBoundingClientRect();
115
115
  let { x: A, y: M } = f.value;
116
- (s === "x" || s === "both") && (A = p.clientX - k.value.x, L && (A = Math.min(Math.max(0, A), L.scrollWidth - x.width))), (s === "y" || s === "both") && (M = p.clientY - k.value.y, L && (M = Math.min(Math.max(0, M), L.scrollHeight - x.height))), f.value = {
116
+ (r === "x" || r === "both") && (A = p.clientX - k.value.x, L && (A = Math.min(Math.max(0, A), L.scrollWidth - x.width))), (r === "y" || r === "both") && (M = p.clientY - k.value.y, L && (M = Math.min(Math.max(0, M), L.scrollHeight - x.height))), f.value = {
117
117
  x: A,
118
118
  y: M
119
119
  }, _ == null || _(f.value, p), $(p);
120
120
  }, j = (p) => {
121
- w(r.disabled) || !T(p) || k.value && (k.value = void 0, b == null || b(f.value, p), $(p));
121
+ w(s.disabled) || !R(p) || k.value && (k.value = void 0, b == null || b(f.value, p), $(p));
122
122
  };
123
123
  if (ce) {
124
- const p = { capture: (e = r.capture) != null ? e : !0 };
124
+ const p = { capture: (e = s.capture) != null ? e : !0 };
125
125
  Q(g, "pointerdown", N, p), Q(d, "pointermove", J, p), Q(d, "pointerup", j, p);
126
126
  }
127
127
  return {
@@ -133,7 +133,7 @@ function je(t, r = {}) {
133
133
  )
134
134
  };
135
135
  }
136
- function Ge(t, r, o = {}) {
136
+ function Ge(t, s, o = {}) {
137
137
  const { window: e = q, ...l } = o;
138
138
  let i;
139
139
  const c = Ve(() => e && "ResizeObserver" in e), h = () => {
@@ -142,36 +142,36 @@ function Ge(t, r, o = {}) {
142
142
  _,
143
143
  (u) => {
144
144
  if (h(), c.value && e) {
145
- i = new ResizeObserver(r);
146
- for (const s of u)
147
- s && i.observe(s, l);
145
+ i = new ResizeObserver(s);
146
+ for (const r of u)
147
+ r && i.observe(r, l);
148
148
  }
149
149
  },
150
150
  { immediate: !0, flush: "post" }
151
- ), m = () => {
151
+ ), v = () => {
152
152
  h(), b();
153
153
  };
154
- return de(m), {
154
+ return de(v), {
155
155
  isSupported: c,
156
- stop: m
156
+ stop: v
157
157
  };
158
158
  }
159
- function W(t, r = { width: 0, height: 0 }, o = {}) {
159
+ function W(t, s = { width: 0, height: 0 }, o = {}) {
160
160
  const { window: e = q, box: l = "content-box" } = o, i = E(() => {
161
- var u, s;
162
- return (s = (u = B(t)) == null ? void 0 : u.namespaceURI) == null ? void 0 : s.includes("svg");
163
- }), c = H(r.width), h = H(r.height), { stop: _ } = Ge(
161
+ var u, r;
162
+ return (r = (u = B(t)) == null ? void 0 : u.namespaceURI) == null ? void 0 : r.includes("svg");
163
+ }), c = H(s.width), h = H(s.height), { stop: _ } = Ge(
164
164
  t,
165
165
  ([u]) => {
166
- const s = l === "border-box" ? u.borderBoxSize : l === "content-box" ? u.contentBoxSize : u.devicePixelContentBoxSize;
166
+ const r = l === "border-box" ? u.borderBoxSize : l === "content-box" ? u.contentBoxSize : u.devicePixelContentBoxSize;
167
167
  if (e && i.value) {
168
168
  const d = B(t);
169
169
  if (d) {
170
170
  const a = e.getComputedStyle(d);
171
171
  c.value = Number.parseFloat(a.width), h.value = Number.parseFloat(a.height);
172
172
  }
173
- } else if (s) {
174
- const d = Array.isArray(s) ? s : [s];
173
+ } else if (r) {
174
+ const d = Array.isArray(r) ? r : [r];
175
175
  c.value = d.reduce((a, { inlineSize: g }) => a + g, 0), h.value = d.reduce((a, { blockSize: g }) => a + g, 0);
176
176
  } else
177
177
  c.value = u.contentRect.width, h.value = u.contentRect.height;
@@ -180,31 +180,31 @@ function W(t, r = { width: 0, height: 0 }, o = {}) {
180
180
  );
181
181
  De(() => {
182
182
  const u = B(t);
183
- u && (c.value = "offsetWidth" in u ? u.offsetWidth : r.width, h.value = "offsetHeight" in u ? u.offsetHeight : r.height);
183
+ u && (c.value = "offsetWidth" in u ? u.offsetWidth : s.width, h.value = "offsetHeight" in u ? u.offsetHeight : s.height);
184
184
  });
185
185
  const b = ee(
186
186
  () => B(t),
187
187
  (u) => {
188
- c.value = u ? r.width : 0, h.value = u ? r.height : 0;
188
+ c.value = u ? s.width : 0, h.value = u ? s.height : 0;
189
189
  }
190
190
  );
191
- function m() {
191
+ function v() {
192
192
  _(), b();
193
193
  }
194
194
  return {
195
195
  width: c,
196
196
  height: h,
197
- stop: m
197
+ stop: v
198
198
  };
199
199
  }
200
- const Xe = (t) => (le("data-v-9a7af353"), t = t(), ae(), t), Ye = { class: "title text-16px font-bold" }, Ke = { class: "action" }, Ue = ["form"], qe = {
200
+ const Xe = (t) => (le("data-v-d520be96"), t = t(), ae(), t), Ye = { class: "title text-16px font-bold" }, Ke = { class: "action" }, Ue = ["form"], qe = {
201
201
  key: 2,
202
202
  class: "modal-loading"
203
- }, Je = /* @__PURE__ */ Xe(() => /* @__PURE__ */ v("div", { class: "lds-ring" }, [
204
- /* @__PURE__ */ v("div"),
205
- /* @__PURE__ */ v("div"),
206
- /* @__PURE__ */ v("div"),
207
- /* @__PURE__ */ v("div")
203
+ }, Je = /* @__PURE__ */ Xe(() => /* @__PURE__ */ m("div", { class: "lds-ring" }, [
204
+ /* @__PURE__ */ m("div"),
205
+ /* @__PURE__ */ m("div"),
206
+ /* @__PURE__ */ m("div"),
207
+ /* @__PURE__ */ m("div")
208
208
  ], -1)), Qe = [
209
209
  Je
210
210
  ], Ze = {
@@ -239,16 +239,18 @@ const Xe = (t) => (le("data-v-9a7af353"), t = t(), ae(), t), Ye = { class: "titl
239
239
  bodyStyle: {},
240
240
  submitText: { default: "确定" },
241
241
  cancelText: { default: "取消" },
242
- zIndex: { default: 1e3 }
242
+ zIndex: { default: 1e3 },
243
+ onOk: {},
244
+ onCancel: {}
243
245
  },
244
246
  emits: ["submit"],
245
- setup(t, { expose: r, emit: o }) {
247
+ setup(t, { expose: s, emit: o }) {
246
248
  Ce((n) => ({
247
- "5751bf6b": n.zIndex
249
+ "053e5c1d": n.zIndex
248
250
  }));
249
251
  const e = t, l = o, i = te(U), c = H(!1);
250
252
  let h = 0, _ = 0;
251
- const b = O(), m = O(), u = O(), s = O(), d = O(), a = O(), { height: g } = W(b), { height: f } = W(u, void 0, { box: "border-box" }), { height: k } = W(s, void 0, { box: "border-box" }), { height: T } = W(d), { height: $ } = W(a), { x: N, y: J } = je(u, {
253
+ const b = T(), v = T(), u = T(), r = T(), d = T(), a = T(), { height: g } = W(b), { height: f } = W(u, void 0, { box: "border-box" }), { height: k } = W(r, void 0, { box: "border-box" }), { height: R } = W(d), { height: $ } = W(a), { x: N, y: J } = je(u, {
252
254
  initialValue: { x: 0, y: 0 }
253
255
  });
254
256
  function j() {
@@ -277,23 +279,25 @@ const Xe = (t) => (le("data-v-9a7af353"), t = t(), ae(), t), Ye = { class: "titl
277
279
  const n = {};
278
280
  return e.draggable && !e.fullscreen && e.mode === "dialog" && (n.cursor = "move"), n;
279
281
  }), M = E(() => {
280
- const n = {}, S = T.value + $.value + f.value + k.value, se = Math.floor(g.value * (Number(p(e.maxHeight).replace("%", "")) / 100));
281
- return e.maxHeight && (n.maxHeight = `${se - S}px`), e.mode === "drawer" && (n.maxHeight = "unset", ["left", "right"].includes(e.position) && (n.height = `${g.value - S}px`)), e.fullscreen && (n.maxHeight = "unset", n.height = `calc(100% - ${S}px)`), e.type !== "component" && (n.padding = "0"), e.bodyStyle && Object.assign(n, e.bodyStyle), n;
282
+ const n = {}, S = R.value + $.value + f.value + k.value, ie = Math.floor(g.value * (Number(p(e.maxHeight).replace("%", "")) / 100));
283
+ return e.maxHeight && (n.maxHeight = `${ie - S}px`), e.mode === "drawer" && (n.maxHeight = "unset", ["left", "right"].includes(e.position) && (n.height = `${g.value - S}px`)), e.fullscreen && (n.maxHeight = "unset", n.height = `calc(100% - ${S}px)`), e.type !== "component" && (n.padding = "0"), e.bodyStyle && Object.assign(n, e.bodyStyle), n;
282
284
  });
283
285
  function G() {
284
- const n = m.value;
286
+ const n = v.value;
285
287
  if (e.form && n) {
286
288
  const S = n.querySelector(`form[name="${e.form}"]`);
287
289
  S && S.dispatchEvent(new Event("submit"));
288
290
  }
289
- l("submit");
291
+ e.onOk && e.onOk({
292
+ close: () => i == null ? void 0 : i.close(e.id)
293
+ }), l("submit");
290
294
  }
291
295
  function ue() {
292
- i == null || i.close(e.id);
296
+ i == null || i.close(e.id), e != null && e.onCancel && e.onCancel();
293
297
  }
294
298
  function fe() {
295
299
  window && window.addEventListener("resize", () => {
296
- F(b), F(m), m.value && (h = m.value.offsetLeft, _ = m.value.offsetTop);
300
+ F(b), F(v), v.value && (h = v.value.offsetLeft, _ = v.value.offsetTop);
297
301
  });
298
302
  }
299
303
  function pe() {
@@ -305,31 +309,31 @@ const Xe = (t) => (le("data-v-9a7af353"), t = t(), ae(), t), Ye = { class: "titl
305
309
  }
306
310
  }
307
311
  function he() {
308
- h = m.value.offsetLeft, _ = m.value.offsetTop;
312
+ h = v.value.offsetLeft, _ = v.value.offsetTop;
309
313
  }
310
314
  Y(() => {
311
315
  pe(), fe();
312
316
  }), ke(() => {
313
317
  });
314
- function me() {
315
- return c.value = !0, () => re();
318
+ function ve() {
319
+ return c.value = !0, () => se();
316
320
  }
317
- function re() {
321
+ function se() {
318
322
  c.value = !1;
319
323
  }
320
- return r({
321
- showLoading: me,
322
- hideLoading: re
324
+ return s({
325
+ showLoading: ve,
326
+ hideLoading: se
323
327
  }), (n, S) => (y(), C("div", {
324
328
  ref_key: "wrapperRef",
325
329
  ref: b,
326
330
  class: "modal-wrapper",
327
331
  style: D(L.value),
328
- onClick: S[0] || (S[0] = Me((se) => n.maskClosable && j(), ["self"]))
332
+ onClick: S[0] || (S[0] = Me((ie) => n.maskClosable && j(), ["self"]))
329
333
  }, [
330
- v("div", {
334
+ m("div", {
331
335
  ref_key: "contentRef",
332
- ref: m,
336
+ ref: v,
333
337
  class: Se(["modal-content", { [`${n.mode}-mode`]: !0, [`${n.position}-position`]: !0 }]),
334
338
  style: D(x.value)
335
339
  }, [
@@ -341,8 +345,8 @@ const Xe = (t) => (le("data-v-9a7af353"), t = t(), ae(), t), Ye = { class: "titl
341
345
  style: D(A.value),
342
346
  onMousedown: he
343
347
  }, [
344
- v("div", Ye, R(n.title), 1),
345
- v("div", Ke, [
348
+ m("div", Ye, O(n.title), 1),
349
+ m("div", Ke, [
346
350
  n.closeable ? (y(), C("div", {
347
351
  key: 0,
348
352
  class: "i-icon-park-outline:close block cursor-pointer",
@@ -350,18 +354,18 @@ const Xe = (t) => (le("data-v-9a7af353"), t = t(), ae(), t), Ye = { class: "titl
350
354
  })) : z("", !0)
351
355
  ])
352
356
  ], 36)) : z("", !0),
353
- v("div", {
357
+ m("div", {
354
358
  id: "modal-header-slot",
355
359
  ref_key: "headerSlotRef",
356
360
  ref: d
357
361
  }, null, 512),
358
- v("div", {
362
+ m("div", {
359
363
  class: "modal-body",
360
364
  style: D(M.value)
361
365
  }, [
362
- (y(), P(ie(n.component), $e(Ee(n.componentProps)), null, 16))
366
+ (y(), P(re(n.component), $e(Ee(n.componentProps)), null, 16))
363
367
  ], 4),
364
- v("div", {
368
+ m("div", {
365
369
  id: "modal-footer-slot",
366
370
  ref_key: "footerSlotRef",
367
371
  ref: a
@@ -369,31 +373,31 @@ const Xe = (t) => (le("data-v-9a7af353"), t = t(), ae(), t), Ye = { class: "titl
369
373
  n.footer ? (y(), C("div", {
370
374
  key: 1,
371
375
  ref_key: "footerRef",
372
- ref: s,
376
+ ref: r,
373
377
  class: "modal-footer space-x-2"
374
378
  }, [
375
- v("button", {
379
+ m("button", {
376
380
  class: "cancel-button",
377
381
  type: "button",
378
382
  onClick: ue
379
- }, R(n.cancelText), 1),
380
- v("button", {
383
+ }, O(n.cancelText), 1),
384
+ m("button", {
381
385
  class: "submit-button",
382
386
  form: n.form,
383
387
  type: "submit",
384
388
  onClick: G
385
- }, R(n.submitText), 9, Ue)
389
+ }, O(n.submitText), 9, Ue)
386
390
  ], 512)) : z("", !0),
387
391
  c.value ? (y(), C("div", qe, Qe)) : z("", !0)
388
392
  ], 6)
389
393
  ], 4));
390
394
  }
391
- }), I = (t, r) => {
395
+ }), I = (t, s) => {
392
396
  const o = t.__vccOpts || t;
393
- for (const [e, l] of r)
397
+ for (const [e, l] of s)
394
398
  o[e] = l;
395
399
  return o;
396
- }, tt = /* @__PURE__ */ I(et, [["__scopeId", "data-v-9a7af353"]]), ot = { class: "modal-dialog" }, nt = { class: "dialog-body" }, rt = { class: "dialog-title" }, st = { class: "dialog-content" }, it = /* @__PURE__ */ K({
400
+ }, tt = /* @__PURE__ */ I(et, [["__scopeId", "data-v-d520be96"]]), ot = { class: "modal-dialog" }, nt = { class: "dialog-body" }, st = { class: "dialog-title" }, it = { class: "dialog-content" }, rt = /* @__PURE__ */ K({
397
401
  __name: "modal-dialog",
398
402
  props: {
399
403
  type: {},
@@ -406,50 +410,50 @@ const Xe = (t) => (le("data-v-9a7af353"), t = t(), ae(), t), Ye = { class: "titl
406
410
  footer: {}
407
411
  },
408
412
  setup(t) {
409
- const r = t, o = Ct(), e = E(() => r.title ? r.title : {
413
+ const s = t, o = Ct(), e = E(() => s.title ? s.title : {
410
414
  confirm: "提示",
411
415
  info: "提示",
412
416
  warning: "警告",
413
417
  error: "错误",
414
418
  success: "成功"
415
- }[r.type]);
419
+ }[s.type]);
416
420
  async function l() {
417
- r.onOk && await r.onOk(), o.close();
421
+ s.onOk && await s.onOk(), o.close();
418
422
  }
419
423
  async function i() {
420
- r.onCancel && await r.onCancel(), o.close();
424
+ s.onCancel && await s.onCancel(), o.close();
421
425
  }
422
426
  return (c, h) => (y(), C("section", ot, [
423
- v("div", nt, [
424
- v("div", rt, R(e.value), 1),
425
- v("div", st, R(c.content), 1)
427
+ m("div", nt, [
428
+ m("div", st, O(e.value), 1),
429
+ m("div", it, O(c.content), 1)
426
430
  ]),
427
- v("div", {
431
+ m("div", {
428
432
  class: "dialog-footer space-x-2",
429
433
  style: D(c.type === "confirm" ? { "justify-content": "end" } : { "border-top": "none" })
430
434
  }, [
431
- c.footer ? (y(), P(ie(c.footer), { key: 0 })) : (y(), C(Z, { key: 1 }, [
432
- v("button", {
435
+ c.footer ? (y(), P(re(c.footer), { key: 0 })) : (y(), C(Z, { key: 1 }, [
436
+ m("button", {
433
437
  class: "submit-button",
434
438
  type: "submit",
435
439
  onClick: l
436
- }, R(c.okText), 1),
440
+ }, O(c.okText), 1),
437
441
  c.type === "confirm" ? (y(), C("button", {
438
442
  key: 0,
439
443
  class: "cancel-button",
440
444
  type: "button",
441
445
  onClick: i
442
- }, R(c.cancelText), 1)) : z("", !0)
446
+ }, O(c.cancelText), 1)) : z("", !0)
443
447
  ], 64))
444
448
  ], 4)
445
449
  ]));
446
450
  }
447
- }), lt = /* @__PURE__ */ I(it, [["__scopeId", "data-v-0c6b8db2"]]), at = (t) => (le("data-v-559bdf2e"), t = t(), ae(), t), dt = { class: "flex-center" }, ct = /* @__PURE__ */ at(() => /* @__PURE__ */ v("div", { class: "modal-loading" }, [
448
- /* @__PURE__ */ v("div", { class: "lds-ring" }, [
449
- /* @__PURE__ */ v("div"),
450
- /* @__PURE__ */ v("div"),
451
- /* @__PURE__ */ v("div"),
452
- /* @__PURE__ */ v("div")
451
+ }), lt = /* @__PURE__ */ I(rt, [["__scopeId", "data-v-0c6b8db2"]]), at = (t) => (le("data-v-559bdf2e"), t = t(), ae(), t), dt = { class: "flex-center" }, ct = /* @__PURE__ */ at(() => /* @__PURE__ */ m("div", { class: "modal-loading" }, [
452
+ /* @__PURE__ */ m("div", { class: "lds-ring" }, [
453
+ /* @__PURE__ */ m("div"),
454
+ /* @__PURE__ */ m("div"),
455
+ /* @__PURE__ */ m("div"),
456
+ /* @__PURE__ */ m("div")
453
457
  ])
454
458
  ], -1)), ut = { class: "modal-loading-text" }, ft = /* @__PURE__ */ K({
455
459
  __name: "modal-loading",
@@ -457,19 +461,19 @@ const Xe = (t) => (le("data-v-9a7af353"), t = t(), ae(), t), Ye = { class: "titl
457
461
  text: { default: "加载中" }
458
462
  },
459
463
  setup(t) {
460
- return (r, o) => (y(), C("section", dt, [
464
+ return (s, o) => (y(), C("section", dt, [
461
465
  ct,
462
- v("div", ut, R(r.text), 1)
466
+ m("div", ut, O(s.text), 1)
463
467
  ]));
464
468
  }
465
469
  }), pt = /* @__PURE__ */ I(ft, [["__scopeId", "data-v-559bdf2e"]]), ht = {
466
470
  key: 0,
467
471
  class: "modal-teleport"
468
- }, mt = {
472
+ }, vt = {
469
473
  name: "ModalProvider",
470
474
  inheritAttrs: !0
471
- }, vt = /* @__PURE__ */ K({
472
- ...mt,
475
+ }, mt = /* @__PURE__ */ K({
476
+ ...vt,
473
477
  props: {
474
478
  appendToBody: { type: [Boolean, String], default: !1 },
475
479
  sizes: { default: () => ({
@@ -481,23 +485,23 @@ const Xe = (t) => (le("data-v-9a7af353"), t = t(), ae(), t), Ye = { class: "titl
481
485
  maxHeight: { default: "90%" },
482
486
  offset: { default: () => ({ x: 0, y: 0 }) }
483
487
  },
484
- setup(t, { expose: r }) {
485
- const o = O([]), e = H(!1), l = V();
486
- function i(s, d = {}, a = {}) {
488
+ setup(t, { expose: s }) {
489
+ const o = T([]), e = H(!1), l = V();
490
+ function i(r, d = {}, a = {}) {
487
491
  const g = He(
488
- () => Promise.resolve(typeof s == "string" ? lt : s)
492
+ () => Promise.resolve(typeof r == "string" ? lt : r)
489
493
  );
490
- typeof s == "string" && (d.type = s, a.size = "small", a.fullscreen = !1, a.mode = "dialog", a.footer = !1, a.header = !1);
494
+ typeof r == "string" && (d.type = r, a.size = "small", a.fullscreen = !1, a.mode = "dialog", a.footer = !1, a.header = !1);
491
495
  const f = Math.random().toString(32).slice(2), k = Object.assign({
492
- zIndex: typeof s == "string" ? 1100 : 1e3
493
- }, a), T = new Promise(($, N) => {
496
+ zIndex: typeof r == "string" ? 1100 : 1e3
497
+ }, a), R = new Promise(($, N) => {
494
498
  o.value.push({
495
499
  id: f,
496
500
  component: g,
497
501
  props: d || {},
498
502
  options: {
499
503
  ...k,
500
- type: typeof s == "string" ? s : "component"
504
+ type: typeof r == "string" ? r : "component"
501
505
  },
502
506
  resolve: $,
503
507
  reject: N,
@@ -505,24 +509,24 @@ const Xe = (t) => (le("data-v-9a7af353"), t = t(), ae(), t), Ye = { class: "titl
505
509
  }), F(o);
506
510
  }).catch(($) => $ === "CANCEL" ? new Promise(() => {
507
511
  }) : Promise.reject($));
508
- return Object.assign(T, {
512
+ return Object.assign(R, {
509
513
  close: () => c(f)
510
514
  });
511
515
  }
512
- function c(s, d) {
513
- const a = o.value.findIndex((f) => f.id === s);
516
+ function c(r, d) {
517
+ const a = o.value.findIndex((f) => f.id === r);
514
518
  if (a < 0)
515
519
  return;
516
520
  const g = o.value[a];
517
521
  d === void 0 ? g == null || g.reject("CANCEL") : g == null || g.resolve(d), o.value.splice(a, 1), F(o);
518
522
  }
519
523
  function h() {
520
- !o.value || o.value.length === 0 || (o.value.forEach((s) => {
521
- s == null || s.reject("CANCEL");
524
+ !o.value || o.value.length === 0 || (o.value.forEach((r) => {
525
+ r == null || r.reject("CANCEL");
522
526
  }), o.value = [], F(o));
523
527
  }
524
- function _(s, d) {
525
- const a = o.value.find((f) => f.id === s);
528
+ function _(r, d) {
529
+ const a = o.value.find((f) => f.id === r);
526
530
  if (!a)
527
531
  return;
528
532
  const g = a.listeners.find((f) => f.event === d);
@@ -531,7 +535,7 @@ const Xe = (t) => (le("data-v-9a7af353"), t = t(), ae(), t), Ye = { class: "titl
531
535
  close: (f) => c(a.id, f),
532
536
  closeAll: h,
533
537
  showLoading: () => b(a.id),
534
- hideLoading: () => m(a.id),
538
+ hideLoading: () => v(a.id),
535
539
  confirm: (f) => i("confirm", f),
536
540
  success: (f) => i("success", f),
537
541
  error: (f) => i("error", f),
@@ -539,10 +543,10 @@ const Xe = (t) => (le("data-v-9a7af353"), t = t(), ae(), t), Ye = { class: "titl
539
543
  info: (f) => i("info", f)
540
544
  });
541
545
  }
542
- function b(s, d) {
546
+ function b(r, d) {
543
547
  if (!l)
544
548
  return;
545
- const [a] = l.refs[`modal-container_${s}`] || [];
549
+ const [a] = l.refs[`modal-container_${r}`] || [];
546
550
  if (a)
547
551
  return a.showLoading();
548
552
  {
@@ -562,15 +566,15 @@ const Xe = (t) => (le("data-v-9a7af353"), t = t(), ae(), t), Ye = { class: "titl
562
566
  ), g;
563
567
  }
564
568
  }
565
- function m(s) {
569
+ function v(r) {
566
570
  if (!l)
567
571
  return;
568
- const [d] = l.refs[`modal-container_${s}`];
572
+ const [d] = l.refs[`modal-container_${r}`];
569
573
  if (d)
570
574
  return d.hideLoading();
571
575
  }
572
- function u(s, d, a) {
573
- const g = o.value.find((f) => f.id === s);
576
+ function u(r, d, a) {
577
+ const g = o.value.find((f) => f.id === r);
574
578
  g && g.listeners.push({
575
579
  event: d,
576
580
  callback: a
@@ -582,34 +586,34 @@ const Xe = (t) => (le("data-v-9a7af353"), t = t(), ae(), t), Ye = { class: "titl
582
586
  closeAll: h,
583
587
  addEventListener: u,
584
588
  showLoading: b,
585
- hideLoading: m
586
- }), r({
589
+ hideLoading: v
590
+ }), s({
587
591
  elements: o,
588
592
  open: i,
589
593
  close: c,
590
594
  closeAll: h
591
595
  }), Y(() => {
592
596
  e.value = !0;
593
- }), (s, d) => (y(), C(Z, null, [
594
- oe(s.$slots, "default", {}, void 0, !0),
597
+ }), (r, d) => (y(), C(Z, null, [
598
+ oe(r.$slots, "default", {}, void 0, !0),
595
599
  e.value ? (y(), C("div", ht, [
596
600
  (y(), P(ne, {
597
- disabled: !s.appendToBody,
598
- to: typeof s.appendToBody == "string" ? s.appendToBody : "body"
601
+ disabled: !r.appendToBody,
602
+ to: typeof r.appendToBody == "string" ? r.appendToBody : "body"
599
603
  }, [
600
- Ae(Re, { name: "modal-fade" }, {
601
- default: Te(() => [
602
- (y(!0), C(Z, null, Oe(o.value, (a) => (y(), P(tt, Be({
604
+ Ae(Oe, { name: "modal-fade" }, {
605
+ default: Re(() => [
606
+ (y(!0), C(Z, null, Te(o.value, (a) => (y(), P(tt, Be({
603
607
  id: a.id,
604
608
  key: a.id,
605
609
  ref_for: !0,
606
610
  ref: `modal-container_${a.id}`,
607
611
  component: a.component,
608
612
  "component-props": a.props,
609
- "max-height": s.maxHeight,
610
- "max-width": s.maxWidth,
611
- offset: s.offset,
612
- sizes: s.sizes
613
+ "max-height": r.maxHeight,
614
+ "max-width": r.maxWidth,
615
+ offset: r.offset,
616
+ sizes: r.sizes
613
617
  }, a.options, {
614
618
  onSubmit: () => _(a.id, "submit")
615
619
  }), null, 16, ["id", "component", "component-props", "max-height", "max-width", "offset", "sizes", "onSubmit"]))), 128))
@@ -620,32 +624,32 @@ const Xe = (t) => (le("data-v-9a7af353"), t = t(), ae(), t), Ye = { class: "titl
620
624
  ])) : z("", !0)
621
625
  ], 64));
622
626
  }
623
- }), Mt = /* @__PURE__ */ I(vt, [["__scopeId", "data-v-60414811"]]), gt = {}, yt = { class: "modal-footer" };
624
- function bt(t, r) {
627
+ }), Mt = /* @__PURE__ */ I(mt, [["__scopeId", "data-v-60414811"]]), gt = {}, yt = { class: "modal-footer" };
628
+ function bt(t, s) {
625
629
  return y(), P(ne, { to: "#modal-footer-slot" }, [
626
- v("div", yt, [
630
+ m("div", yt, [
627
631
  oe(t.$slots, "default", {}, void 0, !0)
628
632
  ])
629
633
  ]);
630
634
  }
631
635
  const St = /* @__PURE__ */ I(gt, [["render", bt], ["__scopeId", "data-v-46f8d703"]]), wt = {}, _t = { class: "modal-header" };
632
- function xt(t, r) {
636
+ function xt(t, s) {
633
637
  return y(), P(ne, { to: "#modal-header-slot" }, [
634
- v("div", _t, [
638
+ m("div", _t, [
635
639
  oe(t.$slots, "default", {}, void 0, !0)
636
640
  ])
637
641
  ]);
638
642
  }
639
643
  const $t = /* @__PURE__ */ I(wt, [["render", xt], ["__scopeId", "data-v-d0247172"]]);
640
- function X(t, r) {
644
+ function X(t, s) {
641
645
  var e, l;
642
646
  let o = t == null ? void 0 : t.parent;
643
- for (; o && ((e = o == null ? void 0 : o.type) == null ? void 0 : e.name) !== r; )
647
+ for (; o && ((e = o == null ? void 0 : o.type) == null ? void 0 : e.name) !== s; )
644
648
  o = o.parent;
645
- return ((l = o == null ? void 0 : o.type) == null ? void 0 : l.name) === r ? o : null;
649
+ return ((l = o == null ? void 0 : o.type) == null ? void 0 : l.name) === s ? o : null;
646
650
  }
647
651
  function Ct() {
648
- const t = te(U), r = V();
652
+ const t = te(U), s = V();
649
653
  function o(e, l, i) {
650
654
  if (!t)
651
655
  throw new Error("Not Found Modal Provider Component");
@@ -657,7 +661,7 @@ function Ct() {
657
661
  var c;
658
662
  if (!t)
659
663
  throw new Error("Not Found Modal Provider Component");
660
- const l = X(r, "ModalContainer"), i = (c = l == null ? void 0 : l.props) == null ? void 0 : c.id;
664
+ const l = X(s, "ModalContainer"), i = (c = l == null ? void 0 : l.props) == null ? void 0 : c.id;
661
665
  if (!i)
662
666
  throw new Error("Not Found Current Modal Container");
663
667
  t.close(i, e);
@@ -671,14 +675,14 @@ function Ct() {
671
675
  var c;
672
676
  if (!t)
673
677
  throw new Error("Not Found Modal Provider Component");
674
- const l = X(r, "ModalContainer"), i = (c = l == null ? void 0 : l.props) == null ? void 0 : c.id;
678
+ const l = X(s, "ModalContainer"), i = (c = l == null ? void 0 : l.props) == null ? void 0 : c.id;
675
679
  return t.showLoading(i, e);
676
680
  },
677
681
  hideLoading() {
678
682
  var i;
679
683
  if (!t)
680
684
  throw new Error("Not Found Modal Provider Component");
681
- const e = X(r, "ModalContainer"), l = (i = e == null ? void 0 : e.props) == null ? void 0 : i.id;
685
+ const e = X(s, "ModalContainer"), l = (i = e == null ? void 0 : e.props) == null ? void 0 : i.id;
682
686
  return t.hideLoading(l);
683
687
  },
684
688
  confirm(e) {
@@ -700,8 +704,8 @@ function Ct() {
700
704
  }
701
705
  function Et(t) {
702
706
  var i;
703
- const r = te(U), o = V(), e = X(o, "ModalContainer"), l = (i = e == null ? void 0 : e.props) == null ? void 0 : i.id;
704
- r && l && r.addEventListener(l, "submit", t);
707
+ const s = te(U), o = V(), e = X(o, "ModalContainer"), l = (i = e == null ? void 0 : e.props) == null ? void 0 : i.id;
708
+ s && l && s.addEventListener(l, "submit", t);
705
709
  }
706
710
  export {
707
711
  tt as ModalContainer,
@@ -30,6 +30,10 @@ export interface OpenModalOptions {
30
30
  bodyStyle?: CSSProperties;
31
31
  submitText?: string;
32
32
  cancelText?: string;
33
+ onOk?: (options: {
34
+ close: () => void;
35
+ }) => void;
36
+ onCancel?: () => void;
33
37
  }
34
38
  export interface ModalElement extends OpenModalOptions {
35
39
  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}.inline-flex{display:inline-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-9a7af353]{z-index:var(--5751bf6b);position:fixed;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;background:#0000004d}.modal-content[data-v-9a7af353]{background:#fff;border-radius:5px;position:relative}.modal-header[data-v-9a7af353]{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-9a7af353]{padding:10px;box-sizing:border-box;overflow:auto;position:relative}.modal-footer[data-v-9a7af353]{box-sizing:border-box;height:50px;border-top:solid 1px var(--color-border-1, #e8e8e8);display:flex;justify-content:flex-end;padding:10px}.modal-footer button[data-v-9a7af353]{height:32px;line-height:28px;min-width:80px;outline:none;border-color:transparent;font-size:14px;border-radius:4px;padding:0 10px;box-sizing:border-box}.modal-footer button.submit-button[data-v-9a7af353]{color:#fff;background-color:rgb(var(--primary-6, 45, 106, 251))}.modal-footer button.submit-button[data-v-9a7af353]:hover{background-color:rgb(var(--primary-5, 28, 76, 207))}.modal-footer button.submit-button[data-v-9a7af353]:active{background-color:rgb(var(--primary-7, 14, 66, 210))}.modal-footer button.cancel-button[data-v-9a7af353]{color:rgb(var(--color-text-2, 78, 89, 105));background-color:var(--color-fill-1, #f5f5f5)}.modal-footer button.cancel-button[data-v-9a7af353]:hover{background-color:var(--color-fill-3, #e5e6eb)}.modal-footer button.cancel-button[data-v-9a7af353]:active{background-color:var(--color-fill-4, #c9cdd4)}.modal-loading[data-v-9a7af353]{position:absolute;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-9a7af353]{display:inline-block;position:relative;width:80px;height:80px}.modal-loading .lds-ring div[data-v-9a7af353]{box-sizing:border-box;display:block;position:absolute;width:48px;height:48px;margin:8px;border:5px solid #fff;border-radius:50%;animation:lds-ring-9a7af353 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:#fff transparent transparent transparent}.modal-loading .lds-ring div[data-v-9a7af353]:nth-child(1){animation-delay:-.45s}.modal-loading .lds-ring div[data-v-9a7af353]:nth-child(2){animation-delay:-.3s}.modal-loading .lds-ring div[data-v-9a7af353]:nth-child(3){animation-delay:-.15s}@keyframes lds-ring-9a7af353{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.dialog-body[data-v-0c6b8db2]{padding:20px 10px 10px}.dialog-title[data-v-0c6b8db2]{padding:5px;font-weight:700;font-size:16px}.dialog-content[data-v-0c6b8db2]{padding:5px}.dialog-footer[data-v-0c6b8db2]{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-0c6b8db2]{height:32px;line-height:28px;min-width:80px;outline:none;border-color:transparent;font-size:14px;border-radius:4px;padding:0;box-sizing:border-box}.dialog-footer button.submit-button[data-v-0c6b8db2]{color:#fff;background-color:rgb(var(--primary-6, 45, 106, 251))}.dialog-footer button.submit-button[data-v-0c6b8db2]:hover{background-color:rgb(var(--primary-5, 28, 76, 207))}.dialog-footer button.submit-button[data-v-0c6b8db2]:active{background-color:rgb(var(--primary-7, 14, 66, 210))}.dialog-footer button.cancel-button[data-v-0c6b8db2]{color:rgb(var(--color-text-2, 78, 89, 105));background-color:var(--color-fill-1, #f5f5f5)}.dialog-footer button.cancel-button[data-v-0c6b8db2]:hover{background-color:var(--color-fill-4, #c9cdd4)}.modal-loading .lds-ring[data-v-559bdf2e]{display:inline-flex;justify-content:center;align-items:center;position:relative;width:80px;height:80px}.modal-loading .lds-ring div[data-v-559bdf2e]{box-sizing:border-box;display:block;position:absolute;width:48px;height:48px;margin:8px;border:5px solid #fff;border-radius:50%;animation:lds-ring-559bdf2e 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:#fff transparent transparent transparent}.modal-loading .lds-ring div[data-v-559bdf2e]:nth-child(1){animation-delay:-.45s}.modal-loading .lds-ring div[data-v-559bdf2e]:nth-child(2){animation-delay:-.3s}.modal-loading .lds-ring div[data-v-559bdf2e]:nth-child(3){animation-delay:-.15s}@keyframes lds-ring-559bdf2e{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.modal-loading-text[data-v-559bdf2e]{color:#fff;font-weight:700}.modal-fade-enter-active[data-v-60414811],.modal-fade-leave-active[data-v-60414811]{transition:opacity .5s ease}.modal-fade-enter-active[data-v-60414811] .modal-content.drawer-mode,.modal-fade-leave-active[data-v-60414811] .modal-content.drawer-mode{transition:transform .5s ease}.modal-fade-enter-from[data-v-60414811],.modal-fade-leave-to[data-v-60414811]{opacity:0}.modal-fade-enter-from[data-v-60414811] .modal-content.drawer-mode.left-position,.modal-fade-leave-to[data-v-60414811] .modal-content.drawer-mode.left-position{transform:translate3d(-100%,0,0)}.modal-fade-enter-from[data-v-60414811] .modal-content.drawer-mode.right-position,.modal-fade-leave-to[data-v-60414811] .modal-content.drawer-mode.right-position{transform:translate3d(100%,0,0)}.modal-fade-enter-from[data-v-60414811] .modal-content.drawer-mode.top-position,.modal-fade-leave-to[data-v-60414811] .modal-content.drawer-mode.top-position{transform:translate3d(0,-100%,0)}.modal-fade-enter-from[data-v-60414811] .modal-content.drawer-mode.bottom-position,.modal-fade-leave-to[data-v-60414811] .modal-content.drawer-mode.bottom-position{transform:translate3d(0,100%,0)}.modal-footer[data-v-46f8d703]{box-sizing:border-box;min-height:50px;border-top:solid 1px var(--color-border-1, rgb(232, 232, 232));padding:10px}.modal-footer button[data-v-46f8d703]{height:32px;line-height:28px;min-width:80px;outline:none;border-color:transparent;font-size:14px;border-radius:4px;padding:0;box-sizing:border-box}.modal-footer button.submit-button[data-v-46f8d703]{color:#fff;background-color:rgb(var(--primary-6, 45, 106, 251))}.modal-footer button.submit-button[data-v-46f8d703]:hover{background-color:rgb(var(--primary-5, 28, 76, 207))}.modal-footer button.submit-button[data-v-46f8d703]:active{background-color:rgb(var(--primary-7, 14, 66, 210))}.modal-footer button.cancel-button[data-v-46f8d703]{color:rgb(var(--color-text-2, 78, 89, 105));background-color:var(--color-fill-1, #f5f5f5)}.modal-footer button.cancel-button[data-v-46f8d703]:hover{background-color:var(--color-fill-3, #e5e6eb)}.modal-footer button.cancel-button[data-v-46f8d703]:active{background-color:var(--color-fill-4, #c9cdd4)}.modal-header[data-v-d0247172]{box-sizing:border-box;padding:10px;min-height:50px;border-bottom:solid 1px var(--color-border-1, rgb(232, 232, 232));color:var(--color-text-2, #4E5969)}
1
+ *,:before,:after{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / .5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }::backdrop{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / .5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }.i-icon-park-outline\:close{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 48 48' width='1em' height='1em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='4' d='m8 8l32 32M8 40L40 8'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1em;height:1em}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.inline-flex{display:inline-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-d520be96]{z-index:var(--053e5c1d);position:fixed;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;background:#0000004d}.modal-content[data-v-d520be96]{background:#fff;border-radius:5px;position:relative}.modal-header[data-v-d520be96]{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-d520be96]{padding:10px;box-sizing:border-box;overflow:auto;position:relative}.modal-footer[data-v-d520be96]{box-sizing:border-box;height:50px;border-top:solid 1px var(--color-border-1, #e8e8e8);display:flex;justify-content:flex-end;padding:10px}.modal-footer button[data-v-d520be96]{height:32px;line-height:28px;min-width:80px;outline:none;border-color:transparent;font-size:14px;border-radius:4px;padding:0 10px;box-sizing:border-box}.modal-footer button.submit-button[data-v-d520be96]{color:#fff;background-color:rgb(var(--primary-6, 45, 106, 251))}.modal-footer button.submit-button[data-v-d520be96]:hover{background-color:rgb(var(--primary-5, 28, 76, 207))}.modal-footer button.submit-button[data-v-d520be96]:active{background-color:rgb(var(--primary-7, 14, 66, 210))}.modal-footer button.cancel-button[data-v-d520be96]{color:rgb(var(--color-text-2, 78, 89, 105));background-color:var(--color-fill-1, #f5f5f5)}.modal-footer button.cancel-button[data-v-d520be96]:hover{background-color:var(--color-fill-3, #e5e6eb)}.modal-footer button.cancel-button[data-v-d520be96]:active{background-color:var(--color-fill-4, #c9cdd4)}.modal-loading[data-v-d520be96]{position:absolute;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-d520be96]{display:inline-block;position:relative;width:80px;height:80px}.modal-loading .lds-ring div[data-v-d520be96]{box-sizing:border-box;display:block;position:absolute;width:48px;height:48px;margin:8px;border:5px solid #fff;border-radius:50%;animation:lds-ring-d520be96 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:#fff transparent transparent transparent}.modal-loading .lds-ring div[data-v-d520be96]:nth-child(1){animation-delay:-.45s}.modal-loading .lds-ring div[data-v-d520be96]:nth-child(2){animation-delay:-.3s}.modal-loading .lds-ring div[data-v-d520be96]:nth-child(3){animation-delay:-.15s}@keyframes lds-ring-d520be96{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.dialog-body[data-v-0c6b8db2]{padding:20px 10px 10px}.dialog-title[data-v-0c6b8db2]{padding:5px;font-weight:700;font-size:16px}.dialog-content[data-v-0c6b8db2]{padding:5px}.dialog-footer[data-v-0c6b8db2]{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-0c6b8db2]{height:32px;line-height:28px;min-width:80px;outline:none;border-color:transparent;font-size:14px;border-radius:4px;padding:0;box-sizing:border-box}.dialog-footer button.submit-button[data-v-0c6b8db2]{color:#fff;background-color:rgb(var(--primary-6, 45, 106, 251))}.dialog-footer button.submit-button[data-v-0c6b8db2]:hover{background-color:rgb(var(--primary-5, 28, 76, 207))}.dialog-footer button.submit-button[data-v-0c6b8db2]:active{background-color:rgb(var(--primary-7, 14, 66, 210))}.dialog-footer button.cancel-button[data-v-0c6b8db2]{color:rgb(var(--color-text-2, 78, 89, 105));background-color:var(--color-fill-1, #f5f5f5)}.dialog-footer button.cancel-button[data-v-0c6b8db2]:hover{background-color:var(--color-fill-4, #c9cdd4)}.modal-loading .lds-ring[data-v-559bdf2e]{display:inline-flex;justify-content:center;align-items:center;position:relative;width:80px;height:80px}.modal-loading .lds-ring div[data-v-559bdf2e]{box-sizing:border-box;display:block;position:absolute;width:48px;height:48px;margin:8px;border:5px solid #fff;border-radius:50%;animation:lds-ring-559bdf2e 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:#fff transparent transparent transparent}.modal-loading .lds-ring div[data-v-559bdf2e]:nth-child(1){animation-delay:-.45s}.modal-loading .lds-ring div[data-v-559bdf2e]:nth-child(2){animation-delay:-.3s}.modal-loading .lds-ring div[data-v-559bdf2e]:nth-child(3){animation-delay:-.15s}@keyframes lds-ring-559bdf2e{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.modal-loading-text[data-v-559bdf2e]{color:#fff;font-weight:700}.modal-fade-enter-active[data-v-60414811],.modal-fade-leave-active[data-v-60414811]{transition:opacity .5s ease}.modal-fade-enter-active[data-v-60414811] .modal-content.drawer-mode,.modal-fade-leave-active[data-v-60414811] .modal-content.drawer-mode{transition:transform .5s ease}.modal-fade-enter-from[data-v-60414811],.modal-fade-leave-to[data-v-60414811]{opacity:0}.modal-fade-enter-from[data-v-60414811] .modal-content.drawer-mode.left-position,.modal-fade-leave-to[data-v-60414811] .modal-content.drawer-mode.left-position{transform:translate3d(-100%,0,0)}.modal-fade-enter-from[data-v-60414811] .modal-content.drawer-mode.right-position,.modal-fade-leave-to[data-v-60414811] .modal-content.drawer-mode.right-position{transform:translate3d(100%,0,0)}.modal-fade-enter-from[data-v-60414811] .modal-content.drawer-mode.top-position,.modal-fade-leave-to[data-v-60414811] .modal-content.drawer-mode.top-position{transform:translate3d(0,-100%,0)}.modal-fade-enter-from[data-v-60414811] .modal-content.drawer-mode.bottom-position,.modal-fade-leave-to[data-v-60414811] .modal-content.drawer-mode.bottom-position{transform:translate3d(0,100%,0)}.modal-footer[data-v-46f8d703]{box-sizing:border-box;min-height:50px;border-top:solid 1px var(--color-border-1, rgb(232, 232, 232));padding:10px}.modal-footer button[data-v-46f8d703]{height:32px;line-height:28px;min-width:80px;outline:none;border-color:transparent;font-size:14px;border-radius:4px;padding:0;box-sizing:border-box}.modal-footer button.submit-button[data-v-46f8d703]{color:#fff;background-color:rgb(var(--primary-6, 45, 106, 251))}.modal-footer button.submit-button[data-v-46f8d703]:hover{background-color:rgb(var(--primary-5, 28, 76, 207))}.modal-footer button.submit-button[data-v-46f8d703]:active{background-color:rgb(var(--primary-7, 14, 66, 210))}.modal-footer button.cancel-button[data-v-46f8d703]{color:rgb(var(--color-text-2, 78, 89, 105));background-color:var(--color-fill-1, #f5f5f5)}.modal-footer button.cancel-button[data-v-46f8d703]:hover{background-color:var(--color-fill-3, #e5e6eb)}.modal-footer button.cancel-button[data-v-46f8d703]:active{background-color:var(--color-fill-4, #c9cdd4)}.modal-header[data-v-d0247172]{box-sizing:border-box;padding:10px;min-height:50px;border-bottom:solid 1px var(--color-border-1, rgb(232, 232, 232));color:var(--color-text-2, #4E5969)}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gopowerteam/modal-render",
3
3
  "type": "module",
4
- "version": "0.0.43",
4
+ "version": "0.0.45",
5
5
  "author": {
6
6
  "name": "zhuchentong",
7
7
  "email": "2037630@gmail.com"