@effect-app/vue-components 2.0.0 → 2.1.0

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 (75) hide show
  1. package/dist/types/components/OmegaForm/InputProps.d.ts +24 -0
  2. package/dist/types/components/OmegaForm/OmegaFormStuff.d.ts +1 -1
  3. package/dist/types/components/OmegaForm/OmegaInternalInput.vue.d.ts +2 -2
  4. package/dist/types/components/OmegaForm/OmegaTaggedUnion.vue.d.ts +34 -0
  5. package/dist/types/components/OmegaForm/OmegaTaggedUnionInternal.vue.d.ts +32 -0
  6. package/dist/types/components/OmegaForm/index.d.ts +3 -1
  7. package/dist/types/components/OmegaForm/useOmegaForm.d.ts +26 -0
  8. package/dist/vue-components.es.js +30 -26
  9. package/dist/vue-components.es10.js +223 -341
  10. package/dist/vue-components.es11.js +29 -33
  11. package/dist/vue-components.es12.js +357 -2
  12. package/dist/vue-components.es13.js +34 -2
  13. package/dist/vue-components.es14.js +2 -10
  14. package/dist/vue-components.es15.js +2 -5
  15. package/dist/vue-components.es16.js +10 -54
  16. package/dist/vue-components.es17.js +5 -68
  17. package/dist/vue-components.es18.js +54 -6
  18. package/dist/vue-components.es19.js +68 -6
  19. package/dist/vue-components.es2.js +20 -16
  20. package/dist/vue-components.es20.js +6 -3
  21. package/dist/vue-components.es21.js +6 -3
  22. package/dist/vue-components.es22.js +3 -2
  23. package/dist/vue-components.es23.js +3 -2
  24. package/dist/vue-components.es24.js +2 -17
  25. package/dist/vue-components.es25.js +2 -11
  26. package/dist/vue-components.es26.js +2 -136
  27. package/dist/vue-components.es27.js +4 -0
  28. package/dist/vue-components.es28.js +17 -42
  29. package/dist/vue-components.es29.js +11 -2
  30. package/dist/vue-components.es30.js +136 -2
  31. package/dist/vue-components.es32.js +44 -0
  32. package/dist/vue-components.es33.js +2 -7
  33. package/dist/vue-components.es34.js +2 -32
  34. package/dist/vue-components.es37.js +7 -23
  35. package/dist/vue-components.es38.js +32 -5
  36. package/dist/vue-components.es40.js +4 -30
  37. package/dist/vue-components.es41.js +20 -19
  38. package/dist/vue-components.es42.js +5 -12
  39. package/dist/vue-components.es43.js +21 -5
  40. package/dist/vue-components.es44.js +29 -18
  41. package/dist/vue-components.es45.js +22 -9
  42. package/dist/vue-components.es46.js +7 -26
  43. package/dist/vue-components.es47.js +5 -48
  44. package/dist/vue-components.es48.js +19 -26
  45. package/dist/vue-components.es49.js +9 -11
  46. package/dist/vue-components.es5.js +2 -2
  47. package/dist/vue-components.es50.js +26 -60
  48. package/dist/vue-components.es51.js +37 -45
  49. package/dist/vue-components.es52.js +26 -17
  50. package/dist/vue-components.es53.js +10 -32
  51. package/dist/vue-components.es54.js +65 -29
  52. package/dist/vue-components.es55.js +45 -31
  53. package/dist/vue-components.es56.js +17 -2
  54. package/dist/vue-components.es57.js +29 -40
  55. package/dist/vue-components.es58.js +29 -2
  56. package/dist/vue-components.es59.js +44 -0
  57. package/dist/vue-components.es6.js +9 -9
  58. package/dist/vue-components.es60.js +4 -0
  59. package/dist/vue-components.es61.js +46 -0
  60. package/dist/vue-components.es62.js +4 -0
  61. package/dist/vue-components.es7.js +26 -25
  62. package/dist/vue-components.es8.js +51 -198
  63. package/dist/vue-components.es9.js +17 -30
  64. package/package.json +1 -1
  65. package/src/components/OmegaForm/InputProps.ts +32 -0
  66. package/src/components/OmegaForm/OmegaFormStuff.ts +22 -3
  67. package/src/components/OmegaForm/OmegaInput.vue +4 -1
  68. package/src/components/OmegaForm/OmegaInternalInput.vue +35 -13
  69. package/src/components/OmegaForm/OmegaTaggedUnion.vue +73 -0
  70. package/src/components/OmegaForm/OmegaTaggedUnionInternal.vue +38 -0
  71. package/src/components/OmegaForm/index.ts +3 -1
  72. package/src/components/OmegaForm/useOmegaForm.ts +178 -11
  73. package/dist/vue-components.es36.js +0 -6
  74. package/dist/vue-components.es39.js +0 -23
  75. /package/dist/{vue-components.es31.js → vue-components.es35.js} +0 -0
