@gopowerteam/modal-render 0.0.27 → 0.0.29
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-header.vue.d.ts +9 -0
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.d.ts +2 -1
- package/dist/es/components/modal-header.vue.d.ts +9 -0
- package/dist/es/index.d.ts +2 -1
- package/dist/es/index.mjs +192 -181
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>, {
|
|
2
|
+
default?(_: {}): any;
|
|
3
|
+
}>;
|
|
4
|
+
export default _default;
|
|
5
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
6
|
+
new (): {
|
|
7
|
+
$slots: S;
|
|
8
|
+
};
|
|
9
|
+
};
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue");const N=Symbol("__MODAL__");function I(n){return e.getCurrentScope()?(e.onScopeDispose(n),!0):!1}function w(n){return typeof n=="function"?n():e.unref(n)}const R=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const W=Object.prototype.toString,H=n=>W.call(n)==="[object Object]",j=()=>{};function G(n,s={}){if(!e.isRef(n))return e.toRefs(n);const r=Array.isArray(n.value)?Array.from({length:n.value.length}):{};for(const t in n.value)r[t]=e.customRef(()=>({get(){return n.value[t]},set(a){var l;if((l=w(s.replaceRef))!=null?l:!0)if(Array.isArray(n.value)){const y=[...n.value];y[t]=a,n.value=y}else{const y={...n.value,[t]:a};Object.setPrototypeOf(y,Object.getPrototypeOf(n.value)),n.value=y}else n.value[t]=a}}));return r}function K(n){var s;const r=w(n);return(s=r==null?void 0:r.$el)!=null?s:r}const z=R?window:void 0;function T(...n){let s,r,t,a;if(typeof n[0]=="string"||Array.isArray(n[0])?([r,t,a]=n,s=z):[s,r,t,a]=n,!s)return j;Array.isArray(r)||(r=[r]),Array.isArray(t)||(t=[t]);const l=[],p=()=>{l.forEach(m=>m()),l.length=0},y=(m,h,i,f)=>(m.addEventListener(h,i,f),()=>m.removeEventListener(h,i,f)),C=e.watch(()=>[K(s),w(a)],([m,h])=>{if(p(),!m)return;const i=H(h)?{...h}:h;l.push(...r.flatMap(f=>t.map(c=>y(m,f,c,i))))},{immediate:!0,flush:"post"}),b=()=>{C(),p()};return I(b),b}function X(n,s={}){var r,t;const{pointerTypes:a,preventDefault:l,stopPropagation:p,exact:y,onMove:C,onEnd:b,onStart:m,initialValue:h,axis:i="both",draggingElement:f=z,containerElement:c,handle:v=n}=s,d=e.ref((r=w(h))!=null?r:{x:0,y:0}),k=e.ref(),E=u=>a?a.includes(u.pointerType):!0,x=u=>{w(l)&&u.preventDefault(),w(p)&&u.stopPropagation()},L=u=>{var S;if(!E(u)||w(y)&&u.target!==w(n))return;const _=w(c),B=(S=_==null?void 0:_.getBoundingClientRect)==null?void 0:S.call(_),o=w(n).getBoundingClientRect(),g={x:u.clientX-(_?o.left-B.left:o.left),y:u.clientY-(_?o.top-B.top:o.top)};(m==null?void 0:m(g,u))!==!1&&(k.value=g,x(u))},A=u=>{var S;if(!E(u)||!k.value)return;const _=w(c),B=(S=_==null?void 0:_.getBoundingClientRect)==null?void 0:S.call(_),o=w(n).getBoundingClientRect();let{x:g,y:M}=d.value;(i==="x"||i==="both")&&(g=u.clientX-k.value.x,_&&(g=Math.min(Math.max(0,g),B.width-o.width))),(i==="y"||i==="both")&&(M=u.clientY-k.value.y,_&&(M=Math.min(Math.max(0,M),B.height-o.height))),d.value={x:g,y:M},C==null||C(d.value,u),x(u)},P=u=>{E(u)&&k.value&&(k.value=void 0,b==null||b(d.value,u),x(u))};if(R){const u={capture:(t=s.capture)!=null?t:!0};T(v,"pointerdown",L,u),T(f,"pointermove",A,u),T(f,"pointerup",P,u)}return{...G(d),position:d,isDragging:e.computed(()=>!!k.value),style:e.computed(()=>`left:${d.value.x}px;top:${d.value.y}px;`)}}const D=n=>(e.pushScopeId("data-v-54c3f8b0"),n=n(),e.popScopeId(),n),Y={class:"title text-16px font-bold"},q={class:"action"},U={key:1,class:"modal-footer space-x-2"},J=["form"],Q=D(()=>e.createElementVNode("div",{id:"modal-footer-slot"},null,-1)),Z={key:2,class:"modal-loading"},ee=D(()=>e.createElementVNode("div",{class:"lds-ring"},[e.createElementVNode("div"),e.createElementVNode("div"),e.createElementVNode("div"),e.createElementVNode("div")],-1)),te=[ee],oe={name:"ModalContainer",inheritAttrs:!0},ne=e.defineComponent({...oe,props:{id:{},form:{},component:{},componentProps:{},width:{},maxWidth:{},maxHeight:{},sizes:{},size:{default:"middle"},fullscreen:{type:Boolean},title:{},header:{type:Boolean,default:!0},footer:{type:Boolean,default:!1},closeable:{type:Boolean,default:!0},esc:{type:Boolean,default:!1},maskClosable:{type:Boolean,default:!1},draggable:{type:Boolean,default:!1},mode:{default:"dialog"},type:{},offset:{},backgroundColor:{},bodyStyle:{},submitText:{default:"确定"},cancelText:{default:"取消"}},emits:["submit"],setup(n,{expose:s,emit:r}){const t=n,a=r,l=e.inject(N),p=e.ref(!1);let y=0,C=0;const b=e.shallowRef(),m=e.shallowRef(),h=e.shallowRef(),{x:i,y:f}=X(h,{initialValue:{x:0,y:0}});function c(){l==null||l.close(t.id)}function v(o){if(typeof o=="number")return`${o}px`;if(typeof o=="string")return o}const d=e.computed(()=>{const o={};return t.mode==="dialog"&&(o.justifyContent="center"),t.mode==="drawer"&&(o.justifyContent="flex-end"),o}),k=e.computed(()=>{const o={};return t.size&&(o.width=v(t.sizes[t.size])),t.width&&(o.width=v(t.width)),t.maxWidth&&(o.maxWidth=v(t.maxWidth)),t.fullscreen&&(o.maxWidth="unset",o.width="100%",o.position="fixed",o.top=0,o.left=0,o.bottom=0,o.right=0,o.borderRadius=0),t.draggable&&!t.fullscreen&&t.mode==="dialog"&&(o.transform=`translate3d(${i.value-y}px, ${f.value-C}px, 0px)`),t.mode==="drawer"&&(o.borderRadius=0,o.height="100%"),t.offset&&t.mode==="dialog"&&(o.marginLeft=`${t.offset.x||0}px`,o.marginTop=`${t.offset.y||0}px`),t.backgroundColor&&(o.backgroundColor=t.backgroundColor),o}),E=e.computed(()=>{const o={};return t.draggable&&!t.fullscreen&&t.mode==="dialog"&&(o.cursor="move"),o}),x=e.computed(()=>{var g;const o={};return t.maxHeight&&(o.maxHeight=`calc(${(g=v(t.maxHeight))==null?void 0:g.replace("%","vh")} - 50px)`),t.mode==="drawer"&&(o.maxHeight="unset",o.height=`calc(100% - ${(t.header?50:0)+(t.footer?50:0)}px)`),t.fullscreen&&(o.maxHeight="unset",o.height=`calc(100% - ${(t.header?50:0)+(t.footer?50:0)}px)`),t.type!=="component"&&(o.padding="0"),t.bodyStyle&&Object.assign(o,t.bodyStyle),o});function L(){const o=m.value;if(t.form&&o){const g=o.querySelector(`form[name="${t.form}"]`);g&&g.dispatchEvent(new Event("submit"))}a("submit")}function A(){l==null||l.close(t.id)}function P(){window&&window.addEventListener("resize",()=>{e.triggerRef(b),e.triggerRef(m),m.value&&(y=m.value.offsetLeft,C=m.value.offsetTop)})}function u(){if(t.closeable&&t.esc){const o=({key:g})=>{g==="Escape"&&(l==null||l.close(t.id),window.removeEventListener("keydown",o))};window.addEventListener("keydown",o)}}function S(){y=m.value.offsetLeft,C=m.value.offsetTop}e.onMounted(()=>{u(),P()}),e.onUnmounted(()=>{});function _(){return p.value=!0,()=>B()}function B(){p.value=!1}return s({showLoading:_,hideLoading:B}),(o,g)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"wrapperRef",ref:b,class:"modal-wrapper",style:e.normalizeStyle(d.value),onClick:g[0]||(g[0]=e.withModifiers(M=>o.maskClosable&&c(),["self"]))},[e.createElementVNode("div",{ref_key:"contentRef",ref:m,class:e.normalizeClass(["modal-content",{[`${o.mode}-mode`]:!0}]),style:e.normalizeStyle(k.value)},[o.header?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"headerRef",ref:h,class:"modal-header",style:e.normalizeStyle(E.value),onMousedown:S},[e.createElementVNode("div",Y,e.toDisplayString(o.title),1),e.createElementVNode("div",q,[o.closeable?(e.openBlock(),e.createElementBlock("div",{key:0,class:"i-icon-park-outline:close block cursor-pointer",onClick:c})):e.createCommentVNode("",!0)])],36)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"modal-body",style:e.normalizeStyle(x.value)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.component),e.normalizeProps(e.guardReactiveProps(o.componentProps)),null,16))],4),o.footer?(e.openBlock(),e.createElementBlock("div",U,[e.createElementVNode("button",{class:"cancel-button",type:"button",onClick:A},e.toDisplayString(o.cancelText),1),e.createElementVNode("button",{class:"submit-button",form:o.form,type:"submit",onClick:L},e.toDisplayString(o.submitText),9,J)])):e.createCommentVNode("",!0),Q,p.value?(e.openBlock(),e.createElementBlock("div",Z,te)):e.createCommentVNode("",!0)],6)],4))}});const $=(n,s)=>{const r=n.__vccOpts||n;for(const[t,a]of s)r[t]=a;return r},O=$(ne,[["__scopeId","data-v-54c3f8b0"]]),re={class:"modal-dialog"},le={class:"dialog-body"},ie={class:"dialog-title"},se={class:"dialog-content"},ae=e.defineComponent({__name:"modal-dialog",props:{type:{},title:{},content:{},okText:{default:"确定"},cancelText:{default:"取消"},onOk:{},onCancel:{},footer:{}},setup(n){const s=n,r=F(),t=e.computed(()=>s.title?s.title:{confirm:"提示",info:"提示",warning:"警告",error:"错误",success:"成功"}[s.type]);async function a(){s.onOk&&await s.onOk(),r.close()}async function l(){s.onCancel&&await s.onCancel(),r.close()}return(p,y)=>(e.openBlock(),e.createElementBlock("section",re,[e.createElementVNode("div",le,[e.createElementVNode("div",ie,e.toDisplayString(t.value),1),e.createElementVNode("div",se,e.toDisplayString(p.content),1)]),e.createElementVNode("div",{class:"dialog-footer space-x-2",style:e.normalizeStyle(p.type==="confirm"?{"justify-content":"end"}:{"border-top":"none"})},[p.footer?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(p.footer),{key:0})):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("button",{class:"submit-button",type:"submit",onClick:a},e.toDisplayString(p.okText),1),p.type==="confirm"?(e.openBlock(),e.createElementBlock("button",{key:0,class:"cancel-button",type:"button",onClick:l},e.toDisplayString(p.cancelText),1)):e.createCommentVNode("",!0)],64))],4)]))}});const ce=$(ae,[["__scopeId","data-v-8326e5a5"]]),de={key:0,class:"modal-teleport"},ue={name:"ModalProvider",inheritAttrs:!0},fe=e.defineComponent({...ue,props:{appendToBody:{type:[Boolean,String],default:!1},sizes:{default:()=>({small:520,middle:860,large:1190})},maxWidth:{default:"90%"},maxHeight:{default:"80%"},offset:{default:()=>({x:0,y:0})}},setup(n,{expose:s}){const r=e.shallowRef([]),t=e.ref(!1),a=e.getCurrentInstance();function l(i,f={},c={}){const v=e.defineAsyncComponent(()=>Promise.resolve(typeof i=="string"?ce:i));typeof i=="string"&&(f.type=i,c.size="small",c.fullscreen=!1,c.mode="dialog",c.footer=!1,c.header=!1);const d=Math.random().toString(32).slice(2),k=new Promise((E,x)=>{r.value.push({id:d,component:v,props:f||{},options:{...c,type:typeof i=="string"?i:"component"},resolve:E,reject:x,listeners:[]}),e.triggerRef(r)}).catch(E=>E==="CANCEL"?new Promise(()=>{}):Promise.reject(E));return Object.assign(k,{close:()=>p(d)})}function p(i,f){const c=r.value.findIndex(d=>d.id===i);if(c<0)return;const v=r.value[c];f===void 0?v==null||v.reject("CANCEL"):v==null||v.resolve(f),r.value.splice(c,1),e.triggerRef(r)}function y(){!r.value||r.value.length===0||(r.value.forEach(i=>{i==null||i.reject("CANCEL")}),r.value=[],e.triggerRef(r))}function C(i,f){const c=r.value.find(d=>d.id===i);if(!c)return;const v=c.listeners.find(d=>d.event===f);v&&v.callback({open:l,close:d=>p(c.id,d),closeAll:y,showLoading:()=>b(c.id),hideLoading:()=>m(c.id),confirm:d=>l("confirm",d),success:d=>l("success",d),error:d=>l("error",d),warning:d=>l("warning",d),info:d=>l("info",d)})}function b(i){if(!a)return;const[f]=a.refs[`modal-container_${i}`];if(f)return f.showLoading()}function m(i){if(!a)return;const[f]=a.refs[`modal-container_${i}`];if(f)return f.hideLoading()}function h(i,f,c){const v=r.value.find(d=>d.id===i);v&&v.listeners.push({event:f,callback:c})}return e.provide(N,{open:l,close:p,closeAll:y,addEventListener:h}),s({elements:r,open:l,close:p,closeAll:y}),e.onMounted(()=>{t.value=!0}),(i,f)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.renderSlot(i.$slots,"default",{},void 0,!0),t.value?(e.openBlock(),e.createElementBlock("div",de,[(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(r.value,c=>(e.openBlock(),e.createBlock(O,e.mergeProps({id:c.id,key:c.id,ref_for:!0,ref:`modal-container_${c.id}`,component:c.component,"component-props":c.props,"max-height":i.maxHeight,"max-width":i.maxWidth,offset:i.offset,sizes:i.sizes},c.options,{onSubmit:()=>C(c.id,"submit")}),null,16,["id","component","component-props","max-height","max-width","offset","sizes","onSubmit"]))),128))]),_:1})],8,["disabled","to"]))])):e.createCommentVNode("",!0)],64))}});const pe=$(fe,[["__scopeId","data-v-d8913113"]]);const me={},ve={class:"modal-footer"};function ye(n,s){return e.openBlock(),e.createBlock(e.Teleport,{to:"#modal-footer-slot"},[e.createElementVNode("div",ve,[e.renderSlot(n.$slots,"default",{},void 0,!0)])])}const ge=$(me,[["render",ye],["__scopeId","data-v-13e08ed6"]]);function V(n,s){var t,a;let r=n==null?void 0:n.parent;for(;r&&((t=r==null?void 0:r.type)==null?void 0:t.name)!==s;)r=r.parent;return((a=r==null?void 0:r.type)==null?void 0:a.name)===s?r:null}function F(){const n=e.inject(N),s=e.getCurrentInstance();function r(t,a,l){if(!n)throw new Error("Not Found Modal Provider Component");return n.open(t,a,l)}return{open:r,close(t){var p;if(!n)throw new Error("Not Found Modal Provider Component");const a=V(s,"ModalContainer"),l=(p=a==null?void 0:a.props)==null?void 0:p.id;if(!l)throw new Error("Not Found Current Modal Container");n.close(l,t)},closeAll(){if(!n)throw new Error("Not Found Modal Provider Component");n.closeAll()},showLoading(){var l;if(!n)throw new Error("Not Found Modal Provider Component");const t=V(s,"ModalContainer");if(!((l=t==null?void 0:t.props)==null?void 0:l.id))throw new Error("Not Found Current Modal Container");t!=null&&t.exposed&&(t==null||t.exposed.showLoading())},hideLoading(){var l;if(!n)throw new Error("Not Found Modal Provider Component");const t=V(s,"ModalContainer");if(!((l=t==null?void 0:t.props)==null?void 0:l.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 he(n){var l;const s=e.inject(N),r=e.getCurrentInstance(),t=V(r,"ModalContainer"),a=(l=t==null?void 0:t.props)==null?void 0:l.id;s&&a&&s.addEventListener(a,"submit",n)}exports.ModalContainer=O;exports.ModalFooter=ge;exports.ModalKey=N;exports.ModalProvider=pe;exports.onSubmit=he;exports.useModal=F;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue");const N=Symbol("__MODAL__");function H(n){return e.getCurrentScope()?(e.onScopeDispose(n),!0):!1}function w(n){return typeof n=="function"?n():e.unref(n)}const z=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const I=Object.prototype.toString,W=n=>I.call(n)==="[object Object]",j=()=>{};function G(n,s={}){if(!e.isRef(n))return e.toRefs(n);const r=Array.isArray(n.value)?Array.from({length:n.value.length}):{};for(const t in n.value)r[t]=e.customRef(()=>({get(){return n.value[t]},set(a){var l;if((l=w(s.replaceRef))!=null?l:!0)if(Array.isArray(n.value)){const y=[...n.value];y[t]=a,n.value=y}else{const y={...n.value,[t]:a};Object.setPrototypeOf(y,Object.getPrototypeOf(n.value)),n.value=y}else n.value[t]=a}}));return r}function K(n){var s;const r=w(n);return(s=r==null?void 0:r.$el)!=null?s:r}const D=z?window:void 0;function P(...n){let s,r,t,a;if(typeof n[0]=="string"||Array.isArray(n[0])?([r,t,a]=n,s=D):[s,r,t,a]=n,!s)return j;Array.isArray(r)||(r=[r]),Array.isArray(t)||(t=[t]);const l=[],p=()=>{l.forEach(m=>m()),l.length=0},y=(m,h,i,f)=>(m.addEventListener(h,i,f),()=>m.removeEventListener(h,i,f)),C=e.watch(()=>[K(s),w(a)],([m,h])=>{if(p(),!m)return;const i=W(h)?{...h}:h;l.push(...r.flatMap(f=>t.map(c=>y(m,f,c,i))))},{immediate:!0,flush:"post"}),b=()=>{C(),p()};return H(b),b}function X(n,s={}){var r,t;const{pointerTypes:a,preventDefault:l,stopPropagation:p,exact:y,onMove:C,onEnd:b,onStart:m,initialValue:h,axis:i="both",draggingElement:f=D,containerElement:c,handle:v=n}=s,d=e.ref((r=w(h))!=null?r:{x:0,y:0}),k=e.ref(),E=u=>a?a.includes(u.pointerType):!0,x=u=>{w(l)&&u.preventDefault(),w(p)&&u.stopPropagation()},L=u=>{var S;if(!E(u)||w(y)&&u.target!==w(n))return;const _=w(c),B=(S=_==null?void 0:_.getBoundingClientRect)==null?void 0:S.call(_),o=w(n).getBoundingClientRect(),g={x:u.clientX-(_?o.left-B.left:o.left),y:u.clientY-(_?o.top-B.top:o.top)};(m==null?void 0:m(g,u))!==!1&&(k.value=g,x(u))},A=u=>{var S;if(!E(u)||!k.value)return;const _=w(c),B=(S=_==null?void 0:_.getBoundingClientRect)==null?void 0:S.call(_),o=w(n).getBoundingClientRect();let{x:g,y:M}=d.value;(i==="x"||i==="both")&&(g=u.clientX-k.value.x,_&&(g=Math.min(Math.max(0,g),B.width-o.width))),(i==="y"||i==="both")&&(M=u.clientY-k.value.y,_&&(M=Math.min(Math.max(0,M),B.height-o.height))),d.value={x:g,y:M},C==null||C(d.value,u),x(u)},T=u=>{E(u)&&k.value&&(k.value=void 0,b==null||b(d.value,u),x(u))};if(z){const u={capture:(t=s.capture)!=null?t:!0};P(v,"pointerdown",L,u),P(f,"pointermove",A,u),P(f,"pointerup",T,u)}return{...G(d),position:d,isDragging:e.computed(()=>!!k.value),style:e.computed(()=>`left:${d.value.x}px;top:${d.value.y}px;`)}}const R=n=>(e.pushScopeId("data-v-4af3c744"),n=n(),e.popScopeId(),n),Y={class:"title text-16px font-bold"},q={class:"action"},U=R(()=>e.createElementVNode("div",{id:"modal-header-slot"},null,-1)),J=R(()=>e.createElementVNode("div",{id:"modal-footer-slot"},null,-1)),Q={key:1,class:"modal-footer space-x-2"},Z=["form"],ee={key:2,class:"modal-loading"},te=R(()=>e.createElementVNode("div",{class:"lds-ring"},[e.createElementVNode("div"),e.createElementVNode("div"),e.createElementVNode("div"),e.createElementVNode("div")],-1)),oe=[te],ne={name:"ModalContainer",inheritAttrs:!0},re=e.defineComponent({...ne,props:{id:{},form:{},component:{},componentProps:{},width:{},maxWidth:{},maxHeight:{},sizes:{},size:{default:"middle"},fullscreen:{type:Boolean},title:{},header:{type:Boolean,default:!0},footer:{type:Boolean,default:!1},closeable:{type:Boolean,default:!0},esc:{type:Boolean,default:!1},maskClosable:{type:Boolean,default:!1},draggable:{type:Boolean,default:!1},mode:{default:"dialog"},type:{},offset:{},backgroundColor:{},bodyStyle:{},submitText:{default:"确定"},cancelText:{default:"取消"}},emits:["submit"],setup(n,{expose:s,emit:r}){const t=n,a=r,l=e.inject(N),p=e.ref(!1);let y=0,C=0;const b=e.shallowRef(),m=e.shallowRef(),h=e.shallowRef(),{x:i,y:f}=X(h,{initialValue:{x:0,y:0}});function c(){l==null||l.close(t.id)}function v(o){if(typeof o=="number")return`${o}px`;if(typeof o=="string")return o}const d=e.computed(()=>{const o={};return t.mode==="dialog"&&(o.justifyContent="center"),t.mode==="drawer"&&(o.justifyContent="flex-end"),o}),k=e.computed(()=>{const o={};return t.size&&(o.width=v(t.sizes[t.size])),t.width&&(o.width=v(t.width)),t.maxWidth&&(o.maxWidth=v(t.maxWidth)),t.fullscreen&&(o.maxWidth="unset",o.width="100%",o.position="fixed",o.top=0,o.left=0,o.bottom=0,o.right=0,o.borderRadius=0),t.draggable&&!t.fullscreen&&t.mode==="dialog"&&(o.transform=`translate3d(${i.value-y}px, ${f.value-C}px, 0px)`),t.mode==="drawer"&&(o.borderRadius=0,o.height="100%"),t.offset&&t.mode==="dialog"&&(o.marginLeft=`${t.offset.x||0}px`,o.marginTop=`${t.offset.y||0}px`),t.backgroundColor&&(o.backgroundColor=t.backgroundColor),o}),E=e.computed(()=>{const o={};return t.draggable&&!t.fullscreen&&t.mode==="dialog"&&(o.cursor="move"),o}),x=e.computed(()=>{var g;const o={};return t.maxHeight&&(o.maxHeight=`calc(${(g=v(t.maxHeight))==null?void 0:g.replace("%","vh")} - 50px)`),t.mode==="drawer"&&(o.maxHeight="unset",o.height=`calc(100% - ${(t.header?50:0)+(t.footer?50:0)}px)`),t.fullscreen&&(o.maxHeight="unset",o.height=`calc(100% - ${(t.header?50:0)+(t.footer?50:0)}px)`),t.type!=="component"&&(o.padding="0"),t.bodyStyle&&Object.assign(o,t.bodyStyle),o});function L(){const o=m.value;if(t.form&&o){const g=o.querySelector(`form[name="${t.form}"]`);g&&g.dispatchEvent(new Event("submit"))}a("submit")}function A(){l==null||l.close(t.id)}function T(){window&&window.addEventListener("resize",()=>{e.triggerRef(b),e.triggerRef(m),m.value&&(y=m.value.offsetLeft,C=m.value.offsetTop)})}function u(){if(t.closeable&&t.esc){const o=({key:g})=>{g==="Escape"&&(l==null||l.close(t.id),window.removeEventListener("keydown",o))};window.addEventListener("keydown",o)}}function S(){y=m.value.offsetLeft,C=m.value.offsetTop}e.onMounted(()=>{u(),T()}),e.onUnmounted(()=>{});function _(){return p.value=!0,()=>B()}function B(){p.value=!1}return s({showLoading:_,hideLoading:B}),(o,g)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"wrapperRef",ref:b,class:"modal-wrapper",style:e.normalizeStyle(d.value),onClick:g[0]||(g[0]=e.withModifiers(M=>o.maskClosable&&c(),["self"]))},[e.createElementVNode("div",{ref_key:"contentRef",ref:m,class:e.normalizeClass(["modal-content",{[`${o.mode}-mode`]:!0}]),style:e.normalizeStyle(k.value)},[o.header?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"headerRef",ref:h,class:"modal-header",style:e.normalizeStyle(E.value),onMousedown:S},[e.createElementVNode("div",Y,e.toDisplayString(o.title),1),e.createElementVNode("div",q,[o.closeable?(e.openBlock(),e.createElementBlock("div",{key:0,class:"i-icon-park-outline:close block cursor-pointer",onClick:c})):e.createCommentVNode("",!0)])],36)):e.createCommentVNode("",!0),U,e.createElementVNode("div",{class:"modal-body",style:e.normalizeStyle(x.value)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.component),e.normalizeProps(e.guardReactiveProps(o.componentProps)),null,16))],4),J,o.footer?(e.openBlock(),e.createElementBlock("div",Q,[e.createElementVNode("button",{class:"cancel-button",type:"button",onClick:A},e.toDisplayString(o.cancelText),1),e.createElementVNode("button",{class:"submit-button",form:o.form,type:"submit",onClick:L},e.toDisplayString(o.submitText),9,Z)])):e.createCommentVNode("",!0),p.value?(e.openBlock(),e.createElementBlock("div",ee,oe)):e.createCommentVNode("",!0)],6)],4))}});const $=(n,s)=>{const r=n.__vccOpts||n;for(const[t,a]of s)r[t]=a;return r},O=$(re,[["__scopeId","data-v-4af3c744"]]),le={class:"modal-dialog"},ie={class:"dialog-body"},se={class:"dialog-title"},ae={class:"dialog-content"},ce=e.defineComponent({__name:"modal-dialog",props:{type:{},title:{},content:{},okText:{default:"确定"},cancelText:{default:"取消"},onOk:{},onCancel:{},footer:{}},setup(n){const s=n,r=F(),t=e.computed(()=>s.title?s.title:{confirm:"提示",info:"提示",warning:"警告",error:"错误",success:"成功"}[s.type]);async function a(){s.onOk&&await s.onOk(),r.close()}async function l(){s.onCancel&&await s.onCancel(),r.close()}return(p,y)=>(e.openBlock(),e.createElementBlock("section",le,[e.createElementVNode("div",ie,[e.createElementVNode("div",se,e.toDisplayString(t.value),1),e.createElementVNode("div",ae,e.toDisplayString(p.content),1)]),e.createElementVNode("div",{class:"dialog-footer space-x-2",style:e.normalizeStyle(p.type==="confirm"?{"justify-content":"end"}:{"border-top":"none"})},[p.footer?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(p.footer),{key:0})):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("button",{class:"submit-button",type:"submit",onClick:a},e.toDisplayString(p.okText),1),p.type==="confirm"?(e.openBlock(),e.createElementBlock("button",{key:0,class:"cancel-button",type:"button",onClick:l},e.toDisplayString(p.cancelText),1)):e.createCommentVNode("",!0)],64))],4)]))}});const de=$(ce,[["__scopeId","data-v-8326e5a5"]]),ue={key:0,class:"modal-teleport"},fe={name:"ModalProvider",inheritAttrs:!0},pe=e.defineComponent({...fe,props:{appendToBody:{type:[Boolean,String],default:!1},sizes:{default:()=>({small:520,middle:860,large:1190})},maxWidth:{default:"90%"},maxHeight:{default:"90%"},offset:{default:()=>({x:0,y:0})}},setup(n,{expose:s}){const r=e.shallowRef([]),t=e.ref(!1),a=e.getCurrentInstance();function l(i,f={},c={}){const v=e.defineAsyncComponent(()=>Promise.resolve(typeof i=="string"?de:i));typeof i=="string"&&(f.type=i,c.size="small",c.fullscreen=!1,c.mode="dialog",c.footer=!1,c.header=!1);const d=Math.random().toString(32).slice(2),k=new Promise((E,x)=>{r.value.push({id:d,component:v,props:f||{},options:{...c,type:typeof i=="string"?i:"component"},resolve:E,reject:x,listeners:[]}),e.triggerRef(r)}).catch(E=>E==="CANCEL"?new Promise(()=>{}):Promise.reject(E));return Object.assign(k,{close:()=>p(d)})}function p(i,f){const c=r.value.findIndex(d=>d.id===i);if(c<0)return;const v=r.value[c];f===void 0?v==null||v.reject("CANCEL"):v==null||v.resolve(f),r.value.splice(c,1),e.triggerRef(r)}function y(){!r.value||r.value.length===0||(r.value.forEach(i=>{i==null||i.reject("CANCEL")}),r.value=[],e.triggerRef(r))}function C(i,f){const c=r.value.find(d=>d.id===i);if(!c)return;const v=c.listeners.find(d=>d.event===f);v&&v.callback({open:l,close:d=>p(c.id,d),closeAll:y,showLoading:()=>b(c.id),hideLoading:()=>m(c.id),confirm:d=>l("confirm",d),success:d=>l("success",d),error:d=>l("error",d),warning:d=>l("warning",d),info:d=>l("info",d)})}function b(i){if(!a)return;const[f]=a.refs[`modal-container_${i}`];if(f)return f.showLoading()}function m(i){if(!a)return;const[f]=a.refs[`modal-container_${i}`];if(f)return f.hideLoading()}function h(i,f,c){const v=r.value.find(d=>d.id===i);v&&v.listeners.push({event:f,callback:c})}return e.provide(N,{open:l,close:p,closeAll:y,addEventListener:h}),s({elements:r,open:l,close:p,closeAll:y}),e.onMounted(()=>{t.value=!0}),(i,f)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.renderSlot(i.$slots,"default",{},void 0,!0),t.value?(e.openBlock(),e.createElementBlock("div",ue,[(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(r.value,c=>(e.openBlock(),e.createBlock(O,e.mergeProps({id:c.id,key:c.id,ref_for:!0,ref:`modal-container_${c.id}`,component:c.component,"component-props":c.props,"max-height":i.maxHeight,"max-width":i.maxWidth,offset:i.offset,sizes:i.sizes},c.options,{onSubmit:()=>C(c.id,"submit")}),null,16,["id","component","component-props","max-height","max-width","offset","sizes","onSubmit"]))),128))]),_:1})],8,["disabled","to"]))])):e.createCommentVNode("",!0)],64))}});const me=$(pe,[["__scopeId","data-v-241a8304"]]);const ve={},ye={class:"modal-footer"};function ge(n,s){return e.openBlock(),e.createBlock(e.Teleport,{to:"#modal-footer-slot"},[e.createElementVNode("div",ye,[e.renderSlot(n.$slots,"default",{},void 0,!0)])])}const he=$(ve,[["render",ge],["__scopeId","data-v-2080a86e"]]);const _e={},we={class:"modal-header"};function ke(n,s){return e.openBlock(),e.createBlock(e.Teleport,{to:"#modal-header-slot"},[e.createElementVNode("div",we,[e.renderSlot(n.$slots,"default",{},void 0,!0)])])}const Ce=$(_e,[["render",ke],["__scopeId","data-v-d0247172"]]);function V(n,s){var t,a;let r=n==null?void 0:n.parent;for(;r&&((t=r==null?void 0:r.type)==null?void 0:t.name)!==s;)r=r.parent;return((a=r==null?void 0:r.type)==null?void 0:a.name)===s?r:null}function F(){const n=e.inject(N),s=e.getCurrentInstance();function r(t,a,l){if(!n)throw new Error("Not Found Modal Provider Component");return n.open(t,a,l)}return{open:r,close(t){var p;if(!n)throw new Error("Not Found Modal Provider Component");const a=V(s,"ModalContainer"),l=(p=a==null?void 0:a.props)==null?void 0:p.id;if(!l)throw new Error("Not Found Current Modal Container");n.close(l,t)},closeAll(){if(!n)throw new Error("Not Found Modal Provider Component");n.closeAll()},showLoading(){var l;if(!n)throw new Error("Not Found Modal Provider Component");const t=V(s,"ModalContainer");if(!((l=t==null?void 0:t.props)==null?void 0:l.id))throw new Error("Not Found Current Modal Container");t!=null&&t.exposed&&(t==null||t.exposed.showLoading())},hideLoading(){var l;if(!n)throw new Error("Not Found Modal Provider Component");const t=V(s,"ModalContainer");if(!((l=t==null?void 0:t.props)==null?void 0:l.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 be(n){var l;const s=e.inject(N),r=e.getCurrentInstance(),t=V(r,"ModalContainer"),a=(l=t==null?void 0:t.props)==null?void 0:l.id;s&&a&&s.addEventListener(a,"submit",n)}exports.ModalContainer=O;exports.ModalFooter=he;exports.ModalHeader=Ce;exports.ModalKey=N;exports.ModalProvider=me;exports.onSubmit=be;exports.useModal=F;
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import ModalProvider from './components/modal-provider.vue';
|
|
2
2
|
import ModalContainer from './components/modal-container.vue';
|
|
3
3
|
import ModalFooter from './components/modal-footer.vue';
|
|
4
|
+
import ModalHeader from './components/modal-header.vue';
|
|
4
5
|
import { useModal } from './hooks/use-modal';
|
|
5
6
|
import { ModalKey } from './constants';
|
|
6
7
|
export { onSubmit } from './hooks/on-submit';
|
|
7
8
|
export * from './interfaces';
|
|
8
|
-
export { ModalContainer, ModalProvider, ModalFooter, useModal, ModalKey, };
|
|
9
|
+
export { ModalContainer, ModalProvider, ModalFooter, ModalHeader, useModal, ModalKey, };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>, {
|
|
2
|
+
default?(_: {}): any;
|
|
3
|
+
}>;
|
|
4
|
+
export default _default;
|
|
5
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
6
|
+
new (): {
|
|
7
|
+
$slots: S;
|
|
8
|
+
};
|
|
9
|
+
};
|
package/dist/es/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import ModalProvider from './components/modal-provider.vue';
|
|
2
2
|
import ModalContainer from './components/modal-container.vue';
|
|
3
3
|
import ModalFooter from './components/modal-footer.vue';
|
|
4
|
+
import ModalHeader from './components/modal-header.vue';
|
|
4
5
|
import { useModal } from './hooks/use-modal';
|
|
5
6
|
import { ModalKey } from './constants';
|
|
6
7
|
export { onSubmit } from './hooks/on-submit';
|
|
7
8
|
export * from './interfaces';
|
|
8
|
-
export { ModalContainer, ModalProvider, ModalFooter, useModal, ModalKey, };
|
|
9
|
+
export { ModalContainer, ModalProvider, ModalFooter, ModalHeader, useModal, ModalKey, };
|
package/dist/es/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { unref as ne, isRef as
|
|
1
|
+
import { unref as ne, isRef as re, toRefs as ie, customRef as se, getCurrentScope as le, onScopeDispose as ae, ref as H, computed as A, watch as de, defineComponent as Y, inject as K, shallowRef as D, onMounted as Z, onUnmounted as ce, openBlock as g, createElementBlock as x, normalizeStyle as z, withModifiers as ue, createElementVNode as v, normalizeClass as fe, toDisplayString as P, createCommentVNode as T, createBlock as B, resolveDynamicComponent as ee, normalizeProps as pe, guardReactiveProps as me, triggerRef as R, pushScopeId as ve, popScopeId as he, Fragment as X, getCurrentInstance as q, provide as ye, renderSlot as U, Teleport as J, createVNode as ge, TransitionGroup as _e, withCtx as we, renderList as be, mergeProps as Ce, defineAsyncComponent as xe } from "vue";
|
|
2
2
|
const W = Symbol("__MODAL__");
|
|
3
3
|
function ke(o) {
|
|
4
4
|
return le() ? (ae(o), !0) : !1;
|
|
@@ -6,13 +6,13 @@ function ke(o) {
|
|
|
6
6
|
function b(o) {
|
|
7
7
|
return typeof o == "function" ? o() : ne(o);
|
|
8
8
|
}
|
|
9
|
-
const
|
|
9
|
+
const te = typeof window < "u" && typeof document < "u";
|
|
10
10
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
11
|
-
const Me = Object.prototype.toString, Ee = (o) => Me.call(o) === "[object Object]",
|
|
11
|
+
const Me = Object.prototype.toString, Ee = (o) => Me.call(o) === "[object Object]", $e = () => {
|
|
12
12
|
};
|
|
13
|
-
function
|
|
14
|
-
if (!
|
|
15
|
-
return
|
|
13
|
+
function Se(o, s = {}) {
|
|
14
|
+
if (!re(o))
|
|
15
|
+
return ie(o);
|
|
16
16
|
const n = Array.isArray(o.value) ? Array.from({ length: o.value.length }) : {};
|
|
17
17
|
for (const e in o.value)
|
|
18
18
|
n[e] = se(() => ({
|
|
@@ -20,14 +20,14 @@ function $e(o, s = {}) {
|
|
|
20
20
|
return o.value[e];
|
|
21
21
|
},
|
|
22
22
|
set(l) {
|
|
23
|
-
var
|
|
24
|
-
if ((
|
|
23
|
+
var r;
|
|
24
|
+
if ((r = b(s.replaceRef)) != null ? r : !0)
|
|
25
25
|
if (Array.isArray(o.value)) {
|
|
26
|
-
const
|
|
27
|
-
|
|
26
|
+
const h = [...o.value];
|
|
27
|
+
h[e] = l, o.value = h;
|
|
28
28
|
} else {
|
|
29
|
-
const
|
|
30
|
-
Object.setPrototypeOf(
|
|
29
|
+
const h = { ...o.value, [e]: l };
|
|
30
|
+
Object.setPrototypeOf(h, Object.getPrototypeOf(o.value)), o.value = h;
|
|
31
31
|
}
|
|
32
32
|
else
|
|
33
33
|
o.value[e] = l;
|
|
@@ -40,22 +40,22 @@ function Le(o) {
|
|
|
40
40
|
const n = b(o);
|
|
41
41
|
return (s = n == null ? void 0 : n.$el) != null ? s : n;
|
|
42
42
|
}
|
|
43
|
-
const
|
|
43
|
+
const oe = te ? window : void 0;
|
|
44
44
|
function G(...o) {
|
|
45
45
|
let s, n, e, l;
|
|
46
|
-
if (typeof o[0] == "string" || Array.isArray(o[0]) ? ([n, e, l] = o, s =
|
|
47
|
-
return
|
|
46
|
+
if (typeof o[0] == "string" || Array.isArray(o[0]) ? ([n, e, l] = o, s = oe) : [s, n, e, l] = o, !s)
|
|
47
|
+
return $e;
|
|
48
48
|
Array.isArray(n) || (n = [n]), Array.isArray(e) || (e = [e]);
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
},
|
|
49
|
+
const r = [], f = () => {
|
|
50
|
+
r.forEach((p) => p()), r.length = 0;
|
|
51
|
+
}, h = (p, _, i, u) => (p.addEventListener(_, i, u), () => p.removeEventListener(_, i, u)), k = de(
|
|
52
52
|
() => [Le(s), b(l)],
|
|
53
53
|
([p, _]) => {
|
|
54
54
|
if (f(), !p)
|
|
55
55
|
return;
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
...n.flatMap((u) => e.map((a) =>
|
|
56
|
+
const i = Ee(_) ? { ..._ } : _;
|
|
57
|
+
r.push(
|
|
58
|
+
...n.flatMap((u) => e.map((a) => h(p, u, a, i)))
|
|
59
59
|
);
|
|
60
60
|
},
|
|
61
61
|
{ immediate: !0, flush: "post" }
|
|
@@ -68,49 +68,49 @@ function Ae(o, s = {}) {
|
|
|
68
68
|
var n, e;
|
|
69
69
|
const {
|
|
70
70
|
pointerTypes: l,
|
|
71
|
-
preventDefault:
|
|
71
|
+
preventDefault: r,
|
|
72
72
|
stopPropagation: f,
|
|
73
|
-
exact:
|
|
73
|
+
exact: h,
|
|
74
74
|
onMove: k,
|
|
75
75
|
onEnd: M,
|
|
76
76
|
onStart: p,
|
|
77
77
|
initialValue: _,
|
|
78
|
-
axis:
|
|
79
|
-
draggingElement: u =
|
|
78
|
+
axis: i = "both",
|
|
79
|
+
draggingElement: u = oe,
|
|
80
80
|
containerElement: a,
|
|
81
81
|
handle: m = o
|
|
82
|
-
} = s, d =
|
|
82
|
+
} = s, d = H(
|
|
83
83
|
(n = b(_)) != null ? n : { x: 0, y: 0 }
|
|
84
|
-
), C =
|
|
85
|
-
b(
|
|
84
|
+
), C = H(), E = (c) => l ? l.includes(c.pointerType) : !0, S = (c) => {
|
|
85
|
+
b(r) && c.preventDefault(), b(f) && c.stopPropagation();
|
|
86
86
|
}, I = (c) => {
|
|
87
87
|
var L;
|
|
88
|
-
if (!E(c) || b(
|
|
88
|
+
if (!E(c) || b(h) && c.target !== b(o))
|
|
89
89
|
return;
|
|
90
|
-
const w = b(a),
|
|
91
|
-
x: c.clientX - (w ? t.left -
|
|
92
|
-
y: c.clientY - (w ? t.top -
|
|
90
|
+
const w = b(a), $ = (L = w == null ? void 0 : w.getBoundingClientRect) == null ? void 0 : L.call(w), t = b(o).getBoundingClientRect(), y = {
|
|
91
|
+
x: c.clientX - (w ? t.left - $.left : t.left),
|
|
92
|
+
y: c.clientY - (w ? t.top - $.top : t.top)
|
|
93
93
|
};
|
|
94
|
-
(p == null ? void 0 : p(
|
|
94
|
+
(p == null ? void 0 : p(y, c)) !== !1 && (C.value = y, S(c));
|
|
95
95
|
}, V = (c) => {
|
|
96
96
|
var L;
|
|
97
97
|
if (!E(c) || !C.value)
|
|
98
98
|
return;
|
|
99
|
-
const w = b(a),
|
|
100
|
-
let { x:
|
|
101
|
-
(
|
|
102
|
-
x:
|
|
103
|
-
y:
|
|
104
|
-
}, k == null || k(d.value, c),
|
|
99
|
+
const w = b(a), $ = (L = w == null ? void 0 : w.getBoundingClientRect) == null ? void 0 : L.call(w), t = b(o).getBoundingClientRect();
|
|
100
|
+
let { x: y, y: O } = d.value;
|
|
101
|
+
(i === "x" || i === "both") && (y = c.clientX - C.value.x, w && (y = Math.min(Math.max(0, y), $.width - t.width))), (i === "y" || i === "both") && (O = c.clientY - C.value.y, w && (O = Math.min(Math.max(0, O), $.height - t.height))), d.value = {
|
|
102
|
+
x: y,
|
|
103
|
+
y: O
|
|
104
|
+
}, k == null || k(d.value, c), S(c);
|
|
105
105
|
}, j = (c) => {
|
|
106
|
-
E(c) && C.value && (C.value = void 0, M == null || M(d.value, c),
|
|
106
|
+
E(c) && C.value && (C.value = void 0, M == null || M(d.value, c), S(c));
|
|
107
107
|
};
|
|
108
|
-
if (
|
|
108
|
+
if (te) {
|
|
109
109
|
const c = { capture: (e = s.capture) != null ? e : !0 };
|
|
110
110
|
G(m, "pointerdown", I, c), G(u, "pointermove", V, c), G(u, "pointerup", j, c);
|
|
111
111
|
}
|
|
112
112
|
return {
|
|
113
|
-
|
|
113
|
+
...Se(d),
|
|
114
114
|
position: d,
|
|
115
115
|
isDragging: A(() => !!C.value),
|
|
116
116
|
style: A(
|
|
@@ -118,24 +118,24 @@ function Ae(o, s = {}) {
|
|
|
118
118
|
)
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
|
-
const
|
|
121
|
+
const Q = (o) => (ve("data-v-4af3c744"), o = o(), he(), o), Pe = { class: "title text-16px font-bold" }, Te = { class: "action" }, Be = /* @__PURE__ */ Q(() => /* @__PURE__ */ v("div", { id: "modal-header-slot" }, null, -1)), Oe = /* @__PURE__ */ Q(() => /* @__PURE__ */ v("div", { id: "modal-footer-slot" }, null, -1)), ze = {
|
|
122
122
|
key: 1,
|
|
123
123
|
class: "modal-footer space-x-2"
|
|
124
|
-
},
|
|
124
|
+
}, Re = ["form"], Ne = {
|
|
125
125
|
key: 2,
|
|
126
126
|
class: "modal-loading"
|
|
127
|
-
},
|
|
128
|
-
/* @__PURE__ */
|
|
129
|
-
/* @__PURE__ */
|
|
130
|
-
/* @__PURE__ */
|
|
131
|
-
/* @__PURE__ */
|
|
132
|
-
], -1)),
|
|
133
|
-
|
|
134
|
-
],
|
|
127
|
+
}, De = /* @__PURE__ */ Q(() => /* @__PURE__ */ v("div", { class: "lds-ring" }, [
|
|
128
|
+
/* @__PURE__ */ v("div"),
|
|
129
|
+
/* @__PURE__ */ v("div"),
|
|
130
|
+
/* @__PURE__ */ v("div"),
|
|
131
|
+
/* @__PURE__ */ v("div")
|
|
132
|
+
], -1)), Fe = [
|
|
133
|
+
De
|
|
134
|
+
], He = {
|
|
135
135
|
name: "ModalContainer",
|
|
136
136
|
inheritAttrs: !0
|
|
137
137
|
}, We = /* @__PURE__ */ Y({
|
|
138
|
-
...
|
|
138
|
+
...He,
|
|
139
139
|
props: {
|
|
140
140
|
id: {},
|
|
141
141
|
form: {},
|
|
@@ -164,13 +164,13 @@ const oe = (o) => (ve("data-v-54c3f8b0"), o = o(), he(), o), Pe = { class: "titl
|
|
|
164
164
|
},
|
|
165
165
|
emits: ["submit"],
|
|
166
166
|
setup(o, { expose: s, emit: n }) {
|
|
167
|
-
const e = o, l = n,
|
|
168
|
-
let
|
|
169
|
-
const M =
|
|
167
|
+
const e = o, l = n, r = K(W), f = H(!1);
|
|
168
|
+
let h = 0, k = 0;
|
|
169
|
+
const M = D(), p = D(), _ = D(), { x: i, y: u } = Ae(_, {
|
|
170
170
|
initialValue: { x: 0, y: 0 }
|
|
171
171
|
});
|
|
172
172
|
function a() {
|
|
173
|
-
|
|
173
|
+
r == null || r.close(e.id);
|
|
174
174
|
}
|
|
175
175
|
function m(t) {
|
|
176
176
|
if (typeof t == "number")
|
|
@@ -183,78 +183,78 @@ const oe = (o) => (ve("data-v-54c3f8b0"), o = o(), he(), o), Pe = { class: "titl
|
|
|
183
183
|
return e.mode === "dialog" && (t.justifyContent = "center"), e.mode === "drawer" && (t.justifyContent = "flex-end"), t;
|
|
184
184
|
}), C = A(() => {
|
|
185
185
|
const t = {};
|
|
186
|
-
return e.size && (t.width = m(e.sizes[e.size])), e.width && (t.width = m(e.width)), e.maxWidth && (t.maxWidth = m(e.maxWidth)), e.fullscreen && (t.maxWidth = "unset", t.width = "100%", t.position = "fixed", t.top = 0, t.left = 0, t.bottom = 0, t.right = 0, t.borderRadius = 0), e.draggable && !e.fullscreen && e.mode === "dialog" && (t.transform = `translate3d(${
|
|
186
|
+
return e.size && (t.width = m(e.sizes[e.size])), e.width && (t.width = m(e.width)), e.maxWidth && (t.maxWidth = m(e.maxWidth)), e.fullscreen && (t.maxWidth = "unset", t.width = "100%", t.position = "fixed", t.top = 0, t.left = 0, t.bottom = 0, t.right = 0, t.borderRadius = 0), e.draggable && !e.fullscreen && e.mode === "dialog" && (t.transform = `translate3d(${i.value - h}px, ${u.value - k}px, 0px)`), e.mode === "drawer" && (t.borderRadius = 0, t.height = "100%"), e.offset && e.mode === "dialog" && (t.marginLeft = `${e.offset.x || 0}px`, t.marginTop = `${e.offset.y || 0}px`), e.backgroundColor && (t.backgroundColor = e.backgroundColor), t;
|
|
187
187
|
}), E = A(() => {
|
|
188
188
|
const t = {};
|
|
189
189
|
return e.draggable && !e.fullscreen && e.mode === "dialog" && (t.cursor = "move"), t;
|
|
190
|
-
}),
|
|
191
|
-
var
|
|
190
|
+
}), S = A(() => {
|
|
191
|
+
var y;
|
|
192
192
|
const t = {};
|
|
193
|
-
return e.maxHeight && (t.maxHeight = `calc(${(
|
|
193
|
+
return e.maxHeight && (t.maxHeight = `calc(${(y = m(e.maxHeight)) == null ? void 0 : y.replace("%", "vh")} - 50px)`), e.mode === "drawer" && (t.maxHeight = "unset", t.height = `calc(100% - ${(e.header ? 50 : 0) + (e.footer ? 50 : 0)}px)`), e.fullscreen && (t.maxHeight = "unset", t.height = `calc(100% - ${(e.header ? 50 : 0) + (e.footer ? 50 : 0)}px)`), e.type !== "component" && (t.padding = "0"), e.bodyStyle && Object.assign(t, e.bodyStyle), t;
|
|
194
194
|
});
|
|
195
195
|
function I() {
|
|
196
196
|
const t = p.value;
|
|
197
197
|
if (e.form && t) {
|
|
198
|
-
const
|
|
199
|
-
|
|
198
|
+
const y = t.querySelector(`form[name="${e.form}"]`);
|
|
199
|
+
y && y.dispatchEvent(new Event("submit"));
|
|
200
200
|
}
|
|
201
201
|
l("submit");
|
|
202
202
|
}
|
|
203
203
|
function V() {
|
|
204
|
-
|
|
204
|
+
r == null || r.close(e.id);
|
|
205
205
|
}
|
|
206
206
|
function j() {
|
|
207
207
|
window && window.addEventListener("resize", () => {
|
|
208
|
-
|
|
208
|
+
R(M), R(p), p.value && (h = p.value.offsetLeft, k = p.value.offsetTop);
|
|
209
209
|
});
|
|
210
210
|
}
|
|
211
211
|
function c() {
|
|
212
212
|
if (e.closeable && e.esc) {
|
|
213
|
-
const t = ({ key:
|
|
214
|
-
|
|
213
|
+
const t = ({ key: y }) => {
|
|
214
|
+
y === "Escape" && (r == null || r.close(e.id), window.removeEventListener("keydown", t));
|
|
215
215
|
};
|
|
216
216
|
window.addEventListener("keydown", t);
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
219
|
function L() {
|
|
220
|
-
|
|
220
|
+
h = p.value.offsetLeft, k = p.value.offsetTop;
|
|
221
221
|
}
|
|
222
|
-
|
|
222
|
+
Z(() => {
|
|
223
223
|
c(), j();
|
|
224
224
|
}), ce(() => {
|
|
225
225
|
});
|
|
226
226
|
function w() {
|
|
227
|
-
return f.value = !0, () =>
|
|
227
|
+
return f.value = !0, () => $();
|
|
228
228
|
}
|
|
229
|
-
function
|
|
229
|
+
function $() {
|
|
230
230
|
f.value = !1;
|
|
231
231
|
}
|
|
232
232
|
return s({
|
|
233
233
|
showLoading: w,
|
|
234
|
-
hideLoading:
|
|
235
|
-
}), (t,
|
|
234
|
+
hideLoading: $
|
|
235
|
+
}), (t, y) => (g(), x("div", {
|
|
236
236
|
ref_key: "wrapperRef",
|
|
237
237
|
ref: M,
|
|
238
238
|
class: "modal-wrapper",
|
|
239
|
-
style:
|
|
240
|
-
onClick:
|
|
239
|
+
style: z(d.value),
|
|
240
|
+
onClick: y[0] || (y[0] = ue((O) => t.maskClosable && a(), ["self"]))
|
|
241
241
|
}, [
|
|
242
|
-
|
|
242
|
+
v("div", {
|
|
243
243
|
ref_key: "contentRef",
|
|
244
244
|
ref: p,
|
|
245
245
|
class: fe(["modal-content", { [`${t.mode}-mode`]: !0 }]),
|
|
246
|
-
style:
|
|
246
|
+
style: z(C.value)
|
|
247
247
|
}, [
|
|
248
248
|
t.header ? (g(), x("div", {
|
|
249
249
|
key: 0,
|
|
250
250
|
ref_key: "headerRef",
|
|
251
251
|
ref: _,
|
|
252
252
|
class: "modal-header",
|
|
253
|
-
style:
|
|
253
|
+
style: z(E.value),
|
|
254
254
|
onMousedown: L
|
|
255
255
|
}, [
|
|
256
|
-
|
|
257
|
-
|
|
256
|
+
v("div", Pe, P(t.title), 1),
|
|
257
|
+
v("div", Te, [
|
|
258
258
|
t.closeable ? (g(), x("div", {
|
|
259
259
|
key: 0,
|
|
260
260
|
class: "i-icon-park-outline:close block cursor-pointer",
|
|
@@ -262,37 +262,38 @@ const oe = (o) => (ve("data-v-54c3f8b0"), o = o(), he(), o), Pe = { class: "titl
|
|
|
262
262
|
})) : T("", !0)
|
|
263
263
|
])
|
|
264
264
|
], 36)) : T("", !0),
|
|
265
|
-
|
|
265
|
+
Be,
|
|
266
|
+
v("div", {
|
|
266
267
|
class: "modal-body",
|
|
267
|
-
style:
|
|
268
|
+
style: z(S.value)
|
|
268
269
|
}, [
|
|
269
|
-
(g(),
|
|
270
|
+
(g(), B(ee(t.component), pe(me(t.componentProps)), null, 16))
|
|
270
271
|
], 4),
|
|
271
|
-
|
|
272
|
-
|
|
272
|
+
Oe,
|
|
273
|
+
t.footer ? (g(), x("div", ze, [
|
|
274
|
+
v("button", {
|
|
273
275
|
class: "cancel-button",
|
|
274
276
|
type: "button",
|
|
275
277
|
onClick: V
|
|
276
278
|
}, P(t.cancelText), 1),
|
|
277
|
-
|
|
279
|
+
v("button", {
|
|
278
280
|
class: "submit-button",
|
|
279
281
|
form: t.form,
|
|
280
282
|
type: "submit",
|
|
281
283
|
onClick: I
|
|
282
|
-
}, P(t.submitText), 9,
|
|
284
|
+
}, P(t.submitText), 9, Re)
|
|
283
285
|
])) : T("", !0),
|
|
284
|
-
|
|
285
|
-
f.value ? (g(), x("div", Re, De)) : T("", !0)
|
|
286
|
+
f.value ? (g(), x("div", Ne, Fe)) : T("", !0)
|
|
286
287
|
], 6)
|
|
287
288
|
], 4));
|
|
288
289
|
}
|
|
289
290
|
});
|
|
290
|
-
const
|
|
291
|
+
const N = (o, s) => {
|
|
291
292
|
const n = o.__vccOpts || o;
|
|
292
293
|
for (const [e, l] of s)
|
|
293
294
|
n[e] = l;
|
|
294
295
|
return n;
|
|
295
|
-
},
|
|
296
|
+
}, Ie = /* @__PURE__ */ N(We, [["__scopeId", "data-v-4af3c744"]]), Ve = { class: "modal-dialog" }, je = { class: "dialog-body" }, Ge = { class: "dialog-title" }, Xe = { class: "dialog-content" }, Ye = /* @__PURE__ */ Y({
|
|
296
297
|
__name: "modal-dialog",
|
|
297
298
|
props: {
|
|
298
299
|
type: {},
|
|
@@ -305,7 +306,7 @@ const H = (o, s) => {
|
|
|
305
306
|
footer: {}
|
|
306
307
|
},
|
|
307
308
|
setup(o) {
|
|
308
|
-
const s = o, n =
|
|
309
|
+
const s = o, n = rt(), e = A(() => s.title ? s.title : {
|
|
309
310
|
confirm: "提示",
|
|
310
311
|
info: "提示",
|
|
311
312
|
warning: "警告",
|
|
@@ -315,20 +316,20 @@ const H = (o, s) => {
|
|
|
315
316
|
async function l() {
|
|
316
317
|
s.onOk && await s.onOk(), n.close();
|
|
317
318
|
}
|
|
318
|
-
async function
|
|
319
|
+
async function r() {
|
|
319
320
|
s.onCancel && await s.onCancel(), n.close();
|
|
320
321
|
}
|
|
321
|
-
return (f,
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
322
|
+
return (f, h) => (g(), x("section", Ve, [
|
|
323
|
+
v("div", je, [
|
|
324
|
+
v("div", Ge, P(e.value), 1),
|
|
325
|
+
v("div", Xe, P(f.content), 1)
|
|
325
326
|
]),
|
|
326
|
-
|
|
327
|
+
v("div", {
|
|
327
328
|
class: "dialog-footer space-x-2",
|
|
328
|
-
style:
|
|
329
|
+
style: z(f.type === "confirm" ? { "justify-content": "end" } : { "border-top": "none" })
|
|
329
330
|
}, [
|
|
330
|
-
f.footer ? (g(),
|
|
331
|
-
|
|
331
|
+
f.footer ? (g(), B(ee(f.footer), { key: 0 })) : (g(), x(X, { key: 1 }, [
|
|
332
|
+
v("button", {
|
|
332
333
|
class: "submit-button",
|
|
333
334
|
type: "submit",
|
|
334
335
|
onClick: l
|
|
@@ -337,21 +338,21 @@ const H = (o, s) => {
|
|
|
337
338
|
key: 0,
|
|
338
339
|
class: "cancel-button",
|
|
339
340
|
type: "button",
|
|
340
|
-
onClick:
|
|
341
|
+
onClick: r
|
|
341
342
|
}, P(f.cancelText), 1)) : T("", !0)
|
|
342
343
|
], 64))
|
|
343
344
|
], 4)
|
|
344
345
|
]));
|
|
345
346
|
}
|
|
346
347
|
});
|
|
347
|
-
const
|
|
348
|
+
const Ke = /* @__PURE__ */ N(Ye, [["__scopeId", "data-v-8326e5a5"]]), qe = {
|
|
348
349
|
key: 0,
|
|
349
350
|
class: "modal-teleport"
|
|
350
|
-
},
|
|
351
|
+
}, Ue = {
|
|
351
352
|
name: "ModalProvider",
|
|
352
353
|
inheritAttrs: !0
|
|
353
|
-
},
|
|
354
|
-
...
|
|
354
|
+
}, Je = /* @__PURE__ */ Y({
|
|
355
|
+
...Ue,
|
|
355
356
|
props: {
|
|
356
357
|
appendToBody: { type: [Boolean, String], default: !1 },
|
|
357
358
|
sizes: { default: () => ({
|
|
@@ -360,118 +361,118 @@ const Ye = /* @__PURE__ */ H(Xe, [["__scopeId", "data-v-8326e5a5"]]), Ke = {
|
|
|
360
361
|
large: 1190
|
|
361
362
|
}) },
|
|
362
363
|
maxWidth: { default: "90%" },
|
|
363
|
-
maxHeight: { default: "
|
|
364
|
+
maxHeight: { default: "90%" },
|
|
364
365
|
offset: { default: () => ({ x: 0, y: 0 }) }
|
|
365
366
|
},
|
|
366
367
|
setup(o, { expose: s }) {
|
|
367
|
-
const n =
|
|
368
|
-
function i
|
|
368
|
+
const n = D([]), e = H(!1), l = q();
|
|
369
|
+
function r(i, u = {}, a = {}) {
|
|
369
370
|
const m = xe(
|
|
370
|
-
() => Promise.resolve(typeof
|
|
371
|
+
() => Promise.resolve(typeof i == "string" ? Ke : i)
|
|
371
372
|
);
|
|
372
|
-
typeof
|
|
373
|
-
const d = Math.random().toString(32).slice(2), C = new Promise((E,
|
|
373
|
+
typeof i == "string" && (u.type = i, a.size = "small", a.fullscreen = !1, a.mode = "dialog", a.footer = !1, a.header = !1);
|
|
374
|
+
const d = Math.random().toString(32).slice(2), C = new Promise((E, S) => {
|
|
374
375
|
n.value.push({
|
|
375
376
|
id: d,
|
|
376
377
|
component: m,
|
|
377
378
|
props: u || {},
|
|
378
379
|
options: {
|
|
379
380
|
...a,
|
|
380
|
-
type: typeof
|
|
381
|
+
type: typeof i == "string" ? i : "component"
|
|
381
382
|
},
|
|
382
383
|
resolve: E,
|
|
383
|
-
reject:
|
|
384
|
+
reject: S,
|
|
384
385
|
listeners: []
|
|
385
|
-
}),
|
|
386
|
+
}), R(n);
|
|
386
387
|
}).catch((E) => E === "CANCEL" ? new Promise(() => {
|
|
387
388
|
}) : Promise.reject(E));
|
|
388
389
|
return Object.assign(C, {
|
|
389
390
|
close: () => f(d)
|
|
390
391
|
});
|
|
391
392
|
}
|
|
392
|
-
function f(
|
|
393
|
-
const a = n.value.findIndex((d) => d.id ===
|
|
393
|
+
function f(i, u) {
|
|
394
|
+
const a = n.value.findIndex((d) => d.id === i);
|
|
394
395
|
if (a < 0)
|
|
395
396
|
return;
|
|
396
397
|
const m = n.value[a];
|
|
397
|
-
u === void 0 ? m == null || m.reject("CANCEL") : m == null || m.resolve(u), n.value.splice(a, 1),
|
|
398
|
+
u === void 0 ? m == null || m.reject("CANCEL") : m == null || m.resolve(u), n.value.splice(a, 1), R(n);
|
|
398
399
|
}
|
|
399
|
-
function
|
|
400
|
-
!n.value || n.value.length === 0 || (n.value.forEach((
|
|
401
|
-
|
|
402
|
-
}), n.value = [],
|
|
400
|
+
function h() {
|
|
401
|
+
!n.value || n.value.length === 0 || (n.value.forEach((i) => {
|
|
402
|
+
i == null || i.reject("CANCEL");
|
|
403
|
+
}), n.value = [], R(n));
|
|
403
404
|
}
|
|
404
|
-
function k(
|
|
405
|
-
const a = n.value.find((d) => d.id ===
|
|
405
|
+
function k(i, u) {
|
|
406
|
+
const a = n.value.find((d) => d.id === i);
|
|
406
407
|
if (!a)
|
|
407
408
|
return;
|
|
408
409
|
const m = a.listeners.find((d) => d.event === u);
|
|
409
410
|
m && m.callback({
|
|
410
|
-
open:
|
|
411
|
+
open: r,
|
|
411
412
|
close: (d) => f(a.id, d),
|
|
412
|
-
closeAll:
|
|
413
|
+
closeAll: h,
|
|
413
414
|
showLoading: () => M(a.id),
|
|
414
415
|
hideLoading: () => p(a.id),
|
|
415
|
-
confirm: (d) =>
|
|
416
|
-
success: (d) =>
|
|
417
|
-
error: (d) =>
|
|
418
|
-
warning: (d) =>
|
|
419
|
-
info: (d) =>
|
|
416
|
+
confirm: (d) => r("confirm", d),
|
|
417
|
+
success: (d) => r("success", d),
|
|
418
|
+
error: (d) => r("error", d),
|
|
419
|
+
warning: (d) => r("warning", d),
|
|
420
|
+
info: (d) => r("info", d)
|
|
420
421
|
});
|
|
421
422
|
}
|
|
422
|
-
function M(
|
|
423
|
+
function M(i) {
|
|
423
424
|
if (!l)
|
|
424
425
|
return;
|
|
425
|
-
const [u] = l.refs[`modal-container_${
|
|
426
|
+
const [u] = l.refs[`modal-container_${i}`];
|
|
426
427
|
if (u)
|
|
427
428
|
return u.showLoading();
|
|
428
429
|
}
|
|
429
|
-
function p(
|
|
430
|
+
function p(i) {
|
|
430
431
|
if (!l)
|
|
431
432
|
return;
|
|
432
|
-
const [u] = l.refs[`modal-container_${
|
|
433
|
+
const [u] = l.refs[`modal-container_${i}`];
|
|
433
434
|
if (u)
|
|
434
435
|
return u.hideLoading();
|
|
435
436
|
}
|
|
436
|
-
function _(
|
|
437
|
-
const m = n.value.find((d) => d.id ===
|
|
437
|
+
function _(i, u, a) {
|
|
438
|
+
const m = n.value.find((d) => d.id === i);
|
|
438
439
|
m && m.listeners.push({
|
|
439
440
|
event: u,
|
|
440
441
|
callback: a
|
|
441
442
|
});
|
|
442
443
|
}
|
|
443
444
|
return ye(W, {
|
|
444
|
-
open:
|
|
445
|
+
open: r,
|
|
445
446
|
close: f,
|
|
446
|
-
closeAll:
|
|
447
|
+
closeAll: h,
|
|
447
448
|
addEventListener: _
|
|
448
449
|
}), s({
|
|
449
450
|
elements: n,
|
|
450
|
-
open:
|
|
451
|
+
open: r,
|
|
451
452
|
close: f,
|
|
452
|
-
closeAll:
|
|
453
|
-
}),
|
|
453
|
+
closeAll: h
|
|
454
|
+
}), Z(() => {
|
|
454
455
|
e.value = !0;
|
|
455
|
-
}), (
|
|
456
|
-
|
|
457
|
-
e.value ? (g(), x("div",
|
|
458
|
-
(g(),
|
|
459
|
-
disabled: !
|
|
460
|
-
to: typeof
|
|
456
|
+
}), (i, u) => (g(), x(X, null, [
|
|
457
|
+
U(i.$slots, "default", {}, void 0, !0),
|
|
458
|
+
e.value ? (g(), x("div", qe, [
|
|
459
|
+
(g(), B(J, {
|
|
460
|
+
disabled: !i.appendToBody,
|
|
461
|
+
to: typeof i.appendToBody == "string" ? i.appendToBody : "body"
|
|
461
462
|
}, [
|
|
462
463
|
ge(_e, { name: "modal-fade" }, {
|
|
463
464
|
default: we(() => [
|
|
464
|
-
(g(!0), x(X, null, be(n.value, (a) => (g(),
|
|
465
|
+
(g(!0), x(X, null, be(n.value, (a) => (g(), B(Ie, Ce({
|
|
465
466
|
id: a.id,
|
|
466
467
|
key: a.id,
|
|
467
468
|
ref_for: !0,
|
|
468
469
|
ref: `modal-container_${a.id}`,
|
|
469
470
|
component: a.component,
|
|
470
471
|
"component-props": a.props,
|
|
471
|
-
"max-height":
|
|
472
|
-
"max-width":
|
|
473
|
-
offset:
|
|
474
|
-
sizes:
|
|
472
|
+
"max-height": i.maxHeight,
|
|
473
|
+
"max-width": i.maxWidth,
|
|
474
|
+
offset: i.offset,
|
|
475
|
+
sizes: i.sizes
|
|
475
476
|
}, a.options, {
|
|
476
477
|
onSubmit: () => k(a.id, "submit")
|
|
477
478
|
}), null, 16, ["id", "component", "component-props", "max-height", "max-width", "offset", "sizes", "onSubmit"]))), 128))
|
|
@@ -483,29 +484,38 @@ const Ye = /* @__PURE__ */ H(Xe, [["__scopeId", "data-v-8326e5a5"]]), Ke = {
|
|
|
483
484
|
], 64));
|
|
484
485
|
}
|
|
485
486
|
});
|
|
486
|
-
const
|
|
487
|
-
const
|
|
488
|
-
function
|
|
489
|
-
return g(),
|
|
490
|
-
|
|
491
|
-
|
|
487
|
+
const st = /* @__PURE__ */ N(Je, [["__scopeId", "data-v-241a8304"]]);
|
|
488
|
+
const Qe = {}, Ze = { class: "modal-footer" };
|
|
489
|
+
function et(o, s) {
|
|
490
|
+
return g(), B(J, { to: "#modal-footer-slot" }, [
|
|
491
|
+
v("div", Ze, [
|
|
492
|
+
U(o.$slots, "default", {}, void 0, !0)
|
|
492
493
|
])
|
|
493
494
|
]);
|
|
494
495
|
}
|
|
495
|
-
const
|
|
496
|
-
|
|
496
|
+
const lt = /* @__PURE__ */ N(Qe, [["render", et], ["__scopeId", "data-v-2080a86e"]]);
|
|
497
|
+
const tt = {}, ot = { class: "modal-header" };
|
|
498
|
+
function nt(o, s) {
|
|
499
|
+
return g(), B(J, { to: "#modal-header-slot" }, [
|
|
500
|
+
v("div", ot, [
|
|
501
|
+
U(o.$slots, "default", {}, void 0, !0)
|
|
502
|
+
])
|
|
503
|
+
]);
|
|
504
|
+
}
|
|
505
|
+
const at = /* @__PURE__ */ N(tt, [["render", nt], ["__scopeId", "data-v-d0247172"]]);
|
|
506
|
+
function F(o, s) {
|
|
497
507
|
var e, l;
|
|
498
508
|
let n = o == null ? void 0 : o.parent;
|
|
499
509
|
for (; n && ((e = n == null ? void 0 : n.type) == null ? void 0 : e.name) !== s; )
|
|
500
510
|
n = n.parent;
|
|
501
511
|
return ((l = n == null ? void 0 : n.type) == null ? void 0 : l.name) === s ? n : null;
|
|
502
512
|
}
|
|
503
|
-
function
|
|
513
|
+
function rt() {
|
|
504
514
|
const o = K(W), s = q();
|
|
505
|
-
function n(e, l,
|
|
515
|
+
function n(e, l, r) {
|
|
506
516
|
if (!o)
|
|
507
517
|
throw new Error("Not Found Modal Provider Component");
|
|
508
|
-
return o.open(e, l,
|
|
518
|
+
return o.open(e, l, r);
|
|
509
519
|
}
|
|
510
520
|
return {
|
|
511
521
|
open: n,
|
|
@@ -513,10 +523,10 @@ function et() {
|
|
|
513
523
|
var f;
|
|
514
524
|
if (!o)
|
|
515
525
|
throw new Error("Not Found Modal Provider Component");
|
|
516
|
-
const l =
|
|
517
|
-
if (!
|
|
526
|
+
const l = F(s, "ModalContainer"), r = (f = l == null ? void 0 : l.props) == null ? void 0 : f.id;
|
|
527
|
+
if (!r)
|
|
518
528
|
throw new Error("Not Found Current Modal Container");
|
|
519
|
-
o.close(
|
|
529
|
+
o.close(r, e);
|
|
520
530
|
},
|
|
521
531
|
closeAll() {
|
|
522
532
|
if (!o)
|
|
@@ -524,20 +534,20 @@ function et() {
|
|
|
524
534
|
o.closeAll();
|
|
525
535
|
},
|
|
526
536
|
showLoading() {
|
|
527
|
-
var
|
|
537
|
+
var r;
|
|
528
538
|
if (!o)
|
|
529
539
|
throw new Error("Not Found Modal Provider Component");
|
|
530
|
-
const e =
|
|
531
|
-
if (!((
|
|
540
|
+
const e = F(s, "ModalContainer");
|
|
541
|
+
if (!((r = e == null ? void 0 : e.props) == null ? void 0 : r.id))
|
|
532
542
|
throw new Error("Not Found Current Modal Container");
|
|
533
543
|
e != null && e.exposed && (e == null || e.exposed.showLoading());
|
|
534
544
|
},
|
|
535
545
|
hideLoading() {
|
|
536
|
-
var
|
|
546
|
+
var r;
|
|
537
547
|
if (!o)
|
|
538
548
|
throw new Error("Not Found Modal Provider Component");
|
|
539
|
-
const e =
|
|
540
|
-
if (!((
|
|
549
|
+
const e = F(s, "ModalContainer");
|
|
550
|
+
if (!((r = e == null ? void 0 : e.props) == null ? void 0 : r.id))
|
|
541
551
|
throw new Error("Not Found Current Modal Container");
|
|
542
552
|
e != null && e.exposed && (e == null || e.exposed.hideLoading());
|
|
543
553
|
},
|
|
@@ -558,16 +568,17 @@ function et() {
|
|
|
558
568
|
}
|
|
559
569
|
};
|
|
560
570
|
}
|
|
561
|
-
function
|
|
562
|
-
var
|
|
563
|
-
const s = K(W), n = q(), e =
|
|
571
|
+
function dt(o) {
|
|
572
|
+
var r;
|
|
573
|
+
const s = K(W), n = q(), e = F(n, "ModalContainer"), l = (r = e == null ? void 0 : e.props) == null ? void 0 : r.id;
|
|
564
574
|
s && l && s.addEventListener(l, "submit", o);
|
|
565
575
|
}
|
|
566
576
|
export {
|
|
567
|
-
|
|
568
|
-
|
|
577
|
+
Ie as ModalContainer,
|
|
578
|
+
lt as ModalFooter,
|
|
579
|
+
at as ModalHeader,
|
|
569
580
|
W as ModalKey,
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
581
|
+
st as ModalProvider,
|
|
582
|
+
dt as onSubmit,
|
|
583
|
+
rt as useModal
|
|
573
584
|
};
|
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-
|
|
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-4af3c744]{z-index:1000;position:fixed;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;background:rgba(0,0,0,.3)}.modal-content[data-v-4af3c744]{background:#ffffff;border-radius:5px;position:relative}.modal-header[data-v-4af3c744]{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-4af3c744]{padding:10px;box-sizing:border-box;max-height:10vw;overflow:auto;position:relative}.modal-footer[data-v-4af3c744]{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-4af3c744]{height:28px;line-height:28px;width:80px;outline:none;border-color:transparent;font-size:14px;border-radius:4px;padding:0;box-sizing:content-box}.modal-footer button.submit-button[data-v-4af3c744]{color:#fff;background-color:rgb(var(--primary-6, 45, 106, 251))}.modal-footer button.submit-button[data-v-4af3c744]:hover{background-color:rgb(var(--primary-5, 28, 76, 207))}.modal-footer button.cancel-button[data-v-4af3c744]{color:rgb(var(--color-text-2, 78, 89, 105));background-color:var(--color-fill-1, #f5f5f5)}.modal-footer button.cancel-button[data-v-4af3c744]:hover{background-color:var(--color-fill-4, #c9cdd4)}.modal-loading[data-v-4af3c744]{position:absolute;z-index:1001;top:0;right:0;bottom:0;left:0;display:flex;justify-content:center;align-items:center;background-color:#0000001a}.modal-loading .lds-ring[data-v-4af3c744]{display:inline-block;position:relative;width:80px;height:80px}.modal-loading .lds-ring div[data-v-4af3c744]{box-sizing:border-box;display:block;position:absolute;width:48px;height:48px;margin:8px;border:5px solid #fff;border-radius:50%;animation:lds-ring-4af3c744 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:#fff transparent transparent transparent}.modal-loading .lds-ring div[data-v-4af3c744]:nth-child(1){animation-delay:-.45s}.modal-loading .lds-ring div[data-v-4af3c744]:nth-child(2){animation-delay:-.3s}.modal-loading .lds-ring div[data-v-4af3c744]:nth-child(3){animation-delay:-.15s}@keyframes lds-ring-4af3c744{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.dialog-body[data-v-8326e5a5]{padding:20px 10px 10px}.dialog-title[data-v-8326e5a5]{padding:5px;font-weight:700;font-size:16px}.dialog-content[data-v-8326e5a5]{padding:5px}.dialog-footer[data-v-8326e5a5]{box-sizing:border-box;height:50px;border-top:solid 1px var(--color-border-1, #e8e8e8);display:flex;justify-content:center;align-items:center;padding:0 10px}.dialog-footer button[data-v-8326e5a5]{height:28px;line-height:28px;width:80px;outline:none;border-color:transparent;font-size:14px;border-radius:4px;padding:0;box-sizing:content-box}.dialog-footer button.submit-button[data-v-8326e5a5]{color:#fff;background-color:rgb(var(--primary-6, 45, 106, 251))}.dialog-footer button.submit-button[data-v-8326e5a5]:hover{background-color:rgb(var(--primary-5, 28, 76, 207))}.dialog-footer button.cancel-button[data-v-8326e5a5]{color:rgb(var(--color-text-2, 78, 89, 105));background-color:var(--color-fill-1, #f5f5f5)}.dialog-footer button.cancel-button[data-v-8326e5a5]:hover{background-color:var(--color-fill-4, #c9cdd4)}.modal-fade-enter-active[data-v-241a8304],.modal-fade-leave-active[data-v-241a8304]{transition:opacity .5s ease}.modal-fade-enter-active[data-v-241a8304] .modal-content.drawer-mode,.modal-fade-leave-active[data-v-241a8304] .modal-content.drawer-mode{transition:transform .5s ease}.modal-fade-enter-from[data-v-241a8304],.modal-fade-leave-to[data-v-241a8304]{opacity:0}.modal-fade-enter-from[data-v-241a8304] .modal-content.drawer-mode,.modal-fade-leave-to[data-v-241a8304] .modal-content.drawer-mode{transform:translate3d(100%,0,0)}.modal-footer[data-v-2080a86e]{box-sizing:border-box;min-height:50px;border-top:solid 1px var(--color-border-1, rgb(232, 232, 232));padding:10px}.modal-footer button[data-v-2080a86e]{height:28px;line-height:28px;width:80px;outline:none;border-color:transparent;font-size:14px;border-radius:4px;padding:0;box-sizing:content-box}.modal-footer button.submit-button[data-v-2080a86e]{color:#fff;background-color:rgb(var(--primary-6, 45, 106, 251))}.modal-footer button.submit-button[data-v-2080a86e]:hover{background-color:rgb(var(--primary-5, 28, 76, 207))}.modal-footer button.cancel-button[data-v-2080a86e]{color:rgb(var(--color-text-2, 78, 89, 105));background-color:var(--color-fill-1, #f5f5f5)}.modal-footer button.cancel-button[data-v-2080a86e]:hover{background-color:var(--color-fill-4, #c9cdd4)}.modal-header[data-v-d0247172]{box-sizing:border-box;padding:10px;min-height:50px;border-bottom:solid 1px var(--color-border-1, rgb(232, 232, 232));color:var(--color-text-2, #4E5969)}
|