venice-ui 2.1.6 → 2.1.8
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.
|
@@ -19,7 +19,6 @@ const Form = ({ formData, size = 'medium', read }) => {
|
|
|
19
19
|
};
|
|
20
20
|
const onIntChangeHandler = (name, value) => {
|
|
21
21
|
let valueString = value;
|
|
22
|
-
console.log('onIntChangeHandler', valueString);
|
|
23
22
|
if (valueString.length > 0) {
|
|
24
23
|
const modify = valueString
|
|
25
24
|
.replaceAll(',', '.')
|
|
@@ -33,6 +33,7 @@ const Theme_1 = require("../../Theme");
|
|
|
33
33
|
const lodash_1 = require("lodash");
|
|
34
34
|
const Input = ({ label, labelPosition = 'top', value, type = 'text', name, disabled = false, size = 'medium', handleChange, handleSubmit, width, error = false, errorMsg, placeholder, min, max, step = 0.1, autoFocus, theme = Theme_1.mainTheme, readOnly = false, prefix, }) => {
|
|
35
35
|
const [inputValue, setInputValue] = (0, react_1.useState)(value);
|
|
36
|
+
(0, react_1.useEffect)(() => { setInputValue(value); }, [value]);
|
|
36
37
|
const calculateNumberValue = (numberValue) => {
|
|
37
38
|
return isNaN(parseFloat(numberValue))
|
|
38
39
|
? numberValue
|
|
@@ -46,7 +47,7 @@ const Input = ({ label, labelPosition = 'top', value, type = 'text', name, disab
|
|
|
46
47
|
? calculateNumberValue(e.target.value)
|
|
47
48
|
: e.target.value.toString();
|
|
48
49
|
setInputValue(returnedValue);
|
|
49
|
-
debouncedHandleChange(name,
|
|
50
|
+
debouncedHandleChange(name, returnedValue);
|
|
50
51
|
};
|
|
51
52
|
const onBlurValidation = () => {
|
|
52
53
|
if (type === 'number' || type === 'increase') {
|
|
@@ -13,7 +13,6 @@ export const Form = ({ formData, size = 'medium', read }) => {
|
|
|
13
13
|
};
|
|
14
14
|
const onIntChangeHandler = (name, value) => {
|
|
15
15
|
let valueString = value;
|
|
16
|
-
console.log('onIntChangeHandler', valueString);
|
|
17
16
|
if (valueString.length > 0) {
|
|
18
17
|
const modify = valueString
|
|
19
18
|
.replaceAll(',', '.')
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useCallback, useState } from 'react';
|
|
1
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
2
|
import { ThemeProvider } from 'styled-components';
|
|
3
3
|
import { Aligment } from '../Aligment';
|
|
4
4
|
import { InputTextElement, InputLabelElement, InputErrorMsg, InputWrapper, EyeIconWrapper, IconsWrapper, InputReadOnlyElement, Prefix, } from './Input.styles';
|
|
@@ -7,6 +7,7 @@ import { mainTheme } from '../../Theme';
|
|
|
7
7
|
import { debounce } from 'lodash';
|
|
8
8
|
export const Input = ({ label, labelPosition = 'top', value, type = 'text', name, disabled = false, size = 'medium', handleChange, handleSubmit, width, error = false, errorMsg, placeholder, min, max, step = 0.1, autoFocus, theme = mainTheme, readOnly = false, prefix, }) => {
|
|
9
9
|
const [inputValue, setInputValue] = useState(value);
|
|
10
|
+
useEffect(() => { setInputValue(value); }, [value]);
|
|
10
11
|
const calculateNumberValue = (numberValue) => {
|
|
11
12
|
return isNaN(parseFloat(numberValue))
|
|
12
13
|
? numberValue
|
|
@@ -20,7 +21,7 @@ export const Input = ({ label, labelPosition = 'top', value, type = 'text', name
|
|
|
20
21
|
? calculateNumberValue(e.target.value)
|
|
21
22
|
: e.target.value.toString();
|
|
22
23
|
setInputValue(returnedValue);
|
|
23
|
-
debouncedHandleChange(name,
|
|
24
|
+
debouncedHandleChange(name, returnedValue);
|
|
24
25
|
};
|
|
25
26
|
const onBlurValidation = () => {
|
|
26
27
|
if (type === 'number' || type === 'increase') {
|