input-material-ui
Advanced tools
Comparing version 2.7.0 to 2.8.0
@@ -7,2 +7,3 @@ import * as React from 'react'; | ||
export interface InputMaterialUiProps extends React.Props<InputMaterialUi> { | ||
defaultValue?: string; | ||
FormHelperTextProps?: FormHelperTextProps; | ||
@@ -9,0 +10,0 @@ helperText?: string; |
@@ -18,3 +18,3 @@ "use strict"; | ||
var style = { | ||
height: '1.1875rem' | ||
height: '1.1875rem', | ||
}; | ||
@@ -44,3 +44,3 @@ var getType = function (type) { return (lodash_1.isEmpty(type) ? 'text' : type); }; | ||
: { | ||
inputProps: {} | ||
inputProps: {}, | ||
}; | ||
@@ -47,0 +47,0 @@ return (React.createElement(core_1.FormControl, { fullWidth: true }, |
@@ -18,2 +18,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var lodash_1 = require("lodash"); | ||
var React = require("react"); | ||
@@ -23,3 +24,2 @@ var InputField_1 = require("./InputField"); | ||
var SeeHidePassword_1 = require("./SeeHidePassword"); | ||
var lodash_1 = require("lodash"); | ||
var InputMaterialUi = (function (_super) { | ||
@@ -31,3 +31,3 @@ __extends(InputMaterialUi, _super); | ||
isPasswordVisible: false, | ||
value: '' | ||
value: undefined, | ||
}; | ||
@@ -38,3 +38,3 @@ _this.handleChange = function (event) { return _this.handleChangeValue(event.target.value); }; | ||
_this.setState({ | ||
value: value | ||
value: value, | ||
}); | ||
@@ -45,3 +45,3 @@ _this.props.onChange(value); | ||
return _this.setState({ | ||
isPasswordVisible: isPasswordVisible | ||
isPasswordVisible: isPasswordVisible, | ||
}); | ||
@@ -53,3 +53,3 @@ }; | ||
var _a = this.props, FormHelperTextProps = _a.FormHelperTextProps, helperText = _a.helperText, id = _a.id, InputLabelProps = _a.InputLabelProps, InputProps = _a.InputProps, label = _a.label, placeholder = _a.placeholder, valueInProps = _a.value; | ||
var valueInState = this.state.value; | ||
var _b = this.state.value, valueInState = _b === void 0 ? '' : _b; | ||
var value = lodash_1.isNil(valueInProps) ? valueInState : valueInProps; | ||
@@ -59,6 +59,12 @@ return (React.createElement(InputField_1.default, { endAdornment: this.getEndAdornament(), helperText: helperText, helperTextProps: FormHelperTextProps, id: id, inputLabelProps: InputLabelProps, inputProps: InputProps, label: label, onChange: this.handleChange, placeholder: placeholder, startAdornment: this.getStartAdornament(), type: this.getType(), value: value })); | ||
InputMaterialUi.prototype.componentDidMount = function () { | ||
var value = this.props.value; | ||
var _a = this.props, defaultValue = _a.defaultValue, value = _a.value; | ||
if (lodash_1.isNil(this.state.value) && lodash_1.isNil(defaultValue) === false) { | ||
this.setState({ | ||
value: defaultValue, | ||
}); | ||
return; | ||
} | ||
if (lodash_1.isNil(value) === false && value !== this.state.value) { | ||
this.setState({ | ||
value: this.props.value | ||
value: this.props.value, | ||
}); | ||
@@ -65,0 +71,0 @@ } |
{ | ||
"name": "input-material-ui", | ||
"version": "2.7.0", | ||
"version": "2.8.0", | ||
"description": "A material-ui INPUT component which allows to see/hide the password text of the field and to clear the input value", | ||
@@ -47,3 +47,3 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"@babel/core": "^7.13.8", | ||
"@babel/core": "^7.13.15", | ||
"@storybook/react": "6.0.28", | ||
@@ -54,4 +54,4 @@ "@types/babel-core": "^6.25.6", | ||
"@types/lodash": "^4.14.168", | ||
"@types/react": "^16.9.56", | ||
"@types/react-dom": "^16.9.11", | ||
"@types/react": "^16.14.5", | ||
"@types/react-dom": "^16.9.12", | ||
"@types/rimraf": "^3.0.0", | ||
@@ -66,3 +66,3 @@ "babel-core": "^6.26.3", | ||
"rimraf": "^3.0.2", | ||
"typescript": "^4.2.2" | ||
"typescript": "^4.2.4" | ||
}, | ||
@@ -69,0 +69,0 @@ "peerDependencies": { |
@@ -48,2 +48,3 @@ # input-material-ui ![Weekly downloads](https://img.shields.io/npm/dw/input-material-ui 'Weekly downloads') | ||
| 2.7.x | 4.11.3 | 16.9.0 or 17.0.0 | | ||
| 2.8.x | 4.11.3 | 16.9.0 or 17.0.0 | | ||
@@ -194,1 +195,5 @@ ### About versioning schema used for InputMaterialUi | ||
- Fixed security warnings | ||
### 2.8.0 | ||
- Added support for defaultValue |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
29648
257
198