@wssto2/vue-core 0.4.19 → 0.4.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Activity-CLyG5Y9o.js → Activity-DX-RK9xj.js} +3 -3
- package/dist/{Changes-xF1VMbqD.js → Changes-_nARQ9IC.js} +2 -2
- package/dist/{CollectionPage.vue_vue_type_script_setup_true_lang-nojILoAf.js → CollectionPage.vue_vue_type_script_setup_true_lang-BNM_cbXa.js} +2 -2
- package/dist/DateField.vue_vue_type_script_setup_true_lang-CpuH0WTl.js +281 -0
- package/dist/{DeadLetters-AbbNs69D.js → DeadLetters-O6QReswO.js} +2 -2
- package/dist/{FormGroup.vue_vue_type_script_setup_true_lang-C7nq7MJB.js → FormGroup.vue_vue_type_script_setup_true_lang-DSwSRsA5.js} +2 -1
- package/dist/{General-De4Q6Wfn.js → General-CkZoXu29.js} +4 -4
- package/dist/{NewRolePage-QAv_XsT0.js → NewRolePage-OosTaMfZ.js} +2 -2
- package/dist/NumberField.vue_vue_type_script_setup_true_lang-DaE5BLm4.js +161 -0
- package/dist/{ProfilePage-CjjKhkHX.js → ProfilePage-Dn8fQ3ff.js} +3 -3
- package/dist/{RoleEditor.vue_vue_type_script_setup_true_lang-FLJk6Kb2.js → RoleEditor.vue_vue_type_script_setup_true_lang-2IOio1Sa.js} +4 -4
- package/dist/{RolePage-De7s2sYr.js → RolePage-33RUvHYD.js} +5 -5
- package/dist/{RolesPage-TXQKtK_J.js → RolesPage-BGPoUCMP.js} +3 -3
- package/dist/SelectField.vue_vue_type_script_setup_true_lang-C3FbRQW7.js +515 -0
- package/dist/{SessionList.vue_vue_type_script_setup_true_lang-CuxVe7rm.js → SessionList.vue_vue_type_script_setup_true_lang-D5qm77Zo.js} +1 -1
- package/dist/{Sessions-BDLI0o-z.js → Sessions-BbAdbjmG.js} +2 -2
- package/dist/{SettingsPage-Kzcqv91E.js → SettingsPage-D47NSOYW.js} +3 -3
- package/dist/{SignIn-DKo46hNK.js → SignIn-DDCRzlUq.js} +2 -2
- package/dist/{SignInPage-B2v3is80.js → SignInPage-D9jryXA7.js} +2 -2
- package/dist/{SignIns-D-_a_S6O.js → SignIns-C_5sRrB4.js} +1 -1
- package/dist/{TextField.vue_vue_type_script_setup_true_lang-BslHroDP.js → TextField.vue_vue_type_script_setup_true_lang-CP2WeU36.js} +114 -111
- package/dist/TextareaField.vue_vue_type_script_setup_true_lang-BJ4__cvJ.js +93 -0
- package/dist/TimeField.vue_vue_type_script_setup_true_lang-DBxKAWRo.js +190 -0
- package/dist/{UserRecord-BR70ai9q.js → UserRecord-CUhbz62x.js} +5 -5
- package/dist/{UsersList-BC9S6omH.js → UsersList-BE8fnICz.js} +7 -7
- package/dist/access/index.js +1 -1
- package/dist/collection/index.js +1 -1
- package/dist/form/ComboField.vue.d.ts +7 -3
- package/dist/form/CommandDialog.vue.d.ts +4 -1
- package/dist/form/DateField.vue.d.ts +4 -0
- package/dist/form/DateTimeField.vue.d.ts +4 -0
- package/dist/form/MoneyField.vue.d.ts +10 -5
- package/dist/form/NumberField.vue.d.ts +13 -5
- package/dist/form/SelectField.vue.d.ts +3 -1
- package/dist/form/TextField.vue.d.ts +4 -0
- package/dist/form/TextareaField.vue.d.ts +4 -0
- package/dist/form/TimeField.vue.d.ts +4 -0
- package/dist/form/index.d.ts +1 -1
- package/dist/form/index.js +1215 -1182
- package/dist/form/options.d.ts +4 -0
- package/dist/form/useCommand.d.ts +18 -0
- package/dist/identity/index.js +1 -1
- package/dist/{index-BrqxylSS.js → index-C3HWRCEe.js} +6 -6
- package/dist/{index-B9KqrN-F.js → index-D-0JNiFF.js} +2 -2
- package/dist/{index-D8akxuKo.js → index-DiEoRV9D.js} +11 -11
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/notifications/index.js +1 -1
- package/dist/{status-vMwum3Y9.js → status-UWWFHi9t.js} +1 -1
- package/dist/styles.css +1 -1
- package/dist/useCommand-VIZE7xG-.js +168 -0
- package/package.json +1 -1
- package/dist/DateField.vue_vue_type_script_setup_true_lang-CfPwcEM2.js +0 -278
- package/dist/NumberField.vue_vue_type_script_setup_true_lang-djJvP6Og.js +0 -150
- package/dist/SelectField.vue_vue_type_script_setup_true_lang-ByDo_32P.js +0 -493
- package/dist/TextareaField.vue_vue_type_script_setup_true_lang-XZRHwx-n.js +0 -91
- package/dist/TimeField.vue_vue_type_script_setup_true_lang-BB7ZGpvP.js +0 -187
- package/dist/useCommand-YN9EMb7s.js +0 -138
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { nextTick as f, defineComponent as C, useTemplateRef as v, ref as b, watch as L, onBeforeUnmount as N, computed as q, openBlock as p, createElementBlock as D, Fragment as z, createVNode as S, unref as y, createSlots as F, withCtx as $, createElementVNode as V, toDisplayString as A, createCommentVNode as h, renderSlot as x, createBlock as O } from "vue";
|
|
2
|
+
import { useI18n as I } from "vue-i18n";
|
|
3
|
+
import { f as R } from "./useDialog-CXR3hN0G.js";
|
|
4
|
+
import { _ as U } from "./Modal.vue_vue_type_script_setup_true_lang-DpBb8ans.js";
|
|
5
|
+
import { _ as G } from "./AlertDialog.vue_vue_type_script_setup_true_lang-whA4WLdl.js";
|
|
6
|
+
import { D as K } from "./useWaitStatus-fsacMl4W.js";
|
|
7
|
+
import { _ as M, u as P } from "./FormErrors.vue_vue_type_script_setup_true_lang-DWcVKZM3.js";
|
|
8
|
+
import { a as W } from "./leaveGuard-Cc8yeLxM.js";
|
|
9
|
+
const c = "input:not([type=hidden]):not([disabled]), textarea:not([disabled]), select:not([disabled]), button:not([disabled]), [tabindex]:not([tabindex='-1'])";
|
|
10
|
+
async function Y(t = document, r) {
|
|
11
|
+
const e = [...t.querySelectorAll("[data-field-error]")], n = e.find((o) => o.matches(c) || o.querySelector(c)) ?? e[0];
|
|
12
|
+
if (!n) return !1;
|
|
13
|
+
const i = r?.sections.value.find((o) => o.element.contains(n));
|
|
14
|
+
i && (await r?.scrollTo(i.id, { updateUrl: !1 }), await f());
|
|
15
|
+
const l = n.matches(c) ? n : n.querySelector(c);
|
|
16
|
+
return (l ?? n).scrollIntoView?.({ block: "center" }), (l ?? n).focus({ preventScroll: !0 }), !0;
|
|
17
|
+
}
|
|
18
|
+
const se = (t) => ({ "data-field-key": t }), j = {
|
|
19
|
+
key: 0,
|
|
20
|
+
class: "text-body text-content-muted"
|
|
21
|
+
}, ne = /* @__PURE__ */ C({
|
|
22
|
+
__name: "CommandDialog",
|
|
23
|
+
props: {
|
|
24
|
+
command: {},
|
|
25
|
+
title: {},
|
|
26
|
+
subtitle: { default: void 0 },
|
|
27
|
+
confirmLabel: {},
|
|
28
|
+
confirmDisabled: { type: Boolean, default: !1 },
|
|
29
|
+
doneLabel: { default: void 0 },
|
|
30
|
+
busyLabel: { default: void 0 },
|
|
31
|
+
message: { default: void 0 },
|
|
32
|
+
size: { default: "sm" },
|
|
33
|
+
fieldLabel: { type: Function, default: void 0 }
|
|
34
|
+
},
|
|
35
|
+
emits: ["done"],
|
|
36
|
+
setup(t, { emit: r }) {
|
|
37
|
+
const e = t, n = r, { t: i } = I(), l = v("modal"), o = v("body"), a = b(!1);
|
|
38
|
+
let u = null;
|
|
39
|
+
const { confirmDiscard: E } = W(() => e.command.open.value && e.command.form.dirty.value);
|
|
40
|
+
L(() => e.command.open.value, (s) => {
|
|
41
|
+
s ? (a.value = !1, l.value?.present()) : l.value?.dismiss();
|
|
42
|
+
});
|
|
43
|
+
async function w(s = {}) {
|
|
44
|
+
e.confirmDisabled || await g(await e.command.run(), s);
|
|
45
|
+
}
|
|
46
|
+
async function g(s, d = {}) {
|
|
47
|
+
if (s.status === "failed") {
|
|
48
|
+
s.failure.kind === "invalid" && await f().then(() => Y(o.value ?? document));
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (s.status !== "aborted") {
|
|
52
|
+
if (n("done"), d.addAnother) {
|
|
53
|
+
e.command.present(), await f(), R(o.value)[0]?.focus();
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
a.value = !0, u = setTimeout(() => e.command.dismiss(), K);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const k = v("ask"), m = b(null);
|
|
60
|
+
L(() => e.command.question?.value, (s) => {
|
|
61
|
+
s && (m.value = s, f(() => k.value?.present()));
|
|
62
|
+
});
|
|
63
|
+
const T = async () => {
|
|
64
|
+
e.command.answer && await g(await e.command.answer(!0));
|
|
65
|
+
};
|
|
66
|
+
N(() => {
|
|
67
|
+
u && clearTimeout(u);
|
|
68
|
+
});
|
|
69
|
+
const B = q(() => e.command.form.submitting.value ? "processing" : a.value ? "done" : "idle");
|
|
70
|
+
return (s, d) => (p(), D(z, null, [
|
|
71
|
+
S(U, {
|
|
72
|
+
ref_key: "modal",
|
|
73
|
+
ref: l,
|
|
74
|
+
size: e.size,
|
|
75
|
+
grouped: "",
|
|
76
|
+
title: e.title,
|
|
77
|
+
subtitle: e.subtitle,
|
|
78
|
+
"before-dismiss": y(E),
|
|
79
|
+
"primary-label": e.confirmLabel,
|
|
80
|
+
"primary-disabled": e.confirmDisabled,
|
|
81
|
+
status: B.value,
|
|
82
|
+
"processing-label": e.busyLabel ?? y(i)("core.actions.saving"),
|
|
83
|
+
"done-label": e.doneLabel ?? y(i)("core.actions.saved"),
|
|
84
|
+
onPrimary: d[0] || (d[0] = (_) => w()),
|
|
85
|
+
onDismissed: d[1] || (d[1] = (_) => e.command.dismiss())
|
|
86
|
+
}, F({
|
|
87
|
+
default: $(() => [
|
|
88
|
+
V("div", {
|
|
89
|
+
ref_key: "body",
|
|
90
|
+
ref: o,
|
|
91
|
+
class: "flex min-w-0 flex-col gap-group-gap",
|
|
92
|
+
"data-test": "command-dialog"
|
|
93
|
+
}, [
|
|
94
|
+
e.message ? (p(), D("p", j, A(e.message), 1)) : h("", !0),
|
|
95
|
+
S(M, {
|
|
96
|
+
form: e.command.form,
|
|
97
|
+
label: e.fieldLabel,
|
|
98
|
+
scope: o.value
|
|
99
|
+
}, null, 8, ["form", "label", "scope"]),
|
|
100
|
+
x(s.$slots, "default")
|
|
101
|
+
], 512)
|
|
102
|
+
]),
|
|
103
|
+
_: 2
|
|
104
|
+
}, [
|
|
105
|
+
s.$slots.actions ? {
|
|
106
|
+
name: "actions",
|
|
107
|
+
fn: $(() => [
|
|
108
|
+
x(s.$slots, "actions", {
|
|
109
|
+
run: w,
|
|
110
|
+
busy: e.command.form.submitting.value
|
|
111
|
+
})
|
|
112
|
+
]),
|
|
113
|
+
key: "0"
|
|
114
|
+
} : void 0
|
|
115
|
+
]), 1032, ["size", "title", "subtitle", "before-dismiss", "primary-label", "primary-disabled", "status", "processing-label", "done-label"]),
|
|
116
|
+
m.value ? (p(), O(G, {
|
|
117
|
+
key: 0,
|
|
118
|
+
ref_key: "ask",
|
|
119
|
+
ref: k,
|
|
120
|
+
title: m.value.title,
|
|
121
|
+
message: m.value.message,
|
|
122
|
+
"confirm-label": m.value.confirmLabel,
|
|
123
|
+
tone: m.value.tone,
|
|
124
|
+
action: T,
|
|
125
|
+
onDismissed: d[2] || (d[2] = (_) => void e.command.answer?.(!1))
|
|
126
|
+
}, null, 8, ["title", "message", "confirm-label", "tone"])) : h("", !0)
|
|
127
|
+
], 64));
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
function oe(t) {
|
|
131
|
+
const r = P(t), e = b(!1), n = () => typeof t.defaults == "function" ? t.defaults() : t.defaults, i = b(null);
|
|
132
|
+
async function l() {
|
|
133
|
+
return await r.submit(t.run, {
|
|
134
|
+
// The page updating itself after the call is the refresh: its failure is "saved, but could not be read back".
|
|
135
|
+
refresh: t.done ? (u) => t.done?.(u) : void 0
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
async function o() {
|
|
139
|
+
const a = t.ask ? r.validate() : null, u = a === null ? null : t.ask?.(a) ?? null;
|
|
140
|
+
return u ? (i.value = u, { status: "aborted" }) : l();
|
|
141
|
+
}
|
|
142
|
+
return {
|
|
143
|
+
form: r,
|
|
144
|
+
open: e,
|
|
145
|
+
present(a) {
|
|
146
|
+
r.hydrate({ ...n(), ...a }), e.value = !0;
|
|
147
|
+
},
|
|
148
|
+
dismiss() {
|
|
149
|
+
e.value = !1;
|
|
150
|
+
},
|
|
151
|
+
run: o,
|
|
152
|
+
question: i,
|
|
153
|
+
async answer(a) {
|
|
154
|
+
return i.value = null, a ? l() : { status: "aborted" };
|
|
155
|
+
},
|
|
156
|
+
async confirm() {
|
|
157
|
+
const a = await l();
|
|
158
|
+
if (a.status === "failed") throw new Error(a.failure.message);
|
|
159
|
+
if (a.status === "aborted") throw new Error("aborted");
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
export {
|
|
164
|
+
ne as _,
|
|
165
|
+
se as a,
|
|
166
|
+
Y as f,
|
|
167
|
+
oe as u
|
|
168
|
+
};
|
package/package.json
CHANGED
|
@@ -1,278 +0,0 @@
|
|
|
1
|
-
import { computed as f, defineComponent as Z, useModel as ee, useTemplateRef as N, openBlock as k, createBlock as I, mergeProps as V, unref as s, createSlots as te, withCtx as v, createElementBlock as T, Fragment as Q, createVNode as $, createTextVNode as re, toDisplayString as Y, createCommentVNode as B, createElementVNode as C, normalizeClass as oe, renderSlot as E, mergeModels as ae, mergeDefaults as ne, nextTick as H } from "vue";
|
|
2
|
-
import { useI18n as j } from "vue-i18n";
|
|
3
|
-
import { _ as le } from "./DateButton.vue_vue_type_script_setup_true_lang-CovKG5lN.js";
|
|
4
|
-
import { u as K } from "./format-D8X4zsx6.js";
|
|
5
|
-
import { _ as se } from "./Icon.vue_vue_type_script_lang-D7oC-d-S.js";
|
|
6
|
-
import { u as ie } from "./mediaQuery-CygcXmFW.js";
|
|
7
|
-
import { _ as de } from "./Popover.vue_vue_type_script_setup_true_lang-C70GrCP7.js";
|
|
8
|
-
import { c as ue, _ as ce, f as me, b as fe } from "./control-B4SdblL6.js";
|
|
9
|
-
import { e as O, f as M, m as G, g as J, h as pe, j as be, u as ve, k as ye, _ as ke, l as ge, c as he } from "./useTypedEntry-C7k7Dyl-.js";
|
|
10
|
-
const xe = ["d", "m", "y"];
|
|
11
|
-
function _e(o) {
|
|
12
|
-
const r = o("2033-11-22"), e = { y: r.indexOf("2033") >= 0 ? r.indexOf("2033") : r.indexOf("33"), m: r.indexOf("11"), d: r.indexOf("22") };
|
|
13
|
-
return e.y < 0 || e.m < 0 || e.d < 0 ? xe : ["d", "m", "y"].sort((t, a) => e[t] - e[a]);
|
|
14
|
-
}
|
|
15
|
-
const we = (o) => o.trim().toLowerCase().replace(/\.+$/, "");
|
|
16
|
-
function $e(o, r) {
|
|
17
|
-
if (o.length === 4) return Number(o);
|
|
18
|
-
if (o.length > 2) return null;
|
|
19
|
-
const e = 2e3 + Number(o);
|
|
20
|
-
return e > Number(r.slice(0, 4)) + 30 ? e - 100 : e;
|
|
21
|
-
}
|
|
22
|
-
function g(o, r) {
|
|
23
|
-
const e = o.y === void 0 ? Number(r.slice(0, 4)) : $e(o.y, r), t = o.m === void 0 ? Number(r.slice(5, 7)) : Number(o.m);
|
|
24
|
-
return e === null || o.d === void 0 ? null : G(e, t, Number(o.d));
|
|
25
|
-
}
|
|
26
|
-
function De(o, r) {
|
|
27
|
-
const e = r.today ?? O(), t = we(o);
|
|
28
|
-
if (t === "") return null;
|
|
29
|
-
const { words: a } = r;
|
|
30
|
-
if (a.today.includes(t)) return e;
|
|
31
|
-
if (a.tomorrow.includes(t)) return M(e, 1);
|
|
32
|
-
if (a.yesterday.includes(t)) return M(e, -1);
|
|
33
|
-
const u = /^([+-])\s*(\d{1,4})$/.exec(t);
|
|
34
|
-
if (u) return M(e, Number(u[2]) * (u[1] === "-" ? -1 : 1));
|
|
35
|
-
const d = /^(\d{4})-(\d{1,2})-(\d{1,2})$/.exec(t);
|
|
36
|
-
if (d) return G(Number(d[1]), Number(d[2]), Number(d[3]));
|
|
37
|
-
if (!/^[\d\s./-]+$/.test(t)) return null;
|
|
38
|
-
const n = r.order, p = n.filter((y) => y !== "y");
|
|
39
|
-
if (/^\d+$/.test(t)) {
|
|
40
|
-
if (t.length <= 2) return g({ d: t }, e);
|
|
41
|
-
if (t.length === 4) return g(S(p, [t.slice(0, 2), t.slice(2)]), e);
|
|
42
|
-
if (t.length === 6 || t.length === 8) {
|
|
43
|
-
const y = n.map((c) => c === "y" ? t.length - 4 : 2);
|
|
44
|
-
let h = 0;
|
|
45
|
-
const b = n.map((c, x) => [c, t.slice(h, h += y[x])]);
|
|
46
|
-
return g(Object.fromEntries(b), e);
|
|
47
|
-
}
|
|
48
|
-
return null;
|
|
49
|
-
}
|
|
50
|
-
const m = t.split(/[^\d]+/).filter(Boolean);
|
|
51
|
-
return m.length === 3 ? g(S(n, m), e) : m.length === 2 ? g(S(p, m), e) : m.length === 1 ? g({ d: m[0] }, e) : null;
|
|
52
|
-
}
|
|
53
|
-
function S(o, r) {
|
|
54
|
-
return Object.fromEntries(o.map((e, t) => [e, r[t]]));
|
|
55
|
-
}
|
|
56
|
-
function Ae(o) {
|
|
57
|
-
const r = o.trim().replace(/^(\d{4}-\d{2}-\d{2})T/, "$1 ").split(/\s+/).filter(Boolean), e = r[r.length - 1];
|
|
58
|
-
if (e === void 0) return { date: null, time: null };
|
|
59
|
-
if (!(e.includes(":") || r.length > 1 && /^\d{1,2}\.\d{2}$/.test(e))) return { date: r.join(" "), time: null };
|
|
60
|
-
const a = r.slice(0, -1).join(" ");
|
|
61
|
-
return { date: a === "" ? null : a, time: e };
|
|
62
|
-
}
|
|
63
|
-
function Ne(o, r, e) {
|
|
64
|
-
const t = o(e), a = /\D+/.exec(t)?.[0].trim() ?? ".", u = /\D+$/.test(t) ? a : "", d = { d: String(Number(e.slice(8))), m: String(Number(e.slice(5, 7))), y: "" };
|
|
65
|
-
return r.filter((n) => n !== "y").map((n) => d[n]).join(a) + u;
|
|
66
|
-
}
|
|
67
|
-
function Te(o) {
|
|
68
|
-
const { t: r } = j(), e = K(), t = (n) => e.date(n), a = f(() => _e(t)), u = f(() => ({
|
|
69
|
-
today: [r("core.form.date.words.today").toLowerCase(), "today"],
|
|
70
|
-
tomorrow: [r("core.form.date.words.tomorrow").toLowerCase(), "tomorrow"],
|
|
71
|
-
yesterday: [r("core.form.date.words.yesterday").toLowerCase(), "yesterday"]
|
|
72
|
-
}));
|
|
73
|
-
return {
|
|
74
|
-
placeholder: f(() => r("core.form.date.placeholder", { example: Ne(t, a.value, O()) })),
|
|
75
|
-
/** The day a text means, or null. */
|
|
76
|
-
parse: (n) => De(n, { order: a.value, words: u.value }),
|
|
77
|
-
available: (n) => !J(n, o()),
|
|
78
|
-
invalidMessage: () => r("core.form.date.invalid", { example: t(O()) }),
|
|
79
|
-
unavailableMessage: () => r("core.form.date.unavailable")
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
function Ce(o, r, e) {
|
|
83
|
-
const { t } = j();
|
|
84
|
-
return f(() => {
|
|
85
|
-
const a = O();
|
|
86
|
-
return (o() ?? pe(r())).map((u) => {
|
|
87
|
-
const d = be(u, (n) => t(`core.form.date.${n.replace(/-/g, "_")}`), a);
|
|
88
|
-
return { ...d, disabled: J(d.value, e()) };
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
const Oe = ["id", "name", "value", "placeholder", "disabled", "required", "aria-required", "aria-invalid", "aria-describedby"], qe = ["aria-label", "onClick"], Pe = { class: "flex flex-col gap-2.5" }, Ve = {
|
|
93
|
-
key: 0,
|
|
94
|
-
class: "border-t border-border-separator pt-2.5"
|
|
95
|
-
}, Be = { class: "text-footnote text-content-muted" }, Ie = /* @__PURE__ */ Z({
|
|
96
|
-
__name: "DateField",
|
|
97
|
-
props: /* @__PURE__ */ ae(/* @__PURE__ */ ne({
|
|
98
|
-
label: {},
|
|
99
|
-
labelHidden: { type: Boolean },
|
|
100
|
-
hint: {},
|
|
101
|
-
error: {},
|
|
102
|
-
required: { type: Boolean },
|
|
103
|
-
editable: { type: Boolean },
|
|
104
|
-
disabled: { type: Boolean },
|
|
105
|
-
lockedReason: {},
|
|
106
|
-
presentation: {},
|
|
107
|
-
name: {},
|
|
108
|
-
min: {},
|
|
109
|
-
max: {},
|
|
110
|
-
disabledDates: { type: [Array, Function] },
|
|
111
|
-
openOn: {},
|
|
112
|
-
quickPicks: {}
|
|
113
|
-
}, { ...fe, min: void 0, max: void 0, disabledDates: void 0, openOn: void 0, quickPicks: void 0 }), {
|
|
114
|
-
modelValue: { default: null },
|
|
115
|
-
modelModifiers: {}
|
|
116
|
-
}),
|
|
117
|
-
emits: ["update:modelValue"],
|
|
118
|
-
setup(o, { expose: r }) {
|
|
119
|
-
const e = o, t = ee(o, "modelValue"), { t: a } = j(), u = K(), d = ie(), n = N("input"), p = N("popover"), m = N("calendar"), y = N("sheet"), h = f(() => ({ min: e.min, max: e.max, disabled: e.disabledDates })), b = Te(() => h.value), c = ve({
|
|
120
|
-
model: t,
|
|
121
|
-
display: (l) => u.date(l),
|
|
122
|
-
parse: (l) => {
|
|
123
|
-
const i = b.parse(l);
|
|
124
|
-
return i ? b.available(i) ? { value: i } : { error: b.unavailableMessage() } : { error: b.invalidMessage() };
|
|
125
|
-
}
|
|
126
|
-
}), x = Ce(() => e.quickPicks, () => d.value, () => h.value), L = f(() => e.error || c.message.value), q = f(() => t.value ? u.date(t.value) : null), W = ue("date", () => L.value ? "error" : e.disabled ? "locked" : "rest"), z = f(() => c.typed.value ?? (ye(t.value) ? t.value : null));
|
|
127
|
-
async function P(l) {
|
|
128
|
-
e.disabled || (p.value?.present(), l && (await H(), await H(), m.value?.focus()));
|
|
129
|
-
}
|
|
130
|
-
function X(l) {
|
|
131
|
-
l.key === "Enter" ? (c.commit(), p.value?.dismiss()) : l.key === "ArrowDown" && (l.preventDefault(), P(!0));
|
|
132
|
-
}
|
|
133
|
-
function F(l, i) {
|
|
134
|
-
c.set(l), i();
|
|
135
|
-
}
|
|
136
|
-
return r({ focus: () => n.value?.focus() }), (l, i) => (k(), I(ce, V({ ...s(me)(e), error: L.value }, {
|
|
137
|
-
value: q.value,
|
|
138
|
-
"value-style": "numeric"
|
|
139
|
-
}), te({
|
|
140
|
-
default: v(({ id: U, describedby: R, invalid: A }) => [
|
|
141
|
-
s(d) ? (k(), T(Q, { key: 0 }, [
|
|
142
|
-
$(le, V({ id: U, "aria-describedby": R }, {
|
|
143
|
-
disabled: e.disabled,
|
|
144
|
-
invalid: A,
|
|
145
|
-
placeholder: s(a)("core.form.select.choose"),
|
|
146
|
-
onClick: i[0] || (i[0] = (_) => y.value?.present())
|
|
147
|
-
}), {
|
|
148
|
-
default: v(() => [
|
|
149
|
-
q.value ? (k(), T(Q, { key: 0 }, [
|
|
150
|
-
re(Y(q.value), 1)
|
|
151
|
-
], 64)) : B("", !0)
|
|
152
|
-
]),
|
|
153
|
-
_: 1
|
|
154
|
-
}, 16, ["disabled", "invalid", "placeholder"]),
|
|
155
|
-
$(ke, {
|
|
156
|
-
ref_key: "sheet",
|
|
157
|
-
ref: y,
|
|
158
|
-
title: e.label ?? s(a)("core.form.date.calendar"),
|
|
159
|
-
mode: "date",
|
|
160
|
-
"model-value": t.value,
|
|
161
|
-
min: e.min,
|
|
162
|
-
max: e.max,
|
|
163
|
-
"disabled-dates": e.disabledDates,
|
|
164
|
-
"open-on": e.openOn,
|
|
165
|
-
shortcuts: s(x),
|
|
166
|
-
clearable: !e.required,
|
|
167
|
-
"onUpdate:modelValue": s(c).set
|
|
168
|
-
}, null, 8, ["title", "model-value", "min", "max", "disabled-dates", "open-on", "shortcuts", "clearable", "onUpdate:modelValue"])
|
|
169
|
-
], 64)) : (k(), I(de, {
|
|
170
|
-
key: 1,
|
|
171
|
-
ref_key: "popover",
|
|
172
|
-
ref: p,
|
|
173
|
-
label: e.label ?? s(a)("core.form.date.calendar"),
|
|
174
|
-
width: "lg",
|
|
175
|
-
placement: "bottom-start",
|
|
176
|
-
arrow: !1,
|
|
177
|
-
autofocus: !1
|
|
178
|
-
}, {
|
|
179
|
-
trigger: v(({ attrs: _, presented: w }) => [
|
|
180
|
-
C("div", {
|
|
181
|
-
class: oe(["inline-flex max-w-full items-center gap-2", s(W)])
|
|
182
|
-
}, [
|
|
183
|
-
C("input", V({
|
|
184
|
-
id: U,
|
|
185
|
-
ref_key: "input",
|
|
186
|
-
ref: n
|
|
187
|
-
}, _, {
|
|
188
|
-
type: "text",
|
|
189
|
-
role: "combobox",
|
|
190
|
-
autocomplete: "off",
|
|
191
|
-
size: "16",
|
|
192
|
-
name: e.name,
|
|
193
|
-
value: s(c).text.value,
|
|
194
|
-
placeholder: s(b).placeholder.value,
|
|
195
|
-
disabled: e.disabled,
|
|
196
|
-
required: e.required,
|
|
197
|
-
"aria-required": e.required || void 0,
|
|
198
|
-
"aria-invalid": A || void 0,
|
|
199
|
-
"aria-describedby": R,
|
|
200
|
-
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",
|
|
201
|
-
onInput: i[1] || (i[1] = (D) => s(c).input(D.target.value)),
|
|
202
|
-
onBlur: i[2] || (i[2] = (D) => s(c).commit()),
|
|
203
|
-
onKeydown: X,
|
|
204
|
-
onClick: i[3] || (i[3] = (D) => P(!1))
|
|
205
|
-
}), null, 16, Oe),
|
|
206
|
-
e.disabled ? B("", !0) : (k(), T("button", {
|
|
207
|
-
key: 0,
|
|
208
|
-
type: "button",
|
|
209
|
-
tabindex: "-1",
|
|
210
|
-
"aria-label": s(a)("core.form.date.open"),
|
|
211
|
-
class: "mr-2 flex shrink-0 cursor-pointer items-center text-content-link",
|
|
212
|
-
onClick: (D) => w ? p.value?.dismiss() : P(!0)
|
|
213
|
-
}, [
|
|
214
|
-
$(s(se), {
|
|
215
|
-
name: "calendarLine",
|
|
216
|
-
size: 18
|
|
217
|
-
})
|
|
218
|
-
], 8, qe))
|
|
219
|
-
], 2)
|
|
220
|
-
]),
|
|
221
|
-
default: v(({ dismiss: _ }) => [
|
|
222
|
-
C("div", Pe, [
|
|
223
|
-
$(ge, {
|
|
224
|
-
ref_key: "calendar",
|
|
225
|
-
ref: m,
|
|
226
|
-
"model-value": z.value,
|
|
227
|
-
min: e.min,
|
|
228
|
-
max: e.max,
|
|
229
|
-
"disabled-dates": e.disabledDates,
|
|
230
|
-
"open-on": e.openOn,
|
|
231
|
-
"month-picker": "",
|
|
232
|
-
"onUpdate:modelValue": (w) => F(w, _)
|
|
233
|
-
}, null, 8, ["model-value", "min", "max", "disabled-dates", "open-on", "onUpdate:modelValue"]),
|
|
234
|
-
s(x).length > 0 ? (k(), T("div", Ve, [
|
|
235
|
-
$(he, {
|
|
236
|
-
items: s(x),
|
|
237
|
-
selected: z.value,
|
|
238
|
-
onPick: (w) => F(w, _)
|
|
239
|
-
}, null, 8, ["items", "selected", "onPick"])
|
|
240
|
-
])) : B("", !0),
|
|
241
|
-
C("p", Be, Y(s(a)("core.form.date.keys")), 1)
|
|
242
|
-
])
|
|
243
|
-
]),
|
|
244
|
-
_: 2
|
|
245
|
-
}, 1032, ["label"]))
|
|
246
|
-
]),
|
|
247
|
-
_: 2
|
|
248
|
-
}, [
|
|
249
|
-
l.$slots.trailing ? {
|
|
250
|
-
name: "trailing",
|
|
251
|
-
fn: v(() => [
|
|
252
|
-
E(l.$slots, "trailing")
|
|
253
|
-
]),
|
|
254
|
-
key: "0"
|
|
255
|
-
} : void 0,
|
|
256
|
-
l.$slots.labelTrailing ? {
|
|
257
|
-
name: "labelTrailing",
|
|
258
|
-
fn: v(() => [
|
|
259
|
-
E(l.$slots, "labelTrailing")
|
|
260
|
-
]),
|
|
261
|
-
key: "1"
|
|
262
|
-
} : void 0,
|
|
263
|
-
l.$slots.readonly ? {
|
|
264
|
-
name: "readonly",
|
|
265
|
-
fn: v(() => [
|
|
266
|
-
E(l.$slots, "readonly")
|
|
267
|
-
]),
|
|
268
|
-
key: "2"
|
|
269
|
-
} : void 0
|
|
270
|
-
]), 1040, ["value"]));
|
|
271
|
-
}
|
|
272
|
-
});
|
|
273
|
-
export {
|
|
274
|
-
Ie as _,
|
|
275
|
-
Ce as a,
|
|
276
|
-
Ae as s,
|
|
277
|
-
Te as u
|
|
278
|
-
};
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import { defineComponent as W, useModel as A, useTemplateRef as E, computed as B, ref as $, watch as M, openBlock as F, createBlock as O, mergeProps as P, unref as q, createSlots as j, withCtx as k, createElementVNode as N, normalizeClass as S, createElementBlock as C, toDisplayString as V, createCommentVNode as R, renderSlot as _, mergeModels as z, mergeDefaults as H } from "vue";
|
|
2
|
-
import { b as J } from "./controlSurface-t7OEFESJ.js";
|
|
3
|
-
import { u as K } from "./format-D8X4zsx6.js";
|
|
4
|
-
import { a as L, c as Q, _ as U, f as X, b as Y } from "./control-B4SdblL6.js";
|
|
5
|
-
function Z(s) {
|
|
6
|
-
const n = s.number(1234.5, { minimumFractionDigits: 1, maximumFractionDigits: 1, useGrouping: !0 }), e = /^\d(\D)\d/.exec(n)?.[1] ?? "";
|
|
7
|
-
return { decimal: n.charAt(n.length - 2) || ".", group: e === "." || e === "," ? e : "" };
|
|
8
|
-
}
|
|
9
|
-
function ee(s, n) {
|
|
10
|
-
const e = s.trim().startsWith("-"), t = s.replace(/[^\d.,]/g, "");
|
|
11
|
-
if (t === "") return e ? void 0 : null;
|
|
12
|
-
const m = [...t].filter((o) => o === "." || o === ",");
|
|
13
|
-
let f = t, v = "";
|
|
14
|
-
if (n.decimals > 0 && m.length > 0) {
|
|
15
|
-
const o = Math.max(t.lastIndexOf("."), t.lastIndexOf(",")), r = t.charAt(o), p = t.slice(o + 1), g = t.includes(".") && t.includes(","), c = m.filter((D) => D === r).length > 1, a = !g && r === n.group && p.length === 3;
|
|
16
|
-
(g || !c && !a) && (f = t.slice(0, o), v = p);
|
|
17
|
-
}
|
|
18
|
-
const x = (o) => o.replace(/\D/g, ""), h = +`${x(f) || "0"}.${x(v) || "0"}`;
|
|
19
|
-
if (!Number.isFinite(h)) return;
|
|
20
|
-
const d = Number(h.toFixed(n.decimals));
|
|
21
|
-
return e ? -d || 0 : d;
|
|
22
|
-
}
|
|
23
|
-
const te = {
|
|
24
|
-
key: 0,
|
|
25
|
-
class: "shrink-0 text-footnote text-content-muted"
|
|
26
|
-
}, ie = ["id", "value", "name", "placeholder", "disabled", "required", "aria-required", "aria-invalid", "aria-describedby"], le = {
|
|
27
|
-
key: 1,
|
|
28
|
-
class: "shrink-0 text-footnote text-content-muted"
|
|
29
|
-
}, se = /* @__PURE__ */ W({
|
|
30
|
-
__name: "NumberField",
|
|
31
|
-
props: /* @__PURE__ */ z(/* @__PURE__ */ H({
|
|
32
|
-
label: {},
|
|
33
|
-
labelHidden: { type: Boolean },
|
|
34
|
-
hint: {},
|
|
35
|
-
error: {},
|
|
36
|
-
required: { type: Boolean },
|
|
37
|
-
editable: { type: Boolean },
|
|
38
|
-
disabled: { type: Boolean },
|
|
39
|
-
lockedReason: {},
|
|
40
|
-
presentation: {},
|
|
41
|
-
name: {},
|
|
42
|
-
decimals: {},
|
|
43
|
-
minDecimals: {},
|
|
44
|
-
negative: { type: Boolean },
|
|
45
|
-
grouping: { type: Boolean },
|
|
46
|
-
maxDigits: {},
|
|
47
|
-
mono: { type: Boolean },
|
|
48
|
-
placeholder: {},
|
|
49
|
-
prefix: {},
|
|
50
|
-
suffix: {},
|
|
51
|
-
width: {}
|
|
52
|
-
}, { ...Y, decimals: 0, minDecimals: void 0, negative: !1, grouping: !0, maxDigits: void 0, mono: !1, placeholder: void 0, prefix: void 0, suffix: void 0, width: "sm" }), {
|
|
53
|
-
modelValue: { default: null },
|
|
54
|
-
modelModifiers: {}
|
|
55
|
-
}),
|
|
56
|
-
emits: ["update:modelValue"],
|
|
57
|
-
setup(s, { expose: n }) {
|
|
58
|
-
const e = s, t = A(s, "modelValue"), m = K(), f = E("input"), v = !!L(), x = Q("text", () => e.error ? "error" : e.disabled ? "locked" : "rest"), h = B(() => v ? J(e.width) : "w-full"), d = B(() => Z(m)), o = B(() => Math.min(e.minDecimals ?? e.decimals, e.decimals)), r = (i) => i === null ? "" : m.number(i, { minimumFractionDigits: o.value, maximumFractionDigits: e.decimals, useGrouping: e.grouping }), p = (i) => i === null ? "" : String(i).replace(".", d.value.decimal), g = (i) => ee(i, { decimals: e.decimals, group: e.grouping ? d.value.group : "" }), c = $(!1), a = $(r(t.value));
|
|
59
|
-
M(t, (i) => {
|
|
60
|
-
c.value ? g(a.value) !== i && (a.value = p(i)) : a.value = r(i);
|
|
61
|
-
}), M(() => [e.decimals, o.value, e.grouping, d.value.decimal], () => {
|
|
62
|
-
c.value || (a.value = r(t.value));
|
|
63
|
-
});
|
|
64
|
-
function D(i) {
|
|
65
|
-
const u = i.target;
|
|
66
|
-
let l = u.value.replace(/[^\d.,\-\s]/g, "");
|
|
67
|
-
e.negative ? l = l.replace(/(?!^)-/g, "") : l = l.replace(/-/g, "");
|
|
68
|
-
const w = l.replace(/\D/g, "").length;
|
|
69
|
-
if (e.maxDigits !== void 0 && w > e.maxDigits) {
|
|
70
|
-
if (l.length === a.value.length + 1) {
|
|
71
|
-
const y = Math.max(0, (u.selectionStart ?? l.length) - 1);
|
|
72
|
-
u.value = a.value, u.setSelectionRange(y, y);
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
let I = 0;
|
|
76
|
-
l = [...l].filter((y) => !/\d/.test(y) || ++I <= e.maxDigits).join("");
|
|
77
|
-
}
|
|
78
|
-
l !== u.value && (u.value = l), a.value = l;
|
|
79
|
-
const b = g(l);
|
|
80
|
-
b !== void 0 ? t.value = b : t.value = null;
|
|
81
|
-
}
|
|
82
|
-
function T() {
|
|
83
|
-
c.value = !0, a.value = p(t.value);
|
|
84
|
-
}
|
|
85
|
-
function G() {
|
|
86
|
-
c.value = !1, a.value = r(t.value);
|
|
87
|
-
}
|
|
88
|
-
return n({ focus: () => f.value?.focus() }), (i, u) => (F(), O(U, P(q(X)(e), {
|
|
89
|
-
value: t.value === null ? null : r(t.value),
|
|
90
|
-
prefix: e.prefix,
|
|
91
|
-
suffix: e.suffix,
|
|
92
|
-
"value-style": e.mono ? "mono" : "numeric"
|
|
93
|
-
}), j({
|
|
94
|
-
default: k(({ id: l, describedby: w, invalid: b }) => [
|
|
95
|
-
N("div", {
|
|
96
|
-
class: S(["flex items-center gap-1.5", [q(x), h.value]])
|
|
97
|
-
}, [
|
|
98
|
-
e.prefix ? (F(), C("span", te, V(e.prefix), 1)) : R("", !0),
|
|
99
|
-
N("input", {
|
|
100
|
-
id: l,
|
|
101
|
-
ref_key: "input",
|
|
102
|
-
ref: f,
|
|
103
|
-
value: a.value,
|
|
104
|
-
type: "text",
|
|
105
|
-
inputmode: "decimal",
|
|
106
|
-
autocomplete: "off",
|
|
107
|
-
name: e.name,
|
|
108
|
-
placeholder: e.placeholder,
|
|
109
|
-
disabled: e.disabled,
|
|
110
|
-
required: e.required,
|
|
111
|
-
"aria-required": e.required || void 0,
|
|
112
|
-
"aria-invalid": b || void 0,
|
|
113
|
-
"aria-describedby": w,
|
|
114
|
-
class: S(["block w-full min-w-0 border-0 bg-transparent px-0 py-1 text-right text-body tabular-nums text-content-strong placeholder:text-content-disabled focus:outline-none focus:ring-0 disabled:cursor-not-allowed", e.mono ? "font-mono" : ""]),
|
|
115
|
-
onInput: D,
|
|
116
|
-
onFocus: T,
|
|
117
|
-
onBlur: G
|
|
118
|
-
}, null, 42, ie),
|
|
119
|
-
e.suffix ? (F(), C("span", le, V(e.suffix), 1)) : R("", !0)
|
|
120
|
-
], 2)
|
|
121
|
-
]),
|
|
122
|
-
_: 2
|
|
123
|
-
}, [
|
|
124
|
-
i.$slots.trailing ? {
|
|
125
|
-
name: "trailing",
|
|
126
|
-
fn: k(() => [
|
|
127
|
-
_(i.$slots, "trailing")
|
|
128
|
-
]),
|
|
129
|
-
key: "0"
|
|
130
|
-
} : void 0,
|
|
131
|
-
i.$slots.labelTrailing ? {
|
|
132
|
-
name: "labelTrailing",
|
|
133
|
-
fn: k(() => [
|
|
134
|
-
_(i.$slots, "labelTrailing")
|
|
135
|
-
]),
|
|
136
|
-
key: "1"
|
|
137
|
-
} : void 0,
|
|
138
|
-
i.$slots.readonly ? {
|
|
139
|
-
name: "readonly",
|
|
140
|
-
fn: k(() => [
|
|
141
|
-
_(i.$slots, "readonly")
|
|
142
|
-
]),
|
|
143
|
-
key: "2"
|
|
144
|
-
} : void 0
|
|
145
|
-
]), 1040, ["value", "prefix", "suffix", "value-style"]));
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
export {
|
|
149
|
-
se as _
|
|
150
|
-
};
|