UNPKG

element-plus

Version:

A Component Library for Vue 3

128 lines (127 loc) 5.5 kB
import type { ExtractPublicPropTypes } from 'vue'; import type { ComponentSize } from 'element-plus/es/constants'; import type { FormItemProp } from './form-item'; import type { FormRules } from './types'; export interface FormMetaProps { /** * @description Control the size of components in this form. */ size?: ComponentSize; /** * @description Whether to disable all components in this form. If set to `true`, it will override the `disabled` prop of the inner component. */ disabled?: boolean; } /** * @deprecated Removed after 3.0.0, Use `FormMetaProps` instead. */ export declare const formMetaProps: { readonly size: { readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", unknown>>; readonly required: false; readonly validator: ((val: unknown) => boolean) | undefined; __epPropKey: true; }; readonly disabled: BooleanConstructor; }; export interface FormProps extends FormMetaProps { /** * @description Data of form component. */ model?: Record<string, any>; /** * @description Validation rules of form. */ rules?: FormRules; /** * @description Position of label. If set to `'left'` or `'right'`, `label-width` prop is also required. */ labelPosition?: 'left' | 'right' | 'top'; /** * @description Position of asterisk. */ requireAsteriskPosition?: 'left' | 'right'; /** * @description Width of label, e.g. `'50px'`. All its direct child form items will inherit this value. `auto` is supported. */ labelWidth?: string | number; /** * @description Suffix of the label. */ labelSuffix?: string; /** * @description Whether the form is inline. */ inline?: boolean; /** * @description Whether to display the error message inline with the form item. */ inlineMessage?: boolean; /** * @description Whether to display an icon indicating the validation result. */ statusIcon?: boolean; /** * @description Whether to show the error message. */ showMessage?: boolean; /** * @description Whether to trigger validation when the `rules` prop is changed. */ validateOnRuleChange?: boolean; /** * @description Whether to hide required fields should have a red asterisk (star) beside their labels. */ hideRequiredAsterisk?: boolean; /** * @description When validation fails, scroll to the first error form entry. */ scrollToError?: boolean; /** * @description When validation fails, it scrolls to the first error item based on the scrollIntoView option. */ scrollIntoViewOptions?: ScrollIntoViewOptions | boolean; } /** * @deprecated Removed after 3.0.0, Use `FormProps` instead. */ export declare const formProps: { readonly model: ObjectConstructor; readonly rules: { readonly type: import("vue").PropType<Partial<Record<string, import("element-plus/es/utils").Arrayable<import("./types").FormItemRule>>>>; readonly required: false; readonly validator: ((val: unknown) => boolean) | undefined; __epPropKey: true; }; readonly labelPosition: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "left" | "right" | "top", unknown, "right", boolean>; readonly requireAsteriskPosition: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "left" | "right", unknown, "left", boolean>; readonly labelWidth: import("element-plus/es/utils").EpPropFinalized<readonly [StringConstructor, NumberConstructor], unknown, unknown, "", boolean>; readonly labelSuffix: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>; readonly inline: BooleanConstructor; readonly inlineMessage: BooleanConstructor; readonly statusIcon: BooleanConstructor; readonly showMessage: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>; readonly validateOnRuleChange: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>; readonly hideRequiredAsterisk: BooleanConstructor; readonly scrollToError: BooleanConstructor; readonly scrollIntoViewOptions: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => boolean | ScrollIntoViewOptions) | (() => boolean | ScrollIntoViewOptions) | ((new (...args: any[]) => boolean | ScrollIntoViewOptions) | (() => boolean | ScrollIntoViewOptions))[], unknown, unknown, true, boolean>; readonly size: { readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", unknown>>; readonly required: false; readonly validator: ((val: unknown) => boolean) | undefined; __epPropKey: true; }; readonly disabled: BooleanConstructor; }; /** * @deprecated Removed after 3.0.0, Use `FormProps` instead. */ export type FormPropsPublic = ExtractPublicPropTypes<typeof formProps>; /** * @deprecated Removed after 3.0.0, Use `FormMetaProps` instead. */ export type FormMetaPropsPublic = ExtractPublicPropTypes<typeof formMetaProps>; export declare const formEmits: { validate: (prop: FormItemProp, isValid: boolean, message: string) => boolean; }; export type FormEmits = typeof formEmits;