@jiaozhiye/qm-design-vue
Version:
A Component Library for Vue3.0
86 lines (85 loc) • 3.73 kB
TypeScript
import { Ref, ComputedRef } from 'vue';
import type { ITableRef } from './useTableVar';
import type { getRowKeyType, ITableProps, IColumn, IFetchParams, IPagination, IRecord, IRowKey, IRule, IValidItem, InsertMode, ToolBoxRef, TableBodyRef, ColumnDefineRef } from '../table/types';
type IExtra = {
getRowKey: getRowKeyType;
tableVar: ITableRef;
toolBoxRef: Ref<ToolBoxRef | undefined>;
tableBodyRef: Ref<TableBodyRef | undefined>;
columnFilterRef: Ref<ColumnDefineRef | undefined>;
flattenColumns: ComputedRef<IColumn[]>;
editableColumns: ComputedRef<IColumn[]>;
pagination: Ref<IPagination>;
fetchParams: ComputedRef<IFetchParams>;
selectionKeys: Ref<IRowKey[]>;
rowExpandedKeys: Ref<IRowKey[]>;
highlightKey: Ref<IRowKey>;
isFetch: ComputedRef<boolean>;
dataChange: () => void;
getTableData: () => Promise<void>;
handleTableData: (records: IRecord[]) => void;
createTableData: (records: IRecord[]) => void;
createTableFullData: (records: IRecord[]) => void;
calcTableHeight: () => void;
scrollXToColumn: (dataIndex: string, index?: number) => void;
scrollYToRecord: (rowKey: IRowKey, index?: number) => void;
doFieldValidate: (rules: IRule[], val: unknown, rowKey: IRowKey, columnKey: string, columnTitle: string) => void;
setTableOriginData: (records: IRecord[]) => void;
setHandleState: (option: ITableRef['handleState']) => void;
forceUpdate: () => void;
setColumnsDefined: (value: boolean) => void;
setSelectionKeysEffect: (rowKeys: IRowKey[]) => void;
setRowExpandedKeys: (rowKeys: IRowKey[]) => void;
setHighlightKey: (rowKey: IRowKey) => void;
setSelectionRows: (records: IRecord[]) => void;
setOriginColumns: (columns: IColumn[]) => void;
getTableLog: () => {
required: IValidItem[];
validate: IValidItem[];
inserted: IRecord[];
updated: IRecord[];
removed: IRecord[];
};
clearRowSelection: () => void;
clearRowHighlight: () => void;
clearTableSorter: () => void;
clearTableFilter: () => void;
clearSuperFilters: () => void;
clearTableLog: () => void;
};
declare const useImperativeMethod: <T extends ITableProps>(props: T, extra: IExtra) => {
CALCULATE_HEIGHT: () => void;
DO_REFRESH: (callback: () => void) => Promise<void>;
GET_LOG: () => {
required: IValidItem[];
validate: IValidItem[];
inserted: IRecord[];
updated: IRecord[];
removed: IRecord[];
};
GET_FETCH_PARAMS: () => IFetchParams;
CLEAR_TABLE_DATA: () => void;
CLEAR_LOG: () => void;
CREATE_FOCUS: (rowKey: IRowKey, dataIndex: string) => void;
FORCE_UPDATE: () => void;
DO_EXPORT: () => void;
SCROLL_TO_RECORD: (rowKey: IRowKey) => void;
SCROLL_TO_COLUMN: (dataIndex: string) => void;
SET_SELECTION: (rowKeys: IRowKey[], preventEvent?: boolean) => void;
SET_HIGHLIGHT: (rowKey: IRowKey) => void;
SET_EXPANDABLE: (rowKeys: IRowKey[], preventEvent?: boolean) => void;
SET_SELECTION_ROWS: (records: IRecord[]) => void;
SET_TABLE_DATA: (records: IRecord[]) => void;
SET_TABLE_COLUMN: (dataIndex: string, option: Record<string, any>, forceRender?: boolean) => void;
DEFINE_INITIAL_COLUMNS: (columns: IColumn[]) => void;
INSERT_RECORDS: <T_1 extends IRecord<any>>(records: T_1 | T_1[], option?: {
mode?: InsertMode;
parentRowKey?: IRowKey;
}) => void;
REMOVE_RECORDS: <T_2 extends string | number | IRecord<any>>(records: T_2 | T_2[]) => void;
VALIDATE_FIELDS: (rowKeys?: IRowKey[], dataIndexes?: string[]) => {
required: IValidItem[];
validate: IValidItem[];
};
};
export default useImperativeMethod;