@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.cjs.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
  'use strict';
@@ -6933,7 +6933,7 @@ class DropList {
6933
6933
  return this;
6934
6934
  }
6935
6935
 
6936
- triggerItemSelection(item, event) {var _item$ItemSymbol3;
6936
+ triggerItemSelection(item, event) {
6937
6937
  const p = this._p;
6938
6938
 
6939
6939
  p.focusItemEl = p.focusItemEl || Dom.closestUntil(event.target, 'li', p.el);
@@ -6946,16 +6946,21 @@ class DropList {
6946
6946
  return false;
6947
6947
  }
6948
6948
 
6949
- if (!p.multi) {
6949
+ if (p.multi) {
6950
+ if (p.focusItemIndex >= 0) {
6951
+ this.toggleFocusedItem();
6952
+ event.preventDefault();
6953
+ }
6954
+ } else {var _item$ItemSymbol3;
6950
6955
  this._setSingleSelectedItemEl(p.focusItemEl);
6951
- }
6952
6956
 
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
- });
6957
+ this._trigger('select', {
6958
+ value: item ? item.value : undefined,
6959
+ item: (_item$ItemSymbol3 = item[ItemSymbol]) !== null && _item$ItemSymbol3 !== void 0 ? _item$ItemSymbol3 : item,
6960
+ event: event,
6961
+ el: p.focusItemEl
6962
+ });
6963
+ }
6959
6964
 
6960
6965
  return true;
6961
6966
  }
@@ -8306,7 +8311,7 @@ class DropList {
8306
8311
  }
8307
8312
 
8308
8313
  hasFocusedItem() {
8309
- return this._p.focusItemIndex > -1;
8314
+ return this._p.focusItemIndex > -1 && this._p.focusItemIndex < this._p.items.length;
8310
8315
  }
8311
8316
 
8312
8317
  getFocusedItemIndex() {
@@ -10006,7 +10011,7 @@ Emits the following events:
10006
10011
  'search' {value}: input box value has changed
10007
10012
  'search:focus': input box has gained focus
10008
10013
  'search:blur': input box has lost focus
10009
- 'search:term': search term has been updated
10014
+ 'search:term': search term has been updated, before results were re-filtered
10010
10015
  'input:resize': input box resized
10011
10016
  'itemschanged' {term, mutated, count}: the current set of items has changed
10012
10017
  */
@@ -10521,8 +10526,8 @@ class SelectBox {
10521
10526
 
10522
10527
  if (performSearch) {var _p$dropList2;
10523
10528
  p.filterTerm = p.input.value.trim();
10524
- (_p$dropList2 = p.dropList) === null || _p$dropList2 === void 0 || _p$dropList2.setSearchTerm(p.filterTerm, performSearch);
10525
10529
  this._trigger('search:term', p.filterTerm);
10530
+ (_p$dropList2 = p.dropList) === null || _p$dropList2 === void 0 || _p$dropList2.setSearchTerm(p.filterTerm, performSearch);
10526
10531
  }
10527
10532
 
10528
10533
  return this;
@@ -12083,8 +12088,8 @@ class SelectBox {
12083
12088
  if (p.disabled || p.readOnly) return;
12084
12089
 
12085
12090
  p.filterTerm = p.input.value.trim();
12086
- (_p$dropList9 = p.dropList) === null || _p$dropList9 === void 0 || _p$dropList9.setSearchTerm(p.filterTerm, true);
12087
12091
  this._trigger('search:term', p.filterTerm);
12092
+ (_p$dropList9 = p.dropList) === null || _p$dropList9 === void 0 || _p$dropList9.setSearchTerm(p.filterTerm, true);
12088
12093
  }).
12089
12094
  add(p.input, 'click.dropdown', () => {
12090
12095
  if (p.disabled || p.readOnly) return;
@@ -12927,8 +12932,8 @@ class SelectBox {
12927
12932
  p.input.value = value == null ? '' : String(value);
12928
12933
 
12929
12934
  p.filterTerm = '';
12930
- (_p$dropList0 = p.dropList) === null || _p$dropList0 === void 0 || _p$dropList0.setSearchTerm('', true);
12931
12935
  this._trigger('search:term', p.filterTerm);
12936
+ (_p$dropList0 = p.dropList) === null || _p$dropList0 === void 0 || _p$dropList0.setSearchTerm('', true);
12932
12937
  }
12933
12938
 
12934
12939
  /**