@danielgindi/selectbox 2.0.28 → 2.0.30

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.28
2
+ * @danielgindi/selectbox 2.0.30
3
3
  * git://github.com/danielgindi/selectbox.git
4
4
  */
5
5
  'use strict';
@@ -9879,7 +9879,7 @@ const inputBackbufferCssProps = [
9879
9879
  * @property {string|string[]} [additionalClasses]
9880
9880
  * @property {'ltr'|'rtl'|'auto'} [direction='auto']
9881
9881
  * @property {boolean} [disabled=false] Should start as disabled?
9882
- * @property {boolean} [readonly=false] Should start as readonly?
9882
+ * @property {boolean} [readOnly=false] Should start as readOnly?
9883
9883
  * @property {boolean} [clearable=true] Has clear button?
9884
9884
  * @property {boolean} [hasOpenIndicator=true] has open/close indicator?
9885
9885
  * @property {string} [placeholder=''] Placeholder text
@@ -9925,7 +9925,7 @@ const DefaultOptions = {
9925
9925
  el: null,
9926
9926
  baseClassName: 'selectbox',
9927
9927
  disabled: false,
9928
- readonly: false,
9928
+ readOnly: false,
9929
9929
  clearable: true,
9930
9930
  hasOpenIndicator: true,
9931
9931
  placeholder: '',
@@ -10024,7 +10024,7 @@ class SelectBox {
10024
10024
  listOptions: o.listOptions,
10025
10025
 
10026
10026
  disabled: !!o.disabled,
10027
- readonly: !!o.readonly,
10027
+ readOnly: !!o.readOnly,
10028
10028
  clearable: !!o.clearable,
10029
10029
  hasOpenIndicator: !!o.hasOpenIndicator,
10030
10030
  placeholder: o.placeholder,
@@ -10107,7 +10107,7 @@ class SelectBox {
10107
10107
  p.multiItemEls = [];
10108
10108
 
10109
10109
  this.enable(!p.disabled);
10110
- this.setReadOnly(!p.readonly);
10110
+ this.setReadOnly(!p.readOnly);
10111
10111
 
10112
10112
  this._setupDropdownMenu();
10113
10113
 
@@ -10336,18 +10336,18 @@ class SelectBox {
10336
10336
 
10337
10337
  /**
10338
10338
  * Sets read only mode
10339
- * @param {boolean=true} readonly Should the control be read only?
10339
+ * @param {boolean=true} readOnly Should the control be read only?
10340
10340
  * @returns {SelectBox}
10341
10341
  */
10342
- setReadOnly(readonly) {
10342
+ setReadOnly(readOnly) {
10343
10343
  const p = this._p;
10344
10344
 
10345
- if (readonly === undefined) {
10346
- readonly = true;
10345
+ if (readOnly === undefined) {
10346
+ readOnly = true;
10347
10347
  }
10348
- p.readonly = !readonly;
10349
- p.el.setAttribute('aria-readonly', p.readonly.toString());
10350
- p.input.readonly = !!p.readonly;
10348
+ p.readOnly = readOnly;
10349
+ p.el.setAttribute('aria-readOnly', p.readOnly.toString());
10350
+ p.input.readOnly = !(p.searchable || p.multi) || !!p.readOnly;
10351
10351
 
10352
10352
  return this;
10353
10353
  }
@@ -10357,7 +10357,7 @@ class SelectBox {
10357
10357
  * @returns {boolean}
10358
10358
  */
10359
10359
  isReadOnly() {
10360
- return !this._p.readonly;
10360
+ return !this._p.readOnly;
10361
10361
  }
10362
10362
 
10363
10363
  /**
@@ -11487,7 +11487,7 @@ class SelectBox {
11487
11487
  spellcheck: 'false',
11488
11488
  role: 'textbox',
11489
11489
  'aria-autocomplete': 'list',
11490
- readOnly: !(p.searchable || p.multi)
11490
+ readOnly: !(p.searchable || p.multi) || !!p.readOnly
11491
11491
  })
11492
11492
  );
11493
11493
  }
@@ -11521,7 +11521,7 @@ class SelectBox {
11521
11521
  if (!Dom.closestUntil(evt.target, ".".concat(p.baseClassName, "__item_remove"), evt.currentTarget))
11522
11522
  return;
11523
11523
 
11524
- if (p.disabled || p.readonly) return;
11524
+ if (p.disabled || p.readOnly) return;
11525
11525
 
11526
11526
  this._removeMultiItemFromEvent(
11527
11527
  /**@type Element*/
@@ -11889,7 +11889,7 @@ class SelectBox {
11889
11889
 
11890
11890
  setTimeout(() => {
11891
11891
  if (this[DestroyedSymbol]) return; // destroyed by event handler
11892
- if (p.disabled || p.readonly) return;
11892
+ if (p.disabled || p.readOnly) return;
11893
11893
 
11894
11894
  this._trigger('search:blur');
11895
11895
 
@@ -12033,7 +12033,7 @@ class SelectBox {
12033
12033
  !p.multi &&
12034
12034
  !dropList.hasFocusedItem() &&
12035
12035
  !p.disabled &&
12036
- !p.readonly)
12036
+ !p.readOnly)
12037
12037
  {
12038
12038
  this.toggleList();
12039
12039
  evt.preventDefault();
@@ -12045,20 +12045,20 @@ class SelectBox {
12045
12045
  if (p.input) {
12046
12046
  p.sink.
12047
12047
  add(p.input, 'input.dropdown', () => {var _p$dropList9;
12048
- if (p.disabled || p.readonly) return;
12048
+ if (p.disabled || p.readOnly) return;
12049
12049
 
12050
12050
  p.filterTerm = p.input.value.trim();
12051
12051
  (_p$dropList9 = p.dropList) === null || _p$dropList9 === void 0 || _p$dropList9.setSearchTerm(p.filterTerm, true);
12052
12052
  }).
12053
12053
  add(p.input, 'click.dropdown', () => {
12054
- if (p.disabled || p.readonly) return;
12054
+ if (p.disabled || p.readOnly) return;
12055
12055
 
12056
12056
  if (!p.multi && p.searchable) {
12057
12057
  this.openList();
12058
12058
  }
12059
12059
  }).
12060
12060
  add(p.input, 'focus.dropdown', () => {
12061
- if (p.disabled || p.readonly) return;
12061
+ if (p.disabled || p.readOnly) return;
12062
12062
 
12063
12063
  this._trigger('search:focus');
12064
12064
 
@@ -12075,7 +12075,7 @@ class SelectBox {
12075
12075
 
12076
12076
  p.sink.
12077
12077
  add(p.el, 'mousedown.dropdown', () => {
12078
- if (!p.multi && !p.searchable && !avoidToggleFromClick && !p.disabled && !p.readonly) {
12078
+ if (!p.multi && !p.searchable && !avoidToggleFromClick && !p.disabled && !p.readOnly) {
12079
12079
  this.toggleList();
12080
12080
  }
12081
12081
  avoidToggleFromClick = false;
@@ -12678,7 +12678,7 @@ class SelectBox {
12678
12678
  if (p.input) p.input.readOnly = false;
12679
12679
  p.el.classList.add("".concat(p.baseClassName, "__searchable"));
12680
12680
  } else {
12681
- if (p.input) p.input.readOnly = true;
12681
+ if (p.input) p.input.readOnly = p.readOnly;
12682
12682
  p.el.classList.remove("".concat(p.baseClassName, "__searchable"));
12683
12683
  }
12684
12684
 
@@ -13060,7 +13060,7 @@ class SelectBox {
13060
13060
  _handleMultiKeydown(event) {
13061
13061
  const p = this._p;
13062
13062
 
13063
- if (p.disabled || p.readonly) return;
13063
+ if (p.disabled || p.readOnly) return;
13064
13064
 
13065
13065
  const isRtl = getComputedStyle(p.el).direction === 'rtl';
13066
13066