@danielgindi/selectbox 2.0.28 → 2.0.29
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 +23 -23
- package/dist/lib.cjs.js.map +1 -1
- package/dist/lib.cjs.min.js +2 -2
- package/dist/lib.cjs.min.js.map +1 -1
- package/dist/lib.es6.js +23 -23
- package/dist/lib.es6.js.map +1 -1
- package/dist/lib.es6.min.js +2 -2
- package/dist/lib.es6.min.js.map +1 -1
- package/dist/lib.umd.js +23 -23
- package/dist/lib.umd.js.map +1 -1
- package/dist/lib.umd.min.js +2 -2
- package/dist/lib.umd.min.js.map +1 -1
- package/lib/SelectBox.js +22 -22
- package/package.json +1 -1
- package/vue/SelectBox.vue +3 -3
package/dist/lib.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @danielgindi/selectbox 2.0.
|
|
2
|
+
* @danielgindi/selectbox 2.0.29
|
|
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} [
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
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}
|
|
10339
|
+
* @param {boolean=true} readOnly Should the control be read only?
|
|
10340
10340
|
* @returns {SelectBox}
|
|
10341
10341
|
*/
|
|
10342
|
-
setReadOnly(
|
|
10342
|
+
setReadOnly(readOnly) {
|
|
10343
10343
|
const p = this._p;
|
|
10344
10344
|
|
|
10345
|
-
if (
|
|
10346
|
-
|
|
10345
|
+
if (readOnly === undefined) {
|
|
10346
|
+
readOnly = true;
|
|
10347
10347
|
}
|
|
10348
|
-
p.
|
|
10349
|
-
p.el.setAttribute('aria-
|
|
10350
|
-
p.input.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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 =
|
|
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.
|
|
13063
|
+
if (p.disabled || p.readOnly) return;
|
|
13064
13064
|
|
|
13065
13065
|
const isRtl = getComputedStyle(p.el).direction === 'rtl';
|
|
13066
13066
|
|