@smilodon/core 1.4.0 → 1.4.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.
- package/dist/index.cjs +24 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +24 -10
- 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 +24 -10
- 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 +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1826,6 +1826,7 @@ class EnhancedSelect extends HTMLElement {
|
|
|
1826
1826
|
this._pendingFirstRenderMark = false;
|
|
1827
1827
|
this._pendingSearchRenderMark = false;
|
|
1828
1828
|
this._rangeAnchorIndex = null;
|
|
1829
|
+
this._customOptionBoundElements = new WeakSet();
|
|
1829
1830
|
this._shadow = this.attachShadow({ mode: 'open' });
|
|
1830
1831
|
this._uniqueId = `enhanced-select-${Math.random().toString(36).substr(2, 9)}`;
|
|
1831
1832
|
this._rendererHelpers = this._buildRendererHelpers();
|
|
@@ -3692,24 +3693,37 @@ class EnhancedSelect extends HTMLElement {
|
|
|
3692
3693
|
if (!optionEl.hasAttribute('tabindex')) {
|
|
3693
3694
|
optionEl.tabIndex = -1;
|
|
3694
3695
|
}
|
|
3695
|
-
if (!
|
|
3696
|
+
if (!this._customOptionBoundElements.has(optionEl)) {
|
|
3696
3697
|
optionEl.addEventListener('click', (e) => {
|
|
3697
|
-
e.stopPropagation();
|
|
3698
|
+
e.stopPropagation();
|
|
3699
|
+
const current = e.currentTarget;
|
|
3700
|
+
if (current.getAttribute('aria-disabled') === 'true')
|
|
3701
|
+
return;
|
|
3702
|
+
const parsedIndex = Number(current.dataset.index);
|
|
3703
|
+
if (!Number.isFinite(parsedIndex))
|
|
3704
|
+
return;
|
|
3698
3705
|
const mouseEvent = e;
|
|
3699
|
-
this._selectOption(
|
|
3706
|
+
this._selectOption(parsedIndex, {
|
|
3700
3707
|
shiftKey: mouseEvent.shiftKey,
|
|
3701
3708
|
toggleKey: mouseEvent.ctrlKey || mouseEvent.metaKey,
|
|
3702
3709
|
});
|
|
3703
3710
|
});
|
|
3704
3711
|
optionEl.addEventListener('keydown', (e) => {
|
|
3705
|
-
if (e.key
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
+
if (e.key !== 'Enter' && e.key !== ' ')
|
|
3713
|
+
return;
|
|
3714
|
+
const current = e.currentTarget;
|
|
3715
|
+
if (current.getAttribute('aria-disabled') === 'true')
|
|
3716
|
+
return;
|
|
3717
|
+
const parsedIndex = Number(current.dataset.index);
|
|
3718
|
+
if (!Number.isFinite(parsedIndex))
|
|
3719
|
+
return;
|
|
3720
|
+
e.preventDefault();
|
|
3721
|
+
this._selectOption(parsedIndex, {
|
|
3722
|
+
shiftKey: e.shiftKey,
|
|
3723
|
+
toggleKey: e.ctrlKey || e.metaKey,
|
|
3724
|
+
});
|
|
3712
3725
|
});
|
|
3726
|
+
this._customOptionBoundElements.add(optionEl);
|
|
3713
3727
|
}
|
|
3714
3728
|
return optionEl;
|
|
3715
3729
|
}
|