@danielgindi/selectbox 1.0.83 → 1.0.85

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/lib/DropList.js CHANGED
@@ -525,7 +525,7 @@ class DropList {
525
525
  return this;
526
526
  }
527
527
 
528
- triggerItemSelection(event) {
528
+ triggerItemSelection(item, event) {
529
529
  const p = this._p;
530
530
 
531
531
  p.focusItemEl = p.focusItemEl || closestUntil(event.target, 'li', p.el);
@@ -533,7 +533,7 @@ class DropList {
533
533
  if (p.focusItemIndex === undefined)
534
534
  p.focusItemIndex = -1;
535
535
 
536
- let item = p.focusItemEl[ItemSymbol];
536
+ item = item ?? p.focusItemEl[ItemSymbol];
537
537
  if (item._nointeraction) {
538
538
  return false;
539
539
  }
@@ -1503,7 +1503,7 @@ class DropList {
1503
1503
 
1504
1504
  if (!this._mouseHandled) {
1505
1505
 
1506
- this.triggerItemSelection(event);
1506
+ this.triggerItemSelection(null, event);
1507
1507
 
1508
1508
  // If we are destroyed in response to a click/select, cease all actions
1509
1509
  if (this[DestroyedSymbol])
@@ -1668,7 +1668,7 @@ class DropList {
1668
1668
  break;
1669
1669
 
1670
1670
  case VALUE_ENTER:
1671
- this.triggerItemSelection(event);
1671
+ this.triggerItemSelection(null, event);
1672
1672
  event.preventDefault();
1673
1673
  break;
1674
1674
 
@@ -1750,7 +1750,7 @@ class DropList {
1750
1750
  this._focus(evt, next || null, matchIndex);
1751
1751
 
1752
1752
  if (!this.isVisible()) {
1753
- this.triggerItemSelection(evt);
1753
+ this.triggerItemSelection(null, evt);
1754
1754
  }
1755
1755
 
1756
1756
  // Record the last filter used
@@ -1944,7 +1944,7 @@ class DropList {
1944
1944
  this._focus(event, next || null, nextIndex);
1945
1945
 
1946
1946
  if (!this.isVisible()) {
1947
- this.triggerItemSelection(event);
1947
+ this.triggerItemSelection(item, event);
1948
1948
  }
1949
1949
  }
1950
1950
 
package/lib/SelectBox.js CHANGED
@@ -1997,7 +1997,7 @@ class SelectBox {
1997
1997
  suppressEnterSpaceToggle = true;
1998
1998
  if (p.multi)
1999
1999
  dropList.toggleFocusedItem(evt);
2000
- else dropList.triggerItemSelection(evt);
2000
+ else dropList.triggerItemSelection(null, evt);
2001
2001
  evt.preventDefault();
2002
2002
  }
2003
2003
  }
@@ -2007,14 +2007,14 @@ class SelectBox {
2007
2007
  if (dropList.isVisible() && dropList.hasFocusedItem()) {
2008
2008
  suppressEnterSpaceToggle = true;
2009
2009
  evt.preventDefault();
2010
- dropList.triggerItemSelection(evt);
2010
+ dropList.triggerItemSelection(null, evt);
2011
2011
  }
2012
2012
 
2013
2013
  break;
2014
2014
 
2015
2015
  case VALUE_TAB:
2016
2016
  if (dropList.isVisible() && dropList.hasFocusedItem()) {
2017
- dropList.triggerItemSelection(evt);
2017
+ dropList.triggerItemSelection(null, evt);
2018
2018
  }
2019
2019
  break;
2020
2020
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danielgindi/selectbox",
3
- "version": "1.0.83",
3
+ "version": "1.0.85",
4
4
  "description": "A collection of dom utilities. So you can work natively with the dom without dom frameworks.",
5
5
  "main": "dist/lib.cjs.min.js",
6
6
  "module": "lib/index.js",
package/vue/DropList.vue CHANGED
@@ -226,7 +226,16 @@ export default {
226
226
  for (let [key, fn] of Object.entries(this.$listeners)) {
227
227
  if (AllListEvents.includes(key))
228
228
  continue;
229
- this.sink.add(this._list.el, key + '.vue', fn);
229
+
230
+ if (key === 'blur') {
231
+ this.sink.add(this._list.el, key + '.vue', evt => {
232
+ if (this._list.el.contains(evt.relatedTarget))
233
+ return;
234
+ fn(evt);
235
+ }, true);
236
+ } else {
237
+ this.sink.add(this._list.el, key + '.vue', fn);
238
+ }
230
239
  }
231
240
  }
232
241
  },