@effect-app/vue-components 1.8.2 → 1.8.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.
Files changed (72) hide show
  1. package/dist/types/components/OmegaForm/InputProps.d.ts +0 -1
  2. package/dist/types/components/OmegaForm/OmegaErrorsInternal.vue.d.ts +0 -1
  3. package/dist/types/components/OmegaForm/OmegaInput.vue.d.ts +0 -1
  4. package/dist/types/components/OmegaForm/OmegaInternalInput.vue.d.ts +10 -1
  5. package/dist/types/components/OmegaForm/index.d.ts +0 -1
  6. package/dist/types/components/OmegaForm/useOmegaForm.d.ts +6 -1
  7. package/dist/types/components/OmegaForm/useRegisterField.d.ts +7 -0
  8. package/dist/vue-components.es.js +24 -26
  9. package/dist/vue-components.es10.js +23 -352
  10. package/dist/vue-components.es11.js +2 -27
  11. package/dist/vue-components.es12.js +10 -2
  12. package/dist/vue-components.es13.js +5 -10
  13. package/dist/vue-components.es14.js +54 -5
  14. package/dist/vue-components.es15.js +63 -49
  15. package/dist/vue-components.es16.js +6 -68
  16. package/dist/vue-components.es17.js +5 -5
  17. package/dist/vue-components.es18.js +3 -6
  18. package/dist/vue-components.es19.js +3 -3
  19. package/dist/vue-components.es2.js +19 -21
  20. package/dist/vue-components.es20.js +2 -3
  21. package/dist/vue-components.es21.js +1 -1
  22. package/dist/vue-components.es22.js +17 -2
  23. package/dist/vue-components.es23.js +10 -16
  24. package/dist/vue-components.es24.js +135 -11
  25. package/dist/vue-components.es26.js +44 -0
  26. package/dist/vue-components.es27.js +2 -42
  27. package/dist/vue-components.es29.js +89 -2
  28. package/dist/vue-components.es31.js +9 -0
  29. package/dist/vue-components.es32.js +31 -7
  30. package/dist/vue-components.es34.js +6 -0
  31. package/dist/vue-components.es35.js +23 -4
  32. package/dist/vue-components.es36.js +5 -23
  33. package/dist/vue-components.es37.js +21 -5
  34. package/dist/vue-components.es38.js +25 -16
  35. package/dist/vue-components.es39.js +15 -23
  36. package/dist/vue-components.es4.js +2 -2
  37. package/dist/vue-components.es40.js +7 -17
  38. package/dist/vue-components.es41.js +5 -12
  39. package/dist/vue-components.es42.js +19 -5
  40. package/dist/vue-components.es43.js +9 -19
  41. package/dist/vue-components.es44.js +31 -9
  42. package/dist/vue-components.es45.js +42 -25
  43. package/dist/vue-components.es46.js +16 -38
  44. package/dist/vue-components.es47.js +11 -26
  45. package/dist/vue-components.es48.js +65 -11
  46. package/dist/vue-components.es49.js +45 -54
  47. package/dist/vue-components.es5.js +10 -9
  48. package/dist/vue-components.es50.js +15 -54
  49. package/dist/vue-components.es51.js +31 -15
  50. package/dist/vue-components.es52.js +26 -30
  51. package/dist/vue-components.es53.js +42 -29
  52. package/dist/vue-components.es54.js +2 -42
  53. package/dist/vue-components.es55.js +44 -2
  54. package/dist/vue-components.es56.js +2 -44
  55. package/dist/vue-components.es6.js +37 -58
  56. package/dist/vue-components.es7.js +219 -27
  57. package/dist/vue-components.es8.js +28 -211
  58. package/dist/vue-components.es9.js +355 -29
  59. package/package.json +1 -1
  60. package/src/components/OmegaForm/InputProps.ts +0 -1
  61. package/src/components/OmegaForm/OmegaErrorsInternal.vue +1 -2
  62. package/src/components/OmegaForm/OmegaInput.vue +1 -0
  63. package/src/components/OmegaForm/OmegaInternalInput.vue +20 -58
  64. package/src/components/OmegaForm/index.ts +0 -1
  65. package/src/components/OmegaForm/useOmegaForm.ts +42 -13
  66. package/src/components/OmegaForm/useRegisterField.ts +15 -0
  67. package/dist/types/components/OmegaForm/OmegaErrorsContext.d.ts +0 -38
  68. package/dist/vue-components.es25.js +0 -137
  69. package/dist/vue-components.es30.js +0 -92
  70. package/dist/vue-components.es33.js +0 -33
  71. package/dist/vue-components.es57.js +0 -4
  72. package/src/components/OmegaForm/OmegaErrorsContext.ts +0 -67
