This commit is contained in:
2022-11-14 11:59:26 +08:00
parent 0a63adba99
commit 492d0963fe
336 changed files with 70636 additions and 7 deletions

28
types/types/form.d.ts vendored Normal file
View File

@@ -0,0 +1,28 @@
import type { ValidateCallback, ValidateError, ValidateMessages } from "async-validator";
export interface LayFormContext {
model: modelType;
required?: boolean;
requiredErrorMessage?: string;
validateMessage: ValidateMessages;
rules?: Record<string, unknown>;
useCN: boolean;
requiredIcons?: string;
addField: (field: LayFormItemContext) => void;
}
export interface LayFormItemContext {
prop?: string;
$el: HTMLDivElement;
required?: boolean;
rules?: Record<string, unknown>;
validate(callback?: ValidateCallback): void;
clearValidate(): void;
}
export declare type modelType = {
[key: string]: any;
};
export declare interface FormCallback {
(isValid?: boolean, model?: modelType, errors?: ValidateError[] | null): void;
}
export declare interface FieldValidateError extends ValidateError {
label?: string;
}

3
types/types/index.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
export * from "./public";
export * from "./select";
export * from "./form";

17
types/types/public.d.ts vendored Normal file
View File

@@ -0,0 +1,17 @@
import type { App, DefineComponent, Ref } from "vue";
export declare type StringObject = Record<string, unknown>;
export declare type UnknownObject = Record<string | number, unknown>;
export declare type UnknownFunction = (...arg: unknown[]) => unknown;
export declare type IDefineComponent<Props = UnknownObject> = DefineComponent<Props> & {
install: (app: App, options?: InstallOptions) => void;
};
export interface InstallOptions extends StringObject {
}
export declare type Nullable<T> = T | null;
export declare type MaybeRef<T> = Ref<T> | T;
export declare type Recordable = Record<string, any>;
export declare type Number = number;
export declare type String = string;
export declare type Boolean = boolean;
export declare type NumberOrString = number | string;
export declare type BooleanOrString = boolean | string;

13
types/types/select.d.ts vendored Normal file
View File

@@ -0,0 +1,13 @@
export declare type SelectValueType = string | string[] | number | number[] | null;
export interface SelectItem {
value?: SelectValueType;
label?: null | string | string[];
disabled?: boolean;
multiple?: boolean;
}
export interface SelectItemHandle {
(selectItem: SelectItem, isChecked?: boolean): void;
}
export interface SelectItemPush {
(selectItem: SelectItem): void;
}