-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Array field optional sortability #345
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
n1k0
merged 32 commits into
rjsf-team:master
from
olzraiti:arrayFieldOptionalSortability
Oct 20, 2016
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
251974c
fix HiddenWidget error when value is undefined
olzraiti 8e69465
add context prop
olzraiti 7ae018c
Replace tabs with spaces and add context PropType to Form.
olzraiti 1217215
Pass context to FieldTemplate
olzraiti 4136956
Fix passing context to SchemaField
olzraiti f8158b9
Replace tabs with spaces
olzraiti 9eeaf75
replace context with formContext
olzraiti 39fb8c3
Don't pass formContext to fields that don't use it
olzraiti 7ada187
Remove duplicate default export from Form
olzraiti 6ab8b12
Add tests for formContext
olzraiti 933f808
Fix formContext tests lint issues
olzraiti b7670f4
FormContext is passed internally inside registry. Pass formContext to…
olzraiti 770f761
update README
olzraiti 295e572
fix lint and package.json
olzraiti 7bc5952
fix tests. FormContext must be and object.
olzraiti 90c0bd8
Fix minor style issues
olzraiti 2861c92
Update README
olzraiti 9e0caac
Merge branch 'master' of https://github.com/mozilla-services/react-js…
olzraiti 9c158ed
Use empty title instead of name
olzraiti 4974362
Use empty label instead of name
olzraiti 8d120e4
Add tests for passing titles/labels
olzraiti a919ae1
fix lint issues
olzraiti e936e07
ArrayField sorting can be disabled
olzraiti 0d2f33f
replace tabs with spaces
olzraiti 0283a95
update README
olzraiti 4c68350
Merge branch 'master' of https://github.com/mozilla-services/react-js…
olzraiti b7465cf
Remove empty line
olzraiti 32c77e7
Rename ArrayField options 'sortable' to 'orderable' & minor changes
olzraiti a7e917e
fix lint issues
olzraiti f16c111
Some code style improvement
olzraiti b8adc95
replace tabs with spaces
olzraiti b34235f
Update README
olzraiti File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,6 +157,15 @@ describe("ArrayField", () => { | |
expect(moveDownBtns[1].disabled).eql(true); | ||
}); | ||
|
||
it("should not show move up/down buttons is orderable is false", () => { | ||
const {node} = createFormComponent({schema, formData: ["foo", "bar"], uiSchema: {"ui:options": {orderable: false}}}); | ||
const moveUpBtns = node.querySelector(".array-item-move-up"); | ||
const moveDownBtns = node.querySelector(".array-item-move-down"); | ||
|
||
expect(moveUpBtns).to.be.null; | ||
expect(moveDownBtns).to.be.null; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
}); | ||
|
||
it("should remove a field from the list", () => { | ||
const {node} = createFormComponent({schema, formData: ["foo", "bar"]}); | ||
const dropBtns = node.querySelectorAll(".array-item-remove"); | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that @n1k0 took a different approach in #346 in order to introduce widget options:
I think that both approaches are valid :) I'll let you figure out pros and cons for each ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having the same approach as widgets would be more consistent, but the
ui:options
-style makes updating auiSchema
simpler (if you want to add an option to an existing uiSchema field, you don't replace any lines, just add new ones).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually like the
ui:options
approach, definitely less verbose and more flexible. Too bad I've just landed #346 which leverages the widget options approach, which is making your approach inconsistent.Don't rush reverting though, I may actually just switch to using your
ui:options
thing instead :)