@gopowerteam/modal-render 0.0.38 → 0.0.40

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 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),V=Symbol("__MODAL__");function F(o){return e.getCurrentScope()?(e.onScopeDispose(o),!0):!1}function w(o){return typeof o=="function"?o():e.unref(o)}const W=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,i={}){if(!e.isRef(o))return e.toRefs(o);const r=Array.isArray(o.value)?Array.from({length:o.value.length}):{};for(const t in o.value)r[t]=e.customRef(()=>({get(){return o.value[t]},set(c){var s;if((s=w(i.replaceRef))!=null?s:!0)if(Array.isArray(o.value)){const h=[...o.value];h[t]=c,o.value=h}else{const h={...o.value,[t]:c};Object.setPrototypeOf(h,Object.getPrototypeOf(o.value)),o.value=h}else o.value[t]=c}}));return r}function oe(o,i=!0,r){ee()?e.onMounted(o,r):i?o():e.nextTick(o)}function N(o){var i;const r=w(o);return(i=r==null?void 0:r.$el)!=null?i:r}const O=W?window:void 0;function P(...o){let i,r,t,c;if(typeof o[0]=="string"||Array.isArray(o[0])?([r,t,c]=o,i=O):[i,r,t,c]=o,!i)return Z;Array.isArray(r)||(r=[r]),Array.isArray(t)||(t=[t]);const s=[],u=()=>{s.forEach(v=>v()),s.length=0},h=(v,d,l,f)=>(v.addEventListener(d,l,f),()=>v.removeEventListener(d,l,f)),b=e.watch(()=>[N(i),w(c)],([v,d])=>{if(u(),!v)return;const l=Q(d)?{...d}:d;s.push(...r.flatMap(f=>t.map(a=>h(v,f,a,l))))},{immediate:!0,flush:"post"}),y=()=>{b(),u()};return F(y),y}function ne(){const o=e.ref(!1),i=e.getCurrentInstance();return i&&e.onMounted(()=>{o.value=!0},i),o}function re(o){const i=ne();return e.computed(()=>(i.value,!!o()))}function ie(o,i={}){var r,t;const{pointerTypes:c,preventDefault:s,stopPropagation:u,exact:h,onMove:b,onEnd:y,onStart:v,initialValue:d,axis:l="both",draggingElement:f=O,containerElement:a,handle:g=o}=i,p=e.ref((r=w(d))!=null?r:{x:0,y:0}),C=e.ref(),M=m=>c?c.includes(m.pointerType):!0,E=m=>{w(s)&&m.preventDefault(),w(u)&&m.stopPropagation()},$=m=>{var S;if(w(i.disabled)||!M(m)||w(h)&&m.target!==w(o))return;const k=w(a),B=(S=k==null?void 0:k.getBoundingClientRect)==null?void 0:S.call(k),_=w(o).getBoundingClientRect(),T={x:m.clientX-(k?_.left-B.left+k.scrollLeft:_.left),y:m.clientY-(k?_.top-B.top+k.scrollTop:_.top)};(v==null?void 0:v(T,m))!==!1&&(C.value=T,E(m))},H=m=>{if(w(i.disabled)||!M(m)||!C.value)return;const S=w(a),k=w(o).getBoundingClientRect();let{x:B,y:_}=p.value;(l==="x"||l==="both")&&(B=m.clientX-C.value.x,S&&(B=Math.min(Math.max(0,B),S.scrollWidth-k.width))),(l==="y"||l==="both")&&(_=m.clientY-C.value.y,S&&(_=Math.min(Math.max(0,_),S.scrollHeight-k.height))),p.value={x:B,y:_},b==null||b(p.value,m),E(m)},A=m=>{w(i.disabled)||!M(m)||C.value&&(C.value=void 0,y==null||y(p.value,m),E(m))};if(W){const m={capture:(t=i.capture)!=null?t:!0};P(g,"pointerdown",$,m),P(f,"pointermove",H,m),P(f,"pointerup",A,m)}return{...te(p),position:p,isDragging:e.computed(()=>!!C.value),style:e.computed(()=>`left:${p.value.x}px;top:${p.value.y}px;`)}}function le(o,i,r={}){const{window:t=O,...c}=r;let s;const u=re(()=>t&&"ResizeObserver"in t),h=()=>{s&&(s.disconnect(),s=void 0)},b=e.computed(()=>Array.isArray(o)?o.map(d=>N(d)):[N(o)]),y=e.watch(b,d=>{if(h(),u.value&&t){s=new ResizeObserver(i);for(const l of d)l&&s.observe(l,c)}},{immediate:!0,flush:"post"}),v=()=>{h(),y()};return F(v),{isSupported:u,stop:v}}function R(o,i={width:0,height:0},r={}){const{window:t=O,box:c="content-box"}=r,s=e.computed(()=>{var d,l;return(l=(d=N(o))==null?void 0:d.namespaceURI)==null?void 0:l.includes("svg")}),u=e.ref(i.width),h=e.ref(i.height),{stop:b}=le(o,([d])=>{const l=c==="border-box"?d.borderBoxSize:c==="content-box"?d.contentBoxSize:d.devicePixelContentBoxSize;if(t&&s.value){const f=N(o);if(f){const a=t.getComputedStyle(f);u.value=Number.parseFloat(a.width),h.value=Number.parseFloat(a.height)}}else if(l){const f=Array.isArray(l)?l:[l];u.value=f.reduce((a,{inlineSize:g})=>a+g,0),h.value=f.reduce((a,{blockSize:g})=>a+g,0)}else u.value=d.contentRect.width,h.value=d.contentRect.height},r);oe(()=>{const d=N(o);d&&(u.value="offsetWidth"in d?d.offsetWidth:i.width,h.value="offsetHeight"in d?d.offsetHeight:i.height)});const y=e.watch(()=>N(o),d=>{u.value=d?i.width:0,h.value=d?i.height:0});function v(){b(),y()}return{width:u,height:h,stop:v}}const se=o=>(e.pushScopeId("data-v-a1713ed1"),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:i,emit:r}){e.useCssVars(n=>({"1c652152":n.zIndex}));const t=o,c=r,s=e.inject(V),u=e.ref(!1);let h=0,b=0;const y=e.shallowRef(),v=e.shallowRef(),d=e.shallowRef(),l=e.shallowRef(),f=e.shallowRef(),a=e.shallowRef(),{height:g}=R(y);R(v);const{height:p}=R(d,void 0,{box:"border-box"}),{height:C}=R(l,void 0,{box:"border-box"}),{height:M}=R(f),{height:E}=R(a),{x:$,y:H}=ie(d,{initialValue:{x:0,y:0}});function A(){s==null||s.close(t.id)}function m(n){return typeof n=="number"?`${n}px`:n}const S=e.computed(()=>{const n={};return t.mode==="dialog"&&(n.justifyContent="center"),t.mode==="drawer"&&(n.justifyContent={left:"flex-start",right:"flex-end",top:"flex-start",bottom:"flex-end"}[t.position],n.flexDirection={left:"row",right:"row",top:"column",bottom:"column"}[t.position]),n}),k=e.computed(()=>{const n={};return t.mode==="drawer"&&["top","bottom"].includes(t.position)?n.maxHeight=m(t.maxHeight):(n.width=m(t.sizes[t.size]),n.maxWidth=m(t.maxWidth)),t.width&&(n.width=m(t.width)),t.height&&(n.height=m(t.height)),t.fullscreen&&(n.maxWidth="unset",n.width="100%",n.position="fixed",n.top=0,n.left=0,n.bottom=0,n.right=0,n.borderRadius=0),t.draggable&&!t.fullscreen&&t.mode==="dialog"&&(n.transform=`translate3d(${$.value-h}px, ${H.value-b}px, 0px)`),t.mode==="drawer"&&(n.borderRadius=0,["left","right"].includes(t.position)?n.height="100%":n.width="100%"),t.offset&&t.mode==="dialog"&&(n.marginLeft=`${t.offset.x||0}px`,n.marginTop=`${t.offset.y||0}px`),t.backgroundColor&&(n.backgroundColor=t.backgroundColor),n}),B=e.computed(()=>{const n={};return t.draggable&&!t.fullscreen&&t.mode==="dialog"&&(n.cursor="move"),n}),_=e.computed(()=>{const n={},x=M.value+E.value+p.value+C.value,I=Math.floor(g.value*(Number(m(t.maxHeight).replace("%",""))/100));return t.maxHeight&&(n.maxHeight=`${I-x}px`),t.mode==="drawer"&&(n.maxHeight="unset",["left","right"].includes(t.position)&&(n.height=`${g.value-x}px`)),t.fullscreen&&(n.maxHeight="unset",n.height=`calc(100% - ${x}px)`),t.type!=="component"&&(n.padding="0"),t.bodyStyle&&Object.assign(n,t.bodyStyle),n});function T(){const n=v.value;if(t.form&&n){const x=n.querySelector(`form[name="${t.form}"]`);x&&x.dispatchEvent(new Event("submit"))}c("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,b=v.value.offsetTop)})}function Y(){if(t.closeable&&t.esc){const n=({key:x})=>{x==="Escape"&&(s==null||s.close(t.id),window.removeEventListener("keydown",n))};window.addEventListener("keydown",n)}}function q(){h=v.value.offsetLeft,b=v.value.offsetTop}e.onMounted(()=>{Y(),X()}),e.onUnmounted(()=>{});function U(){return u.value=!0,()=>D()}function D(){u.value=!1}return i({showLoading:U,hideLoading:D}),(n,x)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"wrapperRef",ref:y,class:"modal-wrapper",style:e.normalizeStyle(S.value),onClick:x[0]||(x[0]=e.withModifiers(I=>n.maskClosable&&A(),["self"]))},[e.createElementVNode("div",{ref_key:"contentRef",ref:v,class:e.normalizeClass(["modal-content",{[`${n.mode}-mode`]:!0,[`${n.position}-position`]:!0}]),style:e.normalizeStyle(k.value)},[n.header?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"headerRef",ref:d,class:"modal-header",style:e.normalizeStyle(B.value),onMousedown:q},[e.createElementVNode("div",ae,e.toDisplayString(n.title),1),e.createElementVNode("div",ce,[n.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:f},null,512),e.createElementVNode("div",{class:"modal-body",style:e.normalizeStyle(_.value)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.component),e.normalizeProps(e.guardReactiveProps(n.componentProps)),null,16))],4),e.createElementVNode("div",{id:"modal-footer-slot",ref_key:"footerSlotRef",ref:a},null,512),n.footer?(e.openBlock(),e.createElementBlock("div",{key:1,ref_key:"footerRef",ref:l,class:"modal-footer space-x-2"},[e.createElementVNode("button",{class:"cancel-button",type:"button",onClick:K},e.toDisplayString(n.cancelText),1),e.createElementVNode("button",{class:"submit-button",form:n.form,type:"submit",onClick:T},e.toDisplayString(n.submitText),9,de)],512)):e.createCommentVNode("",!0),u.value?(e.openBlock(),e.createElementBlock("div",ue,pe)):e.createCommentVNode("",!0)],6)],4))}}),L=(o,i)=>{const r=o.__vccOpts||o;for(const[t,c]of i)r[t]=c;return r},j=L(he,[["__scopeId","data-v-a1713ed1"]]),ve={class:"modal-dialog"},ge={class:"dialog-body"},ye={class:"dialog-title"},we={class:"dialog-content"},be=e.defineComponent({__name:"modal-dialog",props:{type:{},title:{},content:{},okText:{default:"确定"},cancelText:{default:"取消"},onOk:{},onCancel:{},footer:{}},setup(o){const i=o,r=G(),t=e.computed(()=>i.title?i.title:{confirm:"提示",info:"提示",warning:"警告",error:"错误",success:"成功"}[i.type]);async function c(){i.onOk&&await i.onOk(),r.close()}async function s(){i.onCancel&&await i.onCancel(),r.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",we,e.toDisplayString(u.content),1)]),e.createElementVNode("div",{class:"dialog-footer space-x-2",style:e.normalizeStyle(u.type==="confirm"?{"justify-content":"end"}:{"border-top":"none"})},[u.footer?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(u.footer),{key:0})):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("button",{class:"submit-button",type:"submit",onClick:c},e.toDisplayString(u.okText),1),u.type==="confirm"?(e.openBlock(),e.createElementBlock("button",{key:0,class:"cancel-button",type:"button",onClick:s},e.toDisplayString(u.cancelText),1)):e.createCommentVNode("",!0)],64))],4)]))}}),ke=L(be,[["__scopeId","data-v-8326e5a5"]]),Ce={key:0,class:"modal-teleport"},_e={name:"ModalProvider",inheritAttrs:!0},xe=e.defineComponent({..._e,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:i}){const r=e.shallowRef([]),t=e.ref(!1),c=e.getCurrentInstance();function s(l,f={},a={}){const g=e.defineAsyncComponent(()=>Promise.resolve(typeof l=="string"?ke:l));typeof l=="string"&&(f.type=l,a.size="small",a.fullscreen=!1,a.mode="dialog",a.footer=!1,a.header=!1);const p=Math.random().toString(32).slice(2),C=Object.assign({zIndex:typeof l=="string"?1100:1e3},a),M=new Promise((E,$)=>{r.value.push({id:p,component:g,props:f||{},options:{...C,type:typeof l=="string"?l:"component"},resolve:E,reject:$,listeners:[]}),e.triggerRef(r)}).catch(E=>E==="CANCEL"?new Promise(()=>{}):Promise.reject(E));return Object.assign(M,{close:()=>u(p)})}function u(l,f){const a=r.value.findIndex(p=>p.id===l);if(a<0)return;const g=r.value[a];f===void 0?g==null||g.reject("CANCEL"):g==null||g.resolve(f),r.value.splice(a,1),e.triggerRef(r)}function h(){!r.value||r.value.length===0||(r.value.forEach(l=>{l==null||l.reject("CANCEL")}),r.value=[],e.triggerRef(r))}function b(l,f){const a=r.value.find(p=>p.id===l);if(!a)return;const g=a.listeners.find(p=>p.event===f);g&&g.callback({open:s,close:p=>u(a.id,p),closeAll:h,showLoading:()=>y(a.id),hideLoading:()=>v(a.id),confirm:p=>s("confirm",p),success:p=>s("success",p),error:p=>s("error",p),warning:p=>s("warning",p),info:p=>s("info",p)})}function y(l){if(!c)return;const[f]=c.refs[`modal-container_${l}`];if(f)return f.showLoading()}function v(l){if(!c)return;const[f]=c.refs[`modal-container_${l}`];if(f)return f.hideLoading()}function d(l,f,a){const g=r.value.find(p=>p.id===l);g&&g.listeners.push({event:f,callback:a})}return e.provide(V,{open:s,close:u,closeAll:h,addEventListener:d}),i({elements:r,open:s,close:u,closeAll:h}),e.onMounted(()=>{t.value=!0}),(l,f)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.renderSlot(l.$slots,"default",{},void 0,!0),t.value?(e.openBlock(),e.createElementBlock("div",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,a=>(e.openBlock(),e.createBlock(j,e.mergeProps({id:a.id,key:a.id,ref_for:!0,ref:`modal-container_${a.id}`,component:a.component,"component-props":a.props,"max-height":l.maxHeight,"max-width":l.maxWidth,offset:l.offset,sizes:l.sizes},a.options,{onSubmit:()=>b(a.id,"submit")}),null,16,["id","component","component-props","max-height","max-width","offset","sizes","onSubmit"]))),128))]),_:1})],8,["disabled","to"]))])):e.createCommentVNode("",!0)],64))}}),Ee=L(xe,[["__scopeId","data-v-756481fe"]]),Se={},Be={class:"modal-footer"};function Me(o,i){return e.openBlock(),e.createBlock(e.Teleport,{to:"#modal-footer-slot"},[e.createElementVNode("div",Be,[e.renderSlot(o.$slots,"default",{},void 0,!0)])])}const Ne=L(Se,[["render",Me],["__scopeId","data-v-2080a86e"]]),Re={},$e={class:"modal-header"};function Ve(o,i){return e.openBlock(),e.createBlock(e.Teleport,{to:"#modal-header-slot"},[e.createElementVNode("div",$e,[e.renderSlot(o.$slots,"default",{},void 0,!0)])])}const Le=L(Re,[["render",Ve],["__scopeId","data-v-d0247172"]]);function z(o,i){var t,c;let r=o==null?void 0:o.parent;for(;r&&((t=r==null?void 0:r.type)==null?void 0:t.name)!==i;)r=r.parent;return((c=r==null?void 0:r.type)==null?void 0:c.name)===i?r:null}function G(){const o=e.inject(V),i=e.getCurrentInstance();function r(t,c,s){if(!o)throw new Error("Not Found Modal Provider Component");return o.open(t,c,s)}return{open:r,close(t){var u;if(!o)throw new Error("Not Found Modal Provider Component");const c=z(i,"ModalContainer"),s=(u=c==null?void 0:c.props)==null?void 0:u.id;if(!s)throw new Error("Not Found Current Modal Container");o.close(s,t)},closeAll(){if(!o)throw new Error("Not Found Modal Provider Component");o.closeAll()},showLoading(){var s;if(!o)throw new Error("Not Found Modal Provider Component");const t=z(i,"ModalContainer");if(!((s=t==null?void 0:t.props)==null?void 0:s.id))throw new Error("Not Found Current Modal Container");t!=null&&t.exposed&&(t==null||t.exposed.showLoading())},hideLoading(){var s;if(!o)throw new Error("Not Found Modal Provider Component");const t=z(i,"ModalContainer");if(!((s=t==null?void 0:t.props)==null?void 0:s.id))throw new Error("Not Found Current Modal Container");t!=null&&t.exposed&&(t==null||t.exposed.hideLoading())},confirm(t){return this.open("confirm",t)},info(t){return this.open("info",t)},error(t){return this.open("error",t)},warning(t){return this.open("warning",t)},success(t){return this.open("success",t)}}}function Ae(o){var s;const i=e.inject(V),r=e.getCurrentInstance(),t=z(r,"ModalContainer"),c=(s=t==null?void 0:t.props)==null?void 0:s.id;i&&c&&i.addEventListener(c,"submit",o)}exports.ModalContainer=j;exports.ModalFooter=Ne;exports.ModalHeader=Le;exports.ModalKey=V;exports.ModalProvider=Ee;exports.onSubmit=Ae;exports.useModal=G;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),V=Symbol("__MODAL__");function F(o){return e.getCurrentScope()?(e.onScopeDispose(o),!0):!1}function b(o){return typeof o=="function"?o():e.unref(o)}const W=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,i={}){if(!e.isRef(o))return e.toRefs(o);const r=Array.isArray(o.value)?Array.from({length:o.value.length}):{};for(const t in o.value)r[t]=e.customRef(()=>({get(){return o.value[t]},set(c){var s;if((s=b(i.replaceRef))!=null?s:!0)if(Array.isArray(o.value)){const h=[...o.value];h[t]=c,o.value=h}else{const h={...o.value,[t]:c};Object.setPrototypeOf(h,Object.getPrototypeOf(o.value)),o.value=h}else o.value[t]=c}}));return r}function oe(o,i=!0,r){ee()?e.onMounted(o,r):i?o():e.nextTick(o)}function N(o){var i;const r=b(o);return(i=r==null?void 0:r.$el)!=null?i:r}const O=W?window:void 0;function P(...o){let i,r,t,c;if(typeof o[0]=="string"||Array.isArray(o[0])?([r,t,c]=o,i=O):[i,r,t,c]=o,!i)return Z;Array.isArray(r)||(r=[r]),Array.isArray(t)||(t=[t]);const s=[],u=()=>{s.forEach(v=>v()),s.length=0},h=(v,d,l,f)=>(v.addEventListener(d,l,f),()=>v.removeEventListener(d,l,f)),w=e.watch(()=>[N(i),b(c)],([v,d])=>{if(u(),!v)return;const l=Q(d)?{...d}:d;s.push(...r.flatMap(f=>t.map(a=>h(v,f,a,l))))},{immediate:!0,flush:"post"}),y=()=>{w(),u()};return F(y),y}function ne(){const o=e.ref(!1),i=e.getCurrentInstance();return i&&e.onMounted(()=>{o.value=!0},i),o}function re(o){const i=ne();return e.computed(()=>(i.value,!!o()))}function ie(o,i={}){var r,t;const{pointerTypes:c,preventDefault:s,stopPropagation:u,exact:h,onMove:w,onEnd:y,onStart:v,initialValue:d,axis:l="both",draggingElement:f=O,containerElement:a,handle:g=o}=i,p=e.ref((r=b(d))!=null?r:{x:0,y:0}),C=e.ref(),M=m=>c?c.includes(m.pointerType):!0,E=m=>{b(s)&&m.preventDefault(),b(u)&&m.stopPropagation()},R=m=>{var S;if(b(i.disabled)||!M(m)||b(h)&&m.target!==b(o))return;const k=b(a),B=(S=k==null?void 0:k.getBoundingClientRect)==null?void 0:S.call(k),_=b(o).getBoundingClientRect(),T={x:m.clientX-(k?_.left-B.left+k.scrollLeft:_.left),y:m.clientY-(k?_.top-B.top+k.scrollTop:_.top)};(v==null?void 0:v(T,m))!==!1&&(C.value=T,E(m))},H=m=>{if(b(i.disabled)||!M(m)||!C.value)return;const S=b(a),k=b(o).getBoundingClientRect();let{x:B,y:_}=p.value;(l==="x"||l==="both")&&(B=m.clientX-C.value.x,S&&(B=Math.min(Math.max(0,B),S.scrollWidth-k.width))),(l==="y"||l==="both")&&(_=m.clientY-C.value.y,S&&(_=Math.min(Math.max(0,_),S.scrollHeight-k.height))),p.value={x:B,y:_},w==null||w(p.value,m),E(m)},A=m=>{b(i.disabled)||!M(m)||C.value&&(C.value=void 0,y==null||y(p.value,m),E(m))};if(W){const m={capture:(t=i.capture)!=null?t:!0};P(g,"pointerdown",R,m),P(f,"pointermove",H,m),P(f,"pointerup",A,m)}return{...te(p),position:p,isDragging:e.computed(()=>!!C.value),style:e.computed(()=>`left:${p.value.x}px;top:${p.value.y}px;`)}}function le(o,i,r={}){const{window:t=O,...c}=r;let s;const u=re(()=>t&&"ResizeObserver"in t),h=()=>{s&&(s.disconnect(),s=void 0)},w=e.computed(()=>Array.isArray(o)?o.map(d=>N(d)):[N(o)]),y=e.watch(w,d=>{if(h(),u.value&&t){s=new ResizeObserver(i);for(const l of d)l&&s.observe(l,c)}},{immediate:!0,flush:"post"}),v=()=>{h(),y()};return F(v),{isSupported:u,stop:v}}function $(o,i={width:0,height:0},r={}){const{window:t=O,box:c="content-box"}=r,s=e.computed(()=>{var d,l;return(l=(d=N(o))==null?void 0:d.namespaceURI)==null?void 0:l.includes("svg")}),u=e.ref(i.width),h=e.ref(i.height),{stop:w}=le(o,([d])=>{const l=c==="border-box"?d.borderBoxSize:c==="content-box"?d.contentBoxSize:d.devicePixelContentBoxSize;if(t&&s.value){const f=N(o);if(f){const a=t.getComputedStyle(f);u.value=Number.parseFloat(a.width),h.value=Number.parseFloat(a.height)}}else if(l){const f=Array.isArray(l)?l:[l];u.value=f.reduce((a,{inlineSize:g})=>a+g,0),h.value=f.reduce((a,{blockSize:g})=>a+g,0)}else u.value=d.contentRect.width,h.value=d.contentRect.height},r);oe(()=>{const d=N(o);d&&(u.value="offsetWidth"in d?d.offsetWidth:i.width,h.value="offsetHeight"in d?d.offsetHeight:i.height)});const y=e.watch(()=>N(o),d=>{u.value=d?i.width:0,h.value=d?i.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:i,emit:r}){e.useCssVars(n=>({"5751bf6b":n.zIndex}));const t=o,c=r,s=e.inject(V),u=e.ref(!1);let h=0,w=0;const y=e.shallowRef(),v=e.shallowRef(),d=e.shallowRef(),l=e.shallowRef(),f=e.shallowRef(),a=e.shallowRef(),{height:g}=$(y),{height:p}=$(d,void 0,{box:"border-box"}),{height:C}=$(l,void 0,{box:"border-box"}),{height:M}=$(f),{height:E}=$(a),{x:R,y:H}=ie(d,{initialValue:{x:0,y:0}});function A(){s==null||s.close(t.id)}function m(n){return typeof n=="number"?`${n}px`:n}const S=e.computed(()=>{const n={};return t.mode==="dialog"&&(n.justifyContent="center"),t.mode==="drawer"&&(n.justifyContent={left:"flex-start",right:"flex-end",top:"flex-start",bottom:"flex-end"}[t.position],n.flexDirection={left:"row",right:"row",top:"column",bottom:"column"}[t.position]),n}),k=e.computed(()=>{const n={};return t.mode==="drawer"&&["top","bottom"].includes(t.position)?n.maxHeight=m(t.maxHeight):(n.width=m(t.sizes[t.size]),n.maxWidth=m(t.maxWidth)),t.width&&(n.width=m(t.width)),t.height&&(n.height=m(t.height)),t.fullscreen&&(n.maxWidth="unset",n.width="100%",n.position="fixed",n.top=0,n.left=0,n.bottom=0,n.right=0,n.borderRadius=0),t.draggable&&!t.fullscreen&&t.mode==="dialog"&&(n.transform=`translate3d(${R.value-h}px, ${H.value-w}px, 0px)`),t.mode==="drawer"&&(n.borderRadius=0,["left","right"].includes(t.position)?n.height="100%":n.width="100%"),t.offset&&t.mode==="dialog"&&(n.marginLeft=`${t.offset.x||0}px`,n.marginTop=`${t.offset.y||0}px`),t.backgroundColor&&(n.backgroundColor=t.backgroundColor),n}),B=e.computed(()=>{const n={};return t.draggable&&!t.fullscreen&&t.mode==="dialog"&&(n.cursor="move"),n}),_=e.computed(()=>{const n={},x=M.value+E.value+p.value+C.value,I=Math.floor(g.value*(Number(m(t.maxHeight).replace("%",""))/100));return t.maxHeight&&(n.maxHeight=`${I-x}px`),t.mode==="drawer"&&(n.maxHeight="unset",["left","right"].includes(t.position)&&(n.height=`${g.value-x}px`)),t.fullscreen&&(n.maxHeight="unset",n.height=`calc(100% - ${x}px)`),t.type!=="component"&&(n.padding="0"),t.bodyStyle&&Object.assign(n,t.bodyStyle),n});function T(){const n=v.value;if(t.form&&n){const x=n.querySelector(`form[name="${t.form}"]`);x&&x.dispatchEvent(new Event("submit"))}c("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 n=({key:x})=>{x==="Escape"&&(s==null||s.close(t.id),window.removeEventListener("keydown",n))};window.addEventListener("keydown",n)}}function q(){h=v.value.offsetLeft,w=v.value.offsetTop}e.onMounted(()=>{Y(),X()}),e.onUnmounted(()=>{});function U(){return u.value=!0,()=>D()}function D(){u.value=!1}return i({showLoading:U,hideLoading:D}),(n,x)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"wrapperRef",ref:y,class:"modal-wrapper",style:e.normalizeStyle(S.value),onClick:x[0]||(x[0]=e.withModifiers(I=>n.maskClosable&&A(),["self"]))},[e.createElementVNode("div",{ref_key:"contentRef",ref:v,class:e.normalizeClass(["modal-content",{[`${n.mode}-mode`]:!0,[`${n.position}-position`]:!0}]),style:e.normalizeStyle(k.value)},[n.header?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"headerRef",ref:d,class:"modal-header",style:e.normalizeStyle(B.value),onMousedown:q},[e.createElementVNode("div",ae,e.toDisplayString(n.title),1),e.createElementVNode("div",ce,[n.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:f},null,512),e.createElementVNode("div",{class:"modal-body",style:e.normalizeStyle(_.value)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.component),e.normalizeProps(e.guardReactiveProps(n.componentProps)),null,16))],4),e.createElementVNode("div",{id:"modal-footer-slot",ref_key:"footerSlotRef",ref:a},null,512),n.footer?(e.openBlock(),e.createElementBlock("div",{key:1,ref_key:"footerRef",ref:l,class:"modal-footer space-x-2"},[e.createElementVNode("button",{class:"cancel-button",type:"button",onClick:K},e.toDisplayString(n.cancelText),1),e.createElementVNode("button",{class:"submit-button",form:n.form,type:"submit",onClick:T},e.toDisplayString(n.submitText),9,de)],512)):e.createCommentVNode("",!0),u.value?(e.openBlock(),e.createElementBlock("div",ue,pe)):e.createCommentVNode("",!0)],6)],4))}}),L=(o,i)=>{const r=o.__vccOpts||o;for(const[t,c]of i)r[t]=c;return r},j=L(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 i=o,r=G(),t=e.computed(()=>i.title?i.title:{confirm:"提示",info:"提示",warning:"警告",error:"错误",success:"成功"}[i.type]);async function c(){i.onOk&&await i.onOk(),r.close()}async function s(){i.onCancel&&await i.onCancel(),r.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:c},e.toDisplayString(u.okText),1),u.type==="confirm"?(e.openBlock(),e.createElementBlock("button",{key:0,class:"cancel-button",type:"button",onClick:s},e.toDisplayString(u.cancelText),1)):e.createCommentVNode("",!0)],64))],4)]))}}),ke=L(we,[["__scopeId","data-v-0c6b8db2"]]),Ce={key:0,class:"modal-teleport"},_e={name:"ModalProvider",inheritAttrs:!0},xe=e.defineComponent({..._e,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:i}){const r=e.shallowRef([]),t=e.ref(!1),c=e.getCurrentInstance();function s(l,f={},a={}){const g=e.defineAsyncComponent(()=>Promise.resolve(typeof l=="string"?ke:l));typeof l=="string"&&(f.type=l,a.size="small",a.fullscreen=!1,a.mode="dialog",a.footer=!1,a.header=!1);const p=Math.random().toString(32).slice(2),C=Object.assign({zIndex:typeof l=="string"?1100:1e3},a),M=new Promise((E,R)=>{r.value.push({id:p,component:g,props:f||{},options:{...C,type:typeof l=="string"?l:"component"},resolve:E,reject:R,listeners:[]}),e.triggerRef(r)}).catch(E=>E==="CANCEL"?new Promise(()=>{}):Promise.reject(E));return Object.assign(M,{close:()=>u(p)})}function u(l,f){const a=r.value.findIndex(p=>p.id===l);if(a<0)return;const g=r.value[a];f===void 0?g==null||g.reject("CANCEL"):g==null||g.resolve(f),r.value.splice(a,1),e.triggerRef(r)}function h(){!r.value||r.value.length===0||(r.value.forEach(l=>{l==null||l.reject("CANCEL")}),r.value=[],e.triggerRef(r))}function w(l,f){const a=r.value.find(p=>p.id===l);if(!a)return;const g=a.listeners.find(p=>p.event===f);g&&g.callback({open:s,close:p=>u(a.id,p),closeAll:h,showLoading:()=>y(a.id),hideLoading:()=>v(a.id),confirm:p=>s("confirm",p),success:p=>s("success",p),error:p=>s("error",p),warning:p=>s("warning",p),info:p=>s("info",p)})}function y(l){if(!c)return;const[f]=c.refs[`modal-container_${l}`];if(f)return f.showLoading()}function v(l){if(!c)return;const[f]=c.refs[`modal-container_${l}`];if(f)return f.hideLoading()}function d(l,f,a){const g=r.value.find(p=>p.id===l);g&&g.listeners.push({event:f,callback:a})}return e.provide(V,{open:s,close:u,closeAll:h,addEventListener:d}),i({elements:r,open:s,close:u,closeAll:h}),e.onMounted(()=>{t.value=!0}),(l,f)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.renderSlot(l.$slots,"default",{},void 0,!0),t.value?(e.openBlock(),e.createElementBlock("div",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,a=>(e.openBlock(),e.createBlock(j,e.mergeProps({id:a.id,key:a.id,ref_for:!0,ref:`modal-container_${a.id}`,component:a.component,"component-props":a.props,"max-height":l.maxHeight,"max-width":l.maxWidth,offset:l.offset,sizes:l.sizes},a.options,{onSubmit:()=>w(a.id,"submit")}),null,16,["id","component","component-props","max-height","max-width","offset","sizes","onSubmit"]))),128))]),_:1})],8,["disabled","to"]))])):e.createCommentVNode("",!0)],64))}}),Ee=L(xe,[["__scopeId","data-v-756481fe"]]),Se={},Be={class:"modal-footer"};function Me(o,i){return e.openBlock(),e.createBlock(e.Teleport,{to:"#modal-footer-slot"},[e.createElementVNode("div",Be,[e.renderSlot(o.$slots,"default",{},void 0,!0)])])}const Ne=L(Se,[["render",Me],["__scopeId","data-v-46f8d703"]]),Re={},$e={class:"modal-header"};function Ve(o,i){return e.openBlock(),e.createBlock(e.Teleport,{to:"#modal-header-slot"},[e.createElementVNode("div",$e,[e.renderSlot(o.$slots,"default",{},void 0,!0)])])}const Le=L(Re,[["render",Ve],["__scopeId","data-v-d0247172"]]);function z(o,i){var t,c;let r=o==null?void 0:o.parent;for(;r&&((t=r==null?void 0:r.type)==null?void 0:t.name)!==i;)r=r.parent;return((c=r==null?void 0:r.type)==null?void 0:c.name)===i?r:null}function G(){const o=e.inject(V),i=e.getCurrentInstance();function r(t,c,s){if(!o)throw new Error("Not Found Modal Provider Component");return o.open(t,c,s)}return{open:r,close(t){var u;if(!o)throw new Error("Not Found Modal Provider Component");const c=z(i,"ModalContainer"),s=(u=c==null?void 0:c.props)==null?void 0:u.id;if(!s)throw new Error("Not Found Current Modal Container");o.close(s,t)},closeAll(){if(!o)throw new Error("Not Found Modal Provider Component");o.closeAll()},showLoading(){var s;if(!o)throw new Error("Not Found Modal Provider Component");const t=z(i,"ModalContainer");if(!((s=t==null?void 0:t.props)==null?void 0:s.id))throw new Error("Not Found Current Modal Container");t!=null&&t.exposed&&(t==null||t.exposed.showLoading())},hideLoading(){var s;if(!o)throw new Error("Not Found Modal Provider Component");const t=z(i,"ModalContainer");if(!((s=t==null?void 0:t.props)==null?void 0:s.id))throw new Error("Not Found Current Modal Container");t!=null&&t.exposed&&(t==null||t.exposed.hideLoading())},confirm(t){return this.open("confirm",t)},info(t){return this.open("info",t)},error(t){return this.open("error",t)},warning(t){return this.open("warning",t)},success(t){return this.open("success",t)}}}function Ae(o){var s;const i=e.inject(V),r=e.getCurrentInstance(),t=z(r,"ModalContainer"),c=(s=t==null?void 0:t.props)==null?void 0:s.id;i&&c&&i.addEventListener(c,"submit",o)}exports.ModalContainer=j;exports.ModalFooter=Ne;exports.ModalHeader=Le;exports.ModalKey=V;exports.ModalProvider=Ee;exports.onSubmit=Ae;exports.useModal=G;
package/dist/es/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { unref as he, isRef as me, toRefs as ve, customRef as ge, onMounted as Y, nextTick as ye, getCurrentScope as be, onScopeDispose as we, getCurrentInstance as F, ref as H, computed as E, watch as Z, defineComponent as ee, useCssVars as _e, inject as te, shallowRef as O, onUnmounted as xe, openBlock as y, createElementBlock as S, normalizeStyle as W, withModifiers as Ce, createElementVNode as g, normalizeClass as ke, toDisplayString as T, createCommentVNode as P, createBlock as N, resolveDynamicComponent as ie, normalizeProps as Me, guardReactiveProps as Se, triggerRef as D, pushScopeId as $e, popScopeId as Ee, Fragment as Q, provide as Le, renderSlot as oe, Teleport as ne, createVNode as Ae, TransitionGroup as Re, withCtx as Oe, renderList as Te, mergeProps as Be, defineAsyncComponent as He } from "vue";
1
+ import { unref as he, isRef as me, toRefs as ve, customRef as ge, onMounted as Y, nextTick as ye, getCurrentScope as be, onScopeDispose as we, getCurrentInstance as F, ref as H, computed as E, watch as Z, defineComponent as ee, useCssVars as _e, inject as te, shallowRef as O, onUnmounted as xe, openBlock as y, createElementBlock as S, normalizeStyle as W, withModifiers as Ce, createElementVNode as g, normalizeClass as ke, toDisplayString as T, createCommentVNode as z, createBlock as P, resolveDynamicComponent as ie, normalizeProps as Me, guardReactiveProps as Se, triggerRef as D, pushScopeId as $e, popScopeId as Ee, Fragment as Q, provide as Le, renderSlot as oe, Teleport as ne, createVNode as Ae, TransitionGroup as Re, withCtx as Oe, renderList as Te, mergeProps as Be, defineAsyncComponent as He } from "vue";
2
2
  const K = Symbol("__MODAL__");
3
3
  function le(t) {
4
4
  return be() ? (we(t), !0) : !1;
@@ -99,7 +99,7 @@ function je(t, r = {}) {
99
99
  (n = w(d)) != null ? n : { x: 0, y: 0 }
100
100
  ), C = H(), R = (p) => a ? a.includes(p.pointerType) : !0, $ = (p) => {
101
101
  w(i) && p.preventDefault(), w(c) && p.stopPropagation();
102
- }, I = (p) => {
102
+ }, N = (p) => {
103
103
  var L;
104
104
  if (w(r.disabled) || !R(p) || w(h) && p.target !== w(t))
105
105
  return;
@@ -122,7 +122,7 @@ function je(t, r = {}) {
122
122
  };
123
123
  if (ae) {
124
124
  const p = { capture: (e = r.capture) != null ? e : !0 };
125
- J(v, "pointerdown", I, p), J(u, "pointermove", q, p), J(u, "pointerup", j, p);
125
+ J(v, "pointerdown", N, p), J(u, "pointermove", q, p), J(u, "pointerup", j, p);
126
126
  }
127
127
  return {
128
128
  ...We(f),
@@ -156,7 +156,7 @@ function Ge(t, r, n = {}) {
156
156
  stop: m
157
157
  };
158
158
  }
159
- function z(t, r = { width: 0, height: 0 }, n = {}) {
159
+ function I(t, r = { width: 0, height: 0 }, n = {}) {
160
160
  const { window: e = U, box: a = "content-box" } = n, i = E(() => {
161
161
  var d, s;
162
162
  return (s = (d = B(t)) == null ? void 0 : d.namespaceURI) == null ? void 0 : s.includes("svg");
@@ -197,7 +197,7 @@ function z(t, r = { width: 0, height: 0 }, n = {}) {
197
197
  stop: m
198
198
  };
199
199
  }
200
- const Xe = (t) => ($e("data-v-a1713ed1"), t = t(), Ee(), t), Ye = { class: "title text-16px font-bold" }, Ke = { class: "action" }, Ue = ["form"], qe = {
200
+ const Xe = (t) => ($e("data-v-9a7af353"), t = t(), Ee(), t), Ye = { class: "title text-16px font-bold" }, Ke = { class: "action" }, Ue = ["form"], qe = {
201
201
  key: 2,
202
202
  class: "modal-loading"
203
203
  }, Je = /* @__PURE__ */ Xe(() => /* @__PURE__ */ g("div", { class: "lds-ring" }, [
@@ -244,13 +244,11 @@ const Xe = (t) => ($e("data-v-a1713ed1"), t = t(), Ee(), t), Ye = { class: "titl
244
244
  emits: ["submit"],
245
245
  setup(t, { expose: r, emit: n }) {
246
246
  _e((o) => ({
247
- "1c652152": o.zIndex
247
+ "5751bf6b": o.zIndex
248
248
  }));
249
249
  const e = t, a = n, i = te(K), c = H(!1);
250
250
  let h = 0, _ = 0;
251
- const b = O(), m = O(), d = O(), s = O(), u = O(), l = O(), { height: v } = z(b);
252
- z(m);
253
- const { height: f } = z(d, void 0, { box: "border-box" }), { height: C } = z(s, void 0, { box: "border-box" }), { height: R } = z(u), { height: $ } = z(l), { x: I, y: q } = je(d, {
251
+ const b = O(), m = O(), d = O(), s = O(), u = O(), l = O(), { height: v } = I(b), { height: f } = I(d, void 0, { box: "border-box" }), { height: C } = I(s, void 0, { box: "border-box" }), { height: R } = I(u), { height: $ } = I(l), { x: N, y: q } = je(d, {
254
252
  initialValue: { x: 0, y: 0 }
255
253
  });
256
254
  function j() {
@@ -274,7 +272,7 @@ const Xe = (t) => ($e("data-v-a1713ed1"), t = t(), Ee(), t), Ye = { class: "titl
274
272
  }[e.position]), o;
275
273
  }), x = E(() => {
276
274
  const o = {};
277
- return e.mode === "drawer" && ["top", "bottom"].includes(e.position) ? o.maxHeight = p(e.maxHeight) : (o.width = p(e.sizes[e.size]), o.maxWidth = p(e.maxWidth)), e.width && (o.width = p(e.width)), e.height && (o.height = p(e.height)), e.fullscreen && (o.maxWidth = "unset", o.width = "100%", o.position = "fixed", o.top = 0, o.left = 0, o.bottom = 0, o.right = 0, o.borderRadius = 0), e.draggable && !e.fullscreen && e.mode === "dialog" && (o.transform = `translate3d(${I.value - h}px, ${q.value - _}px, 0px)`), e.mode === "drawer" && (o.borderRadius = 0, ["left", "right"].includes(e.position) ? o.height = "100%" : o.width = "100%"), e.offset && e.mode === "dialog" && (o.marginLeft = `${e.offset.x || 0}px`, o.marginTop = `${e.offset.y || 0}px`), e.backgroundColor && (o.backgroundColor = e.backgroundColor), o;
275
+ return e.mode === "drawer" && ["top", "bottom"].includes(e.position) ? o.maxHeight = p(e.maxHeight) : (o.width = p(e.sizes[e.size]), o.maxWidth = p(e.maxWidth)), e.width && (o.width = p(e.width)), e.height && (o.height = p(e.height)), e.fullscreen && (o.maxWidth = "unset", o.width = "100%", o.position = "fixed", o.top = 0, o.left = 0, o.bottom = 0, o.right = 0, o.borderRadius = 0), e.draggable && !e.fullscreen && e.mode === "dialog" && (o.transform = `translate3d(${N.value - h}px, ${q.value - _}px, 0px)`), e.mode === "drawer" && (o.borderRadius = 0, ["left", "right"].includes(e.position) ? o.height = "100%" : o.width = "100%"), e.offset && e.mode === "dialog" && (o.marginLeft = `${e.offset.x || 0}px`, o.marginTop = `${e.offset.y || 0}px`), e.backgroundColor && (o.backgroundColor = e.backgroundColor), o;
278
276
  }), A = E(() => {
279
277
  const o = {};
280
278
  return e.draggable && !e.fullscreen && e.mode === "dialog" && (o.cursor = "move"), o;
@@ -349,9 +347,9 @@ const Xe = (t) => ($e("data-v-a1713ed1"), t = t(), Ee(), t), Ye = { class: "titl
349
347
  key: 0,
350
348
  class: "i-icon-park-outline:close block cursor-pointer",
351
349
  onClick: j
352
- })) : P("", !0)
350
+ })) : z("", !0)
353
351
  ])
354
- ], 36)) : P("", !0),
352
+ ], 36)) : z("", !0),
355
353
  g("div", {
356
354
  id: "modal-header-slot",
357
355
  ref_key: "headerSlotRef",
@@ -361,7 +359,7 @@ const Xe = (t) => ($e("data-v-a1713ed1"), t = t(), Ee(), t), Ye = { class: "titl
361
359
  class: "modal-body",
362
360
  style: W(k.value)
363
361
  }, [
364
- (y(), N(ie(o.component), Me(Se(o.componentProps)), null, 16))
362
+ (y(), P(ie(o.component), Me(Se(o.componentProps)), null, 16))
365
363
  ], 4),
366
364
  g("div", {
367
365
  id: "modal-footer-slot",
@@ -385,8 +383,8 @@ const Xe = (t) => ($e("data-v-a1713ed1"), t = t(), Ee(), t), Ye = { class: "titl
385
383
  type: "submit",
386
384
  onClick: G
387
385
  }, T(o.submitText), 9, Ue)
388
- ], 512)) : P("", !0),
389
- c.value ? (y(), S("div", qe, Qe)) : P("", !0)
386
+ ], 512)) : z("", !0),
387
+ c.value ? (y(), S("div", qe, Qe)) : z("", !0)
390
388
  ], 6)