@@ -1,4 +1,359 @@
1
- import f from "./vue-components.es4.js";
1
+ import { S as n, Option as q } from "effect-app";
2
+ import { getMetadataFromSchema as _ } from "@effect-app/vue/form";
3
+ import { useIntl as w, getTransformationFrom as N } from "./vue-components.es3.js";
4
+ const E = (e) => n.AST.isUnion(e) && e.types.find((i) => i._tag === "UndefinedKeyword" || i === n.Null.ast), d = (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, A = (e) => {
5
+ const i = [];
6
+ for (const t of e)
7
+ if (n.AST.isUnion(t)) {
8
+ const g = A(t.types);
9
+ i.push(...g);
10
+ } else
11
+ i.push(t);
12
+ return i;
13
+ }, m = ({ meta: e = {}, parent: i = "", property: t, propertySignatures: g }, a = {}) => {
14
+ if (t && t._tag === "Transformation")
15
+ return m({
16
+ parent: i,
17
+ meta: e,
18
+ property: t.from
19
+ });
20
+ if (t?._tag === "TypeLiteral" && "propertySignatures" in t)
21
+ return m({
22
+ meta: e,
23
+ propertySignatures: t.propertySignatures
24
+ });
25
+ if (g) {
26
+ for (const r of g) {
27
+ const o = i ? `${i}.${r.name.toString()}` : r.name.toString(), s = d(r.type);
28
+ let l;
29
+ e._isNullableDiscriminatedUnion && r.name.toString() === "_tag" || e.required === !1 ? l = !1 : l = !s;
30
+ const T = r.type;
31
+ if (n.AST.isUnion(r.type)) {
32
+ const c = A(r.type.types).filter(
33
+ (p) => p._tag !== "UndefinedKeyword" && p !== n.Null.ast
34
+ ).map(N);
35
+ if (c.some(
36
+ (p) => "propertySignatures" in p
37
+ )) {
38
+ if (!s) {
39
+ const p = m({
40
+ parent: o,
41
+ property: r.type,
42
+ meta: { required: l, nullableOrUndefined: s }
43
+ });
44
+ a[o] = p;
45
+ }
46
+ for (const p of c)
47
+ if ("propertySignatures" in p) {
48
+ const u = s && c.length > 1;
49
+ Object.assign(
50
+ a,
51
+ m({
52
+ parent: o,
53
+ propertySignatures: p.propertySignatures,
54
+ meta: u ? { _isNullableDiscriminatedUnion: !0 } : {}
55
+ })
56
+ );
57
+ }
58
+ } else {
59
+ const p = c.filter(n.AST.isTupleType);
60
+ if (p.length > 0) {
61
+ const u = p[0];
62
+ if (a[o] = {
63
+ type: "multiple",
64
+ members: u.elements,
65
+ rest: u.rest,
66
+ required: l,
67
+ nullableOrUndefined: s
68
+ }, u.rest && u.rest.length > 0) {
69
+ const S = u.rest[0];
70
+ if (S.type._tag === "TypeLiteral" && "propertySignatures" in S.type)
71
+ for (const f of S.type.propertySignatures) {
72
+ const b = `${o}.${f.name.toString()}`, h = m({
73
+ parent: b,
74
+ property: f.type,
75
+ meta: {
76
+ required: !d(f.type),
77
+ nullableOrUndefined: d(f.type)
78
+ }
79
+ });
80
+ if (h && typeof h == "object" && "type" in h && (a[b] = h, h.type === "multiple" && n.AST.isTupleType(f.type) && f.type.rest && f.type.rest.length > 0)) {
81
+ const U = f.type.rest[0];
82
+ if (U.type._tag === "TypeLiteral" && "propertySignatures" in U.type)
83
+ for (const x of U.type.propertySignatures) {
84
+ const L = `${b}.${x.name.toString()}`, v = m({
85
+ parent: L,
86
+ property: x.type,
87
+ meta: {
88
+ required: !d(x.type),
89
+ nullableOrUndefined: d(x.type)
90
+ }
91
+ });
92
+ v && typeof v == "object" && "type" in v && (a[L] = v);
93
+ }
94
+ }
95
+ }
96
+ }
97
+ } else {
98
+ const u = m({
99
+ parent: o,
100
+ property: r.type,
101
+ meta: { required: l, nullableOrUndefined: s }
102
+ });
103
+ a[o] = u;
104
+ }
105
+ }
106
+ } else if ("propertySignatures" in T)
107
+ Object.assign(
108
+ a,
109
+ m({
110
+ parent: o,
111
+ propertySignatures: T.propertySignatures,
112
+ meta: { required: l, nullableOrUndefined: s }
113
+ })
114
+ );
115
+ else if (n.AST.isTupleType(r.type))
116
+ if (r.type.rest.length > 0 && r.type.rest[0].type._tag === "TypeLiteral" && "propertySignatures" in r.type.rest[0].type) {
117
+ const c = r.type.rest[0].type;
118
+ if (c._tag === "TypeLiteral" && "propertySignatures" in c)
119
+ for (const y of c.propertySignatures) {
120
+ const p = `${o}.${y.name.toString()}`;
121
+ if (n.AST.isTupleType(y.type) && y.type.rest.length > 0) {
122
+ const u = y.type.rest[0].type;
123
+ if (u._tag === "TypeLiteral" && "propertySignatures" in u)
124
+ for (const S of u.propertySignatures) {
125
+ const f = `${p}.${S.name.toString()}`, b = m({
126
+ parent: f,
127
+ property: S.type,
128
+ meta: {
129
+ required: !d(S.type),
130
+ nullableOrUndefined: d(S.type)
131
+ }
132
+ });
133
+ a[f] = b;
134
+ }
135
+ else
136
+ a[p] = {
137
+ type: "multiple",
138
+ members: y.type.elements,
139
+ rest: y.type.rest,
140
+ required: !d(y.type),
141
+ nullableOrUndefined: d(y.type)
142
+ };
143
+ } else {
144
+ const u = m({
145
+ parent: p,
146
+ property: y.type,
147
+ meta: {
148
+ required: !d(y.type),
149
+ nullableOrUndefined: d(y.type)
150
+ }
151
+ });
152
+ a[p] = u;
153
+ }
154
+ }
155
+ } else
156
+ a[o] = {
157
+ type: "multiple",
158
+ members: r.type.elements,
159
+ rest: r.type.rest,
160
+ required: l,
161
+ nullableOrUndefined: s
162
+ };
163
+ else {
164
+ const O = m({
165
+ parent: o,
166
+ property: r.type,
167
+ meta: {
168
+ // an empty string is valid for a S.String field, so we should not mark it as required
169
+ // TODO: handle this better via the createMeta minLength parsing
170
+ required: l && (r.type._tag !== "StringKeyword" || _(r.type).minLength),
171
+ nullableOrUndefined: s
172
+ }
173
+ });
174
+ a[o] = O;
175
+ }
176
+ }
177
+ return a;
178
+ }
179
+ if (t) {
180
+ const r = E(t);
181
+ if (Object.hasOwnProperty.call(e, "required") || (e.required = !r), n.AST.isUnion(t)) {
182
+ const s = A(t.types), l = s.find(
183
+ (T) => T._tag !== "UndefinedKeyword" && T !== n.Null.ast
184
+ );
185
+ return "propertySignatures" in l ? m({
186
+ propertySignatures: l.propertySignatures,
187
+ parent: i,
188
+ meta: e
189
+ }) : s.every(n.AST.isLiteral) ? {
190
+ ...e,
191
+ type: "select",
192
+ members: s.map((T) => T.literal)
193
+ } : {
194
+ ...e,
195
+ ...m({
196
+ parent: i,
197
+ meta: e,
198
+ property: l
199
+ })
200
+ };
201
+ }
202
+ if (n.AST.isTupleType(t))
203
+ return {
204
+ ...e,
205
+ type: "multiple",
206
+ members: t.elements,
207
+ rest: t.rest
208
+ };
209
+ const o = n.AST.getAnnotation(
210
+ t,
211
+ n.AST.JSONSchemaAnnotationId
212
+ ).pipe(q.getOrElse(() => ({})));
213
+ return e = { ...e, ...o }, "from" in t ? m({
214
+ parent: i,
215
+ meta: e,
216
+ property: t.from
217
+ }) : (e.type = n.AST.getAnnotation(
218
+ t,
219
+ n.AST.TitleAnnotationId
220
+ ).pipe(
221
+ q.getOrElse(() => "unknown")
222
+ ), e);
223
+ }
224
+ return a;
225
+ }, M = (e) => {
226
+ const i = e.ast, t = {};
227
+ if (i._tag === "Transformation" || i._tag === "Refinement")
228
+ return M(n.make(i.from));
229
+ if ("propertySignatures" in i) {
230
+ const g = m({
231
+ propertySignatures: i.propertySignatures
232
+ });
233
+ if (Object.values(g).every((r) => r && "type" in r))
234
+ return g;
235
+ const a = (r, o = "") => {
236
+ for (const s in r) {
237
+ const l = o ? `${o}.${s}` : s;
238
+ r[s] && typeof r[s] == "object" && "type" in r[s] ? t[l] = r[s] : r[s] && typeof r[s] == "object" && a(r[s], l);
239
+ }
240
+ };
241
+ a(g);
242
+ }
243
+ return t;
244
+ }, P = (e) => n.extend(e, n.Struct({})), F = (e) => {
245
+ const i = M(e);
246
+ return { schema: e, meta: i };
247
+ }, j = (e) => {
248
+ const { trans: i } = w();
249
+ let t;
250
+ switch (e.type) {
251
+ case "string":
252
+ t = n.String.annotations({
253
+ message: () => i("validation.empty")
254
+ }), e.format === "email" && (t = n.compose(
255
+ t,
256
+ n.Email.annotations({
257
+ message: () => i("validation.email.invalid")
258
+ })
259
+ )), e.required && t.annotations({
260
+ message: () => i("validation.empty")
261
+ }), e.maxLength && (t = t.pipe(n.maxLength(e.maxLength)).annotations({
262
+ message: () => i("validation.string.maxLength", {
263
+ maxLength: e.maxLength
264
+ })
265
+ })), e.minLength && (t = t.pipe(n.minLength(e.minLength)).annotations({
266
+ message: () => i("validation.string.minLength", {
267
+ minLength: e.minLength
268
+ })
269
+ }));
270
+ break;
271
+ case "number":
272
+ t = n.Number.annotations({
273
+ message: () => i("validation.empty")
274
+ }), e.required && t.annotations({
275
+ message: () => i("validation.empty")
276
+ }), e.minimum && (t = t.pipe(n.greaterThanOrEqualTo(e.minimum)).annotations({
277
+ message: () => i("validation.number.min", {
278
+ minimum: e.minimum,
279
+ isExclusive: !0
280
+ })
281
+ })), e.maximum && (t = t.pipe(n.lessThanOrEqualTo(e.maximum)).annotations({
282
+ message: () => i("validation.number.max", {
283
+ maximum: e.maximum,
284
+ isExclusive: !0
285
+ })
286
+ })), e.exclusiveMinimum && (t = t.pipe(n.greaterThan(e.exclusiveMinimum)).annotations({
287
+ message: () => i("validation.number.min", {
288
+ minimum: e.exclusiveMinimum,
289
+ isExclusive: !1
290
+ })
291
+ })), e.exclusiveMaximum && (t = t.pipe(n.lessThan(e.exclusiveMaximum)).annotations({
292
+ message: () => i("validation.number.max", {
293
+ maximum: e.exclusiveMaximum,
294
+ isExclusive: !1
295
+ })
296
+ }));
297
+ break;
298
+ case "select":
299
+ t = n.Literal(...e.members).annotations({
300
+ message: () => ({
301
+ message: i("validation.not_a_valid", {
302
+ type: "select",
303
+ message: e.members.join(", ")
304
+ }),
305
+ override: !0
306
+ })
307
+ });
308
+ break;
309
+ case "multiple":
310
+ t = n.Array(n.String).annotations({
311
+ message: () => i("validation.not_a_valid", {
312
+ type: "multiple",
313
+ message: e.members.join(", ")
314
+ })
315
+ });
316
+ break;
317
+ case "boolean":
318
+ t = n.Boolean;
319
+ break;
320
+ // todo: switch must be exhaustive or have default case, otherwise falls through with schema undefined.
321
+ case "unknown":
322
+ t = n.Unknown;
323
+ break;
324
+ }
325
+ return e.required ? t.pipe(
326
+ n.annotations({
327
+ message: () => i("validation.empty")
328
+ })
329
+ ) : t = n.NullishOr(t), n.standardSchemaV1(t);
330
+ }, D = (e, i) => n.NullOr(e).pipe(
331
+ n.transform(n.typeSchema(e), {
332
+ decode: (t) => t ?? i(),
333
+ encode: (t) => t
334
+ })
335
+ ), k = [
336
+ "button",
337
+ "checkbox",
338
+ "color",
339
+ "date",
340
+ "email",
341
+ "number",
342
+ "password",
343
+ "radio",
344
+ "range",
345
+ "search",
346
+ "submit",
347
+ "tel",
348
+ "text",
349
+ "time",
350
+ "url"
351
+ ], R = (e) => k.includes(e) ? e : "text";
2
352
  export {
3
- f as default
353
+ m as createMeta,
354
+ P as duplicateSchema,
355
+ j as generateInputStandardSchemaFromFieldMeta,
356
+ F as generateMetaFromSchema,
357
+ R as getInputType,
358
+ D as nullableInput
4
359
  };
@@ -1,4 +1,36 @@
1
- import f from "./vue-components.es5.js";
1
+ import { h as o } from "vue";
2
+ import l from "./vue-components.es6.js";
3
+ import { useOmegaForm as O } from "./vue-components.es10.js";
4
+ const g = (n) => (...m) => {
5
+ const [p, s, a] = m;
6
+ return O(
7
+ p,
8
+ s,
9
+ {
10
+ ...a,
11
+ input: {
12
+ name: "WrappedInput",
13
+ inheritAttrs: !1,
14
+ setup(c, { attrs: t }) {
15
+ return () => o(l, {
16
+ ...c,
17
+ ...t
18
+ }, {
19
+ // Override the default slot that OmegaInternalInput provides
20
+ default: ({ field: f, state: i, ...r }) => {
21
+ const u = Object.fromEntries(
22
+ Object.entries(t).filter(
23
+ ([e]) => !Object.prototype.hasOwnProperty.call(r, e) && e !== "form"
24
+ )
25
+ );
26
+ return o(n, { ...u, field: f, state: i, inputProps: r });
27
+ }
28
+ });
29
+ }
30
+ }
31
+ }
32
+ );
33
+ };
2
34
  export {
3
- f as default
35
+ g as createUseFormWithCustomInput
4
36
  };
@@ -1,12 +1,4 @@
1
- import { Exit as c, Runtime as u } from "effect";
2
- import { dual as n, isFunction as m } from "./vue-components.es28.js";
3
- const i = Symbol.for("clone-trait"), a = n(2, (e, t) => i in e ? e[i](t) : Object.setPrototypeOf(t, Object.getPrototypeOf(e)));
4
- n(2, (e, t) => a(e, { ...e, ...m(t) ? t(e) : t }));
5
- const p = (e, t) => new Promise((o, s) => e.addObserver((r) => {
6
- c.isSuccess(r) ? o(r.value) : s(u.makeFiberFailure(r.cause));
7
- }));
1
+ import f from "./vue-components.es4.js";
8
2
  export {
9
- a as clone,
10
- i as cloneTrait,
11
- p as runtimeFiberAsPromise
3
+ f as default
12
4
  };
@@ -1,7 +1,4 @@
1
- import { isFunction as c } from "./vue-components.es28.js";
2
- const s = c, t = (o) => typeof o == "object" && o !== null, i = (o) => t(o) || s(o);
1
+ import f from "./vue-components.es5.js";
3
2
  export {
4
- s as isFunction,
5
- i as isObject,
6
- t as isRecordOrArray
3
+ f as default
7
4
  };
@@ -1,56 +1,12 @@
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
- });
1
+ import { Exit as c, Runtime as u } from "effect";
2
+ import { dual as n, isFunction as m } from "./vue-components.es32.js";
3
+ const i = Symbol.for("clone-trait"), a = n(2, (e, t) => i in e ? e[i](t) : Object.setPrototypeOf(t, Object.getPrototypeOf(e)));
4
+ n(2, (e, t) => a(e, { ...e, ...m(t) ? t(e) : t }));
5
+ const p = (e, t) => new Promise((o, s) => e.addObserver((r) => {
6
+ c.isSuccess(r) ? o(r.value) : s(u.makeFiberFailure(r.cause));
7
+ }));
54
8
  export {
55
- N as default
9
+ a as clone,
10
+ i as cloneTrait,
11
+ p as runtimeFiberAsPromise
56
12
  };
@@ -1,70 +1,7 @@
1
- import { defineComponent as O, computed as j, createElementBlock as M, openBlock as _, Fragment as E, renderList as A, renderSlot as F, createVNode as g, unref as h, mergeProps as k } from "vue";
2
- import { Order as l, pipe as v, Array as u } from "effect-app";
3
- const I = /* @__PURE__ */ O({
4
- __name: "OmegaAutoGen",
5
- props: {
6
- form: {},
7
- pick: {},
8
- omit: {},
9
- labelMap: { type: Function },
10
- filterMap: { type: Function },
11
- order: {},
12
- sort: {}
13
- },
14
- setup(i) {
15
- const p = (e) => (r) => Object.fromEntries(
16
- Object.entries(r).map(([t, o]) => [t, e(o, t)])
17
- ), a = (e) => (r) => Object.fromEntries(
18
- Object.entries(r).filter(([t, o]) => e(o, t))
19
- ), m = (e) => (r) => Object.entries(r).reduce(
20
- (t, [o, c]) => {
21
- const s = e(c, o);
22
- return s !== !1 && (t[o] = s), t;
23
- },
24
- {}
25
- ), n = i, f = (e, r) => {
26
- const t = r?.indexOf(e) ?? -1;
27
- return t === -1 ? Number.MAX_SAFE_INTEGER : t;
28
- }, d = l.mapInput(
29
- l.number,
30
- (e) => f(e.name, n.order || [])
31
- ), b = j(
32
- () => v(
33
- n.form.meta,
34
- // include / exclude
35
- a(
36
- (e, r) => n.pick ? n.pick.includes(r) && !n.omit?.includes(r) : !n.omit?.includes(r)
37
- ),
38
- (e) => e,
39
- // labelMap and adding name
40
- p((e, r) => ({
41
- name: r,
42
- label: n.labelMap?.(r) || r,
43
- ...e
44
- })),
45
- // filterMap
46
- n.filterMap ? m((e) => {
47
- const r = n.filterMap?.(e.name, e);
48
- return r === void 0 || r === !0 ? e : r;
49
- }) : (e) => e,
50
- // transform to array
51
- (e) => Object.values(e),
52
- // order
53
- u.sort(d),
54
- // sort
55
- n.sort ? u.sort(n.sort) : (e) => e
56
- )
57
- );
58
- return (e, r) => (_(!0), M(E, null, A(b.value, ({ name: t, label: o, ...c }) => F(e.$slots, "default", {
59
- child: { name: t, label: o, ...c }
60
- }, () => [
61
- g(h(i.form).Input, k({
62
- name: t,
63
- label: o
64
- }, { ref_for: !0 }, c), null, 16, ["name", "label"])
65
- ])), 256));
66
- }
67
- });
1
+ import { isFunction as c } from "./vue-components.es32.js";
2
+ const s = c, t = (o) => typeof o == "object" && o !== null, i = (o) => t(o) || s(o);
68
3
  export {
69
- I as default
4
+ s as isFunction,
5
+ i as isObject,
6
+ t as isRecordOrArray
70
7
  };
@@ -1,8 +1,56 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var a=document.createElement("style");if(a.appendChild(document.createTextNode(".v-enter-from[data-v-d4ffe76f],.v-leave-to[data-v-d4ffe76f]{max-height:0px;grid-template-rows:0fr;opacity:0}.v-enter-active[data-v-d4ffe76f],.v-leave-active[data-v-d4ffe76f]{display:grid;transition:all .15s}.v-enter-to[data-v-d4ffe76f],.v-leave-from[data-v-d4ffe76f]{grid-template-rows:1fr;max-height:50vh;opacity:1}.error-alert[data-v-d4ffe76f]{transition-behavior:allow-discrete;display:grid;overflow:hidden;min-height:0}.error-alert>*[data-v-d4ffe76f]{min-height:0}.error-list[data-v-d4ffe76f]{list-style-position:inside}div.error-list[data-v-d4ffe76f]{container-type:inline-size;display:grid;grid-template-columns:auto 1fr auto;gap:1.5em;align-items:start}@container (max-width: 27.125rem){div.error-list[data-v-d4ffe76f]{grid-template-columns:auto 1fr}.error-link[data-v-d4ffe76f]{grid-column:1 / -1;justify-self:end}}@container (max-width: 17.75rem){div.error-list[data-v-d4ffe76f]{grid-template-columns:1fr}.error-message[data-v-d4ffe76f]{grid-column:1 / -1}}.error-item[data-v-d4ffe76f]{display:contents}a[data-v-d4ffe76f]{min-width:min-content}.error-link[data-v-d4ffe76f]{align-items:center;color:inherit;display:inline-flex;flex-wrap:wrap;gap:.25em;padding-bottom:1em;text-decoration:none}")),document.head.appendChild(a),window.customElements){const e=window.customElements.define;window.customElements.define=function(r,t){const i=t.prototype.connectedCallback;return t.prototype.connectedCallback=function(){if(i&&i.call(this),this.shadowRoot){const d=document.createElement("style");d.appendChild(document.createTextNode(".v-enter-from[data-v-d4ffe76f],.v-leave-to[data-v-d4ffe76f]{max-height:0px;grid-template-rows:0fr;opacity:0}.v-enter-active[data-v-d4ffe76f],.v-leave-active[data-v-d4ffe76f]{display:grid;transition:all .15s}.v-enter-to[data-v-d4ffe76f],.v-leave-from[data-v-d4ffe76f]{grid-template-rows:1fr;max-height:50vh;opacity:1}.error-alert[data-v-d4ffe76f]{transition-behavior:allow-discrete;display:grid;overflow:hidden;min-height:0}.error-alert>*[data-v-d4ffe76f]{min-height:0}.error-list[data-v-d4ffe76f]{list-style-position:inside}div.error-list[data-v-d4ffe76f]{container-type:inline-size;display:grid;grid-template-columns:auto 1fr auto;gap:1.5em;align-items:start}@container (max-width: 27.125rem){div.error-list[data-v-d4ffe76f]{grid-template-columns:auto 1fr}.error-link[data-v-d4ffe76f]{grid-column:1 / -1;justify-self:end}}@container (max-width: 17.75rem){div.error-list[data-v-d4ffe76f]{grid-template-columns:1fr}.error-message[data-v-d4ffe76f]{grid-column:1 / -1}}.error-item[data-v-d4ffe76f]{display:contents}a[data-v-d4ffe76f]{min-width:min-content}.error-link[data-v-d4ffe76f]{align-items:center;color:inherit;display:inline-flex;flex-wrap:wrap;gap:.25em;padding-bottom:1em;text-decoration:none}")),this.shadowRoot.appendChild(d)}},e.call(window.customElements,r,t)}}}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
2
- import r from "./vue-components.es31.js";
3
-
4
- import o from "./vue-components.es33.js";
5
- const e = /* @__PURE__ */ o(r, [["__scopeId", "data-v-d4ffe76f"]]);
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
+ });
6
54
  export {
7
- e as default
55
+ N as default
8
56
  };