@effect-app/vue-components 0.15.23 → 0.15.25

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.
Files changed (53) hide show
  1. package/dist/types/components/OmegaForm/InputProps.d.ts +3 -3
  2. package/dist/types/components/OmegaForm/OmegaArray.vue.d.ts +4 -4
  3. package/dist/types/components/OmegaForm/OmegaAutoGen.vue.d.ts +4 -4
  4. package/dist/types/components/OmegaForm/OmegaErrors.vue.d.ts +2 -2
  5. package/dist/types/components/OmegaForm/OmegaErrorsContext.d.ts +1 -1
  6. package/dist/types/components/OmegaForm/OmegaFormInput.vue.d.ts +4 -4
  7. package/dist/types/components/OmegaForm/OmegaFormStuff.d.ts +4 -4
  8. package/dist/types/components/OmegaForm/OmegaInput.vue.d.ts +2 -2
  9. package/dist/types/components/OmegaForm/OmegaInputVuetify.vue.d.ts +3 -3
  10. package/dist/types/components/OmegaForm/OmegaInternalInput.vue.d.ts +4 -4
  11. package/dist/types/components/OmegaForm/OmegaWrapper.vue.d.ts +2 -2
  12. package/dist/types/components/OmegaForm/getOmegaStore.d.ts +1 -1
  13. package/dist/types/components/OmegaForm/index.d.ts +7 -7
  14. package/dist/types/components/OmegaForm/useOmegaForm.d.ts +3 -3
  15. package/dist/vue-components.es.js +6 -6
  16. package/dist/vue-components.es10.js +1 -3
  17. package/dist/vue-components.es11.js +5 -5
  18. package/dist/vue-components.es12.js +5 -5
  19. package/dist/vue-components.es13.js +2 -111
  20. package/dist/vue-components.es14.js +4 -0
  21. package/dist/vue-components.es15.js +88 -7
  22. package/dist/vue-components.es17.js +7 -2
  23. package/dist/vue-components.es18.js +2 -89
  24. package/dist/vue-components.es2.js +12 -12
  25. package/dist/vue-components.es20.js +111 -2
  26. package/dist/vue-components.es22.js +1 -1
  27. package/dist/vue-components.es23.js +2 -90
  28. package/dist/vue-components.es24.js +90 -11
  29. package/dist/vue-components.es25.js +11 -2
  30. package/dist/vue-components.es26.js +1 -1
  31. package/dist/vue-components.es4.js +39 -38
  32. package/dist/vue-components.es5.js +66 -28
  33. package/dist/vue-components.es6.js +28 -66
  34. package/dist/vue-components.es7.js +39 -40
  35. package/dist/vue-components.es9.js +7 -9
  36. package/package.json +20 -17
  37. package/src/components/OmegaForm/InputProps.ts +23 -35
  38. package/src/components/OmegaForm/OmegaArray.vue +24 -14
  39. package/src/components/OmegaForm/OmegaAutoGen.vue +38 -30
  40. package/src/components/OmegaForm/OmegaErrors.vue +25 -14
  41. package/src/components/OmegaForm/OmegaErrorsContext.ts +5 -13
  42. package/src/components/OmegaForm/OmegaFormInput.vue +17 -10
  43. package/src/components/OmegaForm/OmegaFormStuff.ts +141 -136
  44. package/src/components/OmegaForm/OmegaInput.vue +13 -10
  45. package/src/components/OmegaForm/OmegaInputVuetify.vue +18 -15
  46. package/src/components/OmegaForm/OmegaInternalInput.vue +34 -34
  47. package/src/components/OmegaForm/OmegaWrapper.vue +60 -58
  48. package/src/components/OmegaForm/getOmegaStore.ts +6 -7
  49. package/src/components/OmegaForm/index.ts +7 -7
  50. package/src/components/OmegaForm/useOmegaForm.ts +74 -76
  51. package/src/utils/index.ts +2 -2
  52. package/dist/vue-components.es16.js +0 -4
  53. /package/dist/{vue-components.es21.js → vue-components.es19.js} +0 -0
