add alpha branch
This commit is contained in:
35
src/types/form.ts
Normal file
35
src/types/form.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
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
src/types/index.ts
Normal file
3
src/types/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from "./public";
|
||||
export * from "./select";
|
||||
export * from "./form";
|
||||
19
src/types/public.ts
Normal file
19
src/types/public.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import type { App, DefineComponent, Ref } from "vue";
|
||||
|
||||
export type StringObject = Record<string, unknown>;
|
||||
|
||||
export type UnknownObject = Record<string | number, unknown>;
|
||||
|
||||
export type UnknownFunction = (...arg: unknown[]) => unknown;
|
||||
|
||||
export type IDefineComponent<Props = UnknownObject> = DefineComponent<Props> & {
|
||||
install: (app: App, options?: InstallOptions) => void;
|
||||
};
|
||||
|
||||
export interface InstallOptions extends StringObject {}
|
||||
|
||||
export type Nullable<T> = T | null;
|
||||
|
||||
export type MaybeRef<T> = Ref<T> | T;
|
||||
|
||||
export type Recordable = Record<string, any>;
|
||||
15
src/types/select.ts
Normal file
15
src/types/select.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
export 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
|
||||
}
|
||||
Reference in New Issue
Block a user