@danielgindi/selectbox 1.0.115 → 1.0.117

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.115
2
+ * @danielgindi/selectbox 1.0.117
3
3
  * git://github.com/danielgindi/selectbox.git
4
4
  */
5
5
  'use strict';
@@ -720,6 +720,20 @@ class DropList {
720
720
  return this;
721
721
  }
722
722
 
723
+ /**
724
+ * Should only be used if the items array has been manually manipulated.
725
+ * @return {DropList}
726
+ */
727
+ invalidate() {
728
+ const p = this._p;
729
+
730
+ p.virtualListHelper.
731
+ invalidate().
732
+ render();
733
+
734
+ return this;
735
+ }
736
+
723
737
  itemDataByValue(value) {
724
738
  const p = this._p;
725
739
 
@@ -4341,7 +4355,8 @@ class SelectBox {
4341
4355
  evt.key === keycodeJs.VALUE_SPACE &&
4342
4356
  p.lastKeyAllowsNonTypeKeys &&
4343
4357
  !p.multi &&
4344
- !dropList.hasFocusedItem())
4358
+ !dropList.hasFocusedItem() &&
4359
+ !p.disabled)
4345
4360
  {
4346
4361
  this.toggleList();
4347
4362
  evt.preventDefault();
@@ -4353,6 +4368,8 @@ class SelectBox {
4353
4368
  if (p.input) {
4354
4369
  p.sink.
4355
4370
  add(p.input, 'input.dropdown', () => {
4371
+ if (p.disabled) return;
4372
+
4356
4373
  p.filterTerm = p.input.value.trim();
4357
4374
  p.filteredItems = null;
4358
4375
  p.itemsChanged = true;
@@ -4362,11 +4379,15 @@ class SelectBox {
4362
4379
  p.throttledUpdateListItems();
4363
4380
  }).
4364
4381
  add(p.input, 'click.dropdown', () => {
4382
+ if (p.disabled) return;
4383
+
4365
4384
  if (!p.multi && p.searchable) {
4366
4385
  this.openList();
4367
4386
  }
4368
4387
  }).
4369
4388
  add(p.input, 'focus.dropdown', () => {
4389
+ if (p.disabled) return;
4390
+
4370
4391
  this._trigger('search:focus');
4371
4392
 
4372
4393
  if (this[DestroyedSymbol]) return; // destroyed by event handler
@@ -4378,6 +4399,8 @@ class SelectBox {
4378
4399
  setTimeout(() => {avoidToggleFromClick = false;}, 10);
4379
4400
  }).
4380
4401
  add(p.input, 'blur.dropdown', () => {
4402
+ if (p.disabled) return;
4403
+
4381
4404
  this._trigger('search:blur');
4382
4405
 
4383
4406
  if (this[DestroyedSymbol]) return; // destroyed by event handler
@@ -4391,7 +4414,7 @@ class SelectBox {
4391
4414
 
4392
4415
  p.sink.
4393
4416
  add(p.el, 'mousedown.dropdown', () => {
4394
- if (!p.multi && !p.searchable && !avoidToggleFromClick) {
4417
+ if (!p.multi && !p.searchable && !avoidToggleFromClick && !p.disabled) {
4395
4418
  this.toggleList();
4396
4419
  }
4397
4420
  avoidToggleFromClick = false;