@effect-app/vue-components 0.6.2 → 0.6.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/types/components/OmegaForm/OmegaFormStuff.d.ts +1 -1
- package/dist/vue-components.es11.js +1 -1
- package/dist/vue-components.es22.js +11 -98
- package/dist/vue-components.es23.js +99 -11
- package/dist/vue-components.es24.js +1 -1
- package/dist/vue-components.es25.js +10 -10
- package/dist/vue-components.es4.js +1 -1
- 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 +1 -1
|
@@ -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";
|
|
18
|
+
export type TypeOverride = "string" | "text" | "number" | "select" | "multiple" | "boolean" | "autocomplete" | "autocompletemultiple" | "switch";
|
|
19
19
|
export interface OmegaError {
|
|
20
20
|
label: string;
|
|
21
21
|
inputId: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as w, computed as f, onBeforeMount as E, watch as j, createElementBlock as v, openBlock as b, withModifiers as F, createElementVNode as M, unref as c, renderSlot as p, createCommentVNode as k, Fragment as V } from "vue";
|
|
2
2
|
import { useStore as g } from "@tanstack/vue-form";
|
|
3
|
-
import { getOmegaStore as B } from "./vue-components.
|
|
3
|
+
import { getOmegaStore as B } from "./vue-components.es22.js";
|
|
4
4
|
import { provideOmegaErrors as C } from "./vue-components.es6.js";
|
|
5
5
|
import { useOmegaForm as I } from "./vue-components.es7.js";
|
|
6
6
|
const $ = ["disabled"], N = /* @__PURE__ */ w({
|
|
@@ -1,100 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
field: {},
|
|
12
|
-
meta: {},
|
|
13
|
-
label: {},
|
|
14
|
-
options: {},
|
|
15
|
-
type: {},
|
|
16
|
-
validators: {}
|
|
17
|
-
},
|
|
18
|
-
setup(C) {
|
|
19
|
-
const e = C, n = L(), $ = n == null ? void 0 : n.appContext.components.VTextField, o = P(), s = e.field, a = J(s.store, (t) => t), f = l(() => {
|
|
20
|
-
var t, r;
|
|
21
|
-
return e.type ? e.type : ((t = e.meta) == null ? void 0 : t.type) === "string" ? e.meta.format === "email" ? "email" : "string" : ((r = e.meta) == null ? void 0 : r.type) || "unknown";
|
|
22
|
-
}), u = l(() => a.value.value), k = l(
|
|
23
|
-
() => (
|
|
24
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
25
|
-
a.value.meta.errors.map((t) => t == null ? void 0 : t.message).filter(Boolean)
|
|
26
|
-
)
|
|
27
|
-
);
|
|
28
|
-
w(
|
|
29
|
-
() => !!u.value,
|
|
30
|
-
(t) => {
|
|
31
|
-
t || S(() => {
|
|
32
|
-
var r;
|
|
33
|
-
s.setValue(
|
|
34
|
-
((r = e.meta) == null ? void 0 : r.nullableOrUndefined) === "undefined" ? void 0 : null
|
|
35
|
-
);
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
), x(() => {
|
|
39
|
-
var t, r;
|
|
40
|
-
!u.value && !((t = e.meta) != null && t.required) && ((r = e.meta) == null ? void 0 : r.nullableOrUndefined) === "null" && s.setValue(null);
|
|
41
|
-
});
|
|
42
|
-
const { addError: I, removeError: O, showErrors: _, showErrorsOn: q } = K(), i = T(!1);
|
|
43
|
-
z(() => {
|
|
44
|
-
(_.value || q === "onChange") && (i.value = !0);
|
|
45
|
-
});
|
|
46
|
-
const m = () => {
|
|
47
|
-
i.value = !0;
|
|
48
|
-
};
|
|
49
|
-
x(() => {
|
|
50
|
-
u.value && m();
|
|
51
|
-
});
|
|
52
|
-
const d = l(() => !i.value && f.value !== "select" ? [] : k.value);
|
|
53
|
-
w(
|
|
54
|
-
() => a.value.meta.errors,
|
|
55
|
-
() => {
|
|
56
|
-
a.value.meta.errors.length ? I({
|
|
57
|
-
inputId: o,
|
|
58
|
-
errors: a.value.meta.errors.map((t) => t.message).filter(Boolean),
|
|
59
|
-
label: e.label
|
|
60
|
-
}) : O(o);
|
|
61
|
-
}
|
|
62
|
-
);
|
|
63
|
-
const p = l(() => {
|
|
64
|
-
var t, r, c, v, g, y, h, b, E, V;
|
|
65
|
-
return {
|
|
66
|
-
id: o,
|
|
67
|
-
required: (t = e.meta) == null ? void 0 : t.required,
|
|
68
|
-
minLength: ((r = e.meta) == null ? void 0 : r.type) === "string" && ((c = e.meta) == null ? void 0 : c.minLength),
|
|
69
|
-
maxLength: ((v = e.meta) == null ? void 0 : v.type) === "string" && ((g = e.meta) == null ? void 0 : g.maxLength),
|
|
70
|
-
max: ((y = e.meta) == null ? void 0 : y.type) === "number" && ((h = e.meta) == null ? void 0 : h.maximum),
|
|
71
|
-
min: ((b = e.meta) == null ? void 0 : b.type) === "number" && ((E = e.meta) == null ? void 0 : E.minimum),
|
|
72
|
-
name: e.field.name,
|
|
73
|
-
modelValue: e.field.state.value,
|
|
74
|
-
errorMessages: d.value,
|
|
75
|
-
error: !!d.value.length,
|
|
76
|
-
field: e.field,
|
|
77
|
-
setRealDirty: m,
|
|
78
|
-
type: f.value,
|
|
79
|
-
label: `${e.label}${(V = e.meta) != null && V.required ? " *" : ""}`,
|
|
80
|
-
options: e.options
|
|
81
|
-
};
|
|
82
|
-
});
|
|
83
|
-
return (t, r) => A(t.$slots, "default", D(F(p.value)), () => [
|
|
84
|
-
M("div", {
|
|
85
|
-
class: N(t.$attrs.class),
|
|
86
|
-
onFocusout: m
|
|
87
|
-
}, [
|
|
88
|
-
j($) ? (G(), R(Q, H({
|
|
89
|
-
key: 0,
|
|
90
|
-
"input-props": p.value
|
|
91
|
-
}, t.$attrs, {
|
|
92
|
-
"vuetify-value": p.value.field.state.value
|
|
93
|
-
}), null, 16, ["input-props", "vuetify-value"])) : U("", !0)
|
|
94
|
-
], 34)
|
|
95
|
-
]);
|
|
96
|
-
}
|
|
97
|
-
});
|
|
1
|
+
import { useStore as u } from "@tanstack/vue-form";
|
|
2
|
+
import { computed as f } from "vue";
|
|
3
|
+
function c(o, t) {
|
|
4
|
+
return f(() => t ? u(o.store, (n) => {
|
|
5
|
+
const r = {};
|
|
6
|
+
for (const e of t)
|
|
7
|
+
r[e] = n[e];
|
|
8
|
+
return r;
|
|
9
|
+
}).value : {});
|
|
10
|
+
}
|
|
98
11
|
export {
|
|
99
|
-
|
|
12
|
+
c as getOmegaStore
|
|
100
13
|
};
|
|
@@ -1,13 +1,101 @@
|
|
|
1
|
-
|
|
2
|
-
import { computed as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var n=document.createElement("style");if(n.appendChild(document.createTextNode(".omega-input .v-input__details:has(.v-messages:empty){grid-template-rows:0fr;transition:all .2s}.omega-input .v-messages:empty{min-height:0}.omega-input .v-input__details:has(.v-messages){transition:all .2s;overflow:hidden;min-height:0;display:grid;grid-template-rows:1fr}.omega-input .v-messages{transition:all .2s}.omega-input .v-messages>*{transition-duration:0s!important}.omega-input [role=alert]:has(.v-messages:empty){padding:0}.omega-input .v-btn{cursor:pointer;width:auto;-webkit-appearance:none;-moz-appearance:none;appearance:none;box-shadow:none;display:block;min-width:auto;height:auto;padding:.5em .5em .5em 1em}")),document.head.appendChild(n),window.customElements){const e=window.customElements.define;window.customElements.define=function(o,t){const a=t.prototype.connectedCallback;return t.prototype.connectedCallback=function(){if(a&&a.call(this),this.shadowRoot){const i=document.createElement("style");i.appendChild(document.createTextNode(".omega-input .v-input__details:has(.v-messages:empty){grid-template-rows:0fr;transition:all .2s}.omega-input .v-messages:empty{min-height:0}.omega-input .v-input__details:has(.v-messages){transition:all .2s;overflow:hidden;min-height:0;display:grid;grid-template-rows:1fr}.omega-input .v-messages{transition:all .2s}.omega-input .v-messages>*{transition-duration:0s!important}.omega-input [role=alert]:has(.v-messages:empty){padding:0}.omega-input .v-btn{cursor:pointer;width:auto;-webkit-appearance:none;-moz-appearance:none;appearance:none;box-shadow:none;display:block;min-width:auto;height:auto;padding:.5em .5em .5em 1em}")),this.shadowRoot.appendChild(i)}},e.call(window.customElements,o,t)}}}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
|
+
import { defineComponent as B, getCurrentInstance as L, useId as P, computed as n, watch as w, nextTick as S, onMounted as x, ref as T, watchEffect as z, renderSlot as A, normalizeProps as D, guardReactiveProps as F, createElementVNode as M, normalizeClass as N, createBlock as R, createCommentVNode as U, unref as j, openBlock as G, mergeProps as H } from "vue";
|
|
3
|
+
import { useStore as J } from "@tanstack/vue-form";
|
|
4
|
+
import { useOmegaErrors as K } from "./vue-components.es6.js";
|
|
5
|
+
import Q from "./vue-components.es25.js";
|
|
6
|
+
|
|
7
|
+
const te = /* @__PURE__ */ B({
|
|
8
|
+
inheritAttrs: !1,
|
|
9
|
+
__name: "OmegaInternalInput",
|
|
10
|
+
props: {
|
|
11
|
+
field: {},
|
|
12
|
+
meta: {},
|
|
13
|
+
label: {},
|
|
14
|
+
options: {},
|
|
15
|
+
type: {},
|
|
16
|
+
validators: {}
|
|
17
|
+
},
|
|
18
|
+
setup(C) {
|
|
19
|
+
const e = C, o = L(), $ = o == null ? void 0 : o.appContext.components.VTextField, s = P(), u = e.field, a = J(u.store, (t) => t), d = n(() => {
|
|
20
|
+
var t, r;
|
|
21
|
+
return e.type ? e.type : ((t = e.meta) == null ? void 0 : t.type) === "string" ? e.meta.format === "email" ? "email" : "string" : ((r = e.meta) == null ? void 0 : r.type) || "unknown";
|
|
22
|
+
}), i = n(() => a.value.value), k = n(
|
|
23
|
+
() => (
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
25
|
+
a.value.meta.errors.map((t) => t == null ? void 0 : t.message).filter(Boolean)
|
|
26
|
+
)
|
|
27
|
+
);
|
|
28
|
+
w(
|
|
29
|
+
() => !!i.value,
|
|
30
|
+
(t) => {
|
|
31
|
+
var r;
|
|
32
|
+
!t && ((r = e.meta) == null ? void 0 : r.type) !== "boolean" && S(() => {
|
|
33
|
+
var l;
|
|
34
|
+
u.setValue(
|
|
35
|
+
((l = e.meta) == null ? void 0 : l.nullableOrUndefined) === "undefined" ? void 0 : null
|
|
36
|
+
);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
), x(() => {
|
|
40
|
+
var t, r;
|
|
41
|
+
!i.value && !((t = e.meta) != null && t.required) && ((r = e.meta) == null ? void 0 : r.nullableOrUndefined) === "null" && u.setValue(null);
|
|
42
|
+
});
|
|
43
|
+
const { addError: I, removeError: O, showErrors: _, showErrorsOn: q } = K(), m = T(!1);
|
|
44
|
+
z(() => {
|
|
45
|
+
(_.value || q === "onChange") && (m.value = !0);
|
|
46
|
+
});
|
|
47
|
+
const p = () => {
|
|
48
|
+
m.value = !0;
|
|
49
|
+
};
|
|
50
|
+
x(() => {
|
|
51
|
+
i.value && p();
|
|
52
|
+
});
|
|
53
|
+
const c = n(() => !m.value && d.value !== "select" ? [] : k.value);
|
|
54
|
+
w(
|
|
55
|
+
() => a.value.meta.errors,
|
|
56
|
+
() => {
|
|
57
|
+
a.value.meta.errors.length ? I({
|
|
58
|
+
inputId: s,
|
|
59
|
+
errors: a.value.meta.errors.map((t) => t.message).filter(Boolean),
|
|
60
|
+
label: e.label
|
|
61
|
+
}) : O(s);
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
const f = n(() => {
|
|
65
|
+
var t, r, l, v, g, y, h, b, E, V;
|
|
66
|
+
return {
|
|
67
|
+
id: s,
|
|
68
|
+
required: (t = e.meta) == null ? void 0 : t.required,
|
|
69
|
+
minLength: ((r = e.meta) == null ? void 0 : r.type) === "string" && ((l = e.meta) == null ? void 0 : l.minLength),
|
|
70
|
+
maxLength: ((v = e.meta) == null ? void 0 : v.type) === "string" && ((g = e.meta) == null ? void 0 : g.maxLength),
|
|
71
|
+
max: ((y = e.meta) == null ? void 0 : y.type) === "number" && ((h = e.meta) == null ? void 0 : h.maximum),
|
|
72
|
+
min: ((b = e.meta) == null ? void 0 : b.type) === "number" && ((E = e.meta) == null ? void 0 : E.minimum),
|
|
73
|
+
name: e.field.name,
|
|
74
|
+
modelValue: e.field.state.value,
|
|
75
|
+
errorMessages: c.value,
|
|
76
|
+
error: !!c.value.length,
|
|
77
|
+
field: e.field,
|
|
78
|
+
setRealDirty: p,
|
|
79
|
+
type: d.value,
|
|
80
|
+
label: `${e.label}${(V = e.meta) != null && V.required ? " *" : ""}`,
|
|
81
|
+
options: e.options
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
return (t, r) => A(t.$slots, "default", D(F(f.value)), () => [
|
|
85
|
+
M("div", {
|
|
86
|
+
class: N(t.$attrs.class),
|
|
87
|
+
onFocusout: p
|
|
88
|
+
}, [
|
|
89
|
+
j($) ? (G(), R(Q, H({
|
|
90
|
+
key: 0,
|
|
91
|
+
"input-props": f.value
|
|
92
|
+
}, t.$attrs, {
|
|
93
|
+
"vuetify-value": f.value.field.state.value
|
|
94
|
+
}), null, 16, ["input-props", "vuetify-value"])) : U("", !0)
|
|
95
|
+
], 34)
|
|
96
|
+
]);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
11
99
|
export {
|
|
12
|
-
|
|
100
|
+
te as default
|
|
13
101
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const b = /* @__PURE__ */
|
|
1
|
+
import { defineComponent as d, resolveComponent as s, createElementBlock as P, openBlock as o, createBlock as n, createCommentVNode as l, resolveDynamicComponent as g, mergeProps as i } from "vue";
|
|
2
|
+
const b = /* @__PURE__ */ d({
|
|
3
3
|
inheritAttrs: !1,
|
|
4
4
|
__name: "OmegaInputVuetify",
|
|
5
5
|
props: {
|
|
@@ -9,13 +9,13 @@ const b = /* @__PURE__ */ P({
|
|
|
9
9
|
emits: ["focus", "blur"],
|
|
10
10
|
setup(y) {
|
|
11
11
|
return (e, r) => {
|
|
12
|
-
const
|
|
13
|
-
return o(),
|
|
12
|
+
const u = s("v-text-field"), a = s("v-textarea"), t = s("v-select"), m = s("v-autocomplete");
|
|
13
|
+
return o(), P("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" ? (o(), n(
|
|
18
|
+
e.inputProps.type === "boolean" || e.inputProps.type === "switch" ? (o(), n(g(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__ */ P({
|
|
|
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(u,
|
|
30
|
+
e.inputProps.type === "email" || e.inputProps.type === "string" ? (o(), n(u, i({
|
|
31
31
|
key: 1,
|
|
32
32
|
id: e.inputProps.id,
|
|
33
33
|
required: e.inputProps.required,
|
|
@@ -42,7 +42,7 @@ const b = /* @__PURE__ */ P({
|
|
|
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(a, i({
|
|
46
46
|
key: 2,
|
|
47
47
|
id: e.inputProps.id,
|
|
48
48
|
required: e.inputProps.required,
|
|
@@ -57,7 +57,7 @@ const b = /* @__PURE__ */ P({
|
|
|
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,
|
|
60
|
+
e.inputProps.type === "number" ? (o(), n(u, i({
|
|
61
61
|
key: 3,
|
|
62
62
|
id: e.inputProps.id,
|
|
63
63
|
required: e.inputProps.required,
|
|
@@ -74,7 +74,7 @@ const b = /* @__PURE__ */ P({
|
|
|
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(t, 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__ */ P({
|
|
|
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(m, i({
|
|
95
95
|
key: 5,
|
|
96
96
|
id: e.inputProps.id,
|
|
97
97
|
clearable: e.inputProps.type === "autocomplete",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as i, computed as t, createBlock as p, openBlock as d, resolveDynamicComponent as u, withCtx as r, createVNode as f, mergeProps as c, renderSlot as v, normalizeProps as h, guardReactiveProps as g } from "vue";
|
|
2
2
|
import { generateInputStandardSchemaFromFieldMeta as y } from "./vue-components.es8.js";
|
|
3
|
-
import b from "./vue-components.
|
|
3
|
+
import b from "./vue-components.es23.js";
|
|
4
4
|
const S = /* @__PURE__ */ i({
|
|
5
5
|
inheritAttrs: !1,
|
|
6
6
|
__name: "OmegaInput",
|
package/package.json
CHANGED
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
@focusout="$emit('blur', $event)"
|
|
5
5
|
@focusin="$emit('focus', $event)"
|
|
6
6
|
>
|
|
7
|
-
<
|
|
8
|
-
|
|
7
|
+
<component
|
|
8
|
+
:is="inputProps.type === 'boolean' ? 'v-checkbox' : 'v-switch'"
|
|
9
|
+
v-if="inputProps.type === 'boolean' || inputProps.type === 'switch'"
|
|
9
10
|
:id="inputProps.id"
|
|
10
11
|
:name="inputProps.name"
|
|
11
12
|
:label="inputProps.label"
|
|
@@ -76,7 +76,7 @@ const errors = computed(() =>
|
|
|
76
76
|
watch(
|
|
77
77
|
() => !!fieldValue.value,
|
|
78
78
|
value => {
|
|
79
|
-
if (!value) {
|
|
79
|
+
if (!value && props.meta?.type !== "boolean") {
|
|
80
80
|
nextTick(() => {
|
|
81
81
|
fieldApi.setValue(
|
|
82
82
|
props.meta?.nullableOrUndefined === "undefined" ? undefined : null,
|