@effect-app/vue-components 0.15.22 → 0.15.24
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/InputProps.d.ts +3 -3
- package/dist/types/components/OmegaForm/OmegaArray.vue.d.ts +4 -4
- package/dist/types/components/OmegaForm/OmegaAutoGen.vue.d.ts +4 -4
- package/dist/types/components/OmegaForm/OmegaErrors.vue.d.ts +2 -2
- package/dist/types/components/OmegaForm/OmegaErrorsContext.d.ts +1 -1
- package/dist/types/components/OmegaForm/OmegaFormInput.vue.d.ts +4 -4
- package/dist/types/components/OmegaForm/OmegaFormStuff.d.ts +4 -4
- package/dist/types/components/OmegaForm/OmegaInput.vue.d.ts +2 -2
- package/dist/types/components/OmegaForm/OmegaInputVuetify.vue.d.ts +3 -3
- package/dist/types/components/OmegaForm/OmegaInternalInput.vue.d.ts +4 -4
- package/dist/types/components/OmegaForm/OmegaWrapper.vue.d.ts +2 -2
- package/dist/types/components/OmegaForm/getOmegaStore.d.ts +1 -1
- package/dist/types/components/OmegaForm/index.d.ts +7 -7
- package/dist/types/components/OmegaForm/useOmegaForm.d.ts +3 -3
- package/dist/vue-components.es.js +6 -6
- package/dist/vue-components.es10.js +1 -3
- package/dist/vue-components.es11.js +5 -5
- package/dist/vue-components.es12.js +5 -5
- package/dist/vue-components.es13.js +2 -111
- package/dist/vue-components.es14.js +4 -0
- package/dist/vue-components.es15.js +88 -7
- package/dist/vue-components.es17.js +7 -2
- package/dist/vue-components.es18.js +2 -89
- package/dist/vue-components.es2.js +12 -12
- package/dist/vue-components.es20.js +111 -2
- package/dist/vue-components.es4.js +39 -38
- package/dist/vue-components.es5.js +66 -28
- package/dist/vue-components.es6.js +28 -66
- package/dist/vue-components.es7.js +39 -40
- package/dist/vue-components.es9.js +7 -9
- package/package.json +20 -17
- package/src/components/OmegaForm/InputProps.ts +23 -35
- package/src/components/OmegaForm/OmegaArray.vue +24 -14
- package/src/components/OmegaForm/OmegaAutoGen.vue +38 -30
- package/src/components/OmegaForm/OmegaErrors.vue +25 -14
- package/src/components/OmegaForm/OmegaErrorsContext.ts +5 -13
- package/src/components/OmegaForm/OmegaFormInput.vue +17 -10
- package/src/components/OmegaForm/OmegaFormStuff.ts +141 -136
- package/src/components/OmegaForm/OmegaInput.vue +13 -10
- package/src/components/OmegaForm/OmegaInputVuetify.vue +18 -15
- package/src/components/OmegaForm/OmegaInternalInput.vue +34 -34
- package/src/components/OmegaForm/OmegaWrapper.vue +60 -58
- package/src/components/OmegaForm/getOmegaStore.ts +6 -7
- package/src/components/OmegaForm/index.ts +7 -7
- package/src/components/OmegaForm/useOmegaForm.ts +74 -76
- package/src/utils/index.ts +2 -2
- package/dist/vue-components.es16.js +0 -4
- /package/dist/{vue-components.es21.js → vue-components.es19.js} +0 -0
|
@@ -1,91 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useOmegaErrors as O } from "./vue-components.es8.js";
|
|
3
|
-
import { mdiLink as z } from "@mdi/js";
|
|
4
|
-
import { useIntl as D } from "./vue-components.es3.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 } = O(), { trans: _ } = D(), f = x(() => p.value ? p.value.filter(
|
|
12
|
-
(i) => !!i
|
|
13
|
-
).flatMap(
|
|
14
|
-
(i) => Object.values(i).filter((l) => !!l).flatMap(
|
|
15
|
-
(l) => l.filter(
|
|
16
|
-
(t) => !!t?.message
|
|
17
|
-
).map((t) => t.message)
|
|
18
|
-
)
|
|
19
|
-
) : []);
|
|
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
|
-
type: "error",
|
|
27
|
-
variant: "tonal",
|
|
28
|
-
role: "alert",
|
|
29
|
-
"aria-live": "polite"
|
|
30
|
-
}, {
|
|
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
|
-
key: 0,
|
|
35
|
-
class: "error-list"
|
|
36
|
-
}, {
|
|
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
|
-
class: "error-item"
|
|
41
|
-
}, {
|
|
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
|
-
]),
|
|
51
|
-
_: 2
|
|
52
|
-
}, 1024))), 128))
|
|
53
|
-
]),
|
|
54
|
-
_: 2
|
|
55
|
-
}, 1024))
|
|
56
|
-
]),
|
|
57
|
-
u("a", {
|
|
58
|
-
href: `#${t.inputId}`,
|
|
59
|
-
class: "error-link"
|
|
60
|
-
}, [
|
|
61
|
-
(r(), o(a(e(m) ? "v-icon" : "i"), {
|
|
62
|
-
icon: e(z),
|
|
63
|
-
"aria-hidden": "true"
|
|
64
|
-
}, {
|
|
65
|
-
default: n(() => l[0] || (l[0] = [
|
|
66
|
-
u("i", null, "🔗", -1)
|
|
67
|
-
])),
|
|
68
|
-
_: 1,
|
|
69
|
-
__: [0]
|
|
70
|
-
}, 8, ["icon"])),
|
|
71
|
-
k(" " + c(e(_)("form.fix_input")), 1)
|
|
72
|
-
], 8, S)
|
|
73
|
-
]),
|
|
74
|
-
_: 2
|
|
75
|
-
}, 1024))), 128))
|
|
76
|
-
]),
|
|
77
|
-
_: 1
|
|
78
|
-
})) : (r(), d("span", T, c(f.value[0]), 1))
|
|
79
|
-
]),
|
|
80
|
-
_: 1
|
|
81
|
-
}, 8, ["class"]))
|
|
82
|
-
], !0)
|
|
83
|
-
])) : b("", !0)
|
|
84
|
-
]),
|
|
85
|
-
_: 3
|
|
86
|
-
}));
|
|
87
|
-
}
|
|
88
|
-
});
|
|
1
|
+
import f from "./vue-components.es6.js";
|
|
89
2
|
export {
|
|
90
|
-
|
|
3
|
+
f as default
|
|
91
4
|
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { default as t } from "./vue-components.
|
|
2
|
-
import { default as m } from "./vue-components.
|
|
3
|
-
import { default as p } from "./vue-components.
|
|
4
|
-
import { default as l } from "./vue-components.
|
|
5
|
-
import { default as g } from "./vue-components.
|
|
6
|
-
import { default as s } from "./vue-components.
|
|
1
|
+
import { default as t } from "./vue-components.es4.js";
|
|
2
|
+
import { default as m } from "./vue-components.es5.js";
|
|
3
|
+
import { default as p } from "./vue-components.es11.js";
|
|
4
|
+
import { default as l } from "./vue-components.es6.js";
|
|
5
|
+
import { default as g } from "./vue-components.es7.js";
|
|
6
|
+
import { default as s } from "./vue-components.es12.js";
|
|
7
7
|
import * as e from "./vue-components.es8.js";
|
|
8
8
|
import { createMeta as O, duplicateSchema as F, generateInputStandardSchemaFromFieldMeta as c, generateMetaFromSchema as I, nullableInput as S } from "./vue-components.es10.js";
|
|
9
9
|
import { useOmegaForm as i } from "./vue-components.es9.js";
|
|
10
10
|
export {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
t as OmegaArray,
|
|
12
|
+
m as OmegaAutoGen,
|
|
13
|
+
p as OmegaErrors,
|
|
14
14
|
e as OmegaErrorsContext,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
s as OmegaForm,
|
|
16
|
+
l as OmegaFormInput,
|
|
17
|
+
g as OmegaInput,
|
|
18
18
|
O as createMeta,
|
|
19
19
|
F as duplicateSchema,
|
|
20
20
|
c as generateInputStandardSchemaFromFieldMeta,
|
|
@@ -1,4 +1,113 @@
|
|
|
1
|
-
import f from "
|
|
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
|
+
import { useStore as g } from "@tanstack/vue-form";
|
|
3
|
+
import { getOmegaStore as B } from "./vue-components.es23.js";
|
|
4
|
+
import { provideOmegaErrors as C } from "./vue-components.es8.js";
|
|
5
|
+
import { useOmegaForm as I } from "./vue-components.es9.js";
|
|
6
|
+
const $ = ["disabled"], N = /* @__PURE__ */ w({
|
|
7
|
+
__name: "OmegaWrapper",
|
|
8
|
+
props: {
|
|
9
|
+
omegaConfig: {},
|
|
10
|
+
subscribe: {},
|
|
11
|
+
showErrorsOn: {},
|
|
12
|
+
defaultValues: {},
|
|
13
|
+
defaultState: {},
|
|
14
|
+
asyncAlways: { type: Boolean },
|
|
15
|
+
asyncDebounceMs: {},
|
|
16
|
+
validators: {},
|
|
17
|
+
onSubmitMeta: {},
|
|
18
|
+
onSubmitInvalid: { type: Function },
|
|
19
|
+
transform: {},
|
|
20
|
+
onSubmit: { type: Function },
|
|
21
|
+
form: {},
|
|
22
|
+
schema: {}
|
|
23
|
+
},
|
|
24
|
+
setup(O) {
|
|
25
|
+
const o = O, m = f(() => {
|
|
26
|
+
if (!(o.form || !o.schema))
|
|
27
|
+
return I(o.schema, o, o.omegaConfig);
|
|
28
|
+
}), t = f(() => o.form ?? m.value);
|
|
29
|
+
E(() => {
|
|
30
|
+
if (!o.form) return;
|
|
31
|
+
const e = Object.keys(o.form.options || {}), s = /* @__PURE__ */ new Set([
|
|
32
|
+
"omegaConfig",
|
|
33
|
+
"subscribe",
|
|
34
|
+
"showErrorsOn",
|
|
35
|
+
"asyncAlways",
|
|
36
|
+
"form",
|
|
37
|
+
"schema"
|
|
38
|
+
]), i = Object.fromEntries(
|
|
39
|
+
Object.entries(o).filter(
|
|
40
|
+
([a, u]) => !s.has(a) && u !== void 0
|
|
41
|
+
)
|
|
42
|
+
), r = Object.keys(i), n = e.filter(
|
|
43
|
+
(a) => r.includes(a) && i[a] !== void 0
|
|
44
|
+
);
|
|
45
|
+
n.length > 0 && console.warn(
|
|
46
|
+
`[OmegaWrapper] Overlapping keys found between form options and filtered props:
|
|
47
|
+
${n.join(
|
|
48
|
+
`,
|
|
49
|
+
`
|
|
50
|
+
)}.
|
|
51
|
+
Props will overwrite existing form options. This might indicate a configuration issue.`
|
|
52
|
+
);
|
|
53
|
+
const S = {
|
|
54
|
+
...t.value.options,
|
|
55
|
+
...i
|
|
56
|
+
};
|
|
57
|
+
t.value.options = Object.fromEntries(
|
|
58
|
+
// TODO
|
|
59
|
+
Object.entries(S).filter(
|
|
60
|
+
([a, u]) => u !== void 0
|
|
61
|
+
)
|
|
62
|
+
);
|
|
63
|
+
});
|
|
64
|
+
const h = g(
|
|
65
|
+
t.value.store,
|
|
66
|
+
(e) => e.isSubmitting
|
|
67
|
+
), d = B(
|
|
68
|
+
t.value,
|
|
69
|
+
o.subscribe
|
|
70
|
+
), y = g(
|
|
71
|
+
t.value.store,
|
|
72
|
+
(e) => e.submissionAttempts
|
|
73
|
+
), l = f(() => t.value.useStore((e) => e.errors));
|
|
74
|
+
return j(
|
|
75
|
+
() => [t.value.filterItems, l.value.value],
|
|
76
|
+
() => {
|
|
77
|
+
const e = t.value.filterItems, s = l.value.value;
|
|
78
|
+
return e ? s ? (Object.values(s).filter(
|
|
79
|
+
(r) => !!r
|
|
80
|
+
).flatMap(
|
|
81
|
+
(r) => Object.values(r).flat().map((n) => n.message)
|
|
82
|
+
).some((r) => r === e.message) && e.items.forEach((r) => {
|
|
83
|
+
const n = t.value.getFieldMeta(r);
|
|
84
|
+
n && t.value.setFieldMeta(r, {
|
|
85
|
+
...n,
|
|
86
|
+
errorMap: {
|
|
87
|
+
onSubmit: [
|
|
88
|
+
{ path: [r], message: e.message }
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}), {}) : {} : {};
|
|
93
|
+
}
|
|
94
|
+
), C(y, l.value, o.showErrorsOn), (e, s) => (b(), v("form", {
|
|
95
|
+
novalidate: "",
|
|
96
|
+
onSubmit: s[0] || (s[0] = F((i) => t.value.handleSubmit(), ["prevent", "stop"]))
|
|
97
|
+
}, [
|
|
98
|
+
M("fieldset", { disabled: c(h) }, [
|
|
99
|
+
o.form ? (b(), v(V, { key: 0 }, [
|
|
100
|
+
p(e.$slots, "externalForm", { subscribedValues: c(d) }, void 0, !0),
|
|
101
|
+
p(e.$slots, "default", {}, void 0, !0)
|
|
102
|
+
], 64)) : m.value ? p(e.$slots, "internalForm", {
|
|
103
|
+
key: 1,
|
|
104
|
+
form: m.value,
|
|
105
|
+
subscribedValues: c(d)
|
|
106
|
+
}, void 0, !0) : k("", !0)
|
|
107
|
+
], 8, $)
|
|
108
|
+
], 32));
|
|
109
|
+
}
|
|
110
|
+
});
|
|
2
111
|
export {
|
|
3
|
-
|
|
112
|
+
N as default
|
|
4
113
|
};
|
|
@@ -1,52 +1,53 @@
|
|
|
1
|
-
import { defineComponent as d,
|
|
2
|
-
|
|
3
|
-
import F from "./vue-components.es24.js";
|
|
4
|
-
const P = /* @__PURE__ */ d({
|
|
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({
|
|
5
3
|
inheritAttrs: !1,
|
|
6
|
-
__name: "
|
|
4
|
+
__name: "OmegaArray",
|
|
7
5
|
props: {
|
|
8
6
|
form: {},
|
|
9
7
|
name: {},
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
options: {},
|
|
13
|
-
type: {}
|
|
8
|
+
defaultItems: {},
|
|
9
|
+
items: {}
|
|
14
10
|
},
|
|
15
|
-
setup(
|
|
16
|
-
const
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return C(t.value);
|
|
23
|
-
});
|
|
24
|
-
return (e, k) => (m(), n(c(e.form.Field), {
|
|
25
|
-
name: e.name,
|
|
26
|
-
validators: {
|
|
27
|
-
onChange: i.value,
|
|
28
|
-
...e.validators
|
|
11
|
+
setup(g) {
|
|
12
|
+
const t = g, y = t.form.useStore((e) => e.values), u = d(() => {
|
|
13
|
+
const e = t.name.replace(/\[/g, ".").replace(/\]/g, "");
|
|
14
|
+
try {
|
|
15
|
+
return e.split(".").reduce((a, r) => a[r], y.value);
|
|
16
|
+
} catch {
|
|
17
|
+
return [];
|
|
29
18
|
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
19
|
+
});
|
|
20
|
+
M(async () => {
|
|
21
|
+
t.defaultItems && !u.value && t.form.setFieldValue(t.name, t.defaultItems);
|
|
22
|
+
});
|
|
23
|
+
const $ = d(() => (a) => {
|
|
24
|
+
const r = a.replace(/\[\d+\]/g, "");
|
|
25
|
+
return t.form.meta[r];
|
|
26
|
+
});
|
|
27
|
+
return P("getMetaFromArray", $), (e, a) => (m(), f(i(e.form.Field), { name: e.name }, {
|
|
28
|
+
default: c(({ field: r, state: p }) => [
|
|
29
|
+
o(e.$slots, "pre-array", s(l({ field: r, 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: `${e.name}[${Number(n)}]`
|
|
33
|
+
}, {
|
|
34
|
+
default: c(({ field: v, state: h }) => [
|
|
35
|
+
o(e.$slots, "default", B({ ref_for: !0 }, {
|
|
36
|
+
subField: v,
|
|
37
|
+
subState: h,
|
|
38
|
+
index: Number(n),
|
|
39
|
+
field: r
|
|
40
|
+
}))
|
|
42
41
|
]),
|
|
43
42
|
_: 2
|
|
44
|
-
},
|
|
43
|
+
}, 1032, ["name"]))), 128)),
|
|
44
|
+
o(e.$slots, "post-array", s(l({ field: r, state: p }))),
|
|
45
|
+
o(e.$slots, "field", s(l({ field: r })))
|
|
45
46
|
]),
|
|
46
47
|
_: 3
|
|
47
|
-
}, 8, ["name"
|
|
48
|
+
}, 8, ["name"]));
|
|
48
49
|
}
|
|
49
50
|
});
|
|
50
51
|
export {
|
|
51
|
-
|
|
52
|
+
N as default
|
|
52
53
|
};
|
|
@@ -1,34 +1,72 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
const
|
|
5
|
-
__name: "
|
|
1
|
+
import { defineComponent as _, computed as O, createElementBlock as j, openBlock as M, Fragment as E, renderList as A, renderSlot as F, createVNode as g, mergeProps as h } from "vue";
|
|
2
|
+
import { Order as s, pipe as k, Array as l } from "effect-app";
|
|
3
|
+
import v from "./vue-components.es7.js";
|
|
4
|
+
const R = /* @__PURE__ */ _({
|
|
5
|
+
__name: "OmegaAutoGen",
|
|
6
6
|
props: {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
type:
|
|
7
|
+
form: {},
|
|
8
|
+
pick: {},
|
|
9
|
+
omit: {},
|
|
10
|
+
labelMap: { type: Function },
|
|
11
|
+
filterMap: { type: Function },
|
|
12
|
+
order: {},
|
|
13
|
+
sort: {}
|
|
12
14
|
},
|
|
13
|
-
setup(
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
+
},
|
|
25
|
+
{}
|
|
26
|
+
), o = p, f = (e, r) => {
|
|
27
|
+
const t = r?.indexOf(e) ?? -1;
|
|
28
|
+
return t === -1 ? Number.MAX_SAFE_INTEGER : t;
|
|
29
|
+
}, d = s.mapInput(
|
|
30
|
+
s.number,
|
|
31
|
+
(e) => f(e.name, o.order || [])
|
|
32
|
+
), b = O(
|
|
33
|
+
() => k(
|
|
34
|
+
o.form.meta,
|
|
35
|
+
// include / exclude
|
|
36
|
+
u(
|
|
37
|
+
(e, r) => o.pick ? o.pick.includes(r) && !o.omit?.includes(r) : !o.omit?.includes(r)
|
|
38
|
+
),
|
|
39
|
+
(e) => e,
|
|
40
|
+
// labelMap and adding name
|
|
41
|
+
m((e, r) => ({
|
|
42
|
+
name: r,
|
|
43
|
+
label: o.labelMap?.(r) || r,
|
|
44
|
+
...e
|
|
45
|
+
})),
|
|
46
|
+
// filterMap
|
|
47
|
+
o.filterMap ? a((e) => {
|
|
48
|
+
const r = o.filterMap?.(e.name, e);
|
|
49
|
+
return r === void 0 || r === !0 ? e : r;
|
|
50
|
+
}) : (e) => e,
|
|
51
|
+
// transform to array
|
|
52
|
+
(e) => Object.values(e),
|
|
53
|
+
// order
|
|
54
|
+
l.sort(d),
|
|
55
|
+
// sort
|
|
56
|
+
o.sort ? l.sort(o.sort) : (e) => e
|
|
57
|
+
)
|
|
58
|
+
);
|
|
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 }
|
|
61
|
+
}, () => [
|
|
62
|
+
g(v, h({
|
|
63
|
+
form: o.form,
|
|
64
|
+
name: t,
|
|
65
|
+
label: n
|
|
66
|
+
}, { ref_for: !0 }, c), null, 16, ["form", "name", "label"])
|
|
67
|
+
])), 256));
|
|
30
68
|
}
|
|
31
69
|
});
|
|
32
70
|
export {
|
|
33
|
-
|
|
71
|
+
R as default
|
|
34
72
|
};
|
|
@@ -1,72 +1,34 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
const
|
|
5
|
-
__name: "
|
|
1
|
+
import { defineComponent as a, inject as t, createBlock as n, openBlock as m, mergeProps as p, unref as s, withCtx as i, renderSlot as l, normalizeProps as f, guardReactiveProps as u } from "vue";
|
|
2
|
+
import d from "./vue-components.es7.js";
|
|
3
|
+
import { OmegaFormKey as c } from "./vue-components.es9.js";
|
|
4
|
+
const w = /* @__PURE__ */ a({
|
|
5
|
+
__name: "OmegaFormInput",
|
|
6
6
|
props: {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
order: {},
|
|
13
|
-
sort: {}
|
|
7
|
+
name: {},
|
|
8
|
+
label: {},
|
|
9
|
+
validators: {},
|
|
10
|
+
options: {},
|
|
11
|
+
type: {}
|
|
14
12
|
},
|
|
15
|
-
setup(
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
),
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
), b = O(
|
|
33
|
-
() => k(
|
|
34
|
-
o.form.meta,
|
|
35
|
-
// include / exclude
|
|
36
|
-
u(
|
|
37
|
-
(e, r) => o.pick ? o.pick.includes(r) && !o.omit?.includes(r) : !o.omit?.includes(r)
|
|
38
|
-
),
|
|
39
|
-
(e) => e,
|
|
40
|
-
// labelMap and adding name
|
|
41
|
-
m((e, r) => ({
|
|
42
|
-
name: r,
|
|
43
|
-
label: o.labelMap?.(r) || r,
|
|
44
|
-
...e
|
|
45
|
-
})),
|
|
46
|
-
// filterMap
|
|
47
|
-
o.filterMap ? a((e) => {
|
|
48
|
-
const r = o.filterMap?.(e.name, e);
|
|
49
|
-
return r === void 0 || r === !0 ? e : r;
|
|
50
|
-
}) : (e) => e,
|
|
51
|
-
// transform to array
|
|
52
|
-
(e) => Object.values(e),
|
|
53
|
-
// order
|
|
54
|
-
l.sort(d),
|
|
55
|
-
// sort
|
|
56
|
-
o.sort ? l.sort(o.sort) : (e) => e
|
|
57
|
-
)
|
|
58
|
-
);
|
|
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 }
|
|
61
|
-
}, () => [
|
|
62
|
-
g(v, h({
|
|
63
|
-
form: o.form,
|
|
64
|
-
name: t,
|
|
65
|
-
label: n
|
|
66
|
-
}, { ref_for: !0 }, c), null, 16, ["form", "name", "label"])
|
|
67
|
-
])), 256));
|
|
13
|
+
setup(g) {
|
|
14
|
+
const o = t(c);
|
|
15
|
+
if (!o)
|
|
16
|
+
throw new Error("OmegaFormInput must be used within an OmegaForm context");
|
|
17
|
+
return (e, b) => (m(), n(d, p(e.$props, {
|
|
18
|
+
form: s(o),
|
|
19
|
+
name: e.name,
|
|
20
|
+
label: e.label,
|
|
21
|
+
validators: e.validators,
|
|
22
|
+
options: e.options,
|
|
23
|
+
type: e.type
|
|
24
|
+
}), {
|
|
25
|
+
default: i((r) => [
|
|
26
|
+
l(e.$slots, "default", f(u(r)))
|
|
27
|
+
]),
|
|
28
|
+
_: 3
|
|
29
|
+
}, 16, ["form", "name", "label", "validators", "options", "type"]));
|
|
68
30
|
}
|
|
69
31
|
});
|
|
70
32
|
export {
|
|
71
|
-
|
|
33
|
+
w as default
|
|
72
34
|
};
|
|
@@ -1,53 +1,52 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
|
|
1
|
+
import { defineComponent as d, inject as f, computed as r, createBlock as n, openBlock as m, resolveDynamicComponent as c, withCtx as l, createCommentVNode as v, mergeProps as y, renderSlot as g, normalizeProps as h, guardReactiveProps as b } from "vue";
|
|
2
|
+
import { generateInputStandardSchemaFromFieldMeta as C } from "./vue-components.es10.js";
|
|
3
|
+
import F from "./vue-components.es24.js";
|
|
4
|
+
const P = /* @__PURE__ */ d({
|
|
3
5
|
inheritAttrs: !1,
|
|
4
|
-
__name: "
|
|
6
|
+
__name: "OmegaInput",
|
|
5
7
|
props: {
|
|
6
8
|
form: {},
|
|
7
9
|
name: {},
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
validators: {},
|
|
11
|
+
label: {},
|
|
12
|
+
options: {},
|
|
13
|
+
type: {}
|
|
10
14
|
},
|
|
11
|
-
setup(
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
});
|
|
20
|
-
M(async () => {
|
|
21
|
-
t.defaultItems && !u.value && t.form.setFieldValue(t.name, t.defaultItems);
|
|
15
|
+
setup(s) {
|
|
16
|
+
const a = s, o = f(
|
|
17
|
+
"getMetaFromArray",
|
|
18
|
+
null
|
|
19
|
+
), t = r(() => o?.value && o.value(a.name) ? o.value(a.name) : a.form.meta[a.name]), i = r(() => {
|
|
20
|
+
if (!t.value)
|
|
21
|
+
throw console.log(a.name, Object.keys(a.form.meta), a.form.meta), new Error("Meta is undefined");
|
|
22
|
+
return C(t.value);
|
|
22
23
|
});
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
24
|
+
return (e, k) => (m(), n(c(e.form.Field), {
|
|
25
|
+
name: e.name,
|
|
26
|
+
validators: {
|
|
27
|
+
onChange: i.value,
|
|
28
|
+
...e.validators
|
|
29
|
+
}
|
|
30
|
+
}, {
|
|
31
|
+
default: l(({ field: p }) => [
|
|
32
|
+
t.value ? (m(), n(F, y({
|
|
33
|
+
key: 0,
|
|
34
|
+
field: p,
|
|
35
|
+
label: e.label,
|
|
36
|
+
options: e.options,
|
|
37
|
+
meta: t.value,
|
|
38
|
+
type: e.type
|
|
39
|
+
}, e.$attrs), {
|
|
40
|
+
default: l((u) => [
|
|
41
|
+
g(e.$slots, "default", h(b(u)))
|
|
41
42
|
]),
|
|
42
|
-
_:
|
|
43
|
-
},
|
|
44
|
-
o(e.$slots, "post-array", s(l({ field: r, state: p }))),
|
|
45
|
-
o(e.$slots, "field", s(l({ field: r })))
|
|
43
|
+
_: 3
|
|
44
|
+
}, 16, ["field", "label", "options", "meta", "type"])) : v("", !0)
|
|
46
45
|
]),
|
|
47
46
|
_: 3
|
|
48
|
-
}, 8, ["name"]));
|
|
47
|
+
}, 8, ["name", "validators"]));
|
|
49
48
|
}
|
|
50
49
|
});
|
|
51
50
|
export {
|
|
52
|
-
|
|
51
|
+
P as default
|
|
53
52
|
};
|