@effect-app/vue-components 0.7.4 → 0.7.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.
@@ -1,8 +1,8 @@
1
1
  import { type OmegaInputProps } from "./OmegaFormStuff";
2
2
  import { type DeepValue, type DeepKeys } from "@tanstack/vue-form";
3
- declare const _default: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
- props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & (Omit<OmegaInputProps<T, T>, "type" | "validators" | "items" | "label" | "options"> & {
5
- items?: DeepValue<T, DeepKeys<T>>;
3
+ declare const _default: <From, To>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & (Omit<OmegaInputProps<From, To>, "type" | "validators" | "items" | "label" | "options"> & {
5
+ items?: DeepValue<To, DeepKeys<To>>;
6
6
  }) & Partial<{}>> & import("vue").PublicProps;
7
7
  expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
8
8
  attrs: any;
@@ -1,6 +1,6 @@
1
- import { defineComponent as c, onMounted as g, watch as M, computed as F, provide as h, createBlock as p, openBlock as m, resolveDynamicComponent as i, withCtx as l, createElementBlock as _, renderSlot as u, Fragment as k, renderList as v, mergeProps as A, normalizeProps as S, guardReactiveProps as $ } from "vue";
2
- import { createMeta as B } from "./vue-components.es9.js";
3
- const w = /* @__PURE__ */ c({
1
+ import { defineComponent as g, onMounted as c, computed as M, provide as F, createBlock as p, openBlock as m, resolveDynamicComponent as i, withCtx as l, createElementBlock as _, renderSlot as u, Fragment as h, renderList as k, mergeProps as v, normalizeProps as A, guardReactiveProps as S } from "vue";
2
+ import { createMeta as $ } from "./vue-components.es9.js";
3
+ const P = /* @__PURE__ */ g({
4
4
  inheritAttrs: !1,
5
5
  __name: "OmegaArray",
6
6
  props: {
@@ -9,59 +9,54 @@ const w = /* @__PURE__ */ c({
9
9
  items: {}
10
10
  },
11
11
  setup(f) {
12
- const r = f;
13
- g(() => {
14
- r.items && r.form.setFieldValue(r.name, r.items);
15
- }), M(
16
- () => r.items,
17
- async (e) => {
18
- e && r.form.setFieldValue(r.name, e);
19
- }
20
- );
21
- const d = F(() => {
22
- const e = r.form.meta[r.name];
12
+ const n = f;
13
+ c(() => {
14
+ n.items && n.form.setFieldValue(n.name, n.items);
15
+ });
16
+ const d = M(() => {
17
+ const e = n.form.meta[n.name];
23
18
  if (e && e.type === "multiple") {
24
- const o = e.rest.reduce((t, a) => a.type._tag === "TypeLiteral" ? {
19
+ const o = e.rest.reduce((t, r) => r.type._tag === "TypeLiteral" ? {
25
20
  ...t,
26
21
  propertySignatures: [
27
22
  ...t.propertySignatures || [],
28
- ...a.type.propertySignatures
23
+ ...r.type.propertySignatures
29
24
  ]
30
25
  } : {
31
26
  ...t,
32
- property: a.type
33
- }, {}), n = B({ ...o, meta: e });
27
+ property: r.type
28
+ }, {}), a = $({ ...o, meta: e });
34
29
  return (t) => {
35
- if (t.endsWith("]")) return n;
36
- const a = t.split("]."), s = a[a.length - 1];
37
- return n[s];
30
+ if (t.endsWith("]")) return a;
31
+ const r = t.split("]."), s = r[r.length - 1];
32
+ return a[s];
38
33
  };
39
34
  }
40
35
  return (o) => {
41
36
  };
42
37
  });
43
- return h("getMetaFromArray", d), (e, o) => (m(), p(i(e.form.Field), { name: e.name }, {
44
- default: l(({ field: n }) => [
45
- (m(!0), _(k, null, v(n.state.value, (y, t) => (m(), p(i(e.form.Field), {
38
+ return F("getMetaFromArray", d), (e, o) => (m(), p(i(e.form.Field), { name: e.name }, {
39
+ default: l(({ field: a }) => [
40
+ (m(!0), _(h, null, k(a.state.value, (y, t) => (m(), p(i(e.form.Field), {
46
41
  key: t,
47
42
  name: `${e.name}[${t}]`
48
43
  }, {
49
- default: l(({ field: a, state: s }) => [
50
- u(e.$slots, "default", A({ ref_for: !0 }, {
51
- field: n,
52
- subField: a,
44
+ default: l(({ field: r, state: s }) => [
45
+ u(e.$slots, "default", v({ ref_for: !0 }, {
46
+ field: a,
47
+ subField: r,
53
48
  subState: s,
54
49
  index: t
55
50
  }))
56
51
  ]),
57
52
  _: 2
58
53
  }, 1032, ["name"]))), 128)),
59
- u(e.$slots, "field", S($({ field: n })))
54
+ u(e.$slots, "field", A(S({ field: a })))
60
55
  ]),
61
56
  _: 3
62
57
  }, 8, ["name"]));
63
58
  }
64
59
  });
65
60
  export {
66
- w as default
61
+ P as default
67
62
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effect-app/vue-components",
3
- "version": "0.7.4",
3
+ "version": "0.7.6",
4
4
  "peerDependencies": {
5
5
  "@mdi/js": "^7.4.47",
6
6
  "@tanstack/vue-form": "^1.2.4",
@@ -23,8 +23,8 @@
23
23
  </component>
24
24
  </template>
25
25
 
26
- <script setup lang="ts" generic="T">
27
- import { computed, onMounted, provide, watch } from "vue"
26
+ <script setup lang="ts" generic="From, To">
27
+ import { computed, onMounted, provide } from "vue"
28
28
  import {
29
29
  type CreateMeta,
30
30
  type OmegaInputProps,
@@ -34,10 +34,10 @@ import { type DeepValue, type DeepKeys } from "@tanstack/vue-form"
34
34
 
35
35
  const props = defineProps<
36
36
  Omit<
37
- OmegaInputProps<T, T>,
37
+ OmegaInputProps<From, To>,
38
38
  "validators" | "options" | "label" | "type" | "items"
39
39
  > & {
40
- items?: DeepValue<T, DeepKeys<T>>
40
+ items?: DeepValue<To, DeepKeys<To>>
41
41
  }
42
42
  >()
43
43
 
@@ -47,19 +47,10 @@ defineOptions({
47
47
 
48
48
  onMounted(() => {
49
49
  if (props.items) {
50
- props.form.setFieldValue(props.name, props.items)
50
+ props.form.setFieldValue(props.name as any, props.items)
51
51
  }
52
52
  })
53
53
 
54
- watch(
55
- () => props.items,
56
- async items => {
57
- if (items) {
58
- props.form.setFieldValue(props.name, items)
59
- }
60
- },
61
- )
62
-
63
54
  const getMetaFromArray = computed(() => {
64
55
  const inputMeta = props.form.meta[props.name]
65
56
  if (inputMeta && inputMeta.type === "multiple") {