@gopowerteam/modal-render 0.0.47 → 1.0.0

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/es/index.mjs CHANGED
@@ -1,217 +1,266 @@
1
- import { unref as me, isRef as ge, toRefs as ye, customRef as be, onMounted as Y, nextTick as we, getCurrentScope as _e, onScopeDispose as xe, getCurrentInstance as V, ref as H, computed as E, watch as ee, defineComponent as K, useCssVars as Ce, inject as te, shallowRef as T, onUnmounted as ke, openBlock as y, createElementBlock as C, normalizeStyle as N, withModifiers as Me, createElementVNode as m, normalizeClass as Se, toDisplayString as O, createCommentVNode as z, createBlock as P, resolveDynamicComponent as re, normalizeProps as $e, guardReactiveProps as Ee, triggerRef as F, pushScopeId as le, popScopeId as ae, Fragment as Z, provide as Le, renderSlot as oe, Teleport as ne, createVNode as Ae, TransitionGroup as Oe, withCtx as Re, renderList as Te, mergeProps as Be, defineAsyncComponent as He } from "vue";
2
- const U = Symbol("__MODAL__");
3
- function de(t) {
4
- return _e() ? (xe(t), !0) : !1;
1
+ import { isRef as Te, toRefs as Ee, customRef as He, toValue as v, onMounted as ae, nextTick as Ae, watch as ce, getCurrentScope as Be, onScopeDispose as Oe, getCurrentInstance as q, ref as se, computed as A, shallowRef as O, unref as Pe, defineComponent as de, useCssVars as Re, inject as xe, onUnmounted as ze, openBlock as k, createElementBlock as E, withModifiers as We, normalizeStyle as K, createElementVNode as y, normalizeClass as Ie, toDisplayString as W, createCommentVNode as D, createBlock as N, resolveDynamicComponent as $e, normalizeProps as Ve, guardReactiveProps as De, triggerRef as U, Teleport as be, renderSlot as we, Fragment as ye, provide as Ne, createVNode as Fe, TransitionGroup as Xe, withCtx as Ye, renderList as je, mergeProps as Ge, defineAsyncComponent as Ke } from "vue";
2
+ function Ue(e, n) {
3
+ return Be() ? (Oe(e, n), !0) : !1;
5
4
  }
6
- function w(t) {
7
- return typeof t == "function" ? t() : me(t);
8
- }
9
- const ce = typeof window < "u" && typeof document < "u";
5
+ const Le = typeof window < "u" && typeof document < "u";
10
6
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
11
- const ze = Object.prototype.toString, Pe = (t) => ze.call(t) === "[object Object]", Ie = () => {
12
- };
13
- function We(t) {
14
- return V();
7
+ const qe = Object.prototype.toString, Je = (e) => qe.call(e) === "[object Object]";
8
+ function le(e) {
9
+ return Array.isArray(e) ? e : [e];
15
10
  }
16
- function De(t, i = {}) {
17
- if (!ge(t))
18
- return ye(t);
19
- const o = Array.isArray(t.value) ? Array.from({ length: t.value.length }) : {};
20
- for (const e in t.value)
21
- o[e] = be(() => ({
22
- get() {
23
- return t.value[e];
24
- },
25
- set(l) {
26
- var s;
27
- if ((s = w(i.replaceRef)) != null ? s : !0)
28
- if (Array.isArray(t.value)) {
29
- const h = [...t.value];
30
- h[e] = l, t.value = h;
31
- } else {
32
- const h = { ...t.value, [e]: l };
33
- Object.setPrototypeOf(h, Object.getPrototypeOf(t.value)), t.value = h;
34
- }
35
- else
36
- t.value[e] = l;
11
+ function Qe(e) {
12
+ return q();
13
+ }
14
+ function Ze(e, n = {}) {
15
+ if (!Te(e)) return Ee(e);
16
+ const o = Array.isArray(e.value) ? Array.from({ length: e.value.length }) : {};
17
+ for (const t in e.value) o[t] = He(() => ({
18
+ get() {
19
+ return e.value[t];
20
+ },
21
+ set(s) {
22
+ var r;
23
+ if (!((r = v(n.replaceRef)) !== null && r !== void 0) || r) if (Array.isArray(e.value)) {
24
+ const u = [...e.value];
25
+ u[t] = s, e.value = u;
26
+ } else {
27
+ const u = {
28
+ ...e.value,
29
+ [t]: s
30
+ };
31
+ Object.setPrototypeOf(u, Object.getPrototypeOf(e.value)), e.value = u;
37
32
  }
38
- }));
33
+ else e.value[t] = s;
34
+ }
35
+ }));
39
36
  return o;
40
37
  }
41
- function Ne(t, i = !0, o) {
42
- We() ? Y(t, o) : i ? t() : we(t);
38
+ function et(e, n = !0, o) {
39
+ Qe() ? ae(e, o) : n ? e() : Ae(e);
43
40
  }
44
- function B(t) {
45
- var i;
46
- const o = w(t);
47
- return (i = o == null ? void 0 : o.$el) != null ? i : o;
41
+ function tt(e, n, o) {
42
+ return ce(e, n, {
43
+ ...o,
44
+ immediate: !0
45
+ });
48
46
  }
49
- const q = ce ? window : void 0;
50
- function Q(...t) {
51
- let i, o, e, l;
52
- if (typeof t[0] == "string" || Array.isArray(t[0]) ? ([o, e, l] = t, i = q) : [i, o, e, l] = t, !i)
53
- return Ie;
54
- Array.isArray(o) || (o = [o]), Array.isArray(e) || (e = [e]);
55
- const s = [], c = () => {
56
- s.forEach((v) => v()), s.length = 0;
57
- }, h = (v, u, r, d) => (v.addEventListener(u, r, d), () => v.removeEventListener(u, r, d)), _ = ee(
58
- () => [B(i), w(l)],
59
- ([v, u]) => {
60
- if (c(), !v)
61
- return;
62
- const r = Pe(u) ? { ...u } : u;
63
- s.push(
64
- ...o.flatMap((d) => e.map((a) => h(v, d, a, r)))
65
- );
66
- },
67
- { immediate: !0, flush: "post" }
68
- ), b = () => {
69
- _(), c();
70
- };
71
- return de(b), b;
47
+ const ue = Le ? window : void 0;
48
+ function I(e) {
49
+ var n;
50
+ const o = v(e);
51
+ return (n = o?.$el) !== null && n !== void 0 ? n : o;
52
+ }
53
+ function ge(...e) {
54
+ const n = (t, s, r, u) => (t.addEventListener(s, r, u), () => t.removeEventListener(s, r, u)), o = A(() => {
55
+ const t = le(v(e[0])).filter((s) => s != null);
56
+ return t.every((s) => typeof s != "string") ? t : void 0;
57
+ });
58
+ return tt(() => {
59
+ var t, s;
60
+ return [
61
+ (t = (s = o.value) === null || s === void 0 ? void 0 : s.map((r) => I(r))) !== null && t !== void 0 ? t : [ue].filter((r) => r != null),
62
+ le(v(o.value ? e[1] : e[0])),
63
+ le(Pe(o.value ? e[2] : e[1])),
64
+ v(o.value ? e[3] : e[2])
65
+ ];
66
+ }, ([t, s, r, u], w, _) => {
67
+ if (!t?.length || !s?.length || !r?.length) return;
68
+ const M = Je(u) ? { ...u } : u, x = t.flatMap((c) => s.flatMap((f) => r.map((m) => n(c, f, m, M))));
69
+ _(() => {
70
+ x.forEach((c) => c());
71
+ });
72
+ }, { flush: "post" });
73
+ }
74
+ // @__NO_SIDE_EFFECTS__
75
+ function ot() {
76
+ const e = O(!1), n = q();
77
+ return n && ae(() => {
78
+ e.value = !0;
79
+ }, n), e;
72
80
  }
73
- function Fe() {
74
- const t = H(!1), i = V();
75
- return i && Y(() => {
76
- t.value = !0;
77
- }, i), t;
81
+ // @__NO_SIDE_EFFECTS__
82
+ function nt(e) {
83
+ const n = /* @__PURE__ */ ot();
84
+ return A(() => (n.value, !!e()));
78
85
  }
79
- function Ve(t) {
80
- const i = Fe();
81
- return E(() => (i.value, !!t()));
86
+ const ie = {
87
+ speed: 2,
88
+ margin: 30,
89
+ direction: "both"
90
+ };
91
+ function it(e) {
92
+ e.scrollLeft > e.scrollWidth - e.clientWidth && (e.scrollLeft = Math.max(0, e.scrollWidth - e.clientWidth)), e.scrollTop > e.scrollHeight - e.clientHeight && (e.scrollTop = Math.max(0, e.scrollHeight - e.clientHeight));
82
93
  }
83
- function je(t, i = {}) {
84
- var o, e;
85
- const {
86
- pointerTypes: l,
87
- preventDefault: s,
88
- stopPropagation: c,
89
- exact: h,
90
- onMove: _,
91
- onEnd: b,
92
- onStart: v,
93
- initialValue: u,
94
- axis: r = "both",
95
- draggingElement: d = q,
96
- containerElement: a,
97
- handle: g = t
98
- } = i, f = H(
99
- (o = w(u)) != null ? o : { x: 0, y: 0 }
100
- ), k = H(), R = (p) => l ? l.includes(p.pointerType) : !0, $ = (p) => {
101
- w(s) && p.preventDefault(), w(c) && p.stopPropagation();
102
- }, W = (p) => {
103
- var L;
104
- if (p.button !== 0 || w(i.disabled) || !R(p) || w(h) && p.target !== w(t))
105
- return;
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)
94
+ function lt(e, n = {}) {
95
+ var o, t, s, r;
96
+ const { pointerTypes: u, preventDefault: w, stopPropagation: _, exact: M, onMove: x, onEnd: c, onStart: f, initialValue: m, axis: a = "both", draggingElement: b = ue, containerElement: p, handle: X = e, buttons: Y = [0], restrictInView: R, autoScroll: T = !1 } = n, $ = se((o = v(m)) !== null && o !== void 0 ? o : {
97
+ x: 0,
98
+ y: 0
99
+ }), H = se(), B = (i) => u ? u.includes(i.pointerType) : !0, j = (i) => {
100
+ v(w) && i.preventDefault(), v(_) && i.stopPropagation();
101
+ }, V = v(T), P = typeof V == "object" ? {
102
+ speed: (t = v(V.speed)) !== null && t !== void 0 ? t : ie.speed,
103
+ margin: (s = v(V.margin)) !== null && s !== void 0 ? s : ie.margin,
104
+ direction: (r = V.direction) !== null && r !== void 0 ? r : ie.direction
105
+ } : ie, J = (i) => typeof i == "number" ? [i, i] : [i.x, i.y], Q = (i, d, h) => {
106
+ const { clientWidth: C, clientHeight: g, scrollLeft: L, scrollTop: te, scrollWidth: pe, scrollHeight: _e } = i, [Ce, ke] = J(P.margin), [Me, Se] = J(P.speed);
107
+ let oe = 0, ne = 0;
108
+ (P.direction === "x" || P.direction === "both") && (h.x < Ce && L > 0 ? oe = -Me : h.x + d.width > C - Ce && L < pe - C && (oe = Me)), (P.direction === "y" || P.direction === "both") && (h.y < ke && te > 0 ? ne = -Se : h.y + d.height > g - ke && te < _e - g && (ne = Se)), (oe || ne) && i.scrollBy({
109
+ left: oe,
110
+ top: ne,
111
+ behavior: "auto"
112
+ });
113
+ };
114
+ let z = null;
115
+ const he = () => {
116
+ const i = v(p);
117
+ i && !z && (z = setInterval(() => {
118
+ const d = v(e).getBoundingClientRect(), { x: h, y: C } = $.value, g = {
119
+ x: h - i.scrollLeft,
120
+ y: C - i.scrollTop
121
+ };
122
+ g.x >= 0 && g.y >= 0 && (Q(i, d, g), g.x += i.scrollLeft, g.y += i.scrollTop, $.value = g);
123
+ }, 1e3 / 60));
124
+ }, Z = () => {
125
+ z && (clearInterval(z), z = null);
126
+ }, me = (i, d, h, C) => {
127
+ const [g, L] = typeof h == "number" ? [h, h] : [h.x, h.y], { clientWidth: te, clientHeight: pe } = d;
128
+ return i.x < g || i.x + C.width > te - g || i.y < L || i.y + C.height > pe - L;
129
+ }, ve = () => {
130
+ if (v(n.disabled) || !H.value) return;
131
+ const i = v(p);
132
+ if (!i) return;
133
+ const d = v(e).getBoundingClientRect(), { x: h, y: C } = $.value;
134
+ me({
135
+ x: h - i.scrollLeft,
136
+ y: C - i.scrollTop
137
+ }, i, P.margin, d) ? he() : Z();
138
+ };
139
+ v(T) && ce($, ve);
140
+ const ee = (i) => {
141
+ var d;
142
+ if (!v(Y).includes(i.button) || v(n.disabled) || !B(i) || v(M) && i.target !== v(e)) return;
143
+ const h = v(p), C = h == null || (d = h.getBoundingClientRect) === null || d === void 0 ? void 0 : d.call(h), g = v(e).getBoundingClientRect(), L = {
144
+ x: i.clientX - (h ? g.left - C.left + (T ? 0 : h.scrollLeft) : g.left),
145
+ y: i.clientY - (h ? g.top - C.top + (T ? 0 : h.scrollTop) : g.top)
109
146
  };
110
- (v == null ? void 0 : v(G, p)) !== !1 && (k.value = G, $(p));
111
- }, J = (p) => {
112
- if (w(i.disabled) || !R(p) || !k.value)
113
- return;
114
- const L = w(a), x = w(t).getBoundingClientRect();
115
- let { x: A, y: M } = f.value;
116
- (r === "x" || r === "both") && (A = p.clientX - k.value.x, L && (A = Math.min(Math.max(0, A), L.scrollWidth - x.width))), (r === "y" || r === "both") && (M = p.clientY - k.value.y, L && (M = Math.min(Math.max(0, M), L.scrollHeight - x.height))), f.value = {
117
- x: A,
118
- y: M
119
- }, _ == null || _(f.value, p), $(p);
120
- }, j = (p) => {
121
- w(i.disabled) || !R(p) || k.value && (k.value = void 0, b == null || b(f.value, p), $(p));
147
+ f?.(L, i) !== !1 && (H.value = L, j(i));
148
+ }, l = (i) => {
149
+ if (v(n.disabled) || !B(i) || !H.value) return;
150
+ const d = v(p);
151
+ d instanceof HTMLElement && it(d);
152
+ const h = v(e).getBoundingClientRect();
153
+ let { x: C, y: g } = $.value;
154
+ if ((a === "x" || a === "both") && (C = i.clientX - H.value.x, d && (C = Math.min(Math.max(0, C), d.scrollWidth - h.width))), (a === "y" || a === "both") && (g = i.clientY - H.value.y, d && (g = Math.min(Math.max(0, g), d.scrollHeight - h.height))), v(T) && d && (z === null && Q(d, h, {
155
+ x: C,
156
+ y: g
157
+ }), C += d.scrollLeft, g += d.scrollTop), d && (R || T)) {
158
+ if (a !== "y") {
159
+ const L = C - d.scrollLeft;
160
+ L < 0 ? C = d.scrollLeft : L > d.clientWidth - h.width && (C = d.clientWidth - h.width + d.scrollLeft);
161
+ }
162
+ if (a !== "x") {
163
+ const L = g - d.scrollTop;
164
+ L < 0 ? g = d.scrollTop : L > d.clientHeight - h.height && (g = d.clientHeight - h.height + d.scrollTop);
165
+ }
166
+ }
167
+ $.value = {
168
+ x: C,
169
+ y: g
170
+ }, x?.($.value, i), j(i);
171
+ }, S = (i) => {
172
+ v(n.disabled) || !B(i) || H.value && (H.value = void 0, T && Z(), c?.($.value, i), j(i));
122
173
  };
123
- if (ce) {
124
- const p = { capture: (e = i.capture) != null ? e : !0 };
125
- Q(g, "pointerdown", W, p), Q(d, "pointermove", J, p), Q(d, "pointerup", j, p);
174
+ if (Le) {
175
+ const i = () => {
176
+ var d;
177
+ return {
178
+ capture: (d = n.capture) !== null && d !== void 0 ? d : !0,
179
+ passive: !v(w)
180
+ };
181
+ };
182
+ ge(X, "pointerdown", ee, i), ge(b, "pointermove", l, i), ge(b, "pointerup", S, i);
126
183
  }
127
184
  return {
128
- ...De(f),
129
- position: f,
130
- isDragging: E(() => !!k.value),
131
- style: E(
132
- () => `left:${f.value.x}px;top:${f.value.y}px;`
133
- )
185
+ ...Ze($),
186
+ position: $,
187
+ isDragging: A(() => !!H.value),
188
+ style: A(() => `
189
+ left: ${$.value.x}px;
190
+ top: ${$.value.y}px;
191
+ ${T ? "text-wrap: nowrap;" : ""}
192
+ `)
134
193
  };
135
194
  }
136
- function Ge(t, i, o = {}) {
137
- const { window: e = q, ...l } = o;
138
- let s;
139
- const c = Ve(() => e && "ResizeObserver" in e), h = () => {
140
- s && (s.disconnect(), s = void 0);
141
- }, _ = E(() => Array.isArray(t) ? t.map((u) => B(u)) : [B(t)]), b = ee(
142
- _,
143
- (u) => {
144
- if (h(), c.value && e) {
145
- s = new ResizeObserver(i);
146
- for (const r of u)
147
- r && s.observe(r, l);
148
- }
149
- },
150
- { immediate: !0, flush: "post" }
151
- ), v = () => {
152
- h(), b();
195
+ function rt(e, n, o = {}) {
196
+ const { window: t = ue, ...s } = o;
197
+ let r;
198
+ const u = /* @__PURE__ */ nt(() => t && "ResizeObserver" in t), w = () => {
199
+ r && (r.disconnect(), r = void 0);
200
+ }, _ = ce(A(() => {
201
+ const x = v(e);
202
+ return Array.isArray(x) ? x.map((c) => I(c)) : [I(x)];
203
+ }), (x) => {
204
+ if (w(), u.value && t) {
205
+ r = new ResizeObserver(n);
206
+ for (const c of x) c && r.observe(c, s);
207
+ }
208
+ }, {
209
+ immediate: !0,
210
+ flush: "post"
211
+ }), M = () => {
212
+ w(), _();
153
213
  };
154
- return de(v), {
155
- isSupported: c,
156
- stop: v
214
+ return Ue(M), {
215
+ isSupported: u,
216
+ stop: M
157
217
  };
158
218
  }
159
- function D(t, i = { width: 0, height: 0 }, o = {}) {
160
- const { window: e = q, box: l = "content-box" } = o, s = E(() => {
161
- var u, r;
162
- return (r = (u = B(t)) == null ? void 0 : u.namespaceURI) == null ? void 0 : r.includes("svg");
163
- }), c = H(i.width), h = H(i.height), { stop: _ } = Ge(
164
- t,
165
- ([u]) => {
166
- const r = l === "border-box" ? u.borderBoxSize : l === "content-box" ? u.contentBoxSize : u.devicePixelContentBoxSize;
167
- if (e && s.value) {
168
- const d = B(t);
169
- if (d) {
170
- const a = d.getBoundingClientRect();
171
- c.value = a.width, h.value = a.height;
172
- }
173
- } else if (r) {
174
- const d = Array.isArray(r) ? r : [r];
175
- c.value = d.reduce((a, { inlineSize: g }) => a + g, 0), h.value = d.reduce((a, { blockSize: g }) => a + g, 0);
176
- } else
177
- c.value = u.contentRect.width, h.value = u.contentRect.height;
178
- },
179
- o
180
- );
181
- Ne(() => {
182
- const u = B(t);
183
- u && (c.value = "offsetWidth" in u ? u.offsetWidth : i.width, h.value = "offsetHeight" in u ? u.offsetHeight : i.height);
219
+ function G(e, n = {
220
+ width: 0,
221
+ height: 0
222
+ }, o = {}) {
223
+ const { window: t = ue, box: s = "content-box" } = o, r = A(() => {
224
+ var c;
225
+ return (c = I(e)) === null || c === void 0 || (c = c.namespaceURI) === null || c === void 0 ? void 0 : c.includes("svg");
226
+ }), u = O(n.width), w = O(n.height), { stop: _ } = rt(e, ([c]) => {
227
+ const f = s === "border-box" ? c.borderBoxSize : s === "content-box" ? c.contentBoxSize : c.devicePixelContentBoxSize;
228
+ if (t && r.value) {
229
+ const m = I(e);
230
+ if (m) {
231
+ const a = m.getBoundingClientRect();
232
+ u.value = a.width, w.value = a.height;
233
+ }
234
+ } else if (f) {
235
+ const m = le(f);
236
+ u.value = m.reduce((a, { inlineSize: b }) => a + b, 0), w.value = m.reduce((a, { blockSize: b }) => a + b, 0);
237
+ } else
238
+ u.value = c.contentRect.width, w.value = c.contentRect.height;
239
+ }, o);
240
+ et(() => {
241
+ const c = I(e);
242
+ c && (u.value = "offsetWidth" in c ? c.offsetWidth : n.width, w.value = "offsetHeight" in c ? c.offsetHeight : n.height);
184
243
  });
185
- const b = ee(
186
- () => B(t),
187
- (u) => {
188
- c.value = u ? i.width : 0, h.value = u ? i.height : 0;
189
- }
190
- );
191
- function v() {
192
- _(), b();
244
+ const M = ce(() => I(e), (c) => {
245
+ u.value = c ? n.width : 0, w.value = c ? n.height : 0;
246
+ });
247
+ function x() {
248
+ _(), M();
193
249
  }
194
250
  return {
195
- width: c,
196
- height: h,
197
- stop: v
251
+ width: u,
252
+ height: w,
253
+ stop: x
198
254
  };
199
255
  }
200
- const Xe = (t) => (le("data-v-e065fedd"), t = t(), ae(), t), Ye = { class: "title text-16px font-bold" }, Ke = { class: "action" }, Ue = ["form"], qe = {
256
+ const fe = /* @__PURE__ */ Symbol("__MODAL__"), st = { class: "title text-16px font-bold" }, at = { class: "action" }, ct = ["form"], dt = {
201
257
  key: 2,
202
258
  class: "modal-loading"
203
- }, Je = /* @__PURE__ */ Xe(() => /* @__PURE__ */ m("div", { class: "lds-ring" }, [
204
- /* @__PURE__ */ m("div"),
205
- /* @__PURE__ */ m("div"),
206
- /* @__PURE__ */ m("div"),
207
- /* @__PURE__ */ m("div")
208
- ], -1)), Qe = [
209
- Je
210
- ], Ze = {
259
+ }, ut = {
211
260
  name: "ModalContainer",
212
261
  inheritAttrs: !1
213
- }, et = /* @__PURE__ */ K({
214
- ...Ze,
262
+ }, ft = /* @__PURE__ */ de({
263
+ ...ut,
215
264
  props: {
216
265
  id: {},
217
266
  form: {},
@@ -244,160 +293,201 @@ const Xe = (t) => (le("data-v-e065fedd"), t = t(), ae(), t), Ye = { class: "titl
244
293
  onCancel: {}
245
294
  },
246
295
  emits: ["submit"],
247
- setup(t, { expose: i, emit: o }) {
248
- Ce((n) => ({
249
- "0b220c17": n.zIndex
296
+ setup(e, { expose: n, emit: o }) {
297
+ Re((l) => ({
298
+ v4586ed24: l.zIndex
250
299
  }));
251
- const e = t, l = o, s = te(U), c = H(!1);
252
- let h = 0, _ = 0;
253
- const b = T(), v = T(), u = T(), r = T(), d = T(), a = T(), { height: g } = D(b), { height: f } = D(u, void 0, { box: "border-box" }), { height: k } = D(r, void 0, { box: "border-box" }), { height: R } = D(d), { height: $ } = D(a), { x: W, y: J } = je(u, {
300
+ const t = e, s = o, r = xe(fe), u = se(!1);
301
+ let w = 0, _ = 0;
302
+ const M = O(), x = O(), c = O(), f = O(), m = O(), a = O(), { height: b } = G(
303
+ M
304
+ ), { height: p } = G(
305
+ c,
306
+ void 0,
307
+ { box: "border-box" }
308
+ ), { height: X } = G(
309
+ f,
310
+ void 0,
311
+ { box: "border-box" }
312
+ ), { height: Y } = G(
313
+ m
314
+ ), { height: R } = G(
315
+ a
316
+ ), { x: T, y: $ } = lt(c, {
254
317
  initialValue: { x: 0, y: 0 }
255
318
  });
256
- function j() {
257
- s == null || s.close(e.id);
319
+ function H() {
320
+ r?.close(t.id);
258
321
  }
259
- function p(n) {
260
- return typeof n == "number" ? `${n}px` : n;
322
+ function B(l) {
323
+ return typeof l == "number" ? `${l}px` : l;
261
324
  }
262
- const L = E(() => {
263
- const n = {};
264
- return e.mode === "dialog" && (n.justifyContent = "center"), e.mode === "drawer" && (n.justifyContent = {
325
+ const j = A(() => {
326
+ const l = {};
327
+ return t.mode === "dialog" && (l.justifyContent = "center"), t.mode === "drawer" && (l.justifyContent = {
265
328
  left: "flex-start",
266
329
  right: "flex-end",
267
330
  top: "flex-start",
268
331
  bottom: "flex-end"
269
- }[e.position], n.flexDirection = {
332
+ }[t.position], l.flexDirection = {
270
333
  left: "row",
271
334
  right: "row",
272
335
  top: "column",
273
336
  bottom: "column"
274
- }[e.position]), n;
275
- }), x = E(() => {
276
- const n = {};
277
- 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(${W.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;
278
- }), A = E(() => {
279
- const n = {};
280
- return e.draggable && !e.fullscreen && e.mode === "dialog" && (n.cursor = "move"), n;
281
- }), M = E(() => {
282
- const n = {}, S = R.value + $.value + f.value + k.value, se = Math.floor(g.value * (Number(p(e.maxHeight).replace("%", "")) / 100));
283
- 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;
337
+ }[t.position]), l;
338
+ }), V = A(() => {
339
+ const l = {};
340
+ return t.mode === "drawer" && ["top", "bottom"].includes(t.position) ? l.maxHeight = B(t.maxHeight) : (l.width = B(t.sizes[t.size]), l.maxWidth = B(t.maxWidth)), t.width && (l.width = B(t.width)), t.height && (l.height = B(t.height)), t.fullscreen && (l.maxWidth = "unset", l.width = "100%", l.position = "fixed", l.top = 0, l.left = 0, l.bottom = 0, l.right = 0, l.borderRadius = 0), t.draggable && !t.fullscreen && t.mode === "dialog" && (l.transform = `translate3d(${T.value - w}px, ${$.value - _}px, 0px)`), t.mode === "drawer" && (l.borderRadius = 0, ["left", "right"].includes(t.position) ? l.height = "100%" : l.width = "100%"), t.offset && t.mode === "dialog" && (l.marginLeft = `${t.offset.x || 0}px`, l.marginTop = `${t.offset.y || 0}px`), t.backgroundColor && (l.backgroundColor = t.backgroundColor), l;
341
+ }), P = A(() => {
342
+ const l = {};
343
+ return t.draggable && !t.fullscreen && t.mode === "dialog" && (l.cursor = "move"), l;
344
+ }), J = A(() => {
345
+ const l = {}, S = Y.value + R.value + p.value + X.value, i = Math.floor(
346
+ b.value * (Number(B(t.maxHeight).replace("%", "")) / 100)
347
+ );
348
+ return t.maxHeight && (l.maxHeight = `${i - S}px`), t.mode === "drawer" && (l.maxHeight = "unset", ["left", "right"].includes(t.position) && (l.height = `${b.value - S}px`)), t.fullscreen && (l.maxHeight = "unset", l.height = `calc(100% - ${S}px)`), t.type !== "component" && (l.padding = "0"), t.bodyStyle && Object.assign(l, t.bodyStyle), l;
284
349
  });
285
- function G() {
286
- const n = v.value;
287
- if (e.form && n) {
288
- const S = n.querySelector(`form[name="${e.form}"]`);
350
+ function Q() {
351
+ const l = x.value;
352
+ if (t.form && l) {
353
+ const S = l.querySelector(
354
+ `form[name="${t.form}"]`
355
+ );
289
356
  S && S.dispatchEvent(new Event("submit"));
290
357
  }
291
- e.onOk && e.onOk({
292
- close: () => s == null ? void 0 : s.close(e.id)
293
- }), l("submit");
358
+ t.onOk && t.onOk({
359
+ close: () => r?.close(t.id)
360
+ }), s("submit");
294
361
  }
295
- function ue() {
296
- s == null || s.close(e.id), e != null && e.onCancel && e.onCancel();
362
+ function z() {
363
+ r?.close(t.id), t?.onCancel && t.onCancel();
297
364
  }
298
- function fe() {
365
+ function he() {
299
366
  window && window.addEventListener("resize", () => {
300
- F(b), F(v), v.value && (h = v.value.offsetLeft, _ = v.value.offsetTop);
367
+ U(M), U(x), x.value && (w = x.value.offsetLeft, _ = x.value.offsetTop);
301
368
  });
302
369
  }
303
- function pe() {
304
- if (e.closeable && e.esc) {
305
- const n = ({ key: S }) => {
306
- S === "Escape" && (s == null || s.close(e.id), window.removeEventListener("keydown", n));
370
+ function Z() {
371
+ if (t.closeable && t.esc) {
372
+ const l = ({ key: S }) => {
373
+ S === "Escape" && (r?.close(t.id), window.removeEventListener("keydown", l));
307
374
  };
308
- window.addEventListener("keydown", n);
375
+ window.addEventListener("keydown", l);
309
376
  }
310
377
  }
311
- function he() {
312
- h = v.value.offsetLeft, _ = v.value.offsetTop;
378
+ function me() {
379
+ w = x.value.offsetLeft, _ = x.value.offsetTop;
313
380
  }
314
- Y(() => {
315
- pe(), fe();
316
- }), ke(() => {
381
+ ae(() => {
382
+ Z(), he();
383
+ }), ze(() => {
317
384
  });
318
385
  function ve() {
319
- return c.value = !0, () => ie();
386
+ return u.value = !0, () => ee();
320
387
  }
321
- function ie() {
322
- c.value = !1;
388
+ function ee() {
389
+ u.value = !1;
323
390
  }
324
- return i({
391
+ return n({
325
392
  showLoading: ve,
326
- hideLoading: ie
327
- }), (n, S) => (y(), C("div", {
393
+ hideLoading: ee
394
+ }), (l, S) => (k(), E("div", {
328
395
  ref_key: "wrapperRef",
329
- ref: b,
396
+ ref: M,
330
397
  class: "modal-wrapper",
331
- style: N(L.value),
332
- onClick: S[0] || (S[0] = Me((se) => n.maskClosable && j(), ["self"]))
398
+ style: K(j.value),
399
+ onClick: S[0] || (S[0] = We((i) => e.maskClosable && H(), ["self"]))
333
400
  }, [
334
- m("div", {
401
+ y("div", {
335
402
  ref_key: "contentRef",
336
- ref: v,
337
- class: Se(["modal-content", { [`${n.mode}-mode`]: !0, [`${n.position}-position`]: !0 }]),
338
- style: N(x.value)
403
+ ref: x,
404
+ class: Ie(["modal-content", { [`${e.mode}-mode`]: !0, [`${e.position}-position`]: !0 }]),
405
+ style: K(V.value)
339
406
  }, [
340
- n.header ? (y(), C("div", {
407
+ e.header ? (k(), E("div", {
341
408
  key: 0,
342
409
  ref_key: "headerRef",
343
- ref: u,
410
+ ref: c,
344
411
  class: "modal-header",
345
- style: N(A.value),
346
- onMousedown: he
412
+ style: K(P.value),
413
+ onMousedown: me
347
414
  }, [
348
- m("div", Ye, O(n.title), 1),
349
- m("div", Ke, [
350
- n.closeable ? (y(), C("div", {
415
+ y("div", st, W(e.title), 1),
416
+ y("div", at, [
417
+ e.closeable ? (k(), E("div", {
351
418
  key: 0,
352
419
  class: "i-icon-park-outline:close block cursor-pointer",
353
- onClick: j
354
- })) : z("", !0)
420
+ onClick: H
421
+ })) : D("", !0)
355
422
  ])
356
- ], 36)) : z("", !0),
357
- m("div", {
423
+ ], 36)) : D("", !0),
424
+ y("div", {
358
425
  id: "modal-header-slot",
359
426
  ref_key: "headerSlotRef",
360
- ref: d
427
+ ref: m
361
428
  }, null, 512),
362
- m("div", {
429
+ y("div", {
363
430
  class: "modal-body",
364
- style: N(M.value)
431
+ style: K(J.value)
365
432
  }, [
366
- (y(), P(re(n.component), $e(Ee(n.componentProps)), null, 16))
433
+ (k(), N($e(e.component), Ve(De(e.componentProps)), null, 16))
367
434
  ], 4),
368
- m("div", {
435
+ y("div", {
369
436
  id: "modal-footer-slot",
370
437
  ref_key: "footerSlotRef",
371
438
  ref: a
372
439
  }, null, 512),
373
- n.footer ? (y(), C("div", {
440
+ e.footer ? (k(), E("div", {
374
441
  key: 1,
375
442
  ref_key: "footerRef",
376
- ref: r,
443
+ ref: f,
377
444
  class: "modal-footer space-x-2"
378
445
  }, [
379
- m("button", {
446
+ y("button", {
380
447
  class: "cancel-button",
381
448
  type: "button",
382
- onClick: ue
383
- }, O(n.cancelText), 1),
384
- m("button", {
449
+ onClick: z
450
+ }, W(e.cancelText), 1),
451
+ y("button", {
385
452
  class: "submit-button",
386
- form: n.form,
387
- type: "button",
388
- onClick: G
389
- }, O(n.submitText), 9, Ue)
390
- ], 512)) : z("", !0),
391
- c.value ? (y(), C("div", qe, Qe)) : z("", !0)
453
+ form: e.form,
454
+ type: "submit",
455
+ onClick: Q
456
+ }, W(e.submitText), 9, ct)
457
+ ], 512)) : D("", !0),
458
+ u.value ? (k(), E("div", dt, [...S[1] || (S[1] = [
459
+ y("div", { class: "lds-ring" }, [
460
+ y("div"),
461
+ y("div"),
462
+ y("div"),
463
+ y("div")
464
+ ], -1)
465
+ ])])) : D("", !0)
392
466
  ], 6)
393
467
  ], 4));
394
468
  }
395
- }), I = (t, i) => {
396
- const o = t.__vccOpts || t;
397
- for (const [e, l] of i)
398
- o[e] = l;
469
+ }), F = (e, n) => {
470
+ const o = e.__vccOpts || e;
471
+ for (const [t, s] of n)
472
+ o[t] = s;
399
473
  return o;
400
- }, tt = /* @__PURE__ */ I(et, [["__scopeId", "data-v-e065fedd"]]), ot = { class: "modal-dialog" }, nt = { class: "dialog-body" }, it = { class: "dialog-title" }, st = { class: "dialog-content" }, rt = /* @__PURE__ */ K({
474
+ }, ht = /* @__PURE__ */ F(ft, [["__scopeId", "data-v-1d490f4f"]]), mt = {}, vt = { class: "modal-footer" };
475
+ function pt(e, n) {
476
+ return k(), N(be, { to: "#modal-footer-slot" }, [
477
+ y("div", vt, [
478
+ we(e.$slots, "default", {}, void 0, !0)
479
+ ])
480
+ ]);
481
+ }
482
+ const Pt = /* @__PURE__ */ F(mt, [["render", pt], ["__scopeId", "data-v-2b3b820b"]]), gt = {}, yt = { class: "modal-header" };
483
+ function xt(e, n) {
484
+ return k(), N(be, { to: "#modal-header-slot" }, [
485
+ y("div", yt, [
486
+ we(e.$slots, "default", {}, void 0, !0)
487
+ ])
488
+ ]);
489
+ }
490
+ const Rt = /* @__PURE__ */ F(gt, [["render", xt], ["__scopeId", "data-v-4d035831"]]), bt = { class: "modal-dialog" }, wt = { class: "dialog-body" }, Ct = { class: "dialog-title" }, kt = { class: "dialog-content" }, Mt = /* @__PURE__ */ de({
401
491
  __name: "modal-dialog",
402
492
  props: {
403
493
  type: {},
@@ -409,71 +499,71 @@ const Xe = (t) => (le("data-v-e065fedd"), t = t(), ae(), t), Ye = { class: "titl
409
499
  onCancel: {},
410
500
  footer: {}
411
501
  },
412
- setup(t) {
413
- const i = t, o = Ct(), e = E(() => i.title ? i.title : {
502
+ setup(e) {
503
+ const n = e, o = Bt(), t = A(() => n.title ? n.title : {
414
504
  confirm: "提示",
415
505
  info: "提示",
416
506
  warning: "警告",
417
507
  error: "错误",
418
508
  success: "成功"
419
- }[i.type]);
420
- async function l() {
421
- i.onOk && await i.onOk(), o.close();
422
- }
509
+ }[n.type]);
423
510
  async function s() {
424
- i.onCancel && await i.onCancel(), o.close();
511
+ n.onOk && await n.onOk(), o.close();
512
+ }
513
+ async function r() {
514
+ n.onCancel && await n.onCancel(), o.close();
425
515
  }
426
- return (c, h) => (y(), C("section", ot, [
427
- m("div", nt, [
428
- m("div", it, O(e.value), 1),
429
- m("div", st, O(c.content), 1)
516
+ return (u, w) => (k(), E("section", bt, [
517
+ y("div", wt, [
518
+ y("div", Ct, W(t.value), 1),
519
+ y("div", kt, W(e.content), 1)
430
520
  ]),
431
- m("div", {
521
+ y("div", {
432
522
  class: "dialog-footer space-x-2",
433
- style: N(c.type === "confirm" ? { "justify-content": "end" } : { "border-top": "none" })
523
+ style: K(e.type === "confirm" ? { "justify-content": "end" } : { "border-top": "none" })
434
524
  }, [
435
- c.footer ? (y(), P(re(c.footer), { key: 0 })) : (y(), C(Z, { key: 1 }, [
436
- m("button", {
525
+ e.footer ? (k(), N($e(e.footer), { key: 0 })) : (k(), E(ye, { key: 1 }, [
526
+ y("button", {
437
527
  class: "submit-button",
438
- type: "submit",
439
- onClick: l
440
- }, O(c.okText), 1),
441
- c.type === "confirm" ? (y(), C("button", {
528
+ type: "button",
529
+ onClick: s
530
+ }, W(e.okText), 1),
531
+ e.type === "confirm" ? (k(), E("button", {
442
532
  key: 0,
443
533
  class: "cancel-button",
444
534
  type: "button",
445
- onClick: s
446
- }, O(c.cancelText), 1)) : z("", !0)
535
+ onClick: r
536
+ }, W(e.cancelText), 1)) : D("", !0)
447
537
  ], 64))
448
538
  ], 4)
449
539
  ]));
450
540
  }
451
- }), lt = /* @__PURE__ */ I(rt, [["__scopeId", "data-v-0c6b8db2"]]), at = (t) => (le("data-v-559bdf2e"), t = t(), ae(), t), dt = { class: "flex-center" }, ct = /* @__PURE__ */ at(() => /* @__PURE__ */ m("div", { class: "modal-loading" }, [
452
- /* @__PURE__ */ m("div", { class: "lds-ring" }, [
453
- /* @__PURE__ */ m("div"),
454
- /* @__PURE__ */ m("div"),
455
- /* @__PURE__ */ m("div"),
456
- /* @__PURE__ */ m("div")
457
- ])
458
- ], -1)), ut = { class: "modal-loading-text" }, ft = /* @__PURE__ */ K({
541
+ }), St = /* @__PURE__ */ F(Mt, [["__scopeId", "data-v-f5ece095"]]), $t = { class: "flex-center" }, Lt = { class: "modal-loading-text" }, _t = /* @__PURE__ */ de({
459
542
  __name: "modal-loading",
460
543
  props: {
461
544
  text: { default: "加载中" }
462
545
  },
463
- setup(t) {
464
- return (i, o) => (y(), C("section", dt, [
465
- ct,
466
- m("div", ut, O(i.text), 1)
546
+ setup(e) {
547
+ return (n, o) => (k(), E("section", $t, [
548
+ o[0] || (o[0] = y("div", { class: "modal-loading" }, [
549
+ y("div", { class: "lds-ring" }, [
550
+ y("div"),
551
+ y("div"),
552
+ y("div"),
553
+ y("div")
554
+ ])
555
+ ], -1)),
556
+ y("div", Lt, W(e.text), 1)
467
557
  ]));
468
558
  }
469
- }), pt = /* @__PURE__ */ I(ft, [["__scopeId", "data-v-559bdf2e"]]), ht = {
559
+ }), Tt = /* @__PURE__ */ F(_t, [["__scopeId", "data-v-27aee8fa"]]), Et = {
470
560
  key: 0,
471
561
  class: "modal-teleport"
472
- }, vt = {
562
+ }, Ht = {
473
563
  name: "ModalProvider",
474
564
  inheritAttrs: !1
475
- }, mt = /* @__PURE__ */ K({
476
- ...vt,
565
+ }, At = /* @__PURE__ */ de({
566
+ ...Ht,
477
567
  props: {
478
568
  appendToBody: { type: [Boolean, String], default: !1 },
479
569
  sizes: { default: () => ({
@@ -485,234 +575,217 @@ const Xe = (t) => (le("data-v-e065fedd"), t = t(), ae(), t), Ye = { class: "titl
485
575
  maxHeight: { default: "90%" },
486
576
  offset: { default: () => ({ x: 0, y: 0 }) }
487
577
  },
488
- setup(t, { expose: i }) {
489
- const o = T([]), e = H(!1), l = V();
490
- function s(r, d = {}, a = {}) {
491
- const g = He(
492
- () => Promise.resolve(typeof r == "string" ? lt : r)
578
+ setup(e, { expose: n }) {
579
+ const o = O([]), t = se(!1), s = q();
580
+ function r(f, m = {}, a = {}) {
581
+ const b = Ke(
582
+ () => Promise.resolve(typeof f == "string" ? St : f)
493
583
  );
494
- typeof r == "string" && (d.type = r, a.size = "small", a.fullscreen = !1, a.mode = "dialog", a.footer = !1, a.header = !1);
495
- const f = Math.random().toString(32).slice(2), k = Object.assign({
496
- zIndex: typeof r == "string" ? 1100 : 1e3
497
- }, a), R = new Promise(($, W) => {
584
+ typeof f == "string" && (m.type = f, a.size = "small", a.fullscreen = !1, a.mode = "dialog", a.footer = !1, a.header = !1);
585
+ const p = Math.random().toString(32).slice(2), X = Object.assign(
586
+ {
587
+ zIndex: typeof f == "string" ? 1100 : 1e3
588
+ },
589
+ a
590
+ ), Y = new Promise((R, T) => {
498
591
  o.value.push({
499
- id: f,
500
- component: g,
501
- props: d || {},
592
+ id: p,
593
+ component: b,
594
+ props: m || {},
502
595
  options: {
503
- ...k,
504
- type: typeof r == "string" ? r : "component"
596
+ ...X,
597
+ type: typeof f == "string" ? f : "component"
505
598
  },
506
- resolve: $,
507
- reject: W,
599
+ resolve: R,
600
+ reject: T,
508
601
  listeners: []
509
- }), F(o);
510
- }).catch(($) => $ === "CANCEL" ? new Promise(() => {
511
- }) : Promise.reject($));
512
- return Object.assign(R, {
513
- close: () => c(f)
602
+ }), U(o);
603
+ }).catch((R) => R === "CANCEL" ? new Promise(() => {
604
+ }) : Promise.reject(R));
605
+ return Object.assign(Y, {
606
+ close: () => u(p)
514
607
  });
515
608
  }
516
- function c(r, d) {
517
- const a = o.value.findIndex((f) => f.id === r);
609
+ function u(f, m) {
610
+ const a = o.value.findIndex((p) => p.id === f);
518
611
  if (a < 0)
519
612
  return;
520
- const g = o.value[a];
521
- d === void 0 ? g == null || g.reject("CANCEL") : g == null || g.resolve(d), o.value.splice(a, 1), F(o);
613
+ const b = o.value[a];
614
+ m === void 0 ? b?.reject("CANCEL") : b?.resolve(m), o.value.splice(a, 1), U(o);
522
615
  }
523
- function h() {
524
- !o.value || o.value.length === 0 || (o.value.forEach((r) => {
525
- r == null || r.reject("CANCEL");
526
- }), o.value = [], F(o));
616
+ function w() {
617
+ !o.value || o.value.length === 0 || (o.value.forEach((f) => {
618
+ f?.reject("CANCEL");
619
+ }), o.value = [], U(o));
527
620
  }
528
- function _(r, d) {
529
- const a = o.value.find((f) => f.id === r);
621
+ function _(f, m) {
622
+ const a = o.value.find((p) => p.id === f);
530
623
  if (!a)
531
624
  return;
532
- const g = a.listeners.find((f) => f.event === d);
533
- g && g.callback({
534
- open: s,
535
- close: (f) => c(a.id, f),
536
- closeAll: h,
537
- showLoading: () => b(a.id),
538
- hideLoading: () => v(a.id),
539
- confirm: (f) => s("confirm", f),
540
- success: (f) => s("success", f),
541
- error: (f) => s("error", f),
542
- warning: (f) => s("warning", f),
543
- info: (f) => s("info", f)
625
+ const b = a.listeners.find((p) => p.event === m);
626
+ b && b.callback({
627
+ open: r,
628
+ close: (p) => u(a.id, p),
629
+ closeAll: w,
630
+ showLoading: () => M(a.id),
631
+ hideLoading: () => x(a.id),
632
+ confirm: (p) => r("confirm", p),
633
+ success: (p) => r("success", p),
634
+ error: (p) => r("error", p),
635
+ warning: (p) => r("warning", p),
636
+ info: (p) => r("info", p)
544
637
  });
545
638
  }
546
- function b(r, d) {
547
- if (!l)
639
+ function M(f, m) {
640
+ if (!s)
548
641
  return;
549
- const [a] = l.refs[`modal-container_${r}`] || [];
642
+ const [a] = s.refs[`modal-container_${f}`] || [];
550
643
  if (a)
551
644
  return a.showLoading();
552
645
  {
553
- const { close: g } = s(pt, {
554
- text: d == null ? void 0 : d.text
555
- }, {
556
- footer: !1,
557
- header: !1,
558
- closeable: !1,
559
- backgroundColor: "transparent"
560
- });
561
- return d != null && d.duration && setTimeout(
562
- () => {
563
- g();
646
+ const { close: b } = r(
647
+ Tt,
648
+ {
649
+ text: m?.text
564
650
  },
565
- d == null ? void 0 : d.duration
566
- ), g;
651
+ {
652
+ footer: !1,
653
+ header: !1,
654
+ closeable: !1,
655
+ backgroundColor: "transparent"
656
+ }
657
+ );
658
+ return m?.duration && setTimeout(() => {
659
+ b();
660
+ }, m?.duration), b;
567
661
  }
568
662
  }
569
- function v(r) {
570
- if (!l)
663
+ function x(f) {
664
+ if (!s)
571
665
  return;
572
- const [d] = l.refs[`modal-container_${r}`];
573
- if (d)
574
- return d.hideLoading();
666
+ const [m] = s.refs[`modal-container_${f}`];
667
+ if (m)
668
+ return m.hideLoading();
575
669
  }
576
- function u(r, d, a) {
577
- const g = o.value.find((f) => f.id === r);
578
- g && g.listeners.push({
579
- event: d,
670
+ function c(f, m, a) {
671
+ const b = o.value.find((p) => p.id === f);
672
+ b && b.listeners.push({
673
+ event: m,
580
674
  callback: a
581
675
  });
582
676
  }
583
- return Le(U, {
584
- open: s,
585
- close: c,
586
- closeAll: h,
587
- addEventListener: u,
588
- showLoading: b,
589
- hideLoading: v
590
- }), i({
677
+ return Ne(fe, {
678
+ open: r,
679
+ close: u,
680
+ closeAll: w,
681
+ addEventListener: c,
682
+ showLoading: M,
683
+ hideLoading: x
684
+ }), n({
591
685
  elements: o,
592
- open: s,
593
- close: c,
594
- closeAll: h
595
- }), Y(() => {
596
- e.value = !0;
597
- }), (r, d) => (y(), C(Z, null, [
598
- oe(r.$slots, "default", {}, void 0, !0),
599
- e.value ? (y(), C("div", ht, [
600
- (y(), P(ne, {
601
- disabled: !r.appendToBody,
602
- to: typeof r.appendToBody == "string" ? r.appendToBody : "body"
686
+ open: r,
687
+ close: u,
688
+ closeAll: w
689
+ }), ae(() => {
690
+ t.value = !0;
691
+ }), (f, m) => (k(), E(ye, null, [
692
+ we(f.$slots, "default", {}, void 0, !0),
693
+ t.value ? (k(), E("div", Et, [
694
+ (k(), N(be, {
695
+ disabled: !e.appendToBody,
696
+ to: typeof e.appendToBody == "string" ? e.appendToBody : "body"
603
697
  }, [
604
- Ae(Oe, { name: "modal-fade" }, {
605
- default: Re(() => [
606
- (y(!0), C(Z, null, Te(o.value, (a) => (y(), P(tt, Be({
698
+ Fe(Xe, { name: "modal-fade" }, {
699
+ default: Ye(() => [
700
+ (k(!0), E(ye, null, je(o.value, (a) => (k(), N(ht, Ge({
607
701
  id: a.id,
608
702
  key: a.id,
609
703
  ref_for: !0,
610
704
  ref: `modal-container_${a.id}`,
611
705
  component: a.component,
612
706
  "component-props": a.props,
613
- "max-height": r.maxHeight,
614
- "max-width": r.maxWidth,
615
- offset: r.offset,
616
- sizes: r.sizes
617
- }, a.options, {
707
+ "max-height": e.maxHeight,
708
+ "max-width": e.maxWidth,
709
+ offset: e.offset,
710
+ sizes: e.sizes
711
+ }, { ref_for: !0 }, a.options, {
618
712
  onSubmit: () => _(a.id, "submit")
619
713
  }), null, 16, ["id", "component", "component-props", "max-height", "max-width", "offset", "sizes", "onSubmit"]))), 128))
620
714
  ]),
621
715
  _: 1
622
716
  })
623
717
  ], 8, ["disabled", "to"]))
624
- ])) : z("", !0)
718
+ ])) : D("", !0)
625
719
  ], 64));
626
720
  }
627
- }), Mt = /* @__PURE__ */ I(mt, [["__scopeId", "data-v-448d3772"]]), gt = {}, yt = { class: "modal-footer" };
628
- function bt(t, i) {
629
- return y(), P(ne, { to: "#modal-footer-slot" }, [
630
- m("div", yt, [
631
- oe(t.$slots, "default", {}, void 0, !0)
632
- ])
633
- ]);
634
- }
635
- const St = /* @__PURE__ */ I(gt, [["render", bt], ["__scopeId", "data-v-46f8d703"]]), wt = {}, _t = { class: "modal-header" };
636
- function xt(t, i) {
637
- return y(), P(ne, { to: "#modal-header-slot" }, [
638
- m("div", _t, [
639
- oe(t.$slots, "default", {}, void 0, !0)
640
- ])
641
- ]);
642
- }
643
- const $t = /* @__PURE__ */ I(wt, [["render", xt], ["__scopeId", "data-v-d0247172"]]);
644
- function X(t, i) {
645
- var e, l;
646
- let o = t == null ? void 0 : t.parent;
647
- for (; o && ((e = o == null ? void 0 : o.type) == null ? void 0 : e.name) !== i; )
721
+ }), zt = /* @__PURE__ */ F(At, [["__scopeId", "data-v-d74e77f1"]]);
722
+ function re(e, n) {
723
+ let o = e?.parent;
724
+ for (; o && o?.type?.name !== n; )
648
725
  o = o.parent;
649
- return ((l = o == null ? void 0 : o.type) == null ? void 0 : l.name) === i ? o : null;
726
+ return o?.type?.name === n ? o : null;
650
727
  }
651
- function Ct() {
652
- const t = te(U), i = V();
653
- function o(e, l, s) {
654
- if (!t)
728
+ function Bt() {
729
+ const e = xe(fe), n = q();
730
+ function o(t, s, r) {
731
+ if (!e)
655
732
  throw new Error("Not Found Modal Provider Component");
656
- return t.open(e, l, s);
733
+ return e.open(t, s, r);
657
734
  }
658
735
  return {
659
736
  open: o,
660
- close(e) {
661
- var c;
662
- if (!t)
737
+ close(t) {
738
+ if (!e)
663
739
  throw new Error("Not Found Modal Provider Component");
664
- const l = X(i, "ModalContainer"), s = (c = l == null ? void 0 : l.props) == null ? void 0 : c.id;
665
- if (!s)
740
+ const r = re(n, "ModalContainer")?.props?.id;
741
+ if (!r)
666
742
  throw new Error("Not Found Current Modal Container");
667
- t.close(s, e);
743
+ e.close(r, t);
668
744
  },
669
745
  closeAll() {
670
- if (!t)
746
+ if (!e)
671
747
  throw new Error("Not Found Modal Provider Component");
672
- t.closeAll();
748
+ e.closeAll();
673
749
  },
674
- showLoading(e) {
675
- var c;
676
- if (!t)
750
+ showLoading(t) {
751
+ if (!e)
677
752
  throw new Error("Not Found Modal Provider Component");
678
- const l = X(i, "ModalContainer"), s = (c = l == null ? void 0 : l.props) == null ? void 0 : c.id;
679
- return t.showLoading(s, e);
753
+ const r = re(n, "ModalContainer")?.props?.id;
754
+ return e.showLoading(r, t);
680
755
  },
681
756
  hideLoading() {
682
- var s;
683
- if (!t)
757
+ if (!e)
684
758
  throw new Error("Not Found Modal Provider Component");
685
- const e = X(i, "ModalContainer"), l = (s = e == null ? void 0 : e.props) == null ? void 0 : s.id;
686
- return t.hideLoading(l);
759
+ const s = re(n, "ModalContainer")?.props?.id;
760
+ return e.hideLoading(s);
687
761
  },
688
- confirm(e) {
689
- return this.open("confirm", e);
762
+ confirm(t) {
763
+ return this.open("confirm", t);
690
764
  },
691
- info(e) {
692
- return this.open("info", e);
765
+ info(t) {
766
+ return this.open("info", t);
693
767
  },
694
- error(e) {
695
- return this.open("error", e);
768
+ error(t) {
769
+ return this.open("error", t);
696
770
  },
697
- warning(e) {
698
- return this.open("warning", e);
771
+ warning(t) {
772
+ return this.open("warning", t);
699
773
  },
700
- success(e) {
701
- return this.open("success", e);
774
+ success(t) {
775
+ return this.open("success", t);
702
776
  }
703
777
  };
704
778
  }
705
- function Et(t) {
706
- var s;
707
- const i = te(U), o = V(), e = X(o, "ModalContainer"), l = (s = e == null ? void 0 : e.props) == null ? void 0 : s.id;
708
- i && l && i.addEventListener(l, "submit", t);
779
+ function Wt(e) {
780
+ const n = xe(fe), o = q(), s = re(o, "ModalContainer")?.props?.id;
781
+ n && s && n.addEventListener(s, "submit", e);
709
782
  }
710
783
  export {
711
- tt as ModalContainer,
712
- St as ModalFooter,
713
- $t as ModalHeader,
714
- U as ModalKey,
715
- Mt as ModalProvider,
716
- Et as onSubmit,
717
- Ct as useModal
784
+ ht as ModalContainer,
785
+ Pt as ModalFooter,
786
+ Rt as ModalHeader,
787
+ fe as ModalKey,
788
+ zt as ModalProvider,
789
+ Wt as onSubmit,
790
+ Bt as useModal
718
791
  };