@homecode/ui 4.18.67 → 4.18.68
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.
|
@@ -254,8 +254,9 @@ class Select extends Component {
|
|
|
254
254
|
this.store.isOpen = !this.store.isOpen;
|
|
255
255
|
};
|
|
256
256
|
setSearchVal(searchVal) {
|
|
257
|
-
|
|
258
|
-
this.
|
|
257
|
+
const searchString = String(searchVal);
|
|
258
|
+
this.searchValLower = searchString.toLowerCase();
|
|
259
|
+
this.store.searchVal = searchString;
|
|
259
260
|
}
|
|
260
261
|
getItems = () => [...this.props.additionalOptions, ...this.optionsTree];
|
|
261
262
|
getItem = id => this.ids.items[id];
|
|
@@ -376,10 +377,15 @@ class Select extends Component {
|
|
|
376
377
|
return null;
|
|
377
378
|
}
|
|
378
379
|
getInputVal() {
|
|
379
|
-
const {
|
|
380
|
+
const { value, options } = this.props;
|
|
381
|
+
const { isFocused, selected, isOpen } = this.store;
|
|
380
382
|
const searchValue = this.props.searchValue ?? this.store.searchVal;
|
|
381
|
-
if (isFocused)
|
|
382
|
-
|
|
383
|
+
if (isFocused) {
|
|
384
|
+
if (isOpen)
|
|
385
|
+
return searchValue ?? '';
|
|
386
|
+
if (value)
|
|
387
|
+
return value;
|
|
388
|
+
}
|
|
383
389
|
const selectedPlain = Object.entries(selected).reduce((acc, entry) => {
|
|
384
390
|
const parentId = this.coerceType(entry[0]);
|
|
385
391
|
const val = entry[1];
|
|
@@ -393,9 +399,10 @@ class Select extends Component {
|
|
|
393
399
|
}
|
|
394
400
|
return acc;
|
|
395
401
|
}, []);
|
|
396
|
-
if (selectedPlain.length
|
|
397
|
-
return
|
|
398
|
-
|
|
402
|
+
if (selectedPlain.length > 0) {
|
|
403
|
+
return selectedPlain.map(id => this.getItem(id)?.label).join(', ');
|
|
404
|
+
}
|
|
405
|
+
return searchValue;
|
|
399
406
|
}
|
|
400
407
|
getLabel(id) {
|
|
401
408
|
const { label, render } = Object(this.getItem(id));
|