@danielgindi/selectbox 1.0.69 → 1.0.72

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.69
2
+ * @danielgindi/selectbox 1.0.72
3
3
  * git://github.com/danielgindi/selectbox.git
4
4
  */
5
5
  'use strict';
@@ -9681,6 +9681,7 @@ var inputBackbufferCssProps = [
9681
9681
  * @property {boolean|'touch'} [blurOnSingleSelection='touch']
9682
9682
  * @property {boolean} [multi=false] can multiple values be selected?
9683
9683
  * @property {boolean} [showSelection=true] show selection? if false, the placeholder will take effect
9684
+ * @property {boolean} [showPlaceholderInTooltip=false] show placeholder in title attribute
9684
9685
  * @property {function(items: DropList.ItemBase[]):string} [multiPlaceholderFormatter] formatter for placeholder for multi items mode
9685
9686
  * @property {boolean} [searchable=false] is it searchable?
9686
9687
  * @property {string} [noResultsText='No matching results'] text for no results (empty for none)
@@ -9724,6 +9725,7 @@ var defaultOptions = {
9724
9725
  blurOnSingleSelection: 'touch',
9725
9726
  multi: false,
9726
9727
  showSelection: true,
9728
+ showPlaceholderInTooltip: false,
9727
9729
  multiPlaceholderFormatter: null,
9728
9730
  searchable: true,
9729
9731
  noResultsText: 'No matching results',
@@ -9814,6 +9816,7 @@ var SelectBox = /*#__PURE__*/function () {
9814
9816
  blurOnSingleSelection: o.blurOnSingleSelection,
9815
9817
  multi: o.multi,
9816
9818
  showSelection: o.showSelection,
9819
+ showPlaceholderInTooltip: o.showPlaceholderInTooltip,
9817
9820
  multiPlaceholderFormatter: o.multiPlaceholderFormatter,
9818
9821
  searchable: o.searchable,
9819
9822
  noResultsText: o.noResultsText,
@@ -10246,6 +10249,16 @@ var SelectBox = /*#__PURE__*/function () {
10246
10249
  if (p.input)
10247
10250
  return p.input.value;
10248
10251
  return '';
10252
+ } }, { key: "invokeRefilter", value:
10253
+
10254
+ function invokeRefilter() {
10255
+ var p = this._p;
10256
+ if (!p.filterTerm && !p.filterOnEmptyTerm)
10257
+ return this;
10258
+ p.filteredItems = null;
10259
+ p.itemsChanged = true;
10260
+ p.throttledUpdateListItems();
10261
+ return this;
10249
10262
  }
10250
10263
 
10251
10264
  /**
@@ -10415,7 +10428,7 @@ var SelectBox = /*#__PURE__*/function () {
10415
10428
  if (p.showSelection === showSelection)
10416
10429
  return this;
10417
10430
 
10418
- this._p.showSelection = showSelection;
10431
+ p.showSelection = showSelection;
10419
10432
  this._scheduleSync('full');
10420
10433
  return this;
10421
10434
  }
@@ -10427,6 +10440,28 @@ var SelectBox = /*#__PURE__*/function () {
10427
10440
  return this._p.showSelection;
10428
10441
  }
10429
10442
 
10443
+ /**
10444
+ * @param {boolean} showPlaceholderInTooltip
10445
+ * @returns {SelectBox}
10446
+ */ }, { key: "setShowPlaceholderInTooltip", value:
10447
+ function setShowPlaceholderInTooltip(showPlaceholderInTooltip) {
10448
+ var p = this._p;
10449
+ showPlaceholderInTooltip = !!showPlaceholderInTooltip;
10450
+ if (p.showPlaceholderInTooltip === showPlaceholderInTooltip)
10451
+ return this;
10452
+
10453
+ p.showPlaceholderInTooltip = showPlaceholderInTooltip;
10454
+ this._scheduleSync('full');
10455
+ return this;
10456
+ }
10457
+
10458
+ /**
10459
+ * @returns {boolean}
10460
+ */ }, { key: "isShowPlaceholderInTooltipEnabled", value:
10461
+ function isShowPlaceholderInTooltipEnabled() {
10462
+ return this._p.showPlaceholderInTooltip;
10463
+ }
10464
+
10430
10465
  /**
10431
10466
  * @param {function(items: DropList.ItemBase[]):string} formatter
10432
10467
  * @returns {SelectBox}
@@ -10437,7 +10472,7 @@ var SelectBox = /*#__PURE__*/function () {
10437
10472
  if (p.multiPlaceholderFormatter === formatter)
10438
10473
  return this;
10439
10474
 
10440
- this._p.multiPlaceholderFormatter = formatter;
10475
+ p.multiPlaceholderFormatter = formatter;
10441
10476
  this._scheduleSync('full');
10442
10477
  return this;
10443
10478
  }
@@ -10451,7 +10486,7 @@ var SelectBox = /*#__PURE__*/function () {
10451
10486
  if (p.blurOnSingleSelection === value)
10452
10487
  return this;
10453
10488
 
10454
- this._p.blurOnSingleSelection = value;
10489
+ p.blurOnSingleSelection = value;
10455
10490
  return this;
10456
10491
  }
10457
10492
 
@@ -10566,7 +10601,10 @@ var SelectBox = /*#__PURE__*/function () {
10566
10601
  */ }, { key: "setFilterOnEmptyTerm", value:
10567
10602
  function setFilterOnEmptyTerm(value) {
10568
10603
  var p = this._p;
10604
+ if (p.filterOnEmptyTerm === value)
10605
+ return this;
10569
10606
  p.filterOnEmptyTerm = value;
10607
+ p.throttledUpdateListItems();
10570
10608
  return this;
10571
10609
  }
10572
10610
 
@@ -10706,7 +10744,10 @@ var SelectBox = /*#__PURE__*/function () {
10706
10744
  */ }, { key: "setFilterFn", value:
10707
10745
  function setFilterFn(fn) {
10708
10746
  var p = this._p;
10747
+ if (p.filterFn === fn)
10748
+ return this;
10709
10749
  p.filterFn = fn;
10750
+ p.throttledUpdateListItems();
10710
10751
  return this;
10711
10752
  }
10712
10753
 
@@ -10822,7 +10863,7 @@ var SelectBox = /*#__PURE__*/function () {
10822
10863
  if (item !== undefined) {
10823
10864
  selectedItems.push(item);
10824
10865
  } else {
10825
- selectedItems.push(_defineProperty({}, p.valueProp, value));
10866
+ selectedItems.push(_defineProperty({}, valueProp, value));
10826
10867
  }
10827
10868
  }} catch (err) {_iterator2.e(err);} finally {_iterator2.f();}
10828
10869
 
@@ -10831,7 +10872,6 @@ var SelectBox = /*#__PURE__*/function () {
10831
10872
  p.selectionChanged = true;
10832
10873
  p.resortBySelectionNeeded = true;
10833
10874
 
10834
- this._updateListItems();
10835
10875
  this._scheduleSync('full');
10836
10876
 
10837
10877
  return this;
@@ -11847,8 +11887,9 @@ var SelectBox = /*#__PURE__*/function () {
11847
11887
  if (hasRefocusedItem) {
11848
11888
  p.dropList.setFocusedItemAtIndex(p.dropList.getFocusedItemIndex());
11849
11889
  }
11850
- } }, { key: "_refilterItems", value:
11890
+ }
11851
11891
 
11892
+ /** @private */ }, { key: "_refilterItems", value:
11852
11893
  function _refilterItems() {
11853
11894
  var p = this._p;
11854
11895
 
@@ -11917,8 +11958,9 @@ var SelectBox = /*#__PURE__*/function () {
11917
11958
  this._trigger('itemschanged', { term: term, mutated: false, count: this.getFilteredItemCount() });
11918
11959
 
11919
11960
  p.itemsChanged = true;
11920
- } }, { key: "_setSelectedItems", value:
11961
+ }
11921
11962
 
11963
+ /** @private */ }, { key: "_setSelectedItems", value:
11922
11964
  function _setSelectedItems(items) {
11923
11965
  var p = this._p,valueProp = p.valueProp;
11924
11966
 
@@ -11935,8 +11977,9 @@ var SelectBox = /*#__PURE__*/function () {
11935
11977
 
11936
11978
  this._updateListItems();
11937
11979
  this._scheduleSync('full');
11938
- } }, { key: "_scheduleSync", value:
11980
+ }
11939
11981
 
11982
+ /** @private */ }, { key: "_scheduleSync", value:
11940
11983
  function _scheduleSync(mode, data) {var _this7 = this;
11941
11984
  var p = this._p;
11942
11985
 
@@ -11958,8 +12001,9 @@ var SelectBox = /*#__PURE__*/function () {
11958
12001
  delete p.syncQueue;
11959
12002
  _this7._performSync(queue);
11960
12003
  });
11961
- } }, { key: "_performSync", value:
12004
+ }
11962
12005
 
12006
+ /** @private */ }, { key: "_performSync", value:
11963
12007
  function _performSync(queue) {var _this8 = this;
11964
12008
  var p = this._p;
11965
12009
 
@@ -12032,8 +12076,9 @@ var SelectBox = /*#__PURE__*/function () {
12032
12076
  break;}
12033
12077
 
12034
12078
  }} catch (err) {_iterator4.e(err);} finally {_iterator4.f();}
12035
- } }, { key: "_cleanupSingleWrapper", value:
12079
+ }
12036
12080
 
12081
+ /** @private */ }, { key: "_cleanupSingleWrapper", value:
12037
12082
  function _cleanupSingleWrapper() {
12038
12083
  var p = this._p;
12039
12084
 
@@ -12212,6 +12257,12 @@ var SelectBox = /*#__PURE__*/function () {
12212
12257
 
12213
12258
  // Set input placeholder
12214
12259
  p.input.setAttribute('placeholder', placeholder);
12260
+
12261
+ if (p.showPlaceholderInTooltip) {
12262
+ p.input.setAttribute('title', placeholder);
12263
+ } else {
12264
+ p.input.removeAttribute('title');
12265
+ }
12215
12266
  }
12216
12267
 
12217
12268
  /** @private */ }, { key: "_syncSingleItem", value:
@@ -12325,7 +12376,10 @@ var SelectBox = /*#__PURE__*/function () {
12325
12376
  }
12326
12377
 
12327
12378
  // Update input size
12328
- this._resizeInput()._updateListItems();
12379
+ this._resizeInput();
12380
+
12381
+ // Update list items
12382
+ this._updateListItems();
12329
12383
 
12330
12384
  return this;
12331
12385
  }