@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 h, computed as s, onMounted as y, provide as F, createBlock as l, openBlock as o, resolveDynamicComponent as u, withCtx as d, createElementBlock as P, renderSlot as i, Fragment as $, renderList as M, mergeProps as k, normalizeProps as A, guardReactiveProps as b } from "vue";
2
- const C = /* @__PURE__ */ h({
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(f) {
12
- const r = f, p = r.form.useStore((e) => e.values), m = s(() => r.name.replace(/\[/g, ".").replace(/\]/g, "").split(".").reduce((a, t) => a[t], p.value));
13
- y(async () => {
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 c = s(() => (a) => {
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", c), (e, a) => (o(), l(u(e.form.Field), { name: e.name }, {
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), P($, null, M(m.value, (z, n) => (o(), l(u(e.form.Field), {
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
- i(e.$slots, "default", k({ ref_for: !0 }, {
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
- i(e.$slots, "field", A(b({ field: t })))
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
- C as default
50
+ I as default
44
51
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effect-app/vue-components",
3
- "version": "0.15.3",
3
+ "version": "0.15.4",
4
4
  "peerDependencies": {
5
5
  "@mdi/js": "^7.4.47",
6
6
  "@tanstack/vue-form": "^1.2.4",
@@ -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
- return normalizedPath.split(".").reduce((acc, curr) => {
58
- return acc[curr] as typeof store.value
59
- }, store.value)
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 () => {