@effect-app/vue-components 0.4.2 → 0.4.4
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/OmegaFormInput.vue.d.ts +26 -0
- package/dist/types/components/OmegaForm/useOmegaForm.d.ts +6 -4
- 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 +32 -11
- package/dist/vue-components.es19.js +2 -2
- package/dist/vue-components.es2.js +11 -11
- package/dist/vue-components.es20.js +2 -115
- package/dist/vue-components.es21.js +98 -0
- package/dist/vue-components.es22.js +11 -4
- package/dist/vue-components.es23.js +4 -0
- package/dist/vue-components.es24.js +117 -0
- package/dist/vue-components.es26.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 +128 -211
- 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/src/components/OmegaForm/OmegaFormInput.vue +45 -0
- package/src/components/OmegaForm/useOmegaForm.ts +12 -35
- package/src/stories/OmegaForm/form.Input.vue +14 -2
- package/dist/vue-components.es12.js +0 -9
- package/dist/vue-components.es16.js +0 -4
|
@@ -1,117 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
const b = /* @__PURE__ */ P({
|
|
3
|
-
inheritAttrs: !1,
|
|
4
|
-
__name: "OmegaInputVuetify",
|
|
5
|
-
props: {
|
|
6
|
-
inputProps: {},
|
|
7
|
-
vuetifyValue: {}
|
|
8
|
-
},
|
|
9
|
-
emits: ["focus", "blur"],
|
|
10
|
-
setup(y) {
|
|
11
|
-
return (e, r) => {
|
|
12
|
-
const a = u("v-checkbox"), i = u("v-text-field"), t = u("v-textarea"), m = u("v-select"), d = u("v-autocomplete");
|
|
13
|
-
return o(), g("div", {
|
|
14
|
-
class: "omega-input",
|
|
15
|
-
onFocusout: r[4] || (r[4] = (p) => e.$emit("blur", p)),
|
|
16
|
-
onFocusin: r[5] || (r[5] = (p) => e.$emit("focus", p))
|
|
17
|
-
}, [
|
|
18
|
-
e.inputProps.type === "boolean" ? (o(), n(a, s({
|
|
19
|
-
key: 0,
|
|
20
|
-
id: e.inputProps.id,
|
|
21
|
-
name: e.inputProps.name,
|
|
22
|
-
label: e.inputProps.label,
|
|
23
|
-
"error-messages": e.inputProps.errorMessages,
|
|
24
|
-
error: e.inputProps.error,
|
|
25
|
-
ripple: ""
|
|
26
|
-
}, e.$attrs, {
|
|
27
|
-
"model-value": e.vuetifyValue,
|
|
28
|
-
onChange: r[0] || (r[0] = (p) => e.inputProps.field.handleChange(p.target.checked))
|
|
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({
|
|
31
|
-
key: 1,
|
|
32
|
-
id: e.inputProps.id,
|
|
33
|
-
required: e.inputProps.required,
|
|
34
|
-
"min-length": e.inputProps.minLength,
|
|
35
|
-
"max-length": e.inputProps.maxLength,
|
|
36
|
-
type: e.inputProps.type,
|
|
37
|
-
name: e.inputProps.name,
|
|
38
|
-
label: e.inputProps.label,
|
|
39
|
-
"error-messages": e.inputProps.errorMessages,
|
|
40
|
-
error: e.inputProps.error
|
|
41
|
-
}, e.$attrs, {
|
|
42
|
-
"model-value": e.vuetifyValue,
|
|
43
|
-
"onUpdate:modelValue": e.inputProps.field.handleChange
|
|
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,
|
|
47
|
-
id: e.inputProps.id,
|
|
48
|
-
required: e.inputProps.required,
|
|
49
|
-
"min-length": e.inputProps.minLength,
|
|
50
|
-
"max-length": e.inputProps.maxLength,
|
|
51
|
-
type: e.inputProps.type,
|
|
52
|
-
name: e.inputProps.name,
|
|
53
|
-
label: e.inputProps.label,
|
|
54
|
-
"error-messages": e.inputProps.errorMessages,
|
|
55
|
-
error: e.inputProps.error
|
|
56
|
-
}, e.$attrs, {
|
|
57
|
-
"model-value": e.vuetifyValue,
|
|
58
|
-
"onUpdate:modelValue": e.inputProps.field.handleChange
|
|
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({
|
|
61
|
-
key: 3,
|
|
62
|
-
id: e.inputProps.id,
|
|
63
|
-
required: e.inputProps.required,
|
|
64
|
-
min: e.inputProps.min,
|
|
65
|
-
max: e.inputProps.max,
|
|
66
|
-
type: e.inputProps.type,
|
|
67
|
-
name: e.inputProps.name,
|
|
68
|
-
label: e.inputProps.label,
|
|
69
|
-
"error-messages": e.inputProps.errorMessages,
|
|
70
|
-
error: e.inputProps.error
|
|
71
|
-
}, e.$attrs, {
|
|
72
|
-
"model-value": e.vuetifyValue,
|
|
73
|
-
"onUpdate:modelValue": r[1] || (r[1] = (p) => {
|
|
74
|
-
e.inputProps.field.handleChange(Number(p));
|
|
75
|
-
})
|
|
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(m, s({
|
|
78
|
-
key: 4,
|
|
79
|
-
id: e.inputProps.id,
|
|
80
|
-
clearable: e.inputProps.type === "select",
|
|
81
|
-
required: e.inputProps.required,
|
|
82
|
-
multiple: e.inputProps.type === "multiple",
|
|
83
|
-
chips: e.inputProps.type === "multiple",
|
|
84
|
-
name: e.inputProps.name,
|
|
85
|
-
label: e.inputProps.label,
|
|
86
|
-
items: e.inputProps.options,
|
|
87
|
-
"error-messages": e.inputProps.errorMessages,
|
|
88
|
-
error: e.inputProps.error
|
|
89
|
-
}, e.$attrs, {
|
|
90
|
-
"model-value": e.vuetifyValue,
|
|
91
|
-
onClear: r[2] || (r[2] = (p) => e.inputProps.field.handleChange(void 0)),
|
|
92
|
-
"onUpdate:modelValue": e.inputProps.field.handleChange
|
|
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(d, s({
|
|
95
|
-
key: 5,
|
|
96
|
-
id: e.inputProps.id,
|
|
97
|
-
clearable: e.inputProps.type === "autocomplete",
|
|
98
|
-
multiple: e.inputProps.type === "autocompletemultiple",
|
|
99
|
-
required: e.inputProps.required,
|
|
100
|
-
name: e.inputProps.name,
|
|
101
|
-
label: e.inputProps.label,
|
|
102
|
-
items: e.inputProps.options,
|
|
103
|
-
"error-messages": e.inputProps.errorMessages,
|
|
104
|
-
error: e.inputProps.error,
|
|
105
|
-
chips: e.inputProps.type === "autocompletemultiple"
|
|
106
|
-
}, e.$attrs, {
|
|
107
|
-
"model-value": e.vuetifyValue,
|
|
108
|
-
onClear: r[3] || (r[3] = (p) => e.inputProps.field.handleChange(void 0)),
|
|
109
|
-
"onUpdate:modelValue": e.inputProps.field.handleChange
|
|
110
|
-
}), null, 16, ["id", "clearable", "multiple", "required", "name", "label", "items", "error-messages", "error", "chips", "model-value", "onUpdate:modelValue"])) : l("", !0)
|
|
111
|
-
], 32);
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
});
|
|
1
|
+
import f from "./vue-components.es18.js";
|
|
115
2
|
export {
|
|
116
|
-
|
|
3
|
+
f as default
|
|
117
4
|
};
|
|
@@ -0,0 +1,98 @@
|
|
|
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 l, watch as C, onMounted as $, ref as S, watchEffect as z, renderSlot as A, normalizeProps as D, guardReactiveProps as F, createElementVNode as M, normalizeClass as N, createBlock as R, createCommentVNode as T, unref as U, openBlock as j, mergeProps as G } from "vue";
|
|
3
|
+
import { useStore as H } from "@tanstack/vue-form";
|
|
4
|
+
import { useOmegaErrors as J } from "./vue-components.es5.js";
|
|
5
|
+
import K from "./vue-components.es24.js";
|
|
6
|
+
|
|
7
|
+
const ee = /* @__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(q) {
|
|
19
|
+
const e = q, o = L(), x = o == null ? void 0 : o.appContext.components.VTextField, s = P(), u = e.field, a = H(u.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
|
+
}), n = l(() => a.value.value), d = 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
|
+
C(
|
|
29
|
+
() => [!!n.value],
|
|
30
|
+
() => {
|
|
31
|
+
var t, r;
|
|
32
|
+
d.value.length && !n.value && !((t = e.meta) != null && t.required) && u.setValue(
|
|
33
|
+
((r = e.meta) == null ? void 0 : r.nullableOrUndefined) === "undefined" ? void 0 : null
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
), $(() => {
|
|
37
|
+
var t, r;
|
|
38
|
+
!n.value && !((t = e.meta) != null && t.required) && ((r = e.meta) == null ? void 0 : r.nullableOrUndefined) === "null" && u.setValue(null);
|
|
39
|
+
});
|
|
40
|
+
const { addError: I, removeError: O, showErrors: _, showErrorsOn: k } = J(), i = S(!1);
|
|
41
|
+
z(() => {
|
|
42
|
+
(_.value || k === "onChange") && (i.value = !0);
|
|
43
|
+
});
|
|
44
|
+
const m = () => {
|
|
45
|
+
i.value = !0;
|
|
46
|
+
};
|
|
47
|
+
$(() => {
|
|
48
|
+
n.value && m();
|
|
49
|
+
});
|
|
50
|
+
const v = l(() => !i.value && f.value !== "select" ? [] : d.value);
|
|
51
|
+
C(
|
|
52
|
+
() => a.value.meta.errors,
|
|
53
|
+
() => {
|
|
54
|
+
a.value.meta.errors.length ? I({
|
|
55
|
+
inputId: s,
|
|
56
|
+
errors: a.value.meta.errors.map((t) => t.message).filter(Boolean),
|
|
57
|
+
label: e.label
|
|
58
|
+
}) : O(s);
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
const p = l(() => {
|
|
62
|
+
var t, r, c, g, y, h, b, E, V, w;
|
|
63
|
+
return {
|
|
64
|
+
id: s,
|
|
65
|
+
required: (t = e.meta) == null ? void 0 : t.required,
|
|
66
|
+
minLength: ((r = e.meta) == null ? void 0 : r.type) === "string" && ((c = e.meta) == null ? void 0 : c.minLength),
|
|
67
|
+
maxLength: ((g = e.meta) == null ? void 0 : g.type) === "string" && ((y = e.meta) == null ? void 0 : y.maxLength),
|
|
68
|
+
max: ((h = e.meta) == null ? void 0 : h.type) === "number" && ((b = e.meta) == null ? void 0 : b.maximum),
|
|
69
|
+
min: ((E = e.meta) == null ? void 0 : E.type) === "number" && ((V = e.meta) == null ? void 0 : V.minimum),
|
|
70
|
+
name: e.field.name,
|
|
71
|
+
modelValue: e.field.state.value,
|
|
72
|
+
errorMessages: v.value,
|
|
73
|
+
error: !!v.value.length,
|
|
74
|
+
field: e.field,
|
|
75
|
+
setRealDirty: m,
|
|
76
|
+
type: f.value,
|
|
77
|
+
label: `${e.label}${(w = e.meta) != null && w.required ? " *" : ""}`,
|
|
78
|
+
options: e.options
|
|
79
|
+
};
|
|
80
|
+
});
|
|
81
|
+
return (t, r) => A(t.$slots, "default", D(F(p.value)), () => [
|
|
82
|
+
M("div", {
|
|
83
|
+
class: N(t.$attrs.class),
|
|
84
|
+
onFocusout: m
|
|
85
|
+
}, [
|
|
86
|
+
U(x) ? (j(), R(K, G({
|
|
87
|
+
key: 0,
|
|
88
|
+
"input-props": p.value
|
|
89
|
+
}, t.$attrs, {
|
|
90
|
+
"vuetify-value": p.value.field.state.value
|
|
91
|
+
}), null, 16, ["input-props", "vuetify-value"])) : T("", !0)
|
|
92
|
+
], 34)
|
|
93
|
+
]);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
export {
|
|
97
|
+
ee as default
|
|
98
|
+
};
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
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
|
+
}
|
|
4
11
|
export {
|
|
5
|
-
|
|
12
|
+
c as getOmegaStore
|
|
6
13
|
};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { defineComponent as P, resolveComponent as i, createElementBlock as g, openBlock as o, createBlock as n, createCommentVNode as l, mergeProps as s } from "vue";
|
|
2
|
+
const b = /* @__PURE__ */ P({
|
|
3
|
+
inheritAttrs: !1,
|
|
4
|
+
__name: "OmegaInputVuetify",
|
|
5
|
+
props: {
|
|
6
|
+
inputProps: {},
|
|
7
|
+
vuetifyValue: {}
|
|
8
|
+
},
|
|
9
|
+
emits: ["focus", "blur"],
|
|
10
|
+
setup(y) {
|
|
11
|
+
return (e, r) => {
|
|
12
|
+
const a = i("v-checkbox"), u = i("v-text-field"), t = i("v-textarea"), m = i("v-select"), d = i("v-autocomplete");
|
|
13
|
+
return o(), g("div", {
|
|
14
|
+
class: "omega-input",
|
|
15
|
+
onFocusout: r[4] || (r[4] = (p) => e.$emit("blur", p)),
|
|
16
|
+
onFocusin: r[5] || (r[5] = (p) => e.$emit("focus", p))
|
|
17
|
+
}, [
|
|
18
|
+
e.inputProps.type === "boolean" ? (o(), n(a, s({
|
|
19
|
+
key: 0,
|
|
20
|
+
id: e.inputProps.id,
|
|
21
|
+
name: e.inputProps.name,
|
|
22
|
+
label: e.inputProps.label,
|
|
23
|
+
"error-messages": e.inputProps.errorMessages,
|
|
24
|
+
error: e.inputProps.error,
|
|
25
|
+
ripple: ""
|
|
26
|
+
}, e.$attrs, {
|
|
27
|
+
"model-value": e.vuetifyValue,
|
|
28
|
+
onChange: r[0] || (r[0] = (p) => e.inputProps.field.handleChange(p.target.checked))
|
|
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, s({
|
|
31
|
+
key: 1,
|
|
32
|
+
id: e.inputProps.id,
|
|
33
|
+
required: e.inputProps.required,
|
|
34
|
+
"min-length": e.inputProps.minLength,
|
|
35
|
+
"max-length": e.inputProps.maxLength,
|
|
36
|
+
type: e.inputProps.type,
|
|
37
|
+
name: e.inputProps.name,
|
|
38
|
+
label: e.inputProps.label,
|
|
39
|
+
"error-messages": e.inputProps.errorMessages,
|
|
40
|
+
error: e.inputProps.error
|
|
41
|
+
}, e.$attrs, {
|
|
42
|
+
"model-value": e.vuetifyValue,
|
|
43
|
+
"onUpdate:modelValue": e.inputProps.field.handleChange
|
|
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,
|
|
47
|
+
id: e.inputProps.id,
|
|
48
|
+
required: e.inputProps.required,
|
|
49
|
+
"min-length": e.inputProps.minLength,
|
|
50
|
+
"max-length": e.inputProps.maxLength,
|
|
51
|
+
type: e.inputProps.type,
|
|
52
|
+
name: e.inputProps.name,
|
|
53
|
+
label: e.inputProps.label,
|
|
54
|
+
"error-messages": e.inputProps.errorMessages,
|
|
55
|
+
error: e.inputProps.error
|
|
56
|
+
}, e.$attrs, {
|
|
57
|
+
"model-value": e.vuetifyValue,
|
|
58
|
+
"onUpdate:modelValue": e.inputProps.field.handleChange
|
|
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, s({
|
|
61
|
+
key: 3,
|
|
62
|
+
id: e.inputProps.id,
|
|
63
|
+
required: e.inputProps.required,
|
|
64
|
+
min: e.inputProps.min,
|
|
65
|
+
max: e.inputProps.max,
|
|
66
|
+
type: e.inputProps.type,
|
|
67
|
+
name: e.inputProps.name,
|
|
68
|
+
label: e.inputProps.label,
|
|
69
|
+
"error-messages": e.inputProps.errorMessages,
|
|
70
|
+
error: e.inputProps.error
|
|
71
|
+
}, e.$attrs, {
|
|
72
|
+
"model-value": e.vuetifyValue,
|
|
73
|
+
"onUpdate:modelValue": r[1] || (r[1] = (p) => {
|
|
74
|
+
e.inputProps.field.handleChange(Number(p));
|
|
75
|
+
})
|
|
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(m, s({
|
|
78
|
+
key: 4,
|
|
79
|
+
id: e.inputProps.id,
|
|
80
|
+
clearable: e.inputProps.type === "select",
|
|
81
|
+
required: e.inputProps.required,
|
|
82
|
+
multiple: e.inputProps.type === "multiple",
|
|
83
|
+
chips: e.inputProps.type === "multiple",
|
|
84
|
+
name: e.inputProps.name,
|
|
85
|
+
label: e.inputProps.label,
|
|
86
|
+
items: e.inputProps.options,
|
|
87
|
+
"error-messages": e.inputProps.errorMessages,
|
|
88
|
+
error: e.inputProps.error
|
|
89
|
+
}, e.$attrs, {
|
|
90
|
+
"model-value": e.vuetifyValue,
|
|
91
|
+
onClear: r[2] || (r[2] = (p) => e.inputProps.field.handleChange(void 0)),
|
|
92
|
+
"onUpdate:modelValue": e.inputProps.field.handleChange
|
|
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(d, s({
|
|
95
|
+
key: 5,
|
|
96
|
+
id: e.inputProps.id,
|
|
97
|
+
clearable: e.inputProps.type === "autocomplete",
|
|
98
|
+
multiple: e.inputProps.type === "autocompletemultiple",
|
|
99
|
+
required: e.inputProps.required,
|
|
100
|
+
name: e.inputProps.name,
|
|
101
|
+
label: e.inputProps.label,
|
|
102
|
+
items: e.inputProps.options,
|
|
103
|
+
"error-messages": e.inputProps.errorMessages,
|
|
104
|
+
error: e.inputProps.error,
|
|
105
|
+
chips: e.inputProps.type === "autocompletemultiple"
|
|
106
|
+
}, e.$attrs, {
|
|
107
|
+
"model-value": e.vuetifyValue,
|
|
108
|
+
onClear: r[3] || (r[3] = (p) => e.inputProps.field.handleChange(void 0)),
|
|
109
|
+
"onUpdate:modelValue": e.inputProps.field.handleChange
|
|
110
|
+
}), null, 16, ["id", "clearable", "multiple", "required", "name", "label", "items", "error-messages", "error", "chips", "model-value", "onUpdate:modelValue"])) : l("", !0)
|
|
111
|
+
], 32);
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
export {
|
|
116
|
+
b as default
|
|
117
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
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 o from "./vue-components.es24.js";
|
|
3
|
+
|
|
4
|
+
export {
|
|
5
|
+
o as default
|
|
6
|
+
};
|
|
@@ -1,38 +1,48 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
+
import { generateInputStandardSchemaFromFieldMeta as y } from "./vue-components.es7.js";
|
|
3
|
+
import b from "./vue-components.es21.js";
|
|
4
|
+
const S = /* @__PURE__ */ i({
|
|
5
|
+
inheritAttrs: !1,
|
|
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
|
+
});
|
|
34
46
|
export {
|
|
35
|
-
|
|
36
|
-
h as provideOmegaErrors,
|
|
37
|
-
w as useOmegaErrors
|
|
47
|
+
S as default
|
|
38
48
|
};
|
|
@@ -1,152 +1,38 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const e = new URLSearchParams(window.location.search);
|
|
17
|
-
e.delete(d.value);
|
|
18
|
-
const r = new URL(window.location.href);
|
|
19
|
-
r.search = e.toString(), window.history.replaceState({}, "", r.toString());
|
|
20
|
-
};
|
|
21
|
-
function h(e, r) {
|
|
22
|
-
for (const l in r)
|
|
23
|
-
r[l] && K(r[l]) ? (e[l] || (e[l] = {}), h(e[l], r[l])) : e[l] = r[l];
|
|
24
|
-
return e;
|
|
25
|
-
}
|
|
26
|
-
const j = b(() => {
|
|
27
|
-
var l;
|
|
28
|
-
if (s != null && s.defaultValues && !((l = i == null ? void 0 : i.persistency) != null && l.overrideDefaultValues))
|
|
29
|
-
return s == null ? void 0 : s.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 n = new URLSearchParams(window.location.search).get(d.value);
|
|
36
|
-
U(), n && (e = JSON.parse(n));
|
|
37
|
-
} catch (u) {
|
|
38
|
-
console.error(u);
|
|
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 u = r.policies.includes("local") ? localStorage : sessionStorage;
|
|
45
|
-
if (u)
|
|
46
|
-
try {
|
|
47
|
-
const n = JSON.parse(
|
|
48
|
-
u.getItem(d.value) || "{}"
|
|
49
|
-
);
|
|
50
|
-
u.removeItem(d.value), e = n;
|
|
51
|
-
} catch (n) {
|
|
52
|
-
console.error(n);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
if (e ?? (e = {}), (s == null ? void 0 : s.defaultValues) == null)
|
|
56
|
-
return e;
|
|
57
|
-
{
|
|
58
|
-
const u = s == null ? void 0 : s.defaultValues;
|
|
59
|
-
return h(u, e);
|
|
60
|
-
}
|
|
61
|
-
}), c = P({
|
|
62
|
-
...s,
|
|
63
|
-
validators: {
|
|
64
|
-
onSubmit: V,
|
|
65
|
-
...(s == null ? void 0 : s.validators) || {}
|
|
66
|
-
},
|
|
67
|
-
onSubmit: s != null && s.onSubmit ? ({ formApi: e, meta: r, value: l }) => {
|
|
68
|
-
var u;
|
|
69
|
-
return (u = s.onSubmit) == null ? void 0 : u.call(s, {
|
|
70
|
-
formApi: e,
|
|
71
|
-
meta: r,
|
|
72
|
-
value: l
|
|
73
|
-
});
|
|
74
|
-
} : void 0,
|
|
75
|
-
defaultValues: j.value
|
|
76
|
-
}), E = () => {
|
|
77
|
-
Object.keys(t).forEach((e) => {
|
|
78
|
-
c.setFieldValue(e, void 0);
|
|
79
|
-
});
|
|
80
|
-
}, a = (e) => e.reduce(
|
|
81
|
-
(r, l) => {
|
|
82
|
-
const u = l.split(".");
|
|
83
|
-
return u.reduce((n, o, I) => (I === u.length - 1 ? n[o] = c.getFieldValue(l) : n[o] = n[o] ?? {}, n[o]), r), r;
|
|
84
|
-
},
|
|
85
|
-
{}
|
|
86
|
-
), S = (e) => {
|
|
87
|
-
if (e) {
|
|
88
|
-
if (Array.isArray(e.keys))
|
|
89
|
-
return a(e.keys);
|
|
90
|
-
if (Array.isArray(e.banKeys)) {
|
|
91
|
-
const r = Object.keys(t).filter(
|
|
92
|
-
(l) => {
|
|
93
|
-
var u;
|
|
94
|
-
return (u = e.banKeys) == null ? void 0 : u.includes(l);
|
|
95
|
-
}
|
|
96
|
-
);
|
|
97
|
-
return a(r);
|
|
98
|
-
}
|
|
99
|
-
return c.store.state.values;
|
|
100
|
-
}
|
|
101
|
-
}, f = () => {
|
|
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 = S(e);
|
|
107
|
-
return r.setItem(d.value, JSON.stringify(l));
|
|
108
|
-
}
|
|
109
|
-
}, v = () => {
|
|
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 = S(e), l = new URLSearchParams(window.location.search);
|
|
113
|
-
l.set(d.value, JSON.stringify(r));
|
|
114
|
-
const u = new URL(window.location.href);
|
|
115
|
-
u.search = l.toString(), window.history.replaceState({}, "", u.toString());
|
|
1
|
+
import { ref as l, computed as p, readonly as v, provide as E, inject as f } from "vue";
|
|
2
|
+
const u = Symbol();
|
|
3
|
+
function h(e, a, t = "onSubmit") {
|
|
4
|
+
const r = l([]), n = (o) => {
|
|
5
|
+
r.value = r.value.filter((d) => d.inputId !== o);
|
|
6
|
+
}, c = (o) => {
|
|
7
|
+
n(o.inputId), r.value.push(o);
|
|
8
|
+
}, i = () => {
|
|
9
|
+
r.value = [];
|
|
10
|
+
}, m = p(() => {
|
|
11
|
+
switch (t) {
|
|
12
|
+
case "onChange":
|
|
13
|
+
return !0;
|
|
14
|
+
default:
|
|
15
|
+
return e.value > 0;
|
|
116
16
|
}
|
|
17
|
+
}), s = {
|
|
18
|
+
errors: v(r),
|
|
19
|
+
addError: c,
|
|
20
|
+
removeError: n,
|
|
21
|
+
clearErrors: i,
|
|
22
|
+
showErrors: m,
|
|
23
|
+
generalErrors: a,
|
|
24
|
+
showErrorsOn: t ?? "onSubmit"
|
|
117
25
|
};
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
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 u = r.name, n = r.label;
|
|
134
|
-
if (!u || !n)
|
|
135
|
-
throw new Error("OmegaForm.Input requires name and label props");
|
|
136
|
-
return () => J(
|
|
137
|
-
M,
|
|
138
|
-
{
|
|
139
|
-
...r,
|
|
140
|
-
name: u,
|
|
141
|
-
label: n,
|
|
142
|
-
form: y
|
|
143
|
-
},
|
|
144
|
-
l
|
|
145
|
-
);
|
|
146
|
-
}
|
|
147
|
-
})
|
|
148
|
-
});
|
|
149
|
-
};
|
|
26
|
+
return E(u, s), s;
|
|
27
|
+
}
|
|
28
|
+
function w() {
|
|
29
|
+
const e = f(u);
|
|
30
|
+
if (!e)
|
|
31
|
+
throw new Error("useOmegaErrors must be used within an OmegaForm provider");
|
|
32
|
+
return e;
|
|
33
|
+
}
|
|
150
34
|
export {
|
|
151
|
-
|
|
35
|
+
u as OmegaErrorsKey,
|
|
36
|
+
h as provideOmegaErrors,
|
|
37
|
+
w as useOmegaErrors
|
|
152
38
|
};
|