@effect-app/vue-components 0.27.16 → 1.0.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/types/components/OmegaForm/OmegaArray.vue.d.ts +2 -3
- package/dist/types/components/OmegaForm/OmegaErrorsContext.d.ts +4 -4
- package/dist/types/components/OmegaForm/OmegaErrorsInternal.vue.d.ts +22 -0
- package/dist/types/components/OmegaForm/OmegaInput.vue.d.ts +1 -2
- package/dist/types/components/OmegaForm/OmegaWrapper.vue.d.ts +7 -37
- package/dist/types/components/OmegaForm/index.d.ts +1 -7
- package/dist/types/components/OmegaForm/useOmegaForm.d.ts +65 -1
- package/dist/types/utils/index.d.ts +9 -0
- package/dist/vue-components.es.js +16 -25
- package/dist/vue-components.es10.js +5 -333
- package/dist/vue-components.es11.js +54 -6
- package/dist/vue-components.es12.js +71 -6
- package/dist/vue-components.es13.js +6 -2
- package/dist/vue-components.es14.js +6 -2
- package/dist/vue-components.es15.js +3 -86
- package/dist/vue-components.es16.js +5 -0
- package/dist/vue-components.es17.js +90 -7
- package/dist/vue-components.es18.js +42 -2
- package/dist/vue-components.es19.js +1 -1
- package/dist/vue-components.es2.js +10 -20
- package/dist/vue-components.es20.js +2 -126
- package/dist/vue-components.es21.js +92 -0
- package/dist/vue-components.es23.js +7 -5
- package/dist/vue-components.es24.js +31 -3
- package/dist/vue-components.es26.js +2 -11
- package/dist/vue-components.es27.js +11 -90
- package/dist/vue-components.es28.js +22 -41
- package/dist/vue-components.es29.js +5 -2
- package/dist/vue-components.es3.js +12 -8
- package/dist/vue-components.es30.js +18 -20
- package/dist/vue-components.es31.js +30 -5
- package/dist/vue-components.es32.js +17 -16
- package/dist/vue-components.es33.js +7 -25
- package/dist/vue-components.es34.js +5 -22
- package/dist/vue-components.es35.js +19 -12
- package/dist/vue-components.es36.js +9 -5
- package/dist/vue-components.es37.js +31 -19
- package/dist/vue-components.es38.js +48 -9
- package/dist/vue-components.es39.js +20 -25
- package/dist/vue-components.es4.js +40 -43
- package/dist/vue-components.es40.js +114 -47
- package/dist/vue-components.es42.js +4 -65
- package/dist/vue-components.es43.js +54 -45
- package/dist/vue-components.es44.js +54 -15
- package/dist/vue-components.es45.js +15 -31
- package/dist/vue-components.es46.js +30 -26
- package/dist/vue-components.es47.js +29 -42
- package/dist/vue-components.es48.js +41 -114
- package/dist/vue-components.es49.js +4 -0
- package/dist/vue-components.es5.js +29 -70
- package/dist/vue-components.es50.js +44 -2
- package/dist/vue-components.es51.js +2 -44
- package/dist/vue-components.es6.js +211 -31
- package/dist/vue-components.es7.js +331 -49
- package/dist/vue-components.es8.js +2 -29
- package/dist/vue-components.es9.js +10 -148
- package/package.json +2 -2
- package/src/components/OmegaForm/OmegaArray.vue +4 -2
- package/src/components/OmegaForm/OmegaAutoGen.vue +5 -5
- package/src/components/OmegaForm/OmegaErrorsContext.ts +10 -8
- package/src/components/OmegaForm/{OmegaErrors.vue → OmegaErrorsInternal.vue} +11 -5
- package/src/components/OmegaForm/OmegaFormInput.vue +4 -2
- package/src/components/OmegaForm/OmegaFormStuff.ts +5 -6
- package/src/components/OmegaForm/OmegaInput.vue +4 -2
- package/src/components/OmegaForm/OmegaWrapper.vue +23 -247
- package/src/components/OmegaForm/index.ts +1 -7
- package/src/components/OmegaForm/useOmegaForm.ts +227 -7
- package/src/utils/index.ts +16 -0
- package/dist/types/components/OmegaForm/OmegaErrors.vue.d.ts +0 -15
- package/dist/vue-components.es22.js +0 -12
- package/dist/vue-components.es25.js +0 -5
- package/dist/vue-components.es41.js +0 -28
- package/dist/vue-components.es52.js +0 -4
- package/dist/vue-components.es53.js +0 -6
|
@@ -1,8 +1,56 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { defineComponent as F, computed as d, onMounted as M, provide as P, createBlock as f, openBlock as m, resolveDynamicComponent as i, withCtx as c, renderSlot as o, createElementBlock as k, normalizeProps as s, guardReactiveProps as l, Fragment as A, renderList as b, mergeProps as B } from "vue";
|
|
2
|
+
const N = /* @__PURE__ */ F({
|
|
3
|
+
inheritAttrs: !1,
|
|
4
|
+
__name: "OmegaArray",
|
|
5
|
+
props: {
|
|
6
|
+
form: {},
|
|
7
|
+
name: {},
|
|
8
|
+
defaultItems: {},
|
|
9
|
+
items: {}
|
|
10
|
+
},
|
|
11
|
+
setup(g) {
|
|
12
|
+
const a = g, y = a.form.useStore((e) => e.values), u = d(() => {
|
|
13
|
+
const e = a.name.replace(/\[/g, ".").replace(/\]/g, "");
|
|
14
|
+
try {
|
|
15
|
+
return e.split(".").reduce((r, t) => r && r[t], y.value);
|
|
16
|
+
} catch (r) {
|
|
17
|
+
return console.error(r), [];
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
M(async () => {
|
|
21
|
+
a.defaultItems && !u.value && a.form.setFieldValue(a.name, a.defaultItems);
|
|
22
|
+
});
|
|
23
|
+
const $ = d(() => (r) => {
|
|
24
|
+
const t = r.replace(/\[\d+\]/g, "");
|
|
25
|
+
return a.form.meta[t];
|
|
26
|
+
});
|
|
27
|
+
return P("getMetaFromArray", $), (e, r) => (m(), f(i(e.form.Field), { name: e.name }, {
|
|
28
|
+
default: c(({ field: t, state: p }) => [
|
|
29
|
+
o(e.$slots, "pre-array", s(l({ field: t, state: p }))),
|
|
30
|
+
(m(!0), k(A, null, b(u.value, (C, n) => (m(), f(i(e.form.Field), {
|
|
31
|
+
key: `${e.name}[${Number(n)}]`,
|
|
32
|
+
name: (
|
|
33
|
+
// eslint-disable-next-line
|
|
34
|
+
`${e.name}[${Number(n)}]`
|
|
35
|
+
)
|
|
36
|
+
}, {
|
|
37
|
+
default: c(({ field: v, state: h }) => [
|
|
38
|
+
o(e.$slots, "default", B({ ref_for: !0 }, {
|
|
39
|
+
subField: v,
|
|
40
|
+
subState: h,
|
|
41
|
+
index: Number(n),
|
|
42
|
+
field: t
|
|
43
|
+
}))
|
|
44
|
+
]),
|
|
45
|
+
_: 2
|
|
46
|
+
}, 1032, ["name"]))), 128)),
|
|
47
|
+
o(e.$slots, "post-array", s(l({ field: t, state: p }))),
|
|
48
|
+
o(e.$slots, "field", s(l({ field: t })))
|
|
49
|
+
]),
|
|
50
|
+
_: 3
|
|
51
|
+
}, 8, ["name"]));
|
|
52
|
+
}
|
|
53
|
+
});
|
|
6
54
|
export {
|
|
7
|
-
|
|
55
|
+
N as default
|
|
8
56
|
};
|
|
@@ -1,8 +1,73 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { defineComponent as _, computed as O, resolveComponent as j, createElementBlock as M, openBlock as E, Fragment as v, renderList as A, renderSlot as F, createVNode as I, mergeProps as g } from "vue";
|
|
2
|
+
import { Order as i, pipe as h, Array as l } from "effect-app";
|
|
3
|
+
const B = /* @__PURE__ */ _({
|
|
4
|
+
__name: "OmegaAutoGen",
|
|
5
|
+
props: {
|
|
6
|
+
form: {},
|
|
7
|
+
pick: {},
|
|
8
|
+
omit: {},
|
|
9
|
+
labelMap: { type: Function },
|
|
10
|
+
filterMap: { type: Function },
|
|
11
|
+
order: {},
|
|
12
|
+
sort: {}
|
|
13
|
+
},
|
|
14
|
+
setup(p) {
|
|
15
|
+
const u = (e) => (r) => Object.fromEntries(
|
|
16
|
+
Object.entries(r).map(([t, n]) => [t, e(n, t)])
|
|
17
|
+
), m = (e) => (r) => Object.fromEntries(
|
|
18
|
+
Object.entries(r).filter(([t, n]) => e(n, t))
|
|
19
|
+
), a = (e) => (r) => Object.entries(r).reduce(
|
|
20
|
+
(t, [n, s]) => {
|
|
21
|
+
const c = e(s, n);
|
|
22
|
+
return c !== !1 && (t[n] = c), t;
|
|
23
|
+
},
|
|
24
|
+
{}
|
|
25
|
+
), o = p, f = (e, r) => {
|
|
26
|
+
const t = r?.indexOf(e) ?? -1;
|
|
27
|
+
return t === -1 ? Number.MAX_SAFE_INTEGER : t;
|
|
28
|
+
}, d = i.mapInput(
|
|
29
|
+
i.number,
|
|
30
|
+
(e) => f(e.name, o.order || [])
|
|
31
|
+
), b = O(
|
|
32
|
+
() => h(
|
|
33
|
+
o.form.meta,
|
|
34
|
+
// include / exclude
|
|
35
|
+
m(
|
|
36
|
+
(e, r) => o.pick ? o.pick.includes(r) && !o.omit?.includes(r) : !o.omit?.includes(r)
|
|
37
|
+
),
|
|
38
|
+
(e) => e,
|
|
39
|
+
// labelMap and adding name
|
|
40
|
+
u((e, r) => ({
|
|
41
|
+
name: r,
|
|
42
|
+
label: o.labelMap?.(r) || r,
|
|
43
|
+
...e
|
|
44
|
+
})),
|
|
45
|
+
// filterMap
|
|
46
|
+
o.filterMap ? a((e) => {
|
|
47
|
+
const r = o.filterMap?.(e.name, e);
|
|
48
|
+
return r === void 0 || r === !0 ? e : r;
|
|
49
|
+
}) : (e) => e,
|
|
50
|
+
// transform to array
|
|
51
|
+
(e) => Object.values(e),
|
|
52
|
+
// order
|
|
53
|
+
l.sort(d),
|
|
54
|
+
// sort
|
|
55
|
+
o.sort ? l.sort(o.sort) : (e) => e
|
|
56
|
+
)
|
|
57
|
+
);
|
|
58
|
+
return (e, r) => {
|
|
59
|
+
const t = j("form.Input");
|
|
60
|
+
return E(!0), M(v, null, A(b.value, ({ name: n, label: s, ...c }) => F(e.$slots, "default", {
|
|
61
|
+
child: { name: n, label: s, ...c }
|
|
62
|
+
}, () => [
|
|
63
|
+
I(t, g({
|
|
64
|
+
name: n,
|
|
65
|
+
label: s
|
|
66
|
+
}, { ref_for: !0 }, c), null, 16, ["name", "label"])
|
|
67
|
+
])), 256);
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
});
|
|
6
71
|
export {
|
|
7
|
-
|
|
72
|
+
B as default
|
|
8
73
|
};
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");if(t.appendChild(document.createTextNode(".v-enter-from[data-v-193816ae],.v-leave-to[data-v-193816ae]{max-height:0px;grid-template-rows:0fr;opacity:0}.v-enter-active[data-v-193816ae],.v-leave-active[data-v-193816ae]{display:grid;transition:all .15s}.v-enter-to[data-v-193816ae],.v-leave-from[data-v-193816ae]{grid-template-rows:1fr;max-height:50vh;opacity:1}.error-alert[data-v-193816ae]{transition-behavior:allow-discrete;display:grid;overflow:hidden;min-height:0}.error-alert>*[data-v-193816ae]{min-height:0}.error-list[data-v-193816ae]{list-style-position:inside}div.error-list[data-v-193816ae]{container-type:inline-size;display:grid;grid-template-columns:auto 1fr auto;gap:1.5em;align-items:start}@container (max-width: 27.125rem){div.error-list[data-v-193816ae]{grid-template-columns:auto 1fr}.error-link[data-v-193816ae]{grid-column:1 / -1;justify-self:end}}@container (max-width: 17.75rem){div.error-list[data-v-193816ae]{grid-template-columns:1fr}.error-message[data-v-193816ae]{grid-column:1 / -1}}.error-item[data-v-193816ae]{display:contents}a[data-v-193816ae]{min-width:min-content}.error-link[data-v-193816ae]{align-items:center;color:inherit;display:inline-flex;flex-wrap:wrap;gap:.25em;padding-bottom:1em;text-decoration:none}")),document.head.appendChild(t),window.customElements){const e=window.customElements.define;window.customElements.define=function(n,a){const i=a.prototype.connectedCallback;return a.prototype.connectedCallback=function(){if(i&&i.call(this),this.shadowRoot){const r=document.createElement("style");r.appendChild(document.createTextNode(".v-enter-from[data-v-193816ae],.v-leave-to[data-v-193816ae]{max-height:0px;grid-template-rows:0fr;opacity:0}.v-enter-active[data-v-193816ae],.v-leave-active[data-v-193816ae]{display:grid;transition:all .15s}.v-enter-to[data-v-193816ae],.v-leave-from[data-v-193816ae]{grid-template-rows:1fr;max-height:50vh;opacity:1}.error-alert[data-v-193816ae]{transition-behavior:allow-discrete;display:grid;overflow:hidden;min-height:0}.error-alert>*[data-v-193816ae]{min-height:0}.error-list[data-v-193816ae]{list-style-position:inside}div.error-list[data-v-193816ae]{container-type:inline-size;display:grid;grid-template-columns:auto 1fr auto;gap:1.5em;align-items:start}@container (max-width: 27.125rem){div.error-list[data-v-193816ae]{grid-template-columns:auto 1fr}.error-link[data-v-193816ae]{grid-column:1 / -1;justify-self:end}}@container (max-width: 17.75rem){div.error-list[data-v-193816ae]{grid-template-columns:1fr}.error-message[data-v-193816ae]{grid-column:1 / -1}}.error-item[data-v-193816ae]{display:contents}a[data-v-193816ae]{min-width:min-content}.error-link[data-v-193816ae]{align-items:center;color:inherit;display:inline-flex;flex-wrap:wrap;gap:.25em;padding-bottom:1em;text-decoration:none}")),this.shadowRoot.appendChild(r)}},e.call(window.customElements,n,a)}}}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
|
+
import r from "./vue-components.es21.js";
|
|
3
|
+
|
|
4
|
+
import o from "./vue-components.es23.js";
|
|
5
|
+
const m = /* @__PURE__ */ o(r, [["__scopeId", "data-v-193816ae"]]);
|
|
2
6
|
export {
|
|
3
|
-
|
|
7
|
+
m as default
|
|
4
8
|
};
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var n=document.createElement("style");if(n.appendChild(document.createTextNode("fieldset[data-v-3e42af39]{display:contents}fieldset[disabled][data-v-3e42af39]>*{pointer-events:none}")),document.head.appendChild(n),window.customElements){const e=window.customElements.define;window.customElements.define=function(i,t){const d=t.prototype.connectedCallback;return t.prototype.connectedCallback=function(){if(d&&d.call(this),this.shadowRoot){const o=document.createElement("style");o.appendChild(document.createTextNode("fieldset[data-v-3e42af39]{display:contents}fieldset[disabled][data-v-3e42af39]>*{pointer-events:none}")),this.shadowRoot.appendChild(o)}},e.call(window.customElements,i,t)}}}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
|
+
import o from "./vue-components.es24.js";
|
|
3
|
+
|
|
4
|
+
import m from "./vue-components.es23.js";
|
|
5
|
+
const e = /* @__PURE__ */ m(o, [["__scopeId", "data-v-3e42af39"]]);
|
|
2
6
|
export {
|
|
3
|
-
|
|
7
|
+
e as default
|
|
4
8
|
};
|
|
@@ -1,88 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { useIntl as z } from "./vue-components.es3.js";
|
|
4
|
-
import { useOmegaErrors as D } from "./vue-components.es8.js";
|
|
5
|
-
const G = {
|
|
6
|
-
key: 0,
|
|
7
|
-
class: "error-alert"
|
|
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
|
-
__name: "OmegaErrors",
|
|
10
|
-
setup($) {
|
|
11
|
-
const m = C()?.appContext.components.VAlert, { errors: s, generalErrors: p, showErrors: y } = D(), { trans: _ } = z(), f = x(() => p.value ? p.value.filter((i) => !!i).flatMap(
|
|
12
|
-
(i) => Object.values(i).filter((l) => !!l).flatMap(
|
|
13
|
-
(l) => l.filter(
|
|
14
|
-
(t) => !!t?.message
|
|
15
|
-
).map((t) => t.message)
|
|
16
|
-
)
|
|
17
|
-
) : []);
|
|
18
|
-
return (i, l) => (r(), o(B, null, {
|
|
19
|
-
default: n(() => [
|
|
20
|
-
e(y) && (e(s).length || f.value.length) ? (r(), d("div", G, [
|
|
21
|
-
w(i.$slots, "default", I(V({ errors: e(s), showedGeneralErrors: f.value })), () => [
|
|
22
|
-
(r(), o(a(e(m) ? "v-alert" : "div"), {
|
|
23
|
-
class: N([e(m) ? "mb-4" : "error-alert-content", "mb-4"]),
|
|
24
|
-
type: "error",
|
|
25
|
-
variant: "tonal",
|
|
26
|
-
role: "alert",
|
|
27
|
-
"aria-live": "polite"
|
|
28
|
-
}, {
|
|
29
|
-
default: n(() => [
|
|
30
|
-
u("div", L, c(e(_)("form.includes_error")) + ": ", 1),
|
|
31
|
-
e(s).length ? (r(), o(a(e(s).length > 1 ? "ul" : "div"), {
|
|
32
|
-
key: 0,
|
|
33
|
-
class: "error-list"
|
|
34
|
-
}, {
|
|
35
|
-
default: n(() => [
|
|
36
|
-
(r(!0), d(v, null, g(e(s), (t) => (r(), o(a(e(s).length > 1 ? "li" : "div"), {
|
|
37
|
-
key: t.inputId,
|
|
38
|
-
class: "error-item"
|
|
39
|
-
}, {
|
|
40
|
-
default: n(() => [
|
|
41
|
-
u("div", M, c(t.label), 1),
|
|
42
|
-
u("div", P, [
|
|
43
|
-
(r(), o(a(t.errors.length > 1 ? "ul" : "div"), { class: "error-list" }, {
|
|
44
|
-
default: n(() => [
|
|
45
|
-
(r(!0), d(v, null, g(t.errors, (h) => (r(), o(a(t.errors.length > 1 ? "li" : "span"), { key: h }, {
|
|
46
|
-
default: n(() => [
|
|
47
|
-
k(c(h), 1)
|
|
48
|
-
]),
|
|
49
|
-
_: 2
|
|
50
|
-
}, 1024))), 128))
|
|
51
|
-
]),
|
|
52
|
-
_: 2
|
|
53
|
-
}, 1024))
|
|
54
|
-
]),
|
|
55
|
-
u("a", {
|
|
56
|
-
href: `#${t.inputId}`,
|
|
57
|
-
class: "error-link"
|
|
58
|
-
}, [
|
|
59
|
-
(r(), o(a(e(m) ? "v-icon" : "i"), {
|
|
60
|
-
icon: e(O),
|
|
61
|
-
"aria-hidden": "true"
|
|
62
|
-
}, {
|
|
63
|
-
default: n(() => [...l[0] || (l[0] = [
|
|
64
|
-
u("i", null, "🔗", -1)
|
|
65
|
-
])]),
|
|
66
|
-
_: 1
|
|
67
|
-
}, 8, ["icon"])),
|
|
68
|
-
k(" " + c(e(_)("form.fix_input")), 1)
|
|
69
|
-
], 8, S)
|
|
70
|
-
]),
|
|
71
|
-
_: 2
|
|
72
|
-
}, 1024))), 128))
|
|
73
|
-
]),
|
|
74
|
-
_: 1
|
|
75
|
-
})) : (r(), d("span", T, c(f.value[0]), 1))
|
|
76
|
-
]),
|
|
77
|
-
_: 1
|
|
78
|
-
}, 8, ["class"]))
|
|
79
|
-
], !0)
|
|
80
|
-
])) : b("", !0)
|
|
81
|
-
]),
|
|
82
|
-
_: 3
|
|
83
|
-
}));
|
|
84
|
-
}
|
|
85
|
-
});
|
|
1
|
+
import { TraceAPI as r } from "./vue-components.es39.js";
|
|
2
|
+
var t = r.getInstance();
|
|
86
3
|
export {
|
|
87
|
-
|
|
4
|
+
t as trace
|
|
88
5
|
};
|
|
@@ -1,9 +1,92 @@
|
|
|
1
|
-
const s = (
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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.es5.js";
|
|
5
|
+
import D from "./vue-components.es40.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
|
+
});
|
|
7
90
|
export {
|
|
8
|
-
|
|
91
|
+
J as default
|
|
9
92
|
};
|
|
@@ -1,4 +1,44 @@
|
|
|
1
|
-
|
|
1
|
+
const f = (c) => typeof c == "function", a = function(c, r) {
|
|
2
|
+
switch (c) {
|
|
3
|
+
case 0:
|
|
4
|
+
case 1:
|
|
5
|
+
throw new RangeError(`Invalid arity ${c}`);
|
|
6
|
+
case 2:
|
|
7
|
+
return function(n, t) {
|
|
8
|
+
return arguments.length >= 2 ? r(n, t) : function(e) {
|
|
9
|
+
return r(e, n);
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
case 3:
|
|
13
|
+
return function(n, t, e) {
|
|
14
|
+
return arguments.length >= 3 ? r(n, t, e) : function(u) {
|
|
15
|
+
return r(u, n, t);
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
case 4:
|
|
19
|
+
return function(n, t, e, u) {
|
|
20
|
+
return arguments.length >= 4 ? r(n, t, e, u) : function(i) {
|
|
21
|
+
return r(i, n, t, e);
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
case 5:
|
|
25
|
+
return function(n, t, e, u, i) {
|
|
26
|
+
return arguments.length >= 5 ? r(n, t, e, u, i) : function(s) {
|
|
27
|
+
return r(s, n, t, e, u);
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
default:
|
|
31
|
+
return function() {
|
|
32
|
+
if (arguments.length >= c)
|
|
33
|
+
return r.apply(this, arguments);
|
|
34
|
+
const n = arguments;
|
|
35
|
+
return function(t) {
|
|
36
|
+
return r(t, ...n);
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
};
|
|
2
41
|
export {
|
|
3
|
-
|
|
42
|
+
a as dual,
|
|
43
|
+
f as isFunction
|
|
4
44
|
};
|
|
@@ -1,24 +1,14 @@
|
|
|
1
1
|
import { default as t } from "./vue-components.es4.js";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { default as g } from "./vue-components.es7.js";
|
|
6
|
-
import { default as s } from "./vue-components.es12.js";
|
|
7
|
-
import * as e from "./vue-components.es8.js";
|
|
8
|
-
import { createMeta as O, duplicateSchema as F, generateInputStandardSchemaFromFieldMeta as c, generateMetaFromSchema as I, nullableInput as S } from "./vue-components.es10.js";
|
|
9
|
-
import { useOmegaForm as i } from "./vue-components.es9.js";
|
|
2
|
+
import * as e from "./vue-components.es5.js";
|
|
3
|
+
import { createMeta as o, duplicateSchema as p, generateInputStandardSchemaFromFieldMeta as n, generateMetaFromSchema as u, nullableInput as l } from "./vue-components.es7.js";
|
|
4
|
+
import { useOmegaForm as d } from "./vue-components.es6.js";
|
|
10
5
|
export {
|
|
11
|
-
t as OmegaArray,
|
|
12
|
-
m as OmegaAutoGen,
|
|
13
|
-
p as OmegaErrors,
|
|
14
6
|
e as OmegaErrorsContext,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
S as nullableInput,
|
|
23
|
-
i as useOmegaForm
|
|
7
|
+
t as OmegaInput,
|
|
8
|
+
o as createMeta,
|
|
9
|
+
p as duplicateSchema,
|
|
10
|
+
n as generateInputStandardSchemaFromFieldMeta,
|
|
11
|
+
u as generateMetaFromSchema,
|
|
12
|
+
l as nullableInput,
|
|
13
|
+
d as useOmegaForm
|
|
24
14
|
};
|
|
@@ -1,128 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useStore as y } from "@tanstack/vue-form";
|
|
3
|
-
import { getOmegaStore as $ } from "./vue-components.es26.js";
|
|
4
|
-
import { provideOmegaErrors as A } from "./vue-components.es8.js";
|
|
5
|
-
import { useOmegaForm as W, OmegaFormKey as P } from "./vue-components.es9.js";
|
|
6
|
-
const x = ["disabled"], q = /* @__PURE__ */ M({
|
|
7
|
-
__name: "OmegaWrapper",
|
|
8
|
-
props: {
|
|
9
|
-
omegaConfig: {},
|
|
10
|
-
subscribe: {},
|
|
11
|
-
showErrorsOn: {},
|
|
12
|
-
formId: {},
|
|
13
|
-
defaultState: {},
|
|
14
|
-
asyncAlways: { type: Boolean },
|
|
15
|
-
asyncDebounceMs: {},
|
|
16
|
-
canSubmitWhenInvalid: { type: Boolean },
|
|
17
|
-
validators: {},
|
|
18
|
-
validationLogic: {},
|
|
19
|
-
listeners: {},
|
|
20
|
-
onSubmitInvalid: {},
|
|
21
|
-
transform: {},
|
|
22
|
-
onSubmitMeta: {},
|
|
23
|
-
defaultValues: {},
|
|
24
|
-
form: {},
|
|
25
|
-
schema: {},
|
|
26
|
-
isLoading: { type: Boolean, default: void 0 },
|
|
27
|
-
onSubmit: {}
|
|
28
|
-
},
|
|
29
|
-
setup(w) {
|
|
30
|
-
const o = w, E = B(), j = (e, r) => new Promise((n) => {
|
|
31
|
-
E.emit("submit", e, r);
|
|
32
|
-
const t = S(() => o.isLoading, (i) => {
|
|
33
|
-
i || (n(), t.stop());
|
|
34
|
-
});
|
|
35
|
-
}), v = typeof o.isLoading < "u" ? u(() => j) : typeof o.onSubmit < "u" ? u(() => o.onSubmit) : void 0, l = v?.value ? ({ formApi: e, meta: r, value: n }) => v.value(n, { meta: r, formApi: e }) : void 0, f = o.form || !o.schema ? void 0 : W(
|
|
36
|
-
o.schema,
|
|
37
|
-
{
|
|
38
|
-
...o,
|
|
39
|
-
onSubmit: l
|
|
40
|
-
},
|
|
41
|
-
o.omegaConfig
|
|
42
|
-
), s = u(() => o.form ?? f);
|
|
43
|
-
L(() => {
|
|
44
|
-
if (!o.form) return;
|
|
45
|
-
const e = Object.keys(o.form.options || {}), r = /* @__PURE__ */ new Set([
|
|
46
|
-
"omegaConfig",
|
|
47
|
-
"subscribe",
|
|
48
|
-
"showErrorsOn",
|
|
49
|
-
"asyncAlways",
|
|
50
|
-
"form",
|
|
51
|
-
"schema",
|
|
52
|
-
"canSubmitWhenInvalid"
|
|
53
|
-
]), n = Object.fromEntries(
|
|
54
|
-
Object.entries(o).filter(
|
|
55
|
-
([a, d]) => a === "isLoading" ? !1 : !r.has(a) && d !== void 0
|
|
56
|
-
)
|
|
57
|
-
), t = Object.keys(n), i = e.filter(
|
|
58
|
-
(a) => t.includes(a) && n[a] !== void 0
|
|
59
|
-
);
|
|
60
|
-
i.length > 0 && console.warn(
|
|
61
|
-
`[OmegaWrapper] Overlapping keys found between form options and filtered props:
|
|
62
|
-
${i.join(
|
|
63
|
-
`,
|
|
64
|
-
`
|
|
65
|
-
)}.
|
|
66
|
-
Props will overwrite existing form options. This might indicate a configuration issue.`
|
|
67
|
-
);
|
|
68
|
-
const g = {
|
|
69
|
-
...s.value.options,
|
|
70
|
-
...n
|
|
71
|
-
};
|
|
72
|
-
l && (g.onSubmit = l), s.value.options = Object.fromEntries(
|
|
73
|
-
// TODO
|
|
74
|
-
Object.entries(g).filter(
|
|
75
|
-
([a, d]) => d !== void 0
|
|
76
|
-
)
|
|
77
|
-
);
|
|
78
|
-
});
|
|
79
|
-
const I = y(
|
|
80
|
-
s.value.store,
|
|
81
|
-
(e) => e.isSubmitting
|
|
82
|
-
), b = $(
|
|
83
|
-
s.value,
|
|
84
|
-
o.subscribe
|
|
85
|
-
), F = y(
|
|
86
|
-
s.value.store,
|
|
87
|
-
(e) => e.submissionAttempts
|
|
88
|
-
), c = u(() => s.value.useStore((e) => e.errors));
|
|
89
|
-
return S(
|
|
90
|
-
() => [s.value.filterItems, c.value.value],
|
|
91
|
-
() => {
|
|
92
|
-
const e = s.value.filterItems, r = c.value.value;
|
|
93
|
-
return e ? r ? (Object.values(r).filter(
|
|
94
|
-
(t) => !!t
|
|
95
|
-
).flatMap(
|
|
96
|
-
(t) => Object.values(t).flat().map((i) => i.message)
|
|
97
|
-
).some((t) => t === e.message) && e.items.forEach((t) => {
|
|
98
|
-
const i = s.value.getFieldMeta(t);
|
|
99
|
-
i && s.value.setFieldMeta(t, {
|
|
100
|
-
...i,
|
|
101
|
-
errorMap: {
|
|
102
|
-
onSubmit: [
|
|
103
|
-
{ path: [t], message: e.message }
|
|
104
|
-
]
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
}), {}) : {} : {};
|
|
108
|
-
}
|
|
109
|
-
), A(F, c.value, o.showErrorsOn), C(P, s.value), (e, r) => (h(), O("form", {
|
|
110
|
-
novalidate: "",
|
|
111
|
-
onSubmit: r[0] || (r[0] = V((n) => s.value.handleSubmit(), ["prevent", "stop"]))
|
|
112
|
-
}, [
|
|
113
|
-
k("fieldset", { disabled: m(I) }, [
|
|
114
|
-
o.form ? (h(), O(_, { key: 0 }, [
|
|
115
|
-
p(e.$slots, "externalForm", { subscribedValues: m(b) }, void 0, !0),
|
|
116
|
-
p(e.$slots, "default", {}, void 0, !0)
|
|
117
|
-
], 64)) : m(f) ? p(e.$slots, "internalForm", {
|
|
118
|
-
key: 1,
|
|
119
|
-
form: m(f),
|
|
120
|
-
subscribedValues: m(b)
|
|
121
|
-
}, void 0, !0) : K("", !0)
|
|
122
|
-
], 8, x)
|
|
123
|
-
], 32));
|
|
124
|
-
}
|
|
125
|
-
});
|
|
1
|
+
import f from "./vue-components.es12.js";
|
|
126
2
|
export {
|
|
127
|
-
|
|
3
|
+
f as default
|
|
128
4
|
};
|