zp-bee
Version:
zp-bee,是一款基于 Dumi,由 React + TypeScript 开发的组件库 🎉。
49 lines (48 loc) • 2.13 kB
TypeScript
import FormStore, { ItemStore } from './store';
import { FormConfig, ItemStores, FormStoreInterface, AutoValidate, AutoHandle, ItemStoreProps, ErrorsType } from './interface';
/**
* 获取监听的key
* @param keys
* @param formStore
* @returns
*/
export declare function getListenValues<T>(keys: (keyof T)[], formStore: FormStoreInterface<T>): () => T[keyof T][];
/**
* 获取所有值
* @param formStore
* @returns
*/
export declare function getValues<T>(formStore: FormStoreInterface<T>): T;
/**
* 创建联合验证器
* @param autoValidator
* @param formStore
* @param autoValidatorId
* @returns
*/
export declare function createUnionValidator<T>(autoValidator: AutoValidate<T>, formStore: FormStoreInterface<T>, autoValidatorId: string): () => void;
/**
* 创建自动处理器
*/
export declare function createAutoHandle<T>(autoHandle: AutoHandle<T>, formStore: FormStoreInterface<T>): import("mobx").IReactionDisposer;
export declare function createUnionValidate<T>(autoValidator: AutoValidate<T>, formStore: FormStoreInterface<T>, autoValidatorId: string): import("mobx").IReactionDisposer;
export declare function configToItemStore<U, T>(props: ItemStoreProps<U, T>): ItemStore<U, T>;
export declare function parseFormConfigs<T = {}>(formConfigs: {
[P in keyof T]: FormConfig<T[P]>;
}): {
formStore: FormStore<T>;
};
export declare function parseAddFormConfigs<T = {}>(formStore: FormStore<T>, formConfigs: Partial<{
[P in keyof T]: FormConfig<T[P]>;
}>): Partial<ItemStores<T>>;
export declare function genFormId(id: string | string[], replaceId?: string): string;
export declare function searchRequired(id: string | string[], store?: FormStore<any>): boolean;
/**
* 跳转到表单字段处,如果可以focus则自动focus
* @param fieldKey 字典id
* @param options scrollIntoView的配置透传
* @returns 是否跳转成功
*/
export declare const scrollToField: (fieldKey: string, options?: boolean | ScrollIntoViewOptions) => boolean;
export declare function scrollByFormErrors(errs?: ErrorsType<any>): boolean;
export declare function getFirstError(errs?: ErrorsType<any>): string;