391
389
  ], 4));
392
390
  }
@@ -395,7 +393,7 @@ const Xe = (t) => ($e("data-v-a1713ed1"), t = t(), Ee(), t), Ye = { class: "titl
395
393
  for (const [e, a] of r)
396
394
  n[e] = a;
397
395
  return n;
398
- }, tt = /* @__PURE__ */ V(et, [["__scopeId", "data-v-a1713ed1"]]), ot = { class: "modal-dialog" }, nt = { class: "dialog-body" }, rt = { class: "dialog-title" }, st = { class: "dialog-content" }, it = /* @__PURE__ */ ee({
396
+ }, tt = /* @__PURE__ */ V(et, [["__scopeId", "data-v-9a7af353"]]), ot = { class: "modal-dialog" }, nt = { class: "dialog-body" }, rt = { class: "dialog-title" }, st = { class: "dialog-content" }, it = /* @__PURE__ */ ee({
399
397
  __name: "modal-dialog",
400
398
  props: {
401
399
  type: {},
@@ -430,7 +428,7 @@ const Xe = (t) => ($e("data-v-a1713ed1"), t = t(), Ee(), t), Ye = { class: "titl
430
428
  class: "dialog-footer space-x-2",
431
429
  style: W(c.type === "confirm" ? { "justify-content": "end" } : { "border-top": "none" })
432
430
  }, [
433
- c.footer ? (y(), N(ie(c.footer), { key: 0 })) : (y(), S(Q, { key: 1 }, [
431
+ c.footer ? (y(), P(ie(c.footer), { key: 0 })) : (y(), S(Q, { key: 1 }, [
434
432
  g("button", {
435
433
  class: "submit-button",
436
434
  type: "submit",
@@ -441,12 +439,12 @@ const Xe = (t) => ($e("data-v-a1713ed1"), t = t(), Ee(), t), Ye = { class: "titl
441
439
  class: "cancel-button",
442
440
  type: "button",
443
441
  onClick: i
444
- }, T(c.cancelText), 1)) : P("", !0)
442
+ }, T(c.cancelText), 1)) : z("", !0)
445
443
  ], 64))
446
444
  ], 4)
447
445
  ]));