@@ -1,91 +1,4 @@
1
- import { defineComponent as E, getCurrentInstance as C, computed as x, createBlock as o, openBlock as r, Transition as B, withCtx as n, createElementBlock as d, createCommentVNode as b, unref as e, renderSlot as w, normalizeProps as I, guardReactiveProps as V, resolveDynamicComponent as a, normalizeClass as N, createElementVNode as u, toDisplayString as c, Fragment as v, renderList as g, createTextVNode as k } from "vue";
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
- H as default
3
+ f as default
91
4
  };
@@ -1,20 +1,20 @@
1
- import { default as t } from "./vue-components.es11.js";
2
- import { default as m } from "./vue-components.es4.js";
3
- import { default as p } from "./vue-components.es5.js";
4
- import { default as l } from "./vue-components.es12.js";
5
- import { default as g } from "./vue-components.es6.js";
6
- import { default as s } from "./vue-components.es7.js";
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
- s as OmegaArray,
12
- g as OmegaAutoGen,
13
- l as OmegaErrors,
11
+ t as OmegaArray,
12
+ m as OmegaAutoGen,
13
+ p as OmegaErrors,
14
14
  e as OmegaErrorsContext,
15
- t as OmegaForm,
16
- p as OmegaFormInput,
17
- m as OmegaInput,
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 "./vue-components.es6.js";
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.es25.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
- f as default
112
+ N as default
4
113
  };
@@ -1,4 +1,4 @@
1
- import { isFunction as c } from "./vue-components.es25.js";
1
+ import { isFunction as c } from "./vue-components.es23.js";
2
2
  const s = c, t = (o) => typeof o == "object" && o !== null, i = (o) => t(o) || s(o);
