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 ObjectFieldTemplate (rjsf-team#653)
* Add ObjectFieldTemplate * ObjectFieldTemplate properties are representative objects instead of React elements * prettier * Update README & rename ObjectFieldTemplate props children to content * Update README * Fix ObjectFieldTemplate test * Ran cs-format & cs-check * Remove index from ObjectFieldTemplate props * Ran cs-format & cs-check
- Loading branch information
Showing
10 changed files
with
255 additions
and
30 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
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,61 @@ | ||
import React from "react"; | ||
|
||
function ObjectFieldTemplate({ TitleField, properties, title, description }) { | ||
return ( | ||
<div> | ||
<TitleField title={title} /> | ||
<div className="row"> | ||
{properties.map(prop => ( | ||
<div className="col-lg-2 col-md-4 col-sm-6 col-xs-12">{prop}</div> | ||
))} | ||
</div> | ||
{description} | ||
</div> | ||
); | ||
} | ||
|
||
module.exports = { | ||
schema: { | ||
title: "A registration form", | ||
description: | ||
"This is the same as the simple form, but it is rendered as a bootstrap grid. Try shrinking the browser window to see it in action.", | ||
type: "object", | ||
required: ["firstName", "lastName"], | ||
properties: { | ||
firstName: { | ||
type: "string", | ||
title: "First name", | ||
}, | ||
lastName: { | ||
type: "string", | ||
title: "Last name", | ||
}, | ||
age: { | ||
type: "integer", | ||
title: "Age", | ||
}, | ||
bio: { | ||
type: "string", | ||
title: "Bio", | ||
}, | ||
password: { | ||
type: "string", | ||
title: "Password", | ||
minLength: 3, | ||
}, | ||
telephone: { | ||
type: "string", | ||
title: "Telephone", | ||
minLength: 10, | ||
}, | ||
}, | ||
}, | ||
formData: { | ||
firstName: "Chuck", | ||
lastName: "Norris", | ||
age: 75, | ||
bio: "Roundhouse kicking asses since 1940", | ||
password: "noneed", | ||
}, | ||
ObjectFieldTemplate, | ||
}; |
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
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
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.