hanap-labs 6.0.0 → 6.0.2
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/chunks/components-Dg-DWzSo.js +5240 -0
- package/dist/chunks/composables-DKVarDSV.js +3600 -0
- package/dist/chunks/usePopup-DgM99GbC.js +1011 -0
- package/dist/components/index.js +1 -1
- package/dist/composables/index.js +3 -3
- package/dist/helpers/index.js +1 -1
- package/dist/index.js +11046 -7
- package/package.json +4 -18
- package/dist/chunks/components-Eyobrbab.js +0 -3260
- package/dist/chunks/composables-BGbskBoU.js +0 -261
- package/dist/chunks/usePopup-DyBxwBWk.js +0 -254
- /package/dist/chunks/{helpers-C1-KOauP.js → helpers-BjMDD0mP.js} +0 -0
|
@@ -1,261 +0,0 @@
|
|
|
1
|
-
import { computed as e, reactive as t, ref as n, unref as r, watch as i } from "vue";
|
|
2
|
-
import { QueryClient as a, VueQueryPlugin as o, useMutation as s, useQuery as c } from "@tanstack/vue-query";
|
|
3
|
-
import l from "lodash/isEqual";
|
|
4
|
-
//#region src/composables/ui/useTheme.ts
|
|
5
|
-
var u = "hanap-labs-theme", d = "hanap-labs-theme", f = "light", p = {}, m = !1, h = n(f), g = e(() => h.value === "system" ? b() === "dark" : h.value === "dark"), _ = e(() => !g.value);
|
|
6
|
-
function v(e) {
|
|
7
|
-
if (typeof document > "u") return null;
|
|
8
|
-
let t = `; ${document.cookie}`.split(`; ${e}=`);
|
|
9
|
-
if (t.length === 2) {
|
|
10
|
-
let e = t.pop();
|
|
11
|
-
if (e) return e.split(";").shift() || null;
|
|
12
|
-
}
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
function y(e, t, n = {}) {
|
|
16
|
-
if (typeof document > "u") return;
|
|
17
|
-
let { path: r = "/", domain: i, secure: a, sameSite: o = "lax", maxAge: s = 31536e3 } = n, c = `${encodeURIComponent(e)}=${encodeURIComponent(t)}`;
|
|
18
|
-
r && (c += `; path=${r}`), i && (c += `; domain=${i}`), a && (c += "; secure"), o && (c += `; samesite=${o}`), s !== void 0 && (c += `; max-age=${s}`), document.cookie = c;
|
|
19
|
-
}
|
|
20
|
-
function b() {
|
|
21
|
-
return typeof window > "u" ? f : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
22
|
-
}
|
|
23
|
-
function x(e) {
|
|
24
|
-
if (typeof document > "u") return;
|
|
25
|
-
let t = document.documentElement;
|
|
26
|
-
t.classList.remove("light", "dark"), t.classList.add(e === "system" ? b() : e);
|
|
27
|
-
}
|
|
28
|
-
function S() {
|
|
29
|
-
if (typeof window > "u") return null;
|
|
30
|
-
let { storageKey: e = u, cookieKey: t = d } = p, n = v(t);
|
|
31
|
-
if (n && [
|
|
32
|
-
"light",
|
|
33
|
-
"dark",
|
|
34
|
-
"system"
|
|
35
|
-
].includes(n)) return n;
|
|
36
|
-
let r = typeof localStorage < "u" ? localStorage.getItem(e) : null;
|
|
37
|
-
return r && [
|
|
38
|
-
"light",
|
|
39
|
-
"dark",
|
|
40
|
-
"system"
|
|
41
|
-
].includes(r) ? r : null;
|
|
42
|
-
}
|
|
43
|
-
function C() {
|
|
44
|
-
m || (m = !0, i(g, () => {
|
|
45
|
-
x(h.value);
|
|
46
|
-
}));
|
|
47
|
-
}
|
|
48
|
-
function w(e) {
|
|
49
|
-
h.value = e;
|
|
50
|
-
let { storageKey: t = u, cookieKey: n = d, cookieOptions: r } = p;
|
|
51
|
-
typeof localStorage < "u" && localStorage.setItem(t, e), y(n, e, r);
|
|
52
|
-
}
|
|
53
|
-
function T() {
|
|
54
|
-
h.value === "light" ? w("dark") : h.value === "dark" ? w("light") : w(b() === "light" ? "dark" : "light");
|
|
55
|
-
}
|
|
56
|
-
function E(e = {}) {
|
|
57
|
-
p = e;
|
|
58
|
-
let t = S();
|
|
59
|
-
if (t) h.value = t;
|
|
60
|
-
else {
|
|
61
|
-
let { defaultMode: e = f } = p;
|
|
62
|
-
h.value = e;
|
|
63
|
-
}
|
|
64
|
-
return x(h.value), C(), {
|
|
65
|
-
mode: h,
|
|
66
|
-
isDark: g,
|
|
67
|
-
isLight: _,
|
|
68
|
-
toggle: T,
|
|
69
|
-
setMode: w
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
//#endregion
|
|
73
|
-
//#region src/composables/data/_internal.ts
|
|
74
|
-
function D(e) {
|
|
75
|
-
return e;
|
|
76
|
-
}
|
|
77
|
-
//#endregion
|
|
78
|
-
//#region src/composables/data/useQuery.ts
|
|
79
|
-
var O = {
|
|
80
|
-
retry: !1,
|
|
81
|
-
refetchOnMount: !0,
|
|
82
|
-
refetchOnReconnect: !1,
|
|
83
|
-
refetchOnWindowFocus: !1
|
|
84
|
-
}, k = 0;
|
|
85
|
-
function A(e) {
|
|
86
|
-
if (e !== void 0) return typeof e == "function" ? e() : r(e);
|
|
87
|
-
}
|
|
88
|
-
function j() {
|
|
89
|
-
return k += 1, ["hanap-labs-query", k];
|
|
90
|
-
}
|
|
91
|
-
async function M(e) {
|
|
92
|
-
return (await e()).data;
|
|
93
|
-
}
|
|
94
|
-
function N(t = {}) {
|
|
95
|
-
return function(n, a) {
|
|
96
|
-
let { queryKey: o, onSuccess: s, onError: l, enabled: u, ...d } = a ?? {}, f = j(), p = [], m = [];
|
|
97
|
-
s !== void 0 && p.push(s), l !== void 0 && m.push(l);
|
|
98
|
-
let h = c({
|
|
99
|
-
queryKey: e(() => o === void 0 ? f : typeof o == "function" ? o() : r(o)),
|
|
100
|
-
queryFn: (e) => n({
|
|
101
|
-
queryKey: e.queryKey,
|
|
102
|
-
signal: e.signal
|
|
103
|
-
}),
|
|
104
|
-
enabled: e(() => A(u)),
|
|
105
|
-
...O,
|
|
106
|
-
...t,
|
|
107
|
-
...d
|
|
108
|
-
});
|
|
109
|
-
p.length > 0 && i(() => h.data.value, (e) => {
|
|
110
|
-
if (e !== void 0) for (let t of p) t(e);
|
|
111
|
-
}, { immediate: !1 }), m.length > 0 && i(() => h.error.value, (e) => {
|
|
112
|
-
if (e !== null) for (let t of m) t(e);
|
|
113
|
-
}, { immediate: !1 });
|
|
114
|
-
let g = () => M(h.refetch), _ = {
|
|
115
|
-
data: D(h.data),
|
|
116
|
-
error: D(h.error),
|
|
117
|
-
isError: D(h.isError),
|
|
118
|
-
loading: D(h.isFetching),
|
|
119
|
-
initializing: D(h.isLoading),
|
|
120
|
-
isSuccess: D(h.isSuccess),
|
|
121
|
-
onError: (e) => (m.push(e), _),
|
|
122
|
-
refetch: g,
|
|
123
|
-
run: g,
|
|
124
|
-
status: D(h.status)
|
|
125
|
-
};
|
|
126
|
-
return _;
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
var P = N();
|
|
130
|
-
//#endregion
|
|
131
|
-
//#region src/composables/data/queryPlugin.ts
|
|
132
|
-
function F(e = {}) {
|
|
133
|
-
return { install(t) {
|
|
134
|
-
let n = new a({ defaultOptions: {
|
|
135
|
-
queries: e.queries,
|
|
136
|
-
mutations: e.mutations
|
|
137
|
-
} });
|
|
138
|
-
t.use(o, { queryClient: n });
|
|
139
|
-
} };
|
|
140
|
-
}
|
|
141
|
-
//#endregion
|
|
142
|
-
//#region src/composables/data/useMutation.ts
|
|
143
|
-
function I(e) {
|
|
144
|
-
return e[0];
|
|
145
|
-
}
|
|
146
|
-
function L(e, t) {
|
|
147
|
-
return e(t);
|
|
148
|
-
}
|
|
149
|
-
function R(e = {}) {
|
|
150
|
-
return function(t, n) {
|
|
151
|
-
let { onSuccess: r, onError: i, onMutate: a, onSettled: o, ...c } = n ?? {}, l = [], u = [], d = [], f = [];
|
|
152
|
-
r !== void 0 && l.push(r), i !== void 0 && u.push(i), a !== void 0 && d.push(a), o !== void 0 && f.push(o);
|
|
153
|
-
let p = s({
|
|
154
|
-
mutationFn: (e) => L(t, e),
|
|
155
|
-
...e,
|
|
156
|
-
...c,
|
|
157
|
-
onMutate: async (e, t) => {
|
|
158
|
-
let n;
|
|
159
|
-
for (let t of d) n = await t(e);
|
|
160
|
-
return n;
|
|
161
|
-
},
|
|
162
|
-
onSuccess: async (e, t, n) => {
|
|
163
|
-
for (let r of l) await r(e, t, n);
|
|
164
|
-
},
|
|
165
|
-
onError: async (e, t, n) => {
|
|
166
|
-
for (let r of u) await r(e, t, n);
|
|
167
|
-
},
|
|
168
|
-
onSettled: async (e, t, n, r) => {
|
|
169
|
-
for (let i of f) await i(e, t, n, r);
|
|
170
|
-
}
|
|
171
|
-
}), m = {
|
|
172
|
-
data: D(p.data),
|
|
173
|
-
error: D(p.error),
|
|
174
|
-
idle: D(p.isIdle),
|
|
175
|
-
isError: D(p.isError),
|
|
176
|
-
isSuccess: D(p.isSuccess),
|
|
177
|
-
submitting: D(p.isPending),
|
|
178
|
-
onError: (e) => (u.push(e), m),
|
|
179
|
-
onMutate: (e) => (d.push(e), m),
|
|
180
|
-
onSettled: (e) => (f.push(e), m),
|
|
181
|
-
onSuccess: (e) => (l.push(e), m),
|
|
182
|
-
reset: p.reset,
|
|
183
|
-
run: (...e) => p.mutateAsync(I(e)),
|
|
184
|
-
status: D(p.status)
|
|
185
|
-
};
|
|
186
|
-
return m;
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
var z = R(), B = (e) => {
|
|
190
|
-
let t = e.error.flatten().fieldErrors, n = {};
|
|
191
|
-
for (let [e, r] of Object.entries(t)) Array.isArray(r) && r.length > 0 && (n[e] = r);
|
|
192
|
-
return n;
|
|
193
|
-
};
|
|
194
|
-
function V(r, a) {
|
|
195
|
-
let o = t({ ...r }), s = n({}), c = n({ ...r }), u = e(() => !l({ ...o }, c.value)), d = () => {
|
|
196
|
-
s.value = {};
|
|
197
|
-
}, f = (e) => {
|
|
198
|
-
s.value = {
|
|
199
|
-
...s.value,
|
|
200
|
-
...e
|
|
201
|
-
};
|
|
202
|
-
}, p = () => ({ ...o }), m = () => {
|
|
203
|
-
if (!a) return d(), {
|
|
204
|
-
valid: !0,
|
|
205
|
-
data: p()
|
|
206
|
-
};
|
|
207
|
-
let e = a.safeParse(p());
|
|
208
|
-
return e.success ? (d(), {
|
|
209
|
-
valid: !0,
|
|
210
|
-
data: e.data
|
|
211
|
-
}) : (s.value = B(e), {
|
|
212
|
-
valid: !1,
|
|
213
|
-
errors: s.value
|
|
214
|
-
});
|
|
215
|
-
}, h = (e) => {
|
|
216
|
-
if (!a) return;
|
|
217
|
-
let t = a.safeParse(p()), n = e, { [n]: r, ...i } = s.value;
|
|
218
|
-
if (t.success) {
|
|
219
|
-
s.value = i;
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
let o = t.error.flatten().fieldErrors[n];
|
|
223
|
-
s.value = o?.length ? {
|
|
224
|
-
...i,
|
|
225
|
-
[n]: o
|
|
226
|
-
} : i;
|
|
227
|
-
}, g = (e) => {
|
|
228
|
-
let t = {
|
|
229
|
-
...c.value,
|
|
230
|
-
...e
|
|
231
|
-
};
|
|
232
|
-
c.value = { ...t };
|
|
233
|
-
for (let e of Object.keys(t)) o[e] = t[e];
|
|
234
|
-
d();
|
|
235
|
-
};
|
|
236
|
-
i(p, (e, t) => {
|
|
237
|
-
for (let n of Object.keys(e)) t?.[n] !== e[n] && h(n);
|
|
238
|
-
}, { deep: !0 });
|
|
239
|
-
let _ = {
|
|
240
|
-
form: o,
|
|
241
|
-
errors: s,
|
|
242
|
-
isDirty: u,
|
|
243
|
-
validate: m,
|
|
244
|
-
reset: g,
|
|
245
|
-
clearErrors: d,
|
|
246
|
-
setErrors: f
|
|
247
|
-
};
|
|
248
|
-
return {
|
|
249
|
-
..._,
|
|
250
|
-
onSubmit: (e) => ({
|
|
251
|
-
..._,
|
|
252
|
-
submit: async (t) => {
|
|
253
|
-
t?.preventDefault();
|
|
254
|
-
let n = m();
|
|
255
|
-
if (n.valid) return await e(n.data, t);
|
|
256
|
-
}
|
|
257
|
-
})
|
|
258
|
-
};
|
|
259
|
-
}
|
|
260
|
-
//#endregion
|
|
261
|
-
export { N as a, F as i, R as n, P as o, z as r, E as s, V as t };
|
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
import { computed as e, markRaw as t, nextTick as n, onBeforeUnmount as r, readonly as i, ref as a, useId as o, watch as s } from "vue";
|
|
2
|
-
import { autoUpdate as c, computePosition as l, flip as u, offset as d, shift as f } from "@floating-ui/dom";
|
|
3
|
-
//#region src/composables/ui/useFloat.ts
|
|
4
|
-
var p = (e) => typeof e == "object" && !!e && "$el" in e, m = (e) => typeof HTMLElement > "u" || e === null ? null : e instanceof HTMLElement ? e : p(e) && e.$el instanceof HTMLElement ? e.$el : null, h = (e, t) => {
|
|
5
|
-
if (e != null) {
|
|
6
|
-
if (typeof e == "function") {
|
|
7
|
-
e(t, {});
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
typeof e == "object" && "value" in e && (e.value = t);
|
|
11
|
-
}
|
|
12
|
-
}, g = (e, t, n) => (r) => {
|
|
13
|
-
let i = m(r);
|
|
14
|
-
e.value = i, i && !i.id && (i.id = t), h(n, r);
|
|
15
|
-
};
|
|
16
|
-
function _(t = {}) {
|
|
17
|
-
let { placement: i = "bottom-start", strategy: p = "fixed", offset: m = 5, flip: h = !0, shift: _ = !0, middleware: v = [], autoUpdate: y = !0 } = t, b = o(), x = o(), S = a(null), C = a(null), w = a({
|
|
18
|
-
x: 0,
|
|
19
|
-
y: 0
|
|
20
|
-
}), T = a(i), E = a(!1), D = [
|
|
21
|
-
d(m),
|
|
22
|
-
...h ? [u(typeof h == "boolean" ? void 0 : h)] : [],
|
|
23
|
-
..._ ? [f(typeof _ == "boolean" ? void 0 : _)] : [],
|
|
24
|
-
...v
|
|
25
|
-
], O = null, k = () => {
|
|
26
|
-
O !== null && (O(), O = null);
|
|
27
|
-
}, A = async () => {
|
|
28
|
-
let e = S.value, t = C.value;
|
|
29
|
-
if (e === null || t === null) return;
|
|
30
|
-
let n = await l(e, t, {
|
|
31
|
-
placement: i,
|
|
32
|
-
strategy: p,
|
|
33
|
-
middleware: D
|
|
34
|
-
});
|
|
35
|
-
w.value = {
|
|
36
|
-
x: n.x,
|
|
37
|
-
y: n.y
|
|
38
|
-
}, T.value = n.placement;
|
|
39
|
-
}, j = () => {
|
|
40
|
-
if (!y) return;
|
|
41
|
-
let e = S.value, t = C.value;
|
|
42
|
-
e === null || t === null || (k(), O = c(e, t, A));
|
|
43
|
-
}, M = () => {
|
|
44
|
-
E.value = !0;
|
|
45
|
-
}, N = () => {
|
|
46
|
-
E.value = !1;
|
|
47
|
-
}, P = () => {
|
|
48
|
-
E.value = !E.value;
|
|
49
|
-
}, F = e(() => ({
|
|
50
|
-
position: p,
|
|
51
|
-
top: `${w.value.y}px`,
|
|
52
|
-
left: `${w.value.x}px`,
|
|
53
|
-
visibility: E.value ? "visible" : "hidden",
|
|
54
|
-
opacity: +!!E.value,
|
|
55
|
-
pointerEvents: E.value ? "auto" : "none",
|
|
56
|
-
transform: E.value ? "scale(1)" : "scale(0.98)",
|
|
57
|
-
transition: "opacity 150ms ease, transform 150ms ease"
|
|
58
|
-
})), I = (e = {}) => {
|
|
59
|
-
let t = e.id ?? b;
|
|
60
|
-
return {
|
|
61
|
-
...e,
|
|
62
|
-
id: t,
|
|
63
|
-
ref: g(S, t, e.ref),
|
|
64
|
-
"aria-controls": e["aria-controls"] ?? C.value?.id ?? x,
|
|
65
|
-
"aria-expanded": e["aria-expanded"] ?? E.value
|
|
66
|
-
};
|
|
67
|
-
}, L = (e = {}) => {
|
|
68
|
-
let t = e.id ?? C.value?.id ?? x;
|
|
69
|
-
return {
|
|
70
|
-
...e,
|
|
71
|
-
id: t,
|
|
72
|
-
ref: g(C, t, e.ref),
|
|
73
|
-
style: e.style === void 0 ? F.value : [F.value, e.style],
|
|
74
|
-
"aria-hidden": e["aria-hidden"] ?? !E.value
|
|
75
|
-
};
|
|
76
|
-
}, R = e(() => I()), z = e(() => L()), B = async () => {
|
|
77
|
-
if (S.value === null || C.value === null) {
|
|
78
|
-
k();
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
await n(), await A(), j();
|
|
82
|
-
};
|
|
83
|
-
return s(E, (e) => {
|
|
84
|
-
e ? B() : k();
|
|
85
|
-
}), s([S, C], () => {
|
|
86
|
-
E.value ? B() : k();
|
|
87
|
-
}), r(k), {
|
|
88
|
-
trigger: R,
|
|
89
|
-
floating: z,
|
|
90
|
-
getTriggerBindings: I,
|
|
91
|
-
getFloatingBindings: L,
|
|
92
|
-
referenceElement: S,
|
|
93
|
-
floatingElement: C,
|
|
94
|
-
visible: E,
|
|
95
|
-
styles: F,
|
|
96
|
-
resolvedPlacement: T,
|
|
97
|
-
show: M,
|
|
98
|
-
hide: N,
|
|
99
|
-
toggle: P,
|
|
100
|
-
updatePosition: A
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
//#endregion
|
|
104
|
-
//#region src/composables/ui/useNotify.ts
|
|
105
|
-
var v = {
|
|
106
|
-
success: "hl-bg-success/10 hl-text-success hl-border hl-border-success/20",
|
|
107
|
-
error: "hl-bg-danger/10 hl-text-danger hl-border hl-border-danger/20",
|
|
108
|
-
info: "hl-bg-info/10 hl-text-info hl-border hl-border-info/20",
|
|
109
|
-
warning: "hl-bg-warning/10 hl-text-warning hl-border hl-border-warning/20"
|
|
110
|
-
}, y = 1, b = a({
|
|
111
|
-
id: 0,
|
|
112
|
-
visible: !1,
|
|
113
|
-
type: "success",
|
|
114
|
-
message: "",
|
|
115
|
-
title: "",
|
|
116
|
-
durationMs: 0,
|
|
117
|
-
colorClass: v.success
|
|
118
|
-
}), x = a(void 0), S = e(() => b.value.colorClass), C = (e) => Array.isArray(e) ? e.length > 0 ? e.join("\n") : "Something went wrong" : e, w = () => {
|
|
119
|
-
x.value !== void 0 && (clearTimeout(x.value), x.value = void 0);
|
|
120
|
-
}, T = () => {
|
|
121
|
-
b.value.visible = !1, w();
|
|
122
|
-
}, E = (e, t, n, r) => {
|
|
123
|
-
w();
|
|
124
|
-
let i = C(t), a = Math.max(r, 0);
|
|
125
|
-
b.value = {
|
|
126
|
-
id: y++,
|
|
127
|
-
visible: !0,
|
|
128
|
-
type: e,
|
|
129
|
-
message: i,
|
|
130
|
-
title: n,
|
|
131
|
-
durationMs: a,
|
|
132
|
-
colorClass: v[e]
|
|
133
|
-
}, a > 0 && (x.value = setTimeout(() => {
|
|
134
|
-
b.value.visible = !1, x.value = void 0;
|
|
135
|
-
}, a));
|
|
136
|
-
}, D = (e, t, n) => {
|
|
137
|
-
E("success", e, t ?? "", n ?? 3500);
|
|
138
|
-
}, O = (e, t, n) => {
|
|
139
|
-
E("error", e, t ?? "", n ?? 3500);
|
|
140
|
-
}, k = (e, t, n) => {
|
|
141
|
-
E("info", e, t ?? "", n ?? 3500);
|
|
142
|
-
}, A = (e, t, n) => {
|
|
143
|
-
E("warning", e, t ?? "", n ?? 3500);
|
|
144
|
-
};
|
|
145
|
-
function j() {
|
|
146
|
-
return {
|
|
147
|
-
notification: i(b),
|
|
148
|
-
classes: S,
|
|
149
|
-
success: D,
|
|
150
|
-
error: O,
|
|
151
|
-
info: k,
|
|
152
|
-
warning: A,
|
|
153
|
-
hide: T
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
//#endregion
|
|
157
|
-
//#region src/composables/ui/usePopup.ts
|
|
158
|
-
var M = 0, N = null, P = null, F = 300, I = a({
|
|
159
|
-
isVisible: !1,
|
|
160
|
-
type: "confirm",
|
|
161
|
-
component: null,
|
|
162
|
-
props: void 0,
|
|
163
|
-
loading: !1
|
|
164
|
-
}), L = () => {
|
|
165
|
-
N = null, P = null;
|
|
166
|
-
}, R = () => {
|
|
167
|
-
L(), I.value = {
|
|
168
|
-
isVisible: !1,
|
|
169
|
-
type: "confirm",
|
|
170
|
-
component: null,
|
|
171
|
-
props: void 0,
|
|
172
|
-
loading: !1
|
|
173
|
-
};
|
|
174
|
-
}, z = () => {
|
|
175
|
-
setTimeout(R, F);
|
|
176
|
-
}, B = (e) => {
|
|
177
|
-
console.error("[usePopup] popup callback failed", e);
|
|
178
|
-
}, V = (e) => e instanceof Promise, H = () => {
|
|
179
|
-
if (P !== null) try {
|
|
180
|
-
let e = P();
|
|
181
|
-
V(e) && e.catch(B);
|
|
182
|
-
} catch (e) {
|
|
183
|
-
B(e);
|
|
184
|
-
}
|
|
185
|
-
}, U = () => {
|
|
186
|
-
I.value.isVisible = !1, z();
|
|
187
|
-
}, W = (e) => {
|
|
188
|
-
let t = {
|
|
189
|
-
onConfirm: (n) => (M === e && (N = n), t),
|
|
190
|
-
onCancel: (n) => (M === e && (P = n), t)
|
|
191
|
-
};
|
|
192
|
-
return t;
|
|
193
|
-
}, G = (e) => {
|
|
194
|
-
L();
|
|
195
|
-
let n = M + 1;
|
|
196
|
-
return M = n, e.type === "confirm" ? (I.value = {
|
|
197
|
-
isVisible: !0,
|
|
198
|
-
type: "confirm",
|
|
199
|
-
component: null,
|
|
200
|
-
props: {
|
|
201
|
-
title: e.title,
|
|
202
|
-
message: e.message,
|
|
203
|
-
confirmText: e.confirmText,
|
|
204
|
-
cancelText: e.cancelText,
|
|
205
|
-
icon: e.icon,
|
|
206
|
-
iconSource: e.iconSource,
|
|
207
|
-
hideIcon: e.hideIcon
|
|
208
|
-
},
|
|
209
|
-
loading: !1
|
|
210
|
-
}, W(n)) : (I.value = {
|
|
211
|
-
isVisible: !0,
|
|
212
|
-
type: "custom",
|
|
213
|
-
component: t(e.component),
|
|
214
|
-
props: e.props,
|
|
215
|
-
loading: !1
|
|
216
|
-
}, W(n));
|
|
217
|
-
}, K = () => {
|
|
218
|
-
I.value.loading || (U(), H());
|
|
219
|
-
}, q = () => {
|
|
220
|
-
if (!I.value.loading) {
|
|
221
|
-
if (N === null) {
|
|
222
|
-
U();
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
try {
|
|
226
|
-
let e = N();
|
|
227
|
-
if (!V(e)) {
|
|
228
|
-
U();
|
|
229
|
-
return;
|
|
230
|
-
}
|
|
231
|
-
I.value.loading = !0, e.then(() => {
|
|
232
|
-
I.value.loading = !1, U();
|
|
233
|
-
}).catch((e) => {
|
|
234
|
-
I.value.loading = !1, B(e);
|
|
235
|
-
});
|
|
236
|
-
} catch (e) {
|
|
237
|
-
B(e);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
};
|
|
241
|
-
function J() {
|
|
242
|
-
return {
|
|
243
|
-
isVisible: e(() => I.value.isVisible),
|
|
244
|
-
loading: e(() => I.value.loading),
|
|
245
|
-
type: e(() => I.value.type),
|
|
246
|
-
component: e(() => I.value.component),
|
|
247
|
-
props: e(() => I.value.props),
|
|
248
|
-
open: G,
|
|
249
|
-
close: K,
|
|
250
|
-
confirm: q
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
//#endregion
|
|
254
|
-
export { j as n, _ as r, J as t };
|
|
File without changes
|