add alpha branch

This commit is contained in:
就眠儀式
2022-01-27 16:18:16 +08:00
parent 5c79b2b9ba
commit 5ea8b7bf7c
103 changed files with 577 additions and 474 deletions

35
src/types/form.ts Normal file
View 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
View File

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

19
src/types/public.ts Normal file
View 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
View 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
}