-
Notifications
You must be signed in to change notification settings - Fork 4
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
code(custom tooltip): enabling custom tooltips for relevant field types #90
Open
Ansh-Sarkar
wants to merge
1
commit into
cern-sis:master
Choose a base branch
from
Ansh-Sarkar:feature-custom-tooltip
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
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 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 |
---|---|---|
|
@@ -26,12 +26,10 @@ export const common = { | |
title: { | ||
type: "string", | ||
title: "Title", | ||
description: "Provide a title to be displayed for your field", | ||
}, | ||
description: { | ||
title: "Description", | ||
type: "string", | ||
description: "Provide a description to be displayed for your field", | ||
}, | ||
}, | ||
optionsUiSchema: { | ||
|
@@ -121,6 +119,10 @@ export const common = { | |
|
||
export const extra = { | ||
optionsSchema: { | ||
tooltip: { | ||
title: "Tooltip", | ||
type: "string" | ||
}, | ||
readOnly: { | ||
type: "boolean", | ||
title: "Read-only", | ||
|
@@ -171,7 +173,7 @@ const collections = { | |
hidden: { | ||
type: "boolean", | ||
title: "Do you want this field to be hidden?", | ||
description: "If yes, this field will not be visible in the form", | ||
tooltip: "If enabled, this field will not be visible in the form", | ||
}, | ||
}, | ||
}, | ||
|
@@ -180,6 +182,12 @@ const collections = { | |
}, | ||
optionsUiSchemaUiSchema: { | ||
...common.optionsUiSchemaUiSchema, | ||
"ui:options": { | ||
...common.optionsUiSchemaUiSchema["ui:options"], | ||
hidden: { | ||
"ui:widget": "switch", | ||
} | ||
} | ||
}, | ||
default: { | ||
schema: { | ||
|
@@ -362,11 +370,12 @@ const simple = { | |
...common.optionsSchema, | ||
pattern: { | ||
title: "Validation regex", | ||
description: | ||
tooltip: | ||
"The input will be validated against this regex on form submission", | ||
type: "string", | ||
format: "regex", | ||
}, | ||
tooltip: extra.optionsSchema.tooltip, | ||
readOnly: extra.optionsSchema.readOnly, | ||
isRequired: extra.optionsSchema.isRequired, | ||
}, | ||
|
@@ -392,7 +401,7 @@ const simple = { | |
suggestions: { | ||
type: "string", | ||
title: "Add a suggestion URL endpoint", | ||
description: "Provide an URL endpoint, to fetch data from there", | ||
tooltip: "Provide an URL endpoint to fetch data from", | ||
}, | ||
convertToUppercase: { | ||
type: "boolean", | ||
|
@@ -441,6 +450,7 @@ const simple = { | |
title: "TextArea Schema", | ||
properties: { | ||
...common.optionsSchema, | ||
tooltip: extra.optionsSchema.tooltip, | ||
readOnly: extra.optionsSchema.readOnly, | ||
isRequired: extra.optionsSchema.isRequired, | ||
}, | ||
|
@@ -461,23 +471,20 @@ const simple = { | |
properties: { | ||
...common.optionsUiSchema.properties["ui:options"].properties, | ||
rows: { | ||
title: "Rows", | ||
description: "The number of rows in the textarea", | ||
title: "Number of Rows", | ||
description: "Default: 4", | ||
type: "number", | ||
}, | ||
maxLength: { | ||
title: "Max Length", | ||
description: "Infinity if not provided", | ||
title: "Max Characters", | ||
type: "number", | ||
}, | ||
minLength: { | ||
title: "Min Length", | ||
description: "Empty if not provided", | ||
title: "Min Characters", | ||
type: "number", | ||
}, | ||
placeholder: { | ||
title: "Placeholder", | ||
description: "Provide a placeholder for the field", | ||
type: "string", | ||
}, | ||
}, | ||
|
@@ -515,6 +522,7 @@ const simple = { | |
{ const: "number", title: "Float" }, | ||
], | ||
}, | ||
tooltip: extra.optionsSchema.tooltip, | ||
readOnly: extra.optionsSchema.readOnly, | ||
isRequired: extra.optionsSchema.isRequired, | ||
}, | ||
|
@@ -554,6 +562,7 @@ const simple = { | |
{ const: "array", title: "Multiple Options" }, | ||
], | ||
}, | ||
tooltip: extra.optionsSchema.tooltip, | ||
readOnly: extra.optionsSchema.readOnly, | ||
isRequired: extra.optionsSchema.isRequired, | ||
}, | ||
|
@@ -583,9 +592,8 @@ const simple = { | |
enum: ["array"], | ||
}, | ||
items: { | ||
title: "Define your options", | ||
title: "Options", | ||
type: "object", | ||
description: "The options for the widget", | ||
properties: { | ||
enum: { | ||
title: "Options List", | ||
|
@@ -640,7 +648,6 @@ const simple = { | |
type: { | ||
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. Add tooltip support also in switch |
||
type: "string", | ||
title: "Type of the returned value", | ||
description: "Define the type of the returned value", | ||
oneOf: [ | ||
{ const: "boolean", title: "Boolean" }, | ||
{ const: "string", title: "String" }, | ||
|
@@ -668,9 +675,9 @@ const simple = { | |
...common.optionsUiSchema.properties["ui:options"].properties, | ||
falseToUndefined: { | ||
type: "boolean", | ||
title: "Do you want to return undefined instead of false?", | ||
description: | ||
"In some cases the returned value is preferred to be undefined than false", | ||
title: "Return undefined instead of false?", | ||
tooltip: | ||
"In some cases the returned value can be preferred to be undefined than false", | ||
}, | ||
}, | ||
}, | ||
|
@@ -679,6 +686,12 @@ const simple = { | |
}, | ||
optionsUiSchemaUiSchema: { | ||
...common.optionsUiSchemaUiSchema, | ||
"ui:options": { | ||
...common.optionsUiSchemaUiSchema["ui:options"], | ||
falseToUndefined: { | ||
"ui:widget": "switch", | ||
}, | ||
}, | ||
}, | ||
default: { | ||
schema: { | ||
|
@@ -700,14 +713,14 @@ const simple = { | |
properties: { | ||
...common.optionsSchema, | ||
enum: { | ||
title: "Define your options", | ||
title: "Options", | ||
type: "array", | ||
description: "The options for the radio widget", | ||
items: { | ||
title: "Radio Option", | ||
type: "string", | ||
}, | ||
}, | ||
tooltip: extra.optionsSchema.tooltip, | ||
readOnly: extra.optionsSchema.readOnly, | ||
isRequired: extra.optionsSchema.isRequired, | ||
}, | ||
|
@@ -751,6 +764,7 @@ const simple = { | |
{ const: "array", title: "Select multiple values" }, | ||
], | ||
}, | ||
tooltip: extra.optionsSchema.tooltip, | ||
readOnly: extra.optionsSchema.readOnly, | ||
isRequired: extra.optionsSchema.isRequired, | ||
}, | ||
|
@@ -766,9 +780,8 @@ const simple = { | |
then: { | ||
properties: { | ||
enum: { | ||
title: "Define your options", | ||
title: "Options", | ||
type: "array", | ||
description: "The options for the widget", | ||
items: { | ||
title: "Option", | ||
type: "string", | ||
|
@@ -788,9 +801,8 @@ const simple = { | |
then: { | ||
properties: { | ||
enum: { | ||
title: "Define your options", | ||
title: "Options", | ||
type: "array", | ||
description: "The options for the widget", | ||
items: { | ||
title: "Option", | ||
type: "number", | ||
|
@@ -810,7 +822,7 @@ const simple = { | |
then: { | ||
properties: { | ||
items: { | ||
title: "Define your options", | ||
title: "Options", | ||
type: "object", | ||
properties: { | ||
enum: { | ||
|
@@ -880,6 +892,7 @@ const simple = { | |
type: "string", | ||
title: "Maximum date allowed", | ||
}, | ||
tooltip: extra.optionsSchema.tooltip, | ||
readOnly: extra.optionsSchema.readOnly, | ||
isRequired: extra.optionsSchema.isRequired, | ||
}, | ||
|
@@ -929,6 +942,7 @@ const advanced = { | |
title: "URI Schema", | ||
properties: { | ||
...common.optionsSchema, | ||
tooltip: extra.optionsSchema.tooltip, | ||
readOnly: extra.optionsSchema.readOnly, | ||
isRequired: extra.optionsSchema.isRequired, | ||
}, | ||
|
@@ -951,7 +965,7 @@ const advanced = { | |
suggestions: { | ||
type: "string", | ||
title: "Add a suggestion URL endpoint", | ||
description: "Provide an URL endpoint, to fetch data from there", | ||
tooltip: "Provide a URL endpoint, to fetch data from there", | ||
}, | ||
}, | ||
}, | ||
|
@@ -981,6 +995,7 @@ const advanced = { | |
title: "Rich/LaTeX Editor Schema", | ||
properties: { | ||
...common.optionsSchema, | ||
tooltip: extra.optionsSchema.tooltip, | ||
readOnly: extra.optionsSchema.readOnly, | ||
isRequired: extra.optionsSchema.isRequired, | ||
}, | ||
|
@@ -1017,14 +1032,15 @@ const advanced = { | |
tagPattern: { | ||
type: "string", | ||
title: "Pattern", | ||
description: "Provide a regex for your pattern", | ||
tooltip: "Only tags matching this regex will be allowed", | ||
}, | ||
tagPatternErrorMessage: { | ||
type: "string", | ||
title: "Pattern error message", | ||
description: | ||
"Provide a message to display when the input does not match the pattern", | ||
tooltip: | ||
"Message to display when the input does not match the pattern", | ||
}, | ||
tooltip: extra.optionsSchema.tooltip, | ||
readOnly: extra.optionsSchema.readOnly, | ||
isRequired: extra.optionsSchema.isRequired, | ||
}, | ||
|
@@ -1061,6 +1077,7 @@ const advanced = { | |
title: "ID Fetcher Schema", | ||
properties: { | ||
...common.optionsSchema, | ||
tooltip: extra.optionsSchema.tooltip, | ||
readOnly: extra.optionsSchema.readOnly, | ||
isRequired: extra.optionsSchema.isRequired, | ||
}, | ||
|
@@ -1119,14 +1136,15 @@ const advanced = { | |
validateWith: { | ||
type: "string", | ||
title: "Validate with", | ||
description: | ||
tooltip: | ||
"You can either provide a URL of a UI Schema to validate against or paste the JSON schema directly", | ||
oneOf: [ | ||
{ const: "none", title: "None" }, | ||
{ const: "url", title: "URL" }, | ||
{ const: "json", title: "JSON" }, | ||
], | ||
}, | ||
tooltip: extra.optionsSchema.tooltip, | ||
readOnly: extra.optionsSchema.readOnly, | ||
isRequired: extra.optionsSchema.isRequired, | ||
}, | ||
|
@@ -1269,6 +1287,7 @@ export const hiddenFields = { | |
{ const: "number", title: "Float" }, | ||
], | ||
}, | ||
tooltip: extra.optionsSchema.tooltip, | ||
readOnly: extra.optionsSchema.readOnly, | ||
isRequired: extra.optionsSchema.isRequired, | ||
}, | ||
|
Oops, something went wrong.
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.
Please move the tooltip up, here and in other fields, so that it appears directly under title and description (i.e. directly after
...common.optionsSchema
)