forked from rjsf-team/react-jsonschema-form
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add preliminary support for object "additionalProperties" (rjsf-team#…
…1021) * Initial commit for additionalProperties * Resolve PR feedback: * avoid modifying parameters * avoid unnecessary let using returns * eliminate unnecessary bind * terse closure return syntax * take advantage of class fields * Fix validation naming issue on additional key change Fix misnamed "additionalProperties" attribute Invert conditional to reduce indentation Added unit tests to ensure non-schema properties are maintained
- Loading branch information
1 parent
ac226bd
commit 1d54db6
Showing
10 changed files
with
539 additions
and
34 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
module.exports = { | ||
schema: { | ||
title: "A customizable registration form", | ||
description: "A simple form with additional properties example.", | ||
type: "object", | ||
required: ["firstName", "lastName"], | ||
additionalProperties: { | ||
type: "string", | ||
}, | ||
properties: { | ||
firstName: { | ||
type: "string", | ||
title: "First name", | ||
}, | ||
lastName: { | ||
type: "string", | ||
title: "Last name", | ||
}, | ||
}, | ||
}, | ||
uiSchema: { | ||
firstName: { | ||
"ui:autofocus": true, | ||
"ui:emptyValue": "", | ||
}, | ||
}, | ||
formData: { | ||
firstName: "Chuck", | ||
lastName: "Norris", | ||
assKickCount: "infinity", | ||
}, | ||
}; |
This file contains 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 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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from "react"; | ||
import IconButton from "./IconButton"; | ||
|
||
export default function AddButton({ className, onClick, disabled }) { | ||
return ( | ||
<div className="row"> | ||
<p className={`col-xs-3 col-xs-offset-9 text-right ${className}`}> | ||
<IconButton | ||
type="info" | ||
icon="plus" | ||
className="btn-add col-xs-12" | ||
tabIndex="0" | ||
onClick={onClick} | ||
disabled={disabled} | ||
/> | ||
</p> | ||
</div> | ||
); | ||
} |
This file contains 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React from "react"; | ||
|
||
export default function IconButton(props) { | ||
const { type = "default", icon, className, ...otherProps } = props; | ||
return ( | ||
<button | ||
type="button" | ||
className={`btn btn-${type} ${className}`} | ||
{...otherProps}> | ||
<i className={`glyphicon glyphicon-${icon}`} /> | ||
</button> | ||
); | ||
} |
This file contains 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 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
Oops, something went wrong.