@smilodon/core 1.13.0 → 1.18.0
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/README.md +47 -4
- package/dist/index.cjs +209 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +209 -30
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/index.umd.js +209 -30
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/dist/types/src/components/enhanced-select.d.ts +14 -1
- package/dist/types/src/config/global-config.d.ts +4 -0
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/types.d.ts +10 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2105,6 +2105,8 @@ const defaultConfig = {
|
|
|
2105
2105
|
overflowX: 'hidden',
|
|
2106
2106
|
overflowY: 'auto',
|
|
2107
2107
|
dragScroll: true,
|
|
2108
|
+
scrollToLatestChip: false,
|
|
2109
|
+
scrollToLatestChipBehavior: 'smooth',
|
|
2108
2110
|
},
|
|
2109
2111
|
scrollToSelected: {
|
|
2110
2112
|
enabled: true,
|
|
@@ -2970,23 +2972,23 @@ class SelectOption extends HTMLElement {
|
|
|
2970
2972
|
}
|
|
2971
2973
|
}
|
|
2972
2974
|
_attachEventListeners() {
|
|
2973
|
-
//
|
|
2975
|
+
// One delegated handler survives all SelectOption re-renders. In
|
|
2976
|
+
// particular, SVG descendants of the remove icon must remove the option,
|
|
2977
|
+
// not accidentally activate the surrounding option.
|
|
2974
2978
|
this._container.addEventListener('click', (e) => {
|
|
2975
|
-
|
|
2976
|
-
if (
|
|
2979
|
+
const target = e.target;
|
|
2980
|
+
if (this._removeButton
|
|
2981
|
+
&& target instanceof Node
|
|
2982
|
+
&& this._removeButton.contains(target)) {
|
|
2983
|
+
e.preventDefault();
|
|
2984
|
+
e.stopPropagation();
|
|
2985
|
+
this._handleRemove();
|
|
2977
2986
|
return;
|
|
2978
2987
|
}
|
|
2979
2988
|
if (!this._isDisabledSelectionBlocked()) {
|
|
2980
2989
|
this._handleSelect();
|
|
2981
2990
|
}
|
|
2982
2991
|
});
|
|
2983
|
-
// Remove button handler
|
|
2984
|
-
if (this._removeButton) {
|
|
2985
|
-
this._removeButton.addEventListener('click', (e) => {
|
|
2986
|
-
e.stopPropagation();
|
|
2987
|
-
this._handleRemove();
|
|
2988
|
-
});
|
|
2989
|
-
}
|
|
2990
2992
|
// Keyboard handler
|
|
2991
2993
|
this.addEventListener('keydown', (e) => {
|
|
2992
2994
|
if (this._isDisabledSelectionBlocked())
|
|
@@ -3049,7 +3051,6 @@ class SelectOption extends HTMLElement {
|
|
|
3049
3051
|
updateConfig(updates) {
|
|
3050
3052
|
this._config = { ...this._config, ...updates };
|
|
3051
3053
|
this._render();
|
|
3052
|
-
this._attachEventListeners();
|
|
3053
3054
|
}
|
|
3054
3055
|
/**
|
|
3055
3056
|
* Get current configuration
|
|
@@ -4064,6 +4065,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
4064
4065
|
intendedRenderKeys: [],
|
|
4065
4066
|
filteredIndexByKey: new Map(),
|
|
4066
4067
|
};
|
|
4068
|
+
this._emptyStateContext = null;
|
|
4067
4069
|
// Null keeps the public/default renderer on its legacy full path. This
|
|
4068
4070
|
// private state is only used by guarded virtualization integration.
|
|
4069
4071
|
this._guardedVirtualWindow = null;
|
|
@@ -4120,6 +4122,10 @@ class EnhancedSelect extends HTMLElement {
|
|
|
4120
4122
|
this._pendingFirstRenderMark = false;
|
|
4121
4123
|
this._pendingSearchRenderMark = false;
|
|
4122
4124
|
this._rangeAnchorIndex = null;
|
|
4125
|
+
/** Chip identity is tracked independently of dropdown option positions. */
|
|
4126
|
+
this._lastRenderedChipKeys = null;
|
|
4127
|
+
this._latestChipScrollGeneration = 0;
|
|
4128
|
+
this._latestChipScrollFrame = null;
|
|
4123
4129
|
this._customOptionBoundElements = new WeakSet();
|
|
4124
4130
|
this._customOptionManagedActiveClasses = new WeakMap();
|
|
4125
4131
|
this._customOptionNormalizedIds = new WeakMap();
|
|
@@ -4310,6 +4316,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
4310
4316
|
this._syncListboxAccessibility();
|
|
4311
4317
|
}
|
|
4312
4318
|
disconnectedCallback() {
|
|
4319
|
+
this._cancelLatestChipScroll();
|
|
4313
4320
|
this._cancelBusyPresentation();
|
|
4314
4321
|
if (this._dataRequestCoordinator) {
|
|
4315
4322
|
const actions = this._dataRequestCoordinator.disconnect();
|
|
@@ -5527,7 +5534,9 @@ class EnhancedSelect extends HTMLElement {
|
|
|
5527
5534
|
`;
|
|
5528
5535
|
const slot = container.querySelector('slot[name="arrow"]');
|
|
5529
5536
|
slot?.addEventListener('slotchange', () => {
|
|
5530
|
-
|
|
5537
|
+
// Do not flatten: flattening can expose the built-in SVG fallback
|
|
5538
|
+
// as an assigned element after the last custom arrow is removed.
|
|
5539
|
+
if (slot.assignedElements().length > 0) {
|
|
5531
5540
|
this.setAttribute('data-custom-arrow', 'true');
|
|
5532
5541
|
}
|
|
5533
5542
|
else {
|
|
@@ -6256,7 +6265,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
6256
6265
|
}
|
|
6257
6266
|
|
|
6258
6267
|
:host([data-custom-arrow="true"]) .dropdown-arrow-container:hover {
|
|
6259
|
-
background-color: transparent;
|
|
6268
|
+
background-color: var(--select-arrow-hover-bg, transparent);
|
|
6260
6269
|
}
|
|
6261
6270
|
|
|
6262
6271
|
.dropdown-arrow {
|
|
@@ -7902,6 +7911,12 @@ class EnhancedSelect extends HTMLElement {
|
|
|
7902
7911
|
: delta >= 0
|
|
7903
7912
|
? -1
|
|
7904
7913
|
: selectableIndices.length;
|
|
7914
|
+
// The final selectable option is the keyboard pagination boundary.
|
|
7915
|
+
// Keep the active option stable while the coordinator requests more data.
|
|
7916
|
+
if (delta === 1
|
|
7917
|
+
&& currentPosition === selectableIndices.length - 1
|
|
7918
|
+
&& this._requestKeyboardLoadMore())
|
|
7919
|
+
return;
|
|
7905
7920
|
const nextPosition = Math.max(0, Math.min(selectableIndices.length - 1, basePosition + delta));
|
|
7906
7921
|
const next = selectableIndices[nextPosition];
|
|
7907
7922
|
this._setActive(next);
|
|
@@ -7914,6 +7929,33 @@ class EnhancedSelect extends HTMLElement {
|
|
|
7914
7929
|
this._selectRange(anchorIndex, next, { clear: !opts?.toggleKey });
|
|
7915
7930
|
}
|
|
7916
7931
|
}
|
|
7932
|
+
/** Return true only when boundary navigation is held for an in-flight/new page. */
|
|
7933
|
+
_requestKeyboardLoadMore() {
|
|
7934
|
+
if (!this._state.isOpen
|
|
7935
|
+
|| !this._config.infiniteScroll.enabled
|
|
7936
|
+
|| this._dataLoadingConfig.protocol !== 'acknowledged'
|
|
7937
|
+
|| !this._dataRequestCoordinator
|
|
7938
|
+
|| !this._acknowledgedReady)
|
|
7939
|
+
return false;
|
|
7940
|
+
if (this._acknowledgedProjectionPending || this._acknowledgedProjectionSettling)
|
|
7941
|
+
return true;
|
|
7942
|
+
const snapshot = this._dataRequestCoordinator.getSnapshot();
|
|
7943
|
+
if (!snapshot.connected)
|
|
7944
|
+
return false;
|
|
7945
|
+
if (snapshot.busy)
|
|
7946
|
+
return true;
|
|
7947
|
+
if (!snapshot.hasMore
|
|
7948
|
+
|| snapshot.error !== null
|
|
7949
|
+
|| snapshot.resourceLimit !== null
|
|
7950
|
+
|| (snapshot.status !== 'succeeded' && snapshot.status !== 'empty'))
|
|
7951
|
+
return false;
|
|
7952
|
+
// Delegate identity, pagination, and in-flight protection to the coordinator.
|
|
7953
|
+
const actions = this._dataRequestCoordinator.requestLoadMore('manual');
|
|
7954
|
+
if (actions.length === 0)
|
|
7955
|
+
return false;
|
|
7956
|
+
this._dispatchAcknowledgedActions(actions);
|
|
7957
|
+
return true;
|
|
7958
|
+
}
|
|
7917
7959
|
_setActive(index, reason = 'keyboard') {
|
|
7918
7960
|
this._ensureRegistryCurrent();
|
|
7919
7961
|
const record = this._getRecordByIndex(index);
|
|
@@ -8233,6 +8275,19 @@ class EnhancedSelect extends HTMLElement {
|
|
|
8233
8275
|
_updateInputDisplay() {
|
|
8234
8276
|
const selectedEntries = this._getSelectedEntries();
|
|
8235
8277
|
const selectedItems = selectedEntries.map(({ item }) => item);
|
|
8278
|
+
const nextKeys = new Set(selectedEntries.map(({ key }) => key));
|
|
8279
|
+
const previousKeys = this._lastRenderedChipKeys;
|
|
8280
|
+
let newlyAddedKey;
|
|
8281
|
+
if (previousKeys) {
|
|
8282
|
+
for (const key of nextKeys) {
|
|
8283
|
+
if (!previousKeys.has(key))
|
|
8284
|
+
newlyAddedKey = key;
|
|
8285
|
+
}
|
|
8286
|
+
}
|
|
8287
|
+
this._lastRenderedChipKeys = nextKeys;
|
|
8288
|
+
const previousChipScrollLeft = this._inputContent.scrollLeft;
|
|
8289
|
+
// Only a newly added selected key can initiate auto-scroll.
|
|
8290
|
+
this._cancelLatestChipScroll();
|
|
8236
8291
|
const getLabel = this._config.serverSide.getLabelFromItem || ((item) => item?.label ?? String(item));
|
|
8237
8292
|
if (selectedItems.length === 0) {
|
|
8238
8293
|
this._input.value = '';
|
|
@@ -8308,8 +8363,87 @@ class EnhancedSelect extends HTMLElement {
|
|
|
8308
8363
|
if (this._acknowledgedPendingSearchQuery !== null) {
|
|
8309
8364
|
this._input.value = this._acknowledgedPendingSearchQuery;
|
|
8310
8365
|
}
|
|
8366
|
+
// Recreating the chip DOM must not reset manual scrolling. In particular,
|
|
8367
|
+
// remove/clear, config rerenders, and item refreshes are not scroll intents.
|
|
8368
|
+
if (this._config.selection.mode === 'multi') {
|
|
8369
|
+
this._inputContent.scrollLeft = previousChipScrollLeft;
|
|
8370
|
+
if (newlyAddedKey !== undefined)
|
|
8371
|
+
this._scheduleLatestChipScroll(newlyAddedKey);
|
|
8372
|
+
}
|
|
8311
8373
|
this._syncClearControlState();
|
|
8312
8374
|
}
|
|
8375
|
+
_cancelLatestChipScroll() {
|
|
8376
|
+
this._latestChipScrollGeneration += 1;
|
|
8377
|
+
if (this._latestChipScrollFrame !== null) {
|
|
8378
|
+
cancelAnimationFrame(this._latestChipScrollFrame);
|
|
8379
|
+
this._latestChipScrollFrame = null;
|
|
8380
|
+
}
|
|
8381
|
+
}
|
|
8382
|
+
_scheduleLatestChipScroll(key) {
|
|
8383
|
+
if (!this.isConnected
|
|
8384
|
+
|| this._config.selection.mode !== 'multi'
|
|
8385
|
+
|| this._config.multiSelectDisplay.mode !== 'horizontal'
|
|
8386
|
+
|| this._config.multiSelectDisplay.scrollToLatestChip !== true
|
|
8387
|
+
|| this._config.multiSelectDisplay.overflowX === 'hidden')
|
|
8388
|
+
return;
|
|
8389
|
+
const generation = this._latestChipScrollGeneration;
|
|
8390
|
+
this._latestChipScrollFrame = requestAnimationFrame(() => {
|
|
8391
|
+
this._latestChipScrollFrame = null;
|
|
8392
|
+
if (generation !== this._latestChipScrollGeneration
|
|
8393
|
+
|| !this.isConnected
|
|
8394
|
+
|| this._multiScrollDrag.active
|
|
8395
|
+
|| this._config.selection.mode !== 'multi'
|
|
8396
|
+
|| this._config.multiSelectDisplay.mode !== 'horizontal'
|
|
8397
|
+
|| this._config.multiSelectDisplay.scrollToLatestChip !== true)
|
|
8398
|
+
return;
|
|
8399
|
+
// Match the canonical selected-key sequence, not option indices:
|
|
8400
|
+
// selected items may be reordered or detached from the loaded page.
|
|
8401
|
+
const entries = this._getSelectedEntries();
|
|
8402
|
+
const index = entries.findIndex((entry) => entry.key === key);
|
|
8403
|
+
if (index < 0)
|
|
8404
|
+
return;
|
|
8405
|
+
const chip = this._inputContent.querySelectorAll('.selection-badge')[index];
|
|
8406
|
+
if (!chip)
|
|
8407
|
+
return;
|
|
8408
|
+
const hostBounds = this._inputContent.getBoundingClientRect();
|
|
8409
|
+
const chipBounds = chip.getBoundingClientRect();
|
|
8410
|
+
const leftEdge = hostBounds.left + this._inputContent.clientLeft;
|
|
8411
|
+
const rightEdge = leftEdge + this._inputContent.clientWidth;
|
|
8412
|
+
let delta;
|
|
8413
|
+
if (chip.parentElement === this._inputContent && chip.offsetWidth > 0) {
|
|
8414
|
+
// getBoundingClientRect() includes the chip's entry animation transform.
|
|
8415
|
+
// Use layout dimensions so the scroll target remains correct while the
|
|
8416
|
+
// chip scales into its final size. In RTL layouts, offsetLeft and
|
|
8417
|
+
// scrollLeft are both negative relative to the inline-start origin, so
|
|
8418
|
+
// the same subtraction maps the chip into the viewport's coordinates.
|
|
8419
|
+
const chipLeft = chip.offsetLeft - this._inputContent.scrollLeft;
|
|
8420
|
+
const chipRight = chipLeft + chip.offsetWidth;
|
|
8421
|
+
delta = chipRight > this._inputContent.clientWidth
|
|
8422
|
+
? chipRight - this._inputContent.clientWidth
|
|
8423
|
+
: chipLeft < 0
|
|
8424
|
+
? chipLeft
|
|
8425
|
+
: 0;
|
|
8426
|
+
}
|
|
8427
|
+
else {
|
|
8428
|
+
// DOM test environments without layout use the measurable rectangle.
|
|
8429
|
+
delta = chipBounds.right > rightEdge
|
|
8430
|
+
? chipBounds.right - rightEdge
|
|
8431
|
+
: chipBounds.left < leftEdge
|
|
8432
|
+
? chipBounds.left - leftEdge
|
|
8433
|
+
: 0;
|
|
8434
|
+
}
|
|
8435
|
+
if (Math.abs(delta) < 0.5)
|
|
8436
|
+
return;
|
|
8437
|
+
const reducedMotion = window.matchMedia?.('(prefers-reduced-motion: reduce)').matches ?? false;
|
|
8438
|
+
const behavior = reducedMotion ? 'auto' : (this._config.multiSelectDisplay.scrollToLatestChipBehavior ?? 'smooth');
|
|
8439
|
+
if (typeof this._inputContent.scrollBy === 'function') {
|
|
8440
|
+
this._inputContent.scrollBy({ left: delta, behavior });
|
|
8441
|
+
}
|
|
8442
|
+
else {
|
|
8443
|
+
this._inputContent.scrollLeft += delta;
|
|
8444
|
+
}
|
|
8445
|
+
});
|
|
8446
|
+
}
|
|
8313
8447
|
_isActivelyEditingSearchInput() {
|
|
8314
8448
|
return this._config.searchable === true
|
|
8315
8449
|
&& this._state.isOpen
|
|
@@ -8575,12 +8709,13 @@ class EnhancedSelect extends HTMLElement {
|
|
|
8575
8709
|
classMap: true,
|
|
8576
8710
|
optionRenderer: true,
|
|
8577
8711
|
groupHeaderRenderer: true,
|
|
8712
|
+
emptyStateSlot: true,
|
|
8578
8713
|
cssCustomProperties: true,
|
|
8579
8714
|
shadowParts: true,
|
|
8580
8715
|
globalStyleMirroring: true,
|
|
8581
8716
|
},
|
|
8582
8717
|
events: {
|
|
8583
|
-
emitted: ['select', 'open', 'close', 'search', 'change', 'loadMore', 'remove', 'clear', 'error', 'diagnostic'],
|
|
8718
|
+
emitted: ['select', 'open', 'close', 'search', 'change', 'loadMore', 'remove', 'clear', 'emptyStateChange', 'error', 'diagnostic'],
|
|
8584
8719
|
diagnosticEvent: true,
|
|
8585
8720
|
},
|
|
8586
8721
|
functionality: {
|
|
@@ -8596,6 +8731,36 @@ class EnhancedSelect extends HTMLElement {
|
|
|
8596
8731
|
limitations: this.getKnownLimitations(),
|
|
8597
8732
|
};
|
|
8598
8733
|
}
|
|
8734
|
+
/** Return a detached immutable snapshot of the currently rendered empty state. */
|
|
8735
|
+
getEmptyStateContext() {
|
|
8736
|
+
const context = this._emptyStateContext;
|
|
8737
|
+
return context ? Object.freeze({ query: context.query, reason: context.reason }) : null;
|
|
8738
|
+
}
|
|
8739
|
+
_syncEmptyStateContext(context) {
|
|
8740
|
+
const current = this._emptyStateContext;
|
|
8741
|
+
if (current?.query === context?.query
|
|
8742
|
+
&& current?.reason === context?.reason
|
|
8743
|
+
&& Boolean(current) === Boolean(context))
|
|
8744
|
+
return;
|
|
8745
|
+
this._emptyStateContext = context
|
|
8746
|
+
? Object.freeze({ query: context.query, reason: context.reason })
|
|
8747
|
+
: null;
|
|
8748
|
+
const detail = Object.freeze({ context: this.getEmptyStateContext() });
|
|
8749
|
+
this._emit('emptyStateChange', detail);
|
|
8750
|
+
}
|
|
8751
|
+
_appendEmptyState(context) {
|
|
8752
|
+
const empty = document.createElement('div');
|
|
8753
|
+
empty.setAttribute('part', 'no-results');
|
|
8754
|
+
empty.className = 'empty-state';
|
|
8755
|
+
const slot = document.createElement('slot');
|
|
8756
|
+
slot.name = 'empty-state';
|
|
8757
|
+
slot.appendChild(document.createTextNode(context.reason === 'no-results'
|
|
8758
|
+
? `No results found for "${context.query}"`
|
|
8759
|
+
: 'No options available'));
|
|
8760
|
+
empty.appendChild(slot);
|
|
8761
|
+
this._optionsContainer.appendChild(empty);
|
|
8762
|
+
this._syncEmptyStateContext(context);
|
|
8763
|
+
}
|
|
8599
8764
|
_emitChange() {
|
|
8600
8765
|
const selectedEntries = this._getSelectedEntries();
|
|
8601
8766
|
const selectedItems = selectedEntries.map(({ item }) => item);
|
|
@@ -9761,11 +9926,27 @@ class EnhancedSelect extends HTMLElement {
|
|
|
9761
9926
|
this._state.isBusy = snapshot.busy;
|
|
9762
9927
|
if (!snapshot.busy) {
|
|
9763
9928
|
this._syncBusyPresentation();
|
|
9764
|
-
|
|
9765
|
-
this.
|
|
9929
|
+
const shouldReconcileEmptyState = snapshot.status === 'exhausted'
|
|
9930
|
+
&& this._renderPlan.filteredKeys.length === 0;
|
|
9931
|
+
if (shouldReconcileEmptyState) {
|
|
9932
|
+
// The first projection rendered while logically busy, so the empty
|
|
9933
|
+
// state was intentionally suppressed. Reconcile only this terminal
|
|
9934
|
+
// empty case after settlement; keep any minimum-duration busy
|
|
9935
|
+
// presentation and its timer intact.
|
|
9936
|
+
this._renderOptions();
|
|
9937
|
+
const emptyStateRenderCycleId = this._renderCycleId;
|
|
9938
|
+
const emptyStateRenderCompleted = await this._waitForRenderCycle(emptyStateRenderCycleId);
|
|
9939
|
+
if (!emptyStateRenderCompleted) {
|
|
9940
|
+
throw new Error('Acknowledged empty-state render was superseded before completion');
|
|
9941
|
+
}
|
|
9942
|
+
}
|
|
9943
|
+
else {
|
|
9944
|
+
if (!this._busyPresentationVisible) {
|
|
9945
|
+
this._optionsContainer.querySelector('.busy-bucket')?.remove();
|
|
9946
|
+
}
|
|
9947
|
+
if (this._shouldRenderLoadMoreTrigger())
|
|
9948
|
+
this._addLoadMoreTrigger();
|
|
9766
9949
|
}
|
|
9767
|
-
if (this._shouldRenderLoadMoreTrigger())
|
|
9768
|
-
this._addLoadMoreTrigger();
|
|
9769
9950
|
}
|
|
9770
9951
|
this._optionsContainer.scrollTop = this._acknowledgedProjectionScrollTop;
|
|
9771
9952
|
this._syncListboxAccessibility();
|
|
@@ -10092,7 +10273,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
10092
10273
|
this._busyPresentationGeneration += 1;
|
|
10093
10274
|
this._clearBusyPresentationHideTimer();
|
|
10094
10275
|
this._busyPresentationVisible = this._config.busyBucket.enabled;
|
|
10095
|
-
this._busyPresentationStartedAt =
|
|
10276
|
+
this._busyPresentationStartedAt = Date.now();
|
|
10096
10277
|
}
|
|
10097
10278
|
_syncBusyPresentation() {
|
|
10098
10279
|
if (!this._config.busyBucket.enabled) {
|
|
@@ -10260,6 +10441,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
10260
10441
|
this._optionsContainer.innerHTML = '';
|
|
10261
10442
|
let filteredIndicesForScope = [];
|
|
10262
10443
|
let guardedScrollTopToRestore = null;
|
|
10444
|
+
let renderedEmptyStateContext = null;
|
|
10263
10445
|
// Ensure dropdown only contains options container (cleanup legacy direct children)
|
|
10264
10446
|
// We need to preserve optionsContainer, so we can't just clear dropdown.innerHTML
|
|
10265
10447
|
// But we can check if there are other children and remove them
|
|
@@ -10283,6 +10465,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
10283
10465
|
searching.setAttribute('part', 'loading');
|
|
10284
10466
|
searching.textContent = 'Searching...';
|
|
10285
10467
|
this._optionsContainer.appendChild(searching);
|
|
10468
|
+
this._syncEmptyStateContext(null);
|
|
10286
10469
|
this._resolveRenderCycle(renderCycleId, true);
|
|
10287
10470
|
return;
|
|
10288
10471
|
}
|
|
@@ -10386,17 +10569,11 @@ class EnhancedSelect extends HTMLElement {
|
|
|
10386
10569
|
const filteredIndices = this._renderPlan.filteredIndices;
|
|
10387
10570
|
this._refreshVirtualizationScope(filteredIndicesForScope);
|
|
10388
10571
|
this._appendGuardedTopSpacer();
|
|
10389
|
-
if (
|
|
10390
|
-
|
|
10391
|
-
|
|
10392
|
-
|
|
10393
|
-
|
|
10394
|
-
empty.textContent = `No results found for "${this._state.searchQuery}"`;
|
|
10395
|
-
}
|
|
10396
|
-
else {
|
|
10397
|
-
empty.textContent = 'No options available';
|
|
10398
|
-
}
|
|
10399
|
-
this._optionsContainer.appendChild(empty);
|
|
10572
|
+
if (this._renderPlan.filteredKeys.length === 0 && !this._state.isBusy) {
|
|
10573
|
+
renderedEmptyStateContext = this._state.searchQuery
|
|
10574
|
+
? { query: this._state.searchQuery, reason: 'no-results' }
|
|
10575
|
+
: { query: '', reason: 'no-options' };
|
|
10576
|
+
this._appendEmptyState(renderedEmptyStateContext);
|
|
10400
10577
|
}
|
|
10401
10578
|
else {
|
|
10402
10579
|
const shouldIncrementalRender = !this._guardedVirtualizer
|
|
@@ -10458,6 +10635,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
10458
10635
|
}
|
|
10459
10636
|
};
|
|
10460
10637
|
renderChunk();
|
|
10638
|
+
this._syncEmptyStateContext(null);
|
|
10461
10639
|
return;
|
|
10462
10640
|
}
|
|
10463
10641
|
filteredIndices.forEach((itemIndex) => {
|
|
@@ -10482,6 +10660,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
10482
10660
|
if (guardedScrollTopToRestore !== null) {
|
|
10483
10661
|
this._optionsContainer.scrollTop = guardedScrollTopToRestore;
|
|
10484
10662
|
}
|
|
10663
|
+
this._syncEmptyStateContext(renderedEmptyStateContext);
|
|
10485
10664
|
this._syncRenderedOptionAccessibility();
|
|
10486
10665
|
this._syncLegacyActiveAria();
|
|
10487
10666
|
this._syncGuardedOptionResizeTargets();
|