@effect-app/vue-components 1.8.26 → 1.9.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/CommandButton.vue.d.ts +38 -0
- package/dist/types/components/OmegaForm/OmegaArray.vue.d.ts +1 -1
- package/dist/types/components/index.d.ts +1 -0
- package/dist/vue-components.es.js +22 -20
- package/dist/vue-components.es10.js +338 -30
- package/dist/vue-components.es11.js +34 -2
- package/dist/vue-components.es12.js +2 -10
- package/dist/vue-components.es13.js +2 -5
- package/dist/vue-components.es14.js +10 -54
- package/dist/vue-components.es15.js +5 -68
- package/dist/vue-components.es16.js +54 -6
- package/dist/vue-components.es17.js +68 -6
- package/dist/vue-components.es18.js +6 -3
- package/dist/vue-components.es19.js +6 -3
- package/dist/vue-components.es2.js +20 -18
- package/dist/vue-components.es20.js +3 -2
- package/dist/vue-components.es21.js +3 -2
- package/dist/vue-components.es22.js +2 -17
- package/dist/vue-components.es23.js +2 -11
- package/dist/vue-components.es24.js +17 -42
- package/dist/vue-components.es25.js +11 -2
- package/dist/vue-components.es26.js +136 -2
- package/dist/vue-components.es28.js +44 -0
- package/dist/vue-components.es29.js +2 -7
- package/dist/vue-components.es30.js +2 -31
- package/dist/vue-components.es33.js +9 -0
- package/dist/vue-components.es34.js +31 -23
- package/dist/vue-components.es36.js +4 -21
- package/dist/vue-components.es37.js +10 -29
- package/dist/vue-components.es38.js +20 -19
- package/dist/vue-components.es39.js +5 -12
- package/dist/vue-components.es4.js +43 -43
- package/dist/vue-components.es40.js +21 -5
- package/dist/vue-components.es41.js +29 -18
- package/dist/vue-components.es42.js +22 -9
- package/dist/vue-components.es43.js +7 -26
- package/dist/vue-components.es44.js +5 -48
- package/dist/vue-components.es45.js +19 -26
- package/dist/vue-components.es46.js +9 -11
- package/dist/vue-components.es47.js +31 -4
- package/dist/vue-components.es48.js +37 -54
- package/dist/vue-components.es49.js +21 -51
- package/dist/vue-components.es5.js +45 -46
- package/dist/vue-components.es50.js +64 -16
- package/dist/vue-components.es51.js +54 -31
- package/dist/vue-components.es52.js +16 -28
- package/dist/vue-components.es53.js +32 -41
- package/dist/vue-components.es54.js +29 -2
- package/dist/vue-components.es55.js +41 -43
- package/dist/vue-components.es56.js +2 -2
- package/dist/vue-components.es57.js +46 -0
- package/dist/vue-components.es58.js +4 -0
- package/dist/vue-components.es6.js +40 -63
- package/dist/vue-components.es7.js +69 -197
- package/dist/vue-components.es8.js +197 -28
- package/dist/vue-components.es9.js +29 -341
- package/package.json +5 -3
- package/src/components/CommandButton.vue +72 -0
- package/src/components/index.ts +1 -0
- package/dist/vue-components.es32.js +0 -138
- package/dist/vue-components.es35.js +0 -7
- /package/dist/{vue-components.es27.js → vue-components.es31.js} +0 -0
|
@@ -1,32 +1,201 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
1
|
+
import { useForm as q } from "@tanstack/vue-form";
|
|
2
|
+
import { Data as K, S as I, Effect as l, Fiber as F, Option as M, Array as P } from "effect-app";
|
|
3
|
+
import { runtimeFiberAsPromise as B } from "./vue-components.es14.js";
|
|
4
|
+
import { isObject as G } from "./vue-components.es15.js";
|
|
5
|
+
import { computed as j, onUnmounted as N, onMounted as T, onBeforeUnmount as W, ref as k, watch as z, h as D } from "vue";
|
|
6
|
+
import { usePreventClose as Q } from "./vue-components.es9.js";
|
|
7
|
+
import X from "./vue-components.es16.js";
|
|
8
|
+
import Y from "./vue-components.es17.js";
|
|
9
|
+
import Z from "./vue-components.es18.js";
|
|
10
|
+
import { generateMetaFromSchema as C } from "./vue-components.es10.js";
|
|
11
|
+
import ee from "./vue-components.es6.js";
|
|
12
|
+
import re from "./vue-components.es19.js";
|
|
13
|
+
import { trace as _ } from "./vue-components.es20.js";
|
|
14
|
+
import { context as V } from "./vue-components.es21.js";
|
|
15
|
+
class te extends K.TaggedError("FormErrors") {
|
|
16
|
+
}
|
|
17
|
+
const w = (c) => function(n) {
|
|
18
|
+
return {
|
|
19
|
+
render() {
|
|
20
|
+
return D(n, {
|
|
21
|
+
form: c,
|
|
22
|
+
...this.$attrs
|
|
23
|
+
}, this.$slots);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}, se = (c) => function(n) {
|
|
27
|
+
return {
|
|
28
|
+
setup() {
|
|
29
|
+
const { fieldMap: f, form: p } = c, h = p.useStore((a) => a.errors), u = p.useStore((a) => a.fieldMeta), b = j(
|
|
30
|
+
() => P.filterMap(
|
|
31
|
+
Object.entries(u.value),
|
|
32
|
+
([a, v]) => (v.errors ?? []).length && f.value.get(a)?.id ? M.some({
|
|
33
|
+
label: f.value.get(a).label,
|
|
34
|
+
inputId: f.value.get(a).id,
|
|
35
|
+
errors: (v.errors ?? []).map((y) => y.message).filter(Boolean)
|
|
36
|
+
}) : M.none()
|
|
37
|
+
)
|
|
38
|
+
);
|
|
39
|
+
return {
|
|
40
|
+
generalErrors: h,
|
|
41
|
+
errors: b
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
render({ errors: f, generalErrors: p }) {
|
|
45
|
+
return D(n, {
|
|
46
|
+
errors: f,
|
|
47
|
+
generalErrors: p,
|
|
48
|
+
...this.$attrs
|
|
49
|
+
}, this.$slots);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}, we = (c, i, n) => {
|
|
53
|
+
if (!c) throw new Error("Schema is required");
|
|
54
|
+
const f = I.standardSchemaV1(c), p = I.decode(c), { meta: h } = C(c), u = j(() => {
|
|
55
|
+
if (n?.persistency?.id)
|
|
56
|
+
return n.persistency.id;
|
|
57
|
+
const e = window.location.pathname, r = Object.keys(h);
|
|
58
|
+
return `${e}-${r.join("-")}`;
|
|
59
|
+
}), b = () => {
|
|
60
|
+
const e = new URLSearchParams(window.location.search);
|
|
61
|
+
e.delete(u.value);
|
|
62
|
+
const r = new URL(window.location.href);
|
|
63
|
+
r.search = e.toString(), window.history.replaceState({}, "", r.toString());
|
|
25
64
|
};
|
|
65
|
+
function a(e, r) {
|
|
66
|
+
for (const t in r)
|
|
67
|
+
r[t] && G(r[t]) ? (e[t] || (e[t] = {}), a(e[t], r[t])) : e[t] = r[t];
|
|
68
|
+
return e;
|
|
69
|
+
}
|
|
70
|
+
const v = j(() => {
|
|
71
|
+
if (i?.defaultValues && !n?.persistency?.overrideDefaultValues)
|
|
72
|
+
return i?.defaultValues;
|
|
73
|
+
let e;
|
|
74
|
+
const r = n?.persistency;
|
|
75
|
+
if (!r?.policies || r.policies.length === 0) return {};
|
|
76
|
+
if (r.policies.includes("querystring"))
|
|
77
|
+
try {
|
|
78
|
+
const s = new URLSearchParams(window.location.search).get(u.value);
|
|
79
|
+
b(), s && (e = JSON.parse(s));
|
|
80
|
+
} catch (t) {
|
|
81
|
+
console.error(t);
|
|
82
|
+
}
|
|
83
|
+
if (
|
|
84
|
+
// query string has higher priority than local/session storage
|
|
85
|
+
!e && (r.policies.includes("local") || r.policies.includes("session"))
|
|
86
|
+
) {
|
|
87
|
+
const t = r.policies.includes("local") ? localStorage : sessionStorage;
|
|
88
|
+
if (t)
|
|
89
|
+
try {
|
|
90
|
+
const s = JSON.parse(
|
|
91
|
+
t.getItem(u.value) || "{}"
|
|
92
|
+
);
|
|
93
|
+
t.removeItem(u.value), e = s;
|
|
94
|
+
} catch (s) {
|
|
95
|
+
console.error(s);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (e ??= {}, i?.defaultValues == null)
|
|
99
|
+
return e;
|
|
100
|
+
{
|
|
101
|
+
const t = i?.defaultValues;
|
|
102
|
+
return a(t, e);
|
|
103
|
+
}
|
|
104
|
+
}), y = (e, r) => e ? V.with(_.setSpan(V.active(), e), r) : r(), d = q({
|
|
105
|
+
...i,
|
|
106
|
+
validators: {
|
|
107
|
+
onSubmit: f,
|
|
108
|
+
...i?.validators || {}
|
|
109
|
+
},
|
|
110
|
+
onSubmit: i?.onSubmit ? ({ formApi: e, meta: r, value: t }) => y(r?.currentSpan, async () => {
|
|
111
|
+
const s = await l.runPromise(p(t)), o = i.onSubmit({
|
|
112
|
+
formApi: e,
|
|
113
|
+
meta: r,
|
|
114
|
+
value: s
|
|
115
|
+
});
|
|
116
|
+
return F.isFiber(o) && F.isRuntimeFiber(o) ? await B(o) : l.isEffect(o) ? await l.runPromise(
|
|
117
|
+
o.pipe(
|
|
118
|
+
// meta?.currentSpan
|
|
119
|
+
// ? Effect.withParentSpan(meta.currentSpan)
|
|
120
|
+
// : (_) => _,
|
|
121
|
+
l.flatMap((S) => F.join(S))
|
|
122
|
+
)
|
|
123
|
+
) : o;
|
|
124
|
+
}) : void 0,
|
|
125
|
+
defaultValues: v.value
|
|
126
|
+
}), R = () => {
|
|
127
|
+
Object.keys(h).forEach((e) => {
|
|
128
|
+
d.setFieldValue(e, void 0);
|
|
129
|
+
});
|
|
130
|
+
}, O = (e) => e.reduce((r, t) => {
|
|
131
|
+
const s = t.split(".");
|
|
132
|
+
return s.reduce((o, S, J) => (J === s.length - 1 ? o[S] = d.getFieldValue(t) : o[S] = o[S] ?? {}, o[S]), r), r;
|
|
133
|
+
}, {}), U = (e) => {
|
|
134
|
+
if (e) {
|
|
135
|
+
if (P.isArray(e.keys))
|
|
136
|
+
return O(e.keys);
|
|
137
|
+
if (P.isArray(e.banKeys)) {
|
|
138
|
+
const r = Object.keys(h).filter((t) => e.banKeys?.includes(t));
|
|
139
|
+
return O(r);
|
|
140
|
+
}
|
|
141
|
+
return d.store.state.values;
|
|
142
|
+
}
|
|
143
|
+
}, g = () => {
|
|
144
|
+
const e = n?.persistency;
|
|
145
|
+
if (!(!e?.policies || e.policies.length === 0) && (e.policies.includes("local") || e.policies.includes("session"))) {
|
|
146
|
+
const r = e.policies.includes("local") ? localStorage : sessionStorage;
|
|
147
|
+
if (!r) return;
|
|
148
|
+
const t = U(e);
|
|
149
|
+
return r.setItem(u.value, JSON.stringify(t));
|
|
150
|
+
}
|
|
151
|
+
}, L = () => {
|
|
152
|
+
const e = n?.persistency;
|
|
153
|
+
if (!(!e?.policies || e.policies.length === 0) && e.policies.includes("querystring")) {
|
|
154
|
+
const r = U(e), t = new URLSearchParams(window.location.search);
|
|
155
|
+
t.set(u.value, JSON.stringify(r));
|
|
156
|
+
const s = new URL(window.location.href);
|
|
157
|
+
s.search = t.toString(), window.history.replaceState({}, "", s.toString());
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
N(g), T(() => {
|
|
161
|
+
window.addEventListener("beforeunload", g), window.addEventListener("blur", L);
|
|
162
|
+
}), W(() => {
|
|
163
|
+
window.removeEventListener("beforeunload", g), window.removeEventListener("blur", L);
|
|
164
|
+
});
|
|
165
|
+
const $ = (e) => l.currentSpan.pipe(
|
|
166
|
+
l.option,
|
|
167
|
+
l.flatMap(
|
|
168
|
+
(r) => l.promise(() => d.handleSubmit(M.isSome(r) ? { currentSpan: r.value, ...e } : e))
|
|
169
|
+
)
|
|
170
|
+
), x = (e) => e?.checkErrors ? $(e?.meta).pipe(l.flatMap(l.fnUntraced(function* () {
|
|
171
|
+
const r = d.getAllErrors();
|
|
172
|
+
if (Object.keys(r.fields).length || r.form.errors.length)
|
|
173
|
+
return yield* new te({ form: r.form, fields: r.fields });
|
|
174
|
+
}))) : $(e?.meta), H = d.handleSubmit, E = k(/* @__PURE__ */ new Map()), m = Object.assign(d, {
|
|
175
|
+
i18nNamespace: n?.i18nNamespace,
|
|
176
|
+
meta: h,
|
|
177
|
+
clear: R,
|
|
178
|
+
handleSubmit: (e) => {
|
|
179
|
+
const r = _.getSpan(V.active());
|
|
180
|
+
return H({ currentSpan: r, ...e });
|
|
181
|
+
},
|
|
182
|
+
// /** @experimental */
|
|
183
|
+
handleSubmitEffect: x,
|
|
184
|
+
registerField: (e) => {
|
|
185
|
+
z(e, (r) => E.value.set(r.name, { label: r.label, id: r.id }), { immediate: !0 }), N(() => E.value.delete(e.value.name));
|
|
186
|
+
}
|
|
187
|
+
}), A = { form: m, fieldMap: E };
|
|
188
|
+
return n?.ignorePreventCloseEvents || Q(() => m.useStore((e) => e.isDirty)), Object.assign(m, {
|
|
189
|
+
errorContext: A,
|
|
190
|
+
Form: w(m)(re),
|
|
191
|
+
Input: w(m)(n?.input ?? ee),
|
|
192
|
+
Field: d.Field,
|
|
193
|
+
Errors: se(A)(Z),
|
|
194
|
+
Array: w(m)(X),
|
|
195
|
+
AutoGen: w(m)(Y)
|
|
196
|
+
});
|
|
26
197
|
};
|
|
27
198
|
export {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
h as useOnClose,
|
|
31
|
-
d as usePreventClose
|
|
199
|
+
te as FormErrors,
|
|
200
|
+
we as useOmegaForm
|
|
32
201
|
};
|
|
@@ -1,344 +1,32 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
});
|
|
16
|
-
if (g) {
|
|
17
|
-
for (const r of g) {
|
|
18
|
-
const p = i ? `${i}.${r.name.toString()}` : r.name.toString(), a = f(r.type), l = !a, O = r.type;
|
|
19
|
-
if (n.AST.isUnion(r.type)) {
|
|
20
|
-
const S = r.type.types.filter(
|
|
21
|
-
(s) => s._tag !== "UndefinedKeyword" && s !== n.Null.ast
|
|
22
|
-
).map(_);
|
|
23
|
-
if (S.some(
|
|
24
|
-
(s) => "propertySignatures" in s
|
|
25
|
-
)) {
|
|
26
|
-
if (!a) {
|
|
27
|
-
const s = u({
|
|
28
|
-
parent: p,
|
|
29
|
-
property: r.type,
|
|
30
|
-
meta: { required: l, nullableOrUndefined: a }
|
|
31
|
-
});
|
|
32
|
-
o[p] = s;
|
|
33
|
-
}
|
|
34
|
-
for (const s of S)
|
|
35
|
-
"propertySignatures" in s && Object.assign(
|
|
36
|
-
o,
|
|
37
|
-
u({
|
|
38
|
-
parent: p,
|
|
39
|
-
propertySignatures: s.propertySignatures,
|
|
40
|
-
meta: { required: l, nullableOrUndefined: a }
|
|
41
|
-
})
|
|
42
|
-
);
|
|
43
|
-
} else {
|
|
44
|
-
const s = S.filter(n.AST.isTupleType);
|
|
45
|
-
if (s.length > 0) {
|
|
46
|
-
const y = s[0];
|
|
47
|
-
if (o[p] = {
|
|
48
|
-
type: "multiple",
|
|
49
|
-
members: y.elements,
|
|
50
|
-
rest: y.rest,
|
|
51
|
-
required: l,
|
|
52
|
-
nullableOrUndefined: a
|
|
53
|
-
}, y.rest && y.rest.length > 0) {
|
|
54
|
-
const d = y.rest[0];
|
|
55
|
-
if (d.type._tag === "TypeLiteral" && "propertySignatures" in d.type)
|
|
56
|
-
for (const m of d.type.propertySignatures) {
|
|
57
|
-
const T = `${p}.${m.name.toString()}`, c = u({
|
|
58
|
-
parent: T,
|
|
59
|
-
property: m.type,
|
|
60
|
-
meta: {
|
|
61
|
-
required: !f(m.type),
|
|
62
|
-
nullableOrUndefined: f(m.type)
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
if (c && typeof c == "object" && "type" in c && (o[T] = c, c.type === "multiple" && n.AST.isTupleType(m.type) && m.type.rest && m.type.rest.length > 0)) {
|
|
66
|
-
const v = m.type.rest[0];
|
|
67
|
-
if (v.type._tag === "TypeLiteral" && "propertySignatures" in v.type)
|
|
68
|
-
for (const h of v.type.propertySignatures) {
|
|
69
|
-
const L = `${T}.${h.name.toString()}`, x = u({
|
|
70
|
-
parent: L,
|
|
71
|
-
property: h.type,
|
|
72
|
-
meta: {
|
|
73
|
-
required: !f(h.type),
|
|
74
|
-
nullableOrUndefined: f(h.type)
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
x && typeof x == "object" && "type" in x && (o[L] = x);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
} else {
|
|
83
|
-
const y = u({
|
|
84
|
-
parent: p,
|
|
85
|
-
property: r.type,
|
|
86
|
-
meta: { required: l, nullableOrUndefined: a }
|
|
87
|
-
});
|
|
88
|
-
o[p] = y;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
} else if ("propertySignatures" in O)
|
|
92
|
-
Object.assign(
|
|
93
|
-
o,
|
|
94
|
-
u({
|
|
95
|
-
parent: p,
|
|
96
|
-
propertySignatures: O.propertySignatures,
|
|
97
|
-
meta: { required: l, 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 b = r.type.rest[0].type;
|
|
103
|
-
if (b._tag === "TypeLiteral" && "propertySignatures" in b)
|
|
104
|
-
for (const s of b.propertySignatures) {
|
|
105
|
-
const y = `${p}.${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 m of d.propertySignatures) {
|
|
110
|
-
const T = `${y}.${m.name.toString()}`, c = u({
|
|
111
|
-
parent: T,
|
|
112
|
-
property: m.type,
|
|
113
|
-
meta: {
|
|
114
|
-
required: !f(m.type),
|
|
115
|
-
nullableOrUndefined: f(m.type)
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
o[T] = c;
|
|
119
|
-
}
|
|
120
|
-
else
|
|
121
|
-
o[y] = {
|
|
122
|
-
type: "multiple",
|
|
123
|
-
members: s.type.elements,
|
|
124
|
-
rest: s.type.rest,
|
|
125
|
-
required: !f(s.type),
|
|
126
|
-
nullableOrUndefined: f(s.type)
|
|
127
|
-
};
|
|
128
|
-
} else {
|
|
129
|
-
const d = u({
|
|
130
|
-
parent: y,
|
|
131
|
-
property: s.type,
|
|
132
|
-
meta: {
|
|
133
|
-
required: !f(s.type),
|
|
134
|
-
nullableOrUndefined: f(s.type)
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
o[y] = d;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
} else
|
|
141
|
-
o[p] = {
|
|
142
|
-
type: "multiple",
|
|
143
|
-
members: r.type.elements,
|
|
144
|
-
rest: r.type.rest,
|
|
145
|
-
required: l,
|
|
146
|
-
nullableOrUndefined: a
|
|
147
|
-
};
|
|
148
|
-
else {
|
|
149
|
-
const S = u({
|
|
150
|
-
parent: p,
|
|
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: l && (r.type._tag !== "StringKeyword" || M(r.type).minLength),
|
|
156
|
-
nullableOrUndefined: a
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
o[p] = S;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
return o;
|
|
163
|
-
}
|
|
164
|
-
if (t) {
|
|
165
|
-
const r = w(t);
|
|
166
|
-
if (Object.hasOwnProperty.call(e, "required") || (e.required = !r), n.AST.isUnion(t)) {
|
|
167
|
-
const a = t.types.find(
|
|
168
|
-
(l) => l._tag !== "UndefinedKeyword" && l !== n.Null.ast
|
|
169
|
-
);
|
|
170
|
-
return "propertySignatures" in a ? u({
|
|
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((l) => l.literal)
|
|
178
|
-
} : {
|
|
179
|
-
...e,
|
|
180
|
-
...u({
|
|
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 p = n.AST.getAnnotation(
|
|
195
|
-
t,
|
|
196
|
-
n.AST.JSONSchemaAnnotationId
|
|
197
|
-
).pipe(q.getOrElse(() => ({})));
|
|
198
|
-
return e = { ...e, ...p }, "from" in t ? u({
|
|
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
|
-
q.getOrElse(() => "unknown")
|
|
207
|
-
), e);
|
|
208
|
-
}
|
|
209
|
-
return o;
|
|
210
|
-
}, A = (e) => {
|
|
211
|
-
const i = e.ast, t = {};
|
|
212
|
-
if (i._tag === "Transformation" || i._tag === "Refinement")
|
|
213
|
-
return A(n.make(i.from));
|
|
214
|
-
if ("propertySignatures" in i) {
|
|
215
|
-
const g = u({
|
|
216
|
-
propertySignatures: i.propertySignatures
|
|
217
|
-
});
|
|
218
|
-
if (Object.values(g).every((r) => r && "type" in r))
|
|
219
|
-
return g;
|
|
220
|
-
const o = (r, p = "") => {
|
|
221
|
-
for (const a in r) {
|
|
222
|
-
const l = p ? `${p}.${a}` : a;
|
|
223
|
-
r[a] && typeof r[a] == "object" && "type" in r[a] ? t[l] = r[a] : r[a] && typeof r[a] == "object" && o(r[a], l);
|
|
224
|
-
}
|
|
1
|
+
import r from "./vue-components.es24.js";
|
|
2
|
+
import { inject as c, provide as l } from "vue";
|
|
3
|
+
import { onMountedWithCleanup as u } from "./vue-components.es25.js";
|
|
4
|
+
const f = () => r(), i = Symbol("DialogBus"), p = () => c(i, null), g = () => {
|
|
5
|
+
const e = f();
|
|
6
|
+
return l(i, e), e;
|
|
7
|
+
}, d = (e) => {
|
|
8
|
+
const o = p();
|
|
9
|
+
if (!o)
|
|
10
|
+
return;
|
|
11
|
+
const s = e();
|
|
12
|
+
u(() => {
|
|
13
|
+
const n = (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
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
t = n.String.annotations({
|
|
238
|
-
message: () => i("validation.empty")
|
|
239
|
-
}), e.format === "email" && (t = n.compose(
|
|
240
|
-
t,
|
|
241
|
-
n.Email.annotations({
|
|
242
|
-
message: () => i("validation.email.invalid")
|
|
243
|
-
})
|
|
244
|
-
)), e.required && t.annotations({
|
|
245
|
-
message: () => i("validation.empty")
|
|
246
|
-
}), e.maxLength && (t = t.pipe(n.maxLength(e.maxLength)).annotations({
|
|
247
|
-
message: () => i("validation.string.maxLength", {
|
|
248
|
-
maxLength: e.maxLength
|
|
249
|
-
})
|
|
250
|
-
})), e.minLength && (t = t.pipe(n.minLength(e.minLength)).annotations({
|
|
251
|
-
message: () => i("validation.string.minLength", {
|
|
252
|
-
minLength: e.minLength
|
|
253
|
-
})
|
|
254
|
-
}));
|
|
255
|
-
break;
|
|
256
|
-
case "number":
|
|
257
|
-
t = n.Number.annotations({
|
|
258
|
-
message: () => i("validation.empty")
|
|
259
|
-
}), e.required && t.annotations({
|
|
260
|
-
message: () => i("validation.empty")
|
|
261
|
-
}), e.minimum && (t = t.pipe(n.greaterThanOrEqualTo(e.minimum)).annotations({
|
|
262
|
-
message: () => i("validation.number.min", {
|
|
263
|
-
minimum: e.minimum,
|
|
264
|
-
isExclusive: !0
|
|
265
|
-
})
|
|
266
|
-
})), e.maximum && (t = t.pipe(n.lessThanOrEqualTo(e.maximum)).annotations({
|
|
267
|
-
message: () => i("validation.number.max", {
|
|
268
|
-
maximum: e.maximum,
|
|
269
|
-
isExclusive: !0
|
|
270
|
-
})
|
|
271
|
-
})), e.exclusiveMinimum && (t = t.pipe(n.greaterThan(e.exclusiveMinimum)).annotations({
|
|
272
|
-
message: () => i("validation.number.min", {
|
|
273
|
-
minimum: e.exclusiveMinimum,
|
|
274
|
-
isExclusive: !1
|
|
275
|
-
})
|
|
276
|
-
})), e.exclusiveMaximum && (t = t.pipe(n.lessThan(e.exclusiveMaximum)).annotations({
|
|
277
|
-
message: () => i("validation.number.max", {
|
|
278
|
-
maximum: e.exclusiveMaximum,
|
|
279
|
-
isExclusive: !1
|
|
280
|
-
})
|
|
281
|
-
}));
|
|
282
|
-
break;
|
|
283
|
-
case "select":
|
|
284
|
-
t = n.Literal(...e.members).annotations({
|
|
285
|
-
message: () => ({
|
|
286
|
-
message: i("validation.not_a_valid", {
|
|
287
|
-
type: "select",
|
|
288
|
-
message: e.members.join(", ")
|
|
289
|
-
}),
|
|
290
|
-
override: !0
|
|
291
|
-
})
|
|
292
|
-
});
|
|
293
|
-
break;
|
|
294
|
-
case "multiple":
|
|
295
|
-
t = n.Array(n.String).annotations({
|
|
296
|
-
message: () => i("validation.not_a_valid", {
|
|
297
|
-
type: "multiple",
|
|
298
|
-
message: e.members.join(", ")
|
|
299
|
-
})
|
|
300
|
-
});
|
|
301
|
-
break;
|
|
302
|
-
case "boolean":
|
|
303
|
-
t = n.Boolean;
|
|
304
|
-
break;
|
|
305
|
-
// todo: switch must be exhaustive or have default case, otherwise falls through with schema undefined.
|
|
306
|
-
case "unknown":
|
|
307
|
-
t = n.Unknown;
|
|
308
|
-
break;
|
|
309
|
-
}
|
|
310
|
-
return e.required ? t.pipe(
|
|
311
|
-
n.annotations({
|
|
312
|
-
message: () => i("validation.empty")
|
|
313
|
-
})
|
|
314
|
-
) : t = n.NullishOr(t), n.standardSchemaV1(t);
|
|
315
|
-
}, F = (e, i) => n.NullOr(e).pipe(
|
|
316
|
-
n.transform(n.typeSchema(e), {
|
|
317
|
-
decode: (t) => t ?? i(),
|
|
318
|
-
encode: (t) => t
|
|
319
|
-
})
|
|
320
|
-
), E = [
|
|
321
|
-
"button",
|
|
322
|
-
"checkbox",
|
|
323
|
-
"color",
|
|
324
|
-
"date",
|
|
325
|
-
"email",
|
|
326
|
-
"number",
|
|
327
|
-
"password",
|
|
328
|
-
"radio",
|
|
329
|
-
"range",
|
|
330
|
-
"search",
|
|
331
|
-
"submit",
|
|
332
|
-
"tel",
|
|
333
|
-
"text",
|
|
334
|
-
"time",
|
|
335
|
-
"url"
|
|
336
|
-
], j = (e) => E.includes(e) ? e : "text";
|
|
16
|
+
return o.on("dialog-closing", n), () => o.off("dialog-closing", n);
|
|
17
|
+
});
|
|
18
|
+
}, h = (e) => {
|
|
19
|
+
const o = g();
|
|
20
|
+
return () => {
|
|
21
|
+
const n = {};
|
|
22
|
+
o.emit("dialog-closing", n), n.prevent ? typeof n.prevent == "object" && "then" in n.prevent && n.prevent.then((t) => {
|
|
23
|
+
t !== !1 && e();
|
|
24
|
+
}) : e();
|
|
25
|
+
};
|
|
26
|
+
};
|
|
337
27
|
export {
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
j as getInputType,
|
|
343
|
-
F as nullableInput
|
|
28
|
+
p as injectBus,
|
|
29
|
+
g as provideBus,
|
|
30
|
+
h as useOnClose,
|
|
31
|
+
d as usePreventClose
|
|
344
32
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effect-app/vue-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@mdi/js": "^7.4.47",
|
|
6
6
|
"effect": "^3.18.0",
|
|
@@ -30,7 +30,9 @@
|
|
|
30
30
|
"vitepress": "^1.6.4",
|
|
31
31
|
"vitest": "^3.2.4",
|
|
32
32
|
"vue-router": "^4.5.1",
|
|
33
|
+
"vue-toastification": "^2.0.0-rc.5",
|
|
33
34
|
"vue-tsc": "^3.1.0",
|
|
35
|
+
"vuetify": "^3.10.3",
|
|
34
36
|
"@effect-app/eslint-shared-config": "0.3.4"
|
|
35
37
|
},
|
|
36
38
|
"files": [
|
|
@@ -51,8 +53,8 @@
|
|
|
51
53
|
"highlight.js": "^11.11.1",
|
|
52
54
|
"mitt": "^3.0.1",
|
|
53
55
|
"vue3-highlightjs": "^1.0.5",
|
|
54
|
-
"effect-app": "
|
|
55
|
-
"
|
|
56
|
+
"@effect-app/vue": "2.89.0",
|
|
57
|
+
"effect-app": "3.11.0"
|
|
56
58
|
},
|
|
57
59
|
"scripts": {
|
|
58
60
|
"build": "pnpm build:run",
|