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(TinyTabs): 选项卡组件配置项的modelValue改为select组件,且其options随着选项卡而变化 #439

Draft
wants to merge 15 commits into
base: develop
Choose a base branch
from

Conversation

betterdancing
Copy link
Contributor

@betterdancing betterdancing commented Apr 22, 2024

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?

选项卡tabs组件默认选中的标签页modelValue需要用户手动填写,体验不友好

Issue Number: N/A

What is the new behavior?

选项卡tabs组件默认选中的标签页modelValue改为下拉选择,且options随着新增或删除选项卡时同步变化

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • New Features

    • Enhanced property management with new functions for handling property values, visibility, and props.
    • Improved component configuration with dynamic default values and better alignment settings.
    • Added support for tabs configuration with predefined labels and values.
  • Bug Fixes

    • Fixed issues with property updates and event handling to ensure smoother user interactions.
  • Improvements

    • Updated UI components for better usability, including clearer label positioning and dynamic default values.
    • Enhanced schema initialization with updated model values and tab properties.
  • Tests

    • Added comprehensive test cases for new utility functions to ensure robust functionality and reliability.

@chilingling chilingling added bug Something isn't working ready_for_review This PR requires more reviews labels May 6, 2024
chilingling
chilingling previously approved these changes May 10, 2024
Copy link
Collaborator

@hexqi hexqi left a comment

Choose a reason for hiding this comment

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

image
建议删除当前选项卡后选中第一个选项卡

@betterdancing
Copy link
Contributor Author

image 建议删除当前选项卡后选中第一个选项卡

已解决

@Issues-translate-bot
Copy link

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


