@aplus-frontend/ui
Version:
93 lines (92 loc) • 2.67 kB
TypeScript
import { ApFormSearchFormPopoverSorterItem } from '../../ap-form';
import { Recordable } from '../../type';
export interface SaveDataSource {
/** 获取表单数据 */
getSearchFormValues?: (transform?: boolean) => (Partial<Recordable> & Recordable<any>) | undefined;
/** 设置表单数据 */
setSearchFormValues?: (values: Partial<Recordable>) => void;
/** 提交 */
submit?: () => void;
/** 表格submitWith,非表格则和submit传递一致函数即可 */
submitWith?: () => void;
/** 重置 */
reset?: () => void;
/** 获取表单排序 */
getSearchFormSorterItems?: () => ApFormSearchFormPopoverSorterItem[];
/** 设置表单排序 */
setSearchFormSorterItems?: (sortedItems: ApFormSearchFormPopoverSorterItem[]) => void;
/** 重置表单排序 */
resetSearchFormSorterItems?: () => void;
/** 是否转换搜索表单,默认为 false */
searchFormTransform?: boolean;
}
export interface ViewCacheOption {
/** 获取视图列表 */
getViewList?: (option: {
tableKey: string;
}) => Promise<ViewListModel[]>;
/** 添加视图 */
addView?: (option: {
tableKey: string;
viewName: string;
viewKey: string;
viewConfig?: Recordable;
isDefault?: boolean;
}) => Promise<void>;
/** 设置视图 */
changeView?: (option: {
tableKey: string;
viewName: string;
viewKey: string;
viewConfig?: Recordable;
isDefault?: boolean;
}) => Promise<void>;
/** 删除视图 */
removeView?: (option: {
tableKey: string;
viewKey: string;
}) => Promise<void>;
}
export interface ViewListModel {
viewKey: string;
viewName: string;
viewConfig?: Recordable;
isDefault?: boolean;
}
export interface ApViewProps {
/**
* 表格唯一标识
*/
tableKey: string;
/**
* 表格数据来源
*/
saveDataSource?: SaveDataSource;
/**
* 视图缓存配置
*/
viewCacheOption?: ViewCacheOption;
/**
* 视图最大保存数
*/
maxViewNum?: number;
/**
* 指定默认视图为系统视图
*/
isDefaultSystemView?: boolean;
/**
* 指定初始化默认视图为系统视图(仅初始化生效)
*/
isFirstDefaultSystemView?: boolean;
/**
* 是否手动发起第一次网络请求,默认为 false
*/
manual?: boolean;
/**
* 表单项为空时的状态数据,适用于为空时其值不为undefined的情况
*/
emptyData?: Recordable;
}
export interface ApViewExpose {
setFirstDefaultSystemView: (value: boolean) => void;
}