venice-ui 2.1.7 → 2.1.9
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(',', '.')
|
|
@@ -46,11 +45,11 @@ const Form = ({ formData, size = 'medium', read }) => {
|
|
|
46
45
|
case 'text':
|
|
47
46
|
return (react_1.default.createElement(Input_1.Input, { label: item.label, value: item.value, name: item.name, type: "text", size: size, handleChange: onChangeHandler, readOnly: read, autoFocus: !!item.isDisabled && item.autofocus, handleSubmit: item.submit, disabled: item.isDisabled, error: item.error }));
|
|
48
47
|
case 'number':
|
|
49
|
-
return (react_1.default.createElement(Input_1.Input, { label: item.label, value: item.value, name: item.name, type: "number", size: size, min: item.min, max: item.max, step: item.step, handleChange: onIntChangeHandler, readOnly: read, autoFocus: !!item.isDisabled && item.autofocus, handleSubmit: item.submit, disabled: item.isDisabled, error: item.error }));
|
|
48
|
+
return (react_1.default.createElement(Input_1.Input, { label: item.label, value: item.value, name: item.name, type: "number", size: size, min: item.min, max: item.max, step: item.step, handleChange: onIntChangeHandler, readOnly: read, autoFocus: !!item.isDisabled && item.autofocus, handleSubmit: item.submit, disabled: item.isDisabled, error: item.error, placeholder: item.placeholder }));
|
|
50
49
|
case 'increase':
|
|
51
|
-
return (react_1.default.createElement(Input_1.Input, { type: "increase", label: item.label, value: item.value, name: item.name, size: size, handleChange: onIntChangeHandler, min: item.min, max: item.max, step: item.step, readOnly: read, autoFocus: item.autofocus, handleSubmit: item.submit, error: item.error }));
|
|
50
|
+
return (react_1.default.createElement(Input_1.Input, { type: "increase", label: item.label, value: item.value, name: item.name, size: size, handleChange: onIntChangeHandler, min: item.min, max: item.max, step: item.step, readOnly: read, autoFocus: item.autofocus, handleSubmit: item.submit, error: item.error, placeholder: item.placeholder }));
|
|
52
51
|
case 'select':
|
|
53
|
-
return (react_1.default.createElement(Dropdown_1.Dropdown, { options: item.options, handleSelect: onChangeHandler, name: item.name, value: item.value, size: size, label: item.label, position: item.position, zIndex: item.zIndex, readOnly: read, error: item.error }));
|
|
52
|
+
return (react_1.default.createElement(Dropdown_1.Dropdown, { options: item.options, handleSelect: onChangeHandler, name: item.name, value: item.value, size: size, label: item.label, position: item.position, zIndex: item.zIndex, readOnly: read, error: item.error, placeholder: item.placeholder }));
|
|
54
53
|
case 'file':
|
|
55
54
|
return (react_1.default.createElement(File_1.File, { label: item.label, fileValue: item.value, name: item.name, size: size, handleChange: onFileHandler, readOnly: read, subLabel: item.subLabel, error: item.error }));
|
|
56
55
|
case 'date':
|
|
@@ -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
|
|
@@ -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(',', '.')
|
|
@@ -40,11 +39,11 @@ export const Form = ({ formData, size = 'medium', read }) => {
|
|
|
40
39
|
case 'text':
|
|
41
40
|
return (React.createElement(Input, { label: item.label, value: item.value, name: item.name, type: "text", size: size, handleChange: onChangeHandler, readOnly: read, autoFocus: !!item.isDisabled && item.autofocus, handleSubmit: item.submit, disabled: item.isDisabled, error: item.error }));
|
|
42
41
|
case 'number':
|
|
43
|
-
return (React.createElement(Input, { label: item.label, value: item.value, name: item.name, type: "number", size: size, min: item.min, max: item.max, step: item.step, handleChange: onIntChangeHandler, readOnly: read, autoFocus: !!item.isDisabled && item.autofocus, handleSubmit: item.submit, disabled: item.isDisabled, error: item.error }));
|
|
42
|
+
return (React.createElement(Input, { label: item.label, value: item.value, name: item.name, type: "number", size: size, min: item.min, max: item.max, step: item.step, handleChange: onIntChangeHandler, readOnly: read, autoFocus: !!item.isDisabled && item.autofocus, handleSubmit: item.submit, disabled: item.isDisabled, error: item.error, placeholder: item.placeholder }));
|
|
44
43
|
case 'increase':
|
|
45
|
-
return (React.createElement(Input, { type: "increase", label: item.label, value: item.value, name: item.name, size: size, handleChange: onIntChangeHandler, min: item.min, max: item.max, step: item.step, readOnly: read, autoFocus: item.autofocus, handleSubmit: item.submit, error: item.error }));
|
|
44
|
+
return (React.createElement(Input, { type: "increase", label: item.label, value: item.value, name: item.name, size: size, handleChange: onIntChangeHandler, min: item.min, max: item.max, step: item.step, readOnly: read, autoFocus: item.autofocus, handleSubmit: item.submit, error: item.error, placeholder: item.placeholder }));
|
|
46
45
|
case 'select':
|
|
47
|
-
return (React.createElement(Dropdown, { options: item.options, handleSelect: onChangeHandler, name: item.name, value: item.value, size: size, label: item.label, position: item.position, zIndex: item.zIndex, readOnly: read, error: item.error }));
|
|
46
|
+
return (React.createElement(Dropdown, { options: item.options, handleSelect: onChangeHandler, name: item.name, value: item.value, size: size, label: item.label, position: item.position, zIndex: item.zIndex, readOnly: read, error: item.error, placeholder: item.placeholder }));
|
|
48
47
|
case 'file':
|
|
49
48
|
return (React.createElement(File, { label: item.label, fileValue: item.value, name: item.name, size: size, handleChange: onFileHandler, readOnly: read, subLabel: item.subLabel, error: item.error }));
|
|
50
49
|
case 'date':
|
|
@@ -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
|