3
3
  export {
4
4
  s as isFunction,
@@ -1,92 +1,4 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var i=document.createElement("style");if(i.appendChild(document.createTextNode(".omega-input .v-input__details:has(.v-messages:empty){grid-template-rows:0fr;transition:all .2s}.omega-input .v-messages:empty{min-height:0}.omega-input .v-input__details:has(.v-messages){transition:all .2s;overflow:hidden;min-height:0;display:grid;grid-template-rows:1fr}.omega-input .v-messages{transition:all .2s}.omega-input .v-messages>*{transition-duration:0s!important}.omega-input [role=alert]:has(.v-messages:empty){padding:0}.omega-input .v-btn{cursor:pointer;width:auto;appearance:none;box-shadow:none;display:block;min-width:auto;height:auto;padding:.5em .5em .5em 1em}")),document.head.appendChild(i),window.customElements){const e=window.customElements.define;window.customElements.define=function(s,t){const n=t.prototype.connectedCallback;return t.prototype.connectedCallback=function(){if(n&&n.call(this),this.shadowRoot){const a=document.createElement("style");a.appendChild(document.createTextNode(".omega-input .v-input__details:has(.v-messages:empty){grid-template-rows:0fr;transition:all .2s}.omega-input .v-messages:empty{min-height:0}.omega-input .v-input__details:has(.v-messages){transition:all .2s;overflow:hidden;min-height:0;display:grid;grid-template-rows:1fr}.omega-input .v-messages{transition:all .2s}.omega-input .v-messages>*{transition-duration:0s!important}.omega-input [role=alert]:has(.v-messages:empty){padding:0}.omega-input .v-btn{cursor:pointer;width:auto;appearance:none;box-shadow:none;display:block;min-width:auto;height:auto;padding:.5em .5em .5em 1em}")),this.shadowRoot.appendChild(a)}},e.call(window.customElements,s,t)}}}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
2
- import { defineComponent as w, getCurrentInstance as x, useId as C, computed as a, watch as f, nextTick as N, onMounted as d, ref as $, watchEffect as k, renderSlot as B, normalizeProps as I, guardReactiveProps as O, createElementVNode as _, normalizeClass as q, createBlock as L, createCommentVNode as P, unref as F, openBlock as S, mergeProps as T } from "vue";
3
- import { useStore as z } from "@tanstack/vue-form";
4
- import { useOmegaErrors as A } from "./vue-components.es8.js";
5
- import D from "./vue-components.es27.js";
6
-
7
- const J = /* @__PURE__ */ w({
8
- inheritAttrs: !1,
9
- __name: "OmegaInternalInput",
10
- props: {
11
- field: {},
12
- meta: {},
13
- label: {},
14
- options: {},
15
- type: {},
16
- validators: {}
17
- },
18
- setup(c) {
19
- const e = c, v = x()?.appContext.components.VTextField, l = C(), o = e.field, r = z(o.store, (t) => t), m = a(() => e.type ? e.type : e.meta?.type === "string" ? e.meta.format === "email" ? "email" : "string" : e.meta?.type || "unknown"), n = a(() => r.value.value), g = a(
20
- () => (
21
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
- r.value.meta.errors.map((t) => t?.message).filter(Boolean)
23
- )
24
- ), y = (t) => t == null || t === !1 || t === "" || Number.isNaN(t);
25
- f(
26
- () => !!n.value,
27
- () => {
28
- y(n.value) && e.meta?.type !== "boolean" && N(() => {
29
- o.setValue(
30
- e.meta?.nullableOrUndefined === "undefined" ? void 0 : null
31
- );
32
- });
33
- }
34
- ), d(() => {
35
- !n.value && !e.meta?.required && e.meta?.nullableOrUndefined === "null" && o.setValue(null);
36
- });
37
- const { addError: h, removeError: b, showErrors: E, showErrorsOn: V } = A(), s = $(!1);
38
- k(() => {
39
- (E.value || V === "onChange") && (s.value = !0);
40
- });
41
- const u = () => {
42
- s.value = !0;
43
- };
44
- d(() => {
45
- n.value && u();
46
- });
47
- const p = a(() => !s.value && m.value !== "select" ? [] : g.value);
48
- f(
49
- () => r.value.meta.errors,
50
- () => {
51
- r.value.meta.errors.length ? h({
52
- inputId: l,
53
- errors: r.value.meta.errors.map((t) => t.message).filter(Boolean),
54
- label: e.label
55
- }) : b(l);
56
- }
57
- );
58
- const i = a(() => ({
59
- id: l,
60
- required: e.meta?.required,
61
- minLength: e.meta?.type === "string" && e.meta?.minLength,
62
- maxLength: e.meta?.type === "string" && e.meta?.maxLength,
63
- max: e.meta?.type === "number" && e.meta?.maximum,
64
- min: e.meta?.type === "number" && e.meta?.minimum,
65
- name: e.field.name,
66
- modelValue: e.field.state.value,
67
- errorMessages: p.value,
68
- error: !!p.value.length,
69
- field: e.field,
70
- setRealDirty: u,
71
- type: m.value,
72
- label: `${e.label}${e.meta?.required ? " *" : ""}`,
73
- options: e.options
74
- }));
75
- return (t, R) => B(t.$slots, "default", I(O(i.value)), () => [
76
- _("div", {
77
- class: q(t.$attrs.class),
78
- onFocusout: u
79
- }, [
80
- F(v) ? (S(), L(D, T({
81
- key: 0,
82
- "input-props": i.value
83
- }, t.$attrs, {
84
- "vuetify-value": i.value.field.state.value
85
- }), null, 16, ["input-props", "vuetify-value"])) : P("", !0)
86
- ], 34)
87
- ]);
88
- }
89
- });
1
+ const o = (n) => typeof n == "function";
90
2
  export {
91
- J as default
3
+ o as isFunction
92
4
  };