![image](https://private-user-images.githubusercontent.com/18585869/329513316-a47da568-a664-4242-8f47-d223cf96e446.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..Q7xEM 4_h0MkvN5nZ8gtPQ8qhekoPejLr4klwgx-DLhQ) It is recommended to delete the current tab Then select the first tab

solved

@Issues-translate-bot
Copy link

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


![image](https://private-user-images.githubusercontent.com/18585869/329513316-a47da568-a664-4242-8f47-d223cf96e446.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..Q7xEM 4_h0MkvN5nZ8gtPQ8qhekoPejLr4klwgx-DLhQ) It is recommended to delete the current tab Then select the first tab

hexqi
hexqi previously approved these changes May 17, 2024
Copy link
Contributor

coderabbitai bot commented May 20, 2024

Walkthrough

The recent updates include improvements to event handling, property configurations, and component settings across various files. Key changes involve modifying event handlers, refactoring component properties, and introducing new utility functions for managing properties. These enhancements aim to streamline the initialization and manipulation of component properties and values, offering better alignment and dynamic default settings.

Changes

File Path Change Summary
mockServer/assets/json/bundle.json Updated event handlers, property configurations, and component settings.
packages/common/component/ConfigItem.vue Added setPropertyProps to property manipulation functions.
packages/common/component/MetaContainer.vue Added props, emits, new methods, and a watcher for children value changes.
packages/common/component/MetaSelect.vue Set clearable prop's default value dynamically based on the property value.
packages/controller/src/useProperties.js Introduced functions for property management.
packages/design-core/public/mock/bundle.json Adjusted event handlers, property settings, and component configurations.
packages/utils/src/utils/index.js Added isOmitValue and delNullKey functions for value filtering.
packages/utils/test/delNullKey.test.js Added test cases for the delNullKey function.
packages/utils/test/isOmitValue.test.js Added test cases for the isOmitValue function.

🐇
In the realm of code so bright,
Changes came to set things right.
Event handlers, properties anew,
Components polished, shining through.
Utilities fine-tuned with care,
Now our code's beyond compare.
Hoppy coding, one and all,
Let's celebrate, both big and small! 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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.

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: 0

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between e9961aa and 41bdc3a.
Files selected for processing (9)
  • mockServer/assets/json/bundle.json (6 hunks)
  • packages/common/component/ConfigItem.vue (2 hunks)
  • packages/common/component/MetaContainer.vue (5 hunks)
  • packages/common/component/MetaSelect.vue (3 hunks)
  • packages/controller/src/useProperties.js (3 hunks)
  • packages/design-core/public/mock/bundle.json (7 hunks)
  • packages/utils/src/utils/index.js (2 hunks)
  • packages/utils/test/delNullKey.test.js (1 hunks)
  • packages/utils/test/isOmitValue.test.js (1 hunks)
Files not reviewed due to errors (5)
  • packages/common/component/MetaSelect.vue (no review received)
  • packages/common/component/MetaContainer.vue (no review received)
  • packages/controller/src/useProperties.js (no review received)
  • packages/utils/src/utils/index.js (no review received)
  • packages/common/component/ConfigItem.vue (no review received)
Files skipped from review due to trivial changes (1)
  • packages/utils/test/delNullKey.test.js
Additional comments not posted (16)
packages/utils/test/isOmitValue.test.js (3)

4-8: The test cases for null, undefined, and empty string are correctly implemented.


10-13: The test cases for empty and non-empty arrays are correctly implemented, respecting the keepRef parameter.


15-18: The test cases for empty and non-empty objects are correctly implemented.

mockServer/assets/json/bundle.json (6)

4321-4321: Update in onBeforeMount looks good.


5835-5835: Addition of onChange handler to dynamically update options is crucial for the feature.

Verification successful

The onChange handler added in mockServer/assets/json/bundle.json is correctly integrated and follows the expected pattern. The handler dynamically updates the modelValue property's options, which aligns with the intended functionality.

  • The onChange handler is used in multiple places within the mockServer/assets/json/bundle.json file.
  • The specific handler in question is correctly formatted and integrated.
Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the integration of the `onChange` function.

# Test: Search for the usage of `onChange` in the project. Expect: Proper integration and no errors.
rg --type json $'onChange'

Length of output: 6574



Script:

#!/bin/bash
# Description: Extract and review the specific `onChange` handlers in `mockServer/assets/json/bundle.json`.

# Extract lines containing `onChange` handlers in the specified file.
rg --json --pretty --context 5 'onChange' mockServer/assets/json/bundle.json

Length of output: 31032


5846-5846: Change in labelPosition to "top" aligns with UI improvements.


5860-5873: Introduction of MetaSelect with predefined options enhances user interaction.

Verification successful

The predefined options for the MetaSelect component are consistent and correctly implemented across multiple instances in the project.

  • Instances of MetaSelect with predefined options were found in various JSON files, including mockServer/assets/json/bundle.json, mockServer/src/services/appinfo.json, and others.
  • The options include values like "标签页1", "标签页2", "top", "right", "left", "card", "checkbox", "button", "medium", "mini", "large", "integer", "index", "ellipsis", "selection", "date", etc.
Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the predefined options for `MetaSelect`.

# Test: Search for the predefined options in the project. Expect: Correct and consistent options.
rg --type json $'MetaSelect'

Length of output: 13951



Script:

#!/bin/bash
# Description: Extract and review the predefined options for `MetaSelect` in the identified files.

# Extract instances of `MetaSelect` and their options.
rg --json --pretty --context 5 '"component": "MetaSelect"' packages/settings/design/src/schemas/gridcolumn.json packages/settings/design/src/schemas/input.json packages/settings/design/src/schemas/tabs.json packages/settings/design/src/schemas/tooltip.json packages/settings/design/src/schemas/popover.json packages/settings/design/src/schemas/grid.json packages/settings/design/src/schemas/form.json packages/settings/design/src/schemas/checkboxgroup.json packages/settings/design/src/schemas/button.json packages/settings/design/src/assets/materials/ng-bundle.json packages/design-core/public/mock/bundle.json packages/canvas/src/components/builtin/builtin.json mockServer/src/services/appinfo.json mockServer/assets/json/bundle.json packages/builtinComponent/src/meta/CanvasRow.json packages/builtinComponent/src/meta/CanvasCol.json

Length of output: 368272


7552-7552: Enhanced onBeforeMount with multiple initializations improves setup efficiency.


9835-9845: Setting modelValue and tabs for TinyTabs supports dynamic updates as intended.

packages/design-core/public/mock/bundle.json (7)

7038-7038: The update to the onBeforeMount event handler looks good and aligns with the PR's objectives.


8532-8540: The introduction of MetaSwitch and the update to labelPosition are noted. Please confirm that the MetaSwitch component aligns with the intended functionality.

Verification successful

The introduction of the MetaSwitch component in the bundle.json file is consistent with its extensive usage across the codebase. No issues were found with this change.

  • packages/design-core/public/mock/bundle.json
  • packages/settings/design/src/schema/carousel.json
  • packages/settings/design/src/schemas/form.json
  • packages/settings/design/src/schemas/input.json
  • packages/settings/design/src/schemas/search.json
  • packages/settings/design/src/schemas/tabs.json
  • packages/settings/design/src/schemas/time-line.json
  • packages/settings/design/src/schemas/switch.json
  • packages/settings/design/src/schemas/tree.json
  • packages/settings/design/src/schemas/select.json
  • packages/settings/design/src/schemas/radio.json
  • packages/settings/design/src/schemas/gridcolumn.json
  • packages/settings/design/src/schemas/grid.json
  • packages/settings/design/src/schemas/popover.json
  • packages/settings/design/src/schemas/formitem.json
  • packages/settings/design/src/schemas/dialogbox.json
  • packages/settings/design/src/schemas/popeditor.json
  • packages/settings/design/src/schemas/checkboxgroup.json
  • packages/settings/design/src/schemas/checkboxbutton.json
  • packages/settings/design/src/schemas/checkbox.json
  • packages/settings/design/src/schemas/button.json
  • packages/settings/design/src/assets/materials/ng-components/checkbox.json
  • packages/settings/design/src/assets/materials/ng-components/image.json
  • packages/settings/design/src/assets/materials/ng-bundle.json
  • packages/settings/design/src/assets/materials/ng-components/tablefilter.json
  • packages/settings/design/src/assets/materials/ng-components/tag.json
  • packages/settings/design/src/assets/materials/ng-components/tab.json
  • packages/settings/design/src/assets/materials/ng-components/table.json
  • packages/settings/design/src/assets/materials/ng-components/swiper.json
  • packages/settings/design/src/assets/materials/ng-components/select.json
  • packages/settings/design/src/assets/materials/ng-components/radio.json
  • packages/settings/design/src/assets/materials/ng-components/halfmodal.json
  • packages/settings/design/src/assets/materials/ng-components/formfield.json
  • packages/settings/design/src/assets/materials/ng-components/form.json
  • packages/settings/design/src/assets/materials/ng-components/date.json
  • packages/settings/design/src/assets/materials/ng-components/daterange.json
  • packages/settings/design/src/assets/materials/ng-components/button.json
  • packages/settings/design/src/assets/materials/ng-components/container.json
  • packages/settings/design/src/assets/materials/ng-components/alert.json
  • packages/settings/design/src/assets/materials/ng-components/accordion.json
  • packages/settings/design/src/assets/materials/ng-components/switch.json
  • packages/builtinComponent/src/meta/CanvasCol.json
  • packages/canvas/test/form.json
  • mockServer/src/services/appinfo.json
  • packages/canvas/src/components/builtin/builtin.json
  • mockServer/assets/json/bundle.json
Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the introduction of `MetaSwitch` in other parts of the codebase.

# Test: Search for `MetaSwitch` usage. Expect: Consistent usage across the application.
rg --type json $'MetaSwitch'

Length of output: 47845


8552-8552: The addition of the onChange event handler to dynamically update modelValue properties is a solid enhancement.


8563-8563: Setting labelPosition to "top" for modelValue enhances UI consistency.


8577-8595: The introduction of MetaSelect with predefined options for tabs aligns perfectly with the PR's objectives to enhance user experience.


10269-10269: The update to the onBeforeMount event handler to initialize multiple properties is a good optimization.


13622-13632: Setting predefined values for modelValue and tabs enhances the dynamic configuration capabilities of the component.

@hexqi hexqi marked this pull request as draft September 28, 2024 03:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ready_for_review This PR requires more reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants