@woosmap/ui 4.109.0 → 4.110.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -31,7 +31,7 @@ export default class Input extends Component {
|
|
|
31
31
|
const { onChange, value: oldValue, name, step, max } = this.props;
|
|
32
32
|
const { value: stateValue } = this.state;
|
|
33
33
|
const theValue = oldValue || stateValue;
|
|
34
|
-
const newValue = !isNaN(theValue) ? theValue + step : step;
|
|
34
|
+
const newValue = (!Number.isNaN(theValue) ? theValue + step : step).toFixed(2);
|
|
35
35
|
if (onChange) {
|
|
36
36
|
onChange({ target: { name, value: max ? Math.min(max, newValue) : newValue } });
|
|
37
37
|
} else {
|
|
@@ -43,7 +43,7 @@ export default class Input extends Component {
|
|
|
43
43
|
const { onChange, value: oldValue, name, step, min } = this.props;
|
|
44
44
|
const { value: stateValue } = this.state;
|
|
45
45
|
const theValue = oldValue || stateValue;
|
|
46
|
-
const newValue = !isNaN(theValue) ? theValue - step : 0;
|
|
46
|
+
const newValue = (!Number.isNaN(theValue) ? theValue - step : 0).toFixed(2);
|
|
47
47
|
if (onChange) {
|
|
48
48
|
onChange({ target: { name, value: min ? Math.max(min, newValue) : newValue } });
|
|
49
49
|
} else {
|
|
@@ -51,12 +51,20 @@ export default class Input extends Component {
|
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
+
onChange = (e) => {
|
|
55
|
+
const { onChange } = this.props;
|
|
56
|
+
if (onChange) {
|
|
57
|
+
onChange(e);
|
|
58
|
+
} else {
|
|
59
|
+
this.setState({ value: e.target.value });
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
54
63
|
renderInput = () => {
|
|
55
64
|
const {
|
|
56
65
|
type,
|
|
57
66
|
name,
|
|
58
67
|
disabled,
|
|
59
|
-
onChange,
|
|
60
68
|
value,
|
|
61
69
|
error,
|
|
62
70
|
placeholder,
|
|
@@ -110,7 +118,7 @@ export default class Input extends Component {
|
|
|
110
118
|
value: value !== undefined ? value : stateValue,
|
|
111
119
|
size: length,
|
|
112
120
|
disabled,
|
|
113
|
-
onChange,
|
|
121
|
+
onChange: this.onChange,
|
|
114
122
|
})}
|
|
115
123
|
{type === 'number' && (
|
|
116
124
|
<div>
|
|
@@ -95,6 +95,7 @@ const Template = (args) => {
|
|
|
95
95
|
/>
|
|
96
96
|
<Input placeholder="Type search" type="search" label="Search" />
|
|
97
97
|
<Input placeholder="Number input" type="number" label="Number" />
|
|
98
|
+
<Input placeholder="Color input" type="color" label="Color" />
|
|
98
99
|
</div>
|
|
99
100
|
);
|
|
100
101
|
};
|