@danielgindi/selectbox 1.0.81 → 1.0.84

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/lib.cjs.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @danielgindi/selectbox 1.0.81
2
+ * @danielgindi/selectbox 1.0.84
3
3
  * git://github.com/danielgindi/selectbox.git
4
4
  */
5
5
  'use strict';
@@ -6690,7 +6690,7 @@ var DropList = /*#__PURE__*/function () {
6690
6690
  return this;
6691
6691
  } }, { key: "triggerItemSelection", value:
6692
6692
 
6693
- function triggerItemSelection(event) {var _item$ItemSymbol3;
6693
+ function triggerItemSelection(item, event) {var _item2, _item$ItemSymbol3;
6694
6694
  var p = this._p;
6695
6695
 
6696
6696
  p.focusItemEl = p.focusItemEl || Dom.closestUntil(event.target, 'li', p.el);
@@ -6698,7 +6698,7 @@ var DropList = /*#__PURE__*/function () {
6698
6698
  if (p.focusItemIndex === undefined)
6699
6699
  p.focusItemIndex = -1;
6700
6700
 
6701
- var item = p.focusItemEl[ItemSymbol$1];
6701
+ item = (_item2 = item) !== null && _item2 !== void 0 ? _item2 : p.focusItemEl[ItemSymbol$1];
6702
6702
  if (item._nointeraction) {
6703
6703
  return false;
6704
6704
  }
@@ -6746,15 +6746,15 @@ var DropList = /*#__PURE__*/function () {
6746
6746
  // Determine if the list is virtual or not
6747
6747
  this._determineVirtualMode(items.length + itemsToAdd.length);
6748
6748
 
6749
- for (var i = 0, count = itemsToAdd.length; i < count; i++) {var _item2;
6749
+ for (var i = 0, count = itemsToAdd.length; i < count; i++) {var _item3;
6750
6750
  var oitem = itemsToAdd[i];
6751
6751
  //noinspection PointlessBooleanExpressionJS
6752
- var item = (_item2 = {}, _defineProperty(_item2,
6753
- ItemSymbol$1, oitem), _defineProperty(_item2, "label",
6754
- oitem[labelProp]), _defineProperty(_item2, "value",
6755
- oitem[valueProp]), _defineProperty(_item2, "_nocheck",
6756
- !!oitem._nocheck), _defineProperty(_item2, "_nointeraction",
6757
- !!oitem._nointeraction), _item2);
6752
+ var item = (_item3 = {}, _defineProperty(_item3,
6753
+ ItemSymbol$1, oitem), _defineProperty(_item3, "label",
6754
+ oitem[labelProp]), _defineProperty(_item3, "value",
6755
+ oitem[valueProp]), _defineProperty(_item3, "_nocheck",
6756
+ !!oitem._nocheck), _defineProperty(_item3, "_nointeraction",
6757
+ !!oitem._nointeraction), _item3);
6758
6758
 
6759
6759
 
6760
6760
  if (isMulti) {
@@ -7668,7 +7668,7 @@ var DropList = /*#__PURE__*/function () {
7668
7668
 
7669
7669
  if (!this._mouseHandled) {
7670
7670
 
7671
- this.triggerItemSelection(event);
7671
+ this.triggerItemSelection(null, event);
7672
7672
 
7673
7673
  // If we are destroyed in response to a click/select, cease all actions
7674
7674
  if (this[DestroyedSymbol$1])
@@ -7833,7 +7833,7 @@ var DropList = /*#__PURE__*/function () {
7833
7833
  break;
7834
7834
 
7835
7835
  case keycodeJs.VALUE_ENTER:
7836
- this.triggerItemSelection(event);
7836
+ this.triggerItemSelection(null, event);
7837
7837
  event.preventDefault();
7838
7838
  break;
7839
7839
 
@@ -7915,7 +7915,7 @@ var DropList = /*#__PURE__*/function () {
7915
7915
  this._focus(evt, next || null, matchIndex);
7916
7916
 
7917
7917
  if (!this.isVisible()) {
7918
- this.triggerItemSelection(evt);
7918
+ this.triggerItemSelection(null, evt);
7919
7919
  }
7920
7920
 
7921
7921
  // Record the last filter used
@@ -8109,7 +8109,7 @@ var DropList = /*#__PURE__*/function () {
8109
8109
  this._focus(event, next || null, nextIndex);
8110
8110
 
8111
8111
  if (!this.isVisible()) {
8112
- this.triggerItemSelection(event);
8112
+ this.triggerItemSelection(item, event);
8113
8113
  }
8114
8114
  } }, { key: "_hasScroll", value:
8115
8115
 
@@ -11374,6 +11374,13 @@ var SelectBox = /*#__PURE__*/function () {
11374
11374
  } }));
11375
11375
 
11376
11376
 
11377
+ p.sink.add(dropList.el, 'mousedown', function (event) {
11378
+ var li = Dom.closestUntil(event.target, 'li', event.currentTarget);
11379
+ if (!li) return;
11380
+
11381
+ event.preventDefault();
11382
+ });
11383
+
11377
11384
  this._registerDropdownEvents();
11378
11385
  } }, { key: "_unregisterDropdownEvents", value:
11379
11386
 
@@ -11465,7 +11472,7 @@ var SelectBox = /*#__PURE__*/function () {
11465
11472
  suppressEnterSpaceToggle = true;
11466
11473
  if (p.multi)
11467
11474
  dropList.toggleFocusedItem(evt);else
11468
- dropList.triggerItemSelection(evt);
11475
+ dropList.triggerItemSelection(null, evt);
11469
11476
  evt.preventDefault();
11470
11477
  }
11471
11478
  }
@@ -11475,14 +11482,14 @@ var SelectBox = /*#__PURE__*/function () {
11475
11482
  if (dropList.isVisible() && dropList.hasFocusedItem()) {
11476
11483
  suppressEnterSpaceToggle = true;
11477
11484
  evt.preventDefault();
11478
- dropList.triggerItemSelection(evt);
11485
+ dropList.triggerItemSelection(null, evt);
11479
11486
  }
11480
11487
 
11481
11488
  break;
11482
11489
 
11483
11490
  case keycodeJs.VALUE_TAB:
11484
11491
  if (dropList.isVisible() && dropList.hasFocusedItem()) {
11485
- dropList.triggerItemSelection(evt);
11492
+ dropList.triggerItemSelection(null, evt);
11486
11493
  }
11487
11494
  break;
11488
11495