@@ -1,13 +1,92 @@
1
- import { useStore as u } from "@tanstack/vue-form";
2
- import { computed as f } from "vue";
3
- function c(o, t) {
4
- return f(() => t ? u(o.store, (n) => {
5
- const r = {};
6
- for (const e of t)
7
- r[e] = n[e];
8
- return r;
9
- }).value : {});
10
- }
1
+ (function(){"use strict";try{if(typeof document<"u"){var i=document.createElement("style");if(i.appendChild(document.createTextNode(".omega-input .v-input__details:has(.v-messages:empty){grid-template-rows:0fr;transition:all .2s}.omega-input .v-messages:empty{min-height:0}.omega-input .v-input__details:has(.v-messages){transition:all .2s;overflow:hidden;min-height:0;display:grid;grid-template-rows:1fr}.omega-input .v-messages{transition:all .2s}.omega-input .v-messages>*{transition-duration:0s!important}.omega-input [role=alert]:has(.v-messages:empty){padding:0}.omega-input .v-btn{cursor:pointer;width:auto;appearance:none;box-shadow:none;display:block;min-width:auto;height:auto;padding:.5em .5em .5em 1em}")),document.head.appendChild(i),window.customElements){const e=window.customElements.define;window.customElements.define=function(s,t){const n=t.prototype.connectedCallback;return t.prototype.connectedCallback=function(){if(n&&n.call(this),this.shadowRoot){const a=document.createElement("style");a.appendChild(document.createTextNode(".omega-input .v-input__details:has(.v-messages:empty){grid-template-rows:0fr;transition:all .2s}.omega-input .v-messages:empty{min-height:0}.omega-input .v-input__details:has(.v-messages){transition:all .2s;overflow:hidden;min-height:0;display:grid;grid-template-rows:1fr}.omega-input .v-messages{transition:all .2s}.omega-input .v-messages>*{transition-duration:0s!important}.omega-input [role=alert]:has(.v-messages:empty){padding:0}.omega-input .v-btn{cursor:pointer;width:auto;appearance:none;box-shadow:none;display:block;min-width:auto;height:auto;padding:.5em .5em .5em 1em}")),this.shadowRoot.appendChild(a)}},e.call(window.customElements,s,t)}}}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
2
+ import { defineComponent as w, getCurrentInstance as x, useId as C, computed as a, watch as f, nextTick as N, onMounted as d, ref as $, watchEffect as k, renderSlot as B, normalizeProps as I, guardReactiveProps as O, createElementVNode as _, normalizeClass as q, createBlock as L, createCommentVNode as P, unref as F, openBlock as S, mergeProps as T } from "vue";
3
+ import { useStore as z } from "@tanstack/vue-form";
4
+ import { useOmegaErrors as A } from "./vue-components.es8.js";
5
+ import D from "./vue-components.es27.js";
6
+
7
+ const J = /* @__PURE__ */ w({
8
+ inheritAttrs: !1,
9
+ __name: "OmegaInternalInput",
10
+ props: {
11
+ field: {},
12
+ meta: {},
13
+ label: {},
14
+ options: {},
15
+ type: {},
16
+ validators: {}
17
+ },
18
+ setup(c) {
19
+ const e = c, v = x()?.appContext.components.VTextField, l = C(), o = e.field, r = z(o.store, (t) => t), m = a(() => e.type ? e.type : e.meta?.type === "string" ? e.meta.format === "email" ? "email" : "string" : e.meta?.type || "unknown"), n = a(() => r.value.value), g = a(
20
+ () => (
21
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
+ r.value.meta.errors.map((t) => t?.message).filter(Boolean)
23
+ )
24
+ ), y = (t) => t == null || t === !1 || t === "" || Number.isNaN(t);
25
+ f(
26
+ () => !!n.value,
27
+ () => {
28
+ y(n.value) && e.meta?.type !== "boolean" && N(() => {
29
+ o.setValue(
30
+ e.meta?.nullableOrUndefined === "undefined" ? void 0 : null
31
+ );
32
+ });
33
+ }
34
+ ), d(() => {
35
+ !n.value && !e.meta?.required && e.meta?.nullableOrUndefined === "null" && o.setValue(null);
36
+ });
37
+ const { addError: h, removeError: b, showErrors: E, showErrorsOn: V } = A(), s = $(!1);
38
+ k(() => {
39
+ (E.value || V === "onChange") && (s.value = !0);
40
+ });
41
+ const u = () => {
42
+ s.value = !0;
43
+ };
44
+ d(() => {
45
+ n.value && u();
46
+ });
47
+ const p = a(() => !s.value && m.value !== "select" ? [] : g.value);
48
+ f(
49
+ () => r.value.meta.errors,
50
+ () => {
51
+ r.value.meta.errors.length ? h({
52
+ inputId: l,
53
+ errors: r.value.meta.errors.map((t) => t.message).filter(Boolean),
54
+ label: e.label
55
+ }) : b(l);
56
+ }
57
+ );
58
+ const i = a(() => ({
59
+ id: l,
60
+ required: e.meta?.required,
61
+ minLength: e.meta?.type === "string" && e.meta?.minLength,
62
+ maxLength: e.meta?.type === "string" && e.meta?.maxLength,
63
+ max: e.meta?.type === "number" && e.meta?.maximum,
64
+ min: e.meta?.type === "number" && e.meta?.minimum,
65
+ name: e.field.name,
66
+ modelValue: e.field.state.value,
67
+ errorMessages: p.value,
68
+ error: !!p.value.length,
69
+ field: e.field,
70
+ setRealDirty: u,
71
+ type: m.value,
72
+ label: `${e.label}${e.meta?.required ? " *" : ""}`,
73
+ options: e.options
74
+ }));
75
+ return (t, R) => B(t.$slots, "default", I(O(i.value)), () => [
76
+ _("div", {
77
+ class: q(t.$attrs.class),
78
+ onFocusout: u
79
+ }, [
80
+ F(v) ? (S(), L(D, T({
81
+ key: 0,
82
+ "input-props": i.value
83
+ }, t.$attrs, {
84
+ "vuetify-value": i.value.field.state.value
85
+ }), null, 16, ["input-props", "vuetify-value"])) : P("", !0)
86
+ ], 34)
87
+ ]);
88
+ }
89
+ });
11
90
  export {
12
- c as getOmegaStore
91
+ J as default
13
92
  };
@@ -1,4 +1,13 @@
1
- const o = (n) => typeof n == "function";
1
+ import { useStore as u } from "@tanstack/vue-form";
2
+ import { computed as f } from "vue";
3
+ function c(o, t) {
4
+ return f(() => t ? u(o.store, (n) => {
5
+ const r = {};
6
+ for (const e of t)
7
+ r[e] = n[e];
8
+ return r;
9
+ }).value : {});
10
+ }
2
11
  export {
3
- o as isFunction
12
+ c as getOmegaStore
4
13
  };
@@ -1,4 +1,4 @@
1
- import f from "./vue-components.es23.js";
1
+ import f from "./vue-components.es24.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,52 +1,53 @@
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.es23.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: "OmegaInput",
4
+ __name: "OmegaArray",
7
5
  props: {
8
6
  form: {},
9
7
  name: {},
10
- validators: {},
11
- label: {},
12
- options: {},
13
- type: {}
8
+ defaultItems: {},
9
+ items: {}
14
10
  },
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);
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
- 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)))
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
- }, 1040, ["field", "label", "options", "meta", "type"])) : v("", !0)
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", "validators"]));
48
+ }, 8, ["name"]));
48
49
  }
49
50
  });
50
51
  export {
51
- P as default
52
+ N as default
52
53
  };