@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,320 @@
|
|
|
1
|
+
import { inject as q, ref as z, computed as r, onBeforeUnmount as A, defineComponent as C, useSlots as F, openBlock as l, createBlock as L, resolveDynamicComponent as T, unref as t, normalizeClass as b, withCtx as _, createElementBlock as s, renderSlot as v, createCommentVNode as n, createElementVNode as x, createTextVNode as h, toDisplayString as f, createVNode as V, useAttrs as G, useId as K, mergeProps as j, createSlots as P, mergeDefaults as M } from "vue";
|
|
2
|
+
import { useI18n as O } from "vue-i18n";
|
|
3
|
+
import { _ as I } from "./Icon.vue_vue_type_script_lang-D7oC-d-S.js";
|
|
4
|
+
import { RouterLink as U } from "vue-router";
|
|
5
|
+
import { c as Y, a as J } from "./controlSurface-t7OEFESJ.js";
|
|
6
|
+
import { u as Q } from "./mediaQuery-CygcXmFW.js";
|
|
7
|
+
const W = {
|
|
8
|
+
label: void 0,
|
|
9
|
+
labelHidden: !1,
|
|
10
|
+
hint: void 0,
|
|
11
|
+
error: void 0,
|
|
12
|
+
required: !1,
|
|
13
|
+
editable: !0,
|
|
14
|
+
disabled: !1,
|
|
15
|
+
lockedReason: void 0,
|
|
16
|
+
presentation: "control",
|
|
17
|
+
name: void 0
|
|
18
|
+
}, X = Symbol("vue-core.formGroup"), Z = Symbol("vue-core.formRowIndent"), ee = Symbol("vue-core.formEditable"), B = () => q(X, null), te = () => q(Z, 0);
|
|
19
|
+
function oe(i) {
|
|
20
|
+
const e = B(), d = q(ee, z(!0)), c = Q(), k = r(() => !!e && !!i.disabled && (c.value || i.presentation === "value")), m = r(() => (i.editable ?? !0) && d.value && !k.value), o = r(() => !!e && !!i.disabled && m.value);
|
|
21
|
+
if (e) {
|
|
22
|
+
const u = e.registerLocked(r(() => !!i.disabled && d.value && i.presentation !== "value"));
|
|
23
|
+
A(u);
|
|
24
|
+
}
|
|
25
|
+
return { editable: m, locked: o };
|
|
26
|
+
}
|
|
27
|
+
const le = ["label", "labelHidden", "hint", "error", "required", "editable", "disabled", "lockedReason", "presentation", "name"];
|
|
28
|
+
function qe(i) {
|
|
29
|
+
return Object.fromEntries(le.map((e) => [e, i[e]]));
|
|
30
|
+
}
|
|
31
|
+
const ae = {
|
|
32
|
+
key: 0,
|
|
33
|
+
class: "flex shrink-0 items-center"
|
|
34
|
+
}, re = { class: "row-body min-h-row min-w-0 flex-1 border-t border-border-separator py-2 pr-row-inset" }, se = {
|
|
35
|
+
key: 0,
|
|
36
|
+
class: "text-content-destructive",
|
|
37
|
+
"aria-hidden": "true"
|
|
38
|
+
}, ne = ["id"], ie = {
|
|
39
|
+
key: 0,
|
|
40
|
+
class: "break-words text-body text-content-strong"
|
|
41
|
+
}, de = ["id"], ue = /* @__PURE__ */ C({
|
|
42
|
+
__name: "FormRow",
|
|
43
|
+
props: {
|
|
44
|
+
label: { default: void 0 },
|
|
45
|
+
labelHidden: { type: Boolean, default: !1 },
|
|
46
|
+
for: { default: void 0 },
|
|
47
|
+
sub: { default: void 0 },
|
|
48
|
+
subId: { default: void 0 },
|
|
49
|
+
required: { type: Boolean, default: !1 },
|
|
50
|
+
layout: { default: "entry" },
|
|
51
|
+
value: { default: void 0 },
|
|
52
|
+
to: { default: void 0 },
|
|
53
|
+
error: { default: void 0 },
|
|
54
|
+
errorId: { default: void 0 },
|
|
55
|
+
indent: { default: 0 },
|
|
56
|
+
labelLines: { default: void 0 },
|
|
57
|
+
labelAlign: { default: "center" }
|
|
58
|
+
},
|
|
59
|
+
setup(i) {
|
|
60
|
+
const e = i, d = F(), c = te(), k = r(() => c + e.indent), m = ["pl-row-inset", "pl-[calc(var(--app-row-inset)+1.25rem)]", "pl-[calc(var(--app-row-inset)+2.5rem)]"], o = { 1: "line-clamp-1", 2: "line-clamp-2", 3: "line-clamp-3" }, u = r(() => e.labelHidden && (e.layout === "entry" || e.layout === "value") ? "stacked" : e.layout), S = r(() => {
|
|
61
|
+
switch (u.value) {
|
|
62
|
+
case "entry":
|
|
63
|
+
return "grid grid-cols-[var(--form-label-width,11rem)_minmax(0,1fr)] items-center gap-x-4 compact:grid-cols-[minmax(0,auto)_minmax(40%,1fr)]";
|
|
64
|
+
case "value":
|
|
65
|
+
return "grid grid-cols-[minmax(min-content,1fr)_minmax(0,auto)] items-center gap-x-4";
|
|
66
|
+
case "setting":
|
|
67
|
+
return "flex items-center gap-4";
|
|
68
|
+
default:
|
|
69
|
+
return "flex flex-col gap-1";
|
|
70
|
+
}
|
|
71
|
+
}), p = r(() => e.labelHidden ? "sr-only" : u.value === "stacked" ? "text-footnote text-content-muted" : e.layout === "value" ? "text-body text-content-muted" : "text-body text-content-strong"), w = r(() => e.value !== void 0 && e.value !== null && e.value !== "");
|
|
72
|
+
return (y, g) => (l(), L(T(e.to ? t(U) : "div"), {
|
|
73
|
+
to: e.to,
|
|
74
|
+
"data-test": "form-row",
|
|
75
|
+
"data-layout": u.value,
|
|
76
|
+
"data-field-error": e.error ? "true" : void 0,
|
|
77
|
+
class: b(["form-row flex min-w-0 items-stretch gap-3 transition-colors duration-motion-fast first:rounded-t-group last:rounded-b-group focus-within:bg-tint-soft/50 [&:first-child>.row-body]:border-t-0", [m[Math.min(k.value, 2)], e.to ? "hover:bg-fill focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-border-focus" : ""]])
|
|
78
|
+
}, {
|
|
79
|
+
default: _(() => [
|
|
80
|
+
d.leading ? (l(), s("div", ae, [
|
|
81
|
+
v(y.$slots, "leading")
|
|
82
|
+
])) : n("", !0),
|
|
83
|
+
x("div", re, [
|
|
84
|
+
x("div", {
|
|
85
|
+
class: b(["min-w-0", S.value])
|
|
86
|
+
}, [
|
|
87
|
+
e.label || e.sub || d.sub ? (l(), s("div", {
|
|
88
|
+
key: 0,
|
|
89
|
+
class: b([e.labelHidden && !e.sub && !d.sub ? "contents" : u.value === "setting" ? "min-w-min flex-1" : "min-w-0", e.labelAlign === "top" ? "self-start pt-1" : ""])
|
|
90
|
+
}, [
|
|
91
|
+
x("div", {
|
|
92
|
+
class: b(d["label-trailing"] ? "flex items-center justify-between gap-3" : "")
|
|
93
|
+
}, [
|
|
94
|
+
(l(), L(T(e.for ? "label" : "span"), {
|
|
95
|
+
for: e.for,
|
|
96
|
+
class: b(["break-words", [p.value, e.labelHidden ? "" : e.labelLines ? o[e.labelLines] : "block"]])
|
|
97
|
+
}, {
|
|
98
|
+
default: _(() => [
|
|
99
|
+
h(f(e.label), 1),
|
|
100
|
+
e.required ? (l(), s("span", se, " *")) : n("", !0)
|
|
101
|
+
]),
|
|
102
|
+
_: 1
|
|
103
|
+
}, 8, ["for", "class"])),
|
|
104
|
+
v(y.$slots, "label-trailing")
|
|
105
|
+
], 2),
|
|
106
|
+
e.sub || d.sub ? (l(), s("small", {
|
|
107
|
+
key: 0,
|
|
108
|
+
id: e.subId,
|
|
109
|
+
class: "mt-0.5 block text-footnote text-content-muted"
|
|
110
|
+
}, [
|
|
111
|
+
v(y.$slots, "sub", {}, () => [
|
|
112
|
+
h(f(e.sub), 1)
|
|
113
|
+
])
|
|
114
|
+
], 8, ne)) : n("", !0)
|
|
115
|
+
], 2)) : n("", !0),
|
|
116
|
+
x("div", {
|
|
117
|
+
class: b(["flex min-w-0 items-center gap-2", u.value === "value" ? "justify-end text-right" : u.value === "setting" ? "flex-wrap justify-end text-right" : u.value === "entry" ? "compact:justify-end" : ""])
|
|
118
|
+
}, [
|
|
119
|
+
v(y.$slots, "default", {}, () => [
|
|
120
|
+
w.value ? (l(), s("span", ie, f(e.value), 1)) : n("", !0)
|
|
121
|
+
]),
|
|
122
|
+
v(y.$slots, "trailing"),
|
|
123
|
+
e.to ? (l(), L(t(I), {
|
|
124
|
+
key: 0,
|
|
125
|
+
name: "arrowRightSLine",
|
|
126
|
+
size: 18,
|
|
127
|
+
class: "shrink-0 text-content-disabled"
|
|
128
|
+
})) : n("", !0)
|
|
129
|
+
], 2)
|
|
130
|
+
], 2),
|
|
131
|
+
e.error ? (l(), s("p", {
|
|
132
|
+
key: 0,
|
|
133
|
+
id: e.errorId,
|
|
134
|
+
class: "mt-1 flex items-start gap-1.5 text-footnote text-content-destructive",
|
|
135
|
+
role: "alert"
|
|
136
|
+
}, [
|
|
137
|
+
V(t(I), {
|
|
138
|
+
name: "alertTriangle",
|
|
139
|
+
size: 14,
|
|
140
|
+
class: "mt-px shrink-0"
|
|
141
|
+
}),
|
|
142
|
+
h(" " + f(e.error), 1)
|
|
143
|
+
], 8, de)) : n("", !0)
|
|
144
|
+
])
|
|
145
|
+
]),
|
|
146
|
+
_: 3
|
|
147
|
+
}, 8, ["to", "data-layout", "data-field-error", "class"]));
|
|
148
|
+
}
|
|
149
|
+
}), ce = ["title"], fe = {
|
|
150
|
+
key: 0,
|
|
151
|
+
class: "mr-1"
|
|
152
|
+
}, ve = {
|
|
153
|
+
key: 1,
|
|
154
|
+
class: "ml-1 text-content-muted"
|
|
155
|
+
}, me = {
|
|
156
|
+
key: 3,
|
|
157
|
+
class: "block text-body text-content-disabled"
|
|
158
|
+
}, be = {
|
|
159
|
+
key: 0,
|
|
160
|
+
class: "sr-only"
|
|
161
|
+
}, ye = ["data-field-error"], pe = ["for"], ge = {
|
|
162
|
+
key: 0,
|
|
163
|
+
class: "text-content-destructive",
|
|
164
|
+
"aria-hidden": "true"
|
|
165
|
+
}, xe = ["id"], he = ["id"], Be = /* @__PURE__ */ C({
|
|
166
|
+
__name: "Field",
|
|
167
|
+
props: /* @__PURE__ */ M({
|
|
168
|
+
label: {},
|
|
169
|
+
labelHidden: { type: Boolean },
|
|
170
|
+
hint: {},
|
|
171
|
+
error: {},
|
|
172
|
+
required: { type: Boolean },
|
|
173
|
+
editable: { type: Boolean },
|
|
174
|
+
disabled: { type: Boolean },
|
|
175
|
+
lockedReason: {},
|
|
176
|
+
presentation: {},
|
|
177
|
+
name: {},
|
|
178
|
+
value: { type: [String, Number, Boolean, null] },
|
|
179
|
+
prefix: {},
|
|
180
|
+
suffix: {},
|
|
181
|
+
valueStyle: {},
|
|
182
|
+
rowLayout: {},
|
|
183
|
+
rowLabelAlign: {}
|
|
184
|
+
}, { ...W, value: void 0, prefix: void 0, suffix: void 0, valueStyle: void 0, rowLayout: "entry", rowLabelAlign: "center" }),
|
|
185
|
+
setup(i) {
|
|
186
|
+
const e = i, { t: d } = O(), c = F(), k = G(), m = B(), { editable: o, locked: u } = oe(e), S = K(), p = r(() => e.name ?? S), w = r(() => `${p.value}-hint`), y = r(() => `${p.value}-error`);
|
|
187
|
+
if (m?.registerField) {
|
|
188
|
+
const a = k["data-field-key"], N = m.registerField(typeof a == "string" ? a : void 0, r(() => e.disabled));
|
|
189
|
+
A(N);
|
|
190
|
+
}
|
|
191
|
+
const g = r(() => {
|
|
192
|
+
const a = e.value;
|
|
193
|
+
return a == null ? !1 : typeof a == "string" ? a.length > 0 : typeof a == "number" ? !Number.isNaN(a) : !0;
|
|
194
|
+
}), R = r(() => typeof e.value == "boolean" ? e.value ? d("core.form.yes") : d("core.form.no") : e.value), D = r(() => !!m && !o.value && m.hideEmpty.value && !g.value && !c.readonly), E = r(() => [e.hint && o.value ? w.value : null, e.error ? y.value : null].filter(Boolean).join(" ") || void 0), $ = r(() => {
|
|
195
|
+
const a = o.value ? e.rowLayout : e.rowLayout === "stacked" ? "stacked" : "value";
|
|
196
|
+
return e.labelHidden && (a === "entry" || a === "value") ? "stacked" : a;
|
|
197
|
+
}), H = r(
|
|
198
|
+
() => o.value && !u.value && e.required ? { "data-field-required": "true", "data-field-filled": g.value ? "true" : void 0 } : {}
|
|
199
|
+
);
|
|
200
|
+
return (a, N) => t(m) && !D.value ? (l(), L(ue, j({ key: 0 }, H.value, {
|
|
201
|
+
label: e.label,
|
|
202
|
+
"label-hidden": e.labelHidden,
|
|
203
|
+
for: t(o) ? p.value : void 0,
|
|
204
|
+
sub: t(o) ? e.hint : void 0,
|
|
205
|
+
"sub-id": w.value,
|
|
206
|
+
required: t(o) && !t(u) && e.required,
|
|
207
|
+
layout: $.value,
|
|
208
|
+
"label-align": $.value === "entry" ? e.rowLabelAlign : void 0,
|
|
209
|
+
error: t(o) ? e.error : void 0,
|
|
210
|
+
"error-id": y.value,
|
|
211
|
+
"data-field-locked": t(u) ? "true" : void 0
|
|
212
|
+
}), P({
|
|
213
|
+
default: _(() => [
|
|
214
|
+
x("div", {
|
|
215
|
+
class: "relative w-full min-w-0",
|
|
216
|
+
title: t(u) ? e.lockedReason : void 0
|
|
217
|
+
}, [
|
|
218
|
+
x("div", {
|
|
219
|
+
class: b(t(o) ? $.value === "setting" ? "flex min-w-0 flex-col items-end" : $.value === "stacked" ? "flex min-w-0 flex-col items-stretch" : "flex min-w-0 flex-col items-start compact:items-end" : "")
|
|
220
|
+
}, [
|
|
221
|
+
t(o) ? v(a.$slots, "default", {
|
|
222
|
+
id: p.value,
|
|
223
|
+
describedby: E.value,
|
|
224
|
+
invalid: !!e.error,
|
|
225
|
+
required: e.required,
|
|
226
|
+
disabled: e.disabled
|
|
227
|
+
}, void 0, void 0, 0) : t(c).readonly ? v(a.$slots, "readonly", {}, void 0, void 0, 1) : g.value ? (l(), s("span", {
|
|
228
|
+
key: 2,
|
|
229
|
+
class: b(["block break-words text-body text-content-strong", e.valueStyle === "mono" ? "font-mono" : e.valueStyle === "numeric" ? "tabular-nums" : ""])
|
|
230
|
+
}, [
|
|
231
|
+
e.prefix ? (l(), s("span", fe, f(e.prefix), 1)) : n("", !0),
|
|
232
|
+
h(f(R.value), 1),
|
|
233
|
+
e.suffix ? (l(), s("span", ve, f(e.suffix), 1)) : n("", !0)
|
|
234
|
+
], 2)) : (l(), s("span", me, f(t(d)("core.state.no_value")), 1))
|
|
235
|
+
], 2)
|
|
236
|
+
], 8, ce),
|
|
237
|
+
t(u) && e.lockedReason ? (l(), s("span", be, f(e.lockedReason), 1)) : n("", !0)
|
|
238
|
+
]),
|
|
239
|
+
_: 2
|
|
240
|
+
}, [
|
|
241
|
+
t(o) && t(c).trailing ? {
|
|
242
|
+
name: "trailing",
|
|
243
|
+
fn: _(() => [
|
|
244
|
+
v(a.$slots, "trailing")
|
|
245
|
+
]),
|
|
246
|
+
key: "0"
|
|
247
|
+
} : void 0,
|
|
248
|
+
t(o) && t(c).labelTrailing ? {
|
|
249
|
+
name: "label-trailing",
|
|
250
|
+
fn: _(() => [
|
|
251
|
+
v(a.$slots, "labelTrailing")
|
|
252
|
+
]),
|
|
253
|
+
key: "1"
|
|
254
|
+
} : void 0
|
|
255
|
+
]), 1040, ["label", "label-hidden", "for", "sub", "sub-id", "required", "layout", "label-align", "error", "error-id", "data-field-locked"])) : t(m) ? n("", !0) : (l(), s("div", j({ key: 1 }, H.value, {
|
|
256
|
+
"data-field-error": e.error ? "true" : void 0,
|
|
257
|
+
class: "flex min-w-0 flex-col gap-1"
|
|
258
|
+
}), [
|
|
259
|
+
e.label || t(o) && t(c).labelTrailing ? (l(), s("div", {
|
|
260
|
+
key: 0,
|
|
261
|
+
class: b(e.labelHidden && !(t(o) && t(c).labelTrailing) ? "contents" : "flex items-center justify-between gap-3")
|
|
262
|
+
}, [
|
|
263
|
+
e.label ? (l(), s("label", {
|
|
264
|
+
key: 0,
|
|
265
|
+
for: t(o) ? p.value : void 0,
|
|
266
|
+
class: b(e.labelHidden ? "sr-only" : "text-footnote font-medium text-content-muted")
|
|
267
|
+
}, [
|
|
268
|
+
h(f(e.label), 1),
|
|
269
|
+
t(o) && e.required ? (l(), s("span", ge, " *")) : n("", !0)
|
|
270
|
+
], 10, pe)) : n("", !0),
|
|
271
|
+
t(o) ? v(a.$slots, "labelTrailing", {}, void 0, void 0, 1) : n("", !0)
|
|
272
|
+
], 2)) : n("", !0),
|
|
273
|
+
t(o) ? v(a.$slots, "default", {
|
|
274
|
+
id: p.value,
|
|
275
|
+
describedby: E.value,
|
|
276
|
+
invalid: !!e.error,
|
|
277
|
+
required: e.required,
|
|
278
|
+
disabled: e.disabled
|
|
279
|
+
}, void 0, void 0, 1) : t(c).readonly ? v(a.$slots, "readonly", {}, void 0, void 0, 2) : (l(), s("span", {
|
|
280
|
+
key: 3,
|
|
281
|
+
class: b(["text-body", g.value ? "text-content-strong" : "text-content-disabled"])
|
|
282
|
+
}, f(g.value ? `${e.prefix ?? ""}${R.value}${e.suffix ?? ""}` : t(d)("core.state.no_value")), 3)),
|
|
283
|
+
e.hint && t(o) ? (l(), s("p", {
|
|
284
|
+
key: 4,
|
|
285
|
+
id: w.value,
|
|
286
|
+
class: "text-footnote text-content-muted"
|
|
287
|
+
}, f(e.hint), 9, xe)) : n("", !0),
|
|
288
|
+
e.error ? (l(), s("p", {
|
|
289
|
+
key: 5,
|
|
290
|
+
id: y.value,
|
|
291
|
+
role: "alert",
|
|
292
|
+
class: "flex items-start gap-1.5 text-footnote text-content-destructive"
|
|
293
|
+
}, [
|
|
294
|
+
V(t(I), {
|
|
295
|
+
name: "alertTriangle",
|
|
296
|
+
size: 14,
|
|
297
|
+
class: "mt-px shrink-0"
|
|
298
|
+
}),
|
|
299
|
+
h(" " + f(e.error), 1)
|
|
300
|
+
], 8, he)) : n("", !0)
|
|
301
|
+
], 16, ye));
|
|
302
|
+
}
|
|
303
|
+
}), ke = "rounded-control transition-[background-color,box-shadow,opacity] duration-motion-fast ease-motion-standard";
|
|
304
|
+
function Re(i, e) {
|
|
305
|
+
const d = !!B();
|
|
306
|
+
return r(() => d ? Y({ kind: i, state: e() }) : [ke, ...J(i, e()).map(([c]) => c)].join(" "));
|
|
307
|
+
}
|
|
308
|
+
export {
|
|
309
|
+
Be as _,
|
|
310
|
+
B as a,
|
|
311
|
+
W as b,
|
|
312
|
+
Re as c,
|
|
313
|
+
ee as d,
|
|
314
|
+
ue as e,
|
|
315
|
+
qe as f,
|
|
316
|
+
X as g,
|
|
317
|
+
Z as h,
|
|
318
|
+
te as i,
|
|
319
|
+
oe as u
|
|
320
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { hasInjectionContext as t, inject as i } from "vue";
|
|
2
|
+
import { useI18n as u } from "vue-i18n";
|
|
3
|
+
import { a } from "./error-CD7x0Jrz.js";
|
|
4
|
+
const d = Symbol("vue-core.describeError"), f = Symbol("vue-core.describeFieldError");
|
|
5
|
+
function h() {
|
|
6
|
+
return t() ? i(f, null) : null;
|
|
7
|
+
}
|
|
8
|
+
function l() {
|
|
9
|
+
return t() ? i(d, null) : null;
|
|
10
|
+
}
|
|
11
|
+
function p({ t: r, te: c }) {
|
|
12
|
+
return (e, { fallback: s } = {}) => {
|
|
13
|
+
const o = s ?? r("core.errors.unexpected");
|
|
14
|
+
if (!a(e)) return o;
|
|
15
|
+
if (e.code) {
|
|
16
|
+
for (const n of [`errors.${e.code}`, `core.errors.${e.code}`])
|
|
17
|
+
if (c(n)) return r(n, { ...e.params });
|
|
18
|
+
if (e.message) return e.message;
|
|
19
|
+
}
|
|
20
|
+
switch (e.kind) {
|
|
21
|
+
case "unauthorized":
|
|
22
|
+
return r("core.errors.unauthenticated");
|
|
23
|
+
case "forbidden":
|
|
24
|
+
return r("core.errors.forbidden");
|
|
25
|
+
case "notFound":
|
|
26
|
+
return r("core.errors.not_found");
|
|
27
|
+
case "conflict":
|
|
28
|
+
return r("core.errors.conflict");
|
|
29
|
+
case "network":
|
|
30
|
+
return r("core.errors.offline");
|
|
31
|
+
case "aborted":
|
|
32
|
+
return r("core.errors.cancelled");
|
|
33
|
+
case "server":
|
|
34
|
+
case "malformed":
|
|
35
|
+
return o;
|
|
36
|
+
case "validation":
|
|
37
|
+
if (Object.keys(e.fields).length > 0) return r("core.errors.check_fields");
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
return e.status === 429 ? r("core.errors.rate_limited") : s ?? (e.message || r("core.errors.unexpected"));
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function y() {
|
|
44
|
+
const { t: r, te: c } = u(), e = l(), s = p({ t: (o, n) => r(o, n ?? {}), te: (o) => c(o) });
|
|
45
|
+
return e ? (o, n) => e(o) ?? s(o, n) : s;
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
l as a,
|
|
49
|
+
d as b,
|
|
50
|
+
f as c,
|
|
51
|
+
h as d,
|
|
52
|
+
y as u
|
|
53
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useI18n as f } from "vue-i18n";
|
|
2
|
+
import { a as c } from "./error-CD7x0Jrz.js";
|
|
3
|
+
import { u as m } from "./format-B8mJm946.js";
|
|
4
|
+
import { u as l } from "./describeError-B-NMa--w.js";
|
|
5
|
+
function E() {
|
|
6
|
+
const { t: i, te: u } = f(), a = m(), d = l(), s = (e) => [`errors.${e}`, `core.errors.${e}`].find((t) => u(t));
|
|
7
|
+
function n(e, t) {
|
|
8
|
+
if (c(e) && e.code) {
|
|
9
|
+
const r = s(e.code), o = typeof e.params?.locked_until == "string" ? new Date(e.params.locked_until) : null;
|
|
10
|
+
if (r && o && !Number.isNaN(o.getTime())) return i(r, { ...e.params, locked_until: a.time(o) });
|
|
11
|
+
}
|
|
12
|
+
return d(e, t === void 0 ? void 0 : { fallback: t });
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
sentence: n,
|
|
16
|
+
describeFieldError: (e) => {
|
|
17
|
+
const t = s(e);
|
|
18
|
+
return t === void 0 ? e : i(t);
|
|
19
|
+
},
|
|
20
|
+
failureMessage: (e, t) => c(t) && t.code && (e === "failed" || e === "forbidden" || e === "conflict") ? n(t) : void 0
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
E as u
|
|
25
|
+
};
|
package/dist/form/Field.vue.d.ts
CHANGED
|
@@ -50,6 +50,7 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}
|
|
|
50
50
|
value: string | number | boolean | null;
|
|
51
51
|
prefix: string;
|
|
52
52
|
presentation: "control" | "value";
|
|
53
|
+
labelHidden: boolean;
|
|
53
54
|
hint: string;
|
|
54
55
|
editable: boolean;
|
|
55
56
|
lockedReason: string;
|
|
@@ -8,7 +8,7 @@ import type { Form } from "./useForm";
|
|
|
8
8
|
* <FormErrors :form="form" :label="fieldLabel" />
|
|
9
9
|
*
|
|
10
10
|
* A field counts as shown while an element carries `data-field-key="<name>"` (`form.bind()` sets it; `fieldKey(path)` does for a field wired by hand,
|
|
11
|
-
* such as one inside a list), or carries the name of something that contains it.
|
|
11
|
+
* such as one inside a list), or carries the name of something that contains it. `useHiddenFieldErrors` is the same list for your own use.
|
|
12
12
|
*/
|
|
13
13
|
type __VLS_Props = {
|
|
14
14
|
form: Pick<Form<object>, "failure" | "errors">;
|
|
@@ -12,6 +12,8 @@ import { type FormRowLayout } from "./field";
|
|
|
12
12
|
*/
|
|
13
13
|
type __VLS_Props = {
|
|
14
14
|
label?: string;
|
|
15
|
+
/** The label is read by screen readers but not drawn; the row lays out as if it had none. */
|
|
16
|
+
labelHidden?: boolean;
|
|
15
17
|
/** The id of the control the label names (editable rows). */
|
|
16
18
|
for?: string;
|
|
17
19
|
/** A secondary line under the label. */
|
|
@@ -50,6 +52,7 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}
|
|
|
50
52
|
required: boolean;
|
|
51
53
|
value: string | number | null;
|
|
52
54
|
for: string;
|
|
55
|
+
labelHidden: boolean;
|
|
53
56
|
subId: string;
|
|
54
57
|
layout: FormRowLayout;
|
|
55
58
|
errorId: string;
|
|
@@ -29,6 +29,7 @@ declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
29
29
|
required: boolean;
|
|
30
30
|
width: Exclude<ControlWidth, "content">;
|
|
31
31
|
presentation: "control" | "value";
|
|
32
|
+
labelHidden: boolean;
|
|
32
33
|
hint: string;
|
|
33
34
|
editable: boolean;
|
|
34
35
|
lockedReason: string;
|
|
@@ -11,6 +11,7 @@ import { type FieldProps } from "./field";
|
|
|
11
11
|
* is always a decimal mark, never a group mark.
|
|
12
12
|
*
|
|
13
13
|
* Typing "1,5" mid-edit is never rewritten under the cursor: the text is the user's until the field loses focus.
|
|
14
|
+
* `:max-digits="5"` takes at most five digits (a postal code): typing a sixth does nothing, pasting a longer number keeps its first five.
|
|
14
15
|
* Limits (`min`, `max`) are the validator's job; the field only keeps what cannot be a number out.
|
|
15
16
|
*/
|
|
16
17
|
type __VLS_Props = FieldProps & {
|
|
@@ -19,6 +20,8 @@ type __VLS_Props = FieldProps & {
|
|
|
19
20
|
negative?: boolean;
|
|
20
21
|
/** Separates thousands ("1.234.567"); off for years, coordinates and codes. */
|
|
21
22
|
grouping?: boolean;
|
|
23
|
+
/** The most digits the field takes, fraction digits included (the sign, separators and decimal mark are not counted): a postal code is `:max-digits="5"`. Further digits are not accepted, as `maxlength` does for text; a pasted longer number keeps its first digits. */
|
|
24
|
+
maxDigits?: number;
|
|
22
25
|
placeholder?: string;
|
|
23
26
|
prefix?: string;
|
|
24
27
|
suffix?: string;
|
|
@@ -44,6 +47,7 @@ declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
44
47
|
width: Exclude<ControlWidth, "content">;
|
|
45
48
|
prefix: string;
|
|
46
49
|
presentation: "control" | "value";
|
|
50
|
+
labelHidden: boolean;
|
|
47
51
|
hint: string;
|
|
48
52
|
editable: boolean;
|
|
49
53
|
lockedReason: string;
|
|
@@ -51,5 +55,6 @@ declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
51
55
|
decimals: number;
|
|
52
56
|
negative: boolean;
|
|
53
57
|
grouping: boolean;
|
|
58
|
+
maxDigits: number;
|
|
54
59
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
55
60
|
export default _default;
|
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
import { type FieldProps } from "./field";
|
|
2
2
|
import type { SelectOption } from "./options";
|
|
3
3
|
import { type OptionsSource } from "./useOptions";
|
|
4
|
-
declare const _default: <Value extends string | number>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
4
|
+
declare const _default: <Value extends string | number, Clearable extends boolean = false>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
5
5
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
6
|
-
readonly "onUpdate:modelValue"?: ((value: Value | null) => any) | undefined;
|
|
6
|
+
readonly "onUpdate:modelValue"?: ((value: Clearable extends true ? Value | null : Value) => any) | undefined;
|
|
7
7
|
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onUpdate:modelValue"> & (FieldProps & {
|
|
8
8
|
options: OptionsSource<Value>;
|
|
9
9
|
/** The option of the current value when the caller already has it (a saved record's model): its label shows before the options arrive, or when they do not contain it. */
|
|
10
10
|
selected?: SelectOption<Value> | null;
|
|
11
11
|
placeholder?: string;
|
|
12
|
-
clearable?:
|
|
12
|
+
clearable?: Clearable;
|
|
13
|
+
modelValue?: Value | null;
|
|
13
14
|
/** Shows the search box from this many options. */
|
|
14
15
|
searchFrom?: number;
|
|
15
|
-
} & {
|
|
16
|
-
modelValue?: Value | null;
|
|
17
16
|
}) & Partial<{}>> & import("vue").PublicProps;
|
|
18
17
|
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
19
18
|
attrs: any;
|
|
20
19
|
slots: {};
|
|
21
|
-
emit: (evt: "update:modelValue", value: Value | null) => void;
|
|
20
|
+
emit: (evt: "update:modelValue", value: Clearable extends true ? Value | null : Value) => void;
|
|
22
21
|
}>) => import("vue").VNode & {
|
|
23
22
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
24
23
|
};
|
|
@@ -68,6 +68,7 @@ declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
68
68
|
width: Exclude<ControlWidth, "content">;
|
|
69
69
|
prefix: string;
|
|
70
70
|
presentation: "control" | "value";
|
|
71
|
+
labelHidden: boolean;
|
|
71
72
|
hint: string;
|
|
72
73
|
editable: boolean;
|
|
73
74
|
lockedReason: string;
|
package/dist/form/field.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { type ComputedRef, type InjectionKey, type Ref } from "vue";
|
|
|
2
2
|
/** What every field takes besides its value. A field is one labelled row: the label, the control, a hint, the error. */
|
|
3
3
|
export interface FieldProps {
|
|
4
4
|
label?: string;
|
|
5
|
+
/** The label stays the control's accessible name (and the read-mode row's) but is not drawn: for a field whose group header already says it. */
|
|
6
|
+
labelHidden?: boolean;
|
|
5
7
|
/** A sentence under the label (under the control outside a group) that says what to enter. */
|
|
6
8
|
hint?: string;
|
|
7
9
|
/** The message to show; `form.bind()` supplies it. */
|
|
@@ -22,6 +24,7 @@ export interface FieldProps {
|
|
|
22
24
|
/** Defaults of `FieldProps` for `withDefaults(defineProps<FieldProps & …>(), { ...fieldDefaults, … })`. */
|
|
23
25
|
export declare const fieldDefaults: {
|
|
24
26
|
label: undefined;
|
|
27
|
+
labelHidden: boolean;
|
|
25
28
|
hint: undefined;
|
|
26
29
|
error: undefined;
|
|
27
30
|
required: boolean;
|
package/dist/form/index.d.ts
CHANGED
|
@@ -61,6 +61,8 @@ export { useGroupSheet } from "./useGroupSheet";
|
|
|
61
61
|
export type { GroupSheetForm, GroupSheetOptions, GroupSheetState } from "./useGroupSheet";
|
|
62
62
|
export { default as EditorPage } from "./EditorPage.vue";
|
|
63
63
|
export { useSectionStates } from "./sectionStates";
|
|
64
|
+
export { useHiddenFieldErrors } from "./useHiddenFieldErrors";
|
|
65
|
+
export type { HiddenFieldError } from "./useHiddenFieldErrors";
|
|
64
66
|
export { useSaveChrome } from "./useSaveChrome";
|
|
65
67
|
export type { SaveChromeOptions } from "./useSaveChrome";
|
|
66
68
|
export { default as CommandDialog } from "./CommandDialog.vue";
|