@signal24/vue-foundation 4.14.1 → 4.15.1
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.
|
@@ -1,8 +1,18 @@
|
|
|
1
|
+
interface IAlertOptions {
|
|
2
|
+
title?: string;
|
|
3
|
+
message: string | Error;
|
|
4
|
+
classes?: string[];
|
|
5
|
+
}
|
|
1
6
|
export declare function showAlert(title: string, message: string | Error): Promise<void>;
|
|
2
7
|
export declare function showAlert(message: string | Error): Promise<void>;
|
|
8
|
+
export declare function showAlert(options: IAlertOptions): Promise<void>;
|
|
3
9
|
export declare function showConfirm(title: string, message: string): Promise<boolean>;
|
|
4
10
|
export declare function showConfirm(message: string): Promise<boolean>;
|
|
11
|
+
export declare function showConfirm(options: IAlertOptions): Promise<boolean>;
|
|
5
12
|
export declare function showConfirmDestroy(title: string, message: string): Promise<boolean>;
|
|
6
13
|
export declare function showConfirmDestroy(message: string): Promise<boolean>;
|
|
14
|
+
export declare function showConfirmDestroy(options: IAlertOptions): Promise<boolean>;
|
|
7
15
|
export declare function showWait(title: string, message: string): () => void;
|
|
8
16
|
export declare function showWait(message: string): () => void;
|
|
17
|
+
export declare function showWait(options: IAlertOptions): () => void;
|
|
18
|
+
export {};
|
|
@@ -3,5 +3,10 @@ export declare class UserError extends Error {
|
|
|
3
3
|
}
|
|
4
4
|
export declare function formatError(err: any): string;
|
|
5
5
|
export declare function toError(err: any): Error;
|
|
6
|
-
|
|
6
|
+
interface IErrorAlertOptions {
|
|
7
|
+
title?: string;
|
|
8
|
+
classes?: string[];
|
|
9
|
+
}
|
|
10
|
+
export declare function handleErrorAndAlert(errIn: any, options?: IErrorAlertOptions): Promise<void>;
|
|
7
11
|
export declare function handleError(errIn: any): Promise<void>;
|
|
12
|
+
export {};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var E = (e, t, n) =>
|
|
4
|
-
import { defineComponent as C, defineProps as
|
|
5
|
-
import { compact as
|
|
6
|
-
import { escapeHtml as
|
|
7
|
-
import { escapeHtml as
|
|
8
|
-
import { installOpenApiClientInterceptors as
|
|
1
|
+
var Be = Object.defineProperty;
|
|
2
|
+
var Ve = (e, t, n) => t in e ? Be(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var E = (e, t, n) => Ve(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import { defineComponent as C, defineProps as Fe, defineEmits as _e, ref as b, computed as _, openBlock as d, createElementBlock as h, createElementVNode as w, toDisplayString as x, withDirectives as j, createCommentVNode as O, Fragment as W, renderList as J, vModelSelect as Re, getCurrentInstance as ee, onMounted as L, normalizeClass as k, normalizeStyle as Ne, withModifiers as te, renderSlot as K, reactive as Ke, h as U, Teleport as je, markRaw as We, onBeforeUnmount as ne, resolveDirective as we, createBlock as be, createSlots as Ue, withCtx as Y, createTextVNode as ae, vModelText as Pe, watch as ce, onActivated as Oe, onDeactivated as ke } from "vue";
|
|
5
|
+
import { compact as qe, debounce as ze, isEqual as Se, upperFirst as Xe, startCase as Ye, cloneDeep as Ze, remove as Ge } from "lodash";
|
|
6
|
+
import { escapeHtml as Qe } from "@vue/shared";
|
|
7
|
+
import { escapeHtml as ns } from "@vue/shared";
|
|
8
|
+
import { installOpenApiClientInterceptors as Je, isOpenApiError as et } from "@signal24/openapi-client-codegen/browser";
|
|
9
9
|
import { format as G } from "date-fns";
|
|
10
|
-
const
|
|
10
|
+
const tt = C({
|
|
11
11
|
setup() {
|
|
12
|
-
const e =
|
|
13
|
-
|
|
14
|
-
const t = b(null), n = _(() => t.value ? t.value.map((o) => e.preprocesor ? e.preprocesor(o) : o[e.displayKey ?? ""]) : null),
|
|
15
|
-
return { props: e, options: t, renderOptions: n, selectedItem:
|
|
12
|
+
const e = Fe();
|
|
13
|
+
_e(["update:modelValue"]);
|
|
14
|
+
const t = b(null), n = _(() => t.value ? t.value.map((o) => e.preprocesor ? e.preprocesor(o) : o[e.displayKey ?? ""]) : null), s = b(e.modelValue ?? null);
|
|
15
|
+
return { props: e, options: t, renderOptions: n, selectedItem: s };
|
|
16
16
|
},
|
|
17
17
|
watch: {
|
|
18
18
|
loadFn() {
|
|
@@ -33,50 +33,50 @@ const nt = C({
|
|
|
33
33
|
this.options = await this.props.loadFn();
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
}),
|
|
36
|
+
}), Ce = (e, t) => {
|
|
37
37
|
const n = e.__vccOpts || e;
|
|
38
|
-
for (const [
|
|
39
|
-
n[
|
|
38
|
+
for (const [s, i] of t)
|
|
39
|
+
n[s] = i;
|
|
40
40
|
return n;
|
|
41
|
-
},
|
|
41
|
+
}, nt = {
|
|
42
42
|
key: 0,
|
|
43
43
|
disabled: ""
|
|
44
44
|
}, st = {
|
|
45
45
|
key: 0,
|
|
46
46
|
value: null
|
|
47
|
-
},
|
|
48
|
-
function
|
|
47
|
+
}, it = ["value"];
|
|
48
|
+
function ot(e, t, n, s, i, o) {
|
|
49
49
|
return e.renderOptions ? j((d(), h("select", {
|
|
50
50
|
key: 1,
|
|
51
51
|
"onUpdate:modelValue": t[0] || (t[0] = (r) => e.selectedItem = r)
|
|
52
52
|
}, [
|
|
53
53
|
e.props.nullText ? (d(), h("option", st, x(e.props.nullText), 1)) : O("", !0),
|
|
54
|
-
(d(!0), h(
|
|
54
|
+
(d(!0), h(W, null, J(e.renderOptions, (r, l) => {
|
|
55
55
|
var a;
|
|
56
56
|
return d(), h("option", {
|
|
57
57
|
key: l,
|
|
58
58
|
value: (a = e.options) == null ? void 0 : a[l]
|
|
59
|
-
}, x(r), 9,
|
|
59
|
+
}, x(r), 9, it);
|
|
60
60
|
}), 128))
|
|
61
61
|
], 512)), [
|
|
62
|
-
[
|
|
63
|
-
]) : (d(), h("select",
|
|
62
|
+
[Re, e.selectedItem]
|
|
63
|
+
]) : (d(), h("select", nt, [
|
|
64
64
|
w("option", null, x(e.props.loadingText || "Loading..."), 1)
|
|
65
65
|
]));
|
|
66
66
|
}
|
|
67
|
-
const Mn = /* @__PURE__ */
|
|
67
|
+
const Mn = /* @__PURE__ */ Ce(tt, [["render", ot]]), lt = /* @__PURE__ */ C({
|
|
68
68
|
__name: "overlay-anchor",
|
|
69
69
|
props: {
|
|
70
70
|
overlayId: {},
|
|
71
71
|
anchor: {}
|
|
72
72
|
},
|
|
73
73
|
setup(e) {
|
|
74
|
-
const t = e, n = t.anchor instanceof HTMLElement ? t.anchor : t.anchor.el,
|
|
74
|
+
const t = e, n = t.anchor instanceof HTMLElement ? t.anchor : t.anchor.el, s = b({ visibility: "hidden", top: "0", left: "0" }), i = b([]), o = ee();
|
|
75
75
|
L(r);
|
|
76
76
|
function r() {
|
|
77
77
|
if (!o) return;
|
|
78
78
|
const p = o.vnode.el, { styles: g, classes: m } = l(p, n);
|
|
79
|
-
|
|
79
|
+
s.value = g, i.value = m;
|
|
80
80
|
}
|
|
81
81
|
function l(p, g) {
|
|
82
82
|
const m = t.anchor instanceof HTMLElement ? {} : t.anchor, v = g.getBoundingClientRect(), f = p.getBoundingClientRect();
|
|
@@ -106,34 +106,34 @@ const Mn = /* @__PURE__ */ xe(nt, [["render", lt]]), rt = /* @__PURE__ */ C({
|
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
108
|
function a() {
|
|
109
|
-
window.removeEventListener("click", a),
|
|
109
|
+
window.removeEventListener("click", a), ct(t.overlayId);
|
|
110
110
|
}
|
|
111
111
|
return L(() => {
|
|
112
112
|
setTimeout(() => {
|
|
113
113
|
window.addEventListener("click", a);
|
|
114
114
|
}, 10);
|
|
115
115
|
}), (p, g) => (d(), h("div", {
|
|
116
|
-
class: k(["vf-overlay-anchor",
|
|
117
|
-
style:
|
|
116
|
+
class: k(["vf-overlay-anchor", i.value]),
|
|
117
|
+
style: Ne(s.value),
|
|
118
118
|
onClick: te(a, ["stop"])
|
|
119
119
|
}, [
|
|
120
120
|
K(p.$slots, "default")
|
|
121
121
|
], 6));
|
|
122
122
|
}
|
|
123
123
|
});
|
|
124
|
-
let
|
|
125
|
-
const S =
|
|
124
|
+
let rt = 0;
|
|
125
|
+
const S = Ke([]), In = C({
|
|
126
126
|
setup() {
|
|
127
|
-
return () =>
|
|
128
|
-
J(S, (e) =>
|
|
127
|
+
return () => U("div", [
|
|
128
|
+
J(S, (e) => U(je, { key: e.id, to: "#vf-overlay-target" }, [e.wrapperVnode ?? e.vnode]))
|
|
129
129
|
]);
|
|
130
130
|
}
|
|
131
131
|
});
|
|
132
|
-
function
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
const
|
|
136
|
-
id:
|
|
132
|
+
function se(e, t, n) {
|
|
133
|
+
const s = document.getElementById("vf-overlay-target") ?? document.createElement("div");
|
|
134
|
+
s.id = "vf-overlay-target", s.removeAttribute("inert"), document.body.appendChild(s);
|
|
135
|
+
const i = String(++rt), o = We(e), r = U(o, t), l = n != null && n.anchor ? U(lt, { overlayId: i, anchor: n.anchor }, () => [r]) : void 0, a = {
|
|
136
|
+
id: i,
|
|
137
137
|
component: o,
|
|
138
138
|
props: t,
|
|
139
139
|
options: n ?? {},
|
|
@@ -143,18 +143,18 @@ function ie(e, t, n) {
|
|
|
143
143
|
return S.push(a), a;
|
|
144
144
|
}
|
|
145
145
|
function Hn(e) {
|
|
146
|
-
e.$ &&
|
|
146
|
+
e.$ && xe(e.$);
|
|
147
147
|
}
|
|
148
|
-
function
|
|
148
|
+
function xe(e) {
|
|
149
149
|
let t = e;
|
|
150
|
-
for (; t && !
|
|
150
|
+
for (; t && !at(t.vnode); )
|
|
151
151
|
t = t.parent;
|
|
152
152
|
}
|
|
153
|
-
function
|
|
153
|
+
function at(e) {
|
|
154
154
|
const t = S.findIndex((n) => n.vnode.component === e.component);
|
|
155
155
|
return t >= 0 ? (S[t].props.callback(), !0) : !1;
|
|
156
156
|
}
|
|
157
|
-
function
|
|
157
|
+
function ct(e) {
|
|
158
158
|
const t = S.findIndex((n) => n.id === e);
|
|
159
159
|
return t >= 0 ? (S[t].props.callback(), !0) : !1;
|
|
160
160
|
}
|
|
@@ -162,48 +162,53 @@ function P(e) {
|
|
|
162
162
|
const t = S.indexOf(e);
|
|
163
163
|
t >= 0 && S.splice(t, 1);
|
|
164
164
|
}
|
|
165
|
-
async function
|
|
166
|
-
return new Promise((
|
|
167
|
-
let
|
|
165
|
+
async function ie(e, t, n) {
|
|
166
|
+
return new Promise((s) => {
|
|
167
|
+
let i = null;
|
|
168
168
|
const r = { ...t, callback: async (l) => {
|
|
169
169
|
if (n != null && n.onCallback) {
|
|
170
170
|
const a = n.onCallback(l);
|
|
171
171
|
if (typeof a == "object" && "then" in a && typeof a.then == "function" && await a === !1)
|
|
172
172
|
return;
|
|
173
173
|
}
|
|
174
|
-
P(
|
|
174
|
+
P(i), s(l);
|
|
175
175
|
} };
|
|
176
|
-
|
|
176
|
+
i = se(e, r, n);
|
|
177
177
|
});
|
|
178
178
|
}
|
|
179
179
|
function q(e, t) {
|
|
180
|
-
return
|
|
180
|
+
return typeof e == "object" && !(e instanceof Error) ? {
|
|
181
|
+
...e,
|
|
182
|
+
classes: e.classes ?? []
|
|
183
|
+
} : { title: t ? e : void 0, message: t ?? e, classes: [] };
|
|
181
184
|
}
|
|
182
|
-
async function
|
|
183
|
-
await
|
|
185
|
+
async function dt(e, t) {
|
|
186
|
+
await ie(X, q(e, t));
|
|
184
187
|
}
|
|
185
188
|
async function Dn(e, t) {
|
|
186
|
-
|
|
187
|
-
|
|
189
|
+
const n = q(e, t);
|
|
190
|
+
return await ie(X, {
|
|
191
|
+
...n,
|
|
188
192
|
shouldConfirm: !0
|
|
189
193
|
}) === !0;
|
|
190
194
|
}
|
|
191
195
|
async function An(e, t) {
|
|
192
|
-
|
|
193
|
-
|
|
196
|
+
const n = q(e, t);
|
|
197
|
+
return await ie(X, {
|
|
198
|
+
...n,
|
|
194
199
|
shouldConfirm: !0,
|
|
195
|
-
classes: ["destructive"]
|
|
200
|
+
classes: ["destructive", ...n.classes]
|
|
196
201
|
}) === !0;
|
|
197
202
|
}
|
|
198
203
|
function $n(e, t) {
|
|
199
|
-
const n =
|
|
200
|
-
...
|
|
204
|
+
const n = q(e, t), s = se(X, {
|
|
205
|
+
...n,
|
|
201
206
|
isBare: !0,
|
|
202
|
-
classes: ["wait"],
|
|
207
|
+
classes: ["wait", ...n.classes],
|
|
203
208
|
callback: () => {
|
|
204
209
|
}
|
|
205
210
|
});
|
|
206
|
-
return () => P(
|
|
211
|
+
return () => P(s);
|
|
207
212
|
}
|
|
208
213
|
const M = {
|
|
209
214
|
unhandledErrorSupportText: "please contact support",
|
|
@@ -231,7 +236,11 @@ function oe(e) {
|
|
|
231
236
|
}
|
|
232
237
|
async function Vn(e, t) {
|
|
233
238
|
const n = oe(e);
|
|
234
|
-
return n instanceof z || M.errorHandler(n),
|
|
239
|
+
return n instanceof z || M.errorHandler(n), dt({
|
|
240
|
+
title: t == null ? void 0 : t.title,
|
|
241
|
+
message: n,
|
|
242
|
+
classes: t == null ? void 0 : t.classes
|
|
243
|
+
});
|
|
235
244
|
}
|
|
236
245
|
async function Fn(e) {
|
|
237
246
|
const t = oe(e);
|
|
@@ -239,48 +248,48 @@ async function Fn(e) {
|
|
|
239
248
|
}
|
|
240
249
|
const B = Symbol("MaskState");
|
|
241
250
|
function _n(e, t) {
|
|
242
|
-
var
|
|
243
|
-
const n = (
|
|
244
|
-
return ht(
|
|
251
|
+
var i;
|
|
252
|
+
const n = (i = e.$) == null ? void 0 : i.vnode.el, s = n.closest(".vf-modal");
|
|
253
|
+
return ht(s ?? n, t);
|
|
245
254
|
}
|
|
246
255
|
function Rn(e) {
|
|
247
|
-
var
|
|
248
|
-
const t = (
|
|
249
|
-
return
|
|
256
|
+
var s;
|
|
257
|
+
const t = (s = e.$) == null ? void 0 : s.vnode.el, n = t.closest(".vf-modal");
|
|
258
|
+
return Le(n ?? t);
|
|
250
259
|
}
|
|
251
260
|
function ht(e, t) {
|
|
252
261
|
if (!e[B]) {
|
|
253
262
|
const n = document.createElement("div");
|
|
254
263
|
n.classList.add("vf-mask"), e.appendChild(n), e[B] = { maskEl: n };
|
|
255
264
|
}
|
|
256
|
-
return e[B].maskEl.innerText = t ?? "", () =>
|
|
265
|
+
return e[B].maskEl.innerText = t ?? "", () => Le(e);
|
|
257
266
|
}
|
|
258
|
-
function
|
|
267
|
+
function Le(e) {
|
|
259
268
|
e[B] && e.removeChild(e[B].maskEl);
|
|
260
269
|
}
|
|
261
270
|
const Q = Symbol("FormMaskState");
|
|
262
271
|
function ft(e, t, n) {
|
|
263
|
-
const
|
|
264
|
-
if (!
|
|
272
|
+
const s = e instanceof Element ? e : Ie(e);
|
|
273
|
+
if (!s) return () => {
|
|
265
274
|
};
|
|
266
|
-
|
|
267
|
-
const
|
|
275
|
+
s.classList.add("vf-masked");
|
|
276
|
+
const i = t instanceof Element ? t : s.querySelectorAll(t ?? 'button:not([disabled]):not([type="button"])')[0];
|
|
268
277
|
let o;
|
|
269
|
-
|
|
270
|
-
const l = [...
|
|
271
|
-
return l.forEach((a) => a.setAttribute("disabled", "disabled")),
|
|
278
|
+
i && (o = i.tagName === "INPUT" ? i.value : i.innerHTML, i.setAttribute("disabled", "disabled"), i.innerText = n ?? "Please wait...");
|
|
279
|
+
const l = [...s.querySelectorAll("input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled])")];
|
|
280
|
+
return l.forEach((a) => a.setAttribute("disabled", "disabled")), s[Q] = {
|
|
272
281
|
disabledElements: l,
|
|
273
|
-
waitButton:
|
|
282
|
+
waitButton: i,
|
|
274
283
|
buttonHtml: o
|
|
275
|
-
}, () =>
|
|
284
|
+
}, () => Me(s);
|
|
276
285
|
}
|
|
277
|
-
function
|
|
278
|
-
const t = e instanceof Element ? e :
|
|
286
|
+
function Me(e) {
|
|
287
|
+
const t = e instanceof Element ? e : Ie(e);
|
|
279
288
|
if (!t) return;
|
|
280
289
|
const n = t[Q];
|
|
281
|
-
n && (t.classList.remove("vf-masked"), n.disabledElements.forEach((
|
|
290
|
+
n && (t.classList.remove("vf-masked"), n.disabledElements.forEach((s) => s.removeAttribute("disabled")), n.waitButton && (n.waitButton.innerHTML = n.buttonHtml, n.waitButton.removeAttribute("disabled")), delete t[Q]);
|
|
282
291
|
}
|
|
283
|
-
function
|
|
292
|
+
function Ie(e) {
|
|
284
293
|
var n;
|
|
285
294
|
const t = (n = e == null ? void 0 : e.$) == null ? void 0 : n.vnode.el;
|
|
286
295
|
return t ? t.tagName === "FORM" ? t : t.querySelector("form") : null;
|
|
@@ -302,32 +311,32 @@ const pt = ["id"], mt = {
|
|
|
302
311
|
},
|
|
303
312
|
emits: ["formSubmit"],
|
|
304
313
|
setup(e, { expose: t }) {
|
|
305
|
-
const n = ee(),
|
|
314
|
+
const n = ee(), s = e;
|
|
306
315
|
t({ mask: m, unmask: v, hide: f, unhide: u });
|
|
307
|
-
const
|
|
316
|
+
const i = b(), o = b(), r = b(!1), l = _(() => qe([s.class, r.value && "hidden"]));
|
|
308
317
|
L(() => {
|
|
309
318
|
var c;
|
|
310
|
-
document.body.classList.add("vf-modal-open"),
|
|
319
|
+
document.body.classList.add("vf-modal-open"), s.closeOnMaskClick && (window.addEventListener("keydown", p), (c = i.value) == null || c.addEventListener("click", a));
|
|
311
320
|
}), ne(() => {
|
|
312
321
|
window.removeEventListener("keydown", p), document.body.querySelectorAll(".vf-modal").length > 0 || document.body.classList.remove("vf-modal-open");
|
|
313
322
|
});
|
|
314
323
|
function a(c) {
|
|
315
|
-
c.target ==
|
|
324
|
+
c.target == i.value && g();
|
|
316
325
|
}
|
|
317
326
|
function p(c) {
|
|
318
327
|
if (c.key === "Esc" || c.key === "Escape") {
|
|
319
328
|
const T = document.querySelectorAll(".vf-modal-wrap");
|
|
320
|
-
T[T.length - 1] ===
|
|
329
|
+
T[T.length - 1] === i.value && g();
|
|
321
330
|
}
|
|
322
331
|
}
|
|
323
332
|
function g() {
|
|
324
|
-
|
|
333
|
+
xe(n);
|
|
325
334
|
}
|
|
326
335
|
function m() {
|
|
327
336
|
return ft(o.value), () => v();
|
|
328
337
|
}
|
|
329
338
|
function v() {
|
|
330
|
-
|
|
339
|
+
Me(o.value);
|
|
331
340
|
}
|
|
332
341
|
function f() {
|
|
333
342
|
return r.value = !0, () => u();
|
|
@@ -339,7 +348,7 @@ const pt = ["id"], mt = {
|
|
|
339
348
|
id: c.id,
|
|
340
349
|
class: k(["vf-overlay vf-modal-wrap", l.value]),
|
|
341
350
|
ref_key: "overlay",
|
|
342
|
-
ref:
|
|
351
|
+
ref: i
|
|
343
352
|
}, [
|
|
344
353
|
w("form", {
|
|
345
354
|
action: ".",
|
|
@@ -350,7 +359,7 @@ const pt = ["id"], mt = {
|
|
|
350
359
|
}, [
|
|
351
360
|
c.$slots.header ? (d(), h("div", mt, [
|
|
352
361
|
K(c.$slots, "header"),
|
|
353
|
-
|
|
362
|
+
s.closeX ? (d(), h("i", {
|
|
354
363
|
key: 0,
|
|
355
364
|
class: "close",
|
|
356
365
|
onClick: g
|
|
@@ -378,15 +387,15 @@ const pt = ["id"], mt = {
|
|
|
378
387
|
},
|
|
379
388
|
setup(e) {
|
|
380
389
|
const t = e, n = _(() => t.message instanceof Error ? ut(t.message) : t.message);
|
|
381
|
-
return (
|
|
382
|
-
const o =
|
|
383
|
-
return d(),
|
|
384
|
-
class: k(["vf-alert",
|
|
385
|
-
},
|
|
390
|
+
return (s, i) => {
|
|
391
|
+
const o = we("autofocus");
|
|
392
|
+
return d(), be(gt, {
|
|
393
|
+
class: k(["vf-alert", s.classes])
|
|
394
|
+
}, Ue({
|
|
386
395
|
default: Y(() => [
|
|
387
|
-
|
|
396
|
+
s.isHtml ? (d(), h("div", {
|
|
388
397
|
key: 0,
|
|
389
|
-
innerHtml:
|
|
398
|
+
innerHtml: s.message,
|
|
390
399
|
class: "user-message"
|
|
391
400
|
}, null, 8, Et)) : (d(), h("div", {
|
|
392
401
|
key: 1,
|
|
@@ -395,20 +404,20 @@ const pt = ["id"], mt = {
|
|
|
395
404
|
]),
|
|
396
405
|
_: 2
|
|
397
406
|
}, [
|
|
398
|
-
|
|
407
|
+
s.title ? {
|
|
399
408
|
name: "header",
|
|
400
409
|
fn: Y(() => [
|
|
401
|
-
w("h1", null, x(
|
|
410
|
+
w("h1", null, x(s.title), 1)
|
|
402
411
|
]),
|
|
403
412
|
key: "0"
|
|
404
413
|
} : void 0,
|
|
405
|
-
|
|
414
|
+
s.isBare ? void 0 : {
|
|
406
415
|
name: "footer",
|
|
407
416
|
fn: Y(() => [
|
|
408
|
-
|
|
417
|
+
s.shouldConfirm ? (d(), h(W, { key: 0 }, [
|
|
409
418
|
j((d(), h("button", {
|
|
410
419
|
class: "primary",
|
|
411
|
-
onClick:
|
|
420
|
+
onClick: i[0] || (i[0] = () => s.callback(!0))
|
|
412
421
|
}, [
|
|
413
422
|
ae("Confirm")
|
|
414
423
|
])), [
|
|
@@ -416,12 +425,12 @@ const pt = ["id"], mt = {
|
|
|
416
425
|
]),
|
|
417
426
|
w("button", {
|
|
418
427
|
class: "default",
|
|
419
|
-
onClick:
|
|
428
|
+
onClick: i[1] || (i[1] = () => s.callback(!1))
|
|
420
429
|
}, "Cancel")
|
|
421
430
|
], 64)) : j((d(), h("button", {
|
|
422
431
|
key: 1,
|
|
423
432
|
class: "default",
|
|
424
|
-
onClick:
|
|
433
|
+
onClick: i[2] || (i[2] = () => s.callback(!0))
|
|
425
434
|
}, [
|
|
426
435
|
ae("OK")
|
|
427
436
|
])), [
|
|
@@ -447,15 +456,15 @@ for (let e = 0; e < 256; ++e)
|
|
|
447
456
|
function Ot(e, t = 0) {
|
|
448
457
|
return y[e[t + 0]] + y[e[t + 1]] + y[e[t + 2]] + y[e[t + 3]] + "-" + y[e[t + 4]] + y[e[t + 5]] + "-" + y[e[t + 6]] + y[e[t + 7]] + "-" + y[e[t + 8]] + y[e[t + 9]] + "-" + y[e[t + 10]] + y[e[t + 11]] + y[e[t + 12]] + y[e[t + 13]] + y[e[t + 14]] + y[e[t + 15]];
|
|
449
458
|
}
|
|
450
|
-
const kt = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto),
|
|
459
|
+
const kt = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), de = {
|
|
451
460
|
randomUUID: kt
|
|
452
461
|
};
|
|
453
462
|
function St(e, t, n) {
|
|
454
|
-
if (
|
|
455
|
-
return
|
|
463
|
+
if (de.randomUUID && !t && !e)
|
|
464
|
+
return de.randomUUID();
|
|
456
465
|
e = e || {};
|
|
457
|
-
const
|
|
458
|
-
return
|
|
466
|
+
const s = e.random || (e.rng || bt)();
|
|
467
|
+
return s[6] = s[6] & 15 | 64, s[8] = s[8] & 63 | 128, Ot(s);
|
|
459
468
|
}
|
|
460
469
|
function Nn(e) {
|
|
461
470
|
return e.replace(/\n/g, "<br>");
|
|
@@ -473,7 +482,7 @@ function Lt(e, t = 1) {
|
|
|
473
482
|
function Kn() {
|
|
474
483
|
return St();
|
|
475
484
|
}
|
|
476
|
-
const D = Symbol("null"),
|
|
485
|
+
const D = Symbol("null"), ue = Symbol("create"), Mt = "`1234567890-=[]\\;',./~!@#$%^&*()_+{}|:\"<>?qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM", It = {
|
|
477
486
|
props: {
|
|
478
487
|
modelValue: {
|
|
479
488
|
type: null,
|
|
@@ -551,14 +560,14 @@ const D = Symbol("null"), he = Symbol("create"), Mt = "`1234567890-=[]\\;',./~!@
|
|
|
551
560
|
optionsDescriptors() {
|
|
552
561
|
return this.allOptions.map((e, t) => {
|
|
553
562
|
var l, a;
|
|
554
|
-
const n = this.formatter(e),
|
|
563
|
+
const n = this.formatter(e), s = (l = this.subtitleFormatter) == null ? void 0 : l.call(this, e), i = n ? n.trim().toLowerCase() : "", o = s ? s.trim().toLowerCase() : "", r = [];
|
|
555
564
|
return this.searchFields ? this.searchFields.forEach((p) => {
|
|
556
565
|
e[p] && r.push(String(e[p]).toLowerCase());
|
|
557
|
-
}) : (r.push(
|
|
566
|
+
}) : (r.push(i), o && r.push(o)), {
|
|
558
567
|
// eslint-disable-next-line vue/no-use-computed-property-like-method
|
|
559
568
|
key: ((a = this.effectiveKeyExtractor) == null ? void 0 : a.call(this, e)) ?? String(t),
|
|
560
569
|
title: n,
|
|
561
|
-
subtitle:
|
|
570
|
+
subtitle: s,
|
|
562
571
|
searchContent: r.join(""),
|
|
563
572
|
ref: e
|
|
564
573
|
};
|
|
@@ -569,17 +578,17 @@ const D = Symbol("null"), he = Symbol("create"), Mt = "`1234567890-=[]\\;',./~!@
|
|
|
569
578
|
if (this.isSearching) {
|
|
570
579
|
const t = this.searchText.trim().toLowerCase();
|
|
571
580
|
if (t.length) {
|
|
572
|
-
e = e.filter((
|
|
573
|
-
const n =
|
|
574
|
-
e = e.map((
|
|
581
|
+
e = e.filter((i) => i.searchContent.includes(t));
|
|
582
|
+
const n = Qe(this.searchText).replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&"), s = new RegExp(`(${n})`, "ig");
|
|
583
|
+
e = e.map((i) => {
|
|
575
584
|
var o;
|
|
576
585
|
return {
|
|
577
|
-
...
|
|
578
|
-
title:
|
|
579
|
-
subtitle: (o =
|
|
586
|
+
...i,
|
|
587
|
+
title: i.title.replace(s, "<mark>$1</mark>"),
|
|
588
|
+
subtitle: (o = i.subtitle) == null ? void 0 : o.replace(s, "<mark>$1</mark>")
|
|
580
589
|
};
|
|
581
590
|
}), this.shouldShowCreateOption && (e.find((o) => o.searchContent === t) !== void 0 || e.push({
|
|
582
|
-
key:
|
|
591
|
+
key: ue,
|
|
583
592
|
title: "Create <strong>" + this.searchText.trim() + "</strong>..."
|
|
584
593
|
}));
|
|
585
594
|
}
|
|
@@ -619,7 +628,7 @@ const D = Symbol("null"), he = Symbol("create"), Mt = "`1234567890-=[]\\;',./~!@
|
|
|
619
628
|
"update:modelValue",
|
|
620
629
|
this.selectedOption && this.valueExtractor ? this.valueExtractor(this.selectedOption) : this.selectedOption
|
|
621
630
|
);
|
|
622
|
-
}), this.remoteSearch && this.$watch("searchText",
|
|
631
|
+
}), this.remoteSearch && this.$watch("searchText", ze(this.reloadOptionsIfSearching, 250));
|
|
623
632
|
},
|
|
624
633
|
methods: {
|
|
625
634
|
async loadRemoteOptions() {
|
|
@@ -673,11 +682,11 @@ const D = Symbol("null"), he = Symbol("create"), Mt = "`1234567890-=[]\\;',./~!@
|
|
|
673
682
|
return this.effectiveKeyExtractor ? this.effectiveKeyExtractor(this.selectedOption) : ((t = this.getOptionDescriptor(e)) == null ? void 0 : t.key) ?? "";
|
|
674
683
|
},
|
|
675
684
|
getOptionDescriptor(e) {
|
|
676
|
-
const t = this.effectiveOptions.find((
|
|
685
|
+
const t = this.effectiveOptions.find((i) => i.ref === e);
|
|
677
686
|
if (t)
|
|
678
687
|
return t;
|
|
679
|
-
const n = this.keyExtractor ? (
|
|
680
|
-
return
|
|
688
|
+
const n = this.keyExtractor ? (i, o) => this.keyExtractor(i) === this.keyExtractor(o) : Se, s = this.effectiveOptions.find((i) => n(i.ref, e));
|
|
689
|
+
return s || null;
|
|
681
690
|
},
|
|
682
691
|
handleInputBlurred() {
|
|
683
692
|
this.debug || (!this.searchText.length && this.nullTitle && (this.selectedOption = null, this.selectedOptionTitle = null), this.shouldDisplayOptions = !1);
|
|
@@ -686,18 +695,18 @@ const D = Symbol("null"), he = Symbol("create"), Mt = "`1234567890-=[]\\;',./~!@
|
|
|
686
695
|
this.isLoaded || this.loadRemoteOptions(), this.optionsListId && this.$refs.optionsContainer.setAttribute("id", this.optionsListId), this.teleportOptionsContainer();
|
|
687
696
|
},
|
|
688
697
|
teleportOptionsContainer() {
|
|
689
|
-
const e = this.$el.getBoundingClientRect(), t = e.y + e.height + 2, n = e.x,
|
|
690
|
-
for (let o in
|
|
691
|
-
/^(font|text)/.test(o) && (
|
|
692
|
-
if (
|
|
698
|
+
const e = this.$el.getBoundingClientRect(), t = e.y + e.height + 2, n = e.x, s = this.$refs.optionsContainer, i = window.getComputedStyle(this.$el);
|
|
699
|
+
for (let o in i)
|
|
700
|
+
/^(font|text)/.test(o) && (s.style[o] = i[o]);
|
|
701
|
+
if (s.style.top = t + "px", s.style.left = n + "px", s.style.minWidth = e.width + "px", !i.maxHeight || i.maxHeight == "none") {
|
|
693
702
|
const o = window.innerHeight - t - 12;
|
|
694
|
-
|
|
703
|
+
s.style.maxHeight = o + "px";
|
|
695
704
|
}
|
|
696
|
-
|
|
705
|
+
s.style.visibility = "visible", document.body.appendChild(s), setTimeout(this.highlightInitialOption, 0);
|
|
697
706
|
},
|
|
698
707
|
highlightInitialOption() {
|
|
699
708
|
if (!this.isLoaded || !this.highlightedOptionKey) return;
|
|
700
|
-
const e = this.effectiveOptions.findIndex((
|
|
709
|
+
const e = this.effectiveOptions.findIndex((s) => s.key == this.highlightedOptionKey), t = this.$refs.optionsContainer, n = t.querySelectorAll(".option")[e];
|
|
701
710
|
t.scrollTop = n.offsetTop;
|
|
702
711
|
},
|
|
703
712
|
handleOptionHover(e) {
|
|
@@ -708,19 +717,19 @@ const D = Symbol("null"), he = Symbol("create"), Mt = "`1234567890-=[]\\;',./~!@
|
|
|
708
717
|
let n = t + e;
|
|
709
718
|
if (n < 0 ? n = 0 : n >= this.effectiveOptions.length && (n = this.effectiveOptions.length - 1), t == n) return;
|
|
710
719
|
this.highlightedOptionKey = this.effectiveOptions[n].key;
|
|
711
|
-
const
|
|
712
|
-
|
|
720
|
+
const s = this.$refs.optionsContainer, i = s.querySelectorAll(".option")[n];
|
|
721
|
+
i.offsetTop < s.scrollTop ? s.scrollTop = i.offsetTop : i.offsetTop + i.offsetHeight > s.scrollTop + s.clientHeight && (s.scrollTop = i.offsetTop + i.offsetHeight - s.clientHeight);
|
|
713
722
|
},
|
|
714
723
|
selectOption(e) {
|
|
715
724
|
var t;
|
|
716
725
|
if (this.isSearching = !1, e.key == D)
|
|
717
726
|
this.searchText = "", this.selectedOption = null, this.selectedOptionTitle = null;
|
|
718
|
-
else if (e.key ===
|
|
727
|
+
else if (e.key === ue) {
|
|
719
728
|
const n = this.searchText.trim();
|
|
720
729
|
this.searchText = "", this.selectedOption = null, this.selectedOptionTitle = null, (t = this.onCreateItem) == null || t.call(this, n);
|
|
721
730
|
} else {
|
|
722
|
-
const
|
|
723
|
-
this.selectedOption =
|
|
731
|
+
const s = this.optionsDescriptors.find((i) => i.key == e.key).ref;
|
|
732
|
+
this.selectedOption = s, this.selectedOptionTitle = this.formatter(s), this.searchText = this.selectedOptionTitle || "";
|
|
724
733
|
}
|
|
725
734
|
this.$refs.searchField.blur();
|
|
726
735
|
},
|
|
@@ -742,8 +751,8 @@ const D = Symbol("null"), he = Symbol("create"), Mt = "`1234567890-=[]\\;',./~!@
|
|
|
742
751
|
key: 0,
|
|
743
752
|
class: "no-results"
|
|
744
753
|
};
|
|
745
|
-
function _t(e, t, n,
|
|
746
|
-
const r =
|
|
754
|
+
function _t(e, t, n, s, i, o) {
|
|
755
|
+
const r = we("disabled");
|
|
747
756
|
return d(), h("div", {
|
|
748
757
|
class: k(["vf-smart-select", { disabled: o.effectiveDisabled, open: e.shouldDisplayOptions }])
|
|
749
758
|
}, [
|
|
@@ -759,12 +768,12 @@ function _t(e, t, n, i, s, o) {
|
|
|
759
768
|
required: n.required,
|
|
760
769
|
"data-1p-ignore": ""
|
|
761
770
|
}, null, 42, Ht), [
|
|
762
|
-
[
|
|
771
|
+
[Pe, e.searchText],
|
|
763
772
|
[r, o.effectiveDisabled]
|
|
764
773
|
]),
|
|
765
774
|
e.shouldDisplayOptions ? (d(), h("div", Dt, [
|
|
766
|
-
e.isLoaded ? (d(), h(
|
|
767
|
-
(d(!0), h(
|
|
775
|
+
e.isLoaded ? (d(), h(W, { key: 1 }, [
|
|
776
|
+
(d(!0), h(W, null, J(o.effectiveOptions, (l) => (d(), h("div", {
|
|
768
777
|
key: String(l.key),
|
|
769
778
|
class: k(["option", {
|
|
770
779
|
highlighted: e.highlightedOptionKey === l.key
|
|
@@ -787,7 +796,7 @@ function _t(e, t, n, i, s, o) {
|
|
|
787
796
|
], 512)) : O("", !0)
|
|
788
797
|
], 2);
|
|
789
798
|
}
|
|
790
|
-
const Rt = /* @__PURE__ */
|
|
799
|
+
const Rt = /* @__PURE__ */ Ce(It, [["render", _t]]), jn = /* @__PURE__ */ C({
|
|
791
800
|
__name: "ez-smart-select",
|
|
792
801
|
props: {
|
|
793
802
|
modelValue: {},
|
|
@@ -798,36 +807,36 @@ const Rt = /* @__PURE__ */ xe(It, [["render", _t]]), jn = /* @__PURE__ */ C({
|
|
|
798
807
|
},
|
|
799
808
|
emits: ["update:modelValue"],
|
|
800
809
|
setup(e, { emit: t }) {
|
|
801
|
-
const n = e,
|
|
810
|
+
const n = e, s = _(() => Array.isArray(n.options) ? n.options.map((l) => ({ value: l, label: l })) : Object.entries(n.options).map(([l, a]) => ({
|
|
802
811
|
value: l,
|
|
803
812
|
label: a
|
|
804
|
-
}))),
|
|
813
|
+
}))), i = _(() => n.formatter ? (l) => {
|
|
805
814
|
var a;
|
|
806
815
|
return (a = n.formatter) == null ? void 0 : a.call(n, l.label);
|
|
807
|
-
} : (l) => l.label), o = t, r = b(
|
|
816
|
+
} : (l) => l.label), o = t, r = b(s.value.find((l) => l.value === n.modelValue) ?? null);
|
|
808
817
|
return ce(
|
|
809
818
|
() => n.modelValue,
|
|
810
819
|
(l) => {
|
|
811
|
-
r.value =
|
|
820
|
+
r.value = s.value.find((a) => a.value === l) ?? null;
|
|
812
821
|
}
|
|
813
822
|
), ce(r, (l) => {
|
|
814
823
|
var a;
|
|
815
|
-
o("update:modelValue", l ? ((a =
|
|
816
|
-
}), (l, a) => (d(),
|
|
824
|
+
o("update:modelValue", l ? ((a = s.value.find((p) => Se(p, l))) == null ? void 0 : a.value) ?? null : null);
|
|
825
|
+
}), (l, a) => (d(), be(Rt, {
|
|
817
826
|
modelValue: r.value,
|
|
818
827
|
"onUpdate:modelValue": a[0] || (a[0] = (p) => r.value = p),
|
|
819
|
-
options:
|
|
820
|
-
formatter:
|
|
828
|
+
options: s.value,
|
|
829
|
+
formatter: i.value,
|
|
821
830
|
"null-title": l.nullTitle
|
|
822
831
|
}, null, 8, ["modelValue", "options", "formatter", "null-title"]));
|
|
823
832
|
}
|
|
824
833
|
}), Nt = { class: "content" }, Kt = { class: "message" }, jt = {
|
|
825
834
|
key: 0,
|
|
826
835
|
class: "close"
|
|
827
|
-
},
|
|
836
|
+
}, Wt = {
|
|
828
837
|
key: 0,
|
|
829
838
|
class: "progress-bar"
|
|
830
|
-
},
|
|
839
|
+
}, Ut = /* @__PURE__ */ C({
|
|
831
840
|
__name: "toast",
|
|
832
841
|
props: {
|
|
833
842
|
message: {},
|
|
@@ -842,42 +851,42 @@ const Rt = /* @__PURE__ */ xe(It, [["render", _t]]), jn = /* @__PURE__ */ C({
|
|
|
842
851
|
function n() {
|
|
843
852
|
t.onClick ? t.onClick() : t.disableClose || t.callback();
|
|
844
853
|
}
|
|
845
|
-
const
|
|
854
|
+
const s = b();
|
|
846
855
|
return t.durationSecs !== null && L(() => {
|
|
847
856
|
var o;
|
|
848
|
-
const
|
|
849
|
-
(o =
|
|
850
|
-
duration:
|
|
857
|
+
const i = t.durationSecs ?? 5;
|
|
858
|
+
(o = s.value) == null || o.animate([{ width: "0%" }, { width: "100%" }], {
|
|
859
|
+
duration: i * 1e3,
|
|
851
860
|
easing: "linear"
|
|
852
|
-
}), setTimeout(() => t.callback(),
|
|
853
|
-
}), (
|
|
854
|
-
class: k(["vf-toast",
|
|
861
|
+
}), setTimeout(() => t.callback(), i * 1e3);
|
|
862
|
+
}), (i, o) => (d(), h("div", {
|
|
863
|
+
class: k(["vf-toast", i.className]),
|
|
855
864
|
onClick: te(n, ["stop"])
|
|
856
865
|
}, [
|
|
857
866
|
w("div", Nt, [
|
|
858
|
-
w("div", Kt, x(
|
|
859
|
-
|
|
867
|
+
w("div", Kt, x(i.message), 1),
|
|
868
|
+
i.disableClose ? O("", !0) : (d(), h("div", jt, "x"))
|
|
860
869
|
]),
|
|
861
|
-
|
|
870
|
+
i.durationSecs !== null ? (d(), h("div", Wt, [
|
|
862
871
|
w("div", {
|
|
863
872
|
ref_key: "progressInnerEl",
|
|
864
|
-
ref:
|
|
873
|
+
ref: s,
|
|
865
874
|
class: "inner"
|
|
866
875
|
}, null, 512)
|
|
867
876
|
])) : O("", !0)
|
|
868
877
|
], 2));
|
|
869
878
|
}
|
|
870
879
|
});
|
|
871
|
-
function
|
|
872
|
-
const t =
|
|
880
|
+
function Wn(e) {
|
|
881
|
+
const t = se(Ut, {
|
|
873
882
|
...e,
|
|
874
883
|
callback: () => P(t)
|
|
875
884
|
});
|
|
876
885
|
return () => P(t);
|
|
877
886
|
}
|
|
878
887
|
function Pt(e) {
|
|
879
|
-
const t = Math.floor(Math.log(e) / Math.log(1024)),
|
|
880
|
-
return `${
|
|
888
|
+
const t = Math.floor(Math.log(e) / Math.log(1024)), s = (e / Math.pow(1024, t)).toFixed(2), i = ["B", "KB", "MB", "GB", "TB"][t];
|
|
889
|
+
return `${s} ${i}`;
|
|
881
890
|
}
|
|
882
891
|
function qt(e) {
|
|
883
892
|
return e != null && String(e).length ? e : "-";
|
|
@@ -892,10 +901,10 @@ function Yt(e) {
|
|
|
892
901
|
return e && xt(e);
|
|
893
902
|
}
|
|
894
903
|
function Zt(e) {
|
|
895
|
-
return e ?
|
|
904
|
+
return e ? Xe(e) : null;
|
|
896
905
|
}
|
|
897
906
|
function Gt(e) {
|
|
898
|
-
return e ?
|
|
907
|
+
return e ? Ye(e) : null;
|
|
899
908
|
}
|
|
900
909
|
function Qt(e) {
|
|
901
910
|
return e ? e.toUpperCase() : null;
|
|
@@ -906,7 +915,7 @@ function Jt(e) {
|
|
|
906
915
|
function en(e, t = 1) {
|
|
907
916
|
return Lt(e, t);
|
|
908
917
|
}
|
|
909
|
-
const
|
|
918
|
+
const he = {
|
|
910
919
|
bytes: Pt,
|
|
911
920
|
dash: qt,
|
|
912
921
|
dashZeros: zt,
|
|
@@ -917,35 +926,35 @@ const fe = {
|
|
|
917
926
|
upperCase: Qt,
|
|
918
927
|
desnake: Jt,
|
|
919
928
|
usCurrency: en
|
|
920
|
-
},
|
|
921
|
-
...
|
|
922
|
-
...e(
|
|
929
|
+
}, Un = (e) => ({
|
|
930
|
+
...he,
|
|
931
|
+
...e(he)
|
|
923
932
|
});
|
|
924
933
|
function Pn(e, t, n) {
|
|
925
|
-
const
|
|
926
|
-
return
|
|
934
|
+
const s = typeof t == "function" ? e.findIndex(t) : e.indexOf(t);
|
|
935
|
+
return s === -1 ? !1 : (e.splice(s, 1, n), !0);
|
|
927
936
|
}
|
|
928
937
|
function qn(e, t) {
|
|
929
938
|
const n = document.createElement("div");
|
|
930
939
|
n.classList.add("vf-overlay"), n.addEventListener("click", m), document.body.appendChild(n);
|
|
931
|
-
const
|
|
932
|
-
|
|
933
|
-
const
|
|
934
|
-
|
|
940
|
+
const s = document.createElement("div");
|
|
941
|
+
s.classList.add("vf-context-menu"), s.style.position = "absolute", n.appendChild(s);
|
|
942
|
+
const i = e.currentTarget;
|
|
943
|
+
i.style.userSelect = "none", i.classList.add("context-menu-active"), t.targetClass && i.classList.add(t.targetClass), t.class && s.classList.add(t.class), t.items.forEach((f) => {
|
|
935
944
|
if (f == "-") {
|
|
936
945
|
const c = document.createElement("div");
|
|
937
|
-
c.classList.add("separator"),
|
|
946
|
+
c.classList.add("separator"), s.appendChild(c);
|
|
938
947
|
return;
|
|
939
948
|
}
|
|
940
949
|
const u = document.createElement("div");
|
|
941
|
-
u.classList.add("item"), u.style.userSelect = "none", u.innerText = f.title,
|
|
950
|
+
u.classList.add("item"), u.style.userSelect = "none", u.innerText = f.title, s.appendChild(u), f.class && u.classList.add(f.class), f.shouldConfirm ? u.addEventListener("click", (c) => v(c, u, f.handler)) : u.addEventListener("click", () => f.handler());
|
|
942
951
|
});
|
|
943
|
-
const o = window.innerWidth - e.clientX, r = window.innerHeight - e.clientY, l =
|
|
944
|
-
|
|
945
|
-
|
|
952
|
+
const o = window.innerWidth - e.clientX, r = window.innerHeight - e.clientY, l = s.offsetHeight, a = s.offsetWidth, p = o < a ? e.clientX - a - 1 : e.clientX + 1, g = r < l ? e.clientY - l - 1 : e.clientY + 1;
|
|
953
|
+
s.style.left = p + "px", s.style.top = g + "px", setTimeout(() => {
|
|
954
|
+
s.style.width = s.offsetWidth + "px";
|
|
946
955
|
}, 50);
|
|
947
956
|
function m() {
|
|
948
|
-
t.targetClass &&
|
|
957
|
+
t.targetClass && i.classList.remove(t.targetClass), i.classList.remove("context-menu-active"), i.style.userSelect = "", n.remove();
|
|
949
958
|
}
|
|
950
959
|
function v(f, u, c) {
|
|
951
960
|
if (u.classList.contains("pending-confirm"))
|
|
@@ -963,54 +972,54 @@ function nn(e) {
|
|
|
963
972
|
return e.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
964
973
|
}
|
|
965
974
|
function Xn(e, t) {
|
|
966
|
-
return e != null ?
|
|
975
|
+
return e != null ? Ze(e) : t;
|
|
967
976
|
}
|
|
968
977
|
function Yn(e, t) {
|
|
969
978
|
const n = { ...e };
|
|
970
|
-
for (const
|
|
971
|
-
n[
|
|
979
|
+
for (const s of t)
|
|
980
|
+
n[s] === "" && (n[s] = null);
|
|
972
981
|
return n;
|
|
973
982
|
}
|
|
974
983
|
function Zn(e) {
|
|
975
|
-
|
|
984
|
+
Je({
|
|
976
985
|
...e,
|
|
977
986
|
onError(t, n) {
|
|
978
|
-
var
|
|
979
|
-
|
|
980
|
-
const
|
|
981
|
-
return
|
|
987
|
+
var i;
|
|
988
|
+
et(t) && t.status === 422 && typeof t.body == "object" && "error" in t.body && (t = new z(t.body.error));
|
|
989
|
+
const s = (i = e.onError) == null ? void 0 : i.call(e, t, n);
|
|
990
|
+
return s !== void 0 ? s : t;
|
|
982
991
|
}
|
|
983
992
|
});
|
|
984
993
|
}
|
|
985
994
|
const le = Symbol("HookState");
|
|
986
995
|
function Gn(e, t) {
|
|
987
996
|
const n = t ?? ee();
|
|
988
|
-
L(() => sn(n, e), n),
|
|
997
|
+
L(() => sn(n, e), n), Oe(() => on(n), n), ke(() => fe(n), n), ne(() => fe(n), n);
|
|
989
998
|
}
|
|
990
999
|
function sn(e, t) {
|
|
991
1000
|
const n = {};
|
|
992
1001
|
if (t.elScrolledToBottom && (n.el = new V(e.vnode.el, t.elScrolledToBottom)), t.ancestorScrolledToBottom) {
|
|
993
|
-
const
|
|
994
|
-
|
|
1002
|
+
const s = He(e.vnode.el);
|
|
1003
|
+
s ? n.ancestor = new V(s, t.ancestorScrolledToBottom) : console.warn("[VueFoundation] No scollable ancestor found for component:", e);
|
|
995
1004
|
}
|
|
996
1005
|
t.windowScrolledToBottom && (n.window = new V(window, t.windowScrolledToBottom)), e[le] = n;
|
|
997
1006
|
}
|
|
998
1007
|
function on(e) {
|
|
999
|
-
var n,
|
|
1008
|
+
var n, s, i;
|
|
1000
1009
|
const t = e[le];
|
|
1001
|
-
(n = t == null ? void 0 : t.el) == null || n.install(), (
|
|
1010
|
+
(n = t == null ? void 0 : t.el) == null || n.install(), (s = t == null ? void 0 : t.ancestor) == null || s.install(), (i = t == null ? void 0 : t.window) == null || i.install();
|
|
1002
1011
|
}
|
|
1003
|
-
function
|
|
1004
|
-
var n,
|
|
1012
|
+
function fe(e) {
|
|
1013
|
+
var n, s, i;
|
|
1005
1014
|
const t = e[le];
|
|
1006
|
-
(n = t == null ? void 0 : t.el) == null || n.uninstall(), (
|
|
1015
|
+
(n = t == null ? void 0 : t.el) == null || n.uninstall(), (s = t == null ? void 0 : t.ancestor) == null || s.uninstall(), (i = t == null ? void 0 : t.window) == null || i.uninstall();
|
|
1007
1016
|
}
|
|
1008
1017
|
const Z = ["auto", "scroll"];
|
|
1009
|
-
function
|
|
1018
|
+
function He(e) {
|
|
1010
1019
|
const t = e.parentElement;
|
|
1011
1020
|
if (!t) return null;
|
|
1012
1021
|
const n = window.getComputedStyle(t);
|
|
1013
|
-
return Z.includes(n.overflow) || Z.includes(n.overflowX) || Z.includes(n.overflowY) ? t :
|
|
1022
|
+
return Z.includes(n.overflow) || Z.includes(n.overflowX) || Z.includes(n.overflowY) ? t : He(t);
|
|
1014
1023
|
}
|
|
1015
1024
|
class V {
|
|
1016
1025
|
constructor(t, n) {
|
|
@@ -1029,15 +1038,15 @@ class V {
|
|
|
1029
1038
|
}
|
|
1030
1039
|
}
|
|
1031
1040
|
function Qn(e) {
|
|
1032
|
-
L(() => window.addEventListener("resize", e)),
|
|
1041
|
+
L(() => window.addEventListener("resize", e)), Oe(() => window.addEventListener("resize", e)), ke(() => window.removeEventListener("resize", e)), ne(() => window.removeEventListener("resize", e));
|
|
1033
1042
|
}
|
|
1034
1043
|
const ln = {
|
|
1035
|
-
mounted:
|
|
1036
|
-
updated:
|
|
1037
|
-
},
|
|
1038
|
-
function
|
|
1039
|
-
if (t.value === void 0 && e[
|
|
1040
|
-
e[
|
|
1044
|
+
mounted: me,
|
|
1045
|
+
updated: me
|
|
1046
|
+
}, pe = Symbol("HasAutoFocused");
|
|
1047
|
+
function me(e, t) {
|
|
1048
|
+
if (t.value === void 0 && e[pe] || t.value !== void 0 && !t.value || t.oldValue !== void 0 && t.value == t.oldValue) return;
|
|
1049
|
+
e[pe] = !0;
|
|
1041
1050
|
const n = ["BUTTON", "INPUT", "TEXTAREA", "SELECT"].indexOf(e.tagName) > -1 ? e : e.querySelectorAll("input")[0];
|
|
1042
1051
|
setTimeout(() => n.focus(), 10);
|
|
1043
1052
|
}
|
|
@@ -1047,23 +1056,23 @@ const rn = {
|
|
|
1047
1056
|
function an(e, t) {
|
|
1048
1057
|
e.addEventListener("click", (n) => {
|
|
1049
1058
|
var r, l;
|
|
1050
|
-
const
|
|
1059
|
+
const s = Date.now(), i = ((r = t.value) == null ? void 0 : r.text) !== void 0 ? t.value.text : "Confirm";
|
|
1051
1060
|
if (e[A]) {
|
|
1052
|
-
if (
|
|
1061
|
+
if (s - e[A].initTime < 300)
|
|
1053
1062
|
return;
|
|
1054
1063
|
e[A].resetHandler(), e.dispatchEvent(new Event("confirm"));
|
|
1055
1064
|
return;
|
|
1056
1065
|
}
|
|
1057
1066
|
n.preventDefault(), n.stopImmediatePropagation();
|
|
1058
1067
|
const o = {
|
|
1059
|
-
initTime:
|
|
1068
|
+
initTime: s,
|
|
1060
1069
|
preconfirmHtml: e.innerHTML,
|
|
1061
1070
|
resetHandler: () => {
|
|
1062
1071
|
var a;
|
|
1063
|
-
|
|
1072
|
+
i && (e.innerHTML = o.preconfirmHtml), (a = t.value) != null && a.class && e.classList.remove(t.value.class), e.blur(), e.removeEventListener("mouseout", o.resetHandler), delete e[A];
|
|
1064
1073
|
}
|
|
1065
1074
|
};
|
|
1066
|
-
e[A] = o,
|
|
1075
|
+
e[A] = o, i && (e.innerHTML = i), (l = t.value) != null && l.class && e.classList.add(t.value.class), e.addEventListener("mouseout", o.resetHandler);
|
|
1067
1076
|
});
|
|
1068
1077
|
}
|
|
1069
1078
|
const cn = {
|
|
@@ -1078,10 +1087,10 @@ function dn(e) {
|
|
|
1078
1087
|
});
|
|
1079
1088
|
}
|
|
1080
1089
|
const un = {
|
|
1081
|
-
beforeMount:
|
|
1082
|
-
updated:
|
|
1090
|
+
beforeMount: ve,
|
|
1091
|
+
updated: ve
|
|
1083
1092
|
};
|
|
1084
|
-
function
|
|
1093
|
+
function ve(e, t) {
|
|
1085
1094
|
t.value == t.oldValue && e.innerHTML.length || (e.innerText = hn(e, t));
|
|
1086
1095
|
}
|
|
1087
1096
|
function hn(e, t) {
|
|
@@ -1089,7 +1098,7 @@ function hn(e, t) {
|
|
|
1089
1098
|
if (!t.value)
|
|
1090
1099
|
return ((a = e.attributes.getNamedItem("placeholder")) == null ? void 0 : a.value) ?? "";
|
|
1091
1100
|
let n = "";
|
|
1092
|
-
const
|
|
1101
|
+
const s = t.value.replace(/ /g, "T").replace(/\.\d+Z$/, "Z"), i = e.attributes.getNamedItem("local") !== null ? s.replace(/Z$/, "") : s.replace(/(Z|\+00:00)?$/, "Z"), o = new Date(i);
|
|
1093
1102
|
e.attributes.getNamedItem("display-utc") !== null && o.setMinutes(o.getMinutes() - o.getTimezoneOffset());
|
|
1094
1103
|
let r = (p = e.attributes.getNamedItem("format")) == null ? void 0 : p.value;
|
|
1095
1104
|
if (!r && e.attributes.getNamedItem("relative-date") !== null) {
|
|
@@ -1101,49 +1110,49 @@ function hn(e, t) {
|
|
|
1101
1110
|
return n && (l = n + " " + l), l;
|
|
1102
1111
|
}
|
|
1103
1112
|
const fn = {
|
|
1104
|
-
beforeMount:
|
|
1105
|
-
updated:
|
|
1113
|
+
beforeMount: ye,
|
|
1114
|
+
updated: ye,
|
|
1106
1115
|
unmounted: pn
|
|
1107
1116
|
};
|
|
1108
|
-
function
|
|
1117
|
+
function ye(e, t) {
|
|
1109
1118
|
e.tagName === "LABEL" && (t.value ? e.classList.remove("disabled") : e.classList.add("disabled"), e = e.querySelector("input")), t.value ? e.setAttribute("disabled", "disabled") : e.removeAttribute("disabled");
|
|
1110
1119
|
}
|
|
1111
1120
|
function pn(e) {
|
|
1112
1121
|
e.tagName === "LABEL" && (e.classList.remove("disabled"), e = e.querySelector("input")), e.removeAttribute("disabled");
|
|
1113
1122
|
}
|
|
1114
1123
|
const mn = {
|
|
1115
|
-
beforeMount:
|
|
1116
|
-
updated:
|
|
1117
|
-
unmounted:
|
|
1124
|
+
beforeMount: ge,
|
|
1125
|
+
updated: ge,
|
|
1126
|
+
unmounted: Ae
|
|
1118
1127
|
}, R = Symbol("HasAutoFocused"), re = [];
|
|
1119
1128
|
function vn() {
|
|
1120
|
-
re.forEach(
|
|
1129
|
+
re.forEach(De);
|
|
1121
1130
|
}
|
|
1122
1131
|
setInterval(vn, 1e3);
|
|
1123
|
-
function
|
|
1132
|
+
function ge(e, t) {
|
|
1124
1133
|
var r;
|
|
1125
1134
|
if (t.value == t.oldValue) return;
|
|
1126
|
-
if (!t.value) return
|
|
1127
|
-
const n = new Date(t.value),
|
|
1135
|
+
if (!t.value) return Ae(e);
|
|
1136
|
+
const n = new Date(t.value), s = (r = e.attributes.getNamedItem("base-time")) == null ? void 0 : r.value, i = n.getTime() - (s ? new Date(s).getTime() - t.value * 1e3 : 0), o = e.getAttribute("no-seconds") === null;
|
|
1128
1137
|
e[R] || re.push(e), e[R] = {
|
|
1129
|
-
startTs:
|
|
1138
|
+
startTs: i,
|
|
1130
1139
|
includeSeconds: o
|
|
1131
|
-
},
|
|
1140
|
+
}, De(e);
|
|
1132
1141
|
}
|
|
1133
|
-
function
|
|
1142
|
+
function De(e) {
|
|
1134
1143
|
const t = e[R], n = Math.round((Date.now() - t.startTs) / 1e3);
|
|
1135
1144
|
e.innerText = yn(n, t.includeSeconds);
|
|
1136
1145
|
}
|
|
1137
|
-
function
|
|
1138
|
-
e[R] && (
|
|
1146
|
+
function Ae(e) {
|
|
1147
|
+
e[R] && (Ge(re, e), delete e[R]), e.innerText = "-";
|
|
1139
1148
|
}
|
|
1140
1149
|
function yn(e, t) {
|
|
1141
|
-
const n = [],
|
|
1142
|
-
|
|
1143
|
-
const
|
|
1144
|
-
(
|
|
1150
|
+
const n = [], s = Math.floor(e / 86400);
|
|
1151
|
+
s && n.push(s + "d"), e -= s * 86400;
|
|
1152
|
+
const i = Math.floor(e / 3600);
|
|
1153
|
+
(s || i) && n.push(i + "h"), e -= i * 3600;
|
|
1145
1154
|
const o = Math.floor(e / 60);
|
|
1146
|
-
return (
|
|
1155
|
+
return (s || i || o) && n.push(o + "m"), t ? n.length || n.push("0m") : (e -= o * 60, n.push(e + "s")), n.join(" ");
|
|
1147
1156
|
}
|
|
1148
1157
|
const $ = Symbol("InfiniteScrollHandler"), gn = {
|
|
1149
1158
|
mounted(e, t) {
|
|
@@ -1158,30 +1167,30 @@ const $ = Symbol("InfiniteScrollHandler"), gn = {
|
|
|
1158
1167
|
(t = e[$]) == null || t.uninstall(), delete e[$];
|
|
1159
1168
|
}
|
|
1160
1169
|
}, En = {
|
|
1161
|
-
beforeMount:
|
|
1162
|
-
updated:
|
|
1170
|
+
beforeMount: Ee,
|
|
1171
|
+
updated: Ee
|
|
1163
1172
|
};
|
|
1164
|
-
function
|
|
1173
|
+
function Ee(e, t) {
|
|
1165
1174
|
e.tagName == "LABEL" && (e = e.querySelector("input")), t.value ? e.setAttribute("readonly", "readonly") : e.removeAttribute("readonly");
|
|
1166
1175
|
}
|
|
1167
1176
|
const Tn = {
|
|
1168
|
-
mounted:
|
|
1169
|
-
updated:
|
|
1170
|
-
unmounted:
|
|
1177
|
+
mounted: Te,
|
|
1178
|
+
updated: Te,
|
|
1179
|
+
unmounted: $e
|
|
1171
1180
|
}, F = Symbol("TooltipState");
|
|
1172
|
-
function
|
|
1173
|
-
var
|
|
1174
|
-
let n = ((
|
|
1181
|
+
function Te(e, t) {
|
|
1182
|
+
var s;
|
|
1183
|
+
let n = ((s = e.attributes.getNamedItem("tip")) == null ? void 0 : s.value) ?? t.value;
|
|
1175
1184
|
if (t.value || (n = null), n) {
|
|
1176
|
-
const
|
|
1185
|
+
const i = {
|
|
1177
1186
|
content: n,
|
|
1178
1187
|
html: e.getAttribute("html") !== null
|
|
1179
1188
|
};
|
|
1180
|
-
e[F] ? e[F].configure(
|
|
1189
|
+
e[F] ? e[F].configure(i) : e[F] = new wn(e, i);
|
|
1181
1190
|
} else
|
|
1182
|
-
|
|
1191
|
+
$e(e);
|
|
1183
1192
|
}
|
|
1184
|
-
function
|
|
1193
|
+
function $e(e) {
|
|
1185
1194
|
var t;
|
|
1186
1195
|
(t = e[F]) == null || t.destroy(), delete e[F];
|
|
1187
1196
|
}
|
|
@@ -1197,7 +1206,7 @@ class wn {
|
|
|
1197
1206
|
E(this, "handleMouseMoveWithContext", this.handleMouseMove.bind(this));
|
|
1198
1207
|
E(this, "handleTargetMouseEnterWithContext", this.handleTargetMouseEnter.bind(this));
|
|
1199
1208
|
E(this, "handleTargetMouseLeaveWithContext", this.handleTargetMouseLeave.bind(this));
|
|
1200
|
-
this.el = t, this.config = n, t.addEventListener("mouseenter", this.handleTargetMouseEnterWithContext), t.addEventListener("mouseleave", this.handleTargetMouseLeaveWithContext);
|
|
1209
|
+
this.el = t, this.config = n, t.addEventListener("mouseenter", this.handleTargetMouseEnterWithContext), t.addEventListener("mouseleave", this.handleTargetMouseLeaveWithContext), t.addEventListener("click", this.handleTargetMouseLeaveWithContext);
|
|
1201
1210
|
}
|
|
1202
1211
|
configure(t) {
|
|
1203
1212
|
this.config = t;
|
|
@@ -1221,16 +1230,16 @@ class wn {
|
|
|
1221
1230
|
this.shouldShow || this.tipEl && (this.tipEl.remove(), this.tipEl = void 0, this.titleEl = void 0, this.contentEl = void 0, this.checkInterval && (clearInterval(this.checkInterval), this.checkInterval = void 0), window.removeEventListener("mousemove", this.handleMouseMoveWithContext), this.mouseMoveBound = !1);
|
|
1222
1231
|
}
|
|
1223
1232
|
handleMouseMove(t) {
|
|
1224
|
-
const n = this.tipEl.offsetWidth,
|
|
1233
|
+
const n = this.tipEl.offsetWidth, s = this.tipEl.offsetHeight, i = window.innerWidth, o = window.innerHeight;
|
|
1225
1234
|
let r = t.pageX + 10, l = t.pageY + 20;
|
|
1226
|
-
r + n >
|
|
1235
|
+
r + n > i && (r = t.pageX - 5 - n), l + s > o && (l = t.pageY - 5 - s), this.tipEl.style.left = r + "px", this.tipEl.style.top = l + "px", this.lastMoveEvt = t;
|
|
1227
1236
|
}
|
|
1228
1237
|
checkMoveEvent() {
|
|
1229
1238
|
var t;
|
|
1230
1239
|
this.lastMoveEvt && this.tipEl !== this.lastMoveEvt.target && ((t = this.tipEl) != null && t.contains(this.lastMoveEvt.target) || this.handleTargetMouseLeave());
|
|
1231
1240
|
}
|
|
1232
1241
|
destroy() {
|
|
1233
|
-
this.shouldShow = !1, this.removeTooltip(), this.el.removeEventListener("mouseenter", this.handleTargetMouseEnterWithContext), this.el.removeEventListener("mouseleave", this.handleTargetMouseLeaveWithContext);
|
|
1242
|
+
this.shouldShow = !1, this.removeTooltip(), this.el.removeEventListener("mouseenter", this.handleTargetMouseEnterWithContext), this.el.removeEventListener("mouseleave", this.handleTargetMouseLeaveWithContext), this.el.removeEventListener("click", this.handleTargetMouseLeaveWithContext);
|
|
1234
1243
|
}
|
|
1235
1244
|
}
|
|
1236
1245
|
function bn(e) {
|
|
@@ -1249,14 +1258,14 @@ export {
|
|
|
1249
1258
|
Rt as VfSmartSelect,
|
|
1250
1259
|
Xn as cloneProp,
|
|
1251
1260
|
Bn as configureVf,
|
|
1252
|
-
|
|
1253
|
-
|
|
1261
|
+
Un as createFilters,
|
|
1262
|
+
se as createOverlayInjection,
|
|
1254
1263
|
Ct as desnakeCase,
|
|
1255
|
-
|
|
1264
|
+
ct as dismissOverlayInjectionById,
|
|
1256
1265
|
Hn as dismissOverlayInjectionByInstance,
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1266
|
+
xe as dismissOverlayInjectionByInternalInstance,
|
|
1267
|
+
at as dismissOverlayInjectionByVnode,
|
|
1268
|
+
ns as escapeHtml,
|
|
1260
1269
|
ut as formatError,
|
|
1261
1270
|
nn as formatNumber,
|
|
1262
1271
|
xt as formatPhone,
|
|
@@ -1270,21 +1279,21 @@ export {
|
|
|
1270
1279
|
ft as maskForm,
|
|
1271
1280
|
Nn as nl2br,
|
|
1272
1281
|
Yn as nullifyEmptyInputs,
|
|
1273
|
-
|
|
1282
|
+
ie as presentOverlay,
|
|
1274
1283
|
P as removeOverlayInjection,
|
|
1275
1284
|
Pn as replaceElement,
|
|
1276
|
-
|
|
1285
|
+
dt as showAlert,
|
|
1277
1286
|
Dn as showConfirm,
|
|
1278
1287
|
An as showConfirmDestroy,
|
|
1279
1288
|
qn as showContextMenu,
|
|
1280
|
-
|
|
1289
|
+
Wn as showToast,
|
|
1281
1290
|
$n as showWait,
|
|
1282
1291
|
tn as sleep,
|
|
1283
1292
|
zn as sleepSecs,
|
|
1284
1293
|
oe as toError,
|
|
1285
1294
|
Rn as unmaskComponent,
|
|
1286
|
-
|
|
1287
|
-
|
|
1295
|
+
Le as unmaskEl,
|
|
1296
|
+
Me as unmaskForm,
|
|
1288
1297
|
Gn as useInfiniteScroll,
|
|
1289
1298
|
Qn as useResizeWatcher,
|
|
1290
1299
|
Kn as uuid
|
package/package.json
CHANGED
|
@@ -1,23 +1,37 @@
|
|
|
1
1
|
import AlertModal from './alert-modal.vue';
|
|
2
2
|
import { createOverlayInjection, presentOverlay, removeOverlayInjection } from './overlay-container';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
interface IAlertOptions {
|
|
5
|
+
title?: string;
|
|
6
|
+
message: string | Error;
|
|
7
|
+
classes?: string[];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function resolveAlertParams(arg0: string | Error | IAlertOptions, arg1?: string | Error) {
|
|
11
|
+
if (typeof arg0 === 'object' && !(arg0 instanceof Error)) {
|
|
12
|
+
return {
|
|
13
|
+
...arg0,
|
|
14
|
+
classes: arg0.classes ?? []
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
const title = arg1 ? (arg0 as string) : undefined;
|
|
18
|
+
return { title, message: arg1 ?? arg0, classes: [] };
|
|
8
19
|
}
|
|
9
20
|
|
|
10
21
|
export async function showAlert(title: string, message: string | Error): Promise<void>;
|
|
11
22
|
export async function showAlert(message: string | Error): Promise<void>;
|
|
12
|
-
export async function showAlert(
|
|
13
|
-
|
|
23
|
+
export async function showAlert(options: IAlertOptions): Promise<void>;
|
|
24
|
+
export async function showAlert(arg0: string | Error | IAlertOptions, arg1?: string | Error): Promise<void> {
|
|
25
|
+
await presentOverlay(AlertModal, resolveAlertParams(arg0, arg1));
|
|
14
26
|
}
|
|
15
27
|
|
|
16
28
|
export async function showConfirm(title: string, message: string): Promise<boolean>;
|
|
17
29
|
export async function showConfirm(message: string): Promise<boolean>;
|
|
18
|
-
export async function showConfirm(
|
|
30
|
+
export async function showConfirm(options: IAlertOptions): Promise<boolean>;
|
|
31
|
+
export async function showConfirm(arg0: string | IAlertOptions, arg1?: string): Promise<boolean> {
|
|
32
|
+
const params = resolveAlertParams(arg0, arg1);
|
|
19
33
|
const result = await presentOverlay(AlertModal, {
|
|
20
|
-
...
|
|
34
|
+
...params,
|
|
21
35
|
shouldConfirm: true
|
|
22
36
|
});
|
|
23
37
|
return result === true;
|
|
@@ -25,22 +39,26 @@ export async function showConfirm(titleOrMessage: string, message?: string): Pro
|
|
|
25
39
|
|
|
26
40
|
export async function showConfirmDestroy(title: string, message: string): Promise<boolean>;
|
|
27
41
|
export async function showConfirmDestroy(message: string): Promise<boolean>;
|
|
28
|
-
export async function showConfirmDestroy(
|
|
42
|
+
export async function showConfirmDestroy(options: IAlertOptions): Promise<boolean>;
|
|
43
|
+
export async function showConfirmDestroy(arg0: string | IAlertOptions, arg1?: string): Promise<boolean> {
|
|
44
|
+
const params = resolveAlertParams(arg0, arg1);
|
|
29
45
|
const result = await presentOverlay(AlertModal, {
|
|
30
|
-
...
|
|
46
|
+
...params,
|
|
31
47
|
shouldConfirm: true,
|
|
32
|
-
classes: ['destructive']
|
|
48
|
+
classes: ['destructive', ...params.classes]
|
|
33
49
|
});
|
|
34
50
|
return result === true;
|
|
35
51
|
}
|
|
36
52
|
|
|
37
53
|
export function showWait(title: string, message: string): () => void;
|
|
38
54
|
export function showWait(message: string): () => void;
|
|
39
|
-
export function showWait(
|
|
55
|
+
export function showWait(options: IAlertOptions): () => void;
|
|
56
|
+
export function showWait(arg0: string | IAlertOptions, arg1?: string): () => void {
|
|
57
|
+
const params = resolveAlertParams(arg0, arg1);
|
|
40
58
|
const injection = createOverlayInjection(AlertModal, {
|
|
41
|
-
...
|
|
59
|
+
...params,
|
|
42
60
|
isBare: true,
|
|
43
|
-
classes: ['wait'],
|
|
61
|
+
classes: ['wait', ...params.classes],
|
|
44
62
|
callback: () => {}
|
|
45
63
|
});
|
|
46
64
|
return () => removeOverlayInjection(injection);
|
|
@@ -47,6 +47,8 @@ interface ITooltipOptions {
|
|
|
47
47
|
class?: string | string[];
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
// todo: improve with mutation observer to see removal of node
|
|
51
|
+
|
|
50
52
|
class VfTooltip {
|
|
51
53
|
private lastMoveEvt?: MouseEvent;
|
|
52
54
|
private checkInterval?: ReturnType<typeof setInterval>;
|
|
@@ -66,6 +68,7 @@ class VfTooltip {
|
|
|
66
68
|
) {
|
|
67
69
|
el.addEventListener('mouseenter', this.handleTargetMouseEnterWithContext);
|
|
68
70
|
el.addEventListener('mouseleave', this.handleTargetMouseLeaveWithContext);
|
|
71
|
+
el.addEventListener('click', this.handleTargetMouseLeaveWithContext);
|
|
69
72
|
}
|
|
70
73
|
|
|
71
74
|
configure(config: ITooltipOptions) {
|
|
@@ -189,5 +192,6 @@ class VfTooltip {
|
|
|
189
192
|
|
|
190
193
|
this.el.removeEventListener('mouseenter', this.handleTargetMouseEnterWithContext);
|
|
191
194
|
this.el.removeEventListener('mouseleave', this.handleTargetMouseLeaveWithContext);
|
|
195
|
+
this.el.removeEventListener('click', this.handleTargetMouseLeaveWithContext);
|
|
192
196
|
}
|
|
193
197
|
}
|
package/src/helpers/error.ts
CHANGED
|
@@ -21,14 +21,22 @@ export function toError(err: any) {
|
|
|
21
21
|
return err instanceof Error ? err : new Error(String(err));
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
interface IErrorAlertOptions {
|
|
25
|
+
title?: string;
|
|
26
|
+
classes?: string[];
|
|
27
|
+
}
|
|
28
|
+
export async function handleErrorAndAlert(errIn: any, options?: IErrorAlertOptions) {
|
|
25
29
|
const err = toError(errIn);
|
|
26
30
|
|
|
27
31
|
if (!(err instanceof UserError)) {
|
|
28
32
|
VfOptions.errorHandler(err);
|
|
29
33
|
}
|
|
30
34
|
|
|
31
|
-
return
|
|
35
|
+
return showAlert({
|
|
36
|
+
title: options?.title,
|
|
37
|
+
message: err,
|
|
38
|
+
classes: options?.classes
|
|
39
|
+
});
|
|
32
40
|
}
|
|
33
41
|
|
|
34
42
|
export async function handleError(errIn: any) {
|