@@ -10,7 +10,6 @@ export type InputProps<From extends Record<PropertyKey, any>, TName extends Deep
10
10
  min?: number | false;
11
11
  errorMessages: string[];
12
12
  error: boolean;
13
- setRealDirty: () => void;
14
13
  label: string;
15
14
  type: string;
16
15
  };
@@ -3,7 +3,6 @@ import { type OmegaError } from "./OmegaFormStuff";
3
3
  type __VLS_Props = {
4
4
  errors: readonly OmegaError[];
5
5
  generalErrors: (Record<string, StandardSchemaV1Issue[]> | undefined)[] | undefined;
6
- showErrors: boolean;
7
6
  };
8
7
  declare var __VLS_6: {
9
8
  errors: readonly OmegaError[];
@@ -14,7 +14,6 @@ declare const __VLS_export: <From extends Record<PropertyKey, any>, To extends R
14
14
  min?: number | false;
15
15
  errorMessages: string[];
16
16
  error: boolean;
17
- setRealDirty: () => void;
18
17
  label: string;
19
18
  type: string;
20
19
  }) => any;
@@ -1,4 +1,5 @@
1
1
  import { type DeepKeys } from "@tanstack/vue-form";
2
+ import { type ComputedRef } from "vue";
2
3
  import type { OmegaFieldInternalApi } from "./InputProps";
3
4
  import type { FieldValidators, MetaRecord, NestedKeyOf, TypeOverride } from "./OmegaFormStuff";
4
5
  declare const __VLS_export: <From extends Record<PropertyKey, any>, Name extends DeepKeys<From>>(__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<{
@@ -8,6 +9,15 @@ declare const __VLS_export: <From extends Record<PropertyKey, any>, Name extends
8
9
  label: string;
9
10
  type?: TypeOverride;
10
11
  validators?: FieldValidators<From>;
12
+ register: (field: ComputedRef<{
13
+ name: string;
14
+ label: string;
15
+ id: string;
16
+ }>) => void;
17
+ options?: {
18
+ title: string;
19
+ value: string;
20
+ }[];
11
21
  }> & import("vue").PublicProps;
12
22
  expose: (exposed: {}) => void;
13
23
  attrs: any;
@@ -22,7 +32,6 @@ declare const __VLS_export: <From extends Record<PropertyKey, any>, Name extends
22
32
  min?: number | false;
23
33
  errorMessages: string[];
24
34
  error: boolean;
25
- setRealDirty: () => void;
26
35
  label: string;
27
36
  type: string;
28
37
  }) => any;
@@ -1,4 +1,3 @@
1
- export * as OmegaErrorsContext from "./OmegaErrorsContext";
2
1
  export * from "./OmegaFormStuff";
3
2
  export { type OmegaConfig, type OmegaFormReturn, useOmegaForm } from "./useOmegaForm";
4
3
  export { type InputProps, type MergedInputProps } from "./InputProps";
@@ -1,6 +1,6 @@
1
1
  import { type DeepKeys, DeepValue, StandardSchemaV1Issue, ValidationError, ValidationErrorMap } from "@tanstack/vue-form";
2
2
  import { Effect, Order, S } from "effect-app";
3
- import { type InjectionKey } from "vue";
3
+ import { ComputedRef, type InjectionKey } from "vue";
4
4
  import { MergedInputProps } from "./InputProps";
