@evoke-platform/ui-components 1.0.0-dev.182 → 1.0.0-dev.184
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.
@@ -21,6 +21,7 @@ export declare type FormFieldProps = {
|
|
21
21
|
queryAddresses?: Function;
|
22
22
|
isOptionEqualToValue?: Function;
|
23
23
|
renderOption?: Function;
|
24
|
+
getOptionLabel?: Function;
|
24
25
|
disableCloseOnSelect?: boolean;
|
25
26
|
};
|
26
27
|
declare const FormField: (props: FormFieldProps) => any;
|
@@ -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, isOptionEqualToValue, renderOption, disableCloseOnSelect, } = props;
|
10
|
+
const { defaultValue, error, onChange, property, readOnly, selectOptions, required, size, placeholder, errorMessage, onBlur, mask, max, min, isMultiLineText, rows, inputMaskPlaceholderChar, queryAddresses, isOptionEqualToValue, renderOption, disableCloseOnSelect, getOptionLabel } = props;
|
11
11
|
const id = property.id;
|
12
12
|
let control;
|
13
13
|
const commonProps = {
|
@@ -27,6 +27,7 @@ const FormField = (props) => {
|
|
27
27
|
max,
|
28
28
|
isOptionEqualToValue,
|
29
29
|
renderOption,
|
30
|
+
getOptionLabel,
|
30
31
|
disableCloseOnSelect,
|
31
32
|
};
|
32
33
|
if (queryAddresses) {
|
@@ -3,7 +3,7 @@ import { Autocomplete, TextField } from '../../../core';
|
|
3
3
|
import InputFieldComponent from '../InputFieldComponent/InputFieldComponent';
|
4
4
|
const Select = (props) => {
|
5
5
|
var _a, _b;
|
6
|
-
const { property, defaultValue, error, errorMessage, onBlur, readOnly, selectOptions, required, size, isOptionEqualToValue, renderOption, disableCloseOnSelect, } = props;
|
6
|
+
const { property, defaultValue, error, errorMessage, onBlur, readOnly, selectOptions, required, size, isOptionEqualToValue, renderOption, getOptionLabel, disableCloseOnSelect, } = props;
|
7
7
|
const [value, setValue] = useState(defaultValue);
|
8
8
|
const [inputValue, setInputValue] = useState('');
|
9
9
|
useEffect(() => {
|
@@ -30,7 +30,7 @@ const Select = (props) => {
|
|
30
30
|
};
|
31
31
|
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: (_b = (_a = selectOptions) !== null && _a !== void 0 ? _a : property === null || property === void 0 ? void 0 : property.enum) !== null && _b !== void 0 ? _b : [], disableClearable: true, inputValue: inputValue !== null && inputValue !== void 0 ? inputValue : '', error: error, errorMessage: errorMessage, required: required, onInputChange: handleInputValueChange, size: size, isOptionEqualToValue: isOptionEqualToValue
|
32
32
|
? (option, value) => isOptionEqualToValue(option, value)
|
33
|
-
: undefined, renderOption: renderOption
|
33
|
+
: undefined, getOptionLabel: getOptionLabel ? (option) => getOptionLabel(option) : undefined, renderOption: renderOption
|
34
34
|
? (props, option, state) => renderOption(props, option, state)
|
35
35
|
: undefined, disableCloseOnSelect: disableCloseOnSelect }));
|
36
36
|
};
|