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

Disable <SelectField /> items based on predicate (closes #736) #803

Merged
merged 9 commits into from
Sep 30, 2020

Conversation

kestarumper
Copy link
Member

This PR adds the ability to disable certain items based on predicate (similar to .filter(item => condition(item))) that can be specified as a prop.

Example: Disable all odd values

<SelectField
  name="x"
  disableItem={value => value % 2}
/>

@kestarumper kestarumper marked this pull request as draft September 16, 2020 12:07
@codecov
Copy link

codecov bot commented Sep 16, 2020

Codecov Report

Merging #803 into master will decrease coverage by 0.04%.
The diff coverage is 91.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #803      +/-   ##
==========================================
- Coverage   97.28%   97.23%   -0.05%     
==========================================
  Files         175      175              
  Lines        3424     3439      +15     
  Branches      655      668      +13     
==========================================
+ Hits         3331     3344      +13     
  Misses          8        8              
- Partials       85       87       +2     
Impacted Files Coverage Δ
packages/uniforms-unstyled/src/SelectField.tsx 94.59% <66.66%> (-2.47%) ⬇️
packages/uniforms-material/src/SelectField.tsx 89.47% <75.00%> (-1.27%) ⬇️
packages/uniforms-antd/src/SelectField.tsx 100.00% <100.00%> (ø)
packages/uniforms-antd/src/wrapField.tsx 100.00% <100.00%> (ø)
packages/uniforms-bootstrap3/src/SelectField.tsx 89.13% <100.00%> (+0.75%) ⬆️
packages/uniforms-bootstrap4/src/SelectField.tsx 88.37% <100.00%> (+0.87%) ⬆️
packages/uniforms-material/src/BoolField.tsx 100.00% <100.00%> (ø)
packages/uniforms-material/src/RadioField.tsx 89.28% <100.00%> (ø)
packages/uniforms-material/src/wrapField.tsx 100.00% <100.00%> (ø)
packages/uniforms-semantic/src/SelectField.tsx 88.63% <100.00%> (+0.83%) ⬆️

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 60a66f5...3613d4e. Read the comment docs.

@radekmie radekmie linked an issue Sep 16, 2020 that may be closed by this pull request
@radekmie radekmie added the Type: Feature New features and feature requests label Sep 16, 2020
@kestarumper kestarumper changed the title WIP: Disable <SelectField /> items based on predicate (closes #736) Disable <SelectField /> items based on predicate (closes #736) Sep 25, 2020
@kestarumper kestarumper marked this pull request as ready for review September 25, 2020 07:07
Copy link
Contributor

@radekmie radekmie left a comment

Choose a reason for hiding this comment

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

I'm still thinking if we could come up with a better name.

@radekmie radekmie merged commit 2dcda02 into master Sep 30, 2020
@radekmie radekmie deleted the item-specific-props-736 branch September 30, 2020 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature New features and feature requests
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Ability to specify disabled items in SelectField
3 participants