provide default value for the field
This commit is contained in:
@@ -8,7 +8,7 @@ export default class VisiblePassword extends React.PureComponent {
|
|||||||
this.inputRef = React.createRef();
|
this.inputRef = React.createRef();
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
value: this.props.value,
|
value: this.props.value || '',
|
||||||
visible: false
|
visible: false
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ export default class VisiblePassword extends React.PureComponent {
|
|||||||
handleKeyDown(e) {
|
handleKeyDown(e) {
|
||||||
if (e.keyCode == 27) {
|
if (e.keyCode == 27) {
|
||||||
// Escape pressed
|
// Escape pressed
|
||||||
this.setState({value: this.props.value, visible: false});
|
this.setState({value: this.props.value || '', visible: false});
|
||||||
if (this.props.onFinished) {
|
if (this.props.onFinished) {
|
||||||
this.props.onFinished();
|
this.props.onFinished();
|
||||||
}
|
}
|
||||||
@@ -68,7 +68,7 @@ export default class VisiblePassword extends React.PureComponent {
|
|||||||
return (
|
return (
|
||||||
<div tabIndex="-1" className="group-focus" onBlur={this.handleEditingFinished}>
|
<div tabIndex="-1" className="group-focus" onBlur={this.handleEditingFinished}>
|
||||||
<input className="with-visibility"
|
<input className="with-visibility"
|
||||||
type={this.state.visible ? "text" : "password"}
|
type={this.state.visible ? 'text' : 'password'}
|
||||||
value={this.state.value}
|
value={this.state.value}
|
||||||
placeholder={this.props.placeholder}
|
placeholder={this.props.placeholder}
|
||||||
required={this.props.required ? 'required' : ''}
|
required={this.props.required ? 'required' : ''}
|
||||||
|
|||||||
+3
-3
@@ -16313,7 +16313,7 @@ class VisiblePassword extends (react__WEBPACK_IMPORTED_MODULE_0___default().Pure
|
|||||||
super(props);
|
super(props);
|
||||||
this.inputRef = react__WEBPACK_IMPORTED_MODULE_0___default().createRef();
|
this.inputRef = react__WEBPACK_IMPORTED_MODULE_0___default().createRef();
|
||||||
this.state = {
|
this.state = {
|
||||||
value: this.props.value,
|
value: this.props.value || '',
|
||||||
visible: false
|
visible: false
|
||||||
};
|
};
|
||||||
this.handleVisibility = this.handleVisibility.bind(this);
|
this.handleVisibility = this.handleVisibility.bind(this);
|
||||||
@@ -16343,7 +16343,7 @@ class VisiblePassword extends (react__WEBPACK_IMPORTED_MODULE_0___default().Pure
|
|||||||
handleKeyDown(e) {
|
handleKeyDown(e) {
|
||||||
if (e.keyCode == 27) {
|
if (e.keyCode == 27) {
|
||||||
this.setState({
|
this.setState({
|
||||||
value: this.props.value,
|
value: this.props.value || '',
|
||||||
visible: false
|
visible: false
|
||||||
});
|
});
|
||||||
if (this.props.onFinished) {
|
if (this.props.onFinished) {
|
||||||
@@ -16374,7 +16374,7 @@ class VisiblePassword extends (react__WEBPACK_IMPORTED_MODULE_0___default().Pure
|
|||||||
onBlur: this.handleEditingFinished
|
onBlur: this.handleEditingFinished
|
||||||
}, react__WEBPACK_IMPORTED_MODULE_0___default().createElement("input", {
|
}, react__WEBPACK_IMPORTED_MODULE_0___default().createElement("input", {
|
||||||
className: "with-visibility",
|
className: "with-visibility",
|
||||||
type: this.state.visible ? "text" : "password",
|
type: this.state.visible ? 'text' : 'password',
|
||||||
value: this.state.value,
|
value: this.state.value,
|
||||||
placeholder: this.props.placeholder,
|
placeholder: this.props.placeholder,
|
||||||
required: this.props.required ? 'required' : '',
|
required: this.props.required ? 'required' : '',
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user