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

feat: remove rc-tree and develop the new Tree component #418

Merged
merged 20 commits into from
Oct 11, 2021
Merged

Conversation

mortalYoung
Copy link
Collaborator

@mortalYoung mortalYoung commented Sep 10, 2021

简介

  • 移除 rc-tree 的依赖
  • 开发 Tree 组件

主要变更

已实现的事件如下:

  • onSelectNode
  • onRightClick
  • onDropTree
  • renderTitle
  • onLoadData

其余变更如下:

  • folderTree 的样式层级变更,由于取消了 rc-tree 所以层级里取消去掉 rc-tree 的 class
  • onLoadData 接口的数据类型变更,本来的类型是 rc-tree 的类型

新功能

  • 支持 indent 的样式
  • 支持 onTreeClick 事件,区别于 onSelectNode 事件,treeClick 事件仅在 tree 本身被点击时触发,可以用于重置 tree 的 active 结点

遗留问题

  • 测试代码未删除
  • onDropTree
  • 测试用例

Related Issues

Closed #406

@mortalYoung mortalYoung self-assigned this Sep 10, 2021
@mortalYoung mortalYoung added the refactoring Refactor label Sep 10, 2021
@mortalYoung mortalYoung added this to the 0.9.0-beta.1 milestone Sep 10, 2021
@mortalYoung mortalYoung force-pushed the feat/tree branch 2 times, most recently from b953b02 to cc4b57b Compare September 18, 2021 02:30
@codecov
Copy link

codecov bot commented Sep 18, 2021

Codecov Report

Merging #418 (4453f85) into main (8626600) will increase coverage by 0.39%.
The diff coverage is 93.16%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #418      +/-   ##
==========================================
+ Coverage   80.87%   81.26%   +0.39%     
==========================================
  Files         177      179       +2     
  Lines        4894     5071     +177     
  Branches     1058     1110      +52     
==========================================
+ Hits         3958     4121     +163     
- Misses        927      941      +14     
  Partials        9        9              
Impacted Files Coverage Δ
src/common/event/eventBus.ts 71.42% <0.00%> (-28.58%) ⬇️
src/common/event/eventEmitter.ts 70.83% <0.00%> (-10.12%) ⬇️
src/workbench/sidebar/search/searchPanel.tsx 92.68% <ø> (-2.44%) ⬇️
src/controller/explorer/folderTree.tsx 18.18% <16.66%> (-1.82%) ⬇️
src/components/tree/index.tsx 98.94% <99.42%> (+0.53%) ⬆️
src/components/tree/base.ts 100.00% <100.00%> (ø)
src/components/tree/treeNode.tsx 100.00% <100.00%> (ø)
...c/services/workbench/explorer/folderTreeService.ts 97.39% <100.00%> (+0.02%) ⬆️
src/workbench/sidebar/explore/folderTree.tsx 97.59% <100.00%> (+0.02%) ⬆️
src/workbench/sidebar/search/searchTree.tsx 100.00% <100.00%> (ø)
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8626600...4453f85. Read the comment docs.

@mortalYoung
Copy link
Collaborator Author

mortalYoung commented Sep 22, 2021

breaking changes:

  • dom 层级变化
  • 不再支持 rc-tree 属性,如 defualtExpandAll showLine 等(后续需要可支持)
  • onLoadData 事件参数变化,由 LoadEventData -> ITreeNodeItemProps
  • onRightClick 事件参数变化,由 ({event,node}) -> (event,node)
  • onSelectNode 事件改为 onSelect

@mortalYoung mortalYoung changed the title WIP:feat: remove rc-tree and develop the new Tree component feat: remove rc-tree and develop the new Tree component Sep 22, 2021
Copy link
Collaborator

@wewoor wewoor left a comment

Choose a reason for hiding this comment

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

+1

@wewoor wewoor merged commit 8690180 into main Oct 11, 2021
@wewoor wewoor deleted the feat/tree branch October 11, 2021 01:57
@mortalYoung mortalYoung restored the feat/tree branch October 11, 2021 06:13
@mortalYoung mortalYoung deleted the feat/tree branch October 11, 2021 06:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The Tree component refactoring
2 participants