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