-
Notifications
You must be signed in to change notification settings - Fork 9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(json-schema-2020-12): add support for expandable behavior
Refs #8513
- Loading branch information
Showing
10 changed files
with
96 additions
and
83 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
9 changes: 4 additions & 5 deletions
9
src/core/plugins/json-schema-2020-12/components/Accordion/_accordion.scss
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
38 changes: 38 additions & 0 deletions
38
src/core/plugins/json-schema-2020-12/components/keywords/Properties.jsx
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,38 @@ | ||
/** | ||
* @prettier | ||
*/ | ||
import React from "react" | ||
|
||
import { schema } from "../../prop-types" | ||
import { useFn, useComponent } from "../../hooks" | ||
|
||
const Properties = ({ schema }) => { | ||
const fn = useFn() | ||
const JSONSchema = useComponent("JSONSchema") | ||
|
||
if (fn.isBooleanJSONSchema(schema)) { | ||
return null | ||
} | ||
|
||
const properties = schema.properties || {} | ||
|
||
if (Object.keys(properties).length === 0) { | ||
return null | ||
} | ||
|
||
return ( | ||
<> | ||
{Object.entries(properties).map(([propertyName, propertyValue]) => ( | ||
<div key={propertyName} className="json-schema-2020-12-property"> | ||
<JSONSchema name={propertyName} schema={propertyValue} /> | ||
</div> | ||
))} | ||
</> | ||
) | ||
} | ||
|
||
Properties.propTypes = { | ||
schema: schema.isRequired, | ||
} | ||
|
||
export default Properties |
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