@effect-app/vue-components 0.15.3 → 0.15.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.
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as y, computed as s, onMounted as h, provide as F, createBlock as l, openBlock as o, resolveDynamicComponent as u, withCtx as d, createElementBlock as $, renderSlot as f, Fragment as M, renderList as P, mergeProps as k, normalizeProps as A, guardReactiveProps as b } from "vue";
|
|
2
|
+
const I = /* @__PURE__ */ y({
|
|
3
3
|
inheritAttrs: !1,
|
|
4
4
|
__name: "OmegaArray",
|
|
5
5
|
props: {
|
|
@@ -8,23 +8,30 @@ const C = /* @__PURE__ */ h({
|
|
|
8
8
|
defaultItems: {},
|
|
9
9
|
items: {}
|
|
10
10
|
},
|
|
11
|
-
setup(
|
|
12
|
-
const r =
|
|
13
|
-
|
|
11
|
+
setup(i) {
|
|
12
|
+
const r = i, c = r.form.useStore((e) => e.values), m = s(() => {
|
|
13
|
+
const e = r.name.replace(/\[/g, ".").replace(/\]/g, "");
|
|
14
|
+
try {
|
|
15
|
+
return e.split(".").reduce((a, t) => a[t], c.value);
|
|
16
|
+
} catch {
|
|
17
|
+
return [];
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
h(async () => {
|
|
14
21
|
r.defaultItems && !m.value && r.form.setFieldValue(r.name, r.defaultItems);
|
|
15
22
|
});
|
|
16
|
-
const
|
|
23
|
+
const p = s(() => (a) => {
|
|
17
24
|
const t = a.replace(/\[\d+\]/g, "");
|
|
18
25
|
return r.form.meta[t];
|
|
19
26
|
});
|
|
20
|
-
return F("getMetaFromArray",
|
|
27
|
+
return F("getMetaFromArray", p), (e, a) => (o(), l(u(e.form.Field), { name: e.name }, {
|
|
21
28
|
default: d(({ field: t }) => [
|
|
22
|
-
(o(!0),
|
|
29
|
+
(o(!0), $(M, null, P(m.value, (B, n) => (o(), l(u(e.form.Field), {
|
|
23
30
|
key: `${e.name}[${Number(n)}]`,
|
|
24
31
|
name: `${e.name}[${Number(n)}]`
|
|
25
32
|
}, {
|
|
26
33
|
default: d(({ field: g, state: v }) => [
|
|
27
|
-
|
|
34
|
+
f(e.$slots, "default", k({ ref_for: !0 }, {
|
|
28
35
|
subField: g,
|
|
29
36
|
subState: v,
|
|
30
37
|
index: Number(n),
|
|
@@ -33,12 +40,12 @@ const C = /* @__PURE__ */ h({
|
|
|
33
40
|
]),
|
|
34
41
|
_: 2
|
|
35
42
|
}, 1032, ["name"]))), 128)),
|
|
36
|
-
|
|
43
|
+
f(e.$slots, "field", A(b({ field: t })))
|
|
37
44
|
]),
|
|
38
45
|
_: 3
|
|
39
46
|
}, 8, ["name"]));
|
|
40
47
|
}
|
|
41
48
|
});
|
|
42
49
|
export {
|
|
43
|
-
|
|
50
|
+
I as default
|
|
44
51
|
};
|
package/package.json
CHANGED
|
@@ -54,9 +54,13 @@ defineOptions({
|
|
|
54
54
|
const store = props.form.useStore(state => state.values)
|
|
55
55
|
const items = computed(() => {
|
|
56
56
|
const normalizedPath = props.name.replace(/\[/g, ".").replace(/\]/g, "")
|
|
57
|
-
|
|
58
|
-
return acc
|
|
59
|
-
|
|
57
|
+
try {
|
|
58
|
+
return normalizedPath.split(".").reduce((acc, curr) => {
|
|
59
|
+
return acc[curr] as typeof store.value
|
|
60
|
+
}, store.value)
|
|
61
|
+
} catch (e) {
|
|
62
|
+
return []
|
|
63
|
+
}
|
|
60
64
|
})
|
|
61
65
|
|
|
62
66
|
onMounted(async () => {
|