@danielgindi/selectbox 1.0.79 → 1.0.81
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 +24 -44
- 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 +24 -44
- 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 +24 -44
- 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 +0 -1
- package/lib/SelectBox.js +23 -42
- package/package.json +1 -1
package/dist/lib.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @danielgindi/selectbox 1.0.
|
|
2
|
+
* @danielgindi/selectbox 1.0.81
|
|
3
3
|
* git://github.com/danielgindi/selectbox.git
|
|
4
4
|
*/
|
|
5
5
|
'use strict';
|
|
@@ -7790,7 +7790,6 @@ var DropList = /*#__PURE__*/function () {
|
|
|
7790
7790
|
var p = this._p;
|
|
7791
7791
|
|
|
7792
7792
|
p.sink.add(p.el, 'keydown', function (evt) {return _this9._keydown(evt);});
|
|
7793
|
-
p.sink.add(p.el, 'keypress', function (evt) {return _this9._keydown(evt);});
|
|
7794
7793
|
} }, { key: "_keydown", value:
|
|
7795
7794
|
|
|
7796
7795
|
function _keydown(event) {
|
|
@@ -11393,9 +11392,7 @@ var SelectBox = /*#__PURE__*/function () {
|
|
|
11393
11392
|
if (!dropList) return;
|
|
11394
11393
|
|
|
11395
11394
|
var avoidToggleFromClick = false,
|
|
11396
|
-
currentTouchId = null
|
|
11397
|
-
suppressKeyPress = false,
|
|
11398
|
-
suppressKeyPressRepeat = false;
|
|
11395
|
+
currentTouchId = null;
|
|
11399
11396
|
|
|
11400
11397
|
var keyEventsTarget = p.multi || p.searchable ? p.input : p.el;
|
|
11401
11398
|
|
|
@@ -11404,8 +11401,10 @@ var SelectBox = /*#__PURE__*/function () {
|
|
|
11404
11401
|
if ( /**@type HTMLInputElement*/evt.currentTarget.readOnly)
|
|
11405
11402
|
return;
|
|
11406
11403
|
|
|
11407
|
-
|
|
11408
|
-
|
|
11404
|
+
var suppressEnterSpaceToggle = false;
|
|
11405
|
+
var lastKeyAllowsNonTypeKeys = p.lastKeyAllowsNonTypeKeys;
|
|
11406
|
+
p.lastKeyAllowsNonTypeKeys = false;
|
|
11407
|
+
var hasInputText = p.input && p.input.value.length > 0;
|
|
11409
11408
|
|
|
11410
11409
|
switch (evt.key) {
|
|
11411
11410
|
case keycodeJs.VALUE_PAGE_UP:
|
|
@@ -11415,14 +11414,13 @@ var SelectBox = /*#__PURE__*/function () {
|
|
|
11415
11414
|
case keycodeJs.VALUE_HOME:
|
|
11416
11415
|
case keycodeJs.VALUE_END:
|
|
11417
11416
|
if ((evt.key === keycodeJs.VALUE_HOME || evt.key === keycodeJs.VALUE_END) &&
|
|
11418
|
-
|
|
11417
|
+
hasInputText && !lastKeyAllowsNonTypeKeys) {
|
|
11419
11418
|
// Allow using HOME/END button within the textbox
|
|
11420
|
-
suppressKeyPressRepeat = true;
|
|
11421
11419
|
dropList._keydownFreeType(evt);
|
|
11422
11420
|
break;
|
|
11423
11421
|
}
|
|
11424
11422
|
|
|
11425
|
-
|
|
11423
|
+
p.lastKeyAllowsNonTypeKeys = true;
|
|
11426
11424
|
evt.preventDefault();
|
|
11427
11425
|
|
|
11428
11426
|
switch (evt.key) {
|
|
@@ -11460,10 +11458,11 @@ var SelectBox = /*#__PURE__*/function () {
|
|
|
11460
11458
|
break;
|
|
11461
11459
|
|
|
11462
11460
|
case keycodeJs.VALUE_SPACE:
|
|
11463
|
-
if (
|
|
11461
|
+
if (lastKeyAllowsNonTypeKeys) {
|
|
11462
|
+
p.lastKeyAllowsNonTypeKeys = true;
|
|
11463
|
+
|
|
11464
11464
|
if (dropList.isVisible() && dropList.hasFocusedItem()) {
|
|
11465
|
-
|
|
11466
|
-
suppressKeyPressRepeat = true;
|
|
11465
|
+
suppressEnterSpaceToggle = true;
|
|
11467
11466
|
if (p.multi)
|
|
11468
11467
|
dropList.toggleFocusedItem(evt);else
|
|
11469
11468
|
dropList.triggerItemSelection(evt);
|
|
@@ -11474,8 +11473,7 @@ var SelectBox = /*#__PURE__*/function () {
|
|
|
11474
11473
|
|
|
11475
11474
|
case keycodeJs.VALUE_ENTER:
|
|
11476
11475
|
if (dropList.isVisible() && dropList.hasFocusedItem()) {
|
|
11477
|
-
|
|
11478
|
-
suppressKeyPressRepeat = true;
|
|
11476
|
+
suppressEnterSpaceToggle = true;
|
|
11479
11477
|
evt.preventDefault();
|
|
11480
11478
|
dropList.triggerItemSelection(evt);
|
|
11481
11479
|
}
|
|
@@ -11496,39 +11494,21 @@ var SelectBox = /*#__PURE__*/function () {
|
|
|
11496
11494
|
break;
|
|
11497
11495
|
|
|
11498
11496
|
default:
|
|
11499
|
-
suppressKeyPressRepeat = true;
|
|
11500
11497
|
dropList._keydownFreeType(evt);
|
|
11501
11498
|
break;}
|
|
11502
11499
|
|
|
11503
11500
|
|
|
11504
|
-
|
|
11505
|
-
|
|
11506
|
-
|
|
11507
|
-
|
|
11508
|
-
|
|
11509
|
-
|
|
11510
|
-
|
|
11511
|
-
|
|
11512
|
-
|
|
11513
|
-
|
|
11514
|
-
|
|
11515
|
-
evt.preventDefault();
|
|
11516
|
-
return;
|
|
11517
|
-
}
|
|
11518
|
-
|
|
11519
|
-
if (suppressKeyPressRepeat)
|
|
11520
|
-
return;
|
|
11521
|
-
|
|
11522
|
-
if (evt.key === keycodeJs.VALUE_ENTER ||
|
|
11523
|
-
evt.key === keycodeJs.VALUE_SPACE &&
|
|
11524
|
-
p.lastKeyAllowsNonTypeKeys &&
|
|
11525
|
-
!p.multi &&
|
|
11526
|
-
!dropList.hasFocusedItem())
|
|
11527
|
-
|
|
11528
|
-
{
|
|
11529
|
-
_this6.toggleList();
|
|
11530
|
-
evt.preventDefault();
|
|
11531
|
-
evt.stopPropagation();
|
|
11501
|
+
if (!suppressEnterSpaceToggle) {
|
|
11502
|
+
if (evt.key === keycodeJs.VALUE_ENTER ||
|
|
11503
|
+
evt.key === keycodeJs.VALUE_SPACE &&
|
|
11504
|
+
p.lastKeyAllowsNonTypeKeys &&
|
|
11505
|
+
!p.multi &&
|
|
11506
|
+
!dropList.hasFocusedItem())
|
|
11507
|
+
{
|
|
11508
|
+
_this6.toggleList();
|
|
11509
|
+
evt.preventDefault();
|
|
11510
|
+
evt.stopPropagation();
|
|
11511
|
+
}
|
|
11532
11512
|
}
|
|
11533
11513
|
});
|
|
11534
11514
|
|