@aplus-frontend/ui
Version:
45 lines (44 loc) • 1.84 kB
TypeScript
import { ColumnsType } from '@aplus-frontend/antdv/es/table';
import { ComputedRef, InjectionKey } from 'vue';
import { ApTableContextRenderConfig, ApTableProps } from './interface';
import { Recordable } from '../type';
import { ApFormSearchFormPopoverSorterItem } from '../ap-form';
type TableSize = ApTableProps['size'];
type ApTableContextProps<RecordType> = {
/**
* 表格列配置
*/
columns?: ComputedRef<ColumnsType<RecordType>>;
/**
* 表格列配置备份(只有在props变更后才会变更)
*/
columnsBackup?: ComputedRef<ColumnsType<RecordType>>;
/**
* 更新数据源的方法
* @param name
* @param value
* @param triggerChange 是否触发外部的`onValuesChange`函数
* @returns
*/
updateColumns?: (nextColumns: ColumnsType<RecordType>) => void;
/**
* ApForm内部实例
*/
size?: ComputedRef<TableSize>;
updateSize?: (nextSize: TableSize) => void;
dataSource?: ComputedRef<RecordType[]>;
renderConfig?: ComputedRef<ApTableContextRenderConfig>;
getSearchFormValues?: (transform?: boolean) => (Partial<Recordable> & Recordable<any>) | undefined;
setSearchFormValues?: (values: Partial<Recordable>) => void;
submit?: () => void;
submitWith?: (resetCurrent?: boolean) => void;
reset?: () => void;
refresh?: () => void;
getSearchFormSorterItems?: () => ApFormSearchFormPopoverSorterItem[];
setSearchFormSorterItems?: (sortedItems: ApFormSearchFormPopoverSorterItem[]) => void;
resetSearchFormSorterItems: () => void;
};
export declare const ApTableContextKey: InjectionKey<ApTableContextProps<any>>;
export declare function useProvideApTable<ModelType>(state: ApTableContextProps<ModelType>): void;
export declare function useInjectApTable(): ApTableContextProps<any>;
export {};