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

refactor: refactor the repeater component using the schema approach #4702

Merged
merged 6 commits into from
Oct 12, 2023

Conversation

LIlGG
Copy link
Member

@LIlGG LIlGG commented Oct 10, 2023

What type of PR is this?

/kind improvement

What this PR does / why we need it:

对 Formkit Repeater 组件使用 schema 的方式进行重构,重构后的 Repeater 组件将支持条件判断,按照下述方式定义即可。

const formSchema = [
  {
    $formkit: "repeater",
    name: "testing",
    min: 1,
    max: 2,
    addLabel: "添加",
    children: [
      {
        $formkit: "select",
        name: "things",
        id: "things",
        label: "Things",
        placeholder: "Select",
        options: ["Something", "Else"],
      },
      {
        $formkit: "number",
        if: "$value.things === Something",
        name: "show_1",
        id: "show_something_1",
        label: "Show something",
      },
      {
        $formkit: "number",
        if: "$value.things === Something",
        name: "show_2",
        id: "show_something_2",
        label: "Also show something",
      },
    ],
  },
];

同时额外增加了对 addLabeladdButtonupControldownControlinsertControlremoveControl 属性的支持。

How to test it?

  • 测试原有使用 Repeater 组件可否正常使用。
  • Repeater 条件判断功能进行测试。
  • 查看保存的数据格式是否正确

Which issue(s) this PR fixes:

Fixes #4603

Does this PR introduce a user-facing change?

重构 Repeater 组件,使其支持条件判断。

@f2c-ci-robot f2c-ci-robot bot added kind/improvement Categorizes issue or PR as related to a improvement. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Oct 10, 2023
@ruibaby ruibaby added this to the 2.11.x milestone Oct 10, 2023
@ruibaby
Copy link
Member

ruibaby commented Oct 10, 2023

/area console
/kind improvement

@f2c-ci-robot f2c-ci-robot bot added the area/console Issues or PRs related to the Halo Console label Oct 10, 2023
@codecov
Copy link

codecov bot commented Oct 10, 2023

Codecov Report

Merging #4702 (b96c55a) into main (a81b073) will increase coverage by 0.00%.
Report is 7 commits behind head on main.
The diff coverage is n/a.

@@            Coverage Diff            @@
##               main    #4702   +/-   ##
=========================================
  Coverage     61.58%   61.59%           
  Complexity     2797     2797           
=========================================
  Files           403      403           
  Lines         14722    14723    +1     
  Branches       1023     1023           
=========================================
+ Hits           9067     9068    +1     
  Misses         5163     5163           
  Partials        492      492           

see 4 files with indirect coverage changes

Copy link
Member

@JohnNiang JohnNiang left a comment

Choose a reason for hiding this comment

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

/lgtm

@f2c-ci-robot f2c-ci-robot bot added the lgtm Indicates that a PR is ready to be merged. label Oct 11, 2023
Copy link
Member

@ruibaby ruibaby left a comment

Choose a reason for hiding this comment

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

/lgtm

Copy link
Member

@ruibaby ruibaby left a comment

Choose a reason for hiding this comment

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

/lgtm

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Oct 12, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ruibaby

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@f2c-ci-robot f2c-ci-robot bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 12, 2023
@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Oct 12, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ruibaby

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@f2c-ci-robot f2c-ci-robot bot merged commit 9e33a81 into halo-dev:main Oct 12, 2023
4 checks passed
@JohnNiang JohnNiang modified the milestones: 2.11.x, 2.11.0 Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/console Issues or PRs related to the Halo Console kind/improvement Categorizes issue or PR as related to a improvement. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

在Setting表单的repeater组件中不能正常使用条件判断
3 participants