@effect-app/vue-components 0.10.3 → 0.10.4
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/vue-components.es12.js +1 -1
- package/dist/vue-components.es16.js +42 -42
- package/dist/vue-components.es24.js +11 -99
- package/dist/vue-components.es25.js +90 -11
- package/dist/vue-components.es26.js +1 -1
- package/dist/vue-components.es29.js +1 -1
- package/dist/vue-components.es4.js +15 -15
- package/dist/vue-components.es5.js +30 -37
- package/dist/vue-components.es8.js +83 -91
- package/dist/vue-components.es9.js +93 -93
- package/package.json +23 -23
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as w, computed as f, onBeforeMount as E, watch as j, createElementBlock as v, openBlock as b, withModifiers as F, createElementVNode as M, unref as c, renderSlot as p, createCommentVNode as k, Fragment as V } from "vue";
|
|
2
2
|
import { useStore as g } from "@tanstack/vue-form";
|
|
3
|
-
import { getOmegaStore as B } from "./vue-components.
|
|
3
|
+
import { getOmegaStore as B } from "./vue-components.es24.js";
|
|
4
4
|
import { provideOmegaErrors as C } from "./vue-components.es7.js";
|
|
5
5
|
import { useOmegaForm as I } from "./vue-components.es8.js";
|
|
6
6
|
const $ = ["disabled"], N = /* @__PURE__ */ w({
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useOmegaErrors as
|
|
3
|
-
import { mdiLink as
|
|
4
|
-
import { useIntl as
|
|
5
|
-
const
|
|
1
|
+
import { defineComponent as E, getCurrentInstance as C, computed as x, createBlock as o, openBlock as r, Transition as B, withCtx as n, createElementBlock as d, createCommentVNode as b, unref as e, renderSlot as w, normalizeProps as I, guardReactiveProps as V, resolveDynamicComponent as a, normalizeClass as N, createElementVNode as u, toDisplayString as c, Fragment as v, renderList as g, createTextVNode as k } from "vue";
|
|
2
|
+
import { useOmegaErrors as O } from "./vue-components.es7.js";
|
|
3
|
+
import { mdiLink as z } from "@mdi/js";
|
|
4
|
+
import { useIntl as D } from "./vue-components.es3.js";
|
|
5
|
+
const G = {
|
|
6
6
|
key: 0,
|
|
7
7
|
class: "error-alert"
|
|
8
|
-
},
|
|
8
|
+
}, L = { class: "text-h6 mb-3" }, M = { class: "font-weight-medium" }, P = { class: "error-message" }, S = ["href"], T = { key: 1 }, H = /* @__PURE__ */ E({
|
|
9
9
|
__name: "OmegaErrors",
|
|
10
|
-
setup(
|
|
11
|
-
const m =
|
|
10
|
+
setup($) {
|
|
11
|
+
const m = C()?.appContext.components.VAlert, { errors: s, generalErrors: p, showErrors: y } = O(), { trans: _ } = D(), f = x(() => p.value ? p.value.filter(
|
|
12
12
|
(i) => !!i
|
|
13
13
|
).flatMap(
|
|
14
|
-
(i) => Object.values(i).filter((
|
|
15
|
-
(
|
|
16
|
-
(
|
|
17
|
-
).map((
|
|
14
|
+
(i) => Object.values(i).filter((l) => !!l).flatMap(
|
|
15
|
+
(l) => l.filter(
|
|
16
|
+
(t) => !!t?.message
|
|
17
|
+
).map((t) => t.message)
|
|
18
18
|
)
|
|
19
19
|
) : []);
|
|
20
|
-
return (i,
|
|
21
|
-
default:
|
|
22
|
-
e(
|
|
23
|
-
|
|
24
|
-
(
|
|
25
|
-
class:
|
|
20
|
+
return (i, l) => (r(), o(B, null, {
|
|
21
|
+
default: n(() => [
|
|
22
|
+
e(y) && (e(s).length || f.value.length) ? (r(), d("div", G, [
|
|
23
|
+
w(i.$slots, "default", I(V({ errors: e(s), showedGeneralErrors: f.value })), () => [
|
|
24
|
+
(r(), o(a(e(m) ? "v-alert" : "div"), {
|
|
25
|
+
class: N([e(m) ? "mb-4" : "error-alert-content", "mb-4"]),
|
|
26
26
|
type: "error",
|
|
27
27
|
variant: "tonal",
|
|
28
28
|
role: "alert",
|
|
29
29
|
"aria-live": "polite"
|
|
30
30
|
}, {
|
|
31
|
-
default:
|
|
32
|
-
|
|
33
|
-
e(
|
|
31
|
+
default: n(() => [
|
|
32
|
+
u("div", L, c(e(_)("form.includes_error")) + ":", 1),
|
|
33
|
+
e(s).length ? (r(), o(a(e(s).length > 1 ? "ul" : "div"), {
|
|
34
34
|
key: 0,
|
|
35
35
|
class: "error-list"
|
|
36
36
|
}, {
|
|
37
|
-
default:
|
|
38
|
-
(
|
|
39
|
-
key:
|
|
37
|
+
default: n(() => [
|
|
38
|
+
(r(!0), d(v, null, g(e(s), (t) => (r(), o(a(e(s).length > 1 ? "li" : "div"), {
|
|
39
|
+
key: t.inputId,
|
|
40
40
|
class: "error-item"
|
|
41
41
|
}, {
|
|
42
|
-
default:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
(
|
|
46
|
-
default:
|
|
47
|
-
(
|
|
48
|
-
default:
|
|
49
|
-
|
|
42
|
+
default: n(() => [
|
|
43
|
+
u("div", M, c(t.label), 1),
|
|
44
|
+
u("div", P, [
|
|
45
|
+
(r(), o(a(t.errors.length > 1 ? "ul" : "div"), { class: "error-list" }, {
|
|
46
|
+
default: n(() => [
|
|
47
|
+
(r(!0), d(v, null, g(t.errors, (h) => (r(), o(a(t.errors.length > 1 ? "li" : "span"), { key: h }, {
|
|
48
|
+
default: n(() => [
|
|
49
|
+
k(c(h), 1)
|
|
50
50
|
]),
|
|
51
51
|
_: 2
|
|
52
52
|
}, 1024))), 128))
|
|
@@ -54,33 +54,33 @@ const L = {
|
|
|
54
54
|
_: 2
|
|
55
55
|
}, 1024))
|
|
56
56
|
]),
|
|
57
|
-
|
|
58
|
-
href: `#${
|
|
57
|
+
u("a", {
|
|
58
|
+
href: `#${t.inputId}`,
|
|
59
59
|
class: "error-link"
|
|
60
60
|
}, [
|
|
61
|
-
(
|
|
62
|
-
icon: e(
|
|
61
|
+
(r(), o(a(e(m) ? "v-icon" : "i"), {
|
|
62
|
+
icon: e(z),
|
|
63
63
|
"aria-hidden": "true"
|
|
64
64
|
}, {
|
|
65
|
-
default:
|
|
66
|
-
|
|
65
|
+
default: n(() => l[0] || (l[0] = [
|
|
66
|
+
u("i", null, "🔗", -1)
|
|
67
67
|
])),
|
|
68
68
|
_: 1,
|
|
69
69
|
__: [0]
|
|
70
70
|
}, 8, ["icon"])),
|
|
71
|
-
|
|
72
|
-
], 8,
|
|
71
|
+
k(" " + c(e(_)("form.fix_input")), 1)
|
|
72
|
+
], 8, S)
|
|
73
73
|
]),
|
|
74
74
|
_: 2
|
|
75
75
|
}, 1024))), 128))
|
|
76
76
|
]),
|
|
77
77
|
_: 1
|
|
78
|
-
})) : (
|
|
78
|
+
})) : (r(), d("span", T, c(f.value[0]), 1))
|
|
79
79
|
]),
|
|
80
80
|
_: 1
|
|
81
81
|
}, 8, ["class"]))
|
|
82
82
|
], !0)
|
|
83
|
-
])) :
|
|
83
|
+
])) : b("", !0)
|
|
84
84
|
]),
|
|
85
85
|
_: 3
|
|
86
86
|
}));
|
|
@@ -1,101 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
field: {},
|
|
12
|
-
meta: {},
|
|
13
|
-
label: {},
|
|
14
|
-
options: {},
|
|
15
|
-
type: {},
|
|
16
|
-
validators: {}
|
|
17
|
-
},
|
|
18
|
-
setup(C) {
|
|
19
|
-
const t = C, o = L(), N = o == null ? void 0 : o.appContext.components.VTextField, s = P(), u = t.field, a = J(u.store, (e) => e), f = l(() => {
|
|
20
|
-
var e, r;
|
|
21
|
-
return t.type ? t.type : ((e = t.meta) == null ? void 0 : e.type) === "string" ? t.meta.format === "email" ? "email" : "string" : ((r = t.meta) == null ? void 0 : r.type) || "unknown";
|
|
22
|
-
}), n = l(() => a.value.value), $ = l(
|
|
23
|
-
() => (
|
|
24
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
25
|
-
a.value.meta.errors.map((e) => e == null ? void 0 : e.message).filter(Boolean)
|
|
26
|
-
)
|
|
27
|
-
), k = (e) => e == null || e === !1 || e === "" || Number.isNaN(e);
|
|
28
|
-
w(
|
|
29
|
-
() => !!n.value,
|
|
30
|
-
() => {
|
|
31
|
-
var e;
|
|
32
|
-
k(n.value) && ((e = t.meta) == null ? void 0 : e.type) !== "boolean" && F(() => {
|
|
33
|
-
var r;
|
|
34
|
-
u.setValue(
|
|
35
|
-
((r = t.meta) == null ? void 0 : r.nullableOrUndefined) === "undefined" ? void 0 : null
|
|
36
|
-
);
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
), x(() => {
|
|
40
|
-
var e, r;
|
|
41
|
-
!n.value && !((e = t.meta) != null && e.required) && ((r = t.meta) == null ? void 0 : r.nullableOrUndefined) === "null" && u.setValue(null);
|
|
42
|
-
});
|
|
43
|
-
const { addError: B, removeError: I, showErrors: O, showErrorsOn: _ } = K(), i = S(!1);
|
|
44
|
-
T(() => {
|
|
45
|
-
(O.value || _ === "onChange") && (i.value = !0);
|
|
46
|
-
});
|
|
47
|
-
const m = () => {
|
|
48
|
-
i.value = !0;
|
|
49
|
-
};
|
|
50
|
-
x(() => {
|
|
51
|
-
n.value && m();
|
|
52
|
-
});
|
|
53
|
-
const d = l(() => !i.value && f.value !== "select" ? [] : $.value);
|
|
54
|
-
w(
|
|
55
|
-
() => a.value.meta.errors,
|
|
56
|
-
() => {
|
|
57
|
-
a.value.meta.errors.length ? B({
|
|
58
|
-
inputId: s,
|
|
59
|
-
errors: a.value.meta.errors.map((e) => e.message).filter(Boolean),
|
|
60
|
-
label: t.label
|
|
61
|
-
}) : I(s);
|
|
62
|
-
}
|
|
63
|
-
);
|
|
64
|
-
const p = l(() => {
|
|
65
|
-
var e, r, c, v, g, y, h, b, E, V;
|
|
66
|
-
return {
|
|
67
|
-
id: s,
|
|
68
|
-
required: (e = t.meta) == null ? void 0 : e.required,
|
|
69
|
-
minLength: ((r = t.meta) == null ? void 0 : r.type) === "string" && ((c = t.meta) == null ? void 0 : c.minLength),
|
|
70
|
-
maxLength: ((v = t.meta) == null ? void 0 : v.type) === "string" && ((g = t.meta) == null ? void 0 : g.maxLength),
|
|
71
|
-
max: ((y = t.meta) == null ? void 0 : y.type) === "number" && ((h = t.meta) == null ? void 0 : h.maximum),
|
|
72
|
-
min: ((b = t.meta) == null ? void 0 : b.type) === "number" && ((E = t.meta) == null ? void 0 : E.minimum),
|
|
73
|
-
name: t.field.name,
|
|
74
|
-
modelValue: t.field.state.value,
|
|
75
|
-
errorMessages: d.value,
|
|
76
|
-
error: !!d.value.length,
|
|
77
|
-
field: t.field,
|
|
78
|
-
setRealDirty: m,
|
|
79
|
-
type: f.value,
|
|
80
|
-
label: `${t.label}${(V = t.meta) != null && V.required ? " *" : ""}`,
|
|
81
|
-
options: t.options
|
|
82
|
-
};
|
|
83
|
-
});
|
|
84
|
-
return (e, r) => z(e.$slots, "default", A(D(p.value)), () => [
|
|
85
|
-
M("div", {
|
|
86
|
-
class: R(e.$attrs.class),
|
|
87
|
-
onFocusout: m
|
|
88
|
-
}, [
|
|
89
|
-
j(N) ? (G(), U(Q, H({
|
|
90
|
-
key: 0,
|
|
91
|
-
"input-props": p.value
|
|
92
|
-
}, e.$attrs, {
|
|
93
|
-
"vuetify-value": p.value.field.state.value
|
|
94
|
-
}), null, 16, ["input-props", "vuetify-value"])) : Z("", !0)
|
|
95
|
-
], 34)
|
|
96
|
-
]);
|
|
97
|
-
}
|
|
98
|
-
});
|
|
1
|
+
import { useStore as u } from "@tanstack/vue-form";
|
|
2
|
+
import { computed as f } from "vue";
|
|
3
|
+
function c(o, t) {
|
|
4
|
+
return f(() => t ? u(o.store, (n) => {
|
|
5
|
+
const r = {};
|
|
6
|
+
for (const e of t)
|
|
7
|
+
r[e] = n[e];
|
|
8
|
+
return r;
|
|
9
|
+
}).value : {});
|
|
10
|
+
}
|
|
99
11
|
export {
|
|
100
|
-
|
|
12
|
+
c as getOmegaStore
|
|
101
13
|
};
|
|
@@ -1,13 +1,92 @@
|
|
|
1
|
-
|
|
2
|
-
import { computed as f } from "vue";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var i=document.createElement("style");if(i.appendChild(document.createTextNode(".omega-input .v-input__details:has(.v-messages:empty){grid-template-rows:0fr;transition:all .2s}.omega-input .v-messages:empty{min-height:0}.omega-input .v-input__details:has(.v-messages){transition:all .2s;overflow:hidden;min-height:0;display:grid;grid-template-rows:1fr}.omega-input .v-messages{transition:all .2s}.omega-input .v-messages>*{transition-duration:0s!important}.omega-input [role=alert]:has(.v-messages:empty){padding:0}.omega-input .v-btn{cursor:pointer;width:auto;appearance:none;box-shadow:none;display:block;min-width:auto;height:auto;padding:.5em .5em .5em 1em}")),document.head.appendChild(i),window.customElements){const e=window.customElements.define;window.customElements.define=function(s,t){const n=t.prototype.connectedCallback;return t.prototype.connectedCallback=function(){if(n&&n.call(this),this.shadowRoot){const a=document.createElement("style");a.appendChild(document.createTextNode(".omega-input .v-input__details:has(.v-messages:empty){grid-template-rows:0fr;transition:all .2s}.omega-input .v-messages:empty{min-height:0}.omega-input .v-input__details:has(.v-messages){transition:all .2s;overflow:hidden;min-height:0;display:grid;grid-template-rows:1fr}.omega-input .v-messages{transition:all .2s}.omega-input .v-messages>*{transition-duration:0s!important}.omega-input [role=alert]:has(.v-messages:empty){padding:0}.omega-input .v-btn{cursor:pointer;width:auto;appearance:none;box-shadow:none;display:block;min-width:auto;height:auto;padding:.5em .5em .5em 1em}")),this.shadowRoot.appendChild(a)}},e.call(window.customElements,s,t)}}}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
|
+
import { defineComponent as w, getCurrentInstance as x, useId as C, computed as a, watch as f, nextTick as N, onMounted as d, ref as $, watchEffect as k, renderSlot as B, normalizeProps as I, guardReactiveProps as O, createElementVNode as _, normalizeClass as q, createBlock as L, createCommentVNode as P, unref as F, openBlock as S, mergeProps as T } from "vue";
|
|
3
|
+
import { useStore as z } from "@tanstack/vue-form";
|
|
4
|
+
import { useOmegaErrors as A } from "./vue-components.es7.js";
|
|
5
|
+
import D from "./vue-components.es27.js";
|
|
6
|
+
|
|
7
|
+
const J = /* @__PURE__ */ w({
|
|
8
|
+
inheritAttrs: !1,
|
|
9
|
+
__name: "OmegaInternalInput",
|
|
10
|
+
props: {
|
|
11
|
+
field: {},
|
|
12
|
+
meta: {},
|
|
13
|
+
label: {},
|
|
14
|
+
options: {},
|
|
15
|
+
type: {},
|
|
16
|
+
validators: {}
|
|
17
|
+
},
|
|
18
|
+
setup(c) {
|
|
19
|
+
const e = c, v = x()?.appContext.components.VTextField, l = C(), o = e.field, r = z(o.store, (t) => t), m = a(() => e.type ? e.type : e.meta?.type === "string" ? e.meta.format === "email" ? "email" : "string" : e.meta?.type || "unknown"), n = a(() => r.value.value), g = a(
|
|
20
|
+
() => (
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
|
+
r.value.meta.errors.map((t) => t?.message).filter(Boolean)
|
|
23
|
+
)
|
|
24
|
+
), y = (t) => t == null || t === !1 || t === "" || Number.isNaN(t);
|
|
25
|
+
f(
|
|
26
|
+
() => !!n.value,
|
|
27
|
+
() => {
|
|
28
|
+
y(n.value) && e.meta?.type !== "boolean" && N(() => {
|
|
29
|
+
o.setValue(
|
|
30
|
+
e.meta?.nullableOrUndefined === "undefined" ? void 0 : null
|
|
31
|
+
);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
), d(() => {
|
|
35
|
+
!n.value && !e.meta?.required && e.meta?.nullableOrUndefined === "null" && o.setValue(null);
|
|
36
|
+
});
|
|
37
|
+
const { addError: h, removeError: b, showErrors: E, showErrorsOn: V } = A(), s = $(!1);
|
|
38
|
+
k(() => {
|
|
39
|
+
(E.value || V === "onChange") && (s.value = !0);
|
|
40
|
+
});
|
|
41
|
+
const u = () => {
|
|
42
|
+
s.value = !0;
|
|
43
|
+
};
|
|
44
|
+
d(() => {
|
|
45
|
+
n.value && u();
|
|
46
|
+
});
|
|
47
|
+
const p = a(() => !s.value && m.value !== "select" ? [] : g.value);
|
|
48
|
+
f(
|
|
49
|
+
() => r.value.meta.errors,
|
|
50
|
+
() => {
|
|
51
|
+
r.value.meta.errors.length ? h({
|
|
52
|
+
inputId: l,
|
|
53
|
+
errors: r.value.meta.errors.map((t) => t.message).filter(Boolean),
|
|
54
|
+
label: e.label
|
|
55
|
+
}) : b(l);
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
const i = a(() => ({
|
|
59
|
+
id: l,
|
|
60
|
+
required: e.meta?.required,
|
|
61
|
+
minLength: e.meta?.type === "string" && e.meta?.minLength,
|
|
62
|
+
maxLength: e.meta?.type === "string" && e.meta?.maxLength,
|
|
63
|
+
max: e.meta?.type === "number" && e.meta?.maximum,
|
|
64
|
+
min: e.meta?.type === "number" && e.meta?.minimum,
|
|
65
|
+
name: e.field.name,
|
|
66
|
+
modelValue: e.field.state.value,
|
|
67
|
+
errorMessages: p.value,
|
|
68
|
+
error: !!p.value.length,
|
|
69
|
+
field: e.field,
|
|
70
|
+
setRealDirty: u,
|
|
71
|
+
type: m.value,
|
|
72
|
+
label: `${e.label}${e.meta?.required ? " *" : ""}`,
|
|
73
|
+
options: e.options
|
|
74
|
+
}));
|
|
75
|
+
return (t, R) => B(t.$slots, "default", I(O(i.value)), () => [
|
|
76
|
+
_("div", {
|
|
77
|
+
class: q(t.$attrs.class),
|
|
78
|
+
onFocusout: u
|
|
79
|
+
}, [
|
|
80
|
+
F(v) ? (S(), L(D, T({
|
|
81
|
+
key: 0,
|
|
82
|
+
"input-props": i.value
|
|
83
|
+
}, t.$attrs, {
|
|
84
|
+
"vuetify-value": i.value.field.state.value
|
|
85
|
+
}), null, 16, ["input-props", "vuetify-value"])) : P("", !0)
|
|
86
|
+
], 34)
|
|
87
|
+
]);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
11
90
|
export {
|
|
12
|
-
|
|
91
|
+
J as default
|
|
13
92
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var i=document.createElement("style");if(i.appendChild(document.createTextNode(".omega-input .v-input__details:has(.v-messages:empty){grid-template-rows:0fr;transition:all .2s}.omega-input .v-messages:empty{min-height:0}.omega-input .v-input__details:has(.v-messages){transition:all .2s;overflow:hidden;min-height:0;display:grid;grid-template-rows:1fr}.omega-input .v-messages{transition:all .2s}.omega-input .v-messages>*{transition-duration:0s!important}.omega-input [role=alert]:has(.v-messages:empty){padding:0}.omega-input .v-btn{cursor:pointer;width:auto;appearance:none;box-shadow:none;display:block;min-width:auto;height:auto;padding:.5em .5em .5em 1em}")),document.head.appendChild(i),window.customElements){const e=window.customElements.define;window.customElements.define=function(s,t){const n=t.prototype.connectedCallback;return t.prototype.connectedCallback=function(){if(n&&n.call(this),this.shadowRoot){const a=document.createElement("style");a.appendChild(document.createTextNode(".omega-input .v-input__details:has(.v-messages:empty){grid-template-rows:0fr;transition:all .2s}.omega-input .v-messages:empty{min-height:0}.omega-input .v-input__details:has(.v-messages){transition:all .2s;overflow:hidden;min-height:0;display:grid;grid-template-rows:1fr}.omega-input .v-messages{transition:all .2s}.omega-input .v-messages>*{transition-duration:0s!important}.omega-input [role=alert]:has(.v-messages:empty){padding:0}.omega-input .v-btn{cursor:pointer;width:auto;appearance:none;box-shadow:none;display:block;min-width:auto;height:auto;padding:.5em .5em .5em 1em}")),this.shadowRoot.appendChild(a)}},e.call(window.customElements,s,t)}}}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
2
|
import o from "./vue-components.es27.js";
|
|
3
3
|
|
|
4
4
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as d, inject as f, computed as
|
|
2
|
-
import { generateInputStandardSchemaFromFieldMeta as
|
|
3
|
-
import
|
|
4
|
-
const
|
|
1
|
+
import { defineComponent as d, inject as f, computed as o, createBlock as n, openBlock as m, resolveDynamicComponent as v, withCtx as l, createCommentVNode as c, mergeProps as y, renderSlot as g, normalizeProps as h, guardReactiveProps as C } from "vue";
|
|
2
|
+
import { generateInputStandardSchemaFromFieldMeta as F } from "./vue-components.es9.js";
|
|
3
|
+
import b from "./vue-components.es25.js";
|
|
4
|
+
const P = /* @__PURE__ */ d({
|
|
5
5
|
inheritAttrs: !1,
|
|
6
6
|
__name: "OmegaInput",
|
|
7
7
|
props: {
|
|
@@ -13,32 +13,32 @@ const $ = /* @__PURE__ */ d({
|
|
|
13
13
|
type: {}
|
|
14
14
|
},
|
|
15
15
|
setup(s) {
|
|
16
|
-
const
|
|
16
|
+
const a = s, r = f(
|
|
17
17
|
"getMetaFromArray",
|
|
18
18
|
null
|
|
19
|
-
),
|
|
20
|
-
if (!
|
|
19
|
+
), t = o(() => r?.value && r.value(a.name) ? r.value(a.name) : a.form.meta[a.name]), i = o(() => {
|
|
20
|
+
if (!t.value)
|
|
21
21
|
throw new Error("Meta is undefined");
|
|
22
|
-
return
|
|
22
|
+
return F(t.value);
|
|
23
23
|
});
|
|
24
|
-
return (e,
|
|
24
|
+
return (e, M) => (m(), n(v(e.form.Field), {
|
|
25
25
|
name: e.name,
|
|
26
26
|
validators: {
|
|
27
27
|
onChange: i.value,
|
|
28
28
|
...e.validators
|
|
29
29
|
}
|
|
30
30
|
}, {
|
|
31
|
-
default:
|
|
32
|
-
|
|
31
|
+
default: l(({ field: p }) => [
|
|
32
|
+
t.value ? (m(), n(b, y({
|
|
33
33
|
key: 0,
|
|
34
34
|
field: p,
|
|
35
35
|
label: e.label,
|
|
36
36
|
options: e.options,
|
|
37
|
-
meta:
|
|
37
|
+
meta: t.value,
|
|
38
38
|
type: e.type
|
|
39
39
|
}, e.$attrs), {
|
|
40
|
-
default:
|
|
41
|
-
|
|
40
|
+
default: l((u) => [
|
|
41
|
+
g(e.$slots, "default", h(C(u)))
|
|
42
42
|
]),
|
|
43
43
|
_: 2
|
|
44
44
|
}, 1040, ["field", "label", "options", "meta", "type"])) : c("", !0)
|
|
@@ -48,5 +48,5 @@ const $ = /* @__PURE__ */ d({
|
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
50
|
export {
|
|
51
|
-
|
|
51
|
+
P as default
|
|
52
52
|
};
|
|
@@ -12,64 +12,57 @@ const R = /* @__PURE__ */ _({
|
|
|
12
12
|
order: {},
|
|
13
13
|
sort: {}
|
|
14
14
|
},
|
|
15
|
-
setup(
|
|
16
|
-
const
|
|
17
|
-
Object.entries(
|
|
18
|
-
),
|
|
19
|
-
Object.entries(
|
|
20
|
-
),
|
|
21
|
-
(
|
|
22
|
-
const i = e(c,
|
|
23
|
-
return i !== !1 && (
|
|
15
|
+
setup(p) {
|
|
16
|
+
const m = (e) => (r) => Object.fromEntries(
|
|
17
|
+
Object.entries(r).map(([t, n]) => [t, e(n, t)])
|
|
18
|
+
), u = (e) => (r) => Object.fromEntries(
|
|
19
|
+
Object.entries(r).filter(([t, n]) => e(n, t))
|
|
20
|
+
), a = (e) => (r) => Object.entries(r).reduce(
|
|
21
|
+
(t, [n, c]) => {
|
|
22
|
+
const i = e(c, n);
|
|
23
|
+
return i !== !1 && (t[n] = i), t;
|
|
24
24
|
},
|
|
25
25
|
{}
|
|
26
|
-
),
|
|
27
|
-
const
|
|
28
|
-
return
|
|
26
|
+
), o = p, f = (e, r) => {
|
|
27
|
+
const t = r?.indexOf(e) ?? -1;
|
|
28
|
+
return t === -1 ? Number.MAX_SAFE_INTEGER : t;
|
|
29
29
|
}, d = s.mapInput(
|
|
30
30
|
s.number,
|
|
31
|
-
(e) =>
|
|
31
|
+
(e) => f(e.name, o.order || [])
|
|
32
32
|
), b = O(
|
|
33
33
|
() => k(
|
|
34
|
-
|
|
34
|
+
o.form.meta,
|
|
35
35
|
// include / exclude
|
|
36
|
-
|
|
37
|
-
(e,
|
|
38
|
-
var r, o;
|
|
39
|
-
return n.pick ? n.pick.includes(t) && !((r = n.omit) != null && r.includes(t)) : !((o = n.omit) != null && o.includes(t));
|
|
40
|
-
}
|
|
36
|
+
u(
|
|
37
|
+
(e, r) => o.pick ? o.pick.includes(r) && !o.omit?.includes(r) : !o.omit?.includes(r)
|
|
41
38
|
),
|
|
42
39
|
(e) => e,
|
|
43
40
|
// labelMap and adding name
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
...e
|
|
50
|
-
};
|
|
51
|
-
}),
|
|
41
|
+
m((e, r) => ({
|
|
42
|
+
name: r,
|
|
43
|
+
label: o.labelMap?.(r) || r,
|
|
44
|
+
...e
|
|
45
|
+
})),
|
|
52
46
|
// filterMap
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return t === void 0 || t === !0 ? e : t;
|
|
47
|
+
o.filterMap ? a((e) => {
|
|
48
|
+
const r = o.filterMap?.(e.name, e);
|
|
49
|
+
return r === void 0 || r === !0 ? e : r;
|
|
57
50
|
}) : (e) => e,
|
|
58
51
|
// transform to array
|
|
59
52
|
(e) => Object.values(e),
|
|
60
53
|
// order
|
|
61
54
|
l.sort(d),
|
|
62
55
|
// sort
|
|
63
|
-
|
|
56
|
+
o.sort ? l.sort(o.sort) : (e) => e
|
|
64
57
|
)
|
|
65
58
|
);
|
|
66
|
-
return (e,
|
|
67
|
-
child: { name:
|
|
59
|
+
return (e, r) => (M(!0), j(E, null, A(b.value, ({ name: t, label: n, ...c }) => F(e.$slots, "default", {
|
|
60
|
+
child: { name: t, label: n, ...c }
|
|
68
61
|
}, () => [
|
|
69
62
|
g(v, h({
|
|
70
|
-
form:
|
|
71
|
-
name:
|
|
72
|
-
label:
|
|
63
|
+
form: o.form,
|
|
64
|
+
name: t,
|
|
65
|
+
label: n
|
|
73
66
|
}, { ref_for: !0 }, c), null, 16, ["form", "name", "label"])
|
|
74
67
|
])), 256));
|
|
75
68
|
}
|
|
@@ -1,135 +1,127 @@
|
|
|
1
|
-
import { useForm as
|
|
2
|
-
import { S as
|
|
3
|
-
import { generateMetaFromSchema as
|
|
4
|
-
import { computed as
|
|
5
|
-
import { isObject as
|
|
6
|
-
import
|
|
7
|
-
const
|
|
8
|
-
if (!
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const e = window.location.pathname, r = Object.keys(t);
|
|
1
|
+
import { useForm as j } from "@tanstack/vue-form";
|
|
2
|
+
import { S as E } from "effect-app";
|
|
3
|
+
import { generateMetaFromSchema as O } from "./vue-components.es9.js";
|
|
4
|
+
import { computed as v, onUnmounted as P, onMounted as I, onBeforeUnmount as N, provide as R } from "vue";
|
|
5
|
+
import { isObject as A } from "./vue-components.es20.js";
|
|
6
|
+
import D from "./vue-components.es21.js";
|
|
7
|
+
const J = Symbol("OmegaForm"), $ = (d, i, o) => {
|
|
8
|
+
if (!d) throw new Error("Schema is required");
|
|
9
|
+
const S = E.standardSchemaV1(d), { filterItems: b, meta: l } = O(d), n = v(() => {
|
|
10
|
+
if (o?.persistency?.id)
|
|
11
|
+
return o.persistency.id;
|
|
12
|
+
const e = window.location.pathname, r = Object.keys(l);
|
|
14
13
|
return `${e}-${r.join("-")}`;
|
|
15
|
-
}),
|
|
14
|
+
}), g = () => {
|
|
16
15
|
const e = new URLSearchParams(window.location.search);
|
|
17
|
-
e.delete(
|
|
16
|
+
e.delete(n.value);
|
|
18
17
|
const r = new URL(window.location.href);
|
|
19
18
|
r.search = e.toString(), window.history.replaceState({}, "", r.toString());
|
|
20
19
|
};
|
|
21
|
-
function
|
|
22
|
-
for (const
|
|
23
|
-
r[
|
|
20
|
+
function m(e, r) {
|
|
21
|
+
for (const s in r)
|
|
22
|
+
r[s] && A(r[s]) ? (e[s] || (e[s] = {}), m(e[s], r[s])) : e[s] = r[s];
|
|
24
23
|
return e;
|
|
25
24
|
}
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return s == null ? void 0 : s.defaultValues;
|
|
25
|
+
const V = v(() => {
|
|
26
|
+
if (i?.defaultValues && !o?.persistency?.overrideDefaultValues)
|
|
27
|
+
return i?.defaultValues;
|
|
30
28
|
let e;
|
|
31
|
-
const r =
|
|
32
|
-
if (!
|
|
29
|
+
const r = o?.persistency;
|
|
30
|
+
if (!r?.policies || r.policies.length === 0) return {};
|
|
33
31
|
if (r.policies.includes("querystring"))
|
|
34
32
|
try {
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
} catch (
|
|
38
|
-
console.error(
|
|
33
|
+
const t = new URLSearchParams(window.location.search).get(n.value);
|
|
34
|
+
g(), t && (e = JSON.parse(t));
|
|
35
|
+
} catch (s) {
|
|
36
|
+
console.error(s);
|
|
39
37
|
}
|
|
40
38
|
if (
|
|
41
39
|
// query string has higher priority than local/session storage
|
|
42
40
|
!e && (r.policies.includes("local") || r.policies.includes("session"))
|
|
43
41
|
) {
|
|
44
|
-
const
|
|
45
|
-
if (
|
|
42
|
+
const s = r.policies.includes("local") ? localStorage : sessionStorage;
|
|
43
|
+
if (s)
|
|
46
44
|
try {
|
|
47
|
-
const
|
|
48
|
-
|
|
45
|
+
const t = JSON.parse(
|
|
46
|
+
s.getItem(n.value) || "{}"
|
|
49
47
|
);
|
|
50
|
-
|
|
51
|
-
} catch (
|
|
52
|
-
console.error(
|
|
48
|
+
s.removeItem(n.value), e = t;
|
|
49
|
+
} catch (t) {
|
|
50
|
+
console.error(t);
|
|
53
51
|
}
|
|
54
52
|
}
|
|
55
|
-
if (e
|
|
53
|
+
if (e ??= {}, i?.defaultValues == null)
|
|
56
54
|
return e;
|
|
57
55
|
{
|
|
58
|
-
const
|
|
59
|
-
return
|
|
56
|
+
const s = i?.defaultValues;
|
|
57
|
+
return m(s, e);
|
|
60
58
|
}
|
|
61
|
-
}),
|
|
62
|
-
...
|
|
59
|
+
}), a = j({
|
|
60
|
+
...i,
|
|
63
61
|
validators: {
|
|
64
|
-
onSubmit:
|
|
65
|
-
...
|
|
62
|
+
onSubmit: S,
|
|
63
|
+
...i?.validators || {}
|
|
66
64
|
},
|
|
67
|
-
onSubmit:
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}), E = () => {
|
|
77
|
-
Object.keys(t).forEach((e) => {
|
|
78
|
-
n.setFieldValue(e, void 0);
|
|
65
|
+
onSubmit: i?.onSubmit ? ({ formApi: e, meta: r, value: s }) => i.onSubmit?.({
|
|
66
|
+
formApi: e,
|
|
67
|
+
meta: r,
|
|
68
|
+
value: s
|
|
69
|
+
}) : void 0,
|
|
70
|
+
defaultValues: V.value
|
|
71
|
+
}), L = () => {
|
|
72
|
+
Object.keys(l).forEach((e) => {
|
|
73
|
+
a.setFieldValue(e, void 0);
|
|
79
74
|
});
|
|
80
|
-
},
|
|
81
|
-
(r,
|
|
82
|
-
const
|
|
83
|
-
return
|
|
75
|
+
}, p = (e) => e.reduce(
|
|
76
|
+
(r, s) => {
|
|
77
|
+
const t = s.split(".");
|
|
78
|
+
return t.reduce((c, u, U) => (U === t.length - 1 ? c[u] = a.getFieldValue(s) : c[u] = c[u] ?? {}, c[u]), r), r;
|
|
84
79
|
},
|
|
85
80
|
{}
|
|
86
|
-
),
|
|
81
|
+
), w = (e) => {
|
|
87
82
|
if (e) {
|
|
88
83
|
if (Array.isArray(e.keys))
|
|
89
|
-
return
|
|
84
|
+
return p(e.keys);
|
|
90
85
|
if (Array.isArray(e.banKeys)) {
|
|
91
|
-
const r = Object.keys(
|
|
92
|
-
(
|
|
93
|
-
var u;
|
|
94
|
-
return (u = e.banKeys) == null ? void 0 : u.includes(l);
|
|
95
|
-
}
|
|
86
|
+
const r = Object.keys(l).filter(
|
|
87
|
+
(s) => e.banKeys?.includes(s)
|
|
96
88
|
);
|
|
97
|
-
return
|
|
89
|
+
return p(r);
|
|
98
90
|
}
|
|
99
|
-
return
|
|
91
|
+
return a.store.state.values;
|
|
100
92
|
}
|
|
101
|
-
},
|
|
102
|
-
const e =
|
|
103
|
-
if (!(!
|
|
93
|
+
}, f = () => {
|
|
94
|
+
const e = o?.persistency;
|
|
95
|
+
if (!(!e?.policies || e.policies.length === 0) && (e.policies.includes("local") || e.policies.includes("session"))) {
|
|
104
96
|
const r = e.policies.includes("local") ? localStorage : sessionStorage;
|
|
105
97
|
if (!r) return;
|
|
106
|
-
const
|
|
107
|
-
return r.setItem(
|
|
98
|
+
const s = w(e);
|
|
99
|
+
return r.setItem(n.value, JSON.stringify(s));
|
|
108
100
|
}
|
|
109
|
-
},
|
|
110
|
-
const e =
|
|
111
|
-
if (!(!
|
|
112
|
-
const r =
|
|
113
|
-
|
|
114
|
-
const
|
|
115
|
-
|
|
101
|
+
}, y = () => {
|
|
102
|
+
const e = o?.persistency;
|
|
103
|
+
if (!(!e?.policies || e.policies.length === 0) && e.policies.includes("querystring")) {
|
|
104
|
+
const r = w(e), s = new URLSearchParams(window.location.search);
|
|
105
|
+
s.set(n.value, JSON.stringify(r));
|
|
106
|
+
const t = new URL(window.location.href);
|
|
107
|
+
t.search = s.toString(), window.history.replaceState({}, "", t.toString());
|
|
116
108
|
}
|
|
117
109
|
};
|
|
118
|
-
|
|
119
|
-
window.addEventListener("beforeunload",
|
|
120
|
-
}),
|
|
121
|
-
window.removeEventListener("beforeunload",
|
|
110
|
+
P(f), I(() => {
|
|
111
|
+
window.addEventListener("beforeunload", f), window.addEventListener("blur", y);
|
|
112
|
+
}), N(() => {
|
|
113
|
+
window.removeEventListener("beforeunload", f), window.removeEventListener("blur", y);
|
|
122
114
|
});
|
|
123
|
-
const
|
|
124
|
-
meta:
|
|
125
|
-
filterItems:
|
|
126
|
-
clear:
|
|
115
|
+
const h = Object.assign(a, {
|
|
116
|
+
meta: l,
|
|
117
|
+
filterItems: b,
|
|
118
|
+
clear: L
|
|
127
119
|
});
|
|
128
|
-
return
|
|
129
|
-
Input:
|
|
120
|
+
return R(J, h), Object.assign(h, {
|
|
121
|
+
Input: D
|
|
130
122
|
});
|
|
131
123
|
};
|
|
132
124
|
export {
|
|
133
|
-
|
|
134
|
-
|
|
125
|
+
J as OmegaFormKey,
|
|
126
|
+
$ as useOmegaForm
|
|
135
127
|
};
|
|
@@ -1,210 +1,210 @@
|
|
|
1
|
-
import { S as
|
|
1
|
+
import { S as t, Option as g, pipe as S } from "effect-app";
|
|
2
2
|
import { useIntl as v } from "./vue-components.es3.js";
|
|
3
|
-
const x =
|
|
3
|
+
const x = t.NonEmptyArray(t.String), T = (e) => t.AST.isUnion(e) && e.types.find((i) => i._tag === "UndefinedKeyword" || i === t.Null.ast), h = (e) => !e || !t.AST.isUnion(e) ? !1 : e.types.find((i) => i._tag === "UndefinedKeyword") ? "undefined" : e.types.find((i) => i === t.Null.ast) ? "null" : !1, m = ({ meta: e = {}, parent: i = "", property: n, propertySignatures: a }, u = {}) => {
|
|
4
4
|
if (n && n._tag === "Transformation")
|
|
5
5
|
return m({
|
|
6
|
-
parent:
|
|
6
|
+
parent: i,
|
|
7
7
|
meta: e,
|
|
8
8
|
property: n.from
|
|
9
9
|
});
|
|
10
|
-
if (
|
|
10
|
+
if (n?._tag === "TypeLiteral" && "propertySignatures" in n)
|
|
11
11
|
return m({
|
|
12
12
|
meta: e,
|
|
13
13
|
propertySignatures: n.propertySignatures
|
|
14
14
|
});
|
|
15
|
-
if (
|
|
16
|
-
for (const s of
|
|
17
|
-
const o =
|
|
18
|
-
if (
|
|
19
|
-
const
|
|
20
|
-
(f) => f._tag !== "UndefinedKeyword" && f !==
|
|
15
|
+
if (a) {
|
|
16
|
+
for (const s of a) {
|
|
17
|
+
const o = i ? `${i}.${s.name.toString()}` : s.name.toString(), r = h(s.type), l = !r, d = s.type;
|
|
18
|
+
if (t.AST.isUnion(s.type)) {
|
|
19
|
+
const p = s.type.types.filter(
|
|
20
|
+
(f) => f._tag !== "UndefinedKeyword" && f !== t.Null.ast
|
|
21
21
|
);
|
|
22
|
-
if (
|
|
22
|
+
if (p.some(
|
|
23
23
|
(f) => "propertySignatures" in f
|
|
24
24
|
)) {
|
|
25
25
|
const f = m({
|
|
26
26
|
parent: o,
|
|
27
27
|
property: s.type,
|
|
28
|
-
meta: { required: l, nullableOrUndefined:
|
|
28
|
+
meta: { required: l, nullableOrUndefined: r }
|
|
29
29
|
});
|
|
30
30
|
u[o] = f;
|
|
31
|
-
for (const c of
|
|
31
|
+
for (const c of p)
|
|
32
32
|
"propertySignatures" in c && Object.assign(
|
|
33
33
|
u,
|
|
34
34
|
m({
|
|
35
35
|
parent: o,
|
|
36
36
|
propertySignatures: c.propertySignatures,
|
|
37
|
-
meta: { required: l, nullableOrUndefined:
|
|
37
|
+
meta: { required: l, nullableOrUndefined: r }
|
|
38
38
|
})
|
|
39
39
|
);
|
|
40
40
|
} else {
|
|
41
41
|
const f = m({
|
|
42
42
|
parent: o,
|
|
43
43
|
property: s.type,
|
|
44
|
-
meta: { required: l, nullableOrUndefined:
|
|
44
|
+
meta: { required: l, nullableOrUndefined: r }
|
|
45
45
|
});
|
|
46
46
|
u[o] = f;
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
if ("propertySignatures" in
|
|
49
|
+
if ("propertySignatures" in d)
|
|
50
50
|
Object.assign(
|
|
51
51
|
u,
|
|
52
52
|
m({
|
|
53
53
|
parent: o,
|
|
54
|
-
propertySignatures:
|
|
55
|
-
meta: { required: l, nullableOrUndefined:
|
|
54
|
+
propertySignatures: d.propertySignatures,
|
|
55
|
+
meta: { required: l, nullableOrUndefined: r }
|
|
56
56
|
})
|
|
57
57
|
);
|
|
58
58
|
else {
|
|
59
|
-
const
|
|
59
|
+
const p = m({
|
|
60
60
|
parent: o,
|
|
61
61
|
property: s.type,
|
|
62
|
-
meta: { required: l, nullableOrUndefined:
|
|
62
|
+
meta: { required: l, nullableOrUndefined: r }
|
|
63
63
|
});
|
|
64
|
-
u[o] =
|
|
64
|
+
u[o] = p;
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
return u;
|
|
68
68
|
}
|
|
69
69
|
if (n) {
|
|
70
70
|
const s = T(n);
|
|
71
|
-
if (Object.hasOwnProperty.call(e, "required") || (e.required = !s),
|
|
72
|
-
const
|
|
73
|
-
(l) => l._tag !== "UndefinedKeyword" && l !==
|
|
71
|
+
if (Object.hasOwnProperty.call(e, "required") || (e.required = !s), t.AST.isUnion(n)) {
|
|
72
|
+
const r = n.types.find(
|
|
73
|
+
(l) => l._tag !== "UndefinedKeyword" && l !== t.Null.ast
|
|
74
74
|
);
|
|
75
|
-
return "propertySignatures" in
|
|
76
|
-
propertySignatures:
|
|
77
|
-
parent:
|
|
75
|
+
return "propertySignatures" in r ? m({
|
|
76
|
+
propertySignatures: r.propertySignatures,
|
|
77
|
+
parent: i,
|
|
78
78
|
meta: e
|
|
79
|
-
}) : n.types.every(
|
|
79
|
+
}) : n.types.every(t.AST.isLiteral) ? {
|
|
80
80
|
...e,
|
|
81
81
|
type: "select",
|
|
82
82
|
members: n.types.map((l) => l.literal)
|
|
83
83
|
} : {
|
|
84
84
|
...e,
|
|
85
85
|
...m({
|
|
86
|
-
parent:
|
|
86
|
+
parent: i,
|
|
87
87
|
meta: e,
|
|
88
|
-
property:
|
|
88
|
+
property: r
|
|
89
89
|
})
|
|
90
90
|
};
|
|
91
91
|
}
|
|
92
|
-
if (
|
|
92
|
+
if (t.AST.isTupleType(n))
|
|
93
93
|
return {
|
|
94
94
|
...e,
|
|
95
95
|
type: "multiple",
|
|
96
96
|
members: n.elements,
|
|
97
97
|
rest: n.rest
|
|
98
98
|
};
|
|
99
|
-
const o =
|
|
99
|
+
const o = t.AST.getAnnotation(
|
|
100
100
|
n,
|
|
101
|
-
|
|
101
|
+
t.AST.JSONSchemaAnnotationId
|
|
102
102
|
).pipe(g.getOrElse(() => ({})));
|
|
103
103
|
return e = { ...e, ...o }, "from" in n ? m({
|
|
104
|
-
parent:
|
|
104
|
+
parent: i,
|
|
105
105
|
meta: e,
|
|
106
106
|
property: n.from
|
|
107
|
-
}) : (e.type =
|
|
107
|
+
}) : (e.type = t.AST.getAnnotation(
|
|
108
108
|
n,
|
|
109
|
-
|
|
109
|
+
t.AST.TitleAnnotationId
|
|
110
110
|
).pipe(
|
|
111
111
|
g.getOrElse(() => "unknown")
|
|
112
112
|
), e);
|
|
113
113
|
}
|
|
114
114
|
return u;
|
|
115
|
-
},
|
|
116
|
-
const
|
|
117
|
-
if (
|
|
118
|
-
return
|
|
119
|
-
if ("propertySignatures" in
|
|
120
|
-
const
|
|
121
|
-
propertySignatures:
|
|
115
|
+
}, y = (e) => {
|
|
116
|
+
const i = e.ast, n = {};
|
|
117
|
+
if (i._tag === "Transformation" || i._tag === "Refinement")
|
|
118
|
+
return y(t.make(i.from));
|
|
119
|
+
if ("propertySignatures" in i) {
|
|
120
|
+
const a = m({
|
|
121
|
+
propertySignatures: i.propertySignatures
|
|
122
122
|
});
|
|
123
|
-
if (Object.values(
|
|
124
|
-
return
|
|
123
|
+
if (Object.values(a).every((s) => s && "type" in s))
|
|
124
|
+
return a;
|
|
125
125
|
const u = (s, o = "") => {
|
|
126
|
-
for (const
|
|
127
|
-
const l = o ? `${o}.${
|
|
128
|
-
s[
|
|
126
|
+
for (const r in s) {
|
|
127
|
+
const l = o ? `${o}.${r}` : r;
|
|
128
|
+
s[r] && typeof s[r] == "object" && "type" in s[r] ? n[l] = s[r] : s[r] && typeof s[r] == "object" && u(s[r], l);
|
|
129
129
|
}
|
|
130
130
|
};
|
|
131
|
-
u(
|
|
131
|
+
u(a);
|
|
132
132
|
}
|
|
133
133
|
return n;
|
|
134
|
-
}, M = (e) =>
|
|
135
|
-
const
|
|
134
|
+
}, M = (e) => t.extend(e, t.Struct({})), N = (e) => {
|
|
135
|
+
const i = y(e), n = S(
|
|
136
136
|
e.ast,
|
|
137
|
-
g.liftPredicate((
|
|
138
|
-
g.flatMap((
|
|
139
|
-
g.filter((
|
|
137
|
+
g.liftPredicate((a) => a._tag === "Refinement" && "filter" in a),
|
|
138
|
+
g.flatMap((a) => t.AST.getJSONSchemaAnnotation(a)),
|
|
139
|
+
g.filter((a) => "items" in a),
|
|
140
140
|
g.filterMap(
|
|
141
|
-
({ items:
|
|
141
|
+
({ items: a }) => t.decodeUnknownOption(x)(a)
|
|
142
142
|
),
|
|
143
143
|
g.zipWith(
|
|
144
|
-
|
|
145
|
-
(
|
|
146
|
-
items:
|
|
144
|
+
t.AST.getMessageAnnotation(e.ast),
|
|
145
|
+
(a, u) => ({
|
|
146
|
+
items: a,
|
|
147
147
|
message: u("")
|
|
148
148
|
})
|
|
149
149
|
),
|
|
150
150
|
g.getOrUndefined
|
|
151
151
|
);
|
|
152
|
-
return { schema: e, meta:
|
|
152
|
+
return { schema: e, meta: i, filterItems: n };
|
|
153
153
|
}, L = (e) => {
|
|
154
|
-
const { trans:
|
|
154
|
+
const { trans: i } = v();
|
|
155
155
|
let n;
|
|
156
156
|
switch (e.type) {
|
|
157
157
|
case "string":
|
|
158
|
-
n =
|
|
159
|
-
message: () =>
|
|
160
|
-
}), e.format === "email" && (n =
|
|
158
|
+
n = t.String.annotations({
|
|
159
|
+
message: () => i("validation.empty")
|
|
160
|
+
}), e.format === "email" && (n = t.compose(
|
|
161
161
|
n,
|
|
162
|
-
|
|
163
|
-
message: () =>
|
|
162
|
+
t.Email.annotations({
|
|
163
|
+
message: () => i("validation.email.invalid")
|
|
164
164
|
})
|
|
165
165
|
)), e.required && n.annotations({
|
|
166
|
-
message: () =>
|
|
167
|
-
}), e.maxLength && (n = n.pipe(
|
|
168
|
-
message: () =>
|
|
166
|
+
message: () => i("validation.empty")
|
|
167
|
+
}), e.maxLength && (n = n.pipe(t.maxLength(e.maxLength)).annotations({
|
|
168
|
+
message: () => i("validation.string.maxLength", {
|
|
169
169
|
maxLength: e.maxLength
|
|
170
170
|
})
|
|
171
|
-
})), e.minLength && (n = n.pipe(
|
|
172
|
-
message: () =>
|
|
171
|
+
})), e.minLength && (n = n.pipe(t.minLength(e.minLength)).annotations({
|
|
172
|
+
message: () => i("validation.string.minLength", {
|
|
173
173
|
minLength: e.minLength
|
|
174
174
|
})
|
|
175
175
|
}));
|
|
176
176
|
break;
|
|
177
177
|
case "number":
|
|
178
|
-
n =
|
|
179
|
-
message: () =>
|
|
178
|
+
n = t.Number.annotations({
|
|
179
|
+
message: () => i("validation.empty")
|
|
180
180
|
}), e.required && n.annotations({
|
|
181
|
-
message: () =>
|
|
182
|
-
}), e.minimum && (n = n.pipe(
|
|
183
|
-
message: () =>
|
|
181
|
+
message: () => i("validation.empty")
|
|
182
|
+
}), e.minimum && (n = n.pipe(t.greaterThanOrEqualTo(e.minimum)).annotations({
|
|
183
|
+
message: () => i("validation.number.min", {
|
|
184
184
|
minimum: e.minimum,
|
|
185
185
|
isExclusive: !0
|
|
186
186
|
})
|
|
187
|
-
})), e.maximum && (n = n.pipe(
|
|
188
|
-
message: () =>
|
|
187
|
+
})), e.maximum && (n = n.pipe(t.lessThanOrEqualTo(e.maximum)).annotations({
|
|
188
|
+
message: () => i("validation.number.max", {
|
|
189
189
|
maximum: e.maximum,
|
|
190
190
|
isExclusive: !0
|
|
191
191
|
})
|
|
192
|
-
})), e.exclusiveMinimum && (n = n.pipe(
|
|
193
|
-
message: () =>
|
|
192
|
+
})), e.exclusiveMinimum && (n = n.pipe(t.greaterThan(e.exclusiveMinimum)).annotations({
|
|
193
|
+
message: () => i("validation.number.min", {
|
|
194
194
|
minimum: e.exclusiveMinimum,
|
|
195
195
|
isExclusive: !1
|
|
196
196
|
})
|
|
197
|
-
})), e.exclusiveMaximum && (n = n.pipe(
|
|
198
|
-
message: () =>
|
|
197
|
+
})), e.exclusiveMaximum && (n = n.pipe(t.lessThan(e.exclusiveMaximum)).annotations({
|
|
198
|
+
message: () => i("validation.number.max", {
|
|
199
199
|
maximum: e.exclusiveMaximum,
|
|
200
200
|
isExclusive: !1
|
|
201
201
|
})
|
|
202
202
|
}));
|
|
203
203
|
break;
|
|
204
204
|
case "select":
|
|
205
|
-
n =
|
|
205
|
+
n = t.Literal(...e.members).annotations({
|
|
206
206
|
message: () => ({
|
|
207
|
-
message:
|
|
207
|
+
message: i("validation.not_a_valid", {
|
|
208
208
|
type: "select",
|
|
209
209
|
message: e.members.join(", ")
|
|
210
210
|
}),
|
|
@@ -213,29 +213,29 @@ const x = i.NonEmptyArray(i.String), T = (e) => i.AST.isUnion(e) && e.types.find
|
|
|
213
213
|
});
|
|
214
214
|
break;
|
|
215
215
|
case "multiple":
|
|
216
|
-
n =
|
|
217
|
-
message: () =>
|
|
216
|
+
n = t.Array(t.String).annotations({
|
|
217
|
+
message: () => i("validation.not_a_valid", {
|
|
218
218
|
type: "multiple",
|
|
219
219
|
message: e.members.join(", ")
|
|
220
220
|
})
|
|
221
221
|
});
|
|
222
222
|
break;
|
|
223
223
|
case "boolean":
|
|
224
|
-
n =
|
|
224
|
+
n = t.Boolean;
|
|
225
225
|
break;
|
|
226
226
|
// todo: switch must be exhaustive or have default case, otherwise falls through with schema undefined.
|
|
227
227
|
case "unknown":
|
|
228
|
-
n =
|
|
228
|
+
n = t.Unknown;
|
|
229
229
|
break;
|
|
230
230
|
}
|
|
231
231
|
return e.required ? n.pipe(
|
|
232
|
-
|
|
233
|
-
message: () =>
|
|
232
|
+
t.annotations({
|
|
233
|
+
message: () => i("validation.empty")
|
|
234
234
|
})
|
|
235
|
-
) : n =
|
|
236
|
-
}, U = (e,
|
|
237
|
-
|
|
238
|
-
decode: (n) => n ??
|
|
235
|
+
) : n = t.NullishOr(n), t.standardSchemaV1(n);
|
|
236
|
+
}, U = (e, i) => t.NullOr(e).pipe(
|
|
237
|
+
t.transform(t.typeSchema(e), {
|
|
238
|
+
decode: (n) => n ?? i(),
|
|
239
239
|
encode: (n) => n
|
|
240
240
|
})
|
|
241
241
|
);
|
package/package.json
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effect-app/vue-components",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.4",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@mdi/js": "^7.4.47",
|
|
6
6
|
"@tanstack/vue-form": "^1.2.4",
|
|
7
|
-
"effect": "^3.17.
|
|
7
|
+
"effect": "^3.17.5",
|
|
8
8
|
"intl-messageformat": "^10.7.16",
|
|
9
9
|
"mdi-js": "^1.0.1",
|
|
10
10
|
"primeflex": "^4.0.0",
|
|
11
11
|
"primeicons": "^7.0.0",
|
|
12
|
-
"primevue": "^4.3.
|
|
13
|
-
"vue": "^3.5.
|
|
14
|
-
"vuetify": "^3.
|
|
12
|
+
"primevue": "^4.3.7",
|
|
13
|
+
"vue": "^3.5.18",
|
|
14
|
+
"vuetify": "^3.9.3"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"@storybook/addon-essentials": "^8.6.
|
|
18
|
-
"@storybook/addon-interactions": "^8.6.
|
|
19
|
-
"@storybook/blocks": "^8.6.
|
|
17
|
+
"@storybook/addon-essentials": "^8.6.14",
|
|
18
|
+
"@storybook/addon-interactions": "^8.6.14",
|
|
19
|
+
"@storybook/blocks": "^8.6.14",
|
|
20
20
|
"@storybook/testing-library": "^0.2.2",
|
|
21
|
-
"@storybook/vue3": "^
|
|
22
|
-
"@storybook/vue3-vite": "^
|
|
23
|
-
"@types/node": "^
|
|
24
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
25
|
-
"@typescript-eslint/parser": "8.
|
|
26
|
-
"@vitejs/plugin-vue": "^
|
|
21
|
+
"@storybook/vue3": "^9.1.0",
|
|
22
|
+
"@storybook/vue3-vite": "^9.1.0",
|
|
23
|
+
"@types/node": "^24.1.0",
|
|
24
|
+
"@typescript-eslint/eslint-plugin": "8.38.0",
|
|
25
|
+
"@typescript-eslint/parser": "8.38.0",
|
|
26
|
+
"@vitejs/plugin-vue": "^6.0.1",
|
|
27
27
|
"@vue/eslint-config-prettier": "^10.2.0",
|
|
28
|
-
"@vue/eslint-config-typescript": "^14.
|
|
28
|
+
"@vue/eslint-config-typescript": "^14.6.0",
|
|
29
29
|
"@vue/test-utils": "^2.4.6",
|
|
30
|
-
"eslint-plugin-prettier": "^5.
|
|
31
|
-
"eslint-plugin-vue": "^10.
|
|
30
|
+
"eslint-plugin-prettier": "^5.5.3",
|
|
31
|
+
"eslint-plugin-vue": "^10.4.0",
|
|
32
32
|
"jsdom": "^26.1.0",
|
|
33
33
|
"rimraf": "^6.0.1",
|
|
34
|
-
"sass": "^1.
|
|
35
|
-
"storybook": "^
|
|
36
|
-
"typescript": "^5.8.
|
|
37
|
-
"vite": "^
|
|
34
|
+
"sass": "^1.89.2",
|
|
35
|
+
"storybook": "^9.1.0",
|
|
36
|
+
"typescript": "^5.8.3",
|
|
37
|
+
"vite": "^7.0.6",
|
|
38
38
|
"vite-plugin-css-injected-by-js": "^3.5.2",
|
|
39
39
|
"vitepress": "^1.6.3",
|
|
40
40
|
"vue-tsc": "^2.2.8"
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"highlight.js": "^11.11.1",
|
|
56
56
|
"vue3-highlightjs": "^1.0.5",
|
|
57
|
-
"@effect-app/vue": "2.46.
|
|
58
|
-
"effect-app": "2.
|
|
57
|
+
"@effect-app/vue": "2.46.4",
|
|
58
|
+
"effect-app": "2.51.0"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
61
|
"build": "pnpm build:run",
|