Skip to content

fix(pf4): Field-Array no longer shows delete all when minItems has a … #1149

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

Conversation

steverhoades
Copy link
Contributor

Fixes #(issue) (if applicable)
I did not create an issue for this but it is in relation to the discussions for PR #1146

Description
When maxItems has a value greater than 0 we should not show the deleteAll button.

Please include a summary of the change.
When maxItems is greater than 0 it will no longer show the Delete all button. This prevents the component from incidentally wiping the contents of the field-array when maxItems is set.

Schema (if applicable)

const schema = {
    fields: [
        {
          "component": "field-array",
          "label": "Field Array",
          "name": "FieldArray",
          "minItems": 1,
          "fields": [
            {
              "component": "text-field",
              "label": "Add Input",
              "name": "InputName",
            }
          ]
        }
    ]
};

Checklist: (please see documentation page for more information)

  • Yarn build passes
  • Yarn lint passes
  • Yarn test passes
  • [(pf4): ] Test coverage for new code (if applicable)
  • Documentation update (if applicable)
  • Correct commit message

@Hyperkid123 Hyperkid123 requested a review from rvsia October 14, 2021 06:45
@Hyperkid123 Hyperkid123 added bug Something isn't working PF4 PF4 pull request labels Oct 14, 2021
Copy link
Contributor

@rvsia rvsia left a comment

Choose a reason for hiding this comment

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

Please, change title/description/commit message from maxItems to mintItems 😅

@DataDrivenFormsBot
Copy link

DataDrivenFormsBot commented Oct 14, 2021

A new version (fix) will be released: v3.15.1 [DataDrivenFormsBot]

@rvsia
Copy link
Contributor

rvsia commented Oct 14, 2021

Lint error:

home/circleci/react-forms/packages/pf4-component-mapper/src/field-array/field-array.js
  104:51  error  Replace `onClick:·()·=>·removeBatch(value.map((_,·index)·=>·index))` with `·onClick:·()·=>·removeBatch(value.map((_,·index)·=>·index))·`  prettier/prettier 

@steverhoades steverhoades force-pushed the remove-delete-all-when-minItems-set branch from 720e8c8 to 8107659 Compare October 14, 2021 16:12
Copy link
Contributor

@rvsia rvsia left a comment

Choose a reason for hiding this comment

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

Thank you!

@rvsia rvsia changed the title fix(pf4): Field-Array no longer shows delete all when maxItems has a … fix(pf4): Field-Array no longer shows delete all when minItems has a … Oct 14, 2021
@codecov
Copy link

codecov bot commented Oct 14, 2021

Codecov Report

Merging #1149 (8107659) into master (94e3b8e) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1149   +/-   ##
=======================================
  Coverage   94.90%   94.90%           
=======================================
  Files         208      208           
  Lines        3531     3533    +2     
  Branches     1213     1215    +2     
=======================================
+ Hits         3351     3353    +2     
  Misses        180      180           
Impacted Files Coverage Δ
...f4-component-mapper/src/field-array/field-array.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3151ceb...8107659. Read the comment docs.

@rvsia rvsia merged commit afb4d83 into data-driven-forms:master Oct 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working PF4 PF4 pull request released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants