@effect-app/vue-components 0.3.3 → 0.4.1
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 +13 -0
- package/dist/types/components/OmegaForm/OmegaInput.vue.d.ts +2 -14
- package/dist/types/components/OmegaForm/OmegaWrapper.vue.d.ts +7 -3
- package/dist/types/components/OmegaForm/index.d.ts +2 -42
- package/dist/types/components/OmegaForm/useOmegaForm.d.ts +6 -2
- package/dist/vue-components.es11.js +43 -33
- package/dist/vue-components.es15.js +1 -1
- package/dist/vue-components.es16.js +2 -93
- package/dist/vue-components.es17.js +93 -11
- package/dist/vue-components.es18.js +11 -2
- package/dist/vue-components.es19.js +1 -1
- package/dist/vue-components.es5.js +88 -61
- package/dist/vue-components.es7.js +2 -2
- package/dist/vue-components.es8.js +1 -1
- package/package.json +3 -1
- package/src/components/OmegaForm/OmegaFormStuff.ts +11 -0
- package/src/components/OmegaForm/OmegaInput.vue +2 -15
- package/src/components/OmegaForm/OmegaWrapper.vue +61 -23
- package/src/components/OmegaForm/index.ts +3 -3
- package/src/components/OmegaForm/useOmegaForm.ts +50 -4
- package/src/stories/OmegaForm/ComplexForm.vue +39 -33
- package/src/stories/OmegaForm/EmailForm.vue +1 -1
- package/src/stories/OmegaForm/Meta.vue +1 -1
- package/src/stories/OmegaForm/OneHundredWaysToWriteAForm.vue +188 -0
- package/src/stories/OmegaForm/PersistencyForm.vue +6 -6
- package/src/stories/OmegaForm/SimpleForm.vue +1 -1
- package/src/stories/OmegaForm/SimpleFormVuetifyDefault.vue +1 -1
- package/src/stories/OmegaForm/SumExample.vue +3 -5
- package/src/stories/OmegaForm/form.Input.vue +86 -0
- package/src/stories/OmegaForm.stories.ts +16 -1
|
@@ -2,6 +2,19 @@ import { S, type Effect } from "effect-app";
|
|
|
2
2
|
import { type FormAsyncValidateOrFn, type FormValidateOrFn, type StandardSchemaV1, type FormApi, type VueFormApi, type FieldComponent, type FormOptions, type DeepKeys, type FieldValidateOrFn, type FieldAsyncValidateOrFn, type FormState } from "@tanstack/vue-form";
|
|
3
3
|
import type { Component } from "vue";
|
|
4
4
|
export type ShowErrorsOn = "onChange" | "onBlur" | "onSubmit";
|
|
5
|
+
export type OmegaInputProps<From, To> = {
|
|
6
|
+
form: FormType<From, To> & {
|
|
7
|
+
meta: MetaRecord<To>;
|
|
8
|
+
};
|
|
9
|
+
name: NestedKeyOf<To>;
|
|
10
|
+
validators?: FieldValidators<From>;
|
|
11
|
+
label: string;
|
|
12
|
+
options?: {
|
|
13
|
+
title: string;
|
|
14
|
+
value: string;
|
|
15
|
+
}[];
|
|
16
|
+
type?: TypeOverride;
|
|
17
|
+
};
|
|
5
18
|
export type TypeOverride = "string" | "text" | "number" | "select" | "multiple" | "boolean" | "autocomplete" | "autocompletemultiple";
|
|
6
19
|
export interface OmegaError {
|
|
7
20
|
label: string;
|
|
@@ -1,19 +1,7 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type OmegaInputProps } from "./OmegaFormStuff";
|
|
2
2
|
import type { OmegaFieldInternalApi } from "./InputProps";
|
|
3
3
|
declare const _default: <From, To>(__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
|
-
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & {
|
|
5
|
-
form: FormType<From, To> & {
|
|
6
|
-
meta: MetaRecord<To>;
|
|
7
|
-
};
|
|
8
|
-
name: NestedKeyOf<To>;
|
|
9
|
-
validators?: FieldValidators<From>;
|
|
10
|
-
label: string;
|
|
11
|
-
options?: {
|
|
12
|
-
title: string;
|
|
13
|
-
value: string;
|
|
14
|
-
}[];
|
|
15
|
-
type?: TypeOverride;
|
|
16
|
-
} & Partial<{}>> & import("vue").PublicProps;
|
|
4
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & OmegaInputProps<From, To> & Partial<{}>> & import("vue").PublicProps;
|
|
17
5
|
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
18
6
|
attrs: any;
|
|
19
7
|
slots: {
|
|
@@ -19,13 +19,17 @@ declare const _default: <From extends Record<PropertyKey, any>, To extends Recor
|
|
|
19
19
|
form?: undefined;
|
|
20
20
|
schema: S.Schema<From, To, never>;
|
|
21
21
|
}))) & Partial<{}>> & import("vue").PublicProps;
|
|
22
|
-
expose(exposed: import("vue").ShallowUnwrapRef<
|
|
22
|
+
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
23
23
|
attrs: any;
|
|
24
24
|
slots: {
|
|
25
|
-
default
|
|
25
|
+
default(): void;
|
|
26
|
+
internalForm(props: {
|
|
26
27
|
form: OmegaFormReturn<To, From>;
|
|
27
28
|
subscribedValues: K[] extends undefined[] ? Record<string, never> : Pick<OmegaFormState<To, From>, K>;
|
|
28
|
-
})
|
|
29
|
+
}): void;
|
|
30
|
+
externalForm(props: {
|
|
31
|
+
subscribedValues: K[] extends undefined[] ? Record<string, never> : Pick<OmegaFormState<To, From>, K>;
|
|
32
|
+
}): void;
|
|
29
33
|
};
|
|
30
34
|
emit: {};
|
|
31
35
|
}>) => import("vue").VNode & {
|
|
@@ -6,48 +6,8 @@ export * from "./OmegaFormStuff";
|
|
|
6
6
|
export { useOmegaForm } from "./useOmegaForm";
|
|
7
7
|
export { default } from "./OmegaWrapper.vue";
|
|
8
8
|
export { OmegaForm, OmegaInput, OmegaErrors };
|
|
9
|
-
declare const OmegaFormCE:
|
|
10
|
-
|
|
11
|
-
subscribe?: K[] | undefined;
|
|
12
|
-
showErrorsOn?: import("./OmegaFormStuff").ShowErrorsOn | undefined;
|
|
13
|
-
form: import("./useOmegaForm").OmegaFormReturn<To, From>;
|
|
14
|
-
schema?: undefined | undefined;
|
|
15
|
-
} | {
|
|
16
|
-
omegaConfig?: import("./useOmegaForm").OmegaConfig<From> | undefined;
|
|
17
|
-
subscribe?: K[] | undefined;
|
|
18
|
-
showErrorsOn?: import("./OmegaFormStuff").ShowErrorsOn | undefined;
|
|
19
|
-
defaultValues?: To | undefined;
|
|
20
|
-
defaultState?: Partial<import("@tanstack/vue-form").FormState<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>> | undefined;
|
|
21
|
-
asyncAlways?: boolean | undefined;
|
|
22
|
-
asyncDebounceMs?: number | undefined;
|
|
23
|
-
validators?: import("@tanstack/vue-form").FormValidators<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> | undefined;
|
|
24
|
-
onSubmitMeta?: import("@tanstack/vue-form").FormAsyncValidateOrFn<To> | undefined;
|
|
25
|
-
onSubmitInvalid?: ((props: {
|
|
26
|
-
value: To;
|
|
27
|
-
formApi: import("@tanstack/vue-form").FormApi<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>;
|
|
28
|
-
}) => void) | undefined;
|
|
29
|
-
transform?: import("@tanstack/vue-form").FormTransform<NoInfer<To>, NoInfer<import("@tanstack/vue-form").FormValidateOrFn<To> | undefined>, NoInfer<import("@tanstack/vue-form").FormValidateOrFn<To> | undefined>, NoInfer<import("@tanstack/vue-form").StandardSchemaV1<To, From>>, NoInfer<import("@tanstack/vue-form").FormValidateOrFn<To> | undefined>, NoInfer<import("@tanstack/vue-form").FormAsyncValidateOrFn<To> | undefined>, NoInfer<import("@tanstack/vue-form").FormValidateOrFn<To> | undefined>, NoInfer<import("@tanstack/vue-form").FormAsyncValidateOrFn<To> | undefined>, NoInfer<import("@tanstack/vue-form").FormAsyncValidateOrFn<To> | undefined>, NoInfer<import("@tanstack/vue-form").FormAsyncValidateOrFn<To> | undefined>> | undefined;
|
|
30
|
-
onSubmit?: ((props: {
|
|
31
|
-
formApi: import("./OmegaFormStuff").OmegaFormParams<To, From>;
|
|
32
|
-
meta: any;
|
|
33
|
-
value: From;
|
|
34
|
-
}) => Promise<any> | any) | undefined;
|
|
35
|
-
form?: undefined | undefined;
|
|
36
|
-
schema: import("effect/Schema").Schema<From, To, never>;
|
|
37
|
-
}) & import("vue").VNodeProps) & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps);
|
|
38
|
-
declare const OmegaInputCE: new <From, To>(initialProps?: Record<string, any>) => import("vue").VueElement & {
|
|
39
|
-
form: import("./OmegaFormStuff").FormType<From, To> & {
|
|
40
|
-
meta: import("./OmegaFormStuff").MetaRecord<To>;
|
|
41
|
-
};
|
|
42
|
-
name: import("@tanstack/vue-form").DeepKeys<To>;
|
|
43
|
-
validators?: import("./OmegaFormStuff").FieldValidators<From> | undefined;
|
|
44
|
-
label: string;
|
|
45
|
-
options?: {
|
|
46
|
-
title: string;
|
|
47
|
-
value: string;
|
|
48
|
-
}[] | undefined;
|
|
49
|
-
type?: import("./OmegaFormStuff").TypeOverride | undefined;
|
|
50
|
-
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
|
|
9
|
+
declare const OmegaFormCE: import("vue").VueElementConstructor<unknown>;
|
|
10
|
+
declare const OmegaInputCE: import("vue").VueElementConstructor<unknown>;
|
|
51
11
|
declare const OmegaErrorsCE: import("vue").VueElementConstructor<unknown>;
|
|
52
12
|
export { OmegaFormCE, OmegaInputCE, OmegaErrorsCE };
|
|
53
13
|
export declare function registerOmegaForm(): void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Record, S } from "effect-app";
|
|
2
|
-
import { type NestedKeyOf, type FilterItems, type FormProps, type MetaRecord, type OmegaFormApi } from "./OmegaFormStuff";
|
|
2
|
+
import { type NestedKeyOf, type FilterItems, type FormProps, type MetaRecord, type OmegaFormApi, type OmegaInputProps } from "./OmegaFormStuff";
|
|
3
|
+
import { type DefineComponent } from "vue";
|
|
3
4
|
type keysRule<T> = {
|
|
4
5
|
keys?: NestedKeyOf<T>[];
|
|
5
6
|
banKeys?: "You should only use one of banKeys or keys, not both, moron";
|
|
@@ -18,10 +19,13 @@ export type OmegaConfig<T> = {
|
|
|
18
19
|
id?: string;
|
|
19
20
|
} & keysRule<T>;
|
|
20
21
|
};
|
|
21
|
-
|
|
22
|
+
interface OF<To, From> extends OmegaFormApi<To, From> {
|
|
22
23
|
meta: MetaRecord<To>;
|
|
23
24
|
filterItems?: FilterItems;
|
|
24
25
|
clear: () => void;
|
|
25
26
|
}
|
|
27
|
+
export interface OmegaFormReturn<To, From> extends OF<To, From> {
|
|
28
|
+
Input: DefineComponent<Omit<OmegaInputProps<From, To>, "form">, {}, {}>;
|
|
29
|
+
}
|
|
26
30
|
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>;
|
|
27
31
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useStore as
|
|
3
|
-
import { getOmegaStore as
|
|
4
|
-
import { provideOmegaErrors as
|
|
5
|
-
import { useOmegaForm as
|
|
6
|
-
const
|
|
1
|
+
import { defineComponent as h, computed as m, watch as F, createElementBlock as c, openBlock as d, withModifiers as y, createElementVNode as O, unref as i, renderSlot as l, createCommentVNode as E, Fragment as M } from "vue";
|
|
2
|
+
import { useStore as p } from "@tanstack/vue-form";
|
|
3
|
+
import { getOmegaStore as V } from "./vue-components.es18.js";
|
|
4
|
+
import { provideOmegaErrors as w } from "./vue-components.es4.js";
|
|
5
|
+
import { useOmegaForm as I } from "./vue-components.es5.js";
|
|
6
|
+
const k = ["disabled"], j = /* @__PURE__ */ h({
|
|
7
7
|
__name: "OmegaWrapper",
|
|
8
8
|
props: {
|
|
9
9
|
omegaConfig: {},
|
|
@@ -21,47 +21,57 @@ const w = ["disabled"], A = /* @__PURE__ */ d({
|
|
|
21
21
|
transform: {},
|
|
22
22
|
onSubmit: { type: Function }
|
|
23
23
|
},
|
|
24
|
-
setup(
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
r.
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
setup(b) {
|
|
25
|
+
const t = b, n = m(() => {
|
|
26
|
+
if (!(t.form || !t.schema))
|
|
27
|
+
return I(t.schema, t, t.omegaConfig);
|
|
28
|
+
}), r = m(() => t.form ?? n.value), v = p(
|
|
29
|
+
r.value.store,
|
|
30
|
+
(e) => e.isSubmitting
|
|
31
|
+
), f = V(
|
|
32
|
+
r.value,
|
|
33
|
+
t.subscribe
|
|
34
|
+
), g = p(
|
|
35
|
+
r.value.store,
|
|
32
36
|
(e) => e.submissionAttempts
|
|
33
|
-
),
|
|
34
|
-
return
|
|
35
|
-
() => [
|
|
37
|
+
), u = m(() => r.value.useStore((e) => e.errors));
|
|
38
|
+
return F(
|
|
39
|
+
() => [r.value.filterItems, u.value.value],
|
|
36
40
|
() => {
|
|
37
|
-
const e =
|
|
38
|
-
return e ? s
|
|
41
|
+
const e = r.value.filterItems, s = u.value.value;
|
|
42
|
+
return e ? s ? (Object.values(s).filter(
|
|
39
43
|
(o) => !!o
|
|
40
44
|
).flatMap(
|
|
41
|
-
(o) => Object.values(o).flat().map((
|
|
45
|
+
(o) => Object.values(o).flat().map((a) => a.message)
|
|
42
46
|
).some((o) => o === e.message) && e.items.forEach((o) => {
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
...
|
|
47
|
+
const a = r.value.getFieldMeta(o);
|
|
48
|
+
a && r.value.setFieldMeta(o, {
|
|
49
|
+
...a,
|
|
46
50
|
errorMap: {
|
|
47
|
-
onSubmit: [
|
|
51
|
+
onSubmit: [
|
|
52
|
+
{ path: [o], message: e.message }
|
|
53
|
+
]
|
|
48
54
|
}
|
|
49
55
|
});
|
|
50
56
|
}), {}) : {} : {};
|
|
51
57
|
}
|
|
52
|
-
),
|
|
58
|
+
), w(g, u.value, t.showErrorsOn), (e, s) => (d(), c("form", {
|
|
53
59
|
novalidate: "",
|
|
54
|
-
onSubmit:
|
|
60
|
+
onSubmit: s[0] || (s[0] = y((S) => r.value.handleSubmit(), ["prevent", "stop"]))
|
|
55
61
|
}, [
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
O("fieldset", { disabled: i(v) }, [
|
|
63
|
+
t.form ? (d(), c(M, { key: 0 }, [
|
|
64
|
+
l(e.$slots, "externalForm", { subscribedValues: i(f) }, void 0, !0),
|
|
65
|
+
l(e.$slots, "default", {}, void 0, !0)
|
|
66
|
+
], 64)) : n.value ? l(e.$slots, "internalForm", {
|
|
67
|
+
key: 1,
|
|
68
|
+
form: n.value,
|
|
69
|
+
subscribedValues: i(f)
|
|
70
|
+
}, void 0, !0) : E("", !0)
|
|
71
|
+
], 8, k)
|
|
62
72
|
], 32));
|
|
63
73
|
}
|
|
64
74
|
});
|
|
65
75
|
export {
|
|
66
|
-
|
|
76
|
+
j as default
|
|
67
77
|
};
|
|
@@ -1,95 +1,4 @@
|
|
|
1
|
-
|
|
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.es20.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
|
-
});
|
|
1
|
+
const o = (n) => typeof n == "function";
|
|
93
2
|
export {
|
|
94
|
-
|
|
3
|
+
o as isFunction
|
|
95
4
|
};
|
|
@@ -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.es20.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
|
-
|
|
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
|
};
|