-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support oneOf and anyOf as alternative of enum/enumNames (#581)
* Add "alternatives" sample using oneOf/anyOf schemas * Retrieve items schema in isMultiSelect and isFilesArray * Support oneOf/anyOf constants in multiselect widgets * Add tests for isMultiSelect with support of oneOf and anyOf * Add support to oneOf/anyOf with constant schemas in StringField * Add tests for isConstant and toConstant
- Loading branch information
Showing
7 changed files
with
227 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
module.exports = { | ||
schema: { | ||
definitions: { | ||
Color: { | ||
title: "Color", | ||
type: "string", | ||
anyOf: [ | ||
{ | ||
type: "string", | ||
enum: ["#ff0000"], | ||
title: "Red", | ||
}, | ||
{ | ||
type: "string", | ||
enum: ["#00ff00"], | ||
title: "Green", | ||
}, | ||
{ | ||
type: "string", | ||
enum: ["#0000ff"], | ||
title: "Blue", | ||
}, | ||
], | ||
}, | ||
}, | ||
title: "Image editor", | ||
type: "object", | ||
required: ["currentColor", "colorMask", "blendMode"], | ||
properties: { | ||
currentColor: { | ||
$ref: "#/definitions/Color", | ||
title: "Brush color", | ||
}, | ||
colorMask: { | ||
type: "array", | ||
uniqueItems: true, | ||
items: { | ||
$ref: "#/definitions/Color", | ||
}, | ||
title: "Color mask", | ||
}, | ||
colorPalette: { | ||
type: "array", | ||
title: "Color palette", | ||
items: { | ||
$ref: "#/definitions/Color", | ||
}, | ||
}, | ||
blendMode: { | ||
title: "Blend mode", | ||
type: "string", | ||
enum: ["screen", "multiply", "overlay"], | ||
enumNames: ["Screen", "Multiply", "Overlay"], | ||
}, | ||
}, | ||
}, | ||
uiSchema: {}, | ||
formData: { | ||
currentColor: "#00ff00", | ||
colorMask: ["#0000ff"], | ||
colorPalette: ["#ff0000"], | ||
blendMode: "screen", | ||
}, | ||
}; |
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
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