5
5
  import { BaseProps, DefaultTypeProps, type FilterItems, type FormProps, type MetaRecord, type NestedKeyOf, OmegaAutoGenMeta, OmegaError, type OmegaFormApi, OmegaFormState, OmegaInputProps, ShowErrorsOn } from "./OmegaFormStuff";
6
6
  type keysRule<T> = {
@@ -44,6 +44,11 @@ export interface OF<From, To> extends OmegaFormApi<From, To> {
44
44
  filterItems?: FilterItems;
45
45
  clear: () => void;
46
46
  i18nNamespace?: string;
47
+ registerField: (field: ComputedRef<{
48
+ name: string;
49
+ label: string;
50
+ id: string;
51
+ }>) => void;
47
52
  /** @experimental */
48
53
  handleSubmitEffect: {
49
54
  /**
@@ -0,0 +1,7 @@
1
+ import { type ComputedRef } from "vue";
2
+ export declare const useRegisterField: (field: ComputedRef<{
3
+ name: string;
4
+ label: string;
5
+ id: string;
6
+ }>) => void;
7
+ export declare const provideRegisterField: () => void;
@@ -1,13 +1,12 @@
1
1
  import * as o from "./vue-components.es2.js";
2
- import { getTransformationFrom as f, provideIntl as u, useIntl as l, useIntlKey as i } from "./vue-components.es3.js";
3
- import { default as x } from "./vue-components.es4.js";
4
- import { default as g } from "./vue-components.es5.js";
5
- import { default as y } from "./vue-components.es6.js";
6
- import * as n from "./vue-components.es7.js";
7
- import { useOmegaForm as F } from "./vue-components.es8.js";
8
- import { useOnClose as C, usePreventClose as S } from "./vue-components.es9.js";
9
- import { createMeta as M, duplicateSchema as j, generateInputStandardSchemaFromFieldMeta as v, generateMetaFromSchema as P, getInputType as T, nullableInput as k } from "./vue-components.es10.js";
10
- import { createUseFormWithCustomInput as D } from "./vue-components.es11.js";
2
+ import { getTransformationFrom as f, provideIntl as s, useIntl as u, useIntlKey as l } from "./vue-components.es3.js";
3
+ import { default as i } from "./vue-components.es4.js";
4
+ import { default as x } from "./vue-components.es5.js";
5
+ import { default as g } from "./vue-components.es6.js";
6
+ import { useOmegaForm as F } from "./vue-components.es7.js";
7
+ import { useOnClose as h, usePreventClose as S } from "./vue-components.es8.js";
8
+ import { createMeta as C, duplicateSchema as M, generateInputStandardSchemaFromFieldMeta as j, generateMetaFromSchema as v, getInputType as P, nullableInput as T } from "./vue-components.es9.js";
9
+ import { createUseFormWithCustomInput as w } from "./vue-components.es10.js";
11
10
  function a(r) {
12
11
  for (const e in o)
13
12
  if (Object.prototype.hasOwnProperty.call(o, e)) {
@@ -15,25 +14,24 @@ function a(r) {
15
14
  t && typeof t == "object" && r.component(e, t);
16
15
  }
17
16
  }
18
- const m = { install: a };
17
+ const n = { install: a };
19
18
  export {
20
- x as Dialog,
21
- n as OmegaErrorsContext,
22
- g as OmegaInput,
23
- y as OmegaVuetifyInput,
24
- M as createMeta,
25
- D as createUseFormWithCustomInput,
26
- m as default,
27
- j as duplicateSchema,
28
- v as generateInputStandardSchemaFromFieldMeta,
29
- P as generateMetaFromSchema,
30
- T as getInputType,
19
+ i as Dialog,
20
+ x as OmegaInput,
21
+ g as OmegaVuetifyInput,
22
+ C as createMeta,
23
+ w as createUseFormWithCustomInput,
24
+ n as default,
25
+ M as duplicateSchema,
26
+ j as generateInputStandardSchemaFromFieldMeta,
27
+ v as generateMetaFromSchema,
28
+ P as getInputType,
31
29
  f as getTransformationFrom,
32
- k as nullableInput,
33
- u as provideIntl,
34
- l as useIntl,
35
- i as useIntlKey,
30
+ T as nullableInput,
31
+ s as provideIntl,
32
+ u as useIntl,
33
+ l as useIntlKey,
36
34
  F as useOmegaForm,
37
- C as useOnClose,
35
+ h as useOnClose,
38
36
  S as usePreventClose
39
37
  };
@@ -1,358 +1,29 @@
1
- import { S as n, Option as c, pipe as q } from "effect-app";
2
- import { getMetadataFromSchema as U } from "@effect-app/vue/form";
3
- import { useIntl as _, getTransformationFrom as N } from "./vue-components.es3.js";
4
- const w = n.NonEmptyArray(n.String), E = (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: p }, o = {}) => {
5
- if (t && t._tag === "Transformation")
6
- return m({
7
- parent: i,
8
- meta: e,
9
- property: t.from
10
- });
11
- if (t?._tag === "TypeLiteral" && "propertySignatures" in t)
12
- return m({
13
- meta: e,
14
- propertySignatures: t.propertySignatures
15
- });
16
- if (p) {
17
- for (const r of p) {
18
- const l = i ? `${i}.${r.name.toString()}` : r.name.toString(), a = g(r.type), u = !a, A = r.type;
19
- if (n.AST.isUnion(r.type)) {
20
- const T = r.type.types.filter(
21
- (s) => s._tag !== "UndefinedKeyword" && s !== n.Null.ast
22
- ).map(N);
23
- if (T.some(
24
- (s) => "propertySignatures" in s
25
- )) {
26
- if (!a) {
27
- const s = m({
28
- parent: l,
29
- property: r.type,
30
- meta: { required: u, nullableOrUndefined: a }
31
- });
32
- o[l] = s;
33
- }
34
- for (const s of T)
35
- "propertySignatures" in s && Object.assign(
36
- o,
37
- m({
38
- parent: l,
39
- propertySignatures: s.propertySignatures,
40
- meta: { required: u, nullableOrUndefined: a }
41
- })
42
- );
43
- } else {
44
- const s = T.filter(n.AST.isTupleType);
45
- if (s.length > 0) {
46
- const f = s[0];
47
- if (o[l] = {
48
- type: "multiple",
49
- members: f.elements,
50
- rest: f.rest,
51
- required: u,
52
- nullableOrUndefined: a
53
- }, f.rest && f.rest.length > 0) {
54
- const d = f.rest[0];
55
- if (d.type._tag === "TypeLiteral" && "propertySignatures" in d.type)
56
- for (const y of d.type.propertySignatures) {
57
- const b = `${l}.${y.name.toString()}`, S = m({
58
- parent: b,
59
- property: y.type,
60
- meta: {
61
- required: !g(y.type),
62
- nullableOrUndefined: g(y.type)
63
- }
64
- });
65
- if (S && typeof S == "object" && "type" in S && (o[b] = S, S.type === "multiple" && n.AST.isTupleType(y.type) && y.type.rest && y.type.rest.length > 0)) {
66
- const O = y.type.rest[0];
67
- if (O.type._tag === "TypeLiteral" && "propertySignatures" in O.type)
68
- for (const x of O.type.propertySignatures) {
69
- const M = `${b}.${x.name.toString()}`, v = m({
70
- parent: M,
71
- property: x.type,
72
- meta: {
73
- required: !g(x.type),
74
- nullableOrUndefined: g(x.type)
75
- }
76
- });
77
- v && typeof v == "object" && "type" in v && (o[M] = v);
78
- }
79
- }
80
- }
81
- }
82
- } else {
83
- const f = m({
84
- parent: l,
85
- property: r.type,
86
- meta: { required: u, nullableOrUndefined: a }
87
- });
88
- o[l] = f;
89
- }
1
+ import { h as t } from "vue";
2
+ import i from "./vue-components.es5.js";
3
+ import { useOmegaForm as f } from "./vue-components.es7.js";
4
+ const g = (r) => (...e) => {
5
+ const [o, n, m] = e;
6
+ return f(
7
+ o,
8
+ n,
9
+ {
10
+ ...m,
11
+ input: {
12
+ name: "WrappedInput",
13
+ inheritAttrs: !1,
14
+ setup(p, { attrs: s }) {
15
+ return () => t(i, {
16
+ ...p,
17
+ ...s
18
+ }, {
19
+ // Override the default slot that OmegaInternalInput provides
20
+ default: ({ field: a, ...u }) => t(r, { field: a, inputProps: u })
21
+ });
90
22
  }
91
- } else if ("propertySignatures" in A)
92
- Object.assign(
93
- o,
94
- m({
95
- parent: l,
96
- propertySignatures: A.propertySignatures,
97
- meta: { required: u, nullableOrUndefined: a }
98
- })
99
- );
100
- else if (n.AST.isTupleType(r.type))
101
- if (r.type.rest.length > 0 && r.type.rest[0].type._tag === "TypeLiteral" && "propertySignatures" in r.type.rest[0].type) {
102
- const h = r.type.rest[0].type;
103
- if (h._tag === "TypeLiteral" && "propertySignatures" in h)
104
- for (const s of h.propertySignatures) {
105
- const f = `${l}.${s.name.toString()}`;
106
- if (n.AST.isTupleType(s.type) && s.type.rest.length > 0) {
107
- const d = s.type.rest[0].type;
108
- if (d._tag === "TypeLiteral" && "propertySignatures" in d)
109
- for (const y of d.propertySignatures) {
110
- const b = `${f}.${y.name.toString()}`, S = m({
111
- parent: b,
112
- property: y.type,
113
- meta: {
114
- required: !g(y.type),
115
- nullableOrUndefined: g(y.type)
116
- }
117
- });
118
- o[b] = S;
119
- }
120
- else
121
- o[f] = {
122
- type: "multiple",
123
- members: s.type.elements,
124
- rest: s.type.rest,
125
- required: !g(s.type),
126
- nullableOrUndefined: g(s.type)
127
- };
128
- } else {
129
- const d = m({
130
- parent: f,
131
- property: s.type,
132
- meta: {
133
- required: !g(s.type),
134
- nullableOrUndefined: g(s.type)
135
- }
136
- });
137
- o[f] = d;
138
- }
139
- }
140
- } else
141
- o[l] = {
142
- type: "multiple",
143
- members: r.type.elements,
144
- rest: r.type.rest,
145
- required: u,
146
- nullableOrUndefined: a
147
- };
148
- else {
149
- const T = m({
150
- parent: l,
151
- property: r.type,
152
- meta: {
153
- // an empty string is valid for a S.String field, so we should not mark it as required
154
- // TODO: handle this better via the createMeta minLength parsing
155
- required: u && (r.type._tag !== "StringKeyword" || U(r.type).minLength),
156
- nullableOrUndefined: a
157
- }
158
- });
159
- o[l] = T;
160
23
  }
161
24
  }
162
- return o;
163
- }
164
- if (t) {
165
- const r = E(t);
166
- if (Object.hasOwnProperty.call(e, "required") || (e.required = !r), n.AST.isUnion(t)) {
167
- const a = t.types.find(
168
- (u) => u._tag !== "UndefinedKeyword" && u !== n.Null.ast
169
- );
170
- return "propertySignatures" in a ? m({
171
- propertySignatures: a.propertySignatures,
172
- parent: i,
173
- meta: e
174
- }) : t.types.every(n.AST.isLiteral) ? {
175
- ...e,
176
- type: "select",
177
- members: t.types.map((u) => u.literal)
178
- } : {
179
- ...e,
180
- ...m({
181
- parent: i,
182
- meta: e,
183
- property: a
184
- })
185
- };
186
- }
187
- if (n.AST.isTupleType(t))
188
- return {
189
- ...e,
190
- type: "multiple",
191
- members: t.elements,
192
- rest: t.rest
193
- };
194
- const l = n.AST.getAnnotation(
195
- t,
196
- n.AST.JSONSchemaAnnotationId
197
- ).pipe(c.getOrElse(() => ({})));
198
- return e = { ...e, ...l }, "from" in t ? m({
199
- parent: i,
200
- meta: e,
201
- property: t.from
202
- }) : (e.type = n.AST.getAnnotation(
203
- t,
204
- n.AST.TitleAnnotationId
205
- ).pipe(
206
- c.getOrElse(() => "unknown")
207
- ), e);
208
- }
209
- return o;
210
- }, L = (e) => {
211
- const i = e.ast, t = {};
212
- if (i._tag === "Transformation" || i._tag === "Refinement")
213
- return L(n.make(i.from));
214
- if ("propertySignatures" in i) {
215
- const p = m({
216
- propertySignatures: i.propertySignatures
217
- });
218
- if (Object.values(p).every((r) => r && "type" in r))
219
- return p;
220
- const o = (r, l = "") => {
221
- for (const a in r) {
222
- const u = l ? `${l}.${a}` : a;
223
- r[a] && typeof r[a] == "object" && "type" in r[a] ? t[u] = r[a] : r[a] && typeof r[a] == "object" && o(r[a], u);
224
- }
225
- };
226
- o(p);
227
- }
228
- return t;
229
- }, P = (e) => n.extend(e, n.Struct({})), F = (e) => {
230
- const i = L(e), t = q(
231
- e.ast,
232
- c.liftPredicate((p) => p._tag === "Refinement" && "filter" in p),
233
- c.flatMap((p) => n.AST.getJSONSchemaAnnotation(p)),
234
- c.filter((p) => "items" in p),
235
- c.filterMap(({ items: p }) => n.decodeUnknownOption(w)(p)),
236
- c.zipWith(
237
- n.AST.getMessageAnnotation(e.ast),
238
- (p, o) => ({
239
- items: p,
240
- message: o("")
241
- })
242
- ),
243
- c.getOrUndefined
244
25
  );
245
- return { schema: e, meta: i, filterItems: t };
246
- }, j = (e) => {
247
- const { trans: i } = _();
248
- let t;
249
- switch (e.type) {
250
- case "string":
251
- t = n.String.annotations({
252
- message: () => i("validation.empty")
253
- }), e.format === "email" && (t = n.compose(
254
- t,
255
- n.Email.annotations({
256
- message: () => i("validation.email.invalid")
257
- })
258
- )), e.required && t.annotations({
259
- message: () => i("validation.empty")
260
- }), e.maxLength && (t = t.pipe(n.maxLength(e.maxLength)).annotations({
261
- message: () => i("validation.string.maxLength", {
262
- maxLength: e.maxLength
263
- })
264
- })), e.minLength && (t = t.pipe(n.minLength(e.minLength)).annotations({
265
- message: () => i("validation.string.minLength", {
266
- minLength: e.minLength
267
- })
268
- }));
269
- break;
270
- case "number":
271
- t = n.Number.annotations({
272
- message: () => i("validation.empty")
273
- }), e.required && t.annotations({
274
- message: () => i("validation.empty")
275
- }), e.minimum && (t = t.pipe(n.greaterThanOrEqualTo(e.minimum)).annotations({
276
- message: () => i("validation.number.min", {
277
- minimum: e.minimum,
278
- isExclusive: !0
279
- })
280
- })), e.maximum && (t = t.pipe(n.lessThanOrEqualTo(e.maximum)).annotations({
281
- message: () => i("validation.number.max", {
282
- maximum: e.maximum,
283
- isExclusive: !0
284
- })
285
- })), e.exclusiveMinimum && (t = t.pipe(n.greaterThan(e.exclusiveMinimum)).annotations({
286
- message: () => i("validation.number.min", {
287
- minimum: e.exclusiveMinimum,
288
- isExclusive: !1
289
- })
290
- })), e.exclusiveMaximum && (t = t.pipe(n.lessThan(e.exclusiveMaximum)).annotations({
291
- message: () => i("validation.number.max", {
292
- maximum: e.exclusiveMaximum,
293
- isExclusive: !1
294
- })
295
- }));
296
- break;
297
- case "select":
298
- t = n.Literal(...e.members).annotations({
299
- message: () => ({
300
- message: i("validation.not_a_valid", {
301
- type: "select",
302
- message: e.members.join(", ")
303
- }),
304
- override: !0
305
- })
306
- });
307
- break;
308
- case "multiple":
309
- t = n.Array(n.String).annotations({
310
- message: () => i("validation.not_a_valid", {
311
- type: "multiple",
312
- message: e.members.join(", ")
313
- })
314
- });
315
- break;
316
- case "boolean":
317
- t = n.Boolean;
318
- break;
319
- // todo: switch must be exhaustive or have default case, otherwise falls through with schema undefined.
320
- case "unknown":
321
- t = n.Unknown;
322
- break;
323
- }
324
- return e.required ? t.pipe(
325
- n.annotations({
326
- message: () => i("validation.empty")
327
- })
328
- ) : t = n.NullishOr(t), n.standardSchemaV1(t);
329
- }, R = (e, i) => n.NullOr(e).pipe(
330
- n.transform(n.typeSchema(e), {
331
- decode: (t) => t ?? i(),
332
- encode: (t) => t
333
- })
334
- ), k = [
335
- "button",
336
- "checkbox",
337
- "color",
338
- "date",
339
- "email",
340
- "number",
341
- "password",
342
- "radio",
343
- "range",
344
- "search",
345
- "submit",
346
- "tel",
347
- "text",
348
- "time",
349
- "url"
350
- ], J = (e) => k.includes(e) ? e : "text";
26
+ };
351
27
  export {
352
- m as createMeta,
353
- P as duplicateSchema,
354
- j as generateInputStandardSchemaFromFieldMeta,
355
- F as generateMetaFromSchema,
356
- J as getInputType,
357
- R as nullableInput
28
+ g as createUseFormWithCustomInput
358
29
  };
@@ -1,29 +1,4 @@
1
- import { h as t } from "vue";
2
- import i from "./vue-components.es5.js";
3
- import { useOmegaForm as f } from "./vue-components.es8.js";
4
- const g = (r) => (...e) => {
5
- const [o, n, m] = e;
6
- return f(
7
- o,
8
- n,
9
- {
10
- ...m,
11
- input: {
12
- name: "WrappedInput",
13
- inheritAttrs: !1,
14
- setup(p, { attrs: s }) {
15
- return () => t(i, {
16
- ...p,
17
- ...s
18
- }, {
19
- // Override the default slot that OmegaInternalInput provides
20
- default: ({ field: a, ...u }) => t(r, { field: a, inputProps: u })
21
- });
22
- }
23
- }
24
- }
25
- );
26
- };
1
+ import f from "./vue-components.es4.js";
27
2
  export {
28
- g as createUseFormWithCustomInput
3
+ f as default
29
4
  };
@@ -1,4 +1,12 @@
1
- import f from "./vue-components.es4.js";
1
+ import { Exit as c, Runtime as s } from "effect";
2
+ import { dual as n, isFunction as m } from "./vue-components.es26.js";
3
+ const i = Symbol.for("clone-trait"), u = n(2, (e, t) => i in e ? e[i](t) : Object.setPrototypeOf(t, Object.getPrototypeOf(e)));
4
+ n(2, (e, t) => u(e, { ...e, ...m(t) ? t(e) : t }));
5
+ const b = (e) => new Promise((t, r) => e.addObserver((o) => {
6
+ c.isSuccess(o) ? t(o.value) : r(s.makeFiberFailure(o.cause));
7
+ }));
2
8
  export {
3
- f as default
9
+ u as clone,
10
+ i as cloneTrait,
11
+ b as runtimeFiberAsPromise
4
12
  };
@@ -1,12 +1,7 @@
1
- import { Exit as c, Runtime as s } from "effect";
2
- import { dual as n, isFunction as m } from "./vue-components.es27.js";
3
- const i = Symbol.for("clone-trait"), u = n(2, (e, t) => i in e ? e[i](t) : Object.setPrototypeOf(t, Object.getPrototypeOf(e)));
4
- n(2, (e, t) => u(e, { ...e, ...m(t) ? t(e) : t }));
5
- const b = (e) => new Promise((t, r) => e.addObserver((o) => {
6
- c.isSuccess(o) ? t(o.value) : r(s.makeFiberFailure(o.cause));
7
- }));
1
+ import { isFunction as c } from "./vue-components.es26.js";
2
+ const s = c, t = (o) => typeof o == "object" && o !== null, i = (o) => t(o) || s(o);
8
3
  export {
9
- u as clone,
10
- i as cloneTrait,
11
- b as runtimeFiberAsPromise
4
+ s as isFunction,
5
+ i as isObject,
6
+ t as isRecordOrArray
12
7
  };
@@ -1,7 +1,56 @@
1
- import { isFunction as c } from "./vue-components.es27.js";
2
- const s = c, t = (o) => typeof o == "object" && o !== null, i = (o) => t(o) || s(o);
1
+ import { defineComponent as F, computed as i, onMounted as M, provide as P, createBlock as c, openBlock as s, resolveDynamicComponent as p, withCtx as g, renderSlot as o, createElementBlock as k, normalizeProps as l, guardReactiveProps as u, Fragment as A, renderList as b, mergeProps as B } from "vue";
2
+ const N = /* @__PURE__ */ F({
3
+ inheritAttrs: !1,
4
+ __name: "OmegaArray",
5
+ props: {
6
+ form: {},
7
+ name: {},
8
+ defaultItems: {},
9
+ items: {}
10
+ },
11
+ setup(n) {
12
+ const a = n, y = a.form.useStore((e) => e.values), d = i(() => {
13
+ const e = a.name.replace(/\[/g, ".").replace(/\]/g, "");
14
+ try {
15
+ return e.split(".").reduce((r, t) => r && r[t], y.value);
16
+ } catch (r) {
17
+ return console.error(r), [];
18
+ }
19
+ });
20
+ M(async () => {
21
+ a.defaultItems && !d.value && a.form.setFieldValue(a.name, a.defaultItems);
22
+ });
23
+ const $ = i(() => (r) => {
24
+ const t = r.replace(/\[\d+\]/g, "");
25
+ return a.form.meta[t];
26
+ });
27
+ return P("getMetaFromArray", $), (e, r) => (s(), c(p(n.form.Field), { name: n.name }, {
28
+ default: g(({ field: t, state: f }) => [
29
+ o(e.$slots, "pre-array", l(u({ field: t, state: f }))),
30
+ (s(!0), k(A, null, b(d.value, (C, m) => (s(), c(p(n.form.Field), {
31
+ key: `${n.name}[${Number(m)}]`,
32
+ name: (
33
+ // eslint-disable-next-line
34
+ `${n.name}[${Number(m)}]`
35
+ )
36
+ }, {
37
+ default: g(({ field: v, state: h }) => [
38
+ o(e.$slots, "default", B({ ref_for: !0 }, {
39
+ subField: v,
40
+ subState: h,
41
+ index: Number(m),
42
+ field: t
43
+ }))
44
+ ]),
45
+ _: 2
46
+ }, 1032, ["name"]))), 128)),
47
+ o(e.$slots, "post-array", l(u({ field: t, state: f }))),
48
+ o(e.$slots, "field", l(u({ field: t })))
49
+ ]),
50
+ _: 3
51
+ }, 8, ["name"]));
52
+ }
53
+ });
3
54
  export {
4
- s as isFunction,
5
- i as isObject,
6
- t as isRecordOrArray
55
+ N as default
7
56
  };