@effect-app/vue-components 0.4.2 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/vue-components.es.js +11 -11
- package/dist/vue-components.es10.js +3 -3
- package/dist/vue-components.es11.js +14 -14
- package/dist/vue-components.es13.js +7 -2
- package/dist/vue-components.es14.js +2 -88
- package/dist/vue-components.es15.js +88 -5
- package/dist/vue-components.es17.js +5 -96
- package/dist/vue-components.es18.js +2 -11
- package/dist/vue-components.es19.js +11 -2
- package/dist/vue-components.es2.js +11 -11
- package/dist/vue-components.es20.js +89 -108
- package/dist/vue-components.es21.js +4 -0
- package/dist/vue-components.es22.js +115 -4
- package/dist/vue-components.es24.js +6 -0
- package/dist/vue-components.es4.js +46 -36
- package/dist/vue-components.es5.js +34 -148
- package/dist/vue-components.es6.js +143 -209
- package/dist/vue-components.es7.js +216 -5
- package/dist/vue-components.es8.js +6 -46
- package/dist/vue-components.es9.js +3 -2
- package/package.json +3 -3
- package/dist/vue-components.es12.js +0 -9
- package/dist/vue-components.es16.js +0 -4
|
@@ -1,218 +1,152 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { useForm as P } from "@tanstack/vue-form";
|
|
2
|
+
import { S as A } from "effect-app";
|
|
3
|
+
import { generateMetaFromSchema as N } from "./vue-components.es7.js";
|
|
4
|
+
import { computed as b, onUnmounted as R, onMounted as p, onBeforeUnmount as q, defineComponent as D, h as J } from "vue";
|
|
5
|
+
import { isObject as K } from "./vue-components.es17.js";
|
|
6
|
+
import M from "./vue-components.es4.js";
|
|
7
|
+
const G = (w, u, i) => {
|
|
8
|
+
if (!w) throw new Error("Schema is required");
|
|
9
|
+
const V = A.standardSchemaV1(w), { filterItems: L, meta: n } = N(w), c = b(() => {
|
|
10
|
+
var l;
|
|
11
|
+
if ((l = i == null ? void 0 : i.persistency) != null && l.id)
|
|
12
|
+
return i.persistency.id;
|
|
13
|
+
const e = window.location.pathname, r = Object.keys(n);
|
|
14
|
+
return `${e}-${r.join("-")}`;
|
|
15
|
+
}), U = () => {
|
|
16
|
+
const e = new URLSearchParams(window.location.search);
|
|
17
|
+
e.delete(c.value);
|
|
18
|
+
const r = new URL(window.location.href);
|
|
19
|
+
r.search = e.toString(), window.history.replaceState({}, "", r.toString());
|
|
20
|
+
};
|
|
21
|
+
function a(e, r) {
|
|
22
|
+
for (const l in r)
|
|
23
|
+
r[l] && K(r[l]) ? (e[l] || (e[l] = {}), a(e[l], r[l])) : e[l] = r[l];
|
|
24
|
+
return e;
|
|
25
|
+
}
|
|
26
|
+
const j = b(() => {
|
|
27
|
+
var l;
|
|
28
|
+
if (u != null && u.defaultValues && !((l = i == null ? void 0 : i.persistency) != null && l.overrideDefaultValues))
|
|
29
|
+
return u == null ? void 0 : u.defaultValues;
|
|
30
|
+
let e;
|
|
31
|
+
const r = i == null ? void 0 : i.persistency;
|
|
32
|
+
if (!(r != null && r.policies) || r.policies.length === 0) return {};
|
|
33
|
+
if (r.policies.includes("querystring"))
|
|
34
|
+
try {
|
|
35
|
+
const t = new URLSearchParams(window.location.search).get(c.value);
|
|
36
|
+
U(), t && (e = JSON.parse(t));
|
|
37
|
+
} catch (s) {
|
|
38
|
+
console.error(s);
|
|
39
|
+
}
|
|
40
|
+
if (
|
|
41
|
+
// query string has higher priority than local/session storage
|
|
42
|
+
!e && (r.policies.includes("local") || r.policies.includes("session"))
|
|
43
|
+
) {
|
|
44
|
+
const s = r.policies.includes("local") ? localStorage : sessionStorage;
|
|
45
|
+
if (s)
|
|
46
|
+
try {
|
|
47
|
+
const t = JSON.parse(
|
|
48
|
+
s.getItem(c.value) || "{}"
|
|
49
|
+
);
|
|
50
|
+
s.removeItem(c.value), e = t;
|
|
51
|
+
} catch (t) {
|
|
52
|
+
console.error(t);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (e ?? (e = {}), (u == null ? void 0 : u.defaultValues) == null)
|
|
56
|
+
return e;
|
|
57
|
+
{
|
|
58
|
+
const s = u == null ? void 0 : u.defaultValues;
|
|
59
|
+
return a(s, e);
|
|
60
|
+
}
|
|
61
|
+
}), d = P({
|
|
62
|
+
...u,
|
|
63
|
+
validators: {
|
|
64
|
+
onSubmit: V,
|
|
65
|
+
...(u == null ? void 0 : u.validators) || {}
|
|
66
|
+
},
|
|
67
|
+
onSubmit: u != null && u.onSubmit ? ({ formApi: e, meta: r, value: l }) => {
|
|
68
|
+
var s;
|
|
69
|
+
return (s = u.onSubmit) == null ? void 0 : s.call(u, {
|
|
70
|
+
formApi: e,
|
|
71
|
+
meta: r,
|
|
72
|
+
value: l
|
|
73
|
+
});
|
|
74
|
+
} : void 0,
|
|
75
|
+
defaultValues: j.value
|
|
76
|
+
}), E = () => {
|
|
77
|
+
Object.keys(n).forEach((e) => {
|
|
78
|
+
d.setFieldValue(e, void 0);
|
|
14
79
|
});
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
80
|
+
}, f = (e) => e.reduce(
|
|
81
|
+
(r, l) => {
|
|
82
|
+
const s = l.split(".");
|
|
83
|
+
return s.reduce((t, o, I) => (I === s.length - 1 ? t[o] = d.getFieldValue(l) : t[o] = t[o] ?? {}, t[o]), r), r;
|
|
84
|
+
},
|
|
85
|
+
{}
|
|
86
|
+
), v = (e) => {
|
|
87
|
+
if (e) {
|
|
88
|
+
if (Array.isArray(e.keys))
|
|
89
|
+
return f(e.keys);
|
|
90
|
+
if (Array.isArray(e.banKeys)) {
|
|
91
|
+
const r = Object.keys(n).filter(
|
|
92
|
+
(l) => {
|
|
93
|
+
var s;
|
|
94
|
+
return (s = e.banKeys) == null ? void 0 : s.includes(l);
|
|
95
|
+
}
|
|
29
96
|
);
|
|
30
|
-
|
|
31
|
-
const g = m({
|
|
32
|
-
parent: u,
|
|
33
|
-
property: s.type,
|
|
34
|
-
meta: { required: o, nullableOrUndefined: r }
|
|
35
|
-
});
|
|
36
|
-
l[u] = g;
|
|
97
|
+
return f(r);
|
|
37
98
|
}
|
|
99
|
+
return d.store.state.values;
|
|
38
100
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
);
|
|
47
|
-
return "propertySignatures" in r ? m({
|
|
48
|
-
propertySignatures: r.propertySignatures,
|
|
49
|
-
parent: t,
|
|
50
|
-
meta: e
|
|
51
|
-
}) : n.types.every(i.AST.isLiteral) ? {
|
|
52
|
-
...e,
|
|
53
|
-
type: "select",
|
|
54
|
-
members: n.types.map((o) => o.literal)
|
|
55
|
-
} : {
|
|
56
|
-
...e,
|
|
57
|
-
...m({
|
|
58
|
-
parent: t,
|
|
59
|
-
meta: e,
|
|
60
|
-
property: r
|
|
61
|
-
})
|
|
62
|
-
};
|
|
101
|
+
}, h = () => {
|
|
102
|
+
const e = i == null ? void 0 : i.persistency;
|
|
103
|
+
if (!(!(e != null && e.policies) || e.policies.length === 0) && (e.policies.includes("local") || e.policies.includes("session"))) {
|
|
104
|
+
const r = e.policies.includes("local") ? localStorage : sessionStorage;
|
|
105
|
+
if (!r) return;
|
|
106
|
+
const l = v(e);
|
|
107
|
+
return r.setItem(c.value, JSON.stringify(l));
|
|
63
108
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
109
|
+
}, S = () => {
|
|
110
|
+
const e = i == null ? void 0 : i.persistency;
|
|
111
|
+
if (!(!(e != null && e.policies) || e.policies.length === 0) && e.policies.includes("querystring")) {
|
|
112
|
+
const r = v(e), l = new URLSearchParams(window.location.search);
|
|
113
|
+
l.set(c.value, JSON.stringify(r));
|
|
114
|
+
const s = new URL(window.location.href);
|
|
115
|
+
s.search = l.toString(), window.history.replaceState({}, "", s.toString());
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
R(h), p(() => {
|
|
119
|
+
window.addEventListener("beforeunload", h), window.addEventListener("blur", S);
|
|
120
|
+
}), q(() => {
|
|
121
|
+
window.removeEventListener("beforeunload", h), window.removeEventListener("blur", S);
|
|
122
|
+
});
|
|
123
|
+
const y = Object.assign(d, {
|
|
124
|
+
meta: n,
|
|
125
|
+
filterItems: L,
|
|
126
|
+
clear: E
|
|
127
|
+
});
|
|
128
|
+
return Object.assign(y, {
|
|
129
|
+
Input: D({
|
|
130
|
+
name: "FormInput",
|
|
131
|
+
inheritAttrs: !0,
|
|
132
|
+
setup(e, { attrs: r, slots: l }) {
|
|
133
|
+
const s = r.name, t = r.label;
|
|
134
|
+
if (!s || !t)
|
|
135
|
+
throw new Error("OmegaForm.Input requires name and label props");
|
|
136
|
+
return () => J(
|
|
137
|
+
M,
|
|
138
|
+
{
|
|
139
|
+
...r,
|
|
140
|
+
name: s,
|
|
141
|
+
label: t,
|
|
142
|
+
form: y
|
|
143
|
+
},
|
|
144
|
+
l
|
|
145
|
+
);
|
|
100
146
|
}
|
|
101
|
-
};
|
|
102
|
-
l(a);
|
|
103
|
-
}
|
|
104
|
-
return n;
|
|
105
|
-
}, b = (e) => i.extend(e, i.Struct({})), A = (e) => {
|
|
106
|
-
const t = c(e), n = p(
|
|
107
|
-
e.ast,
|
|
108
|
-
f.liftPredicate((a) => a._tag === "Refinement" && "filter" in a),
|
|
109
|
-
f.flatMap((a) => i.AST.getJSONSchemaAnnotation(a)),
|
|
110
|
-
f.filter((a) => "items" in a),
|
|
111
|
-
f.filterMap(
|
|
112
|
-
({ items: a }) => i.decodeUnknownOption(y)(a)
|
|
113
|
-
),
|
|
114
|
-
f.zipWith(
|
|
115
|
-
i.AST.getMessageAnnotation(e.ast),
|
|
116
|
-
(a, l) => ({
|
|
117
|
-
items: a,
|
|
118
|
-
message: l("")
|
|
119
|
-
})
|
|
120
|
-
),
|
|
121
|
-
f.getOrUndefined
|
|
122
|
-
);
|
|
123
|
-
return { schema: e, meta: t, filterItems: n };
|
|
124
|
-
}, O = (e) => {
|
|
125
|
-
const { trans: t } = S();
|
|
126
|
-
let n;
|
|
127
|
-
switch (e.type) {
|
|
128
|
-
case "string":
|
|
129
|
-
n = i.String.annotations({
|
|
130
|
-
message: () => t("validation.empty")
|
|
131
|
-
}), e.format === "email" && (n = i.compose(
|
|
132
|
-
n,
|
|
133
|
-
i.Email.annotations({
|
|
134
|
-
message: () => t("validation.email.invalid")
|
|
135
|
-
})
|
|
136
|
-
)), e.required && n.annotations({
|
|
137
|
-
message: () => t("validation.empty")
|
|
138
|
-
}), e.maxLength && (n = n.pipe(i.maxLength(e.maxLength)).annotations({
|
|
139
|
-
message: () => t("validation.string.maxLength", {
|
|
140
|
-
maxLength: e.maxLength
|
|
141
|
-
})
|
|
142
|
-
})), e.minLength && (n = n.pipe(i.minLength(e.minLength)).annotations({
|
|
143
|
-
message: () => t("validation.string.minLength", {
|
|
144
|
-
minLength: e.minLength
|
|
145
|
-
})
|
|
146
|
-
}));
|
|
147
|
-
break;
|
|
148
|
-
case "number":
|
|
149
|
-
n = i.Number.annotations({
|
|
150
|
-
message: () => t("validation.empty")
|
|
151
|
-
}), e.required && n.annotations({
|
|
152
|
-
message: () => t("validation.empty")
|
|
153
|
-
}), e.minimum && (n = n.pipe(i.greaterThanOrEqualTo(e.minimum)).annotations({
|
|
154
|
-
message: () => t("validation.number.min", {
|
|
155
|
-
minimum: e.minimum,
|
|
156
|
-
isExclusive: !0
|
|
157
|
-
})
|
|
158
|
-
})), e.maximum && (n = n.pipe(i.lessThanOrEqualTo(e.maximum)).annotations({
|
|
159
|
-
message: () => t("validation.number.max", {
|
|
160
|
-
maximum: e.maximum,
|
|
161
|
-
isExclusive: !0
|
|
162
|
-
})
|
|
163
|
-
})), e.exclusiveMinimum && (n = n.pipe(i.greaterThan(e.exclusiveMinimum)).annotations({
|
|
164
|
-
message: () => t("validation.number.min", {
|
|
165
|
-
minimum: e.exclusiveMinimum,
|
|
166
|
-
isExclusive: !1
|
|
167
|
-
})
|
|
168
|
-
})), e.exclusiveMaximum && (n = n.pipe(i.lessThan(e.exclusiveMaximum)).annotations({
|
|
169
|
-
message: () => t("validation.number.max", {
|
|
170
|
-
maximum: e.exclusiveMaximum,
|
|
171
|
-
isExclusive: !1
|
|
172
|
-
})
|
|
173
|
-
}));
|
|
174
|
-
break;
|
|
175
|
-
case "select":
|
|
176
|
-
n = i.Literal(...e.members).annotations({
|
|
177
|
-
message: () => ({
|
|
178
|
-
message: t("validation.not_a_valid", {
|
|
179
|
-
type: "select",
|
|
180
|
-
message: e.members.join(", ")
|
|
181
|
-
}),
|
|
182
|
-
override: !0
|
|
183
|
-
})
|
|
184
|
-
});
|
|
185
|
-
break;
|
|
186
|
-
case "multiple":
|
|
187
|
-
n = i.Array(i.String).annotations({
|
|
188
|
-
message: () => t("validation.not_a_valid", {
|
|
189
|
-
type: "multiple",
|
|
190
|
-
message: e.members.join(", ")
|
|
191
|
-
})
|
|
192
|
-
});
|
|
193
|
-
break;
|
|
194
|
-
case "boolean":
|
|
195
|
-
n = i.Boolean;
|
|
196
|
-
break;
|
|
197
|
-
// todo: switch must be exhaustive or have default case, otherwise falls through with schema undefined.
|
|
198
|
-
case "unknown":
|
|
199
|
-
n = i.Unknown;
|
|
200
|
-
break;
|
|
201
|
-
}
|
|
202
|
-
return e.required ? n.pipe(
|
|
203
|
-
i.annotations({
|
|
204
|
-
message: () => t("validation.empty")
|
|
205
147
|
})
|
|
206
|
-
)
|
|
207
|
-
}
|
|
208
|
-
i.transform(i.typeSchema(e), {
|
|
209
|
-
decode: (n) => n ?? t(),
|
|
210
|
-
encode: (n) => n
|
|
211
|
-
})
|
|
212
|
-
);
|
|
148
|
+
});
|
|
149
|
+
};
|
|
213
150
|
export {
|
|
214
|
-
|
|
215
|
-
O as generateInputStandardSchemaFromFieldMeta,
|
|
216
|
-
A as generateMetaFromSchema,
|
|
217
|
-
L as nullableInput
|
|
151
|
+
G as useOmegaForm
|
|
218
152
|
};
|
|
@@ -1,7 +1,218 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { S as i, pipe as p, Option as f } from "effect-app";
|
|
2
|
+
import { useIntl as S } from "./vue-components.es3.js";
|
|
3
|
+
const y = i.NonEmptyArray(i.String), v = (e) => i.AST.isUnion(e) && e.types.find((t) => t._tag === "UndefinedKeyword" || t === i.Null.ast), x = (e) => !e || !i.AST.isUnion(e) ? !1 : e.types.find((t) => t._tag === "UndefinedKeyword") ? "undefined" : e.types.find((t) => t === i.Null.ast) ? "null" : !1, m = ({ meta: e = {}, parent: t = "", property: n, propertySignatures: a }, l = {}) => {
|
|
4
|
+
if (n && n._tag === "Transformation")
|
|
5
|
+
return m({
|
|
6
|
+
parent: t,
|
|
7
|
+
meta: e,
|
|
8
|
+
property: n.from
|
|
9
|
+
});
|
|
10
|
+
if ((n == null ? void 0 : n._tag) === "TypeLiteral" && "propertySignatures" in n)
|
|
11
|
+
return m({
|
|
12
|
+
meta: e,
|
|
13
|
+
propertySignatures: n.propertySignatures
|
|
14
|
+
});
|
|
15
|
+
if (a) {
|
|
16
|
+
for (const s of a) {
|
|
17
|
+
const u = t ? `${t}.${s.name.toString()}` : s.name.toString(), r = x(s.type), o = !r;
|
|
18
|
+
let d = s.type;
|
|
19
|
+
if (i.AST.isUnion(s.type) && (d = s.type.types.find(
|
|
20
|
+
(g) => g._tag !== "UndefinedKeyword" && g !== i.Null.ast
|
|
21
|
+
)), "propertySignatures" in d)
|
|
22
|
+
Object.assign(
|
|
23
|
+
l,
|
|
24
|
+
m({
|
|
25
|
+
parent: u,
|
|
26
|
+
propertySignatures: d.propertySignatures,
|
|
27
|
+
meta: { required: o, nullableOrUndefined: r }
|
|
28
|
+
})
|
|
29
|
+
);
|
|
30
|
+
else {
|
|
31
|
+
const g = m({
|
|
32
|
+
parent: u,
|
|
33
|
+
property: s.type,
|
|
34
|
+
meta: { required: o, nullableOrUndefined: r }
|
|
35
|
+
});
|
|
36
|
+
l[u] = g;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return l;
|
|
40
|
+
}
|
|
41
|
+
if (n) {
|
|
42
|
+
const s = v(n);
|
|
43
|
+
if (Object.hasOwnProperty.call(e, "required") || (e.required = !s), i.AST.isUnion(n)) {
|
|
44
|
+
const r = n.types.find(
|
|
45
|
+
(o) => o._tag !== "UndefinedKeyword" && o !== i.Null.ast
|
|
46
|
+
);
|
|
47
|
+
return "propertySignatures" in r ? m({
|
|
48
|
+
propertySignatures: r.propertySignatures,
|
|
49
|
+
parent: t,
|
|
50
|
+
meta: e
|
|
51
|
+
}) : n.types.every(i.AST.isLiteral) ? {
|
|
52
|
+
...e,
|
|
53
|
+
type: "select",
|
|
54
|
+
members: n.types.map((o) => o.literal)
|
|
55
|
+
} : {
|
|
56
|
+
...e,
|
|
57
|
+
...m({
|
|
58
|
+
parent: t,
|
|
59
|
+
meta: e,
|
|
60
|
+
property: r
|
|
61
|
+
})
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
if (i.AST.isTupleType(n))
|
|
65
|
+
return {
|
|
66
|
+
...e,
|
|
67
|
+
type: "multiple",
|
|
68
|
+
members: n.elements
|
|
69
|
+
};
|
|
70
|
+
const u = i.AST.getAnnotation(
|
|
71
|
+
n,
|
|
72
|
+
i.AST.JSONSchemaAnnotationId
|
|
73
|
+
).pipe(f.getOrElse(() => ({})));
|
|
74
|
+
return e = { ...e, ...u }, "from" in n ? m({
|
|
75
|
+
parent: t,
|
|
76
|
+
meta: e,
|
|
77
|
+
property: n.from
|
|
78
|
+
}) : (e.type = i.AST.getAnnotation(
|
|
79
|
+
n,
|
|
80
|
+
i.AST.TitleAnnotationId
|
|
81
|
+
).pipe(
|
|
82
|
+
f.getOrElse(() => "unknown")
|
|
83
|
+
), e);
|
|
84
|
+
}
|
|
85
|
+
return l;
|
|
86
|
+
}, c = (e) => {
|
|
87
|
+
const t = e.ast, n = {};
|
|
88
|
+
if (t._tag === "Transformation" || t._tag === "Refinement")
|
|
89
|
+
return c(i.make(t.from));
|
|
90
|
+
if ("propertySignatures" in t) {
|
|
91
|
+
const a = m({
|
|
92
|
+
propertySignatures: t.propertySignatures
|
|
93
|
+
});
|
|
94
|
+
if (Object.values(a).every((s) => s && "type" in s))
|
|
95
|
+
return a;
|
|
96
|
+
const l = (s, u = "") => {
|
|
97
|
+
for (const r in s) {
|
|
98
|
+
const o = u ? `${u}.${r}` : r;
|
|
99
|
+
s[r] && typeof s[r] == "object" && "type" in s[r] ? n[o] = s[r] : s[r] && typeof s[r] == "object" && l(s[r], o);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
l(a);
|
|
103
|
+
}
|
|
104
|
+
return n;
|
|
105
|
+
}, b = (e) => i.extend(e, i.Struct({})), A = (e) => {
|
|
106
|
+
const t = c(e), n = p(
|
|
107
|
+
e.ast,
|
|
108
|
+
f.liftPredicate((a) => a._tag === "Refinement" && "filter" in a),
|
|
109
|
+
f.flatMap((a) => i.AST.getJSONSchemaAnnotation(a)),
|
|
110
|
+
f.filter((a) => "items" in a),
|
|
111
|
+
f.filterMap(
|
|
112
|
+
({ items: a }) => i.decodeUnknownOption(y)(a)
|
|
113
|
+
),
|
|
114
|
+
f.zipWith(
|
|
115
|
+
i.AST.getMessageAnnotation(e.ast),
|
|
116
|
+
(a, l) => ({
|
|
117
|
+
items: a,
|
|
118
|
+
message: l("")
|
|
119
|
+
})
|
|
120
|
+
),
|
|
121
|
+
f.getOrUndefined
|
|
122
|
+
);
|
|
123
|
+
return { schema: e, meta: t, filterItems: n };
|
|
124
|
+
}, O = (e) => {
|
|
125
|
+
const { trans: t } = S();
|
|
126
|
+
let n;
|
|
127
|
+
switch (e.type) {
|
|
128
|
+
case "string":
|
|
129
|
+
n = i.String.annotations({
|
|
130
|
+
message: () => t("validation.empty")
|
|
131
|
+
}), e.format === "email" && (n = i.compose(
|
|
132
|
+
n,
|
|
133
|
+
i.Email.annotations({
|
|
134
|
+
message: () => t("validation.email.invalid")
|
|
135
|
+
})
|
|
136
|
+
)), e.required && n.annotations({
|
|
137
|
+
message: () => t("validation.empty")
|
|
138
|
+
}), e.maxLength && (n = n.pipe(i.maxLength(e.maxLength)).annotations({
|
|
139
|
+
message: () => t("validation.string.maxLength", {
|
|
140
|
+
maxLength: e.maxLength
|
|
141
|
+
})
|
|
142
|
+
})), e.minLength && (n = n.pipe(i.minLength(e.minLength)).annotations({
|
|
143
|
+
message: () => t("validation.string.minLength", {
|
|
144
|
+
minLength: e.minLength
|
|
145
|
+
})
|
|
146
|
+
}));
|
|
147
|
+
break;
|
|
148
|
+
case "number":
|
|
149
|
+
n = i.Number.annotations({
|
|
150
|
+
message: () => t("validation.empty")
|
|
151
|
+
}), e.required && n.annotations({
|
|
152
|
+
message: () => t("validation.empty")
|
|
153
|
+
}), e.minimum && (n = n.pipe(i.greaterThanOrEqualTo(e.minimum)).annotations({
|
|
154
|
+
message: () => t("validation.number.min", {
|
|
155
|
+
minimum: e.minimum,
|
|
156
|
+
isExclusive: !0
|
|
157
|
+
})
|
|
158
|
+
})), e.maximum && (n = n.pipe(i.lessThanOrEqualTo(e.maximum)).annotations({
|
|
159
|
+
message: () => t("validation.number.max", {
|
|
160
|
+
maximum: e.maximum,
|
|
161
|
+
isExclusive: !0
|
|
162
|
+
})
|
|
163
|
+
})), e.exclusiveMinimum && (n = n.pipe(i.greaterThan(e.exclusiveMinimum)).annotations({
|
|
164
|
+
message: () => t("validation.number.min", {
|
|
165
|
+
minimum: e.exclusiveMinimum,
|
|
166
|
+
isExclusive: !1
|
|
167
|
+
})
|
|
168
|
+
})), e.exclusiveMaximum && (n = n.pipe(i.lessThan(e.exclusiveMaximum)).annotations({
|
|
169
|
+
message: () => t("validation.number.max", {
|
|
170
|
+
maximum: e.exclusiveMaximum,
|
|
171
|
+
isExclusive: !1
|
|
172
|
+
})
|
|
173
|
+
}));
|
|
174
|
+
break;
|
|
175
|
+
case "select":
|
|
176
|
+
n = i.Literal(...e.members).annotations({
|
|
177
|
+
message: () => ({
|
|
178
|
+
message: t("validation.not_a_valid", {
|
|
179
|
+
type: "select",
|
|
180
|
+
message: e.members.join(", ")
|
|
181
|
+
}),
|
|
182
|
+
override: !0
|
|
183
|
+
})
|
|
184
|
+
});
|
|
185
|
+
break;
|
|
186
|
+
case "multiple":
|
|
187
|
+
n = i.Array(i.String).annotations({
|
|
188
|
+
message: () => t("validation.not_a_valid", {
|
|
189
|
+
type: "multiple",
|
|
190
|
+
message: e.members.join(", ")
|
|
191
|
+
})
|
|
192
|
+
});
|
|
193
|
+
break;
|
|
194
|
+
case "boolean":
|
|
195
|
+
n = i.Boolean;
|
|
196
|
+
break;
|
|
197
|
+
// todo: switch must be exhaustive or have default case, otherwise falls through with schema undefined.
|
|
198
|
+
case "unknown":
|
|
199
|
+
n = i.Unknown;
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
return e.required ? n.pipe(
|
|
203
|
+
i.annotations({
|
|
204
|
+
message: () => t("validation.empty")
|
|
205
|
+
})
|
|
206
|
+
) : n = i.NullishOr(n), i.standardSchemaV1(n);
|
|
207
|
+
}, L = (e, t) => i.NullOr(e).pipe(
|
|
208
|
+
i.transform(i.typeSchema(e), {
|
|
209
|
+
decode: (n) => n ?? t(),
|
|
210
|
+
encode: (n) => n
|
|
211
|
+
})
|
|
212
|
+
);
|
|
5
213
|
export {
|
|
6
|
-
|
|
214
|
+
b as duplicateSchema,
|
|
215
|
+
O as generateInputStandardSchemaFromFieldMeta,
|
|
216
|
+
A as generateMetaFromSchema,
|
|
217
|
+
L as nullableInput
|
|
7
218
|
};
|
|
@@ -1,48 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
__name: "OmegaInput",
|
|
7
|
-
props: {
|
|
8
|
-
form: {},
|
|
9
|
-
name: {},
|
|
10
|
-
validators: {},
|
|
11
|
-
label: {},
|
|
12
|
-
options: {},
|
|
13
|
-
type: {}
|
|
14
|
-
},
|
|
15
|
-
setup(n) {
|
|
16
|
-
const o = n, a = t(() => o.form.meta[o.name]), m = t(() => {
|
|
17
|
-
if (!a.value)
|
|
18
|
-
throw new Error("Meta is undefined");
|
|
19
|
-
return y(a.value);
|
|
20
|
-
});
|
|
21
|
-
return (e, C) => (d(), p(u(e.form.Field), {
|
|
22
|
-
name: e.name,
|
|
23
|
-
validators: {
|
|
24
|
-
onChange: m.value,
|
|
25
|
-
...e.validators
|
|
26
|
-
}
|
|
27
|
-
}, {
|
|
28
|
-
default: r(({ field: l }) => [
|
|
29
|
-
f(b, c({
|
|
30
|
-
field: l,
|
|
31
|
-
label: e.label,
|
|
32
|
-
options: e.options,
|
|
33
|
-
meta: a.value,
|
|
34
|
-
type: e.type
|
|
35
|
-
}, e.$attrs), {
|
|
36
|
-
default: r((s) => [
|
|
37
|
-
v(e.$slots, "default", h(g(s)))
|
|
38
|
-
]),
|
|
39
|
-
_: 2
|
|
40
|
-
}, 1040, ["field", "label", "options", "meta", "type"])
|
|
41
|
-
]),
|
|
42
|
-
_: 3
|
|
43
|
-
}, 8, ["name", "validators"]));
|
|
44
|
-
}
|
|
45
|
-
});
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var n=document.createElement("style");if(n.appendChild(document.createTextNode("fieldset[data-v-6833e150]{display:contents}")),document.head.appendChild(n),window.customElements){const e=window.customElements.define;window.customElements.define=function(i,t){const o=t.prototype.connectedCallback;return t.prototype.connectedCallback=function(){if(o&&o.call(this),this.shadowRoot){const d=document.createElement("style");d.appendChild(document.createTextNode("fieldset[data-v-6833e150]{display:contents}")),this.shadowRoot.appendChild(d)}},e.call(window.customElements,i,t)}}}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
|
+
import o from "./vue-components.es11.js";
|
|
3
|
+
|
|
4
|
+
import m from "./vue-components.es13.js";
|
|
5
|
+
const e = /* @__PURE__ */ m(o, [["__scopeId", "data-v-6833e150"]]);
|
|
46
6
|
export {
|
|
47
|
-
|
|
7
|
+
e as default
|
|
48
8
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");if(t.appendChild(document.createTextNode(".v-enter-from[data-v-502ecb3a],.v-leave-to[data-v-502ecb3a]{max-height:0px;grid-template-rows:0fr;opacity:0}.v-enter-active[data-v-502ecb3a],.v-leave-active[data-v-502ecb3a]{display:grid;transition:all .15s}.v-enter-to[data-v-502ecb3a],.v-leave-from[data-v-502ecb3a]{grid-template-rows:1fr;max-height:50vh;opacity:1}.error-alert[data-v-502ecb3a]{transition-behavior:allow-discrete;display:grid;overflow:hidden;min-height:0}.error-alert>*[data-v-502ecb3a]{min-height:0}.error-list[data-v-502ecb3a]{container-type:inline-size;display:grid;grid-template-columns:auto 1fr auto;gap:.5em;align-items:start}@container (max-width: 28.125rem){.error-list[data-v-502ecb3a]{grid-template-columns:auto 1fr}.error-link[data-v-502ecb3a]{grid-column:1 / -1;justify-self:end}}@container (max-width: 18.75rem){.error-list[data-v-502ecb3a]{grid-template-columns:1fr}.error-message[data-v-502ecb3a]{grid-column:1 / -1}}.error-item[data-v-502ecb3a]{display:contents}a[data-v-502ecb3a]{min-width:min-content}.error-link[data-v-502ecb3a]{align-items:center;color:inherit;display:inline-flex;flex-wrap:wrap;gap:.25em;padding-bottom:1em;text-decoration:none}")),document.head.appendChild(t),window.customElements){const e=window.customElements.define;window.customElements.define=function(n,a){const i=a.prototype.connectedCallback;return a.prototype.connectedCallback=function(){if(i&&i.call(this),this.shadowRoot){const r=document.createElement("style");r.appendChild(document.createTextNode(".v-enter-from[data-v-502ecb3a],.v-leave-to[data-v-502ecb3a]{max-height:0px;grid-template-rows:0fr;opacity:0}.v-enter-active[data-v-502ecb3a],.v-leave-active[data-v-502ecb3a]{display:grid;transition:all .15s}.v-enter-to[data-v-502ecb3a],.v-leave-from[data-v-502ecb3a]{grid-template-rows:1fr;max-height:50vh;opacity:1}.error-alert[data-v-502ecb3a]{transition-behavior:allow-discrete;display:grid;overflow:hidden;min-height:0}.error-alert>*[data-v-502ecb3a]{min-height:0}.error-list[data-v-502ecb3a]{container-type:inline-size;display:grid;grid-template-columns:auto 1fr auto;gap:.5em;align-items:start}@container (max-width: 28.125rem){.error-list[data-v-502ecb3a]{grid-template-columns:auto 1fr}.error-link[data-v-502ecb3a]{grid-column:1 / -1;justify-self:end}}@container (max-width: 18.75rem){.error-list[data-v-502ecb3a]{grid-template-columns:1fr}.error-message[data-v-502ecb3a]{grid-column:1 / -1}}.error-item[data-v-502ecb3a]{display:contents}a[data-v-502ecb3a]{min-width:min-content}.error-link[data-v-502ecb3a]{align-items:center;color:inherit;display:inline-flex;flex-wrap:wrap;gap:.25em;padding-bottom:1em;text-decoration:none}")),this.shadowRoot.appendChild(r)}},e.call(window.customElements,n,a)}}}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
|
-
import o from "./vue-components.
|
|
3
|
-
|
|
2
|
+
import o from "./vue-components.es15.js";
|
|
3
|
+
|
|
4
|
+
import r from "./vue-components.es13.js";
|
|
4
5
|
const e = /* @__PURE__ */ r(o, [["__scopeId", "data-v-502ecb3a"]]);
|
|
5
6
|
export {
|
|
6
7
|
e as default
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effect-app/vue-components",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@mdi/js": "^7.4.47",
|
|
6
6
|
"@tanstack/vue-form": "^1.2.4",
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"highlight.js": "^11.11.1",
|
|
54
54
|
"vue3-highlightjs": "^1.0.5",
|
|
55
|
-
"@effect-app/vue": "2.
|
|
56
|
-
"effect-app": "2.
|
|
55
|
+
"@effect-app/vue": "2.41.0",
|
|
56
|
+
"effect-app": "2.40.0"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"build": "rimraf dist && vue-tsc && vite build",
|