@evoke-platform/ui-components 1.0.0-dev.1.10.8 → 1.0.0-dev.1.10.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.
@@ -5,7 +5,7 @@ import FileUploadControl from './FileUpload/FileUpload';
|
|
5
5
|
import InputFieldComponent from './InputFieldComponent/InputFieldComponent';
|
6
6
|
import Select from './Select/Select';
|
7
7
|
const FormField = (props) => {
|
8
|
-
const { defaultValue, error, onChange, property, readOnly, selectOptions, required, size, placeholder, errorMessage } = props;
|
8
|
+
const { defaultValue, error, onChange, property, readOnly, selectOptions, required, size, placeholder, errorMessage, mask } = props;
|
9
9
|
const id = property.id;
|
10
10
|
let control;
|
11
11
|
const commonProps = {
|
@@ -38,7 +38,7 @@ const FormField = (props) => {
|
|
38
38
|
control = React.createElement(Select, Object.assign({}, commonProps));
|
39
39
|
break;
|
40
40
|
default:
|
41
|
-
control = React.createElement(InputFieldComponent, Object.assign({}, commonProps));
|
41
|
+
control = React.createElement(InputFieldComponent, Object.assign({}, commonProps, { mask: mask }));
|
42
42
|
break;
|
43
43
|
}
|
44
44
|
return control;
|
package/dist/published/components/custom/FormField/InputFieldComponent/InputFieldComponent.js
CHANGED
@@ -12,6 +12,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
12
12
|
import React, { useEffect, useState } from 'react';
|
13
13
|
import NumberFormat from 'react-number-format';
|
14
14
|
import { Autocomplete, TextField } from '../../../core';
|
15
|
+
import InputMask from 'react-input-mask';
|
15
16
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
16
17
|
const NumericFormat = (props) => {
|
17
18
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
@@ -22,11 +23,11 @@ const NumericFormat = (props) => {
|
|
22
23
|
value: values.floatValue,
|
23
24
|
},
|
24
25
|
});
|
25
|
-
}, thousandSeparator: true, isNumericString: true, fixedDecimalScale: true, allowNegative:
|
26
|
+
}, thousandSeparator: true, isNumericString: true, fixedDecimalScale: true, allowNegative: false })));
|
26
27
|
};
|
27
28
|
const InputFieldComponent = (props) => {
|
28
29
|
var _a;
|
29
|
-
const { property, defaultValue, error, errorMessage, readOnly, required, size, placeholder } = props;
|
30
|
+
const { property, defaultValue, error, errorMessage, readOnly, required, size, placeholder, mask } = props;
|
30
31
|
const [value, setValue] = useState(defaultValue !== null && defaultValue !== void 0 ? defaultValue : '');
|
31
32
|
const [inputValue, setInputValue] = useState('');
|
32
33
|
const id = property.id;
|
@@ -61,7 +62,7 @@ const InputFieldComponent = (props) => {
|
|
61
62
|
}
|
62
63
|
return property.enum && !readOnly ? (React.createElement(Autocomplete, { id: id, options: selectOptions, onChange: handleSelectChange, renderInput: (params) => (React.createElement(TextField, Object.assign({}, params, { value: value, error: error, errorMessage: errorMessage, fullWidth: true, size: size !== null && size !== void 0 ? size : 'medium', placeholder: placeholder }))), disableClearable: true, value: value, isOptionEqualToValue: (option, value) => {
|
63
64
|
return option.value === value;
|
64
|
-
}, error: error, required: required, inputValue: inputValue !== null && inputValue !== void 0 ? inputValue : '', onInputChange: handleInputValueChange })) : (React.createElement(TextField, { id: id, sx: readOnly
|
65
|
+
}, error: error, required: required, inputValue: inputValue !== null && inputValue !== void 0 ? inputValue : '', onInputChange: handleInputValueChange })) : !mask ? (React.createElement(TextField, { id: id, sx: readOnly
|
65
66
|
? {
|
66
67
|
'& .MuiOutlinedInput-notchedOutline': {
|
67
68
|
border: 'none',
|
@@ -71,6 +72,17 @@ const InputFieldComponent = (props) => {
|
|
71
72
|
backgroundColor: '#f4f6f8',
|
72
73
|
},
|
73
74
|
}
|
74
|
-
: undefined, error: error, errorMessage: errorMessage, value: value, onChange: !readOnly ? handleChange : undefined, InputProps: Object.assign(Object.assign({}, InputProps), { readOnly: readOnly }), required: required, fullWidth: true, placeholder: placeholder, style: { background: 'white', borderRadius: '8px' }, size: size !== null && size !== void 0 ? size : 'medium', type: property.type === 'integer' ? 'number' : 'text', multiline: property.type === 'string' && !!readOnly }))
|
75
|
+
: undefined, error: error, errorMessage: errorMessage, value: value, onChange: !readOnly ? handleChange : undefined, InputProps: Object.assign(Object.assign({}, InputProps), { readOnly: readOnly }), required: required, fullWidth: true, placeholder: placeholder, style: { background: 'white', borderRadius: '8px' }, size: size !== null && size !== void 0 ? size : 'medium', type: property.type === 'integer' ? 'number' : 'text', multiline: property.type === 'string' && !!readOnly })) : (React.createElement(InputMask, { mask: mask, value: value, onChange: !readOnly ? handleChange : undefined, alwaysShowMask: true },
|
76
|
+
React.createElement(TextField, { id: id, sx: readOnly
|
77
|
+
? {
|
78
|
+
'& .MuiOutlinedInput-notchedOutline': {
|
79
|
+
border: 'none',
|
80
|
+
},
|
81
|
+
'.MuiOutlinedInput-root': {
|
82
|
+
borderRadius: '8px',
|
83
|
+
backgroundColor: '#f4f6f8',
|
84
|
+
},
|
85
|
+
}
|
86
|
+
: undefined, error: error, InputProps: Object.assign(Object.assign({}, InputProps), { readOnly: readOnly }), fullWidth: true, type: property.type === 'integer' ? 'number' : 'text' })));
|
75
87
|
};
|
76
88
|
export default InputFieldComponent;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@evoke-platform/ui-components",
|
3
|
-
"version": "1.0.0-dev.1.10.
|
3
|
+
"version": "1.0.0-dev.1.10.9",
|
4
4
|
"description": "",
|
5
5
|
"main": "dist/published/index.js",
|
6
6
|
"module": "dist/published/index.js",
|
@@ -72,6 +72,7 @@
|
|
72
72
|
"@react-querybuilder/material": "^5.4.1",
|
73
73
|
"lodash-es": "^4.17.21",
|
74
74
|
"react-dropzone": "^14.2.2",
|
75
|
+
"react-input-mask": "^3.0.0-alpha.2",
|
75
76
|
"react-number-format": "^4.9.3",
|
76
77
|
"react-querybuilder": "^6.0.2"
|
77
78
|
},
|