@wssto2/vue-core 0.4.13 → 0.4.15
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/{ActionRow.vue_vue_type_script_setup_true_lang-LlfIPWsJ.js → ActionRow.vue_vue_type_script_setup_true_lang-CkvS5W6K.js} +1 -1
- package/dist/{Activity-DhVVSf60.js → Activity-4q26REYj.js} +6 -6
- package/dist/{Changes-Czs32zlz.js → Changes-CKIuGF8O.js} +5 -5
- package/dist/{CollectionPage.vue_vue_type_script_setup_true_lang-DkpFEHUw.js → CollectionPage.vue_vue_type_script_setup_true_lang-B17cUOzj.js} +2 -2
- package/dist/{DateField.vue_vue_type_script_setup_true_lang-GVasv8ao.js → DateField.vue_vue_type_script_setup_true_lang-DehwWm78.js} +17 -16
- package/dist/{DeadLetters-DBUALYXL.js → DeadLetters-DPGcQOz1.js} +4 -4
- package/dist/FormErrors.vue_vue_type_script_setup_true_lang-DWcVKZM3.js +285 -0
- package/dist/{FormGroup.vue_vue_type_script_setup_true_lang-DG2zdG_a.js → FormGroup.vue_vue_type_script_setup_true_lang-noYI9QMk.js} +1 -1
- package/dist/{FormView.vue_vue_type_script_setup_true_lang-cr0xNDXP.js → FormView.vue_vue_type_script_setup_true_lang-BcIbTMHN.js} +2 -2
- package/dist/{General-UWbJQLc8.js → General-CUA9b3ML.js} +10 -10
- package/dist/{NewRolePage-Dm7urTx0.js → NewRolePage-DBfCvDWA.js} +3 -3
- package/dist/NumberField.vue_vue_type_script_setup_true_lang-Dm6FfJ2T.js +126 -0
- package/dist/{ProfilePage-Ep75xf-u.js → ProfilePage-On-eAiJ-.js} +41 -41
- package/dist/{RoleEditor.vue_vue_type_script_setup_true_lang-CDZjkiU5.js → RoleEditor.vue_vue_type_script_setup_true_lang-fvAf3rQm.js} +44 -44
- package/dist/{RolePage-CQc_wV3b.js → RolePage-B8oul55j.js} +8 -8
- package/dist/{RolesPage-CG7InZ_u.js → RolesPage-DsXVivdj.js} +5 -5
- package/dist/{SegmentedField.vue_vue_type_script_setup_true_lang-BMqWlpsL.js → SegmentedField.vue_vue_type_script_setup_true_lang-B2d55hrh.js} +7 -6
- package/dist/SelectField.vue_vue_type_script_setup_true_lang-DedKLLQK.js +443 -0
- package/dist/{SessionList.vue_vue_type_script_setup_true_lang-D4k5QeWS.js → SessionList.vue_vue_type_script_setup_true_lang-CirlMdHb.js} +2 -2
- package/dist/{Sessions-_w3Tnevz.js → Sessions-BTyXDEuY.js} +4 -4
- package/dist/{SettingsPage-BNdeH-_0.js → SettingsPage-DHTmMgif.js} +9 -9
- package/dist/{SignIn-DIjshMpl.js → SignIn-DU4DE2wj.js} +6 -6
- package/dist/{SignInPage-C3-LHjo2.js → SignInPage-BA22kyOp.js} +3 -3
- package/dist/{SignIns-DNdLctGJ.js → SignIns-C8QAZBaL.js} +3 -3
- package/dist/{SwitchField.vue_vue_type_script_setup_true_lang-CM8yp9JQ.js → SwitchField.vue_vue_type_script_setup_true_lang-B2Z2hy_h.js} +11 -10
- package/dist/{TextField.vue_vue_type_script_setup_true_lang-B9dwVASU.js → TextField.vue_vue_type_script_setup_true_lang-nqnGG7Zc.js} +27 -26
- package/dist/{TextareaField.vue_vue_type_script_setup_true_lang-CqAWfABZ.js → TextareaField.vue_vue_type_script_setup_true_lang-BgIQyYtf.js} +9 -8
- package/dist/{TimeField.vue_vue_type_script_setup_true_lang-DWfAUlnz.js → TimeField.vue_vue_type_script_setup_true_lang-Dr0h-V_8.js} +25 -24
- package/dist/{UserRecord-C0JZgK47.js → UserRecord-D1BNmYp9.js} +10 -10
- package/dist/{UsersList-Bc8dCuRB.js → UsersList-ltx3G23-.js} +8 -8
- package/dist/access/index.js +1 -1
- package/dist/app/application.d.ts +13 -0
- package/dist/app/index.js +160 -159
- package/dist/collection/index.js +1 -1
- package/dist/control-CX9BG2UB.js +320 -0
- package/dist/describeError-B-NMa--w.js +53 -0
- package/dist/fieldMessages-DV6sESpn.js +25 -0
- package/dist/form/DateField.vue.d.ts +1 -0
- package/dist/form/DateTimeField.vue.d.ts +1 -0
- package/dist/form/Field.vue.d.ts +1 -0
- package/dist/form/FileField.vue.d.ts +1 -0
- package/dist/form/FormErrors.vue.d.ts +1 -1
- package/dist/form/FormRow.vue.d.ts +3 -0
- package/dist/form/I18nField.vue.d.ts +1 -0
- package/dist/form/MoneyField.vue.d.ts +1 -0
- package/dist/form/MonthYearField.vue.d.ts +1 -0
- package/dist/form/NumberField.vue.d.ts +5 -0
- package/dist/form/PhotoField.vue.d.ts +1 -0
- package/dist/form/SelectField.vue.d.ts +5 -6
- package/dist/form/SwitchField.vue.d.ts +1 -0
- package/dist/form/TextField.vue.d.ts +1 -0
- package/dist/form/TextareaField.vue.d.ts +1 -0
- package/dist/form/TimeField.vue.d.ts +1 -0
- package/dist/form/field.d.ts +3 -0
- package/dist/form/index.d.ts +2 -0
- package/dist/form/index.js +469 -456
- package/dist/form/useForm.d.ts +2 -2
- package/dist/form/useHiddenFieldErrors.d.ts +23 -0
- package/dist/form/useSaveChrome.d.ts +8 -3
- package/dist/i18n/describeError.d.ts +19 -1
- package/dist/i18n/index.d.ts +2 -2
- package/dist/i18n/index.js +8 -6
- package/dist/identity/fieldMessages.d.ts +1 -1
- package/dist/identity/index.js +1 -1
- package/dist/{index-Cz4LtYKa.js → index-BCw_Ki6z.js} +2 -2
- package/dist/{index-BesWsiIg.js → index-Chh4z9xW.js} +10 -10
- package/dist/{index-BEDhdJQE.js → index-DwdVrW6q.js} +15 -15
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/notifications/index.js +1 -1
- package/dist/phone/PhoneField.vue.d.ts +1 -0
- package/dist/phone/index.js +66 -65
- package/dist/resource/index.js +1 -1
- package/dist/resource/resource.d.ts +1 -1
- package/dist/{routeResource-DstM0hvf.js → routeResource-DlTsGTg_.js} +36 -32
- package/dist/state/index.js +1 -1
- package/dist/state/useLoad.d.ts +7 -0
- package/dist/{status-DfAac6vw.js → status-cWCAMAmW.js} +1 -1
- package/dist/{useCommand-BkONMn3X.js → useCommand-B-N6HJOz.js} +1 -1
- package/dist/useLoad-M7V-AVwR.js +43 -0
- package/dist/{useResourceForm-D1hIpwW5.js → useResourceForm-CP2lCwmD.js} +1 -1
- package/dist/useSaveChrome-7huA3FzR.js +26 -0
- package/package.json +1 -1
- package/dist/FormErrors.vue_vue_type_script_setup_true_lang-BQb7wLT0.js +0 -276
- package/dist/NumberField.vue_vue_type_script_setup_true_lang-C7N5nq0P.js +0 -113
- package/dist/SelectField.vue_vue_type_script_setup_true_lang-BJoAkBo2.js +0 -437
- package/dist/control-7EP4tjYy.js +0 -313
- package/dist/describeError-Ctga6GcS.js +0 -41
- package/dist/fieldMessages-C3Rpbktw.js +0 -25
- package/dist/useLoad-CYRVx6HW.js +0 -39
- package/dist/useSaveChrome-DuWm0Czf.js +0 -25
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { shallowRef as S, watch as k, getCurrentScope as C, onScopeDispose as D, computed as v } from "vue";
|
|
2
|
+
import { useI18n as E } from "vue-i18n";
|
|
3
|
+
import { u as x } from "./describeError-B-NMa--w.js";
|
|
4
|
+
const f = Symbol("vue-core.load.abandoned");
|
|
5
|
+
function M(m, t = {}) {
|
|
6
|
+
const { t: g } = E(), b = x(), p = t.errorMessage ?? ((a) => b(a, { fallback: g("core.resource.unavailable") })), e = S({ status: "loading" });
|
|
7
|
+
let u = 0, s = null;
|
|
8
|
+
function n() {
|
|
9
|
+
return s?.abort(), s = null, ++u;
|
|
10
|
+
}
|
|
11
|
+
async function l() {
|
|
12
|
+
const a = n(), i = e.value, r = "value" in i ? i : null;
|
|
13
|
+
e.value = r ? { status: "refreshing", value: r.value } : { status: "loading" };
|
|
14
|
+
const c = new AbortController();
|
|
15
|
+
s = c;
|
|
16
|
+
try {
|
|
17
|
+
const o = await m({ signal: c.signal, abandon: w });
|
|
18
|
+
a === u && (e.value = { status: "loaded", value: o });
|
|
19
|
+
} catch (o) {
|
|
20
|
+
if (a !== u || o === f) return;
|
|
21
|
+
const d = p(o);
|
|
22
|
+
e.value = r ? { status: "stale", value: r.value, error: d } : { status: "failed", error: d };
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function w() {
|
|
26
|
+
throw f;
|
|
27
|
+
}
|
|
28
|
+
function h(a) {
|
|
29
|
+
n(), e.value = { status: "loaded", value: a };
|
|
30
|
+
}
|
|
31
|
+
function y() {
|
|
32
|
+
e.value = { status: "loading" }, l();
|
|
33
|
+
}
|
|
34
|
+
return t.watch !== void 0 ? k(t.watch, y, { immediate: t.immediate ?? !0 }) : (t.immediate ?? !0) && l(), C() && D(n), {
|
|
35
|
+
state: v(() => e.value),
|
|
36
|
+
data: v(() => "value" in e.value ? e.value.value : null),
|
|
37
|
+
reload: l,
|
|
38
|
+
update: h
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
M as u
|
|
43
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { shallowRef as v, watch as m, computed as f } from "vue";
|
|
2
|
-
import { u as i, c as h } from "./FormErrors.vue_vue_type_script_setup_true_lang-
|
|
2
|
+
import { u as i, c as h } from "./FormErrors.vue_vue_type_script_setup_true_lang-DWcVKZM3.js";
|
|
3
3
|
function b(u) {
|
|
4
4
|
const t = i(u), r = v(null), s = v(!1);
|
|
5
5
|
let n = null;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { computed as u, toValue as l } from "vue";
|
|
2
|
+
import { useI18n as m } from "vue-i18n";
|
|
3
|
+
import { u as i } from "./chrome-nUcmVu8G.js";
|
|
4
|
+
import { a as n } from "./leaveGuard-Cc8yeLxM.js";
|
|
5
|
+
function o(e) {
|
|
6
|
+
const { t: a } = m(), r = u(() => (l(e.ready) ?? !0) && (l(e.allowed) ?? !0)), c = u(() => r.value && e.form.dirty.value);
|
|
7
|
+
n(() => r.value && e.form.dirty.value), i({
|
|
8
|
+
actions: () => r.value ? [
|
|
9
|
+
{
|
|
10
|
+
id: e.id ?? "save",
|
|
11
|
+
label: l(e.label) ?? a("core.actions.save"),
|
|
12
|
+
shortLabel: a("core.actions.save"),
|
|
13
|
+
icon: "save",
|
|
14
|
+
placement: "primary",
|
|
15
|
+
processing: e.form.submitting.value,
|
|
16
|
+
disabled: (l(e.disabledWhileClean) ?? !0) && !e.form.dirty.value,
|
|
17
|
+
onClick: e.save
|
|
18
|
+
}
|
|
19
|
+
] : [],
|
|
20
|
+
leading: () => c.value && e.cancel ? { id: `${e.id ?? "save"}-cancel`, label: a("core.actions.cancel"), prominence: "plain", onClick: e.cancel } : null,
|
|
21
|
+
status: () => c.value ? a("core.form.unsaved_changes") : null
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
o as u
|
|
26
|
+
};
|
package/package.json
CHANGED
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
var J = Object.defineProperty;
|
|
2
|
-
var Q = (a, e, s) => e in a ? J(a, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : a[e] = s;
|
|
3
|
-
var I = (a, e, s) => Q(a, typeof e != "symbol" ? e + "" : e, s);
|
|
4
|
-
import { shallowRef as M, computed as x, toRaw as X, reactive as Z, ref as Y, defineComponent as K, watch as ee, nextTick as te, openBlock as b, createBlock as re, withCtx as se, createElementBlock as O, toDisplayString as A, createCommentVNode as E, Fragment as U, createElementVNode as P, normalizeClass as ae, unref as R, renderList as ne, createTextVNode as V } from "vue";
|
|
5
|
-
import { useI18n as G } from "vue-i18n";
|
|
6
|
-
import { i as le, a as q } from "./error-CD7x0Jrz.js";
|
|
7
|
-
import { _ as ie } from "./Banner.vue_vue_type_script_setup_true_lang-DSStj_5z.js";
|
|
8
|
-
class ue {
|
|
9
|
-
constructor() {
|
|
10
|
-
I(this, "messages", M({}));
|
|
11
|
-
/** How many fields have a message. */
|
|
12
|
-
I(this, "count", x(() => Object.keys(this.messages.value).length));
|
|
13
|
-
}
|
|
14
|
-
/** Replaces everything. Empty lists are dropped. */
|
|
15
|
-
set(e) {
|
|
16
|
-
this.messages.value = Object.fromEntries(Object.entries(e).filter(([, s]) => s.length > 0).map(([s, t]) => [s, [...t]]));
|
|
17
|
-
}
|
|
18
|
-
add(e, s) {
|
|
19
|
-
this.messages.value = { ...this.messages.value, [e]: [...this.messages.value[e] ?? [], s] };
|
|
20
|
-
}
|
|
21
|
-
/** Clears one field (and its nested paths), or everything. */
|
|
22
|
-
clear(e) {
|
|
23
|
-
if (e === void 0) {
|
|
24
|
-
this.count.value > 0 && (this.messages.value = {});
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
const s = Object.fromEntries(Object.entries(this.messages.value).filter(([t]) => t !== e && !t.startsWith(`${e}.`)));
|
|
28
|
-
Object.keys(s).length !== this.count.value && (this.messages.value = s);
|
|
29
|
-
}
|
|
30
|
-
/** Whether the field, or a value inside it (`items.0.quantity` for `items`), has a message. */
|
|
31
|
-
has(e) {
|
|
32
|
-
return this.first(e) !== void 0 || Object.keys(this.messages.value).some((s) => s.startsWith(`${e}.`));
|
|
33
|
-
}
|
|
34
|
-
first(e) {
|
|
35
|
-
return this.messages.value[e]?.[0];
|
|
36
|
-
}
|
|
37
|
-
all() {
|
|
38
|
-
return this.messages.value;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
function f(a) {
|
|
42
|
-
const e = X(a);
|
|
43
|
-
return e === null || typeof e != "object" ? e : e instanceof Date ? new Date(e.getTime()) : typeof Blob < "u" && e instanceof Blob ? e : Array.isArray(e) ? e.map(f) : Object.fromEntries(Object.entries(e).map(([s, t]) => [s, f(t)]));
|
|
44
|
-
}
|
|
45
|
-
function S(a, e) {
|
|
46
|
-
const s = a, t = e;
|
|
47
|
-
if (Object.is(s, t)) return !0;
|
|
48
|
-
if (s === null || t === null || typeof s != "object" || typeof t != "object") return !1;
|
|
49
|
-
if (s instanceof Date || t instanceof Date) return s instanceof Date && t instanceof Date && s.getTime() === t.getTime();
|
|
50
|
-
if (Array.isArray(s) || Array.isArray(t))
|
|
51
|
-
return Array.isArray(s) && Array.isArray(t) && s.length === t.length && s.every((c, d) => S(c, t[d]));
|
|
52
|
-
if (typeof Blob < "u" && (s instanceof Blob || t instanceof Blob)) return !1;
|
|
53
|
-
const l = (c) => Object.keys(c).filter((d) => c[d] !== void 0), o = l(s);
|
|
54
|
-
return o.length === l(t).length && o.every((c) => S(s[c], t[c]));
|
|
55
|
-
}
|
|
56
|
-
function W(a) {
|
|
57
|
-
const e = {};
|
|
58
|
-
for (const s of a) {
|
|
59
|
-
const t = s.path.map(String).join(".");
|
|
60
|
-
(e[t] ?? (e[t] = [])).push(s.message);
|
|
61
|
-
}
|
|
62
|
-
return e;
|
|
63
|
-
}
|
|
64
|
-
const oe = (a) => a.split(".")[0] ?? a, L = () => typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
65
|
-
function ye(a) {
|
|
66
|
-
const { t: e } = G(), t = Z(f(typeof a.defaults == "function" ? a.defaults() : a.defaults)), l = M(f(t)), o = new ue(), c = Y(!1), d = M(null), v = x(() => !S(t, l.value));
|
|
67
|
-
let j = null, h = L();
|
|
68
|
-
function y(r) {
|
|
69
|
-
const n = t;
|
|
70
|
-
for (const i of Object.keys(n)) i in r || delete n[i];
|
|
71
|
-
Object.assign(n, f(r));
|
|
72
|
-
}
|
|
73
|
-
function D() {
|
|
74
|
-
o.clear(), d.value = null;
|
|
75
|
-
}
|
|
76
|
-
function _(r, n) {
|
|
77
|
-
const i = q(n) ? n.requestId : null, u = a.failureMessage?.(r, n) ?? e(`core.form.failure.${r}`);
|
|
78
|
-
return d.value = { kind: r, message: u, requestId: i, error: n };
|
|
79
|
-
}
|
|
80
|
-
function B(r, n = !1) {
|
|
81
|
-
const { translate: i, serverField: u } = a, w = n && u ? Object.entries(r).map(([m, g]) => [u(m), g]) : Object.entries(r);
|
|
82
|
-
o.set(Object.fromEntries(i ? w.map(([m, g]) => [m, g.map((F) => i(F, m))]) : w));
|
|
83
|
-
}
|
|
84
|
-
function T() {
|
|
85
|
-
if (o.clear(), !a.validator) return f(t);
|
|
86
|
-
const r = a.validator.safeParse(f(t));
|
|
87
|
-
return r.success ? r.data : (B(W(r.error.issues)), null);
|
|
88
|
-
}
|
|
89
|
-
function C(r) {
|
|
90
|
-
if (o.clear(), !a.validator) return !0;
|
|
91
|
-
const n = a.validator.safeParse(f(t));
|
|
92
|
-
if (n.success) return !0;
|
|
93
|
-
const i = Object.fromEntries(Object.entries(W(n.error.issues)).filter(([u]) => r.includes(oe(u))));
|
|
94
|
-
return B(i), Object.keys(i).length === 0;
|
|
95
|
-
}
|
|
96
|
-
function H(r) {
|
|
97
|
-
if (!q(r)) return "failed";
|
|
98
|
-
switch (r.kind) {
|
|
99
|
-
case "validation":
|
|
100
|
-
return "invalid";
|
|
101
|
-
case "conflict":
|
|
102
|
-
return "conflict";
|
|
103
|
-
case "forbidden":
|
|
104
|
-
return "forbidden";
|
|
105
|
-
case "unauthorized":
|
|
106
|
-
return "unauthorized";
|
|
107
|
-
case "network":
|
|
108
|
-
return "offline";
|
|
109
|
-
default:
|
|
110
|
-
return "failed";
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
async function z(r, n, i, u) {
|
|
114
|
-
if (j) return j;
|
|
115
|
-
const m = (async () => {
|
|
116
|
-
d.value = null;
|
|
117
|
-
const g = r();
|
|
118
|
-
if (g === null) return { status: "failed", failure: _("invalid", null) };
|
|
119
|
-
const F = f(t);
|
|
120
|
-
let k;
|
|
121
|
-
c.value = !0;
|
|
122
|
-
try {
|
|
123
|
-
k = await n(g, { idempotencyKey: h });
|
|
124
|
-
} catch (p) {
|
|
125
|
-
if (c.value = !1, le(p)) return { status: "aborted" };
|
|
126
|
-
const N = H(p);
|
|
127
|
-
return N === "invalid" && q(p) && B(p.fields, !0), { status: "failed", failure: _(N, p) };
|
|
128
|
-
}
|
|
129
|
-
const $ = u?.hydrateFrom?.(k) ?? null;
|
|
130
|
-
$ ? (y($), l.value = f($), o.clear()) : i(k, F);
|
|
131
|
-
try {
|
|
132
|
-
await u?.refresh?.(k);
|
|
133
|
-
} catch (p) {
|
|
134
|
-
return _("refresh", p), { status: "saved-refresh-failed", value: k, error: p };
|
|
135
|
-
} finally {
|
|
136
|
-
c.value = !1;
|
|
137
|
-
}
|
|
138
|
-
return { status: "saved", value: k };
|
|
139
|
-
})().finally(() => {
|
|
140
|
-
j = null, h = L();
|
|
141
|
-
});
|
|
142
|
-
return j = m, m;
|
|
143
|
-
}
|
|
144
|
-
return {
|
|
145
|
-
values: t,
|
|
146
|
-
errors: o,
|
|
147
|
-
dirty: v,
|
|
148
|
-
submitting: c,
|
|
149
|
-
failure: d,
|
|
150
|
-
bind(r) {
|
|
151
|
-
return {
|
|
152
|
-
get modelValue() {
|
|
153
|
-
return t[r];
|
|
154
|
-
},
|
|
155
|
-
"onUpdate:modelValue"(n) {
|
|
156
|
-
t[r] = n, o.clear(r);
|
|
157
|
-
},
|
|
158
|
-
get error() {
|
|
159
|
-
return o.first(r);
|
|
160
|
-
},
|
|
161
|
-
"data-field-key": r
|
|
162
|
-
};
|
|
163
|
-
},
|
|
164
|
-
bindMonthYear(r, n) {
|
|
165
|
-
const i = t;
|
|
166
|
-
return {
|
|
167
|
-
get month() {
|
|
168
|
-
return i[r] ?? null;
|
|
169
|
-
},
|
|
170
|
-
get year() {
|
|
171
|
-
return i[n] ?? null;
|
|
172
|
-
},
|
|
173
|
-
"onUpdate:month"(u) {
|
|
174
|
-
i[r] = u, o.clear(r);
|
|
175
|
-
},
|
|
176
|
-
"onUpdate:year"(u) {
|
|
177
|
-
i[n] = u, o.clear(n);
|
|
178
|
-
},
|
|
179
|
-
get error() {
|
|
180
|
-
return o.first(r) ?? o.first(n);
|
|
181
|
-
},
|
|
182
|
-
"data-field-key": `${r} ${n}`
|
|
183
|
-
};
|
|
184
|
-
},
|
|
185
|
-
hydrate(r) {
|
|
186
|
-
y(r), l.value = f(r), D();
|
|
187
|
-
},
|
|
188
|
-
reset() {
|
|
189
|
-
y(l.value), D();
|
|
190
|
-
},
|
|
191
|
-
markClean() {
|
|
192
|
-
l.value = f(t);
|
|
193
|
-
},
|
|
194
|
-
validate: T,
|
|
195
|
-
check: C,
|
|
196
|
-
submit: (r, n) => z(T, r, (i, u) => l.value = u, n),
|
|
197
|
-
submitFields: (r, n, i) => z(
|
|
198
|
-
() => C(r) ? Object.fromEntries(r.map((u) => [u, f(t[u])])) : null,
|
|
199
|
-
n,
|
|
200
|
-
(u, w) => {
|
|
201
|
-
const m = f(l.value);
|
|
202
|
-
for (const g of r) m[g] = f(w[g]);
|
|
203
|
-
l.value = m;
|
|
204
|
-
},
|
|
205
|
-
i
|
|
206
|
-
),
|
|
207
|
-
dismissFailure() {
|
|
208
|
-
d.value = null;
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
const ce = {
|
|
213
|
-
key: 0,
|
|
214
|
-
class: "text-footnote font-medium"
|
|
215
|
-
}, fe = {
|
|
216
|
-
class: "mt-1 list-inside list-disc text-footnote",
|
|
217
|
-
"data-test": "form-errors-hidden"
|
|
218
|
-
}, de = {
|
|
219
|
-
key: 2,
|
|
220
|
-
class: "mt-1 text-caption text-content-muted"
|
|
221
|
-
}, be = /* @__PURE__ */ K({
|
|
222
|
-
__name: "FormErrors",
|
|
223
|
-
props: {
|
|
224
|
-
form: {},
|
|
225
|
-
label: { type: Function, default: (a) => a },
|
|
226
|
-
scope: { default: null }
|
|
227
|
-
},
|
|
228
|
-
setup(a) {
|
|
229
|
-
const e = a, { t: s } = G(), t = Y([]);
|
|
230
|
-
ee(
|
|
231
|
-
() => e.form.errors.all(),
|
|
232
|
-
async (c) => {
|
|
233
|
-
await te();
|
|
234
|
-
const d = e.scope ?? document, v = new Set([...d.querySelectorAll("[data-field-key]")].flatMap((h) => (h.getAttribute("data-field-key") ?? "").split(/\s+/))), j = (h) => h.split(".").some((y, D, _) => v.has(_.slice(0, D + 1).join(".")));
|
|
235
|
-
t.value = Object.entries(c).flatMap(([h, y]) => y[0] && !j(h) ? [{ field: h, message: y[0] }] : []);
|
|
236
|
-
},
|
|
237
|
-
{ immediate: !0 }
|
|
238
|
-
);
|
|
239
|
-
const l = x(() => e.form.failure.value), o = x(() => l.value?.kind === "conflict" || l.value?.kind === "refresh" ? "warning" : "critical");
|
|
240
|
-
return (c, d) => l.value || t.value.length ? (b(), re(ie, {
|
|
241
|
-
key: 0,
|
|
242
|
-
tone: l.value ? o.value : "warning",
|
|
243
|
-
"data-test": "form-errors"
|
|
244
|
-
}, {
|
|
245
|
-
default: se(() => [
|
|
246
|
-
l.value ? (b(), O("p", ce, A(l.value.message), 1)) : E("", !0),
|
|
247
|
-
t.value.length ? (b(), O(U, { key: 1 }, [
|
|
248
|
-
P("p", {
|
|
249
|
-
class: ae(["text-footnote", l.value ? "mt-1" : "font-medium"])
|
|
250
|
-
}, A(R(s)("core.form.errors.hidden_title")), 3),
|
|
251
|
-
P("ul", fe, [
|
|
252
|
-
(b(!0), O(U, null, ne(t.value, (v) => (b(), O("li", {
|
|
253
|
-
key: v.field
|
|
254
|
-
}, [
|
|
255
|
-
V(A(v.field ? e.label(v.field) : ""), 1),
|
|
256
|
-
v.field ? (b(), O(U, { key: 0 }, [
|
|
257
|
-
V(": ")
|
|
258
|
-
], 64)) : E("", !0),
|
|
259
|
-
V(A(v.message), 1)
|
|
260
|
-
]))), 128))
|
|
261
|
-
])
|
|
262
|
-
], 64)) : E("", !0),
|
|
263
|
-
l.value?.requestId ? (b(), O("p", de, A(R(s)("core.form.errors.request", { id: l.value.requestId })), 1)) : E("", !0)
|
|
264
|
-
]),
|
|
265
|
-
_: 1
|
|
266
|
-
}, 8, ["tone"])) : E("", !0);
|
|
267
|
-
}
|
|
268
|
-
});
|
|
269
|
-
export {
|
|
270
|
-
ue as E,
|
|
271
|
-
be as _,
|
|
272
|
-
f as c,
|
|
273
|
-
oe as f,
|
|
274
|
-
S as s,
|
|
275
|
-
ye as u
|
|
276
|
-
};
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { defineComponent as G, useModel as I, useTemplateRef as R, computed as _, ref as w, watch as F, openBlock as y, createBlock as S, mergeProps as W, unref as B, withCtx as $, createElementVNode as D, normalizeClass as A, createElementBlock as q, toDisplayString as N, createCommentVNode as M, mergeModels as E, mergeDefaults as O } from "vue";
|
|
2
|
-
import { b as P } from "./controlSurface-t7OEFESJ.js";
|
|
3
|
-
import { u as z } from "./format-B8mJm946.js";
|
|
4
|
-
import { a as T, c as j, _ as H, f as J, b as K } from "./control-7EP4tjYy.js";
|
|
5
|
-
function L(n) {
|
|
6
|
-
const r = n.number(1234.5, { minimumFractionDigits: 1, maximumFractionDigits: 1, useGrouping: !0 }), e = /^\d(\D)\d/.exec(r)?.[1] ?? "";
|
|
7
|
-
return { decimal: r.charAt(r.length - 2) || ".", group: e === "." || e === "," ? e : "" };
|
|
8
|
-
}
|
|
9
|
-
function Q(n, r) {
|
|
10
|
-
const e = n.trim().startsWith("-"), t = n.replace(/[^\d.,]/g, "");
|
|
11
|
-
if (t === "") return e ? void 0 : null;
|
|
12
|
-
const c = [...t].filter((a) => a === "." || a === ",");
|
|
13
|
-
let d = t, p = "";
|
|
14
|
-
if (r.decimals > 0 && c.length > 0) {
|
|
15
|
-
const a = Math.max(t.lastIndexOf("."), t.lastIndexOf(",")), m = t.charAt(a), f = t.slice(a + 1), s = t.includes(".") && t.includes(","), l = c.filter((k) => k === m).length > 1, h = !s && m === r.group && f.length === 3;
|
|
16
|
-
(s || !l && !h) && (d = t.slice(0, a), p = f);
|
|
17
|
-
}
|
|
18
|
-
const g = (a) => a.replace(/\D/g, ""), v = +`${g(d) || "0"}.${g(p) || "0"}`;
|
|
19
|
-
if (!Number.isFinite(v)) return;
|
|
20
|
-
const u = Number(v.toFixed(r.decimals));
|
|
21
|
-
return e ? -u || 0 : u;
|
|
22
|
-
}
|
|
23
|
-
const U = {
|
|
24
|
-
key: 0,
|
|
25
|
-
class: "shrink-0 text-footnote text-content-muted"
|
|
26
|
-
}, X = ["id", "value", "name", "placeholder", "disabled", "required", "aria-required", "aria-invalid", "aria-describedby"], Y = {
|
|
27
|
-
key: 1,
|
|
28
|
-
class: "shrink-0 text-footnote text-content-muted"
|
|
29
|
-
}, ie = /* @__PURE__ */ G({
|
|
30
|
-
__name: "NumberField",
|
|
31
|
-
props: /* @__PURE__ */ E(/* @__PURE__ */ O({
|
|
32
|
-
label: {},
|
|
33
|
-
hint: {},
|
|
34
|
-
error: {},
|
|
35
|
-
required: { type: Boolean },
|
|
36
|
-
editable: { type: Boolean },
|
|
37
|
-
disabled: { type: Boolean },
|
|
38
|
-
lockedReason: {},
|
|
39
|
-
presentation: {},
|
|
40
|
-
name: {},
|
|
41
|
-
decimals: {},
|
|
42
|
-
negative: { type: Boolean },
|
|
43
|
-
grouping: { type: Boolean },
|
|
44
|
-
placeholder: {},
|
|
45
|
-
prefix: {},
|
|
46
|
-
suffix: {},
|
|
47
|
-
width: {}
|
|
48
|
-
}, { ...K, decimals: 0, negative: !1, grouping: !0, placeholder: void 0, prefix: void 0, suffix: void 0, width: "sm" }), {
|
|
49
|
-
modelValue: { default: null },
|
|
50
|
-
modelModifiers: {}
|
|
51
|
-
}),
|
|
52
|
-
emits: ["update:modelValue"],
|
|
53
|
-
setup(n, { expose: r }) {
|
|
54
|
-
const e = n, t = I(n, "modelValue"), c = z(), d = R("input"), p = !!T(), g = j("text", () => e.error ? "error" : e.disabled ? "locked" : "rest"), v = _(() => p ? P(e.width) : "w-full"), u = _(() => L(c)), a = (i) => i === null ? "" : c.number(i, { minimumFractionDigits: e.decimals, maximumFractionDigits: e.decimals, useGrouping: e.grouping }), m = (i) => i === null ? "" : String(i).replace(".", u.value.decimal), f = (i) => Q(i, { decimals: e.decimals, group: e.grouping ? u.value.group : "" }), s = w(!1), l = w(a(t.value));
|
|
55
|
-
F(t, (i) => {
|
|
56
|
-
s.value ? f(l.value) !== i && (l.value = m(i)) : l.value = a(i);
|
|
57
|
-
}), F(() => [e.decimals, e.grouping, u.value.decimal], () => {
|
|
58
|
-
s.value || (l.value = a(t.value));
|
|
59
|
-
});
|
|
60
|
-
function h(i) {
|
|
61
|
-
const x = i.target;
|
|
62
|
-
let o = x.value.replace(/[^\d.,\-\s]/g, "");
|
|
63
|
-
e.negative ? o = o.replace(/(?!^)-/g, "") : o = o.replace(/-/g, ""), o !== x.value && (x.value = o), l.value = o;
|
|
64
|
-
const b = f(o);
|
|
65
|
-
b !== void 0 ? t.value = b : t.value = null;
|
|
66
|
-
}
|
|
67
|
-
function k() {
|
|
68
|
-
s.value = !0, l.value = m(t.value);
|
|
69
|
-
}
|
|
70
|
-
function C() {
|
|
71
|
-
s.value = !1, l.value = a(t.value);
|
|
72
|
-
}
|
|
73
|
-
return r({ focus: () => d.value?.focus() }), (i, x) => (y(), S(H, W(B(J)(e), {
|
|
74
|
-
value: t.value === null ? null : a(t.value),
|
|
75
|
-
prefix: e.prefix,
|
|
76
|
-
suffix: e.suffix,
|
|
77
|
-
"value-style": "numeric"
|
|
78
|
-
}), {
|
|
79
|
-
default: $(({ id: o, describedby: b, invalid: V }) => [
|
|
80
|
-
D("div", {
|
|
81
|
-
class: A(["flex items-center gap-1.5", [B(g), v.value]])
|
|
82
|
-
}, [
|
|
83
|
-
e.prefix ? (y(), q("span", U, N(e.prefix), 1)) : M("", !0),
|
|
84
|
-
D("input", {
|
|
85
|
-
id: o,
|
|
86
|
-
ref_key: "input",
|
|
87
|
-
ref: d,
|
|
88
|
-
value: l.value,
|
|
89
|
-
type: "text",
|
|
90
|
-
inputmode: "decimal",
|
|
91
|
-
autocomplete: "off",
|
|
92
|
-
name: e.name,
|
|
93
|
-
placeholder: e.placeholder,
|
|
94
|
-
disabled: e.disabled,
|
|
95
|
-
required: e.required,
|
|
96
|
-
"aria-required": e.required || void 0,
|
|
97
|
-
"aria-invalid": V || void 0,
|
|
98
|
-
"aria-describedby": b,
|
|
99
|
-
class: "block w-full min-w-0 border-0 bg-transparent px-0 py-1 text-right text-body tabular-nums text-content-strong placeholder:text-content-disabled focus:outline-none focus:ring-0 disabled:cursor-not-allowed",
|
|
100
|
-
onInput: h,
|
|
101
|
-
onFocus: k,
|
|
102
|
-
onBlur: C
|
|
103
|
-
}, null, 40, X),
|
|
104
|
-
e.suffix ? (y(), q("span", Y, N(e.suffix), 1)) : M("", !0)
|
|
105
|
-
], 2)
|
|
106
|
-
]),
|
|
107
|
-
_: 1
|
|
108
|
-
}, 16, ["value", "prefix", "suffix"]));
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
export {
|
|
112
|
-
ie as _
|
|
113
|
-
};
|