@effect-app/vue-components 4.0.0-beta.22 → 4.0.0-beta.221
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/README.md +13 -9
- package/dist/reset.css +39 -38
- package/dist/types/components/CommandButton.vue.d.ts +6 -4
- package/dist/types/components/OmegaForm/OmegaArray.vue.d.ts +1 -1
- package/dist/types/components/OmegaForm/OmegaAutoGen.vue.d.ts +2 -2
- package/dist/types/components/OmegaForm/OmegaErrorsInternal.vue.d.ts +1 -1
- package/dist/types/components/OmegaForm/OmegaFormInput.vue.d.ts +1 -1
- package/dist/types/components/OmegaForm/OmegaInput.vue.d.ts +1 -1
- package/dist/types/components/OmegaForm/OmegaInternalInput.vue.d.ts +2 -1
- package/dist/types/components/OmegaForm/OmegaWrapper.vue.d.ts +1 -1
- package/dist/types/components/OmegaForm/createUseFormWithCustomInput.d.ts +2 -2
- package/dist/types/components/OmegaForm/errors.d.ts +33 -0
- package/dist/types/components/OmegaForm/getOmegaStore.d.ts +1 -1
- package/dist/types/components/OmegaForm/hocs.d.ts +3 -0
- package/dist/types/components/OmegaForm/index.d.ts +13 -3
- package/dist/types/components/OmegaForm/inputs.d.ts +4 -0
- package/dist/types/components/OmegaForm/meta/checks.d.ts +4 -0
- package/dist/types/components/OmegaForm/meta/createMeta.d.ts +33 -0
- package/dist/types/components/OmegaForm/meta/defaults.d.ts +2 -0
- package/dist/types/components/OmegaForm/meta/redacted.d.ts +2 -0
- package/dist/types/components/OmegaForm/meta/types.d.ts +56 -0
- package/dist/types/components/OmegaForm/meta/walker.d.ts +18 -0
- package/dist/types/components/OmegaForm/persistency.d.ts +58 -0
- package/dist/types/components/OmegaForm/submit.d.ts +60 -0
- package/dist/types/components/OmegaForm/types.d.ts +283 -0
- package/dist/types/components/OmegaForm/useOmegaForm.d.ts +7 -213
- package/dist/types/components/OmegaForm/validation/localized.d.ts +10 -0
- package/dist/types/index.d.ts +0 -1
- package/dist/types/utils/index.d.ts +8 -8
- package/dist/vue-components.es.js +29 -44
- package/dist/vue-components10.es.js +5 -0
- package/dist/vue-components100.es.js +269 -0
- package/dist/vue-components102.es.js +8 -0
- package/dist/vue-components103.es.js +73 -0
- package/dist/vue-components104.es.js +5 -0
- package/dist/vue-components105.es.js +52 -0
- package/dist/vue-components106.es.js +5 -0
- package/dist/vue-components107.es.js +24 -0
- package/dist/vue-components108.es.js +5 -0
- package/dist/vue-components109.es.js +59 -0
- package/dist/vue-components11.es.js +20 -0
- package/dist/vue-components110.es.js +5 -0
- package/dist/vue-components111.es.js +12 -0
- package/dist/vue-components112.es.js +22 -0
- package/dist/vue-components114.es.js +9 -0
- package/dist/vue-components115.es.js +4 -0
- package/dist/vue-components116.es.js +38 -0
- package/dist/vue-components117.es.js +27 -0
- package/dist/vue-components118.es.js +28 -0
- package/dist/vue-components119.es.js +7 -0
- package/dist/vue-components12.es.js +27 -0
- package/dist/vue-components120.es.js +18 -0
- package/dist/vue-components121.es.js +36 -0
- package/dist/vue-components122.es.js +18 -0
- package/dist/vue-components123.es.js +21 -0
- package/dist/vue-components124.es.js +30 -0
- package/dist/vue-components125.es.js +7 -0
- package/dist/vue-components126.es.js +9 -0
- package/dist/vue-components127.es.js +38 -0
- package/dist/vue-components128.es.js +25 -0
- package/dist/vue-components129.es.js +128 -0
- package/dist/vue-components13.es.js +70 -0
- package/dist/vue-components130.es.js +24 -0
- package/dist/vue-components131.es.js +21 -0
- package/dist/vue-components132.es.js +9 -0
- package/dist/vue-components133.es.js +19 -0
- package/dist/vue-components134.es.js +5 -0
- package/dist/vue-components135.es.js +29 -0
- package/dist/vue-components136.es.js +5 -0
- package/dist/vue-components137.es.js +43 -0
- package/dist/vue-components138.es.js +82 -0
- package/dist/vue-components139.es.js +33 -0
- package/dist/vue-components14.es.js +15 -0
- package/dist/vue-components140.es.js +19 -0
- package/dist/vue-components141.es.js +48 -0
- package/dist/vue-components15.es.js +29 -0
- package/dist/vue-components16.es.js +53 -0
- package/dist/vue-components17.es.js +87 -0
- package/dist/vue-components18.es.js +4 -0
- package/dist/vue-components19.es.js +4 -0
- package/dist/vue-components2.es.js +20 -0
- package/dist/vue-components20.es.js +19 -0
- package/dist/vue-components21.es.js +73 -0
- package/dist/vue-components22.es.js +14 -0
- package/dist/vue-components23.es.js +26 -0
- package/dist/vue-components24.es.js +252 -0
- package/dist/vue-components25.es.js +65 -0
- package/dist/vue-components26.es.js +68 -0
- package/dist/vue-components27.es.js +8 -0
- package/dist/vue-components28.es.js +12 -0
- package/dist/vue-components29.es.js +6 -0
- package/dist/vue-components3.es.js +86 -0
- package/dist/vue-components30.es.js +28 -0
- package/dist/vue-components31.es.js +75 -0
- package/dist/vue-components32.es.js +109 -0
- package/dist/vue-components33.es.js +57 -0
- package/dist/vue-components34.es.js +7 -0
- package/dist/vue-components35.es.js +4 -0
- package/dist/vue-components36.es.js +6 -0
- package/dist/vue-components37.es.js +688 -0
- package/dist/vue-components38.es.js +7 -0
- package/dist/vue-components39.es.js +5 -0
- package/dist/vue-components4.es.js +5 -0
- package/dist/vue-components40.es.js +6 -0
- package/dist/vue-components41.es.js +27 -0
- package/dist/vue-components42.es.js +5 -0
- package/dist/vue-components43.es.js +48 -0
- package/dist/vue-components44.es.js +70 -0
- package/dist/vue-components45.es.js +9 -0
- package/dist/vue-components46.es.js +10 -0
- package/dist/vue-components47.es.js +8 -0
- package/dist/vue-components48.es.js +173 -0
- package/dist/vue-components49.es.js +14 -0
- package/dist/vue-components5.es.js +24 -0
- package/dist/vue-components50.es.js +11 -0
- package/dist/vue-components51.es.js +4 -0
- package/dist/vue-components52.es.js +7 -0
- package/dist/vue-components53.es.js +29 -0
- package/dist/vue-components54.es.js +221 -0
- package/dist/vue-components55.es.js +85 -0
- package/dist/vue-components56.es.js +74 -0
- package/dist/vue-components57.es.js +819 -0
- package/dist/vue-components58.es.js +4 -0
- package/dist/vue-components59.es.js +109 -0
- package/dist/vue-components6.es.js +13 -0
- package/dist/vue-components60.es.js +54 -0
- package/dist/vue-components61.es.js +520 -0
- package/dist/vue-components62.es.js +440 -0
- package/dist/vue-components63.es.js +10 -0
- package/dist/vue-components64.es.js +13 -0
- package/dist/vue-components65.es.js +19 -0
- package/dist/vue-components66.es.js +29 -0
- package/dist/vue-components67.es.js +22 -0
- package/dist/vue-components68.es.js +30 -0
- package/dist/vue-components69.es.js +29 -0
- package/dist/vue-components7.es.js +13 -0
- package/dist/vue-components70.es.js +73 -0
- package/dist/vue-components71.es.js +6 -0
- package/dist/vue-components72.es.js +18 -0
- package/dist/vue-components73.es.js +5 -0
- package/dist/vue-components74.es.js +70 -0
- package/dist/vue-components75.es.js +140 -0
- package/dist/vue-components76.es.js +4 -0
- package/dist/vue-components77.es.js +21 -0
- package/dist/vue-components78.es.js +55 -0
- package/dist/vue-components79.es.js +9 -0
- package/dist/vue-components8.es.js +35 -0
- package/dist/vue-components80.es.js +16 -0
- package/dist/vue-components81.es.js +39 -0
- package/dist/vue-components82.es.js +49 -0
- package/dist/vue-components83.es.js +128 -0
- package/dist/vue-components84.es.js +65 -0
- package/dist/vue-components85.es.js +63 -0
- package/dist/vue-components86.es.js +25 -0
- package/dist/vue-components87.es.js +5 -0
- package/dist/vue-components88.es.js +80 -0
- package/dist/vue-components89.es.js +95 -0
- package/dist/vue-components9.es.js +47 -0
- package/dist/vue-components90.es.js +73 -0
- package/dist/vue-components91.es.js +12 -0
- package/dist/vue-components92.es.js +56 -0
- package/dist/vue-components93.es.js +5 -0
- package/dist/vue-components94.es.js +44 -0
- package/dist/vue-components95.es.js +5 -0
- package/dist/vue-components96.es.js +84 -0
- package/dist/vue-components98.es.js +8 -0
- package/dist/vue-components99.es.js +9 -0
- package/package.json +29 -29
- package/src/components/CommandButton.vue +55 -7
- package/src/components/OmegaForm/OmegaArray.vue +2 -4
- package/src/components/OmegaForm/OmegaAutoGen.vue +3 -2
- package/src/components/OmegaForm/OmegaErrorsInternal.vue +1 -1
- package/src/components/OmegaForm/OmegaFormInput.vue +1 -1
- package/src/components/OmegaForm/OmegaInput.vue +7 -36
- package/src/components/OmegaForm/OmegaInputVuetify.vue +5 -2
- package/src/components/OmegaForm/OmegaInternalInput.vue +12 -6
- package/src/components/OmegaForm/OmegaTaggedUnion.vue +2 -1
- package/src/components/OmegaForm/OmegaTaggedUnionInternal.vue +1 -1
- package/src/components/OmegaForm/OmegaWrapper.vue +1 -1
- package/src/components/OmegaForm/blockDialog.ts +18 -6
- package/src/components/OmegaForm/createUseFormWithCustomInput.ts +2 -1
- package/src/components/OmegaForm/errors.ts +136 -0
- package/src/components/OmegaForm/getOmegaStore.ts +1 -1
- package/src/components/OmegaForm/hocs.ts +19 -0
- package/src/components/OmegaForm/index.ts +16 -4
- package/src/components/OmegaForm/inputs.ts +22 -0
- package/src/components/OmegaForm/meta/checks.ts +82 -0
- package/src/components/OmegaForm/meta/createMeta.ts +140 -0
- package/src/components/OmegaForm/meta/defaults.ts +134 -0
- package/src/components/OmegaForm/meta/redacted.ts +66 -0
- package/src/components/OmegaForm/meta/types.ts +78 -0
- package/src/components/OmegaForm/meta/walker.ts +248 -0
- package/src/components/OmegaForm/persistency.ts +247 -0
- package/src/components/OmegaForm/submit.ts +131 -0
- package/src/components/OmegaForm/types.ts +753 -0
- package/src/components/OmegaForm/useOmegaForm.ts +59 -893
- package/src/components/OmegaForm/useRegisterField.ts +1 -1
- package/src/components/OmegaForm/validation/localized.ts +203 -0
- package/src/index.ts +0 -1
- package/src/reset.css +39 -38
- package/src/utils/index.ts +11 -8
- package/dist/types/components/OmegaForm/OmegaFormStuff.d.ts +0 -159
- package/dist/types/constants/index.d.ts +0 -1
- package/dist/vue-components.es10.js +0 -239
- package/dist/vue-components.es11.js +0 -32
- package/dist/vue-components.es12.js +0 -503
- package/dist/vue-components.es13.js +0 -49
- package/dist/vue-components.es14.js +0 -4
- package/dist/vue-components.es15.js +0 -4
- package/dist/vue-components.es16.js +0 -6
- package/dist/vue-components.es17.js +0 -13
- package/dist/vue-components.es18.js +0 -57
- package/dist/vue-components.es19.js +0 -56
- package/dist/vue-components.es2.js +0 -30
- package/dist/vue-components.es20.js +0 -8
- package/dist/vue-components.es21.js +0 -8
- package/dist/vue-components.es22.js +0 -5
- package/dist/vue-components.es23.js +0 -5
- package/dist/vue-components.es24.js +0 -4
- package/dist/vue-components.es25.js +0 -4
- package/dist/vue-components.es26.js +0 -4
- package/dist/vue-components.es27.js +0 -4
- package/dist/vue-components.es28.js +0 -19
- package/dist/vue-components.es29.js +0 -13
- package/dist/vue-components.es3.js +0 -17
- package/dist/vue-components.es30.js +0 -194
- package/dist/vue-components.es32.js +0 -31
- package/dist/vue-components.es33.js +0 -6
- package/dist/vue-components.es34.js +0 -4
- package/dist/vue-components.es35.js +0 -4
- package/dist/vue-components.es36.js +0 -113
- package/dist/vue-components.es38.js +0 -9
- package/dist/vue-components.es39.js +0 -34
- package/dist/vue-components.es4.js +0 -52
- package/dist/vue-components.es41.js +0 -6
- package/dist/vue-components.es42.js +0 -25
- package/dist/vue-components.es43.js +0 -7
- package/dist/vue-components.es44.js +0 -23
- package/dist/vue-components.es45.js +0 -32
- package/dist/vue-components.es46.js +0 -24
- package/dist/vue-components.es47.js +0 -14
- package/dist/vue-components.es48.js +0 -7
- package/dist/vue-components.es49.js +0 -21
- package/dist/vue-components.es5.js +0 -52
- package/dist/vue-components.es50.js +0 -11
- package/dist/vue-components.es51.js +0 -33
- package/dist/vue-components.es52.js +0 -50
- package/dist/vue-components.es53.js +0 -28
- package/dist/vue-components.es54.js +0 -13
- package/dist/vue-components.es55.js +0 -67
- package/dist/vue-components.es56.js +0 -58
- package/dist/vue-components.es57.js +0 -19
- package/dist/vue-components.es58.js +0 -35
- package/dist/vue-components.es59.js +0 -31
- package/dist/vue-components.es6.js +0 -69
- package/dist/vue-components.es60.js +0 -44
- package/dist/vue-components.es61.js +0 -4
- package/dist/vue-components.es62.js +0 -46
- package/dist/vue-components.es63.js +0 -4
- package/dist/vue-components.es7.js +0 -83
- package/dist/vue-components.es8.js +0 -63
- package/dist/vue-components.es9.js +0 -21
- package/src/components/OmegaForm/OmegaFormStuff.ts +0 -1276
- package/src/constants/index.ts +0 -1
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Number as e, mapInput as t } from "./vue-components27.es.js";
|
|
2
|
+
import { Fragment as n, computed as r, createElementBlock as i, createVNode as a, defineComponent as o, mergeProps as s, openBlock as c, renderList as l, renderSlot as u, unref as d } from "vue";
|
|
3
|
+
//#region src/components/OmegaForm/OmegaAutoGen.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var f = /* @__PURE__ */ o({
|
|
5
|
+
__name: "OmegaAutoGen",
|
|
6
|
+
props: {
|
|
7
|
+
form: {},
|
|
8
|
+
pick: {},
|
|
9
|
+
omit: {},
|
|
10
|
+
labelMap: { type: Function },
|
|
11
|
+
filterMap: { type: Function },
|
|
12
|
+
order: {},
|
|
13
|
+
sort: {}
|
|
14
|
+
},
|
|
15
|
+
setup(o) {
|
|
16
|
+
let f = (e) => (t) => Object.fromEntries(Object.entries(t).map(([t, n]) => [t, e(n, t)])), p = (e) => (t) => Object.fromEntries(Object.entries(t).filter(([t, n]) => e(n, t))), m = (e) => (t) => Object.entries(t).reduce((t, [n, r]) => {
|
|
17
|
+
let i = e(r, n);
|
|
18
|
+
return i !== !1 && (t[n] = i), t;
|
|
19
|
+
}, {}), h = o, g = (e, t) => {
|
|
20
|
+
let n = t?.indexOf(e) ?? -1;
|
|
21
|
+
return n === -1 ? 2 ** 53 - 1 : n;
|
|
22
|
+
}, _ = t(e, (e) => g(e.name, h.order || [])), v = r(() => {
|
|
23
|
+
let e = p((e, t) => !!e && (h.pick ? h.pick.includes(t) && !h.omit?.includes(t) : !h.omit?.includes(t)))(h.form.meta), t = f((e, t) => ({
|
|
24
|
+
name: t,
|
|
25
|
+
label: h.labelMap?.(t) || t,
|
|
26
|
+
...e
|
|
27
|
+
}))(e), n = h.filterMap ? m((e) => {
|
|
28
|
+
let t = h.filterMap?.(e.name, e);
|
|
29
|
+
return t === void 0 || t === !0 ? e : t;
|
|
30
|
+
})(t) : t, r = [...Object.values(n)].sort(_);
|
|
31
|
+
return h.sort ? r.sort(h.sort) : r;
|
|
32
|
+
});
|
|
33
|
+
return (e, t) => (c(!0), i(n, null, l(v.value, ({ name: t, label: n, ...r }) => u(e.$slots, "default", { child: {
|
|
34
|
+
name: t,
|
|
35
|
+
label: n,
|
|
36
|
+
...r
|
|
37
|
+
} }, () => [a(d(o.form).Input, s({
|
|
38
|
+
name: t,
|
|
39
|
+
label: n
|
|
40
|
+
}, { ref_for: !0 }, r), null, 16, ["name", "label"])])), 256));
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
//#endregion
|
|
44
|
+
export { f as default };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { useIntl as e } from "./vue-components6.es.js";
|
|
2
|
+
import { Fragment as t, Transition as n, computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, defineComponent as l, getCurrentInstance as u, guardReactiveProps as d, normalizeClass as f, normalizeProps as p, openBlock as m, renderList as h, renderSlot as g, resolveDynamicComponent as _, toDisplayString as v, unref as y, withCtx as b } from "vue";
|
|
3
|
+
//#region src/components/OmegaForm/OmegaErrorsInternal.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var x = {
|
|
5
|
+
key: 0,
|
|
6
|
+
class: "error-alert"
|
|
7
|
+
}, S = { class: "container" }, C = {
|
|
8
|
+
key: 0,
|
|
9
|
+
viewBox: "0 0 24 24",
|
|
10
|
+
fill: "none",
|
|
11
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
12
|
+
}, w = { class: "text-h6" }, T = {
|
|
13
|
+
key: 0,
|
|
14
|
+
class: "error-list"
|
|
15
|
+
}, E = ["for"], D = { key: 1 }, O = /* @__PURE__ */ l({
|
|
16
|
+
__name: "OmegaErrorsInternal",
|
|
17
|
+
props: {
|
|
18
|
+
generalErrors: {},
|
|
19
|
+
errors: {},
|
|
20
|
+
hideErrorDetails: { type: Boolean }
|
|
21
|
+
},
|
|
22
|
+
setup(l) {
|
|
23
|
+
let O = u()?.appContext.components.VAlert, k = l, { trans: A } = e(), j = r(() => k.generalErrors ? k.generalErrors.filter((e) => !!e).flatMap((e) => Object.values(e).filter((e) => !!e).flatMap((e) => e.filter((e) => !!e?.message).map((e) => e.message))) : []);
|
|
24
|
+
return (e, r) => (m(), i(n, null, {
|
|
25
|
+
default: b(() => [l.errors.length || j.value.length ? (m(), o("div", x, [g(e.$slots, "default", p(d({
|
|
26
|
+
errors: l.errors,
|
|
27
|
+
showedGeneralErrors: j.value
|
|
28
|
+
})), () => [(m(), i(_(y(O) ? "v-alert" : "div"), {
|
|
29
|
+
class: f([y(O) ? "mb-4" : "error-alert-content", "mb-4"]),
|
|
30
|
+
type: "error",
|
|
31
|
+
variant: "tonal",
|
|
32
|
+
role: "alert",
|
|
33
|
+
"aria-live": "polite"
|
|
34
|
+
}, {
|
|
35
|
+
default: b(() => [s("div", S, [g(e.$slots, "icon", {}, () => [y(O) ? a("", !0) : (m(), o("svg", C, [...r[0] ||= [
|
|
36
|
+
s("path", {
|
|
37
|
+
d: "M16 2H8L2 8V16L8 22H16L22 16V8L16 2Z",
|
|
38
|
+
stroke: "currentColor",
|
|
39
|
+
"stroke-width": "2",
|
|
40
|
+
"stroke-linecap": "round",
|
|
41
|
+
"stroke-linejoin": "round"
|
|
42
|
+
}, null, -1),
|
|
43
|
+
s("path", {
|
|
44
|
+
d: "M12 8V12",
|
|
45
|
+
stroke: "currentColor",
|
|
46
|
+
"stroke-width": "2",
|
|
47
|
+
"stroke-linecap": "round",
|
|
48
|
+
"stroke-linejoin": "round"
|
|
49
|
+
}, null, -1),
|
|
50
|
+
s("path", {
|
|
51
|
+
d: "M12 16.0195V16",
|
|
52
|
+
stroke: "currentColor",
|
|
53
|
+
"stroke-width": "2",
|
|
54
|
+
"stroke-linecap": "round",
|
|
55
|
+
"stroke-linejoin": "round"
|
|
56
|
+
}, null, -1)
|
|
57
|
+
]]))], !0), s("div", null, [s("div", w, v(y(A)("form.includes_error")) + ": ", 1), l.errors.length ? (m(), o("ul", T, [(m(!0), o(t, null, h(l.errors, (e) => (m(), o("li", {
|
|
58
|
+
key: e.inputId,
|
|
59
|
+
class: "error-item"
|
|
60
|
+
}, [s("div", null, [
|
|
61
|
+
s("label", {
|
|
62
|
+
for: e.inputId,
|
|
63
|
+
class: "error-link"
|
|
64
|
+
}, v(e.label), 9, E),
|
|
65
|
+
r[1] ||= c(" " + v(" ") + " ", -1),
|
|
66
|
+
l.hideErrorDetails ? a("", !0) : (m(), o("div", {
|
|
67
|
+
key: 0,
|
|
68
|
+
class: f(["error-message", e.errors.length < 2 && "single-error"])
|
|
69
|
+
}, [(m(), i(_(e.errors.length > 1 ? "ul" : "div"), { class: "error-list" }, {
|
|
70
|
+
default: b(() => [(m(!0), o(t, null, h(e.errors, (t) => (m(), i(_(e.errors.length > 1 ? "li" : "span"), { key: t }, {
|
|
71
|
+
default: b(() => [c(v(t), 1)]),
|
|
72
|
+
_: 2
|
|
73
|
+
}, 1024))), 128))]),
|
|
74
|
+
_: 2
|
|
75
|
+
}, 1024))], 2))
|
|
76
|
+
])]))), 128))])) : (m(), o("span", D, v(j.value[0]), 1))])])]),
|
|
77
|
+
_: 3
|
|
78
|
+
}, 8, ["class"]))], !0)])) : a("", !0)]),
|
|
79
|
+
_: 3
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
//#endregion
|
|
84
|
+
export { O as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
(function(){try{if(typeof document<`u`){var e=document.createElement(`style`);if(e.appendChild(document.createTextNode(`.v-enter-from[data-v-5278f8d3],.v-leave-to[data-v-5278f8d3]{opacity:0;grid-template-rows:0fr;max-height:0}.v-enter-active[data-v-5278f8d3],.v-leave-active[data-v-5278f8d3]{transition:all .15s;display:grid}.v-enter-to[data-v-5278f8d3],.v-leave-from[data-v-5278f8d3]{opacity:1;grid-template-rows:1fr;max-height:50vh}.error-alert[data-v-5278f8d3]{transition-behavior:allow-discrete;min-height:0;display:grid;overflow:hidden}.error-alert>[data-v-5278f8d3]{min-height:0}.error-list[data-v-5278f8d3]{list-style-position:inside}.error-list [data-v-5278f8d3]::marker{margin:0;padding:0}.error-alert-content[data-v-5278f8d3]{background-color:var(--error-background,#fff5f5);color:var(--error-color,#c92a2a);padding:1em}.error-link[data-v-5278f8d3]{color:var(--error-color,#c92a2a);cursor:pointer;font-weight:700;position:relative}.error-link[data-v-5278f8d3]:after{content:"";background:rgba(from var(--error-color,#c92a2a) r g b / .5);height:1px;position:absolute;bottom:0;left:0;right:0}.text-h6[data-v-5278f8d3]{font-size:1.25em;font-weight:700}.error-message[data-v-5278f8d3]{font-style:italic}.error-item[data-v-5278f8d3]{margin-bottom:.5em;overflow:hidden}.error-item>div[data-v-5278f8d3]{float:right;width:100%;max-width:calc(100% - 1.5em)}.container[data-v-5278f8d3]{gap:1.5em;display:flex}.container svg[data-v-5278f8d3]{width:3em}.container .single-error[data-v-5278f8d3]{display:inline-block}`)),document.head.appendChild(e),window.customElements){let e=window.customElements.define;window.customElements.define=function(t,n){let r=n.prototype.connectedCallback;return n.prototype.connectedCallback=function(){if(r&&r.call(this),this.shadowRoot){let e=document.createElement(`style`);e.appendChild(document.createTextNode(`.v-enter-from[data-v-5278f8d3],.v-leave-to[data-v-5278f8d3]{opacity:0;grid-template-rows:0fr;max-height:0}.v-enter-active[data-v-5278f8d3],.v-leave-active[data-v-5278f8d3]{transition:all .15s;display:grid}.v-enter-to[data-v-5278f8d3],.v-leave-from[data-v-5278f8d3]{opacity:1;grid-template-rows:1fr;max-height:50vh}.error-alert[data-v-5278f8d3]{transition-behavior:allow-discrete;min-height:0;display:grid;overflow:hidden}.error-alert>[data-v-5278f8d3]{min-height:0}.error-list[data-v-5278f8d3]{list-style-position:inside}.error-list [data-v-5278f8d3]::marker{margin:0;padding:0}.error-alert-content[data-v-5278f8d3]{background-color:var(--error-background,#fff5f5);color:var(--error-color,#c92a2a);padding:1em}.error-link[data-v-5278f8d3]{color:var(--error-color,#c92a2a);cursor:pointer;font-weight:700;position:relative}.error-link[data-v-5278f8d3]:after{content:"";background:rgba(from var(--error-color,#c92a2a) r g b / .5);height:1px;position:absolute;bottom:0;left:0;right:0}.text-h6[data-v-5278f8d3]{font-size:1.25em;font-weight:700}.error-message[data-v-5278f8d3]{font-style:italic}.error-item[data-v-5278f8d3]{margin-bottom:.5em;overflow:hidden}.error-item>div[data-v-5278f8d3]{float:right;width:100%;max-width:calc(100% - 1.5em)}.container[data-v-5278f8d3]{gap:1.5em;display:flex}.container svg[data-v-5278f8d3]{width:3em}.container .single-error[data-v-5278f8d3]{display:inline-block}`)),this.shadowRoot.appendChild(e)}},e.call(window.customElements,t,n)}}}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();
|
|
2
|
+
(function(){try{if(typeof document<`u`){var e=document.createElement(`style`);if(e.appendChild(document.createTextNode(`.v-enter-from[data-v-5278f8d3],.v-leave-to[data-v-5278f8d3]{opacity:0;grid-template-rows:0fr;max-height:0}.v-enter-active[data-v-5278f8d3],.v-leave-active[data-v-5278f8d3]{transition:all .15s;display:grid}.v-enter-to[data-v-5278f8d3],.v-leave-from[data-v-5278f8d3]{opacity:1;grid-template-rows:1fr;max-height:50vh}.error-alert[data-v-5278f8d3]{transition-behavior:allow-discrete;min-height:0;display:grid;overflow:hidden}.error-alert>[data-v-5278f8d3]{min-height:0}.error-list[data-v-5278f8d3]{list-style-position:inside}.error-list [data-v-5278f8d3]::marker{margin:0;padding:0}.error-alert-content[data-v-5278f8d3]{background-color:var(--error-background,#fff5f5);color:var(--error-color,#c92a2a);padding:1em}.error-link[data-v-5278f8d3]{color:var(--error-color,#c92a2a);cursor:pointer;font-weight:700;position:relative}.error-link[data-v-5278f8d3]:after{content:"";background:rgba(from var(--error-color,#c92a2a) r g b / .5);height:1px;position:absolute;bottom:0;left:0;right:0}.text-h6[data-v-5278f8d3]{font-size:1.25em;font-weight:700}.error-message[data-v-5278f8d3]{font-style:italic}.error-item[data-v-5278f8d3]{margin-bottom:.5em;overflow:hidden}.error-item>div[data-v-5278f8d3]{float:right;width:100%;max-width:calc(100% - 1.5em)}.container[data-v-5278f8d3]{gap:1.5em;display:flex}.container svg[data-v-5278f8d3]{width:3em}.container .single-error[data-v-5278f8d3]{display:inline-block}`)),document.head.appendChild(e),window.customElements){let e=window.customElements.define;window.customElements.define=function(t,n){let r=n.prototype.connectedCallback;return n.prototype.connectedCallback=function(){if(r&&r.call(this),this.shadowRoot){let e=document.createElement(`style`);e.appendChild(document.createTextNode(`.v-enter-from[data-v-5278f8d3],.v-leave-to[data-v-5278f8d3]{opacity:0;grid-template-rows:0fr;max-height:0}.v-enter-active[data-v-5278f8d3],.v-leave-active[data-v-5278f8d3]{transition:all .15s;display:grid}.v-enter-to[data-v-5278f8d3],.v-leave-from[data-v-5278f8d3]{opacity:1;grid-template-rows:1fr;max-height:50vh}.error-alert[data-v-5278f8d3]{transition-behavior:allow-discrete;min-height:0;display:grid;overflow:hidden}.error-alert>[data-v-5278f8d3]{min-height:0}.error-list[data-v-5278f8d3]{list-style-position:inside}.error-list [data-v-5278f8d3]::marker{margin:0;padding:0}.error-alert-content[data-v-5278f8d3]{background-color:var(--error-background,#fff5f5);color:var(--error-color,#c92a2a);padding:1em}.error-link[data-v-5278f8d3]{color:var(--error-color,#c92a2a);cursor:pointer;font-weight:700;position:relative}.error-link[data-v-5278f8d3]:after{content:"";background:rgba(from var(--error-color,#c92a2a) r g b / .5);height:1px;position:absolute;bottom:0;left:0;right:0}.text-h6[data-v-5278f8d3]{font-size:1.25em;font-weight:700}.error-message[data-v-5278f8d3]{font-style:italic}.error-item[data-v-5278f8d3]{margin-bottom:.5em;overflow:hidden}.error-item>div[data-v-5278f8d3]{float:right;width:100%;max-width:calc(100% - 1.5em)}.container[data-v-5278f8d3]{gap:1.5em;display:flex}.container svg[data-v-5278f8d3]{width:3em}.container .single-error[data-v-5278f8d3]{display:inline-block}`)),this.shadowRoot.appendChild(e)}},e.call(window.customElements,t,n)}}}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();
|
|
3
|
+
import e from "./vue-components96.es.js";
|
|
4
|
+
|
|
5
|
+
import t from "./vue-components98.es.js";
|
|
6
|
+
//#region src/components/OmegaForm/OmegaErrorsInternal.vue
|
|
7
|
+
var n = /* @__PURE__ */ t(e, [["__scopeId", "data-v-5278f8d3"]]);
|
|
8
|
+
//#endregion
|
|
9
|
+
export { n as default };
|
package/package.json
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effect-app/vue-components",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.221",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@mdi/js": "^7.4.47",
|
|
6
|
-
"effect": "^4.0.0-beta.
|
|
7
|
-
"intl-messageformat": "^11.
|
|
6
|
+
"effect": "^4.0.0-beta.62",
|
|
7
|
+
"intl-messageformat": "^11.2.4",
|
|
8
8
|
"mdi-js": "^1.0.1",
|
|
9
9
|
"primeflex": "^4.0.0",
|
|
10
10
|
"primeicons": "^7.0.0",
|
|
11
|
-
"primevue": "^4.5.
|
|
12
|
-
"vue": "^3.5.
|
|
13
|
-
"vuetify": "^4.0.
|
|
11
|
+
"primevue": "^4.5.5",
|
|
12
|
+
"vue": "^3.5.34",
|
|
13
|
+
"vuetify": "^4.0.6"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@storybook/vue3": "^10.
|
|
17
|
-
"@storybook/vue3-vite": "^10.
|
|
18
|
-
"@types/node": "^25.
|
|
19
|
-
"@vitejs/plugin-vue": "^6.0.
|
|
20
|
-
"@vue/test-utils": "^2.4.
|
|
21
|
-
"@vueuse/core": "^14.
|
|
22
|
-
"
|
|
23
|
-
"jsdom": "^28.1.0",
|
|
16
|
+
"@storybook/vue3": "^10.3.6",
|
|
17
|
+
"@storybook/vue3-vite": "^10.3.6",
|
|
18
|
+
"@types/node": "^25.6.0",
|
|
19
|
+
"@vitejs/plugin-vue": "^6.0.6",
|
|
20
|
+
"@vue/test-utils": "^2.4.10",
|
|
21
|
+
"@vueuse/core": "^14.3.0",
|
|
22
|
+
"jsdom": "^29.1.1",
|
|
24
23
|
"rimraf": "^6.1.3",
|
|
25
|
-
"sass": "^1.
|
|
26
|
-
"storybook": "^10.
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"vite
|
|
24
|
+
"sass": "^1.99.0",
|
|
25
|
+
"storybook": "^10.3.6",
|
|
26
|
+
"storybook-vue3-router": "^7.0.0",
|
|
27
|
+
"typescript": "~6.0.3",
|
|
28
|
+
"vite": "^8.0.10",
|
|
29
|
+
"vite-plugin-css-injected-by-js": "^5.0.1",
|
|
30
30
|
"vitepress": "^1.6.4",
|
|
31
|
-
"vitest": "^4.
|
|
32
|
-
"vue-router": "^5.0.
|
|
31
|
+
"vitest": "^4.1.5",
|
|
32
|
+
"vue-router": "^5.0.6",
|
|
33
33
|
"vue-toastification": "^2.0.0-rc.5",
|
|
34
|
-
"vue-tsc": "^3.2.
|
|
35
|
-
"vuetify": "^4.0.
|
|
36
|
-
"@effect-app/eslint-shared-config": "0.
|
|
34
|
+
"vue-tsc": "^3.2.8",
|
|
35
|
+
"vuetify": "^4.0.6",
|
|
36
|
+
"@effect-app/eslint-shared-config": "0.6.0-beta.25"
|
|
37
37
|
},
|
|
38
38
|
"files": [
|
|
39
39
|
"src",
|
|
@@ -52,13 +52,13 @@
|
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@opentelemetry/api": "^1.9.
|
|
55
|
+
"@opentelemetry/api": "^1.9.1",
|
|
56
56
|
"@tanstack/vue-form": "^1.23.5",
|
|
57
57
|
"highlight.js": "^11.11.1",
|
|
58
58
|
"mitt": "^3.0.1",
|
|
59
59
|
"vue3-highlightjs": "^1.0.5",
|
|
60
|
-
"@effect-app/vue": "4.0.0-beta.
|
|
61
|
-
"effect-app": "4.0.0-beta.
|
|
60
|
+
"@effect-app/vue": "4.0.0-beta.221",
|
|
61
|
+
"effect-app": "4.0.0-beta.221"
|
|
62
62
|
},
|
|
63
63
|
"scripts": {
|
|
64
64
|
"check": "vue-tsc",
|
|
@@ -67,10 +67,10 @@
|
|
|
67
67
|
"docs:dev": "vitepress dev docs",
|
|
68
68
|
"docs:build": "vitepress build docs",
|
|
69
69
|
"docs:serve": "vitepress serve docs",
|
|
70
|
-
"lint": "NODE_OPTIONS=--max-old-space-size=8192 eslint src stories .storybook",
|
|
70
|
+
"lint": "oxlint --quiet --type-aware src stories && NODE_OPTIONS=--max-old-space-size=8192 ESLINT_TS=1 eslint --quiet src stories .storybook && pnpm exec dprint check --config ../../dprint.jsonc .",
|
|
71
71
|
"ncu": "ncu",
|
|
72
72
|
"clean": "rm -rf dist",
|
|
73
|
-
"lint-fix": "pnpm
|
|
73
|
+
"lint-fix": "oxlint --quiet --type-aware --fix src stories && NODE_OPTIONS=--max-old-space-size=8192 ESLINT_TS=1 eslint --quiet --fix src stories .storybook && pnpm exec dprint fmt --config ../../dprint.jsonc .",
|
|
74
74
|
"storybook": "storybook dev -p 6006",
|
|
75
75
|
"build-storybook": "storybook build",
|
|
76
76
|
"test": "vitest",
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<script
|
|
2
2
|
setup
|
|
3
3
|
lang="ts"
|
|
4
|
-
generic="I = never"
|
|
4
|
+
generic="I = never, RA = unknown, RE = unknown"
|
|
5
5
|
>
|
|
6
|
-
import type { CommandBase } from "@effect-app/vue"
|
|
6
|
+
import type { CommandBase, Progress } from "@effect-app/vue/makeClient"
|
|
7
|
+
import type * as AsyncResult from "effect/unstable/reactivity/AsyncResult"
|
|
7
8
|
import { computed } from "vue"
|
|
8
9
|
import type { VBtn } from "vuetify/components"
|
|
9
10
|
|
|
@@ -14,11 +15,11 @@ const props = defineProps<
|
|
|
14
15
|
& (
|
|
15
16
|
| {
|
|
16
17
|
input: NoInfer<I>
|
|
17
|
-
command: CommandBase<I>
|
|
18
|
+
command: CommandBase<I, any, RA, RE>
|
|
18
19
|
empty?: boolean
|
|
19
20
|
}
|
|
20
21
|
| {
|
|
21
|
-
command: CommandBase
|
|
22
|
+
command: CommandBase<any, any, RA, RE>
|
|
22
23
|
input?: undefined
|
|
23
24
|
empty?: boolean
|
|
24
25
|
}
|
|
@@ -26,12 +27,32 @@ const props = defineProps<
|
|
|
26
27
|
& {
|
|
27
28
|
disabled?: ButtonProps["disabled"]
|
|
28
29
|
title?: string // why isn't it part of VBtnProps??
|
|
30
|
+
mapProgress?: (result: AsyncResult.AsyncResult<RA, RE>) => Progress | undefined
|
|
29
31
|
}
|
|
30
32
|
& ButtonProps
|
|
31
33
|
>()
|
|
32
34
|
|
|
33
35
|
const isDisabled = computed(() => props.command.blocked || props.disabled)
|
|
34
36
|
|
|
37
|
+
const resolvedProgress = computed(() => {
|
|
38
|
+
if (props.mapProgress) {
|
|
39
|
+
const result = props.command.result
|
|
40
|
+
return result !== undefined ? props.mapProgress(result) : undefined
|
|
41
|
+
}
|
|
42
|
+
return props.command.progress
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
const progressText = computed(() => {
|
|
46
|
+
const p = resolvedProgress.value
|
|
47
|
+
if (p === undefined) return undefined
|
|
48
|
+
return typeof p === "string" ? p : p.text
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
const progressPercentage = computed(() => {
|
|
52
|
+
const p = resolvedProgress.value
|
|
53
|
+
return typeof p === "object" && p !== null ? p.percentage : undefined
|
|
54
|
+
})
|
|
55
|
+
|
|
35
56
|
const handleClick = () => {
|
|
36
57
|
// Block execution if button is disabled
|
|
37
58
|
if (isDisabled.value) {
|
|
@@ -41,7 +62,9 @@ const handleClick = () => {
|
|
|
41
62
|
const input = ("input" in props && props.input
|
|
42
63
|
? props.input
|
|
43
64
|
: undefined) as unknown as I
|
|
44
|
-
|
|
65
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- command.handle has a generic signature mismatched by erased input type
|
|
66
|
+
const handle = props.command.handle as any
|
|
67
|
+
handle(input)
|
|
45
68
|
}
|
|
46
69
|
</script>
|
|
47
70
|
<script lang="ts">
|
|
@@ -60,13 +83,25 @@ export default {
|
|
|
60
83
|
:class="{ 'v-btn--disabled': isDisabled }"
|
|
61
84
|
@click="handleClick"
|
|
62
85
|
>
|
|
86
|
+
<template
|
|
87
|
+
v-if="progressText !== undefined"
|
|
88
|
+
#loader
|
|
89
|
+
>
|
|
90
|
+
<v-progress-circular
|
|
91
|
+
:indeterminate="progressPercentage === undefined"
|
|
92
|
+
:model-value="progressPercentage"
|
|
93
|
+
size="20"
|
|
94
|
+
width="2"
|
|
95
|
+
/>
|
|
96
|
+
<span class="ml-2">{{ progressText }}</span>
|
|
97
|
+
</template>
|
|
63
98
|
<slot
|
|
64
99
|
:loading="command.waiting"
|
|
65
100
|
:disabled="isDisabled"
|
|
66
101
|
:label="command.label"
|
|
67
102
|
:title="title ?? command.action"
|
|
68
103
|
>
|
|
69
|
-
|
|
104
|
+
{{ command.label }}
|
|
70
105
|
</slot>
|
|
71
106
|
</v-btn>
|
|
72
107
|
<v-btn
|
|
@@ -77,5 +112,18 @@ export default {
|
|
|
77
112
|
:title="title ?? command.action"
|
|
78
113
|
:class="{ 'v-btn--disabled': isDisabled }"
|
|
79
114
|
@click="handleClick"
|
|
80
|
-
|
|
115
|
+
>
|
|
116
|
+
<template
|
|
117
|
+
v-if="progressText !== undefined"
|
|
118
|
+
#loader
|
|
119
|
+
>
|
|
120
|
+
<v-progress-circular
|
|
121
|
+
:indeterminate="progressPercentage === undefined"
|
|
122
|
+
:model-value="progressPercentage"
|
|
123
|
+
size="20"
|
|
124
|
+
width="2"
|
|
125
|
+
/>
|
|
126
|
+
<span class="ml-2">{{ progressText }}</span>
|
|
127
|
+
</template>
|
|
128
|
+
</v-btn>
|
|
81
129
|
</template>
|
|
@@ -12,9 +12,7 @@
|
|
|
12
12
|
:is="form.Field"
|
|
13
13
|
v-for="(_, i) of items"
|
|
14
14
|
:key="`${name}[${Number(i)}]`"
|
|
15
|
-
:name="
|
|
16
|
-
`${name}[${Number(i)}]` as DeepKeys<From>
|
|
17
|
-
"
|
|
15
|
+
:name="`${name}[${Number(i)}]` as DeepKeys<From>"
|
|
18
16
|
>
|
|
19
17
|
<template #default="{ field: subField, state: subState }">
|
|
20
18
|
<slot
|
|
@@ -46,7 +44,7 @@
|
|
|
46
44
|
>
|
|
47
45
|
import { type DeepKeys } from "@tanstack/vue-form"
|
|
48
46
|
import { computed, onMounted, provide } from "vue"
|
|
49
|
-
import { type OmegaArrayProps } from "./
|
|
47
|
+
import { type OmegaArrayProps } from "./types"
|
|
50
48
|
|
|
51
49
|
const props = defineProps<OmegaArrayProps<From, To, Name>>()
|
|
52
50
|
|
|
@@ -20,9 +20,10 @@
|
|
|
20
20
|
Name extends DeepKeys<From>"
|
|
21
21
|
>
|
|
22
22
|
import { type DeepKeys } from "@tanstack/vue-form"
|
|
23
|
-
import
|
|
23
|
+
import * as Order from "effect/Order"
|
|
24
24
|
import { computed } from "vue"
|
|
25
|
-
import { type FieldMeta
|
|
25
|
+
import { type FieldMeta } from "./meta/types"
|
|
26
|
+
import { type FieldPath, type OmegaAutoGenMeta, type OmegaInputProps } from "./types"
|
|
26
27
|
|
|
27
28
|
type NewMeta = OmegaAutoGenMeta<From, To, Name>
|
|
28
29
|
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
import type { StandardSchemaV1Issue } from "@tanstack/vue-form"
|
|
103
103
|
import { computed, getCurrentInstance } from "vue"
|
|
104
104
|
import { useIntl } from "../../utils"
|
|
105
|
-
import { type OmegaError } from "./
|
|
105
|
+
import { type OmegaError } from "./types"
|
|
106
106
|
|
|
107
107
|
const instance = getCurrentInstance()
|
|
108
108
|
const vuetified = instance?.appContext.components["VAlert"]
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
import { type DeepKeys } from "@tanstack/vue-form"
|
|
18
18
|
import { inject } from "vue"
|
|
19
19
|
import type { MergedInputProps } from "./InputProps"
|
|
20
|
-
import type { BaseProps, DefaultTypeProps, OmegaInputProps } from "./OmegaFormStuff"
|
|
21
20
|
import OmegaInput from "./OmegaInput.vue"
|
|
21
|
+
import type { BaseProps, DefaultTypeProps, OmegaInputProps } from "./types"
|
|
22
22
|
import { OmegaFormKey } from "./useOmegaForm"
|
|
23
23
|
|
|
24
24
|
const form = inject(OmegaFormKey) as unknown as OmegaInputProps<
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<component
|
|
3
3
|
:is="form.Field"
|
|
4
|
-
:key="fieldKey"
|
|
5
4
|
:name="name"
|
|
6
|
-
:validators="
|
|
7
|
-
onChange: schema,
|
|
8
|
-
...validators
|
|
9
|
-
}"
|
|
5
|
+
:validators="validators"
|
|
10
6
|
>
|
|
11
7
|
<template #default="{ field, state }">
|
|
12
8
|
<OmegaInternalInput
|
|
13
9
|
v-if="meta"
|
|
14
10
|
v-bind="{ ...$attrs, ...$props, inputClass: computedClass }"
|
|
15
|
-
:field="field"
|
|
11
|
+
:field="field as any"
|
|
16
12
|
:state="state"
|
|
17
13
|
:register="form.registerField"
|
|
18
14
|
:label="label ?? errori18n(propsName)"
|
|
@@ -40,12 +36,13 @@
|
|
|
40
36
|
lang="ts"
|
|
41
37
|
generic="From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>, Name extends DeepKeys<From>"
|
|
42
38
|
>
|
|
39
|
+
/* eslint-disable @typescript-eslint/no-explicit-any -- TanStack Form Field generic interop and slot prop typing */
|
|
43
40
|
import { type DeepKeys } from "@tanstack/vue-form"
|
|
44
41
|
import { computed, inject, type Ref, useAttrs } from "vue"
|
|
45
|
-
import {
|
|
46
|
-
import { type FieldMeta
|
|
42
|
+
import { useErrorLabel } from "./errors"
|
|
43
|
+
import { type FieldMeta } from "./meta/types"
|
|
47
44
|
import OmegaInternalInput from "./OmegaInternalInput.vue"
|
|
48
|
-
import {
|
|
45
|
+
import { type OmegaInputPropsBase } from "./types"
|
|
49
46
|
|
|
50
47
|
const props = defineProps<OmegaInputPropsBase<From, To, Name>>()
|
|
51
48
|
|
|
@@ -57,13 +54,10 @@ defineSlots<{
|
|
|
57
54
|
default?: (props: any) => any
|
|
58
55
|
}>()
|
|
59
56
|
|
|
60
|
-
defineOptions({
|
|
61
|
-
inheritAttrs: false
|
|
62
|
-
})
|
|
57
|
+
defineOptions({ inheritAttrs: false })
|
|
63
58
|
|
|
64
59
|
const attrs = useAttrs()
|
|
65
60
|
|
|
66
|
-
// Compute the class to use based on inputClass prop
|
|
67
61
|
const computedClass = computed(() => {
|
|
68
62
|
if (props.inputClass === null) return undefined
|
|
69
63
|
if (props.inputClass !== undefined) return props.inputClass
|
|
@@ -82,28 +76,5 @@ const meta = computed(() => {
|
|
|
82
76
|
return props.form.meta[propsName.value]
|
|
83
77
|
})
|
|
84
78
|
|
|
85
|
-
// Key to force Field re-mount when meta type changes (for TaggedUnion support)
|
|
86
|
-
const fieldKey = computed(() => {
|
|
87
|
-
const m = meta.value
|
|
88
|
-
if (!m) return propsName.value
|
|
89
|
-
// Include type and key constraints in the key so Field re-mounts when validation rules change
|
|
90
|
-
// Cast to any since not all FieldMeta variants have these properties
|
|
91
|
-
const fm = m as any
|
|
92
|
-
return `${propsName.value}-${fm.type}-${fm.minLength ?? ""}-${fm.maxLength ?? ""}-${fm.minimum ?? ""}-${
|
|
93
|
-
fm.maximum ?? ""
|
|
94
|
-
}`
|
|
95
|
-
})
|
|
96
|
-
|
|
97
|
-
// Call useIntl during setup to avoid issues when computed re-evaluates
|
|
98
|
-
const { trans } = useIntl()
|
|
99
|
-
|
|
100
|
-
const schema = computed(() => {
|
|
101
|
-
if (!meta.value) {
|
|
102
|
-
console.log(props.name, Object.keys(props.form.meta), props.form.meta)
|
|
103
|
-
throw new Error("Meta is undefined")
|
|
104
|
-
}
|
|
105
|
-
return generateInputStandardSchemaFromFieldMeta(meta.value, trans)
|
|
106
|
-
})
|
|
107
|
-
|
|
108
79
|
const errori18n = useErrorLabel(props.form)
|
|
109
80
|
</script>
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
3
|
class="omega-input"
|
|
4
|
-
@focusout="
|
|
4
|
+
@focusout="(e) => {
|
|
5
|
+
$emit('blur', e)
|
|
6
|
+
field.handleBlur()
|
|
7
|
+
}"
|
|
5
8
|
@focusin="$emit('focus', $event)"
|
|
6
9
|
>
|
|
7
10
|
<component
|
|
@@ -204,8 +207,8 @@
|
|
|
204
207
|
generic="From extends Record<PropertyKey, any>, Name extends DeepKeys<From>"
|
|
205
208
|
>
|
|
206
209
|
import { type DeepKeys } from "@tanstack/vue-form"
|
|
207
|
-
import { getInputType } from "../OmegaForm/OmegaFormStuff"
|
|
208
210
|
import type { VuetifyInputProps } from "./InputProps"
|
|
211
|
+
import { getInputType } from "./inputs"
|
|
209
212
|
|
|
210
213
|
defineProps<VuetifyInputProps<From, Name>>()
|
|
211
214
|
|
|
@@ -24,11 +24,13 @@
|
|
|
24
24
|
lang="ts"
|
|
25
25
|
generic="From extends Record<PropertyKey, any>, Name extends DeepKeys<From>"
|
|
26
26
|
>
|
|
27
|
+
/* eslint-disable @typescript-eslint/no-explicit-any -- TanStack Form / Vue attrs interop */
|
|
27
28
|
import { type DeepKeys, useStore } from "@tanstack/vue-form"
|
|
28
29
|
import { computed, type ComputedRef, getCurrentInstance, useAttrs, useId, useSlots } from "vue"
|
|
29
30
|
import type { InputProps, OmegaFieldInternalApi } from "./InputProps"
|
|
30
|
-
import type {
|
|
31
|
+
import type { MetaRecord, NestedKeyOf } from "./meta/types"
|
|
31
32
|
import OmegaInputVuetify from "./OmegaInputVuetify.vue"
|
|
33
|
+
import type { FieldValidators, TypeOverride } from "./types"
|
|
32
34
|
|
|
33
35
|
defineOptions({
|
|
34
36
|
inheritAttrs: false
|
|
@@ -84,7 +86,8 @@ const id = useId()
|
|
|
84
86
|
|
|
85
87
|
const fieldApi = props.field
|
|
86
88
|
|
|
87
|
-
|
|
89
|
+
// Subscribed for side-effect: keeps component reactive to fieldApi.store changes
|
|
90
|
+
const _fieldState = useStore(fieldApi.store, (state) => state)
|
|
88
91
|
|
|
89
92
|
// Get errors from form-level fieldMeta (persists across Field re-mounts)
|
|
90
93
|
const formFieldMeta = useStore(fieldApi.form.store, (state) => state.fieldMeta)
|
|
@@ -128,6 +131,13 @@ const handleChange: OmegaFieldInternalApi<From, Name>["handleChange"] = (value)
|
|
|
128
131
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
129
132
|
: null as any
|
|
130
133
|
)
|
|
134
|
+
} else if (props.meta?.isOptionalKey) {
|
|
135
|
+
// `S.optionalKey` expects the key to be ABSENT from the submitted
|
|
136
|
+
// object, not present-with-undefined. Remove it from form state
|
|
137
|
+
// rather than setting it to `undefined`. Note: this is distinct
|
|
138
|
+
// from `required: false`, which may also just mean "empty string
|
|
139
|
+
// is valid" for unconstrained `S.String` fields.
|
|
140
|
+
props.field.form.deleteField(props.field.name)
|
|
131
141
|
} else {
|
|
132
142
|
// Keep the actual value (e.g., empty string for S.String fields)
|
|
133
143
|
props.field.handleChange(value)
|
|
@@ -135,10 +145,6 @@ const handleChange: OmegaFieldInternalApi<From, Name>["handleChange"] = (value)
|
|
|
135
145
|
} else {
|
|
136
146
|
props.field.handleChange(value)
|
|
137
147
|
}
|
|
138
|
-
|
|
139
|
-
// whenever we change the field, regardless if we set it to null, we should reset onSubmit.
|
|
140
|
-
// not sure why this is not the case in tanstack form.
|
|
141
|
-
props.field.setMeta((m) => ({ ...m, errorMap: { ...m.errorMap, onSubmit: undefined } }))
|
|
142
148
|
}
|
|
143
149
|
|
|
144
150
|
// Note: Default value normalization (converting empty strings to null/undefined for nullable fields)
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
import { type DeepKeys } from "@tanstack/vue-form"
|
|
9
9
|
import { computed, provide, ref, watch } from "vue"
|
|
10
10
|
import { type TaggedUnionOption } from "./InputProps"
|
|
11
|
-
import { type FieldPath } from "./OmegaFormStuff"
|
|
12
11
|
import OmegaTaggedUnionInternal from "./OmegaTaggedUnionInternal.vue"
|
|
12
|
+
import { type FieldPath } from "./types"
|
|
13
13
|
import { type useOmegaForm } from "./useOmegaForm"
|
|
14
14
|
|
|
15
15
|
const props = defineProps<{
|
|
@@ -30,6 +30,7 @@ watch(
|
|
|
30
30
|
() => {
|
|
31
31
|
const path = tagPath.value
|
|
32
32
|
// Navigate to the nested value
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- traversing arbitrary nested values
|
|
33
34
|
return path.split(".").reduce((acc: any, key) => acc?.[key], formValues.value) as string | null
|
|
34
35
|
},
|
|
35
36
|
(newTag) => {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
import { useStore } from "@tanstack/vue-form"
|
|
31
31
|
import { usePreventClose } from "./blockDialog"
|
|
32
32
|
import { getOmegaStore } from "./getOmegaStore"
|
|
33
|
-
import { type DefaultTypeProps, type OmegaFormApi, type OmegaFormState } from "./
|
|
33
|
+
import { type DefaultTypeProps, type OmegaFormApi, type OmegaFormState } from "./types"
|
|
34
34
|
import { type OmegaFormReturn } from "./useOmegaForm"
|
|
35
35
|
|
|
36
36
|
type OmegaWrapperProps = {
|