@danielgindi/selectbox 2.0.47 → 2.0.49
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 +49 -8
- 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 +49 -8
- 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 +49 -8
- 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 +1 -4
- package/lib/SelectBox.js +47 -3
- package/package.json +1 -1
package/dist/lib.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @danielgindi/selectbox 2.0.
|
|
2
|
+
* @danielgindi/selectbox 2.0.49
|
|
3
3
|
* git://github.com/danielgindi/selectbox.git
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -6943,9 +6943,8 @@
|
|
|
6943
6943
|
}
|
|
6944
6944
|
|
|
6945
6945
|
if (p.multi) {
|
|
6946
|
-
if (
|
|
6946
|
+
if (this.hasFocusedItem()) {
|
|
6947
6947
|
this.toggleFocusedItem();
|
|
6948
|
-
event.preventDefault();
|
|
6949
6948
|
}
|
|
6950
6949
|
} else {var _item$ItemSymbol3;
|
|
6951
6950
|
this._setSingleSelectedItemEl(p.focusItemEl);
|
|
@@ -8735,8 +8734,6 @@
|
|
|
8735
8734
|
if (this[DestroyedSymbol$1])
|
|
8736
8735
|
return;
|
|
8737
8736
|
|
|
8738
|
-
this.toggleFocusedItem();
|
|
8739
|
-
|
|
8740
8737
|
if (document.activeElement !== this.el && p.focusItemEl) {
|
|
8741
8738
|
clearTimeout(p.blurTimer);
|
|
8742
8739
|
}
|
|
@@ -9988,6 +9985,42 @@
|
|
|
9988
9985
|
return title;
|
|
9989
9986
|
};
|
|
9990
9987
|
|
|
9988
|
+
|
|
9989
|
+
function getFocusState(element) {
|
|
9990
|
+
if (!element)
|
|
9991
|
+
return null;
|
|
9992
|
+
|
|
9993
|
+
const state = { element };
|
|
9994
|
+
|
|
9995
|
+
if (typeof element.selectionStart === 'number' &&
|
|
9996
|
+
typeof element.selectionEnd === 'number') {
|
|
9997
|
+
state.selectionStart = element.selectionStart;
|
|
9998
|
+
state.selectionEnd = element.selectionEnd;
|
|
9999
|
+
state.selectionDirection = element.selectionDirection;
|
|
10000
|
+
}
|
|
10001
|
+
|
|
10002
|
+
return state;
|
|
10003
|
+
}
|
|
10004
|
+
|
|
10005
|
+
function restoreFocusState(state) {
|
|
10006
|
+
if (!(state !== null && state !== void 0 && state.element) || !document.body.contains(state.element))
|
|
10007
|
+
return false;
|
|
10008
|
+
|
|
10009
|
+
state.element.focus();
|
|
10010
|
+
|
|
10011
|
+
if (typeof state.selectionStart === 'number' &&
|
|
10012
|
+
typeof state.selectionEnd === 'number' &&
|
|
10013
|
+
typeof state.element.setSelectionRange === 'function') {var _state$selectionDirec;
|
|
10014
|
+
state.element.setSelectionRange(
|
|
10015
|
+
state.selectionStart,
|
|
10016
|
+
state.selectionEnd, (_state$selectionDirec =
|
|
10017
|
+
state.selectionDirection) !== null && _state$selectionDirec !== void 0 ? _state$selectionDirec : 'none'
|
|
10018
|
+
);
|
|
10019
|
+
}
|
|
10020
|
+
|
|
10021
|
+
return true;
|
|
10022
|
+
}
|
|
10023
|
+
|
|
9991
10024
|
/*
|
|
9992
10025
|
Emits the following events:
|
|
9993
10026
|
---------------------------
|
|
@@ -11252,6 +11285,8 @@
|
|
|
11252
11285
|
|
|
11253
11286
|
this._trigger('open:before', { list: p.dropList });
|
|
11254
11287
|
|
|
11288
|
+
p.lastActiveElement = document.activeElement === document.body ? null : getFocusState(document.activeElement);
|
|
11289
|
+
|
|
11255
11290
|
// Propagate direction to droplist
|
|
11256
11291
|
p.dropList.setDirection(getComputedStyle(p.el).direction);
|
|
11257
11292
|
|
|
@@ -11286,6 +11321,11 @@
|
|
|
11286
11321
|
|
|
11287
11322
|
p.dropList.hide();
|
|
11288
11323
|
|
|
11324
|
+
if (p.lastActiveElement) {
|
|
11325
|
+
restoreFocusState(p.lastActiveElement);
|
|
11326
|
+
p.lastActiveElement = null;
|
|
11327
|
+
}
|
|
11328
|
+
|
|
11289
11329
|
return this;
|
|
11290
11330
|
}
|
|
11291
11331
|
|
|
@@ -11878,9 +11918,10 @@
|
|
|
11878
11918
|
|
|
11879
11919
|
this.closeList();
|
|
11880
11920
|
|
|
11881
|
-
if (p.blurOnSingleSelection === 'touch' && hasTouchCapability ||
|
|
11882
|
-
p.blurOnSingleSelection !== 'touch' && p.blurOnSingleSelection)
|
|
11883
|
-
|
|
11921
|
+
if ((p.blurOnSingleSelection === 'touch' && hasTouchCapability ||
|
|
11922
|
+
p.blurOnSingleSelection !== 'touch' && p.blurOnSingleSelection) &&
|
|
11923
|
+
p.input && document.activeElement === p.input) {
|
|
11924
|
+
p.input.blur();
|
|
11884
11925
|
}
|
|
11885
11926
|
}
|
|
11886
11927
|
break;
|