@effect-app/vue-components 1.4.2 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/types/components/OmegaForm/blockDialog.d.ts +12 -0
- package/dist/types/components/OmegaForm/index.d.ts +1 -0
- package/dist/types/components/OmegaForm/onMountedWithCleanup.d.ts +6 -0
- package/dist/types/components/OmegaForm/useOmegaForm.d.ts +1 -0
- package/dist/vue-components.es.js +21 -18
- package/dist/vue-components.es10.js +30 -10
- package/dist/vue-components.es11.js +10 -5
- package/dist/vue-components.es12.js +5 -54
- package/dist/vue-components.es13.js +49 -63
- package/dist/vue-components.es14.js +68 -6
- package/dist/vue-components.es15.js +5 -5
- package/dist/vue-components.es16.js +6 -3
- package/dist/vue-components.es17.js +3 -3
- package/dist/vue-components.es18.js +3 -2
- package/dist/vue-components.es19.js +1 -1
- package/dist/vue-components.es2.js +12 -9
- package/dist/vue-components.es20.js +2 -135
- package/dist/vue-components.es21.js +19 -0
- package/dist/vue-components.es22.js +11 -42
- package/dist/vue-components.es23.js +135 -2
- package/dist/vue-components.es25.js +41 -89
- package/dist/vue-components.es27.js +2 -7
- package/dist/vue-components.es28.js +86 -27
- package/dist/vue-components.es30.js +7 -4
- package/dist/vue-components.es31.js +31 -23
- package/dist/vue-components.es33.js +4 -21
- package/dist/vue-components.es34.js +20 -27
- package/dist/vue-components.es35.js +5 -22
- package/dist/vue-components.es36.js +15 -6
- package/dist/vue-components.es37.js +30 -5
- package/dist/vue-components.es38.js +22 -19
- package/dist/vue-components.es39.js +12 -9
- package/dist/vue-components.es4.js +1 -1
- package/dist/vue-components.es40.js +5 -31
- package/dist/vue-components.es41.js +19 -48
- package/dist/vue-components.es42.js +9 -26
- package/dist/vue-components.es43.js +31 -11
- package/dist/vue-components.es44.js +37 -54
- package/dist/vue-components.es45.js +21 -51
- package/dist/vue-components.es46.js +10 -16
- package/dist/vue-components.es47.js +64 -32
- package/dist/vue-components.es48.js +55 -28
- package/dist/vue-components.es49.js +16 -41
- package/dist/vue-components.es5.js +44 -44
- package/dist/vue-components.es50.js +33 -2
- package/dist/vue-components.es51.js +28 -43
- package/dist/vue-components.es52.js +42 -2
- package/dist/vue-components.es53.js +4 -0
- package/dist/vue-components.es54.js +46 -0
- package/dist/vue-components.es55.js +4 -0
- package/dist/vue-components.es7.js +45 -44
- package/dist/vue-components.es8.js +29 -355
- package/dist/vue-components.es9.js +352 -26
- package/package.json +5 -4
- package/src/components/OmegaForm/OmegaInternalInput.vue +6 -4
- package/src/components/OmegaForm/blockDialog.ts +56 -0
- package/src/components/OmegaForm/index.ts +2 -0
- package/src/components/OmegaForm/onMountedWithCleanup.ts +22 -0
- package/src/components/OmegaForm/useOmegaForm.ts +7 -0
- package/dist/vue-components.es32.js +0 -7
- /package/dist/{vue-components.es24.js → vue-components.es26.js} +0 -0
|
@@ -1,4 +1,44 @@
|
|
|
1
|
-
|
|
1
|
+
import { ROOT_CONTEXT as l } from "./vue-components.es34.js";
|
|
2
|
+
var c = function(t, o) {
|
|
3
|
+
var n = typeof Symbol == "function" && t[Symbol.iterator];
|
|
4
|
+
if (!n) return t;
|
|
5
|
+
var e = n.call(t), a, r = [], u;
|
|
6
|
+
try {
|
|
7
|
+
for (; (o === void 0 || o-- > 0) && !(a = e.next()).done; ) r.push(a.value);
|
|
8
|
+
} catch (i) {
|
|
9
|
+
u = { error: i };
|
|
10
|
+
} finally {
|
|
11
|
+
try {
|
|
12
|
+
a && !a.done && (n = e.return) && n.call(e);
|
|
13
|
+
} finally {
|
|
14
|
+
if (u) throw u.error;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return r;
|
|
18
|
+
}, p = function(t, o, n) {
|
|
19
|
+
if (n || arguments.length === 2) for (var e = 0, a = o.length, r; e < a; e++)
|
|
20
|
+
(r || !(e in o)) && (r || (r = Array.prototype.slice.call(o, 0, e)), r[e] = o[e]);
|
|
21
|
+
return t.concat(r || Array.prototype.slice.call(o));
|
|
22
|
+
}, y = (
|
|
23
|
+
/** @class */
|
|
24
|
+
(function() {
|
|
25
|
+
function t() {
|
|
26
|
+
}
|
|
27
|
+
return t.prototype.active = function() {
|
|
28
|
+
return l;
|
|
29
|
+
}, t.prototype.with = function(o, n, e) {
|
|
30
|
+
for (var a = [], r = 3; r < arguments.length; r++)
|
|
31
|
+
a[r - 3] = arguments[r];
|
|
32
|
+
return n.call.apply(n, p([e], c(a), !1));
|
|
33
|
+
}, t.prototype.bind = function(o, n) {
|
|
34
|
+
return n;
|
|
35
|
+
}, t.prototype.enable = function() {
|
|
36
|
+
return this;
|
|
37
|
+
}, t.prototype.disable = function() {
|
|
38
|
+
return this;
|
|
39
|
+
}, t;
|
|
40
|
+
})()
|
|
41
|
+
);
|
|
2
42
|
export {
|
|
3
|
-
|
|
43
|
+
y as NoopContextManager
|
|
4
44
|
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { VERSION as d } from "./vue-components.es53.js";
|
|
2
|
+
var h = /^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;
|
|
3
|
+
function s(c) {
|
|
4
|
+
var m = /* @__PURE__ */ new Set([c]), f = /* @__PURE__ */ new Set(), t = c.match(h);
|
|
5
|
+
if (!t)
|
|
6
|
+
return function() {
|
|
7
|
+
return !1;
|
|
8
|
+
};
|
|
9
|
+
var e = {
|
|
10
|
+
major: +t[1],
|
|
11
|
+
minor: +t[2],
|
|
12
|
+
patch: +t[3],
|
|
13
|
+
prerelease: t[4]
|
|
14
|
+
};
|
|
15
|
+
if (e.prerelease != null)
|
|
16
|
+
return function(r) {
|
|
17
|
+
return r === c;
|
|
18
|
+
};
|
|
19
|
+
function a(n) {
|
|
20
|
+
return f.add(n), !1;
|
|
21
|
+
}
|
|
22
|
+
function p(n) {
|
|
23
|
+
return m.add(n), !0;
|
|
24
|
+
}
|
|
25
|
+
return function(r) {
|
|
26
|
+
if (m.has(r))
|
|
27
|
+
return !0;
|
|
28
|
+
if (f.has(r))
|
|
29
|
+
return !1;
|
|
30
|
+
var i = r.match(h);
|
|
31
|
+
if (!i)
|
|
32
|
+
return a(r);
|
|
33
|
+
var u = {
|
|
34
|
+
major: +i[1],
|
|
35
|
+
minor: +i[2],
|
|
36
|
+
patch: +i[3],
|
|
37
|
+
prerelease: i[4]
|
|
38
|
+
};
|
|
39
|
+
return u.prerelease != null || e.major !== u.major ? a(r) : e.major === 0 ? e.minor === u.minor && e.patch <= u.patch ? p(r) : a(r) : e.minor <= u.minor ? p(r) : a(r);
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
var v = s(d);
|
|
43
|
+
export {
|
|
44
|
+
s as _makeCompatibilityCheck,
|
|
45
|
+
v as isCompatible
|
|
46
|
+
};
|
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
import { useForm as J, useStore as q } from "@tanstack/vue-form";
|
|
2
|
-
import { Data as K, S as
|
|
3
|
-
import { runtimeFiberAsPromise as B } from "./vue-components.
|
|
4
|
-
import { isObject as G } from "./vue-components.
|
|
5
|
-
import { computed as
|
|
6
|
-
import X from "./vue-components.
|
|
2
|
+
import { Data as K, S as L, Effect as c, Fiber as y, Option as k } from "effect-app";
|
|
3
|
+
import { runtimeFiberAsPromise as B } from "./vue-components.es11.js";
|
|
4
|
+
import { isObject as G } from "./vue-components.es12.js";
|
|
5
|
+
import { computed as A, onUnmounted as T, onMounted as W, onBeforeUnmount as z, watch as Q, h as M } from "vue";
|
|
6
|
+
import { usePreventClose as X } from "./vue-components.es8.js";
|
|
7
7
|
import Y from "./vue-components.es13.js";
|
|
8
|
-
import
|
|
9
|
-
import C from "./vue-components.
|
|
10
|
-
import
|
|
11
|
-
import re from "./vue-components.
|
|
12
|
-
import te from "./vue-components.
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
15
|
-
|
|
8
|
+
import Z from "./vue-components.es14.js";
|
|
9
|
+
import { buildOmegaErrors as C } from "./vue-components.es6.js";
|
|
10
|
+
import ee from "./vue-components.es15.js";
|
|
11
|
+
import { generateMetaFromSchema as re } from "./vue-components.es9.js";
|
|
12
|
+
import te from "./vue-components.es4.js";
|
|
13
|
+
import se from "./vue-components.es16.js";
|
|
14
|
+
import { trace as I } from "./vue-components.es17.js";
|
|
15
|
+
import { context as E } from "./vue-components.es18.js";
|
|
16
|
+
class ne extends K.TaggedError("FormErrors") {
|
|
16
17
|
}
|
|
17
18
|
const p = (l) => function(o) {
|
|
18
19
|
return {
|
|
19
20
|
render() {
|
|
20
|
-
return
|
|
21
|
+
return M(o, {
|
|
21
22
|
form: l,
|
|
22
23
|
...this.$attrs
|
|
23
24
|
}, this.$slots);
|
|
24
25
|
}
|
|
25
26
|
};
|
|
26
|
-
},
|
|
27
|
+
}, oe = (l) => function(o) {
|
|
27
28
|
return {
|
|
28
29
|
setup() {
|
|
29
30
|
return {
|
|
@@ -31,7 +32,7 @@ const p = (l) => function(o) {
|
|
|
31
32
|
};
|
|
32
33
|
},
|
|
33
34
|
render({ errors: h, generalErrors: S, showErrors: w }) {
|
|
34
|
-
return
|
|
35
|
+
return M(o, {
|
|
35
36
|
errors: h,
|
|
36
37
|
generalErrors: S,
|
|
37
38
|
showErrors: w,
|
|
@@ -39,9 +40,9 @@ const p = (l) => function(o) {
|
|
|
39
40
|
}, this.$slots);
|
|
40
41
|
}
|
|
41
42
|
};
|
|
42
|
-
},
|
|
43
|
+
}, Ee = (l, a, o) => {
|
|
43
44
|
if (!l) throw new Error("Schema is required");
|
|
44
|
-
const h =
|
|
45
|
+
const h = L.standardSchemaV1(l), S = L.decode(l), { filterItems: w, meta: d } = re(l), m = A(() => {
|
|
45
46
|
if (o?.persistency?.id)
|
|
46
47
|
return o.persistency.id;
|
|
47
48
|
const e = window.location.pathname, r = Object.keys(d);
|
|
@@ -57,7 +58,7 @@ const p = (l) => function(o) {
|
|
|
57
58
|
r[t] && G(r[t]) ? (e[t] || (e[t] = {}), g(e[t], r[t])) : e[t] = r[t];
|
|
58
59
|
return e;
|
|
59
60
|
}
|
|
60
|
-
const $ =
|
|
61
|
+
const $ = A(() => {
|
|
61
62
|
if (a?.defaultValues && !o?.persistency?.overrideDefaultValues)
|
|
62
63
|
return a?.defaultValues;
|
|
63
64
|
let e;
|
|
@@ -91,7 +92,7 @@ const p = (l) => function(o) {
|
|
|
91
92
|
const t = a?.defaultValues;
|
|
92
93
|
return g(t, e);
|
|
93
94
|
}
|
|
94
|
-
}), N = (e, r) => e ? E.with(
|
|
95
|
+
}), N = (e, r) => e ? E.with(I.setSpan(E.active(), e), r) : r(), u = J({
|
|
95
96
|
...a,
|
|
96
97
|
validators: {
|
|
97
98
|
onSubmit: h,
|
|
@@ -130,7 +131,7 @@ const p = (l) => function(o) {
|
|
|
130
131
|
}
|
|
131
132
|
return u.store.state.values;
|
|
132
133
|
}
|
|
133
|
-
},
|
|
134
|
+
}, v = () => {
|
|
134
135
|
const e = o?.persistency;
|
|
135
136
|
if (!(!e?.policies || e.policies.length === 0) && (e.policies.includes("local") || e.policies.includes("session"))) {
|
|
136
137
|
const r = e.policies.includes("local") ? localStorage : sessionStorage;
|
|
@@ -147,39 +148,39 @@ const p = (l) => function(o) {
|
|
|
147
148
|
s.search = t.toString(), window.history.replaceState({}, "", s.toString());
|
|
148
149
|
}
|
|
149
150
|
};
|
|
150
|
-
T(
|
|
151
|
-
window.addEventListener("beforeunload",
|
|
151
|
+
T(v), W(() => {
|
|
152
|
+
window.addEventListener("beforeunload", v), window.addEventListener("blur", V);
|
|
152
153
|
}), z(() => {
|
|
153
|
-
window.removeEventListener("beforeunload",
|
|
154
|
+
window.removeEventListener("beforeunload", v), window.removeEventListener("blur", V);
|
|
154
155
|
});
|
|
155
156
|
const j = (e) => c.currentSpan.pipe(
|
|
156
157
|
c.option,
|
|
157
158
|
c.flatMap(
|
|
158
159
|
(r) => c.promise(() => u.handleSubmit(k.isSome(r) ? { currentSpan: r.value, ...e } : e))
|
|
159
160
|
)
|
|
160
|
-
),
|
|
161
|
+
), D = (e) => e?.checkErrors ? j(e?.meta).pipe(c.flatMap(c.fnUntraced(function* () {
|
|
161
162
|
const r = u.getAllErrors();
|
|
162
163
|
if (Object.keys(r.fields).length || r.form.errors.length)
|
|
163
|
-
return yield* new
|
|
164
|
-
}))) : j(e?.meta),
|
|
164
|
+
return yield* new ne({ form: r.form, fields: r.fields });
|
|
165
|
+
}))) : j(e?.meta), R = u.handleSubmit, i = Object.assign(u, {
|
|
165
166
|
i18nNamespace: o?.i18nNamespace,
|
|
166
167
|
meta: d,
|
|
167
168
|
filterItems: w,
|
|
168
169
|
clear: _,
|
|
169
170
|
handleSubmit: (e) => {
|
|
170
|
-
const r =
|
|
171
|
-
return
|
|
171
|
+
const r = I.getSpan(E.active());
|
|
172
|
+
return R({ currentSpan: r, ...e });
|
|
172
173
|
},
|
|
173
174
|
// /** @experimental */
|
|
174
|
-
handleSubmitEffect:
|
|
175
|
-
}),
|
|
175
|
+
handleSubmitEffect: D
|
|
176
|
+
}), x = q(
|
|
176
177
|
i.store,
|
|
177
178
|
(e) => e.submissionAttempts
|
|
178
|
-
),
|
|
179
|
+
), b = i.useStore((e) => e.errors);
|
|
179
180
|
Q(
|
|
180
|
-
() => [i.filterItems,
|
|
181
|
+
() => [i.filterItems, b.value],
|
|
181
182
|
() => {
|
|
182
|
-
const e = i.filterItems, r =
|
|
183
|
+
const e = i.filterItems, r = b.value;
|
|
183
184
|
return e ? r ? (Object.values(r).filter(
|
|
184
185
|
(s) => !!s
|
|
185
186
|
).flatMap(
|
|
@@ -197,18 +198,18 @@ const p = (l) => function(o) {
|
|
|
197
198
|
}), {}) : {} : {};
|
|
198
199
|
}
|
|
199
200
|
);
|
|
200
|
-
const
|
|
201
|
-
return Object.assign(i, {
|
|
202
|
-
errorContext:
|
|
203
|
-
Form: p(i)(
|
|
204
|
-
Input: p(i)(o?.input ??
|
|
201
|
+
const P = C(x, b, o?.showErrorsOn);
|
|
202
|
+
return o?.ignorePreventCloseEvents || X(() => i.useStore((e) => e.isDirty)), Object.assign(i, {
|
|
203
|
+
errorContext: P,
|
|
204
|
+
Form: p(i)(se),
|
|
205
|
+
Input: p(i)(o?.input ?? te),
|
|
205
206
|
Field: u.Field,
|
|
206
|
-
Errors:
|
|
207
|
-
Array: p(i)(
|
|
208
|
-
AutoGen: p(i)(
|
|
207
|
+
Errors: oe(P)(ee),
|
|
208
|
+
Array: p(i)(Y),
|
|
209
|
+
AutoGen: p(i)(Z)
|
|
209
210
|
});
|
|
210
211
|
};
|
|
211
212
|
export {
|
|
212
|
-
|
|
213
|
-
|
|
213
|
+
ne as FormErrors,
|
|
214
|
+
Ee as useOmegaForm
|
|
214
215
|
};
|
|
@@ -1,358 +1,32 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
});
|
|
16
|
-
if (p) {
|
|
17
|
-
for (const r of p) {
|
|
18
|
-
const l = i ? `${i}.${r.name.toString()}` : r.name.toString(), a = g(r.type), u = !a, A = r.type;
|
|
19
|
-
if (n.AST.isUnion(r.type)) {
|
|
20
|
-
const T = r.type.types.filter(
|
|
21
|
-
(s) => s._tag !== "UndefinedKeyword" && s !== n.Null.ast
|
|
22
|
-
).map(N);
|
|
23
|
-
if (T.some(
|
|
24
|
-
(s) => "propertySignatures" in s
|
|
25
|
-
)) {
|
|
26
|
-
if (!a) {
|
|
27
|
-
const s = m({
|
|
28
|
-
parent: l,
|
|
29
|
-
property: r.type,
|
|
30
|
-
meta: { required: u, nullableOrUndefined: a }
|
|
31
|
-
});
|
|
32
|
-
o[l] = s;
|
|
33
|
-
}
|
|
34
|
-
for (const s of T)
|
|
35
|
-
"propertySignatures" in s && Object.assign(
|
|
36
|
-
o,
|
|
37
|
-
m({
|
|
38
|
-
parent: l,
|
|
39
|
-
propertySignatures: s.propertySignatures,
|
|
40
|
-
meta: { required: u, nullableOrUndefined: a }
|
|
41
|
-
})
|
|
42
|
-
);
|
|
43
|
-
} else {
|
|
44
|
-
const s = T.filter(n.AST.isTupleType);
|
|
45
|
-
if (s.length > 0) {
|
|
46
|
-
const f = s[0];
|
|
47
|
-
if (o[l] = {
|
|
48
|
-
type: "multiple",
|
|
49
|
-
members: f.elements,
|
|
50
|
-
rest: f.rest,
|
|
51
|
-
required: u,
|
|
52
|
-
nullableOrUndefined: a
|
|
53
|
-
}, f.rest && f.rest.length > 0) {
|
|
54
|
-
const d = f.rest[0];
|
|
55
|
-
if (d.type._tag === "TypeLiteral" && "propertySignatures" in d.type)
|
|
56
|
-
for (const y of d.type.propertySignatures) {
|
|
57
|
-
const b = `${l}.${y.name.toString()}`, S = m({
|
|
58
|
-
parent: b,
|
|
59
|
-
property: y.type,
|
|
60
|
-
meta: {
|
|
61
|
-
required: !g(y.type),
|
|
62
|
-
nullableOrUndefined: g(y.type)
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
if (S && typeof S == "object" && "type" in S && (o[b] = S, S.type === "multiple" && n.AST.isTupleType(y.type) && y.type.rest && y.type.rest.length > 0)) {
|
|
66
|
-
const O = y.type.rest[0];
|
|
67
|
-
if (O.type._tag === "TypeLiteral" && "propertySignatures" in O.type)
|
|
68
|
-
for (const x of O.type.propertySignatures) {
|
|
69
|
-
const M = `${b}.${x.name.toString()}`, v = m({
|
|
70
|
-
parent: M,
|
|
71
|
-
property: x.type,
|
|
72
|
-
meta: {
|
|
73
|
-
required: !g(x.type),
|
|
74
|
-
nullableOrUndefined: g(x.type)
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
v && typeof v == "object" && "type" in v && (o[M] = v);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
} else {
|
|
83
|
-
const f = m({
|
|
84
|
-
parent: l,
|
|
85
|
-
property: r.type,
|
|
86
|
-
meta: { required: u, nullableOrUndefined: a }
|
|
87
|
-
});
|
|
88
|
-
o[l] = f;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
} else if ("propertySignatures" in A)
|
|
92
|
-
Object.assign(
|
|
93
|
-
o,
|
|
94
|
-
m({
|
|
95
|
-
parent: l,
|
|
96
|
-
propertySignatures: A.propertySignatures,
|
|
97
|
-
meta: { required: u, nullableOrUndefined: a }
|
|
98
|
-
})
|
|
99
|
-
);
|
|
100
|
-
else if (n.AST.isTupleType(r.type))
|
|
101
|
-
if (r.type.rest.length > 0 && r.type.rest[0].type._tag === "TypeLiteral" && "propertySignatures" in r.type.rest[0].type) {
|
|
102
|
-
const h = r.type.rest[0].type;
|
|
103
|
-
if (h._tag === "TypeLiteral" && "propertySignatures" in h)
|
|
104
|
-
for (const s of h.propertySignatures) {
|
|
105
|
-
const f = `${l}.${s.name.toString()}`;
|
|
106
|
-
if (n.AST.isTupleType(s.type) && s.type.rest.length > 0) {
|
|
107
|
-
const d = s.type.rest[0].type;
|
|
108
|
-
if (d._tag === "TypeLiteral" && "propertySignatures" in d)
|
|
109
|
-
for (const y of d.propertySignatures) {
|
|
110
|
-
const b = `${f}.${y.name.toString()}`, S = m({
|
|
111
|
-
parent: b,
|
|
112
|
-
property: y.type,
|
|
113
|
-
meta: {
|
|
114
|
-
required: !g(y.type),
|
|
115
|
-
nullableOrUndefined: g(y.type)
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
o[b] = S;
|
|
119
|
-
}
|
|
120
|
-
else
|
|
121
|
-
o[f] = {
|
|
122
|
-
type: "multiple",
|
|
123
|
-
members: s.type.elements,
|
|
124
|
-
rest: s.type.rest,
|
|
125
|
-
required: !g(s.type),
|
|
126
|
-
nullableOrUndefined: g(s.type)
|
|
127
|
-
};
|
|
128
|
-
} else {
|
|
129
|
-
const d = m({
|
|
130
|
-
parent: f,
|
|
131
|
-
property: s.type,
|
|
132
|
-
meta: {
|
|
133
|
-
required: !g(s.type),
|
|
134
|
-
nullableOrUndefined: g(s.type)
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
o[f] = d;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
} else
|
|
141
|
-
o[l] = {
|
|
142
|
-
type: "multiple",
|
|
143
|
-
members: r.type.elements,
|
|
144
|
-
rest: r.type.rest,
|
|
145
|
-
required: u,
|
|
146
|
-
nullableOrUndefined: a
|
|
147
|
-
};
|
|
148
|
-
else {
|
|
149
|
-
const T = m({
|
|
150
|
-
parent: l,
|
|
151
|
-
property: r.type,
|
|
152
|
-
meta: {
|
|
153
|
-
// an empty string is valid for a S.String field, so we should not mark it as required
|
|
154
|
-
// TODO: handle this better via the createMeta minLength parsing
|
|
155
|
-
required: u && (r.type._tag !== "StringKeyword" || U(r.type).minLength),
|
|
156
|
-
nullableOrUndefined: a
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
o[l] = T;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
return o;
|
|
163
|
-
}
|
|
164
|
-
if (t) {
|
|
165
|
-
const r = E(t);
|
|
166
|
-
if (Object.hasOwnProperty.call(e, "required") || (e.required = !r), n.AST.isUnion(t)) {
|
|
167
|
-
const a = t.types.find(
|
|
168
|
-
(u) => u._tag !== "UndefinedKeyword" && u !== n.Null.ast
|
|
169
|
-
);
|
|
170
|
-
return "propertySignatures" in a ? m({
|
|
171
|
-
propertySignatures: a.propertySignatures,
|
|
172
|
-
parent: i,
|
|
173
|
-
meta: e
|
|
174
|
-
}) : t.types.every(n.AST.isLiteral) ? {
|
|
175
|
-
...e,
|
|
176
|
-
type: "select",
|
|
177
|
-
members: t.types.map((u) => u.literal)
|
|
178
|
-
} : {
|
|
179
|
-
...e,
|
|
180
|
-
...m({
|
|
181
|
-
parent: i,
|
|
182
|
-
meta: e,
|
|
183
|
-
property: a
|
|
184
|
-
})
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
if (n.AST.isTupleType(t))
|
|
188
|
-
return {
|
|
189
|
-
...e,
|
|
190
|
-
type: "multiple",
|
|
191
|
-
members: t.elements,
|
|
192
|
-
rest: t.rest
|
|
193
|
-
};
|
|
194
|
-
const l = n.AST.getAnnotation(
|
|
195
|
-
t,
|
|
196
|
-
n.AST.JSONSchemaAnnotationId
|
|
197
|
-
).pipe(c.getOrElse(() => ({})));
|
|
198
|
-
return e = { ...e, ...l }, "from" in t ? m({
|
|
199
|
-
parent: i,
|
|
200
|
-
meta: e,
|
|
201
|
-
property: t.from
|
|
202
|
-
}) : (e.type = n.AST.getAnnotation(
|
|
203
|
-
t,
|
|
204
|
-
n.AST.TitleAnnotationId
|
|
205
|
-
).pipe(
|
|
206
|
-
c.getOrElse(() => "unknown")
|
|
207
|
-
), e);
|
|
208
|
-
}
|
|
209
|
-
return o;
|
|
210
|
-
}, L = (e) => {
|
|
211
|
-
const i = e.ast, t = {};
|
|
212
|
-
if (i._tag === "Transformation" || i._tag === "Refinement")
|
|
213
|
-
return L(n.make(i.from));
|
|
214
|
-
if ("propertySignatures" in i) {
|
|
215
|
-
const p = m({
|
|
216
|
-
propertySignatures: i.propertySignatures
|
|
217
|
-
});
|
|
218
|
-
if (Object.values(p).every((r) => r && "type" in r))
|
|
219
|
-
return p;
|
|
220
|
-
const o = (r, l = "") => {
|
|
221
|
-
for (const a in r) {
|
|
222
|
-
const u = l ? `${l}.${a}` : a;
|
|
223
|
-
r[a] && typeof r[a] == "object" && "type" in r[a] ? t[u] = r[a] : r[a] && typeof r[a] == "object" && o(r[a], u);
|
|
224
|
-
}
|
|
1
|
+
import r from "./vue-components.es21.js";
|
|
2
|
+
import { inject as c, provide as l } from "vue";
|
|
3
|
+
import { onMountedWithCleanup as u } from "./vue-components.es22.js";
|
|
4
|
+
const f = () => r(), i = Symbol("dialog"), p = () => c(i), g = () => {
|
|
5
|
+
const n = f();
|
|
6
|
+
return l(i, n), n;
|
|
7
|
+
}, d = (n) => {
|
|
8
|
+
const o = p();
|
|
9
|
+
if (!o)
|
|
10
|
+
return;
|
|
11
|
+
const s = n();
|
|
12
|
+
u(() => {
|
|
13
|
+
const e = (t) => {
|
|
14
|
+
s.value && (confirm("Es sind ungespeicherte Änderungen vorhanden. Wirklich schließen?") || (t.prevent = !0));
|
|
225
15
|
};
|
|
226
|
-
o(
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
e
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
n.AST.getMessageAnnotation(e.ast),
|
|
238
|
-
(p, o) => ({
|
|
239
|
-
items: p,
|
|
240
|
-
message: o("")
|
|
241
|
-
})
|
|
242
|
-
),
|
|
243
|
-
c.getOrUndefined
|
|
244
|
-
);
|
|
245
|
-
return { schema: e, meta: i, filterItems: t };
|
|
246
|
-
}, j = (e) => {
|
|
247
|
-
const { trans: i } = _();
|
|
248
|
-
let t;
|
|
249
|
-
switch (e.type) {
|
|
250
|
-
case "string":
|
|
251
|
-
t = n.String.annotations({
|
|
252
|
-
message: () => i("validation.empty")
|
|
253
|
-
}), e.format === "email" && (t = n.compose(
|
|
254
|
-
t,
|
|
255
|
-
n.Email.annotations({
|
|
256
|
-
message: () => i("validation.email.invalid")
|
|
257
|
-
})
|
|
258
|
-
)), e.required && t.annotations({
|
|
259
|
-
message: () => i("validation.empty")
|
|
260
|
-
}), e.maxLength && (t = t.pipe(n.maxLength(e.maxLength)).annotations({
|
|
261
|
-
message: () => i("validation.string.maxLength", {
|
|
262
|
-
maxLength: e.maxLength
|
|
263
|
-
})
|
|
264
|
-
})), e.minLength && (t = t.pipe(n.minLength(e.minLength)).annotations({
|
|
265
|
-
message: () => i("validation.string.minLength", {
|
|
266
|
-
minLength: e.minLength
|
|
267
|
-
})
|
|
268
|
-
}));
|
|
269
|
-
break;
|
|
270
|
-
case "number":
|
|
271
|
-
t = n.Number.annotations({
|
|
272
|
-
message: () => i("validation.empty")
|
|
273
|
-
}), e.required && t.annotations({
|
|
274
|
-
message: () => i("validation.empty")
|
|
275
|
-
}), e.minimum && (t = t.pipe(n.greaterThanOrEqualTo(e.minimum)).annotations({
|
|
276
|
-
message: () => i("validation.number.min", {
|
|
277
|
-
minimum: e.minimum,
|
|
278
|
-
isExclusive: !0
|
|
279
|
-
})
|
|
280
|
-
})), e.maximum && (t = t.pipe(n.lessThanOrEqualTo(e.maximum)).annotations({
|
|
281
|
-
message: () => i("validation.number.max", {
|
|
282
|
-
maximum: e.maximum,
|
|
283
|
-
isExclusive: !0
|
|
284
|
-
})
|
|
285
|
-
})), e.exclusiveMinimum && (t = t.pipe(n.greaterThan(e.exclusiveMinimum)).annotations({
|
|
286
|
-
message: () => i("validation.number.min", {
|
|
287
|
-
minimum: e.exclusiveMinimum,
|
|
288
|
-
isExclusive: !1
|
|
289
|
-
})
|
|
290
|
-
})), e.exclusiveMaximum && (t = t.pipe(n.lessThan(e.exclusiveMaximum)).annotations({
|
|
291
|
-
message: () => i("validation.number.max", {
|
|
292
|
-
maximum: e.exclusiveMaximum,
|
|
293
|
-
isExclusive: !1
|
|
294
|
-
})
|
|
295
|
-
}));
|
|
296
|
-
break;
|
|
297
|
-
case "select":
|
|
298
|
-
t = n.Literal(...e.members).annotations({
|
|
299
|
-
message: () => ({
|
|
300
|
-
message: i("validation.not_a_valid", {
|
|
301
|
-
type: "select",
|
|
302
|
-
message: e.members.join(", ")
|
|
303
|
-
}),
|
|
304
|
-
override: !0
|
|
305
|
-
})
|
|
306
|
-
});
|
|
307
|
-
break;
|
|
308
|
-
case "multiple":
|
|
309
|
-
t = n.Array(n.String).annotations({
|
|
310
|
-
message: () => i("validation.not_a_valid", {
|
|
311
|
-
type: "multiple",
|
|
312
|
-
message: e.members.join(", ")
|
|
313
|
-
})
|
|
314
|
-
});
|
|
315
|
-
break;
|
|
316
|
-
case "boolean":
|
|
317
|
-
t = n.Boolean;
|
|
318
|
-
break;
|
|
319
|
-
// todo: switch must be exhaustive or have default case, otherwise falls through with schema undefined.
|
|
320
|
-
case "unknown":
|
|
321
|
-
t = n.Unknown;
|
|
322
|
-
break;
|
|
323
|
-
}
|
|
324
|
-
return e.required ? t.pipe(
|
|
325
|
-
n.annotations({
|
|
326
|
-
message: () => i("validation.empty")
|
|
327
|
-
})
|
|
328
|
-
) : t = n.NullishOr(t), n.standardSchemaV1(t);
|
|
329
|
-
}, R = (e, i) => n.NullOr(e).pipe(
|
|
330
|
-
n.transform(n.typeSchema(e), {
|
|
331
|
-
decode: (t) => t ?? i(),
|
|
332
|
-
encode: (t) => t
|
|
333
|
-
})
|
|
334
|
-
), k = [
|
|
335
|
-
"button",
|
|
336
|
-
"checkbox",
|
|
337
|
-
"color",
|
|
338
|
-
"date",
|
|
339
|
-
"email",
|
|
340
|
-
"number",
|
|
341
|
-
"password",
|
|
342
|
-
"radio",
|
|
343
|
-
"range",
|
|
344
|
-
"search",
|
|
345
|
-
"submit",
|
|
346
|
-
"tel",
|
|
347
|
-
"text",
|
|
348
|
-
"time",
|
|
349
|
-
"url"
|
|
350
|
-
], J = (e) => k.includes(e) ? e : "text";
|
|
16
|
+
return o.on("dialog-closing", e), () => o.off("dialog-closing", e);
|
|
17
|
+
});
|
|
18
|
+
}, h = (n) => {
|
|
19
|
+
const o = g();
|
|
20
|
+
return () => {
|
|
21
|
+
const e = {};
|
|
22
|
+
o.emit("dialog-closing", e), e.prevent ? typeof e.prevent == "object" && "then" in e.prevent && e.prevent.then((t) => {
|
|
23
|
+
t !== !1 && n();
|
|
24
|
+
}) : n();
|
|
25
|
+
};
|
|
26
|
+
};
|
|
351
27
|
export {
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
J as getInputType,
|
|
357
|
-
R as nullableInput
|
|
28
|
+
p as injectBus,
|
|
29
|
+
g as provideBus,
|
|
30
|
+
h as useOnClose,
|
|
31
|
+
d as usePreventClose
|
|
358
32
|
};
|