Add validation error tooltips
If there is an error put it on the tooltip
This commit is contained in:
@@ -58,6 +58,7 @@ export class JsonSchema_string extends Component {
|
|||||||
if ( enumValue ) {
|
if ( enumValue ) {
|
||||||
const Select = getComponent("Select")
|
const Select = getComponent("Select")
|
||||||
return (<Select className={ errors.length ? "invalid" : ""}
|
return (<Select className={ errors.length ? "invalid" : ""}
|
||||||
|
title={ errors.length ? errors : ""}
|
||||||
allowedValues={ enumValue }
|
allowedValues={ enumValue }
|
||||||
value={ value }
|
value={ value }
|
||||||
allowEmptyValue={ !required }
|
allowEmptyValue={ !required }
|
||||||
@@ -67,10 +68,20 @@ export class JsonSchema_string extends Component {
|
|||||||
const isDisabled = schema["in"] === "formData" && !("FormData" in window)
|
const isDisabled = schema["in"] === "formData" && !("FormData" in window)
|
||||||
const Input = getComponent("Input")
|
const Input = getComponent("Input")
|
||||||
if (schema["type"] === "file") {
|
if (schema["type"] === "file") {
|
||||||
return <Input type="file" className={ errors.length ? "invalid" : ""} onChange={ this.onChange } disabled={isDisabled}/>
|
return (<Input type="file"
|
||||||
|
className={ errors.length ? "invalid" : ""}
|
||||||
|
title={ errors.length ? errors : ""}
|
||||||
|
onChange={ this.onChange }
|
||||||
|
disabled={isDisabled}/>)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return <Input type={ schema.format === "password" ? "password" : "text" } className={ errors.length ? "invalid" : ""} value={value} placeholder={description} onChange={ this.onChange } disabled={isDisabled}/>
|
return (<Input type={ schema.format === "password" ? "password" : "text" }
|
||||||
|
className={ errors.length ? "invalid" : ""}
|
||||||
|
title={ errors.length ? errors : ""}
|
||||||
|
value={value}
|
||||||
|
placeholder={description}
|
||||||
|
onChange={ this.onChange }
|
||||||
|
disabled={isDisabled}/>)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -134,11 +145,12 @@ export class JsonSchema_array extends PureComponent {
|
|||||||
if ( enumValue ) {
|
if ( enumValue ) {
|
||||||
const Select = getComponent("Select")
|
const Select = getComponent("Select")
|
||||||
return (<Select className={ errors.length ? "invalid" : ""}
|
return (<Select className={ errors.length ? "invalid" : ""}
|
||||||
multiple={ true }
|
title={ errors.length ? errors : ""}
|
||||||
value={ value }
|
multiple={ true }
|
||||||
allowedValues={ enumValue }
|
value={ value }
|
||||||
allowEmptyValue={ !required }
|
allowedValues={ enumValue }
|
||||||
onChange={ this.onEnumChange }/>)
|
allowEmptyValue={ !required }
|
||||||
|
onChange={ this.onEnumChange }/>)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -175,6 +187,7 @@ export class JsonSchema_boolean extends Component {
|
|||||||
const Select = getComponent("Select")
|
const Select = getComponent("Select")
|
||||||
|
|
||||||
return (<Select className={ errors.length ? "invalid" : ""}
|
return (<Select className={ errors.length ? "invalid" : ""}
|
||||||
|
title={ errors.length ? errors : ""}
|
||||||
value={ String(value) }
|
value={ String(value) }
|
||||||
allowedValues={ fromJS(["true", "false"]) }
|
allowedValues={ fromJS(["true", "false"]) }
|
||||||
allowEmptyValue={ true }
|
allowEmptyValue={ true }
|
||||||
|
|||||||
Reference in New Issue
Block a user