@wssto2/vue-core 0.4.23 → 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 +21 -0
- package/dist/{Activity-Cu_mAn_m.js → Activity-CI-l_OFl.js} +1 -1
- package/dist/{Changes-DW_3-MwX.js → Changes-BdR0R20V.js} +1 -1
- package/dist/{DeadLetters-CpcMccCc.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-CbvMRBOc.js → FormView.vue_vue_type_script_setup_true_lang-BUrYkjmF.js} +1 -1
- package/dist/{General-Dbc3qDRz.js → General-hdmVP72B.js} +3 -3
- package/dist/{NewRolePage-DPHFJ0I8.js → NewRolePage-BPeKasOp.js} +2 -2
- package/dist/{ProfilePage-Cc7eiyV2.js → ProfilePage-Dq9lcO5O.js} +3 -3
- package/dist/{RoleEditor.vue_vue_type_script_setup_true_lang-2fpYYCXj.js → RoleEditor.vue_vue_type_script_setup_true_lang-B6g2760V.js} +3 -3
- package/dist/{RolePage-C0jmkQkO.js → RolePage-BYH-0fVI.js} +3 -3
- package/dist/{RolesPage-eb4gqxdW.js → RolesPage-BRm5xDw7.js} +1 -1
- package/dist/{Sessions-DSDcj8Yd.js → Sessions-B1eKG_I2.js} +1 -1
- package/dist/{SettingsPage-BF7MW1GH.js → SettingsPage-0P38Ty4w.js} +3 -3
- package/dist/{SignIn-BR8-RVIk.js → SignIn-Dp8Ji0_r.js} +1 -1
- package/dist/{SignInPage-Dcws582A.js → SignInPage-CiStJboK.js} +2 -2
- package/dist/{SignIns-3u7YgKqh.js → SignIns-Bo7R2Coi.js} +1 -1
- package/dist/{UserRecord-AtZIwCO9.js → UserRecord-DGq_PPy1.js} +3 -3
- package/dist/{UsersList-1IeQnvOL.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/index.js +8 -8
- package/dist/form/useForm.d.ts +5 -1
- package/dist/form/useRecordDialog.d.ts +2 -2
- package/dist/identity/index.js +1 -1
- package/dist/{index--CxZ33h0.js → index-BmowiT1y.js} +12 -12
- package/dist/{index-Du3Ti2Zp.js → index-Yy28omu6.js} +4 -4
- package/dist/{index-DBTK_iMB.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-QOGPjIHu.js → status-Bh3-Cg7o.js} +1 -1
- package/dist/{useCommand-CT1RF_IB.js → useCommand-Cj-APj-P.js} +53 -50
- package/dist/{useResourceForm-CQuniKhd.js → useResourceForm-tGYTfKhH.js} +1 -1
- package/package.json +1 -1
- package/dist/FormErrors.vue_vue_type_script_setup_true_lang-4WQz-TYS.js +0 -286
|
@@ -1,286 +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 le, renderList as ie, createTextVNode as U } from "vue";
|
|
5
|
-
import { useI18n as G } from "vue-i18n";
|
|
6
|
-
import { i as ue, a as q } from "./error-CD7x0Jrz.js";
|
|
7
|
-
import { d as oe } 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 d(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(d) : Object.fromEntries(Object.entries(e).map(([t, n]) => [t, d(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((l, m) => S(l, n[m]));
|
|
53
|
-
if (typeof Blob < "u" && (t instanceof Blob || n instanceof Blob)) return !1;
|
|
54
|
-
const a = (l) => Object.keys(l).filter((m) => l[m] !== void 0), c = a(t);
|
|
55
|
-
return c.length === a(n).length && c.every((l) => S(t[l], n[l]));
|
|
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 ?? oe(), a = K(d(typeof s.defaults == "function" ? s.defaults() : s.defaults)), c = M(d(a)), l = new fe(), m = Y(!1), f = M(null), A = w(() => !S(a, c.value));
|
|
68
|
-
let E = null, T = L();
|
|
69
|
-
function F(r) {
|
|
70
|
-
const i = a;
|
|
71
|
-
for (const u of Object.keys(i)) u in r || delete i[u];
|
|
72
|
-
Object.assign(i, d(r));
|
|
73
|
-
}
|
|
74
|
-
function C() {
|
|
75
|
-
l.clear(), f.value = null;
|
|
76
|
-
}
|
|
77
|
-
function D(r, i) {
|
|
78
|
-
const u = q(i) ? i.requestId : null, o = s.failureMessage?.(r, i) ?? e(`core.form.failure.${r}`);
|
|
79
|
-
return f.value = { kind: r, message: o, requestId: u, error: i };
|
|
80
|
-
}
|
|
81
|
-
function x(r, i = !1) {
|
|
82
|
-
const { serverField: u } = s, o = t, j = i && u ? Object.entries(r).map(([v, h]) => [u(v), h]) : Object.entries(r);
|
|
83
|
-
l.set(Object.fromEntries(o ? j.map(([v, h]) => [v, h.map((B) => o(B, v))]) : j));
|
|
84
|
-
}
|
|
85
|
-
function z() {
|
|
86
|
-
if (l.clear(), !s.validator)
|
|
87
|
-
return f.value = null, d(a);
|
|
88
|
-
const r = s.validator.safeParse(d(a));
|
|
89
|
-
return r.success ? (f.value = null, r.data) : (x(H(r.error.issues)), null);
|
|
90
|
-
}
|
|
91
|
-
function N(r) {
|
|
92
|
-
if (l.clear(), !s.validator) return !0;
|
|
93
|
-
const i = s.validator.safeParse(d(a));
|
|
94
|
-
if (i.success) return !0;
|
|
95
|
-
const u = Object.fromEntries(Object.entries(H(i.error.issues)).filter(([o]) => r.includes(de(o))));
|
|
96
|
-
return x(u), Object.keys(u).length === 0;
|
|
97
|
-
}
|
|
98
|
-
function J(r) {
|
|
99
|
-
if (!q(r)) return "failed";
|
|
100
|
-
switch (r.kind) {
|
|
101
|
-
case "validation":
|
|
102
|
-
return "invalid";
|
|
103
|
-
case "conflict":
|
|
104
|
-
return "conflict";
|
|
105
|
-
case "forbidden":
|
|
106
|
-
return "forbidden";
|
|
107
|
-
case "unauthorized":
|
|
108
|
-
return "unauthorized";
|
|
109
|
-
case "network":
|
|
110
|
-
return "offline";
|
|
111
|
-
default:
|
|
112
|
-
return "failed";
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
async function P(r, i, u, o) {
|
|
116
|
-
if (E) return E;
|
|
117
|
-
const v = (async () => {
|
|
118
|
-
f.value = null;
|
|
119
|
-
const h = r();
|
|
120
|
-
if (h === null) return { status: "failed", failure: D("invalid", null) };
|
|
121
|
-
const B = d(a);
|
|
122
|
-
let p;
|
|
123
|
-
m.value = !0;
|
|
124
|
-
try {
|
|
125
|
-
p = await i(h, { idempotencyKey: T });
|
|
126
|
-
} catch (g) {
|
|
127
|
-
if (m.value = !1, ue(g)) return { status: "aborted" };
|
|
128
|
-
const R = J(g);
|
|
129
|
-
return R === "invalid" && q(g) && x(g.fields, !0), { status: "failed", failure: D(R, g) };
|
|
130
|
-
}
|
|
131
|
-
const V = o?.hydrateFrom?.(p) ?? null;
|
|
132
|
-
V ? (F(V), c.value = d(V), l.clear()) : u(p, B);
|
|
133
|
-
try {
|
|
134
|
-
await o?.refresh?.(p);
|
|
135
|
-
} catch (g) {
|
|
136
|
-
return D("refresh", g), { status: "saved-refresh-failed", value: p, error: g };
|
|
137
|
-
} finally {
|
|
138
|
-
m.value = !1;
|
|
139
|
-
}
|
|
140
|
-
return { status: "saved", value: p };
|
|
141
|
-
})().finally(() => {
|
|
142
|
-
E = null, T = L();
|
|
143
|
-
});
|
|
144
|
-
return E = v, v;
|
|
145
|
-
}
|
|
146
|
-
return {
|
|
147
|
-
values: a,
|
|
148
|
-
errors: l,
|
|
149
|
-
dirty: A,
|
|
150
|
-
submitting: m,
|
|
151
|
-
failure: f,
|
|
152
|
-
bind(r) {
|
|
153
|
-
return {
|
|
154
|
-
get modelValue() {
|
|
155
|
-
return a[r];
|
|
156
|
-
},
|
|
157
|
-
"onUpdate:modelValue"(i) {
|
|
158
|
-
a[r] = i, l.clear(r);
|
|
159
|
-
},
|
|
160
|
-
get error() {
|
|
161
|
-
return l.first(r);
|
|
162
|
-
},
|
|
163
|
-
"data-field-key": r
|
|
164
|
-
};
|
|
165
|
-
},
|
|
166
|
-
bindMonthYear(r, i) {
|
|
167
|
-
const u = a;
|
|
168
|
-
return {
|
|
169
|
-
get month() {
|
|
170
|
-
return u[r] ?? null;
|
|
171
|
-
},
|
|
172
|
-
get year() {
|
|
173
|
-
return u[i] ?? null;
|
|
174
|
-
},
|
|
175
|
-
"onUpdate:month"(o) {
|
|
176
|
-
u[r] = o, l.clear(r);
|
|
177
|
-
},
|
|
178
|
-
"onUpdate:year"(o) {
|
|
179
|
-
u[i] = o, l.clear(i);
|
|
180
|
-
},
|
|
181
|
-
get error() {
|
|
182
|
-
return l.first(r) ?? l.first(i);
|
|
183
|
-
},
|
|
184
|
-
"data-field-key": `${r} ${i}`
|
|
185
|
-
};
|
|
186
|
-
},
|
|
187
|
-
hydrate(r) {
|
|
188
|
-
F(r), c.value = d(r), C();
|
|
189
|
-
},
|
|
190
|
-
reset() {
|
|
191
|
-
F(c.value), C();
|
|
192
|
-
},
|
|
193
|
-
markClean() {
|
|
194
|
-
c.value = d(a);
|
|
195
|
-
},
|
|
196
|
-
validate: z,
|
|
197
|
-
check: N,
|
|
198
|
-
submit: (r, i) => P(z, r, (u, o) => c.value = o, i),
|
|
199
|
-
submitFields: (r, i, u) => P(
|
|
200
|
-
() => N(r) ? Object.fromEntries(r.map((o) => [o, d(a[o])])) : null,
|
|
201
|
-
i,
|
|
202
|
-
(o, j) => {
|
|
203
|
-
const v = d(c.value);
|
|
204
|
-
for (const h of r) v[h] = d(j[h]);
|
|
205
|
-
c.value = v;
|
|
206
|
-
},
|
|
207
|
-
u
|
|
208
|
-
),
|
|
209
|
-
dismissFailure() {
|
|
210
|
-
f.value = null;
|
|
211
|
-
}
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
function me(s) {
|
|
215
|
-
const e = Y([]);
|
|
216
|
-
return ee(
|
|
217
|
-
() => s.form.errors.all(),
|
|
218
|
-
async (t) => {
|
|
219
|
-
await te();
|
|
220
|
-
const n = re(s.root) ?? document, a = new Set([...n.querySelectorAll("[data-field-key]")].flatMap((l) => (l.getAttribute("data-field-key") ?? "").split(/\s+/))), c = (l) => l.split(".").some((m, f, A) => a.has(A.slice(0, f + 1).join(".")));
|
|
221
|
-
e.value = Object.entries(t).flatMap(([l, m]) => m[0] && !c(l) ? [{ field: l, message: m[0] }] : []);
|
|
222
|
-
},
|
|
223
|
-
{ immediate: !0 }
|
|
224
|
-
), w(() => e.value);
|
|
225
|
-
}
|
|
226
|
-
const ve = {
|
|
227
|
-
key: 0,
|
|
228
|
-
class: "text-footnote font-medium"
|
|
229
|
-
}, he = {
|
|
230
|
-
class: "mt-1 list-inside list-disc text-footnote",
|
|
231
|
-
"data-test": "form-errors-hidden"
|
|
232
|
-
}, ge = {
|
|
233
|
-
key: 2,
|
|
234
|
-
class: "mt-1 text-caption text-content-muted"
|
|
235
|
-
}, we = /* @__PURE__ */ se({
|
|
236
|
-
__name: "FormErrors",
|
|
237
|
-
props: {
|
|
238
|
-
form: {},
|
|
239
|
-
label: { type: Function, default: (s) => s },
|
|
240
|
-
scope: { default: null }
|
|
241
|
-
},
|
|
242
|
-
setup(s) {
|
|
243
|
-
const e = s, { t } = G(), n = me({
|
|
244
|
-
get form() {
|
|
245
|
-
return e.form;
|
|
246
|
-
},
|
|
247
|
-
root: () => e.scope
|
|
248
|
-
}), a = w(() => e.form.failure.value), c = w(() => a.value?.kind === "conflict" || a.value?.kind === "refresh" ? "warning" : "critical");
|
|
249
|
-
return (l, m) => a.value || k(n).length ? (b(), ne(ce, {
|
|
250
|
-
key: 0,
|
|
251
|
-
tone: a.value ? c.value : "warning",
|
|
252
|
-
"data-test": "form-errors"
|
|
253
|
-
}, {
|
|
254
|
-
default: ae(() => [
|
|
255
|
-
a.value ? (b(), y("p", ve, O(a.value.message), 1)) : _("", !0),
|
|
256
|
-
k(n).length ? (b(), y(I, { key: 1 }, [
|
|
257
|
-
W("p", {
|
|
258
|
-
class: le(["text-footnote", a.value ? "mt-1" : "font-medium"])
|
|
259
|
-
}, O(k(t)("core.form.errors.hidden_title")), 3),
|
|
260
|
-
W("ul", he, [
|
|
261
|
-
(b(!0), y(I, null, ie(k(n), (f) => (b(), y("li", {
|
|
262
|
-
key: f.field
|
|
263
|
-
}, [
|
|
264
|
-
U(O(f.field ? e.label(f.field) : ""), 1),
|
|
265
|
-
f.field ? (b(), y(I, { key: 0 }, [
|
|
266
|
-
U(": ")
|
|
267
|
-
], 64)) : _("", !0),
|
|
268
|
-
U(O(f.message), 1)
|
|
269
|
-
]))), 128))
|
|
270
|
-
])
|
|
271
|
-
], 64)) : _("", !0),
|
|
272
|
-
a.value?.requestId ? (b(), y("p", ge, O(k(t)("core.form.errors.request", { id: a.value.requestId })), 1)) : _("", !0)
|
|
273
|
-
]),
|
|
274
|
-
_: 1
|
|
275
|
-
}, 8, ["tone"])) : _("", !0);
|
|
276
|
-
}
|
|
277
|
-
});
|
|
278
|
-
export {
|
|
279
|
-
fe as E,
|
|
280
|
-
we as _,
|
|
281
|
-
me as a,
|
|
282
|
-
d as c,
|
|
283
|
-
de as f,
|
|
284
|
-
S as s,
|
|
285
|
-
_e as u
|
|
286
|
-
};
|