@wssto2/vue-core 0.4.21 → 0.4.24
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/CHANGELOG.md +481 -0
- package/dist/{Activity-DX-RK9xj.js → Activity-CI-l_OFl.js} +1 -1
- package/dist/{Changes-_nARQ9IC.js → Changes-BdR0R20V.js} +1 -1
- package/dist/{DeadLetters-O6QReswO.js → DeadLetters-CRTeoZS1.js} +1 -1
- package/dist/FormErrors.vue_vue_type_script_setup_true_lang-DGOSc-PS.js +295 -0
- package/dist/{FormView.vue_vue_type_script_setup_true_lang-Dbfg_jGh.js → FormView.vue_vue_type_script_setup_true_lang-BUrYkjmF.js} +1 -1
- package/dist/{General-CkZoXu29.js → General-hdmVP72B.js} +3 -3
- package/dist/{NewRolePage-OosTaMfZ.js → NewRolePage-BPeKasOp.js} +2 -2
- package/dist/{ProfilePage-Dn8fQ3ff.js → ProfilePage-Dq9lcO5O.js} +3 -3
- package/dist/{RoleEditor.vue_vue_type_script_setup_true_lang-2IOio1Sa.js → RoleEditor.vue_vue_type_script_setup_true_lang-B6g2760V.js} +3 -3
- package/dist/{RolePage-33RUvHYD.js → RolePage-BYH-0fVI.js} +3 -3
- package/dist/{RolesPage-BGPoUCMP.js → RolesPage-BRm5xDw7.js} +1 -1
- package/dist/{Sessions-BbAdbjmG.js → Sessions-B1eKG_I2.js} +1 -1
- package/dist/{SettingsPage-D47NSOYW.js → SettingsPage-0P38Ty4w.js} +3 -3
- package/dist/{SignIn-DDCRzlUq.js → SignIn-Dp8Ji0_r.js} +1 -1
- package/dist/{SignInPage-D9jryXA7.js → SignInPage-CiStJboK.js} +2 -2
- package/dist/{SignIns-C_5sRrB4.js → SignIns-Bo7R2Coi.js} +1 -1
- package/dist/{UserRecord-CUhbz62x.js → UserRecord-DGq_PPy1.js} +3 -3
- package/dist/{UsersList-BE8fnICz.js → UsersList-BulNu4aE.js} +3 -3
- package/dist/access/index.js +1 -1
- package/dist/form/CommandDialog.vue.d.ts +6 -0
- package/dist/form/MonthYearField.vue.d.ts +3 -1
- package/dist/form/index.js +13 -11
- package/dist/form/useCommand.d.ts +4 -1
- package/dist/form/useForm.d.ts +6 -2
- package/dist/form/useRecordDialog.d.ts +2 -2
- package/dist/identity/index.js +1 -1
- package/dist/{index-DiEoRV9D.js → index-BmowiT1y.js} +12 -12
- package/dist/{index-C3HWRCEe.js → index-Yy28omu6.js} +4 -4
- package/dist/{index-D-0JNiFF.js → index-tnSTp0cM.js} +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/notifications/index.js +1 -1
- package/dist/{status-UWWFHi9t.js → status-Bh3-Cg7o.js} +1 -1
- package/dist/{useCommand-VIZE7xG-.js → useCommand-Cj-APj-P.js} +54 -50
- package/dist/{useResourceForm-CP2lCwmD.js → useResourceForm-tGYTfKhH.js} +1 -1
- package/package.json +3 -2
- package/dist/FormErrors.vue_vue_type_script_setup_true_lang-DWcVKZM3.js +0 -285
|
@@ -1,285 +0,0 @@
|
|
|
1
|
-
var Q = Object.defineProperty;
|
|
2
|
-
var X = (s, e, t) => e in s ? Q(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
-
var $ = (s, e, t) => X(s, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { shallowRef as M, computed as w, toRaw as Z, reactive as K, ref as Y, watch as ee, nextTick as te, toValue as re, defineComponent as se, unref as k, openBlock as b, createBlock as ne, withCtx as ae, createElementBlock as y, toDisplayString as O, createCommentVNode as _, Fragment as I, createElementVNode as W, normalizeClass as ie, renderList as le, createTextVNode as U } from "vue";
|
|
5
|
-
import { useI18n as G } from "vue-i18n";
|
|
6
|
-
import { i as oe, a as q } from "./error-CD7x0Jrz.js";
|
|
7
|
-
import { d as ue } from "./describeError-B-NMa--w.js";
|
|
8
|
-
import { _ as ce } from "./Banner.vue_vue_type_script_setup_true_lang-DSStj_5z.js";
|
|
9
|
-
class fe {
|
|
10
|
-
constructor() {
|
|
11
|
-
$(this, "messages", M({}));
|
|
12
|
-
/** How many fields have a message. */
|
|
13
|
-
$(this, "count", w(() => Object.keys(this.messages.value).length));
|
|
14
|
-
}
|
|
15
|
-
/** Replaces everything. Empty lists are dropped. */
|
|
16
|
-
set(e) {
|
|
17
|
-
this.messages.value = Object.fromEntries(Object.entries(e).filter(([, t]) => t.length > 0).map(([t, n]) => [t, [...n]]));
|
|
18
|
-
}
|
|
19
|
-
add(e, t) {
|
|
20
|
-
this.messages.value = { ...this.messages.value, [e]: [...this.messages.value[e] ?? [], t] };
|
|
21
|
-
}
|
|
22
|
-
/** Clears one field (and its nested paths), or everything. */
|
|
23
|
-
clear(e) {
|
|
24
|
-
if (e === void 0) {
|
|
25
|
-
this.count.value > 0 && (this.messages.value = {});
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
const t = Object.fromEntries(Object.entries(this.messages.value).filter(([n]) => n !== e && !n.startsWith(`${e}.`)));
|
|
29
|
-
Object.keys(t).length !== this.count.value && (this.messages.value = t);
|
|
30
|
-
}
|
|
31
|
-
/** Whether the field, or a value inside it (`items.0.quantity` for `items`), has a message. */
|
|
32
|
-
has(e) {
|
|
33
|
-
return this.first(e) !== void 0 || Object.keys(this.messages.value).some((t) => t.startsWith(`${e}.`));
|
|
34
|
-
}
|
|
35
|
-
first(e) {
|
|
36
|
-
return this.messages.value[e]?.[0];
|
|
37
|
-
}
|
|
38
|
-
all() {
|
|
39
|
-
return this.messages.value;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
function f(s) {
|
|
43
|
-
const e = Z(s);
|
|
44
|
-
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(([t, n]) => [t, f(n)]));
|
|
45
|
-
}
|
|
46
|
-
function S(s, e) {
|
|
47
|
-
const t = s, n = e;
|
|
48
|
-
if (Object.is(t, n)) return !0;
|
|
49
|
-
if (t === null || n === null || typeof t != "object" || typeof n != "object") return !1;
|
|
50
|
-
if (t instanceof Date || n instanceof Date) return t instanceof Date && n instanceof Date && t.getTime() === n.getTime();
|
|
51
|
-
if (Array.isArray(t) || Array.isArray(n))
|
|
52
|
-
return Array.isArray(t) && Array.isArray(n) && t.length === n.length && t.every((i, d) => S(i, n[d]));
|
|
53
|
-
if (typeof Blob < "u" && (t instanceof Blob || n instanceof Blob)) return !1;
|
|
54
|
-
const a = (i) => Object.keys(i).filter((d) => i[d] !== void 0), c = a(t);
|
|
55
|
-
return c.length === a(n).length && c.every((i) => S(t[i], n[i]));
|
|
56
|
-
}
|
|
57
|
-
function H(s) {
|
|
58
|
-
const e = {};
|
|
59
|
-
for (const t of s) {
|
|
60
|
-
const n = t.path.map(String).join(".");
|
|
61
|
-
(e[n] ?? (e[n] = [])).push(t.message);
|
|
62
|
-
}
|
|
63
|
-
return e;
|
|
64
|
-
}
|
|
65
|
-
const de = (s) => s.split(".")[0] ?? s, L = () => typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
66
|
-
function _e(s) {
|
|
67
|
-
const { t: e } = G(), t = s.describeFieldError ?? ue(), a = K(f(typeof s.defaults == "function" ? s.defaults() : s.defaults)), c = M(f(a)), i = new fe(), d = Y(!1), m = M(null), A = w(() => !S(a, c.value));
|
|
68
|
-
let E = null, T = L();
|
|
69
|
-
function F(r) {
|
|
70
|
-
const l = a;
|
|
71
|
-
for (const o of Object.keys(l)) o in r || delete l[o];
|
|
72
|
-
Object.assign(l, f(r));
|
|
73
|
-
}
|
|
74
|
-
function C() {
|
|
75
|
-
i.clear(), m.value = null;
|
|
76
|
-
}
|
|
77
|
-
function D(r, l) {
|
|
78
|
-
const o = q(l) ? l.requestId : null, u = s.failureMessage?.(r, l) ?? e(`core.form.failure.${r}`);
|
|
79
|
-
return m.value = { kind: r, message: u, requestId: o, error: l };
|
|
80
|
-
}
|
|
81
|
-
function x(r, l = !1) {
|
|
82
|
-
const { serverField: o } = s, u = t, j = l && o ? Object.entries(r).map(([v, h]) => [o(v), h]) : Object.entries(r);
|
|
83
|
-
i.set(Object.fromEntries(u ? j.map(([v, h]) => [v, h.map((B) => u(B, v))]) : j));
|
|
84
|
-
}
|
|
85
|
-
function z() {
|
|
86
|
-
if (i.clear(), !s.validator) return f(a);
|
|
87
|
-
const r = s.validator.safeParse(f(a));
|
|
88
|
-
return r.success ? r.data : (x(H(r.error.issues)), null);
|
|
89
|
-
}
|
|
90
|
-
function N(r) {
|
|
91
|
-
if (i.clear(), !s.validator) return !0;
|
|
92
|
-
const l = s.validator.safeParse(f(a));
|
|
93
|
-
if (l.success) return !0;
|
|
94
|
-
const o = Object.fromEntries(Object.entries(H(l.error.issues)).filter(([u]) => r.includes(de(u))));
|
|
95
|
-
return x(o), Object.keys(o).length === 0;
|
|
96
|
-
}
|
|
97
|
-
function J(r) {
|
|
98
|
-
if (!q(r)) return "failed";
|
|
99
|
-
switch (r.kind) {
|
|
100
|
-
case "validation":
|
|
101
|
-
return "invalid";
|
|
102
|
-
case "conflict":
|
|
103
|
-
return "conflict";
|
|
104
|
-
case "forbidden":
|
|
105
|
-
return "forbidden";
|
|
106
|
-
case "unauthorized":
|
|
107
|
-
return "unauthorized";
|
|
108
|
-
case "network":
|
|
109
|
-
return "offline";
|
|
110
|
-
default:
|
|
111
|
-
return "failed";
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
async function P(r, l, o, u) {
|
|
115
|
-
if (E) return E;
|
|
116
|
-
const v = (async () => {
|
|
117
|
-
m.value = null;
|
|
118
|
-
const h = r();
|
|
119
|
-
if (h === null) return { status: "failed", failure: D("invalid", null) };
|
|
120
|
-
const B = f(a);
|
|
121
|
-
let p;
|
|
122
|
-
d.value = !0;
|
|
123
|
-
try {
|
|
124
|
-
p = await l(h, { idempotencyKey: T });
|
|
125
|
-
} catch (g) {
|
|
126
|
-
if (d.value = !1, oe(g)) return { status: "aborted" };
|
|
127
|
-
const R = J(g);
|
|
128
|
-
return R === "invalid" && q(g) && x(g.fields, !0), { status: "failed", failure: D(R, g) };
|
|
129
|
-
}
|
|
130
|
-
const V = u?.hydrateFrom?.(p) ?? null;
|
|
131
|
-
V ? (F(V), c.value = f(V), i.clear()) : o(p, B);
|
|
132
|
-
try {
|
|
133
|
-
await u?.refresh?.(p);
|
|
134
|
-
} catch (g) {
|
|
135
|
-
return D("refresh", g), { status: "saved-refresh-failed", value: p, error: g };
|
|
136
|
-
} finally {
|
|
137
|
-
d.value = !1;
|
|
138
|
-
}
|
|
139
|
-
return { status: "saved", value: p };
|
|
140
|
-
})().finally(() => {
|
|
141
|
-
E = null, T = L();
|
|
142
|
-
});
|
|
143
|
-
return E = v, v;
|
|
144
|
-
}
|
|
145
|
-
return {
|
|
146
|
-
values: a,
|
|
147
|
-
errors: i,
|
|
148
|
-
dirty: A,
|
|
149
|
-
submitting: d,
|
|
150
|
-
failure: m,
|
|
151
|
-
bind(r) {
|
|
152
|
-
return {
|
|
153
|
-
get modelValue() {
|
|
154
|
-
return a[r];
|
|
155
|
-
},
|
|
156
|
-
"onUpdate:modelValue"(l) {
|
|
157
|
-
a[r] = l, i.clear(r);
|
|
158
|
-
},
|
|
159
|
-
get error() {
|
|
160
|
-
return i.first(r);
|
|
161
|
-
},
|
|
162
|
-
"data-field-key": r
|
|
163
|
-
};
|
|
164
|
-
},
|
|
165
|
-
bindMonthYear(r, l) {
|
|
166
|
-
const o = a;
|
|
167
|
-
return {
|
|
168
|
-
get month() {
|
|
169
|
-
return o[r] ?? null;
|
|
170
|
-
},
|
|
171
|
-
get year() {
|
|
172
|
-
return o[l] ?? null;
|
|
173
|
-
},
|
|
174
|
-
"onUpdate:month"(u) {
|
|
175
|
-
o[r] = u, i.clear(r);
|
|
176
|
-
},
|
|
177
|
-
"onUpdate:year"(u) {
|
|
178
|
-
o[l] = u, i.clear(l);
|
|
179
|
-
},
|
|
180
|
-
get error() {
|
|
181
|
-
return i.first(r) ?? i.first(l);
|
|
182
|
-
},
|
|
183
|
-
"data-field-key": `${r} ${l}`
|
|
184
|
-
};
|
|
185
|
-
},
|
|
186
|
-
hydrate(r) {
|
|
187
|
-
F(r), c.value = f(r), C();
|
|
188
|
-
},
|
|
189
|
-
reset() {
|
|
190
|
-
F(c.value), C();
|
|
191
|
-
},
|
|
192
|
-
markClean() {
|
|
193
|
-
c.value = f(a);
|
|
194
|
-
},
|
|
195
|
-
validate: z,
|
|
196
|
-
check: N,
|
|
197
|
-
submit: (r, l) => P(z, r, (o, u) => c.value = u, l),
|
|
198
|
-
submitFields: (r, l, o) => P(
|
|
199
|
-
() => N(r) ? Object.fromEntries(r.map((u) => [u, f(a[u])])) : null,
|
|
200
|
-
l,
|
|
201
|
-
(u, j) => {
|
|
202
|
-
const v = f(c.value);
|
|
203
|
-
for (const h of r) v[h] = f(j[h]);
|
|
204
|
-
c.value = v;
|
|
205
|
-
},
|
|
206
|
-
o
|
|
207
|
-
),
|
|
208
|
-
dismissFailure() {
|
|
209
|
-
m.value = null;
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
function me(s) {
|
|
214
|
-
const e = Y([]);
|
|
215
|
-
return ee(
|
|
216
|
-
() => s.form.errors.all(),
|
|
217
|
-
async (t) => {
|
|
218
|
-
await te();
|
|
219
|
-
const n = re(s.root) ?? document, a = new Set([...n.querySelectorAll("[data-field-key]")].flatMap((i) => (i.getAttribute("data-field-key") ?? "").split(/\s+/))), c = (i) => i.split(".").some((d, m, A) => a.has(A.slice(0, m + 1).join(".")));
|
|
220
|
-
e.value = Object.entries(t).flatMap(([i, d]) => d[0] && !c(i) ? [{ field: i, message: d[0] }] : []);
|
|
221
|
-
},
|
|
222
|
-
{ immediate: !0 }
|
|
223
|
-
), w(() => e.value);
|
|
224
|
-
}
|
|
225
|
-
const ve = {
|
|
226
|
-
key: 0,
|
|
227
|
-
class: "text-footnote font-medium"
|
|
228
|
-
}, he = {
|
|
229
|
-
class: "mt-1 list-inside list-disc text-footnote",
|
|
230
|
-
"data-test": "form-errors-hidden"
|
|
231
|
-
}, ge = {
|
|
232
|
-
key: 2,
|
|
233
|
-
class: "mt-1 text-caption text-content-muted"
|
|
234
|
-
}, we = /* @__PURE__ */ se({
|
|
235
|
-
__name: "FormErrors",
|
|
236
|
-
props: {
|
|
237
|
-
form: {},
|
|
238
|
-
label: { type: Function, default: (s) => s },
|
|
239
|
-
scope: { default: null }
|
|
240
|
-
},
|
|
241
|
-
setup(s) {
|
|
242
|
-
const e = s, { t } = G(), n = me({
|
|
243
|
-
get form() {
|
|
244
|
-
return e.form;
|
|
245
|
-
},
|
|
246
|
-
root: () => e.scope
|
|
247
|
-
}), a = w(() => e.form.failure.value), c = w(() => a.value?.kind === "conflict" || a.value?.kind === "refresh" ? "warning" : "critical");
|
|
248
|
-
return (i, d) => a.value || k(n).length ? (b(), ne(ce, {
|
|
249
|
-
key: 0,
|
|
250
|
-
tone: a.value ? c.value : "warning",
|
|
251
|
-
"data-test": "form-errors"
|
|
252
|
-
}, {
|
|
253
|
-
default: ae(() => [
|
|
254
|
-
a.value ? (b(), y("p", ve, O(a.value.message), 1)) : _("", !0),
|
|
255
|
-
k(n).length ? (b(), y(I, { key: 1 }, [
|
|
256
|
-
W("p", {
|
|
257
|
-
class: ie(["text-footnote", a.value ? "mt-1" : "font-medium"])
|
|
258
|
-
}, O(k(t)("core.form.errors.hidden_title")), 3),
|
|
259
|
-
W("ul", he, [
|
|
260
|
-
(b(!0), y(I, null, le(k(n), (m) => (b(), y("li", {
|
|
261
|
-
key: m.field
|
|
262
|
-
}, [
|
|
263
|
-
U(O(m.field ? e.label(m.field) : ""), 1),
|
|
264
|
-
m.field ? (b(), y(I, { key: 0 }, [
|
|
265
|
-
U(": ")
|
|
266
|
-
], 64)) : _("", !0),
|
|
267
|
-
U(O(m.message), 1)
|
|
268
|
-
]))), 128))
|
|
269
|
-
])
|
|
270
|
-
], 64)) : _("", !0),
|
|
271
|
-
a.value?.requestId ? (b(), y("p", ge, O(k(t)("core.form.errors.request", { id: a.value.requestId })), 1)) : _("", !0)
|
|
272
|
-
]),
|
|
273
|
-
_: 1
|
|
274
|
-
}, 8, ["tone"])) : _("", !0);
|
|
275
|
-
}
|
|
276
|
-
});
|
|
277
|
-
export {
|
|
278
|
-
fe as E,
|
|
279
|
-
we as _,
|
|
280
|
-
me as a,
|
|
281
|
-
f as c,
|
|
282
|
-
de as f,
|
|
283
|
-
S as s,
|
|
284
|
-
_e as u
|
|
285
|
-
};
|