Skip to content

Use original FieldGroup component in Field array #1146

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

Merged
merged 2 commits into from
Oct 13, 2021

Conversation

rvsia
Copy link
Contributor

@rvsia rvsia commented Oct 13, 2021

Fixes #1141

Description

Updates our field array to use the original PF4 design.

After

screencapture-localhost-8080-2021-10-13-13_58_23

@rvsia rvsia added enhancement New feature or request PF4 PF4 pull request labels Oct 13, 2021
@rvsia rvsia requested a review from Hyperkid123 October 13, 2021 14:25
@DataDrivenFormsBot
Copy link

A new version (feat) will be released: v3.14.0 [DataDrivenFormsBot]

@codecov
Copy link

codecov bot commented Oct 13, 2021

Codecov Report

Merging #1146 (2c0015f) into master (de36488) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1146      +/-   ##
==========================================
- Coverage   94.91%   94.90%   -0.02%     
==========================================
  Files         208      208              
  Lines        3542     3531      -11     
  Branches     1224     1213      -11     
==========================================
- Hits         3362     3351      -11     
  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 834aaac...2c0015f. Read the comment docs.

@Hyperkid123 Hyperkid123 merged commit b83f112 into data-driven-forms:master Oct 13, 2021
@steverhoades
Copy link
Contributor

I detected one small issue with this PR. The Delete All button is new and does not respect the minItems definition. I'll see if I can pinpoint where that is failing.

Also, wow. What a great improvement!

@rvsia
Copy link
Contributor Author

rvsia commented Oct 13, 2021

@steverhoades oh yeah! Great catch! 👀

I know where it is failing - I haven’t consider this option at all. 😂

But I am not sure what to do - I guess it would be better to hide the button when minItems are set, what do you think? 🤔

Otherwise, I’ll wix it tomorrow.

@steverhoades
Copy link
Contributor

That was exactly what I was just looking at. Something like:

            <FormFieldGroupHeader
              titleText={{ text: label, id: props.name }}
              titleDescription={description}
              actions={
                <React.Fragment>
                 { minItems && minItems > 0 ? '' :
                    <Button
                      variant="link"
                      isDisabled={value.length === 0}
                      {...(value.length !== 0 && { onClick: () => removeBatch(value.map((_, index) => index)) })}
                    >
                      {combinedButtonLabels.removeAll}
                    </Button>
                  }
                  <Button
                    variant="secondary"
                    isDisabled={value.length >= maxItems}
                    {...(!(value.length >= maxItems) && { onClick: () => push(defaultItem) })}
                  >
                    {combinedButtonLabels.add}
                  </Button>
                </React.Fragment>
              }

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

Successfully merging this pull request may close these issues.

PF4-Mapper: conditions within a field-array do not hide the label
4 participants