fix: 修复嵌套模式当列隐藏时不显示展开按钮问题 Close: #8301

This commit is contained in:
2betop 2023-10-07 20:21:46 +08:00
parent 1ca520ef25
commit a4a7fcda71
2 changed files with 8 additions and 3 deletions

View File

@ -51,7 +51,6 @@ export const Column = types
toggable: true,
expandable: false,
checkdisable: false,
isPrimary: false,
searchable: types.maybe(types.frozen()),
enableSearch: true,
sortable: false,
@ -67,6 +66,13 @@ export const Column = types
remark: types.optional(types.frozen(), undefined),
className: types.union(types.string, types.frozen())
})
.views(self => ({
get isPrimary() {
const table = getParent(self, 2) as any;
return table.filteredColumns[0]?.id === self.id;
}
}))
.actions(self => ({
toggleToggle(min = 1) {
self.toggled = !self.toggled;
@ -1016,7 +1022,6 @@ export const TableStore = iRendererStore
pristine: item.pristine || item,
toggled: item.toggled !== false,
breakpoint: item.breakpoint,
isPrimary: index === PARTITION_INDEX,
/** 提前映射变量方便后续view中使用 */
label: isPureVariable(item.label)
? resolveVariableAndFilter(item.label, self.data)

View File

@ -169,7 +169,7 @@ export default function Cell({
);
}
return [prefix, affix, addtionalClassName];
}, [item.expandable, item.expanded]);
}, [item.expandable, item.expanded, column.isPrimary]);
// 根据条件缓存 data避免孩子重复渲染
const hasCustomTrackExpression =