@smilodon/core 1.3.2 → 1.3.4
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/index.cjs +45 -94
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +45 -94
- 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 +45 -94
- 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/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -544,13 +544,11 @@ class CustomOptionPool {
|
|
|
544
544
|
component = pooled.instance;
|
|
545
545
|
pooled.inUse = true;
|
|
546
546
|
pooled.lastUsedIndex = index;
|
|
547
|
-
console.log(`[CustomOptionPool] Reusing component for index ${index}`);
|
|
548
547
|
}
|
|
549
548
|
else {
|
|
550
549
|
// Create new component
|
|
551
550
|
try {
|
|
552
551
|
component = factory(item, index);
|
|
553
|
-
console.log(`[CustomOptionPool] Created new component for index ${index}`);
|
|
554
552
|
// Add to pool if under limit
|
|
555
553
|
const pool = this._pool.get(factoryKey) || [];
|
|
556
554
|
if (pool.length < this._maxPoolSize) {
|
|
@@ -599,7 +597,6 @@ class CustomOptionPool {
|
|
|
599
597
|
const pooled = pool.find(p => p.instance === component);
|
|
600
598
|
if (pooled) {
|
|
601
599
|
pooled.inUse = false;
|
|
602
|
-
console.log(`[CustomOptionPool] Released component from index ${index}`);
|
|
603
600
|
break;
|
|
604
601
|
}
|
|
605
602
|
}
|
|
@@ -608,7 +605,6 @@ class CustomOptionPool {
|
|
|
608
605
|
* Release all active components
|
|
609
606
|
*/
|
|
610
607
|
releaseAll() {
|
|
611
|
-
console.log(`[CustomOptionPool] Releasing ${this._activeComponents.size} active components`);
|
|
612
608
|
const indices = Array.from(this._activeComponents.keys());
|
|
613
609
|
indices.forEach(index => this.release(index));
|
|
614
610
|
}
|
|
@@ -651,7 +647,6 @@ class CustomOptionPool {
|
|
|
651
647
|
clear() {
|
|
652
648
|
this.releaseAll();
|
|
653
649
|
this._pool.clear();
|
|
654
|
-
console.log('[CustomOptionPool] Pool cleared');
|
|
655
650
|
}
|
|
656
651
|
/**
|
|
657
652
|
* Get pool statistics for debugging
|
|
@@ -830,7 +825,6 @@ class OptionRenderer {
|
|
|
830
825
|
});
|
|
831
826
|
}
|
|
832
827
|
this._mountedElements.set(index, option);
|
|
833
|
-
console.log(`[OptionRenderer] Rendered lightweight option ${index}: ${label}`);
|
|
834
828
|
return option;
|
|
835
829
|
}
|
|
836
830
|
/**
|
|
@@ -890,7 +884,6 @@ class OptionRenderer {
|
|
|
890
884
|
}
|
|
891
885
|
});
|
|
892
886
|
}
|
|
893
|
-
console.log(`[OptionRenderer] Rendered custom component option ${index}: ${label}`);
|
|
894
887
|
}
|
|
895
888
|
catch (error) {
|
|
896
889
|
console.error(`[OptionRenderer] Failed to render custom component at index ${index}:`, error);
|
|
@@ -1488,13 +1481,10 @@ class EnhancedSelect extends HTMLElement {
|
|
|
1488
1481
|
this._hasError = false;
|
|
1489
1482
|
this._errorMessage = '';
|
|
1490
1483
|
this._boundArrowClick = null;
|
|
1491
|
-
console.log('[EnhancedSelect] Constructor called');
|
|
1492
1484
|
this._shadow = this.attachShadow({ mode: 'open' });
|
|
1493
|
-
console.log('[EnhancedSelect] Shadow root attached:', this._shadow);
|
|
1494
1485
|
this._uniqueId = `enhanced-select-${Math.random().toString(36).substr(2, 9)}`;
|
|
1495
1486
|
// Merge global config with component-level config
|
|
1496
1487
|
this._config = selectConfig.getConfig();
|
|
1497
|
-
console.log('[EnhancedSelect] Config loaded');
|
|
1498
1488
|
// Initialize state
|
|
1499
1489
|
this._state = {
|
|
1500
1490
|
isOpen: false,
|
|
@@ -1514,41 +1504,26 @@ class EnhancedSelect extends HTMLElement {
|
|
|
1514
1504
|
lastNotifiedResultCount: 0,
|
|
1515
1505
|
isExpanded: false,
|
|
1516
1506
|
};
|
|
1517
|
-
console.log('[EnhancedSelect] State initialized');
|
|
1518
1507
|
// Create DOM structure
|
|
1519
1508
|
this._container = this._createContainer();
|
|
1520
|
-
console.log('[EnhancedSelect] Container created:', this._container);
|
|
1521
1509
|
this._inputContainer = this._createInputContainer();
|
|
1522
|
-
console.log('[EnhancedSelect] Input container created');
|
|
1523
1510
|
this._input = this._createInput();
|
|
1524
|
-
console.log('[EnhancedSelect] Input created:', this._input);
|
|
1525
1511
|
this._arrowContainer = this._createArrowContainer();
|
|
1526
|
-
console.log('[EnhancedSelect] Arrow container created');
|
|
1527
1512
|
this._dropdown = this._createDropdown();
|
|
1528
|
-
console.log('[EnhancedSelect] Dropdown created');
|
|
1529
1513
|
this._optionsContainer = this._createOptionsContainer();
|
|
1530
|
-
console.log('[EnhancedSelect] Options container created');
|
|
1531
1514
|
this._liveRegion = this._createLiveRegion();
|
|
1532
|
-
console.log('[EnhancedSelect] Live region created');
|
|
1533
1515
|
// Initialize styles BEFORE assembling DOM (order matters in shadow DOM)
|
|
1534
1516
|
this._initializeStyles();
|
|
1535
|
-
console.log('[EnhancedSelect] Styles initialized');
|
|
1536
1517
|
this._assembleDOM();
|
|
1537
|
-
console.log('[EnhancedSelect] DOM assembled');
|
|
1538
1518
|
this._attachEventListeners();
|
|
1539
|
-
console.log('[EnhancedSelect] Event listeners attached');
|
|
1540
1519
|
this._initializeObservers();
|
|
1541
|
-
console.log('[EnhancedSelect] Observers initialized');
|
|
1542
|
-
console.log('[EnhancedSelect] Constructor complete, shadow DOM children:', this._shadow.children.length);
|
|
1543
1520
|
}
|
|
1544
1521
|
connectedCallback() {
|
|
1545
|
-
console.log('[EnhancedSelect] connectedCallback called');
|
|
1546
1522
|
// WORKAROUND: Force display style on host element for Angular compatibility
|
|
1547
1523
|
// Angular's rendering seems to not apply :host styles correctly in some cases
|
|
1548
1524
|
// Must be done in connectedCallback when element is attached to DOM
|
|
1549
1525
|
this.style.display = 'block';
|
|
1550
1526
|
this.style.width = '100%';
|
|
1551
|
-
console.log('[EnhancedSelect] Forced host display styles');
|
|
1552
1527
|
// Load initial data if server-side is enabled
|
|
1553
1528
|
if (this._config.serverSide.enabled && this._config.serverSide.initialSelectedValues) {
|
|
1554
1529
|
this._loadInitialSelectedItems();
|
|
@@ -1557,7 +1532,6 @@ class EnhancedSelect extends HTMLElement {
|
|
|
1557
1532
|
if (this._config.callbacks.onOpen) {
|
|
1558
1533
|
this._config.callbacks.onOpen();
|
|
1559
1534
|
}
|
|
1560
|
-
console.log('[EnhancedSelect] connectedCallback complete');
|
|
1561
1535
|
}
|
|
1562
1536
|
disconnectedCallback() {
|
|
1563
1537
|
// Cleanup observers
|
|
@@ -1655,43 +1629,22 @@ class EnhancedSelect extends HTMLElement {
|
|
|
1655
1629
|
return container;
|
|
1656
1630
|
}
|
|
1657
1631
|
_assembleDOM() {
|
|
1658
|
-
console.log('[EnhancedSelect] _assembleDOM: Starting DOM assembly');
|
|
1659
|
-
console.log('[EnhancedSelect] _assembleDOM: Elements to assemble:', {
|
|
1660
|
-
inputContainer: !!this._inputContainer,
|
|
1661
|
-
input: !!this._input,
|
|
1662
|
-
arrowContainer: !!this._arrowContainer,
|
|
1663
|
-
container: !!this._container,
|
|
1664
|
-
dropdown: !!this._dropdown,
|
|
1665
|
-
optionsContainer: !!this._optionsContainer,
|
|
1666
|
-
shadow: !!this._shadow,
|
|
1667
|
-
liveRegion: !!this._liveRegion
|
|
1668
|
-
});
|
|
1669
1632
|
this._inputContainer.appendChild(this._input);
|
|
1670
|
-
console.log('[EnhancedSelect] _assembleDOM: Appended input to inputContainer');
|
|
1671
1633
|
if (this._arrowContainer) {
|
|
1672
1634
|
this._inputContainer.appendChild(this._arrowContainer);
|
|
1673
|
-
console.log('[EnhancedSelect] _assembleDOM: Appended arrowContainer to inputContainer');
|
|
1674
1635
|
}
|
|
1675
1636
|
this._container.appendChild(this._inputContainer);
|
|
1676
|
-
console.log('[EnhancedSelect] _assembleDOM: Appended inputContainer to container');
|
|
1677
1637
|
this._dropdown.appendChild(this._optionsContainer);
|
|
1678
|
-
console.log('[EnhancedSelect] _assembleDOM: Appended optionsContainer to dropdown');
|
|
1679
1638
|
this._container.appendChild(this._dropdown);
|
|
1680
|
-
console.log('[EnhancedSelect] _assembleDOM: Appended dropdown to container');
|
|
1681
1639
|
this._shadow.appendChild(this._container);
|
|
1682
|
-
console.log('[EnhancedSelect] _assembleDOM: Appended container to shadow root');
|
|
1683
1640
|
if (this._liveRegion) {
|
|
1684
1641
|
this._shadow.appendChild(this._liveRegion);
|
|
1685
|
-
console.log('[EnhancedSelect] _assembleDOM: Appended liveRegion to shadow root');
|
|
1686
1642
|
}
|
|
1687
|
-
console.log('[EnhancedSelect] _assembleDOM: Shadow root children count:', this._shadow.children.length);
|
|
1688
|
-
console.log('[EnhancedSelect] _assembleDOM: Shadow root HTML length:', this._shadow.innerHTML.length);
|
|
1689
1643
|
// Set ARIA relationships
|
|
1690
1644
|
const listboxId = `${this._uniqueId}-listbox`;
|
|
1691
1645
|
this._dropdown.id = listboxId;
|
|
1692
1646
|
this._input.setAttribute('aria-controls', listboxId);
|
|
1693
1647
|
this._input.setAttribute('aria-owns', listboxId);
|
|
1694
|
-
console.log('[EnhancedSelect] _assembleDOM: Set ARIA relationships with listboxId:', listboxId);
|
|
1695
1648
|
}
|
|
1696
1649
|
_initializeStyles() {
|
|
1697
1650
|
const style = document.createElement('style');
|
|
@@ -1861,28 +1814,32 @@ class EnhancedSelect extends HTMLElement {
|
|
|
1861
1814
|
max-height: 300px;
|
|
1862
1815
|
overflow: auto;
|
|
1863
1816
|
transition: opacity 0.2s ease-in-out;
|
|
1817
|
+
background: var(--select-options-bg, white);
|
|
1864
1818
|
}
|
|
1865
1819
|
|
|
1866
1820
|
.option {
|
|
1867
|
-
padding: 8px 12px;
|
|
1821
|
+
padding: var(--select-option-padding, 8px 12px);
|
|
1868
1822
|
cursor: pointer;
|
|
1869
|
-
color:
|
|
1823
|
+
color: var(--select-option-color, #1f2937);
|
|
1824
|
+
background: var(--select-option-bg, white);
|
|
1870
1825
|
transition: background-color 0.15s ease;
|
|
1871
1826
|
user-select: none;
|
|
1872
1827
|
}
|
|
1873
1828
|
|
|
1874
1829
|
.option:hover {
|
|
1875
|
-
background-color: #f3f4f6;
|
|
1830
|
+
background-color: var(--select-option-hover-bg, #f3f4f6);
|
|
1831
|
+
color: var(--select-option-hover-color, #1f2937);
|
|
1876
1832
|
}
|
|
1877
1833
|
|
|
1878
1834
|
.option.selected {
|
|
1879
|
-
background-color: #e0e7ff;
|
|
1880
|
-
color: #4338ca;
|
|
1835
|
+
background-color: var(--select-option-selected-bg, #e0e7ff);
|
|
1836
|
+
color: var(--select-option-selected-color, #4338ca);
|
|
1881
1837
|
font-weight: 500;
|
|
1882
1838
|
}
|
|
1883
1839
|
|
|
1884
1840
|
.option.active {
|
|
1885
|
-
background-color: #f3f4f6;
|
|
1841
|
+
background-color: var(--select-option-active-bg, #f3f4f6);
|
|
1842
|
+
color: var(--select-option-active-color, #1f2937);
|
|
1886
1843
|
}
|
|
1887
1844
|
|
|
1888
1845
|
.load-more-container {
|
|
@@ -1971,22 +1928,39 @@ class EnhancedSelect extends HTMLElement {
|
|
|
1971
1928
|
}
|
|
1972
1929
|
}
|
|
1973
1930
|
|
|
1974
|
-
/*
|
|
1975
|
-
|
|
1976
|
-
|
|
1931
|
+
/* Dark mode - Opt-in via class or data attribute */
|
|
1932
|
+
:host(.dark-mode),
|
|
1933
|
+
:host([data-theme="dark"]) {
|
|
1934
|
+
.input-container {
|
|
1977
1935
|
background: var(--select-dark-bg, #1f2937);
|
|
1978
|
-
color: var(--select-dark-text, #f9fafb);
|
|
1979
1936
|
border-color: var(--select-dark-border, #4b5563);
|
|
1980
1937
|
}
|
|
1981
1938
|
|
|
1939
|
+
.select-input {
|
|
1940
|
+
color: var(--select-dark-text, #f9fafb);
|
|
1941
|
+
}
|
|
1942
|
+
|
|
1943
|
+
.select-input::placeholder {
|
|
1944
|
+
color: var(--select-dark-placeholder, #6b7280);
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1982
1947
|
.select-dropdown {
|
|
1983
1948
|
background: var(--select-dark-dropdown-bg, #1f2937);
|
|
1984
1949
|
border-color: var(--select-dark-dropdown-border, #4b5563);
|
|
1985
|
-
|
|
1950
|
+
}
|
|
1951
|
+
|
|
1952
|
+
.options-container {
|
|
1953
|
+
background: var(--select-dark-options-bg, #1f2937);
|
|
1954
|
+
}
|
|
1955
|
+
|
|
1956
|
+
.option {
|
|
1957
|
+
color: var(--select-dark-option-color, #f9fafb);
|
|
1958
|
+
background: var(--select-dark-option-bg, #1f2937);
|
|
1986
1959
|
}
|
|
1987
1960
|
|
|
1988
1961
|
.option:hover {
|
|
1989
1962
|
background-color: var(--select-dark-option-hover-bg, #374151);
|
|
1963
|
+
color: var(--select-dark-option-hover-color, #f9fafb);
|
|
1990
1964
|
}
|
|
1991
1965
|
|
|
1992
1966
|
.option.selected {
|
|
@@ -1996,11 +1970,23 @@ class EnhancedSelect extends HTMLElement {
|
|
|
1996
1970
|
|
|
1997
1971
|
.option.active {
|
|
1998
1972
|
background-color: var(--select-dark-option-active-bg, #374151);
|
|
1973
|
+
color: var(--select-dark-option-active-color, #f9fafb);
|
|
1999
1974
|
}
|
|
2000
1975
|
|
|
2001
|
-
.busy-bucket
|
|
1976
|
+
.busy-bucket,
|
|
1977
|
+
.empty-state {
|
|
2002
1978
|
color: var(--select-dark-busy-color, #9ca3af);
|
|
2003
1979
|
}
|
|
1980
|
+
|
|
1981
|
+
.input-container::after {
|
|
1982
|
+
background: linear-gradient(
|
|
1983
|
+
to bottom,
|
|
1984
|
+
transparent 0%,
|
|
1985
|
+
rgba(255, 255, 255, 0.1) 20%,
|
|
1986
|
+
rgba(255, 255, 255, 0.1) 80%,
|
|
1987
|
+
transparent 100%
|
|
1988
|
+
);
|
|
1989
|
+
}
|
|
2004
1990
|
}
|
|
2005
1991
|
|
|
2006
1992
|
/* Accessibility: High contrast mode */
|
|
@@ -2021,8 +2007,6 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2021
2007
|
min-height: 44px;
|
|
2022
2008
|
}
|
|
2023
2009
|
`;
|
|
2024
|
-
console.log('[EnhancedSelect] _initializeStyles: Created style element, content length:', style.textContent?.length || 0);
|
|
2025
|
-
console.log('[EnhancedSelect] _initializeStyles: Shadow root children BEFORE:', this._shadow.children.length);
|
|
2026
2010
|
// Insert as first child to ensure styles are processed first
|
|
2027
2011
|
if (this._shadow.firstChild) {
|
|
2028
2012
|
this._shadow.insertBefore(style, this._shadow.firstChild);
|
|
@@ -2030,9 +2014,6 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2030
2014
|
else {
|
|
2031
2015
|
this._shadow.appendChild(style);
|
|
2032
2016
|
}
|
|
2033
|
-
console.log('[EnhancedSelect] _initializeStyles: Style inserted, shadow root children AFTER:', this._shadow.children.length);
|
|
2034
|
-
console.log('[EnhancedSelect] _initializeStyles: Shadow root has style element:', !!this._shadow.querySelector('style'));
|
|
2035
|
-
console.log('[EnhancedSelect] _initializeStyles: Style sheet rules:', style.sheet?.cssRules?.length || 'NOT PARSED');
|
|
2036
2017
|
}
|
|
2037
2018
|
_attachEventListeners() {
|
|
2038
2019
|
// Arrow click handler
|
|
@@ -2639,27 +2620,21 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2639
2620
|
* Set items to display in the select
|
|
2640
2621
|
*/
|
|
2641
2622
|
setItems(items) {
|
|
2642
|
-
console.log('[EnhancedSelect] setItems called with', items?.length || 0, 'items');
|
|
2643
|
-
console.log('[EnhancedSelect] Items:', items);
|
|
2644
2623
|
const previousLength = this._state.loadedItems.length;
|
|
2645
2624
|
this._state.loadedItems = items;
|
|
2646
2625
|
// If grouped items exist, flatten them to items
|
|
2647
2626
|
if (this._state.groupedItems.length > 0) {
|
|
2648
2627
|
this._state.loadedItems = this._state.groupedItems.flatMap(group => group.options);
|
|
2649
|
-
console.log('[EnhancedSelect] Flattened grouped items to', this._state.loadedItems.length, 'items');
|
|
2650
2628
|
}
|
|
2651
2629
|
const newLength = this._state.loadedItems.length;
|
|
2652
|
-
console.log('[EnhancedSelect] State.loadedItems updated:', previousLength, '→', newLength);
|
|
2653
2630
|
// When infinite scroll is active (preserveScrollPosition = true),
|
|
2654
2631
|
// we need to maintain scroll position during the update
|
|
2655
2632
|
if (this._state.preserveScrollPosition && this._dropdown) {
|
|
2656
2633
|
const targetScrollTop = this._state.lastScrollPosition;
|
|
2657
|
-
console.log('[EnhancedSelect] Preserving scroll position:', targetScrollTop);
|
|
2658
2634
|
// Only clear loading if we actually got more items
|
|
2659
2635
|
if (newLength > previousLength) {
|
|
2660
2636
|
this._state.isBusy = false;
|
|
2661
2637
|
}
|
|
2662
|
-
console.log('[EnhancedSelect] Calling _renderOptions (with scroll preservation)...');
|
|
2663
2638
|
this._renderOptions();
|
|
2664
2639
|
// Restore the exact scrollTop we had before loading
|
|
2665
2640
|
// so the previously visible items stay in place and
|
|
@@ -2679,10 +2654,8 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2679
2654
|
else {
|
|
2680
2655
|
// Normal update - just render normally
|
|
2681
2656
|
this._state.isBusy = false;
|
|
2682
|
-
console.log('[EnhancedSelect] Calling _renderOptions (normal)...');
|
|
2683
2657
|
this._renderOptions();
|
|
2684
2658
|
}
|
|
2685
|
-
console.log('[EnhancedSelect] setItems complete');
|
|
2686
2659
|
}
|
|
2687
2660
|
/**
|
|
2688
2661
|
* Set grouped items
|
|
@@ -2846,21 +2819,11 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2846
2819
|
* Render options based on current state
|
|
2847
2820
|
*/
|
|
2848
2821
|
_renderOptions() {
|
|
2849
|
-
console.log('[EnhancedSelect] _renderOptions called');
|
|
2850
|
-
console.log('[EnhancedSelect] State:', {
|
|
2851
|
-
loadedItems: this._state.loadedItems.length,
|
|
2852
|
-
groupedItems: this._state.groupedItems.length,
|
|
2853
|
-
isOpen: this._state.isOpen,
|
|
2854
|
-
isSearching: this._state.isSearching,
|
|
2855
|
-
searchQuery: this._state.searchQuery,
|
|
2856
|
-
isBusy: this._state.isBusy
|
|
2857
|
-
});
|
|
2858
2822
|
// Cleanup observer
|
|
2859
2823
|
if (this._loadMoreTrigger && this._intersectionObserver) {
|
|
2860
2824
|
this._intersectionObserver.unobserve(this._loadMoreTrigger);
|
|
2861
2825
|
}
|
|
2862
2826
|
// Clear options container
|
|
2863
|
-
console.log('[EnhancedSelect] Clearing options container, previous children:', this._optionsContainer.children.length);
|
|
2864
2827
|
this._optionsContainer.innerHTML = '';
|
|
2865
2828
|
// Ensure dropdown only contains options container (cleanup legacy direct children)
|
|
2866
2829
|
// We need to preserve optionsContainer, so we can't just clear dropdown.innerHTML
|
|
@@ -2873,7 +2836,6 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2873
2836
|
// Ensure dropdown is visible if we are rendering options
|
|
2874
2837
|
if (this._state.isOpen && this._dropdown.style.display === 'none') {
|
|
2875
2838
|
this._dropdown.style.display = 'block';
|
|
2876
|
-
console.log('[EnhancedSelect] Dropdown display set to block');
|
|
2877
2839
|
}
|
|
2878
2840
|
// Show searching state (exclusive state)
|
|
2879
2841
|
if (this._state.isSearching) {
|
|
@@ -2881,7 +2843,6 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2881
2843
|
searching.className = 'searching-state';
|
|
2882
2844
|
searching.textContent = 'Searching...';
|
|
2883
2845
|
this._optionsContainer.appendChild(searching);
|
|
2884
|
-
console.log('[EnhancedSelect] Added searching state');
|
|
2885
2846
|
return;
|
|
2886
2847
|
}
|
|
2887
2848
|
const getValue = this._config.serverSide.getValueFromItem || ((item) => item?.value ?? item);
|
|
@@ -2890,7 +2851,6 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2890
2851
|
const query = this._state.searchQuery.toLowerCase();
|
|
2891
2852
|
// Handle Grouped Items Rendering (when no search query)
|
|
2892
2853
|
if (this._state.groupedItems.length > 0 && !query) {
|
|
2893
|
-
console.log('[EnhancedSelect] Rendering grouped items:', this._state.groupedItems.length, 'groups');
|
|
2894
2854
|
this._state.groupedItems.forEach(group => {
|
|
2895
2855
|
const header = document.createElement('div');
|
|
2896
2856
|
header.className = 'group-header';
|
|
@@ -2920,7 +2880,6 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2920
2880
|
}
|
|
2921
2881
|
else {
|
|
2922
2882
|
// Normal rendering (flat list or filtered)
|
|
2923
|
-
console.log('[EnhancedSelect] Rendering flat list:', this._state.loadedItems.length, 'items');
|
|
2924
2883
|
let hasRenderedItems = false;
|
|
2925
2884
|
this._state.loadedItems.forEach((item, index) => {
|
|
2926
2885
|
// Apply filter if query exists
|
|
@@ -2937,7 +2896,6 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2937
2896
|
hasRenderedItems = true;
|
|
2938
2897
|
this._renderSingleOption(item, index, getValue, getLabel);
|
|
2939
2898
|
});
|
|
2940
|
-
console.log('[EnhancedSelect] Rendered', hasRenderedItems ? 'items' : 'no items');
|
|
2941
2899
|
if (!hasRenderedItems && !this._state.isBusy) {
|
|
2942
2900
|
const empty = document.createElement('div');
|
|
2943
2901
|
empty.className = 'empty-state';
|
|
@@ -2948,7 +2906,6 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2948
2906
|
empty.textContent = 'No options available';
|
|
2949
2907
|
}
|
|
2950
2908
|
this._optionsContainer.appendChild(empty);
|
|
2951
|
-
console.log('[EnhancedSelect] Added empty state');
|
|
2952
2909
|
}
|
|
2953
2910
|
}
|
|
2954
2911
|
// Append Busy Indicator if busy
|
|
@@ -2966,13 +2923,11 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2966
2923
|
busyBucket.appendChild(message);
|
|
2967
2924
|
}
|
|
2968
2925
|
this._optionsContainer.appendChild(busyBucket);
|
|
2969
|
-
console.log('[EnhancedSelect] Added busy bucket');
|
|
2970
2926
|
}
|
|
2971
2927
|
// Append Load More Trigger (Button or Sentinel) if enabled and not busy
|
|
2972
2928
|
else if ((this._config.loadMore.enabled || this._config.infiniteScroll.enabled) && this._state.loadedItems.length > 0) {
|
|
2973
2929
|
this._addLoadMoreTrigger();
|
|
2974
2930
|
}
|
|
2975
|
-
console.log('[EnhancedSelect] _renderOptions complete, optionsContainer children:', this._optionsContainer.children.length);
|
|
2976
2931
|
}
|
|
2977
2932
|
_renderSingleOption(item, index, getValue, getLabel) {
|
|
2978
2933
|
const option = document.createElement('div');
|
|
@@ -2980,7 +2935,6 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2980
2935
|
option.id = `${this._uniqueId}-option-${index}`;
|
|
2981
2936
|
const value = getValue(item);
|
|
2982
2937
|
const label = getLabel(item);
|
|
2983
|
-
console.log('[EnhancedSelect] Rendering option', index, ':', { value, label });
|
|
2984
2938
|
option.textContent = label;
|
|
2985
2939
|
option.dataset.value = String(value);
|
|
2986
2940
|
option.dataset.index = String(index); // Also useful for debugging/selectors
|
|
@@ -2997,7 +2951,6 @@ class EnhancedSelect extends HTMLElement {
|
|
|
2997
2951
|
this._selectOption(index);
|
|
2998
2952
|
});
|
|
2999
2953
|
this._optionsContainer.appendChild(option);
|
|
3000
|
-
console.log('[EnhancedSelect] Option', index, 'appended to optionsContainer');
|
|
3001
2954
|
}
|
|
3002
2955
|
_addLoadMoreTrigger() {
|
|
3003
2956
|
const container = document.createElement('div');
|
|
@@ -3830,7 +3783,6 @@ async function measureAsync(label, fn) {
|
|
|
3830
3783
|
const start = performance.now();
|
|
3831
3784
|
const result = await fn();
|
|
3832
3785
|
const duration = performance.now() - start;
|
|
3833
|
-
console.log(`[Perf] ${label}: ${duration.toFixed(2)}ms`);
|
|
3834
3786
|
return { result, duration };
|
|
3835
3787
|
}
|
|
3836
3788
|
/**
|
|
@@ -3840,7 +3792,6 @@ function measureSync(label, fn) {
|
|
|
3840
3792
|
const start = performance.now();
|
|
3841
3793
|
const result = fn();
|
|
3842
3794
|
const duration = performance.now() - start;
|
|
3843
|
-
console.log(`[Perf] ${label}: ${duration.toFixed(2)}ms`);
|
|
3844
3795
|
return { result, duration };
|
|
3845
3796
|
}
|
|
3846
3797
|
|