@effect-app/vue-components 0.14.5 → 0.14.6
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 +4 -0
- package/dist/vue-components.es10.js +56 -55
- package/dist/vue-components.es4.js +11 -11
- package/dist/vue-components.es7.js +31 -23
- package/package.json +1 -1
- package/src/components/OmegaForm/OmegaArray.vue +5 -1
- package/src/components/OmegaForm/OmegaFormStuff.ts +11 -10
- package/src/components/OmegaForm/OmegaInput.vue +1 -0
|
@@ -13,6 +13,10 @@ declare const _default: <From extends Record<PropertyKey, any>, To extends Recor
|
|
|
13
13
|
subState: import("@tanstack/vue-form").FieldState<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>, import("@tanstack/vue-form").FieldValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").StandardSchemaV1<From, To>, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined>;
|
|
14
14
|
index: number;
|
|
15
15
|
}) => any;
|
|
16
|
+
} & {
|
|
17
|
+
field?: (props: {
|
|
18
|
+
field: import("@tanstack/vue-form").FieldApi<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>, import("@tanstack/vue-form").FieldValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").StandardSchemaV1<From, To>, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined>;
|
|
19
|
+
}) => any;
|
|
16
20
|
};
|
|
17
21
|
emit: {};
|
|
18
22
|
}>) => import("vue").VNode & {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { S as n, Option as f, pipe as O } from "effect-app";
|
|
2
2
|
import { useIntl as A } from "./vue-components.es3.js";
|
|
3
|
-
const M = n.NonEmptyArray(n.String), L = (e) => n.AST.isUnion(e) && e.types.find((i) => i._tag === "UndefinedKeyword" || i === n.Null.ast),
|
|
3
|
+
const M = n.NonEmptyArray(n.String), L = (e) => n.AST.isUnion(e) && e.types.find((i) => i._tag === "UndefinedKeyword" || i === n.Null.ast), g = (e) => !e || !n.AST.isUnion(e) ? !1 : e.types.find((i) => i._tag === "UndefinedKeyword") ? "undefined" : e.types.find((i) => i === n.Null.ast) ? "null" : !1, m = ({ meta: e = {}, parent: i = "", property: t, propertySignatures: o }, l = {}) => {
|
|
4
4
|
if (t && t._tag === "Transformation")
|
|
5
5
|
return m({
|
|
6
6
|
parent: i,
|
|
@@ -14,85 +14,86 @@ const M = n.NonEmptyArray(n.String), L = (e) => n.AST.isUnion(e) && e.types.find
|
|
|
14
14
|
});
|
|
15
15
|
if (o) {
|
|
16
16
|
for (const r of o) {
|
|
17
|
-
const u = i ? `${i}.${r.name.toString()}` : r.name.toString(),
|
|
17
|
+
const u = i ? `${i}.${r.name.toString()}` : r.name.toString(), a = g(r.type), p = !a, b = r.type;
|
|
18
18
|
if (n.AST.isUnion(r.type)) {
|
|
19
|
-
const
|
|
20
|
-
(
|
|
19
|
+
const y = r.type.types.filter(
|
|
20
|
+
(s) => s._tag !== "UndefinedKeyword" && s !== n.Null.ast
|
|
21
21
|
);
|
|
22
|
-
if (
|
|
23
|
-
(
|
|
22
|
+
if (y.some(
|
|
23
|
+
(s) => "propertySignatures" in s
|
|
24
24
|
)) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
if (!a) {
|
|
26
|
+
const s = m({
|
|
27
|
+
parent: u,
|
|
28
|
+
property: r.type,
|
|
29
|
+
meta: { required: p, nullableOrUndefined: a }
|
|
30
|
+
});
|
|
31
|
+
l[u] = s;
|
|
32
|
+
}
|
|
33
|
+
for (const s of y)
|
|
34
|
+
"propertySignatures" in s && Object.assign(
|
|
33
35
|
l,
|
|
34
36
|
m({
|
|
35
37
|
parent: u,
|
|
36
|
-
propertySignatures:
|
|
37
|
-
meta: { required: p, nullableOrUndefined:
|
|
38
|
+
propertySignatures: s.propertySignatures,
|
|
39
|
+
meta: { required: p, nullableOrUndefined: a }
|
|
38
40
|
})
|
|
39
41
|
);
|
|
40
42
|
} else {
|
|
41
|
-
const
|
|
43
|
+
const s = m({
|
|
42
44
|
parent: u,
|
|
43
45
|
property: r.type,
|
|
44
|
-
meta: { required: p, nullableOrUndefined:
|
|
46
|
+
meta: { required: p, nullableOrUndefined: a }
|
|
45
47
|
});
|
|
46
|
-
l[u] =
|
|
48
|
+
l[u] = s;
|
|
47
49
|
}
|
|
48
|
-
}
|
|
49
|
-
if ("propertySignatures" in b)
|
|
50
|
+
} else if ("propertySignatures" in b)
|
|
50
51
|
Object.assign(
|
|
51
52
|
l,
|
|
52
53
|
m({
|
|
53
54
|
parent: u,
|
|
54
55
|
propertySignatures: b.propertySignatures,
|
|
55
|
-
meta: { required: p, nullableOrUndefined:
|
|
56
|
+
meta: { required: p, nullableOrUndefined: a }
|
|
56
57
|
})
|
|
57
58
|
);
|
|
58
59
|
else if (n.AST.isTupleType(r.type))
|
|
59
60
|
if (r.type.rest.length > 0 && r.type.rest[0].type._tag === "TypeLiteral" && "propertySignatures" in r.type.rest[0].type) {
|
|
60
|
-
const
|
|
61
|
-
if (
|
|
62
|
-
for (const
|
|
63
|
-
const
|
|
64
|
-
if (n.AST.isTupleType(
|
|
65
|
-
const
|
|
66
|
-
if (
|
|
67
|
-
for (const T of
|
|
68
|
-
const h = `${
|
|
61
|
+
const c = r.type.rest[0].type;
|
|
62
|
+
if (c._tag === "TypeLiteral" && "propertySignatures" in c)
|
|
63
|
+
for (const s of c.propertySignatures) {
|
|
64
|
+
const S = `${u}.${s.name.toString()}`;
|
|
65
|
+
if (n.AST.isTupleType(s.type) && s.type.rest.length > 0) {
|
|
66
|
+
const d = s.type.rest[0].type;
|
|
67
|
+
if (d._tag === "TypeLiteral" && "propertySignatures" in d)
|
|
68
|
+
for (const T of d.propertySignatures) {
|
|
69
|
+
const h = `${S}.${T.name.toString()}`, x = m({
|
|
69
70
|
parent: h,
|
|
70
71
|
property: T.type,
|
|
71
72
|
meta: {
|
|
72
|
-
required: !
|
|
73
|
-
nullableOrUndefined:
|
|
73
|
+
required: !g(T.type),
|
|
74
|
+
nullableOrUndefined: g(T.type)
|
|
74
75
|
}
|
|
75
76
|
});
|
|
76
77
|
l[h] = x;
|
|
77
78
|
}
|
|
78
79
|
else
|
|
79
|
-
l[
|
|
80
|
+
l[S] = {
|
|
80
81
|
type: "multiple",
|
|
81
|
-
members:
|
|
82
|
-
rest:
|
|
83
|
-
required: !
|
|
84
|
-
nullableOrUndefined:
|
|
82
|
+
members: s.type.elements,
|
|
83
|
+
rest: s.type.rest,
|
|
84
|
+
required: !g(s.type),
|
|
85
|
+
nullableOrUndefined: g(s.type)
|
|
85
86
|
};
|
|
86
87
|
} else {
|
|
87
|
-
const
|
|
88
|
-
parent:
|
|
89
|
-
property:
|
|
88
|
+
const d = m({
|
|
89
|
+
parent: S,
|
|
90
|
+
property: s.type,
|
|
90
91
|
meta: {
|
|
91
|
-
required: !
|
|
92
|
-
nullableOrUndefined:
|
|
92
|
+
required: !g(s.type),
|
|
93
|
+
nullableOrUndefined: g(s.type)
|
|
93
94
|
}
|
|
94
95
|
});
|
|
95
|
-
l[
|
|
96
|
+
l[S] = d;
|
|
96
97
|
}
|
|
97
98
|
}
|
|
98
99
|
} else
|
|
@@ -101,15 +102,15 @@ const M = n.NonEmptyArray(n.String), L = (e) => n.AST.isUnion(e) && e.types.find
|
|
|
101
102
|
members: r.type.elements,
|
|
102
103
|
rest: r.type.rest,
|
|
103
104
|
required: p,
|
|
104
|
-
nullableOrUndefined:
|
|
105
|
+
nullableOrUndefined: a
|
|
105
106
|
};
|
|
106
107
|
else {
|
|
107
|
-
const
|
|
108
|
+
const y = m({
|
|
108
109
|
parent: u,
|
|
109
110
|
property: r.type,
|
|
110
|
-
meta: { required: p, nullableOrUndefined:
|
|
111
|
+
meta: { required: p, nullableOrUndefined: a }
|
|
111
112
|
});
|
|
112
|
-
l[u] =
|
|
113
|
+
l[u] = y;
|
|
113
114
|
}
|
|
114
115
|
}
|
|
115
116
|
return l;
|
|
@@ -117,11 +118,11 @@ const M = n.NonEmptyArray(n.String), L = (e) => n.AST.isUnion(e) && e.types.find
|
|
|
117
118
|
if (t) {
|
|
118
119
|
const r = L(t);
|
|
119
120
|
if (Object.hasOwnProperty.call(e, "required") || (e.required = !r), n.AST.isUnion(t)) {
|
|
120
|
-
const
|
|
121
|
+
const a = t.types.find(
|
|
121
122
|
(p) => p._tag !== "UndefinedKeyword" && p !== n.Null.ast
|
|
122
123
|
);
|
|
123
|
-
return "propertySignatures" in
|
|
124
|
-
propertySignatures:
|
|
124
|
+
return "propertySignatures" in a ? m({
|
|
125
|
+
propertySignatures: a.propertySignatures,
|
|
125
126
|
parent: i,
|
|
126
127
|
meta: e
|
|
127
128
|
}) : t.types.every(n.AST.isLiteral) ? {
|
|
@@ -133,7 +134,7 @@ const M = n.NonEmptyArray(n.String), L = (e) => n.AST.isUnion(e) && e.types.find
|
|
|
133
134
|
...m({
|
|
134
135
|
parent: i,
|
|
135
136
|
meta: e,
|
|
136
|
-
property:
|
|
137
|
+
property: a
|
|
137
138
|
})
|
|
138
139
|
};
|
|
139
140
|
}
|
|
@@ -171,9 +172,9 @@ const M = n.NonEmptyArray(n.String), L = (e) => n.AST.isUnion(e) && e.types.find
|
|
|
171
172
|
if (Object.values(o).every((r) => r && "type" in r))
|
|
172
173
|
return o;
|
|
173
174
|
const l = (r, u = "") => {
|
|
174
|
-
for (const
|
|
175
|
-
const p = u ? `${u}.${
|
|
176
|
-
r[
|
|
175
|
+
for (const a in r) {
|
|
176
|
+
const p = u ? `${u}.${a}` : a;
|
|
177
|
+
r[a] && typeof r[a] == "object" && "type" in r[a] ? t[p] = r[a] : r[a] && typeof r[a] == "object" && l(r[a], p);
|
|
177
178
|
}
|
|
178
179
|
};
|
|
179
180
|
l(o);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent as d, inject as f, computed as
|
|
2
|
-
import { generateInputStandardSchemaFromFieldMeta as
|
|
3
|
-
import
|
|
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
4
|
const P = /* @__PURE__ */ d({
|
|
5
5
|
inheritAttrs: !1,
|
|
6
6
|
__name: "OmegaInput",
|
|
@@ -13,15 +13,15 @@ const P = /* @__PURE__ */ d({
|
|
|
13
13
|
type: {}
|
|
14
14
|
},
|
|
15
15
|
setup(s) {
|
|
16
|
-
const a = s,
|
|
16
|
+
const a = s, o = f(
|
|
17
17
|
"getMetaFromArray",
|
|
18
18
|
null
|
|
19
|
-
), t =
|
|
19
|
+
), t = r(() => o?.value && o.value(a.name) ? o.value(a.name) : a.form.meta[a.name]), i = r(() => {
|
|
20
20
|
if (!t.value)
|
|
21
|
-
throw new Error("Meta is undefined");
|
|
22
|
-
return
|
|
21
|
+
throw console.log(a.name, Object.keys(a.form.meta), a.form.meta), new Error("Meta is undefined");
|
|
22
|
+
return C(t.value);
|
|
23
23
|
});
|
|
24
|
-
return (e,
|
|
24
|
+
return (e, k) => (m(), n(c(e.form.Field), {
|
|
25
25
|
name: e.name,
|
|
26
26
|
validators: {
|
|
27
27
|
onChange: i.value,
|
|
@@ -29,7 +29,7 @@ const P = /* @__PURE__ */ d({
|
|
|
29
29
|
}
|
|
30
30
|
}, {
|
|
31
31
|
default: l(({ field: p }) => [
|
|
32
|
-
t.value ? (m(), n(
|
|
32
|
+
t.value ? (m(), n(F, y({
|
|
33
33
|
key: 0,
|
|
34
34
|
field: p,
|
|
35
35
|
label: e.label,
|
|
@@ -38,10 +38,10 @@ const P = /* @__PURE__ */ d({
|
|
|
38
38
|
type: e.type
|
|
39
39
|
}, e.$attrs), {
|
|
40
40
|
default: l((u) => [
|
|
41
|
-
g(e.$slots, "default", h(
|
|
41
|
+
g(e.$slots, "default", h(b(u)))
|
|
42
42
|
]),
|
|
43
43
|
_: 2
|
|
44
|
-
}, 1040, ["field", "label", "options", "meta", "type"])) :
|
|
44
|
+
}, 1040, ["field", "label", "options", "meta", "type"])) : v("", !0)
|
|
45
45
|
]),
|
|
46
46
|
_: 3
|
|
47
47
|
}, 8, ["name", "validators"]));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as F, computed as l, onMounted as P, provide as $, createElementBlock as s, openBlock as n, Fragment as u, createBlock as d, renderList as M, resolveDynamicComponent as i, withCtx as f, renderSlot as p, mergeProps as k, normalizeProps as A, guardReactiveProps as b } from "vue";
|
|
2
|
+
const B = /* @__PURE__ */ F({
|
|
3
3
|
inheritAttrs: !1,
|
|
4
4
|
__name: "OmegaArray",
|
|
5
5
|
props: {
|
|
@@ -8,30 +8,38 @@ const P = /* @__PURE__ */ i({
|
|
|
8
8
|
defaultItems: {},
|
|
9
9
|
items: {}
|
|
10
10
|
},
|
|
11
|
-
setup(
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
setup(c) {
|
|
12
|
+
const r = c, g = r.form.useStore((e) => e.values), m = l(() => r.name.replace(/\[/g, ".").replace(/\]/g, "").split(".").reduce((a, t) => a[t], g.value));
|
|
13
|
+
P(async () => {
|
|
14
|
+
r.defaultItems && !m.value && r.form.setFieldValue(r.name, r.defaultItems);
|
|
15
15
|
});
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
return
|
|
16
|
+
const v = l(() => (a) => {
|
|
17
|
+
const t = a.replace(/\[\d+\]/g, "");
|
|
18
|
+
return r.form.meta[t];
|
|
19
19
|
});
|
|
20
|
-
return
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
20
|
+
return $("getMetaFromArray", v), (e, a) => (n(), s(u, null, [
|
|
21
|
+
(n(!0), s(u, null, M(m.value, (t, o) => (n(), d(i(e.form.Field), {
|
|
22
|
+
key: `${e.name}[${Number(o)}]`,
|
|
23
|
+
name: `${e.name}[${Number(o)}]`
|
|
24
|
+
}, {
|
|
25
|
+
default: f(({ field: h, state: y }) => [
|
|
26
|
+
p(e.$slots, "default", k({ ref_for: !0 }, {
|
|
27
|
+
subField: h,
|
|
28
|
+
subState: y,
|
|
29
|
+
index: Number(o)
|
|
30
|
+
}))
|
|
31
|
+
]),
|
|
32
|
+
_: 2
|
|
33
|
+
}, 1032, ["name"]))), 128)),
|
|
34
|
+
(n(), d(i(e.form.Field), { name: e.name }, {
|
|
35
|
+
default: f(({ field: t }) => [
|
|
36
|
+
p(e.$slots, "field", A(b({ field: t })))
|
|
37
|
+
]),
|
|
38
|
+
_: 3
|
|
39
|
+
}, 8, ["name"]))
|
|
40
|
+
], 64));
|
|
33
41
|
}
|
|
34
42
|
});
|
|
35
43
|
export {
|
|
36
|
-
|
|
44
|
+
B as default
|
|
37
45
|
};
|
package/package.json
CHANGED
|
@@ -268,14 +268,16 @@ export const createMeta = <T = any>(
|
|
|
268
268
|
)
|
|
269
269
|
|
|
270
270
|
if (hasStructMembers) {
|
|
271
|
-
//
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
271
|
+
// Only create parent meta for non-NullOr unions to avoid duplicates
|
|
272
|
+
if (!nullableOrUndefined) {
|
|
273
|
+
const parentMeta = createMeta<T>({
|
|
274
|
+
parent: key,
|
|
275
|
+
property: p.type,
|
|
276
|
+
meta: { required: isRequired, nullableOrUndefined },
|
|
277
|
+
})
|
|
278
|
+
acc[key as NestedKeyOf<T>] = parentMeta as FieldMeta
|
|
279
|
+
}
|
|
280
|
+
|
|
279
281
|
// Process each non-null type and merge their metadata
|
|
280
282
|
for (const nonNullType of nonNullTypes) {
|
|
281
283
|
if ("propertySignatures" in nonNullType) {
|
|
@@ -298,8 +300,7 @@ export const createMeta = <T = any>(
|
|
|
298
300
|
})
|
|
299
301
|
acc[key as NestedKeyOf<T>] = newMeta as FieldMeta
|
|
300
302
|
}
|
|
301
|
-
}
|
|
302
|
-
if ("propertySignatures" in typeToProcess) {
|
|
303
|
+
} else if ("propertySignatures" in typeToProcess) {
|
|
303
304
|
Object.assign(
|
|
304
305
|
acc,
|
|
305
306
|
createMeta<T>({
|
|
@@ -54,6 +54,7 @@ const meta = computed(() => {
|
|
|
54
54
|
|
|
55
55
|
const schema = computed(() => {
|
|
56
56
|
if (!meta.value) {
|
|
57
|
+
console.log(props.name, Object.keys(props.form.meta), props.form.meta)
|
|
57
58
|
throw new Error("Meta is undefined")
|
|
58
59
|
}
|
|
59
60
|
return generateInputStandardSchemaFromFieldMeta(meta.value)
|