@effect-app/vue-components 0.7.7 → 0.8.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/OmegaFormStuff.d.ts +1 -1
- package/dist/vue-components.es24.js +26 -26
- package/dist/vue-components.es27.js +10 -10
- package/package.json +1 -1
- package/src/components/OmegaForm/OmegaFormStuff.ts +1 -0
- package/src/components/OmegaForm/OmegaInputVuetify.vue +3 -2
- package/src/components/OmegaForm/OmegaInternalInput.vue +2 -2
|
@@ -15,7 +15,7 @@ export type OmegaInputProps<From, To> = {
|
|
|
15
15
|
}[];
|
|
16
16
|
type?: TypeOverride;
|
|
17
17
|
};
|
|
18
|
-
export type TypeOverride = "string" | "text" | "number" | "select" | "multiple" | "boolean" | "autocomplete" | "autocompletemultiple" | "switch";
|
|
18
|
+
export type TypeOverride = "string" | "text" | "number" | "select" | "multiple" | "boolean" | "autocomplete" | "autocompletemultiple" | "switch" | "range";
|
|
19
19
|
export interface OmegaError {
|
|
20
20
|
label: string;
|
|
21
21
|
inputId: string;
|
|
@@ -16,41 +16,41 @@ const re = /* @__PURE__ */ q({
|
|
|
16
16
|
validators: {}
|
|
17
17
|
},
|
|
18
18
|
setup(C) {
|
|
19
|
-
const t = C, o = L(), N = o == null ? void 0 : o.appContext.components.VTextField, s = P(), u = t.field, a = J(u.store, (e) => e),
|
|
19
|
+
const t = C, o = L(), N = o == null ? void 0 : o.appContext.components.VTextField, s = P(), u = t.field, a = J(u.store, (e) => e), f = l(() => {
|
|
20
20
|
var e, r;
|
|
21
21
|
return t.type ? t.type : ((e = t.meta) == null ? void 0 : e.type) === "string" ? t.meta.format === "email" ? "email" : "string" : ((r = t.meta) == null ? void 0 : r.type) || "unknown";
|
|
22
|
-
}),
|
|
22
|
+
}), n = l(() => a.value.value), $ = l(
|
|
23
23
|
() => (
|
|
24
24
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
25
25
|
a.value.meta.errors.map((e) => e == null ? void 0 : e.message).filter(Boolean)
|
|
26
26
|
)
|
|
27
27
|
), k = (e) => e == null || e === !1 || e === "" || Number.isNaN(e);
|
|
28
28
|
w(
|
|
29
|
-
() => !!
|
|
30
|
-
(
|
|
31
|
-
var
|
|
32
|
-
k(
|
|
33
|
-
var
|
|
29
|
+
() => !!n.value,
|
|
30
|
+
() => {
|
|
31
|
+
var e;
|
|
32
|
+
k(n.value) && ((e = t.meta) == null ? void 0 : e.type) !== "boolean" && F(() => {
|
|
33
|
+
var r;
|
|
34
34
|
u.setValue(
|
|
35
|
-
((
|
|
35
|
+
((r = t.meta) == null ? void 0 : r.nullableOrUndefined) === "undefined" ? void 0 : null
|
|
36
36
|
);
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
), x(() => {
|
|
40
40
|
var e, r;
|
|
41
|
-
!
|
|
41
|
+
!n.value && !((e = t.meta) != null && e.required) && ((r = t.meta) == null ? void 0 : r.nullableOrUndefined) === "null" && u.setValue(null);
|
|
42
42
|
});
|
|
43
|
-
const { addError: B, removeError: I, showErrors: O, showErrorsOn: _ } = K(),
|
|
43
|
+
const { addError: B, removeError: I, showErrors: O, showErrorsOn: _ } = K(), i = S(!1);
|
|
44
44
|
T(() => {
|
|
45
|
-
(O.value || _ === "onChange") && (
|
|
45
|
+
(O.value || _ === "onChange") && (i.value = !0);
|
|
46
46
|
});
|
|
47
|
-
const
|
|
48
|
-
|
|
47
|
+
const m = () => {
|
|
48
|
+
i.value = !0;
|
|
49
49
|
};
|
|
50
50
|
x(() => {
|
|
51
|
-
|
|
51
|
+
n.value && m();
|
|
52
52
|
});
|
|
53
|
-
const
|
|
53
|
+
const d = l(() => !i.value && f.value !== "select" ? [] : $.value);
|
|
54
54
|
w(
|
|
55
55
|
() => a.value.meta.errors,
|
|
56
56
|
() => {
|
|
@@ -61,36 +61,36 @@ const re = /* @__PURE__ */ q({
|
|
|
61
61
|
}) : I(s);
|
|
62
62
|
}
|
|
63
63
|
);
|
|
64
|
-
const
|
|
65
|
-
var e, r,
|
|
64
|
+
const p = l(() => {
|
|
65
|
+
var e, r, c, v, g, y, h, b, E, V;
|
|
66
66
|
return {
|
|
67
67
|
id: s,
|
|
68
68
|
required: (e = t.meta) == null ? void 0 : e.required,
|
|
69
|
-
minLength: ((r = t.meta) == null ? void 0 : r.type) === "string" && ((
|
|
69
|
+
minLength: ((r = t.meta) == null ? void 0 : r.type) === "string" && ((c = t.meta) == null ? void 0 : c.minLength),
|
|
70
70
|
maxLength: ((v = t.meta) == null ? void 0 : v.type) === "string" && ((g = t.meta) == null ? void 0 : g.maxLength),
|
|
71
71
|
max: ((y = t.meta) == null ? void 0 : y.type) === "number" && ((h = t.meta) == null ? void 0 : h.maximum),
|
|
72
72
|
min: ((b = t.meta) == null ? void 0 : b.type) === "number" && ((E = t.meta) == null ? void 0 : E.minimum),
|
|
73
73
|
name: t.field.name,
|
|
74
74
|
modelValue: t.field.state.value,
|
|
75
|
-
errorMessages:
|
|
76
|
-
error: !!
|
|
75
|
+
errorMessages: d.value,
|
|
76
|
+
error: !!d.value.length,
|
|
77
77
|
field: t.field,
|
|
78
|
-
setRealDirty:
|
|
79
|
-
type:
|
|
78
|
+
setRealDirty: m,
|
|
79
|
+
type: f.value,
|
|
80
80
|
label: `${t.label}${(V = t.meta) != null && V.required ? " *" : ""}`,
|
|
81
81
|
options: t.options
|
|
82
82
|
};
|
|
83
83
|
});
|
|
84
|
-
return (e, r) => z(e.$slots, "default", A(D(
|
|
84
|
+
return (e, r) => z(e.$slots, "default", A(D(p.value)), () => [
|
|
85
85
|
M("div", {
|
|
86
86
|
class: R(e.$attrs.class),
|
|
87
|
-
onFocusout:
|
|
87
|
+
onFocusout: m
|
|
88
88
|
}, [
|
|
89
89
|
j(N) ? (G(), U(Q, H({
|
|
90
90
|
key: 0,
|
|
91
|
-
"input-props":
|
|
91
|
+
"input-props": p.value
|
|
92
92
|
}, e.$attrs, {
|
|
93
|
-
"vuetify-value":
|
|
93
|
+
"vuetify-value": p.value.field.state.value
|
|
94
94
|
}), null, 16, ["input-props", "vuetify-value"])) : Z("", !0)
|
|
95
95
|
], 34)
|
|
96
96
|
]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const b = /* @__PURE__ */
|
|
1
|
+
import { defineComponent as P, resolveComponent as s, createElementBlock as g, openBlock as o, createBlock as n, createCommentVNode as l, resolveDynamicComponent as u, mergeProps as i } from "vue";
|
|
2
|
+
const b = /* @__PURE__ */ P({
|
|
3
3
|
inheritAttrs: !1,
|
|
4
4
|
__name: "OmegaInputVuetify",
|
|
5
5
|
props: {
|
|
@@ -9,13 +9,13 @@ const b = /* @__PURE__ */ d({
|
|
|
9
9
|
emits: ["focus", "blur"],
|
|
10
10
|
setup(y) {
|
|
11
11
|
return (e, r) => {
|
|
12
|
-
const
|
|
13
|
-
return o(),
|
|
12
|
+
const a = s("v-text-field"), t = s("v-textarea"), m = s("v-select"), d = s("v-autocomplete");
|
|
13
|
+
return o(), g("div", {
|
|
14
14
|
class: "omega-input",
|
|
15
15
|
onFocusout: r[4] || (r[4] = (p) => e.$emit("blur", p)),
|
|
16
16
|
onFocusin: r[5] || (r[5] = (p) => e.$emit("focus", p))
|
|
17
17
|
}, [
|
|
18
|
-
e.inputProps.type === "boolean" || e.inputProps.type === "switch" ? (o(), n(
|
|
18
|
+
e.inputProps.type === "boolean" || e.inputProps.type === "switch" ? (o(), n(u(e.inputProps.type === "boolean" ? "v-checkbox" : "v-switch"), i({
|
|
19
19
|
key: 0,
|
|
20
20
|
id: e.inputProps.id,
|
|
21
21
|
name: e.inputProps.name,
|
|
@@ -27,7 +27,7 @@ const b = /* @__PURE__ */ d({
|
|
|
27
27
|
"model-value": e.vuetifyValue,
|
|
28
28
|
onChange: r[0] || (r[0] = (p) => e.inputProps.field.handleChange(p.target.checked))
|
|
29
29
|
}), null, 16, ["id", "name", "label", "error-messages", "error", "model-value"])) : l("", !0),
|
|
30
|
-
e.inputProps.type === "email" || e.inputProps.type === "string" ? (o(), n(
|
|
30
|
+
e.inputProps.type === "email" || e.inputProps.type === "string" ? (o(), n(a, i({
|
|
31
31
|
key: 1,
|
|
32
32
|
id: e.inputProps.id,
|
|
33
33
|
required: e.inputProps.required,
|
|
@@ -42,7 +42,7 @@ const b = /* @__PURE__ */ d({
|
|
|
42
42
|
"model-value": e.vuetifyValue,
|
|
43
43
|
"onUpdate:modelValue": e.inputProps.field.handleChange
|
|
44
44
|
}), null, 16, ["id", "required", "min-length", "max-length", "type", "name", "label", "error-messages", "error", "model-value", "onUpdate:modelValue"])) : l("", !0),
|
|
45
|
-
e.inputProps.type === "text" ? (o(), n(
|
|
45
|
+
e.inputProps.type === "text" ? (o(), n(t, i({
|
|
46
46
|
key: 2,
|
|
47
47
|
id: e.inputProps.id,
|
|
48
48
|
required: e.inputProps.required,
|
|
@@ -57,7 +57,7 @@ const b = /* @__PURE__ */ d({
|
|
|
57
57
|
"model-value": e.vuetifyValue,
|
|
58
58
|
"onUpdate:modelValue": e.inputProps.field.handleChange
|
|
59
59
|
}), null, 16, ["id", "required", "min-length", "max-length", "type", "name", "label", "error-messages", "error", "model-value", "onUpdate:modelValue"])) : l("", !0),
|
|
60
|
-
e.inputProps.type === "number" ? (o(), n(u, i({
|
|
60
|
+
e.inputProps.type === "number" || e.inputProps.type === "range" ? (o(), n(u(e.inputProps.type === "range" ? "v-slider" : "v-text-field"), i({
|
|
61
61
|
key: 3,
|
|
62
62
|
id: e.inputProps.id,
|
|
63
63
|
required: e.inputProps.required,
|
|
@@ -74,7 +74,7 @@ const b = /* @__PURE__ */ d({
|
|
|
74
74
|
e.inputProps.field.handleChange(Number(p));
|
|
75
75
|
})
|
|
76
76
|
}), null, 16, ["id", "required", "min", "max", "type", "name", "label", "error-messages", "error", "model-value"])) : l("", !0),
|
|
77
|
-
e.inputProps.type === "select" || e.inputProps.type === "multiple" ? (o(), n(
|
|
77
|
+
e.inputProps.type === "select" || e.inputProps.type === "multiple" ? (o(), n(m, i({
|
|
78
78
|
key: 4,
|
|
79
79
|
id: e.inputProps.id,
|
|
80
80
|
clearable: e.inputProps.type === "select",
|
|
@@ -91,7 +91,7 @@ const b = /* @__PURE__ */ d({
|
|
|
91
91
|
onClear: r[2] || (r[2] = (p) => e.inputProps.field.handleChange(void 0)),
|
|
92
92
|
"onUpdate:modelValue": e.inputProps.field.handleChange
|
|
93
93
|
}), null, 16, ["id", "clearable", "required", "multiple", "chips", "name", "label", "items", "error-messages", "error", "model-value", "onUpdate:modelValue"])) : l("", !0),
|
|
94
|
-
e.inputProps.type === "autocomplete" || e.inputProps.type === "autocompletemultiple" ? (o(), n(
|
|
94
|
+
e.inputProps.type === "autocomplete" || e.inputProps.type === "autocompletemultiple" ? (o(), n(d, i({
|
|
95
95
|
key: 5,
|
|
96
96
|
id: e.inputProps.id,
|
|
97
97
|
clearable: e.inputProps.type === "autocomplete",
|
package/package.json
CHANGED
|
@@ -47,8 +47,9 @@
|
|
|
47
47
|
:model-value="vuetifyValue"
|
|
48
48
|
@update:model-value="inputProps.field.handleChange"
|
|
49
49
|
/>
|
|
50
|
-
<
|
|
51
|
-
|
|
50
|
+
<component
|
|
51
|
+
:is="inputProps.type === 'range' ? 'v-slider' : 'v-text-field'"
|
|
52
|
+
v-if="inputProps.type === 'number' || inputProps.type === 'range'"
|
|
52
53
|
:id="inputProps.id"
|
|
53
54
|
:required="inputProps.required"
|
|
54
55
|
:min="inputProps.min"
|
|
@@ -79,8 +79,8 @@ const isFalsyButNotZero = (value: unknown): boolean => {
|
|
|
79
79
|
//watchEffect will trigger infinite times with both free fieldValue and errors, so bet to watch a stupid boolean
|
|
80
80
|
watch(
|
|
81
81
|
() => !!fieldValue.value,
|
|
82
|
-
|
|
83
|
-
if (isFalsyButNotZero(value) && props.meta?.type !== "boolean") {
|
|
82
|
+
() => {
|
|
83
|
+
if (isFalsyButNotZero(fieldValue.value) && props.meta?.type !== "boolean") {
|
|
84
84
|
nextTick(() => {
|
|
85
85
|
fieldApi.setValue(
|
|
86
86
|
props.meta?.nullableOrUndefined === "undefined" ? undefined : null,
|