@wssto2/vue-core 0.17.0 → 0.19.0
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/README.md +2 -0
- package/dist/collection/DynamicCollection.vue.d.ts +69 -0
- package/dist/collection/RecordIdentity.vue.d.ts +1 -1
- package/dist/collection/definition.d.ts +4 -4
- package/dist/collection/dynamicColumns.d.ts +13 -0
- package/dist/collection/index.d.ts +1 -0
- package/dist/collection/index.js +195 -146
- package/dist/form/CodeField.vue.d.ts +62 -0
- package/dist/form/codeEditor.d.ts +27 -0
- package/dist/form/dynamic/DynamicForm.vue.d.ts +46 -0
- package/dist/form/dynamic/RepeatField.vue.d.ts +47 -0
- package/dist/form/dynamic/ResourceField.vue.d.ts +38 -0
- package/dist/form/dynamic/ResourcePickerList.vue.d.ts +12 -0
- package/dist/form/dynamic/RichTextField.vue.d.ts +40 -0
- package/dist/form/dynamic/localeMode.d.ts +5 -0
- package/dist/form/dynamic/resources.d.ts +34 -0
- package/dist/form/dynamic/schema.d.ts +73 -0
- package/dist/form/dynamic/validator.d.ts +30 -0
- package/dist/form/dynamic/visibility.d.ts +12 -0
- package/dist/form/index.d.ts +13 -0
- package/dist/form/index.js +2307 -1316
- package/dist/i18n/index.js +15 -15
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/resources-BZLlAtoS.js +62 -0
- package/dist/styles.css +1 -1
- package/package.json +56 -1
package/dist/form/index.js
CHANGED
|
@@ -1,109 +1,108 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import {
|
|
3
|
-
import { f as
|
|
4
|
-
import { _ as
|
|
5
|
-
import { ref as
|
|
6
|
-
import { a as
|
|
7
|
-
import { M as
|
|
8
|
-
import { _ as
|
|
9
|
-
import { u as
|
|
10
|
-
import { _ as
|
|
11
|
-
import { _ as
|
|
12
|
-
import { g as
|
|
13
|
-
import { u as
|
|
14
|
-
import { c as
|
|
15
|
-
import { useI18n as
|
|
16
|
-
import { b as
|
|
17
|
-
import { a as
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import { u as
|
|
27
|
-
import { _ as
|
|
28
|
-
import {
|
|
29
|
-
import { _ as
|
|
30
|
-
import {
|
|
31
|
-
import { _ as
|
|
32
|
-
import {
|
|
33
|
-
import { _ as
|
|
34
|
-
import {
|
|
35
|
-
import { b as
|
|
36
|
-
import { _ as
|
|
37
|
-
import { _ as
|
|
38
|
-
import { _ as
|
|
39
|
-
import { _ as
|
|
40
|
-
import { _ as
|
|
41
|
-
import { _ as
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const t = P(null);
|
|
1
|
+
import { a as Ft, _ as ct, c as Bt, f as Lt, E as Tt } from "../FormGroup.vue_vue_type_script_setup_true_lang-lvAuBG-0.js";
|
|
2
|
+
import { b as Jr, d as Zr, p as Xr, r as Qr, u as en, e as tn, g as an } from "../FormGroup.vue_vue_type_script_setup_true_lang-lvAuBG-0.js";
|
|
3
|
+
import { f as Oe } from "../useCommand-DQKvro1n.js";
|
|
4
|
+
import { _ as ln, a as rn, u as nn } from "../useCommand-DQKvro1n.js";
|
|
5
|
+
import { ref as G, computed as B, defineComponent as Z, openBlock as d, createBlock as R, mergeProps as P, unref as s, createSlots as ue, withCtx as _, createElementVNode as V, normalizeClass as W, createElementBlock as g, Fragment as ee, renderList as ve, createVNode as N, createCommentVNode as z, toDisplayString as L, renderSlot as j, mergeDefaults as ce, useModel as ke, useId as Ae, withKeys as Fe, withModifiers as he, createTextVNode as X, mergeModels as ye, useTemplateRef as oe, shallowRef as Je, watch as ne, normalizeProps as je, guardReactiveProps as Ee, nextTick as we, provide as mt, inject as ze, onBeforeUnmount as Be, getCurrentScope as Dt, onScopeDispose as zt, toValue as Mt, shallowReactive as Ze, normalizeStyle as Ne, resolveDynamicComponent as Rt, onMounted as Ie, withDirectives as ft, vModelText as pt } from "vue";
|
|
6
|
+
import { a as vt } from "../leaveGuard-Cc8yeLxM.js";
|
|
7
|
+
import { M as un, c as dn, i as cn, l as mn, u as fn } from "../leaveGuard-Cc8yeLxM.js";
|
|
8
|
+
import { _ as vn } from "../LeaveGuardRoot.vue_vue_type_script_setup_true_lang-CrGrjrlO.js";
|
|
9
|
+
import { u as yn } from "../useResourceForm-zVuWerSn.js";
|
|
10
|
+
import { _ as de } from "../Icon.vue_vue_type_script_lang-BhhsFYwp.js";
|
|
11
|
+
import { _ as be, u as Pe } from "../options-mOOX6JSS.js";
|
|
12
|
+
import { g as hn, m as kn } from "../options-mOOX6JSS.js";
|
|
13
|
+
import { u as Se, f as me, b as fe, a as bt, _ as Ot, e as jt, g as Et } from "../FormRow.vue_vue_type_script_setup_true_lang-CpgNVQF4.js";
|
|
14
|
+
import { c as xn } from "../FormRow.vue_vue_type_script_setup_true_lang-CpgNVQF4.js";
|
|
15
|
+
import { useI18n as le } from "vue-i18n";
|
|
16
|
+
import { b as Nt } from "../controlSurface-t7OEFESJ.js";
|
|
17
|
+
import { a as Ut, _ as Xe } from "../TextField.vue_vue_type_script_setup_true_lang-CVGh-p3J.js";
|
|
18
|
+
import { u as At, l as It } from "../suggestions-DeMgs_ki.js";
|
|
19
|
+
import { r as $n } from "../suggestions-DeMgs_ki.js";
|
|
20
|
+
import { o as Ce, q as Pt, m as Ht, s as qe, u as Qe, i as Kt, e as Le, k as Gt, _ as Wt, l as Yt, c as Jt, b as Zt, t as Re, g as Xt, v as Qt } from "../useTypedEntry-BsMV66Yc.js";
|
|
21
|
+
import { u as ea, a as ta, s as aa, _ as oa } from "../DateField.vue_vue_type_script_setup_true_lang-D0KcfW8R.js";
|
|
22
|
+
import { _ as yt } from "../DateButton.vue_vue_type_script_setup_true_lang-CovKG5lN.js";
|
|
23
|
+
import { u as gt } from "../format-C_HXlOYQ.js";
|
|
24
|
+
import { u as He } from "../mediaQuery-CygcXmFW.js";
|
|
25
|
+
import { _ as Ke } from "../Popover.vue_vue_type_script_setup_true_lang-BK8HL_V0.js";
|
|
26
|
+
import { u as la } from "../TimeField.vue_vue_type_script_setup_true_lang-DHNC_MLt.js";
|
|
27
|
+
import { _ as Cn } from "../TimeField.vue_vue_type_script_setup_true_lang-DHNC_MLt.js";
|
|
28
|
+
import { _ as ae } from "../Button.vue_vue_type_script_setup_true_lang-JrqhO99l.js";
|
|
29
|
+
import { _ as qn } from "../FormView.vue_vue_type_script_setup_true_lang-D01Jr4UU.js";
|
|
30
|
+
import { a as ht } from "../environment-Dva-SG8D.js";
|
|
31
|
+
import { _ as kt } from "../NumberField.vue_vue_type_script_setup_true_lang-BhNZgEW6.js";
|
|
32
|
+
import { _ as ra } from "../Sheet.vue_vue_type_script_setup_true_lang-BG8HUNfs.js";
|
|
33
|
+
import { b as na, a as et, _ as sa } from "../SelectField.vue_vue_type_script_setup_true_lang-D5xYofdb.js";
|
|
34
|
+
import { u as Bn } from "../SelectField.vue_vue_type_script_setup_true_lang-D5xYofdb.js";
|
|
35
|
+
import { _ as Tn, b as Dn, a as zn, u as Mn } from "../useGroupSheet-CRw3MUmX.js";
|
|
36
|
+
import { _ as tt } from "../PhotoViewer.vue_vue_type_script_setup_true_lang-DmMg1T_V.js";
|
|
37
|
+
import { _ as On } from "../SegmentedField.vue_vue_type_script_setup_true_lang-CLR6EvzO.js";
|
|
38
|
+
import { _ as ia } from "../SwitchField.vue_vue_type_script_setup_true_lang-CLtcuofe.js";
|
|
39
|
+
import { _ as at } from "../TextareaField.vue_vue_type_script_setup_true_lang-YxUlNHSk.js";
|
|
40
|
+
import { _ as ua } from "../AdaptivePageShell.vue_vue_type_script_setup_true_lang-oXWQTfBs.js";
|
|
41
|
+
import { _ as da, a as ca } from "../SectionList.vue_vue_type_script_setup_true_lang-CodyVezo.js";
|
|
42
|
+
import { p as ma } from "../sectionIndex-BS0ic5W7.js";
|
|
43
|
+
import { u as fa } from "../useSaveChrome-DB9OwIjT.js";
|
|
44
|
+
import { u as En } from "../useRecordDialog-0azHxxvm.js";
|
|
45
|
+
import { matchedRouteKey as pa, onBeforeRouteLeave as va } from "vue-router";
|
|
46
|
+
import { t as Ge, c as _t, _ as xt } from "../resources-BZLlAtoS.js";
|
|
47
|
+
function ba(o) {
|
|
48
|
+
const a = G(null);
|
|
50
49
|
return {
|
|
51
|
-
isDirty:
|
|
52
|
-
markClean: () =>
|
|
50
|
+
isDirty: B(() => a.value !== null && JSON.stringify(o()) !== a.value),
|
|
51
|
+
markClean: () => a.value = JSON.stringify(o())
|
|
53
52
|
};
|
|
54
53
|
}
|
|
55
|
-
function
|
|
56
|
-
const
|
|
54
|
+
function qr(o) {
|
|
55
|
+
const a = G(!1), e = ba(o), { confirmDiscard: t } = vt(() => a.value && e.isDirty.value);
|
|
57
56
|
return {
|
|
58
57
|
/** The sheet was just filled: its current values are the baseline. */
|
|
59
58
|
opened: () => {
|
|
60
|
-
e.markClean(),
|
|
59
|
+
e.markClean(), a.value = !0;
|
|
61
60
|
},
|
|
62
61
|
/** The sheet closes with nothing to lose (after a save, or once it has closed). */
|
|
63
62
|
closed: () => {
|
|
64
|
-
|
|
63
|
+
a.value = !1;
|
|
65
64
|
},
|
|
66
|
-
beforeDismiss:
|
|
65
|
+
beforeDismiss: t
|
|
67
66
|
};
|
|
68
67
|
}
|
|
69
|
-
const
|
|
70
|
-
const e = Number(
|
|
68
|
+
const ot = (o, a) => {
|
|
69
|
+
const e = Number(a);
|
|
71
70
|
if (Number.isInteger(e) && Math.abs(e) < 1e4) return String(e);
|
|
72
|
-
const
|
|
73
|
-
return
|
|
71
|
+
const t = Number.isInteger(e) ? 0 : 2;
|
|
72
|
+
return o.number(e, { minimumFractionDigits: t, maximumFractionDigits: t });
|
|
74
73
|
};
|
|
75
|
-
function
|
|
76
|
-
const { t: e, te:
|
|
77
|
-
return (
|
|
78
|
-
switch (
|
|
74
|
+
function Fr({ i18n: o, format: a }) {
|
|
75
|
+
const { t: e, te: t } = o.global, r = (u) => `validation_errors.${u}`, i = (u) => `core.validation_errors.${u}`, p = (u, v) => ({ message: e(t(r(u)) ? r(u) : i(u), v) });
|
|
76
|
+
return (u) => {
|
|
77
|
+
switch (u.code) {
|
|
79
78
|
case "invalid_type":
|
|
80
|
-
return
|
|
79
|
+
return p("required");
|
|
81
80
|
case "too_small":
|
|
82
|
-
return
|
|
81
|
+
return u.origin === "string" ? Number(u.minimum) === 1 ? p("required") : p("min", { min: Number(u.minimum) }) : u.origin === "number" ? p("min_value", { min: ot(a, u.minimum) }) : void 0;
|
|
83
82
|
case "too_big":
|
|
84
|
-
return
|
|
83
|
+
return u.origin === "string" ? p("max", { max: Number(u.maximum) }) : u.origin === "number" ? p("max_value", { max: ot(a, u.maximum) }) : void 0;
|
|
85
84
|
case "invalid_format":
|
|
86
|
-
return
|
|
85
|
+
return u.format !== void 0 && ["email", "url", "date", "datetime"].includes(u.format) ? p(u.format) : void 0;
|
|
87
86
|
case "custom": {
|
|
88
|
-
const
|
|
89
|
-
if (typeof
|
|
90
|
-
if (
|
|
91
|
-
const
|
|
92
|
-
return
|
|
87
|
+
const v = u.params?.code;
|
|
88
|
+
if (typeof v != "string") return;
|
|
89
|
+
if (v === "required") return p("required");
|
|
90
|
+
const x = t(r(v)) ? r(v) : t(i(v)) ? i(v) : null;
|
|
91
|
+
return x === null ? void 0 : { message: e(x) };
|
|
93
92
|
}
|
|
94
93
|
default:
|
|
95
94
|
return;
|
|
96
95
|
}
|
|
97
96
|
};
|
|
98
97
|
}
|
|
99
|
-
const
|
|
98
|
+
const ya = ["id", "aria-label", "aria-describedby", "aria-invalid"], ga = ["name", "value", "checked", "disabled", "onChange"], ha = { class: "min-w-0 flex-1" }, ka = { class: "block text-body font-semibold text-content-strong" }, _a = {
|
|
100
99
|
key: 0,
|
|
101
100
|
class: "mt-0.5 block text-footnote text-content-muted"
|
|
102
|
-
},
|
|
101
|
+
}, xa = {
|
|
103
102
|
key: 1,
|
|
104
103
|
class: "flex size-5 shrink-0 items-center justify-center rounded-full bg-control-on text-white",
|
|
105
104
|
"aria-hidden": "true"
|
|
106
|
-
},
|
|
105
|
+
}, Br = /* @__PURE__ */ Z({
|
|
107
106
|
__name: "CardSelectField",
|
|
108
107
|
props: /* @__PURE__ */ ce({
|
|
109
108
|
label: {},
|
|
@@ -119,90 +118,90 @@ const Wt = ["id", "aria-label", "aria-describedby", "aria-invalid"], Jt = ["name
|
|
|
119
118
|
modelValue: {},
|
|
120
119
|
options: {},
|
|
121
120
|
columns: {}
|
|
122
|
-
}, { ...
|
|
121
|
+
}, { ...fe, modelValue: null, columns: 2 }),
|
|
123
122
|
emits: ["update:modelValue"],
|
|
124
|
-
setup(
|
|
125
|
-
const e =
|
|
126
|
-
return (
|
|
127
|
-
value: e.options.find((
|
|
123
|
+
setup(o, { emit: a }) {
|
|
124
|
+
const e = o, t = a, { editable: r } = Se(e), i = { 1: "grid-cols-1", 2: "grid-cols-2", 3: "grid-cols-3", 4: "grid-cols-4" }, p = B(() => i[e.columns]);
|
|
125
|
+
return (u, v) => (d(), R(be, P(s(me)(e), {
|
|
126
|
+
value: e.options.find((x) => x.value === e.modelValue)?.label ?? null,
|
|
128
127
|
"row-layout": "stacked"
|
|
129
|
-
}),
|
|
130
|
-
default:
|
|
131
|
-
|
|
132
|
-
id:
|
|
128
|
+
}), ue({
|
|
129
|
+
default: _(({ id: x, describedby: S, invalid: h }) => [
|
|
130
|
+
V("div", {
|
|
131
|
+
id: x,
|
|
133
132
|
role: "radiogroup",
|
|
134
133
|
"aria-label": e.label,
|
|
135
|
-
"aria-describedby":
|
|
136
|
-
"aria-invalid":
|
|
137
|
-
class:
|
|
134
|
+
"aria-describedby": S,
|
|
135
|
+
"aria-invalid": h || void 0,
|
|
136
|
+
class: W(["grid w-full gap-2.5", p.value]),
|
|
138
137
|
"data-test": "card-select"
|
|
139
138
|
}, [
|
|
140
|
-
(d(!0),
|
|
141
|
-
key:
|
|
142
|
-
class:
|
|
139
|
+
(d(!0), g(ee, null, ve(e.options, (l) => (d(), g("label", {
|
|
140
|
+
key: l.value,
|
|
141
|
+
class: W(["relative flex items-center gap-3 rounded-group bg-fill p-3.5 transition-colors duration-motion-fast focus-within:outline-2 focus-within:outline-offset-2 focus-within:outline-border-focus", [l.value === e.modelValue ? "bg-tint-soft ring-[1.5px] ring-inset ring-border-selected" : "hover:bg-fill-strong", e.disabled || !s(r) || l.disabled ? "cursor-not-allowed opacity-60" : "cursor-pointer"]])
|
|
143
142
|
}, [
|
|
144
|
-
|
|
143
|
+
V("input", {
|
|
145
144
|
type: "radio",
|
|
146
145
|
class: "sr-only",
|
|
147
|
-
name: e.name ??
|
|
148
|
-
value:
|
|
149
|
-
checked:
|
|
150
|
-
disabled: e.disabled || !s(
|
|
151
|
-
onChange: (
|
|
152
|
-
}, null, 40,
|
|
153
|
-
|
|
146
|
+
name: e.name ?? x,
|
|
147
|
+
value: l.value,
|
|
148
|
+
checked: l.value === e.modelValue,
|
|
149
|
+
disabled: e.disabled || !s(r) || l.disabled,
|
|
150
|
+
onChange: (m) => t("update:modelValue", l.value)
|
|
151
|
+
}, null, 40, ga),
|
|
152
|
+
l.icon ? (d(), g("span", {
|
|
154
153
|
key: 0,
|
|
155
|
-
class:
|
|
154
|
+
class: W(["flex size-9 shrink-0 items-center justify-center rounded-control", l.value === e.modelValue ? "bg-control-on text-white" : "bg-fill-strong text-content-muted"])
|
|
156
155
|
}, [
|
|
157
|
-
N(s(
|
|
158
|
-
name:
|
|
156
|
+
N(s(de), {
|
|
157
|
+
name: l.icon,
|
|
159
158
|
size: 18
|
|
160
159
|
}, null, 8, ["name"])
|
|
161
|
-
], 2)) :
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
160
|
+
], 2)) : z("", !0),
|
|
161
|
+
V("span", ha, [
|
|
162
|
+
V("span", ka, L(l.label), 1),
|
|
163
|
+
l.description ? (d(), g("span", _a, L(l.description), 1)) : z("", !0)
|
|
165
164
|
]),
|
|
166
|
-
|
|
167
|
-
N(s(
|
|
165
|
+
l.value === e.modelValue ? (d(), g("span", xa, [
|
|
166
|
+
N(s(de), {
|
|
168
167
|
name: "checkCustom",
|
|
169
168
|
size: 12
|
|
170
169
|
})
|
|
171
|
-
])) :
|
|
170
|
+
])) : z("", !0)
|
|
172
171
|
], 2))), 128))
|
|
173
|
-
], 10,
|
|
172
|
+
], 10, ya)
|
|
174
173
|
]),
|
|
175
174
|
_: 2
|
|
176
175
|
}, [
|
|
177
|
-
|
|
176
|
+
u.$slots.trailing ? {
|
|
178
177
|
name: "trailing",
|
|
179
|
-
fn:
|
|
180
|
-
|
|
178
|
+
fn: _(() => [
|
|
179
|
+
j(u.$slots, "trailing")
|
|
181
180
|
]),
|
|
182
181
|
key: "0"
|
|
183
182
|
} : void 0,
|
|
184
|
-
|
|
183
|
+
u.$slots.labelTrailing ? {
|
|
185
184
|
name: "labelTrailing",
|
|
186
|
-
fn:
|
|
187
|
-
|
|
185
|
+
fn: _(() => [
|
|
186
|
+
j(u.$slots, "labelTrailing")
|
|
188
187
|
]),
|
|
189
188
|
key: "1"
|
|
190
189
|
} : void 0,
|
|
191
|
-
|
|
190
|
+
u.$slots.readonly ? {
|
|
192
191
|
name: "readonly",
|
|
193
|
-
fn:
|
|
194
|
-
|
|
192
|
+
fn: _(() => [
|
|
193
|
+
j(u.$slots, "readonly")
|
|
195
194
|
]),
|
|
196
195
|
key: "2"
|
|
197
196
|
} : void 0
|
|
198
197
|
]), 1040, ["value"]));
|
|
199
198
|
}
|
|
200
|
-
}),
|
|
199
|
+
}), wa = ["data-field-error"], $a = ["aria-checked", "aria-disabled", "aria-describedby", "aria-invalid", "tabindex", "onKeydown"], Va = { class: "flex min-w-0 flex-1 flex-col items-start" }, Ca = {
|
|
201
200
|
key: 0,
|
|
202
201
|
class: "flex shrink-0 items-center gap-2.5"
|
|
203
|
-
},
|
|
202
|
+
}, Sa = ["id"], Lr = /* @__PURE__ */ Z({
|
|
204
203
|
__name: "CheckboxField",
|
|
205
|
-
props: /* @__PURE__ */
|
|
204
|
+
props: /* @__PURE__ */ ye({
|
|
206
205
|
label: {},
|
|
207
206
|
description: { default: void 0 },
|
|
208
207
|
disabled: { type: Boolean, default: !1 },
|
|
@@ -213,78 +212,78 @@ const Wt = ["id", "aria-label", "aria-describedby", "aria-invalid"], Jt = ["name
|
|
|
213
212
|
modelModifiers: {}
|
|
214
213
|
}),
|
|
215
214
|
emits: ["update:modelValue"],
|
|
216
|
-
setup(
|
|
217
|
-
const
|
|
218
|
-
|
|
215
|
+
setup(o) {
|
|
216
|
+
const a = o, e = ke(o, "modelValue"), t = !!bt(), r = Ae(), i = () => {
|
|
217
|
+
a.disabled || (e.value = !e.value);
|
|
219
218
|
};
|
|
220
|
-
return (
|
|
219
|
+
return (p, u) => (d(), g("div", {
|
|
221
220
|
class: "group/check",
|
|
222
|
-
"data-field-error":
|
|
221
|
+
"data-field-error": a.error ? "true" : void 0
|
|
223
222
|
}, [
|
|
224
|
-
|
|
223
|
+
V("div", {
|
|
225
224
|
role: "checkbox",
|
|
226
225
|
"aria-checked": e.value,
|
|
227
|
-
"aria-disabled":
|
|
228
|
-
"aria-describedby":
|
|
229
|
-
"aria-invalid":
|
|
230
|
-
tabindex:
|
|
226
|
+
"aria-disabled": a.disabled || void 0,
|
|
227
|
+
"aria-describedby": a.error ? `${s(r)}-error` : void 0,
|
|
228
|
+
"aria-invalid": a.error ? !0 : void 0,
|
|
229
|
+
tabindex: a.disabled ? -1 : 0,
|
|
231
230
|
"data-test": "checkbox",
|
|
232
|
-
class:
|
|
233
|
-
onClick:
|
|
231
|
+
class: W(["flex items-center transition-colors duration-motion-fast focus-visible:outline-2 focus-visible:outline-border-focus", [a.variant === "row" ? "gap-3 pl-row-inset focus-visible:-outline-offset-2" : "gap-2.5 rounded-control px-2 py-1.5 focus-visible:outline-offset-1", t && a.variant === "row" ? "group-first/check:rounded-t-group group-last/check:rounded-b-group" : "", a.disabled ? "cursor-not-allowed" : a.variant === "row" ? "cursor-pointer hover:bg-fill/60 active:bg-fill" : "cursor-pointer hover:bg-fill"]]),
|
|
232
|
+
onClick: i,
|
|
234
233
|
onKeydown: [
|
|
235
|
-
|
|
236
|
-
|
|
234
|
+
Fe(he(i, ["prevent"]), ["space"]),
|
|
235
|
+
Fe(he(i, ["prevent"]), ["enter"])
|
|
237
236
|
]
|
|
238
237
|
}, [
|
|
239
|
-
|
|
240
|
-
class:
|
|
238
|
+
V("span", {
|
|
239
|
+
class: W(["flex shrink-0 items-center justify-center rounded-full border-2", [a.variant === "row" ? "size-5.5" : "size-5", e.value ? a.disabled ? "border-content-disabled bg-content-disabled text-white" : "border-control-on bg-control-on text-white" : "border-border-control"]]),
|
|
241
240
|
"aria-hidden": "true"
|
|
242
241
|
}, [
|
|
243
|
-
e.value ? (d(),
|
|
242
|
+
e.value ? (d(), R(s(de), {
|
|
244
243
|
key: 0,
|
|
245
244
|
name: "checkCustom",
|
|
246
245
|
size: 12
|
|
247
|
-
})) :
|
|
246
|
+
})) : z("", !0)
|
|
248
247
|
], 2),
|
|
249
|
-
|
|
250
|
-
class:
|
|
248
|
+
V("div", {
|
|
249
|
+
class: W(["flex min-w-0 flex-1 items-center gap-3", a.variant === "row" ? "min-h-row border-t border-border-separator py-2 pr-row-inset group-first/check:border-t-0" : ""])
|
|
251
250
|
}, [
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
class:
|
|
255
|
-
},
|
|
256
|
-
|
|
251
|
+
V("div", Va, [
|
|
252
|
+
V("p", {
|
|
253
|
+
class: W(["w-full text-body", [a.variant === "row" ? "break-words" : "truncate", a.disabled ? "text-content-muted" : e.value ? "text-content-strong" : "text-content"]])
|
|
254
|
+
}, L(a.label), 3),
|
|
255
|
+
a.description ? (d(), g("p", {
|
|
257
256
|
key: 0,
|
|
258
|
-
class:
|
|
259
|
-
},
|
|
260
|
-
|
|
257
|
+
class: W(["tabular-nums text-content-muted", a.variant === "row" ? "text-footnote" : "text-xs"])
|
|
258
|
+
}, L(a.description), 3)) : z("", !0),
|
|
259
|
+
j(p.$slots, "default")
|
|
261
260
|
]),
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
])) :
|
|
261
|
+
p.$slots.trailing ? (d(), g("div", Ca, [
|
|
262
|
+
j(p.$slots, "trailing")
|
|
263
|
+
])) : z("", !0)
|
|
265
264
|
], 2)
|
|
266
|
-
], 42,
|
|
267
|
-
|
|
265
|
+
], 42, $a),
|
|
266
|
+
a.error ? (d(), g("p", {
|
|
268
267
|
key: 0,
|
|
269
|
-
id: `${s(
|
|
268
|
+
id: `${s(r)}-error`,
|
|
270
269
|
role: "alert",
|
|
271
270
|
class: "flex items-start gap-1.5 px-2 pt-1 text-footnote text-content-destructive"
|
|
272
271
|
}, [
|
|
273
|
-
N(s(
|
|
272
|
+
N(s(de), {
|
|
274
273
|
name: "alertTriangle",
|
|
275
274
|
size: 14,
|
|
276
275
|
class: "mt-px shrink-0"
|
|
277
276
|
}),
|
|
278
|
-
|
|
279
|
-
], 8,
|
|
280
|
-
], 8,
|
|
277
|
+
X(" " + L(a.error), 1)
|
|
278
|
+
], 8, Sa)) : z("", !0)
|
|
279
|
+
], 8, wa));
|
|
281
280
|
}
|
|
282
|
-
}),
|
|
281
|
+
}), qa = {
|
|
283
282
|
key: 0,
|
|
284
283
|
class: "text-body text-content-muted"
|
|
285
|
-
},
|
|
284
|
+
}, Fa = ["id", "aria-label", "aria-describedby", "aria-invalid"], Ba = ["aria-pressed", "disabled", "onClick"], Tr = /* @__PURE__ */ Z({
|
|
286
285
|
__name: "ChoiceChips",
|
|
287
|
-
props: /* @__PURE__ */
|
|
286
|
+
props: /* @__PURE__ */ ye(/* @__PURE__ */ ce({
|
|
288
287
|
label: {},
|
|
289
288
|
labelHidden: { type: Boolean },
|
|
290
289
|
hint: {},
|
|
@@ -296,77 +295,77 @@ const Wt = ["id", "aria-label", "aria-describedby", "aria-invalid"], Jt = ["name
|
|
|
296
295
|
presentation: {},
|
|
297
296
|
name: {},
|
|
298
297
|
options: {}
|
|
299
|
-
}, { ...
|
|
298
|
+
}, { ...fe }), {
|
|
300
299
|
modelValue: { default: () => [] },
|
|
301
300
|
modelModifiers: {}
|
|
302
301
|
}),
|
|
303
302
|
emits: ["update:modelValue"],
|
|
304
|
-
setup(
|
|
305
|
-
const
|
|
306
|
-
return (
|
|
307
|
-
value:
|
|
303
|
+
setup(o) {
|
|
304
|
+
const a = o, e = ke(o, "modelValue"), t = (r) => e.value = e.value.includes(r) ? e.value.filter((i) => i !== r) : [...e.value, r];
|
|
305
|
+
return (r, i) => (d(), R(be, P(s(me)(a), {
|
|
306
|
+
value: a.options.filter((p) => e.value.includes(p.value)).map((p) => p.label).join(", ") || null,
|
|
308
307
|
"row-layout": "stacked"
|
|
309
|
-
}),
|
|
310
|
-
default:
|
|
311
|
-
|
|
308
|
+
}), ue({
|
|
309
|
+
default: _(({ id: p, describedby: u, invalid: v }) => [
|
|
310
|
+
a.options.length === 0 ? (d(), g("span", qa, "—")) : (d(), g("div", {
|
|
312
311
|
key: 1,
|
|
313
|
-
id:
|
|
312
|
+
id: p,
|
|
314
313
|
role: "group",
|
|
315
|
-
"aria-label":
|
|
316
|
-
"aria-describedby":
|
|
317
|
-
"aria-invalid":
|
|
314
|
+
"aria-label": a.label,
|
|
315
|
+
"aria-describedby": u,
|
|
316
|
+
"aria-invalid": v || void 0,
|
|
318
317
|
class: "flex flex-wrap gap-1.5 py-1",
|
|
319
318
|
"data-test": "choice-chips"
|
|
320
319
|
}, [
|
|
321
|
-
(d(!0),
|
|
322
|
-
key:
|
|
320
|
+
(d(!0), g(ee, null, ve(a.options, (x) => (d(), g("button", {
|
|
321
|
+
key: x.value,
|
|
323
322
|
type: "button",
|
|
324
|
-
"aria-pressed": e.value.includes(
|
|
325
|
-
disabled:
|
|
326
|
-
class:
|
|
327
|
-
onClick: (
|
|
323
|
+
"aria-pressed": e.value.includes(x.value),
|
|
324
|
+
disabled: a.disabled || x.disabled,
|
|
325
|
+
class: W(["inline-flex min-h-8 cursor-pointer items-center gap-1.5 rounded-full px-3 text-subheadline transition-colors duration-motion-fast focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus disabled:cursor-not-allowed disabled:opacity-60", e.value.includes(x.value) ? "bg-tint-soft font-semibold text-content-link" : "bg-fill font-medium text-content-strong hover:bg-fill-strong"]),
|
|
326
|
+
onClick: (S) => t(x.value)
|
|
328
327
|
}, [
|
|
329
|
-
e.value.includes(
|
|
328
|
+
e.value.includes(x.value) ? (d(), R(s(de), {
|
|
330
329
|
key: 0,
|
|
331
330
|
name: "checkCustom",
|
|
332
331
|
size: 12
|
|
333
|
-
})) :
|
|
334
|
-
|
|
335
|
-
], 10,
|
|
336
|
-
], 8,
|
|
332
|
+
})) : z("", !0),
|
|
333
|
+
X(" " + L(x.label), 1)
|
|
334
|
+
], 10, Ba))), 128))
|
|
335
|
+
], 8, Fa))
|
|
337
336
|
]),
|
|
338
337
|
_: 2
|
|
339
338
|
}, [
|
|
340
|
-
|
|
339
|
+
r.$slots.trailing ? {
|
|
341
340
|
name: "trailing",
|
|
342
|
-
fn:
|
|
343
|
-
|
|
341
|
+
fn: _(() => [
|
|
342
|
+
j(r.$slots, "trailing")
|
|
344
343
|
]),
|
|
345
344
|
key: "0"
|
|
346
345
|
} : void 0,
|
|
347
|
-
|
|
346
|
+
r.$slots.labelTrailing ? {
|
|
348
347
|
name: "labelTrailing",
|
|
349
|
-
fn:
|
|
350
|
-
|
|
348
|
+
fn: _(() => [
|
|
349
|
+
j(r.$slots, "labelTrailing")
|
|
351
350
|
]),
|
|
352
351
|
key: "1"
|
|
353
352
|
} : void 0,
|
|
354
|
-
|
|
353
|
+
r.$slots.readonly ? {
|
|
355
354
|
name: "readonly",
|
|
356
|
-
fn:
|
|
357
|
-
|
|
355
|
+
fn: _(() => [
|
|
356
|
+
j(r.$slots, "readonly")
|
|
358
357
|
]),
|
|
359
358
|
key: "2"
|
|
360
359
|
} : void 0
|
|
361
360
|
]), 1040, ["value"]));
|
|
362
361
|
}
|
|
363
|
-
}),
|
|
362
|
+
}), La = {
|
|
364
363
|
key: 0,
|
|
365
364
|
class: "flex shrink-0 items-center",
|
|
366
365
|
"data-test": "field-value"
|
|
367
|
-
},
|
|
366
|
+
}, Ta = ["id", "value", "name", "placeholder", "disabled", "required", "aria-expanded", "aria-controls", "aria-activedescendant", "aria-required", "aria-invalid", "aria-describedby"], Da = { class: "block break-words text-body text-content-strong" }, Dr = /* @__PURE__ */ Z({
|
|
368
367
|
__name: "ComboField",
|
|
369
|
-
props: /* @__PURE__ */
|
|
368
|
+
props: /* @__PURE__ */ ye(/* @__PURE__ */ ce({
|
|
370
369
|
label: {},
|
|
371
370
|
labelHidden: { type: Boolean },
|
|
372
371
|
hint: {},
|
|
@@ -387,104 +386,104 @@ const Wt = ["id", "aria-label", "aria-describedby", "aria-invalid"], Jt = ["name
|
|
|
387
386
|
recents: {},
|
|
388
387
|
width: {},
|
|
389
388
|
rowLayout: {}
|
|
390
|
-
}, { ...
|
|
389
|
+
}, { ...fe, options: void 0, search: void 0, selected: null, placeholder: void 0, minLength: 1, debounce: 300, limit: 30, recents: void 0, width: "md", rowLayout: void 0 }), {
|
|
391
390
|
modelValue: { default: null },
|
|
392
391
|
modelModifiers: {}
|
|
393
392
|
}),
|
|
394
|
-
emits: /* @__PURE__ */
|
|
395
|
-
setup(
|
|
396
|
-
const
|
|
397
|
-
source: () =>
|
|
398
|
-
minLength: () =>
|
|
399
|
-
debounce: () =>
|
|
400
|
-
limit: () =>
|
|
393
|
+
emits: /* @__PURE__ */ ye(["picked", "focus", "blur"], ["update:modelValue"]),
|
|
394
|
+
setup(o, { expose: a, emit: e }) {
|
|
395
|
+
const t = o, r = ke(o, "modelValue"), i = e, { t: p } = le(), u = !!bt(), v = Pe("text", () => t.error ? "error" : t.disabled ? "locked" : "rest"), x = B(() => t.rowLayout === "stacked"), S = B(() => u && !x.value ? Nt(t.width) : "w-full"), h = oe("input"), l = oe("anchor"), m = Je(null), c = Je(""), k = At({
|
|
396
|
+
source: () => t.search ?? t.options,
|
|
397
|
+
minLength: () => t.minLength,
|
|
398
|
+
debounce: () => t.debounce,
|
|
399
|
+
limit: () => t.limit,
|
|
401
400
|
listAllWhenEmpty: !0,
|
|
402
|
-
recents: () =>
|
|
403
|
-
}), { items:
|
|
404
|
-
const
|
|
405
|
-
return
|
|
401
|
+
recents: () => t.recents
|
|
402
|
+
}), { items: b, open: y, status: w, highlighted: F, showingRecent: q } = k, $ = B(() => {
|
|
403
|
+
const M = r.value;
|
|
404
|
+
return M === null ? null : [m.value, t.selected, ...t.options ?? []].find((Q) => Q?.value === M) ?? null;
|
|
406
405
|
});
|
|
407
|
-
|
|
408
|
-
|
|
406
|
+
ne($, (M) => {
|
|
407
|
+
y.value || (c.value = M?.label ?? "");
|
|
409
408
|
}, { immediate: !0 });
|
|
410
|
-
function
|
|
411
|
-
|
|
409
|
+
function E(M) {
|
|
410
|
+
c.value = M.target.value, k.ask(c.value), c.value === "" && (r.value = null, m.value = null);
|
|
412
411
|
}
|
|
413
|
-
function
|
|
414
|
-
|
|
412
|
+
function H(M) {
|
|
413
|
+
i("focus", M), t.disabled || k.show("");
|
|
415
414
|
}
|
|
416
|
-
function
|
|
417
|
-
|
|
415
|
+
function O(M) {
|
|
416
|
+
k.close(), k.remember(M), m.value = M, r.value = M.value, c.value = M.label, i("picked", M);
|
|
418
417
|
}
|
|
419
|
-
function
|
|
420
|
-
|
|
418
|
+
function D(M) {
|
|
419
|
+
k.close(), c.value = $.value?.label ?? "", i("blur", M);
|
|
421
420
|
}
|
|
422
|
-
const
|
|
423
|
-
return
|
|
424
|
-
value:
|
|
425
|
-
"row-layout":
|
|
426
|
-
}),
|
|
427
|
-
default:
|
|
428
|
-
|
|
421
|
+
const J = B(() => It(y.value, b.value.length, w.value, !0));
|
|
422
|
+
return a({ focus: () => h.value?.focus() }), (M, Q) => (d(), R(be, P(s(me)(t), {
|
|
423
|
+
value: $.value?.label ?? null,
|
|
424
|
+
"row-layout": t.rowLayout
|
|
425
|
+
}), ue({
|
|
426
|
+
default: _(({ id: te, describedby: se, invalid: re }) => [
|
|
427
|
+
V("div", {
|
|
429
428
|
ref_key: "anchor",
|
|
430
|
-
ref:
|
|
431
|
-
class:
|
|
429
|
+
ref: l,
|
|
430
|
+
class: W(["flex items-center gap-1.5", [s(v), S.value]])
|
|
432
431
|
}, [
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
option:
|
|
432
|
+
M.$slots.value && $.value ? (d(), g("span", La, [
|
|
433
|
+
j(M.$slots, "value", {
|
|
434
|
+
option: $.value
|
|
436
435
|
})
|
|
437
|
-
])) :
|
|
438
|
-
|
|
439
|
-
id:
|
|
436
|
+
])) : z("", !0),
|
|
437
|
+
V("input", {
|
|
438
|
+
id: te,
|
|
440
439
|
ref_key: "input",
|
|
441
|
-
ref:
|
|
440
|
+
ref: h,
|
|
442
441
|
role: "combobox",
|
|
443
442
|
type: "text",
|
|
444
443
|
autocomplete: "off",
|
|
445
|
-
value:
|
|
446
|
-
name:
|
|
447
|
-
placeholder:
|
|
448
|
-
disabled:
|
|
449
|
-
required:
|
|
444
|
+
value: c.value,
|
|
445
|
+
name: t.name,
|
|
446
|
+
placeholder: t.placeholder,
|
|
447
|
+
disabled: t.disabled,
|
|
448
|
+
required: t.required,
|
|
450
449
|
"aria-autocomplete": "list",
|
|
451
|
-
"aria-expanded":
|
|
452
|
-
"aria-controls": `${
|
|
453
|
-
"aria-activedescendant":
|
|
454
|
-
"aria-required":
|
|
455
|
-
"aria-invalid":
|
|
456
|
-
"aria-describedby":
|
|
457
|
-
class:
|
|
458
|
-
onInput:
|
|
459
|
-
onFocus:
|
|
460
|
-
onBlur:
|
|
461
|
-
onKeydown:
|
|
462
|
-
}, null, 42,
|
|
463
|
-
N(s(
|
|
450
|
+
"aria-expanded": J.value,
|
|
451
|
+
"aria-controls": `${te}-list`,
|
|
452
|
+
"aria-activedescendant": J.value && s(b).length > 0 ? `${te}-option-${s(F)}` : void 0,
|
|
453
|
+
"aria-required": t.required || void 0,
|
|
454
|
+
"aria-invalid": re || void 0,
|
|
455
|
+
"aria-describedby": se,
|
|
456
|
+
class: W(["block w-full min-w-0 border-0 bg-transparent px-0 py-1 text-body text-content-strong placeholder:text-content-disabled focus:outline-none focus:ring-0 disabled:cursor-not-allowed", u && !x.value ? "compact:text-right" : ""]),
|
|
457
|
+
onInput: E,
|
|
458
|
+
onFocus: H,
|
|
459
|
+
onBlur: D,
|
|
460
|
+
onKeydown: Q[0] || (Q[0] = (pe) => s(k).keydown(pe, { pick: O, enterNeedsMove: !1 }))
|
|
461
|
+
}, null, 42, Ta),
|
|
462
|
+
N(s(de), {
|
|
464
463
|
name: "search",
|
|
465
464
|
size: 14,
|
|
466
465
|
class: "shrink-0 text-content-muted"
|
|
467
466
|
})
|
|
468
467
|
], 2),
|
|
469
|
-
N(
|
|
470
|
-
id:
|
|
471
|
-
anchor:
|
|
472
|
-
open: s(
|
|
473
|
-
items: s(
|
|
474
|
-
highlighted: s(
|
|
475
|
-
query:
|
|
476
|
-
status: s(
|
|
477
|
-
recent: s(
|
|
468
|
+
N(Ut, {
|
|
469
|
+
id: te,
|
|
470
|
+
anchor: l.value,
|
|
471
|
+
open: s(y),
|
|
472
|
+
items: s(b),
|
|
473
|
+
highlighted: s(F),
|
|
474
|
+
query: c.value,
|
|
475
|
+
status: s(w),
|
|
476
|
+
recent: s(q),
|
|
478
477
|
"empty-message": !0,
|
|
479
|
-
selected:
|
|
480
|
-
hint: s(
|
|
481
|
-
onPick:
|
|
482
|
-
onHover:
|
|
483
|
-
},
|
|
484
|
-
|
|
478
|
+
selected: r.value,
|
|
479
|
+
hint: s(p)("core.form.suggestions.keys_pick"),
|
|
480
|
+
onPick: O,
|
|
481
|
+
onHover: Q[1] || (Q[1] = (pe) => s(k).highlight(pe))
|
|
482
|
+
}, ue({ _: 2 }, [
|
|
483
|
+
M.$slots.option ? {
|
|
485
484
|
name: "option",
|
|
486
|
-
fn:
|
|
487
|
-
|
|
485
|
+
fn: _((pe) => [
|
|
486
|
+
j(M.$slots, "option", je(Ee(pe)))
|
|
488
487
|
]),
|
|
489
488
|
key: "0"
|
|
490
489
|
} : void 0
|
|
@@ -492,32 +491,32 @@ const Wt = ["id", "aria-label", "aria-describedby", "aria-invalid"], Jt = ["name
|
|
|
492
491
|
]),
|
|
493
492
|
_: 2
|
|
494
493
|
}, [
|
|
495
|
-
|
|
494
|
+
M.$slots.trailing ? {
|
|
496
495
|
name: "trailing",
|
|
497
|
-
fn:
|
|
498
|
-
|
|
496
|
+
fn: _(() => [
|
|
497
|
+
j(M.$slots, "trailing")
|
|
499
498
|
]),
|
|
500
499
|
key: "0"
|
|
501
500
|
} : void 0,
|
|
502
|
-
|
|
501
|
+
M.$slots.labelTrailing ? {
|
|
503
502
|
name: "labelTrailing",
|
|
504
|
-
fn:
|
|
505
|
-
|
|
503
|
+
fn: _(() => [
|
|
504
|
+
j(M.$slots, "labelTrailing")
|
|
506
505
|
]),
|
|
507
506
|
key: "1"
|
|
508
507
|
} : void 0,
|
|
509
|
-
|
|
508
|
+
M.$slots.readonly ? {
|
|
510
509
|
name: "readonly",
|
|
511
|
-
fn:
|
|
512
|
-
|
|
510
|
+
fn: _(() => [
|
|
511
|
+
j(M.$slots, "readonly")
|
|
513
512
|
]),
|
|
514
513
|
key: "2"
|
|
515
|
-
} :
|
|
514
|
+
} : M.$slots.value && $.value ? {
|
|
516
515
|
name: "readonly",
|
|
517
|
-
fn:
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
option:
|
|
516
|
+
fn: _(() => [
|
|
517
|
+
V("span", Da, [
|
|
518
|
+
j(M.$slots, "value", {
|
|
519
|
+
option: $.value
|
|
521
520
|
})
|
|
522
521
|
])
|
|
523
522
|
]),
|
|
@@ -525,40 +524,40 @@ const Wt = ["id", "aria-label", "aria-describedby", "aria-invalid"], Jt = ["name
|
|
|
525
524
|
} : void 0
|
|
526
525
|
]), 1040, ["value", "row-layout"]));
|
|
527
526
|
}
|
|
528
|
-
}),
|
|
529
|
-
function
|
|
530
|
-
if (
|
|
531
|
-
if (
|
|
532
|
-
if (
|
|
533
|
-
const
|
|
534
|
-
return
|
|
527
|
+
}), wt = /^(0000-00-00|1970-01-01|0001-01-01)/, lt = (o) => String(o).padStart(2, "0"), $t = (o) => Ht(o.getFullYear(), o.getMonth() + 1, o.getDate()), za = (o) => `${lt(o.getHours())}:${lt(o.getMinutes())}`;
|
|
528
|
+
function Ma(o) {
|
|
529
|
+
if (o == null || o === "") return null;
|
|
530
|
+
if (o instanceof Date) return Number.isNaN(o.getTime()) ? null : $t(o);
|
|
531
|
+
if (wt.test(o)) return null;
|
|
532
|
+
const a = /^(\d{4}-\d{2}-\d{2})/.exec(o);
|
|
533
|
+
return a && Pt(a[1]) ? a[1] : null;
|
|
535
534
|
}
|
|
536
|
-
function
|
|
537
|
-
if (
|
|
538
|
-
const
|
|
539
|
-
if (Number.isNaN(
|
|
540
|
-
const e =
|
|
541
|
-
return e ?
|
|
535
|
+
function Vt(o) {
|
|
536
|
+
if (o == null || o === "" || typeof o == "string" && wt.test(o)) return null;
|
|
537
|
+
const a = o instanceof Date ? o : Ra(o);
|
|
538
|
+
if (Number.isNaN(a.getTime())) return null;
|
|
539
|
+
const e = $t(a);
|
|
540
|
+
return e ? Ce(e, za(a)) : null;
|
|
542
541
|
}
|
|
543
|
-
function
|
|
544
|
-
const
|
|
545
|
-
return
|
|
542
|
+
function Ra(o) {
|
|
543
|
+
const a = /^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?)?$/.exec(o);
|
|
544
|
+
return a ? new Date(Number(a[1]), Number(a[2]) - 1, Number(a[3]), Number(a[4] ?? 0), Number(a[5] ?? 0), Number(a[6] ?? 0)) : new Date(o);
|
|
546
545
|
}
|
|
547
|
-
function
|
|
548
|
-
return
|
|
546
|
+
function zr(o = /* @__PURE__ */ new Date()) {
|
|
547
|
+
return Vt(o) ?? "";
|
|
549
548
|
}
|
|
550
|
-
const
|
|
549
|
+
const Oa = {
|
|
551
550
|
key: 0,
|
|
552
551
|
class: "whitespace-normal"
|
|
553
|
-
},
|
|
552
|
+
}, ja = { class: "whitespace-nowrap" }, Ea = { class: "whitespace-nowrap" }, Na = ["id", "name", "value", "placeholder", "disabled", "required", "aria-required", "aria-invalid", "aria-describedby"], Ua = ["aria-label", "onClick"], Aa = {
|
|
554
553
|
class: "-m-3 flex",
|
|
555
554
|
"data-test": "date-time-popover"
|
|
556
|
-
},
|
|
555
|
+
}, Ia = { class: "flex w-75 flex-col gap-2.5 border-r border-border-separator p-3.5" }, Pa = {
|
|
557
556
|
key: 0,
|
|
558
557
|
class: "border-t border-border-separator pt-2.5"
|
|
559
|
-
},
|
|
558
|
+
}, Ha = { class: "flex w-48 flex-col gap-2.5 px-3 py-3.5" }, Ka = ["for"], Ga = ["id", "value", "placeholder", "aria-invalid"], Wa = ["onClick"], Ya = /* @__PURE__ */ Z({
|
|
560
559
|
__name: "DateTimeField",
|
|
561
|
-
props: /* @__PURE__ */
|
|
560
|
+
props: /* @__PURE__ */ ye(/* @__PURE__ */ ce({
|
|
562
561
|
label: {},
|
|
563
562
|
labelHidden: { type: Boolean },
|
|
564
563
|
hint: {},
|
|
@@ -575,190 +574,190 @@ const pa = {
|
|
|
575
574
|
openOn: {},
|
|
576
575
|
minuteStep: {},
|
|
577
576
|
quickPicks: {}
|
|
578
|
-
}, { ...
|
|
577
|
+
}, { ...fe, min: void 0, max: void 0, disabledDates: void 0, openOn: void 0, minuteStep: 1, quickPicks: void 0 }), {
|
|
579
578
|
modelValue: { default: null },
|
|
580
579
|
modelModifiers: {}
|
|
581
580
|
}),
|
|
582
|
-
emits: /* @__PURE__ */
|
|
583
|
-
setup(
|
|
584
|
-
const
|
|
585
|
-
function
|
|
586
|
-
const { date:
|
|
587
|
-
if (!
|
|
588
|
-
let
|
|
589
|
-
if (
|
|
590
|
-
const
|
|
591
|
-
if ("error" in
|
|
592
|
-
|
|
581
|
+
emits: /* @__PURE__ */ ye(["focus", "blur"], ["update:modelValue"]),
|
|
582
|
+
setup(o, { expose: a, emit: e }) {
|
|
583
|
+
const t = o, r = ke(o, "modelValue"), i = e, { t: p } = le(), u = gt(), v = He(), x = oe("input"), S = oe("popover"), h = oe("calendar"), l = oe("sheet"), m = B(() => ({ min: t.min?.slice(0, 10), max: t.max?.slice(0, 10), disabled: t.disabledDates })), c = B(() => t.min && t.min.length === 10 ? `${t.min}T00:00` : t.min), k = B(() => t.max && t.max.length === 10 ? `${t.max}T23:59` : t.max), b = (n, f) => !Xt(f, { disabled: t.disabledDates }) && (!c.value || n >= c.value) && (!k.value || n <= k.value), y = ea(() => m.value), w = la(() => t.minuteStep), F = B(() => qe(r.value));
|
|
584
|
+
function q(n) {
|
|
585
|
+
const { date: f, time: U } = aa(n), Y = f === null ? F.value.day ?? Le() : y.parse(f);
|
|
586
|
+
if (!Y) return { error: y.invalidMessage() };
|
|
587
|
+
let T = F.value.time ?? Re(t.minuteStep);
|
|
588
|
+
if (U !== null) {
|
|
589
|
+
const A = w.parse(U);
|
|
590
|
+
if ("error" in A) return A;
|
|
591
|
+
T = A.value;
|
|
593
592
|
}
|
|
594
|
-
const
|
|
595
|
-
return
|
|
593
|
+
const K = Ce(Y, T);
|
|
594
|
+
return b(K, Y) ? { value: K } : { error: y.unavailableMessage() };
|
|
596
595
|
}
|
|
597
|
-
const
|
|
598
|
-
get: () =>
|
|
599
|
-
set: (
|
|
600
|
-
|
|
596
|
+
const $ = Qe({ model: r, display: (n) => `${u.date(qe(n).day)} ${qe(n).time ?? ""}`.trim(), parse: q }), E = B({
|
|
597
|
+
get: () => F.value.time,
|
|
598
|
+
set: (n) => {
|
|
599
|
+
n && Kt(n) && (r.value = Ce(F.value.day ?? Le(), n));
|
|
601
600
|
}
|
|
602
|
-
}),
|
|
603
|
-
const
|
|
604
|
-
return
|
|
605
|
-
}),
|
|
606
|
-
function
|
|
607
|
-
|
|
601
|
+
}), H = Qe({ model: E, display: (n) => n, parse: w.parse }), O = ta(() => t.quickPicks ?? (v.value ? void 0 : []), () => v.value, () => m.value), D = B(() => t.error || $.message.value || H.message.value), J = B(() => r.value ? u.dateTime(r.value) : null), M = Pe("date", () => D.value ? "error" : t.disabled ? "locked" : "rest"), Q = B(() => {
|
|
602
|
+
const n = $.typed.value;
|
|
603
|
+
return n ? qe(n).day ?? null : null;
|
|
604
|
+
}), te = B(() => Q.value ?? (Gt(F.value.day) ? F.value.day : null)), se = B(() => $.typed.value ? qe($.typed.value).time : F.value.time);
|
|
605
|
+
function re(n) {
|
|
606
|
+
n && $.set(Ce(n, F.value.time ?? Re(t.minuteStep)));
|
|
608
607
|
}
|
|
609
|
-
function
|
|
610
|
-
|
|
608
|
+
function pe(n) {
|
|
609
|
+
n && $.set(Ce(F.value.day ?? Le(), n));
|
|
611
610
|
}
|
|
612
|
-
function
|
|
613
|
-
|
|
611
|
+
function _e(n) {
|
|
612
|
+
$.set(Ce(Le(), Re(t.minuteStep))), n();
|
|
614
613
|
}
|
|
615
|
-
const
|
|
616
|
-
async function
|
|
617
|
-
|
|
614
|
+
const ge = Ae();
|
|
615
|
+
async function C(n) {
|
|
616
|
+
t.disabled || (S.value?.present(), n && (await we(), await we(), h.value?.focus()));
|
|
618
617
|
}
|
|
619
|
-
function
|
|
620
|
-
|
|
618
|
+
function I(n) {
|
|
619
|
+
n.key === "Enter" ? ($.commit(), S.value?.dismiss()) : n.key === "ArrowDown" && (n.preventDefault(), C(!0));
|
|
621
620
|
}
|
|
622
|
-
return
|
|
623
|
-
value:
|
|
621
|
+
return a({ focus: () => x.value?.focus() }), (n, f) => (d(), R(be, P({ ...s(me)(t), error: D.value }, {
|
|
622
|
+
value: J.value,
|
|
624
623
|
"value-style": "numeric"
|
|
625
|
-
}),
|
|
626
|
-
default:
|
|
627
|
-
s(
|
|
628
|
-
N(
|
|
629
|
-
disabled:
|
|
630
|
-
invalid:
|
|
631
|
-
placeholder: s(
|
|
632
|
-
onClick:
|
|
624
|
+
}), ue({
|
|
625
|
+
default: _(({ id: U, describedby: Y, invalid: T }) => [
|
|
626
|
+
s(v) ? (d(), g(ee, { key: 0 }, [
|
|
627
|
+
N(yt, P({ id: U, "aria-describedby": Y }, {
|
|
628
|
+
disabled: t.disabled,
|
|
629
|
+
invalid: T,
|
|
630
|
+
placeholder: s(p)("core.form.select.choose"),
|
|
631
|
+
onClick: f[0] || (f[0] = (K) => l.value?.present())
|
|
633
632
|
}), {
|
|
634
|
-
default:
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
])) :
|
|
633
|
+
default: _(() => [
|
|
634
|
+
r.value ? (d(), g("span", Oa, [
|
|
635
|
+
V("span", ja, L(s(u).date(F.value.day)), 1),
|
|
636
|
+
f[8] || (f[8] = X(L(" "), -1)),
|
|
637
|
+
V("span", Ea, L(F.value.time), 1)
|
|
638
|
+
])) : z("", !0)
|
|
640
639
|
]),
|
|
641
640
|
_: 1
|
|
642
641
|
}, 16, ["disabled", "invalid", "placeholder"]),
|
|
643
|
-
N(
|
|
642
|
+
N(Wt, {
|
|
644
643
|
ref_key: "sheet",
|
|
645
|
-
ref:
|
|
646
|
-
title:
|
|
644
|
+
ref: l,
|
|
645
|
+
title: t.label ?? s(p)("core.form.date.calendar"),
|
|
647
646
|
mode: "datetime",
|
|
648
|
-
"model-value":
|
|
649
|
-
min:
|
|
650
|
-
max:
|
|
651
|
-
"disabled-dates":
|
|
652
|
-
"open-on":
|
|
653
|
-
shortcuts: s(
|
|
654
|
-
step:
|
|
655
|
-
clearable: !
|
|
656
|
-
"onUpdate:modelValue": s(
|
|
647
|
+
"model-value": r.value,
|
|
648
|
+
min: m.value.min,
|
|
649
|
+
max: m.value.max,
|
|
650
|
+
"disabled-dates": t.disabledDates,
|
|
651
|
+
"open-on": t.openOn,
|
|
652
|
+
shortcuts: s(O),
|
|
653
|
+
step: t.minuteStep,
|
|
654
|
+
clearable: !t.required,
|
|
655
|
+
"onUpdate:modelValue": s($).set
|
|
657
656
|
}, null, 8, ["title", "model-value", "min", "max", "disabled-dates", "open-on", "shortcuts", "step", "clearable", "onUpdate:modelValue"])
|
|
658
|
-
], 64)) : (d(),
|
|
657
|
+
], 64)) : (d(), R(Ke, {
|
|
659
658
|
key: 1,
|
|
660
659
|
ref_key: "popover",
|
|
661
|
-
ref:
|
|
662
|
-
label:
|
|
660
|
+
ref: S,
|
|
661
|
+
label: t.label ?? s(p)("core.form.date.calendar"),
|
|
663
662
|
width: "auto",
|
|
664
663
|
placement: "bottom-start",
|
|
665
664
|
arrow: !1,
|
|
666
665
|
autofocus: !1
|
|
667
666
|
}, {
|
|
668
|
-
trigger:
|
|
669
|
-
|
|
670
|
-
class:
|
|
667
|
+
trigger: _(({ attrs: K, presented: A }) => [
|
|
668
|
+
V("div", {
|
|
669
|
+
class: W(["inline-flex max-w-full items-center gap-2", s(M)])
|
|
671
670
|
}, [
|
|
672
|
-
|
|
673
|
-
id:
|
|
671
|
+
V("input", P({
|
|
672
|
+
id: U,
|
|
674
673
|
ref_key: "input",
|
|
675
|
-
ref:
|
|
676
|
-
},
|
|
674
|
+
ref: x
|
|
675
|
+
}, K, {
|
|
677
676
|
type: "text",
|
|
678
677
|
role: "combobox",
|
|
679
678
|
autocomplete: "off",
|
|
680
679
|
size: "20",
|
|
681
|
-
name:
|
|
682
|
-
value: s(
|
|
683
|
-
placeholder: s(
|
|
684
|
-
disabled:
|
|
685
|
-
required:
|
|
686
|
-
"aria-required":
|
|
687
|
-
"aria-invalid":
|
|
688
|
-
"aria-describedby":
|
|
680
|
+
name: t.name,
|
|
681
|
+
value: s($).text.value,
|
|
682
|
+
placeholder: s(y).placeholder.value,
|
|
683
|
+
disabled: t.disabled,
|
|
684
|
+
required: t.required,
|
|
685
|
+
"aria-required": t.required || void 0,
|
|
686
|
+
"aria-invalid": T || void 0,
|
|
687
|
+
"aria-describedby": Y,
|
|
689
688
|
class: "block min-h-7 min-w-0 border-0 bg-transparent py-1 pl-2.5 text-body tabular-nums text-content-strong placeholder:text-content-disabled focus:outline-none focus:ring-0 disabled:cursor-not-allowed",
|
|
690
|
-
onInput:
|
|
691
|
-
onFocus:
|
|
692
|
-
onBlur:
|
|
693
|
-
s(
|
|
689
|
+
onInput: f[1] || (f[1] = (ie) => s($).input(ie.target.value)),
|
|
690
|
+
onFocus: f[2] || (f[2] = (ie) => i("focus", ie)),
|
|
691
|
+
onBlur: f[3] || (f[3] = (ie) => {
|
|
692
|
+
s($).commit(), i("blur", ie);
|
|
694
693
|
}),
|
|
695
|
-
onKeydown:
|
|
696
|
-
onClick:
|
|
697
|
-
}), null, 16,
|
|
698
|
-
|
|
694
|
+
onKeydown: I,
|
|
695
|
+
onClick: f[4] || (f[4] = (ie) => C(!1))
|
|
696
|
+
}), null, 16, Na),
|
|
697
|
+
t.disabled ? z("", !0) : (d(), g("button", {
|
|
699
698
|
key: 0,
|
|
700
699
|
type: "button",
|
|
701
700
|
tabindex: "-1",
|
|
702
|
-
"aria-label": s(
|
|
701
|
+
"aria-label": s(p)("core.form.date.open"),
|
|
703
702
|
class: "mr-2 flex shrink-0 cursor-pointer items-center text-content-link",
|
|
704
|
-
onClick: (
|
|
703
|
+
onClick: (ie) => A ? S.value?.dismiss() : C(!0)
|
|
705
704
|
}, [
|
|
706
|
-
N(s(
|
|
705
|
+
N(s(de), {
|
|
707
706
|
name: "calendarLine",
|
|
708
707
|
size: 18
|
|
709
708
|
})
|
|
710
|
-
], 8,
|
|
709
|
+
], 8, Ua))
|
|
711
710
|
], 2)
|
|
712
711
|
]),
|
|
713
|
-
default:
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
N(
|
|
712
|
+
default: _(({ dismiss: K }) => [
|
|
713
|
+
V("div", Aa, [
|
|
714
|
+
V("div", Ia, [
|
|
715
|
+
N(Yt, {
|
|
717
716
|
ref_key: "calendar",
|
|
718
|
-
ref:
|
|
719
|
-
"model-value":
|
|
720
|
-
min:
|
|
721
|
-
max:
|
|
722
|
-
"disabled-dates":
|
|
723
|
-
"open-on":
|
|
724
|
-
"onUpdate:modelValue":
|
|
717
|
+
ref: h,
|
|
718
|
+
"model-value": te.value,
|
|
719
|
+
min: m.value.min,
|
|
720
|
+
max: m.value.max,
|
|
721
|
+
"disabled-dates": t.disabledDates,
|
|
722
|
+
"open-on": t.openOn,
|
|
723
|
+
"onUpdate:modelValue": re
|
|
725
724
|
}, null, 8, ["model-value", "min", "max", "disabled-dates", "open-on"]),
|
|
726
|
-
s(
|
|
727
|
-
N(
|
|
728
|
-
items: s(
|
|
729
|
-
selected:
|
|
730
|
-
onPick:
|
|
725
|
+
s(O).length > 0 ? (d(), g("div", Pa, [
|
|
726
|
+
N(Jt, {
|
|
727
|
+
items: s(O),
|
|
728
|
+
selected: te.value,
|
|
729
|
+
onPick: re
|
|
731
730
|
}, null, 8, ["items", "selected"])
|
|
732
|
-
])) :
|
|
731
|
+
])) : z("", !0)
|
|
733
732
|
]),
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
for: s(
|
|
733
|
+
V("div", Ha, [
|
|
734
|
+
V("label", {
|
|
735
|
+
for: s(ge),
|
|
737
736
|
class: "text-footnote font-semibold text-content-muted"
|
|
738
|
-
},
|
|
739
|
-
|
|
740
|
-
id: s(
|
|
737
|
+
}, L(s(p)("core.form.time.label")), 9, Ka),
|
|
738
|
+
V("input", {
|
|
739
|
+
id: s(ge),
|
|
741
740
|
type: "text",
|
|
742
741
|
autocomplete: "off",
|
|
743
742
|
inputmode: "numeric",
|
|
744
|
-
value: s(
|
|
745
|
-
placeholder: s(
|
|
746
|
-
"aria-invalid": s(
|
|
743
|
+
value: s(H).text.value,
|
|
744
|
+
placeholder: s(w).placeholder.value,
|
|
745
|
+
"aria-invalid": s(H).message.value ? !0 : void 0,
|
|
747
746
|
class: "rounded-control bg-fill p-1.5 text-center text-[20px] font-semibold tabular-nums text-content-strong placeholder:text-base placeholder:font-normal placeholder:text-content-disabled focus:outline-2 focus:outline-border-focus",
|
|
748
|
-
onInput:
|
|
749
|
-
onBlur:
|
|
750
|
-
onKeydown:
|
|
751
|
-
}, null, 40,
|
|
752
|
-
N(
|
|
753
|
-
"model-value":
|
|
754
|
-
step:
|
|
755
|
-
"onUpdate:modelValue":
|
|
747
|
+
onInput: f[5] || (f[5] = (A) => s(H).input(A.target.value)),
|
|
748
|
+
onBlur: f[6] || (f[6] = (A) => s(H).commit()),
|
|
749
|
+
onKeydown: f[7] || (f[7] = Fe(he((A) => s(H).commit(), ["prevent"]), ["enter"]))
|
|
750
|
+
}, null, 40, Ga),
|
|
751
|
+
N(Zt, {
|
|
752
|
+
"model-value": se.value,
|
|
753
|
+
step: t.minuteStep,
|
|
754
|
+
"onUpdate:modelValue": pe
|
|
756
755
|
}, null, 8, ["model-value", "step"]),
|
|
757
|
-
|
|
756
|
+
V("button", {
|
|
758
757
|
type: "button",
|
|
759
758
|
class: "cursor-pointer self-start rounded-full bg-tint-soft px-2.5 py-1.5 text-footnote font-medium text-content-link focus-visible:outline-2 focus-visible:outline-border-focus",
|
|
760
|
-
onClick: (
|
|
761
|
-
},
|
|
759
|
+
onClick: (A) => _e(K)
|
|
760
|
+
}, L(s(p)("core.form.time.now")), 9, Wa)
|
|
762
761
|
])
|
|
763
762
|
])
|
|
764
763
|
]),
|
|
@@ -767,51 +766,51 @@ const pa = {
|
|
|
767
766
|
]),
|
|
768
767
|
_: 2
|
|
769
768
|
}, [
|
|
770
|
-
|
|
769
|
+
n.$slots.trailing ? {
|
|
771
770
|
name: "trailing",
|
|
772
|
-
fn:
|
|
773
|
-
|
|
771
|
+
fn: _(() => [
|
|
772
|
+
j(n.$slots, "trailing")
|
|
774
773
|
]),
|
|
775
774
|
key: "0"
|
|
776
775
|
} : void 0,
|
|
777
|
-
|
|
776
|
+
n.$slots.labelTrailing ? {
|
|
778
777
|
name: "labelTrailing",
|
|
779
|
-
fn:
|
|
780
|
-
|
|
778
|
+
fn: _(() => [
|
|
779
|
+
j(n.$slots, "labelTrailing")
|
|
781
780
|
]),
|
|
782
781
|
key: "1"
|
|
783
782
|
} : void 0,
|
|
784
|
-
|
|
783
|
+
n.$slots.readonly ? {
|
|
785
784
|
name: "readonly",
|
|
786
|
-
fn:
|
|
787
|
-
|
|
785
|
+
fn: _(() => [
|
|
786
|
+
j(n.$slots, "readonly")
|
|
788
787
|
]),
|
|
789
788
|
key: "2"
|
|
790
789
|
} : void 0
|
|
791
790
|
]), 1040, ["value"]));
|
|
792
791
|
}
|
|
793
792
|
});
|
|
794
|
-
function
|
|
795
|
-
const e =
|
|
793
|
+
function Ct(o, a = {}) {
|
|
794
|
+
const e = a.accept ?? [];
|
|
796
795
|
if (e.length > 0) {
|
|
797
|
-
const
|
|
798
|
-
if (!e.some((
|
|
799
|
-
const
|
|
800
|
-
return
|
|
796
|
+
const t = o.name.lastIndexOf("."), r = t === -1 ? "" : o.name.slice(t).toLowerCase(), i = o.type.toLowerCase();
|
|
797
|
+
if (!e.some((u) => {
|
|
798
|
+
const v = u.trim().toLowerCase();
|
|
799
|
+
return v.startsWith(".") ? v === r : v.endsWith("/*") ? i.startsWith(v.slice(0, -1)) : v === i;
|
|
801
800
|
})) return "invalid_type";
|
|
802
801
|
}
|
|
803
|
-
return (
|
|
802
|
+
return (a.maxSize ?? 0) > 0 && o.size > (a.maxSize ?? 0) ? "too_large" : null;
|
|
804
803
|
}
|
|
805
|
-
function
|
|
806
|
-
return
|
|
804
|
+
function Te(o) {
|
|
805
|
+
return o < 1024 ? `${o} B` : o < 1024 * 1024 ? `${Math.round(o / 1024)} KB` : `${(o / (1024 * 1024)).toFixed(o % (1024 * 1024) === 0 ? 0 : 1)} MB`;
|
|
807
806
|
}
|
|
808
|
-
const
|
|
807
|
+
const Ja = { class: "w-full" }, Za = ["id", "accept", "disabled", "aria-describedby", "aria-invalid"], Xa = {
|
|
809
808
|
key: 0,
|
|
810
809
|
class: "flex items-center gap-3 rounded-group bg-fill p-3",
|
|
811
810
|
"data-test": "file-selected"
|
|
812
|
-
},
|
|
811
|
+
}, Qa = { class: "min-w-0 flex-1" }, eo = { class: "truncate text-body font-medium text-content-strong" }, to = { class: "text-footnote text-content-muted" }, ao = ["disabled", "aria-label", "title"], oo = ["aria-disabled"], lo = { class: "font-semibold text-content-link" }, ro = { class: "text-content-muted" }, Mr = /* @__PURE__ */ Z({
|
|
813
812
|
__name: "FileField",
|
|
814
|
-
props: /* @__PURE__ */
|
|
813
|
+
props: /* @__PURE__ */ ye(/* @__PURE__ */ ce({
|
|
815
814
|
label: {},
|
|
816
815
|
labelHidden: { type: Boolean },
|
|
817
816
|
hint: {},
|
|
@@ -825,91 +824,91 @@ const Fa = { class: "w-full" }, Ba = ["id", "accept", "disabled", "aria-describe
|
|
|
825
824
|
variant: {},
|
|
826
825
|
accept: {},
|
|
827
826
|
maxSize: {}
|
|
828
|
-
}, { ...
|
|
827
|
+
}, { ...fe, variant: "button", accept: () => [], maxSize: 0 }), {
|
|
829
828
|
modelValue: { default: null },
|
|
830
829
|
modelModifiers: {}
|
|
831
830
|
}),
|
|
832
831
|
emits: ["update:modelValue"],
|
|
833
|
-
setup(
|
|
834
|
-
const e =
|
|
832
|
+
setup(o, { expose: a }) {
|
|
833
|
+
const e = o, t = ke(o, "modelValue"), { t: r } = le(), i = oe("chooser"), p = G(!1), u = G(null), v = B(() => {
|
|
835
834
|
if (e.hint) return e.hint;
|
|
836
|
-
const
|
|
837
|
-
return e.accept.length &&
|
|
835
|
+
const h = [];
|
|
836
|
+
return e.accept.length && h.push(r("core.form.file.allowed", { formats: e.accept.map((l) => l.replace(/^\./, "").toUpperCase()).join(", ") })), e.maxSize > 0 && h.push(r("core.form.file.max_size", { size: Te(e.maxSize) })), h.join(" · ") || void 0;
|
|
838
837
|
});
|
|
839
|
-
function
|
|
840
|
-
if (
|
|
841
|
-
const
|
|
842
|
-
|
|
838
|
+
function x(h) {
|
|
839
|
+
if (!h) return;
|
|
840
|
+
const l = Ct(h, { accept: e.accept, maxSize: e.maxSize });
|
|
841
|
+
l ? (u.value = l === "invalid_type" ? r("core.form.file.invalid_type") : r("core.form.file.too_large", { size: Te(e.maxSize) }), t.value = null) : (u.value = null, t.value = h);
|
|
843
842
|
}
|
|
844
|
-
function
|
|
845
|
-
|
|
843
|
+
function S() {
|
|
844
|
+
t.value = null, u.value = null;
|
|
846
845
|
}
|
|
847
|
-
return
|
|
848
|
-
|
|
849
|
-
}),
|
|
850
|
-
value:
|
|
846
|
+
return ne(t, (h) => {
|
|
847
|
+
!h && i.value && (i.value.value = "");
|
|
848
|
+
}), a({ clear: S }), (h, l) => (d(), R(be, P({ ...s(me)(e), hint: v.value, error: u.value ?? e.error }, {
|
|
849
|
+
value: t.value?.name ?? null,
|
|
851
850
|
"row-layout": "stacked"
|
|
852
|
-
}),
|
|
853
|
-
default:
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
id:
|
|
851
|
+
}), ue({
|
|
852
|
+
default: _(({ id: m, describedby: c, invalid: k }) => [
|
|
853
|
+
V("div", Ja, [
|
|
854
|
+
V("input", {
|
|
855
|
+
id: m,
|
|
857
856
|
ref_key: "chooser",
|
|
858
|
-
ref:
|
|
857
|
+
ref: i,
|
|
859
858
|
type: "file",
|
|
860
859
|
class: "sr-only",
|
|
861
860
|
tabindex: "-1",
|
|
862
861
|
accept: e.accept.join(",") || void 0,
|
|
863
862
|
disabled: e.disabled,
|
|
864
|
-
"aria-describedby":
|
|
865
|
-
"aria-invalid":
|
|
866
|
-
onChange:
|
|
867
|
-
}, null, 40,
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
863
|
+
"aria-describedby": c,
|
|
864
|
+
"aria-invalid": k || void 0,
|
|
865
|
+
onChange: l[0] || (l[0] = (b) => x(b.target.files?.[0]))
|
|
866
|
+
}, null, 40, Za),
|
|
867
|
+
t.value ? (d(), g("div", Xa, [
|
|
868
|
+
V("div", Qa, [
|
|
869
|
+
V("p", eo, L(t.value.name), 1),
|
|
870
|
+
V("p", to, L(s(Te)(t.value.size)), 1)
|
|
872
871
|
]),
|
|
873
|
-
|
|
872
|
+
V("button", {
|
|
874
873
|
type: "button",
|
|
875
874
|
disabled: e.disabled,
|
|
876
|
-
"aria-label": s(
|
|
877
|
-
title: s(
|
|
875
|
+
"aria-label": s(r)("core.form.file.remove"),
|
|
876
|
+
title: s(r)("core.form.file.remove"),
|
|
878
877
|
class: "flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-full text-content-muted hover:bg-fill-strong focus-visible:outline-2 focus-visible:outline-border-focus disabled:cursor-not-allowed",
|
|
879
|
-
onClick:
|
|
878
|
+
onClick: S
|
|
880
879
|
}, [
|
|
881
|
-
N(s(
|
|
880
|
+
N(s(de), {
|
|
882
881
|
name: "close",
|
|
883
882
|
size: 14
|
|
884
883
|
})
|
|
885
|
-
], 8,
|
|
886
|
-
])) : e.variant === "dropzone" ? (d(),
|
|
884
|
+
], 8, ao)
|
|
885
|
+
])) : e.variant === "dropzone" ? (d(), g("div", {
|
|
887
886
|
key: 1,
|
|
888
887
|
role: "button",
|
|
889
888
|
tabindex: "0",
|
|
890
889
|
"data-test": "file-dropzone",
|
|
891
890
|
"aria-disabled": e.disabled || void 0,
|
|
892
|
-
class:
|
|
893
|
-
onClick:
|
|
891
|
+
class: W(["cursor-pointer rounded-group border-2 border-dashed p-6 text-center text-body transition-colors duration-motion-fast focus-visible:outline-2 focus-visible:outline-border-focus", p.value ? "border-border-focus bg-tint-soft" : "border-border-control hover:bg-fill"]),
|
|
892
|
+
onClick: l[1] || (l[1] = (b) => !e.disabled && i.value?.click()),
|
|
894
893
|
onKeydown: [
|
|
895
|
-
|
|
896
|
-
|
|
894
|
+
l[2] || (l[2] = Fe(he((b) => !e.disabled && i.value?.click(), ["prevent"]), ["enter"])),
|
|
895
|
+
l[3] || (l[3] = Fe(he((b) => !e.disabled && i.value?.click(), ["prevent"]), ["space"]))
|
|
897
896
|
],
|
|
898
|
-
onDragover:
|
|
899
|
-
onDragleave:
|
|
900
|
-
onDrop:
|
|
901
|
-
|
|
897
|
+
onDragover: l[4] || (l[4] = he((b) => p.value = !0, ["prevent"])),
|
|
898
|
+
onDragleave: l[5] || (l[5] = he((b) => p.value = !1, ["prevent"])),
|
|
899
|
+
onDrop: l[6] || (l[6] = he((b) => {
|
|
900
|
+
p.value = !1, e.disabled || x(b.dataTransfer?.files?.[0]);
|
|
902
901
|
}, ["prevent"]))
|
|
903
902
|
}, [
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
], 42,
|
|
903
|
+
V("span", lo, L(s(r)("core.form.file.choose")), 1),
|
|
904
|
+
V("span", ro, L(" " + s(r)("core.form.file.drop")), 1)
|
|
905
|
+
], 42, oo)) : (d(), R(ae, {
|
|
907
906
|
key: 2,
|
|
908
907
|
disabled: e.disabled,
|
|
909
|
-
onClick:
|
|
908
|
+
onClick: l[7] || (l[7] = (b) => i.value?.click())
|
|
910
909
|
}, {
|
|
911
|
-
default:
|
|
912
|
-
|
|
910
|
+
default: _(() => [
|
|
911
|
+
X(L(s(r)("core.form.file.choose")), 1)
|
|
913
912
|
]),
|
|
914
913
|
_: 1
|
|
915
914
|
}, 8, ["disabled"]))
|
|
@@ -917,30 +916,30 @@ const Fa = { class: "w-full" }, Ba = ["id", "accept", "disabled", "aria-describe
|
|
|
917
916
|
]),
|
|
918
917
|
_: 2
|
|
919
918
|
}, [
|
|
920
|
-
|
|
919
|
+
h.$slots.trailing ? {
|
|
921
920
|
name: "trailing",
|
|
922
|
-
fn:
|
|
923
|
-
|
|
921
|
+
fn: _(() => [
|
|
922
|
+
j(h.$slots, "trailing")
|
|
924
923
|
]),
|
|
925
924
|
key: "0"
|
|
926
925
|
} : void 0,
|
|
927
|
-
|
|
926
|
+
h.$slots.labelTrailing ? {
|
|
928
927
|
name: "labelTrailing",
|
|
929
|
-
fn:
|
|
930
|
-
|
|
928
|
+
fn: _(() => [
|
|
929
|
+
j(h.$slots, "labelTrailing")
|
|
931
930
|
]),
|
|
932
931
|
key: "1"
|
|
933
932
|
} : void 0,
|
|
934
|
-
|
|
933
|
+
h.$slots.readonly ? {
|
|
935
934
|
name: "readonly",
|
|
936
|
-
fn:
|
|
937
|
-
|
|
935
|
+
fn: _(() => [
|
|
936
|
+
j(h.$slots, "readonly")
|
|
938
937
|
]),
|
|
939
938
|
key: "2"
|
|
940
939
|
} : void 0
|
|
941
940
|
]), 1040, ["value"]));
|
|
942
941
|
}
|
|
943
|
-
}),
|
|
942
|
+
}), no = ["disabled"], Rr = /* @__PURE__ */ Z({
|
|
944
943
|
__name: "FormGroupButton",
|
|
945
944
|
props: {
|
|
946
945
|
label: {},
|
|
@@ -948,18 +947,18 @@ const Fa = { class: "w-full" }, Ba = ["id", "accept", "disabled", "aria-describe
|
|
|
948
947
|
disabled: { type: Boolean, default: !1 }
|
|
949
948
|
},
|
|
950
949
|
emits: ["click"],
|
|
951
|
-
setup(
|
|
952
|
-
const e =
|
|
953
|
-
return (
|
|
954
|
-
default:
|
|
955
|
-
N(
|
|
956
|
-
default:
|
|
957
|
-
|
|
950
|
+
setup(o, { emit: a }) {
|
|
951
|
+
const e = o, t = a;
|
|
952
|
+
return (r, i) => (d(), R(Ft, null, {
|
|
953
|
+
default: _(() => [
|
|
954
|
+
N(Ot, { layout: "stacked" }, {
|
|
955
|
+
default: _(() => [
|
|
956
|
+
V("button", {
|
|
958
957
|
type: "button",
|
|
959
958
|
disabled: e.disabled,
|
|
960
|
-
class:
|
|
961
|
-
onClick:
|
|
962
|
-
},
|
|
959
|
+
class: W(["w-full py-1 text-center text-body focus-visible:outline-2 focus-visible:outline-border-focus disabled:text-content-disabled", e.tone === "critical" ? "text-content-destructive" : "text-content-link"]),
|
|
960
|
+
onClick: i[0] || (i[0] = (p) => t("click"))
|
|
961
|
+
}, L(e.label), 11, no)
|
|
963
962
|
]),
|
|
964
963
|
_: 1
|
|
965
964
|
})
|
|
@@ -967,31 +966,31 @@ const Fa = { class: "w-full" }, Ba = ["id", "accept", "disabled", "aria-describe
|
|
|
967
966
|
_: 1
|
|
968
967
|
}));
|
|
969
968
|
}
|
|
970
|
-
}),
|
|
969
|
+
}), Or = /* @__PURE__ */ Z({
|
|
971
970
|
__name: "FormIndent",
|
|
972
|
-
setup(
|
|
973
|
-
return
|
|
971
|
+
setup(o) {
|
|
972
|
+
return mt(jt, Et() + 1), (a, e) => j(a.$slots, "default");
|
|
974
973
|
}
|
|
975
974
|
});
|
|
976
|
-
function
|
|
977
|
-
return
|
|
975
|
+
function so(o, a) {
|
|
976
|
+
return a.filter((e) => (o?.[e] ?? "").trim() === "");
|
|
978
977
|
}
|
|
979
|
-
const
|
|
978
|
+
const io = ["id", "aria-labelledby"], uo = ["id", "value", "lang", "name", "rows", "placeholder", "maxlength", "disabled", "aria-required", "aria-invalid", "aria-describedby"], co = ["id", "value", "lang", "name", "placeholder", "maxlength", "disabled", "aria-required", "aria-invalid", "aria-describedby"], mo = {
|
|
980
979
|
key: 0,
|
|
981
980
|
class: "mt-1.5 flex items-center gap-2"
|
|
982
|
-
},
|
|
981
|
+
}, fo = {
|
|
983
982
|
key: 0,
|
|
984
983
|
class: "flex-1 text-footnote text-status-warning-content",
|
|
985
984
|
"data-test": "i18n-missing"
|
|
986
|
-
},
|
|
985
|
+
}, po = {
|
|
987
986
|
key: 1,
|
|
988
987
|
class: "flex-1"
|
|
989
|
-
},
|
|
988
|
+
}, vo = ["aria-label"], bo = ["id", "aria-selected", "tabindex", "aria-controls", "aria-label", "title", "onClick", "onKeydown"], yo = ["data-state"], go = { class: "w-full" }, ho = { class: "whitespace-pre-line break-words text-body text-content-strong" }, ko = ["aria-expanded"], _o = { class: "flex-1" }, xo = {
|
|
990
989
|
key: 0,
|
|
991
990
|
class: "mt-1 flex flex-col gap-1.5"
|
|
992
|
-
},
|
|
991
|
+
}, wo = ["title"], $o = /* @__PURE__ */ Z({
|
|
993
992
|
__name: "I18nField",
|
|
994
|
-
props: /* @__PURE__ */
|
|
993
|
+
props: /* @__PURE__ */ ye(/* @__PURE__ */ ce({
|
|
995
994
|
label: {},
|
|
996
995
|
labelHidden: { type: Boolean },
|
|
997
996
|
hint: {},
|
|
@@ -1009,211 +1008,211 @@ const Oa = ["id", "aria-labelledby"], ja = ["id", "value", "lang", "name", "rows
|
|
|
1009
1008
|
rows: {},
|
|
1010
1009
|
placeholder: {},
|
|
1011
1010
|
maxLength: {}
|
|
1012
|
-
}, { ...
|
|
1011
|
+
}, { ...fe, locales: void 0, defaultLocale: void 0, requiredLocales: () => [], multiline: !1, rows: 3, placeholder: void 0, maxLength: void 0 }), {
|
|
1013
1012
|
modelValue: { default: () => ({}) },
|
|
1014
1013
|
modelModifiers: {}
|
|
1015
1014
|
}),
|
|
1016
1015
|
emits: ["update:modelValue"],
|
|
1017
|
-
setup(
|
|
1018
|
-
const e =
|
|
1019
|
-
function
|
|
1016
|
+
setup(o, { expose: a }) {
|
|
1017
|
+
const e = o, t = ke(o, "modelValue"), { t: r, locale: i, availableLocales: p } = le(), u = gt(), v = ze(ht, null), x = Ae(), S = oe("field"), h = oe("root"), { editable: l } = Se(e), m = Pe(e.multiline ? "area" : "text", () => e.error || re.value ? "error" : e.disabled ? "locked" : "rest"), c = B(() => e.locales ?? v?.locales ?? p), k = B(() => e.defaultLocale ?? c.value[0] ?? ""), b = B(() => c.value.includes(k.value) ? [k.value, ...c.value.filter((T) => T !== k.value)] : c.value), y = G(null), w = B(() => y.value !== null && b.value.includes(y.value) ? y.value : b.value.includes(i.value) ? i.value : k.value), F = (T) => t.value[T] ?? "", q = (T) => F(T).trim() !== "", $ = (T) => T.toUpperCase();
|
|
1018
|
+
function E(T) {
|
|
1020
1019
|
try {
|
|
1021
|
-
return new Intl.DisplayNames([
|
|
1020
|
+
return new Intl.DisplayNames([u.intlLocale], { type: "language" }).of(T) ?? $(T);
|
|
1022
1021
|
} catch {
|
|
1023
|
-
return
|
|
1022
|
+
return $(T);
|
|
1024
1023
|
}
|
|
1025
1024
|
}
|
|
1026
|
-
const
|
|
1027
|
-
function
|
|
1028
|
-
|
|
1025
|
+
const H = (T) => T.map(E).join(", ");
|
|
1026
|
+
function O(T, K) {
|
|
1027
|
+
t.value = { ...t.value, [T]: K };
|
|
1029
1028
|
}
|
|
1030
|
-
const
|
|
1031
|
-
function
|
|
1032
|
-
|
|
1029
|
+
const D = (T) => `${x}-tab-${T}`;
|
|
1030
|
+
function J(T, K) {
|
|
1031
|
+
y.value = T, K && we(() => S.value?.focus());
|
|
1033
1032
|
}
|
|
1034
|
-
function
|
|
1035
|
-
const
|
|
1036
|
-
if (
|
|
1037
|
-
|
|
1038
|
-
const
|
|
1039
|
-
|
|
1033
|
+
function M(T, K) {
|
|
1034
|
+
const A = b.value.length - 1, ie = { ArrowRight: K + 1, ArrowLeft: K - 1, Home: 0, End: A }[T.key];
|
|
1035
|
+
if (ie === void 0) return;
|
|
1036
|
+
T.preventDefault();
|
|
1037
|
+
const xe = b.value[(ie + b.value.length) % b.value.length];
|
|
1038
|
+
xe !== void 0 && (J(xe, !1), we(() => document.getElementById(D(xe))?.focus()));
|
|
1040
1039
|
}
|
|
1041
|
-
const
|
|
1042
|
-
function
|
|
1043
|
-
|
|
1040
|
+
const Q = G(!1);
|
|
1041
|
+
function te(T) {
|
|
1042
|
+
h.value?.contains(T.relatedTarget) || (Q.value = !0);
|
|
1044
1043
|
}
|
|
1045
|
-
const
|
|
1046
|
-
function
|
|
1047
|
-
const
|
|
1048
|
-
|
|
1044
|
+
const se = B(() => so(t.value, e.requiredLocales)), re = B(() => Q.value && se.value.length > 0 ? r("core.form.i18n.required", { languages: H(se.value) }) : void 0), pe = B(() => e.requiredLocales.length > 0 ? se.value.length === 0 : b.value.some(q)), _e = B(() => b.value.filter((T) => !q(T) && !(re.value && se.value.includes(T)))), ge = B(() => q(k.value) && b.value.some((T) => T !== k.value && !q(T)));
|
|
1045
|
+
function C() {
|
|
1046
|
+
const T = F(k.value);
|
|
1047
|
+
t.value = { ...t.value, ...Object.fromEntries(b.value.filter((K) => !q(K)).map((K) => [K, T])) };
|
|
1049
1048
|
}
|
|
1050
|
-
const
|
|
1051
|
-
return
|
|
1052
|
-
value: s(
|
|
1049
|
+
const I = B(() => [i.value, k.value, ...b.value].find((T) => b.value.includes(T) && q(T))), n = B(() => b.value.filter((T) => T !== I.value)), f = B(() => n.value.filter(q).length), U = G(!1), Y = B(() => e.label && !l.value && I.value ? `${e.label} · ${$(I.value)}` : e.label);
|
|
1050
|
+
return a({ focus: () => S.value?.focus() }), (T, K) => (d(), R(be, P({ ...s(me)(e), label: Y.value, error: e.error ?? re.value, required: e.required || e.requiredLocales.length > 0 }, {
|
|
1051
|
+
value: s(l) ? pe.value ? "written" : null : I.value ? F(I.value) : null,
|
|
1053
1052
|
"row-layout": "stacked"
|
|
1054
|
-
}),
|
|
1055
|
-
default:
|
|
1056
|
-
|
|
1053
|
+
}), ue({
|
|
1054
|
+
default: _(({ id: A, describedby: ie, invalid: xe }) => [
|
|
1055
|
+
V("div", {
|
|
1057
1056
|
ref_key: "root",
|
|
1058
|
-
ref:
|
|
1057
|
+
ref: h,
|
|
1059
1058
|
class: "w-full",
|
|
1060
|
-
onFocusout:
|
|
1059
|
+
onFocusout: te
|
|
1061
1060
|
}, [
|
|
1062
|
-
|
|
1063
|
-
id: `${s(
|
|
1061
|
+
V("div", {
|
|
1062
|
+
id: `${s(x)}-panel`,
|
|
1064
1063
|
role: "tabpanel",
|
|
1065
|
-
"aria-labelledby":
|
|
1064
|
+
"aria-labelledby": D(w.value)
|
|
1066
1065
|
}, [
|
|
1067
|
-
|
|
1068
|
-
class:
|
|
1066
|
+
V("div", {
|
|
1067
|
+
class: W(["w-full", s(m)])
|
|
1069
1068
|
}, [
|
|
1070
|
-
e.multiline ? (d(),
|
|
1069
|
+
e.multiline ? (d(), g("textarea", {
|
|
1071
1070
|
key: 0,
|
|
1072
|
-
id:
|
|
1071
|
+
id: A,
|
|
1073
1072
|
ref_key: "field",
|
|
1074
|
-
ref:
|
|
1075
|
-
value:
|
|
1076
|
-
lang:
|
|
1073
|
+
ref: S,
|
|
1074
|
+
value: F(w.value),
|
|
1075
|
+
lang: w.value,
|
|
1077
1076
|
name: e.name,
|
|
1078
1077
|
rows: e.rows,
|
|
1079
1078
|
placeholder: e.placeholder,
|
|
1080
1079
|
maxlength: e.maxLength,
|
|
1081
1080
|
disabled: e.disabled,
|
|
1082
1081
|
"aria-required": e.required || void 0,
|
|
1083
|
-
"aria-invalid":
|
|
1084
|
-
"aria-describedby":
|
|
1082
|
+
"aria-invalid": xe || void 0,
|
|
1083
|
+
"aria-describedby": ie,
|
|
1085
1084
|
"data-test": "i18n-input",
|
|
1086
1085
|
class: "block w-full resize-y border-0 bg-transparent px-0 py-1 text-body text-content-strong placeholder:text-content-disabled focus:outline-none focus:ring-0 disabled:cursor-not-allowed",
|
|
1087
|
-
onInput:
|
|
1088
|
-
}, null, 40,
|
|
1086
|
+
onInput: K[0] || (K[0] = (Me) => O(w.value, Me.target.value))
|
|
1087
|
+
}, null, 40, uo)) : (d(), g("input", {
|
|
1089
1088
|
key: 1,
|
|
1090
|
-
id:
|
|
1089
|
+
id: A,
|
|
1091
1090
|
ref_key: "field",
|
|
1092
|
-
ref:
|
|
1093
|
-
value:
|
|
1094
|
-
lang:
|
|
1091
|
+
ref: S,
|
|
1092
|
+
value: F(w.value),
|
|
1093
|
+
lang: w.value,
|
|
1095
1094
|
type: "text",
|
|
1096
1095
|
name: e.name,
|
|
1097
1096
|
placeholder: e.placeholder,
|
|
1098
1097
|
maxlength: e.maxLength,
|
|
1099
1098
|
disabled: e.disabled,
|
|
1100
1099
|
"aria-required": e.required || void 0,
|
|
1101
|
-
"aria-invalid":
|
|
1102
|
-
"aria-describedby":
|
|
1100
|
+
"aria-invalid": xe || void 0,
|
|
1101
|
+
"aria-describedby": ie,
|
|
1103
1102
|
"data-test": "i18n-input",
|
|
1104
1103
|
class: "block w-full min-w-0 border-0 bg-transparent px-0 py-1 text-body text-content-strong placeholder:text-content-disabled focus:outline-none focus:ring-0 disabled:cursor-not-allowed",
|
|
1105
|
-
onInput:
|
|
1106
|
-
}, null, 40,
|
|
1104
|
+
onInput: K[1] || (K[1] = (Me) => O(w.value, Me.target.value))
|
|
1105
|
+
}, null, 40, co))
|
|
1107
1106
|
], 2)
|
|
1108
|
-
], 8,
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1107
|
+
], 8, io),
|
|
1108
|
+
_e.value.length > 0 || ge.value ? (d(), g("div", mo, [
|
|
1109
|
+
_e.value.length > 0 ? (d(), g("p", fo, L(s(r)("core.form.i18n.missing", { languages: H(_e.value) })), 1)) : (d(), g("span", po)),
|
|
1110
|
+
ge.value && !e.disabled ? (d(), g("button", {
|
|
1112
1111
|
key: 2,
|
|
1113
1112
|
type: "button",
|
|
1114
1113
|
"data-test": "i18n-copy",
|
|
1115
1114
|
class: "shrink-0 cursor-pointer rounded-control bg-tint-soft px-2.5 py-1.5 text-footnote font-medium text-content-link transition-colors duration-motion-fast hover:bg-fill focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus",
|
|
1116
|
-
onClick:
|
|
1117
|
-
},
|
|
1118
|
-
])) :
|
|
1115
|
+
onClick: C
|
|
1116
|
+
}, L(s(r)("core.form.i18n.copy", { language: $(k.value) })), 1)) : z("", !0)
|
|
1117
|
+
])) : z("", !0)
|
|
1119
1118
|
], 544)
|
|
1120
1119
|
]),
|
|
1121
|
-
labelTrailing:
|
|
1122
|
-
|
|
1120
|
+
labelTrailing: _(() => [
|
|
1121
|
+
V("div", {
|
|
1123
1122
|
role: "tablist",
|
|
1124
|
-
"aria-label": s(
|
|
1123
|
+
"aria-label": s(r)("core.form.i18n.languages"),
|
|
1125
1124
|
class: "flex shrink-0 gap-0.5 rounded-control bg-fill p-0.5",
|
|
1126
1125
|
"data-test": "i18n-tabs"
|
|
1127
1126
|
}, [
|
|
1128
|
-
(d(!0),
|
|
1129
|
-
id:
|
|
1130
|
-
key:
|
|
1127
|
+
(d(!0), g(ee, null, ve(b.value, (A, ie) => (d(), g("button", {
|
|
1128
|
+
id: D(A),
|
|
1129
|
+
key: A,
|
|
1131
1130
|
type: "button",
|
|
1132
1131
|
role: "tab",
|
|
1133
|
-
"aria-selected":
|
|
1134
|
-
tabindex:
|
|
1135
|
-
"aria-controls": `${s(
|
|
1136
|
-
"aria-label": s(
|
|
1137
|
-
title:
|
|
1138
|
-
class:
|
|
1139
|
-
onClick: (
|
|
1140
|
-
onKeydown: (
|
|
1132
|
+
"aria-selected": A === w.value,
|
|
1133
|
+
tabindex: A === w.value ? 0 : -1,
|
|
1134
|
+
"aria-controls": `${s(x)}-panel`,
|
|
1135
|
+
"aria-label": s(r)(q(A) ? "core.form.i18n.tab_written" : "core.form.i18n.tab_empty", { language: E(A) }),
|
|
1136
|
+
title: E(A),
|
|
1137
|
+
class: W(["flex min-h-7 cursor-pointer items-center gap-1.5 rounded-control px-2.5 py-1 text-footnote font-semibold transition-colors duration-motion-fast focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus", A === w.value ? "bg-segment-selected text-content-strong shadow-sm" : "text-content-muted hover:text-content-strong"]),
|
|
1138
|
+
onClick: (xe) => J(A, !0),
|
|
1139
|
+
onKeydown: (xe) => M(xe, ie)
|
|
1141
1140
|
}, [
|
|
1142
|
-
|
|
1143
|
-
|
|
1141
|
+
X(L($(A)) + " ", 1),
|
|
1142
|
+
V("span", {
|
|
1144
1143
|
"aria-hidden": "true",
|
|
1145
|
-
class:
|
|
1144
|
+
class: W(["size-1.5 rounded-full", q(A) ? "bg-status-success-solid" : re.value && se.value.includes(A) ? "bg-content-destructive" : "bg-content-disabled"]),
|
|
1146
1145
|
"data-test": "i18n-dot",
|
|
1147
|
-
"data-state":
|
|
1148
|
-
}, null, 10,
|
|
1149
|
-
], 42,
|
|
1150
|
-
], 8,
|
|
1146
|
+
"data-state": q(A) ? "written" : re.value && se.value.includes(A) ? "required" : "empty"
|
|
1147
|
+
}, null, 10, yo)
|
|
1148
|
+
], 42, bo))), 128))
|
|
1149
|
+
], 8, vo)
|
|
1151
1150
|
]),
|
|
1152
1151
|
_: 2
|
|
1153
1152
|
}, [
|
|
1154
|
-
|
|
1153
|
+
I.value ? {
|
|
1155
1154
|
name: "readonly",
|
|
1156
|
-
fn:
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1155
|
+
fn: _(() => [
|
|
1156
|
+
V("div", go, [
|
|
1157
|
+
V("p", ho, L(F(I.value)), 1),
|
|
1158
|
+
n.value.length > 0 ? (d(), g(ee, { key: 0 }, [
|
|
1159
|
+
V("button", {
|
|
1161
1160
|
type: "button",
|
|
1162
|
-
"aria-expanded":
|
|
1161
|
+
"aria-expanded": U.value,
|
|
1163
1162
|
class: "mt-1.5 flex w-full cursor-pointer items-center gap-2 text-left text-footnote text-content-muted focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus",
|
|
1164
|
-
onClick:
|
|
1163
|
+
onClick: K[2] || (K[2] = (A) => U.value = !U.value)
|
|
1165
1164
|
}, [
|
|
1166
|
-
|
|
1167
|
-
N(s(
|
|
1165
|
+
V("span", _o, L(s(r)("core.form.i18n.more", { count: n.value.length, filled: f.value })), 1),
|
|
1166
|
+
N(s(de), {
|
|
1168
1167
|
name: "arrowRightSLine",
|
|
1169
1168
|
size: 16,
|
|
1170
|
-
class:
|
|
1169
|
+
class: W(["shrink-0 transition-transform duration-motion-fast", U.value ? "rotate-90" : ""])
|
|
1171
1170
|
}, null, 8, ["class"])
|
|
1172
|
-
], 8,
|
|
1173
|
-
|
|
1174
|
-
(d(!0),
|
|
1175
|
-
key:
|
|
1171
|
+
], 8, ko),
|
|
1172
|
+
U.value ? (d(), g("dl", xo, [
|
|
1173
|
+
(d(!0), g(ee, null, ve(n.value, (A) => (d(), g("div", {
|
|
1174
|
+
key: A,
|
|
1176
1175
|
class: "flex gap-2 text-body"
|
|
1177
1176
|
}, [
|
|
1178
|
-
|
|
1177
|
+
V("dt", {
|
|
1179
1178
|
class: "w-8 shrink-0 text-footnote font-semibold leading-6 text-content-muted",
|
|
1180
|
-
title:
|
|
1181
|
-
},
|
|
1182
|
-
|
|
1183
|
-
class:
|
|
1184
|
-
},
|
|
1179
|
+
title: E(A)
|
|
1180
|
+
}, L($(A)), 9, wo),
|
|
1181
|
+
V("dd", {
|
|
1182
|
+
class: W(["min-w-0 flex-1 whitespace-pre-line break-words", q(A) ? "text-content-strong" : "text-content-disabled"])
|
|
1183
|
+
}, L(q(A) ? F(A) : s(r)("core.state.no_value")), 3)
|
|
1185
1184
|
]))), 128))
|
|
1186
|
-
])) :
|
|
1187
|
-
], 64)) :
|
|
1185
|
+
])) : z("", !0)
|
|
1186
|
+
], 64)) : z("", !0)
|
|
1188
1187
|
])
|
|
1189
1188
|
]),
|
|
1190
1189
|
key: "0"
|
|
1191
1190
|
} : void 0,
|
|
1192
|
-
|
|
1191
|
+
T.$slots.trailing ? {
|
|
1193
1192
|
name: "trailing",
|
|
1194
|
-
fn:
|
|
1195
|
-
|
|
1193
|
+
fn: _(() => [
|
|
1194
|
+
j(T.$slots, "trailing")
|
|
1196
1195
|
]),
|
|
1197
1196
|
key: "1"
|
|
1198
1197
|
} : void 0
|
|
1199
1198
|
]), 1040, ["value"]));
|
|
1200
1199
|
}
|
|
1201
|
-
}),
|
|
1202
|
-
function
|
|
1203
|
-
return
|
|
1200
|
+
}), Vo = "unsupported_characters", Co = /[\u{10000}-\u{10FFFF}]/u;
|
|
1201
|
+
function So(o) {
|
|
1202
|
+
return Co.test(o);
|
|
1204
1203
|
}
|
|
1205
|
-
function
|
|
1206
|
-
if (typeof
|
|
1207
|
-
|
|
1208
|
-
else if (Array.isArray(
|
|
1209
|
-
|
|
1210
|
-
else if (
|
|
1211
|
-
for (const [
|
|
1204
|
+
function Ue(o, a, e) {
|
|
1205
|
+
if (typeof o == "string")
|
|
1206
|
+
So(o) && e.addIssue({ code: "custom", path: a, params: { code: Vo } });
|
|
1207
|
+
else if (Array.isArray(o))
|
|
1208
|
+
o.forEach((t, r) => Ue(t, [...a, r], e));
|
|
1209
|
+
else if (o && typeof o == "object")
|
|
1210
|
+
for (const [t, r] of Object.entries(o)) Ue(r, [...a, t], e);
|
|
1212
1211
|
}
|
|
1213
|
-
function
|
|
1214
|
-
|
|
1212
|
+
function jr(o, a) {
|
|
1213
|
+
Ue(o, [], a);
|
|
1215
1214
|
}
|
|
1216
|
-
const
|
|
1215
|
+
const Er = /* @__PURE__ */ Z({
|
|
1217
1216
|
__name: "MoneyField",
|
|
1218
1217
|
props: /* @__PURE__ */ ce({
|
|
1219
1218
|
label: {},
|
|
@@ -1232,50 +1231,50 @@ const To = /* @__PURE__ */ G({
|
|
|
1232
1231
|
blankZero: { type: Boolean },
|
|
1233
1232
|
negative: { type: Boolean },
|
|
1234
1233
|
width: {}
|
|
1235
|
-
}, { ...
|
|
1234
|
+
}, { ...fe, modelValue: void 0, decimals: 2, blankZero: !1, negative: !1, width: "sm" }),
|
|
1236
1235
|
emits: ["update:modelValue", "focus", "blur"],
|
|
1237
|
-
setup(
|
|
1238
|
-
const
|
|
1239
|
-
return
|
|
1236
|
+
setup(o, { expose: a, emit: e }) {
|
|
1237
|
+
const t = o, r = e, i = oe("field");
|
|
1238
|
+
return a({ focus: () => i.value?.focus() }), (p, u) => (d(), R(kt, P({
|
|
1240
1239
|
ref_key: "field",
|
|
1241
|
-
ref:
|
|
1242
|
-
"model-value":
|
|
1243
|
-
"onUpdate:modelValue":
|
|
1244
|
-
}, s(
|
|
1245
|
-
decimals:
|
|
1246
|
-
negative:
|
|
1247
|
-
"blank-zero":
|
|
1248
|
-
suffix:
|
|
1249
|
-
width:
|
|
1250
|
-
onFocus:
|
|
1251
|
-
onBlur:
|
|
1252
|
-
}),
|
|
1253
|
-
|
|
1240
|
+
ref: i,
|
|
1241
|
+
"model-value": t.modelValue,
|
|
1242
|
+
"onUpdate:modelValue": u[0] || (u[0] = (v) => r("update:modelValue", v))
|
|
1243
|
+
}, s(me)(t), {
|
|
1244
|
+
decimals: t.decimals,
|
|
1245
|
+
negative: t.negative,
|
|
1246
|
+
"blank-zero": t.blankZero,
|
|
1247
|
+
suffix: t.currency,
|
|
1248
|
+
width: t.width,
|
|
1249
|
+
onFocus: u[1] || (u[1] = (v) => r("focus", v)),
|
|
1250
|
+
onBlur: u[2] || (u[2] = (v) => r("blur", v))
|
|
1251
|
+
}), ue({ _: 2 }, [
|
|
1252
|
+
p.$slots.trailing ? {
|
|
1254
1253
|
name: "trailing",
|
|
1255
|
-
fn:
|
|
1256
|
-
|
|
1254
|
+
fn: _(() => [
|
|
1255
|
+
j(p.$slots, "trailing")
|
|
1257
1256
|
]),
|
|
1258
1257
|
key: "0"
|
|
1259
1258
|
} : void 0,
|
|
1260
|
-
|
|
1259
|
+
p.$slots.labelTrailing ? {
|
|
1261
1260
|
name: "labelTrailing",
|
|
1262
|
-
fn:
|
|
1263
|
-
|
|
1261
|
+
fn: _(() => [
|
|
1262
|
+
j(p.$slots, "labelTrailing")
|
|
1264
1263
|
]),
|
|
1265
1264
|
key: "1"
|
|
1266
1265
|
} : void 0,
|
|
1267
|
-
|
|
1266
|
+
p.$slots.readonly ? {
|
|
1268
1267
|
name: "readonly",
|
|
1269
|
-
fn:
|
|
1270
|
-
|
|
1268
|
+
fn: _(() => [
|
|
1269
|
+
j(p.$slots, "readonly")
|
|
1271
1270
|
]),
|
|
1272
1271
|
key: "2"
|
|
1273
1272
|
} : void 0
|
|
1274
1273
|
]), 1040, ["model-value", "decimals", "negative", "blank-zero", "suffix", "width"]));
|
|
1275
1274
|
}
|
|
1276
|
-
}),
|
|
1275
|
+
}), qo = { class: "flex flex-col gap-2" }, Fo = ["onClick"], Nr = /* @__PURE__ */ Z({
|
|
1277
1276
|
__name: "MonthYearField",
|
|
1278
|
-
props: /* @__PURE__ */
|
|
1277
|
+
props: /* @__PURE__ */ ye(/* @__PURE__ */ ce({
|
|
1279
1278
|
label: {},
|
|
1280
1279
|
labelHidden: { type: Boolean },
|
|
1281
1280
|
hint: {},
|
|
@@ -1289,67 +1288,67 @@ const To = /* @__PURE__ */ G({
|
|
|
1289
1288
|
minYear: {},
|
|
1290
1289
|
maxYear: {},
|
|
1291
1290
|
placeholder: {}
|
|
1292
|
-
}, { ...
|
|
1291
|
+
}, { ...fe, placeholder: void 0, minYear: 1970, maxYear: () => (/* @__PURE__ */ new Date()).getFullYear() + 1 }), {
|
|
1293
1292
|
month: { default: null },
|
|
1294
1293
|
monthModifiers: {},
|
|
1295
1294
|
year: { default: null },
|
|
1296
1295
|
yearModifiers: {}
|
|
1297
1296
|
}),
|
|
1298
1297
|
emits: ["update:month", "update:year"],
|
|
1299
|
-
setup(
|
|
1300
|
-
const
|
|
1301
|
-
function
|
|
1302
|
-
e.value =
|
|
1298
|
+
setup(o) {
|
|
1299
|
+
const a = o, e = ke(o, "month"), t = ke(o, "year"), { t: r } = le(), i = B(() => e.value !== null && e.value >= 1 && e.value <= 12), p = (S, h) => r(`core.form.months.${h}.${S}`), u = B(() => i.value && t.value !== null ? r("core.form.months.with_year", { month: p(e.value, "long"), year: t.value }) : t.value !== null ? String(t.value) : i.value ? p(e.value, "long") : "");
|
|
1300
|
+
function v(S, h) {
|
|
1301
|
+
e.value = S.month, t.value = S.year, h();
|
|
1303
1302
|
}
|
|
1304
|
-
function
|
|
1305
|
-
e.value = null,
|
|
1303
|
+
function x(S) {
|
|
1304
|
+
e.value = null, t.value = null, S();
|
|
1306
1305
|
}
|
|
1307
|
-
return (
|
|
1308
|
-
value:
|
|
1309
|
-
}),
|
|
1310
|
-
default:
|
|
1311
|
-
N(
|
|
1312
|
-
label:
|
|
1306
|
+
return (S, h) => (d(), R(be, P(s(me)(a), {
|
|
1307
|
+
value: u.value || null
|
|
1308
|
+
}), ue({
|
|
1309
|
+
default: _(({ id: l, describedby: m, invalid: c }) => [
|
|
1310
|
+
N(Ke, {
|
|
1311
|
+
label: a.label ?? u.value,
|
|
1313
1312
|
width: "sm",
|
|
1314
1313
|
placement: "bottom-start",
|
|
1315
1314
|
arrow: !1
|
|
1316
1315
|
}, {
|
|
1317
|
-
trigger:
|
|
1318
|
-
N(
|
|
1319
|
-
expanded:
|
|
1320
|
-
disabled:
|
|
1321
|
-
invalid:
|
|
1322
|
-
placeholder:
|
|
1323
|
-
onClick:
|
|
1316
|
+
trigger: _(({ toggle: k, presented: b }) => [
|
|
1317
|
+
N(yt, P({ id: l, "aria-describedby": m }, {
|
|
1318
|
+
expanded: b,
|
|
1319
|
+
disabled: a.disabled,
|
|
1320
|
+
invalid: c,
|
|
1321
|
+
placeholder: a.placeholder ?? s(r)("core.form.select.choose"),
|
|
1322
|
+
onClick: k
|
|
1324
1323
|
}), {
|
|
1325
|
-
default:
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
N(s(
|
|
1324
|
+
default: _(() => [
|
|
1325
|
+
u.value ? (d(), g(ee, { key: 0 }, [
|
|
1326
|
+
X(L(u.value), 1),
|
|
1327
|
+
N(s(de), {
|
|
1329
1328
|
name: "calendarLine",
|
|
1330
1329
|
size: 16,
|
|
1331
1330
|
class: "ml-2 shrink-0 text-content-muted"
|
|
1332
1331
|
})
|
|
1333
|
-
], 64)) :
|
|
1332
|
+
], 64)) : z("", !0)
|
|
1334
1333
|
]),
|
|
1335
1334
|
_: 1
|
|
1336
1335
|
}, 16, ["expanded", "disabled", "invalid", "placeholder", "onClick"])
|
|
1337
1336
|
]),
|
|
1338
|
-
default:
|
|
1339
|
-
|
|
1340
|
-
N(
|
|
1337
|
+
default: _(({ dismiss: k }) => [
|
|
1338
|
+
V("div", qo, [
|
|
1339
|
+
N(Qt, {
|
|
1341
1340
|
month: e.value,
|
|
1342
|
-
year:
|
|
1343
|
-
"min-year":
|
|
1344
|
-
"max-year":
|
|
1345
|
-
onPick: (
|
|
1341
|
+
year: t.value,
|
|
1342
|
+
"min-year": a.minYear,
|
|
1343
|
+
"max-year": a.maxYear,
|
|
1344
|
+
onPick: (b) => v(b, k)
|
|
1346
1345
|
}, null, 8, ["month", "year", "min-year", "max-year", "onPick"]),
|
|
1347
|
-
|
|
1346
|
+
i.value || t.value !== null ? (d(), g("button", {
|
|
1348
1347
|
key: 0,
|
|
1349
1348
|
type: "button",
|
|
1350
1349
|
class: "cursor-pointer self-start rounded-control px-1 text-footnote text-content-link",
|
|
1351
|
-
onClick: (
|
|
1352
|
-
},
|
|
1350
|
+
onClick: (b) => x(k)
|
|
1351
|
+
}, L(s(r)("core.form.select.clear")), 9, Fo)) : z("", !0)
|
|
1353
1352
|
])
|
|
1354
1353
|
]),
|
|
1355
1354
|
_: 2
|
|
@@ -1357,32 +1356,32 @@ const To = /* @__PURE__ */ G({
|
|
|
1357
1356
|
]),
|
|
1358
1357
|
_: 2
|
|
1359
1358
|
}, [
|
|
1360
|
-
|
|
1359
|
+
S.$slots.trailing ? {
|
|
1361
1360
|
name: "trailing",
|
|
1362
|
-
fn:
|
|
1363
|
-
S
|
|
1361
|
+
fn: _(() => [
|
|
1362
|
+
j(S.$slots, "trailing")
|
|
1364
1363
|
]),
|
|
1365
1364
|
key: "0"
|
|
1366
1365
|
} : void 0,
|
|
1367
|
-
|
|
1366
|
+
S.$slots.labelTrailing ? {
|
|
1368
1367
|
name: "labelTrailing",
|
|
1369
|
-
fn:
|
|
1370
|
-
S
|
|
1368
|
+
fn: _(() => [
|
|
1369
|
+
j(S.$slots, "labelTrailing")
|
|
1371
1370
|
]),
|
|
1372
1371
|
key: "1"
|
|
1373
1372
|
} : void 0,
|
|
1374
|
-
|
|
1373
|
+
S.$slots.readonly ? {
|
|
1375
1374
|
name: "readonly",
|
|
1376
|
-
fn:
|
|
1377
|
-
S
|
|
1375
|
+
fn: _(() => [
|
|
1376
|
+
j(S.$slots, "readonly")
|
|
1378
1377
|
]),
|
|
1379
1378
|
key: "2"
|
|
1380
1379
|
} : void 0
|
|
1381
1380
|
]), 1040, ["value"]));
|
|
1382
1381
|
}
|
|
1383
|
-
}),
|
|
1382
|
+
}), Bo = { class: "flex min-w-0 flex-wrap items-center gap-1.5 py-0.5" }, Lo = { class: "truncate" }, To = ["disabled", "aria-label", "onClick"], Do = ["id", "disabled", "aria-expanded", "aria-invalid", "aria-describedby", "aria-busy"], zo = ["id", "disabled", "aria-invalid", "aria-describedby", "aria-busy", "onClick"], Mo = { class: "max-h-72 overflow-y-auto" }, Ro = { class: "flex items-center justify-between gap-2" }, rt = "inline-flex min-h-7 cursor-pointer items-center gap-1 rounded-control bg-fill px-2.5 py-1 text-body text-content-muted hover:bg-fill-strong focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus disabled:cursor-not-allowed disabled:opacity-45", Oo = /* @__PURE__ */ Z({
|
|
1384
1383
|
__name: "MultiSelectField",
|
|
1385
|
-
props: /* @__PURE__ */
|
|
1384
|
+
props: /* @__PURE__ */ ye(/* @__PURE__ */ ce({
|
|
1386
1385
|
label: {},
|
|
1387
1386
|
labelHidden: { type: Boolean },
|
|
1388
1387
|
hint: {},
|
|
@@ -1397,114 +1396,114 @@ const To = /* @__PURE__ */ G({
|
|
|
1397
1396
|
selected: {},
|
|
1398
1397
|
placeholder: {},
|
|
1399
1398
|
searchFrom: {}
|
|
1400
|
-
}, { ...
|
|
1399
|
+
}, { ...fe, selected: () => [], placeholder: void 0, searchFrom: 9 }), {
|
|
1401
1400
|
modelValue: { default: () => [] },
|
|
1402
1401
|
modelModifiers: {}
|
|
1403
1402
|
}),
|
|
1404
1403
|
emits: ["update:modelValue"],
|
|
1405
|
-
setup(
|
|
1406
|
-
const
|
|
1407
|
-
const
|
|
1408
|
-
|
|
1409
|
-
}),
|
|
1410
|
-
const
|
|
1411
|
-
return
|
|
1412
|
-
})),
|
|
1413
|
-
function
|
|
1414
|
-
|
|
1404
|
+
setup(o) {
|
|
1405
|
+
const a = o, e = ke(o, "modelValue"), { t } = le(), r = He(), i = oe("sheet"), p = G(!1), u = na(() => a.options, (l) => {
|
|
1406
|
+
const m = e.value.filter((c) => l.some((k) => k.value === c));
|
|
1407
|
+
m.length !== e.value.length && (e.value = m);
|
|
1408
|
+
}), v = B(() => e.value.flatMap((l) => {
|
|
1409
|
+
const m = u.known.value.find((c) => c.value === l) ?? a.selected.find((c) => c.value === l);
|
|
1410
|
+
return m ? [m] : [];
|
|
1411
|
+
})), x = B(() => a.placeholder ?? t("core.form.select.choose"));
|
|
1412
|
+
function S(l) {
|
|
1413
|
+
l !== null && (e.value = e.value.includes(l) ? e.value.filter((m) => m !== l) : [...e.value, l]);
|
|
1415
1414
|
}
|
|
1416
|
-
const
|
|
1417
|
-
return (
|
|
1418
|
-
value:
|
|
1415
|
+
const h = (l) => e.value = e.value.filter((m) => m !== l);
|
|
1416
|
+
return (l, m) => (d(), R(be, P(s(me)(a), {
|
|
1417
|
+
value: v.value.length ? v.value.map((c) => c.label).join(", ") : null,
|
|
1419
1418
|
"row-layout": "stacked"
|
|
1420
|
-
}),
|
|
1421
|
-
default:
|
|
1422
|
-
|
|
1423
|
-
(d(!0),
|
|
1424
|
-
key: String(
|
|
1419
|
+
}), ue({
|
|
1420
|
+
default: _(({ id: c, describedby: k, invalid: b }) => [
|
|
1421
|
+
V("div", Bo, [
|
|
1422
|
+
(d(!0), g(ee, null, ve(v.value, (y) => (d(), g("span", {
|
|
1423
|
+
key: String(y.value),
|
|
1425
1424
|
"data-test": "chip",
|
|
1426
1425
|
class: "inline-flex min-h-7 max-w-full items-center gap-1 rounded-full bg-tint-soft pl-3 pr-1 text-subheadline font-medium text-content-link"
|
|
1427
1426
|
}, [
|
|
1428
|
-
|
|
1429
|
-
|
|
1427
|
+
V("span", Lo, L(y.label), 1),
|
|
1428
|
+
V("button", {
|
|
1430
1429
|
type: "button",
|
|
1431
|
-
disabled:
|
|
1432
|
-
"aria-label": `${s(
|
|
1430
|
+
disabled: a.disabled,
|
|
1431
|
+
"aria-label": `${s(t)("core.form.select.clear")}: ${y.label}`,
|
|
1433
1432
|
class: "flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-full hover:bg-fill focus-visible:outline-2 focus-visible:outline-border-focus disabled:cursor-not-allowed",
|
|
1434
|
-
onClick: (
|
|
1433
|
+
onClick: (w) => h(y.value)
|
|
1435
1434
|
}, [
|
|
1436
|
-
N(s(
|
|
1435
|
+
N(s(de), {
|
|
1437
1436
|
name: "close",
|
|
1438
1437
|
size: 12
|
|
1439
1438
|
})
|
|
1440
|
-
], 8,
|
|
1439
|
+
], 8, To)
|
|
1441
1440
|
]))), 128)),
|
|
1442
|
-
s(
|
|
1441
|
+
s(r) ? (d(), g("button", {
|
|
1443
1442
|
key: 0,
|
|
1444
|
-
id:
|
|
1443
|
+
id: c,
|
|
1445
1444
|
type: "button",
|
|
1446
|
-
disabled:
|
|
1445
|
+
disabled: a.disabled,
|
|
1447
1446
|
"aria-haspopup": "dialog",
|
|
1448
|
-
"aria-expanded":
|
|
1449
|
-
"aria-invalid":
|
|
1450
|
-
"aria-describedby":
|
|
1451
|
-
"aria-busy": s(
|
|
1452
|
-
class:
|
|
1453
|
-
onClick:
|
|
1447
|
+
"aria-expanded": p.value,
|
|
1448
|
+
"aria-invalid": b || void 0,
|
|
1449
|
+
"aria-describedby": k,
|
|
1450
|
+
"aria-busy": s(u).loading.value || void 0,
|
|
1451
|
+
class: W(rt),
|
|
1452
|
+
onClick: m[0] || (m[0] = (y) => i.value?.present())
|
|
1454
1453
|
}, [
|
|
1455
|
-
s(
|
|
1454
|
+
s(u).loading.value ? (d(), R(s(de), {
|
|
1456
1455
|
key: 0,
|
|
1457
1456
|
name: "loader4Line",
|
|
1458
1457
|
size: 14,
|
|
1459
1458
|
class: "shrink-0 animate-spin"
|
|
1460
|
-
})) :
|
|
1461
|
-
|
|
1462
|
-
], 8,
|
|
1459
|
+
})) : z("", !0),
|
|
1460
|
+
X(" " + L(v.value.length ? s(t)("core.actions.edit") : x.value), 1)
|
|
1461
|
+
], 8, Do)) : (d(), R(Ke, {
|
|
1463
1462
|
key: 1,
|
|
1464
|
-
label:
|
|
1463
|
+
label: a.label ?? x.value,
|
|
1465
1464
|
width: "lg",
|
|
1466
1465
|
"match-trigger-width": "",
|
|
1467
1466
|
placement: "bottom-start",
|
|
1468
1467
|
arrow: !1
|
|
1469
1468
|
}, {
|
|
1470
|
-
trigger:
|
|
1471
|
-
|
|
1472
|
-
id:
|
|
1469
|
+
trigger: _(({ toggle: y, attrs: w }) => [
|
|
1470
|
+
V("button", P({
|
|
1471
|
+
id: c,
|
|
1473
1472
|
type: "button"
|
|
1474
|
-
},
|
|
1473
|
+
}, w, {
|
|
1475
1474
|
"aria-haspopup": "listbox",
|
|
1476
|
-
disabled:
|
|
1477
|
-
"aria-invalid":
|
|
1478
|
-
"aria-describedby":
|
|
1479
|
-
"aria-busy": s(
|
|
1480
|
-
class:
|
|
1481
|
-
onClick:
|
|
1475
|
+
disabled: a.disabled,
|
|
1476
|
+
"aria-invalid": b || void 0,
|
|
1477
|
+
"aria-describedby": k,
|
|
1478
|
+
"aria-busy": s(u).loading.value || void 0,
|
|
1479
|
+
class: rt,
|
|
1480
|
+
onClick: y
|
|
1482
1481
|
}), [
|
|
1483
|
-
s(
|
|
1482
|
+
s(u).loading.value ? (d(), R(s(de), {
|
|
1484
1483
|
key: 0,
|
|
1485
1484
|
name: "loader4Line",
|
|
1486
1485
|
size: 14,
|
|
1487
1486
|
class: "shrink-0 animate-spin"
|
|
1488
|
-
})) :
|
|
1489
|
-
|
|
1490
|
-
], 16,
|
|
1487
|
+
})) : z("", !0),
|
|
1488
|
+
X(" " + L(v.value.length ? s(t)("core.actions.edit") : x.value), 1)
|
|
1489
|
+
], 16, zo)
|
|
1491
1490
|
]),
|
|
1492
|
-
default:
|
|
1493
|
-
|
|
1494
|
-
N(
|
|
1495
|
-
options: s(
|
|
1496
|
-
status: s(
|
|
1491
|
+
default: _(() => [
|
|
1492
|
+
V("div", Mo, [
|
|
1493
|
+
N(et, {
|
|
1494
|
+
options: s(u).rows.value,
|
|
1495
|
+
status: s(u).status.value,
|
|
1497
1496
|
"model-value": e.value,
|
|
1498
1497
|
multiple: "",
|
|
1499
|
-
"search-from":
|
|
1498
|
+
"search-from": a.searchFrom,
|
|
1500
1499
|
presentation: "plain",
|
|
1501
|
-
onSelect:
|
|
1502
|
-
onRetry:
|
|
1503
|
-
},
|
|
1504
|
-
|
|
1500
|
+
onSelect: S,
|
|
1501
|
+
onRetry: m[1] || (m[1] = (y) => s(u).reload())
|
|
1502
|
+
}, ue({ _: 2 }, [
|
|
1503
|
+
l.$slots.option ? {
|
|
1505
1504
|
name: "option",
|
|
1506
|
-
fn:
|
|
1507
|
-
|
|
1505
|
+
fn: _((y) => [
|
|
1506
|
+
j(l.$slots, "option", je(Ee(y)))
|
|
1508
1507
|
]),
|
|
1509
1508
|
key: "0"
|
|
1510
1509
|
} : void 0
|
|
@@ -1514,88 +1513,88 @@ const To = /* @__PURE__ */ G({
|
|
|
1514
1513
|
_: 2
|
|
1515
1514
|
}, 1032, ["label"]))
|
|
1516
1515
|
]),
|
|
1517
|
-
s(
|
|
1516
|
+
s(r) ? (d(), R(ra, {
|
|
1518
1517
|
key: 0,
|
|
1519
1518
|
ref_key: "sheet",
|
|
1520
|
-
ref:
|
|
1521
|
-
title:
|
|
1519
|
+
ref: i,
|
|
1520
|
+
title: a.label ?? x.value,
|
|
1522
1521
|
grouped: "",
|
|
1523
|
-
onPresented:
|
|
1524
|
-
onDismissed:
|
|
1522
|
+
onPresented: m[5] || (m[5] = (y) => p.value = !0),
|
|
1523
|
+
onDismissed: m[6] || (m[6] = (y) => p.value = !1)
|
|
1525
1524
|
}, {
|
|
1526
|
-
footer:
|
|
1527
|
-
|
|
1528
|
-
N(
|
|
1525
|
+
footer: _(() => [
|
|
1526
|
+
V("div", Ro, [
|
|
1527
|
+
N(ae, {
|
|
1529
1528
|
prominence: "plain",
|
|
1530
1529
|
disabled: e.value.length === 0,
|
|
1531
|
-
onClick:
|
|
1530
|
+
onClick: m[3] || (m[3] = (y) => e.value = [])
|
|
1532
1531
|
}, {
|
|
1533
|
-
default:
|
|
1534
|
-
|
|
1532
|
+
default: _(() => [
|
|
1533
|
+
X(L(s(t)("core.form.select.clear")), 1)
|
|
1535
1534
|
]),
|
|
1536
1535
|
_: 1
|
|
1537
1536
|
}, 8, ["disabled"]),
|
|
1538
|
-
N(
|
|
1537
|
+
N(ae, {
|
|
1539
1538
|
prominence: "primary",
|
|
1540
|
-
onClick:
|
|
1539
|
+
onClick: m[4] || (m[4] = (y) => i.value?.dismiss())
|
|
1541
1540
|
}, {
|
|
1542
|
-
default:
|
|
1543
|
-
|
|
1541
|
+
default: _(() => [
|
|
1542
|
+
X(L(s(t)("core.form.select.done")), 1)
|
|
1544
1543
|
]),
|
|
1545
1544
|
_: 1
|
|
1546
1545
|
})
|
|
1547
1546
|
])
|
|
1548
1547
|
]),
|
|
1549
|
-
default:
|
|
1550
|
-
N(
|
|
1551
|
-
options: s(
|
|
1552
|
-
status: s(
|
|
1548
|
+
default: _(() => [
|
|
1549
|
+
N(et, {
|
|
1550
|
+
options: s(u).rows.value,
|
|
1551
|
+
status: s(u).status.value,
|
|
1553
1552
|
"model-value": e.value,
|
|
1554
1553
|
multiple: "",
|
|
1555
|
-
"search-from":
|
|
1556
|
-
onSelect:
|
|
1557
|
-
onRetry:
|
|
1558
|
-
},
|
|
1559
|
-
|
|
1554
|
+
"search-from": a.searchFrom,
|
|
1555
|
+
onSelect: S,
|
|
1556
|
+
onRetry: m[2] || (m[2] = (y) => s(u).reload())
|
|
1557
|
+
}, ue({ _: 2 }, [
|
|
1558
|
+
l.$slots.option ? {
|
|
1560
1559
|
name: "option",
|
|
1561
|
-
fn:
|
|
1562
|
-
|
|
1560
|
+
fn: _((y) => [
|
|
1561
|
+
j(l.$slots, "option", je(Ee(y)))
|
|
1563
1562
|
]),
|
|
1564
1563
|
key: "0"
|
|
1565
1564
|
} : void 0
|
|
1566
1565
|
]), 1032, ["options", "status", "model-value", "search-from"])
|
|
1567
1566
|
]),
|
|
1568
1567
|
_: 3
|
|
1569
|
-
}, 8, ["title"])) :
|
|
1568
|
+
}, 8, ["title"])) : z("", !0)
|
|
1570
1569
|
]),
|
|
1571
1570
|
_: 2
|
|
1572
1571
|
}, [
|
|
1573
|
-
|
|
1572
|
+
l.$slots.trailing ? {
|
|
1574
1573
|
name: "trailing",
|
|
1575
|
-
fn:
|
|
1576
|
-
|
|
1574
|
+
fn: _(() => [
|
|
1575
|
+
j(l.$slots, "trailing")
|
|
1577
1576
|
]),
|
|
1578
1577
|
key: "0"
|
|
1579
1578
|
} : void 0,
|
|
1580
|
-
|
|
1579
|
+
l.$slots.labelTrailing ? {
|
|
1581
1580
|
name: "labelTrailing",
|
|
1582
|
-
fn:
|
|
1583
|
-
|
|
1581
|
+
fn: _(() => [
|
|
1582
|
+
j(l.$slots, "labelTrailing")
|
|
1584
1583
|
]),
|
|
1585
1584
|
key: "1"
|
|
1586
1585
|
} : void 0,
|
|
1587
|
-
|
|
1586
|
+
l.$slots.readonly ? {
|
|
1588
1587
|
name: "readonly",
|
|
1589
|
-
fn:
|
|
1590
|
-
|
|
1588
|
+
fn: _(() => [
|
|
1589
|
+
j(l.$slots, "readonly")
|
|
1591
1590
|
]),
|
|
1592
1591
|
key: "2"
|
|
1593
1592
|
} : void 0
|
|
1594
1593
|
]), 1040, ["value"]));
|
|
1595
1594
|
}
|
|
1596
|
-
}),
|
|
1595
|
+
}), jo = ["aria-label"], Eo = ["src"], No = { class: "flex flex-wrap items-center gap-3" }, Uo = ["id", "accept", "disabled", "aria-describedby", "aria-invalid"], Ao = ["aria-label"], Io = ["src"], Ur = /* @__PURE__ */ Z({
|
|
1597
1596
|
__name: "PhotoField",
|
|
1598
|
-
props: /* @__PURE__ */
|
|
1597
|
+
props: /* @__PURE__ */ ye(/* @__PURE__ */ ce({
|
|
1599
1598
|
label: {},
|
|
1600
1599
|
labelHidden: { type: Boolean },
|
|
1601
1600
|
hint: {},
|
|
@@ -1608,181 +1607,181 @@ const To = /* @__PURE__ */ G({
|
|
|
1608
1607
|
name: {},
|
|
1609
1608
|
accept: {},
|
|
1610
1609
|
maxSize: {}
|
|
1611
|
-
}, { ...
|
|
1610
|
+
}, { ...fe, accept: () => ["image/jpeg", "image/png", "image/webp", "image/gif"], maxSize: 5 * 1024 * 1024 }), {
|
|
1612
1611
|
modelValue: { default: null },
|
|
1613
1612
|
modelModifiers: {}
|
|
1614
1613
|
}),
|
|
1615
1614
|
emits: ["update:modelValue"],
|
|
1616
|
-
setup(
|
|
1617
|
-
const
|
|
1618
|
-
function
|
|
1619
|
-
|
|
1615
|
+
setup(o) {
|
|
1616
|
+
const a = o, e = ke(o, "modelValue"), { t } = le(), r = oe("chooser"), i = G(null), p = G(null);
|
|
1617
|
+
function u() {
|
|
1618
|
+
p.value && URL.revokeObjectURL(p.value), p.value = null;
|
|
1620
1619
|
}
|
|
1621
|
-
|
|
1620
|
+
ne(
|
|
1622
1621
|
e,
|
|
1623
|
-
(
|
|
1624
|
-
|
|
1622
|
+
(l) => {
|
|
1623
|
+
u(), l instanceof File && (p.value = URL.createObjectURL(l)), l === null && r.value && (r.value.value = "");
|
|
1625
1624
|
},
|
|
1626
1625
|
{ immediate: !0 }
|
|
1627
|
-
),
|
|
1628
|
-
const
|
|
1629
|
-
function
|
|
1630
|
-
if (!
|
|
1631
|
-
const
|
|
1632
|
-
|
|
1626
|
+
), Be(u);
|
|
1627
|
+
const v = B(() => e.value instanceof File ? p.value : e.value), x = oe("viewer"), S = B(() => v.value ? [{ src: v.value, alt: a.label ?? t("core.viewer.label"), downloadName: e.value instanceof File ? e.value.name : void 0 }] : []);
|
|
1628
|
+
function h(l) {
|
|
1629
|
+
if (!l) return;
|
|
1630
|
+
const m = Ct(l, { accept: a.accept, maxSize: a.maxSize });
|
|
1631
|
+
m ? i.value = m === "invalid_type" ? t("core.form.file.invalid_type") : t("core.form.file.too_large", { size: Te(a.maxSize) }) : (i.value = null, e.value = l);
|
|
1633
1632
|
}
|
|
1634
|
-
return (
|
|
1635
|
-
value:
|
|
1633
|
+
return (l, m) => (d(), R(be, P({ ...s(me)(a), error: i.value ?? a.error }, {
|
|
1634
|
+
value: v.value ? s(t)("core.form.file.choose") : null,
|
|
1636
1635
|
"row-layout": "stacked"
|
|
1637
|
-
}),
|
|
1638
|
-
readonly:
|
|
1639
|
-
|
|
1636
|
+
}), ue({
|
|
1637
|
+
readonly: _(() => [
|
|
1638
|
+
v.value ? (d(), g("button", {
|
|
1640
1639
|
key: 0,
|
|
1641
1640
|
type: "button",
|
|
1642
|
-
"aria-label": s(
|
|
1641
|
+
"aria-label": s(t)("core.viewer.open"),
|
|
1643
1642
|
"data-test": "photo-open",
|
|
1644
1643
|
class: "block cursor-zoom-in rounded-group focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus",
|
|
1645
|
-
onClick:
|
|
1644
|
+
onClick: m[0] || (m[0] = (c) => x.value?.present(0))
|
|
1646
1645
|
}, [
|
|
1647
|
-
|
|
1648
|
-
src:
|
|
1646
|
+
V("img", {
|
|
1647
|
+
src: v.value,
|
|
1649
1648
|
alt: "",
|
|
1650
1649
|
class: "size-40 rounded-group object-cover"
|
|
1651
|
-
}, null, 8,
|
|
1652
|
-
], 8,
|
|
1653
|
-
|
|
1650
|
+
}, null, 8, Eo)
|
|
1651
|
+
], 8, jo)) : z("", !0),
|
|
1652
|
+
v.value ? (d(), R(tt, {
|
|
1654
1653
|
key: 1,
|
|
1655
1654
|
ref_key: "viewer",
|
|
1656
|
-
ref:
|
|
1657
|
-
items:
|
|
1658
|
-
}, null, 8, ["items"])) :
|
|
1655
|
+
ref: x,
|
|
1656
|
+
items: S.value
|
|
1657
|
+
}, null, 8, ["items"])) : z("", !0)
|
|
1659
1658
|
]),
|
|
1660
|
-
default:
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
id:
|
|
1659
|
+
default: _(({ id: c, describedby: k, invalid: b }) => [
|
|
1660
|
+
V("div", No, [
|
|
1661
|
+
V("input", {
|
|
1662
|
+
id: c,
|
|
1664
1663
|
ref_key: "chooser",
|
|
1665
|
-
ref:
|
|
1664
|
+
ref: r,
|
|
1666
1665
|
type: "file",
|
|
1667
1666
|
class: "sr-only",
|
|
1668
1667
|
tabindex: "-1",
|
|
1669
|
-
accept:
|
|
1670
|
-
disabled:
|
|
1671
|
-
"aria-describedby":
|
|
1672
|
-
"aria-invalid":
|
|
1673
|
-
onChange:
|
|
1674
|
-
}, null, 40,
|
|
1675
|
-
|
|
1668
|
+
accept: a.accept.join(","),
|
|
1669
|
+
disabled: a.disabled,
|
|
1670
|
+
"aria-describedby": k,
|
|
1671
|
+
"aria-invalid": b || void 0,
|
|
1672
|
+
onChange: m[1] || (m[1] = (y) => h(y.target.files?.[0]))
|
|
1673
|
+
}, null, 40, Uo),
|
|
1674
|
+
v.value ? (d(), g("button", {
|
|
1676
1675
|
key: 0,
|
|
1677
1676
|
type: "button",
|
|
1678
|
-
"aria-label": s(
|
|
1677
|
+
"aria-label": s(t)("core.viewer.open"),
|
|
1679
1678
|
"data-test": "photo-open",
|
|
1680
1679
|
class: "block cursor-zoom-in rounded-group focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus",
|
|
1681
|
-
onClick:
|
|
1680
|
+
onClick: m[2] || (m[2] = (y) => x.value?.present(0))
|
|
1682
1681
|
}, [
|
|
1683
|
-
|
|
1684
|
-
src:
|
|
1682
|
+
V("img", {
|
|
1683
|
+
src: v.value,
|
|
1685
1684
|
alt: "",
|
|
1686
1685
|
"data-test": "photo-preview",
|
|
1687
1686
|
class: "size-28 rounded-group object-cover"
|
|
1688
|
-
}, null, 8,
|
|
1689
|
-
], 8,
|
|
1690
|
-
N(
|
|
1691
|
-
disabled:
|
|
1692
|
-
onClick:
|
|
1687
|
+
}, null, 8, Io)
|
|
1688
|
+
], 8, Ao)) : z("", !0),
|
|
1689
|
+
N(ae, {
|
|
1690
|
+
disabled: a.disabled,
|
|
1691
|
+
onClick: m[3] || (m[3] = (y) => r.value?.click())
|
|
1693
1692
|
}, {
|
|
1694
|
-
default:
|
|
1695
|
-
|
|
1693
|
+
default: _(() => [
|
|
1694
|
+
X(L(s(t)("core.form.file.choose")), 1)
|
|
1696
1695
|
]),
|
|
1697
1696
|
_: 1
|
|
1698
1697
|
}, 8, ["disabled"]),
|
|
1699
|
-
|
|
1698
|
+
v.value ? (d(), R(ae, {
|
|
1700
1699
|
key: 1,
|
|
1701
1700
|
prominence: "plain",
|
|
1702
1701
|
tone: "critical",
|
|
1703
|
-
disabled:
|
|
1704
|
-
onClick:
|
|
1705
|
-
e.value = null,
|
|
1702
|
+
disabled: a.disabled,
|
|
1703
|
+
onClick: m[4] || (m[4] = (y) => {
|
|
1704
|
+
e.value = null, i.value = null;
|
|
1706
1705
|
})
|
|
1707
1706
|
}, {
|
|
1708
|
-
default:
|
|
1709
|
-
|
|
1707
|
+
default: _(() => [
|
|
1708
|
+
X(L(s(t)("core.form.file.remove")), 1)
|
|
1710
1709
|
]),
|
|
1711
1710
|
_: 1
|
|
1712
|
-
}, 8, ["disabled"])) :
|
|
1711
|
+
}, 8, ["disabled"])) : z("", !0)
|
|
1713
1712
|
]),
|
|
1714
|
-
|
|
1713
|
+
v.value ? (d(), R(tt, {
|
|
1715
1714
|
key: 0,
|
|
1716
1715
|
ref_key: "viewer",
|
|
1717
|
-
ref:
|
|
1718
|
-
items:
|
|
1719
|
-
}, null, 8, ["items"])) :
|
|
1716
|
+
ref: x,
|
|
1717
|
+
items: S.value
|
|
1718
|
+
}, null, 8, ["items"])) : z("", !0)
|
|
1720
1719
|
]),
|
|
1721
1720
|
_: 2
|
|
1722
1721
|
}, [
|
|
1723
|
-
|
|
1722
|
+
l.$slots.trailing ? {
|
|
1724
1723
|
name: "trailing",
|
|
1725
|
-
fn:
|
|
1726
|
-
|
|
1724
|
+
fn: _(() => [
|
|
1725
|
+
j(l.$slots, "trailing")
|
|
1727
1726
|
]),
|
|
1728
1727
|
key: "0"
|
|
1729
1728
|
} : void 0,
|
|
1730
|
-
|
|
1729
|
+
l.$slots.labelTrailing ? {
|
|
1731
1730
|
name: "labelTrailing",
|
|
1732
|
-
fn:
|
|
1733
|
-
|
|
1731
|
+
fn: _(() => [
|
|
1732
|
+
j(l.$slots, "labelTrailing")
|
|
1734
1733
|
]),
|
|
1735
1734
|
key: "1"
|
|
1736
1735
|
} : void 0
|
|
1737
1736
|
]), 1040, ["value"]));
|
|
1738
1737
|
}
|
|
1739
|
-
}),
|
|
1738
|
+
}), Po = { hidden: "" }, Ho = /* @__PURE__ */ Z({
|
|
1740
1739
|
__name: "EditorChrome",
|
|
1741
1740
|
props: {
|
|
1742
1741
|
options: {}
|
|
1743
1742
|
},
|
|
1744
|
-
setup(
|
|
1745
|
-
return
|
|
1743
|
+
setup(o) {
|
|
1744
|
+
return fa(o.options), (e, t) => (d(), g("span", Po));
|
|
1746
1745
|
}
|
|
1747
1746
|
});
|
|
1748
|
-
function
|
|
1749
|
-
const
|
|
1747
|
+
function Ko(o) {
|
|
1748
|
+
const a = G(0);
|
|
1750
1749
|
let e = 0;
|
|
1751
|
-
const
|
|
1750
|
+
const t = () => {
|
|
1752
1751
|
e || (e = requestAnimationFrame(() => {
|
|
1753
|
-
e = 0,
|
|
1752
|
+
e = 0, a.value++;
|
|
1754
1753
|
}));
|
|
1755
|
-
},
|
|
1756
|
-
|
|
1757
|
-
() =>
|
|
1758
|
-
(
|
|
1759
|
-
|
|
1760
|
-
for (const
|
|
1761
|
-
|
|
1762
|
-
|
|
1754
|
+
}, r = typeof MutationObserver > "u" ? null : new MutationObserver(t);
|
|
1755
|
+
ne(
|
|
1756
|
+
() => o.sections.value,
|
|
1757
|
+
(u) => {
|
|
1758
|
+
r?.disconnect();
|
|
1759
|
+
for (const v of u)
|
|
1760
|
+
r?.observe(v.element, { subtree: !0, childList: !0, attributes: !0, attributeFilter: ["data-field-error", "data-field-required", "data-field-filled"] });
|
|
1761
|
+
t();
|
|
1763
1762
|
},
|
|
1764
1763
|
{ immediate: !0 }
|
|
1765
|
-
),
|
|
1766
|
-
|
|
1764
|
+
), Dt() && zt(() => {
|
|
1765
|
+
r?.disconnect(), e && cancelAnimationFrame(e);
|
|
1767
1766
|
});
|
|
1768
|
-
const
|
|
1769
|
-
|
|
1770
|
-
|
|
1767
|
+
const i = B(() => (a.value, Object.fromEntries(
|
|
1768
|
+
o.sections.value.map((u) => [
|
|
1769
|
+
u.id,
|
|
1771
1770
|
{
|
|
1772
|
-
errors:
|
|
1773
|
-
required: { total:
|
|
1771
|
+
errors: u.element.querySelectorAll("[data-field-error]").length,
|
|
1772
|
+
required: { total: u.element.querySelectorAll("[data-field-required]").length, filled: u.element.querySelectorAll("[data-field-required][data-field-filled]").length }
|
|
1774
1773
|
}
|
|
1775
1774
|
])
|
|
1776
|
-
))),
|
|
1777
|
-
return { states:
|
|
1775
|
+
))), p = B(() => Object.values(i.value).reduce((u, v) => ({ filled: u.filled + v.required.filled, total: u.total + v.required.total }), { filled: 0, total: 0 }));
|
|
1776
|
+
return { states: i, totals: p };
|
|
1778
1777
|
}
|
|
1779
|
-
const
|
|
1778
|
+
const Go = {
|
|
1780
1779
|
class: "grid min-w-0 grid-cols-1 items-start gap-8 lg:grid-cols-[12.5rem_minmax(0,1fr)]",
|
|
1781
1780
|
"data-test": "editor-page"
|
|
1782
|
-
},
|
|
1781
|
+
}, Wo = {
|
|
1783
1782
|
key: 0,
|
|
1784
1783
|
class: "sticky top-[calc(var(--app-bar-height)+1.5rem+var(--shell-banner-h,0px))] hidden min-w-0 flex-col gap-4 self-start lg:flex"
|
|
1785
|
-
},
|
|
1784
|
+
}, Ar = /* @__PURE__ */ Z({
|
|
1786
1785
|
__name: "EditorPage",
|
|
1787
1786
|
props: {
|
|
1788
1787
|
title: {},
|
|
@@ -1794,105 +1793,105 @@ const xl = {
|
|
|
1794
1793
|
disabledWhileClean: { type: Boolean, default: !1 }
|
|
1795
1794
|
},
|
|
1796
1795
|
emits: ["save", "cancel"],
|
|
1797
|
-
setup(
|
|
1798
|
-
const e =
|
|
1796
|
+
setup(o, { emit: a }) {
|
|
1797
|
+
const e = o, t = a, { t: r } = le(), i = He(), p = ma(), { states: u, totals: v } = Ko(p), x = oe("content"), S = B(
|
|
1799
1798
|
() => e.form ? {
|
|
1800
1799
|
form: e.form,
|
|
1801
|
-
label: () => e.saveLabel ??
|
|
1800
|
+
label: () => e.saveLabel ?? r("core.actions.save"),
|
|
1802
1801
|
allowed: () => e.canSave,
|
|
1803
1802
|
disabledWhileClean: () => e.disabledWhileClean,
|
|
1804
1803
|
save: () => {
|
|
1805
|
-
e.form?.submitting.value ||
|
|
1804
|
+
e.form?.submitting.value || t("save");
|
|
1806
1805
|
},
|
|
1807
1806
|
cancel: () => {
|
|
1808
|
-
e.form?.reset(),
|
|
1807
|
+
e.form?.reset(), t("cancel");
|
|
1809
1808
|
}
|
|
1810
1809
|
} : null
|
|
1811
1810
|
);
|
|
1812
|
-
|
|
1811
|
+
ne(
|
|
1813
1812
|
() => e.form?.failure.value,
|
|
1814
|
-
async (
|
|
1815
|
-
|
|
1813
|
+
async (l) => {
|
|
1814
|
+
l?.kind === "invalid" && (await we(), await Oe(x.value ?? document, p));
|
|
1816
1815
|
}
|
|
1817
1816
|
);
|
|
1818
|
-
function
|
|
1819
|
-
const
|
|
1820
|
-
|
|
1817
|
+
function h(l) {
|
|
1818
|
+
const m = p.sections.value.find((c) => c.id === l)?.element;
|
|
1819
|
+
m && we(() => Oe(m));
|
|
1821
1820
|
}
|
|
1822
|
-
return (
|
|
1821
|
+
return (l, m) => (d(), R(ua, {
|
|
1823
1822
|
title: e.title,
|
|
1824
1823
|
back: e.back,
|
|
1825
1824
|
width: "content"
|
|
1826
|
-
},
|
|
1827
|
-
default:
|
|
1828
|
-
|
|
1825
|
+
}, ue({
|
|
1826
|
+
default: _(() => [
|
|
1827
|
+
S.value ? (d(), R(Ho, {
|
|
1829
1828
|
key: 0,
|
|
1830
|
-
options:
|
|
1831
|
-
}, null, 8, ["options"])) :
|
|
1832
|
-
|
|
1833
|
-
s(
|
|
1834
|
-
N(
|
|
1829
|
+
options: S.value
|
|
1830
|
+
}, null, 8, ["options"])) : z("", !0),
|
|
1831
|
+
V("div", Go, [
|
|
1832
|
+
s(i) ? z("", !0) : (d(), g("aside", Wo, [
|
|
1833
|
+
N(da, {
|
|
1835
1834
|
standalone: "",
|
|
1836
|
-
states: s(
|
|
1837
|
-
progress: s(
|
|
1838
|
-
onSelect:
|
|
1835
|
+
states: s(u),
|
|
1836
|
+
progress: s(v),
|
|
1837
|
+
onSelect: h
|
|
1839
1838
|
}, null, 8, ["states", "progress"]),
|
|
1840
|
-
|
|
1839
|
+
j(l.$slots, "aside")
|
|
1841
1840
|
])),
|
|
1842
|
-
|
|
1841
|
+
V("div", {
|
|
1843
1842
|
ref_key: "content",
|
|
1844
|
-
ref:
|
|
1843
|
+
ref: x,
|
|
1845
1844
|
class: "flex min-w-0 flex-col gap-section-gap"
|
|
1846
1845
|
}, [
|
|
1847
|
-
e.form ? (d(),
|
|
1846
|
+
e.form ? (d(), R(ct, {
|
|
1848
1847
|
key: 0,
|
|
1849
1848
|
form: e.form,
|
|
1850
1849
|
label: e.fieldLabel,
|
|
1851
|
-
scope:
|
|
1852
|
-
}, null, 8, ["form", "label", "scope"])) :
|
|
1853
|
-
|
|
1850
|
+
scope: x.value
|
|
1851
|
+
}, null, 8, ["form", "label", "scope"])) : z("", !0),
|
|
1852
|
+
j(l.$slots, "default")
|
|
1854
1853
|
], 512)
|
|
1855
1854
|
]),
|
|
1856
|
-
s(
|
|
1855
|
+
s(i) ? (d(), R(ca, {
|
|
1857
1856
|
key: 1,
|
|
1858
|
-
states: s(
|
|
1859
|
-
}, null, 8, ["states"])) :
|
|
1857
|
+
states: s(u)
|
|
1858
|
+
}, null, 8, ["states"])) : z("", !0)
|
|
1860
1859
|
]),
|
|
1861
1860
|
_: 2
|
|
1862
1861
|
}, [
|
|
1863
|
-
|
|
1862
|
+
l.$slots.header ? {
|
|
1864
1863
|
name: "header",
|
|
1865
|
-
fn:
|
|
1866
|
-
|
|
1864
|
+
fn: _(() => [
|
|
1865
|
+
j(l.$slots, "header")
|
|
1867
1866
|
]),
|
|
1868
1867
|
key: "0"
|
|
1869
1868
|
} : void 0,
|
|
1870
|
-
|
|
1869
|
+
l.$slots.pager ? {
|
|
1871
1870
|
name: "pager",
|
|
1872
|
-
fn:
|
|
1873
|
-
|
|
1871
|
+
fn: _(() => [
|
|
1872
|
+
j(l.$slots, "pager")
|
|
1874
1873
|
]),
|
|
1875
1874
|
key: "1"
|
|
1876
1875
|
} : void 0,
|
|
1877
|
-
|
|
1876
|
+
l.$slots.notices ? {
|
|
1878
1877
|
name: "notices",
|
|
1879
|
-
fn:
|
|
1880
|
-
|
|
1878
|
+
fn: _(() => [
|
|
1879
|
+
j(l.$slots, "notices")
|
|
1881
1880
|
]),
|
|
1882
1881
|
key: "2"
|
|
1883
1882
|
} : void 0,
|
|
1884
|
-
|
|
1883
|
+
l.$slots.bottom ? {
|
|
1885
1884
|
name: "bottom",
|
|
1886
|
-
fn:
|
|
1887
|
-
|
|
1885
|
+
fn: _(() => [
|
|
1886
|
+
j(l.$slots, "bottom")
|
|
1888
1887
|
]),
|
|
1889
1888
|
key: "3"
|
|
1890
1889
|
} : void 0
|
|
1891
1890
|
]), 1032, ["title", "back"]));
|
|
1892
1891
|
}
|
|
1893
|
-
}),
|
|
1892
|
+
}), Yo = ["value", "aria-label", "disabled", "aria-invalid", "placeholder"], Ir = /* @__PURE__ */ Z({
|
|
1894
1893
|
__name: "NumberCell",
|
|
1895
|
-
props: /* @__PURE__ */
|
|
1894
|
+
props: /* @__PURE__ */ ye({
|
|
1896
1895
|
label: {},
|
|
1897
1896
|
min: { default: 0 },
|
|
1898
1897
|
max: { default: 9999 },
|
|
@@ -1905,347 +1904,347 @@ const xl = {
|
|
|
1905
1904
|
modelModifiers: {}
|
|
1906
1905
|
}),
|
|
1907
1906
|
emits: ["update:modelValue"],
|
|
1908
|
-
setup(
|
|
1909
|
-
const
|
|
1910
|
-
function
|
|
1911
|
-
const
|
|
1912
|
-
e.value =
|
|
1907
|
+
setup(o) {
|
|
1908
|
+
const a = o, e = ke(o, "modelValue");
|
|
1909
|
+
function t(i) {
|
|
1910
|
+
const p = i.target.value.replace(/\D/g, "");
|
|
1911
|
+
e.value = p === "" ? null : Math.min(a.max, Math.max(a.min, Number(p)));
|
|
1913
1912
|
}
|
|
1914
|
-
const
|
|
1915
|
-
return (
|
|
1913
|
+
const r = (i) => i.target.value = e.value === null ? "" : String(e.value);
|
|
1914
|
+
return (i, p) => (d(), g("input", {
|
|
1916
1915
|
value: e.value ?? "",
|
|
1917
1916
|
type: "text",
|
|
1918
1917
|
inputmode: "numeric",
|
|
1919
1918
|
autocomplete: "off",
|
|
1920
|
-
"aria-label":
|
|
1921
|
-
disabled:
|
|
1922
|
-
"aria-invalid":
|
|
1923
|
-
placeholder:
|
|
1924
|
-
class:
|
|
1925
|
-
onInput:
|
|
1926
|
-
onBlur:
|
|
1927
|
-
}, null, 42,
|
|
1919
|
+
"aria-label": a.label,
|
|
1920
|
+
disabled: a.disabled,
|
|
1921
|
+
"aria-invalid": a.invalid || void 0,
|
|
1922
|
+
placeholder: a.placeholder,
|
|
1923
|
+
class: W(["rounded-control bg-fill px-2 py-1 text-right text-body tabular-nums text-content-strong transition-[background-color,box-shadow] duration-motion-fast ease-motion-standard placeholder:text-content-disabled focus:bg-surface-cell focus:outline-none focus:ring-[1.5px] focus:ring-inset focus:ring-border-focus disabled:opacity-45", [a.wide ? "w-28" : "w-16", a.invalid ? "bg-status-danger-surface ring-[1.5px] ring-inset ring-border-destructive" : ""]]),
|
|
1924
|
+
onInput: t,
|
|
1925
|
+
onBlur: r
|
|
1926
|
+
}, null, 42, Yo));
|
|
1928
1927
|
}
|
|
1929
|
-
}),
|
|
1930
|
-
function
|
|
1928
|
+
}), We = "vue-core:step-draft:";
|
|
1929
|
+
function Ye(o) {
|
|
1931
1930
|
try {
|
|
1932
|
-
return (
|
|
1931
|
+
return (o.storage === "local" ? window.localStorage : window.sessionStorage) ?? null;
|
|
1933
1932
|
} catch {
|
|
1934
1933
|
return null;
|
|
1935
1934
|
}
|
|
1936
1935
|
}
|
|
1937
|
-
function
|
|
1936
|
+
function Jo(o) {
|
|
1938
1937
|
try {
|
|
1939
|
-
const
|
|
1940
|
-
if (!
|
|
1941
|
-
const e = JSON.parse(
|
|
1942
|
-
return !e || e.version !== (
|
|
1938
|
+
const a = Ye(o)?.getItem(We + o.key);
|
|
1939
|
+
if (!a) return null;
|
|
1940
|
+
const e = JSON.parse(a);
|
|
1941
|
+
return !e || e.version !== (o.version ?? 1) || typeof e.values != "object" || e.values === null || typeof e.step != "string" || !Array.isArray(e.passed) ? null : e;
|
|
1943
1942
|
} catch {
|
|
1944
1943
|
return null;
|
|
1945
1944
|
}
|
|
1946
1945
|
}
|
|
1947
|
-
function
|
|
1946
|
+
function Zo(o, a) {
|
|
1948
1947
|
try {
|
|
1949
|
-
const e =
|
|
1948
|
+
const e = Ye(o);
|
|
1950
1949
|
if (!e) return !1;
|
|
1951
|
-
const
|
|
1952
|
-
return e.setItem(
|
|
1950
|
+
const t = (r, i) => typeof Blob < "u" && i instanceof Blob ? null : i;
|
|
1951
|
+
return e.setItem(We + o.key, JSON.stringify({ version: o.version ?? 1, ...a }, t)), !0;
|
|
1953
1952
|
} catch {
|
|
1954
1953
|
return !1;
|
|
1955
1954
|
}
|
|
1956
1955
|
}
|
|
1957
|
-
function
|
|
1956
|
+
function nt(o) {
|
|
1958
1957
|
try {
|
|
1959
|
-
|
|
1958
|
+
Ye(o)?.removeItem(We + o.key);
|
|
1960
1959
|
} catch {
|
|
1961
1960
|
}
|
|
1962
1961
|
}
|
|
1963
|
-
function
|
|
1964
|
-
for (const [e,
|
|
1965
|
-
if (!(e in
|
|
1966
|
-
const
|
|
1967
|
-
(
|
|
1962
|
+
function Xo(o, a) {
|
|
1963
|
+
for (const [e, t] of Object.entries(o)) {
|
|
1964
|
+
if (!(e in a)) continue;
|
|
1965
|
+
const r = a[e];
|
|
1966
|
+
(r === null || t === null || t === void 0 || typeof r == typeof t && Array.isArray(r) === Array.isArray(t)) && (o[e] = r);
|
|
1968
1967
|
}
|
|
1969
1968
|
}
|
|
1970
|
-
function
|
|
1971
|
-
const { t: e } =
|
|
1972
|
-
if (
|
|
1973
|
-
const
|
|
1974
|
-
let
|
|
1975
|
-
const
|
|
1976
|
-
() =>
|
|
1977
|
-
const
|
|
1969
|
+
function Pr(o, a) {
|
|
1970
|
+
const { t: e } = le(), t = B(() => Mt(a.steps));
|
|
1971
|
+
if (t.value.length === 0) throw new Error("useStepForm: a flow needs at least one step.");
|
|
1972
|
+
const r = G(t.value[0].name), i = Ze(/* @__PURE__ */ new Set()), p = Ze(/* @__PURE__ */ new Set([t.value[0].name])), u = G(null), v = G(!1), x = G(0), S = G(!1), h = G(!1);
|
|
1973
|
+
let l = !1, m = 0;
|
|
1974
|
+
const c = B(() => Math.max(0, t.value.findIndex((f) => f.name === r.value))), k = (f) => f.fields?.filter((U) => o.errors.has(U)).length ?? 0, b = B(
|
|
1975
|
+
() => t.value.map((f, U) => {
|
|
1976
|
+
const Y = k(f), T = U === c.value;
|
|
1978
1977
|
return {
|
|
1979
|
-
name:
|
|
1980
|
-
label:
|
|
1981
|
-
position:
|
|
1982
|
-
state:
|
|
1983
|
-
errors:
|
|
1984
|
-
reachable: !
|
|
1978
|
+
name: f.name,
|
|
1979
|
+
label: f.label,
|
|
1980
|
+
position: U + 1,
|
|
1981
|
+
state: T ? "current" : i.has(f.name) && Y === 0 ? "done" : "todo",
|
|
1982
|
+
errors: Y,
|
|
1983
|
+
reachable: !T && (p.has(f.name) || U < c.value)
|
|
1985
1984
|
};
|
|
1986
1985
|
})
|
|
1987
|
-
),
|
|
1988
|
-
function
|
|
1989
|
-
const
|
|
1990
|
-
|
|
1986
|
+
), y = B(() => b.value[c.value]), w = B(() => b.value.length), F = B(() => c.value === 0), q = B(() => c.value === w.value - 1), $ = B(() => v.value || o.submitting.value);
|
|
1987
|
+
function E(f) {
|
|
1988
|
+
const U = t.value[f];
|
|
1989
|
+
U && (u.value = f > c.value ? "forward" : "back", r.value = U.name, p.add(U.name), m = f, S.value = !1);
|
|
1991
1990
|
}
|
|
1992
|
-
|
|
1993
|
-
() =>
|
|
1991
|
+
ne(
|
|
1992
|
+
() => t.value.map((f) => f.name).join("\0"),
|
|
1994
1993
|
() => {
|
|
1995
|
-
const
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
}),
|
|
1999
|
-
for (const
|
|
1994
|
+
const f = t.value, U = f.findIndex((T) => T.name === r.value), Y = U === -1 ? Math.min(m, f.length - 1) : U;
|
|
1995
|
+
r.value = f[Y].name, m = Y, f.forEach((T, K) => {
|
|
1996
|
+
K > Y && (i.delete(T.name), p.delete(T.name));
|
|
1997
|
+
}), p.add(r.value);
|
|
1998
|
+
for (const T of [i, p]) for (const K of [...T]) f.some((A) => A.name === K) || T.delete(K);
|
|
2000
1999
|
}
|
|
2001
2000
|
);
|
|
2002
|
-
function
|
|
2003
|
-
const
|
|
2004
|
-
if (!
|
|
2005
|
-
const
|
|
2006
|
-
return
|
|
2001
|
+
function H(f) {
|
|
2002
|
+
const U = f.fields;
|
|
2003
|
+
if (!U?.length) return !0;
|
|
2004
|
+
const Y = Object.entries(o.errors.all()).filter(([K]) => !U.includes(Lt(K))), T = o.check(f.fields);
|
|
2005
|
+
return Y.length > 0 && o.errors.set({ ...Object.fromEntries(Y), ...o.errors.all() }), T;
|
|
2007
2006
|
}
|
|
2008
|
-
async function
|
|
2009
|
-
if (!
|
|
2010
|
-
return
|
|
2011
|
-
if (!
|
|
2012
|
-
|
|
2007
|
+
async function O(f) {
|
|
2008
|
+
if (!H(f))
|
|
2009
|
+
return x.value++, !1;
|
|
2010
|
+
if (!f.beforeNext) return !0;
|
|
2011
|
+
v.value = !0;
|
|
2013
2012
|
try {
|
|
2014
|
-
if (await
|
|
2013
|
+
if (await f.beforeNext()) return !0;
|
|
2015
2014
|
} finally {
|
|
2016
|
-
|
|
2015
|
+
v.value = !1;
|
|
2017
2016
|
}
|
|
2018
|
-
return
|
|
2017
|
+
return x.value++, !1;
|
|
2019
2018
|
}
|
|
2020
|
-
async function
|
|
2021
|
-
const
|
|
2022
|
-
if (
|
|
2023
|
-
return
|
|
2024
|
-
if (
|
|
2025
|
-
const
|
|
2026
|
-
|
|
2019
|
+
async function D() {
|
|
2020
|
+
const f = await o.submit(a.submit, a.submitOptions);
|
|
2021
|
+
if (f.status === "saved" || f.status === "saved-refresh-failed")
|
|
2022
|
+
return l = !0, re(), a.onSaved?.(f.value), !0;
|
|
2023
|
+
if (f.status === "failed" && (x.value++, y.value.errors === 0)) {
|
|
2024
|
+
const U = b.value.findIndex((Y) => Y.errors > 0);
|
|
2025
|
+
U !== -1 && E(U);
|
|
2027
2026
|
}
|
|
2028
2027
|
return !1;
|
|
2029
2028
|
}
|
|
2030
|
-
async function
|
|
2031
|
-
if (
|
|
2032
|
-
const
|
|
2033
|
-
return await
|
|
2029
|
+
async function J() {
|
|
2030
|
+
if ($.value) return !1;
|
|
2031
|
+
const f = t.value[c.value];
|
|
2032
|
+
return await O(f) ? (i.add(f.name), c.value < w.value - 1 ? (E(c.value + 1), !0) : D()) : !1;
|
|
2034
2033
|
}
|
|
2035
|
-
async function
|
|
2036
|
-
if (
|
|
2037
|
-
const
|
|
2038
|
-
if (
|
|
2039
|
-
if (
|
|
2040
|
-
return
|
|
2041
|
-
if (!
|
|
2042
|
-
for (;
|
|
2043
|
-
return
|
|
2034
|
+
async function M(f) {
|
|
2035
|
+
if ($.value) return !1;
|
|
2036
|
+
const U = t.value.findIndex((Y) => Y.name === f);
|
|
2037
|
+
if (U === -1) return !1;
|
|
2038
|
+
if (U <= c.value)
|
|
2039
|
+
return U < c.value && E(U), !0;
|
|
2040
|
+
if (!p.has(f)) return !1;
|
|
2041
|
+
for (; c.value < U; ) if (!await J()) return !1;
|
|
2042
|
+
return c.value === U;
|
|
2044
2043
|
}
|
|
2045
|
-
const
|
|
2046
|
-
let
|
|
2047
|
-
function
|
|
2048
|
-
if (
|
|
2049
|
-
if (!
|
|
2050
|
-
|
|
2044
|
+
const Q = a.draft;
|
|
2045
|
+
let te;
|
|
2046
|
+
function se() {
|
|
2047
|
+
if (te = void 0, !(!Q || l)) {
|
|
2048
|
+
if (!o.dirty.value) {
|
|
2049
|
+
nt(Q), h.value = !1;
|
|
2051
2050
|
return;
|
|
2052
2051
|
}
|
|
2053
|
-
|
|
2052
|
+
h.value = Zo(Q, { values: Bt(o.values), step: r.value, passed: [...i] });
|
|
2054
2053
|
}
|
|
2055
2054
|
}
|
|
2056
|
-
function
|
|
2057
|
-
|
|
2055
|
+
function re() {
|
|
2056
|
+
l = !0, clearTimeout(te), te = void 0, h.value = !1, Q && nt(Q);
|
|
2058
2057
|
}
|
|
2059
|
-
if (
|
|
2060
|
-
const
|
|
2061
|
-
if (
|
|
2062
|
-
|
|
2063
|
-
const
|
|
2064
|
-
|
|
2065
|
-
for (const
|
|
2066
|
-
for (const
|
|
2067
|
-
|
|
2058
|
+
if (Q) {
|
|
2059
|
+
const f = Jo(Q);
|
|
2060
|
+
if (f) {
|
|
2061
|
+
Xo(o.values, f.values);
|
|
2062
|
+
const U = t.value.map((Y) => Y.name);
|
|
2063
|
+
U.includes(f.step) && (r.value = f.step);
|
|
2064
|
+
for (const Y of f.passed) U.includes(Y) && i.add(Y);
|
|
2065
|
+
for (const Y of [...i, r.value]) p.add(Y);
|
|
2066
|
+
m = c.value, S.value = o.dirty.value, h.value = S.value;
|
|
2068
2067
|
}
|
|
2069
|
-
|
|
2070
|
-
[() =>
|
|
2068
|
+
ne(
|
|
2069
|
+
[() => o.values, r, () => [...i].join("\0")],
|
|
2071
2070
|
() => {
|
|
2072
|
-
|
|
2071
|
+
l || (clearTimeout(te), te = setTimeout(se, 400));
|
|
2073
2072
|
},
|
|
2074
2073
|
{ deep: !0 }
|
|
2075
|
-
),
|
|
2076
|
-
|
|
2074
|
+
), Be(() => {
|
|
2075
|
+
te !== void 0 && (clearTimeout(te), se());
|
|
2077
2076
|
});
|
|
2078
2077
|
}
|
|
2079
|
-
const { confirmDiscard:
|
|
2080
|
-
|
|
2081
|
-
async function
|
|
2082
|
-
const
|
|
2083
|
-
return
|
|
2078
|
+
const { confirmDiscard: pe } = vt(() => !l && o.dirty.value);
|
|
2079
|
+
ze(pa, null) && va(() => (l || re(), !0));
|
|
2080
|
+
async function _e() {
|
|
2081
|
+
const f = await pe();
|
|
2082
|
+
return f && re(), f;
|
|
2084
2083
|
}
|
|
2085
|
-
function
|
|
2086
|
-
|
|
2084
|
+
function ge() {
|
|
2085
|
+
o.reset(), i.clear(), p.clear(), u.value = null, r.value = t.value[0].name, p.add(r.value), m = 0, S.value = !1, re(), l = !1;
|
|
2087
2086
|
}
|
|
2088
|
-
const
|
|
2089
|
-
const
|
|
2090
|
-
return
|
|
2091
|
-
}),
|
|
2092
|
-
const
|
|
2093
|
-
return
|
|
2094
|
-
}),
|
|
2087
|
+
const C = B(() => {
|
|
2088
|
+
const f = [e("core.steps.position", { current: c.value + 1, total: w.value }), y.value.label];
|
|
2089
|
+
return h.value && f.push(e("core.steps.draft_saved")), f.join(" · ");
|
|
2090
|
+
}), I = B(() => {
|
|
2091
|
+
const f = t.value[c.value];
|
|
2092
|
+
return f.nextLabel ? f.nextLabel : q.value ? a.submitLabel ?? e("core.actions.save") : e("core.steps.next_named", { step: t.value[c.value + 1].label });
|
|
2093
|
+
}), n = B(() => F.value ? null : t.value[c.value - 1].label);
|
|
2095
2094
|
return {
|
|
2096
|
-
steps:
|
|
2097
|
-
current:
|
|
2098
|
-
index:
|
|
2099
|
-
count:
|
|
2100
|
-
isFirst:
|
|
2101
|
-
isLast:
|
|
2102
|
-
busy:
|
|
2103
|
-
direction:
|
|
2104
|
-
subtitle:
|
|
2105
|
-
nextLabel:
|
|
2106
|
-
backLabel:
|
|
2107
|
-
restored:
|
|
2108
|
-
refusals:
|
|
2109
|
-
errors:
|
|
2110
|
-
failure:
|
|
2111
|
-
next:
|
|
2112
|
-
back: () =>
|
|
2113
|
-
goTo:
|
|
2114
|
-
restart:
|
|
2115
|
-
confirmDiscard:
|
|
2116
|
-
bindDialog: () => ({ subtitle:
|
|
2095
|
+
steps: b,
|
|
2096
|
+
current: y,
|
|
2097
|
+
index: c,
|
|
2098
|
+
count: w,
|
|
2099
|
+
isFirst: F,
|
|
2100
|
+
isLast: q,
|
|
2101
|
+
busy: $,
|
|
2102
|
+
direction: u,
|
|
2103
|
+
subtitle: C,
|
|
2104
|
+
nextLabel: I,
|
|
2105
|
+
backLabel: n,
|
|
2106
|
+
restored: S,
|
|
2107
|
+
refusals: x,
|
|
2108
|
+
errors: o.errors,
|
|
2109
|
+
failure: o.failure,
|
|
2110
|
+
next: J,
|
|
2111
|
+
back: () => E(c.value - 1),
|
|
2112
|
+
goTo: M,
|
|
2113
|
+
restart: ge,
|
|
2114
|
+
confirmDiscard: _e,
|
|
2115
|
+
bindDialog: () => ({ subtitle: C.value, primaryLabel: I.value, status: $.value ? "processing" : "idle", beforeDismiss: _e })
|
|
2117
2116
|
};
|
|
2118
2117
|
}
|
|
2119
|
-
const
|
|
2118
|
+
const Qo = {
|
|
2120
2119
|
class: "flex flex-wrap items-center gap-2.5 border-t border-border-separator pt-3.5",
|
|
2121
2120
|
"data-test": "step-navigation"
|
|
2122
|
-
},
|
|
2121
|
+
}, el = /* @__PURE__ */ Z({
|
|
2123
2122
|
__name: "StepNavigation",
|
|
2124
2123
|
props: {
|
|
2125
2124
|
flow: {}
|
|
2126
2125
|
},
|
|
2127
2126
|
emits: ["cancel"],
|
|
2128
|
-
setup(
|
|
2129
|
-
const
|
|
2130
|
-
return (
|
|
2131
|
-
|
|
2127
|
+
setup(o) {
|
|
2128
|
+
const a = o, { t: e } = le();
|
|
2129
|
+
return (t, r) => (d(), g("div", Qo, [
|
|
2130
|
+
a.flow.backLabel.value ? (d(), R(ae, {
|
|
2132
2131
|
key: 0,
|
|
2133
2132
|
prominence: "plain",
|
|
2134
2133
|
icon: "arrowLeftSLine",
|
|
2135
|
-
disabled:
|
|
2134
|
+
disabled: a.flow.busy.value,
|
|
2136
2135
|
"data-test": "step-back",
|
|
2137
|
-
onClick:
|
|
2136
|
+
onClick: r[0] || (r[0] = (i) => a.flow.back())
|
|
2138
2137
|
}, {
|
|
2139
|
-
default:
|
|
2140
|
-
|
|
2138
|
+
default: _(() => [
|
|
2139
|
+
X(L(a.flow.backLabel.value), 1)
|
|
2141
2140
|
]),
|
|
2142
2141
|
_: 1
|
|
2143
|
-
}, 8, ["disabled"])) :
|
|
2144
|
-
|
|
2145
|
-
N(
|
|
2142
|
+
}, 8, ["disabled"])) : z("", !0),
|
|
2143
|
+
r[3] || (r[3] = V("div", { class: "grow" }, null, -1)),
|
|
2144
|
+
N(ae, {
|
|
2146
2145
|
prominence: "plain",
|
|
2147
2146
|
"data-test": "step-cancel",
|
|
2148
|
-
onClick:
|
|
2147
|
+
onClick: r[1] || (r[1] = (i) => t.$emit("cancel"))
|
|
2149
2148
|
}, {
|
|
2150
|
-
default:
|
|
2151
|
-
|
|
2149
|
+
default: _(() => [
|
|
2150
|
+
X(L(s(e)("core.actions.cancel")), 1)
|
|
2152
2151
|
]),
|
|
2153
2152
|
_: 1
|
|
2154
2153
|
}),
|
|
2155
|
-
N(
|
|
2154
|
+
N(ae, {
|
|
2156
2155
|
prominence: "primary",
|
|
2157
|
-
processing:
|
|
2156
|
+
processing: a.flow.busy.value,
|
|
2158
2157
|
"data-test": "step-next",
|
|
2159
|
-
onClick:
|
|
2158
|
+
onClick: r[2] || (r[2] = (i) => a.flow.next())
|
|
2160
2159
|
}, {
|
|
2161
|
-
default:
|
|
2162
|
-
|
|
2160
|
+
default: _(() => [
|
|
2161
|
+
X(L(a.flow.nextLabel.value), 1)
|
|
2163
2162
|
]),
|
|
2164
2163
|
_: 1
|
|
2165
2164
|
}, 8, ["processing"])
|
|
2166
2165
|
]));
|
|
2167
2166
|
}
|
|
2168
|
-
}),
|
|
2167
|
+
}), tl = ["aria-label"], al = ["aria-current"], ol = ["aria-label"], ll = {
|
|
2169
2168
|
key: 2,
|
|
2170
2169
|
class: "sr-only"
|
|
2171
|
-
},
|
|
2170
|
+
}, rl = {
|
|
2172
2171
|
key: 1,
|
|
2173
2172
|
"data-test": "step-dots",
|
|
2174
2173
|
class: "flex justify-center gap-1.5",
|
|
2175
2174
|
"aria-hidden": "true"
|
|
2176
|
-
},
|
|
2175
|
+
}, nl = ["data-state"], sl = /* @__PURE__ */ Z({
|
|
2177
2176
|
__name: "StepProgress",
|
|
2178
2177
|
props: {
|
|
2179
2178
|
flow: {},
|
|
2180
2179
|
progress: { default: "bar" }
|
|
2181
2180
|
},
|
|
2182
|
-
setup(
|
|
2183
|
-
const
|
|
2184
|
-
return (
|
|
2181
|
+
setup(o) {
|
|
2182
|
+
const a = o, { t: e } = le();
|
|
2183
|
+
return (t, r) => a.progress === "bar" ? (d(), g("ol", {
|
|
2185
2184
|
key: 0,
|
|
2186
2185
|
"aria-label": s(e)("core.steps.label"),
|
|
2187
2186
|
"data-test": "step-bar",
|
|
2188
2187
|
class: "grid min-w-0 gap-2",
|
|
2189
|
-
style:
|
|
2188
|
+
style: Ne({ gridTemplateColumns: `repeat(${a.flow.count.value}, minmax(0, 1fr))` })
|
|
2190
2189
|
}, [
|
|
2191
|
-
(d(!0),
|
|
2192
|
-
key:
|
|
2190
|
+
(d(!0), g(ee, null, ve(a.flow.steps.value, (i) => (d(), g("li", {
|
|
2191
|
+
key: i.name,
|
|
2193
2192
|
class: "flex min-w-0",
|
|
2194
|
-
"aria-current":
|
|
2193
|
+
"aria-current": i.state === "current" ? "step" : void 0
|
|
2195
2194
|
}, [
|
|
2196
|
-
(d(),
|
|
2197
|
-
type:
|
|
2198
|
-
disabled:
|
|
2199
|
-
"data-test": `step-${
|
|
2200
|
-
"data-state":
|
|
2201
|
-
class:
|
|
2202
|
-
onClick: (
|
|
2195
|
+
(d(), R(Rt(i.reachable ? "button" : "div"), {
|
|
2196
|
+
type: i.reachable ? "button" : void 0,
|
|
2197
|
+
disabled: i.reachable ? a.flow.busy.value : void 0,
|
|
2198
|
+
"data-test": `step-${i.name}`,
|
|
2199
|
+
"data-state": i.errors > 0 ? "error" : i.state,
|
|
2200
|
+
class: W(["group flex min-w-0 flex-1 flex-col gap-1.5 text-left", i.reachable ? "cursor-pointer rounded-control focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus disabled:cursor-default" : ""]),
|
|
2201
|
+
onClick: (p) => i.reachable ? a.flow.goTo(i.name) : void 0
|
|
2203
2202
|
}, {
|
|
2204
|
-
default:
|
|
2205
|
-
|
|
2206
|
-
class:
|
|
2203
|
+
default: _(() => [
|
|
2204
|
+
V("span", {
|
|
2205
|
+
class: W(["h-1 rounded-full transition-colors duration-motion-normal", i.errors > 0 ? "bg-status-danger-solid" : i.state === "current" ? "bg-tint" : i.state === "done" ? "bg-control-on" : "bg-fill-strong"]),
|
|
2207
2206
|
"aria-hidden": "true"
|
|
2208
2207
|
}, null, 2),
|
|
2209
|
-
|
|
2210
|
-
class:
|
|
2208
|
+
V("span", {
|
|
2209
|
+
class: W(["flex min-w-0 items-center gap-1.5 text-footnote", i.state === "current" ? "font-bold text-content-strong" : i.state === "done" ? "font-medium text-content-link" : "font-medium text-content-muted"])
|
|
2211
2210
|
}, [
|
|
2212
|
-
|
|
2211
|
+
i.state === "done" ? (d(), R(s(de), {
|
|
2213
2212
|
key: 0,
|
|
2214
2213
|
name: "checkCustom",
|
|
2215
2214
|
size: 12,
|
|
2216
2215
|
class: "shrink-0"
|
|
2217
|
-
})) :
|
|
2218
|
-
|
|
2219
|
-
class:
|
|
2220
|
-
},
|
|
2221
|
-
|
|
2216
|
+
})) : z("", !0),
|
|
2217
|
+
V("span", {
|
|
2218
|
+
class: W(["truncate", i.reachable ? "group-hover:text-content-link" : ""])
|
|
2219
|
+
}, L(i.position) + ". " + L(i.label), 3),
|
|
2220
|
+
i.errors > 0 ? (d(), g("span", {
|
|
2222
2221
|
key: 1,
|
|
2223
2222
|
"data-test": "step-errors",
|
|
2224
|
-
"aria-label": s(e)("core.form.sections.errors", { count:
|
|
2223
|
+
"aria-label": s(e)("core.form.sections.errors", { count: i.errors }),
|
|
2225
2224
|
class: "min-w-4.5 shrink-0 rounded-full bg-status-danger-solid px-1.5 text-center text-caption font-semibold text-white"
|
|
2226
|
-
},
|
|
2227
|
-
|
|
2225
|
+
}, L(i.errors), 9, ol)) : z("", !0),
|
|
2226
|
+
i.state === "done" ? (d(), g("span", ll, L(s(e)("core.steps.done")), 1)) : z("", !0)
|
|
2228
2227
|
], 2)
|
|
2229
2228
|
]),
|
|
2230
2229
|
_: 2
|
|
2231
2230
|
}, 1032, ["type", "disabled", "data-test", "data-state", "class", "onClick"]))
|
|
2232
|
-
], 8,
|
|
2233
|
-
], 12,
|
|
2234
|
-
(d(!0),
|
|
2235
|
-
key:
|
|
2236
|
-
class:
|
|
2237
|
-
"data-state":
|
|
2238
|
-
}, null, 10,
|
|
2231
|
+
], 8, al))), 128))
|
|
2232
|
+
], 12, tl)) : (d(), g("div", rl, [
|
|
2233
|
+
(d(!0), g(ee, null, ve(a.flow.steps.value, (i) => (d(), g("span", {
|
|
2234
|
+
key: i.name,
|
|
2235
|
+
class: W(["h-1.5 rounded-full transition-all duration-motion-fast", [i.state === "current" ? "w-4.5" : "w-1.5", i.errors > 0 ? "bg-status-danger-solid" : i.state === "todo" && i.position > a.flow.index.value ? "bg-fill-strong" : "bg-tint"]]),
|
|
2236
|
+
"data-state": i.errors > 0 ? "error" : i.state
|
|
2237
|
+
}, null, 10, nl))), 128))
|
|
2239
2238
|
]));
|
|
2240
2239
|
}
|
|
2241
|
-
}),
|
|
2240
|
+
}), il = ["data-step"], ul = {
|
|
2242
2241
|
class: "sr-only",
|
|
2243
2242
|
"aria-live": "polite"
|
|
2244
|
-
},
|
|
2243
|
+
}, dl = {
|
|
2245
2244
|
key: 1,
|
|
2246
2245
|
"data-test": "step-restored",
|
|
2247
2246
|
class: "flex items-center gap-2 text-footnote text-content-muted"
|
|
2248
|
-
},
|
|
2247
|
+
}, Hr = /* @__PURE__ */ Z({
|
|
2249
2248
|
__name: "StepForm",
|
|
2250
2249
|
props: {
|
|
2251
2250
|
flow: {},
|
|
@@ -2253,157 +2252,1149 @@ const Fl = {
|
|
|
2253
2252
|
navigation: { default: "inline" }
|
|
2254
2253
|
},
|
|
2255
2254
|
emits: ["cancel"],
|
|
2256
|
-
setup(
|
|
2257
|
-
const
|
|
2258
|
-
function
|
|
2259
|
-
for (let
|
|
2260
|
-
const
|
|
2261
|
-
if ((
|
|
2255
|
+
setup(o) {
|
|
2256
|
+
const a = o, { t: e } = le(), t = oe("body"), r = oe("root");
|
|
2257
|
+
function i(p) {
|
|
2258
|
+
for (let u = p.parentElement; u; u = u.parentElement) {
|
|
2259
|
+
const v = getComputedStyle(u).overflowY;
|
|
2260
|
+
if ((v === "auto" || v === "scroll") && u.scrollHeight > u.clientHeight) return p.getBoundingClientRect().top < u.getBoundingClientRect().top;
|
|
2262
2261
|
}
|
|
2263
|
-
return
|
|
2262
|
+
return p.getBoundingClientRect().top < 0;
|
|
2264
2263
|
}
|
|
2265
|
-
return
|
|
2266
|
-
await
|
|
2267
|
-
}),
|
|
2268
|
-
await
|
|
2269
|
-
}), (
|
|
2264
|
+
return ne(() => a.flow.current.value.name, async () => {
|
|
2265
|
+
await we(), r.value && i(r.value) && r.value.scrollIntoView?.({ block: "start" }), t.value?.focus({ preventScroll: !0 });
|
|
2266
|
+
}), ne(() => a.flow.refusals.value, async () => {
|
|
2267
|
+
await we(), t.value && await Oe(t.value);
|
|
2268
|
+
}), (p, u) => (d(), g("div", {
|
|
2270
2269
|
ref_key: "root",
|
|
2271
|
-
ref:
|
|
2270
|
+
ref: r,
|
|
2272
2271
|
class: "flex min-w-0 flex-col gap-group-gap",
|
|
2273
2272
|
"data-test": "step-form",
|
|
2274
|
-
"data-step":
|
|
2273
|
+
"data-step": a.flow.current.value.name
|
|
2275
2274
|
}, [
|
|
2276
|
-
|
|
2275
|
+
a.progress !== "none" ? (d(), R(sl, {
|
|
2277
2276
|
key: 0,
|
|
2278
|
-
flow:
|
|
2279
|
-
progress:
|
|
2280
|
-
}, null, 8, ["flow", "progress"])) :
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
N(
|
|
2277
|
+
flow: a.flow,
|
|
2278
|
+
progress: a.progress
|
|
2279
|
+
}, null, 8, ["flow", "progress"])) : z("", !0),
|
|
2280
|
+
V("p", ul, L(a.flow.subtitle.value), 1),
|
|
2281
|
+
a.flow.restored.value ? (d(), g("div", dl, [
|
|
2282
|
+
V("span", null, L(s(e)("core.steps.restored")), 1),
|
|
2283
|
+
N(ae, {
|
|
2285
2284
|
prominence: "link",
|
|
2286
2285
|
size: "sm",
|
|
2287
|
-
onClick:
|
|
2286
|
+
onClick: u[0] || (u[0] = (v) => a.flow.restart())
|
|
2288
2287
|
}, {
|
|
2289
|
-
default:
|
|
2290
|
-
|
|
2288
|
+
default: _(() => [
|
|
2289
|
+
X(L(s(e)("core.steps.start_over")), 1)
|
|
2291
2290
|
]),
|
|
2292
2291
|
_: 1
|
|
2293
2292
|
})
|
|
2294
|
-
])) :
|
|
2295
|
-
(d(),
|
|
2296
|
-
key:
|
|
2297
|
-
form:
|
|
2293
|
+
])) : z("", !0),
|
|
2294
|
+
(d(), R(ct, {
|
|
2295
|
+
key: a.flow.current.value.name,
|
|
2296
|
+
form: a.flow
|
|
2298
2297
|
}, null, 8, ["form"])),
|
|
2299
|
-
(d(),
|
|
2300
|
-
key:
|
|
2298
|
+
(d(), g("form", {
|
|
2299
|
+
key: a.flow.current.value.name,
|
|
2301
2300
|
ref_key: "body",
|
|
2302
|
-
ref:
|
|
2301
|
+
ref: t,
|
|
2303
2302
|
tabindex: "-1",
|
|
2304
2303
|
novalidate: "",
|
|
2305
2304
|
"data-test": "step-body",
|
|
2306
|
-
class:
|
|
2307
|
-
onSubmit:
|
|
2305
|
+
class: W(["flex min-w-0 flex-col gap-group-gap outline-none", a.flow.direction.value === "back" ? "animate-step-back" : a.flow.direction.value === "forward" ? "animate-step-in" : ""]),
|
|
2306
|
+
onSubmit: u[1] || (u[1] = he((v) => a.flow.next(), ["prevent"]))
|
|
2308
2307
|
}, [
|
|
2309
|
-
|
|
2310
|
-
|
|
2308
|
+
j(p.$slots, a.flow.current.value.name),
|
|
2309
|
+
u[3] || (u[3] = V("button", {
|
|
2311
2310
|
type: "submit",
|
|
2312
2311
|
class: "sr-only",
|
|
2313
2312
|
tabindex: "-1",
|
|
2314
2313
|
"aria-hidden": "true"
|
|
2315
2314
|
}, null, -1))
|
|
2316
2315
|
], 34)),
|
|
2317
|
-
|
|
2316
|
+
a.navigation === "inline" ? (d(), R(el, {
|
|
2318
2317
|
key: 2,
|
|
2319
|
-
flow:
|
|
2320
|
-
onCancel:
|
|
2321
|
-
}, null, 8, ["flow"])) :
|
|
2322
|
-
], 8,
|
|
2318
|
+
flow: a.flow,
|
|
2319
|
+
onCancel: u[2] || (u[2] = (v) => p.$emit("cancel"))
|
|
2320
|
+
}, null, 8, ["flow"])) : z("", !0)
|
|
2321
|
+
], 8, il));
|
|
2322
|
+
}
|
|
2323
|
+
}), st = Symbol("vue-core.dynamicForm.locale"), cl = { class: "flex w-full flex-col gap-3" }, ml = { class: "mb-2 flex items-center justify-between" }, fl = { class: "text-sm font-medium text-muted" }, pl = {
|
|
2324
|
+
key: 0,
|
|
2325
|
+
class: "flex gap-1"
|
|
2326
|
+
}, vl = { key: 0 }, bl = /* @__PURE__ */ Z({
|
|
2327
|
+
__name: "RepeatField",
|
|
2328
|
+
props: /* @__PURE__ */ ce({
|
|
2329
|
+
label: {},
|
|
2330
|
+
labelHidden: { type: Boolean },
|
|
2331
|
+
hint: {},
|
|
2332
|
+
error: {},
|
|
2333
|
+
required: { type: Boolean },
|
|
2334
|
+
editable: { type: Boolean },
|
|
2335
|
+
disabled: { type: Boolean },
|
|
2336
|
+
lockedReason: {},
|
|
2337
|
+
presentation: {},
|
|
2338
|
+
name: {},
|
|
2339
|
+
fields: {},
|
|
2340
|
+
modelValue: {},
|
|
2341
|
+
locales: {},
|
|
2342
|
+
defaultLocale: {},
|
|
2343
|
+
errors: {},
|
|
2344
|
+
resources: {},
|
|
2345
|
+
addLabel: {},
|
|
2346
|
+
localeMode: {}
|
|
2347
|
+
}, { ...fe, modelValue: () => [], locales: void 0, defaultLocale: void 0, errors: () => ({}), resources: void 0, addLabel: void 0, localeMode: "perField" }),
|
|
2348
|
+
emits: ["update:modelValue"],
|
|
2349
|
+
setup(o, { emit: a }) {
|
|
2350
|
+
const e = o, t = a, { t: r } = le(), { editable: i } = Se(e);
|
|
2351
|
+
let p = 0;
|
|
2352
|
+
const u = G([]);
|
|
2353
|
+
ne(() => e.modelValue.length, (c) => {
|
|
2354
|
+
for (; u.value.length < c; ) u.value.push(p++);
|
|
2355
|
+
u.value.length = c;
|
|
2356
|
+
}, { immediate: !0 });
|
|
2357
|
+
const v = (c) => t("update:modelValue", c), x = () => {
|
|
2358
|
+
u.value.push(p++), v([...e.modelValue, {}]);
|
|
2359
|
+
}, S = (c) => {
|
|
2360
|
+
u.value.splice(c, 1), v(e.modelValue.filter((k, b) => b !== c));
|
|
2361
|
+
};
|
|
2362
|
+
function h(c, k) {
|
|
2363
|
+
const b = c + k;
|
|
2364
|
+
if (b < 0 || b >= e.modelValue.length) return;
|
|
2365
|
+
const y = [...e.modelValue];
|
|
2366
|
+
[y[c], y[b]] = [y[b], y[c]], [u.value[c], u.value[b]] = [u.value[b], u.value[c]], v(y);
|
|
2367
|
+
}
|
|
2368
|
+
const l = (c, k) => v(e.modelValue.map((b, y) => y === c ? k : { ...b }));
|
|
2369
|
+
function m(c) {
|
|
2370
|
+
const k = `${c}.`;
|
|
2371
|
+
return Object.fromEntries(Object.entries(e.errors).filter(([b]) => b.startsWith(k)).map(([b, y]) => [b.slice(k.length), y]));
|
|
2372
|
+
}
|
|
2373
|
+
return (c, k) => (d(), R(be, P(s(me)(e), {
|
|
2374
|
+
"row-layout": "stacked",
|
|
2375
|
+
value: null,
|
|
2376
|
+
error: e.error ?? e.errors[""]?.[0]
|
|
2377
|
+
}), {
|
|
2378
|
+
default: _(() => [
|
|
2379
|
+
V("div", cl, [
|
|
2380
|
+
(d(!0), g(ee, null, ve(e.modelValue, (b, y) => (d(), g("div", {
|
|
2381
|
+
key: u.value[y],
|
|
2382
|
+
class: "rounded-md border border-border p-3",
|
|
2383
|
+
"data-repeat-row": ""
|
|
2384
|
+
}, [
|
|
2385
|
+
V("div", ml, [
|
|
2386
|
+
V("span", fl, L(s(r)("core.form.dynamic.repeat.row", { n: y + 1 })), 1),
|
|
2387
|
+
s(i) && !e.disabled ? (d(), g("div", pl, [
|
|
2388
|
+
N(ae, P({
|
|
2389
|
+
size: "xs",
|
|
2390
|
+
prominence: "plain",
|
|
2391
|
+
icon: "arrowUpSLine",
|
|
2392
|
+
disabled: y === 0
|
|
2393
|
+
}, { ref_for: !0 }, { "aria-label": s(r)("core.form.dynamic.repeat.up", { n: y + 1 }) }, {
|
|
2394
|
+
"data-move": "up",
|
|
2395
|
+
onClick: (w) => h(y, -1)
|
|
2396
|
+
}), null, 16, ["disabled", "onClick"]),
|
|
2397
|
+
N(ae, P({
|
|
2398
|
+
size: "xs",
|
|
2399
|
+
prominence: "plain",
|
|
2400
|
+
icon: "arrowDownSLine",
|
|
2401
|
+
disabled: y === e.modelValue.length - 1
|
|
2402
|
+
}, { ref_for: !0 }, { "aria-label": s(r)("core.form.dynamic.repeat.down", { n: y + 1 }) }, {
|
|
2403
|
+
"data-move": "down",
|
|
2404
|
+
onClick: (w) => h(y, 1)
|
|
2405
|
+
}), null, 16, ["disabled", "onClick"]),
|
|
2406
|
+
N(ae, P({
|
|
2407
|
+
size: "xs",
|
|
2408
|
+
prominence: "plain",
|
|
2409
|
+
tone: "critical",
|
|
2410
|
+
icon: "deleteBin2Line"
|
|
2411
|
+
}, { ref_for: !0 }, { "aria-label": s(r)("core.form.dynamic.repeat.remove", { n: y + 1 }) }, {
|
|
2412
|
+
"data-remove": "",
|
|
2413
|
+
onClick: (w) => S(y)
|
|
2414
|
+
}), null, 16, ["onClick"])
|
|
2415
|
+
])) : z("", !0)
|
|
2416
|
+
]),
|
|
2417
|
+
N(Al, {
|
|
2418
|
+
schema: { fields: e.fields },
|
|
2419
|
+
"model-value": b,
|
|
2420
|
+
locales: e.locales,
|
|
2421
|
+
"default-locale": e.defaultLocale,
|
|
2422
|
+
errors: m(y),
|
|
2423
|
+
resources: e.resources,
|
|
2424
|
+
readonly: !s(i) || e.disabled,
|
|
2425
|
+
"locale-mode": e.localeMode,
|
|
2426
|
+
"onUpdate:modelValue": (w) => l(y, w)
|
|
2427
|
+
}, null, 8, ["schema", "model-value", "locales", "default-locale", "errors", "resources", "readonly", "locale-mode", "onUpdate:modelValue"])
|
|
2428
|
+
]))), 128)),
|
|
2429
|
+
s(i) && !e.disabled ? (d(), g("div", vl, [
|
|
2430
|
+
N(ae, {
|
|
2431
|
+
icon: "addLine",
|
|
2432
|
+
"data-add": "",
|
|
2433
|
+
onClick: x
|
|
2434
|
+
}, {
|
|
2435
|
+
default: _(() => [
|
|
2436
|
+
X(L(e.addLabel ?? s(r)("core.form.dynamic.repeat.add")), 1)
|
|
2437
|
+
]),
|
|
2438
|
+
_: 1
|
|
2439
|
+
})
|
|
2440
|
+
])) : z("", !0)
|
|
2441
|
+
])
|
|
2442
|
+
]),
|
|
2443
|
+
_: 1
|
|
2444
|
+
}, 16, ["error"]));
|
|
2445
|
+
}
|
|
2446
|
+
}), yl = { class: "flex flex-col gap-3 p-4" }, gl = ["placeholder", "aria-label"], hl = {
|
|
2447
|
+
key: 0,
|
|
2448
|
+
role: "alert",
|
|
2449
|
+
class: "text-sm text-critical"
|
|
2450
|
+
}, kl = {
|
|
2451
|
+
key: 1,
|
|
2452
|
+
class: "text-sm text-muted"
|
|
2453
|
+
}, _l = {
|
|
2454
|
+
key: 2,
|
|
2455
|
+
class: "text-sm text-muted"
|
|
2456
|
+
}, xl = {
|
|
2457
|
+
key: 3,
|
|
2458
|
+
class: "grid grid-cols-3 gap-2 sm:grid-cols-4"
|
|
2459
|
+
}, wl = ["onClick"], $l = ["src", "alt"], Vl = {
|
|
2460
|
+
key: 0,
|
|
2461
|
+
class: "truncate text-xs"
|
|
2462
|
+
}, Cl = { class: "flex justify-between" }, St = /* @__PURE__ */ Z({
|
|
2463
|
+
__name: "ResourcePickerList",
|
|
2464
|
+
props: {
|
|
2465
|
+
source: {},
|
|
2466
|
+
accept: {}
|
|
2467
|
+
},
|
|
2468
|
+
emits: ["select"],
|
|
2469
|
+
setup(o, { emit: a }) {
|
|
2470
|
+
const e = o, t = a, { t: r } = le(), i = G(""), p = G(1), u = G(1), v = G([]), x = G("loading");
|
|
2471
|
+
let S = null, h;
|
|
2472
|
+
async function l() {
|
|
2473
|
+
S?.abort();
|
|
2474
|
+
const k = S = new AbortController();
|
|
2475
|
+
x.value = "loading";
|
|
2476
|
+
try {
|
|
2477
|
+
const b = await e.source.list({ search: i.value.trim(), page: p.value, pageSize: 24, ...e.accept !== void 0 ? { accept: e.accept } : {} }, { signal: k.signal });
|
|
2478
|
+
if (k.signal.aborted) return;
|
|
2479
|
+
v.value = b.rows, u.value = Math.max(1, b.lastPage), x.value = "loaded";
|
|
2480
|
+
} catch {
|
|
2481
|
+
k.signal.aborted || (x.value = "failed");
|
|
2482
|
+
}
|
|
2483
|
+
}
|
|
2484
|
+
function m() {
|
|
2485
|
+
clearTimeout(h), h = setTimeout(() => {
|
|
2486
|
+
p.value = 1, l();
|
|
2487
|
+
}, 250);
|
|
2488
|
+
}
|
|
2489
|
+
function c(k) {
|
|
2490
|
+
p.value += k, l();
|
|
2491
|
+
}
|
|
2492
|
+
return Ie(() => void l()), Be(() => {
|
|
2493
|
+
clearTimeout(h), S?.abort();
|
|
2494
|
+
}), (k, b) => (d(), g("div", yl, [
|
|
2495
|
+
ft(V("input", {
|
|
2496
|
+
"onUpdate:modelValue": b[0] || (b[0] = (y) => i.value = y),
|
|
2497
|
+
type: "search",
|
|
2498
|
+
class: "w-full rounded-md border border-border bg-surface px-3 py-2 text-sm",
|
|
2499
|
+
placeholder: s(r)("core.form.dynamic.resource.search"),
|
|
2500
|
+
"aria-label": s(r)("core.form.dynamic.resource.search"),
|
|
2501
|
+
onInput: m
|
|
2502
|
+
}, null, 40, gl), [
|
|
2503
|
+
[pt, i.value]
|
|
2504
|
+
]),
|
|
2505
|
+
x.value === "failed" ? (d(), g("p", hl, L(s(r)("core.form.dynamic.resource.failed")), 1)) : x.value === "loading" && v.value.length === 0 ? (d(), g("p", kl, L(s(r)("core.form.dynamic.resource.loading")), 1)) : v.value.length === 0 ? (d(), g("p", _l, L(s(r)("core.form.dynamic.resource.empty")), 1)) : (d(), g("ul", xl, [
|
|
2506
|
+
(d(!0), g(ee, null, ve(v.value, (y) => (d(), g("li", {
|
|
2507
|
+
key: y.id
|
|
2508
|
+
}, [
|
|
2509
|
+
V("button", {
|
|
2510
|
+
type: "button",
|
|
2511
|
+
class: "flex w-full flex-col gap-1 rounded-md border border-border p-1 text-left hover:border-accent focus-visible:outline-2",
|
|
2512
|
+
onClick: (w) => t("select", y)
|
|
2513
|
+
}, [
|
|
2514
|
+
V("img", {
|
|
2515
|
+
src: s(Ge)(e.source, y.id),
|
|
2516
|
+
alt: y.name ?? "",
|
|
2517
|
+
class: "aspect-square w-full rounded object-cover",
|
|
2518
|
+
loading: "lazy"
|
|
2519
|
+
}, null, 8, $l),
|
|
2520
|
+
y.name ? (d(), g("span", Vl, L(y.name), 1)) : z("", !0)
|
|
2521
|
+
], 8, wl)
|
|
2522
|
+
]))), 128))
|
|
2523
|
+
])),
|
|
2524
|
+
V("div", Cl, [
|
|
2525
|
+
N(ae, {
|
|
2526
|
+
prominence: "plain",
|
|
2527
|
+
disabled: p.value <= 1,
|
|
2528
|
+
onClick: b[1] || (b[1] = (y) => c(-1))
|
|
2529
|
+
}, {
|
|
2530
|
+
default: _(() => [
|
|
2531
|
+
X(L(s(r)("core.form.dynamic.resource.previous")), 1)
|
|
2532
|
+
]),
|
|
2533
|
+
_: 1
|
|
2534
|
+
}, 8, ["disabled"]),
|
|
2535
|
+
N(ae, {
|
|
2536
|
+
prominence: "plain",
|
|
2537
|
+
disabled: p.value >= u.value,
|
|
2538
|
+
onClick: b[2] || (b[2] = (y) => c(1))
|
|
2539
|
+
}, {
|
|
2540
|
+
default: _(() => [
|
|
2541
|
+
X(L(s(r)("core.form.dynamic.resource.next")), 1)
|
|
2542
|
+
]),
|
|
2543
|
+
_: 1
|
|
2544
|
+
}, 8, ["disabled"])
|
|
2545
|
+
])
|
|
2546
|
+
]));
|
|
2547
|
+
}
|
|
2548
|
+
}), Sl = ["id"], ql = ["src"], Fl = {
|
|
2549
|
+
key: 0,
|
|
2550
|
+
class: "mt-1 flex justify-between"
|
|
2551
|
+
}, Bl = {
|
|
2552
|
+
key: 0,
|
|
2553
|
+
class: "text-sm text-muted"
|
|
2554
|
+
}, Ll = /* @__PURE__ */ Z({
|
|
2555
|
+
__name: "ResourceField",
|
|
2556
|
+
props: /* @__PURE__ */ ce({
|
|
2557
|
+
label: {},
|
|
2558
|
+
labelHidden: { type: Boolean },
|
|
2559
|
+
hint: {},
|
|
2560
|
+
error: {},
|
|
2561
|
+
required: { type: Boolean },
|
|
2562
|
+
editable: { type: Boolean },
|
|
2563
|
+
disabled: { type: Boolean },
|
|
2564
|
+
lockedReason: {},
|
|
2565
|
+
presentation: {},
|
|
2566
|
+
name: {},
|
|
2567
|
+
source: {},
|
|
2568
|
+
multiple: { type: Boolean },
|
|
2569
|
+
accept: {},
|
|
2570
|
+
modelValue: {}
|
|
2571
|
+
}, { ...fe, multiple: !1, accept: void 0, modelValue: void 0 }),
|
|
2572
|
+
emits: ["update:modelValue"],
|
|
2573
|
+
setup(o, { emit: a }) {
|
|
2574
|
+
const e = o, t = a, { t: r } = le(), { editable: i } = Se(e), p = _t(), u = B(() => Array.isArray(e.modelValue) ? [...e.modelValue] : e.modelValue === null || e.modelValue === void 0 || e.modelValue === "" ? [] : [e.modelValue]);
|
|
2575
|
+
function v(h) {
|
|
2576
|
+
t("update:modelValue", e.multiple ? h : h[0] ?? null);
|
|
2577
|
+
}
|
|
2578
|
+
async function x(h) {
|
|
2579
|
+
const l = await p.pick({ title: e.label ?? r("core.form.dynamic.resource.title") });
|
|
2580
|
+
if (!l) return;
|
|
2581
|
+
const m = [...u.value];
|
|
2582
|
+
e.multiple && h === void 0 ? m.push(l.id) : m[h ?? 0] = l.id, v(m);
|
|
2583
|
+
}
|
|
2584
|
+
const S = (h) => v(u.value.filter((l, m) => m !== h));
|
|
2585
|
+
return (h, l) => (d(), R(be, P(s(me)(e), {
|
|
2586
|
+
"row-layout": "stacked",
|
|
2587
|
+
value: u.value.length > 0 ? u.value.join(", ") : null
|
|
2588
|
+
}), {
|
|
2589
|
+
default: _(({ id: m }) => [
|
|
2590
|
+
V("div", {
|
|
2591
|
+
id: m,
|
|
2592
|
+
class: "flex flex-wrap items-start gap-2"
|
|
2593
|
+
}, [
|
|
2594
|
+
(d(!0), g(ee, null, ve(u.value, (c, k) => (d(), g("div", {
|
|
2595
|
+
key: `${c}-${k}`,
|
|
2596
|
+
class: "relative w-24",
|
|
2597
|
+
"data-resource": ""
|
|
2598
|
+
}, [
|
|
2599
|
+
V("img", {
|
|
2600
|
+
src: s(Ge)(e.source, c),
|
|
2601
|
+
alt: "",
|
|
2602
|
+
class: "aspect-square w-full rounded-md border border-border object-cover"
|
|
2603
|
+
}, null, 8, ql),
|
|
2604
|
+
s(i) && !e.disabled ? (d(), g("div", Fl, [
|
|
2605
|
+
N(ae, {
|
|
2606
|
+
size: "xs",
|
|
2607
|
+
prominence: "plain",
|
|
2608
|
+
onClick: (b) => x(k)
|
|
2609
|
+
}, {
|
|
2610
|
+
default: _(() => [
|
|
2611
|
+
X(L(s(r)("core.form.dynamic.resource.change")), 1)
|
|
2612
|
+
]),
|
|
2613
|
+
_: 1
|
|
2614
|
+
}, 8, ["onClick"]),
|
|
2615
|
+
N(ae, P({
|
|
2616
|
+
size: "xs",
|
|
2617
|
+
prominence: "plain",
|
|
2618
|
+
tone: "critical",
|
|
2619
|
+
icon: "close"
|
|
2620
|
+
}, { ref_for: !0 }, { "aria-label": s(r)("core.form.dynamic.resource.remove") }, {
|
|
2621
|
+
onClick: (b) => S(k)
|
|
2622
|
+
}), null, 16, ["onClick"])
|
|
2623
|
+
])) : z("", !0)
|
|
2624
|
+
]))), 128)),
|
|
2625
|
+
u.value.length === 0 && !s(i) ? (d(), g("p", Bl, L(s(r)("core.form.dynamic.resource.none")), 1)) : z("", !0),
|
|
2626
|
+
s(i) && !e.disabled && (e.multiple || u.value.length === 0) ? (d(), R(ae, {
|
|
2627
|
+
key: 1,
|
|
2628
|
+
icon: "addLine",
|
|
2629
|
+
onClick: l[0] || (l[0] = (c) => x())
|
|
2630
|
+
}, {
|
|
2631
|
+
default: _(() => [
|
|
2632
|
+
X(L(s(r)("core.form.dynamic.resource.choose")), 1)
|
|
2633
|
+
]),
|
|
2634
|
+
_: 1
|
|
2635
|
+
})) : z("", !0)
|
|
2636
|
+
], 8, Sl),
|
|
2637
|
+
N(xt, { picker: s(p) }, {
|
|
2638
|
+
default: _(({ select: c }) => [
|
|
2639
|
+
N(St, {
|
|
2640
|
+
source: e.source,
|
|
2641
|
+
accept: e.accept,
|
|
2642
|
+
onSelect: c
|
|
2643
|
+
}, null, 8, ["source", "accept", "onSelect"])
|
|
2644
|
+
]),
|
|
2645
|
+
_: 1
|
|
2646
|
+
}, 8, ["picker"])
|
|
2647
|
+
]),
|
|
2648
|
+
_: 1
|
|
2649
|
+
}, 16, ["value"]));
|
|
2650
|
+
}
|
|
2651
|
+
}), Tl = { class: "w-full rounded-md border border-border bg-surface" }, Dl = ["aria-label"], zl = ["data-tool", "aria-label", "title", "aria-pressed", "disabled", "onClick"], Ml = ["aria-label", "placeholder"], Rl = {
|
|
2652
|
+
key: 2,
|
|
2653
|
+
role: "alert",
|
|
2654
|
+
class: "p-3 text-sm text-critical"
|
|
2655
|
+
}, Ol = ["id"], it = /* @__PURE__ */ Z({
|
|
2656
|
+
__name: "RichTextField",
|
|
2657
|
+
props: /* @__PURE__ */ ce({
|
|
2658
|
+
label: {},
|
|
2659
|
+
labelHidden: { type: Boolean },
|
|
2660
|
+
hint: {},
|
|
2661
|
+
error: {},
|
|
2662
|
+
required: { type: Boolean },
|
|
2663
|
+
editable: { type: Boolean },
|
|
2664
|
+
disabled: { type: Boolean },
|
|
2665
|
+
lockedReason: {},
|
|
2666
|
+
presentation: {},
|
|
2667
|
+
name: {},
|
|
2668
|
+
modelValue: {},
|
|
2669
|
+
images: {},
|
|
2670
|
+
video: { type: Boolean },
|
|
2671
|
+
placeholder: {}
|
|
2672
|
+
}, { ...fe, modelValue: "", images: void 0, video: !1, placeholder: void 0 }),
|
|
2673
|
+
emits: ["update:modelValue"],
|
|
2674
|
+
setup(o, { emit: a }) {
|
|
2675
|
+
const e = o, t = a, { t: r } = le(), { editable: i } = Se(e), p = oe("host"), u = G(!1), v = G(!1), x = _t(), S = G(null), h = G("");
|
|
2676
|
+
let l = null, m = "", c = null;
|
|
2677
|
+
const k = G({}), b = () => l ? l.getText().trim() === "" && !l.root.querySelector("img, iframe") ? "" : l.getSemanticHTML() : "";
|
|
2678
|
+
function y(O) {
|
|
2679
|
+
l && (l.setContents(l.clipboard.convert({ html: O }), "silent"), m = b());
|
|
2680
|
+
}
|
|
2681
|
+
Ie(async () => {
|
|
2682
|
+
try {
|
|
2683
|
+
const { default: O } = await import("quill");
|
|
2684
|
+
if (!p.value) return;
|
|
2685
|
+
l = new O(p.value, { modules: { toolbar: !1 }, placeholder: e.placeholder, readOnly: !i.value || e.disabled });
|
|
2686
|
+
} catch {
|
|
2687
|
+
u.value = !0;
|
|
2688
|
+
return;
|
|
2689
|
+
}
|
|
2690
|
+
y(e.modelValue), l.on("text-change", (O, D, J) => {
|
|
2691
|
+
m = b(), J === "user" && t("update:modelValue", m);
|
|
2692
|
+
}), l.on("selection-change", (O) => {
|
|
2693
|
+
O && (c = O, k.value = l?.getFormat(O) ?? {});
|
|
2694
|
+
}), v.value = !0;
|
|
2695
|
+
}), Be(() => l?.disable()), ne(() => e.modelValue, (O) => {
|
|
2696
|
+
O !== m && y(O);
|
|
2697
|
+
}), ne(() => !i.value || e.disabled, (O) => l?.enable(!O));
|
|
2698
|
+
const w = (O, D) => {
|
|
2699
|
+
if (!l) return;
|
|
2700
|
+
l.focus();
|
|
2701
|
+
const J = l.getFormat();
|
|
2702
|
+
l.format(O, J[O] === D ? !1 : D, "user"), k.value = l.getFormat();
|
|
2703
|
+
}, F = (O, D = !0) => k.value[O] === D;
|
|
2704
|
+
function q(O) {
|
|
2705
|
+
c = l?.getSelection() ?? c, h.value = "", S.value = O;
|
|
2706
|
+
}
|
|
2707
|
+
async function $() {
|
|
2708
|
+
const O = h.value.trim(), D = S.value;
|
|
2709
|
+
if (S.value = null, !l || O === "" || !D) return;
|
|
2710
|
+
l.focus(), c && l.setSelection(c);
|
|
2711
|
+
const J = c ?? { index: l.getLength() };
|
|
2712
|
+
D === "link" ? l.format("link", O, "user") : l.insertEmbed(J.index, "video", O, "user");
|
|
2713
|
+
}
|
|
2714
|
+
async function E() {
|
|
2715
|
+
c = l?.getSelection() ?? c;
|
|
2716
|
+
const O = await x.pick({ title: r("core.form.dynamic.rich_text.image") });
|
|
2717
|
+
if (!O || !l || !e.images) return;
|
|
2718
|
+
const D = { thumbnail: e.images.image ?? e.images.thumbnail };
|
|
2719
|
+
l.insertEmbed(c?.index ?? l.getLength(), "image", Ge(D, O.id), "user");
|
|
2720
|
+
}
|
|
2721
|
+
const H = B(() => [
|
|
2722
|
+
{ key: "heading", label: r("core.form.dynamic.rich_text.heading"), text: "H", on: F("header", 2), run: () => w("header", 2) },
|
|
2723
|
+
{ key: "bold", label: r("core.form.dynamic.rich_text.bold"), text: "B", on: F("bold"), run: () => w("bold", !0) },
|
|
2724
|
+
{ key: "italic", label: r("core.form.dynamic.rich_text.italic"), text: "I", on: F("italic"), run: () => w("italic", !0) },
|
|
2725
|
+
{ key: "bullets", label: r("core.form.dynamic.rich_text.bullets"), text: "•", on: F("list", "bullet"), run: () => w("list", "bullet") },
|
|
2726
|
+
{ key: "numbers", label: r("core.form.dynamic.rich_text.numbers"), text: "1.", on: F("list", "ordered"), run: () => w("list", "ordered") },
|
|
2727
|
+
{ key: "link", label: r("core.form.dynamic.rich_text.link"), text: "↗", on: typeof k.value.link == "string", run: () => q("link") },
|
|
2728
|
+
...e.images ? [{ key: "image", label: r("core.form.dynamic.rich_text.image"), text: "▣", on: !1, run: () => void E() }] : [],
|
|
2729
|
+
...e.video ? [{ key: "video", label: r("core.form.dynamic.rich_text.video"), text: "▶", on: !1, run: () => q("video") }] : []
|
|
2730
|
+
]);
|
|
2731
|
+
return (O, D) => (d(), R(be, P(s(me)(e), {
|
|
2732
|
+
"row-layout": "stacked",
|
|
2733
|
+
value: null
|
|
2734
|
+
}), {
|
|
2735
|
+
default: _(({ id: J }) => [
|
|
2736
|
+
V("div", Tl, [
|
|
2737
|
+
s(i) && !e.disabled ? (d(), g("div", {
|
|
2738
|
+
key: 0,
|
|
2739
|
+
class: "flex flex-wrap gap-1 border-b border-border p-1",
|
|
2740
|
+
role: "toolbar",
|
|
2741
|
+
"aria-label": e.label
|
|
2742
|
+
}, [
|
|
2743
|
+
(d(!0), g(ee, null, ve(H.value, (M) => (d(), g("button", {
|
|
2744
|
+
key: M.key,
|
|
2745
|
+
type: "button",
|
|
2746
|
+
"data-tool": M.key,
|
|
2747
|
+
"aria-label": M.label,
|
|
2748
|
+
title: M.label,
|
|
2749
|
+
"aria-pressed": M.on,
|
|
2750
|
+
disabled: !v.value,
|
|
2751
|
+
class: "min-w-8 rounded px-2 py-1 text-sm font-medium hover:bg-surface-muted aria-pressed:bg-surface-muted",
|
|
2752
|
+
onMousedown: D[0] || (D[0] = he(() => {
|
|
2753
|
+
}, ["prevent"])),
|
|
2754
|
+
onClick: M.run
|
|
2755
|
+
}, L(M.text), 41, zl))), 128))
|
|
2756
|
+
], 8, Dl)) : z("", !0),
|
|
2757
|
+
S.value ? (d(), g("form", {
|
|
2758
|
+
key: 1,
|
|
2759
|
+
class: "flex gap-2 border-b border-border p-2",
|
|
2760
|
+
onSubmit: he($, ["prevent"])
|
|
2761
|
+
}, [
|
|
2762
|
+
ft(V("input", {
|
|
2763
|
+
"onUpdate:modelValue": D[1] || (D[1] = (M) => h.value = M),
|
|
2764
|
+
type: "url",
|
|
2765
|
+
class: "w-full rounded-md border border-border bg-surface px-2 py-1 text-sm",
|
|
2766
|
+
"aria-label": S.value === "link" ? s(r)("core.form.dynamic.rich_text.link_prompt") : s(r)("core.form.dynamic.rich_text.video_prompt"),
|
|
2767
|
+
placeholder: S.value === "link" ? s(r)("core.form.dynamic.rich_text.link_prompt") : s(r)("core.form.dynamic.rich_text.video_prompt")
|
|
2768
|
+
}, null, 8, Ml), [
|
|
2769
|
+
[pt, h.value]
|
|
2770
|
+
]),
|
|
2771
|
+
N(ae, {
|
|
2772
|
+
type: "submit",
|
|
2773
|
+
size: "sm"
|
|
2774
|
+
}, {
|
|
2775
|
+
default: _(() => [...D[2] || (D[2] = [
|
|
2776
|
+
X("OK", -1)
|
|
2777
|
+
])]),
|
|
2778
|
+
_: 1
|
|
2779
|
+
})
|
|
2780
|
+
], 32)) : z("", !0),
|
|
2781
|
+
u.value ? (d(), g("p", Rl, L(s(r)("core.form.dynamic.rich_text.failed")), 1)) : z("", !0),
|
|
2782
|
+
V("div", {
|
|
2783
|
+
id: J,
|
|
2784
|
+
ref_key: "host",
|
|
2785
|
+
ref: p,
|
|
2786
|
+
class: W(["min-h-32 px-3 py-2 text-sm [&_.ql-clipboard]:absolute [&_.ql-clipboard]:-left-[100000px] [&_.ql-editor]:min-h-28 [&_.ql-editor]:outline-none [&_.ql-editor_h2]:text-lg [&_.ql-editor_h2]:font-semibold [&_.ql-editor_img]:max-w-full [&_.ql-editor_ol]:pl-6 [&_.ql-editor_li[data-list=bullet]]:list-disc [&_.ql-editor_li[data-list=ordered]]:list-decimal [&_.ql-editor_a]:text-accent [&_.ql-editor_a]:underline [&_.ql-ui]:hidden [&_.ql-editor.ql-blank::before]:text-muted [&_.ql-editor.ql-blank::before]:content-[attr(data-placeholder)]", { hidden: u.value }])
|
|
2787
|
+
}, null, 10, Ol)
|
|
2788
|
+
]),
|
|
2789
|
+
e.images ? (d(), R(xt, {
|
|
2790
|
+
key: 0,
|
|
2791
|
+
picker: s(x)
|
|
2792
|
+
}, {
|
|
2793
|
+
default: _(({ select: M }) => [
|
|
2794
|
+
N(St, {
|
|
2795
|
+
source: e.images,
|
|
2796
|
+
accept: "image/*",
|
|
2797
|
+
onSelect: M
|
|
2798
|
+
}, null, 8, ["source", "onSelect"])
|
|
2799
|
+
]),
|
|
2800
|
+
_: 1
|
|
2801
|
+
}, 8, ["picker"])) : z("", !0)
|
|
2802
|
+
]),
|
|
2803
|
+
_: 1
|
|
2804
|
+
}, 16));
|
|
2323
2805
|
}
|
|
2324
2806
|
});
|
|
2807
|
+
function $e(o) {
|
|
2808
|
+
return o == null ? !0 : typeof o == "string" ? o.trim() === "" : Array.isArray(o) ? o.length === 0 : typeof o == "object" ? Object.values(o).every($e) : !1;
|
|
2809
|
+
}
|
|
2810
|
+
function De(o, a) {
|
|
2811
|
+
if (o === a) return !0;
|
|
2812
|
+
if (typeof o != "object" || typeof a != "object" || o === null || a === null || Array.isArray(o) !== Array.isArray(a)) return !1;
|
|
2813
|
+
const e = o, t = a, r = Object.keys(e);
|
|
2814
|
+
return r.length === Object.keys(t).length && r.every((i) => i in t && De(e[i], t[i]));
|
|
2815
|
+
}
|
|
2816
|
+
function jl(o, a) {
|
|
2817
|
+
const e = a[o.field];
|
|
2818
|
+
return "eq" in o ? De(e, o.eq) : "ne" in o ? !De(e, o.ne) : "in" in o ? Array.isArray(o.in) ? o.in.some((t) => De(e, t)) : null : "empty" in o ? $e(e) : "not_empty" in o ? !$e(e) : null;
|
|
2819
|
+
}
|
|
2820
|
+
function qt(o, a) {
|
|
2821
|
+
if (!o) return !0;
|
|
2822
|
+
const e = (o.all ?? o.any ?? []).map((t) => jl(t, a)).filter((t) => t !== null);
|
|
2823
|
+
return e.length === 0 ? !0 : o.all ? e.every(Boolean) : e.some(Boolean);
|
|
2824
|
+
}
|
|
2825
|
+
const El = {
|
|
2826
|
+
class: "flex w-full flex-col gap-4",
|
|
2827
|
+
"data-dynamic-form": ""
|
|
2828
|
+
}, Nl = ["aria-label"], Ul = ["id", "aria-selected", "data-locale", "data-error", "onClick"], Al = /* @__PURE__ */ Z({
|
|
2829
|
+
__name: "DynamicForm",
|
|
2830
|
+
props: {
|
|
2831
|
+
schema: {},
|
|
2832
|
+
modelValue: { default: () => ({}) },
|
|
2833
|
+
locales: { default: void 0 },
|
|
2834
|
+
defaultLocale: { default: void 0 },
|
|
2835
|
+
errors: { default: () => ({}) },
|
|
2836
|
+
readonly: { type: Boolean, default: !1 },
|
|
2837
|
+
localeMode: { default: "perField" },
|
|
2838
|
+
resources: { default: void 0 }
|
|
2839
|
+
},
|
|
2840
|
+
emits: ["update:modelValue"],
|
|
2841
|
+
setup(o, { emit: a }) {
|
|
2842
|
+
const e = o, t = a, { t: r, availableLocales: i } = le(), p = ze(ht, null), u = B(() => e.locales ?? p?.locales ?? i), v = B(() => e.defaultLocale ?? u.value[0] ?? ""), x = B(() => e.errors instanceof Tt ? e.errors.all() : e.errors);
|
|
2843
|
+
function S(C) {
|
|
2844
|
+
const I = x.value[C]?.[0];
|
|
2845
|
+
if (I !== void 0) return I;
|
|
2846
|
+
const n = Object.keys(x.value).find((f) => f.startsWith(`${C}.`));
|
|
2847
|
+
return n === void 0 ? void 0 : x.value[n]?.[0];
|
|
2848
|
+
}
|
|
2849
|
+
const h = (C) => Object.fromEntries(Object.entries(x.value).filter(([I]) => I.startsWith(`${C}.`)).map(([I, n]) => [I.slice(C.length + 1), n])), l = B(() => e.schema.fields.filter((C) => qt(C.visible_when, e.modelValue)));
|
|
2850
|
+
function m(C, I) {
|
|
2851
|
+
t("update:modelValue", { ...e.modelValue, [C]: I });
|
|
2852
|
+
}
|
|
2853
|
+
const c = (C) => !!C.translatable && (C.kind === "text" || C.kind === "textarea" || C.kind === "rich_text"), k = (C) => c(C) && (e.localeMode === "form" || C.kind === "rich_text"), b = ze(st, null), y = B(() => e.localeMode === "form" && b !== null), w = G(null), F = B(() => y.value && b ? b.value : w.value !== null && u.value.includes(w.value) ? w.value : v.value), q = B(() => !y.value && l.value.some(k));
|
|
2854
|
+
mt(st, F);
|
|
2855
|
+
const $ = (C) => typeof e.modelValue[C.key] == "object" && e.modelValue[C.key] !== null ? e.modelValue[C.key] : {}, E = (C) => x.value[`${C.key}.${F.value}`]?.[0] ?? x.value[C.key]?.[0], H = (C) => l.value.some((I) => c(I) && x.value[`${I.key}.${C}`] !== void 0);
|
|
2856
|
+
function O(C, I, n) {
|
|
2857
|
+
m(C.key, { ...$(C), [I]: n });
|
|
2858
|
+
}
|
|
2859
|
+
const D = (C, I = C.key) => ({
|
|
2860
|
+
label: C.label,
|
|
2861
|
+
hint: C.props?.hint,
|
|
2862
|
+
required: C.required === !0,
|
|
2863
|
+
error: C.kind === "collection" ? x.value[C.key]?.[0] : S(C.key),
|
|
2864
|
+
editable: !e.readonly,
|
|
2865
|
+
name: C.key,
|
|
2866
|
+
"data-field-key": I
|
|
2867
|
+
}), J = (C, I) => C.validation?.some((n) => n.rule === I) === !0, M = (C) => {
|
|
2868
|
+
const I = C.validation?.find((n) => n.rule === "max")?.args?.[0];
|
|
2869
|
+
return typeof I == "number" ? I : void 0;
|
|
2870
|
+
}, Q = (C) => Array.isArray(e.modelValue[C.key]) ? e.modelValue[C.key] : [], te = (C) => typeof e.modelValue[C.key] == "number" ? e.modelValue[C.key] : null, se = (C) => typeof e.modelValue[C.key] == "string" && e.modelValue[C.key] !== "" ? e.modelValue[C.key] : null, re = (C) => {
|
|
2871
|
+
const I = e.modelValue[C.key];
|
|
2872
|
+
return typeof I == "string" || typeof I == "number" ? I : null;
|
|
2873
|
+
}, pe = (C) => Array.isArray(e.modelValue[C.key]) ? e.modelValue[C.key] : [], _e = (C) => Array.isArray(e.modelValue[C.key]) ? e.modelValue[C.key] : [], ge = (C) => typeof e.modelValue[C.key] == "string" ? e.modelValue[C.key] : "";
|
|
2874
|
+
return (C, I) => (d(), g("div", El, [
|
|
2875
|
+
q.value ? (d(), g("div", {
|
|
2876
|
+
key: 0,
|
|
2877
|
+
role: "tablist",
|
|
2878
|
+
"aria-label": s(r)("core.form.dynamic.language"),
|
|
2879
|
+
class: "flex gap-1"
|
|
2880
|
+
}, [
|
|
2881
|
+
(d(!0), g(ee, null, ve(u.value, (n) => (d(), g("button", {
|
|
2882
|
+
id: `dynamic-locale-${n}`,
|
|
2883
|
+
key: n,
|
|
2884
|
+
type: "button",
|
|
2885
|
+
role: "tab",
|
|
2886
|
+
"aria-selected": n === F.value,
|
|
2887
|
+
"data-locale": n,
|
|
2888
|
+
"data-error": H(n) || void 0,
|
|
2889
|
+
class: "rounded-md px-3 py-1 text-sm font-medium uppercase aria-selected:bg-surface-muted data-[error]:text-critical",
|
|
2890
|
+
onClick: (f) => w.value = n
|
|
2891
|
+
}, L(n), 9, Ul))), 128))
|
|
2892
|
+
], 8, Nl)) : z("", !0),
|
|
2893
|
+
(d(!0), g(ee, null, ve(l.value, (n) => (d(), g(ee, {
|
|
2894
|
+
key: n.key
|
|
2895
|
+
}, [
|
|
2896
|
+
c(n) ? (d(), g(ee, { key: 0 }, [
|
|
2897
|
+
k(n) ? (d(), g(ee, { key: 0 }, [
|
|
2898
|
+
n.kind === "rich_text" ? (d(), R(it, P({
|
|
2899
|
+
key: 0,
|
|
2900
|
+
ref_for: !0
|
|
2901
|
+
}, D(n), {
|
|
2902
|
+
error: E(n),
|
|
2903
|
+
"model-value": $(n)[F.value] ?? "",
|
|
2904
|
+
images: e.resources,
|
|
2905
|
+
video: n.props?.video,
|
|
2906
|
+
"onUpdate:modelValue": (f) => O(n, F.value, f)
|
|
2907
|
+
}), null, 16, ["error", "model-value", "images", "video", "onUpdate:modelValue"])) : n.kind === "textarea" ? (d(), R(at, P({
|
|
2908
|
+
key: 1,
|
|
2909
|
+
ref_for: !0
|
|
2910
|
+
}, D(n), {
|
|
2911
|
+
error: E(n),
|
|
2912
|
+
"model-value": $(n)[F.value] ?? "",
|
|
2913
|
+
rows: n.props?.rows,
|
|
2914
|
+
placeholder: n.props?.placeholder,
|
|
2915
|
+
"max-length": M(n),
|
|
2916
|
+
"onUpdate:modelValue": (f) => O(n, F.value, f)
|
|
2917
|
+
}), null, 16, ["error", "model-value", "rows", "placeholder", "max-length", "onUpdate:modelValue"])) : (d(), R(Xe, P({
|
|
2918
|
+
key: 2,
|
|
2919
|
+
ref_for: !0
|
|
2920
|
+
}, D(n), {
|
|
2921
|
+
error: E(n),
|
|
2922
|
+
"model-value": $(n)[F.value] ?? "",
|
|
2923
|
+
placeholder: n.props?.placeholder,
|
|
2924
|
+
"max-length": M(n),
|
|
2925
|
+
"onUpdate:modelValue": (f) => O(n, F.value, f)
|
|
2926
|
+
}), null, 16, ["error", "model-value", "placeholder", "max-length", "onUpdate:modelValue"]))
|
|
2927
|
+
], 64)) : (d(), R($o, P({
|
|
2928
|
+
key: 1,
|
|
2929
|
+
ref_for: !0
|
|
2930
|
+
}, D(n), {
|
|
2931
|
+
"model-value": $(n),
|
|
2932
|
+
locales: u.value,
|
|
2933
|
+
"default-locale": v.value,
|
|
2934
|
+
"required-locales": n.required ? [v.value] : [],
|
|
2935
|
+
multiline: n.kind === "textarea",
|
|
2936
|
+
rows: n.props?.rows,
|
|
2937
|
+
placeholder: n.props?.placeholder,
|
|
2938
|
+
"max-length": M(n),
|
|
2939
|
+
"onUpdate:modelValue": (f) => m(n.key, f)
|
|
2940
|
+
}), null, 16, ["model-value", "locales", "default-locale", "required-locales", "multiline", "rows", "placeholder", "max-length", "onUpdate:modelValue"]))
|
|
2941
|
+
], 64)) : n.kind === "text" ? (d(), R(Xe, P({
|
|
2942
|
+
key: 1,
|
|
2943
|
+
ref_for: !0
|
|
2944
|
+
}, D(n), {
|
|
2945
|
+
type: J(n, "email") ? "email" : J(n, "url") ? "url" : "text",
|
|
2946
|
+
"model-value": ge(n),
|
|
2947
|
+
placeholder: n.props?.placeholder,
|
|
2948
|
+
"max-length": M(n),
|
|
2949
|
+
"onUpdate:modelValue": (f) => m(n.key, f)
|
|
2950
|
+
}), null, 16, ["type", "model-value", "placeholder", "max-length", "onUpdate:modelValue"])) : n.kind === "textarea" ? (d(), R(at, P({
|
|
2951
|
+
key: 2,
|
|
2952
|
+
ref_for: !0
|
|
2953
|
+
}, D(n), {
|
|
2954
|
+
"model-value": ge(n),
|
|
2955
|
+
rows: n.props?.rows,
|
|
2956
|
+
placeholder: n.props?.placeholder,
|
|
2957
|
+
"max-length": M(n),
|
|
2958
|
+
"onUpdate:modelValue": (f) => m(n.key, f)
|
|
2959
|
+
}), null, 16, ["model-value", "rows", "placeholder", "max-length", "onUpdate:modelValue"])) : n.kind === "rich_text" ? (d(), R(it, P({
|
|
2960
|
+
key: 3,
|
|
2961
|
+
ref_for: !0
|
|
2962
|
+
}, D(n), {
|
|
2963
|
+
"model-value": ge(n),
|
|
2964
|
+
images: e.resources,
|
|
2965
|
+
video: n.props?.video,
|
|
2966
|
+
"onUpdate:modelValue": (f) => m(n.key, f)
|
|
2967
|
+
}), null, 16, ["model-value", "images", "video", "onUpdate:modelValue"])) : n.kind === "number" ? (d(), R(kt, P({
|
|
2968
|
+
key: 4,
|
|
2969
|
+
ref_for: !0
|
|
2970
|
+
}, D(n), {
|
|
2971
|
+
"model-value": te(n),
|
|
2972
|
+
placeholder: n.props?.placeholder,
|
|
2973
|
+
"onUpdate:modelValue": (f) => m(n.key, f)
|
|
2974
|
+
}), null, 16, ["model-value", "placeholder", "onUpdate:modelValue"])) : n.kind === "boolean" ? (d(), R(ia, P({
|
|
2975
|
+
key: 5,
|
|
2976
|
+
ref_for: !0
|
|
2977
|
+
}, D(n), {
|
|
2978
|
+
"model-value": e.modelValue[n.key] === !0,
|
|
2979
|
+
"onUpdate:modelValue": (f) => m(n.key, f)
|
|
2980
|
+
}), null, 16, ["model-value", "onUpdate:modelValue"])) : n.kind === "select" ? (d(), R(sa, P({
|
|
2981
|
+
key: 6,
|
|
2982
|
+
ref_for: !0
|
|
2983
|
+
}, D(n), {
|
|
2984
|
+
options: n.options ?? [],
|
|
2985
|
+
"model-value": re(n),
|
|
2986
|
+
clearable: !n.required,
|
|
2987
|
+
placeholder: n.props?.placeholder,
|
|
2988
|
+
"onUpdate:modelValue": (f) => m(n.key, f)
|
|
2989
|
+
}), null, 16, ["options", "model-value", "clearable", "placeholder", "onUpdate:modelValue"])) : n.kind === "multi_select" ? (d(), R(Oo, P({
|
|
2990
|
+
key: 7,
|
|
2991
|
+
ref_for: !0
|
|
2992
|
+
}, D(n), {
|
|
2993
|
+
options: n.options ?? [],
|
|
2994
|
+
"model-value": pe(n),
|
|
2995
|
+
placeholder: n.props?.placeholder,
|
|
2996
|
+
"onUpdate:modelValue": (f) => m(n.key, f)
|
|
2997
|
+
}), null, 16, ["options", "model-value", "placeholder", "onUpdate:modelValue"])) : n.kind === "date" ? (d(), R(oa, P({
|
|
2998
|
+
key: 8,
|
|
2999
|
+
ref_for: !0
|
|
3000
|
+
}, D(n), {
|
|
3001
|
+
"model-value": se(n),
|
|
3002
|
+
"onUpdate:modelValue": (f) => m(n.key, f)
|
|
3003
|
+
}), null, 16, ["model-value", "onUpdate:modelValue"])) : n.kind === "datetime" ? (d(), R(Ya, P({
|
|
3004
|
+
key: 9,
|
|
3005
|
+
ref_for: !0
|
|
3006
|
+
}, D(n), {
|
|
3007
|
+
"model-value": se(n),
|
|
3008
|
+
"onUpdate:modelValue": (f) => m(n.key, f)
|
|
3009
|
+
}), null, 16, ["model-value", "onUpdate:modelValue"])) : n.kind === "image" || n.kind === "document" || n.kind === "gallery" ? (d(), g(ee, { key: 10 }, [
|
|
3010
|
+
e.resources ? (d(), R(Ll, P({
|
|
3011
|
+
key: 0,
|
|
3012
|
+
ref_for: !0
|
|
3013
|
+
}, D(n), {
|
|
3014
|
+
source: e.resources,
|
|
3015
|
+
multiple: n.kind === "gallery",
|
|
3016
|
+
accept: n.props?.accept ?? (n.kind === "image" ? "image/*" : void 0),
|
|
3017
|
+
"model-value": n.kind === "gallery" ? Q(n) : e.modelValue[n.key],
|
|
3018
|
+
"onUpdate:modelValue": (f) => m(n.key, f)
|
|
3019
|
+
}), null, 16, ["source", "multiple", "accept", "model-value", "onUpdate:modelValue"])) : z("", !0)
|
|
3020
|
+
], 64)) : n.kind === "collection" ? (d(), R(bl, P({
|
|
3021
|
+
key: 11,
|
|
3022
|
+
ref_for: !0
|
|
3023
|
+
}, D(n), {
|
|
3024
|
+
fields: n.children ?? [],
|
|
3025
|
+
"model-value": _e(n),
|
|
3026
|
+
locales: u.value,
|
|
3027
|
+
"default-locale": v.value,
|
|
3028
|
+
errors: h(n.key),
|
|
3029
|
+
resources: e.resources,
|
|
3030
|
+
"add-label": n.props?.addLabel,
|
|
3031
|
+
"locale-mode": e.localeMode,
|
|
3032
|
+
"onUpdate:modelValue": (f) => m(n.key, f)
|
|
3033
|
+
}), null, 16, ["fields", "model-value", "locales", "default-locale", "errors", "resources", "add-label", "locale-mode", "onUpdate:modelValue"])) : z("", !0)
|
|
3034
|
+
], 64))), 128))
|
|
3035
|
+
]));
|
|
3036
|
+
}
|
|
3037
|
+
});
|
|
3038
|
+
async function Il() {
|
|
3039
|
+
const [o, a, e, t, r, i] = await Promise.all([
|
|
3040
|
+
import("@codemirror/state"),
|
|
3041
|
+
import("@codemirror/view"),
|
|
3042
|
+
import("@codemirror/commands"),
|
|
3043
|
+
import("@codemirror/language"),
|
|
3044
|
+
import("@codemirror/lint"),
|
|
3045
|
+
import("@lezer/highlight")
|
|
3046
|
+
]);
|
|
3047
|
+
return { state: o, view: a, commands: e, language: t, lint: r, highlight: i };
|
|
3048
|
+
}
|
|
3049
|
+
async function ut(o) {
|
|
3050
|
+
switch (o) {
|
|
3051
|
+
case "liquid":
|
|
3052
|
+
return (await import("@codemirror/lang-liquid")).liquid();
|
|
3053
|
+
case "html":
|
|
3054
|
+
return (await import("@codemirror/lang-html")).html();
|
|
3055
|
+
case "css":
|
|
3056
|
+
return (await import("@codemirror/lang-css")).css();
|
|
3057
|
+
case "javascript":
|
|
3058
|
+
return (await import("@codemirror/lang-javascript")).javascript();
|
|
3059
|
+
}
|
|
3060
|
+
}
|
|
3061
|
+
const Pl = { class: "w-full" }, Hl = ["aria-expanded", "aria-controls"], Kl = ["id", "aria-describedby"], Gl = {
|
|
3062
|
+
key: 0,
|
|
3063
|
+
role: "alert",
|
|
3064
|
+
class: "p-3 text-sm text-critical"
|
|
3065
|
+
}, Wl = {
|
|
3066
|
+
key: 1,
|
|
3067
|
+
class: "mt-1 text-footnote text-content-muted"
|
|
3068
|
+
}, Yl = ["id", "aria-label"], Kr = /* @__PURE__ */ Z({
|
|
3069
|
+
__name: "CodeField",
|
|
3070
|
+
props: /* @__PURE__ */ ce({
|
|
3071
|
+
label: {},
|
|
3072
|
+
labelHidden: { type: Boolean },
|
|
3073
|
+
hint: {},
|
|
3074
|
+
error: {},
|
|
3075
|
+
required: { type: Boolean },
|
|
3076
|
+
editable: { type: Boolean },
|
|
3077
|
+
disabled: { type: Boolean },
|
|
3078
|
+
lockedReason: {},
|
|
3079
|
+
presentation: {},
|
|
3080
|
+
name: {},
|
|
3081
|
+
modelValue: {},
|
|
3082
|
+
language: {},
|
|
3083
|
+
readonly: { type: Boolean },
|
|
3084
|
+
lineNumbers: { type: Boolean },
|
|
3085
|
+
height: {},
|
|
3086
|
+
markers: {}
|
|
3087
|
+
}, { ...fe, modelValue: "", language: "html", readonly: !1, lineNumbers: !0, height: "24rem", markers: () => [] }),
|
|
3088
|
+
emits: ["update:modelValue", "save"],
|
|
3089
|
+
setup(o, { expose: a, emit: e }) {
|
|
3090
|
+
const t = o, r = e, { t: i } = le(), { editable: p } = Se(t), u = oe("host"), v = G(!1), x = G(!1), S = B(() => t.readonly || !p.value || t.disabled);
|
|
3091
|
+
let h = null, l = null, m = !1;
|
|
3092
|
+
const c = { language: void 0, locked: void 0, numbers: void 0 };
|
|
3093
|
+
function k() {
|
|
3094
|
+
return l ? [l.state.EditorState.readOnly.of(S.value), l.view.EditorView.editable.of(!S.value)] : [];
|
|
3095
|
+
}
|
|
3096
|
+
const b = () => l && t.lineNumbers ? [l.view.lineNumbers(), l.view.highlightActiveLineGutter()] : [];
|
|
3097
|
+
function y() {
|
|
3098
|
+
if (!h || !l) return;
|
|
3099
|
+
const w = h.state.doc, F = t.markers.map((q) => {
|
|
3100
|
+
const $ = w.line(Math.min(Math.max(q.line, 1), w.lines)), E = q.column ? Math.min($.from + q.column - 1, $.to) : $.from, H = q.column ? Math.max(h.state.wordAt(E)?.to ?? E + 1, Math.min(E + 1, $.to)) : $.to;
|
|
3101
|
+
return { from: E, to: Math.min(H, w.length), severity: q.severity, message: q.message };
|
|
3102
|
+
});
|
|
3103
|
+
h.dispatch(l.lint.setDiagnostics(h.state, F));
|
|
3104
|
+
}
|
|
3105
|
+
return Ie(async () => {
|
|
3106
|
+
try {
|
|
3107
|
+
l = await Il();
|
|
3108
|
+
const w = await ut(t.language);
|
|
3109
|
+
if (!u.value) return;
|
|
3110
|
+
const { EditorState: F, Compartment: q } = l.state, { EditorView: $, keymap: E } = l.view;
|
|
3111
|
+
c.language = new q(), c.locked = new q(), c.numbers = new q();
|
|
3112
|
+
let H = !1;
|
|
3113
|
+
const O = (D) => (J) => !H && D(J);
|
|
3114
|
+
h = new $({
|
|
3115
|
+
parent: u.value,
|
|
3116
|
+
state: F.create({
|
|
3117
|
+
doc: t.modelValue,
|
|
3118
|
+
extensions: [
|
|
3119
|
+
$.contentAttributes.of({ "aria-label": t.label ?? "", "aria-multiline": "true" }),
|
|
3120
|
+
$.domEventHandlers({
|
|
3121
|
+
keydown: (D) => (D.key === "Escape" ? H = !0 : D.key !== "Tab" && D.key !== "Shift" && (H = !1), !1),
|
|
3122
|
+
blur: () => (H = !1, !1)
|
|
3123
|
+
}),
|
|
3124
|
+
E.of([
|
|
3125
|
+
{ key: "Mod-s", preventDefault: !0, run: () => (r("save"), !0) },
|
|
3126
|
+
{ key: "Tab", run: O(l.commands.indentMore), shift: O(l.commands.indentLess) },
|
|
3127
|
+
...l.commands.defaultKeymap,
|
|
3128
|
+
...l.commands.historyKeymap
|
|
3129
|
+
]),
|
|
3130
|
+
l.commands.history(),
|
|
3131
|
+
l.language.indentOnInput(),
|
|
3132
|
+
l.language.bracketMatching(),
|
|
3133
|
+
l.language.syntaxHighlighting(l.highlight.classHighlighter),
|
|
3134
|
+
l.lint.lintGutter(),
|
|
3135
|
+
$.lineWrapping,
|
|
3136
|
+
$.theme({ "&": { height: "100%", backgroundColor: "transparent" }, "&.cm-focused": { outline: "none" }, ".cm-scroller": { fontFamily: "var(--font-mono, ui-monospace, monospace)", fontSize: "0.8125rem" } }),
|
|
3137
|
+
c.language.of(w),
|
|
3138
|
+
c.locked.of(k()),
|
|
3139
|
+
c.numbers.of(b()),
|
|
3140
|
+
$.updateListener.of((D) => {
|
|
3141
|
+
if (!D.docChanged || m) return;
|
|
3142
|
+
const J = D.state.doc.toString();
|
|
3143
|
+
J !== t.modelValue && r("update:modelValue", J);
|
|
3144
|
+
})
|
|
3145
|
+
]
|
|
3146
|
+
})
|
|
3147
|
+
}), y();
|
|
3148
|
+
} catch {
|
|
3149
|
+
v.value = !0;
|
|
3150
|
+
}
|
|
3151
|
+
}), Be(() => h?.destroy()), ne(() => t.modelValue, (w) => {
|
|
3152
|
+
!h || w === h.state.doc.toString() || (m = !0, h.dispatch({ changes: { from: 0, to: h.state.doc.length, insert: w } }), m = !1);
|
|
3153
|
+
}), ne(() => t.markers, y, { deep: !0 }), ne(S, () => h?.dispatch({ effects: c.locked?.reconfigure(k()) })), ne(() => t.lineNumbers, () => h?.dispatch({ effects: c.numbers?.reconfigure(b()) })), ne(() => t.language, async (w) => {
|
|
3154
|
+
const F = await ut(w);
|
|
3155
|
+
h?.dispatch({ effects: c.language?.reconfigure(F) });
|
|
3156
|
+
}), a({ focus: () => h?.focus() }), (w, F) => (d(), R(be, P({ ...s(me)(t), editable: !0, required: t.required && s(p) }, {
|
|
3157
|
+
"row-layout": "stacked",
|
|
3158
|
+
value: null
|
|
3159
|
+
}), ue({
|
|
3160
|
+
default: _(({ id: q, describedby: $ }) => [
|
|
3161
|
+
V("div", Pl, [
|
|
3162
|
+
w.$slots.preview ? (d(), g("button", {
|
|
3163
|
+
key: 0,
|
|
3164
|
+
type: "button",
|
|
3165
|
+
class: "mb-2 rounded-md border border-border px-2 py-1 text-sm lg:hidden",
|
|
3166
|
+
"aria-expanded": x.value,
|
|
3167
|
+
"aria-controls": `${q}-preview`,
|
|
3168
|
+
onClick: F[0] || (F[0] = (E) => x.value = !x.value)
|
|
3169
|
+
}, L(x.value ? s(i)("core.form.code.hide_preview") : s(i)("core.form.code.show_preview")), 9, Hl)) : z("", !0),
|
|
3170
|
+
V("div", {
|
|
3171
|
+
class: W(["grid w-full gap-3", { "lg:grid-cols-2": w.$slots.preview }])
|
|
3172
|
+
}, [
|
|
3173
|
+
V("div", null, [
|
|
3174
|
+
V("div", {
|
|
3175
|
+
ref_key: "host",
|
|
3176
|
+
ref: u,
|
|
3177
|
+
id: q,
|
|
3178
|
+
"aria-describedby": $,
|
|
3179
|
+
"data-code-field": "",
|
|
3180
|
+
class: W(["resize-y overflow-hidden rounded-md border border-border bg-surface text-content-strong focus-within:border-border-focus [&_.cm-gutters]:border-r [&_.cm-gutters]:border-border [&_.cm-gutters]:bg-transparent [&_.cm-gutters]:text-content-muted [&_.tok-keyword]:text-content-link [&_.tok-tagName]:text-content-link [&_.tok-string]:text-emerald-700 dark:[&_.tok-string]:text-emerald-400 [&_.tok-comment]:italic [&_.tok-comment]:text-content-muted [&_.tok-number]:text-amber-700 dark:[&_.tok-number]:text-amber-400 [&_.tok-bool]:text-amber-700 dark:[&_.tok-bool]:text-amber-400 [&_.tok-attributeName]:text-violet-700 dark:[&_.tok-attributeName]:text-violet-400 [&_.tok-propertyName]:text-violet-700 dark:[&_.tok-propertyName]:text-violet-400 [&_.tok-meta]:text-content-muted [&_.cm-lintRange-error]:underline [&_.cm-lintRange-error]:decoration-wavy [&_.cm-lintRange-error]:decoration-red-600 [&_.cm-lintRange-warning]:underline [&_.cm-lintRange-warning]:decoration-wavy [&_.cm-lintRange-warning]:decoration-amber-500", { hidden: v.value }]),
|
|
3181
|
+
style: Ne({ height: t.height })
|
|
3182
|
+
}, null, 14, Kl),
|
|
3183
|
+
v.value ? (d(), g("p", Gl, L(s(i)("core.form.code.failed")), 1)) : z("", !0),
|
|
3184
|
+
S.value ? z("", !0) : (d(), g("p", Wl, L(s(i)("core.form.code.tab_hint")), 1))
|
|
3185
|
+
]),
|
|
3186
|
+
w.$slots.preview ? (d(), g("div", {
|
|
3187
|
+
key: 0,
|
|
3188
|
+
id: `${q}-preview`,
|
|
3189
|
+
"aria-label": s(i)("core.form.code.preview"),
|
|
3190
|
+
role: "region",
|
|
3191
|
+
class: W(["min-h-48 overflow-hidden rounded-md border border-border", x.value ? "block" : "hidden lg:block"]),
|
|
3192
|
+
style: Ne({ height: t.height })
|
|
3193
|
+
}, [
|
|
3194
|
+
j(w.$slots, "preview")
|
|
3195
|
+
], 14, Yl)) : z("", !0)
|
|
3196
|
+
], 2)
|
|
3197
|
+
])
|
|
3198
|
+
]),
|
|
3199
|
+
_: 2
|
|
3200
|
+
}, [
|
|
3201
|
+
w.$slots.trailing ? {
|
|
3202
|
+
name: "trailing",
|
|
3203
|
+
fn: _(() => [
|
|
3204
|
+
j(w.$slots, "trailing")
|
|
3205
|
+
]),
|
|
3206
|
+
key: "0"
|
|
3207
|
+
} : void 0,
|
|
3208
|
+
w.$slots.labelTrailing ? {
|
|
3209
|
+
name: "labelTrailing",
|
|
3210
|
+
fn: _(() => [
|
|
3211
|
+
j(w.$slots, "labelTrailing")
|
|
3212
|
+
]),
|
|
3213
|
+
key: "1"
|
|
3214
|
+
} : void 0
|
|
3215
|
+
]), 1040));
|
|
3216
|
+
}
|
|
3217
|
+
}), Ve = (o) => {
|
|
3218
|
+
const [a] = o.args ?? [];
|
|
3219
|
+
if (typeof a != "number" || !Number.isFinite(a)) throw new Error(`buildValidator: the "${o.rule}" rule needs a number argument.`);
|
|
3220
|
+
return a;
|
|
3221
|
+
}, dt = (o) => typeof o == "string" || typeof o == "number";
|
|
3222
|
+
function Gr(o, a) {
|
|
3223
|
+
const e = a.zod, { messages: t = {} } = a, r = e.any().refine(() => !1, { params: { code: "required" }, ...t.required !== void 0 ? { error: t.required } : {} }), i = (m) => m !== void 0 ? { error: m } : {};
|
|
3224
|
+
function p(m) {
|
|
3225
|
+
const c = m.validation ?? [], k = (q) => c.find(($) => $.rule === q), b = k("min"), y = k("max"), w = () => {
|
|
3226
|
+
let q = e.string(i(t.type));
|
|
3227
|
+
b && (q = q.min(Ve(b))), y && (q = q.max(Ve(y)));
|
|
3228
|
+
const $ = [q];
|
|
3229
|
+
k("email") && $.push(e.email(i(t.email))), k("url") && $.push(e.url(i(t.url)));
|
|
3230
|
+
const E = k("regex")?.args?.[0];
|
|
3231
|
+
if (typeof E == "string") $.push(e.string().regex(new RegExp(E), i(t.regex)));
|
|
3232
|
+
else if (k("regex")) throw new Error(`buildValidator: the "regex" rule of "${m.key}" needs a pattern string.`);
|
|
3233
|
+
return $;
|
|
3234
|
+
}, F = (q) => {
|
|
3235
|
+
let $ = e.array(q);
|
|
3236
|
+
return b && ($ = $.min(Ve(b))), y && ($ = $.max(Ve(y))), $;
|
|
3237
|
+
};
|
|
3238
|
+
switch (m.kind) {
|
|
3239
|
+
case "text":
|
|
3240
|
+
case "textarea":
|
|
3241
|
+
case "rich_text":
|
|
3242
|
+
return m.translatable ? [e.record(e.string(), e.unknown()).superRefine((q, $) => {
|
|
3243
|
+
for (const [E, H] of Object.entries(q))
|
|
3244
|
+
if (!$e(H))
|
|
3245
|
+
for (const O of w()) for (const D of O.safeParse(H).error?.issues ?? []) $.addIssue({ ...D, path: [E, ...D.path] });
|
|
3246
|
+
})] : w();
|
|
3247
|
+
case "number": {
|
|
3248
|
+
let q = e.number(i(t.type));
|
|
3249
|
+
return b && (q = q.min(Ve(b))), y && (q = q.max(Ve(y))), [q];
|
|
3250
|
+
}
|
|
3251
|
+
case "boolean":
|
|
3252
|
+
return [e.boolean(i(t.type))];
|
|
3253
|
+
case "select": {
|
|
3254
|
+
const q = (m.options ?? []).map(($) => $.value);
|
|
3255
|
+
return [e.union([e.string(), e.number()], i(t.type)).refine(($) => q.includes($), { params: { code: "invalid_choice" } })];
|
|
3256
|
+
}
|
|
3257
|
+
case "multi_select": {
|
|
3258
|
+
const q = (m.options ?? []).map(($) => $.value);
|
|
3259
|
+
return [F(e.union([e.string(), e.number()])), e.array(e.unknown()).refine(($) => $.every((E) => q.includes(E)), { params: { code: "invalid_choice" } })];
|
|
3260
|
+
}
|
|
3261
|
+
case "date":
|
|
3262
|
+
return [e.string(i(t.type)).refine((q) => Ma(q) !== null, { params: { code: "date" } })];
|
|
3263
|
+
case "datetime":
|
|
3264
|
+
return [e.string(i(t.type)).refine((q) => Vt(q) !== null, { params: { code: "datetime" } })];
|
|
3265
|
+
case "image":
|
|
3266
|
+
case "document":
|
|
3267
|
+
return [e.custom(dt, i(t.type))];
|
|
3268
|
+
case "gallery":
|
|
3269
|
+
return [F(e.custom(dt))];
|
|
3270
|
+
case "collection":
|
|
3271
|
+
return [F(e.record(e.string(), e.unknown()))];
|
|
3272
|
+
}
|
|
3273
|
+
}
|
|
3274
|
+
const u = /* @__PURE__ */ new Map(), v = (m) => {
|
|
3275
|
+
for (const c of m)
|
|
3276
|
+
u.set(c, p(c)), c.children && v(c.children);
|
|
3277
|
+
};
|
|
3278
|
+
v(o.fields);
|
|
3279
|
+
const x = (m, c) => m.kind === "boolean" ? c == null : $e(c), S = (m) => m.required === !0 || m.validation?.some((c) => c.rule === "required") === !0, h = (m, c) => {
|
|
3280
|
+
if (!m.translatable || typeof c != "object" || c === null) return x(m, c);
|
|
3281
|
+
const k = c;
|
|
3282
|
+
return a.defaultLocale !== void 0 ? $e(k[a.defaultLocale]) : $e(k);
|
|
3283
|
+
};
|
|
3284
|
+
function l(m, c, k, b) {
|
|
3285
|
+
const y = {};
|
|
3286
|
+
for (const w of m) {
|
|
3287
|
+
if (!qt(w.visible_when, c)) continue;
|
|
3288
|
+
const F = c[w.key], q = [...k, w.key];
|
|
3289
|
+
if (y[w.key] = F, w.kind === "text" || w.kind === "textarea" || w.kind === "rich_text" ? h(w, F) : x(w, F)) {
|
|
3290
|
+
if (S(w)) for (const E of r.safeParse(F).error?.issues ?? []) b.push({ path: q, message: E.message });
|
|
3291
|
+
continue;
|
|
3292
|
+
}
|
|
3293
|
+
for (const E of u.get(w) ?? [])
|
|
3294
|
+
for (const H of E.safeParse(F).error?.issues ?? [])
|
|
3295
|
+
b.push({ path: [...q, ...H.path], message: H.message });
|
|
3296
|
+
w.kind === "collection" && w.children && Array.isArray(F) && F.every((E) => typeof E == "object" && E !== null) && (y[w.key] = F.map((E, H) => l(w.children, E, [...q, H], b)));
|
|
3297
|
+
}
|
|
3298
|
+
return y;
|
|
3299
|
+
}
|
|
3300
|
+
return {
|
|
3301
|
+
safeParse(m) {
|
|
3302
|
+
const c = typeof m == "object" && m !== null ? m : {}, k = [], b = l(o.fields, c, [], k);
|
|
3303
|
+
return k.length > 0 ? { success: !1, error: { issues: k } } : { success: !0, data: b };
|
|
3304
|
+
}
|
|
3305
|
+
};
|
|
3306
|
+
}
|
|
2325
3307
|
export {
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
3308
|
+
Yt as Calendar,
|
|
3309
|
+
Br as CardSelectField,
|
|
3310
|
+
Lr as CheckboxField,
|
|
3311
|
+
Tr as ChoiceChips,
|
|
3312
|
+
Kr as CodeField,
|
|
3313
|
+
Dr as ComboField,
|
|
3314
|
+
ln as CommandDialog,
|
|
3315
|
+
oa as DateField,
|
|
3316
|
+
Ya as DateTimeField,
|
|
3317
|
+
Al as DynamicForm,
|
|
3318
|
+
Ar as EditorPage,
|
|
3319
|
+
Tt as ErrorBag,
|
|
3320
|
+
be as Field,
|
|
3321
|
+
Mr as FileField,
|
|
3322
|
+
ct as FormErrors,
|
|
3323
|
+
Ft as FormGroup,
|
|
3324
|
+
Rr as FormGroupButton,
|
|
3325
|
+
Or as FormIndent,
|
|
3326
|
+
Ot as FormRow,
|
|
3327
|
+
qn as FormView,
|
|
3328
|
+
Jr as GroupEditAction,
|
|
3329
|
+
Tn as GroupSheet,
|
|
3330
|
+
$o as I18nField,
|
|
3331
|
+
vn as LeaveGuardRoot,
|
|
3332
|
+
un as MissingLeaveGuardRootError,
|
|
3333
|
+
Er as MoneyField,
|
|
3334
|
+
Nr as MonthYearField,
|
|
3335
|
+
Oo as MultiSelectField,
|
|
3336
|
+
Ir as NumberCell,
|
|
3337
|
+
kt as NumberField,
|
|
3338
|
+
et as OptionList,
|
|
3339
|
+
Dn as OtpInput,
|
|
3340
|
+
Ur as PhotoField,
|
|
3341
|
+
zn as RecordGroupScope,
|
|
3342
|
+
bl as RepeatField,
|
|
3343
|
+
Ll as ResourceField,
|
|
3344
|
+
it as RichTextField,
|
|
3345
|
+
On as SegmentedField,
|
|
3346
|
+
sa as SelectField,
|
|
3347
|
+
Hr as StepForm,
|
|
3348
|
+
el as StepNavigation,
|
|
3349
|
+
sl as StepProgress,
|
|
3350
|
+
ia as SwitchField,
|
|
3351
|
+
Xe as TextField,
|
|
3352
|
+
at as TextareaField,
|
|
3353
|
+
Cn as TimeField,
|
|
3354
|
+
Gr as buildValidator,
|
|
3355
|
+
Ct as checkFile,
|
|
3356
|
+
Zr as createFieldGroups,
|
|
3357
|
+
dn as createLeaveGuard,
|
|
3358
|
+
Vt as dateTimeValue,
|
|
3359
|
+
Ma as dateValue,
|
|
3360
|
+
qt as evaluateVisibility,
|
|
3361
|
+
fe as fieldDefaults,
|
|
3362
|
+
rn as fieldKey,
|
|
3363
|
+
me as fieldProps,
|
|
3364
|
+
Oe as focusFirstError,
|
|
3365
|
+
xn as formEditableKey,
|
|
3366
|
+
Te as formatBytes,
|
|
3367
|
+
hn as groupOptions,
|
|
3368
|
+
So as hasUnsupportedCharacters,
|
|
3369
|
+
cn as installLeaveGuard,
|
|
3370
|
+
$e as isEmptyValue,
|
|
3371
|
+
mn as leaveGuardKey,
|
|
3372
|
+
kn as matchOptions,
|
|
3373
|
+
so as missingLocales,
|
|
3374
|
+
zr as now,
|
|
3375
|
+
Ra as parseDateValue,
|
|
3376
|
+
Xr as provideRecordGroups,
|
|
3377
|
+
$n as recentChoicesKey,
|
|
3378
|
+
Qr as recordGroupsKey,
|
|
3379
|
+
jr as refineStorableText,
|
|
3380
|
+
Ge as thumbnailUrl,
|
|
3381
|
+
Le as today,
|
|
3382
|
+
Vo as unsupportedCharactersCode,
|
|
3383
|
+
nn as useCommand,
|
|
3384
|
+
ba as useDirtySnapshot,
|
|
3385
|
+
Se as useFieldMode,
|
|
3386
|
+
en as useForm,
|
|
3387
|
+
Mn as useGroupSheet,
|
|
3388
|
+
tn as useHiddenFieldErrors,
|
|
3389
|
+
vt as useLeaveGuard,
|
|
3390
|
+
fn as useLeaveGuardContext,
|
|
3391
|
+
Bn as useOptions,
|
|
3392
|
+
En as useRecordDialog,
|
|
3393
|
+
an as useRecordGroups,
|
|
3394
|
+
yn as useResourceForm,
|
|
3395
|
+
fa as useSaveChrome,
|
|
3396
|
+
Ko as useSectionStates,
|
|
3397
|
+
qr as useSheetDiscardGuard,
|
|
3398
|
+
Pr as useStepForm,
|
|
3399
|
+
Fr as zodErrorMap
|
|
2409
3400
|
};
|