tdesign-vue
Version:
73 lines (72 loc) • 8.56 kB
TypeScript
import { SetupContext } from '@vue/composition-api';
import { SwapParams } from '../../_common/js/table/tree-store';
import { TdEnhancedTableProps, PrimaryTableCol, TableRowData, TableRowValue, TableRowState } from '../type';
export default function useTreeData(props: TdEnhancedTableProps, context: SetupContext): {
store: import("@vue/composition-api").Ref<{
treeDataMap: import("../../_common/js/table/tree-store").TableTreeDataMap;
expandAllRowIndex: 0;
initialTreeStore: (dataSource: import("../../_common/js/table/types").TableRowData[], columns: import("../../_common/js/table/types").PlainObject[], keys: import("../../_common/js/table/tree-store").KeysType) => void;
getAllUniqueKeys: (data: import("../../_common/js/table/types").TableRowData[], keys: import("../../_common/js/table/tree-store").KeysType, arr?: import("../../_common/js/table/types").TableRowData[]) => import("../../_common/js/table/types").TableRowData[];
getExpandedChildrenKeys: (data: import("../../_common/js/table/types").TableRowData[], keys: import("../../_common/js/table/tree-store").KeysType, arr?: (string | number)[]) => (string | number)[];
expandTreeNode: (rowList: (string | number)[], dataSource: import("../../_common/js/table/types").TableRowData[], keys: import("../../_common/js/table/tree-store").KeysType) => import("../../_common/js/table/types").TableRowData[];
foldTreeNode: (rowList: (string | number)[], dataSource: import("../../_common/js/table/types").TableRowData[], keys: import("../../_common/js/table/tree-store").KeysType) => import("../../_common/js/table/types").TableRowData[];
toggleExpandData: (p: {
rowIndex: number;
row: import("../../_common/js/table/types").TableRowData;
}, dataSource: import("../../_common/js/table/types").TableRowData[], keys: import("../../_common/js/table/tree-store").KeysType, type?: "expand" | "fold") => import("../../_common/js/table/types").TableRowData[];
updateExpandRow: (changeRow: import("../../_common/js/table/types").TableRowState<import("../../_common/js/table/types").TableRowData>, dataSource: import("../../_common/js/table/types").TableRowData[], keys: import("../../_common/js/table/tree-store").KeysType) => import("../../_common/js/table/types").TableRowData[];
getData: (key: import("../../_common/js/table/types").TableRowValue) => import("../../_common/js/table/types").TableRowState<import("../../_common/js/table/types").TableRowData>;
updateData: (rowValue: import("../../_common/js/table/types").TableRowValue, newRowData: import("../../_common/js/table/types").TableRowData, dataSource: import("../../_common/js/table/types").TableRowData[], keys: import("../../_common/js/table/tree-store").KeysType) => number;
remove: (key: import("../../_common/js/table/types").TableRowValue, dataSource: import("../../_common/js/table/types").TableRowData[], keys: import("../../_common/js/table/tree-store").KeysType) => import("../../_common/js/table/types").TableRowData[];
removeChildren: (key: import("../../_common/js/table/types").TableRowValue, dataSource: import("../../_common/js/table/types").TableRowData[], keys: import("../../_common/js/table/tree-store").KeysType) => import("../../_common/js/table/types").TableRowData[];
appendTo: (rowValue: string | number, newData: import("../../_common/js/table/types").TableRowData | import("../../_common/js/table/types").TableRowData[], dataSource: import("../../_common/js/table/types").TableRowData[], keys: import("../../_common/js/table/tree-store").KeysType) => import("../../_common/js/table/types").TableRowData[];
appendToRoot: (newData: import("../../_common/js/table/types").TableRowData | import("../../_common/js/table/types").TableRowData[], dataSource: import("../../_common/js/table/types").TableRowData[], keys: import("../../_common/js/table/tree-store").KeysType) => import("../../_common/js/table/types").TableRowData[];
insertAfter: (rowValue: string | number, newData: import("../../_common/js/table/types").TableRowData, dataSource: import("../../_common/js/table/types").TableRowData[], keys: import("../../_common/js/table/tree-store").KeysType) => import("../../_common/js/table/types").TableRowData[];
insertBefore: (rowValue: string | number, newData: import("../../_common/js/table/types").TableRowData, dataSource: import("../../_common/js/table/types").TableRowData[], keys: import("../../_common/js/table/tree-store").KeysType) => import("../../_common/js/table/types").TableRowData[];
insert: (rowValue: string | number, newData: import("../../_common/js/table/types").TableRowData, dataSource: import("../../_common/js/table/types").TableRowData[], keys: import("../../_common/js/table/tree-store").KeysType, type: "after" | "before") => import("../../_common/js/table/types").TableRowData[];
swapData: (dataSource: import("../../_common/js/table/types").TableRowData[], params: SwapParams<import("../../_common/js/table/types").TableRowData>, keys: import("../../_common/js/table/tree-store").KeysType) => {
dataSource: import("../../_common/js/table/types").TableRowData[];
result: boolean;
code?: number;
reason?: string;
};
expandAll: (dataSource: import("../../_common/js/table/types").TableRowData[], keys: import("../../_common/js/table/tree-store").KeysType) => import("../../_common/js/table/types").TableRowData[];
foldAll: (dataSource: import("../../_common/js/table/types").TableRowData[], keys: import("../../_common/js/table/tree-store").KeysType) => import("../../_common/js/table/types").TableRowData[];
getTreeNode: (dataSource: import("../../_common/js/table/types").TableRowData[], keys: import("../../_common/js/table/tree-store").KeysType) => import("../../_common/js/table/types").TableRowData[];
getTreeExpandedRow: (dataSource: import("../../_common/js/table/types").TableRowData[], keys: import("../../_common/js/table/tree-store").KeysType, type?: "all" | "data" | "unique") => any[];
initialTreeDataMap: (treeDataMap: import("../../_common/js/table/tree-store").TableTreeDataMap, dataSource: import("../../_common/js/table/types").TableRowData[], column: import("../../_common/js/table/types").PlainObject, keys: import("../../_common/js/table/tree-store").KeysType, level?: number, parent?: import("../../_common/js/table/types").TableRowState<import("../../_common/js/table/types").TableRowData>) => void;
updateDisabledState: (dataSource: import("../../_common/js/table/types").TableRowData[], column: import("../../_common/js/table/types").PlainObject, keys: import("../../_common/js/table/tree-store").KeysType) => void;
validateDataExist: (state: import("../../_common/js/table/types").TableRowState<import("../../_common/js/table/types").TableRowData>, rowValue: string | number) => boolean;
validateDataDoubleExist: (state: import("../../_common/js/table/types").TableRowState<import("../../_common/js/table/types").TableRowData>, rowValue: string | number) => boolean;
}>;
rowDataKeys: import("@vue/composition-api").ComputedRef<{
rowKey: string;
childrenKey: string;
}>;
dataSource: import("@vue/composition-api").Ref<{
[x: string]: any;
children?: any[];
}[]>;
swapData: (params: SwapParams<TableRowData>) => void;
setData: <T>(key: TableRowValue, newRowData: T) => void;
getData: (key: TableRowValue) => TableRowState;
remove: (key: TableRowValue) => void;
removeChildren: (key: TableRowValue) => void;
appendTo: <T_1>(key: TableRowValue, newData: T_1 | T_1[]) => void;
insertAfter: <T_2>(rowValue: TableRowValue, newData: T_2) => void;
insertBefore: <T_3>(rowValue: TableRowValue, newData: T_3) => void;
formatTreeColumn: (col: PrimaryTableCol) => PrimaryTableCol;
toggleExpandData: (p: {
row: TableRowData;
rowIndex: number;
}, trigger?: 'expand-fold-icon' | 'row-click') => void;
expandAll: (type?: "default-expand-all" | "expand-all", list?: TableRowData[]) => void;
foldAll: () => void;
getTreeNode: () => import("../../_common/js/table/types").TableRowData[];
resetData: (data: TableRowData[]) => void;
getTreeExpandedRow: (type?: 'unique' | 'data' | 'all') => any[];
onExpandFoldIconClick: (p: {
row: TableRowData;
rowIndex: number;
}, trigger?: "expand-fold-icon" | "row-click") => void;
};