@danielgindi/selectbox 1.0.138 → 1.0.139
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 +31 -17
- 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 +33 -19
- 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 +31 -17
- 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 +7 -6
- package/lib/SelectBox.js +25 -12
- package/package.json +1 -1
package/lib/DropList.js
CHANGED
|
@@ -1578,7 +1578,7 @@ class DropList {
|
|
|
1578
1578
|
let itemPos, previousPos = -1;
|
|
1579
1579
|
let maxIterations = 30; // Some zoom/scroll issues can make it so that it takes almost forever
|
|
1580
1580
|
|
|
1581
|
-
|
|
1581
|
+
|
|
1582
1582
|
while (maxIterations-- > 0) {
|
|
1583
1583
|
itemPos = p.virtualListHelper.getItemPosition(itemIndex);
|
|
1584
1584
|
|
|
@@ -1820,11 +1820,12 @@ class DropList {
|
|
|
1820
1820
|
setTimeout(() => {
|
|
1821
1821
|
if (this[DestroyedSymbol]) return;
|
|
1822
1822
|
|
|
1823
|
-
if (
|
|
1824
|
-
|
|
1825
|
-
this._delayBlurItemOnBlur();
|
|
1826
|
-
this._trigger('blur', event);
|
|
1823
|
+
if (document.activeElement && this.elContains(document.activeElement, true)) {
|
|
1824
|
+
return;
|
|
1827
1825
|
}
|
|
1826
|
+
|
|
1827
|
+
this._delayBlurItemOnBlur();
|
|
1828
|
+
this._trigger('blur', event);
|
|
1828
1829
|
});
|
|
1829
1830
|
});
|
|
1830
1831
|
}
|
|
@@ -2116,7 +2117,7 @@ class DropList {
|
|
|
2116
2117
|
let base = getElementOffset(p.focusItemEl).top;
|
|
2117
2118
|
let height = getElementHeight(p.el, true);
|
|
2118
2119
|
|
|
2119
|
-
while (true) {
|
|
2120
|
+
while (true) {
|
|
2120
2121
|
next = p.focusItemEl.nextElementSibling;
|
|
2121
2122
|
if (!next) return;
|
|
2122
2123
|
if (next.tagName !== 'LI') continue;
|
package/lib/SelectBox.js
CHANGED
|
@@ -1970,6 +1970,9 @@ class SelectBox {
|
|
|
1970
1970
|
}
|
|
1971
1971
|
}
|
|
1972
1972
|
break;
|
|
1973
|
+
|
|
1974
|
+
case 'blur':
|
|
1975
|
+
this._handleOnBlur();
|
|
1973
1976
|
}
|
|
1974
1977
|
},
|
|
1975
1978
|
});
|
|
@@ -1984,6 +1987,27 @@ class SelectBox {
|
|
|
1984
1987
|
this._registerDropdownEvents();
|
|
1985
1988
|
}
|
|
1986
1989
|
|
|
1990
|
+
_handleOnBlur() {
|
|
1991
|
+
const p = this._p;
|
|
1992
|
+
|
|
1993
|
+
setTimeout(() => {
|
|
1994
|
+
if (p.disabled) return;
|
|
1995
|
+
|
|
1996
|
+
this._trigger('search:blur');
|
|
1997
|
+
|
|
1998
|
+
if (this[DestroyedSymbol]) return; // destroyed by event handler
|
|
1999
|
+
|
|
2000
|
+
if (document.activeElement &&
|
|
2001
|
+
(p.input && p.input.contains(document.activeElement) ||
|
|
2002
|
+
p.dropList && this.droplistElContains(document.activeElement, true))) {
|
|
2003
|
+
return;
|
|
2004
|
+
}
|
|
2005
|
+
if (p.throttledUpdateListItems)
|
|
2006
|
+
p.throttledUpdateListItems.cancel();
|
|
2007
|
+
this.closeList();
|
|
2008
|
+
});
|
|
2009
|
+
}
|
|
2010
|
+
|
|
1987
2011
|
_unregisterDropdownEvents() {
|
|
1988
2012
|
const p = this._p;
|
|
1989
2013
|
|
|
@@ -2153,18 +2177,7 @@ class SelectBox {
|
|
|
2153
2177
|
avoidToggleFromClick = true;
|
|
2154
2178
|
setTimeout(() => { avoidToggleFromClick = false; }, 10);
|
|
2155
2179
|
})
|
|
2156
|
-
.add(p.input, 'blur.dropdown', () =>
|
|
2157
|
-
if (p.disabled) return;
|
|
2158
|
-
|
|
2159
|
-
this._trigger('search:blur');
|
|
2160
|
-
|
|
2161
|
-
if (this[DestroyedSymbol]) return; // destroyed by event handler
|
|
2162
|
-
|
|
2163
|
-
if (p.throttledUpdateListItems)
|
|
2164
|
-
p.throttledUpdateListItems.cancel();
|
|
2165
|
-
|
|
2166
|
-
this.closeList();
|
|
2167
|
-
});
|
|
2180
|
+
.add(p.input, 'blur.dropdown', () => this._handleOnBlur());
|
|
2168
2181
|
}
|
|
2169
2182
|
|
|
2170
2183
|
p.sink
|
package/package.json
CHANGED