routie dev init since i didn't adhere to any proper guidance up until now
This commit is contained in:
+595
@@ -0,0 +1,595 @@
|
||||
import type { FieldValidationResult, FormField, FormValidationResult, SubmitEventPromise } from '../../composables/form.js';
|
||||
export declare const makeVFormProps: <Defaults extends {
|
||||
class?: unknown;
|
||||
style?: unknown;
|
||||
disabled?: unknown;
|
||||
fastFail?: unknown;
|
||||
readonly?: unknown;
|
||||
modelValue?: unknown;
|
||||
validateOn?: unknown;
|
||||
} = {}>(defaults?: Defaults | undefined) => {
|
||||
class: unknown extends Defaults["class"] ? import("vue").PropType<any> : {
|
||||
type: import("vue").PropType<unknown extends Defaults["class"] ? any : any>;
|
||||
default: unknown extends Defaults["class"] ? any : any;
|
||||
};
|
||||
style: unknown extends Defaults["style"] ? {
|
||||
type: import("vue").PropType<import("vue").StyleValue>;
|
||||
default: null;
|
||||
} : Omit<{
|
||||
type: import("vue").PropType<import("vue").StyleValue>;
|
||||
default: null;
|
||||
}, "default" | "type"> & {
|
||||
type: import("vue").PropType<unknown extends Defaults["style"] ? import("vue").StyleValue : Defaults["style"] | import("vue").StyleValue>;
|
||||
default: unknown extends Defaults["style"] ? import("vue").StyleValue : Defaults["style"] | NonNullable<import("vue").StyleValue>;
|
||||
};
|
||||
disabled: unknown extends Defaults["disabled"] ? BooleanConstructor : {
|
||||
type: import("vue").PropType<unknown extends Defaults["disabled"] ? boolean : boolean | Defaults["disabled"]>;
|
||||
default: unknown extends Defaults["disabled"] ? boolean : boolean | Defaults["disabled"];
|
||||
};
|
||||
fastFail: unknown extends Defaults["fastFail"] ? BooleanConstructor : {
|
||||
type: import("vue").PropType<unknown extends Defaults["fastFail"] ? boolean : boolean | Defaults["fastFail"]>;
|
||||
default: unknown extends Defaults["fastFail"] ? boolean : boolean | Defaults["fastFail"];
|
||||
};
|
||||
readonly: unknown extends Defaults["readonly"] ? BooleanConstructor : {
|
||||
type: import("vue").PropType<unknown extends Defaults["readonly"] ? boolean : boolean | Defaults["readonly"]>;
|
||||
default: unknown extends Defaults["readonly"] ? boolean : boolean | Defaults["readonly"];
|
||||
};
|
||||
modelValue: unknown extends Defaults["modelValue"] ? {
|
||||
type: import("vue").PropType<boolean | null>;
|
||||
default: null;
|
||||
} : Omit<{
|
||||
type: import("vue").PropType<boolean | null>;
|
||||
default: null;
|
||||
}, "default" | "type"> & {
|
||||
type: import("vue").PropType<unknown extends Defaults["modelValue"] ? boolean | null : boolean | Defaults["modelValue"] | null>;
|
||||
default: unknown extends Defaults["modelValue"] ? boolean | null : Defaults["modelValue"] | NonNullable<boolean | null>;
|
||||
};
|
||||
validateOn: unknown extends Defaults["validateOn"] ? {
|
||||
type: import("vue").PropType<("blur eager" | "blur lazy" | "eager" | "eager blur" | "eager input" | "eager invalid-input" | "eager submit" | "input eager" | "input lazy" | "invalid-input eager" | "invalid-input lazy" | "lazy" | "lazy blur" | "lazy input" | "lazy invalid-input" | "lazy submit" | "submit eager" | "submit lazy" | ("blur" | "input" | "invalid-input" | "submit")) | undefined>;
|
||||
default: string;
|
||||
} : Omit<{
|
||||
type: import("vue").PropType<("blur eager" | "blur lazy" | "eager" | "eager blur" | "eager input" | "eager invalid-input" | "eager submit" | "input eager" | "input lazy" | "invalid-input eager" | "invalid-input lazy" | "lazy" | "lazy blur" | "lazy input" | "lazy invalid-input" | "lazy submit" | "submit eager" | "submit lazy" | ("blur" | "input" | "invalid-input" | "submit")) | undefined>;
|
||||
default: string;
|
||||
}, "default" | "type"> & {
|
||||
type: import("vue").PropType<unknown extends Defaults["validateOn"] ? ("blur eager" | "blur lazy" | "eager" | "eager blur" | "eager input" | "eager invalid-input" | "eager submit" | "input eager" | "input lazy" | "invalid-input eager" | "invalid-input lazy" | "lazy" | "lazy blur" | "lazy input" | "lazy invalid-input" | "lazy submit" | "submit eager" | "submit lazy" | ("blur" | "input" | "invalid-input" | "submit")) | undefined : Defaults["validateOn"] | ("blur eager" | "blur lazy" | "eager" | "eager blur" | "eager input" | "eager invalid-input" | "eager submit" | "input eager" | "input lazy" | "invalid-input eager" | "invalid-input lazy" | "lazy" | "lazy blur" | "lazy input" | "lazy invalid-input" | "lazy submit" | "submit eager" | "submit lazy" | ("blur" | "input" | "invalid-input" | "submit")) | undefined>;
|
||||
default: unknown extends Defaults["validateOn"] ? ("blur eager" | "blur lazy" | "eager" | "eager blur" | "eager input" | "eager invalid-input" | "eager submit" | "input eager" | "input lazy" | "invalid-input eager" | "invalid-input lazy" | "lazy" | "lazy blur" | "lazy input" | "lazy invalid-input" | "lazy submit" | "submit eager" | "submit lazy" | ("blur" | "input" | "invalid-input" | "submit")) | undefined : Defaults["validateOn"] | NonNullable<("blur eager" | "blur lazy" | "eager" | "eager blur" | "eager input" | "eager invalid-input" | "eager submit" | "input eager" | "input lazy" | "invalid-input eager" | "invalid-input lazy" | "lazy" | "lazy blur" | "lazy input" | "lazy invalid-input" | "lazy submit" | "submit eager" | "submit lazy" | ("blur" | "input" | "invalid-input" | "submit")) | undefined>;
|
||||
};
|
||||
};
|
||||
export declare const VForm: {
|
||||
new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<{
|
||||
style: string | false | import("vue").StyleValue[] | import("vue").CSSProperties | null;
|
||||
disabled: boolean;
|
||||
fastFail: boolean;
|
||||
readonly: boolean;
|
||||
modelValue: boolean | null;
|
||||
validateOn: "blur eager" | "blur lazy" | "eager" | "eager blur" | "eager input" | "eager invalid-input" | "eager submit" | "input eager" | "input lazy" | "invalid-input eager" | "invalid-input lazy" | "lazy" | "lazy blur" | "lazy input" | "lazy invalid-input" | "lazy submit" | "submit eager" | "submit lazy" | ("blur" | "input" | "invalid-input" | "submit");
|
||||
} & {
|
||||
class?: any;
|
||||
} & {
|
||||
$children?: {
|
||||
default?: ((arg: {
|
||||
errors: FieldValidationResult[];
|
||||
isDisabled: boolean;
|
||||
isReadonly: boolean;
|
||||
isValidating: boolean;
|
||||
isValid: boolean | null;
|
||||
items: FormField[];
|
||||
validate: () => Promise<FormValidationResult>;
|
||||
reset: () => void;
|
||||
resetValidation: () => void;
|
||||
}) => import("vue").VNodeChild) | undefined;
|
||||
} | {
|
||||
$stable?: boolean;
|
||||
} | ((arg: {
|
||||
errors: FieldValidationResult[];
|
||||
isDisabled: boolean;
|
||||
isReadonly: boolean;
|
||||
isValidating: boolean;
|
||||
isValid: boolean | null;
|
||||
items: FormField[];
|
||||
validate: () => Promise<FormValidationResult>;
|
||||
reset: () => void;
|
||||
resetValidation: () => void;
|
||||
}) => import("vue").VNodeChild) | import("vue").VNodeChild;
|
||||
'v-slots'?: {
|
||||
default?: false | ((arg: {
|
||||
errors: FieldValidationResult[];
|
||||
isDisabled: boolean;
|
||||
isReadonly: boolean;
|
||||
isValidating: boolean;
|
||||
isValid: boolean | null;
|
||||
items: FormField[];
|
||||
validate: () => Promise<FormValidationResult>;
|
||||
reset: () => void;
|
||||
resetValidation: () => void;
|
||||
}) => import("vue").VNodeChild) | undefined;
|
||||
} | undefined;
|
||||
} & {
|
||||
"v-slot:default"?: false | ((arg: {
|
||||
errors: FieldValidationResult[];
|
||||
isDisabled: boolean;
|
||||
isReadonly: boolean;
|
||||
isValidating: boolean;
|
||||
isValid: boolean | null;
|
||||
items: FormField[];
|
||||
validate: () => Promise<FormValidationResult>;
|
||||
reset: () => void;
|
||||
resetValidation: () => void;
|
||||
}) => import("vue").VNodeChild) | undefined;
|
||||
} & {
|
||||
onSubmit?: ((e: SubmitEventPromise) => any) | undefined;
|
||||
"onUpdate:modelValue"?: ((val: boolean | null) => any) | undefined;
|
||||
}, {
|
||||
errors: import("vue").Ref<{
|
||||
id: number | string;
|
||||
errorMessages: string[];
|
||||
}[], FieldValidationResult[] | {
|
||||
id: number | string;
|
||||
errorMessages: string[];
|
||||
}[]>;
|
||||
isDisabled: Readonly<import("vue").Ref<boolean, boolean>>;
|
||||
isReadonly: Readonly<import("vue").Ref<boolean, boolean>>;
|
||||
isValidating: import("vue").ShallowRef<boolean, boolean>;
|
||||
isValid: import("vue").Ref<boolean | null, boolean | null> & {
|
||||
readonly externalValue: boolean | null;
|
||||
};
|
||||
items: import("vue").Ref<{
|
||||
id: number | string;
|
||||
validate: () => Promise<string[]>;
|
||||
reset: () => Promise<void>;
|
||||
resetValidation: () => Promise<void>;
|
||||
vm: import("vue").Raw<import("vue").ComponentInternalInstance>;
|
||||
isValid: boolean | null;
|
||||
errorMessages: string[];
|
||||
}[], FormField[] | {
|
||||
id: number | string;
|
||||
validate: () => Promise<string[]>;
|
||||
reset: () => Promise<void>;
|
||||
resetValidation: () => Promise<void>;
|
||||
vm: import("vue").Raw<import("vue").ComponentInternalInstance>;
|
||||
isValid: boolean | null;
|
||||
errorMessages: string[];
|
||||
}[]>;
|
||||
validate: () => Promise<{
|
||||
valid: boolean;
|
||||
errors: {
|
||||
id: number | string;
|
||||
errorMessages: string[];
|
||||
}[];
|
||||
}>;
|
||||
reset: () => void;
|
||||
resetValidation: () => void;
|
||||
} & HTMLFormElement & {
|
||||
_allExposed: {
|
||||
errors: import("vue").Ref<{
|
||||
id: number | string;
|
||||
errorMessages: string[];
|
||||
}[], FieldValidationResult[] | {
|
||||
id: number | string;
|
||||
errorMessages: string[];
|
||||
}[]>;
|
||||
isDisabled: Readonly<import("vue").Ref<boolean, boolean>>;
|
||||
isReadonly: Readonly<import("vue").Ref<boolean, boolean>>;
|
||||
isValidating: import("vue").ShallowRef<boolean, boolean>;
|
||||
isValid: import("vue").Ref<boolean | null, boolean | null> & {
|
||||
readonly externalValue: boolean | null;
|
||||
};
|
||||
items: import("vue").Ref<{
|
||||
id: number | string;
|
||||
validate: () => Promise<string[]>;
|
||||
reset: () => Promise<void>;
|
||||
resetValidation: () => Promise<void>;
|
||||
vm: import("vue").Raw<import("vue").ComponentInternalInstance>;
|
||||
isValid: boolean | null;
|
||||
errorMessages: string[];
|
||||
}[], FormField[] | {
|
||||
id: number | string;
|
||||
validate: () => Promise<string[]>;
|
||||
reset: () => Promise<void>;
|
||||
resetValidation: () => Promise<void>;
|
||||
vm: import("vue").Raw<import("vue").ComponentInternalInstance>;
|
||||
isValid: boolean | null;
|
||||
errorMessages: string[];
|
||||
}[]>;
|
||||
validate: () => Promise<{
|
||||
valid: boolean;
|
||||
errors: {
|
||||
id: number | string;
|
||||
errorMessages: string[];
|
||||
}[];
|
||||
}>;
|
||||
reset: () => void;
|
||||
resetValidation: () => void;
|
||||
};
|
||||
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
||||
'update:modelValue': (val: boolean | null) => true;
|
||||
submit: (e: SubmitEventPromise) => true;
|
||||
}, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, {
|
||||
style: import("vue").StyleValue;
|
||||
disabled: boolean;
|
||||
fastFail: boolean;
|
||||
readonly: boolean;
|
||||
modelValue: boolean | null;
|
||||
validateOn: ("blur eager" | "blur lazy" | "eager" | "eager blur" | "eager input" | "eager invalid-input" | "eager submit" | "input eager" | "input lazy" | "invalid-input eager" | "invalid-input lazy" | "lazy" | "lazy blur" | "lazy input" | "lazy invalid-input" | "lazy submit" | "submit eager" | "submit lazy" | ("blur" | "input" | "invalid-input" | "submit")) | undefined;
|
||||
}, true, {}, import("vue").SlotsType<Partial<{
|
||||
default: (arg: {
|
||||
errors: FieldValidationResult[];
|
||||
isDisabled: boolean;
|
||||
isReadonly: boolean;
|
||||
isValidating: boolean;
|
||||
isValid: boolean | null;
|
||||
items: FormField[];
|
||||
validate: () => Promise<FormValidationResult>;
|
||||
reset: () => void;
|
||||
resetValidation: () => void;
|
||||
}) => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
||||
[key: string]: any;
|
||||
}>[];
|
||||
}>>, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
||||
P: {};
|
||||
B: {};
|
||||
D: {};
|
||||
C: {};
|
||||
M: {};
|
||||
Defaults: {};
|
||||
}, {
|
||||
style: string | false | import("vue").StyleValue[] | import("vue").CSSProperties | null;
|
||||
disabled: boolean;
|
||||
fastFail: boolean;
|
||||
readonly: boolean;
|
||||
modelValue: boolean | null;
|
||||
validateOn: "blur eager" | "blur lazy" | "eager" | "eager blur" | "eager input" | "eager invalid-input" | "eager submit" | "input eager" | "input lazy" | "invalid-input eager" | "invalid-input lazy" | "lazy" | "lazy blur" | "lazy input" | "lazy invalid-input" | "lazy submit" | "submit eager" | "submit lazy" | ("blur" | "input" | "invalid-input" | "submit");
|
||||
} & {
|
||||
class?: any;
|
||||
} & {
|
||||
$children?: {
|
||||
default?: ((arg: {
|
||||
errors: FieldValidationResult[];
|
||||
isDisabled: boolean;
|
||||
isReadonly: boolean;
|
||||
isValidating: boolean;
|
||||
isValid: boolean | null;
|
||||
items: FormField[];
|
||||
validate: () => Promise<FormValidationResult>;
|
||||
reset: () => void;
|
||||
resetValidation: () => void;
|
||||
}) => import("vue").VNodeChild) | undefined;
|
||||
} | {
|
||||
$stable?: boolean;
|
||||
} | ((arg: {
|
||||
errors: FieldValidationResult[];
|
||||
isDisabled: boolean;
|
||||
isReadonly: boolean;
|
||||
isValidating: boolean;
|
||||
isValid: boolean | null;
|
||||
items: FormField[];
|
||||
validate: () => Promise<FormValidationResult>;
|
||||
reset: () => void;
|
||||
resetValidation: () => void;
|
||||
}) => import("vue").VNodeChild) | import("vue").VNodeChild;
|
||||
'v-slots'?: {
|
||||
default?: false | ((arg: {
|
||||
errors: FieldValidationResult[];
|
||||
isDisabled: boolean;
|
||||
isReadonly: boolean;
|
||||
isValidating: boolean;
|
||||
isValid: boolean | null;
|
||||
items: FormField[];
|
||||
validate: () => Promise<FormValidationResult>;
|
||||
reset: () => void;
|
||||
resetValidation: () => void;
|
||||
}) => import("vue").VNodeChild) | undefined;
|
||||
} | undefined;
|
||||
} & {
|
||||
"v-slot:default"?: false | ((arg: {
|
||||
errors: FieldValidationResult[];
|
||||
isDisabled: boolean;
|
||||
isReadonly: boolean;
|
||||
isValidating: boolean;
|
||||
isValid: boolean | null;
|
||||
items: FormField[];
|
||||
validate: () => Promise<FormValidationResult>;
|
||||
reset: () => void;
|
||||
resetValidation: () => void;
|
||||
}) => import("vue").VNodeChild) | undefined;
|
||||
} & {
|
||||
onSubmit?: ((e: SubmitEventPromise) => any) | undefined;
|
||||
"onUpdate:modelValue"?: ((val: boolean | null) => any) | undefined;
|
||||
}, {
|
||||
errors: import("vue").Ref<{
|
||||
id: number | string;
|
||||
errorMessages: string[];
|
||||
}[], FieldValidationResult[] | {
|
||||
id: number | string;
|
||||
errorMessages: string[];
|
||||
}[]>;
|
||||
isDisabled: Readonly<import("vue").Ref<boolean, boolean>>;
|
||||
isReadonly: Readonly<import("vue").Ref<boolean, boolean>>;
|
||||
isValidating: import("vue").ShallowRef<boolean, boolean>;
|
||||
isValid: import("vue").Ref<boolean | null, boolean | null> & {
|
||||
readonly externalValue: boolean | null;
|
||||
};
|
||||
items: import("vue").Ref<{
|
||||
id: number | string;
|
||||
validate: () => Promise<string[]>;
|
||||
reset: () => Promise<void>;
|
||||
resetValidation: () => Promise<void>;
|
||||
vm: import("vue").Raw<import("vue").ComponentInternalInstance>;
|
||||
isValid: boolean | null;
|
||||
errorMessages: string[];
|
||||
}[], FormField[] | {
|
||||
id: number | string;
|
||||
validate: () => Promise<string[]>;
|
||||
reset: () => Promise<void>;
|
||||
resetValidation: () => Promise<void>;
|
||||
vm: import("vue").Raw<import("vue").ComponentInternalInstance>;
|
||||
isValid: boolean | null;
|
||||
errorMessages: string[];
|
||||
}[]>;
|
||||
validate: () => Promise<{
|
||||
valid: boolean;
|
||||
errors: {
|
||||
id: number | string;
|
||||
errorMessages: string[];
|
||||
}[];
|
||||
}>;
|
||||
reset: () => void;
|
||||
resetValidation: () => void;
|
||||
} & HTMLFormElement & {
|
||||
_allExposed: {
|
||||
errors: import("vue").Ref<{
|
||||
id: number | string;
|
||||
errorMessages: string[];
|
||||
}[], FieldValidationResult[] | {
|
||||
id: number | string;
|
||||
errorMessages: string[];
|
||||
}[]>;
|
||||
isDisabled: Readonly<import("vue").Ref<boolean, boolean>>;
|
||||
isReadonly: Readonly<import("vue").Ref<boolean, boolean>>;
|
||||
isValidating: import("vue").ShallowRef<boolean, boolean>;
|
||||
isValid: import("vue").Ref<boolean | null, boolean | null> & {
|
||||
readonly externalValue: boolean | null;
|
||||
};
|
||||
items: import("vue").Ref<{
|
||||
id: number | string;
|
||||
validate: () => Promise<string[]>;
|
||||
reset: () => Promise<void>;
|
||||
resetValidation: () => Promise<void>;
|
||||
vm: import("vue").Raw<import("vue").ComponentInternalInstance>;
|
||||
isValid: boolean | null;
|
||||
errorMessages: string[];
|
||||
}[], FormField[] | {
|
||||
id: number | string;
|
||||
validate: () => Promise<string[]>;
|
||||
reset: () => Promise<void>;
|
||||
resetValidation: () => Promise<void>;
|
||||
vm: import("vue").Raw<import("vue").ComponentInternalInstance>;
|
||||
isValid: boolean | null;
|
||||
errorMessages: string[];
|
||||
}[]>;
|
||||
validate: () => Promise<{
|
||||
valid: boolean;
|
||||
errors: {
|
||||
id: number | string;
|
||||
errorMessages: string[];
|
||||
}[];
|
||||
}>;
|
||||
reset: () => void;
|
||||
resetValidation: () => void;
|
||||
};
|
||||
}, {}, {}, {}, {
|
||||
style: import("vue").StyleValue;
|
||||
disabled: boolean;
|
||||
fastFail: boolean;
|
||||
readonly: boolean;
|
||||
modelValue: boolean | null;
|
||||
validateOn: ("blur eager" | "blur lazy" | "eager" | "eager blur" | "eager input" | "eager invalid-input" | "eager submit" | "input eager" | "input lazy" | "invalid-input eager" | "invalid-input lazy" | "lazy" | "lazy blur" | "lazy input" | "lazy invalid-input" | "lazy submit" | "submit eager" | "submit lazy" | ("blur" | "input" | "invalid-input" | "submit")) | undefined;
|
||||
}>;
|
||||
__isFragment?: never;
|
||||
__isTeleport?: never;
|
||||
__isSuspense?: never;
|
||||
} & import("vue").ComponentOptionsBase<{
|
||||
style: string | false | import("vue").StyleValue[] | import("vue").CSSProperties | null;
|
||||
disabled: boolean;
|
||||
fastFail: boolean;
|
||||
readonly: boolean;
|
||||
modelValue: boolean | null;
|
||||
validateOn: "blur eager" | "blur lazy" | "eager" | "eager blur" | "eager input" | "eager invalid-input" | "eager submit" | "input eager" | "input lazy" | "invalid-input eager" | "invalid-input lazy" | "lazy" | "lazy blur" | "lazy input" | "lazy invalid-input" | "lazy submit" | "submit eager" | "submit lazy" | ("blur" | "input" | "invalid-input" | "submit");
|
||||
} & {
|
||||
class?: any;
|
||||
} & {
|
||||
$children?: {
|
||||
default?: ((arg: {
|
||||
errors: FieldValidationResult[];
|
||||
isDisabled: boolean;
|
||||
isReadonly: boolean;
|
||||
isValidating: boolean;
|
||||
isValid: boolean | null;
|
||||
items: FormField[];
|
||||
validate: () => Promise<FormValidationResult>;
|
||||
reset: () => void;
|
||||
resetValidation: () => void;
|
||||
}) => import("vue").VNodeChild) | undefined;
|
||||
} | {
|
||||
$stable?: boolean;
|
||||
} | ((arg: {
|
||||
errors: FieldValidationResult[];
|
||||
isDisabled: boolean;
|
||||
isReadonly: boolean;
|
||||
isValidating: boolean;
|
||||
isValid: boolean | null;
|
||||
items: FormField[];
|
||||
validate: () => Promise<FormValidationResult>;
|
||||
reset: () => void;
|
||||
resetValidation: () => void;
|
||||
}) => import("vue").VNodeChild) | import("vue").VNodeChild;
|
||||
'v-slots'?: {
|
||||
default?: false | ((arg: {
|
||||
errors: FieldValidationResult[];
|
||||
isDisabled: boolean;
|
||||
isReadonly: boolean;
|
||||
isValidating: boolean;
|
||||
isValid: boolean | null;
|
||||
items: FormField[];
|
||||
validate: () => Promise<FormValidationResult>;
|
||||
reset: () => void;
|
||||
resetValidation: () => void;
|
||||
}) => import("vue").VNodeChild) | undefined;
|
||||
} | undefined;
|
||||
} & {
|
||||
"v-slot:default"?: false | ((arg: {
|
||||
errors: FieldValidationResult[];
|
||||
isDisabled: boolean;
|
||||
isReadonly: boolean;
|
||||
isValidating: boolean;
|
||||
isValid: boolean | null;
|
||||
items: FormField[];
|
||||
validate: () => Promise<FormValidationResult>;
|
||||
reset: () => void;
|
||||
resetValidation: () => void;
|
||||
}) => import("vue").VNodeChild) | undefined;
|
||||
} & {
|
||||
onSubmit?: ((e: SubmitEventPromise) => any) | undefined;
|
||||
"onUpdate:modelValue"?: ((val: boolean | null) => any) | undefined;
|
||||
}, {
|
||||
errors: import("vue").Ref<{
|
||||
id: number | string;
|
||||
errorMessages: string[];
|
||||
}[], FieldValidationResult[] | {
|
||||
id: number | string;
|
||||
errorMessages: string[];
|
||||
}[]>;
|
||||
isDisabled: Readonly<import("vue").Ref<boolean, boolean>>;
|
||||
isReadonly: Readonly<import("vue").Ref<boolean, boolean>>;
|
||||
isValidating: import("vue").ShallowRef<boolean, boolean>;
|
||||
isValid: import("vue").Ref<boolean | null, boolean | null> & {
|
||||
readonly externalValue: boolean | null;
|
||||
};
|
||||
items: import("vue").Ref<{
|
||||
id: number | string;
|
||||
validate: () => Promise<string[]>;
|
||||
reset: () => Promise<void>;
|
||||
resetValidation: () => Promise<void>;
|
||||
vm: import("vue").Raw<import("vue").ComponentInternalInstance>;
|
||||
isValid: boolean | null;
|
||||
errorMessages: string[];
|
||||
}[], FormField[] | {
|
||||
id: number | string;
|
||||
validate: () => Promise<string[]>;
|
||||
reset: () => Promise<void>;
|
||||
resetValidation: () => Promise<void>;
|
||||
vm: import("vue").Raw<import("vue").ComponentInternalInstance>;
|
||||
isValid: boolean | null;
|
||||
errorMessages: string[];
|
||||
}[]>;
|
||||
validate: () => Promise<{
|
||||
valid: boolean;
|
||||
errors: {
|
||||
id: number | string;
|
||||
errorMessages: string[];
|
||||
}[];
|
||||
}>;
|
||||
reset: () => void;
|
||||
resetValidation: () => void;
|
||||
} & HTMLFormElement & {
|
||||
_allExposed: {
|
||||
errors: import("vue").Ref<{
|
||||
id: number | string;
|
||||
errorMessages: string[];
|
||||
}[], FieldValidationResult[] | {
|
||||
id: number | string;
|
||||
errorMessages: string[];
|
||||
}[]>;
|
||||
isDisabled: Readonly<import("vue").Ref<boolean, boolean>>;
|
||||
isReadonly: Readonly<import("vue").Ref<boolean, boolean>>;
|
||||
isValidating: import("vue").ShallowRef<boolean, boolean>;
|
||||
isValid: import("vue").Ref<boolean | null, boolean | null> & {
|
||||
readonly externalValue: boolean | null;
|
||||
};
|
||||
items: import("vue").Ref<{
|
||||
id: number | string;
|
||||
validate: () => Promise<string[]>;
|
||||
reset: () => Promise<void>;
|
||||
resetValidation: () => Promise<void>;
|
||||
vm: import("vue").Raw<import("vue").ComponentInternalInstance>;
|
||||
isValid: boolean | null;
|
||||
errorMessages: string[];
|
||||
}[], FormField[] | {
|
||||
id: number | string;
|
||||
validate: () => Promise<string[]>;
|
||||
reset: () => Promise<void>;
|
||||
resetValidation: () => Promise<void>;
|
||||
vm: import("vue").Raw<import("vue").ComponentInternalInstance>;
|
||||
isValid: boolean | null;
|
||||
errorMessages: string[];
|
||||
}[]>;
|
||||
validate: () => Promise<{
|
||||
valid: boolean;
|
||||
errors: {
|
||||
id: number | string;
|
||||
errorMessages: string[];
|
||||
}[];
|
||||
}>;
|
||||
reset: () => void;
|
||||
resetValidation: () => void;
|
||||
};
|
||||
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
||||
'update:modelValue': (val: boolean | null) => true;
|
||||
submit: (e: SubmitEventPromise) => true;
|
||||
}, string, {
|
||||
style: import("vue").StyleValue;
|
||||
disabled: boolean;
|
||||
fastFail: boolean;
|
||||
readonly: boolean;
|
||||
modelValue: boolean | null;
|
||||
validateOn: ("blur eager" | "blur lazy" | "eager" | "eager blur" | "eager input" | "eager invalid-input" | "eager submit" | "input eager" | "input lazy" | "invalid-input eager" | "invalid-input lazy" | "lazy" | "lazy blur" | "lazy input" | "lazy invalid-input" | "lazy submit" | "submit eager" | "submit lazy" | ("blur" | "input" | "invalid-input" | "submit")) | undefined;
|
||||
}, {}, string, import("vue").SlotsType<Partial<{
|
||||
default: (arg: {
|
||||
errors: FieldValidationResult[];
|
||||
isDisabled: boolean;
|
||||
isReadonly: boolean;
|
||||
isValidating: boolean;
|
||||
isValid: boolean | null;
|
||||
items: FormField[];
|
||||
validate: () => Promise<FormValidationResult>;
|
||||
reset: () => void;
|
||||
resetValidation: () => void;
|
||||
}) => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
||||
[key: string]: any;
|
||||
}>[];
|
||||
}>>, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & import("../../util/index.js").FilterPropsOptions<{
|
||||
class: import("vue").PropType<any>;
|
||||
style: {
|
||||
type: import("vue").PropType<import("vue").StyleValue>;
|
||||
default: null;
|
||||
};
|
||||
disabled: BooleanConstructor;
|
||||
fastFail: BooleanConstructor;
|
||||
readonly: BooleanConstructor;
|
||||
modelValue: {
|
||||
type: import("vue").PropType<boolean | null>;
|
||||
default: null;
|
||||
};
|
||||
validateOn: {
|
||||
type: import("vue").PropType<("blur eager" | "blur lazy" | "eager" | "eager blur" | "eager input" | "eager invalid-input" | "eager submit" | "input eager" | "input lazy" | "invalid-input eager" | "invalid-input lazy" | "lazy" | "lazy blur" | "lazy input" | "lazy invalid-input" | "lazy submit" | "submit eager" | "submit lazy" | ("blur" | "input" | "invalid-input" | "submit")) | undefined>;
|
||||
default: string;
|
||||
};
|
||||
}, import("vue").ExtractPropTypes<{
|
||||
class: import("vue").PropType<any>;
|
||||
style: {
|
||||
type: import("vue").PropType<import("vue").StyleValue>;
|
||||
default: null;
|
||||
};
|
||||
disabled: BooleanConstructor;
|
||||
fastFail: BooleanConstructor;
|
||||
readonly: BooleanConstructor;
|
||||
modelValue: {
|
||||
type: import("vue").PropType<boolean | null>;
|
||||
default: null;
|
||||
};
|
||||
validateOn: {
|
||||
type: import("vue").PropType<("blur eager" | "blur lazy" | "eager" | "eager blur" | "eager input" | "eager invalid-input" | "eager submit" | "input eager" | "input lazy" | "invalid-input eager" | "invalid-input lazy" | "lazy" | "lazy blur" | "lazy input" | "lazy invalid-input" | "lazy submit" | "submit eager" | "submit lazy" | ("blur" | "input" | "invalid-input" | "submit")) | undefined>;
|
||||
default: string;
|
||||
};
|
||||
}>>;
|
||||
export type VForm = InstanceType<typeof VForm>;
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
import { normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode } from "vue";
|
||||
// Composables
|
||||
import { makeComponentProps } from "../../composables/component.js";
|
||||
import { createForm, makeFormProps } from "../../composables/form.js";
|
||||
import { forwardRefs } from "../../composables/forwardRefs.js"; // Utilities
|
||||
import { ref } from 'vue';
|
||||
import { genericComponent, propsFactory, useRender } from "../../util/index.js"; // Types
|
||||
export const makeVFormProps = propsFactory({
|
||||
...makeComponentProps(),
|
||||
...makeFormProps()
|
||||
}, 'VForm');
|
||||
export const VForm = genericComponent()({
|
||||
name: 'VForm',
|
||||
props: makeVFormProps(),
|
||||
emits: {
|
||||
'update:modelValue': val => true,
|
||||
submit: e => true
|
||||
},
|
||||
setup(props, {
|
||||
slots,
|
||||
emit
|
||||
}) {
|
||||
const form = createForm(props);
|
||||
const formRef = ref();
|
||||
function onReset(e) {
|
||||
e.preventDefault();
|
||||
form.reset();
|
||||
}
|
||||
function onSubmit(_e) {
|
||||
const e = _e;
|
||||
const ready = form.validate();
|
||||
e.then = ready.then.bind(ready);
|
||||
e.catch = ready.catch.bind(ready);
|
||||
e.finally = ready.finally.bind(ready);
|
||||
emit('submit', e);
|
||||
if (!e.defaultPrevented) {
|
||||
ready.then(({
|
||||
valid
|
||||
}) => {
|
||||
if (valid) {
|
||||
formRef.value?.submit();
|
||||
}
|
||||
});
|
||||
}
|
||||
e.preventDefault();
|
||||
}
|
||||
useRender(() => _createElementVNode("form", {
|
||||
"ref": formRef,
|
||||
"class": _normalizeClass(['v-form', props.class]),
|
||||
"style": _normalizeStyle(props.style),
|
||||
"novalidate": true,
|
||||
"onReset": onReset,
|
||||
"onSubmit": onSubmit
|
||||
}, [slots.default?.({
|
||||
errors: form.errors.value,
|
||||
isDisabled: form.isDisabled.value,
|
||||
isReadonly: form.isReadonly.value,
|
||||
isValidating: form.isValidating.value,
|
||||
isValid: form.isValid.value,
|
||||
items: form.items.value,
|
||||
validate: form.validate,
|
||||
reset: form.reset,
|
||||
resetValidation: form.resetValidation
|
||||
})]));
|
||||
return forwardRefs(form, formRef);
|
||||
}
|
||||
});
|
||||
//# sourceMappingURL=VForm.js.map
|
||||
+1
File diff suppressed because one or more lines are too long
+1
@@ -0,0 +1 @@
|
||||
export { VForm } from './VForm.js';
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export { VForm } from "./VForm.js";
|
||||
//# sourceMappingURL=index.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","names":["VForm"],"sources":["../../../src/components/VForm/index.ts"],"sourcesContent":["export { VForm } from './VForm'\n"],"mappings":"SAASA,KAAK","ignoreList":[]}
|
||||
Reference in New Issue
Block a user