@effect-app/vue-components 4.0.0-beta.315 → 4.0.0-beta.317
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/types/components/Dialog.vue.d.ts +1 -1
- package/dist/types/components/OmegaForm/decimalSeparatorInput.d.ts +13 -0
- package/dist/vue-components.es.js +9 -9
- package/dist/vue-components14.es.js +1 -1
- package/dist/vue-components32.es.js +14 -23
- package/dist/vue-components33.es.js +23 -335
- package/dist/vue-components34.es.js +344 -0
- package/dist/vue-components36.es.js +7 -73
- package/dist/vue-components37.es.js +72 -3
- package/dist/vue-components38.es.js +4 -63
- package/dist/vue-components39.es.js +63 -4
- package/dist/vue-components40.es.js +4 -23
- package/dist/vue-components41.es.js +23 -4
- package/dist/vue-components42.es.js +3 -57
- package/dist/vue-components43.es.js +57 -3
- package/dist/vue-components44.es.js +4 -11
- package/dist/vue-components45.es.js +11 -21
- package/dist/vue-components46.es.js +22 -0
- package/dist/vue-components48.es.js +8 -3
- package/dist/vue-components49.es.js +3 -37
- package/dist/vue-components50.es.js +34 -23
- package/dist/vue-components51.es.js +23 -24
- package/dist/vue-components52.es.js +27 -6
- package/dist/vue-components53.es.js +6 -17
- package/dist/vue-components54.es.js +16 -34
- package/dist/vue-components55.es.js +34 -16
- package/dist/vue-components56.es.js +16 -19
- package/dist/vue-components57.es.js +10 -19
- package/dist/vue-components58.es.js +29 -6
- package/dist/vue-components59.es.js +6 -8
- package/dist/vue-components60.es.js +7 -36
- package/dist/vue-components61.es.js +37 -24
- package/dist/vue-components62.es.js +19 -122
- package/dist/vue-components63.es.js +126 -22
- package/dist/vue-components64.es.js +20 -17
- package/dist/vue-components65.es.js +18 -6
- package/dist/vue-components66.es.js +5 -15
- package/dist/vue-components67.es.js +18 -4
- package/dist/vue-components68.es.js +4 -28
- package/dist/vue-components69.es.js +28 -4
- package/dist/vue-components70.es.js +4 -42
- package/dist/vue-components71.es.js +38 -96
- package/dist/vue-components72.es.js +95 -30
- package/dist/vue-components73.es.js +35 -18
- package/dist/vue-components74.es.js +18 -49
- package/dist/vue-components75.es.js +50 -0
- package/package.json +3 -3
- package/src/components/OmegaForm/OmegaInputVuetify.vue +28 -3
- package/src/components/OmegaForm/decimalSeparatorInput.ts +38 -0
- package/src/components/OmegaForm/meta/checks.ts +4 -1
- package/dist/vue-components35.es.js +0 -8
- package/dist/vue-components47.es.js +0 -9
|
@@ -1,5 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { getGlobal as e, registerGlobal as t, unregisterGlobal as n } from "./vue-components51.es.js";
|
|
2
|
+
import { DiagAPI as r } from "./vue-components55.es.js";
|
|
3
|
+
import { deleteSpan as i, getActiveSpan as a, getSpan as o, getSpanContext as s, setSpan as c, setSpanContext as l } from "./vue-components62.es.js";
|
|
4
|
+
import { isSpanContextValid as u, wrapSpanContext as d } from "./vue-components63.es.js";
|
|
5
|
+
import { ProxyTracerProvider as f } from "./vue-components67.es.js";
|
|
6
|
+
//#region ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/trace.js
|
|
7
|
+
var p = "trace", m = class m {
|
|
8
|
+
constructor() {
|
|
9
|
+
this._proxyTracerProvider = new f(), this.wrapSpanContext = d, this.isSpanContextValid = u, this.deleteSpan = i, this.getSpan = o, this.getActiveSpan = a, this.getSpanContext = s, this.setSpan = c, this.setSpanContext = l;
|
|
10
|
+
}
|
|
11
|
+
static getInstance() {
|
|
12
|
+
return this._instance ||= new m(), this._instance;
|
|
13
|
+
}
|
|
14
|
+
setGlobalTracerProvider(e) {
|
|
15
|
+
let n = t(p, this._proxyTracerProvider, r.instance());
|
|
16
|
+
return n && this._proxyTracerProvider.setDelegate(e), n;
|
|
17
|
+
}
|
|
18
|
+
getTracerProvider() {
|
|
19
|
+
return e(p) || this._proxyTracerProvider;
|
|
20
|
+
}
|
|
21
|
+
getTracer(e, t) {
|
|
22
|
+
return this.getTracerProvider().getTracer(e, t);
|
|
23
|
+
}
|
|
24
|
+
disable() {
|
|
25
|
+
n(p, r.instance()), this._proxyTracerProvider = new f();
|
|
26
|
+
}
|
|
27
|
+
};
|
|
4
28
|
//#endregion
|
|
5
|
-
export {
|
|
29
|
+
export { m as TraceAPI };
|
|
@@ -1,43 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import * as r from "effect-app/Effect";
|
|
5
|
-
import { runtimeFiberAsPromise as i } from "effect-app/utils";
|
|
6
|
-
import * as a from "effect/Data";
|
|
7
|
-
import * as o from "effect/Fiber";
|
|
8
|
-
//#region src/components/OmegaForm/submit.ts
|
|
9
|
-
var s = class extends a.TaggedError("FormErrors") {}, c = (n, r) => n ? e.with(t.setSpan(e.active(), n), r) : r(), l = (e, t, n) => {
|
|
10
|
-
if (e) return ({ formApi: a, meta: s, value: l }) => c(s?.currentSpan, async () => {
|
|
11
|
-
let c = e({
|
|
12
|
-
formApi: a,
|
|
13
|
-
meta: s,
|
|
14
|
-
value: await n(t(l))
|
|
15
|
-
});
|
|
16
|
-
if (o.isFiber(c)) return await i(c);
|
|
17
|
-
if (r.isEffect(c)) {
|
|
18
|
-
let e = await n(c);
|
|
19
|
-
return o.isFiber(e) ? await i(e) : e;
|
|
20
|
-
}
|
|
21
|
-
return c;
|
|
22
|
-
});
|
|
23
|
-
}, u = (i) => {
|
|
24
|
-
let a = i.handleSubmit.bind(i), o = async (e) => await a(e), c = (n) => o({
|
|
25
|
-
currentSpan: t.getSpan(e.active()),
|
|
26
|
-
...n
|
|
27
|
-
}), l = (e) => r.currentSpan.pipe(r.option, r.flatMap((t) => r.promise(() => o(n.isSome(t) ? {
|
|
28
|
-
currentSpan: t.value,
|
|
29
|
-
...e
|
|
30
|
-
} : e))));
|
|
31
|
-
return {
|
|
32
|
-
handleSubmit: c,
|
|
33
|
-
handleSubmitEffect: (e) => e?.checkErrors ? l(e?.meta).pipe(r.flatMap(r.fnUntraced(function* () {
|
|
34
|
-
let e = i.getAllErrors();
|
|
35
|
-
if (Object.keys(e.fields).length || e.form.errors.length) return yield* r.fail(new s({
|
|
36
|
-
form: e.form,
|
|
37
|
-
fields: e.fields
|
|
38
|
-
}));
|
|
39
|
-
}))) : l(e?.meta)
|
|
40
|
-
};
|
|
41
|
-
};
|
|
1
|
+
import { TraceAPI as e } from "./vue-components69.es.js";
|
|
2
|
+
//#region ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace-api.js
|
|
3
|
+
var t = e.getInstance();
|
|
42
4
|
//#endregion
|
|
43
|
-
export {
|
|
5
|
+
export { t as trace };
|
|
@@ -1,101 +1,43 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
import { makeRunPromise as T } from "@effect-app/vue/runtime";
|
|
21
|
-
//#region src/components/OmegaForm/useOmegaForm.ts
|
|
22
|
-
var E = Symbol("OmegaForm"), D = T(w.empty()), O = (w, T, E) => {
|
|
23
|
-
if (!w) throw Error("Schema is required");
|
|
24
|
-
let { trans: O } = e(), k = a(w), A = s(k, O), j = n(k.ast), M = (e) => i(j, e), N = c(A, O), P = {
|
|
25
|
-
...N,
|
|
26
|
-
"~standard": {
|
|
27
|
-
...N["~standard"],
|
|
28
|
-
validate: (e) => N["~standard"].validate(M(e))
|
|
1
|
+
import { context as e } from "./vue-components68.es.js";
|
|
2
|
+
import { trace as t } from "./vue-components70.es.js";
|
|
3
|
+
import * as n from "effect-app/Option";
|
|
4
|
+
import * as r from "effect-app/Effect";
|
|
5
|
+
import { runtimeFiberAsPromise as i } from "effect-app/utils";
|
|
6
|
+
import * as a from "effect/Data";
|
|
7
|
+
import * as o from "effect/Fiber";
|
|
8
|
+
//#region src/components/OmegaForm/submit.ts
|
|
9
|
+
var s = class extends a.TaggedError("FormErrors") {}, c = (n, r) => n ? e.with(t.setSpan(e.active(), n), r) : r(), l = (e, t, n) => {
|
|
10
|
+
if (e) return ({ formApi: a, meta: s, value: l }) => c(s?.currentSpan, async () => {
|
|
11
|
+
let c = e({
|
|
12
|
+
formApi: a,
|
|
13
|
+
meta: s,
|
|
14
|
+
value: await n(t(l))
|
|
15
|
+
});
|
|
16
|
+
if (o.isFiber(c)) return await i(c);
|
|
17
|
+
if (r.isEffect(c)) {
|
|
18
|
+
let e = await n(c);
|
|
19
|
+
return o.isFiber(e) ? await i(e) : e;
|
|
29
20
|
}
|
|
30
|
-
|
|
31
|
-
meta: L,
|
|
32
|
-
persistency: E?.persistency,
|
|
33
|
-
preventWindowExit: E?.preventWindowExit,
|
|
34
|
-
defaultValuesPriority: E?.defaultValuesPriority,
|
|
35
|
-
tanstackDefaultValues: T?.defaultValues,
|
|
36
|
-
schemaDefaultValues: () => r(w),
|
|
37
|
-
getForm: () => z.form
|
|
38
|
-
}), V = C({
|
|
39
|
-
...T,
|
|
40
|
-
validationLogic: S(),
|
|
41
|
-
validators: {
|
|
42
|
-
onDynamic: P,
|
|
43
|
-
...T?.validators
|
|
44
|
-
},
|
|
45
|
-
onSubmit: y(T?.onSubmit, I, D),
|
|
46
|
-
defaultValues: B.defaultValues.value
|
|
21
|
+
return c;
|
|
47
22
|
});
|
|
48
|
-
|
|
49
|
-
let
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
23
|
+
}, u = (i) => {
|
|
24
|
+
let a = i.handleSubmit.bind(i), o = async (e) => await a(e), c = (n) => o({
|
|
25
|
+
currentSpan: t.getSpan(e.active()),
|
|
26
|
+
...n
|
|
27
|
+
}), l = (e) => r.currentSpan.pipe(r.option, r.flatMap((t) => r.promise(() => o(n.isSome(t) ? {
|
|
28
|
+
currentSpan: t.value,
|
|
29
|
+
...e
|
|
30
|
+
} : e))));
|
|
31
|
+
return {
|
|
32
|
+
handleSubmit: c,
|
|
33
|
+
handleSubmitEffect: (e) => e?.checkErrors ? l(e?.meta).pipe(r.flatMap(r.fnUntraced(function* () {
|
|
34
|
+
let e = i.getAllErrors();
|
|
35
|
+
if (Object.keys(e.fields).length || e.form.errors.length) return yield* r.fail(new s({
|
|
36
|
+
form: e.form,
|
|
37
|
+
fields: e.fields
|
|
38
|
+
}));
|
|
39
|
+
}))) : l(e?.meta)
|
|
64
40
|
};
|
|
65
|
-
if (E?.preventWindowExit === "prevent-and-reset") {
|
|
66
|
-
let e = V.useStore((e) => e.isSubmitting), t = V.useStore((e) => e.submissionAttempts), n = V.useStore((e) => e.canSubmit), r = V.useStore((e) => e.values);
|
|
67
|
-
b([e, t], ([e, t], [i]) => {
|
|
68
|
-
i && !e && t > 0 && n.value && V.reset(r.value);
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
let { handleSubmit: W, handleSubmitEffect: G } = v(V), { fieldMap: K, registerField: q } = u(), J = Object.assign(V, {
|
|
72
|
-
i18nNamespace: E?.i18nNamespace,
|
|
73
|
-
ignorePreventCloseEvents: E?.ignorePreventCloseEvents,
|
|
74
|
-
inputs: E?.inputs,
|
|
75
|
-
meta: L,
|
|
76
|
-
unionMeta: R,
|
|
77
|
-
clear: U,
|
|
78
|
-
normalizeNullableStructs: H,
|
|
79
|
-
handleSubmit: W,
|
|
80
|
-
handleSubmitEffect: G,
|
|
81
|
-
registerField: q
|
|
82
|
-
}), Y = {
|
|
83
|
-
form: J,
|
|
84
|
-
fieldMap: K
|
|
85
|
-
};
|
|
86
|
-
return Object.assign(J, {
|
|
87
|
-
_paths: void 0,
|
|
88
|
-
_keys: void 0,
|
|
89
|
-
_schema: w,
|
|
90
|
-
errorContext: Y,
|
|
91
|
-
Form: d(J)(_),
|
|
92
|
-
Input: d(J)(E?.input ?? h),
|
|
93
|
-
TaggedUnion: d(J)(g),
|
|
94
|
-
Field: V.Field,
|
|
95
|
-
Errors: l(Y)(m),
|
|
96
|
-
Array: d(J)(f),
|
|
97
|
-
AutoGen: d(J)(p)
|
|
98
|
-
});
|
|
99
41
|
};
|
|
100
42
|
//#endregion
|
|
101
|
-
export {
|
|
43
|
+
export { s as FormErrors, u as makeSubmitHandlers, l as wrapOnSubmit };
|
|
@@ -1,36 +1,101 @@
|
|
|
1
|
-
import e from "./vue-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
1
|
+
import { useIntl as e } from "./vue-components6.es.js";
|
|
2
|
+
import { generateMetaFromSchema as t, unwrapDeclaration as n } from "./vue-components16.es.js";
|
|
3
|
+
import { defaultsValueFromSchema as r, fillNestedDefaults as i } from "./vue-components17.es.js";
|
|
4
|
+
import { toFormSchema as a } from "./vue-components18.es.js";
|
|
5
|
+
import { usePersistency as o } from "./vue-components20.es.js";
|
|
6
|
+
import { annotateLiteralUnionMessages as s, toLocalizedStandardSchemaV1 as c } from "./vue-components21.es.js";
|
|
7
|
+
import { eHoc as l, makeFieldMap as u } from "./vue-components22.es.js";
|
|
8
|
+
import { fHoc as d } from "./vue-components23.es.js";
|
|
9
|
+
import f from "./vue-components25.es.js";
|
|
10
|
+
import p from "./vue-components27.es.js";
|
|
11
|
+
import m from "./vue-components31.es.js";
|
|
12
|
+
import h from "./vue-components40.es.js";
|
|
13
|
+
import g from "./vue-components44.es.js";
|
|
14
|
+
import _ from "./vue-components48.es.js";
|
|
15
|
+
import { makeSubmitHandlers as v, wrapOnSubmit as y } from "./vue-components71.es.js";
|
|
16
|
+
import { watch as b } from "vue";
|
|
17
|
+
import * as x from "effect-app/Schema";
|
|
18
|
+
import { revalidateLogic as S, useForm as C } from "@tanstack/vue-form";
|
|
19
|
+
import * as w from "effect-app/Context";
|
|
20
|
+
import { makeRunPromise as T } from "@effect-app/vue/runtime";
|
|
21
|
+
//#region src/components/OmegaForm/useOmegaForm.ts
|
|
22
|
+
var E = Symbol("OmegaForm"), D = T(w.empty()), O = (w, T, E) => {
|
|
23
|
+
if (!w) throw Error("Schema is required");
|
|
24
|
+
let { trans: O } = e(), k = a(w), A = s(k, O), j = n(k.ast), M = (e) => i(j, e), N = c(A, O), P = {
|
|
25
|
+
...N,
|
|
26
|
+
"~standard": {
|
|
27
|
+
...N["~standard"],
|
|
28
|
+
validate: (e) => N["~standard"].validate(M(e))
|
|
29
|
+
}
|
|
30
|
+
}, F = x.decodeUnknownEffectConcurrently(k), I = (e) => F(M(e)), { meta: L, unionMeta: R } = t(k), z = { form: void 0 }, B = o({
|
|
31
|
+
meta: L,
|
|
32
|
+
persistency: E?.persistency,
|
|
33
|
+
preventWindowExit: E?.preventWindowExit,
|
|
34
|
+
defaultValuesPriority: E?.defaultValuesPriority,
|
|
35
|
+
tanstackDefaultValues: T?.defaultValues,
|
|
36
|
+
schemaDefaultValues: () => r(w),
|
|
37
|
+
getForm: () => z.form
|
|
38
|
+
}), V = C({
|
|
39
|
+
...T,
|
|
40
|
+
validationLogic: S(),
|
|
41
|
+
validators: {
|
|
42
|
+
onDynamic: P,
|
|
43
|
+
...T?.validators
|
|
44
|
+
},
|
|
45
|
+
onSubmit: y(T?.onSubmit, I, D),
|
|
46
|
+
defaultValues: B.defaultValues.value
|
|
47
|
+
});
|
|
48
|
+
z.form = V;
|
|
49
|
+
let H = () => {
|
|
50
|
+
let e = V.state.values, t = i(j, e);
|
|
51
|
+
if (t === e || !t || typeof t != "object") return;
|
|
52
|
+
let n = e, r = t;
|
|
53
|
+
for (let e of Object.keys(r)) if (r[e] !== n[e]) {
|
|
54
|
+
let t = e;
|
|
55
|
+
V.setFieldValue(t, r[e], {
|
|
56
|
+
dontUpdateMeta: !0,
|
|
57
|
+
dontValidate: !0
|
|
27
58
|
});
|
|
28
59
|
}
|
|
60
|
+
}, U = () => {
|
|
61
|
+
Object.keys(L).forEach((e) => {
|
|
62
|
+
V.setFieldValue(e, void 0);
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
if (E?.preventWindowExit === "prevent-and-reset") {
|
|
66
|
+
let e = V.useStore((e) => e.isSubmitting), t = V.useStore((e) => e.submissionAttempts), n = V.useStore((e) => e.canSubmit), r = V.useStore((e) => e.values);
|
|
67
|
+
b([e, t], ([e, t], [i]) => {
|
|
68
|
+
i && !e && t > 0 && n.value && V.reset(r.value);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
let { handleSubmit: W, handleSubmitEffect: G } = v(V), { fieldMap: K, registerField: q } = u(), J = Object.assign(V, {
|
|
72
|
+
i18nNamespace: E?.i18nNamespace,
|
|
73
|
+
ignorePreventCloseEvents: E?.ignorePreventCloseEvents,
|
|
74
|
+
inputs: E?.inputs,
|
|
75
|
+
meta: L,
|
|
76
|
+
unionMeta: R,
|
|
77
|
+
clear: U,
|
|
78
|
+
normalizeNullableStructs: H,
|
|
79
|
+
handleSubmit: W,
|
|
80
|
+
handleSubmitEffect: G,
|
|
81
|
+
registerField: q
|
|
82
|
+
}), Y = {
|
|
83
|
+
form: J,
|
|
84
|
+
fieldMap: K
|
|
29
85
|
};
|
|
30
|
-
return
|
|
31
|
-
|
|
32
|
-
|
|
86
|
+
return Object.assign(J, {
|
|
87
|
+
_paths: void 0,
|
|
88
|
+
_keys: void 0,
|
|
89
|
+
_schema: w,
|
|
90
|
+
errorContext: Y,
|
|
91
|
+
Form: d(J)(_),
|
|
92
|
+
Input: d(J)(E?.input ?? h),
|
|
93
|
+
TaggedUnion: d(J)(g),
|
|
94
|
+
Field: V.Field,
|
|
95
|
+
Errors: l(Y)(m),
|
|
96
|
+
Array: d(J)(f),
|
|
97
|
+
AutoGen: d(J)(p)
|
|
33
98
|
});
|
|
34
99
|
};
|
|
35
100
|
//#endregion
|
|
36
|
-
export {
|
|
101
|
+
export { E as OmegaFormKey, O as useOmegaForm };
|
|
@@ -1,19 +1,36 @@
|
|
|
1
|
-
import "./vue-
|
|
2
|
-
import "./vue-
|
|
3
|
-
import "
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import e from "./vue-components40.es.js";
|
|
2
|
+
import { useOmegaForm as t } from "./vue-components72.es.js";
|
|
3
|
+
import { h as n } from "vue";
|
|
4
|
+
//#region src/components/OmegaForm/createUseFormWithCustomInput.ts
|
|
5
|
+
var r = (r) => (i, a, o) => {
|
|
6
|
+
let s = {
|
|
7
|
+
name: "WrappedInput",
|
|
8
|
+
inheritAttrs: !1,
|
|
9
|
+
setup(t, { attrs: i, slots: a }) {
|
|
10
|
+
return () => n(e, {
|
|
11
|
+
...t,
|
|
12
|
+
...i
|
|
13
|
+
}, {
|
|
14
|
+
default: ({ field: e, state: t, ...s }) => {
|
|
15
|
+
let c = Object.fromEntries(Object.entries(i).filter(([e]) => !Object.prototype.hasOwnProperty.call(s, e) && e !== "form"));
|
|
16
|
+
return n(o?.inputs?.[s.type] ?? r, {
|
|
17
|
+
...c,
|
|
18
|
+
field: e,
|
|
19
|
+
state: t,
|
|
20
|
+
inputProps: s
|
|
21
|
+
}, {
|
|
22
|
+
...a.label && { label: (e) => a.label(e) },
|
|
23
|
+
...a.default && { default: (e) => a.default(e) }
|
|
24
|
+
});
|
|
25
|
+
},
|
|
26
|
+
...a.label && { label: (e) => a.label(e) }
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
return t(i, a, {
|
|
31
|
+
...o,
|
|
32
|
+
input: s
|
|
33
|
+
});
|
|
34
|
+
};
|
|
18
35
|
//#endregion
|
|
19
|
-
export {
|
|
36
|
+
export { r as createUseFormWithCustomInput };
|
|
@@ -1,50 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
import { OmegaFormKey as S, useOmegaForm as C } from "./vue-components71.es.js";
|
|
19
|
-
import { createUseFormWithCustomInput as w } from "./vue-components72.es.js";
|
|
20
|
-
import { duplicateSchema as T } from "./vue-components73.es.js";
|
|
21
|
-
//#region src/components/index.ts
|
|
22
|
-
var E = /* @__PURE__ */ e({
|
|
23
|
-
CommandButton: () => t,
|
|
24
|
-
Dialog: () => i,
|
|
25
|
-
FixedNuxtErrorBoundary: () => a,
|
|
26
|
-
FormErrors: () => x,
|
|
27
|
-
OmegaFormKey: () => S,
|
|
28
|
-
OmegaInput: () => v,
|
|
29
|
-
OmegaTaggedUnion: () => b,
|
|
30
|
-
OmegaTaggedUnionInternal: () => y,
|
|
31
|
-
OmegaVuetifyInput: () => _,
|
|
32
|
-
createMeta: () => s,
|
|
33
|
-
createUseFormWithCustomInput: () => w,
|
|
34
|
-
deepMerge: () => p,
|
|
35
|
-
defaultsValueFromSchema: () => d,
|
|
36
|
-
duplicateSchema: () => T,
|
|
37
|
-
generateMetaFromSchema: () => c,
|
|
38
|
-
getInputType: () => o,
|
|
39
|
-
isNullableOrUndefined: () => l,
|
|
40
|
-
makeStandardSchemaV1Hooks: () => m,
|
|
41
|
-
metadataFromAst: () => u,
|
|
42
|
-
toFormSchema: () => f,
|
|
43
|
-
toLocalizedStandardSchemaV1: () => h,
|
|
44
|
-
useErrorLabel: () => g,
|
|
45
|
-
useOmegaForm: () => C,
|
|
46
|
-
useOnClose: () => n,
|
|
47
|
-
usePreventClose: () => r
|
|
48
|
-
});
|
|
1
|
+
import "./vue-components8.es.js";
|
|
2
|
+
import "./vue-components13.es.js";
|
|
3
|
+
import "./vue-components16.es.js";
|
|
4
|
+
import "./vue-components17.es.js";
|
|
5
|
+
import "./vue-components18.es.js";
|
|
6
|
+
import "./vue-components20.es.js";
|
|
7
|
+
import "./vue-components21.es.js";
|
|
8
|
+
import "./vue-components22.es.js";
|
|
9
|
+
import "./vue-components38.es.js";
|
|
10
|
+
import "./vue-components40.es.js";
|
|
11
|
+
import "./vue-components42.es.js";
|
|
12
|
+
import "./vue-components44.es.js";
|
|
13
|
+
import "./vue-components71.es.js";
|
|
14
|
+
import "./vue-components72.es.js";
|
|
15
|
+
import "./vue-components73.es.js";
|
|
16
|
+
//#region src/components/OmegaForm/index.ts
|
|
17
|
+
var e = (e) => e;
|
|
49
18
|
//#endregion
|
|
50
|
-
export {
|
|
19
|
+
export { e as duplicateSchema };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { __exportAll as e } from "./vue-components2.es.js";
|
|
2
|
+
import t from "./vue-components4.es.js";
|
|
3
|
+
import { useOnClose as n, usePreventClose as r } from "./vue-components8.es.js";
|
|
4
|
+
import i from "./vue-components10.es.js";
|
|
5
|
+
import a from "./vue-components12.es.js";
|
|
6
|
+
import { getInputType as o } from "./vue-components13.es.js";
|
|
7
|
+
import { createMeta as s, generateMetaFromSchema as c, isNullableOrUndefined as l, metadataFromAst as u } from "./vue-components16.es.js";
|
|
8
|
+
import { defaultsValueFromSchema as d } from "./vue-components17.es.js";
|
|
9
|
+
import { toFormSchema as f } from "./vue-components18.es.js";
|
|
10
|
+
import { deepMerge as p } from "./vue-components20.es.js";
|
|
11
|
+
import { makeStandardSchemaV1Hooks as m, toLocalizedStandardSchemaV1 as h } from "./vue-components21.es.js";
|
|
12
|
+
import { useErrorLabel as g } from "./vue-components22.es.js";
|
|
13
|
+
import _ from "./vue-components38.es.js";
|
|
14
|
+
import v from "./vue-components40.es.js";
|
|
15
|
+
import y from "./vue-components42.es.js";
|
|
16
|
+
import b from "./vue-components44.es.js";
|
|
17
|
+
import { FormErrors as x } from "./vue-components71.es.js";
|
|
18
|
+
import { OmegaFormKey as S, useOmegaForm as C } from "./vue-components72.es.js";
|
|
19
|
+
import { createUseFormWithCustomInput as w } from "./vue-components73.es.js";
|
|
20
|
+
import { duplicateSchema as T } from "./vue-components74.es.js";
|
|
21
|
+
//#region src/components/index.ts
|
|
22
|
+
var E = /* @__PURE__ */ e({
|
|
23
|
+
CommandButton: () => t,
|
|
24
|
+
Dialog: () => i,
|
|
25
|
+
FixedNuxtErrorBoundary: () => a,
|
|
26
|
+
FormErrors: () => x,
|
|
27
|
+
OmegaFormKey: () => S,
|
|
28
|
+
OmegaInput: () => v,
|
|
29
|
+
OmegaTaggedUnion: () => b,
|
|
30
|
+
OmegaTaggedUnionInternal: () => y,
|
|
31
|
+
OmegaVuetifyInput: () => _,
|
|
32
|
+
createMeta: () => s,
|
|
33
|
+
createUseFormWithCustomInput: () => w,
|
|
34
|
+
deepMerge: () => p,
|
|
35
|
+
defaultsValueFromSchema: () => d,
|
|
36
|
+
duplicateSchema: () => T,
|
|
37
|
+
generateMetaFromSchema: () => c,
|
|
38
|
+
getInputType: () => o,
|
|
39
|
+
isNullableOrUndefined: () => l,
|
|
40
|
+
makeStandardSchemaV1Hooks: () => m,
|
|
41
|
+
metadataFromAst: () => u,
|
|
42
|
+
toFormSchema: () => f,
|
|
43
|
+
toLocalizedStandardSchemaV1: () => h,
|
|
44
|
+
useErrorLabel: () => g,
|
|
45
|
+
useOmegaForm: () => C,
|
|
46
|
+
useOnClose: () => n,
|
|
47
|
+
usePreventClose: () => r
|
|
48
|
+
});
|
|
49
|
+
//#endregion
|
|
50
|
+
export { E as components_exports };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effect-app/vue-components",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.317",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/effect-app/libs.git",
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
"highlight.js": "^11.11.1",
|
|
63
63
|
"mitt": "^3.0.1",
|
|
64
64
|
"vue3-highlightjs": "^1.0.5",
|
|
65
|
-
"@effect-app/vue": "4.0.0-beta.
|
|
66
|
-
"effect-app": "4.0.0-beta.
|
|
65
|
+
"@effect-app/vue": "4.0.0-beta.317",
|
|
66
|
+
"effect-app": "4.0.0-beta.317"
|
|
67
67
|
},
|
|
68
68
|
"scripts": {
|
|
69
69
|
"check": "vue-tsc",
|
|
@@ -91,7 +91,9 @@
|
|
|
91
91
|
silently withholds out-of-range values from the model (so schema errors
|
|
92
92
|
would never show) and clamps on blur. Validation stays schema-driven; the
|
|
93
93
|
bounds are exposed to AT via the spinbutton ARIA attrs, which fall through
|
|
94
|
-
to the native input.
|
|
94
|
+
to the native input. Same reasoning for precision: Vuetify's default (0)
|
|
95
|
+
would silently block decimals, so it's forced to null and typing 1.5 into
|
|
96
|
+
an int field shows the schema error instead. -->
|
|
95
97
|
<v-number-input
|
|
96
98
|
v-if="inputProps.type === 'number'"
|
|
97
99
|
:id="inputProps.id"
|
|
@@ -104,10 +106,11 @@
|
|
|
104
106
|
:label="inputProps.label"
|
|
105
107
|
:error-messages="inputProps.errorMessages"
|
|
106
108
|
:error="inputProps.error"
|
|
107
|
-
:precision="
|
|
109
|
+
:precision="null"
|
|
108
110
|
control-variant="stacked"
|
|
109
111
|
v-bind="$attrs"
|
|
110
112
|
:model-value="state.value as any"
|
|
113
|
+
@beforeinput.capture="onNumberBeforeinput"
|
|
111
114
|
@update:model-value="(v: number | null) => field.handleChange((v ?? undefined) as any)"
|
|
112
115
|
>
|
|
113
116
|
<template
|
|
@@ -270,7 +273,9 @@
|
|
|
270
273
|
generic="From extends Record<PropertyKey, any>, Name extends DeepKeys<From>"
|
|
271
274
|
>
|
|
272
275
|
import { type DeepKeys } from "@tanstack/vue-form"
|
|
273
|
-
import { computed, watchEffect } from "vue"
|
|
276
|
+
import { computed, useAttrs, watchEffect } from "vue"
|
|
277
|
+
import { useLocale } from "vuetify"
|
|
278
|
+
import { handleDecimalSeparatorBeforeinput } from "./decimalSeparatorInput"
|
|
274
279
|
import type { VuetifyInputProps } from "./InputProps"
|
|
275
280
|
import { getInputType } from "./inputs"
|
|
276
281
|
import { typeOverrides } from "./types"
|
|
@@ -286,6 +291,26 @@ defineOptions({
|
|
|
286
291
|
inheritAttrs: false
|
|
287
292
|
})
|
|
288
293
|
|
|
294
|
+
const attrs = useAttrs()
|
|
295
|
+
// useLocale throws outside a Vuetify app (e.g. tests mounting with stubbed
|
|
296
|
+
// vuetify components); numbers then fall back to the "." separator.
|
|
297
|
+
const localeDecimalSeparator = (() => {
|
|
298
|
+
try {
|
|
299
|
+
return useLocale().decimalSeparator
|
|
300
|
+
} catch {
|
|
301
|
+
return undefined
|
|
302
|
+
}
|
|
303
|
+
})()
|
|
304
|
+
|
|
305
|
+
// Mirrors VNumberInput's own resolution: an explicit decimal-separator attr
|
|
306
|
+
// wins, otherwise the locale decides.
|
|
307
|
+
const decimalSeparator = computed(() => {
|
|
308
|
+
const explicit = (attrs["decimal-separator"] ?? attrs["decimalSeparator"]) as string | undefined
|
|
309
|
+
return explicit?.[0] || localeDecimalSeparator?.value || "."
|
|
310
|
+
})
|
|
311
|
+
|
|
312
|
+
const onNumberBeforeinput = (e: Event) => handleDecimalSeparatorBeforeinput(e as InputEvent, decimalSeparator.value)
|
|
313
|
+
|
|
289
314
|
// True when no dedicated branch handles `inputProps.type` (it's outside the
|
|
290
315
|
// built-in `typeOverrides`): the fallback text input renders and we warn.
|
|
291
316
|
const isUnhandledType = computed(() => !(typeOverrides as readonly string[]).includes(props.inputProps.type))
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const escapeForRegex = (s: string) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* VNumberInput only accepts the active decimal separator and silently drops
|
|
5
|
+
* the other one while typing. Attached in capture phase on the component
|
|
6
|
+
* root, this handler lets users type either "." or ",": the wrong character
|
|
7
|
+
* is translated to the active separator before Vuetify's own beforeinput
|
|
8
|
+
* filter can reject it.
|
|
9
|
+
*
|
|
10
|
+
* No validation beyond Vuetify's own single-separator typing rule: OmegaForm
|
|
11
|
+
* deliberately lets out-of-schema values through so schema errors show,
|
|
12
|
+
* instead of silently blocking input (same reasoning as min/max not being
|
|
13
|
+
* passed as props).
|
|
14
|
+
*/
|
|
15
|
+
export const handleDecimalSeparatorBeforeinput = (e: InputEvent, separator: string) => {
|
|
16
|
+
if (!e.data) return
|
|
17
|
+
// The active separator may be any single char (locale or explicit prop,
|
|
18
|
+
// e.g. "٫"); everything from [".", ","] that isn't it gets translated.
|
|
19
|
+
const wrongs = [".", ","].filter((c) => c !== separator)
|
|
20
|
+
if (!wrongs.some((c) => e.data!.includes(c))) return
|
|
21
|
+
|
|
22
|
+
const input = e.target as HTMLInputElement
|
|
23
|
+
e.preventDefault()
|
|
24
|
+
e.stopPropagation()
|
|
25
|
+
|
|
26
|
+
const data = wrongs.reduce((acc, c) => acc.replaceAll(c, separator), e.data)
|
|
27
|
+
const start = input.selectionStart ?? input.value.length
|
|
28
|
+
const end = input.selectionEnd ?? input.value.length
|
|
29
|
+
const next = input.value.slice(0, start) + data + input.value.slice(end)
|
|
30
|
+
// Mirrors Vuetify's own typing filter: at most one separator, "-" only at
|
|
31
|
+
// the start. A second separator would only produce an unparseable string.
|
|
32
|
+
if (!new RegExp(`^-?\\d*${escapeForRegex(separator)}?\\d*$`).test(next)) return
|
|
33
|
+
|
|
34
|
+
input.value = next
|
|
35
|
+
const cursor = start + data.length
|
|
36
|
+
input.setSelectionRange(cursor, cursor)
|
|
37
|
+
input.dispatchEvent(new Event("input", { bubbles: true }))
|
|
38
|
+
}
|