@homecode/ui 4.29.0 → 4.29.1
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.
|
@@ -17,7 +17,7 @@ import useEvent from '../../hooks/useEvent.js';
|
|
|
17
17
|
import S from './Select.styl.js';
|
|
18
18
|
|
|
19
19
|
function Select2(props) {
|
|
20
|
-
const { className, value, onChange, onSearchChange, disableTriggerArrow, inputProps, popupProps, scrollProps, size = 'm', round, optionClassName, additionalOptions = [], options, variant, label, error, blur, disabled, trigger, required, hideRequiredStar, isSearchable, presets = [], selectAllButton, clearButton, showSelectedCount, disableLabel, } = props;
|
|
20
|
+
const { className, value, onChange, onSearchChange, disableTriggerArrow, inputProps, popupProps, scrollProps, size = 'm', round, optionClassName, additionalOptions = [], options, variant, label, additionalLabel, error, blur, disabled, trigger, required, hideRequiredStar, isSearchable, presets = [], selectAllButton, clearButton, showSelectedCount, disableLabel, } = props;
|
|
21
21
|
const isMultiple$1 = isMultiple(value);
|
|
22
22
|
const closeOnSelect = props.closeOnSelect ?? !isMultiple$1;
|
|
23
23
|
const contentRef = useRef(null);
|
|
@@ -172,7 +172,6 @@ function Select2(props) {
|
|
|
172
172
|
}, [])
|
|
173
173
|
.join(', '));
|
|
174
174
|
}, [isMultiple$1, value, ids]);
|
|
175
|
-
// console.log('selectedLabel::', selectedLabel);
|
|
176
175
|
const triggerArrow = useMemo(() => {
|
|
177
176
|
if (disableTriggerArrow || (inputProps?.hasClear && searchVal))
|
|
178
177
|
return null;
|
|
@@ -183,13 +182,10 @@ function Select2(props) {
|
|
|
183
182
|
// TODO: autoComplete
|
|
184
183
|
addonRight: triggerArrow, error: isErrorVisible, value: isFocused && isSearchActive ? searchVal : selectedLabel, onChange: handleSearchChange, label: getFieldLabel(label) }));
|
|
185
184
|
};
|
|
186
|
-
const renderAdditionalLabel = () => {
|
|
187
|
-
return null;
|
|
188
|
-
};
|
|
189
185
|
const renderTriggerButton = () => {
|
|
190
186
|
const { label, className, ...rest } = triggerProps;
|
|
191
187
|
const props = omit(rest, ['name', 'inputProps']);
|
|
192
|
-
const fullSelectedLabel = [selectedLabel,
|
|
188
|
+
const fullSelectedLabel = [selectedLabel, label, additionalLabel].filter(Boolean);
|
|
193
189
|
const hasSelected = fullSelectedLabel.length > 0;
|
|
194
190
|
const displayLabel = hasSelected ? fullSelectedLabel : label;
|
|
195
191
|
const title = hasSelected ? fullSelectedLabel : null;
|
|
@@ -263,6 +259,9 @@ function Select2(props) {
|
|
|
263
259
|
: options;
|
|
264
260
|
setNewItems(items);
|
|
265
261
|
}, [options]);
|
|
262
|
+
useEffect(() => {
|
|
263
|
+
setIsOpen(props.isOpen);
|
|
264
|
+
}, [props.isOpen]);
|
|
266
265
|
useEffect(() => {
|
|
267
266
|
const searchVal = props.searchValue;
|
|
268
267
|
if (searchVal)
|