@effect-app/vue-components 0.2.5 → 0.2.7
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/OmegaInputVuetify.vue.d.ts +1 -0
- package/dist/vue-components.es15.js +22 -20
- package/dist/vue-components.es18.js +25 -22
- package/package.json +1 -1
- package/src/components/OmegaForm/OmegaInputVuetify.vue +9 -8
- package/src/components/OmegaForm/OmegaInternalInput.vue +1 -0
|
@@ -5,6 +5,7 @@ declare const _default: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>
|
|
|
5
5
|
readonly onFocus?: ((event: Event) => any) | undefined;
|
|
6
6
|
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onBlur" | "onFocus"> & {
|
|
7
7
|
inputProps: InputProps<T>;
|
|
8
|
+
vuetifyValue: unknown;
|
|
8
9
|
} & Partial<{}>> & import("vue").PublicProps;
|
|
9
10
|
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
10
11
|
attrs: any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
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 C, getCurrentInstance as L, useId as O, computed as
|
|
2
|
+
import { defineComponent as C, getCurrentInstance as L, useId as O, computed as l, watch as q, onMounted as S, ref as A, watchEffect as D, renderSlot as F, mergeProps as E, createBlock as M, createCommentVNode as P, unref as T, openBlock as U } from "vue";
|
|
3
3
|
import { useStore as N } from "@tanstack/vue-form";
|
|
4
4
|
import { useOmegaErrors as R } from "./vue-components.es4.js";
|
|
5
5
|
import j from "./vue-components.es18.js";
|
|
@@ -16,34 +16,34 @@ const Q = /* @__PURE__ */ C({
|
|
|
16
16
|
validators: {}
|
|
17
17
|
},
|
|
18
18
|
setup(I) {
|
|
19
|
-
const e = I,
|
|
19
|
+
const e = I, n = L(), $ = n == null ? void 0 : n.appContext.components.VTextField, o = O(), u = e.field, a = N(u.store, (t) => t), p = l(() => {
|
|
20
20
|
var t, r;
|
|
21
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
|
-
}),
|
|
22
|
+
}), s = l(() => a.value.value), f = l(
|
|
23
23
|
() => (
|
|
24
24
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
25
25
|
a.value.meta.errors.map((t) => t == null ? void 0 : t.message).filter(Boolean)
|
|
26
26
|
)
|
|
27
27
|
);
|
|
28
28
|
q(
|
|
29
|
-
() => [!!
|
|
29
|
+
() => [!!s.value],
|
|
30
30
|
() => {
|
|
31
31
|
var t, r;
|
|
32
|
-
|
|
32
|
+
f.value.length && !s.value && !((t = e.meta) != null && t.required) && u.setValue(
|
|
33
33
|
((r = e.meta) == null ? void 0 : r.nullableOrUndefined) === "undefined" ? void 0 : null
|
|
34
34
|
);
|
|
35
35
|
}
|
|
36
36
|
), S(() => {
|
|
37
37
|
var t, r;
|
|
38
|
-
!
|
|
38
|
+
!s.value && !((t = e.meta) != null && t.required) && ((r = e.meta) == null ? void 0 : r.nullableOrUndefined) === "null" && u.setValue(null);
|
|
39
39
|
});
|
|
40
|
-
const
|
|
41
|
-
|
|
40
|
+
const i = A(!1), d = () => {
|
|
41
|
+
i.value = !0;
|
|
42
42
|
}, { addError: k, formSubmissionAttempts: w, removeError: B } = R();
|
|
43
43
|
D(() => {
|
|
44
|
-
w.value > 0 && (
|
|
44
|
+
w.value > 0 && (i.value = !0);
|
|
45
45
|
});
|
|
46
|
-
const
|
|
46
|
+
const v = l(() => !i.value && p.value !== "select" ? [] : f.value);
|
|
47
47
|
q(
|
|
48
48
|
() => a.value.meta.errors,
|
|
49
49
|
() => {
|
|
@@ -54,31 +54,33 @@ const Q = /* @__PURE__ */ C({
|
|
|
54
54
|
}) : B(o);
|
|
55
55
|
}
|
|
56
56
|
);
|
|
57
|
-
const
|
|
58
|
-
var t, r,
|
|
57
|
+
const m = l(() => {
|
|
58
|
+
var t, r, c, g, y, h, b, x, V, _;
|
|
59
59
|
return {
|
|
60
60
|
id: o,
|
|
61
61
|
required: (t = e.meta) == null ? void 0 : t.required,
|
|
62
|
-
minLength: ((r = e.meta) == null ? void 0 : r.type) === "string" && ((
|
|
62
|
+
minLength: ((r = e.meta) == null ? void 0 : r.type) === "string" && ((c = e.meta) == null ? void 0 : c.minLength),
|
|
63
63
|
maxLength: ((g = e.meta) == null ? void 0 : g.type) === "string" && ((y = e.meta) == null ? void 0 : y.maxLength),
|
|
64
64
|
max: ((h = e.meta) == null ? void 0 : h.type) === "number" && ((b = e.meta) == null ? void 0 : b.maximum),
|
|
65
65
|
min: ((x = e.meta) == null ? void 0 : x.type) === "number" && ((V = e.meta) == null ? void 0 : V.minimum),
|
|
66
66
|
name: e.field.name,
|
|
67
67
|
modelValue: e.field.state.value,
|
|
68
|
-
errorMessages:
|
|
69
|
-
error: !!
|
|
68
|
+
errorMessages: v.value,
|
|
69
|
+
error: !!v.value.length,
|
|
70
70
|
field: e.field,
|
|
71
|
-
setRealDirty:
|
|
72
|
-
type:
|
|
71
|
+
setRealDirty: d,
|
|
72
|
+
type: p.value,
|
|
73
73
|
label: `${e.label}${(_ = e.meta) != null && _.required ? " *" : ""}`,
|
|
74
74
|
options: e.options
|
|
75
75
|
};
|
|
76
76
|
});
|
|
77
|
-
return (t, r) => F(t.$slots, "default", E(
|
|
77
|
+
return (t, r) => F(t.$slots, "default", E(m.value, { onFocusout: d }), () => [
|
|
78
78
|
T($) ? (U(), M(j, E({
|
|
79
79
|
key: 0,
|
|
80
|
-
"input-props":
|
|
81
|
-
}, t.$attrs
|
|
80
|
+
"input-props": m.value
|
|
81
|
+
}, t.$attrs, {
|
|
82
|
+
"vuetify-value": m.value.field.state.value
|
|
83
|
+
}), null, 16, ["input-props", "vuetify-value"])) : P("", !0)
|
|
82
84
|
]);
|
|
83
85
|
}
|
|
84
86
|
});
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { defineComponent as P, resolveComponent as
|
|
1
|
+
import { defineComponent as P, resolveComponent as u, createElementBlock as g, openBlock as o, createBlock as n, createCommentVNode as l, mergeProps as s } from "vue";
|
|
2
2
|
const b = /* @__PURE__ */ P({
|
|
3
3
|
inheritAttrs: !1,
|
|
4
4
|
__name: "OmegaInputVuetify",
|
|
5
5
|
props: {
|
|
6
|
-
inputProps: {}
|
|
6
|
+
inputProps: {},
|
|
7
|
+
vuetifyValue: {}
|
|
7
8
|
},
|
|
8
9
|
emits: ["focus", "blur"],
|
|
9
|
-
setup(
|
|
10
|
+
setup(y) {
|
|
10
11
|
return (e, r) => {
|
|
11
|
-
const a =
|
|
12
|
+
const a = u("v-checkbox"), i = u("v-text-field"), t = u("v-textarea"), m = u("v-select"), d = u("v-autocomplete");
|
|
12
13
|
return o(), g("div", {
|
|
13
14
|
class: "omega-input",
|
|
14
15
|
onFocusout: r[4] || (r[4] = (p) => e.$emit("blur", p)),
|
|
@@ -19,14 +20,14 @@ const b = /* @__PURE__ */ P({
|
|
|
19
20
|
id: e.inputProps.id,
|
|
20
21
|
name: e.inputProps.name,
|
|
21
22
|
label: e.inputProps.label,
|
|
22
|
-
"model-value": e.inputProps.field.state.value,
|
|
23
23
|
"error-messages": e.inputProps.errorMessages,
|
|
24
|
-
error: e.inputProps.error
|
|
24
|
+
error: e.inputProps.error,
|
|
25
|
+
ripple: ""
|
|
25
26
|
}, e.$attrs, {
|
|
26
|
-
|
|
27
|
+
"model-value": e.vuetifyValue,
|
|
27
28
|
onChange: r[0] || (r[0] = (p) => e.inputProps.field.handleChange(p.target.checked))
|
|
28
|
-
}), null, 16, ["id", "name", "label", "
|
|
29
|
-
e.inputProps.type === "email" || e.inputProps.type === "string" ? (o(), n(
|
|
29
|
+
}), null, 16, ["id", "name", "label", "error-messages", "error", "model-value"])) : l("", !0),
|
|
30
|
+
e.inputProps.type === "email" || e.inputProps.type === "string" ? (o(), n(i, s({
|
|
30
31
|
key: 1,
|
|
31
32
|
id: e.inputProps.id,
|
|
32
33
|
required: e.inputProps.required,
|
|
@@ -35,13 +36,14 @@ const b = /* @__PURE__ */ P({
|
|
|
35
36
|
type: e.inputProps.type,
|
|
36
37
|
name: e.inputProps.name,
|
|
37
38
|
label: e.inputProps.label,
|
|
38
|
-
"model-value": e.inputProps.field.state.value,
|
|
39
39
|
"error-messages": e.inputProps.errorMessages,
|
|
40
40
|
error: e.inputProps.error
|
|
41
41
|
}, e.$attrs, {
|
|
42
|
+
"model-value": e.vuetifyValue,
|
|
42
43
|
"onUpdate:modelValue": e.inputProps.field.handleChange
|
|
43
|
-
}), null, 16, ["id", "required", "min-length", "max-length", "type", "name", "label", "
|
|
44
|
-
e.inputProps.type === "text" ? (o(), n(t, s({
|
|
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(t, s({
|
|
46
|
+
key: 2,
|
|
45
47
|
id: e.inputProps.id,
|
|
46
48
|
required: e.inputProps.required,
|
|
47
49
|
"min-length": e.inputProps.minLength,
|
|
@@ -49,12 +51,13 @@ const b = /* @__PURE__ */ P({
|
|
|
49
51
|
type: e.inputProps.type,
|
|
50
52
|
name: e.inputProps.name,
|
|
51
53
|
label: e.inputProps.label,
|
|
52
|
-
"model-value": e.inputProps.field.state.value,
|
|
53
54
|
"error-messages": e.inputProps.errorMessages,
|
|
54
|
-
error: e.inputProps.error
|
|
55
|
+
error: e.inputProps.error
|
|
56
|
+
}, e.$attrs, {
|
|
57
|
+
"model-value": e.vuetifyValue,
|
|
55
58
|
"onUpdate:modelValue": e.inputProps.field.handleChange
|
|
56
|
-
}), null, 16, ["id", "required", "min-length", "max-length", "type", "name", "label", "
|
|
57
|
-
e.inputProps.type === "number" ? (o(), n(
|
|
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(i, s({
|
|
58
61
|
key: 3,
|
|
59
62
|
id: e.inputProps.id,
|
|
60
63
|
required: e.inputProps.required,
|
|
@@ -63,14 +66,14 @@ const b = /* @__PURE__ */ P({
|
|
|
63
66
|
type: e.inputProps.type,
|
|
64
67
|
name: e.inputProps.name,
|
|
65
68
|
label: e.inputProps.label,
|
|
66
|
-
"model-value": e.inputProps.field.state.value,
|
|
67
69
|
"error-messages": e.inputProps.errorMessages,
|
|
68
70
|
error: e.inputProps.error
|
|
69
71
|
}, e.$attrs, {
|
|
72
|
+
"model-value": e.vuetifyValue,
|
|
70
73
|
"onUpdate:modelValue": r[1] || (r[1] = (p) => {
|
|
71
74
|
e.inputProps.field.handleChange(Number(p));
|
|
72
75
|
})
|
|
73
|
-
}), null, 16, ["id", "required", "min", "max", "type", "name", "label", "
|
|
76
|
+
}), null, 16, ["id", "required", "min", "max", "type", "name", "label", "error-messages", "error", "model-value"])) : l("", !0),
|
|
74
77
|
e.inputProps.type === "select" || e.inputProps.type === "multiple" ? (o(), n(m, s({
|
|
75
78
|
key: 4,
|
|
76
79
|
id: e.inputProps.id,
|
|
@@ -79,15 +82,15 @@ const b = /* @__PURE__ */ P({
|
|
|
79
82
|
multiple: e.inputProps.type === "multiple",
|
|
80
83
|
chips: e.inputProps.type === "multiple",
|
|
81
84
|
name: e.inputProps.name,
|
|
82
|
-
"model-value": e.inputProps.field.state.value,
|
|
83
85
|
label: e.inputProps.label,
|
|
84
86
|
items: e.inputProps.options,
|
|
85
87
|
"error-messages": e.inputProps.errorMessages,
|
|
86
88
|
error: e.inputProps.error
|
|
87
89
|
}, e.$attrs, {
|
|
90
|
+
"model-value": e.vuetifyValue,
|
|
88
91
|
onClear: r[2] || (r[2] = (p) => e.inputProps.field.handleChange(void 0)),
|
|
89
92
|
"onUpdate:modelValue": e.inputProps.field.handleChange
|
|
90
|
-
}), null, 16, ["id", "clearable", "required", "multiple", "chips", "name", "
|
|
93
|
+
}), null, 16, ["id", "clearable", "required", "multiple", "chips", "name", "label", "items", "error-messages", "error", "model-value", "onUpdate:modelValue"])) : l("", !0),
|
|
91
94
|
e.inputProps.type === "autocomplete" || e.inputProps.type === "autocompletemultiple" ? (o(), n(d, s({
|
|
92
95
|
key: 5,
|
|
93
96
|
id: e.inputProps.id,
|
|
@@ -95,16 +98,16 @@ const b = /* @__PURE__ */ P({
|
|
|
95
98
|
multiple: e.inputProps.type === "autocompletemultiple",
|
|
96
99
|
required: e.inputProps.required,
|
|
97
100
|
name: e.inputProps.name,
|
|
98
|
-
"model-value": e.inputProps.field.state.value,
|
|
99
101
|
label: e.inputProps.label,
|
|
100
102
|
items: e.inputProps.options,
|
|
101
103
|
"error-messages": e.inputProps.errorMessages,
|
|
102
104
|
error: e.inputProps.error,
|
|
103
105
|
chips: e.inputProps.type === "autocompletemultiple"
|
|
104
106
|
}, e.$attrs, {
|
|
107
|
+
"model-value": e.vuetifyValue,
|
|
105
108
|
onClear: r[3] || (r[3] = (p) => e.inputProps.field.handleChange(void 0)),
|
|
106
109
|
"onUpdate:modelValue": e.inputProps.field.handleChange
|
|
107
|
-
}), null, 16, ["id", "clearable", "multiple", "required", "name", "
|
|
110
|
+
}), null, 16, ["id", "clearable", "multiple", "required", "name", "label", "items", "error-messages", "error", "chips", "model-value", "onUpdate:modelValue"])) : l("", !0)
|
|
108
111
|
], 32);
|
|
109
112
|
};
|
|
110
113
|
}
|
package/package.json
CHANGED
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
:id="inputProps.id"
|
|
10
10
|
:name="inputProps.name"
|
|
11
11
|
:label="inputProps.label"
|
|
12
|
-
:model-value="inputProps.field.state.value"
|
|
13
12
|
:error-messages="inputProps.errorMessages"
|
|
14
13
|
:error="inputProps.error"
|
|
15
|
-
v-bind="$attrs"
|
|
16
14
|
ripple
|
|
15
|
+
v-bind="$attrs"
|
|
16
|
+
:model-value="vuetifyValue"
|
|
17
17
|
@change="(e: any) => inputProps.field.handleChange(e.target.checked)"
|
|
18
18
|
/>
|
|
19
19
|
<v-text-field
|
|
@@ -25,15 +25,14 @@
|
|
|
25
25
|
:type="inputProps.type"
|
|
26
26
|
:name="inputProps.name"
|
|
27
27
|
:label="inputProps.label"
|
|
28
|
-
:model-value="inputProps.field.state.value"
|
|
29
28
|
:error-messages="inputProps.errorMessages"
|
|
30
29
|
:error="inputProps.error"
|
|
31
30
|
v-bind="$attrs"
|
|
31
|
+
:model-value="vuetifyValue"
|
|
32
32
|
@update:model-value="inputProps.field.handleChange"
|
|
33
33
|
/>
|
|
34
34
|
<v-textarea
|
|
35
35
|
v-if="inputProps.type === 'text'"
|
|
36
|
-
v-bind="$attrs"
|
|
37
36
|
:id="inputProps.id"
|
|
38
37
|
:required="inputProps.required"
|
|
39
38
|
:min-length="inputProps.minLength"
|
|
@@ -41,9 +40,10 @@
|
|
|
41
40
|
:type="inputProps.type"
|
|
42
41
|
:name="inputProps.name"
|
|
43
42
|
:label="inputProps.label"
|
|
44
|
-
:model-value="inputProps.field.state.value"
|
|
45
43
|
:error-messages="inputProps.errorMessages"
|
|
46
44
|
:error="inputProps.error"
|
|
45
|
+
v-bind="$attrs"
|
|
46
|
+
:model-value="vuetifyValue"
|
|
47
47
|
@update:model-value="inputProps.field.handleChange"
|
|
48
48
|
/>
|
|
49
49
|
<v-text-field
|
|
@@ -55,10 +55,10 @@
|
|
|
55
55
|
:type="inputProps.type"
|
|
56
56
|
:name="inputProps.name"
|
|
57
57
|
:label="inputProps.label"
|
|
58
|
-
:model-value="inputProps.field.state.value"
|
|
59
58
|
:error-messages="inputProps.errorMessages"
|
|
60
59
|
:error="inputProps.error"
|
|
61
60
|
v-bind="$attrs"
|
|
61
|
+
:model-value="vuetifyValue"
|
|
62
62
|
@update:model-value="
|
|
63
63
|
(e: any) => {
|
|
64
64
|
inputProps.field.handleChange(Number(e))
|
|
@@ -73,12 +73,12 @@
|
|
|
73
73
|
:multiple="inputProps.type === 'multiple'"
|
|
74
74
|
:chips="inputProps.type === 'multiple'"
|
|
75
75
|
:name="inputProps.name"
|
|
76
|
-
:model-value="inputProps.field.state.value"
|
|
77
76
|
:label="inputProps.label"
|
|
78
77
|
:items="inputProps.options"
|
|
79
78
|
:error-messages="inputProps.errorMessages"
|
|
80
79
|
:error="inputProps.error"
|
|
81
80
|
v-bind="$attrs"
|
|
81
|
+
:model-value="vuetifyValue"
|
|
82
82
|
@clear="inputProps.field.handleChange(undefined)"
|
|
83
83
|
@update:model-value="inputProps.field.handleChange"
|
|
84
84
|
/>
|
|
@@ -93,13 +93,13 @@
|
|
|
93
93
|
:multiple="inputProps.type === 'autocompletemultiple'"
|
|
94
94
|
:required="inputProps.required"
|
|
95
95
|
:name="inputProps.name"
|
|
96
|
-
:model-value="inputProps.field.state.value"
|
|
97
96
|
:label="inputProps.label"
|
|
98
97
|
:items="inputProps.options"
|
|
99
98
|
:error-messages="inputProps.errorMessages"
|
|
100
99
|
:error="inputProps.error"
|
|
101
100
|
:chips="inputProps.type === 'autocompletemultiple'"
|
|
102
101
|
v-bind="$attrs"
|
|
102
|
+
:model-value="vuetifyValue"
|
|
103
103
|
@clear="inputProps.field.handleChange(undefined)"
|
|
104
104
|
@update:model-value="inputProps.field.handleChange"
|
|
105
105
|
/>
|
|
@@ -111,6 +111,7 @@ import type { InputProps } from "./InputProps"
|
|
|
111
111
|
|
|
112
112
|
defineProps<{
|
|
113
113
|
inputProps: InputProps<T>
|
|
114
|
+
vuetifyValue: unknown
|
|
114
115
|
}>()
|
|
115
116
|
|
|
116
117
|
defineEmits<{
|