@effect-app/vue-components 0.1.1 → 0.1.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.
|
@@ -1,10 +1,11 @@
|
|
|
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
|
|
3
|
-
import { useStore as
|
|
4
|
-
import { useOmegaErrors as
|
|
5
|
-
import
|
|
2
|
+
import { defineComponent as A, getCurrentInstance as B, useId as C, computed as n, watch as _, onMounted as L, ref as O, watchEffect as P, useAttrs as S, renderSlot as D, normalizeProps as M, guardReactiveProps as R, createBlock as T, createCommentVNode as U, unref as z, openBlock as F, mergeProps as N } from "vue";
|
|
3
|
+
import { useStore as j } from "@tanstack/vue-form";
|
|
4
|
+
import { useOmegaErrors as G } from "./vue-components.es4.js";
|
|
5
|
+
import H from "./vue-components.es18.js";
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const Y = /* @__PURE__ */ A({
|
|
8
|
+
inheritAttrs: !1,
|
|
8
9
|
__name: "OmegaInternalInput",
|
|
9
10
|
props: {
|
|
10
11
|
field: {},
|
|
@@ -15,46 +16,46 @@ const X = /* @__PURE__ */ C({
|
|
|
15
16
|
validators: {}
|
|
16
17
|
},
|
|
17
18
|
setup(q) {
|
|
18
|
-
const e = q, l =
|
|
19
|
+
const e = q, l = B(), E = l == null ? void 0 : l.appContext.components.VTextField, o = C(), u = e.field, a = j(u.store, (t) => t), i = n(() => {
|
|
19
20
|
var t, r;
|
|
20
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";
|
|
21
|
-
}),
|
|
22
|
+
}), s = n(() => a.value.value), p = n(
|
|
22
23
|
() => (
|
|
23
24
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
24
25
|
a.value.meta.errors.map((t) => t == null ? void 0 : t.message).filter(Boolean)
|
|
25
26
|
)
|
|
26
27
|
);
|
|
27
|
-
|
|
28
|
-
() => [!!
|
|
28
|
+
_(
|
|
29
|
+
() => [!!s.value],
|
|
29
30
|
() => {
|
|
30
31
|
var t, r;
|
|
31
|
-
p.value.length && !
|
|
32
|
+
p.value.length && !s.value && !((t = e.meta) != null && t.required) && u.setValue(
|
|
32
33
|
((r = e.meta) == null ? void 0 : r.nullableOrUndefined) === "undefined" ? void 0 : null
|
|
33
34
|
);
|
|
34
35
|
}
|
|
35
|
-
),
|
|
36
|
+
), L(() => {
|
|
36
37
|
var t, r;
|
|
37
|
-
!
|
|
38
|
+
!s.value && !((t = e.meta) != null && t.required) && ((r = e.meta) == null ? void 0 : r.nullableOrUndefined) === "null" && u.setValue(null);
|
|
38
39
|
});
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
}, { addError:
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
const m = O(!1), I = () => {
|
|
41
|
+
m.value = !0;
|
|
42
|
+
}, { addError: $, formSubmissionAttempts: k, removeError: w } = G();
|
|
43
|
+
P(() => {
|
|
44
|
+
k.value > 0 && (m.value = !0);
|
|
44
45
|
});
|
|
45
|
-
const
|
|
46
|
-
|
|
46
|
+
const f = n(() => !m.value && i.value !== "select" ? [] : p.value);
|
|
47
|
+
_(
|
|
47
48
|
() => a.value.meta.errors,
|
|
48
49
|
() => {
|
|
49
|
-
a.value.meta.errors.length ?
|
|
50
|
+
a.value.meta.errors.length ? $({
|
|
50
51
|
inputId: o,
|
|
51
52
|
errors: a.value.meta.errors.map((t) => t.message).filter(Boolean),
|
|
52
53
|
label: e.label
|
|
53
|
-
}) :
|
|
54
|
+
}) : w(o);
|
|
54
55
|
}
|
|
55
|
-
),
|
|
56
|
-
const
|
|
57
|
-
var t, r, c, v, g, y, h, b, x,
|
|
56
|
+
), S();
|
|
57
|
+
const d = n(() => {
|
|
58
|
+
var t, r, c, v, g, y, h, b, x, V;
|
|
58
59
|
return {
|
|
59
60
|
id: o,
|
|
60
61
|
required: (t = e.meta) == null ? void 0 : t.required,
|
|
@@ -64,23 +65,23 @@ const X = /* @__PURE__ */ C({
|
|
|
64
65
|
min: ((b = e.meta) == null ? void 0 : b.type) === "number" && ((x = e.meta) == null ? void 0 : x.minimum),
|
|
65
66
|
name: e.field.name,
|
|
66
67
|
modelValue: e.field.state.value,
|
|
67
|
-
errorMessages:
|
|
68
|
-
error: !!
|
|
68
|
+
errorMessages: f.value,
|
|
69
|
+
error: !!f.value.length,
|
|
69
70
|
field: e.field,
|
|
70
71
|
setRealDirty: I,
|
|
71
72
|
type: i.value,
|
|
72
|
-
label: `${e.label}${(
|
|
73
|
+
label: `${e.label}${(V = e.meta) != null && V.required ? " *" : ""}`,
|
|
73
74
|
options: e.options
|
|
74
75
|
};
|
|
75
76
|
});
|
|
76
|
-
return (t, r) => D(t.$slots, "default", M(R(
|
|
77
|
-
z(E) ? (F(), T(
|
|
77
|
+
return (t, r) => D(t.$slots, "default", M(R(d.value)), () => [
|
|
78
|
+
z(E) ? (F(), T(H, N({
|
|
78
79
|
key: 0,
|
|
79
|
-
"input-props":
|
|
80
|
-
}, null,
|
|
80
|
+
"input-props": d.value
|
|
81
|
+
}, t.$attrs), null, 16, ["input-props"])) : U("", !0)
|
|
81
82
|
]);
|
|
82
83
|
}
|
|
83
84
|
});
|
|
84
85
|
export {
|
|
85
|
-
|
|
86
|
+
Y as default
|
|
86
87
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effect-app/vue-components",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@mdi/js": "^7.4.47",
|
|
6
6
|
"@tanstack/vue-form": "^1.2.4",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"./dist/vue-components.css": "./dist/vue-components.css"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@effect-app/vue": "2.39.
|
|
47
|
-
"effect-app": "2.38.
|
|
46
|
+
"@effect-app/vue": "2.39.9",
|
|
47
|
+
"effect-app": "2.38.5"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "rimraf dist && vue-tsc && vite build",
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<slot v-bind="inputProps">
|
|
3
|
-
<OmegaInputVuetify
|
|
3
|
+
<OmegaInputVuetify
|
|
4
|
+
v-if="vuetified"
|
|
5
|
+
:input-props="inputProps"
|
|
6
|
+
v-bind="$attrs"
|
|
7
|
+
/>
|
|
4
8
|
</slot>
|
|
5
9
|
</template>
|
|
6
10
|
|
|
@@ -27,6 +31,10 @@ import { useOmegaErrors } from "./OmegaErrorsContext"
|
|
|
27
31
|
import type { OmegaFieldInternalApi, InputProps } from "./InputProps"
|
|
28
32
|
import OmegaInputVuetify from "./OmegaInputVuetify.vue"
|
|
29
33
|
|
|
34
|
+
defineOptions({
|
|
35
|
+
inheritAttrs: false,
|
|
36
|
+
})
|
|
37
|
+
|
|
30
38
|
const props = defineProps<{
|
|
31
39
|
field: OmegaFieldInternalApi<To>
|
|
32
40
|
meta: MetaRecord<To>[NestedKeyOf<To>]
|