@gopowerteam/modal-render 0.0.37 → 0.0.39

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