@evoke-platform/ui-components 1.0.0-dev.176 → 1.0.0-dev.178
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/dist/published/components/core/Autocomplete/Autocomplete.js +2 -2
- package/dist/published/components/custom/FormField/FormField.d.ts +2 -0
- package/dist/published/components/custom/FormField/FormField.js +3 -1
- package/dist/published/components/custom/FormField/Select/Select.js +6 -2
- package/package.json +2 -2
@@ -36,7 +36,7 @@ const Autocomplete = (props) => {
|
|
36
36
|
border: props.readOnly ? 'none' : 'auto',
|
37
37
|
}, '& .MuiInputBase-input.Mui-disabled': {
|
38
38
|
WebkitTextFillColor: props.readOnly ? 'black' : 'auto',
|
39
|
-
}, backgroundColor: props.readOnly ? '#f4f6f8' : 'auto', marginTop: '3px', borderRadius: '8px' }, props.sx), options: sortedOptions, popupIcon: (_d = props.popupIcon) !== null && _d !== void 0 ? _d : React.createElement(ExpandMore, null) })),
|
39
|
+
}, backgroundColor: props.readOnly ? '#f4f6f8' : 'auto', marginTop: '3px', borderRadius: '8px' }, props.sx), options: sortedOptions, popupIcon: ((_d = props.popupIcon) !== null && _d !== void 0 ? _d : (props.readOnly || props.disabled)) ? null : React.createElement(ExpandMore, null) })),
|
40
40
|
props.error && React.createElement(FieldError, { required: props.required, label: props.errorMessage })));
|
41
41
|
}
|
42
42
|
else {
|
@@ -45,7 +45,7 @@ const Autocomplete = (props) => {
|
|
45
45
|
border: props.readOnly ? 'none' : 'auto',
|
46
46
|
}, '& .MuiInputBase-input.Mui-disabled': {
|
47
47
|
WebkitTextFillColor: props.readOnly ? 'black' : 'auto',
|
48
|
-
}, backgroundColor: props.readOnly ? '#f4f6f8' : 'auto', borderRadius: '8px' }, props.sx), options: sortedOptions, popupIcon: (_e = props.popupIcon) !== null && _e !== void 0 ? _e : React.createElement(ExpandMore, null) })),
|
48
|
+
}, backgroundColor: props.readOnly ? '#f4f6f8' : 'auto', borderRadius: '8px' }, props.sx), options: sortedOptions, popupIcon: ((_e = props.popupIcon) !== null && _e !== void 0 ? _e : (props.readOnly || props.disabled)) ? null : React.createElement(ExpandMore, null) })),
|
49
49
|
props.error && React.createElement(FieldError, { required: props.required, label: props.errorMessage })));
|
50
50
|
}
|
51
51
|
};
|
@@ -19,6 +19,8 @@ export declare type FormFieldProps = {
|
|
19
19
|
rows?: number;
|
20
20
|
inputMaskPlaceholderChar?: string;
|
21
21
|
queryAddresses?: Function;
|
22
|
+
isOptionEqualToValue?: Function;
|
23
|
+
renderOption?: Function;
|
22
24
|
};
|
23
25
|
declare const FormField: (props: FormFieldProps) => any;
|
24
26
|
export default FormField;
|
@@ -7,7 +7,7 @@ import InputFieldComponent from './InputFieldComponent/InputFieldComponent';
|
|
7
7
|
import Select from './Select/Select';
|
8
8
|
import TimePickerSelect from './TimePickerSelect/TimePickerSelect';
|
9
9
|
const FormField = (props) => {
|
10
|
-
const { defaultValue, error, onChange, property, readOnly, selectOptions, required, size, placeholder, errorMessage, onBlur, mask, max, min, isMultiLineText, rows, inputMaskPlaceholderChar, queryAddresses, } = props;
|
10
|
+
const { defaultValue, error, onChange, property, readOnly, selectOptions, required, size, placeholder, errorMessage, onBlur, mask, max, min, isMultiLineText, rows, inputMaskPlaceholderChar, queryAddresses, isOptionEqualToValue, renderOption, } = props;
|
11
11
|
const id = property.id;
|
12
12
|
let control;
|
13
13
|
const commonProps = {
|
@@ -25,6 +25,8 @@ const FormField = (props) => {
|
|
25
25
|
placeholder,
|
26
26
|
min,
|
27
27
|
max,
|
28
|
+
isOptionEqualToValue,
|
29
|
+
renderOption,
|
28
30
|
};
|
29
31
|
if (queryAddresses) {
|
30
32
|
control = (React.createElement(AddressFieldComponent, Object.assign({}, commonProps, { mask: mask, inputMaskPlaceholderChar: inputMaskPlaceholderChar, isMultiLineText: isMultiLineText, rows: rows, queryAddresses: queryAddresses })));
|
@@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { Autocomplete, TextField } from '../../../core';
|
3
3
|
import InputFieldComponent from '../InputFieldComponent/InputFieldComponent';
|
4
4
|
const Select = (props) => {
|
5
|
-
const { property, defaultValue, error, errorMessage, onBlur, readOnly, selectOptions, required, size } = props;
|
5
|
+
const { property, defaultValue, error, errorMessage, onBlur, readOnly, selectOptions, required, size, isOptionEqualToValue, renderOption, } = props;
|
6
6
|
const [value, setValue] = useState(defaultValue);
|
7
7
|
const [inputValue, setInputValue] = useState('');
|
8
8
|
useEffect(() => {
|
@@ -27,6 +27,10 @@ const Select = (props) => {
|
|
27
27
|
setInputValue(selectValue);
|
28
28
|
}
|
29
29
|
};
|
30
|
-
return readOnly ? (React.createElement(InputFieldComponent, Object.assign({}, props))) : (React.createElement(Autocomplete, { multiple: (property === null || property === void 0 ? void 0 : property.type) === 'array' ? true : false, id: id, renderInput: (params) => React.createElement(TextField, Object.assign({}, params, { value: value, fullWidth: true, onBlur: onBlur })), value: value !== null && value !== void 0 ? value : ((property === null || property === void 0 ? void 0 : property.type) === 'array' ? [] : undefined), onChange: handleChange, options: (property === null || property === void 0 ? void 0 : property.type) === 'array' ? property === null || property === void 0 ? void 0 : property.enum : selectOptions, disableClearable: true, inputValue: inputValue !== null && inputValue !== void 0 ? inputValue : '', error: error, errorMessage: errorMessage, required: required, onInputChange: handleInputValueChange, filterOptions: (option) => { var _a; return (property === null || property === void 0 ? void 0 : property.type) === 'array' ? (_a = property === null || property === void 0 ? void 0 : property.enum) === null || _a === void 0 ? void 0 : _a.filter((item) => item !== option.value) : option; }, size: size
|
30
|
+
return readOnly ? (React.createElement(InputFieldComponent, Object.assign({}, props))) : (React.createElement(Autocomplete, { multiple: (property === null || property === void 0 ? void 0 : property.type) === 'array' ? true : false, id: id, renderInput: (params) => React.createElement(TextField, Object.assign({}, params, { value: value, fullWidth: true, onBlur: onBlur })), value: value !== null && value !== void 0 ? value : ((property === null || property === void 0 ? void 0 : property.type) === 'array' ? [] : undefined), onChange: handleChange, options: (property === null || property === void 0 ? void 0 : property.type) === 'array' ? property === null || property === void 0 ? void 0 : property.enum : selectOptions, disableClearable: true, inputValue: inputValue !== null && inputValue !== void 0 ? inputValue : '', error: error, errorMessage: errorMessage, required: required, onInputChange: handleInputValueChange, filterOptions: (option) => { var _a; return (property === null || property === void 0 ? void 0 : property.type) === 'array' ? (_a = property === null || property === void 0 ? void 0 : property.enum) === null || _a === void 0 ? void 0 : _a.filter((item) => item !== option.value) : option; }, size: size, isOptionEqualToValue: isOptionEqualToValue
|
31
|
+
? (option, value) => isOptionEqualToValue(option, value)
|
32
|
+
: undefined, renderOption: renderOption
|
33
|
+
? (props, option, state) => renderOption(props, option, state)
|
34
|
+
: undefined }));
|
31
35
|
};
|
32
36
|
export default Select;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@evoke-platform/ui-components",
|
3
|
-
"version": "1.0.0-dev.
|
3
|
+
"version": "1.0.0-dev.178",
|
4
4
|
"description": "",
|
5
5
|
"main": "dist/published/index.js",
|
6
6
|
"module": "dist/published/index.js",
|
@@ -13,7 +13,7 @@
|
|
13
13
|
".": "./dist/published/index.js",
|
14
14
|
"./colors": "./dist/published/colors/index.js",
|
15
15
|
"./icons": "./dist/published/icons/index.js"
|
16
|
-
|
16
|
+
},
|
17
17
|
"scripts": {
|
18
18
|
"test": "jest",
|
19
19
|
"copy-styles": "copyfiles -u 1 src/styles/*.css dist/published/",
|