Skip to content

Commit

Permalink
fix(table): 兼容树状表格未传入tree属性的场景 (#1002)
Browse files Browse the repository at this point in the history
  • Loading branch information
richerfu authored Jun 30, 2022
1 parent 5d40920 commit 626f811
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/table/hooks/useTreeSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ export default function useTreeSelect(props: TdEnhancedTableProps, treeDataMap:
function handleSelectAll(extraData: SelectChangeParams[1]) {
const newRowKeys: Array<string | number> = [];
const newRowData: TableRowData[] = [];
if (extraData.type === 'check') {
if (extraData?.type === 'check') {
const arr = [...treeDataMap.values()];
for (let i = 0, len = arr.length; i < len; i++) {
const item = arr[i];
if (!item.disabled) {
if (!item?.disabled) {
newRowData.push(item.row);
newRowKeys.push(get(item.row, rowDataKeys.rowKey));
}
Expand All @@ -128,7 +128,7 @@ export default function useTreeSelect(props: TdEnhancedTableProps, treeDataMap:

function handleSelect(rowKeys: SelectChangeParams[0], extraData: SelectChangeParams[1]) {
let newRowKeys = [...rowKeys];
if (props?.tree.checkStrictly === false) {
if (props?.tree?.checkStrictly === false) {
if (extraData?.type === 'check') {
const result = getChildrenData(
treeDataMap,
Expand Down

0 comments on commit 626f811

Please sign in to comment.