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