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(configurator): migrate configurator #546

Merged
merged 3 commits into from
Jun 14, 2024

Conversation

chilingling
Copy link
Member

@chilingling chilingling commented Jun 5, 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?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • Refactor

    • Renamed various components to follow a consistent naming convention with "Configurator" suffix.
    • Updated component references across multiple configuration files and schemas for consistency.
  • New Features

    • Introduced FormConfigurator component for customizable form configurations.
  • Dependencies

    • Added @opentiny/tiny-engine-configurator dependency to the project.

These changes enhance the maintainability and consistency of component configurations across the application.

Copy link
Contributor

coderabbitai bot commented Jun 5, 2024

Important

Review skipped

More than 25% of the files skipped due to max files limit. The review is being skipped to prevent a low-quality review.

25 files out of 94 files are above the max files limit of 50. Please upgrade to Pro plan to get higher limits.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The changes primarily involve renaming various components across multiple files and updating their references to improve consistency and maintainability. Configurator components have been standardized with new naming conventions, replacing the old "Meta" prefix with "Configurator." Additionally, there are updates to import/export structures and dependencies to align with these changes.

Changes

File(s) Change Summary
designer-demo/src/configurators.js Restructured export of configurators, consolidating imports and spreading them into the configurators object.
packages/builtinComponent/src/meta/CanvasCol.json Renamed MetaRadioGroup to RadioGroupConfigurator and MetaSwitch to SwitchConfigurator.
packages/canvas/src/components/builtin/builtin.json Renamed MetaSwitch to SwitchConfigurator and MetaSelectIcon to SelectIconConfigurator.
packages/canvas/test/form.json Updated widget component property from MetaSwitch to SwitchConfigurator.
packages/common/component/ConfigItem.vue Updated logic for determining label position and handling icon configurations based on new component names.
packages/common/index.js Reorganized imports and updated component references to configurator counterparts.
packages/common/package.json, packages/settings/design/package.json Added dependency on @opentiny/tiny-engine-configurator.
packages/configurator/src/... (multiple files) Renamed components from Meta* to *Configurator and updated corresponding imports and exports.
packages/design-core/public/mock/bundle.json Updated component names within widget objects to new configurator names.
packages/design-core/src/registerConfigurators.js Modified how configurators are added, transforming input object into an array before adding them.
packages/plugins/block/src/js/blockSetting.jsx Renamed MetaSwitch to SwitchConfigurator in various mappings and lists.
packages/settings/design/src/assets/materials/ng-components/... (multiple files) Updated component names from Meta* to *Configurator in various JSON files.
packages/settings/design/src/convertToSchema.js Renamed MetaSwitch to SwitchConfigurator within widgetMap.
packages/settings/design/src/schema/... (multiple files) Updated component names from Meta* to *Configurator in various schema JSON files.
mockServer/src/services/blocks.json Updated component names within the blocks.json file.

Poem

In the land of code, where changes flow,
Configurators now take the show.
Meta's gone, new names arise,
Consistency gleams in developers' eyes.
With each line of code, a rabbit's cheer,
For clarity and order, we hold dear. 🐇✨


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.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @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: 8

Outside diff range and nitpick comments (5)
packages/configurator/src/slider-configurator/SliderConfigurator.vue (1)

[!TIP]
Codebase Verification

The script output indicates that there are multiple references to NumberConfigurator across various files, including JSON configuration files and JavaScript files. These references need to be reviewed and updated if necessary to ensure consistency across the codebase.

  • mockServer/src/services/appinfo.json
  • mockServer/assets/json/bundle.json
  • packages/configurator/src/index.js
  • packages/settings/design/src/schema/carousel.json
  • packages/settings/design/src/schemas/time-line.json
  • packages/settings/design/src/schemas/select.json
  • packages/settings/design/src/schemas/popeditor.json
  • packages/settings/design/src/schemas/pager.json
  • packages/settings/design/src/schemas/input.json
  • packages/settings/design/src/schemas/button.json
  • packages/design-core/public/mock/bundle.json
  • packages/common/index.js

Please review and update these references to ensure they align with the renaming strategy.

Analysis chain

Line range hint 4-18: Renaming MetaNumber to NumberConfigurator and updating its usage aligns with the PR's renaming strategy.

Also applies to: 24-28


The script confirms that the NumberConfigurator is referenced in SliderConfigurator.vue. However, to ensure comprehensive verification, we should check for any other potential references across the entire codebase.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify all references to `NumberConfigurator` are updated.
rg --type vue 'NumberConfigurator' -l

Length of output: 65



Script:

#!/bin/bash
# Description: Verify all references to `NumberConfigurator` are updated.
rg 'NumberConfigurator' --glob '*.vue'

Length of output: 278



Script:

#!/bin/bash
# Description: Verify all references to `NumberConfigurator` are updated across the entire codebase.
rg 'NumberConfigurator'

Length of output: 14713

packages/common/index.js (1)

111-111: Consider addressing the TODO comment about code import practices to improve modularity and maintainability.

