Skip to content

feat: Modify router select configurator and add tab-bar configurator #1538

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

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

xuanlid
Copy link
Contributor

@xuanlid xuanlid commented Jul 21, 2025

add tab-bar configurator

English | 简体中文

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • 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)
  • Built its own designer, fully self-validated

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • 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:

Background and solution

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • New Features
    • Introduced a new Tab Bar Configurator, allowing users to add, delete, reorder, and edit tab bar items within the design tool.
  • Enhancements
    • Router selection now emits both the name and path of the selected route for improved event detail.
  • Style
    • Added new CSS variables for tab bar background and divider colors to ensure consistent theming.

Copy link
Contributor

coderabbitai bot commented Jul 21, 2025

Walkthrough

A new TabBarConfigurator Vue component and its export were added to the configurator package. The RouterSelectConfigurator component was updated to include the route property in tree data and event payloads. Two new CSS variables for tab bar styling were introduced in the stylesheet.

Changes

File(s) Change Summary
packages/configurator/src/tab-bar-configurator/TabBarConfigurator.vue Added new Vue component for tab bar configuration, supporting add, delete, reorder, and edit of tab items.
packages/configurator/src/index.ts Imported and exported TabBarConfigurator in the configurator module.
packages/configurator/src/router-select-configurator/RouterSelectConfigurator.vue Included route in tree node data, added treeToArray helper, and extended emitted event payload with path.
packages/configurator/src/styles/vars.less Added two CSS variables for tab bar background and divider color.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant TabBarConfigurator
    participant Canvas
    participant History

    User->>TabBarConfigurator: Add/Delete/Reorder/Edit Tab Item
    TabBarConfigurator->>Canvas: Update schema (add, delete, reorder, edit)
    TabBarConfigurator->>History: Record action (for undo/redo)
    Canvas-->>TabBarConfigurator: Confirm schema update
    TabBarConfigurator-->>User: UI updates to reflect changes
Loading

Estimated code review effort

3 (30–60 minutes)

Poem

A new tab bar hops into view,
With colors crisp and actions new.
Routes now travel with the tree,
As styles grow in harmony.
Add, drag, or edit with delight—
The configurator feels just right!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1429298 and e9a5d43.

📒 Files selected for processing (1)
  • packages/configurator/src/router-select-configurator/RouterSelectConfigurator.vue (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/configurator/src/router-select-configurator/RouterSelectConfigurator.vue
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: push-check

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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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.

@github-actions github-actions bot added the enhancement New feature or request label Jul 21, 2025
@xuanlid xuanlid changed the title feat: Modify router select configurator and ad feat: Modify router select configurator and add tab-bar configurator Jul 21, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
packages/configurator/src/tab-bar-configurator/TabBarConfigurator.vue (2)

43-43: Avoid redundant schema retrieval.

The schema is already retrieved at line 43. Consider passing it as a parameter to updateChildrenToValid to avoid calling getSchema() again.

-const updateChildrenToValid = () => {
-  const schema = useProperties().getSchema()
+const updateChildrenToValid = (schema) => {
   const schemaChildren = schema.children || []

And update the call:

 onMounted(() => {
-  updateChildrenToValid()
+  const schema = useProperties().getSchema()
+  updateChildrenToValid(schema)
 })

Also applies to: 49-49


58-60: Consider extracting hardcoded values as constants.

The default text and iconPath URL are hardcoded. Consider extracting them as constants for better maintainability.

+const DEFAULT_TAB_TEXT = '选项标题'
+const DEFAULT_TAB_ICON = 'https://tinyengine-assets.obs.cn-north-4.myhuaweicloud.com/files/harmony/images/tabbar/home.svg'
+
 const updateChildrenToValid = () => {
   // ...
   item.props = {
-    text: '选项标题',
-    iconPath: 'https://tinyengine-assets.obs.cn-north-4.myhuaweicloud.com/files/harmony/images/tabbar/home.svg'
+    text: DEFAULT_TAB_TEXT,
+    iconPath: DEFAULT_TAB_ICON
   }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8502e0b and 1429298.

📒 Files selected for processing (4)
  • packages/configurator/src/index.ts (2 hunks)
  • packages/configurator/src/router-select-configurator/RouterSelectConfigurator.vue (2 hunks)
  • packages/configurator/src/styles/vars.less (1 hunks)
  • packages/configurator/src/tab-bar-configurator/TabBarConfigurator.vue (1 hunks)
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: gene9831
PR: opentiny/tiny-engine#1041
File: packages/plugins/datasource/src/DataSourceList.vue:138-138
Timestamp: 2025-01-14T10:06:25.508Z
Learning: PR #1041 in opentiny/tiny-engine is specifically for reverting Prettier v3 formatting to v2, without any logical code changes or syntax improvements.
Learnt from: rhlin
PR: opentiny/tiny-engine#1011
File: packages/canvas/render/src/RenderMain.ts:82-88
Timestamp: 2025-01-14T08:50:50.226Z
Learning: For PR #1011, the focus is on resolving conflicts and migrating code, with architectural improvements deferred for future PRs.
Learnt from: gene9831
PR: opentiny/tiny-engine#1226
File: packages/canvas/container/src/components/CanvasDivider.vue:184-185
Timestamp: 2025-03-19T03:13:51.520Z
Learning: The CSS bug in packages/canvas/container/src/components/CanvasDivider.vue where verLeft already includes "px" but is being appended again in the style object will be fixed in a future update, as confirmed by gene9831.
Learnt from: gene9831
PR: opentiny/tiny-engine#1011
File: packages/configurator/src/router-select-configurator/RouterSelectConfigurator.vue:20-38
Timestamp: 2025-01-14T06:52:01.277Z
Learning: In RouterSelectConfigurator.vue, the `modelValue` prop only supports String type, not Array.
Learnt from: yy-wow
PR: opentiny/tiny-engine#850
File: packages/toolbars/preview/src/Main.vue:16-16
Timestamp: 2024-10-10T02:47:46.239Z
Learning: In `packages/toolbars/preview/src/Main.vue`, within the `preview` function, the `getMergeMeta` method is used at lines 64 and 65 to retrieve `engine.config` configurations.
Learnt from: rhlin
PR: opentiny/tiny-engine#1011
File: packages/vue-generator/src/plugins/genRouterPlugin.js:122-125
Timestamp: 2025-01-14T11:09:32.013Z
Learning: The router configuration in Vue Generator should maintain the current structure without a catch-all route for 404 handling or modification to the root path prefix, as these are not required at this time.
Learnt from: yy-wow
PR: opentiny/tiny-engine#850
File: packages/toolbars/preview/src/Main.vue:0-0
Timestamp: 2024-10-10T02:48:10.881Z
Learning: 在 `packages/toolbars/preview/src/Main.vue` 文件中,使用 `useNotify` 而不是 `console` 来记录错误日志。
packages/configurator/src/index.ts (4)
Learnt from: yy-wow
PR: opentiny/tiny-engine#850
File: packages/toolbars/preview/src/Main.vue:16-16
Timestamp: 2024-10-10T02:47:46.239Z
Learning: In `packages/toolbars/preview/src/Main.vue`, within the `preview` function, the `getMergeMeta` method is used at lines 64 and 65 to retrieve `engine.config` configurations.
Learnt from: gene9831
PR: opentiny/tiny-engine#1011
File: packages/configurator/src/router-select-configurator/RouterSelectConfigurator.vue:63-73
Timestamp: 2025-01-14T06:49:00.797Z
Learning: In the tiny-engine project, the SvgIcon component is globally registered and available throughout Vue components without requiring explicit imports.
Learnt from: gene9831
PR: opentiny/tiny-engine#1011
File: packages/configurator/src/router-select-configurator/RouterSelectConfigurator.vue:63-73
Timestamp: 2025-01-14T06:49:00.797Z
Learning: In the tiny-engine project, the SvgIcon component is globally registered using `app.component('SvgIcon', SvgIcon)` in `packages/svgs/index.js`, making it available throughout Vue components without requiring explicit imports.
Learnt from: yy-wow
PR: opentiny/tiny-engine#850
File: packages/toolbars/preview/src/Main.vue:0-0
Timestamp: 2024-10-10T02:48:10.881Z
Learning: 在 `packages/toolbars/preview/src/Main.vue` 文件中,使用 `useNotify` 而不是 `console` 来记录错误日志。
packages/configurator/src/styles/vars.less (1)
Learnt from: gene9831
PR: opentiny/tiny-engine#1226
File: packages/canvas/container/src/components/CanvasDivider.vue:184-185
Timestamp: 2025-03-19T03:13:51.520Z
Learning: The CSS bug in packages/canvas/container/src/components/CanvasDivider.vue where verLeft already includes "px" but is being appended again in the style object will be fixed in a future update, as confirmed by gene9831.
packages/configurator/src/router-select-configurator/RouterSelectConfigurator.vue (9)
Learnt from: gene9831
PR: opentiny/tiny-engine#1011
File: packages/plugins/page/src/PageTree.vue:340-345
Timestamp: 2025-01-14T08:37:01.393Z
Learning: The code in PageTree.vue is based on template code copied from elsewhere and will be refactored later, so suggestions for improvements should be deferred until that refactoring occurs.
Learnt from: rhlin
PR: opentiny/tiny-engine#1011
File: packages/vue-generator/src/plugins/genRouterPlugin.js:122-125
Timestamp: 2025-01-14T11:09:32.013Z
Learning: The router configuration in Vue Generator should maintain the current structure without a catch-all route for 404 handling or modification to the root path prefix, as these are not required at this time.
Learnt from: lichunn
PR: opentiny/tiny-engine#1011
File: packages/vue-generator/src/plugins/genRouterPlugin.js:19-19
Timestamp: 2025-01-14T09:24:11.999Z
Learning: In Vue router path construction, when recursively flattening nested routes, starting with empty parentPath for child routes is correct as the parent's path is already captured in the parent route object. This avoids duplicate path segments.
Learnt from: gene9831
PR: opentiny/tiny-engine#1011
File: packages/plugins/page/src/PageGeneral.vue:166-178
Timestamp: 2025-01-14T06:40:18.223Z
Learning: The page structure data in PageGeneral.vue cannot have circular dependencies due to design constraints.
Learnt from: gene9831
PR: opentiny/tiny-engine#1069
File: packages/plugins/page/src/PageGeneral.vue:107-107
Timestamp: 2025-01-24T07:30:38.528Z
Learning: In PageGeneral.vue, `pageParentId.value` is only used to initialize the `oldParentId` ref. After initialization, `oldParentId` is kept in sync with `pageSettingState.oldParentId` through a watchEffect.
Learnt from: chilingling
PR: opentiny/tiny-engine#1440
File: packages/plugins/materials/src/composable/useResource.ts:82-84
Timestamp: 2025-05-28T03:58:31.212Z
Learning: In the TinyEngine codebase, there are two different data structures for page information:
1. App schema components tree (appSchemaState.pageTree) uses nested meta structure with page.meta?.id
2. API responses from pagePluginApi.getPageById() return flattened structure with pageInfo.id and pageInfo.occupier directly
The code should use page.meta?.id when working with pageTree data and pageInfo.id when working with API response data.
Learnt from: gene9831
PR: opentiny/tiny-engine#1011
File: packages/configurator/src/router-select-configurator/RouterSelectConfigurator.vue:20-38
Timestamp: 2025-01-14T06:52:01.277Z
Learning: In RouterSelectConfigurator.vue, the `modelValue` prop only supports String type, not Array.
Learnt from: gene9831
PR: opentiny/tiny-engine#1011
File: packages/plugins/page/src/PageTree.vue:311-346
Timestamp: 2025-01-14T08:27:13.559Z
Learning: In Vue drag-and-drop tree components, the handleMoveNode event handler doesn't need debouncing since the move event is only triggered once when the drop operation is completed, and the drag state is managed by the tree component internally.
Learnt from: gene9831
PR: opentiny/tiny-engine#1011
File: packages/configurator/src/router-select-configurator/RouterSelectConfigurator.vue:95-98
Timestamp: 2025-01-14T06:55:59.692Z
Learning: The tiny-select component from @opentiny/vue library ensures selected options are valid internally, requiring no additional validation in the change handler.
packages/configurator/src/tab-bar-configurator/TabBarConfigurator.vue (5)
Learnt from: yy-wow
PR: opentiny/tiny-engine#850
File: packages/toolbars/preview/src/Main.vue:16-16
Timestamp: 2024-10-10T02:47:46.239Z
Learning: In `packages/toolbars/preview/src/Main.vue`, within the `preview` function, the `getMergeMeta` method is used at lines 64 and 65 to retrieve `engine.config` configurations.
Learnt from: gene9831
PR: opentiny/tiny-engine#830
File: packages/common/component/MetaChildItem.vue:50-56
Timestamp: 2024-10-15T02:45:17.168Z
Learning: In `packages/common/component/MetaChildItem.vue`, when checking if `text` is an object in the computed property `title`, ensure that `text` is not `null` because `typeof null === 'object'` in JavaScript. Use checks like `text && typeof text === 'object'` to safely handle `null` values.
Learnt from: gene9831
PR: opentiny/tiny-engine#1011
File: packages/plugins/page/src/PageTree.vue:340-345
Timestamp: 2025-01-14T08:37:01.393Z
Learning: The code in PageTree.vue is based on template code copied from elsewhere and will be refactored later, so suggestions for improvements should be deferred until that refactoring occurs.
Learnt from: yy-wow
PR: opentiny/tiny-engine#850
File: packages/toolbars/preview/src/Main.vue:0-0
Timestamp: 2024-10-10T02:48:10.881Z
Learning: 在 `packages/toolbars/preview/src/Main.vue` 文件中,使用 `useNotify` 而不是 `console` 来记录错误日志。
Learnt from: gene9831
PR: opentiny/tiny-engine#1011
File: packages/configurator/src/router-select-configurator/RouterSelectConfigurator.vue:95-98
Timestamp: 2025-01-14T06:55:59.692Z
Learning: The tiny-select component from @opentiny/vue library ensures selected options are valid internally, requiring no additional validation in the change handler.
🔇 Additional comments (6)
packages/configurator/src/styles/vars.less (1)

47-48: LGTM! CSS variables follow the established pattern.

The new CSS variables for the tab bar configurator correctly reference existing common variables and maintain consistency with the naming convention.

packages/configurator/src/index.ts (1)

32-32: LGTM! Component export follows the established pattern.

The TabBarConfigurator is correctly imported and exported following the same pattern as other configurators in the package.

Also applies to: 69-69

packages/configurator/src/router-select-configurator/RouterSelectConfigurator.vue (2)

53-53: Good addition of route property to tree data.

Including the route property in the tree node data enables downstream components to access routing information directly.

Also applies to: 56-56


98-99: Enhanced event payload with path information.

The addition of the path property to the emitted value provides more context to parent components. The fallback to an empty object is a good defensive programming practice.

packages/configurator/src/tab-bar-configurator/TabBarConfigurator.vue (2)

77-77: Children ref is not reactive to schema changes.

The children ref is always reset to schemaChildren which doesn't update when the schema changes. Consider using a computed property or watching the schema for changes.

-const children = ref(schemaChildren)
+const children = computed(() => {
+  const schema = useProperties().getSchema()
+  return schema.children || []
+})

Then remove the manual updates:

-children.value = [...schemaChildren]

Also applies to: 92-92, 100-100, 129-129

⛔ Skipped due to learnings
Learnt from: gene9831
PR: opentiny/tiny-engine#1011
File: packages/plugins/page/src/PageTree.vue:340-345
Timestamp: 2025-01-14T08:37:01.393Z
Learning: The code in PageTree.vue is based on template code copied from elsewhere and will be refactored later, so suggestions for improvements should be deferred until that refactoring occurs.
Learnt from: rhlin
PR: opentiny/tiny-engine#1011
File: packages/canvas/render/src/canvas-function/design-mode.ts:6-13
Timestamp: 2025-01-14T06:55:14.457Z
Learning: The code in `packages/canvas/render/src/canvas-function/design-mode.ts` is migrated code that should be preserved in its current form during the migration process. Refactoring suggestions for type safety and state management improvements should be considered in future PRs.
Learnt from: gene9831
PR: opentiny/tiny-engine#1011
File: packages/plugins/page/src/PageGeneral.vue:166-178
Timestamp: 2025-01-14T06:40:18.223Z
Learning: The page structure data in PageGeneral.vue cannot have circular dependencies due to design constraints.
Learnt from: gene9831
PR: opentiny/tiny-engine#1011
File: packages/plugins/page/src/PageTree.vue:311-346
Timestamp: 2025-01-14T08:27:13.559Z
Learning: In Vue drag-and-drop tree components, the handleMoveNode event handler doesn't need debouncing since the move event is only triggered once when the drop operation is completed, and the drag state is managed by the tree component internally.
Learnt from: gene9831
PR: opentiny/tiny-engine#830
File: packages/common/component/MetaChildItem.vue:50-56
Timestamp: 2024-10-15T02:45:17.168Z
Learning: In `packages/common/component/MetaChildItem.vue`, when checking if `text` is an object in the computed property `title`, ensure that `text` is not `null` because `typeof null === 'object'` in JavaScript. Use checks like `text && typeof text === 'object'` to safely handle `null` values.

117-127: No unsupported ‘move’ operation—current delete/insert is correct.

I confirmed that NodeOperation only includes insert, delete, changeProps, and updateAttributes. There’s no built-in move type, so using delete-then-insert for reordering is the only supported approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant