@effect-app/vue-components 2.7.0 → 2.7.1
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/types/components/OmegaForm/OmegaTaggedUnion.vue.d.ts +14 -3
- package/dist/types/components/OmegaForm/OmegaTaggedUnionInternal.vue.d.ts +2 -2
- package/dist/vue-components.es10.js +144 -138
- package/dist/vue-components.es11.js +2 -2
- package/dist/vue-components.es16.js +11 -10
- package/dist/vue-components.es17.js +10 -5
- package/dist/vue-components.es18.js +5 -55
- package/dist/vue-components.es19.js +50 -63
- package/dist/vue-components.es20.js +68 -6
- package/dist/vue-components.es21.js +4 -4
- package/dist/vue-components.es22.js +6 -3
- package/dist/vue-components.es23.js +3 -3
- package/dist/vue-components.es24.js +3 -2
- 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 +2 -17
- package/dist/vue-components.es29.js +16 -10
- package/dist/vue-components.es31.js +1 -1
- package/dist/vue-components.es32.js +1 -1
- package/dist/vue-components.es5.js +1 -1
- package/dist/vue-components.es8.js +31 -32
- package/dist/vue-components.es9.js +2 -2
- package/package.json +1 -1
- package/src/components/OmegaForm/OmegaTaggedUnion.vue +20 -13
- package/src/components/OmegaForm/OmegaTaggedUnionInternal.vue +3 -3
- package/src/components/OmegaForm/useOmegaForm.ts +19 -3
|
@@ -12,12 +12,23 @@ declare const __VLS_export: <From extends Record<PropertyKey, any>, To extends R
|
|
|
12
12
|
expose: (exposed: {}) => void;
|
|
13
13
|
attrs: any;
|
|
14
14
|
slots: {
|
|
15
|
-
[x: string]: ((props:
|
|
16
|
-
|
|
15
|
+
[x: string]: ((props: {
|
|
16
|
+
field: import("./InputProps").OmegaFieldInternalApi<From, any>;
|
|
17
|
+
state: NonNullable<import("@tanstack/vue-form").DeepValue<From, any>>;
|
|
18
|
+
}) => any) | undefined;
|
|
19
|
+
[x: number]: ((props: {
|
|
20
|
+
field: import("./InputProps").OmegaFieldInternalApi<From, any>;
|
|
21
|
+
state: NonNullable<import("@tanstack/vue-form").DeepValue<From, any>>;
|
|
22
|
+
}) => any) | undefined;
|
|
17
23
|
} & {
|
|
18
|
-
OmegaCustomInput?: (props: {
|
|
24
|
+
OmegaCustomInput?: (props: {
|
|
25
|
+
field: import("@tanstack/vue-form").FieldApi<From, any, import("@tanstack/vue-form").DeepValue<From, any>, import("@tanstack/vue-form").FieldValidateOrFn<From, any, import("@tanstack/vue-form").DeepValue<From, any>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, any, import("@tanstack/vue-form").DeepValue<From, any>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, any, import("@tanstack/vue-form").DeepValue<From, any>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, any, import("@tanstack/vue-form").DeepValue<From, any>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, any, import("@tanstack/vue-form").DeepValue<From, any>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, any, import("@tanstack/vue-form").DeepValue<From, any>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, any, import("@tanstack/vue-form").DeepValue<From, any>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, any, import("@tanstack/vue-form").DeepValue<From, any>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, any, import("@tanstack/vue-form").DeepValue<From, any>> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").StandardSchemaV1<From, To>, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined, Record<string, any> | undefined>;
|
|
26
|
+
state: import("@tanstack/vue-form").FieldState<From, any, import("@tanstack/vue-form").DeepValue<From, any>, import("@tanstack/vue-form").FieldValidateOrFn<From, any, import("@tanstack/vue-form").DeepValue<From, any>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, any, import("@tanstack/vue-form").DeepValue<From, any>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, any, import("@tanstack/vue-form").DeepValue<From, any>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, any, import("@tanstack/vue-form").DeepValue<From, any>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, any, import("@tanstack/vue-form").DeepValue<From, any>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, any, import("@tanstack/vue-form").DeepValue<From, any>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, any, import("@tanstack/vue-form").DeepValue<From, any>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, any, import("@tanstack/vue-form").DeepValue<From, any>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, any, import("@tanstack/vue-form").DeepValue<From, any>> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").StandardSchemaV1<From, To>, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined>;
|
|
27
|
+
}) => any;
|
|
19
28
|
} & {
|
|
20
29
|
default?: (props: {}) => any;
|
|
30
|
+
} & {
|
|
31
|
+
OmegaCommon?: (props: {}) => any;
|
|
21
32
|
};
|
|
22
33
|
emit: {};
|
|
23
34
|
}>) => import("vue").VNode & {
|
|
@@ -9,9 +9,9 @@ declare const __VLS_export: <From extends Record<PropertyKey, any>, To extends R
|
|
|
9
9
|
expose: (exposed: {}) => void;
|
|
10
10
|
attrs: any;
|
|
11
11
|
slots: {
|
|
12
|
-
[x:
|
|
12
|
+
[x: string]: ((props: {
|
|
13
13
|
field: OmegaFieldInternalApi<From, Name>;
|
|
14
|
-
state: NonNullable<
|
|
14
|
+
state: NonNullable<DeepValue<From, Name>>;
|
|
15
15
|
}) => any) | undefined;
|
|
16
16
|
};
|
|
17
17
|
emit: {};
|
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
import { useForm as
|
|
2
|
-
import { Data as
|
|
3
|
-
import { runtimeFiberAsPromise as
|
|
4
|
-
import { isObject as
|
|
5
|
-
import { computed as
|
|
6
|
-
import ee from "./vue-components.es18.js";
|
|
1
|
+
import { useForm as Z } from "@tanstack/vue-form";
|
|
2
|
+
import { Data as G, S as v, Effect as S, Fiber as O, Option as U, Array as _ } from "effect-app";
|
|
3
|
+
import { runtimeFiberAsPromise as Q } from "./vue-components.es17.js";
|
|
4
|
+
import { isObject as X } from "./vue-components.es18.js";
|
|
5
|
+
import { computed as T, onUnmounted as W, onMounted as Y, onBeforeUnmount as C, watch as B, ref as ee, h as H } from "vue";
|
|
7
6
|
import te from "./vue-components.es19.js";
|
|
8
7
|
import re from "./vue-components.es20.js";
|
|
9
|
-
import
|
|
10
|
-
import se from "./vue-components.
|
|
11
|
-
import oe from "./vue-components.
|
|
12
|
-
import ie from "./vue-components.
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
15
|
-
|
|
8
|
+
import ne from "./vue-components.es21.js";
|
|
9
|
+
import { generateMetaFromSchema as se } from "./vue-components.es12.js";
|
|
10
|
+
import oe from "./vue-components.es6.js";
|
|
11
|
+
import ie from "./vue-components.es8.js";
|
|
12
|
+
import ae from "./vue-components.es22.js";
|
|
13
|
+
import { trace as q } from "./vue-components.es23.js";
|
|
14
|
+
import { context as L } from "./vue-components.es24.js";
|
|
15
|
+
const F = (c) => {
|
|
16
16
|
const a = c.ast;
|
|
17
17
|
if (a._tag === "Union") {
|
|
18
|
-
const o = a.types.map((
|
|
19
|
-
const l =
|
|
20
|
-
return
|
|
18
|
+
const o = a.types.map((u) => {
|
|
19
|
+
const l = v.make(u);
|
|
20
|
+
return F(l).ast;
|
|
21
21
|
}), m = {
|
|
22
22
|
...a,
|
|
23
23
|
types: o
|
|
24
24
|
};
|
|
25
|
-
return
|
|
25
|
+
return v.make(m);
|
|
26
26
|
}
|
|
27
27
|
if (a._tag === "Transformation") {
|
|
28
|
-
const o =
|
|
28
|
+
const o = v.make(a.from), m = v.make(a.to), u = F(o), l = F(m), f = {
|
|
29
29
|
...a,
|
|
30
|
-
from:
|
|
30
|
+
from: u.ast,
|
|
31
31
|
to: l.ast
|
|
32
32
|
};
|
|
33
|
-
return
|
|
33
|
+
return v.make(f);
|
|
34
34
|
}
|
|
35
35
|
if (a._tag === "TypeLiteral") {
|
|
36
|
-
const o = a.propertySignatures.map((
|
|
37
|
-
const l =
|
|
38
|
-
let
|
|
36
|
+
const o = a.propertySignatures.map((u) => {
|
|
37
|
+
const l = u.type;
|
|
38
|
+
let f = l;
|
|
39
39
|
if (l._tag === "TypeLiteral" || l._tag === "Union" || l._tag === "Transformation") {
|
|
40
|
-
const w =
|
|
41
|
-
|
|
40
|
+
const w = v.make(l);
|
|
41
|
+
f = F(w).ast;
|
|
42
42
|
}
|
|
43
43
|
return {
|
|
44
|
-
...
|
|
45
|
-
type:
|
|
44
|
+
...u,
|
|
45
|
+
type: f,
|
|
46
46
|
isOptional: !0
|
|
47
47
|
};
|
|
48
48
|
}), m = {
|
|
49
49
|
...a,
|
|
50
50
|
propertySignatures: o
|
|
51
51
|
};
|
|
52
|
-
return
|
|
52
|
+
return v.make(m);
|
|
53
53
|
}
|
|
54
54
|
return c;
|
|
55
55
|
};
|
|
56
|
-
class
|
|
56
|
+
class le extends G.TaggedError("FormErrors") {
|
|
57
57
|
}
|
|
58
58
|
const D = (c) => function(o) {
|
|
59
59
|
return {
|
|
@@ -64,30 +64,30 @@ const D = (c) => function(o) {
|
|
|
64
64
|
}, this.$slots);
|
|
65
65
|
}
|
|
66
66
|
};
|
|
67
|
-
},
|
|
67
|
+
}, ce = (c) => function(o) {
|
|
68
68
|
return {
|
|
69
69
|
setup() {
|
|
70
|
-
const { fieldMap: m, form:
|
|
71
|
-
const
|
|
72
|
-
Object.entries(
|
|
73
|
-
([
|
|
74
|
-
const
|
|
75
|
-
if (!
|
|
76
|
-
const i = m.value.get(
|
|
77
|
-
return i ?
|
|
70
|
+
const { fieldMap: m, form: u } = c, l = u.useStore((y) => y.errors), f = u.useStore((y) => y.fieldMeta), w = u.useStore((y) => y.errorMap), E = T(() => {
|
|
71
|
+
const y = _.filterMap(
|
|
72
|
+
Object.entries(f.value),
|
|
73
|
+
([A, h]) => {
|
|
74
|
+
const k = h.errors ?? [];
|
|
75
|
+
if (!k.length) return U.none();
|
|
76
|
+
const i = m.value.get(A);
|
|
77
|
+
return i ? U.some({
|
|
78
78
|
label: i.label,
|
|
79
79
|
inputId: i.id,
|
|
80
80
|
// Only show the first error
|
|
81
|
-
errors: [
|
|
82
|
-
}) :
|
|
81
|
+
errors: [k[0]?.message].filter(Boolean)
|
|
82
|
+
}) : U.none();
|
|
83
83
|
}
|
|
84
84
|
), g = [];
|
|
85
85
|
if (w.value.onSubmit) {
|
|
86
|
-
for (const [
|
|
87
|
-
if (
|
|
88
|
-
for (const
|
|
89
|
-
const i =
|
|
90
|
-
if (i?.path &&
|
|
86
|
+
for (const [A, h] of Object.entries(w.value.onSubmit))
|
|
87
|
+
if (_.isArray(h) && h.length)
|
|
88
|
+
for (const k of h) {
|
|
89
|
+
const i = k;
|
|
90
|
+
if (i?.path && _.isArray(i.path) && i.path.length) {
|
|
91
91
|
const M = i.path.join(".");
|
|
92
92
|
if (!m.value.has(M)) {
|
|
93
93
|
g.push({
|
|
@@ -100,227 +100,233 @@ const D = (c) => function(o) {
|
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
return [...
|
|
103
|
+
return [...y, ...g];
|
|
104
104
|
});
|
|
105
105
|
return {
|
|
106
106
|
generalErrors: l,
|
|
107
107
|
errors: E
|
|
108
108
|
};
|
|
109
109
|
},
|
|
110
|
-
render({ errors: m, generalErrors:
|
|
110
|
+
render({ errors: m, generalErrors: u }) {
|
|
111
111
|
return H(o, {
|
|
112
112
|
errors: m,
|
|
113
|
-
generalErrors:
|
|
113
|
+
generalErrors: u,
|
|
114
114
|
...this.$attrs
|
|
115
115
|
}, this.$slots);
|
|
116
116
|
}
|
|
117
117
|
};
|
|
118
118
|
}, Fe = (c, a, o) => {
|
|
119
119
|
if (!c) throw new Error("Schema is required");
|
|
120
|
-
const m =
|
|
120
|
+
const m = v.standardSchemaV1(c), u = v.decode(c), { meta: l } = se(c), f = T(() => {
|
|
121
121
|
if (o?.persistency?.id)
|
|
122
122
|
return o.persistency.id;
|
|
123
123
|
const e = window.location.pathname, t = Object.keys(l);
|
|
124
124
|
return `${e}-${t.join("-")}`;
|
|
125
125
|
}), w = () => {
|
|
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
131
|
function E(e, t) {
|
|
132
|
-
for (const
|
|
133
|
-
t[
|
|
132
|
+
for (const n in t)
|
|
133
|
+
t[n] && X(t[n]) ? (e[n] || (e[n] = {}), E(e[n], t[n])) : e[n] = t[n];
|
|
134
134
|
return e;
|
|
135
135
|
}
|
|
136
|
-
const
|
|
136
|
+
const y = (e) => {
|
|
137
137
|
if (!e) return;
|
|
138
138
|
const t = { ...e };
|
|
139
|
-
for (const
|
|
140
|
-
const s = l[
|
|
141
|
-
s && !s.required && s.nullableOrUndefined && s.type !== "boolean" && (
|
|
139
|
+
for (const n in l) {
|
|
140
|
+
const s = l[n], r = t[n], p = (r == null || r === !1 || r === "" || Number.isNaN(r)) && r !== !1 && r !== 0;
|
|
141
|
+
s && !s.required && s.nullableOrUndefined && s.type !== "boolean" && (r === void 0 || p) && (t[n] = s.nullableOrUndefined === "undefined" ? void 0 : null);
|
|
142
142
|
}
|
|
143
143
|
return t;
|
|
144
144
|
}, g = (e) => {
|
|
145
145
|
const t = {};
|
|
146
|
-
if (e?.
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
146
|
+
if (typeof e?.make == "function")
|
|
147
|
+
try {
|
|
148
|
+
return e.make({});
|
|
149
|
+
} catch {
|
|
150
|
+
}
|
|
151
|
+
const n = e?.members || (e?.ast?._tag === "Union" && e.ast.types ? e.ast.types.map((s) => v.make(s)) : null);
|
|
152
|
+
if (n && _.isArray(n)) {
|
|
153
|
+
for (const s of n) {
|
|
154
|
+
const r = g(s);
|
|
155
|
+
if (Object.keys(r).length > 0 && s?.fields && Object.entries(s.fields).some(
|
|
156
|
+
([p, K]) => p === "_tag" || p === "type" || p === "kind" ? K?.ast?.defaultValue !== void 0 : !1
|
|
151
157
|
))
|
|
152
|
-
return
|
|
158
|
+
return r;
|
|
153
159
|
}
|
|
154
160
|
return {};
|
|
155
161
|
}
|
|
156
162
|
if (e?.fields && typeof e.fields == "object")
|
|
157
|
-
for (const [
|
|
158
|
-
if (
|
|
163
|
+
for (const [s, r] of Object.entries(e.fields)) {
|
|
164
|
+
if (r?.ast?.defaultValue)
|
|
159
165
|
try {
|
|
160
|
-
const
|
|
161
|
-
|
|
166
|
+
const p = r.ast.defaultValue();
|
|
167
|
+
p !== void 0 && (t[s] = p);
|
|
162
168
|
} catch {
|
|
163
169
|
}
|
|
164
|
-
const
|
|
165
|
-
Object.keys(
|
|
170
|
+
const d = g(r);
|
|
171
|
+
Object.keys(d).length > 0 && (t[s] && typeof t[s] == "object" ? Object.assign(t[s], d) : t[s] || (t[s] = d));
|
|
166
172
|
}
|
|
167
173
|
return t;
|
|
168
|
-
},
|
|
174
|
+
}, A = (e = {}) => {
|
|
169
175
|
let t = {};
|
|
170
176
|
try {
|
|
171
|
-
const
|
|
172
|
-
t =
|
|
173
|
-
} catch (
|
|
174
|
-
window.location.hostname === "localhost" && console.warn("schema.make() failed, extracting defaults from AST:",
|
|
177
|
+
const n = c.make(e);
|
|
178
|
+
t = v.encodeSync(F(c))(n);
|
|
179
|
+
} catch (n) {
|
|
180
|
+
window.location.hostname === "localhost" && console.warn("schema.make() failed, extracting defaults from AST:", n);
|
|
175
181
|
try {
|
|
176
182
|
const s = g(c);
|
|
177
|
-
t =
|
|
183
|
+
t = v.encodeSync(F(c))(s);
|
|
178
184
|
} catch (s) {
|
|
179
185
|
window.location.hostname === "localhost" && console.warn("Could not extract defaults from AST:", s);
|
|
180
186
|
}
|
|
181
187
|
}
|
|
182
188
|
return E(t, e);
|
|
183
|
-
},
|
|
184
|
-
const e =
|
|
185
|
-
|
|
189
|
+
}, h = T(() => {
|
|
190
|
+
const e = A(
|
|
191
|
+
y(
|
|
186
192
|
a?.defaultValues
|
|
187
193
|
)
|
|
188
194
|
);
|
|
189
195
|
if (e && !o?.persistency?.overrideDefaultValues)
|
|
190
196
|
return e;
|
|
191
197
|
let t;
|
|
192
|
-
const
|
|
193
|
-
if (!
|
|
194
|
-
if (
|
|
198
|
+
const n = o?.persistency;
|
|
199
|
+
if (!n?.policies || n.policies.length === 0) return {};
|
|
200
|
+
if (n.policies.includes("querystring"))
|
|
195
201
|
try {
|
|
196
|
-
const
|
|
197
|
-
w(),
|
|
202
|
+
const r = new URLSearchParams(window.location.search).get(f.value);
|
|
203
|
+
w(), r && (t = JSON.parse(r));
|
|
198
204
|
} catch (s) {
|
|
199
205
|
console.error(s);
|
|
200
206
|
}
|
|
201
207
|
if (
|
|
202
208
|
// query string has higher priority than local/session storage
|
|
203
|
-
!t && (
|
|
209
|
+
!t && (n.policies.includes("local") || n.policies.includes("session"))
|
|
204
210
|
) {
|
|
205
|
-
const s =
|
|
211
|
+
const s = n.policies.includes("local") ? localStorage : sessionStorage;
|
|
206
212
|
if (s)
|
|
207
213
|
try {
|
|
208
|
-
const
|
|
209
|
-
s.getItem(
|
|
214
|
+
const r = JSON.parse(
|
|
215
|
+
s.getItem(f.value) || "{}"
|
|
210
216
|
);
|
|
211
|
-
s.removeItem(
|
|
212
|
-
} catch (
|
|
213
|
-
console.error(
|
|
217
|
+
s.removeItem(f.value), t = r;
|
|
218
|
+
} catch (r) {
|
|
219
|
+
console.error(r);
|
|
214
220
|
}
|
|
215
221
|
}
|
|
216
|
-
return t ??=
|
|
217
|
-
}),
|
|
222
|
+
return t ??= A({}), e ? E(e, t) : t;
|
|
223
|
+
}), k = (e, t) => e ? L.with(q.setSpan(L.active(), e), t) : t(), i = Z({
|
|
218
224
|
...a,
|
|
219
225
|
validators: {
|
|
220
226
|
onSubmit: m,
|
|
221
227
|
...a?.validators || {}
|
|
222
228
|
},
|
|
223
|
-
onSubmit: a?.onSubmit ? ({ formApi: e, meta: t, value:
|
|
224
|
-
const s = await
|
|
229
|
+
onSubmit: a?.onSubmit ? ({ formApi: e, meta: t, value: n }) => k(t?.currentSpan, async () => {
|
|
230
|
+
const s = await S.runPromise(u(n)), r = a.onSubmit({
|
|
225
231
|
formApi: e,
|
|
226
232
|
meta: t,
|
|
227
233
|
value: s
|
|
228
234
|
});
|
|
229
|
-
return
|
|
230
|
-
|
|
235
|
+
return O.isFiber(r) && O.isRuntimeFiber(r) ? await Q(r) : S.isEffect(r) ? await S.runPromise(
|
|
236
|
+
r.pipe(
|
|
231
237
|
// meta?.currentSpan
|
|
232
238
|
// ? Effect.withParentSpan(meta.currentSpan)
|
|
233
239
|
// : (_) => _,
|
|
234
|
-
|
|
240
|
+
S.flatMap((d) => O.join(d))
|
|
235
241
|
)
|
|
236
|
-
) :
|
|
242
|
+
) : r;
|
|
237
243
|
}) : void 0,
|
|
238
|
-
defaultValues:
|
|
244
|
+
defaultValues: h.value
|
|
239
245
|
}), M = () => {
|
|
240
246
|
Object.keys(l).forEach((e) => {
|
|
241
247
|
i.setFieldValue(e, void 0);
|
|
242
248
|
});
|
|
243
|
-
},
|
|
244
|
-
const s =
|
|
245
|
-
return s.reduce((
|
|
246
|
-
}, {}),
|
|
249
|
+
}, V = (e) => e.reduce((t, n) => {
|
|
250
|
+
const s = n.split(".");
|
|
251
|
+
return s.reduce((r, d, p) => (p === s.length - 1 ? r[d] = i.getFieldValue(n) : r[d] = r[d] ?? {}, r[d]), t), t;
|
|
252
|
+
}, {}), j = (e) => {
|
|
247
253
|
if (e) {
|
|
248
|
-
if (
|
|
249
|
-
return
|
|
250
|
-
if (
|
|
251
|
-
const t = Object.keys(l).filter((
|
|
252
|
-
return
|
|
254
|
+
if (_.isArray(e.keys))
|
|
255
|
+
return V(e.keys);
|
|
256
|
+
if (_.isArray(e.banKeys)) {
|
|
257
|
+
const t = Object.keys(l).filter((n) => e.banKeys?.includes(n));
|
|
258
|
+
return V(t);
|
|
253
259
|
}
|
|
254
260
|
return i.store.state.values;
|
|
255
261
|
}
|
|
256
|
-
},
|
|
262
|
+
}, x = () => {
|
|
257
263
|
const e = o?.persistency;
|
|
258
264
|
if (!(!e?.policies || e.policies.length === 0) && (e.policies.includes("local") || e.policies.includes("session"))) {
|
|
259
265
|
const t = e.policies.includes("local") ? localStorage : sessionStorage;
|
|
260
266
|
if (!t) return;
|
|
261
|
-
const
|
|
262
|
-
return t.setItem(
|
|
267
|
+
const n = j(e);
|
|
268
|
+
return t.setItem(f.value, JSON.stringify(n));
|
|
263
269
|
}
|
|
264
270
|
}, N = () => {
|
|
265
271
|
const e = o?.persistency;
|
|
266
272
|
if (!(!e?.policies || e.policies.length === 0) && e.policies.includes("querystring")) {
|
|
267
|
-
const t =
|
|
268
|
-
|
|
273
|
+
const t = j(e), n = new URLSearchParams(window.location.search);
|
|
274
|
+
n.set(f.value, JSON.stringify(t));
|
|
269
275
|
const s = new URL(window.location.href);
|
|
270
|
-
s.search =
|
|
276
|
+
s.search = n.toString(), window.history.replaceState({}, "", s.toString());
|
|
271
277
|
}
|
|
272
278
|
}, I = (e) => {
|
|
273
279
|
i.store.state.isDirty && e.preventDefault();
|
|
274
280
|
};
|
|
275
|
-
if (W(
|
|
276
|
-
window.addEventListener("beforeunload",
|
|
277
|
-
}),
|
|
278
|
-
window.removeEventListener("beforeunload",
|
|
281
|
+
if (W(x), Y(() => {
|
|
282
|
+
window.addEventListener("beforeunload", x), window.addEventListener("blur", N), o?.preventWindowExit && o.preventWindowExit !== "nope" && window.addEventListener("beforeunload", I);
|
|
283
|
+
}), C(() => {
|
|
284
|
+
window.removeEventListener("beforeunload", x), window.removeEventListener("blur", N), o?.preventWindowExit && o.preventWindowExit !== "nope" && window.removeEventListener("beforeunload", I);
|
|
279
285
|
}), o?.preventWindowExit === "prevent-and-reset") {
|
|
280
|
-
const e = i.useStore((
|
|
281
|
-
B([e, t], ([
|
|
282
|
-
|
|
286
|
+
const e = i.useStore((r) => r.isSubmitting), t = i.useStore((r) => r.submissionAttempts), n = i.useStore((r) => r.canSubmit), s = i.useStore((r) => r.values);
|
|
287
|
+
B([e, t], ([r, d], [p]) => {
|
|
288
|
+
p && !r && d > 0 && n.value && i.reset(s.value);
|
|
283
289
|
});
|
|
284
290
|
}
|
|
285
|
-
const $ = (e) =>
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
(t) =>
|
|
291
|
+
const $ = (e) => S.currentSpan.pipe(
|
|
292
|
+
S.option,
|
|
293
|
+
S.flatMap(
|
|
294
|
+
(t) => S.promise(() => i.handleSubmit(U.isSome(t) ? { currentSpan: t.value, ...e } : e))
|
|
289
295
|
)
|
|
290
|
-
), J = (e) => e?.checkErrors ? $(e?.meta).pipe(
|
|
296
|
+
), J = (e) => e?.checkErrors ? $(e?.meta).pipe(S.flatMap(S.fnUntraced(function* () {
|
|
291
297
|
const t = i.getAllErrors();
|
|
292
298
|
if (Object.keys(t.fields).length || t.form.errors.length)
|
|
293
|
-
return yield* new
|
|
294
|
-
}))) : $(e?.meta), z = i.handleSubmit,
|
|
299
|
+
return yield* new le({ form: t.form, fields: t.fields });
|
|
300
|
+
}))) : $(e?.meta), z = i.handleSubmit, P = ee(/* @__PURE__ */ new Map()), b = Object.assign(i, {
|
|
295
301
|
i18nNamespace: o?.i18nNamespace,
|
|
296
302
|
ignorePreventCloseEvents: o?.ignorePreventCloseEvents,
|
|
297
303
|
meta: l,
|
|
298
304
|
clear: M,
|
|
299
305
|
handleSubmit: (e) => {
|
|
300
|
-
const t = q.getSpan(
|
|
306
|
+
const t = q.getSpan(L.active());
|
|
301
307
|
return z({ currentSpan: t, ...e });
|
|
302
308
|
},
|
|
303
309
|
// /** @experimental */
|
|
304
310
|
handleSubmitEffect: J,
|
|
305
311
|
registerField: (e) => {
|
|
306
|
-
B(e, (t) =>
|
|
312
|
+
B(e, (t) => P.value.set(t.name, { label: t.label, id: t.id }), { immediate: !0 }), W(() => P.value.delete(e.value.name));
|
|
307
313
|
}
|
|
308
|
-
}), R = { form:
|
|
309
|
-
return Object.assign(
|
|
314
|
+
}), R = { form: b, fieldMap: P };
|
|
315
|
+
return Object.assign(b, {
|
|
310
316
|
// Type-level properties for performance optimization (not used at runtime)
|
|
311
317
|
_paths: void 0,
|
|
312
318
|
_keys: void 0,
|
|
313
319
|
errorContext: R,
|
|
314
|
-
Form: D(
|
|
315
|
-
Input: D(
|
|
316
|
-
TaggedUnion: D(
|
|
320
|
+
Form: D(b)(ae),
|
|
321
|
+
Input: D(b)(o?.input ?? oe),
|
|
322
|
+
TaggedUnion: D(b)(ie),
|
|
317
323
|
Field: i.Field,
|
|
318
|
-
Errors:
|
|
319
|
-
Array: D(
|
|
320
|
-
AutoGen: D(
|
|
324
|
+
Errors: ce(R)(ne),
|
|
325
|
+
Array: D(b)(te),
|
|
326
|
+
AutoGen: D(b)(re)
|
|
321
327
|
});
|
|
322
328
|
};
|
|
323
329
|
export {
|
|
324
|
-
|
|
330
|
+
le as FormErrors,
|
|
325
331
|
Fe as useOmegaForm
|
|
326
332
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import l from "./vue-components.
|
|
1
|
+
import l from "./vue-components.es29.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.es16.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,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
}))
|
|
1
|
+
import { onMounted as e, onUnmounted as u } from "vue";
|
|
2
|
+
function p(t) {
|
|
3
|
+
let n;
|
|
4
|
+
e(() => {
|
|
5
|
+
const o = t();
|
|
6
|
+
o && (n = o);
|
|
7
|
+
}), u(() => {
|
|
8
|
+
n && n();
|
|
9
|
+
});
|
|
10
|
+
}
|
|
8
11
|
export {
|
|
9
|
-
|
|
10
|
-
i as cloneTrait,
|
|
11
|
-
p as runtimeFiberAsPromise
|
|
12
|
+
p as onMountedWithCleanup
|
|
12
13
|
};
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
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
|
+
}));
|
|
3
8
|
export {
|
|
4
|
-
|
|
5
|
-
i as
|
|
6
|
-
|
|
9
|
+
a as clone,
|
|
10
|
+
i as cloneTrait,
|
|
11
|
+
p as runtimeFiberAsPromise
|
|
7
12
|
};
|
|
@@ -1,57 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const
|
|
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
|
-
});
|
|
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);
|
|
55
3
|
export {
|
|
56
|
-
|
|
4
|
+
s as isFunction,
|
|
5
|
+
i as isObject,
|
|
6
|
+
t as isRecordOrArray
|
|
57
7
|
};
|
|
@@ -1,70 +1,57 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
__name: "
|
|
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
5
|
props: {
|
|
6
6
|
form: {},
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
order: {},
|
|
12
|
-
sort: {}
|
|
7
|
+
inputClass: {},
|
|
8
|
+
name: {},
|
|
9
|
+
defaultItems: {},
|
|
10
|
+
items: {}
|
|
13
11
|
},
|
|
14
|
-
setup(
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
n.form.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
(e
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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));
|
|
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"]));
|
|
66
53
|
}
|
|
67
54
|
});
|
|
68
55
|
export {
|
|
69
|
-
|
|
56
|
+
N as default
|
|
70
57
|
};
|
|
@@ -1,8 +1,70 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
+
});
|
|
6
68
|
export {
|
|
7
|
-
|
|
69
|
+
I as default
|
|
8
70
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var
|
|
2
|
-
import
|
|
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.es33.js";
|
|
3
3
|
|
|
4
|
-
import
|
|
5
|
-
const e = /* @__PURE__ */
|
|
4
|
+
import o from "./vue-components.es35.js";
|
|
5
|
+
const e = /* @__PURE__ */ o(r, [["__scopeId", "data-v-d4ffe76f"]]);
|
|
6
6
|
export {
|
|
7
7
|
e as default
|
|
8
8
|
};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var n=document.createElement("style");if(n.appendChild(document.createTextNode("fieldset[data-v-05e510ab]{display:contents}fieldset[disabled][data-v-05e510ab]>*{pointer-events:none}")),document.head.appendChild(n),window.customElements){const e=window.customElements.define;window.customElements.define=function(i,t){const d=t.prototype.connectedCallback;return t.prototype.connectedCallback=function(){if(d&&d.call(this),this.shadowRoot){const o=document.createElement("style");o.appendChild(document.createTextNode("fieldset[data-v-05e510ab]{display:contents}fieldset[disabled][data-v-05e510ab]>*{pointer-events:none}")),this.shadowRoot.appendChild(o)}},e.call(window.customElements,i,t)}}}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
|
+
import o from "./vue-components.es36.js";
|
|
3
|
+
|
|
4
|
+
import m from "./vue-components.es35.js";
|
|
5
|
+
const e = /* @__PURE__ */ m(o, [["__scopeId", "data-v-05e510ab"]]);
|
|
3
6
|
export {
|
|
4
|
-
|
|
7
|
+
e as default
|
|
5
8
|
};
|
|
@@ -1,19 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
return { all: t = t || /* @__PURE__ */ new Map(), on: function(e, f) {
|
|
3
|
-
var i = t.get(e);
|
|
4
|
-
i ? i.push(f) : t.set(e, [f]);
|
|
5
|
-
}, off: function(e, f) {
|
|
6
|
-
var i = t.get(e);
|
|
7
|
-
i && (f ? i.splice(i.indexOf(f) >>> 0, 1) : t.set(e, []));
|
|
8
|
-
}, emit: function(e, f) {
|
|
9
|
-
var i = t.get(e);
|
|
10
|
-
i && i.slice().map(function(a) {
|
|
11
|
-
a(f);
|
|
12
|
-
}), (i = t.get("*")) && i.slice().map(function(a) {
|
|
13
|
-
a(e, f);
|
|
14
|
-
});
|
|
15
|
-
} };
|
|
16
|
-
}
|
|
1
|
+
import f from "./vue-components.es9.js";
|
|
17
2
|
export {
|
|
18
|
-
|
|
3
|
+
f as default
|
|
19
4
|
};
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
function c(t) {
|
|
2
|
+
return { all: t = t || /* @__PURE__ */ new Map(), on: function(e, f) {
|
|
3
|
+
var i = t.get(e);
|
|
4
|
+
i ? i.push(f) : t.set(e, [f]);
|
|
5
|
+
}, off: function(e, f) {
|
|
6
|
+
var i = t.get(e);
|
|
7
|
+
i && (f ? i.splice(i.indexOf(f) >>> 0, 1) : t.set(e, []));
|
|
8
|
+
}, emit: function(e, f) {
|
|
9
|
+
var i = t.get(e);
|
|
10
|
+
i && i.slice().map(function(a) {
|
|
11
|
+
a(f);
|
|
12
|
+
}), (i = t.get("*")) && i.slice().map(function(a) {
|
|
13
|
+
a(e, f);
|
|
14
|
+
});
|
|
15
|
+
} };
|
|
10
16
|
}
|
|
11
17
|
export {
|
|
12
|
-
|
|
18
|
+
c as default
|
|
13
19
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as v, mergeModels as C, useModel as k, useSlots as V, computed as _, resolveComponent as g, createBlock as y, openBlock as B, unref as a, createSlots as E, withCtx as u, renderSlot as d, renderList as M, normalizeProps as S, guardReactiveProps as w } from "vue";
|
|
2
2
|
import { useOnClose as L } from "./vue-components.es11.js";
|
|
3
|
-
import { onMountedWithCleanup as h } from "./vue-components.
|
|
3
|
+
import { onMountedWithCleanup as h } from "./vue-components.es16.js";
|
|
4
4
|
const z = /* @__PURE__ */ v({
|
|
5
5
|
__name: "Dialog",
|
|
6
6
|
props: /* @__PURE__ */ C({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as d, createBlock as u, openBlock as g, unref as l, withCtx as o, renderSlot as n, createVNode as r, createCommentVNode as c, normalizeProps as s, guardReactiveProps as f, createSlots as $, renderList as y } from "vue";
|
|
2
2
|
import C from "./vue-components.es9.js";
|
|
3
|
-
const
|
|
3
|
+
const h = /* @__PURE__ */ d({
|
|
4
4
|
__name: "OmegaTaggedUnion",
|
|
5
5
|
props: {
|
|
6
6
|
name: {},
|
|
@@ -10,38 +10,37 @@ const F = /* @__PURE__ */ s({
|
|
|
10
10
|
label: {}
|
|
11
11
|
},
|
|
12
12
|
setup(e) {
|
|
13
|
-
return (
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}, {
|
|
25
|
-
default: r(({ field: u, state: m }) => [
|
|
26
|
-
m.value ? n(t.$slots, "default", { key: 0 }) : g("", !0),
|
|
27
|
-
a(C, {
|
|
28
|
-
field: u,
|
|
29
|
-
state: m.value,
|
|
30
|
-
name: e.name
|
|
31
|
-
}, $({ _: 2 }, [
|
|
32
|
-
y(t.$slots, (v, l) => ({
|
|
33
|
-
name: l,
|
|
34
|
-
fn: r((i) => [
|
|
35
|
-
n(t.$slots, l, b(p(i)))
|
|
36
|
-
])
|
|
37
|
-
}))
|
|
38
|
-
]), 1032, ["field", "state", "name"])
|
|
13
|
+
return (a, b) => (g(), u(l(e.form).Field, {
|
|
14
|
+
name: e.name ? `${e.name}._tag` : "_tag"
|
|
15
|
+
}, {
|
|
16
|
+
default: o((t) => [
|
|
17
|
+
n(a.$slots, "OmegaCustomInput", s(f(t)), () => [
|
|
18
|
+
r(l(e.form).Input, {
|
|
19
|
+
name: e.name ? `${e.name}._tag` : "_tag",
|
|
20
|
+
label: e.label,
|
|
21
|
+
type: e.type ?? "select",
|
|
22
|
+
options: e.options
|
|
23
|
+
}, null, 8, ["name", "label", "type", "options"])
|
|
39
24
|
]),
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
25
|
+
n(a.$slots, "default"),
|
|
26
|
+
r(C, {
|
|
27
|
+
field: t.field,
|
|
28
|
+
state: t.state.value,
|
|
29
|
+
name: e.name
|
|
30
|
+
}, $({ _: 2 }, [
|
|
31
|
+
y(a.$slots, (k, m) => ({
|
|
32
|
+
name: m,
|
|
33
|
+
fn: o((i) => [
|
|
34
|
+
n(a.$slots, m, s(f(i)))
|
|
35
|
+
])
|
|
36
|
+
}))
|
|
37
|
+
]), 1032, ["field", "state", "name"]),
|
|
38
|
+
t.state.value ? n(a.$slots, "OmegaCommon", { key: 0 }) : c("", !0)
|
|
39
|
+
]),
|
|
40
|
+
_: 3
|
|
41
|
+
}, 8, ["name"]));
|
|
43
42
|
}
|
|
44
43
|
});
|
|
45
44
|
export {
|
|
46
|
-
|
|
45
|
+
h as default
|
|
47
46
|
};
|
|
@@ -8,11 +8,11 @@ const f = /* @__PURE__ */ l({
|
|
|
8
8
|
},
|
|
9
9
|
setup(e) {
|
|
10
10
|
const a = e;
|
|
11
|
-
return i(() => a.state
|
|
11
|
+
return i(() => a.state, (t, n) => {
|
|
12
12
|
t === null && a.field.setValue(null), t !== n && setTimeout(() => {
|
|
13
13
|
a.field.validate("change");
|
|
14
14
|
}, 0);
|
|
15
|
-
}), (t, n) => e.state
|
|
15
|
+
}), (t, n) => e.state ? m(t.$slots, `${e.name ? `${e.name}.` : ""}${e.state}`, o(r({ key: 0 }, { field: e.field, state: e.state }))) : s("", !0);
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
export {
|
package/package.json
CHANGED
|
@@ -23,20 +23,23 @@ defineProps<{
|
|
|
23
23
|
</script>
|
|
24
24
|
|
|
25
25
|
<template>
|
|
26
|
-
<
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
26
|
+
<form.Field :name="(name ? `${name}._tag` : '_tag') as any">
|
|
27
|
+
<template #default="inputProps">
|
|
28
|
+
<slot
|
|
29
|
+
name="OmegaCustomInput"
|
|
30
|
+
v-bind="inputProps"
|
|
31
|
+
>
|
|
32
|
+
<form.Input
|
|
33
|
+
:name="(name ? `${name}._tag` : '_tag') as FieldPath<From>"
|
|
34
|
+
:label="label"
|
|
35
|
+
:type="type ?? 'select'"
|
|
36
|
+
:options="options"
|
|
37
|
+
/>
|
|
38
|
+
</slot>
|
|
39
|
+
<slot />
|
|
37
40
|
<OmegaTaggedUnionInternal
|
|
38
|
-
:field="field as any"
|
|
39
|
-
:state="state.value"
|
|
41
|
+
:field="inputProps.field as any"
|
|
42
|
+
:state="inputProps.state.value"
|
|
40
43
|
:name="name"
|
|
41
44
|
>
|
|
42
45
|
<template
|
|
@@ -49,6 +52,10 @@ defineProps<{
|
|
|
49
52
|
/>
|
|
50
53
|
</template>
|
|
51
54
|
</OmegaTaggedUnionInternal>
|
|
55
|
+
<slot
|
|
56
|
+
v-if="inputProps.state.value"
|
|
57
|
+
name="OmegaCommon"
|
|
58
|
+
/>
|
|
52
59
|
</template>
|
|
53
60
|
</form.Field>
|
|
54
61
|
</template>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<slot
|
|
3
|
-
v-if="state
|
|
4
|
-
:name="`${name ? `${name}.` : ''}${state
|
|
3
|
+
v-if="state"
|
|
4
|
+
:name="`${name ? `${name}.` : ''}${state}`"
|
|
5
5
|
v-bind="{ field, state }"
|
|
6
6
|
/>
|
|
7
7
|
</template>
|
|
@@ -26,7 +26,7 @@ const props = defineProps<{
|
|
|
26
26
|
}>()
|
|
27
27
|
|
|
28
28
|
// Watch for _tag changes
|
|
29
|
-
watch(() => props.state
|
|
29
|
+
watch(() => props.state, (newTag, oldTag) => {
|
|
30
30
|
if (newTag === null) {
|
|
31
31
|
props.field.setValue(null as DeepValue<From, Name>)
|
|
32
32
|
}
|
|
@@ -791,11 +791,27 @@ export const useOmegaForm = <
|
|
|
791
791
|
const extractDefaultsFromAST = (schemaObj: any): any => {
|
|
792
792
|
const result: Record<string, any> = {}
|
|
793
793
|
|
|
794
|
-
//
|
|
795
|
-
|
|
794
|
+
// If this schema has a .make() method (like ExtendedClass), use it to get complete defaults
|
|
795
|
+
// This is more reliable than manually extracting fields, especially for classes
|
|
796
|
+
if (typeof schemaObj?.make === "function") {
|
|
797
|
+
try {
|
|
798
|
+
const instance = schemaObj.make({})
|
|
799
|
+
// For ExtendedClass, the instance is already in the correct encoded format
|
|
800
|
+
return instance
|
|
801
|
+
} catch {
|
|
802
|
+
// If make() fails, fall through to manual extraction
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
// Check if this schema is a union - check both direct property and AST
|
|
807
|
+
const unionMembers = schemaObj?.members
|
|
808
|
+
|| (schemaObj?.ast?._tag === "Union" && schemaObj.ast.types
|
|
809
|
+
? schemaObj.ast.types.map((t: any) => S.make(t))
|
|
810
|
+
: null)
|
|
811
|
+
if (unionMembers && Array.isArray(unionMembers)) {
|
|
796
812
|
// For unions, we try to find the first member that has a complete set of defaults
|
|
797
813
|
// Priority is given to members with default values for discriminator fields
|
|
798
|
-
for (const member of
|
|
814
|
+
for (const member of unionMembers as any[]) {
|
|
799
815
|
const memberDefaults = extractDefaultsFromAST(member)
|
|
800
816
|
if (Object.keys(memberDefaults).length > 0) {
|
|
801
817
|
// Check if this member has a default value for a discriminator field (like _tag)
|