@danielgindi/selectbox 2.0.45 → 2.0.47

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.umd.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @danielgindi/selectbox 2.0.45
2
+ * @danielgindi/selectbox 2.0.47
3
3
  * git://github.com/danielgindi/selectbox.git
4
4
  */
5
5
  (function (global, factory) {
@@ -6929,7 +6929,7 @@
6929
6929
  return this;
6930
6930
  }
6931
6931
 
6932
- triggerItemSelection(item, event) {var _item$ItemSymbol3;
6932
+ triggerItemSelection(item, event) {
6933
6933
  const p = this._p;
6934
6934
 
6935
6935
  p.focusItemEl = p.focusItemEl || Dom.closestUntil(event.target, 'li', p.el);
@@ -6942,16 +6942,21 @@
6942
6942
  return false;
6943
6943
  }
6944
6944
 
6945
- if (!p.multi) {
6945
+ if (p.multi) {
6946
+ if (p.focusItemIndex >= 0) {
6947
+ this.toggleFocusedItem();
6948
+ event.preventDefault();
6949
+ }
6950
+ } else {var _item$ItemSymbol3;
6946
6951
  this._setSingleSelectedItemEl(p.focusItemEl);
6947
- }
6948
6952
 
6949
- this._trigger('select', {
6950
- value: item ? item.value : undefined,
6951
- item: (_item$ItemSymbol3 = item[ItemSymbol]) !== null && _item$ItemSymbol3 !== void 0 ? _item$ItemSymbol3 : item,
6952
- event: event,
6953
- el: p.focusItemEl
6954
- });
6953
+ this._trigger('select', {
6954
+ value: item ? item.value : undefined,
6955
+ item: (_item$ItemSymbol3 = item[ItemSymbol]) !== null && _item$ItemSymbol3 !== void 0 ? _item$ItemSymbol3 : item,
6956
+ event: event,
6957
+ el: p.focusItemEl
6958
+ });
6959
+ }
6955
6960
 
6956
6961
  return true;
6957
6962
  }
@@ -8302,7 +8307,7 @@
8302
8307
  }
8303
8308
 
8304
8309
  hasFocusedItem() {
8305
- return this._p.focusItemIndex > -1;
8310
+ return this._p.focusItemIndex > -1 && this._p.focusItemIndex < this._p.items.length;
8306
8311
  }
8307
8312
 
8308
8313
  getFocusedItemIndex() {
@@ -10002,7 +10007,7 @@
10002
10007
  'search' {value}: input box value has changed
10003
10008
  'search:focus': input box has gained focus
10004
10009
  'search:blur': input box has lost focus
10005
- 'search:term': search term has been updated
10010
+ 'search:term': search term has been updated, before results were re-filtered
10006
10011
  'input:resize': input box resized
10007
10012
  'itemschanged' {term, mutated, count}: the current set of items has changed
10008
10013
  */
@@ -10517,8 +10522,8 @@
10517
10522
 
10518
10523
  if (performSearch) {var _p$dropList2;
10519
10524
  p.filterTerm = p.input.value.trim();
10520
- (_p$dropList2 = p.dropList) === null || _p$dropList2 === void 0 || _p$dropList2.setSearchTerm(p.filterTerm, performSearch);
10521
10525
  this._trigger('search:term', p.filterTerm);
10526
+ (_p$dropList2 = p.dropList) === null || _p$dropList2 === void 0 || _p$dropList2.setSearchTerm(p.filterTerm, performSearch);
10522
10527
  }
10523
10528
 
10524
10529
  return this;
@@ -12079,8 +12084,8 @@
12079
12084
  if (p.disabled || p.readOnly) return;
12080
12085
 
12081
12086
  p.filterTerm = p.input.value.trim();
12082
- (_p$dropList9 = p.dropList) === null || _p$dropList9 === void 0 || _p$dropList9.setSearchTerm(p.filterTerm, true);
12083
12087
  this._trigger('search:term', p.filterTerm);
12088
+ (_p$dropList9 = p.dropList) === null || _p$dropList9 === void 0 || _p$dropList9.setSearchTerm(p.filterTerm, true);
12084
12089
  }).
12085
12090
  add(p.input, 'click.dropdown', () => {
12086
12091
  if (p.disabled || p.readOnly) return;
@@ -12923,8 +12928,8 @@
12923
12928
  p.input.value = value == null ? '' : String(value);
12924
12929
 
12925
12930
  p.filterTerm = '';
12926
- (_p$dropList0 = p.dropList) === null || _p$dropList0 === void 0 || _p$dropList0.setSearchTerm('', true);
12927
12931
  this._trigger('search:term', p.filterTerm);
12932
+ (_p$dropList0 = p.dropList) === null || _p$dropList0 === void 0 || _p$dropList0.setSearchTerm('', true);
12928
12933
  }
12929
12934
 
12930
12935
  /**