packages/plugins/block/src/js/blockSetting.jsx (3)

Line range hint 492-494: Optimize array iteration by replacing forEach with for...of.

- children.forEach((child) => {
+ for (const child of children) {
    const component = getMaterial(child.componentName);

    if (!component) continue;

    const { npm, component: componentName } = component;

    if (npm) {
      const { package: pkg, exportName, css, version, script } = npm;
      const currentPkg = deps.scripts.find((item) => item.package === pkg);

      if (currentPkg) {
        currentPkg.components[componentName] = exportName;
      } else {
        deps.scripts.push({
          package: pkg,
          version,
          script,
          css,
          components: {
            [componentName]: exportName
          }
        });
      }

      if (css) {
        deps.styles.add(css);
      }
    }

    // 递归查找子区块或子组件
    if (child.children) {
      generateBlockDeps(child.children, deps);
    }
+ }

Line range hint 532-536: Replace forEach with for...of to improve performance in array iteration.

- data.sort((a, b) => new Date(b.updated_at) - new Date(a.updated_at)).forEach((block) => {
+ for (const block of data.sort((a, b) => new Date(b.updated_at) - new Date(a.updated_at))) {
    setBlockList(blockListDescByUpdateAt);
+ }

Line range hint 737-775: Consider using for...of instead of forEach for better performance in array operations.

- state.arrayConfig.map?.(({ property, type, component, defaultValue, description, props }) => ({
+ for (const { property, type, component, defaultValue, description, props } of state.arrayConfig) {
    property,
    type,
    defaultValue,
    label: {
      text: {
        zh_CN: description
      }
    },
    widget: {
      component,
      props
    }
+ })
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between efd411c and 65dbcd0.

Files selected for processing (56)
  • designer-demo/src/configurators.js (1 hunks)
  • mockServer/assets/json/bundle.json (200 hunks)
  • packages/builtinComponent/src/meta/CanvasCol.json (3 hunks)
  • packages/canvas/src/components/builtin/builtin.json (2 hunks)
  • packages/canvas/test/form.json (2 hunks)
  • packages/common/component/ConfigItem.vue (2 hunks)
  • packages/common/index.js (6 hunks)
  • packages/common/package.json (1 hunks)
  • packages/configurator/src/button-group-configurator/ButtonGroupConfigurator.vue (1 hunks)
  • packages/configurator/src/cascader-configurator/CascaderConfigurator.vue (1 hunks)
  • packages/configurator/src/checkbox-group-configurator/CheckboxGroupConfigurator.vue (1 hunks)
  • packages/configurator/src/form-configurator/FormConfigurator.vue (1 hunks)
  • packages/configurator/src/html-text-configurator/HtmlTextConfigurator.vue (1 hunks)
  • packages/configurator/src/index.js (1 hunks)
  • packages/configurator/src/ip-section-configurator/IpSectionConfigurator.vue (1 hunks)
  • packages/configurator/src/radio-configurator/RadioConfigurator.vue (1 hunks)
  • packages/configurator/src/radio-group-configurator/RadioGroupConfigurator.vue (1 hunks)
  • packages/configurator/src/slider-configurator/SliderConfigurator.vue (2 hunks)
  • packages/design-core/public/mock/bundle.json (162 hunks)
  • packages/design-core/src/registerConfigurators.js (1 hunks)
  • packages/plugins/block/src/js/blockSetting.jsx (3 hunks)
  • packages/settings/design/package.json (1 hunks)
  • packages/settings/design/src/assets/materials/ng-bundle.json (97 hunks)
  • packages/settings/design/src/assets/materials/ng-components/accordion.json (3 hunks)
  • packages/settings/design/src/assets/materials/ng-components/alert.json (3 hunks)
  • packages/settings/design/src/assets/materials/ng-components/button.json (2 hunks)
  • packages/settings/design/src/assets/materials/ng-components/checkbox.json (6 hunks)
  • packages/settings/design/src/assets/materials/ng-components/container.json (3 hunks)
  • packages/settings/design/src/assets/materials/ng-components/date.json (8 hunks)
  • packages/settings/design/src/assets/materials/ng-components/daterange.json (6 hunks)
  • packages/settings/design/src/assets/materials/ng-components/form.json (4 hunks)
  • packages/settings/design/src/assets/materials/ng-components/formfield.json (9 hunks)
  • packages/settings/design/src/assets/materials/ng-components/halfmodal.json (4 hunks)
  • packages/settings/design/src/assets/materials/ng-components/image.json (4 hunks)
  • packages/settings/design/src/assets/materials/ng-components/input.json (3 hunks)
  • packages/settings/design/src/assets/materials/ng-components/radio.json (2 hunks)
  • packages/settings/design/src/assets/materials/ng-components/select.json (3 hunks)
  • packages/settings/design/src/assets/materials/ng-components/swiper.json (5 hunks)
  • packages/settings/design/src/assets/materials/ng-components/switch.json (5 hunks)
  • packages/settings/design/src/assets/materials/ng-components/tab.json (3 hunks)
  • packages/settings/design/src/assets/materials/ng-components/table.json (12 hunks)
  • packages/settings/design/src/assets/materials/ng-components/tablefilter.json (6 hunks)
  • packages/settings/design/src/assets/materials/ng-components/tag.json (5 hunks)
  • packages/settings/design/src/components/ArrayConfigItemForm.vue (2 hunks)
  • packages/settings/design/src/components/widgets/index.js (2 hunks)
  • packages/settings/design/src/convertToSchema.js (2 hunks)
  • packages/settings/design/src/schema/carousel-item.json (2 hunks)
  • packages/settings/design/src/schema/carousel.json (10 hunks)
  • packages/settings/design/src/schemas/button.json (7 hunks)
  • packages/settings/design/src/schemas/checkbox.json (7 hunks)
  • packages/settings/design/src/schemas/checkboxbutton.json (4 hunks)
  • packages/settings/design/src/schemas/checkboxgroup.json (2 hunks)
  • packages/settings/design/src/schemas/collapse.json (1 hunks)
  • packages/settings/design/src/schemas/collapseitem.json (2 hunks)
  • packages/settings/design/src/schemas/dialogbox.json (7 hunks)
  • packages/settings/design/src/schemas/form.json (5 hunks)
Files not processed due to max files limit (21)
  • packages/settings/design/src/schemas/formitem.json
  • packages/settings/design/src/schemas/grid.json
  • packages/settings/design/src/schemas/gridcolumn.json
  • packages/settings/design/src/schemas/input.json
  • packages/settings/design/src/schemas/pager.json
  • packages/settings/design/src/schemas/popeditor.json
  • packages/settings/design/src/schemas/popover.json
  • packages/settings/design/src/schemas/radio.json
  • packages/settings/design/src/schemas/search.json
  • packages/settings/design/src/schemas/select.json
  • packages/settings/design/src/schemas/switch.json
  • packages/settings/design/src/schemas/tabitem.json
  • packages/settings/design/src/schemas/tabs.json
  • packages/settings/design/src/schemas/time-line.json
  • packages/settings/design/src/schemas/tooltip.json
  • packages/settings/design/src/schemas/tree.json
  • packages/settings/design/src/store/index.js
  • packages/settings/events/src/components/AdvanceConfig.vue
  • packages/settings/props/src/components/inputs/DraggableOptions.vue
  • packages/vue-generator/test/testcases/full/case1_normal/input/blocks.schema.json
  • packages/vue-generator/test/testcases/sfc/case01/blocks.schema.json
Files not summarized due to errors (1)
  • mockServer/assets/json/bundle.json: Error: Message exceeds token limit
Files skipped from review due to trivial changes (22)
  • packages/canvas/test/form.json
  • packages/common/package.json
  • packages/configurator/src/button-group-configurator/ButtonGroupConfigurator.vue
  • packages/configurator/src/cascader-configurator/CascaderConfigurator.vue
  • packages/configurator/src/index.js
  • packages/configurator/src/ip-section-configurator/IpSectionConfigurator.vue
  • packages/settings/design/package.json
  • packages/settings/design/src/assets/materials/ng-components/checkbox.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/form.json
  • packages/settings/design/src/assets/materials/ng-components/halfmodal.json
  • packages/settings/design/src/assets/materials/ng-components/image.json
  • packages/settings/design/src/assets/materials/ng-components/select.json
  • packages/settings/design/src/assets/materials/ng-components/swiper.json
  • packages/settings/design/src/assets/materials/ng-components/switch.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/schemas/button.json
  • packages/settings/design/src/schemas/collapseitem.json
  • packages/settings/design/src/schemas/dialogbox.json
  • packages/settings/design/src/schemas/form.json
Additional context used
Biome
packages/settings/design/src/components/widgets/index.js

[error] 18-24: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 24-28: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.

packages/settings/design/src/convertToSchema.js

[error] 81-103: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.

packages/common/index.js

[error] 105-107: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.

packages/plugins/block/src/js/blockSetting.jsx

[error] 492-494: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 532-536: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.


[error] 737-775: Prefer for...of instead of forEach. (lint/complexity/noForEach)

forEach may lead to performance issues when working with large arrays. When combined with functions like filter or map, this causes multiple iterations over the same type.

Additional comments not posted (64)
designer-demo/src/configurators.js (1)

1-7: The restructuring and export of configurators are well-implemented.

packages/design-core/src/registerConfigurators.js (1)

10-10: The addition of user-specified configurators is correctly implemented.

packages/settings/design/src/schema/carousel-item.json (1)

15-15: Correct update of component names in the JSON schema.

Also applies to: 25-25

packages/configurator/src/checkbox-group-configurator/CheckboxGroupConfigurator.vue (1)

16-16: The component renaming and setup are correctly implemented.

packages/configurator/src/radio-group-configurator/RadioGroupConfigurator.vue (1)

27-27: The component renaming and setup are correctly implemented.

packages/settings/design/src/schemas/collapse.json (1)

35-35: The update to use InputConfigurator aligns with the new naming convention. Good job on maintaining consistency.

packages/settings/design/src/assets/materials/ng-components/alert.json (3)

39-39: The update to SwitchConfigurator is consistent with the renaming strategy. Well done.


57-57: The update to InputConfigurator is consistent with the renaming strategy. Well done.


81-81: The update to InputConfigurator is consistent with the renaming strategy. Well done.

packages/settings/design/src/assets/materials/ng-components/accordion.json (3)

39-39: The update to SwitchConfigurator is consistent with the renaming strategy. Well done.


63-63: The update to InputConfigurator is consistent with the renaming strategy. Well done.


83-83: The update to SwitchConfigurator is consistent with the renaming strategy. Well done.

packages/settings/design/src/assets/materials/ng-components/input.json (3)

39-39: The update to SwitchConfigurator is consistent with the renaming strategy. Well done.


58-58: The update to InputConfigurator is consistent with the renaming strategy. Well done.


83-83: The update to InputConfigurator is consistent with the renaming strategy. Well done.

packages/settings/design/src/assets/materials/ng-components/tab.json (3)

39-39: Change to SwitchConfigurator aligns with the new naming convention.


58-58: Change to InputConfigurator aligns with the new naming convention.


89-89: Change to InputConfigurator aligns with the new naming convention.

packages/settings/design/src/assets/materials/ng-components/radio.json (2)

39-39: Change to SwitchConfigurator aligns with the new naming convention.


87-87: Change to InputConfigurator aligns with the new naming convention.

packages/settings/design/src/assets/materials/ng-components/container.json (3)

39-39: Change to SwitchConfigurator aligns with the new naming convention.


59-59: Change to InputConfigurator aligns with the new naming convention.


78-78: Change to InputConfigurator aligns with the new naming convention.

packages/configurator/src/html-text-configurator/HtmlTextConfigurator.vue (3)

13-13: Usage of input-configurator in the template aligns with the new naming convention.


19-19: Updated import statement for InputConfigurator aligns with the new naming convention.


24-24: Component registration for InputConfigurator aligns with the new naming convention.

packages/settings/design/src/convertToSchema.js (1)

49-49: Updated widget mapping for boolean types to SwitchConfigurator aligns with the new naming convention.

packages/settings/design/src/schemas/checkboxbutton.json (4)

35-35: Change to InputConfigurator aligns with the new naming convention.


55-55: Change to SwitchConfigurator aligns with the new naming convention.


74-74: Change to SwitchConfigurator aligns with the new naming convention.


94-94: Change to InputConfigurator aligns with the new naming convention.

packages/settings/design/src/assets/materials/ng-components/button.json (1)

39-39: Renaming MetaSwitch to SwitchConfigurator aligns with the PR's renaming strategy.

Verification successful

To ensure the renaming from MetaSwitch to SwitchConfigurator is consistent across the codebase, we need to verify that no references to MetaSwitch remain.


The renaming from MetaSwitch to SwitchConfigurator has been applied consistently across the codebase, as no references to MetaSwitch remain in the JSON files.

  • packages/settings/design/src/assets/materials/ng-components/button.json
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify all references to `SwitchConfigurator` are updated.
rg --type json 'SwitchConfigurator' -l

Length of output: 2949



Script:

#!/bin/bash
# Description: Verify no references to `MetaSwitch` remain in the codebase.
rg --type json 'MetaSwitch' -l

Length of output: 30

packages/settings/design/src/schemas/checkboxgroup.json (2)

35-35: Renaming MetaInput to InputConfigurator aligns with the PR's renaming strategy.


55-55: Renaming MetaSwitch to SwitchConfigurator aligns with the PR's renaming strategy.

Verification successful

Renaming MetaSwitch to SwitchConfigurator aligns with the PR's renaming strategy. The rg command output shows multiple files referencing SwitchConfigurator. We need to ensure that all these references are correct and consistent with the renaming strategy.


Renaming MetaSwitch to SwitchConfigurator aligns with the PR's renaming strategy. All references to SwitchConfigurator have been correctly updated across the codebase.

  • Verified references in multiple files, including:
    • packages/design-core/public/mock/bundle.json
    • packages/vue-generator/test/testcases/sfc/case01/blocks.schema.json
    • packages/settings/design/src/schemas/checkboxgroup.json
    • And many others.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify all references to `SwitchConfigurator` are updated.
rg --type json 'SwitchConfigurator' -l

Length of output: 2949



Script:

#!/bin/bash
# Description: Check the content of files referencing `SwitchConfigurator` to confirm the references are correct.
files=(
  "packages/design-core/public/mock/bundle.json"
  "packages/vue-generator/test/testcases/sfc/case01/blocks.schema.json"
  "packages/vue-generator/test/testcases/full/case1_normal/input/blocks.schema.json"
  "packages/settings/design/src/schema/carousel.json"
  "packages/settings/design/src/schemas/formitem.json"
  "packages/settings/design/src/schemas/checkboxgroup.json"
  "packages/settings/design/src/schemas/input.json"
  "packages/settings/design/src/schemas/popeditor.json"
  "packages/settings/design/src/schemas/select.json"
  "packages/settings/design/src/schemas/tree.json"
  "packages/settings/design/src/schemas/time-line.json"
  "packages/settings/design/src/schemas/tabs.json"
  "packages/settings/design/src/schemas/radio.json"
  "packages/settings/design/src/schemas/popover.json"
  "packages/settings/design/src/schemas/gridcolumn.json"
  "packages/settings/design/src/schemas/grid.json"
  "packages/settings/design/src/schemas/search.json"
  "packages/settings/design/src/schemas/form.json"
  "packages/settings/design/src/schemas/dialogbox.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/schemas/switch.json"
  "packages/settings/design/src/assets/materials/ng-bundle.json"
  "packages/settings/design/src/assets/materials/ng-components/button.json"
  "packages/settings/design/src/assets/materials/ng-components/alert.json"
  "packages/settings/design/src/assets/materials/ng-components/switch.json"
  "packages/settings/design/src/assets/materials/ng-components/tag.json"
  "packages/settings/design/src/assets/materials/ng-components/tablefilter.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/input.json"
  "packages/settings/design/src/assets/materials/ng-components/image.json"
  "packages/settings/design/src/assets/materials/ng-components/radio.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/daterange.json"
  "packages/settings/design/src/assets/materials/ng-components/date.json"
  "packages/settings/design/src/assets/materials/ng-components/container.json"
  "packages/settings/design/src/assets/materials/ng-components/accordion.json"
  "packages/settings/design/src/assets/materials/ng-components/halfmodal.json"
  "packages/settings/design/src/assets/materials/ng-components/checkbox.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"
)

for file in "${files[@]}"; do
  echo "File: $file"
  cat "$file" | rg 'SwitchConfigurator'
done

Length of output: 44880

packages/settings/design/src/schema/carousel.json (1)

16-16: Renaming MetaInput, MetaSwitch, and MetaNumber to InputConfigurator, SwitchConfigurator, and NumberConfigurator aligns with the PR's renaming strategy.

Also applies to: 34-34, 44-44, 55-55, 72-72, 82-82, 92-92, 102-102, 113-113, 131-131

packages/builtinComponent/src/meta/CanvasCol.json (1)

37-37: Renaming MetaRadioGroup, MetaSwitch, and others to RadioGroupConfigurator, SwitchConfigurator, and so on aligns with the PR's renaming strategy.

Also applies to: 156-156, 172-172

packages/settings/design/src/components/ArrayConfigItemForm.vue (2)

157-160: The dynamic component resolution logic is clear and well-implemented. Good use of computed properties for reactive updates.


55-56: Ensure that all imported components are used within the file to avoid unnecessary imports.

Verification successful

The script results indicate that all imported components (ConfigItem, MetaCodeEditor, MetaNumber, SwitchConfigurator, and InputConfigurator) are used within the ArrayConfigItemForm.vue file. Therefore, there are no unnecessary imports.

  • ConfigItem is used.
  • MetaCodeEditor is used.
  • MetaNumber is used.
  • SwitchConfigurator is used.
  • InputConfigurator is used.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Check for unused imports in ArrayConfigItemForm.vue
ast-grep --lang vue --pattern 'import $_ from $_' packages/settings/design/src/components/ArrayConfigItemForm.vue

Length of output: 222



Script:

#!/bin/bash
# Description: Check for usage of each imported component in ArrayConfigItemForm.vue

# Define the components to check
components=("ConfigItem" "MetaCodeEditor" "MetaNumber" "SwitchConfigurator" "InputConfigurator")

# Loop through each component and search for its usage in the file
for component in "${components[@]}"; do
  echo "Searching for usage of $component:"
  rg "$component" packages/settings/design/src/components/ArrayConfigItemForm.vue
  echo
done

Length of output: 1777

packages/settings/design/src/assets/materials/ng-components/formfield.json (1)

39-39: The updates to the component names in the widget configurations align with the new naming conventions. Ensure that these new components are properly defined and exported in their respective modules.

Also applies to: 58-58, 78-78, 98-98, 118-118, 138-138, 158-158, 178-178, 229-229

Verification successful

The components SwitchConfigurator and InputConfigurator are properly defined and exported in their respective modules.

  • SwitchConfigurator is exported from packages/configurator/src/switch-configurator/SwitchConfigurator.vue.
  • InputConfigurator is exported from packages/configurator/src/input-configurator/InputConfigurator.vue.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the existence and export of new component names in their respective modules.
rg --type json --files-with-matches 'SwitchConfigurator|InputConfigurator' packages/configurator/src/**/*.vue

Length of output: 1607



Script:

#!/bin/bash
# Description: Verify the export of SwitchConfigurator and InputConfigurator components in their respective modules.
rg 'export default' packages/configurator/src/switch-configurator/SwitchConfigurator.vue packages/configurator/src/input-configurator/InputConfigurator.vue

Length of output: 327

packages/common/index.js (2)

13-33: The import statements for the configurator components are correctly updated to reflect the new naming conventions. This ensures consistency across the project.


111-111: Replace forEach with for...of for better performance and readability, especially if dealing with large arrays.

- Object.entries(globalComponents).forEach(([name, component]) => {
+ for (const [name, component] of Object.entries(globalComponents)) {
    app.component(name, component)
- });
+ }

Likely invalid or redundant comment.

packages/settings/design/src/assets/materials/ng-components/table.json (1)

39-39: The updates to the component names in the widget configurations are consistent with the new naming conventions. Ensure that these components are properly defined and exported in their respective modules.

Also applies to: 105-105, 125-125, 145-145, 181-181, 217-217, 237-237, 257-257, 284-284, 303-303, 322-322, 346-346

Verification successful

The components SwitchConfigurator and InputConfigurator exist in their respective modules. Now, let's verify if these components are properly exported from their modules.


The components SwitchConfigurator and InputConfigurator are properly defined and exported in their respective modules.

  • SwitchConfigurator is exported from packages/configurator/src/switch-configurator/SwitchConfigurator.vue.
  • InputConfigurator is exported from packages/configurator/src/input-configurator/InputConfigurator.vue.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the existence and export of new component names in their respective modules.
rg --type json --files-with-matches 'SwitchConfigurator|InputConfigurator' packages/configurator/src/**/*.vue

Length of output: 1607



Script:

#!/bin/bash
# Description: Verify the export of SwitchConfigurator and InputConfigurator components in their respective modules.
rg 'export default' packages/configurator/src/switch-configurator/SwitchConfigurator.vue
rg 'export default' packages/configurator/src/input-configurator/InputConfigurator.vue

Length of output: 213

packages/canvas/src/components/builtin/builtin.json (1)

173-173: The updates to the component names in the widget configurations are consistent with the new naming conventions. Ensure that these components are properly defined and exported in their respective modules.

Also applies to: 332-332

packages/plugins/block/src/js/blockSetting.jsx (3)

104-104: Update to SwitchConfigurator aligns with the renaming strategy across the project.


113-113: Correctly updated the component list to include SwitchConfigurator for boolean types.


242-242: The default editor for boolean types has been updated to SwitchConfigurator, ensuring consistency with other changes.

packages/settings/design/src/assets/materials/ng-bundle.json (4)

44-44: Updated component name to 'SwitchConfigurator' aligns with the PR's renaming strategy.


64-64: Renaming 'MetaInput' to 'InputConfigurator' in widget components is consistent with the overall migration strategy.

Also applies to: 83-83


152-152: Switch to 'SwitchConfigurator' for boolean properties is correctly implemented across various components.

Also applies to: 196-196, 250-250, 346-346, 393-393, 487-487, 599-599, 737-737, 835-835, 937-937, 1063-1063, 1218-1218, 1348-1348, 1478-1478, 1582-1582, 1769-1769, 1941-1941, 2052-2052, 2163-2163, 2549-2549, 2812-2812


176-176: All instances of 'InputConfigurator' are correctly updated in line with the renaming strategy.

Also applies to: 268-268, 292-292, 373-373, 413-413, 507-507, 526-526, 545-545, 624-624, 756-756, 781-781, 883-883, 982-982, 1009-1009, 1082-1082, 1101-1101, 1126-1126, 1237-1237, 1256-1256, 1275-1275, 1367-1367, 1386-1386, 1497-1497, 1528-1528, 1601-1601, 1620-1620, 1639-1639, 1677-1677, 1696-1696, 1715-1715, 1789-1789, 1812-1812, 1832-1832, 1852-1852, 1872-1872, 1960-1960, 1979-1979, 1998-1998, 2071-2071, 2090-2090, 2109-2109, 2205-2205, 2225-2225, 2245-2245, 2265-2265, 2301-2301, 2337-2337, 2357-2357, 2377-2377, 2404-2404, 2423-2423, 2442-2442, 2466-2466, 2569-2569, 2589-2589, 2613-2613, 2637-2637, 2701-2701, 2831-2831, 2851-2851, 2871-2871, 2891-2891, 2911-2911, 2931-2931, 3002-3002

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

55-55: The component name InputConfigurator is consistent with the renaming strategy outlined in the PR. Ensure that all references to the old component name are updated across the project.


74-74: The component name InputConfigurator is correctly updated here as well. Double-check for any missed references or incorrect imports that might still be using the old name.


93-93: The SelectConfigurator component is correctly named according to the new naming conventions. Verify that the options provided are correctly migrated from the old component.


223-223: The SwitchConfigurator component is correctly updated. Ensure that all properties and behaviors are correctly migrated from the old MetaSwitch component.


313-313: The NumberConfigurator component is correctly named. Verify that all numerical properties (like min, max) are correctly set if they were part of the old component's configuration.


513-513: The HtmlTextConfigurator component is introduced correctly. Ensure that all HTML-related properties are correctly configured and that the component behaves as expected in the UI.


582-582: The HtmlAttributesConfigurator component is correctly named. Verify that all HTML attribute configurations are correctly migrated from any previous component setups.


663-663: The HtmlTextConfigurator component with showRadioButton property is a specific configuration. Ensure this property is handled correctly in the component logic.


685-685: Another instance of HtmlAttributesConfigurator. As with other configurators, ensure all necessary attributes are correctly migrated and functional.


189-189: The InputConfigurator component appears multiple times. Ensure that this is intentional and not a copy-paste error, especially if the configuration is identical across different sections.

Verification successful

Let's correct the script to properly search for the InputConfigurator component and check for duplicates.


The script output indicates that the InputConfigurator component appears multiple times in the bundle.json file, with 54 and 11 occurrences respectively. This suggests that there might be duplicate entries, but we need to verify if these entries have identical configurations.

To ensure thorough verification, we should check if these occurrences have identical configurations.


The previous script did not produce any output, which suggests that there might not be exact duplicate configurations for the InputConfigurator component. However, to be thorough, we should verify the configurations more precisely.

Let's refine our approach to extract and compare the full configurations of the InputConfigurator component.


The extracted configurations show that the InputConfigurator component appears multiple times with varying configurations. Some instances have empty props while others have specific options or properties set.

This indicates that the multiple occurrences of InputConfigurator are intentional and not a result of a copy-paste error, as they serve different purposes with different configurations.

  • : The multiple occurrences of the InputConfigurator component in bundle.json are intentional and have different configurations.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Check for duplicate entries of InputConfigurator with identical configurations.

# Test: Search for duplicate JSON blocks. Expect: No exact duplicates.
rg --type json --json $'{
  "component": "InputConfigurator",
  "props": {}
}' mockServer/assets/json/bundle.json | uniq -c | grep -v ' 1 '

Length of output: 436



Script:

#!/bin/bash
# Description: Check for duplicate entries of InputConfigurator with identical configurations.

# Test: Search for duplicate JSON blocks containing "component": "InputConfigurator".
rg --type json '"component": "InputConfigurator"' mockServer/assets/json/bundle.json | uniq -c | grep -v ' 1 '

Length of output: 240



Script:

#!/bin/bash
# Description: Check for duplicate entries of InputConfigurator with identical configurations.

# Extract all JSON blocks containing "component": "InputConfigurator" and count unique occurrences.
rg --type json -A 5 '"component": "InputConfigurator"' mockServer/assets/json/bundle.json | uniq -c | grep -v ' 1 '

Length of output: 117



Script:

#!/bin/bash
# Description: Extract and compare configurations of InputConfigurator components.

# Extract all JSON blocks containing "component": "InputConfigurator" and their configurations.
rg --type json -A 10 '"component": "InputConfigurator"' mockServer/assets/json/bundle.json

Length of output: 24463

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

206-206: Consistent component renaming to 'SwitchConfigurator'.

Also applies to: 420-420, 442-442, 464-464, 486-486, 508-508, 530-530, 552-552, 575-575, 729-729, 831-831, 886-886, 908-908, 930-930, 952-952, 1011-1011, 1034-1034, 1203-1203, 1268-1268, 1289-1289, 2167-2167, 2189-2189, 2248-2248, 2270-2270, 2292-2292, 2432-2432, 2454-2454, 2937-2937, 3065-3065, 3084-3084, 3911-3911, 3930-3930, 5779-5779, 5854-5854, 5874-5874, 5933-5933, 5953-5953, 10742-10742, 10762-10762, 10941-10941, 11032-11032, 11100-11100, 11288-11288, 11316-11316, 11599-11599, 11615-11615, 11710-11710, 11859-11859, 11878-11878, 11954-11954, 12049-12049, 12274-12274, 12294-12294, 12313-12313, 12394-12394, 12651-12651, 12671-12671, 12724-12724, 151-151, 152-152, 153-153, 155-155, 156-156, 157-157, 158-158, 161-161, 162-162


1638-1638: Consistent component renaming to 'NumberConfigurator'.

Also applies to: 1657-1657, 2122-2122, 3228-3228, 3297-3297, 3378-3378, 3400-3400, 3481-3481, 3501-3501, 3703-3703, 3949-3949, 4046-4046, 4109-4109, 4228-4228, 4306-4306, 4325-4325, 4344-4344, 4863-4863, 4946-4946, 4985-4985, 5004-5004, 5339-5339, 5476-5476, 5498-5498, 5519-5519, 5541-5541, 5563-5563, 5585-5585, 5607-5607, 5629-5629, 5894-5894, 5913-5913, 5933-5933, 5953-5953, 6102-6102, 6140-6140, 6160-6160, 6221-6221, 6241-6241, 6527-6527, 6556-6556, 6750-6750, 6770-6770, 6790-6790, 6831-6831, 6859-6859, 6899-6899, 7118-7118, 7197-7197, 7340-7340, 7380-7380, 7400-7400, 7428-7428, 7448-7448, 7619-7619, 7638-7638, 7686-7686, 7878-7878, 7897-7897, 8071-8071, 8280-8280, 8320-8320, 8339-8339, 8379-8379, 8399-8399, 8540-8540, 8602-8602, 8622-8622, 9481-9481, 9495-9495, 9579-9579, 9785-9785, 9908-9908, 9944-9944, 9964-9964, 9984-9984, 10004-10004, 10024-10024, 10338-10338, 10358-10358, 10397-10397, 10615-10615, 10635-10635, 10662-10662, 10742-10742, 10762-10762, 10941-10941, 11032-11032, 11100-11100, 11288-11288, 11316-11316, 11599-11599, 11615-11615, 11710-11710, 11859-11859, 11878-11878, 11954-11954, 12049-12049, 12274-12274, 12294-12294, 12313-12313, 12394-12394, 12651-12651, 12671-12671, 12724-12724


1706-1706: Consistent component renaming to 'SwitchConfigurator'.

Also applies to: 1787-1787, 1829-1829, 1979-1979, 2040-2040, 1706-1706, 1787-1787, 1829-1829, 1979-1979, 2040-2040


2167-2167: Consistent component renaming to 'SwitchConfigurator'.

Also applies to: 2189-2189, 2248-2248, 2270-2270, 2292-2292, 2432-2432, 2454-2454, 2937-2937, 3065-3065, 3084-3084, 3911-3911, 3930-3930, 5779-5779, 5854-5854, 5874-5874, 5933-5933, 5953-5953, 10742-10742, 10762-10762, 10941-10941, 11032-11032, 11100-11100, 11288-11288, 11316-11316, 11599-11599, 11615-11615, 11710-11710, 11859-11859, 11878-11878, 11954-11954, 12049-12049, 12274-12274, 12294-12294, 12313-12313, 12394-12394, 12651-12651, 12671-12671, 12724-12724, 151-151, 152-152, 153-153, 155-155, 156-156, 157-157, 158-158, 161-161, 162-162

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 65dbcd0 and 06002e9.

Files selected for processing (9)
  • mockServer/src/services/blocks.json (2 hunks)
  • packages/canvas/test/form.json (3 hunks)
  • packages/design-core/public/mock/bundle.json (162 hunks)
  • packages/vue-generator/test/testcases/full/case1_normal/input/blocks.schema.json (3 hunks)
  • packages/vue-generator/test/testcases/full/case2_prop-accessor/input/blocks.schema.json (1 hunks)
  • packages/vue-generator/test/testcases/full/case3_state-accessor/input/blocks.schema.json (2 hunks)
  • packages/vue-generator/test/testcases/sfc/case01/blocks.schema.json (3 hunks)
  • packages/vue-generator/test/testcases/sfc/case02/blocks.schema.json (1 hunks)
  • packages/vue-generator/test/testcases/sfc/case03/blocks.schema.json (2 hunks)
Files skipped from review due to trivial changes (4)
  • mockServer/src/services/blocks.json
  • packages/vue-generator/test/testcases/full/case2_prop-accessor/input/blocks.schema.json
  • packages/vue-generator/test/testcases/sfc/case02/blocks.schema.json
  • packages/vue-generator/test/testcases/sfc/case03/blocks.schema.json
Files skipped from review as they are similar to previous changes (2)
  • packages/canvas/test/form.json
  • packages/design-core/public/mock/bundle.json
Additional comments not posted (8)
packages/vue-generator/test/testcases/full/case3_state-accessor/input/blocks.schema.json (2)

114-114: Ensure InputConfigurator is fully compatible with the previous component.


134-134: Confirm that InputConfigurator supports all required props.

packages/vue-generator/test/testcases/sfc/case01/blocks.schema.json (3)

131-131: Ensure InputConfigurator is fully compatible with the previous component.


153-153: Confirm that InputConfigurator supports all required props.


175-175: Verify that SwitchConfigurator correctly handles boolean values.

packages/vue-generator/test/testcases/full/case1_normal/input/blocks.schema.json (3)

134-134: Ensure InputConfigurator is fully compatible with the previous component.


156-156: Confirm that InputConfigurator supports all required props.


178-178: Verify that SwitchConfigurator correctly handles boolean values.

@chilingling chilingling added the ready_for_review This PR requires more reviews label Jun 6, 2024
@chilingling chilingling force-pushed the feat/addConfigurator branch from 06002e9 to c8499ab Compare June 14, 2024 02:14
@hexqi hexqi merged commit 02d0e96 into opentiny:refactor/develop Jun 14, 2024
yy-wow pushed a commit to yy-wow/tiny-engine that referenced this pull request Oct 10, 2024
* feat(configurator): migrate configurator

* fix: fix NumberConfiguratoric to NumberConfigurator

* feat: register all configurator by default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready_for_review This PR requires more reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants