@effect-app/vue-components 2.7.3 → 2.7.5
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.
- package/dist/vue-components.es10.js +169 -182
- package/dist/vue-components.es11.js +2 -2
- package/dist/vue-components.es16.js +10 -11
- package/dist/vue-components.es17.js +5 -10
- package/dist/vue-components.es18.js +55 -5
- package/dist/vue-components.es19.js +63 -50
- package/dist/vue-components.es20.js +6 -68
- package/dist/vue-components.es21.js +4 -4
- package/dist/vue-components.es22.js +3 -6
- package/dist/vue-components.es23.js +3 -3
- package/dist/vue-components.es24.js +2 -3
- package/dist/vue-components.es25.js +1 -1
- package/dist/vue-components.es26.js +1 -1
- package/dist/vue-components.es27.js +1 -1
- package/dist/vue-components.es28.js +17 -2
- package/dist/vue-components.es29.js +10 -16
- package/dist/vue-components.es30.js +41 -191
- package/dist/vue-components.es31.js +4 -0
- package/dist/vue-components.es32.js +2 -42
- package/dist/vue-components.es33.js +89 -2
- package/dist/vue-components.es35.js +7 -89
- package/dist/vue-components.es36.js +34 -0
- package/dist/vue-components.es38.js +187 -27
- package/dist/vue-components.es40.js +1 -1
- package/dist/vue-components.es5.js +1 -1
- package/dist/vue-components.es7.js +1 -1
- package/package.json +3 -3
- package/src/components/OmegaForm/useOmegaForm.ts +7 -54
- package/dist/vue-components.es34.js +0 -4
- package/dist/vue-components.es37.js +0 -9
|
@@ -1,162 +1,151 @@
|
|
|
1
|
-
import { useForm as
|
|
2
|
-
import { Data as
|
|
3
|
-
import { runtimeFiberAsPromise as
|
|
4
|
-
import { isObject as
|
|
5
|
-
import { computed as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { generateMetaFromSchema as
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import { trace as
|
|
14
|
-
import { context as
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
if (
|
|
18
|
-
const o =
|
|
19
|
-
const
|
|
20
|
-
return
|
|
21
|
-
}),
|
|
22
|
-
...
|
|
1
|
+
import { useForm as G } from "@tanstack/vue-form";
|
|
2
|
+
import { Data as z, S as p, Effect as h, Array as g, Fiber as L, Option as D } from "effect-app";
|
|
3
|
+
import { runtimeFiberAsPromise as Q } from "./vue-components.es16.js";
|
|
4
|
+
import { isObject as X } from "./vue-components.es17.js";
|
|
5
|
+
import { computed as j, onUnmounted as R, onMounted as Y, onBeforeUnmount as Z, watch as W, ref as C, h as J } from "vue";
|
|
6
|
+
import ee from "./vue-components.es18.js";
|
|
7
|
+
import te from "./vue-components.es19.js";
|
|
8
|
+
import re from "./vue-components.es20.js";
|
|
9
|
+
import { generateMetaFromSchema as ne } from "./vue-components.es12.js";
|
|
10
|
+
import se from "./vue-components.es6.js";
|
|
11
|
+
import oe from "./vue-components.es8.js";
|
|
12
|
+
import ie from "./vue-components.es21.js";
|
|
13
|
+
import { trace as H } from "./vue-components.es22.js";
|
|
14
|
+
import { context as V } from "./vue-components.es23.js";
|
|
15
|
+
const _ = (c) => {
|
|
16
|
+
const i = c.ast;
|
|
17
|
+
if (i._tag === "Union") {
|
|
18
|
+
const o = i.types.map((u) => {
|
|
19
|
+
const l = p.make(u);
|
|
20
|
+
return _(l).ast;
|
|
21
|
+
}), m = {
|
|
22
|
+
...i,
|
|
23
23
|
types: o
|
|
24
24
|
};
|
|
25
|
-
return
|
|
25
|
+
return p.make(m);
|
|
26
26
|
}
|
|
27
|
-
if (
|
|
28
|
-
const o =
|
|
29
|
-
...
|
|
30
|
-
from:
|
|
31
|
-
to:
|
|
27
|
+
if (i._tag === "Transformation") {
|
|
28
|
+
const o = p.make(i.from), m = p.make(i.to), u = _(o), l = _(m), f = {
|
|
29
|
+
...i,
|
|
30
|
+
from: u.ast,
|
|
31
|
+
to: l.ast
|
|
32
32
|
};
|
|
33
|
-
return
|
|
33
|
+
return p.make(f);
|
|
34
34
|
}
|
|
35
|
-
if (
|
|
36
|
-
const o =
|
|
37
|
-
const
|
|
38
|
-
let
|
|
39
|
-
if (
|
|
40
|
-
const
|
|
41
|
-
|
|
35
|
+
if (i._tag === "TypeLiteral") {
|
|
36
|
+
const o = i.propertySignatures.map((u) => {
|
|
37
|
+
const l = u.type;
|
|
38
|
+
let f = l;
|
|
39
|
+
if (l._tag === "TypeLiteral" || l._tag === "Union" || l._tag === "Transformation") {
|
|
40
|
+
const k = p.make(l);
|
|
41
|
+
f = _(k).ast;
|
|
42
42
|
}
|
|
43
43
|
return {
|
|
44
|
-
...
|
|
45
|
-
type:
|
|
44
|
+
...u,
|
|
45
|
+
type: f,
|
|
46
46
|
isOptional: !0
|
|
47
47
|
};
|
|
48
|
-
}),
|
|
49
|
-
...
|
|
48
|
+
}), m = {
|
|
49
|
+
...i,
|
|
50
50
|
propertySignatures: o
|
|
51
51
|
};
|
|
52
|
-
return
|
|
52
|
+
return p.make(m);
|
|
53
53
|
}
|
|
54
|
-
return
|
|
54
|
+
return c;
|
|
55
55
|
};
|
|
56
|
-
class
|
|
56
|
+
class ae extends z.TaggedError("FormErrors") {
|
|
57
57
|
}
|
|
58
|
-
const
|
|
58
|
+
const M = (c) => function(o) {
|
|
59
59
|
return {
|
|
60
60
|
render() {
|
|
61
|
-
return
|
|
62
|
-
form:
|
|
61
|
+
return J(o, {
|
|
62
|
+
form: c,
|
|
63
63
|
...this.$attrs
|
|
64
64
|
}, this.$slots);
|
|
65
65
|
}
|
|
66
66
|
};
|
|
67
|
-
},
|
|
67
|
+
}, ce = (c) => function(o) {
|
|
68
68
|
return {
|
|
69
69
|
setup() {
|
|
70
|
-
const { fieldMap:
|
|
71
|
-
const
|
|
72
|
-
Object.entries(
|
|
73
|
-
([
|
|
74
|
-
const
|
|
75
|
-
if (!
|
|
76
|
-
const
|
|
77
|
-
return
|
|
78
|
-
label:
|
|
79
|
-
inputId:
|
|
70
|
+
const { fieldMap: m, form: u } = c, l = u.useStore((S) => S.errors), f = u.useStore((S) => S.fieldMeta), k = u.useStore((S) => S.errorMap), w = j(() => {
|
|
71
|
+
const S = g.filterMap(
|
|
72
|
+
Object.entries(f.value),
|
|
73
|
+
([x, b]) => {
|
|
74
|
+
const a = b.errors ?? [];
|
|
75
|
+
if (!a.length) return D.none();
|
|
76
|
+
const v = m.value.get(x);
|
|
77
|
+
return v ? D.some({
|
|
78
|
+
label: v.label,
|
|
79
|
+
inputId: v.id,
|
|
80
80
|
// Only show the first error
|
|
81
|
-
errors: [
|
|
82
|
-
}) :
|
|
81
|
+
errors: [a[0]?.message].filter(Boolean)
|
|
82
|
+
}) : D.none();
|
|
83
83
|
}
|
|
84
84
|
), F = [];
|
|
85
|
-
if (
|
|
86
|
-
for (const [
|
|
87
|
-
if (
|
|
88
|
-
for (const
|
|
89
|
-
const
|
|
90
|
-
if (
|
|
91
|
-
const
|
|
92
|
-
if (!
|
|
85
|
+
if (k.value.onSubmit) {
|
|
86
|
+
for (const [x, b] of Object.entries(k.value.onSubmit))
|
|
87
|
+
if (g.isArray(b) && b.length)
|
|
88
|
+
for (const a of b) {
|
|
89
|
+
const v = a;
|
|
90
|
+
if (v?.path && g.isArray(v.path) && v.path.length) {
|
|
91
|
+
const A = v.path.join(".");
|
|
92
|
+
if (!m.value.has(A)) {
|
|
93
93
|
F.push({
|
|
94
|
-
label:
|
|
95
|
-
inputId:
|
|
96
|
-
errors: [
|
|
94
|
+
label: A,
|
|
95
|
+
inputId: A,
|
|
96
|
+
errors: [v.message].filter(Boolean)
|
|
97
97
|
});
|
|
98
98
|
break;
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
return [...
|
|
103
|
+
return [...S, ...F];
|
|
104
104
|
});
|
|
105
105
|
return {
|
|
106
|
-
generalErrors:
|
|
107
|
-
errors:
|
|
106
|
+
generalErrors: l,
|
|
107
|
+
errors: w
|
|
108
108
|
};
|
|
109
109
|
},
|
|
110
|
-
render({ errors:
|
|
111
|
-
return
|
|
112
|
-
errors:
|
|
113
|
-
generalErrors:
|
|
110
|
+
render({ errors: m, generalErrors: u }) {
|
|
111
|
+
return J(o, {
|
|
112
|
+
errors: m,
|
|
113
|
+
generalErrors: u,
|
|
114
114
|
...this.$attrs
|
|
115
115
|
}, this.$slots);
|
|
116
116
|
}
|
|
117
117
|
};
|
|
118
|
-
},
|
|
119
|
-
if (!
|
|
120
|
-
const
|
|
118
|
+
}, ke = (c, i, o) => {
|
|
119
|
+
if (!c) throw new Error("Schema is required");
|
|
120
|
+
const m = p.standardSchemaV1(c), u = p.decode(c), { meta: l } = ne(c), f = j(() => {
|
|
121
121
|
if (o?.persistency?.id)
|
|
122
122
|
return o.persistency.id;
|
|
123
|
-
const e = window.location.pathname, t = Object.keys(
|
|
123
|
+
const e = window.location.pathname, t = Object.keys(l);
|
|
124
124
|
return `${e}-${t.join("-")}`;
|
|
125
|
-
}),
|
|
125
|
+
}), k = () => {
|
|
126
126
|
const e = new URLSearchParams(window.location.search);
|
|
127
|
-
e.delete(
|
|
127
|
+
e.delete(f.value);
|
|
128
128
|
const t = new URL(window.location.href);
|
|
129
129
|
t.search = e.toString(), window.history.replaceState({}, "", t.toString());
|
|
130
130
|
};
|
|
131
|
-
function
|
|
131
|
+
function w(e, t) {
|
|
132
132
|
for (const r in t)
|
|
133
|
-
t[r] &&
|
|
133
|
+
g.isArray(t[r]) ? e[r] = t[r] : t[r] && X(t[r]) ? (e[r] || (e[r] = {}), w(e[r], t[r])) : e[r] = t[r];
|
|
134
134
|
return e;
|
|
135
135
|
}
|
|
136
|
-
const
|
|
137
|
-
if (!e) return;
|
|
138
|
-
const t = { ...e }, r = (s, a) => a.split(".").reduce((l, g) => l?.[g], s), n = (s, a, l) => {
|
|
139
|
-
const g = a.split("."), N = g.pop(), X = g.reduce((L, O) => (L[O] || (L[O] = {}), L[O]), s);
|
|
140
|
-
X[N] = l;
|
|
141
|
-
};
|
|
142
|
-
for (const s in u) {
|
|
143
|
-
const a = u[s], l = r(t, s), N = (l == null || l === !1 || l === "" || Number.isNaN(l)) && l !== !1 && l !== 0;
|
|
144
|
-
a && !a.required && a.nullableOrUndefined && a.type !== "boolean" && (l === void 0 || N) && n(t, s, a.nullableOrUndefined === "undefined" ? void 0 : null);
|
|
145
|
-
}
|
|
146
|
-
return t;
|
|
147
|
-
}, F = (e) => {
|
|
136
|
+
const S = (e) => {
|
|
148
137
|
const t = {};
|
|
149
138
|
if (typeof e?.make == "function")
|
|
150
139
|
try {
|
|
151
140
|
return e.make({});
|
|
152
141
|
} catch {
|
|
153
142
|
}
|
|
154
|
-
const r = e?.members || (e?.ast?._tag === "Union" && e.ast.types ? e.ast.types.map((n) =>
|
|
155
|
-
if (r &&
|
|
143
|
+
const r = e?.members || (e?.ast?._tag === "Union" && e.ast.types ? e.ast.types.map((n) => p.make(n)) : null);
|
|
144
|
+
if (r && g.isArray(r)) {
|
|
156
145
|
for (const n of r) {
|
|
157
|
-
const s =
|
|
146
|
+
const s = S(n);
|
|
158
147
|
if (Object.keys(s).length > 0 && n?.fields && Object.entries(n.fields).some(
|
|
159
|
-
([
|
|
148
|
+
([y, K]) => y === "_tag" || y === "type" || y === "kind" ? K?.ast?.defaultValue !== void 0 : !1
|
|
160
149
|
))
|
|
161
150
|
return s;
|
|
162
151
|
}
|
|
@@ -166,30 +155,30 @@ const D = (f) => function(o) {
|
|
|
166
155
|
for (const [n, s] of Object.entries(e.fields)) {
|
|
167
156
|
if (s?.ast?.defaultValue)
|
|
168
157
|
try {
|
|
169
|
-
const
|
|
170
|
-
|
|
158
|
+
const y = s.ast.defaultValue();
|
|
159
|
+
y !== void 0 && (t[n] = y);
|
|
171
160
|
} catch {
|
|
172
161
|
}
|
|
173
|
-
const
|
|
174
|
-
Object.keys(
|
|
162
|
+
const d = S(s);
|
|
163
|
+
Object.keys(d).length > 0 && (t[n] && typeof t[n] == "object" ? Object.assign(t[n], d) : t[n] || (t[n] = d));
|
|
175
164
|
}
|
|
176
165
|
return t;
|
|
177
|
-
},
|
|
166
|
+
}, F = (e = {}) => {
|
|
178
167
|
let t = {};
|
|
179
168
|
try {
|
|
180
|
-
const r =
|
|
181
|
-
t =
|
|
169
|
+
const r = c.make(e);
|
|
170
|
+
t = p.encodeSync(_(c))(r);
|
|
182
171
|
} catch (r) {
|
|
183
172
|
window.location.hostname === "localhost" && console.warn("schema.make() failed, extracting defaults from AST:", r);
|
|
184
173
|
try {
|
|
185
|
-
const n =
|
|
186
|
-
t =
|
|
174
|
+
const n = S(c);
|
|
175
|
+
t = p.encodeSync(_(c))(n);
|
|
187
176
|
} catch (n) {
|
|
188
177
|
window.location.hostname === "localhost" && console.warn("Could not extract defaults from AST:", n);
|
|
189
178
|
}
|
|
190
179
|
}
|
|
191
|
-
return
|
|
192
|
-
},
|
|
180
|
+
return w(t, e);
|
|
181
|
+
}, x = j(() => {
|
|
193
182
|
let e;
|
|
194
183
|
const t = o?.persistency;
|
|
195
184
|
if (
|
|
@@ -200,132 +189,130 @@ const D = (f) => function(o) {
|
|
|
200
189
|
if (r)
|
|
201
190
|
try {
|
|
202
191
|
const n = JSON.parse(
|
|
203
|
-
r.getItem(
|
|
192
|
+
r.getItem(f.value) || "{}"
|
|
204
193
|
);
|
|
205
|
-
r.removeItem(
|
|
194
|
+
r.removeItem(f.value), e = n;
|
|
206
195
|
} catch (n) {
|
|
207
196
|
console.error(n);
|
|
208
197
|
}
|
|
209
198
|
}
|
|
210
199
|
if (t?.policies && t.policies.includes("querystring"))
|
|
211
200
|
try {
|
|
212
|
-
const n = new URLSearchParams(window.location.search).get(
|
|
213
|
-
|
|
201
|
+
const n = new URLSearchParams(window.location.search).get(f.value);
|
|
202
|
+
k(), n && (e = w(e || {}, JSON.parse(n)));
|
|
214
203
|
} catch (r) {
|
|
215
204
|
console.error(r);
|
|
216
205
|
}
|
|
217
|
-
return e ??= {},
|
|
218
|
-
|
|
219
|
-
o?.persistency?.overrideDefaultValues ? b(c?.defaultValues || {}, e) : b(e, c?.defaultValues || {})
|
|
220
|
-
)
|
|
206
|
+
return e ??= {}, F(
|
|
207
|
+
o?.persistency?.overrideDefaultValues ? w(i?.defaultValues || {}, e) : w(e, i?.defaultValues || {})
|
|
221
208
|
);
|
|
222
|
-
}),
|
|
223
|
-
...
|
|
209
|
+
}), b = (e, t) => e ? V.with(H.setSpan(V.active(), e), t) : t(), a = G({
|
|
210
|
+
...i,
|
|
224
211
|
validators: {
|
|
225
|
-
onSubmit:
|
|
226
|
-
...
|
|
212
|
+
onSubmit: m,
|
|
213
|
+
...i?.validators || {}
|
|
227
214
|
},
|
|
228
|
-
onSubmit:
|
|
229
|
-
const n = await
|
|
215
|
+
onSubmit: i?.onSubmit ? ({ formApi: e, meta: t, value: r }) => b(t?.currentSpan, async () => {
|
|
216
|
+
const n = await h.runPromise(u(r)), s = i.onSubmit({
|
|
230
217
|
formApi: e,
|
|
231
218
|
meta: t,
|
|
232
219
|
value: n
|
|
233
220
|
});
|
|
234
|
-
return
|
|
221
|
+
return L.isFiber(s) && L.isRuntimeFiber(s) ? await Q(s) : h.isEffect(s) ? await h.runPromise(
|
|
235
222
|
s.pipe(
|
|
236
223
|
// meta?.currentSpan
|
|
237
224
|
// ? Effect.withParentSpan(meta.currentSpan)
|
|
238
225
|
// : (_) => _,
|
|
239
|
-
|
|
226
|
+
h.flatMap((d) => L.join(d))
|
|
240
227
|
)
|
|
241
228
|
) : s;
|
|
242
229
|
}) : void 0,
|
|
243
|
-
defaultValues:
|
|
244
|
-
}),
|
|
245
|
-
Object.keys(
|
|
246
|
-
|
|
230
|
+
defaultValues: x.value
|
|
231
|
+
}), v = () => {
|
|
232
|
+
Object.keys(l).forEach((e) => {
|
|
233
|
+
a.setFieldValue(e, void 0);
|
|
247
234
|
});
|
|
248
|
-
},
|
|
235
|
+
}, A = (e) => e.reduce((t, r) => {
|
|
249
236
|
const n = r.split(".");
|
|
250
|
-
return n.reduce((s,
|
|
251
|
-
}, {}),
|
|
237
|
+
return n.reduce((s, d, y) => (y === n.length - 1 ? s[d] = a.getFieldValue(r) : s[d] = s[d] ?? {}, s[d]), t), t;
|
|
238
|
+
}, {}), T = (e) => {
|
|
252
239
|
if (e) {
|
|
253
|
-
if (
|
|
254
|
-
return
|
|
255
|
-
if (
|
|
256
|
-
const t = Object.keys(
|
|
257
|
-
return
|
|
240
|
+
if (g.isArray(e.keys))
|
|
241
|
+
return A(e.keys);
|
|
242
|
+
if (g.isArray(e.banKeys)) {
|
|
243
|
+
const t = Object.keys(l).filter((r) => e.banKeys?.includes(r));
|
|
244
|
+
return A(t);
|
|
258
245
|
}
|
|
259
|
-
return
|
|
246
|
+
return a.store.state.values;
|
|
260
247
|
}
|
|
261
|
-
},
|
|
248
|
+
}, P = () => {
|
|
262
249
|
const e = o?.persistency;
|
|
263
250
|
if (!(!e?.policies || e.policies.length === 0) && (e.policies.includes("local") || e.policies.includes("session"))) {
|
|
264
251
|
const t = e.policies.includes("local") ? localStorage : sessionStorage;
|
|
265
252
|
if (!t) return;
|
|
266
|
-
const r =
|
|
267
|
-
return t.setItem(
|
|
253
|
+
const r = T(e);
|
|
254
|
+
return t.setItem(f.value, JSON.stringify(r));
|
|
268
255
|
}
|
|
269
|
-
},
|
|
256
|
+
}, O = () => {
|
|
270
257
|
const e = o?.persistency;
|
|
271
258
|
if (!(!e?.policies || e.policies.length === 0) && e.policies.includes("querystring")) {
|
|
272
|
-
const t =
|
|
273
|
-
r.set(
|
|
259
|
+
const t = T(e), r = new URLSearchParams(window.location.search);
|
|
260
|
+
r.set(f.value, JSON.stringify(t));
|
|
274
261
|
const n = new URL(window.location.href);
|
|
275
262
|
n.search = r.toString(), window.history.replaceState({}, "", n.toString());
|
|
276
263
|
}
|
|
277
|
-
},
|
|
278
|
-
|
|
264
|
+
}, I = (e) => {
|
|
265
|
+
a.store.state.isDirty && e.preventDefault();
|
|
279
266
|
};
|
|
280
|
-
if (
|
|
281
|
-
window.addEventListener("beforeunload",
|
|
282
|
-
}),
|
|
283
|
-
window.removeEventListener("beforeunload",
|
|
267
|
+
if (R(P), Y(() => {
|
|
268
|
+
window.addEventListener("beforeunload", P), window.addEventListener("blur", O), o?.preventWindowExit && o.preventWindowExit !== "nope" && window.addEventListener("beforeunload", I);
|
|
269
|
+
}), Z(() => {
|
|
270
|
+
window.removeEventListener("beforeunload", P), window.removeEventListener("blur", O), o?.preventWindowExit && o.preventWindowExit !== "nope" && window.removeEventListener("beforeunload", I);
|
|
284
271
|
}), o?.preventWindowExit === "prevent-and-reset") {
|
|
285
|
-
const e =
|
|
286
|
-
|
|
287
|
-
|
|
272
|
+
const e = a.useStore((s) => s.isSubmitting), t = a.useStore((s) => s.submissionAttempts), r = a.useStore((s) => s.canSubmit), n = a.useStore((s) => s.values);
|
|
273
|
+
W([e, t], ([s, d], [y]) => {
|
|
274
|
+
y && !s && d > 0 && r.value && a.reset(n.value);
|
|
288
275
|
});
|
|
289
276
|
}
|
|
290
|
-
const
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
(t) =>
|
|
277
|
+
const $ = (e) => h.currentSpan.pipe(
|
|
278
|
+
h.option,
|
|
279
|
+
h.flatMap(
|
|
280
|
+
(t) => h.promise(() => a.handleSubmit(D.isSome(t) ? { currentSpan: t.value, ...e } : e))
|
|
294
281
|
)
|
|
295
|
-
),
|
|
296
|
-
const t =
|
|
282
|
+
), q = (e) => e?.checkErrors ? $(e?.meta).pipe(h.flatMap(h.fnUntraced(function* () {
|
|
283
|
+
const t = a.getAllErrors();
|
|
297
284
|
if (Object.keys(t.fields).length || t.form.errors.length)
|
|
298
|
-
return yield* new
|
|
299
|
-
}))) :
|
|
285
|
+
return yield* new ae({ form: t.form, fields: t.fields });
|
|
286
|
+
}))) : $(e?.meta), B = a.handleSubmit, U = C(/* @__PURE__ */ new Map()), E = Object.assign(a, {
|
|
300
287
|
i18nNamespace: o?.i18nNamespace,
|
|
301
288
|
ignorePreventCloseEvents: o?.ignorePreventCloseEvents,
|
|
302
|
-
meta:
|
|
303
|
-
clear:
|
|
289
|
+
meta: l,
|
|
290
|
+
clear: v,
|
|
304
291
|
handleSubmit: (e) => {
|
|
305
|
-
const t =
|
|
306
|
-
return
|
|
292
|
+
const t = H.getSpan(V.active());
|
|
293
|
+
return B({ currentSpan: t, ...e });
|
|
307
294
|
},
|
|
308
295
|
// /** @experimental */
|
|
309
|
-
handleSubmitEffect:
|
|
296
|
+
handleSubmitEffect: q,
|
|
310
297
|
registerField: (e) => {
|
|
311
|
-
|
|
298
|
+
W(e, (t) => U.value.set(t.name, { label: t.label, id: t.id }), { immediate: !0 }), R(() => U.value.delete(e.value.name));
|
|
312
299
|
}
|
|
313
|
-
}),
|
|
314
|
-
return Object.assign(
|
|
300
|
+
}), N = { form: E, fieldMap: U };
|
|
301
|
+
return Object.assign(E, {
|
|
315
302
|
// Type-level properties for performance optimization (not used at runtime)
|
|
316
303
|
_paths: void 0,
|
|
317
304
|
_keys: void 0,
|
|
318
|
-
errorContext:
|
|
319
|
-
Form:
|
|
320
|
-
Input:
|
|
321
|
-
TaggedUnion:
|
|
322
|
-
Field:
|
|
323
|
-
Errors:
|
|
324
|
-
Array:
|
|
325
|
-
AutoGen:
|
|
305
|
+
errorContext: N,
|
|
306
|
+
Form: M(E)(ie),
|
|
307
|
+
Input: M(E)(o?.input ?? se),
|
|
308
|
+
TaggedUnion: M(E)(oe),
|
|
309
|
+
Field: a.Field,
|
|
310
|
+
Errors: ce(N)(re),
|
|
311
|
+
Array: M(E)(ee),
|
|
312
|
+
AutoGen: M(E)(te)
|
|
326
313
|
});
|
|
327
314
|
};
|
|
328
315
|
export {
|
|
329
|
-
|
|
330
|
-
|
|
316
|
+
ae as FormErrors,
|
|
317
|
+
ke as useOmegaForm
|
|
331
318
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import l from "./vue-components.
|
|
1
|
+
import l from "./vue-components.es28.js";
|
|
2
2
|
import { inject as c, provide as u } from "vue";
|
|
3
|
-
import { onMountedWithCleanup as f } from "./vue-components.
|
|
3
|
+
import { onMountedWithCleanup as f } from "./vue-components.es29.js";
|
|
4
4
|
const p = () => l(), i = Symbol("DialogBus"), r = () => c(i, null), g = () => {
|
|
5
5
|
const n = p();
|
|
6
6
|
return u(i, n), n;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
n && n();
|
|
9
|
-
});
|
|
10
|
-
}
|
|
1
|
+
import { Exit as c, Runtime as u } from "effect";
|
|
2
|
+
import { dual as n, isFunction as m } from "./vue-components.es30.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
|
+
}));
|
|
11
8
|
export {
|
|
12
|
-
|
|
9
|
+
a as clone,
|
|
10
|
+
i as cloneTrait,
|
|
11
|
+
p as runtimeFiberAsPromise
|
|
13
12
|
};
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
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 { isFunction as c } from "./vue-components.es30.js";
|
|
2
|
+
const s = c, t = (o) => typeof o == "object" && o !== null, i = (o) => t(o) || s(o);
|
|
8
3
|
export {
|
|
9
|
-
|
|
10
|
-
i as
|
|
11
|
-
|
|
4
|
+
s as isFunction,
|
|
5
|
+
i as isObject,
|
|
6
|
+
t as isRecordOrArray
|
|
12
7
|
};
|
|
@@ -1,7 +1,57 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as F, computed as f, 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 C, mergeProps as b } from "vue";
|
|
2
|
+
const N = /* @__PURE__ */ F({
|
|
3
|
+
inheritAttrs: !1,
|
|
4
|
+
__name: "OmegaArray",
|
|
5
|
+
props: {
|
|
6
|
+
form: {},
|
|
7
|
+
inputClass: {},
|
|
8
|
+
name: {},
|
|
9
|
+
defaultItems: {},
|
|
10
|
+
items: {}
|
|
11
|
+
},
|
|
12
|
+
setup(n) {
|
|
13
|
+
const a = n, y = a.form.useStore((e) => e.values), i = f(() => {
|
|
14
|
+
const e = a.name.replace(/\[/g, ".").replace(/\]/g, "");
|
|
15
|
+
try {
|
|
16
|
+
return e.split(".").reduce((r, t) => r && r[t], y.value);
|
|
17
|
+
} catch (r) {
|
|
18
|
+
return console.error(r), [];
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
M(async () => {
|
|
22
|
+
a.defaultItems && !i.value && a.form.setFieldValue(a.name, a.defaultItems);
|
|
23
|
+
});
|
|
24
|
+
const $ = f(() => (r) => {
|
|
25
|
+
const t = r.replace(/\[\d+\]/g, "");
|
|
26
|
+
return a.form.meta[t];
|
|
27
|
+
});
|
|
28
|
+
return P("getMetaFromArray", $), (e, r) => (s(), c(p(n.form.Field), { name: n.name }, {
|
|
29
|
+
default: g(({ field: t, state: d }) => [
|
|
30
|
+
o(e.$slots, "pre-array", l(u({ field: t, state: d }))),
|
|
31
|
+
(s(!0), k(A, null, C(i.value, (B, m) => (s(), c(p(n.form.Field), {
|
|
32
|
+
key: `${n.name}[${Number(m)}]`,
|
|
33
|
+
name: (
|
|
34
|
+
// eslint-disable-next-line
|
|
35
|
+
`${n.name}[${Number(m)}]`
|
|
36
|
+
)
|
|
37
|
+
}, {
|
|
38
|
+
default: g(({ field: v, state: h }) => [
|
|
39
|
+
o(e.$slots, "default", b({ ref_for: !0 }, {
|
|
40
|
+
subField: v,
|
|
41
|
+
subState: h,
|
|
42
|
+
index: Number(m),
|
|
43
|
+
field: t
|
|
44
|
+
}))
|
|
45
|
+
]),
|
|
46
|
+
_: 2
|
|
47
|
+
}, 1032, ["name"]))), 128)),
|
|
48
|
+
o(e.$slots, "post-array", l(u({ field: t, state: d }))),
|
|
49
|
+
o(e.$slots, "field", l(u({ field: t })))
|
|
50
|
+
]),
|
|
51
|
+
_: 3
|
|
52
|
+
}, 8, ["name"]));
|
|
53
|
+
}
|
|
54
|
+
});
|
|
3
55
|
export {
|
|
4
|
-
|
|
5
|
-
i as isObject,
|
|
6
|
-
t as isRecordOrArray
|
|
56
|
+
N as default
|
|
7
57
|
};
|