element-plus
Version:
A Component Library for Vue 3
95 lines (94 loc) • 3.52 kB
TypeScript
import type { Arrayable } from 'element-plus/es/utils';
import type { FormProps } from './form';
import type { FormItemContext, FormValidateCallback, FormValidationResult } from './types';
import type { FormItemProp } from './form-item';
declare var __VLS_1: {};
type __VLS_Slots = {} & {
default?: (props: typeof __VLS_1) => any;
};
declare const __VLS_base: import("vue").DefineComponent<__VLS_WithDefaultsLocal<__VLS_TypePropsToOption<FormProps>, {
labelPosition: string;
requireAsteriskPosition: string;
labelWidth: string;
labelSuffix: string;
showMessage: boolean;
validateOnRuleChange: boolean;
scrollIntoViewOptions: boolean;
}>, {
/**
* @description Validate the whole form. Receives a callback or returns `Promise`.
*/
validate: (callback?: FormValidateCallback) => FormValidationResult;
/**
* @description Validate specified fields.
*/
validateField: (props?: Arrayable<FormItemProp>, callback?: FormValidateCallback) => FormValidationResult;
/**
* @description Reset specified fields and remove validation result.
*/
resetFields: (props?: Arrayable<FormItemProp>) => void;
/**
* @description Clear validation message for specified fields.
*/
clearValidate: (props?: Arrayable<FormItemProp>) => void;
/**
* @description Scroll to the specified fields.
*/
scrollToField: (prop: FormItemProp) => void;
/**
* @description Get a field context.
*/
getField: (prop: FormItemProp) => FormItemContext | undefined;
/**
* @description All fields context.
*/
fields: import("vue").Reactive<FormItemContext[]>;
/**
* @description Set initial values for form fields. When `resetFields` is called, fields will reset to these values. Only fields present in `initModel` will be updated.
*/
setInitialValues: (initModel: Record<string, any>) => void;
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
validate: (prop: FormItemProp, isValid: boolean, message: string) => void;
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaultsLocal<__VLS_TypePropsToOption<FormProps>, {
labelPosition: string;
requireAsteriskPosition: string;
labelWidth: string;
labelSuffix: string;
showMessage: boolean;
validateOnRuleChange: boolean;
scrollIntoViewOptions: boolean;
}>>> & {
onValidate?: ((prop: FormItemProp, isValid: boolean, message: string) => any) | undefined;
}, {
labelWidth: string | number;
labelPosition: "left" | "right" | "top";
showMessage: boolean;
requireAsteriskPosition: "left" | "right";
labelSuffix: string;
validateOnRuleChange: boolean;
scrollIntoViewOptions: ScrollIntoViewOptions | boolean;
}, {}>;
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
declare const _default: typeof __VLS_export;
export default _default;
type __VLS_TypePropsToOption<T> = {
[K in keyof T]-?: {} extends Pick<T, K> ? {
type: import('vue').PropType<Required<T>[K]>;
} : {
type: import('vue').PropType<T[K]>;
required: true;
};
};
type __VLS_WithDefaultsLocal<P, D> = {
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
default: D[K];
}> : P[K];
};
type __VLS_WithSlots<T, S> = T & {
new (): {
$slots: S;
};
};
type __VLS_PrettifyLocal<T> = {
[K in keyof T as K]: T[K];
} & {};