@danielgindi/selectbox 1.0.54 → 1.0.58
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 +44 -18
- 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 +48 -22
- 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 +44 -18
- 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/DropList.js +47 -21
- package/package.json +1 -1
- package/vue/DropList.vue +34 -8
package/dist/lib.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @danielgindi/selectbox 1.0.
|
|
2
|
+
* @danielgindi/selectbox 1.0.58
|
|
3
3
|
* git://github.com/danielgindi/selectbox.git
|
|
4
4
|
*/
|
|
5
5
|
'use strict';
|
|
@@ -5993,7 +5993,8 @@ var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
|
5993
5993
|
* @property {Element} [el] An element to attach to, instead of creating a new one
|
|
5994
5994
|
* @property {string} [baseClassName='droplist'] class name for the menu root element
|
|
5995
5995
|
* @property {string|string[]} [additionalClasses]
|
|
5996
|
-
* @property {
|
|
5996
|
+
* @property {boolean} [autoItemBlur=true] Should we automatically blur the focused item when the droplist loses focus?
|
|
5997
|
+
* @property {number} [autoItemBlurDelay=300] How long to wait before deciding to blur the focused item (when the droplist loses focus)?
|
|
5997
5998
|
* @property {boolean} [capturesFocus=true] Should this DropList be added to the TAB-key stack?
|
|
5998
5999
|
* @property {boolean} [multi=false] Does this DropList show checkboxes for multiple item selection?
|
|
5999
6000
|
* @property {function} [keyDownHandler=null] An alternative "keydown" event handler. Return true to prevent default behaviour.
|
|
@@ -6053,7 +6054,8 @@ var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
|
6053
6054
|
var defaultOptions$1 = {
|
|
6054
6055
|
baseClassName: 'droplist',
|
|
6055
6056
|
|
|
6056
|
-
|
|
6057
|
+
autoItemBlur: true,
|
|
6058
|
+
autoItemBlurDelay: 300,
|
|
6057
6059
|
capturesFocus: true,
|
|
6058
6060
|
multi: false,
|
|
6059
6061
|
keyDownHandler: null,
|
|
@@ -6076,9 +6078,9 @@ var defaultOptions$1 = {
|
|
|
6076
6078
|
Emits the following events:
|
|
6077
6079
|
---------------------------
|
|
6078
6080
|
|
|
6079
|
-
'itemfocus' {value, item, event}: item gained focus.
|
|
6081
|
+
'itemfocus' {value, item, event?, el}: item gained focus.
|
|
6080
6082
|
'itemblur' {value, item}: item lost focus.
|
|
6081
|
-
'select' {value, item}: item was selected (in single mode).
|
|
6083
|
+
'select' {value, item, event?, el}: item was selected (in single mode).
|
|
6082
6084
|
'show:before': the drop list will show.
|
|
6083
6085
|
'show': the drop list has been shown.
|
|
6084
6086
|
'hide:before': the drop list will hide.
|
|
@@ -6107,7 +6109,8 @@ var DropList = /*#__PURE__*/function () {
|
|
|
6107
6109
|
|
|
6108
6110
|
baseClassName: o.baseClassName,
|
|
6109
6111
|
additionalClasses: o.additionalClasses,
|
|
6110
|
-
|
|
6112
|
+
autoItemBlur: o.autoItemBlur,
|
|
6113
|
+
autoItemBlurDelay: o.autoItemBlurDelay,
|
|
6111
6114
|
capturesFocus: o.capturesFocus,
|
|
6112
6115
|
multi: o.multi,
|
|
6113
6116
|
keyDownHandler: o.keyDownHandler,
|
|
@@ -6244,7 +6247,9 @@ var DropList = /*#__PURE__*/function () {
|
|
|
6244
6247
|
p.virtualListHelper.setOnItemUnrender(function (el) {
|
|
6245
6248
|
try {
|
|
6246
6249
|
fn(el[ItemSymbol$1][ItemSymbol$1], el);
|
|
6247
|
-
} catch (err) {
|
|
6250
|
+
} catch (err) {
|
|
6251
|
+
console.error(err);
|
|
6252
|
+
} // eslint-disable-line no-console
|
|
6248
6253
|
delete el[ItemSymbol$1];
|
|
6249
6254
|
|
|
6250
6255
|
if (p.focusItemEl === el)
|
|
@@ -6363,7 +6368,9 @@ var DropList = /*#__PURE__*/function () {
|
|
|
6363
6368
|
p.virtualListHelper.setOnItemUnrender(function (el) {
|
|
6364
6369
|
try {
|
|
6365
6370
|
_fn(el[ItemSymbol$1][ItemSymbol$1], el);
|
|
6366
|
-
} catch (err) {
|
|
6371
|
+
} catch (err) {
|
|
6372
|
+
console.error(err);
|
|
6373
|
+
} // eslint-disable-line no-console
|
|
6367
6374
|
delete el[ItemSymbol$1];
|
|
6368
6375
|
|
|
6369
6376
|
if (p.focusItemEl === el)
|
|
@@ -6480,7 +6487,12 @@ var DropList = /*#__PURE__*/function () {
|
|
|
6480
6487
|
this._setSingleSelectedItemEl(p.focusItemEl);
|
|
6481
6488
|
}
|
|
6482
6489
|
|
|
6483
|
-
this._trigger('select', {
|
|
6490
|
+
this._trigger('select', {
|
|
6491
|
+
value: item ? item.value : undefined,
|
|
6492
|
+
item: (_item$ItemSymbol3 = item[ItemSymbol$1]) !== null && _item$ItemSymbol3 !== void 0 ? _item$ItemSymbol3 : item,
|
|
6493
|
+
event: event,
|
|
6494
|
+
el: p.focusItemEl });
|
|
6495
|
+
|
|
6484
6496
|
|
|
6485
6497
|
return true;
|
|
6486
6498
|
}
|
|
@@ -7074,7 +7086,7 @@ var DropList = /*#__PURE__*/function () {
|
|
|
7074
7086
|
// Detect mouse tap outside of the droplist, to blur the focused item
|
|
7075
7087
|
p.sink.add(document, 'mousedown', p.onDocumentMouseDown = function (event) {
|
|
7076
7088
|
if (!p.el.contains(event.target))
|
|
7077
|
-
_this2.
|
|
7089
|
+
_this2._delayBlurItemOnBlur();
|
|
7078
7090
|
});
|
|
7079
7091
|
}
|
|
7080
7092
|
});
|
|
@@ -7223,7 +7235,12 @@ var DropList = /*#__PURE__*/function () {
|
|
|
7223
7235
|
itemElement.classList.add("".concat(p.baseClassName, "__item_focus"));
|
|
7224
7236
|
p.focusItemEl = itemElement;
|
|
7225
7237
|
|
|
7226
|
-
this._trigger('itemfocus', {
|
|
7238
|
+
this._trigger('itemfocus', {
|
|
7239
|
+
value: itemElement.value,
|
|
7240
|
+
item: itemElement[ItemSymbol$1],
|
|
7241
|
+
event: null,
|
|
7242
|
+
el: itemElement });
|
|
7243
|
+
|
|
7227
7244
|
}
|
|
7228
7245
|
}
|
|
7229
7246
|
|
|
@@ -7498,7 +7515,9 @@ var DropList = /*#__PURE__*/function () {
|
|
|
7498
7515
|
|
|
7499
7516
|
// Track scrolling
|
|
7500
7517
|
var didScroll = false;
|
|
7501
|
-
var onScroll = function onScroll() {
|
|
7518
|
+
var onScroll = function onScroll() {
|
|
7519
|
+
didScroll = true;
|
|
7520
|
+
};
|
|
7502
7521
|
var onTouchCancel = function onTouchCancel() {
|
|
7503
7522
|
currentTouchId = null;
|
|
7504
7523
|
p.sink.remove(null, '.dropdown_touchextra');
|
|
@@ -7547,7 +7566,7 @@ var DropList = /*#__PURE__*/function () {
|
|
|
7547
7566
|
if (_this8[DestroyedSymbol$1]) return;
|
|
7548
7567
|
|
|
7549
7568
|
if (!p.el.contains(document.activeElement)) {
|
|
7550
|
-
_this8.
|
|
7569
|
+
_this8._delayBlurItemOnBlur();
|
|
7551
7570
|
}
|
|
7552
7571
|
});
|
|
7553
7572
|
});
|
|
@@ -7730,21 +7749,24 @@ var DropList = /*#__PURE__*/function () {
|
|
|
7730
7749
|
p.focusItemIndex = itemIndex;
|
|
7731
7750
|
|
|
7732
7751
|
var item = p.items[itemIndex];
|
|
7733
|
-
this._trigger('itemfocus', { value: item.value, item: (_item$ItemSymbol4 = item[ItemSymbol$1]) !== null && _item$ItemSymbol4 !== void 0 ? _item$ItemSymbol4 : item, event: event });
|
|
7734
|
-
} }, { key: "
|
|
7752
|
+
this._trigger('itemfocus', { value: item.value, item: (_item$ItemSymbol4 = item[ItemSymbol$1]) !== null && _item$ItemSymbol4 !== void 0 ? _item$ItemSymbol4 : item, event: event, el: focusItemEl });
|
|
7753
|
+
} }, { key: "_delayBlurItemOnBlur", value:
|
|
7735
7754
|
|
|
7736
|
-
function
|
|
7755
|
+
function _delayBlurItemOnBlur() {var _this10 = this;
|
|
7737
7756
|
if (this[DestroyedSymbol$1])
|
|
7738
7757
|
return;
|
|
7739
7758
|
|
|
7740
7759
|
var p = this._p;
|
|
7741
7760
|
|
|
7761
|
+
if (!p.autoItemBlur)
|
|
7762
|
+
return;
|
|
7763
|
+
|
|
7742
7764
|
clearTimeout(p.blurTimer);
|
|
7743
7765
|
|
|
7744
7766
|
p.blurTimer = setTimeout(function () {
|
|
7745
7767
|
if (_this10[DestroyedSymbol$1]) return;
|
|
7746
7768
|
_this10.blurFocusedItem();
|
|
7747
|
-
}, p.
|
|
7769
|
+
}, p.autoItemBlurDelay);
|
|
7748
7770
|
} }, { key: "_move", value:
|
|
7749
7771
|
|
|
7750
7772
|
function _move(direction, event) {
|
|
@@ -7930,7 +7952,11 @@ var DropList = /*#__PURE__*/function () {
|
|
|
7930
7952
|
}
|
|
7931
7953
|
|
|
7932
7954
|
// Fire event
|
|
7933
|
-
this._trigger('groupcheck', {
|
|
7955
|
+
this._trigger('groupcheck', {
|
|
7956
|
+
value: item.value,
|
|
7957
|
+
item: (_item$ItemSymbol5 = item[ItemSymbol$1]) !== null && _item$ItemSymbol5 !== void 0 ? _item$ItemSymbol5 : item,
|
|
7958
|
+
affectedItems: affectedItems });
|
|
7959
|
+
|
|
7934
7960
|
} else if (p.groupCount > 0) {
|
|
7935
7961
|
items = p.items;
|
|
7936
7962
|
itemIndex = items.indexOf(item);
|