You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.6 KiB

import type { InjectionKey } from 'vue';
import type { ValidateFieldsError } from 'async-validator';
import type { ComponentSize } from 'element-plus/es/utils/types';
export interface ElFormContext {
registerLabelWidth(width: number, oldWidth: number): void;
deregisterLabelWidth(width: number): void;
autoLabelWidth: string | undefined;
emit: (evt: string, ...args: any[]) => void;
addField: (field: ElFormItemContext) => void;
removeField: (field: ElFormItemContext) => void;
resetFields: () => void;
clearValidate: (props: string | string[]) => void;
validateField: (props: string | string[], cb: ValidateFieldCallback) => void;
labelSuffix: string;
inline?: boolean;
inlineMessage?: boolean;
model?: Record<string, unknown>;
size?: ComponentSize;
showMessage?: boolean;
labelPosition?: string;
labelWidth?: string | number;
rules?: Record<string, unknown>;
statusIcon?: boolean;
hideRequiredAsterisk?: boolean;
disabled?: boolean;
}
export interface ValidateFieldCallback {
(isValid?: string, invalidFields?: ValidateFieldsError): void;
}
export interface ElFormItemContext {
prop?: string;
size?: ComponentSize;
validateState: string;
$el: HTMLDivElement;
validate(trigger: string, callback?: ValidateFieldCallback): void;
updateComputedLabelWidth(width: number): void;
evaluateValidationEnabled(): void;
resetField(): void;
clearValidate(): void;
}
export declare const elFormKey: InjectionKey<ElFormContext>;
export declare const elFormItemKey: InjectionKey<ElFormItemContext>;