448
446
  }
449
- }), lt = /* @__PURE__ */ V(it, [["__scopeId", "data-v-8326e5a5"]]), at = {
447
+ }), lt = /* @__PURE__ */ V(it, [["__scopeId", "data-v-0c6b8db2"]]), at = {
450
448
  key: 0,
451
449
  class: "modal-teleport"
452
450
  }, dt = {
@@ -474,7 +472,7 @@ const Xe = (t) => ($e("data-v-a1713ed1"), t = t(), Ee(), t), Ye = { class: "titl
474
472
  typeof s == "string" && (u.type = s, l.size = "small", l.fullscreen = !1, l.mode = "dialog", l.footer = !1, l.header = !1);
475
473
  const f = Math.random().toString(32).slice(2), C = Object.assign({
476
474
  zIndex: typeof s == "string" ? 1100 : 1e3
477
- }, l), R = new Promise(($, I) => {
475
+ }, l), R = new Promise(($, N) => {
478
476
  n.value.push({
479
477
  id: f,
480
478
  component: v,
@@ -484,7 +482,7 @@ const Xe = (t) => ($e("data-v-a1713ed1"), t = t(), Ee(), t), Ye = { class: "titl
484
482
  type: typeof s == "string" ? s : "component"
485
483
  },
486
484
  resolve: $,
487
- reject: I,
485
+ reject: N,
488
486
  listeners: []
489
487
  }), D(n);
490
488
  }).catch(($) => $ === "CANCEL" ? new Promise(() => {
@@ -559,13 +557,13 @@ const Xe = (t) => ($e("data-v-a1713ed1"), t = t(), Ee(), t), Ye = { class: "titl
559
557
  }), (s, u) => (y(), S(Q, null, [
560
558
  oe(s.$slots, "default", {}, void 0, !0),
561
559
  e.value ? (y(), S("div", at, [
562
- (y(), N(ne, {
560
+ (y(), P(ne, {
563
561
  disabled: !s.appendToBody,
564
562
  to: typeof s.appendToBody == "string" ? s.appendToBody : "body"
565
563
  }, [
566
564
  Ae(Re, { name: "modal-fade" }, {
567
565
  default: Oe(() => [
568
- (y(!0), S(Q, null, Te(n.value, (l) => (y(), N(tt, Be({
566
+ (y(!0), S(Q, null, Te(n.value, (l) => (y(), P(tt, Be({
569
567
  id: l.id,
570
568
  key: l.id,
571
569
  ref_for: !0,
@@ -583,20 +581,20 @@ const Xe = (t) => ($e("data-v-a1713ed1"), t = t(), Ee(), t), Ye = { class: "titl
583
581
  _: 1
584
582
  })
585
583
  ], 8, ["disabled", "to"]))
586
- ])) : P("", !0)
584
+ ])) : z("", !0)
587
585
  ], 64));
588
586
  }
589
587
  }), bt = /* @__PURE__ */ V(ct, [["__scopeId", "data-v-756481fe"]]), ut = {}, ft = { class: "modal-footer" };
590
588
  function pt(t, r) {
591
- return y(), N(ne, { to: "#modal-footer-slot" }, [
589
+ return y(), P(ne, { to: "#modal-footer-slot" }, [
592
590
  g("div", ft, [
593
591
  oe(t.$slots, "default", {}, void 0, !0)
594
592
  ])
595
593
  ]);
596
594
  }
597
- const wt = /* @__PURE__ */ V(ut, [["render", pt], ["__scopeId", "data-v-2080a86e"]]), ht = {}, mt = { class: "modal-header" };
595
+ const wt = /* @__PURE__ */ V(ut, [["render", pt], ["__scopeId", "data-v-46f8d703"]]), ht = {}, mt = { class: "modal-header" };
598
596
  function vt(t, r) {
599
- return y(), N(ne, { to: "#modal-header-slot" }, [
597
+ return y(), P(ne, { to: "#modal-header-slot" }, [
600
598
  g("div", mt, [
601
599
  oe(t.$slots, "default", {}, void 0, !0)
602
600
  ])
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- *,:before,:after{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / .5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }::backdrop{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / .5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }.i-icon-park-outline\:close{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 48 48' width='1em' height='1em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='4' d='m8 8l32 32M8 40L40 8'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1em;height:1em}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.transform{transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.cursor-pointer{cursor:pointer}.resize{resize:both}.space-x-2>:not([hidden])~:not([hidden]){--un-space-x-reverse:0;margin-left:calc(.5rem * calc(1 - var(--un-space-x-reverse)));margin-right:calc(.5rem * var(--un-space-x-reverse))}.border{border-width:1px}.px{padding-left:1rem;padding-right:1rem}.text-16px{font-size:16px}.font-bold{font-weight:700}.outline{outline-style:solid}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.ease{transition-timing-function:cubic-bezier(.4,0,.2,1)}.modal-wrapper[data-v-a1713ed1]{z-index:var(--1c652152);position:fixed;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;background:#0000004d}.modal-content[data-v-a1713ed1]{background:#fff;border-radius:5px;position:relative}.modal-header[data-v-a1713ed1]{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-a1713ed1]{padding:10px;box-sizing:border-box;overflow:auto;position:relative}.modal-footer[data-v-a1713ed1]{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-a1713ed1]{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-a1713ed1]{color:#fff;background-color:rgb(var(--primary-6, 45, 106, 251))}.modal-footer button.submit-button[data-v-a1713ed1]:hover{background-color:rgb(var(--primary-5, 28, 76, 207))}.modal-footer button.cancel-button[data-v-a1713ed1]{color:rgb(var(--color-text-2, 78, 89, 105));background-color:var(--color-fill-1, #f5f5f5)}.modal-footer button.cancel-button[data-v-a1713ed1]:hover{background-color:var(--color-fill-4, #c9cdd4)}.modal-loading[data-v-a1713ed1]{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-a1713ed1]{display:inline-block;position:relative;width:80px;height:80px}.modal-loading .lds-ring div[data-v-a1713ed1]{box-sizing:border-box;display:block;position:absolute;width:48px;height:48px;margin:8px;border:5px solid #fff;border-radius:50%;animation:lds-ring-a1713ed1 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:#fff transparent transparent transparent}.modal-loading .lds-ring div[data-v-a1713ed1]:nth-child(1){animation-delay:-.45s}.modal-loading .lds-ring div[data-v-a1713ed1]:nth-child(2){animation-delay:-.3s}.modal-loading .lds-ring div[data-v-a1713ed1]:nth-child(3){animation-delay:-.15s}@keyframes lds-ring-a1713ed1{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-756481fe],.modal-fade-leave-active[data-v-756481fe]{transition:opacity .5s ease}.modal-fade-enter-active[data-v-756481fe] .modal-content.drawer-mode,.modal-fade-leave-active[data-v-756481fe] .modal-content.drawer-mode{transition:transform .5s ease}.modal-fade-enter-from[data-v-756481fe],.modal-fade-leave-to[data-v-756481fe]{opacity:0}.modal-fade-enter-from[data-v-756481fe] .modal-content.drawer-mode.left-position,.modal-fade-leave-to[data-v-756481fe] .modal-content.drawer-mode.left-position{transform:translate3d(-100%,0,0)}.modal-fade-enter-from[data-v-756481fe] .modal-content.drawer-mode.right-position,.modal-fade-leave-to[data-v-756481fe] .modal-content.drawer-mode.right-position{transform:translate3d(100%,0,0)}.modal-fade-enter-from[data-v-756481fe] .modal-content.drawer-mode.top-position,.modal-fade-leave-to[data-v-756481fe] .modal-content.drawer-mode.top-position{transform:translate3d(0,-100%,0)}.modal-fade-enter-from[data-v-756481fe] .modal-content.drawer-mode.bottom-position,.modal-fade-leave-to[data-v-756481fe] .modal-content.drawer-mode.bottom-position{transform:translate3d(0,100%,0)}.modal-footer[data-v-2080a86e]{box-sizing:border-box;min-height:50px;border-top:solid 1px var(--color-border-1, rgb(232, 232, 232));padding:10px}.modal-footer button[data-v-2080a86e]{height:28px;line-height:28px;width:80px;outline:none;border-color:transparent;font-size:14px;border-radius:4px;padding:0;box-sizing:content-box}.modal-footer button.submit-button[data-v-2080a86e]{color:#fff;background-color:rgb(var(--primary-6, 45, 106, 251))}.modal-footer button.submit-button[data-v-2080a86e]:hover{background-color:rgb(var(--primary-5, 28, 76, 207))}.modal-footer button.cancel-button[data-v-2080a86e]{color:rgb(var(--color-text-2, 78, 89, 105));background-color:var(--color-fill-1, #f5f5f5)}.modal-footer button.cancel-button[data-v-2080a86e]:hover{background-color:var(--color-fill-4, #c9cdd4)}.modal-header[data-v-d0247172]{box-sizing:border-box;padding:10px;min-height:50px;border-bottom:solid 1px var(--color-border-1, rgb(232, 232, 232));color:var(--color-text-2, #4E5969)}
1
+ *,:before,:after{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / .5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }::backdrop{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / .5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }.i-icon-park-outline\:close{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 48 48' width='1em' height='1em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='4' d='m8 8l32 32M8 40L40 8'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1em;height:1em}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.transform{transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.cursor-pointer{cursor:pointer}.resize{resize:both}.space-x-2>:not([hidden])~:not([hidden]){--un-space-x-reverse:0;margin-left:calc(.5rem * calc(1 - var(--un-space-x-reverse)));margin-right:calc(.5rem * var(--un-space-x-reverse))}.border{border-width:1px}.px{padding-left:1rem;padding-right:1rem}.text-16px{font-size:16px}.font-bold{font-weight:700}.outline{outline-style:solid}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.ease{transition-timing-function:cubic-bezier(.4,0,.2,1)}.modal-wrapper[data-v-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-fade-enter-active[data-v-756481fe],.modal-fade-leave-active[data-v-756481fe]{transition:opacity .5s ease}.modal-fade-enter-active[data-v-756481fe] .modal-content.drawer-mode,.modal-fade-leave-active[data-v-756481fe] .modal-content.drawer-mode{transition:transform .5s ease}.modal-fade-enter-from[data-v-756481fe],.modal-fade-leave-to[data-v-756481fe]{opacity:0}.modal-fade-enter-from[data-v-756481fe] .modal-content.drawer-mode.left-position,.modal-fade-leave-to[data-v-756481fe] .modal-content.drawer-mode.left-position{transform:translate3d(-100%,0,0)}.modal-fade-enter-from[data-v-756481fe] .modal-content.drawer-mode.right-position,.modal-fade-leave-to[data-v-756481fe] .modal-content.drawer-mode.right-position{transform:translate3d(100%,0,0)}.modal-fade-enter-from[data-v-756481fe] .modal-content.drawer-mode.top-position,.modal-fade-leave-to[data-v-756481fe] .modal-content.drawer-mode.top-position{transform:translate3d(0,-100%,0)}.modal-fade-enter-from[data-v-756481fe] .modal-content.drawer-mode.bottom-position,.modal-fade-leave-to[data-v-756481fe] .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.38",
4
+ "version": "0.0.40",
5
5
  "author": {
6
6
  "name": "zhuchentong",
7
7
  "email": "2037630@gmail.com"
@@ -56,6 +56,7 @@
56
56
  "@unocss/preset-icons": "^0.59.4",
57
57
  "@unocss/preset-uno": "^0.59.4",
58
58
  "@vitejs/plugin-vue": "5.0.4",
59
+ "@vitejs/plugin-vue-jsx": "^3.1.0",
59
60
  "@vue/compiler-sfc": "3.4.23",
60
61
  "@vueuse/core": "^10.9.0",
61
62
  "less": "^4.2.0",