Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(table): 修复树状表格多选时父子层级之间的联动交互效果问题 #1012

Closed
wants to merge 2 commits into from

Conversation

richerfu
Copy link
Contributor

🤔 这个 PR 的性质是?

  • 日常 bug 修复
  • 新特性提交
  • 文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • CI/CD 改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他

🔗 相关 Issue

#1004
#996

💡 需求背景和解决方案

📝 更新日志

  • fix(组件名称): 处理问题或特性描述 ...

  • 本条 PR 不需要纳入 Changelog

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充
  • Changelog 已提供或无须提供

@github-actions
Copy link
Contributor

github-actions bot commented Jun 30, 2022

完成

@uyarn
Copy link
Collaborator

uyarn commented Jun 30, 2022

cc @chaishi

@chaishi
Copy link
Collaborator

chaishi commented Jun 30, 2022

树形结构选择相关的,都应该在 useTreeSelect 里面处理。当前处理方式不合适。容易让本身独立的代码逻辑又变得混淆,失去了 Hook 的意义。


export default function useRowSelect(props: TdPrimaryTableProps) {
const { selectedRowKeys, columns, data, rowKey } = props;
export default function useRowSelect(props: TdEnhancedTableProps) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useRowSelect 是 PrimaryTable 的行选中功能,对于这类组件,并没有 EnhancedTable 相关的属性。当前改动不合适

@richerfu
Copy link
Contributor Author

richerfu commented Jul 1, 2022

树形结构选择相关的,都应该在 useTreeSelect 里面处理。当前处理方式不合适。容易让本身独立的代码逻辑又变得混淆,失去了 Hook 的意义。

因为useTreeSelect不是完全独立的,依赖于useRowSelect,选择能力是独立的,但是交互联动还是基于useRowSelect。目前并没有想到更好的能在useTreeSelect中修改能避免这些问题的方案,大佬有更好的方案可以提供到研究下吗?
个人认为这两个Hook并没有太独立

@chaishi
Copy link
Collaborator

chaishi commented Jul 1, 2022

两个 Hook 肯定是独立的,useRowSelect 都是可以独立使用的。PrimaryTable 就是基于 useRowSelect。如果不独立,使用早就有问题了

@richerfu
Copy link
Contributor Author

richerfu commented Jul 1, 2022

两个 Hook 肯定是独立的,useRowSelect 都是可以独立使用的。PrimaryTable 就是基于 useRowSelect。如果不独立,使用早就有问题了

useRowSelect独立的没有问题,但是useTreeSelect的选择也是基于useRowSelect实现的。就是因为独立的原因,导致在树状选择的时候出现了关联issue的问题。

@chaishi
Copy link
Collaborator

chaishi commented Jul 2, 2022

#996

issue 中,已回复,场景较为复杂,PR 挂起,待集中处理。

@chaishi chaishi closed this Jul 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants