@evoke-platform/ui-components 1.0.0-dev.142 → 1.0.0-dev.144
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/custom/FormField/AddressFieldComponent/addressFieldComponent.js
CHANGED
@@ -12,16 +12,17 @@ const AddressFieldComponent = (props) => {
|
|
12
12
|
const id = property.id;
|
13
13
|
const [anchorEl, setAnchorEl] = React.useState(null);
|
14
14
|
const open = Boolean(anchorEl);
|
15
|
-
const
|
15
|
+
const popoverId = open ? `${id}-popover` : undefined;
|
16
16
|
useEffect(() => {
|
17
17
|
setValue(defaultValue !== null && defaultValue !== void 0 ? defaultValue : '');
|
18
18
|
}, [defaultValue]);
|
19
19
|
const handleChange = (e) => {
|
20
20
|
setAnchorEl(e.currentTarget);
|
21
|
-
const inputValue = e.target.value;
|
21
|
+
const inputValue = e.target.value || '';
|
22
22
|
setValue(inputValue);
|
23
23
|
queryAddresses &&
|
24
|
-
|
24
|
+
inputValue.length > 1 &&
|
25
|
+
queryAddresses(inputValue).then((addresses) => {
|
25
26
|
setSelectOptions(addresses
|
26
27
|
.filter((address) => address.address.line1)
|
27
28
|
.map((address) => {
|
@@ -56,7 +57,7 @@ const AddressFieldComponent = (props) => {
|
|
56
57
|
setAnchorEl(null);
|
57
58
|
};
|
58
59
|
return (React.createElement(Box, null,
|
59
|
-
!mask ? (React.createElement(TextField, { id: id, "aria-describedby":
|
60
|
+
!mask ? (React.createElement(TextField, { id: id, "aria-describedby": popoverId, onChange: !readOnly ? handleChange : undefined, error: error, errorMessage: errorMessage, value: value, fullWidth: true, onBlur: onBlur, size: size !== null && size !== void 0 ? size : 'medium', placeholder: placeholder, InputProps: {
|
60
61
|
type: 'search',
|
61
62
|
autoComplete: 'off',
|
62
63
|
}, required: required, readOnly: readOnly, multiline: property.type === 'string' && !readOnly && isMultiLineText, rows: isMultiLineText ? (rows ? rows : 3) : undefined })) : (React.createElement(InputMask, { mask: mask, maskChar: inputMaskPlaceholderChar !== null && inputMaskPlaceholderChar !== void 0 ? inputMaskPlaceholderChar : '_', value: value, onChange: !readOnly ? handleChange : undefined, onBlur: onBlur, alwaysShowMask: true }, () => (React.createElement(TextField, { id: id, sx: readOnly
|
@@ -70,7 +71,7 @@ const AddressFieldComponent = (props) => {
|
|
70
71
|
},
|
71
72
|
}
|
72
73
|
: undefined, required: required, error: error, errorMessage: errorMessage, InputProps: { readOnly: readOnly }, fullWidth: true, size: size !== null && size !== void 0 ? size : 'medium', type: 'text', multiline: property.type === 'string' && !readOnly && isMultiLineText, rows: isMultiLineText ? (rows ? rows : 3) : undefined, value: value })))),
|
73
|
-
!readOnly && (React.createElement(Popover, { id:
|
74
|
+
!readOnly && (React.createElement(Popover, { id: popoverId, open: open, anchorEl: anchorEl, onClose: handleClose, disableAutoFocus: true, marginThreshold: null, anchorOrigin: {
|
74
75
|
vertical: 'bottom',
|
75
76
|
horizontal: 'left',
|
76
77
|
}, transformOrigin: {
|
@@ -79,11 +80,12 @@ const AddressFieldComponent = (props) => {
|
|
79
80
|
}, PaperProps: {
|
80
81
|
sx: {
|
81
82
|
width: '100%',
|
82
|
-
|
83
|
-
|
83
|
+
height: '400px',
|
84
|
+
maxWidth: '300px',
|
84
85
|
boxShadow: 'none',
|
86
|
+
zIndex: 2000,
|
85
87
|
},
|
86
|
-
}
|
88
|
+
} },
|
87
89
|
React.createElement(List, null,
|
88
90
|
selectOptions.map((option) => {
|
89
91
|
return (React.createElement(ListItem, { onClick: () => handleClick(option), sx: {
|