@signal24/vue-foundation 4.30.1 → 4.30.3
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/src/components/modal-helpers.d.ts +6 -0
- package/dist/src/components/vf-modal.vue.d.ts +1 -0
- package/dist/src/helpers/error.d.ts +6 -2
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/vue-foundation.es.js +58 -56
- package/package.json +1 -1
- package/src/components/vf-modal.vue +6 -1
- package/src/helpers/error.ts +15 -6
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as q, ref as N, computed as O, watch as H, onMounted as z, createElementBlock as I, withDirectives as fe, openBlock as T, createElementVNode as U, toDisplayString as J, createCommentVNode as W, Fragment as he, renderList as pe, vModelSelect as Ht, getCurrentInstance as
|
|
2
|
-
import { compact as ut, cloneDeep as qt, uniq as Jt, groupBy as Kt, isEqual as
|
|
1
|
+
import { defineComponent as q, ref as N, computed as O, watch as H, onMounted as z, createElementBlock as I, withDirectives as fe, openBlock as T, createElementVNode as U, toDisplayString as J, createCommentVNode as W, Fragment as he, renderList as pe, vModelSelect as Ht, getCurrentInstance as Ne, withModifiers as Le, normalizeStyle as Vt, normalizeClass as P, renderSlot as K, reactive as Bt, h as ve, Teleport as _t, markRaw as Wt, onBeforeUnmount as me, resolveDirective as Pt, createBlock as at, createSlots as jt, withCtx as Se, createTextVNode as te, onUpdated as Ut, vModelText as zt, onActivated as st, onDeactivated as lt } from "vue";
|
|
2
|
+
import { compact as ut, cloneDeep as qt, uniq as Jt, groupBy as Kt, isEqual as Ce, debounce as Yt, startCase as Xt, upperFirst as Zt, remove as Gt, last as Qt } from "lodash";
|
|
3
3
|
import { configureOpenApiClient as en, OpenApiError as tn } from "@signal24/openapi-client-codegen";
|
|
4
4
|
import { escapeHtml as br } from "@vue/shared";
|
|
5
5
|
import { format as X, addDays as nn, parse as on } from "date-fns";
|
|
@@ -64,7 +64,7 @@ const ln = /* @__PURE__ */ q({
|
|
|
64
64
|
anchor: {}
|
|
65
65
|
},
|
|
66
66
|
setup(e) {
|
|
67
|
-
const t = e, o = t.anchor instanceof HTMLElement ? t.anchor : t.anchor.el, a = N({ visibility: "hidden", top: "0", left: "0" }), p = N([]), l =
|
|
67
|
+
const t = e, o = t.anchor instanceof HTMLElement ? t.anchor : t.anchor.el, a = N({ visibility: "hidden", top: "0", left: "0" }), p = N([]), l = Ne();
|
|
68
68
|
z(y);
|
|
69
69
|
function y() {
|
|
70
70
|
if (!l) return;
|
|
@@ -108,7 +108,7 @@ const ln = /* @__PURE__ */ q({
|
|
|
108
108
|
}), (v, c) => (T(), I("div", {
|
|
109
109
|
class: P(["vf-overlay-anchor", p.value]),
|
|
110
110
|
style: Vt(a.value),
|
|
111
|
-
onClick:
|
|
111
|
+
onClick: Le(E, ["stop"])
|
|
112
112
|
}, [
|
|
113
113
|
K(v.$slots, "default")
|
|
114
114
|
], 6));
|
|
@@ -159,7 +159,7 @@ function ie(e) {
|
|
|
159
159
|
const t = j.indexOf(e);
|
|
160
160
|
t >= 0 && j.splice(t, 1);
|
|
161
161
|
}
|
|
162
|
-
async function
|
|
162
|
+
async function Re(e, t, o) {
|
|
163
163
|
return new Promise((a) => {
|
|
164
164
|
let p = null;
|
|
165
165
|
const y = { ...t, callback: async (g) => {
|
|
@@ -185,18 +185,18 @@ function se(e, t) {
|
|
|
185
185
|
} : { title: t ? e : void 0, message: t ?? e, classes: [] };
|
|
186
186
|
}
|
|
187
187
|
async function hn(e, t) {
|
|
188
|
-
await
|
|
188
|
+
await Re(le, se(e, t));
|
|
189
189
|
}
|
|
190
190
|
async function Go(e, t) {
|
|
191
191
|
const o = se(e, t);
|
|
192
|
-
return await
|
|
192
|
+
return await Re(le, {
|
|
193
193
|
...o,
|
|
194
194
|
shouldConfirm: !0
|
|
195
195
|
}) === !0;
|
|
196
196
|
}
|
|
197
197
|
async function Qo(e, t) {
|
|
198
198
|
const o = se(e, t);
|
|
199
|
-
return await
|
|
199
|
+
return await Re(le, {
|
|
200
200
|
...o,
|
|
201
201
|
shouldConfirm: !0,
|
|
202
202
|
classes: ["destructive", ...o.classes]
|
|
@@ -235,27 +235,28 @@ class ye extends Error {
|
|
|
235
235
|
function pn(e) {
|
|
236
236
|
return e instanceof ye ? e.message : `An application error has occurred:
|
|
237
237
|
|
|
238
|
-
${
|
|
238
|
+
${Ee(e).message}
|
|
239
239
|
|
|
240
240
|
Please refresh the page and try again. If this error persists, ${$.unhandledErrorSupportText}.`;
|
|
241
241
|
}
|
|
242
|
-
function
|
|
243
|
-
|
|
242
|
+
function Ee(e, t) {
|
|
243
|
+
const o = vn(e) ? e : new Error(String(e));
|
|
244
|
+
return t && (o.cause = Ee(t)), o;
|
|
244
245
|
}
|
|
245
246
|
function vn(e) {
|
|
246
247
|
return e instanceof Error || typeof e == "object" && e !== null && "message" in e && "name" in e;
|
|
247
248
|
}
|
|
248
249
|
async function nr(e, t) {
|
|
249
|
-
const o =
|
|
250
|
+
const o = Ee(e, t?.cause);
|
|
250
251
|
return o instanceof ye || $.errorHandler(o), hn({
|
|
251
252
|
title: t?.title,
|
|
252
253
|
message: o,
|
|
253
254
|
classes: t?.classes
|
|
254
255
|
});
|
|
255
256
|
}
|
|
256
|
-
async function or(e) {
|
|
257
|
-
const
|
|
258
|
-
|
|
257
|
+
async function or(e, t) {
|
|
258
|
+
const o = Ee(e, t);
|
|
259
|
+
o instanceof ye || $.errorHandler(o);
|
|
259
260
|
}
|
|
260
261
|
const ne = Symbol("MaskState");
|
|
261
262
|
function rr(e, t) {
|
|
@@ -276,7 +277,7 @@ function mn(e, t) {
|
|
|
276
277
|
function dt(e) {
|
|
277
278
|
e[ne] && e.removeChild(e[ne].maskEl);
|
|
278
279
|
}
|
|
279
|
-
const
|
|
280
|
+
const Oe = Symbol("FormMaskState");
|
|
280
281
|
function gn(e, t, o) {
|
|
281
282
|
const a = e instanceof Element ? e : ht(e);
|
|
282
283
|
if (!a) return () => {
|
|
@@ -286,7 +287,7 @@ function gn(e, t, o) {
|
|
|
286
287
|
let l;
|
|
287
288
|
p && (l = p.tagName === "INPUT" ? p.value : p.innerHTML, p.setAttribute("disabled", "disabled"), p.innerText = o ?? "Please wait...");
|
|
288
289
|
const g = [...a.querySelectorAll("input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled])")];
|
|
289
|
-
return g.forEach((E) => E.setAttribute("disabled", "disabled")), a[
|
|
290
|
+
return g.forEach((E) => E.setAttribute("disabled", "disabled")), a[Oe] = {
|
|
290
291
|
disabledElements: g,
|
|
291
292
|
waitButton: p,
|
|
292
293
|
buttonHtml: l
|
|
@@ -295,8 +296,8 @@ function gn(e, t, o) {
|
|
|
295
296
|
function ft(e) {
|
|
296
297
|
const t = e instanceof Element ? e : ht(e);
|
|
297
298
|
if (!t) return;
|
|
298
|
-
const o = t[
|
|
299
|
-
o && (t.classList.remove("vf-masked"), o.disabledElements.forEach((a) => a.removeAttribute("disabled")), o.waitButton && (o.waitButton.innerHTML = o.buttonHtml, o.waitButton.removeAttribute("disabled")), delete t[
|
|
299
|
+
const o = t[Oe];
|
|
300
|
+
o && (t.classList.remove("vf-masked"), o.disabledElements.forEach((a) => a.removeAttribute("disabled")), o.waitButton && (o.waitButton.innerHTML = o.buttonHtml, o.waitButton.removeAttribute("disabled")), delete t[Oe]);
|
|
300
301
|
}
|
|
301
302
|
function ht(e) {
|
|
302
303
|
const t = e?.$?.vnode.el;
|
|
@@ -315,11 +316,12 @@ const yn = ["id"], En = {
|
|
|
315
316
|
closeOnMaskClick: { type: Boolean },
|
|
316
317
|
scrolls: { type: Boolean },
|
|
317
318
|
closeX: { type: Boolean },
|
|
318
|
-
class: {}
|
|
319
|
+
class: {},
|
|
320
|
+
onClose: { type: Function }
|
|
319
321
|
},
|
|
320
322
|
emits: ["formSubmit"],
|
|
321
323
|
setup(e, { expose: t }) {
|
|
322
|
-
const o =
|
|
324
|
+
const o = Ne(), a = e;
|
|
323
325
|
t({ mask: n, unmask: i, hide: r, unhide: s });
|
|
324
326
|
const p = N(), l = N(), y = N(!1), g = O(() => ut([...Array.isArray(a.class) ? a.class : [a.class], y.value && "hidden"]));
|
|
325
327
|
z(() => {
|
|
@@ -337,7 +339,7 @@ const yn = ["id"], En = {
|
|
|
337
339
|
}
|
|
338
340
|
}
|
|
339
341
|
function c() {
|
|
340
|
-
ct(o);
|
|
342
|
+
a.onClose ? a.onClose() : ct(o);
|
|
341
343
|
}
|
|
342
344
|
function n() {
|
|
343
345
|
return gn(l.value), () => i();
|
|
@@ -362,7 +364,7 @@ const yn = ["id"], En = {
|
|
|
362
364
|
ref: l,
|
|
363
365
|
action: ".",
|
|
364
366
|
class: P(["vf-modal", { scrolls: e.scrolls }]),
|
|
365
|
-
onSubmit: h[0] || (h[0] =
|
|
367
|
+
onSubmit: h[0] || (h[0] = Le((f) => u.$emit("formSubmit"), ["prevent"]))
|
|
366
368
|
}, [
|
|
367
369
|
u.$slots.header ? (T(), I("div", En, [
|
|
368
370
|
K(u.$slots, "header"),
|
|
@@ -401,7 +403,7 @@ const yn = ["id"], En = {
|
|
|
401
403
|
class: P(["vf-alert", ...e.classes ?? []]),
|
|
402
404
|
scrolls: ""
|
|
403
405
|
}, jt({
|
|
404
|
-
default:
|
|
406
|
+
default: Se(() => [
|
|
405
407
|
e.iconClass ? (T(), I("i", {
|
|
406
408
|
key: 0,
|
|
407
409
|
class: P(["vf-alert-icon", e.iconClass])
|
|
@@ -419,14 +421,14 @@ const yn = ["id"], En = {
|
|
|
419
421
|
}, [
|
|
420
422
|
e.title ? {
|
|
421
423
|
name: "header",
|
|
422
|
-
fn:
|
|
424
|
+
fn: Se(() => [
|
|
423
425
|
te(J(e.title), 1)
|
|
424
426
|
]),
|
|
425
427
|
key: "0"
|
|
426
428
|
} : void 0,
|
|
427
429
|
e.isBare ? void 0 : {
|
|
428
430
|
name: "footer",
|
|
429
|
-
fn:
|
|
431
|
+
fn: Se(() => [
|
|
430
432
|
e.shouldConfirm ? (T(), I(he, { key: 0 }, [
|
|
431
433
|
fe((T(), I("button", {
|
|
432
434
|
class: "primary",
|
|
@@ -981,8 +983,8 @@ function Mn() {
|
|
|
981
983
|
this.opt = i;
|
|
982
984
|
var s = 0, u = "wrapMatches", h = this.getSeparatedKeywords(typeof n == "string" ? [n] : n), f = h.keywords, m = h.length, w = this.opt.caseSensitive ? "" : "i", S = function C(L) {
|
|
983
985
|
var R = new RegExp(r.createRegExp(L), "gm" + w), F = 0;
|
|
984
|
-
r.log('Searching with expression "' + R + '"'), r[u](R, 1, function(V,
|
|
985
|
-
return r.opt.filter(
|
|
986
|
+
r.log('Searching with expression "' + R + '"'), r[u](R, 1, function(V, ke) {
|
|
987
|
+
return r.opt.filter(ke, L, s, F);
|
|
986
988
|
}, function(V) {
|
|
987
989
|
F++, s++, r.opt.each(V);
|
|
988
990
|
}, function() {
|
|
@@ -1281,15 +1283,15 @@ for (let e = 0; e < 256; ++e)
|
|
|
1281
1283
|
function Hn(e, t = 0) {
|
|
1282
1284
|
return (A[e[t + 0]] + A[e[t + 1]] + A[e[t + 2]] + A[e[t + 3]] + "-" + A[e[t + 4]] + A[e[t + 5]] + "-" + A[e[t + 6]] + A[e[t + 7]] + "-" + A[e[t + 8]] + A[e[t + 9]] + "-" + A[e[t + 10]] + A[e[t + 11]] + A[e[t + 12]] + A[e[t + 13]] + A[e[t + 14]] + A[e[t + 15]]).toLowerCase();
|
|
1283
1285
|
}
|
|
1284
|
-
let
|
|
1286
|
+
let Te;
|
|
1285
1287
|
const Vn = new Uint8Array(16);
|
|
1286
1288
|
function Bn() {
|
|
1287
|
-
if (!
|
|
1289
|
+
if (!Te) {
|
|
1288
1290
|
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
1289
1291
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
1290
|
-
|
|
1292
|
+
Te = crypto.getRandomValues.bind(crypto);
|
|
1291
1293
|
}
|
|
1292
|
-
return
|
|
1294
|
+
return Te(Vn);
|
|
1293
1295
|
}
|
|
1294
1296
|
const _n = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Xe = { randomUUID: _n };
|
|
1295
1297
|
function Wn(e, t, o) {
|
|
@@ -1368,14 +1370,14 @@ const qn = ["disabled", "placeholder", "required", "name"], Jn = {
|
|
|
1368
1370
|
t({
|
|
1369
1371
|
addRemoteOption: $t
|
|
1370
1372
|
});
|
|
1371
|
-
const g = N(), E = N(), v = N(), c = N(!1), n = N(), i = N(!1), r = N(""), s = N(null), u = N(null), h = N(!1), f = N(null), m = N(!1), w = O(() => l.showCreateTextOnNewItem ?? !0), S = O(() => !!(l.options || n.value)), C = O(() => l.options ?? n.value ?? []), L = O(() => l.prependOptions ?? []), R = O(() => l.appendOptions ?? []), F = O(() => !!l.disabled || !S.value && !l.loadOptions), V = O(() => l.loadingText || "..."),
|
|
1373
|
+
const g = N(), E = N(), v = N(), c = N(!1), n = N(), i = N(!1), r = N(""), s = N(null), u = N(null), h = N(!1), f = N(null), m = N(!1), w = O(() => l.showCreateTextOnNewItem ?? !0), S = O(() => !!(l.options || n.value)), C = O(() => l.options ?? n.value ?? []), L = O(() => l.prependOptions ?? []), R = O(() => l.appendOptions ?? []), F = O(() => !!l.disabled || !S.value && !l.loadOptions), V = O(() => l.loadingText || "..."), ke = O(() => !S.value && (!l.loadOptions || l.preload || l.modelValue && (l.valueField || l.valueExtractor)) ? V.value : l.nullTitle ? l.nullTitle : l.placeholder || ""), bt = O(() => l.noResultsText || "No options match your search."), Z = O(() => l.valueExtractor ? l.valueExtractor : l.valueField ? (d) => d[l.valueField] : null), xe = O(() => l.keyExtractor ? l.keyExtractor : l.keyField ? (d) => String(d[l.keyField]) : Z.value ? (d) => String(Z.value(d)) : null), St = O(() => l.groupFormatter ? l.groupFormatter : l.groupField ? (d) => String(d[l.groupField]) : null), $e = O(() => l.formatter ? l.formatter : l.labelField ? (d) => String(d[l.labelField]) : (d) => String(d)), He = O(() => l.selectionFormatter ? l.selectionFormatter : $e.value), Ve = O(() => [...L.value, ...C.value, ...R.value]), Be = O(() => !!(l.groupField || l.groupFormatter)), we = O(() => Ve.value.map((d, b) => {
|
|
1372
1374
|
const k = St.value?.(d), x = $e.value(d), M = l.subtitleFormatter?.(d), B = x ? x.trim().toLowerCase() : "", qe = M ? M.trim().toLowerCase() : "", ue = [];
|
|
1373
1375
|
return l.searchFields ? l.searchFields.forEach((Je) => {
|
|
1374
1376
|
d[Je] && ue.push(
|
|
1375
1377
|
String(d[Je]).toLowerCase().replace(/^[a-z0-9 ]+$/i, "")
|
|
1376
1378
|
);
|
|
1377
1379
|
}) : (ue.push(B), qe && ue.push(qe)), {
|
|
1378
|
-
key:
|
|
1380
|
+
key: xe.value?.(d) ?? String(b),
|
|
1379
1381
|
group: k,
|
|
1380
1382
|
title: x,
|
|
1381
1383
|
subtitle: M,
|
|
@@ -1383,7 +1385,7 @@ const qn = ["disabled", "placeholder", "required", "name"], Jn = {
|
|
|
1383
1385
|
ref: d
|
|
1384
1386
|
};
|
|
1385
1387
|
})), D = O(() => {
|
|
1386
|
-
let d = [...
|
|
1388
|
+
let d = [...we.value];
|
|
1387
1389
|
if (i.value) {
|
|
1388
1390
|
const b = r.value.trim().toLowerCase().replace(/[^a-z0-9 ]+$/i, "");
|
|
1389
1391
|
b.length && (d = d.filter((k) => k.searchContent.includes(b)), m.value && (d.find((x) => x.searchContent === b) !== void 0 || d.push({
|
|
@@ -1409,7 +1411,7 @@ const qn = ["disabled", "placeholder", "required", "name"], Jn = {
|
|
|
1409
1411
|
options: b[k]
|
|
1410
1412
|
}));
|
|
1411
1413
|
});
|
|
1412
|
-
H(() => l.modelValue, G), H(
|
|
1414
|
+
H(() => l.modelValue, G), H(we, () => {
|
|
1413
1415
|
h.value && setTimeout(je, 0);
|
|
1414
1416
|
}), H(r, () => {
|
|
1415
1417
|
i.value && !l.remoteSearch && !r.value.trim().length && (i.value = !1);
|
|
@@ -1420,7 +1422,7 @@ const qn = ["disabled", "placeholder", "required", "name"], Jn = {
|
|
|
1420
1422
|
}), z(async () => {
|
|
1421
1423
|
m.value = l.onCreateItem !== void 0, l.loadOptions && l.preload ? await _e() : !l.options && !l.loadOptions && (l.valueField || l.valueExtractor) || G(), H(s, () => {
|
|
1422
1424
|
const d = Ye(s.value) && Z.value !== null ? Z.value(s.value) : s.value;
|
|
1423
|
-
|
|
1425
|
+
Ce(l.modelValue, d) || y("update:modelValue", d);
|
|
1424
1426
|
}), l.remoteSearch && H(r, Yt(It, 250));
|
|
1425
1427
|
}), me(() => {
|
|
1426
1428
|
v.value?.remove();
|
|
@@ -1446,11 +1448,11 @@ const qn = ["disabled", "placeholder", "required", "name"], Jn = {
|
|
|
1446
1448
|
return;
|
|
1447
1449
|
}
|
|
1448
1450
|
if (d.key == "ArrowUp" || d.key == "ArrowDown")
|
|
1449
|
-
return d.preventDefault(),
|
|
1451
|
+
return d.preventDefault(), be(d.key == "ArrowUp" ? -1 : 1);
|
|
1450
1452
|
if (d.key == "PageUp" || d.key == "PageDown")
|
|
1451
|
-
return d.preventDefault(),
|
|
1453
|
+
return d.preventDefault(), be(d.key == "PageUp" ? -10 : 10);
|
|
1452
1454
|
if (d.key == "Home" || d.key == "End")
|
|
1453
|
-
return d.preventDefault(),
|
|
1455
|
+
return d.preventDefault(), be(d.key == "Home" ? -Number.MAX_SAFE_INTEGER : Number.MAX_SAFE_INTEGER);
|
|
1454
1456
|
if (d.key == "Enter") {
|
|
1455
1457
|
d.preventDefault();
|
|
1456
1458
|
const b = D.value.find((k) => k.key == f.value);
|
|
@@ -1473,13 +1475,13 @@ const qn = ["disabled", "placeholder", "required", "name"], Jn = {
|
|
|
1473
1475
|
s.value ? f.value = Nt(s.value) : l.nullTitle && (f.value = a);
|
|
1474
1476
|
}
|
|
1475
1477
|
function Nt(d) {
|
|
1476
|
-
return
|
|
1478
|
+
return xe.value ? xe.value(s.value) : Lt(d)?.key ?? "";
|
|
1477
1479
|
}
|
|
1478
1480
|
function Lt(d) {
|
|
1479
1481
|
const b = D.value.find((M) => M.ref === d);
|
|
1480
1482
|
if (b)
|
|
1481
1483
|
return b;
|
|
1482
|
-
const k = l.keyExtractor ? (M, B) => l.keyExtractor(M) === l.keyExtractor(B) :
|
|
1484
|
+
const k = l.keyExtractor ? (M, B) => l.keyExtractor(M) === l.keyExtractor(B) : Ce, x = D.value.find((M) => k(M.ref, d));
|
|
1483
1485
|
return x || null;
|
|
1484
1486
|
}
|
|
1485
1487
|
function Rt() {
|
|
@@ -1506,7 +1508,7 @@ const qn = ["disabled", "placeholder", "required", "name"], Jn = {
|
|
|
1506
1508
|
function Dt(d) {
|
|
1507
1509
|
f.value = d ? d.key : null;
|
|
1508
1510
|
}
|
|
1509
|
-
function
|
|
1511
|
+
function be(d) {
|
|
1510
1512
|
const b = D.value.findIndex((B) => B.key == f.value);
|
|
1511
1513
|
let k = b + d;
|
|
1512
1514
|
if (k < 0 ? k = 0 : k >= D.value.length && (k = D.value.length - 1), b == k) return;
|
|
@@ -1521,7 +1523,7 @@ const qn = ["disabled", "placeholder", "required", "name"], Jn = {
|
|
|
1521
1523
|
const b = r.value.trim();
|
|
1522
1524
|
r.value = "", s.value = null, u.value = null, l.onCreateItem?.(b);
|
|
1523
1525
|
} else {
|
|
1524
|
-
const k =
|
|
1526
|
+
const k = we.value.find((x) => x.key == d.key).ref;
|
|
1525
1527
|
s.value = k, u.value = He.value(k), r.value = u.value ?? "";
|
|
1526
1528
|
}
|
|
1527
1529
|
E.value?.blur(), ze();
|
|
@@ -1566,7 +1568,7 @@ const qn = ["disabled", "placeholder", "required", "name"], Jn = {
|
|
|
1566
1568
|
type: "text",
|
|
1567
1569
|
disabled: F.value,
|
|
1568
1570
|
class: P({ nullable: !!e.nullTitle }),
|
|
1569
|
-
placeholder:
|
|
1571
|
+
placeholder: ke.value,
|
|
1570
1572
|
required: e.required,
|
|
1571
1573
|
name: e.name,
|
|
1572
1574
|
"data-1p-ignore": "",
|
|
@@ -1643,7 +1645,7 @@ const qn = ["disabled", "placeholder", "required", "name"], Jn = {
|
|
|
1643
1645
|
y.value = a.value.find((E) => E.value === g) ?? null;
|
|
1644
1646
|
}
|
|
1645
1647
|
), H(y, (g) => {
|
|
1646
|
-
const E = g ? a.value.find((v) =>
|
|
1648
|
+
const E = g ? a.value.find((v) => Ce(v, g))?.value : null;
|
|
1647
1649
|
l("update:modelValue", E ?? null);
|
|
1648
1650
|
}), (g, E) => (T(), at(eo, {
|
|
1649
1651
|
modelValue: y.value,
|
|
@@ -1690,7 +1692,7 @@ const to = { class: "content" }, no = { class: "message" }, oo = {
|
|
|
1690
1692
|
}), setTimeout(() => t.callback(), p * 1e3);
|
|
1691
1693
|
}), (p, l) => (T(), I("div", {
|
|
1692
1694
|
class: P(["vf-toast", [e.className, { top: e.position === "top", bottom: e.position !== "top" }]]),
|
|
1693
|
-
onClick:
|
|
1695
|
+
onClick: Le(o, ["stop"])
|
|
1694
1696
|
}, [
|
|
1695
1697
|
U("div", to, [
|
|
1696
1698
|
U("div", no, J(e.message), 1),
|
|
@@ -1784,7 +1786,7 @@ const Ze = {
|
|
|
1784
1786
|
...e(Ze)
|
|
1785
1787
|
}), Ae = Symbol("HookState");
|
|
1786
1788
|
function yr(e, t) {
|
|
1787
|
-
const o = t ??
|
|
1789
|
+
const o = t ?? Ne();
|
|
1788
1790
|
z(() => wo(o, e), o), st(() => bo(o), o), lt(() => Ge(o), o), me(() => Ge(o), o);
|
|
1789
1791
|
}
|
|
1790
1792
|
function wo(e, t) {
|
|
@@ -1803,12 +1805,12 @@ function Ge(e) {
|
|
|
1803
1805
|
const t = e[Ae];
|
|
1804
1806
|
t?.el?.uninstall(), t?.ancestor?.uninstall(), t?.window?.uninstall();
|
|
1805
1807
|
}
|
|
1806
|
-
const
|
|
1808
|
+
const Ie = ["auto", "scroll"];
|
|
1807
1809
|
function mt(e) {
|
|
1808
1810
|
const t = e.parentElement;
|
|
1809
1811
|
if (!t) return null;
|
|
1810
1812
|
const o = window.getComputedStyle(t);
|
|
1811
|
-
return
|
|
1813
|
+
return Ie.includes(o.overflow) || Ie.includes(o.overflowX) || Ie.includes(o.overflowY) ? t : mt(t);
|
|
1812
1814
|
}
|
|
1813
1815
|
class oe {
|
|
1814
1816
|
constructor(t, o) {
|
|
@@ -1988,17 +1990,17 @@ const ee = Symbol("InfiniteScrollHandler"), Vo = {
|
|
|
1988
1990
|
function rt(e, t) {
|
|
1989
1991
|
e.tagName == "LABEL" && (e = e.querySelector("input")), t.value ? e.setAttribute("readonly", "readonly") : e.removeAttribute("readonly");
|
|
1990
1992
|
}
|
|
1991
|
-
const
|
|
1993
|
+
const Me = /* @__PURE__ */ new WeakMap(), _o = {
|
|
1992
1994
|
beforeMount(e) {
|
|
1993
1995
|
const t = new ResizeObserver(() => {
|
|
1994
1996
|
const o = window.getComputedStyle(e).minWidth.match(/^(\d+)px$/)?.[1], a = o ? parseInt(o, 10) : 0;
|
|
1995
1997
|
e.clientWidth <= a || (e.style.minWidth = `${e.clientWidth}px`);
|
|
1996
1998
|
});
|
|
1997
|
-
|
|
1999
|
+
Me.set(e, t), t.observe(e);
|
|
1998
2000
|
},
|
|
1999
2001
|
beforeUnmount(e) {
|
|
2000
|
-
const t =
|
|
2001
|
-
t && (t.unobserve(e),
|
|
2002
|
+
const t = Me.get(e);
|
|
2003
|
+
t && (t.unobserve(e), Me.delete(e));
|
|
2002
2004
|
}
|
|
2003
2005
|
}, Wo = {
|
|
2004
2006
|
mounted: it,
|
|
@@ -2105,7 +2107,7 @@ export {
|
|
|
2105
2107
|
gn as maskForm,
|
|
2106
2108
|
fr as nl2br,
|
|
2107
2109
|
cr as nullifyEmptyInputs,
|
|
2108
|
-
|
|
2110
|
+
Re as presentOverlay,
|
|
2109
2111
|
ie as removeOverlayInjection,
|
|
2110
2112
|
ar as replaceElement,
|
|
2111
2113
|
hn as showAlert,
|
|
@@ -2117,7 +2119,7 @@ export {
|
|
|
2117
2119
|
er as showWait,
|
|
2118
2120
|
Nn as sleep,
|
|
2119
2121
|
lr as sleepSecs,
|
|
2120
|
-
|
|
2122
|
+
Ee as toError,
|
|
2121
2123
|
ir as unmaskComponent,
|
|
2122
2124
|
dt as unmaskEl,
|
|
2123
2125
|
ft as unmaskForm,
|
package/package.json
CHANGED
|
@@ -30,6 +30,7 @@ const props = defineProps<{
|
|
|
30
30
|
scrolls?: boolean;
|
|
31
31
|
closeX?: boolean;
|
|
32
32
|
class?: string | string[];
|
|
33
|
+
onClose?: () => void;
|
|
33
34
|
}>();
|
|
34
35
|
|
|
35
36
|
defineEmits(['formSubmit']);
|
|
@@ -77,7 +78,11 @@ function handleEscapeKey(e: KeyboardEvent) {
|
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
function closeParent() {
|
|
80
|
-
|
|
81
|
+
if (props.onClose) {
|
|
82
|
+
props.onClose();
|
|
83
|
+
} else {
|
|
84
|
+
dismissOverlayInjectionByInternalInstance(instance!);
|
|
85
|
+
}
|
|
81
86
|
}
|
|
82
87
|
|
|
83
88
|
function mask() {
|
package/src/helpers/error.ts
CHANGED
|
@@ -8,6 +8,10 @@ export class UserError extends Error {
|
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
interface ErrorWithCause extends Error {
|
|
12
|
+
cause?: Error;
|
|
13
|
+
}
|
|
14
|
+
|
|
11
15
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
16
|
export function formatError(err: any): string {
|
|
13
17
|
if (err instanceof UserError) {
|
|
@@ -19,9 +23,12 @@ export function formatError(err: any): string {
|
|
|
19
23
|
}
|
|
20
24
|
|
|
21
25
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
|
-
export function toError(err: any) {
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
export function toError(err: any, cause?: any): ErrorWithCause {
|
|
27
|
+
const error = (isError(err) ? err : new Error(String(err))) as ErrorWithCause;
|
|
28
|
+
if (cause) {
|
|
29
|
+
error.cause = toError(cause);
|
|
30
|
+
}
|
|
31
|
+
return error;
|
|
25
32
|
}
|
|
26
33
|
|
|
27
34
|
export function isError(err: unknown): err is Error {
|
|
@@ -31,12 +38,14 @@ export function isError(err: unknown): err is Error {
|
|
|
31
38
|
}
|
|
32
39
|
|
|
33
40
|
interface IErrorAlertOptions {
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
42
|
+
cause?: any;
|
|
34
43
|
title?: string;
|
|
35
44
|
classes?: string[];
|
|
36
45
|
}
|
|
37
46
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
38
47
|
export async function handleErrorAndAlert(errIn: any, options?: IErrorAlertOptions) {
|
|
39
|
-
const err = toError(errIn);
|
|
48
|
+
const err = toError(errIn, options?.cause);
|
|
40
49
|
|
|
41
50
|
if (!(err instanceof UserError)) {
|
|
42
51
|
VfOptions.errorHandler(err);
|
|
@@ -50,8 +59,8 @@ export async function handleErrorAndAlert(errIn: any, options?: IErrorAlertOptio
|
|
|
50
59
|
}
|
|
51
60
|
|
|
52
61
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
53
|
-
export async function handleError(errIn: any) {
|
|
54
|
-
const err = toError(errIn);
|
|
62
|
+
export async function handleError(errIn: any, cause?: any) {
|
|
63
|
+
const err = toError(errIn, cause);
|
|
55
64
|
|
|
56
65
|
if (!(err instanceof UserError)) {
|
|
57
66
|
VfOptions.errorHandler(err);
|