|
|
@ -37,6 +37,10 @@ export function useTableExpand( |
|
|
expandedRowKeys.value = keys; |
|
|
expandedRowKeys.value = keys; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function collapseAll() { |
|
|
|
|
|
expandedRowKeys.value = []; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
function expandRows(keys: (string | number)[]) { |
|
|
function expandRows(keys: (string | number)[]) { |
|
|
// use row ID expands the specified table row
|
|
|
// use row ID expands the specified table row
|
|
|
const { isTreeTable } = unref(propsRef); |
|
|
const { isTreeTable } = unref(propsRef); |
|
|
@ -44,6 +48,13 @@ export function useTableExpand( |
|
|
expandedRowKeys.value = [...expandedRowKeys.value, ...keys]; |
|
|
expandedRowKeys.value = [...expandedRowKeys.value, ...keys]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function collapseRows(keys: (string | number)[]) { |
|
|
|
|
|
// use row ID collapses the specified table row
|
|
|
|
|
|
const { isTreeTable } = unref(propsRef); |
|
|
|
|
|
if (!isTreeTable) return; |
|
|
|
|
|
expandedRowKeys.value = unref(expandedRowKeys).filter((key) => !keys.includes(key)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
function getAllKeys(data?: Recordable[]) { |
|
|
function getAllKeys(data?: Recordable[]) { |
|
|
const keys: string[] = []; |
|
|
const keys: string[] = []; |
|
|
const { childrenColumnName } = unref(propsRef); |
|
|
const { childrenColumnName } = unref(propsRef); |
|
|
@ -57,9 +68,5 @@ export function useTableExpand( |
|
|
return keys; |
|
|
return keys; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function collapseAll() { |
|
|
return { getExpandOption, expandAll, collapseAll, expandRows, collapseRows }; |
|
|
expandedRowKeys.value = []; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return { getExpandOption, expandAll, expandRows, collapseAll }; |
|
|
|
|
|
} |
|
|
} |
|
|
|