tiny-vue icon indicating copy to clipboard operation
tiny-vue copied to clipboard

Feat(tree-menu):[tree-menu] 树折叠时,支持悬浮展示子菜单列表,无子菜单时,悬浮展示tooltip

Open hashiqi12138 opened this issue 8 months ago • 12 comments

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • [x] The commit message follows our Commit Message Guidelines
  • [ ] Tests for the changes have been added (for bug fixes / features)
  • [ ] Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • [ ] Bugfix
  • [x] Feature
  • [ ] Code style update (formatting, local variables)
  • [ ] Refactoring (no functional changes, no api changes)
  • [ ] Build related changes
  • [ ] CI related changes
  • [ ] Documentation content changes
  • [ ] Other... Please describe:

What is the current behavior?

Issue Number: https://github.com/opentiny/tiny-vue/issues/3105

What is the new behavior?

树折叠时,支持悬浮展示子菜单列表,无子菜单时,悬浮展示tooltip

Does this PR introduce a breaking change?

  • [ ] Yes
  • [x] No

Other information

Summary by CodeRabbit

  • New Features
    • Enhanced tree menu components now support interactive pop-up submenus on hover with additional configuration options.
    • Introduced new demos, including one with keyword search and light/dark modes, to showcase dynamic tree menu interactions.
  • Style
    • Updated visual styling with new customizable CSS properties for a refined pop-up menu appearance.
  • Tests
    • Added automated tests to verify tree node interactions, visibility transitions, and filtering capabilities.

hashiqi12138 avatar Mar 25 '25 09:03 hashiqi12138

Walkthrough

This pull request enhances the tree menu component by adding two new properties—expand-menu-popable and popper-class—to control the display of submenus. It introduces several new Vue components that implement pop-up submenu behavior in both Composition API and Classic API formats. A new demo and Playwright test have been added to demonstrate and verify the functionality. Additionally, the renderless function has been updated to enable dependency injection, and new CSS classes and variables support the styling of pop-up menus. The PC view has been refactored for conditional rendering using tooltips or pop-up menus.

Changes

File(s) Change Summary
examples/.../apis/tree-menu.js
packages/vue/.../src/props.ts
Added new properties (expand-menu-popable and popper-class) to the tree-menu component with default values and bilingual descriptions.
examples/.../pop-sub-menu-composition-api.vue
examples/.../pop-sub-menu.vue
packages/vue/.../src/menu-node.vue
packages/vue/.../src/pop-menu.vue
Introduced new Vue components for implementing and rendering tree menus with pop-up submenu functionality using both Composition API and TypeScript.
examples/.../pop-sub-menu.spec.ts Added Playwright tests to verify tree menu interactions, including node visibility, selection, and filtering.
examples/.../webdoc/tree-menu.js Added a new demo entry for the pop-up submenu feature, providing bilingual descriptions and linking to the relevant component.
packages/renderless/.../vue.ts Updated the renderless function to include the provide method for dependency injection, sharing the view model with child components.
packages/theme/.../index.less
packages/theme/.../vars.less
Added new CSS classes, prefixes, and custom properties to support styling for pop-up menus and panels in the tree menu.
packages/vue/.../src/pc.vue Refactored the tree menu's PC view to conditionally render tooltips or pop-up menus based on properties and node structure, integrating new components.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant T as TreeMenu (pc.vue)
    participant P as PopMenu (pop-menu.vue)
    participant N as MenuNode (menu-node.vue)
    
    U->>T: Click on tree node
    T->>T: Check expandMenuPopable & isExpand state
    alt Node has children
        T->>P: Render pop-up menu
        P->>N: Render submenu items
        U->>P: Click on submenu item
        P->>T: Update current node state
    else No children
        T->>T: Display tooltip with node label
    end

Possibly related PRs

  • opentiny/tiny-vue#2534: Addresses property handling in the tree-menu component, similar to the approach for pop-up menus in this update.
  • opentiny/tiny-vue#2588: Involves changes in the tree-menu's PC view and prop management, closely related to the conditional rendering logic added here.
  • opentiny/tiny-vue#2627: Modifies the treeMenuProps object to include new properties, directly aligning with the new configurations introduced in this PR.

Suggested labels

enhancement

Suggested reviewers

  • zzcr

Poem

I'm a rabbit, swift on the run,
Hopping through code under the sun.
New menus pop with a cheerful glow,
Tree nodes dancing, row by row.
With every change, my joy is spun 🐇!

[!WARNING] There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

examples/sites/demos/pc/app/tree-menu/pop-sub-menu-composition-api.vue

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-vue".

(The package "eslint-plugin-vue" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-vue@latest --save-dev

The plugin "eslint-plugin-vue" was referenced from the config file in ".eslintrc.js » @antfu/eslint-config » @antfu/eslint-config-vue".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

examples/sites/demos/pc/app/tree-menu/pop-sub-menu.spec.ts

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-vue".

(The package "eslint-plugin-vue" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-vue@latest --save-dev

The plugin "eslint-plugin-vue" was referenced from the config file in ".eslintrc.js » @antfu/eslint-config » @antfu/eslint-config-vue".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

examples/sites/demos/pc/app/tree-menu/pop-sub-menu.vue

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-vue".

(The package "eslint-plugin-vue" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-vue@latest --save-dev

The plugin "eslint-plugin-vue" was referenced from the config file in ".eslintrc.js » @antfu/eslint-config » @antfu/eslint-config-vue".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

  • 7 others
✨ Finishing Touches
  • [ ] 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar Mar 25 '25 09:03 coderabbitai[bot]

Walkthrough

此PR为树形菜单组件添加了一个新功能:在树折叠时支持悬浮展示子菜单列表,并在无子菜单时悬浮展示tooltip。此功能通过新增属性expand-menu-popablepopper-class实现,并在多个文件中进行了相应的实现和样式调整。

Changes

文件 概要
examples/sites/demos/apis/tree-menu.js 添加了expand-menu-popablepopper-class属性的定义和描述。
examples/sites/demos/pc/app/tree-menu/pop-sub-menu-composition-api.vue 新增了一个示例文件,展示了新功能的使用。
examples/sites/demos/pc/app/tree-menu/pop-sub-menu.spec.ts 新增了测试文件,测试新功能的正确性。
examples/sites/demos/pc/app/tree-menu/pop-sub-menu.vue 新增了一个示例文件,展示了浅色和深色模式下的新功能。
examples/sites/demos/pc/app/tree-menu/webdoc/tree-menu.js 更新了文档,添加了新功能的描述。
packages/renderless/src/tree-menu/vue.ts 在renderless函数中添加了provide方法,支持新功能。
packages/theme/src/tree-menu/index.less 添加了新功能相关的样式定义。
packages/theme/src/tree-menu/vars.less 定义了新功能相关的样式变量。
packages/vue/src/tree-menu/src/menu-node.vue 新增了一个组件文件,用于渲染树节点。
packages/vue/src/tree-menu/src/pc.vue 修改了树节点的渲染逻辑,支持新功能。
packages/vue/src/tree-menu/src/pop-menu.vue 新增了一个组件文件,用于渲染弹出菜单。
packages/vue/src/tree-menu/src/props.ts 添加了expand-menu-popablepopper-class属性的定义。

petercat-assistant[bot] avatar Mar 25 '25 09:03 petercat-assistant[bot]

[e2e-test-warn] The component to be tested is missing.

The title of the Pull request should look like "fix(vue-renderless): [action-menu, alert] fix xxx bug".

Please make sure you've read our contributing guide

github-actions[bot] avatar Mar 25 '25 09:03 github-actions[bot]

Bot detected the issue body's language is not English, translate it automatically.


Walkthrough

This PR adds a new feature to the tree menu component: support for floating display submenu lists when tree collapses, and suspend display tooltip when there is no submenu. This function is implemented by adding the properties expand-menu-popable and popper-class, and has been implemented and styled in multiple files.

Changes

Documents Summary
examples/sites/demos/apis/tree-menu.js Added definition and description of the expand-menu-popable and popper-class properties.
examples/sites/demos/pc/app/tree-menu/pop-sub-menu-composition-api.vue Added a sample file to show the use of new features.
examples/sites/demos/pc/app/tree-menu/pop-sub-menu.spec.ts Added a test file to test the correctness of the new functions.
examples/sites/demos/pc/app/tree-menu/pop-sub-menu.vue Added an example file showing new features in light and dark modes.
examples/sites/demos/pc/app/tree-menu/webdoc/tree-menu.js Updated documentation and added descriptions of new features.
packages/renderless/src/tree-menu/vue.ts Added a provide method in the renderless function to support new functions.
packages/theme/src/tree-menu/index.less Added style definitions related to new features.
packages/theme/src/tree-menu/vars.less Defines style variables related to the new feature.
packages/vue/src/tree-menu/src/menu-node.vue Added a component file for rendering tree nodes.
packages/vue/src/tree-menu/src/pc.vue Modified the rendering logic of the tree node and supports new functions.
packages/vue/src/tree-menu/src/pop-menu.vue Added a component file for rendering pop-up menus.
packages/vue/src/tree-menu/src/props.ts Added definitions for the expand-menu-popable and popper-class properties.

Issues-translate-bot avatar Mar 25 '25 09:03 Issues-translate-bot

在标题中可以用:[tree-menu] 触发下e2e测试用例哈,可以参考下其他的mr或者贡献指南

zzcr avatar Mar 25 '25 13:03 zzcr

Bot detected the issue body's language is not English, translate it automatically.


You can use: [tree-menu] to trigger the e2e test case. You can refer to other mr or contribution guides.

Issues-translate-bot avatar Mar 25 '25 13:03 Issues-translate-bot

e2e测试报错解决一下

wuyiping0628 avatar Apr 15 '25 01:04 wuyiping0628

Bot detected the issue body's language is not English, translate it automatically.


e2e tests are kept resolved

Issues-translate-bot avatar Apr 15 '25 01:04 Issues-translate-bot

@hashiqi12138 E2E测试没哟通过,可以排查下哈

zzcr avatar Apr 30 '25 02:04 zzcr

Bot detected the issue body's language is not English, translate it automatically.


@hashiqi12138 The E2E test failed, you can check it out

Issues-translate-bot avatar Apr 30 '25 02:04 Issues-translate-bot

代码有冲突哈

zzcr avatar Jul 09 '25 08:07 zzcr

Bot detected the issue body's language is not English, translate it automatically.


There is a conflict in the code

Issues-translate-bot avatar Jul 09 '25 08:07 Issues-translate-bot