@effect-app/vue-components 0.2.8 → 0.3.0
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/OmegaWrapper.vue.d.ts +7 -14
- package/dist/types/components/OmegaForm/getOmegaStore.d.ts +1 -1
- package/dist/types/components/OmegaForm/index.d.ts +3 -4
- package/dist/types/components/OmegaForm/useOmegaForm.d.ts +20 -3
- package/dist/vue-components.es11.js +17 -15
- package/dist/vue-components.es15.js +4 -89
- package/dist/vue-components.es16.js +93 -11
- package/dist/vue-components.es17.js +11 -2
- package/dist/vue-components.es18.js +2 -115
- package/dist/vue-components.es19.js +117 -0
- package/dist/{vue-components.es20.js → vue-components.es21.js} +1 -1
- package/dist/vue-components.es5.js +82 -16
- package/dist/vue-components.es7.js +2 -2
- package/dist/vue-components.es8.js +1 -1
- package/package.json +11 -2
- package/src/components/OmegaForm/OmegaInternalInput.vue +6 -0
- package/src/components/OmegaForm/OmegaWrapper.vue +10 -8
- package/src/components/OmegaForm/getOmegaStore.ts +1 -1
- package/src/components/OmegaForm/useOmegaForm.ts +133 -11
- package/src/stories/OmegaForm/ComplexForm.vue +81 -0
- package/src/stories/OmegaForm/EmailForm.vue +48 -0
- package/src/stories/OmegaForm/PersistencyForm.vue +65 -0
- package/src/stories/OmegaForm/SimpleForm.vue +30 -0
- package/src/stories/OmegaForm/SimpleFormVuetifyDefault.vue +15 -0
- package/src/stories/OmegaForm/SumExample.vue +39 -0
- package/src/stories/OmegaForm.stories.ts +83 -0
- package/src/stories/README.md +29 -0
- package/src/stories/tsconfig.json +4 -0
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { type S } from "effect-app";
|
|
2
|
-
import { type
|
|
2
|
+
import { type OmegaFormState, type ShowErrorsOn } from "./OmegaFormStuff";
|
|
3
|
+
import { type OmegaConfig, type OmegaFormReturn } from "./useOmegaForm";
|
|
3
4
|
declare const _default: <From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>, K extends keyof OmegaFormState<To, From> = keyof OmegaFormState<To, From>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
4
5
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & ({
|
|
6
|
+
omegaConfig?: OmegaConfig<From>;
|
|
5
7
|
subscribe?: K[];
|
|
6
8
|
showErrorsOn?: ShowErrorsOn;
|
|
7
9
|
} & ({
|
|
8
|
-
form:
|
|
9
|
-
meta: MetaRecord<To>;
|
|
10
|
-
filterItems?: FilterItems;
|
|
11
|
-
};
|
|
10
|
+
form: OmegaFormReturn<To, From>;
|
|
12
11
|
schema?: undefined;
|
|
13
12
|
} | (Omit<import("@tanstack/vue-form").FormOptions<To, import("@tanstack/vue-form").FormValidateOrFn<To> | undefined, import("@tanstack/vue-form").FormValidateOrFn<To> | undefined, import("@tanstack/vue-form").StandardSchemaV1<To, From>, import("@tanstack/vue-form").FormValidateOrFn<To> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<To> | undefined, import("@tanstack/vue-form").FormValidateOrFn<To> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<To> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<To> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<To> | undefined>, "onSubmit"> & {
|
|
14
13
|
onSubmit?: ((props: {
|
|
@@ -20,18 +19,12 @@ declare const _default: <From extends Record<PropertyKey, any>, To extends Recor
|
|
|
20
19
|
form?: undefined;
|
|
21
20
|
schema: S.Schema<From, To, never>;
|
|
22
21
|
}))) & Partial<{}>> & import("vue").PublicProps;
|
|
23
|
-
expose(exposed: import("vue").ShallowUnwrapRef<
|
|
24
|
-
meta: MetaRecord<To>;
|
|
25
|
-
filterItems?: FilterItems;
|
|
26
|
-
}>): void;
|
|
22
|
+
expose(exposed: import("vue").ShallowUnwrapRef<OmegaFormReturn<To, From>>): void;
|
|
27
23
|
attrs: any;
|
|
28
24
|
slots: {
|
|
29
25
|
default?: ((props: {
|
|
30
|
-
form:
|
|
31
|
-
|
|
32
|
-
filterItems?: FilterItems;
|
|
33
|
-
};
|
|
34
|
-
subscribedValues: Pick<OmegaFormState<To, From>, K>;
|
|
26
|
+
form: OmegaFormReturn<To, From>;
|
|
27
|
+
subscribedValues: K[] extends undefined[] ? Record<string, never> : Pick<OmegaFormState<To, From>, K>;
|
|
35
28
|
}) => any) | undefined;
|
|
36
29
|
};
|
|
37
30
|
emit: {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type Ref } from "vue";
|
|
2
2
|
import type { OmegaFormState, OmegaFormApi } from "./OmegaFormStuff";
|
|
3
|
-
export declare function getOmegaStore<To, From, K extends keyof OmegaFormState<To, From> = keyof OmegaFormState<To, From>>(form: OmegaFormApi<To, From>, subscribe?: K[]): Ref<K[] extends undefined ? Record<string, never> : Pick<OmegaFormState<To, From>, K>>;
|
|
3
|
+
export declare function getOmegaStore<To, From, K extends keyof OmegaFormState<To, From> = keyof OmegaFormState<To, From>>(form: OmegaFormApi<To, From>, subscribe?: K[]): Ref<K[] extends undefined[] ? Record<string, never> : Pick<OmegaFormState<To, From>, K>>;
|
|
@@ -7,14 +7,13 @@ export { useOmegaForm } from "./useOmegaForm";
|
|
|
7
7
|
export { default } from "./OmegaWrapper.vue";
|
|
8
8
|
export { OmegaForm, OmegaInput, OmegaErrors };
|
|
9
9
|
declare const OmegaFormCE: new <From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>, K extends keyof import("./OmegaFormStuff").OmegaFormState<To, From> = keyof import("./OmegaFormStuff").OmegaFormState<To, From>>(initialProps?: Record<string, any>) => import("vue").VueElement & ((({
|
|
10
|
+
omegaConfig?: import("./useOmegaForm").OmegaConfig<From> | undefined;
|
|
10
11
|
subscribe?: K[] | undefined;
|
|
11
12
|
showErrorsOn?: import("./OmegaFormStuff").ShowErrorsOn | undefined;
|
|
12
|
-
form: import("./
|
|
13
|
-
meta: import("./OmegaFormStuff").MetaRecord<To>;
|
|
14
|
-
filterItems?: import("./OmegaFormStuff").FilterItems;
|
|
15
|
-
};
|
|
13
|
+
form: import("./useOmegaForm").OmegaFormReturn<To, From>;
|
|
16
14
|
schema?: undefined | undefined;
|
|
17
15
|
} | {
|
|
16
|
+
omegaConfig?: import("./useOmegaForm").OmegaConfig<From> | undefined;
|
|
18
17
|
subscribe?: K[] | undefined;
|
|
19
18
|
showErrorsOn?: import("./OmegaFormStuff").ShowErrorsOn | undefined;
|
|
20
19
|
defaultValues?: To | undefined;
|
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
import { S } from "effect-app";
|
|
2
|
-
import { type FilterItems, type FormProps, type MetaRecord, type OmegaFormApi } from "./OmegaFormStuff";
|
|
3
|
-
|
|
2
|
+
import { type NestedKeyOf, type FilterItems, type FormProps, type MetaRecord, type OmegaFormApi } from "./OmegaFormStuff";
|
|
3
|
+
type keysRule<T> = {
|
|
4
|
+
keys?: NestedKeyOf<T>[];
|
|
5
|
+
banKeys?: "You should only use one of banKeys or keys, not both, moron";
|
|
6
|
+
} | {
|
|
7
|
+
keys?: "You should only use one of banKeys or keys, not both, moron";
|
|
8
|
+
banKeys?: NestedKeyOf<T>[];
|
|
9
|
+
};
|
|
10
|
+
export type OmegaConfig<T> = {
|
|
11
|
+
persistency?: {
|
|
12
|
+
method?: "session" | "local" | "none";
|
|
13
|
+
overrideDefaultValues?: boolean;
|
|
14
|
+
id?: string;
|
|
15
|
+
} & keysRule<T>;
|
|
16
|
+
};
|
|
17
|
+
export interface OmegaFormReturn<To, From> extends OmegaFormApi<To, From> {
|
|
4
18
|
meta: MetaRecord<To>;
|
|
5
19
|
filterItems?: FilterItems;
|
|
6
|
-
|
|
20
|
+
clear: () => void;
|
|
21
|
+
}
|
|
22
|
+
export declare const useOmegaForm: <From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>>(schema: S.Schema<From, To, never>, tanstackFormOptions?: NoInfer<FormProps<To, From>>, omegaConfig?: OmegaConfig<From>) => OmegaFormReturn<To, From>;
|
|
23
|
+
export {};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { defineComponent as d, watch as b, createElementBlock as
|
|
1
|
+
import { defineComponent as d, watch as b, createElementBlock as g, openBlock as S, withModifiers as v, unref as n, createElementVNode as h, renderSlot as O } from "vue";
|
|
2
2
|
import { useStore as i } from "@tanstack/vue-form";
|
|
3
|
-
import { getOmegaStore as M } from "./vue-components.
|
|
3
|
+
import { getOmegaStore as M } from "./vue-components.es17.js";
|
|
4
4
|
import { provideOmegaErrors as y } from "./vue-components.es4.js";
|
|
5
5
|
import { useOmegaForm as E } from "./vue-components.es5.js";
|
|
6
6
|
const w = ["disabled"], A = /* @__PURE__ */ d({
|
|
7
7
|
__name: "OmegaWrapper",
|
|
8
8
|
props: {
|
|
9
|
+
omegaConfig: {},
|
|
9
10
|
subscribe: {},
|
|
10
11
|
showErrorsOn: {},
|
|
11
12
|
form: {},
|
|
@@ -21,35 +22,36 @@ const w = ["disabled"], A = /* @__PURE__ */ d({
|
|
|
21
22
|
onSubmit: { type: Function }
|
|
22
23
|
},
|
|
23
24
|
setup(u, { expose: l }) {
|
|
24
|
-
const
|
|
25
|
+
const r = u, t = r.form ?? E(r.schema, r, r.omegaConfig), f = i(t.store, (e) => e.isSubmitting);
|
|
25
26
|
l(t);
|
|
26
27
|
const c = M(
|
|
27
28
|
t,
|
|
28
|
-
|
|
29
|
+
r.subscribe
|
|
29
30
|
), p = i(
|
|
30
31
|
t.store,
|
|
31
32
|
(e) => e.submissionAttempts
|
|
32
|
-
),
|
|
33
|
+
), s = t.useStore((e) => e.errors);
|
|
33
34
|
return b(
|
|
34
|
-
() => [t.filterItems,
|
|
35
|
+
() => [t.filterItems, s.value],
|
|
35
36
|
() => {
|
|
36
37
|
const e = t.filterItems;
|
|
37
|
-
return e ?
|
|
38
|
-
(
|
|
38
|
+
return e ? s.value ? (Object.values(s.value).filter(
|
|
39
|
+
(o) => !!o
|
|
39
40
|
).flatMap(
|
|
40
|
-
(
|
|
41
|
-
).some((
|
|
42
|
-
const m = t.getFieldMeta(
|
|
43
|
-
t.setFieldMeta(
|
|
41
|
+
(o) => Object.values(o).flat().map((m) => m.message)
|
|
42
|
+
).some((o) => o === e.message) && e.items.forEach((o) => {
|
|
43
|
+
const m = t.getFieldMeta(o);
|
|
44
|
+
t.setFieldMeta(o, {
|
|
44
45
|
...m,
|
|
45
46
|
errorMap: {
|
|
46
|
-
onSubmit: [{ path: [
|
|
47
|
+
onSubmit: [{ path: [o], message: e.message }]
|
|
47
48
|
}
|
|
48
49
|
});
|
|
49
50
|
}), {}) : {} : {};
|
|
50
51
|
}
|
|
51
|
-
), y(p,
|
|
52
|
-
|
|
52
|
+
), y(p, s, r.showErrorsOn), (e, a) => (S(), g("form", {
|
|
53
|
+
novalidate: "",
|
|
54
|
+
onSubmit: a[0] || (a[0] = v((o) => n(t).handleSubmit(), ["prevent", "stop"]))
|
|
53
55
|
}, [
|
|
54
56
|
h("fieldset", { disabled: n(f) }, [
|
|
55
57
|
O(e.$slots, "default", {
|
|
@@ -1,91 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import { defineComponent as k, getCurrentInstance as B, useId as L, computed as n, watch as x, onMounted as P, ref as S, watchEffect as A, renderSlot as D, normalizeProps as F, guardReactiveProps as M, createElementVNode as N, createBlock as R, createCommentVNode as T, unref as U, openBlock as z, mergeProps as j } from "vue";
|
|
3
|
-
import { useStore as G } from "@tanstack/vue-form";
|
|
4
|
-
import { useOmegaErrors as H } from "./vue-components.es4.js";
|
|
5
|
-
import J from "./vue-components.es18.js";
|
|
6
|
-
|
|
7
|
-
const Z = /* @__PURE__ */ k({
|
|
8
|
-
inheritAttrs: !1,
|
|
9
|
-
__name: "OmegaInternalInput",
|
|
10
|
-
props: {
|
|
11
|
-
field: {},
|
|
12
|
-
meta: {},
|
|
13
|
-
label: {},
|
|
14
|
-
options: {},
|
|
15
|
-
type: {},
|
|
16
|
-
validators: {}
|
|
17
|
-
},
|
|
18
|
-
setup(_) {
|
|
19
|
-
const e = _, l = B(), q = l == null ? void 0 : l.appContext.components.VTextField, o = L(), u = e.field, a = G(u.store, (t) => t), p = 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
|
-
}), s = n(() => a.value.value), d = 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
|
-
x(
|
|
29
|
-
() => [!!s.value],
|
|
30
|
-
() => {
|
|
31
|
-
var t, r;
|
|
32
|
-
d.value.length && !s.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
|
-
), P(() => {
|
|
37
|
-
var t, r;
|
|
38
|
-
!s.value && !((t = e.meta) != null && t.required) && ((r = e.meta) == null ? void 0 : r.nullableOrUndefined) === "null" && u.setValue(null);
|
|
39
|
-
});
|
|
40
|
-
const { addError: C, removeError: I, showErrors: O, showErrorsOn: $ } = H(), i = S(!1);
|
|
41
|
-
A(() => {
|
|
42
|
-
(O.value || $ === "onChange") && (i.value = !0);
|
|
43
|
-
});
|
|
44
|
-
const f = () => {
|
|
45
|
-
i.value = !0;
|
|
46
|
-
}, v = n(() => !i.value && p.value !== "select" ? [] : d.value);
|
|
47
|
-
x(
|
|
48
|
-
() => a.value.meta.errors,
|
|
49
|
-
() => {
|
|
50
|
-
a.value.meta.errors.length ? C({
|
|
51
|
-
inputId: o,
|
|
52
|
-
errors: a.value.meta.errors.map((t) => t.message).filter(Boolean),
|
|
53
|
-
label: e.label
|
|
54
|
-
}) : I(o);
|
|
55
|
-
}
|
|
56
|
-
);
|
|
57
|
-
const m = n(() => {
|
|
58
|
-
var t, r, c, g, y, h, b, E, V, w;
|
|
59
|
-
return {
|
|
60
|
-
id: o,
|
|
61
|
-
required: (t = e.meta) == null ? void 0 : t.required,
|
|
62
|
-
minLength: ((r = e.meta) == null ? void 0 : r.type) === "string" && ((c = e.meta) == null ? void 0 : c.minLength),
|
|
63
|
-
maxLength: ((g = e.meta) == null ? void 0 : g.type) === "string" && ((y = e.meta) == null ? void 0 : y.maxLength),
|
|
64
|
-
max: ((h = e.meta) == null ? void 0 : h.type) === "number" && ((b = e.meta) == null ? void 0 : b.maximum),
|
|
65
|
-
min: ((E = e.meta) == null ? void 0 : E.type) === "number" && ((V = e.meta) == null ? void 0 : V.minimum),
|
|
66
|
-
name: e.field.name,
|
|
67
|
-
modelValue: e.field.state.value,
|
|
68
|
-
errorMessages: v.value,
|
|
69
|
-
error: !!v.value.length,
|
|
70
|
-
field: e.field,
|
|
71
|
-
setRealDirty: f,
|
|
72
|
-
type: p.value,
|
|
73
|
-
label: `${e.label}${(w = e.meta) != null && w.required ? " *" : ""}`,
|
|
74
|
-
options: e.options
|
|
75
|
-
};
|
|
76
|
-
});
|
|
77
|
-
return (t, r) => D(t.$slots, "default", F(M(m.value)), () => [
|
|
78
|
-
N("div", { onFocusout: f }, [
|
|
79
|
-
U(q) ? (z(), R(J, j({
|
|
80
|
-
key: 0,
|
|
81
|
-
"input-props": m.value
|
|
82
|
-
}, t.$attrs, {
|
|
83
|
-
"vuetify-value": m.value.field.state.value
|
|
84
|
-
}), null, 16, ["input-props", "vuetify-value"])) : T("", !0)
|
|
85
|
-
], 32)
|
|
86
|
-
]);
|
|
87
|
-
}
|
|
88
|
-
});
|
|
1
|
+
const o = (n) => () => n, t = /* @__PURE__ */ o(void 0), c = t;
|
|
89
2
|
export {
|
|
90
|
-
|
|
3
|
+
t as constUndefined,
|
|
4
|
+
c as constVoid,
|
|
5
|
+
o as constant
|
|
91
6
|
};
|
|
@@ -1,13 +1,95 @@
|
|
|
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 x, onMounted as _, ref as S, watchEffect as A, renderSlot as D, normalizeProps as F, guardReactiveProps as M, createElementVNode as N, createBlock as R, createCommentVNode as T, unref as U, openBlock as z, mergeProps as j } from "vue";
|
|
3
|
+
import { useStore as G } from "@tanstack/vue-form";
|
|
4
|
+
import { useOmegaErrors as H } from "./vue-components.es4.js";
|
|
5
|
+
import J from "./vue-components.es19.js";
|
|
6
|
+
|
|
7
|
+
const Z = /* @__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(), C = o == null ? void 0 : o.appContext.components.VTextField, u = P(), s = e.field, a = G(s.store, (t) => t), f = 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
|
+
}), l = n(() => a.value.value), d = 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
|
+
x(
|
|
29
|
+
() => [!!l.value],
|
|
30
|
+
() => {
|
|
31
|
+
var t, r;
|
|
32
|
+
d.value.length && !l.value && !((t = e.meta) != null && t.required) && s.setValue(
|
|
33
|
+
((r = e.meta) == null ? void 0 : r.nullableOrUndefined) === "undefined" ? void 0 : null
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
), _(() => {
|
|
37
|
+
var t, r;
|
|
38
|
+
!l.value && !((t = e.meta) != null && t.required) && ((r = e.meta) == null ? void 0 : r.nullableOrUndefined) === "null" && s.setValue(null);
|
|
39
|
+
});
|
|
40
|
+
const { addError: I, removeError: O, showErrors: $, showErrorsOn: k } = H(), i = S(!1);
|
|
41
|
+
A(() => {
|
|
42
|
+
($.value || k === "onChange") && (i.value = !0);
|
|
43
|
+
});
|
|
44
|
+
const m = () => {
|
|
45
|
+
i.value = !0;
|
|
46
|
+
};
|
|
47
|
+
_(() => {
|
|
48
|
+
l.value && m();
|
|
49
|
+
});
|
|
50
|
+
const v = n(() => !i.value && f.value !== "select" ? [] : d.value);
|
|
51
|
+
x(
|
|
52
|
+
() => a.value.meta.errors,
|
|
53
|
+
() => {
|
|
54
|
+
a.value.meta.errors.length ? I({
|
|
55
|
+
inputId: u,
|
|
56
|
+
errors: a.value.meta.errors.map((t) => t.message).filter(Boolean),
|
|
57
|
+
label: e.label
|
|
58
|
+
}) : O(u);
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
const p = n(() => {
|
|
62
|
+
var t, r, c, g, y, h, b, E, V, w;
|
|
63
|
+
return {
|
|
64
|
+
id: u,
|
|
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) => D(t.$slots, "default", F(M(p.value)), () => [
|
|
82
|
+
N("div", { onFocusout: m }, [
|
|
83
|
+
U(C) ? (z(), R(J, j({
|
|
84
|
+
key: 0,
|
|
85
|
+
"input-props": p.value
|
|
86
|
+
}, t.$attrs, {
|
|
87
|
+
"vuetify-value": p.value.field.state.value
|
|
88
|
+
}), null, 16, ["input-props", "vuetify-value"])) : T("", !0)
|
|
89
|
+
], 32)
|
|
90
|
+
]);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
11
93
|
export {
|
|
12
|
-
|
|
94
|
+
Z as default
|
|
13
95
|
};
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
import
|
|
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
|
+
}
|
|
2
11
|
export {
|
|
3
|
-
|
|
12
|
+
c as getOmegaStore
|
|
4
13
|
};
|
|
@@ -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.es16.js";
|
|
115
2
|
export {
|
|
116
|
-
|
|
3
|
+
f as default
|
|
117
4
|
};
|
|
@@ -0,0 +1,117 @@
|
|
|
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
|
+
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
|
+
});
|
|
115
|
+
export {
|
|
116
|
+
b as default
|
|
117
|
+
};
|
|
@@ -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 o from "./vue-components.
|
|
2
|
+
import o from "./vue-components.es19.js";
|
|
3
3
|
|
|
4
4
|
export {
|
|
5
5
|
o as default
|