@gopowerteam/modal-render 0.0.40 → 0.0.42
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.
- package/dist/cjs/components/modal-loading.vue.d.ts +29 -0
- package/dist/cjs/hooks/use-modal.d.ts +2 -2
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/interfaces.d.ts +6 -0
- package/dist/es/components/modal-loading.vue.d.ts +29 -0
- package/dist/es/hooks/use-modal.d.ts +2 -2
- package/dist/es/index.mjs +304 -272
- package/dist/es/interfaces.d.ts +6 -0
- package/dist/style.css +1 -1
- package/package.json +6 -6
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
2
|
+
text?: string | undefined;
|
|
3
|
+
}>, {
|
|
4
|
+
text: string;
|
|
5
|
+
}>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
6
|
+
text?: string | undefined;
|
|
7
|
+
}>, {
|
|
8
|
+
text: string;
|
|
9
|
+
}>>>, {
|
|
10
|
+
text: string;
|
|
11
|
+
}, {}>;
|
|
12
|
+
export default _default;
|
|
13
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
14
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
15
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
16
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
17
|
+
} : {
|
|
18
|
+
type: import('vue').PropType<T[K]>;
|
|
19
|
+
required: true;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
type __VLS_WithDefaults<P, D> = {
|
|
23
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
24
|
+
default: D[K];
|
|
25
|
+
}> : P[K];
|
|
26
|
+
};
|
|
27
|
+
type __VLS_Prettify<T> = {
|
|
28
|
+
[K in keyof T]: T[K];
|
|
29
|
+
} & {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OpenModalOptions } from '../interfaces';
|
|
1
|
+
import { OpenModalOptions, ShowLoadingOptions } from '../interfaces';
|
|
2
2
|
import { Component } from 'vue';
|
|
3
3
|
|
|
4
4
|
export declare function useModal(): {
|
|
@@ -24,7 +24,7 @@ export declare function useModal(): {
|
|
|
24
24
|
};
|
|
25
25
|
close(data?: any): void;
|
|
26
26
|
closeAll(): void;
|
|
27
|
-
showLoading(): void;
|
|
27
|
+
showLoading(options?: ShowLoadingOptions): () => void;
|
|
28
28
|
hideLoading(): void;
|
|
29
29
|
confirm(props: {
|
|
30
30
|
title?: string;
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -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 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;
|
|
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;
|
package/dist/cjs/interfaces.d.ts
CHANGED
|
@@ -6,6 +6,10 @@ export interface SizeOptions {
|
|
|
6
6
|
middle: string | number;
|
|
7
7
|
large: string | number;
|
|
8
8
|
}
|
|
9
|
+
export interface ShowLoadingOptions {
|
|
10
|
+
duration?: number;
|
|
11
|
+
text?: string;
|
|
12
|
+
}
|
|
9
13
|
export interface OpenModalOptions {
|
|
10
14
|
closeable?: boolean;
|
|
11
15
|
esc?: boolean;
|
|
@@ -48,4 +52,6 @@ export interface ModalActions {
|
|
|
48
52
|
close: (id: string, data?: any) => void;
|
|
49
53
|
closeAll: () => void;
|
|
50
54
|
addEventListener: (id: string, event: 'submit', callback: (modal: ReturnType<typeof useModal>) => void) => void;
|
|
55
|
+
showLoading: (id?: string, options?: ShowLoadingOptions) => () => void;
|
|
56
|
+
hideLoading: (id?: string) => void;
|
|
51
57
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
2
|
+
text?: string | undefined;
|
|
3
|
+
}>, {
|
|
4
|
+
text: string;
|
|
5
|
+
}>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
6
|
+
text?: string | undefined;
|
|
7
|
+
}>, {
|
|
8
|
+
text: string;
|
|
9
|
+
}>>>, {
|
|
10
|
+
text: string;
|
|
11
|
+
}, {}>;
|
|
12
|
+
export default _default;
|
|
13
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
14
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
15
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
16
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
17
|
+
} : {
|
|
18
|
+
type: import('vue').PropType<T[K]>;
|
|
19
|
+
required: true;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
type __VLS_WithDefaults<P, D> = {
|
|
23
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
24
|
+
default: D[K];
|
|
25
|
+
}> : P[K];
|
|
26
|
+
};
|
|
27
|
+
type __VLS_Prettify<T> = {
|
|
28
|
+
[K in keyof T]: T[K];
|
|
29
|
+
} & {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OpenModalOptions } from '../interfaces';
|
|
1
|
+
import { OpenModalOptions, ShowLoadingOptions } from '../interfaces';
|
|
2
2
|
import { Component } from 'vue';
|
|
3
3
|
|
|
4
4
|
export declare function useModal(): {
|
|
@@ -24,7 +24,7 @@ export declare function useModal(): {
|
|
|
24
24
|
};
|
|
25
25
|
close(data?: any): void;
|
|
26
26
|
closeAll(): void;
|
|
27
|
-
showLoading(): void;
|
|
27
|
+
showLoading(options?: ShowLoadingOptions): () => void;
|
|
28
28
|
hideLoading(): void;
|
|
29
29
|
confirm(props: {
|
|
30
30
|
title?: string;
|
package/dist/es/index.mjs
CHANGED
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
import { unref as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
return
|
|
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";
|
|
2
|
+
const U = Symbol("__MODAL__");
|
|
3
|
+
function de(t) {
|
|
4
|
+
return _e() ? (xe(t), !0) : !1;
|
|
5
5
|
}
|
|
6
6
|
function w(t) {
|
|
7
|
-
return typeof t == "function" ? t() :
|
|
7
|
+
return typeof t == "function" ? t() : ve(t);
|
|
8
8
|
}
|
|
9
|
-
const
|
|
9
|
+
const ce = typeof window < "u" && typeof document < "u";
|
|
10
10
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
11
|
-
const ze = Object.prototype.toString, Pe = (t) => ze.call(t) === "[object Object]",
|
|
11
|
+
const ze = Object.prototype.toString, Pe = (t) => ze.call(t) === "[object Object]", Ie = () => {
|
|
12
12
|
};
|
|
13
|
-
function
|
|
14
|
-
return
|
|
13
|
+
function Ne(t) {
|
|
14
|
+
return V();
|
|
15
15
|
}
|
|
16
16
|
function We(t, r = {}) {
|
|
17
|
-
if (!
|
|
18
|
-
return
|
|
19
|
-
const
|
|
17
|
+
if (!ge(t))
|
|
18
|
+
return ye(t);
|
|
19
|
+
const o = Array.isArray(t.value) ? Array.from({ length: t.value.length }) : {};
|
|
20
20
|
for (const e in t.value)
|
|
21
|
-
|
|
21
|
+
o[e] = be(() => ({
|
|
22
22
|
get() {
|
|
23
23
|
return t.value[e];
|
|
24
24
|
},
|
|
25
|
-
set(
|
|
25
|
+
set(l) {
|
|
26
26
|
var i;
|
|
27
27
|
if ((i = w(r.replaceRef)) != null ? i : !0)
|
|
28
28
|
if (Array.isArray(t.value)) {
|
|
29
29
|
const h = [...t.value];
|
|
30
|
-
h[e] =
|
|
30
|
+
h[e] = l, t.value = h;
|
|
31
31
|
} else {
|
|
32
|
-
const h = { ...t.value, [e]:
|
|
32
|
+
const h = { ...t.value, [e]: l };
|
|
33
33
|
Object.setPrototypeOf(h, Object.getPrototypeOf(t.value)), t.value = h;
|
|
34
34
|
}
|
|
35
35
|
else
|
|
36
|
-
t.value[e] =
|
|
36
|
+
t.value[e] = l;
|
|
37
37
|
}
|
|
38
38
|
}));
|
|
39
|
-
return
|
|
39
|
+
return o;
|
|
40
40
|
}
|
|
41
|
-
function De(t, r = !0,
|
|
42
|
-
|
|
41
|
+
function De(t, r = !0, o) {
|
|
42
|
+
Ne() ? Y(t, o) : r ? t() : we(t);
|
|
43
43
|
}
|
|
44
44
|
function B(t) {
|
|
45
45
|
var r;
|
|
46
|
-
const
|
|
47
|
-
return (r =
|
|
46
|
+
const o = w(t);
|
|
47
|
+
return (r = o == null ? void 0 : o.$el) != null ? r : o;
|
|
48
48
|
}
|
|
49
|
-
const
|
|
50
|
-
function
|
|
51
|
-
let r,
|
|
52
|
-
if (typeof t[0] == "string" || Array.isArray(t[0]) ? ([
|
|
53
|
-
return
|
|
54
|
-
Array.isArray(
|
|
49
|
+
const q = ce ? window : void 0;
|
|
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)
|
|
53
|
+
return Ie;
|
|
54
|
+
Array.isArray(o) || (o = [o]), Array.isArray(e) || (e = [e]);
|
|
55
55
|
const i = [], c = () => {
|
|
56
56
|
i.forEach((m) => m()), i.length = 0;
|
|
57
|
-
}, h = (m,
|
|
58
|
-
() => [B(r), w(
|
|
59
|
-
([m,
|
|
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
60
|
if (c(), !m)
|
|
61
61
|
return;
|
|
62
|
-
const s = Pe(
|
|
62
|
+
const s = Pe(u) ? { ...u } : u;
|
|
63
63
|
i.push(
|
|
64
|
-
...
|
|
64
|
+
...o.flatMap((d) => e.map((a) => h(m, d, a, s)))
|
|
65
65
|
);
|
|
66
66
|
},
|
|
67
67
|
{ immediate: !0, flush: "post" }
|
|
68
68
|
), b = () => {
|
|
69
69
|
_(), c();
|
|
70
70
|
};
|
|
71
|
-
return
|
|
71
|
+
return de(b), b;
|
|
72
72
|
}
|
|
73
73
|
function Fe() {
|
|
74
|
-
const t = H(!1), r =
|
|
74
|
+
const t = H(!1), r = V();
|
|
75
75
|
return r && Y(() => {
|
|
76
76
|
t.value = !0;
|
|
77
77
|
}, r), t;
|
|
@@ -81,111 +81,111 @@ function Ve(t) {
|
|
|
81
81
|
return E(() => (r.value, !!t()));
|
|
82
82
|
}
|
|
83
83
|
function je(t, r = {}) {
|
|
84
|
-
var
|
|
84
|
+
var o, e;
|
|
85
85
|
const {
|
|
86
|
-
pointerTypes:
|
|
86
|
+
pointerTypes: l,
|
|
87
87
|
preventDefault: i,
|
|
88
88
|
stopPropagation: c,
|
|
89
89
|
exact: h,
|
|
90
90
|
onMove: _,
|
|
91
91
|
onEnd: b,
|
|
92
92
|
onStart: m,
|
|
93
|
-
initialValue:
|
|
93
|
+
initialValue: u,
|
|
94
94
|
axis: s = "both",
|
|
95
|
-
draggingElement:
|
|
96
|
-
containerElement:
|
|
97
|
-
handle:
|
|
95
|
+
draggingElement: d = q,
|
|
96
|
+
containerElement: a,
|
|
97
|
+
handle: g = t
|
|
98
98
|
} = r, f = H(
|
|
99
|
-
(
|
|
100
|
-
),
|
|
99
|
+
(o = w(u)) != null ? o : { x: 0, y: 0 }
|
|
100
|
+
), k = H(), T = (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) || !
|
|
104
|
+
if (w(r.disabled) || !T(p) || w(h) && p.target !== w(t))
|
|
105
105
|
return;
|
|
106
|
-
const x = w(
|
|
107
|
-
x: p.clientX - (x ?
|
|
108
|
-
y: p.clientY - (x ?
|
|
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
|
+
x: p.clientX - (x ? M.left - A.left + x.scrollLeft : M.left),
|
|
108
|
+
y: p.clientY - (x ? M.top - A.top + x.scrollTop : M.top)
|
|
109
109
|
};
|
|
110
|
-
(m == null ? void 0 : m(G, p)) !== !1 && (
|
|
111
|
-
},
|
|
112
|
-
if (w(r.disabled) || !
|
|
110
|
+
(m == null ? void 0 : m(G, p)) !== !1 && (k.value = G, $(p));
|
|
111
|
+
}, J = (p) => {
|
|
112
|
+
if (w(r.disabled) || !T(p) || !k.value)
|
|
113
113
|
return;
|
|
114
|
-
const L = w(
|
|
115
|
-
let { x: A, y:
|
|
116
|
-
(s === "x" || s === "both") && (A = p.clientX -
|
|
114
|
+
const L = w(a), x = w(t).getBoundingClientRect();
|
|
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 = {
|
|
117
117
|
x: A,
|
|
118
|
-
y:
|
|
118
|
+
y: M
|
|
119
119
|
}, _ == null || _(f.value, p), $(p);
|
|
120
120
|
}, j = (p) => {
|
|
121
|
-
w(r.disabled) || !
|
|
121
|
+
w(r.disabled) || !T(p) || k.value && (k.value = void 0, b == null || b(f.value, p), $(p));
|
|
122
122
|
};
|
|
123
|
-
if (
|
|
123
|
+
if (ce) {
|
|
124
124
|
const p = { capture: (e = r.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 {
|
|
128
128
|
...We(f),
|
|
129
129
|
position: f,
|
|
130
|
-
isDragging: E(() => !!
|
|
130
|
+
isDragging: E(() => !!k.value),
|
|
131
131
|
style: E(
|
|
132
132
|
() => `left:${f.value.x}px;top:${f.value.y}px;`
|
|
133
133
|
)
|
|
134
134
|
};
|
|
135
135
|
}
|
|
136
|
-
function Ge(t, r,
|
|
137
|
-
const { window: e =
|
|
136
|
+
function Ge(t, r, o = {}) {
|
|
137
|
+
const { window: e = q, ...l } = o;
|
|
138
138
|
let i;
|
|
139
139
|
const c = Ve(() => e && "ResizeObserver" in e), h = () => {
|
|
140
140
|
i && (i.disconnect(), i = void 0);
|
|
141
|
-
}, _ = E(() => Array.isArray(t) ? t.map((
|
|
141
|
+
}, _ = E(() => Array.isArray(t) ? t.map((u) => B(u)) : [B(t)]), b = ee(
|
|
142
142
|
_,
|
|
143
|
-
(
|
|
143
|
+
(u) => {
|
|
144
144
|
if (h(), c.value && e) {
|
|
145
145
|
i = new ResizeObserver(r);
|
|
146
|
-
for (const s of
|
|
147
|
-
s && i.observe(s,
|
|
146
|
+
for (const s of u)
|
|
147
|
+
s && i.observe(s, l);
|
|
148
148
|
}
|
|
149
149
|
},
|
|
150
150
|
{ immediate: !0, flush: "post" }
|
|
151
151
|
), m = () => {
|
|
152
152
|
h(), b();
|
|
153
153
|
};
|
|
154
|
-
return
|
|
154
|
+
return de(m), {
|
|
155
155
|
isSupported: c,
|
|
156
156
|
stop: m
|
|
157
157
|
};
|
|
158
158
|
}
|
|
159
|
-
function
|
|
160
|
-
const { window: e =
|
|
161
|
-
var
|
|
162
|
-
return (s = (
|
|
159
|
+
function W(t, r = { width: 0, height: 0 }, o = {}) {
|
|
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
163
|
}), c = H(r.width), h = H(r.height), { stop: _ } = Ge(
|
|
164
164
|
t,
|
|
165
|
-
([
|
|
166
|
-
const s =
|
|
165
|
+
([u]) => {
|
|
166
|
+
const s = l === "border-box" ? u.borderBoxSize : l === "content-box" ? u.contentBoxSize : u.devicePixelContentBoxSize;
|
|
167
167
|
if (e && i.value) {
|
|
168
|
-
const
|
|
169
|
-
if (
|
|
170
|
-
const
|
|
171
|
-
c.value = Number.parseFloat(
|
|
168
|
+
const d = B(t);
|
|
169
|
+
if (d) {
|
|
170
|
+
const a = e.getComputedStyle(d);
|
|
171
|
+
c.value = Number.parseFloat(a.width), h.value = Number.parseFloat(a.height);
|
|
172
172
|
}
|
|
173
173
|
} else if (s) {
|
|
174
|
-
const
|
|
175
|
-
c.value =
|
|
174
|
+
const d = Array.isArray(s) ? s : [s];
|
|
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
|
-
c.value =
|
|
177
|
+
c.value = u.contentRect.width, h.value = u.contentRect.height;
|
|
178
178
|
},
|
|
179
|
-
|
|
179
|
+
o
|
|
180
180
|
);
|
|
181
181
|
De(() => {
|
|
182
|
-
const
|
|
183
|
-
|
|
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);
|
|
184
184
|
});
|
|
185
|
-
const b =
|
|
185
|
+
const b = ee(
|
|
186
186
|
() => B(t),
|
|
187
|
-
(
|
|
188
|
-
c.value =
|
|
187
|
+
(u) => {
|
|
188
|
+
c.value = u ? r.width : 0, h.value = u ? r.height : 0;
|
|
189
189
|
}
|
|
190
190
|
);
|
|
191
191
|
function m() {
|
|
@@ -197,20 +197,20 @@ function I(t, r = { width: 0, height: 0 }, n = {}) {
|
|
|
197
197
|
stop: m
|
|
198
198
|
};
|
|
199
199
|
}
|
|
200
|
-
const Xe = (t) => (
|
|
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 = {
|
|
201
201
|
key: 2,
|
|
202
202
|
class: "modal-loading"
|
|
203
|
-
}, Je = /* @__PURE__ */ Xe(() => /* @__PURE__ */
|
|
204
|
-
/* @__PURE__ */
|
|
205
|
-
/* @__PURE__ */
|
|
206
|
-
/* @__PURE__ */
|
|
207
|
-
/* @__PURE__ */
|
|
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")
|
|
208
208
|
], -1)), Qe = [
|
|
209
209
|
Je
|
|
210
210
|
], Ze = {
|
|
211
211
|
name: "ModalContainer",
|
|
212
212
|
inheritAttrs: !0
|
|
213
|
-
}, et = /* @__PURE__ */
|
|
213
|
+
}, et = /* @__PURE__ */ K({
|
|
214
214
|
...Ze,
|
|
215
215
|
props: {
|
|
216
216
|
id: {},
|
|
@@ -242,158 +242,158 @@ const Xe = (t) => ($e("data-v-9a7af353"), t = t(), Ee(), t), Ye = { class: "titl
|
|
|
242
242
|
zIndex: { default: 1e3 }
|
|
243
243
|
},
|
|
244
244
|
emits: ["submit"],
|
|
245
|
-
setup(t, { expose: r, emit:
|
|
246
|
-
|
|
247
|
-
"5751bf6b":
|
|
245
|
+
setup(t, { expose: r, emit: o }) {
|
|
246
|
+
Ce((n) => ({
|
|
247
|
+
"5751bf6b": n.zIndex
|
|
248
248
|
}));
|
|
249
|
-
const e = t,
|
|
249
|
+
const e = t, l = o, i = te(U), c = H(!1);
|
|
250
250
|
let h = 0, _ = 0;
|
|
251
|
-
const b = O(), m = O(),
|
|
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, {
|
|
252
252
|
initialValue: { x: 0, y: 0 }
|
|
253
253
|
});
|
|
254
254
|
function j() {
|
|
255
255
|
i == null || i.close(e.id);
|
|
256
256
|
}
|
|
257
|
-
function p(
|
|
258
|
-
return typeof
|
|
257
|
+
function p(n) {
|
|
258
|
+
return typeof n == "number" ? `${n}px` : n;
|
|
259
259
|
}
|
|
260
260
|
const L = E(() => {
|
|
261
|
-
const
|
|
262
|
-
return e.mode === "dialog" && (
|
|
261
|
+
const n = {};
|
|
262
|
+
return e.mode === "dialog" && (n.justifyContent = "center"), e.mode === "drawer" && (n.justifyContent = {
|
|
263
263
|
left: "flex-start",
|
|
264
264
|
right: "flex-end",
|
|
265
265
|
top: "flex-start",
|
|
266
266
|
bottom: "flex-end"
|
|
267
|
-
}[e.position],
|
|
267
|
+
}[e.position], n.flexDirection = {
|
|
268
268
|
left: "row",
|
|
269
269
|
right: "row",
|
|
270
270
|
top: "column",
|
|
271
271
|
bottom: "column"
|
|
272
|
-
}[e.position]),
|
|
272
|
+
}[e.position]), n;
|
|
273
273
|
}), x = E(() => {
|
|
274
|
-
const
|
|
275
|
-
return e.mode === "drawer" && ["top", "bottom"].includes(e.position) ?
|
|
274
|
+
const n = {};
|
|
275
|
+
return e.mode === "drawer" && ["top", "bottom"].includes(e.position) ? n.maxHeight = p(e.maxHeight) : (n.width = p(e.sizes[e.size]), n.maxWidth = p(e.maxWidth)), e.width && (n.width = p(e.width)), e.height && (n.height = p(e.height)), e.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), e.draggable && !e.fullscreen && e.mode === "dialog" && (n.transform = `translate3d(${N.value - h}px, ${J.value - _}px, 0px)`), e.mode === "drawer" && (n.borderRadius = 0, ["left", "right"].includes(e.position) ? n.height = "100%" : n.width = "100%"), e.offset && e.mode === "dialog" && (n.marginLeft = `${e.offset.x || 0}px`, n.marginTop = `${e.offset.y || 0}px`), e.backgroundColor && (n.backgroundColor = e.backgroundColor), n;
|
|
276
276
|
}), A = E(() => {
|
|
277
|
-
const
|
|
278
|
-
return e.draggable && !e.fullscreen && e.mode === "dialog" && (
|
|
279
|
-
}),
|
|
280
|
-
const
|
|
281
|
-
return e.maxHeight && (
|
|
277
|
+
const n = {};
|
|
278
|
+
return e.draggable && !e.fullscreen && e.mode === "dialog" && (n.cursor = "move"), n;
|
|
279
|
+
}), 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
282
|
});
|
|
283
283
|
function G() {
|
|
284
|
-
const
|
|
285
|
-
if (e.form &&
|
|
286
|
-
const
|
|
287
|
-
|
|
284
|
+
const n = m.value;
|
|
285
|
+
if (e.form && n) {
|
|
286
|
+
const S = n.querySelector(`form[name="${e.form}"]`);
|
|
287
|
+
S && S.dispatchEvent(new Event("submit"));
|
|
288
288
|
}
|
|
289
|
-
|
|
289
|
+
l("submit");
|
|
290
290
|
}
|
|
291
|
-
function
|
|
291
|
+
function ue() {
|
|
292
292
|
i == null || i.close(e.id);
|
|
293
293
|
}
|
|
294
|
-
function
|
|
294
|
+
function fe() {
|
|
295
295
|
window && window.addEventListener("resize", () => {
|
|
296
|
-
|
|
296
|
+
F(b), F(m), m.value && (h = m.value.offsetLeft, _ = m.value.offsetTop);
|
|
297
297
|
});
|
|
298
298
|
}
|
|
299
|
-
function
|
|
299
|
+
function pe() {
|
|
300
300
|
if (e.closeable && e.esc) {
|
|
301
|
-
const
|
|
302
|
-
|
|
301
|
+
const n = ({ key: S }) => {
|
|
302
|
+
S === "Escape" && (i == null || i.close(e.id), window.removeEventListener("keydown", n));
|
|
303
303
|
};
|
|
304
|
-
window.addEventListener("keydown",
|
|
304
|
+
window.addEventListener("keydown", n);
|
|
305
305
|
}
|
|
306
306
|
}
|
|
307
|
-
function
|
|
307
|
+
function he() {
|
|
308
308
|
h = m.value.offsetLeft, _ = m.value.offsetTop;
|
|
309
309
|
}
|
|
310
310
|
Y(() => {
|
|
311
|
-
|
|
312
|
-
}),
|
|
311
|
+
pe(), fe();
|
|
312
|
+
}), ke(() => {
|
|
313
313
|
});
|
|
314
|
-
function
|
|
314
|
+
function me() {
|
|
315
315
|
return c.value = !0, () => re();
|
|
316
316
|
}
|
|
317
317
|
function re() {
|
|
318
318
|
c.value = !1;
|
|
319
319
|
}
|
|
320
320
|
return r({
|
|
321
|
-
showLoading:
|
|
321
|
+
showLoading: me,
|
|
322
322
|
hideLoading: re
|
|
323
|
-
}), (
|
|
323
|
+
}), (n, S) => (y(), C("div", {
|
|
324
324
|
ref_key: "wrapperRef",
|
|
325
325
|
ref: b,
|
|
326
326
|
class: "modal-wrapper",
|
|
327
|
-
style:
|
|
328
|
-
onClick:
|
|
327
|
+
style: D(L.value),
|
|
328
|
+
onClick: S[0] || (S[0] = Me((se) => n.maskClosable && j(), ["self"]))
|
|
329
329
|
}, [
|
|
330
|
-
|
|
330
|
+
v("div", {
|
|
331
331
|
ref_key: "contentRef",
|
|
332
332
|
ref: m,
|
|
333
|
-
class:
|
|
334
|
-
style:
|
|
333
|
+
class: Se(["modal-content", { [`${n.mode}-mode`]: !0, [`${n.position}-position`]: !0 }]),
|
|
334
|
+
style: D(x.value)
|
|
335
335
|
}, [
|
|
336
|
-
|
|
336
|
+
n.header ? (y(), C("div", {
|
|
337
337
|
key: 0,
|
|
338
338
|
ref_key: "headerRef",
|
|
339
|
-
ref:
|
|
339
|
+
ref: u,
|
|
340
340
|
class: "modal-header",
|
|
341
|
-
style:
|
|
342
|
-
onMousedown:
|
|
341
|
+
style: D(A.value),
|
|
342
|
+
onMousedown: he
|
|
343
343
|
}, [
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
344
|
+
v("div", Ye, R(n.title), 1),
|
|
345
|
+
v("div", Ke, [
|
|
346
|
+
n.closeable ? (y(), C("div", {
|
|
347
347
|
key: 0,
|
|
348
348
|
class: "i-icon-park-outline:close block cursor-pointer",
|
|
349
349
|
onClick: j
|
|
350
350
|
})) : z("", !0)
|
|
351
351
|
])
|
|
352
352
|
], 36)) : z("", !0),
|
|
353
|
-
|
|
353
|
+
v("div", {
|
|
354
354
|
id: "modal-header-slot",
|
|
355
355
|
ref_key: "headerSlotRef",
|
|
356
|
-
ref:
|
|
356
|
+
ref: d
|
|
357
357
|
}, null, 512),
|
|
358
|
-
|
|
358
|
+
v("div", {
|
|
359
359
|
class: "modal-body",
|
|
360
|
-
style:
|
|
360
|
+
style: D(M.value)
|
|
361
361
|
}, [
|
|
362
|
-
(y(), P(ie(
|
|
362
|
+
(y(), P(ie(n.component), $e(Ee(n.componentProps)), null, 16))
|
|
363
363
|
], 4),
|
|
364
|
-
|
|
364
|
+
v("div", {
|
|
365
365
|
id: "modal-footer-slot",
|
|
366
366
|
ref_key: "footerSlotRef",
|
|
367
|
-
ref:
|
|
367
|
+
ref: a
|
|
368
368
|
}, null, 512),
|
|
369
|
-
|
|
369
|
+
n.footer ? (y(), C("div", {
|
|
370
370
|
key: 1,
|
|
371
371
|
ref_key: "footerRef",
|
|
372
372
|
ref: s,
|
|
373
373
|
class: "modal-footer space-x-2"
|
|
374
374
|
}, [
|
|
375
|
-
|
|
375
|
+
v("button", {
|
|
376
376
|
class: "cancel-button",
|
|
377
377
|
type: "button",
|
|
378
|
-
onClick:
|
|
379
|
-
},
|
|
380
|
-
|
|
378
|
+
onClick: ue
|
|
379
|
+
}, R(n.cancelText), 1),
|
|
380
|
+
v("button", {
|
|
381
381
|
class: "submit-button",
|
|
382
|
-
form:
|
|
382
|
+
form: n.form,
|
|
383
383
|
type: "submit",
|
|
384
384
|
onClick: G
|
|
385
|
-
},
|
|
385
|
+
}, R(n.submitText), 9, Ue)
|
|
386
386
|
], 512)) : z("", !0),
|
|
387
|
-
c.value ? (y(),
|
|
387
|
+
c.value ? (y(), C("div", qe, Qe)) : z("", !0)
|
|
388
388
|
], 6)
|
|
389
389
|
], 4));
|
|
390
390
|
}
|
|
391
|
-
}),
|
|
392
|
-
const
|
|
393
|
-
for (const [e,
|
|
394
|
-
|
|
395
|
-
return
|
|
396
|
-
}, tt = /* @__PURE__ */
|
|
391
|
+
}), I = (t, r) => {
|
|
392
|
+
const o = t.__vccOpts || t;
|
|
393
|
+
for (const [e, l] of r)
|
|
394
|
+
o[e] = l;
|
|
395
|
+
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({
|
|
397
397
|
__name: "modal-dialog",
|
|
398
398
|
props: {
|
|
399
399
|
type: {},
|
|
@@ -406,52 +406,70 @@ const Xe = (t) => ($e("data-v-9a7af353"), t = t(), Ee(), t), Ye = { class: "titl
|
|
|
406
406
|
footer: {}
|
|
407
407
|
},
|
|
408
408
|
setup(t) {
|
|
409
|
-
const r = t,
|
|
409
|
+
const r = t, o = Ct(), e = E(() => r.title ? r.title : {
|
|
410
410
|
confirm: "提示",
|
|
411
411
|
info: "提示",
|
|
412
412
|
warning: "警告",
|
|
413
413
|
error: "错误",
|
|
414
414
|
success: "成功"
|
|
415
415
|
}[r.type]);
|
|
416
|
-
async function
|
|
417
|
-
r.onOk && await r.onOk(),
|
|
416
|
+
async function l() {
|
|
417
|
+
r.onOk && await r.onOk(), o.close();
|
|
418
418
|
}
|
|
419
419
|
async function i() {
|
|
420
|
-
r.onCancel && await r.onCancel(),
|
|
420
|
+
r.onCancel && await r.onCancel(), o.close();
|
|
421
421
|
}
|
|
422
|
-
return (c, h) => (y(),
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
422
|
+
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)
|
|
426
426
|
]),
|
|
427
|
-
|
|
427
|
+
v("div", {
|
|
428
428
|
class: "dialog-footer space-x-2",
|
|
429
|
-
style:
|
|
429
|
+
style: D(c.type === "confirm" ? { "justify-content": "end" } : { "border-top": "none" })
|
|
430
430
|
}, [
|
|
431
|
-
c.footer ? (y(), P(ie(c.footer), { key: 0 })) : (y(),
|
|
432
|
-
|
|
431
|
+
c.footer ? (y(), P(ie(c.footer), { key: 0 })) : (y(), C(Z, { key: 1 }, [
|
|
432
|
+
v("button", {
|
|
433
433
|
class: "submit-button",
|
|
434
434
|
type: "submit",
|
|
435
|
-
onClick:
|
|
436
|
-
},
|
|
437
|
-
c.type === "confirm" ? (y(),
|
|
435
|
+
onClick: l
|
|
436
|
+
}, R(c.okText), 1),
|
|
437
|
+
c.type === "confirm" ? (y(), C("button", {
|
|
438
438
|
key: 0,
|
|
439
439
|
class: "cancel-button",
|
|
440
440
|
type: "button",
|
|
441
441
|
onClick: i
|
|
442
|
-
},
|
|
442
|
+
}, R(c.cancelText), 1)) : z("", !0)
|
|
443
443
|
], 64))
|
|
444
444
|
], 4)
|
|
445
445
|
]));
|
|
446
446
|
}
|
|
447
|
-
}), lt = /* @__PURE__ */
|
|
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")
|
|
453
|
+
])
|
|
454
|
+
], -1)), ut = { class: "modal-loading-text" }, ft = /* @__PURE__ */ K({
|
|
455
|
+
__name: "modal-loading",
|
|
456
|
+
props: {
|
|
457
|
+
text: { default: "加载中" }
|
|
458
|
+
},
|
|
459
|
+
setup(t) {
|
|
460
|
+
return (r, o) => (y(), C("section", dt, [
|
|
461
|
+
ct,
|
|
462
|
+
v("div", ut, R(r.text), 1)
|
|
463
|
+
]));
|
|
464
|
+
}
|
|
465
|
+
}), pt = /* @__PURE__ */ I(ft, [["__scopeId", "data-v-559bdf2e"]]), ht = {
|
|
448
466
|
key: 0,
|
|
449
467
|
class: "modal-teleport"
|
|
450
|
-
},
|
|
468
|
+
}, mt = {
|
|
451
469
|
name: "ModalProvider",
|
|
452
470
|
inheritAttrs: !0
|
|
453
|
-
},
|
|
454
|
-
...
|
|
471
|
+
}, vt = /* @__PURE__ */ K({
|
|
472
|
+
...mt,
|
|
455
473
|
props: {
|
|
456
474
|
appendToBody: { type: [Boolean, String], default: !1 },
|
|
457
475
|
sizes: { default: () => ({
|
|
@@ -464,56 +482,56 @@ const Xe = (t) => ($e("data-v-9a7af353"), t = t(), Ee(), t), Ye = { class: "titl
|
|
|
464
482
|
offset: { default: () => ({ x: 0, y: 0 }) }
|
|
465
483
|
},
|
|
466
484
|
setup(t, { expose: r }) {
|
|
467
|
-
const
|
|
468
|
-
function i(s,
|
|
469
|
-
const
|
|
485
|
+
const o = O([]), e = H(!1), l = V();
|
|
486
|
+
function i(s, d = {}, a = {}) {
|
|
487
|
+
const g = He(
|
|
470
488
|
() => Promise.resolve(typeof s == "string" ? lt : s)
|
|
471
489
|
);
|
|
472
|
-
typeof s == "string" && (
|
|
473
|
-
const f = Math.random().toString(32).slice(2),
|
|
490
|
+
typeof s == "string" && (d.type = s, a.size = "small", a.fullscreen = !1, a.mode = "dialog", a.footer = !1, a.header = !1);
|
|
491
|
+
const f = Math.random().toString(32).slice(2), k = Object.assign({
|
|
474
492
|
zIndex: typeof s == "string" ? 1100 : 1e3
|
|
475
|
-
},
|
|
476
|
-
|
|
493
|
+
}, a), T = new Promise(($, N) => {
|
|
494
|
+
o.value.push({
|
|
477
495
|
id: f,
|
|
478
|
-
component:
|
|
479
|
-
props:
|
|
496
|
+
component: g,
|
|
497
|
+
props: d || {},
|
|
480
498
|
options: {
|
|
481
|
-
...
|
|
499
|
+
...k,
|
|
482
500
|
type: typeof s == "string" ? s : "component"
|
|
483
501
|
},
|
|
484
502
|
resolve: $,
|
|
485
503
|
reject: N,
|
|
486
504
|
listeners: []
|
|
487
|
-
}),
|
|
505
|
+
}), F(o);
|
|
488
506
|
}).catch(($) => $ === "CANCEL" ? new Promise(() => {
|
|
489
507
|
}) : Promise.reject($));
|
|
490
|
-
return Object.assign(
|
|
508
|
+
return Object.assign(T, {
|
|
491
509
|
close: () => c(f)
|
|
492
510
|
});
|
|
493
511
|
}
|
|
494
|
-
function c(s,
|
|
495
|
-
const
|
|
496
|
-
if (
|
|
512
|
+
function c(s, d) {
|
|
513
|
+
const a = o.value.findIndex((f) => f.id === s);
|
|
514
|
+
if (a < 0)
|
|
497
515
|
return;
|
|
498
|
-
const
|
|
499
|
-
|
|
516
|
+
const g = o.value[a];
|
|
517
|
+
d === void 0 ? g == null || g.reject("CANCEL") : g == null || g.resolve(d), o.value.splice(a, 1), F(o);
|
|
500
518
|
}
|
|
501
519
|
function h() {
|
|
502
|
-
!
|
|
520
|
+
!o.value || o.value.length === 0 || (o.value.forEach((s) => {
|
|
503
521
|
s == null || s.reject("CANCEL");
|
|
504
|
-
}),
|
|
522
|
+
}), o.value = [], F(o));
|
|
505
523
|
}
|
|
506
|
-
function _(s,
|
|
507
|
-
const
|
|
508
|
-
if (!
|
|
524
|
+
function _(s, d) {
|
|
525
|
+
const a = o.value.find((f) => f.id === s);
|
|
526
|
+
if (!a)
|
|
509
527
|
return;
|
|
510
|
-
const
|
|
511
|
-
|
|
528
|
+
const g = a.listeners.find((f) => f.event === d);
|
|
529
|
+
g && g.callback({
|
|
512
530
|
open: i,
|
|
513
|
-
close: (f) => c(
|
|
531
|
+
close: (f) => c(a.id, f),
|
|
514
532
|
closeAll: h,
|
|
515
|
-
showLoading: () => b(
|
|
516
|
-
hideLoading: () => m(
|
|
533
|
+
showLoading: () => b(a.id),
|
|
534
|
+
hideLoading: () => m(a.id),
|
|
517
535
|
confirm: (f) => i("confirm", f),
|
|
518
536
|
success: (f) => i("success", f),
|
|
519
537
|
error: (f) => i("error", f),
|
|
@@ -521,61 +539,79 @@ const Xe = (t) => ($e("data-v-9a7af353"), t = t(), Ee(), t), Ye = { class: "titl
|
|
|
521
539
|
info: (f) => i("info", f)
|
|
522
540
|
});
|
|
523
541
|
}
|
|
524
|
-
function b(s) {
|
|
525
|
-
if (!
|
|
542
|
+
function b(s, d) {
|
|
543
|
+
if (!l)
|
|
526
544
|
return;
|
|
527
|
-
const [
|
|
528
|
-
if (
|
|
529
|
-
return
|
|
545
|
+
const [a] = l.refs[`modal-container_${s}`] || [];
|
|
546
|
+
if (a)
|
|
547
|
+
return a.showLoading();
|
|
548
|
+
{
|
|
549
|
+
const { close: g } = i(pt, {
|
|
550
|
+
text: d == null ? void 0 : d.text
|
|
551
|
+
}, {
|
|
552
|
+
footer: !1,
|
|
553
|
+
header: !1,
|
|
554
|
+
closeable: !1,
|
|
555
|
+
backgroundColor: "transparent"
|
|
556
|
+
});
|
|
557
|
+
return d != null && d.duration && setTimeout(
|
|
558
|
+
() => {
|
|
559
|
+
g();
|
|
560
|
+
},
|
|
561
|
+
d == null ? void 0 : d.duration
|
|
562
|
+
), g;
|
|
563
|
+
}
|
|
530
564
|
}
|
|
531
565
|
function m(s) {
|
|
532
|
-
if (!
|
|
566
|
+
if (!l)
|
|
533
567
|
return;
|
|
534
|
-
const [
|
|
535
|
-
if (
|
|
536
|
-
return
|
|
568
|
+
const [d] = l.refs[`modal-container_${s}`];
|
|
569
|
+
if (d)
|
|
570
|
+
return d.hideLoading();
|
|
537
571
|
}
|
|
538
|
-
function
|
|
539
|
-
const
|
|
540
|
-
|
|
541
|
-
event:
|
|
542
|
-
callback:
|
|
572
|
+
function u(s, d, a) {
|
|
573
|
+
const g = o.value.find((f) => f.id === s);
|
|
574
|
+
g && g.listeners.push({
|
|
575
|
+
event: d,
|
|
576
|
+
callback: a
|
|
543
577
|
});
|
|
544
578
|
}
|
|
545
|
-
return Le(
|
|
579
|
+
return Le(U, {
|
|
546
580
|
open: i,
|
|
547
581
|
close: c,
|
|
548
582
|
closeAll: h,
|
|
549
|
-
addEventListener:
|
|
583
|
+
addEventListener: u,
|
|
584
|
+
showLoading: b,
|
|
585
|
+
hideLoading: m
|
|
550
586
|
}), r({
|
|
551
|
-
elements:
|
|
587
|
+
elements: o,
|
|
552
588
|
open: i,
|
|
553
589
|
close: c,
|
|
554
590
|
closeAll: h
|
|
555
591
|
}), Y(() => {
|
|
556
592
|
e.value = !0;
|
|
557
|
-
}), (s,
|
|
593
|
+
}), (s, d) => (y(), C(Z, null, [
|
|
558
594
|
oe(s.$slots, "default", {}, void 0, !0),
|
|
559
|
-
e.value ? (y(),
|
|
595
|
+
e.value ? (y(), C("div", ht, [
|
|
560
596
|
(y(), P(ne, {
|
|
561
597
|
disabled: !s.appendToBody,
|
|
562
598
|
to: typeof s.appendToBody == "string" ? s.appendToBody : "body"
|
|
563
599
|
}, [
|
|
564
600
|
Ae(Re, { name: "modal-fade" }, {
|
|
565
|
-
default:
|
|
566
|
-
(y(!0),
|
|
567
|
-
id:
|
|
568
|
-
key:
|
|
601
|
+
default: Te(() => [
|
|
602
|
+
(y(!0), C(Z, null, Oe(o.value, (a) => (y(), P(tt, Be({
|
|
603
|
+
id: a.id,
|
|
604
|
+
key: a.id,
|
|
569
605
|
ref_for: !0,
|
|
570
|
-
ref: `modal-container_${
|
|
571
|
-
component:
|
|
572
|
-
"component-props":
|
|
606
|
+
ref: `modal-container_${a.id}`,
|
|
607
|
+
component: a.component,
|
|
608
|
+
"component-props": a.props,
|
|
573
609
|
"max-height": s.maxHeight,
|
|
574
610
|
"max-width": s.maxWidth,
|
|
575
611
|
offset: s.offset,
|
|
576
612
|
sizes: s.sizes
|
|
577
|
-
},
|
|
578
|
-
onSubmit: () => _(
|
|
613
|
+
}, a.options, {
|
|
614
|
+
onSubmit: () => _(a.id, "submit")
|
|
579
615
|
}), null, 16, ["id", "component", "component-props", "max-height", "max-width", "offset", "sizes", "onSubmit"]))), 128))
|
|
580
616
|
]),
|
|
581
617
|
_: 1
|
|
@@ -584,44 +620,44 @@ const Xe = (t) => ($e("data-v-9a7af353"), t = t(), Ee(), t), Ye = { class: "titl
|
|
|
584
620
|
])) : z("", !0)
|
|
585
621
|
], 64));
|
|
586
622
|
}
|
|
587
|
-
}),
|
|
588
|
-
function
|
|
623
|
+
}), Mt = /* @__PURE__ */ I(vt, [["__scopeId", "data-v-60414811"]]), gt = {}, yt = { class: "modal-footer" };
|
|
624
|
+
function bt(t, r) {
|
|
589
625
|
return y(), P(ne, { to: "#modal-footer-slot" }, [
|
|
590
|
-
|
|
626
|
+
v("div", yt, [
|
|
591
627
|
oe(t.$slots, "default", {}, void 0, !0)
|
|
592
628
|
])
|
|
593
629
|
]);
|
|
594
630
|
}
|
|
595
|
-
const
|
|
596
|
-
function
|
|
631
|
+
const St = /* @__PURE__ */ I(gt, [["render", bt], ["__scopeId", "data-v-46f8d703"]]), wt = {}, _t = { class: "modal-header" };
|
|
632
|
+
function xt(t, r) {
|
|
597
633
|
return y(), P(ne, { to: "#modal-header-slot" }, [
|
|
598
|
-
|
|
634
|
+
v("div", _t, [
|
|
599
635
|
oe(t.$slots, "default", {}, void 0, !0)
|
|
600
636
|
])
|
|
601
637
|
]);
|
|
602
638
|
}
|
|
603
|
-
const
|
|
639
|
+
const $t = /* @__PURE__ */ I(wt, [["render", xt], ["__scopeId", "data-v-d0247172"]]);
|
|
604
640
|
function X(t, r) {
|
|
605
|
-
var e,
|
|
606
|
-
let
|
|
607
|
-
for (;
|
|
608
|
-
|
|
609
|
-
return ((
|
|
641
|
+
var e, l;
|
|
642
|
+
let o = t == null ? void 0 : t.parent;
|
|
643
|
+
for (; o && ((e = o == null ? void 0 : o.type) == null ? void 0 : e.name) !== r; )
|
|
644
|
+
o = o.parent;
|
|
645
|
+
return ((l = o == null ? void 0 : o.type) == null ? void 0 : l.name) === r ? o : null;
|
|
610
646
|
}
|
|
611
|
-
function
|
|
612
|
-
const t = te(
|
|
613
|
-
function
|
|
647
|
+
function Ct() {
|
|
648
|
+
const t = te(U), r = V();
|
|
649
|
+
function o(e, l, i) {
|
|
614
650
|
if (!t)
|
|
615
651
|
throw new Error("Not Found Modal Provider Component");
|
|
616
|
-
return t.open(e,
|
|
652
|
+
return t.open(e, l, i);
|
|
617
653
|
}
|
|
618
654
|
return {
|
|
619
|
-
open:
|
|
655
|
+
open: o,
|
|
620
656
|
close(e) {
|
|
621
657
|
var c;
|
|
622
658
|
if (!t)
|
|
623
659
|
throw new Error("Not Found Modal Provider Component");
|
|
624
|
-
const
|
|
660
|
+
const l = X(r, "ModalContainer"), i = (c = l == null ? void 0 : l.props) == null ? void 0 : c.id;
|
|
625
661
|
if (!i)
|
|
626
662
|
throw new Error("Not Found Current Modal Container");
|
|
627
663
|
t.close(i, e);
|
|
@@ -631,23 +667,19 @@ function gt() {
|
|
|
631
667
|
throw new Error("Not Found Modal Provider Component");
|
|
632
668
|
t.closeAll();
|
|
633
669
|
},
|
|
634
|
-
showLoading() {
|
|
635
|
-
var
|
|
670
|
+
showLoading(e) {
|
|
671
|
+
var c;
|
|
636
672
|
if (!t)
|
|
637
673
|
throw new Error("Not Found Modal Provider Component");
|
|
638
|
-
const
|
|
639
|
-
|
|
640
|
-
throw new Error("Not Found Current Modal Container");
|
|
641
|
-
e != null && e.exposed && (e == null || e.exposed.showLoading());
|
|
674
|
+
const l = X(r, "ModalContainer"), i = (c = l == null ? void 0 : l.props) == null ? void 0 : c.id;
|
|
675
|
+
return t.showLoading(i, e);
|
|
642
676
|
},
|
|
643
677
|
hideLoading() {
|
|
644
678
|
var i;
|
|
645
679
|
if (!t)
|
|
646
680
|
throw new Error("Not Found Modal Provider Component");
|
|
647
|
-
const e = X(r, "ModalContainer");
|
|
648
|
-
|
|
649
|
-
throw new Error("Not Found Current Modal Container");
|
|
650
|
-
e != null && e.exposed && (e == null || e.exposed.hideLoading());
|
|
681
|
+
const e = X(r, "ModalContainer"), l = (i = e == null ? void 0 : e.props) == null ? void 0 : i.id;
|
|
682
|
+
return t.hideLoading(l);
|
|
651
683
|
},
|
|
652
684
|
confirm(e) {
|
|
653
685
|
return this.open("confirm", e);
|
|
@@ -666,17 +698,17 @@ function gt() {
|
|
|
666
698
|
}
|
|
667
699
|
};
|
|
668
700
|
}
|
|
669
|
-
function
|
|
701
|
+
function Et(t) {
|
|
670
702
|
var i;
|
|
671
|
-
const r = te(
|
|
672
|
-
r &&
|
|
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);
|
|
673
705
|
}
|
|
674
706
|
export {
|
|
675
707
|
tt as ModalContainer,
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
708
|
+
St as ModalFooter,
|
|
709
|
+
$t as ModalHeader,
|
|
710
|
+
U as ModalKey,
|
|
711
|
+
Mt as ModalProvider,
|
|
712
|
+
Et as onSubmit,
|
|
713
|
+
Ct as useModal
|
|
682
714
|
};
|
package/dist/es/interfaces.d.ts
CHANGED
|
@@ -6,6 +6,10 @@ export interface SizeOptions {
|
|
|
6
6
|
middle: string | number;
|
|
7
7
|
large: string | number;
|
|
8
8
|
}
|
|
9
|
+
export interface ShowLoadingOptions {
|
|
10
|
+
duration?: number;
|
|
11
|
+
text?: string;
|
|
12
|
+
}
|
|
9
13
|
export interface OpenModalOptions {
|
|
10
14
|
closeable?: boolean;
|
|
11
15
|
esc?: boolean;
|
|
@@ -48,4 +52,6 @@ export interface ModalActions {
|
|
|
48
52
|
close: (id: string, data?: any) => void;
|
|
49
53
|
closeAll: () => void;
|
|
50
54
|
addEventListener: (id: string, event: 'submit', callback: (modal: ReturnType<typeof useModal>) => void) => void;
|
|
55
|
+
showLoading: (id?: string, options?: ShowLoadingOptions) => () => void;
|
|
56
|
+
hideLoading: (id?: string) => void;
|
|
51
57
|
}
|
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-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)}
|
|
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)}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gopowerteam/modal-render",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.42",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "zhuchentong",
|
|
7
7
|
"email": "2037630@gmail.com"
|
|
@@ -15,14 +15,11 @@
|
|
|
15
15
|
"bugs": {
|
|
16
16
|
"url": "https://github.com/gopowerteam/x-render/issues"
|
|
17
17
|
},
|
|
18
|
-
"main": "./dist/cjs/index.cjs",
|
|
19
|
-
"module": "./dist/es/index.mjs",
|
|
20
|
-
"types": "./dist/es/index.d.ts",
|
|
21
18
|
"exports": {
|
|
22
19
|
".": {
|
|
23
20
|
"types": "./dist/es/index.d.ts",
|
|
24
|
-
"
|
|
25
|
-
"
|
|
21
|
+
"require": "./dist/cjs/index.cjs",
|
|
22
|
+
"import": "./dist/es/index.mjs"
|
|
26
23
|
},
|
|
27
24
|
"./es": {
|
|
28
25
|
"types": "./dist/es/index.d.ts",
|
|
@@ -38,6 +35,9 @@
|
|
|
38
35
|
},
|
|
39
36
|
"./*": "./*"
|
|
40
37
|
},
|
|
38
|
+
"main": "./dist/cjs/index.cjs",
|
|
39
|
+
"module": "./dist/es/index.mjs",
|
|
40
|
+
"types": "./dist/es/index.d.ts",
|
|
41
41
|
"files": [
|
|
42
42
|
"dist",
|
|
43
43
|
"README.md"
|