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

Support easy-to-use RecycleTree component #93

Closed
erha19 opened this issue Dec 6, 2021 · 3 comments · Fixed by #103
Closed

Support easy-to-use RecycleTree component #93

erha19 opened this issue Dec 6, 2021 · 3 comments · Fixed by #103
Assignees

Comments

@erha19
Copy link
Member

erha19 commented Dec 6, 2021

现状

当前的 @opensumi/ide-components 中实现的 RecycleTree 为了更灵活的组装形式,分离了视图及数据,牺牲了一定使用的便捷性,而以目前的情况去看,许多简化场景下可能不希望自己去组装,而是希望获得一个能快速使用的Tree组件,参考 AntDesign Tree组件 tree

期望

这部分组件功能前期希望能尽量收敛,支持的 Tree 种类希望能为一个最简化的版本,后续可能更多的是由业务方遵循相关开发规范自行在 @opensumi/ide-components 中实现相应的 Tree 组件的方式

@erha19 erha19 self-assigned this Dec 6, 2021
@erha19
Copy link
Member Author

erha19 commented Dec 6, 2021

当前仍在使用 @opensumi/ide-core-browser 中的 DeprecatedRecycleTree 的模块还有 markersearchcomment , 基于依赖情况,第一个简化版需要实现的能力有:

  • 基础节点展示,支持提供 children 的直接展示,也支持传入 resolveChildren 方法处理子节点获取
  • 基础节点属性,如 iconlabeldescriptiontooltip 等属性
  • 基础事件 onClickonDbClickonContextMenuonTwistierClick
  • 额外属性 inlineMenus, inlineMenuActuator , contextMenus, contextMenuActuator属性,用于指定右侧工具栏内容及执行逻辑
  • 基础样式 outlinefoldableitemHeightcontainerStyleheightwidthindentclassName

@erha19
Copy link
Member Author

erha19 commented Dec 7, 2021

补充针对 InlineMenuContextMenu 细节设计:

Tree 上面可以指定 inlineMenuscontextMenus, 伪代码如下:

行内菜单:

<RecycleTree 
  inlineMenus={[
    {
       icon: getExternalIcon('replace'),
       title: localize('search.replace.title'),
       command: 'replaceResult',
       location: TreeViewActionTypes.TreeNode_Right,  // 三个区域,节点左、节点右、父节点上(右侧)
       paramsKey: 'id', // 点击后传递给执行器的参数,默认是整个 Item,这里指定的下面 `params` 的第二个参数 [item, item.id...]
    },
  ]}
  inlineMenuActuator=(command, params) => {.....}    // inlineMenus 点击后的执行逻辑
/>

右键菜单:

<RecycleTree 
  contextMenus={[
    {
       title: localize('search.replace.title'),
       command: 'replaceResult',
       paramsKey: 'id', // 点击后传递给执行器的参数,默认是整个 Item,这里指定的下面 `params` 的第二个参数 [item, item.id...]
    },
  ]}
  contextMenuActuator=(command, params) => {.....}    // contextMenus 点击后的执行逻辑
/>

@erha19
Copy link
Member Author

erha19 commented Dec 7, 2021

同时 inlineMenuscontextMenus 支持函数传入

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 a pull request may close this issue.

1 participant