@danielgindi/selectbox 2.0.10 → 2.0.12
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 +6750 -230
- 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 +32 -1
- 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 +11910 -5390
- 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 +31 -0
- package/package.json +16 -16
- package/vue/SelectBox.vue +774 -774
package/dist/lib.es6.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @danielgindi/selectbox 2.0.
|
|
2
|
+
* @danielgindi/selectbox 2.0.12
|
|
3
3
|
* git://github.com/danielgindi/selectbox.git
|
|
4
4
|
*/
|
|
5
5
|
import { createElement, closestUntil, setElementAttrs, next, prev } from '@danielgindi/dom-utils/lib/Dom';
|
|
@@ -3414,6 +3414,7 @@ const inputBackbufferCssProps = [
|
|
|
3414
3414
|
* @property {function(item: DropList.ItemBase, itemEl: Element)} [unrenderNoResultsItem]
|
|
3415
3415
|
* @property {boolean} [searchable=false] is it searchable?
|
|
3416
3416
|
* @property {string} [noResultsText='No matching results'] text for no results (empty for none)
|
|
3417
|
+
* @property {boolean} [autoSelectTextOnCheck=true] automatically select text in input when an item is checked (multi mode). Used to allow the user to quickly type multiple items.
|
|
3417
3418
|
* @property {number} [filterThrottleWindow=300] throttle time (milliseconds) for filtering
|
|
3418
3419
|
* @property {boolean} [filterOnEmptyTerm=false] call the filter function on empty search term too
|
|
3419
3420
|
* @property {function(items: DropList.ItemBase[], term: string):(DropList.ItemBase[]|null)} [filterFn]
|
|
@@ -3441,6 +3442,7 @@ const defaultOptions = {
|
|
|
3441
3442
|
multiPlaceholderFormatter: null,
|
|
3442
3443
|
searchable: true,
|
|
3443
3444
|
noResultsText: 'No matching results',
|
|
3445
|
+
autoSelectTextOnCheck: true,
|
|
3444
3446
|
filterThrottleWindow: 300,
|
|
3445
3447
|
filterOnEmptyTerm: false,
|
|
3446
3448
|
labelProp: 'label',
|
|
@@ -3535,6 +3537,7 @@ class SelectBox {
|
|
|
3535
3537
|
multiPlaceholderFormatter: o.multiPlaceholderFormatter,
|
|
3536
3538
|
searchable: o.searchable,
|
|
3537
3539
|
noResultsText: o.noResultsText,
|
|
3540
|
+
autoSelectTextOnCheck: o.autoSelectTextOnCheck,
|
|
3538
3541
|
|
|
3539
3542
|
labelProp: o.labelProp,
|
|
3540
3543
|
valueProp: o.valueProp,
|
|
@@ -4309,6 +4312,22 @@ class SelectBox {
|
|
|
4309
4312
|
return this._p.noResultsText;
|
|
4310
4313
|
}
|
|
4311
4314
|
|
|
4315
|
+
/**
|
|
4316
|
+
* @param {boolean} autoSelectTextOnCheck
|
|
4317
|
+
* @returns {SelectBox}
|
|
4318
|
+
*/
|
|
4319
|
+
setAutoSelectTextOnCheck(autoSelectTextOnCheck) {
|
|
4320
|
+
this._p.autoSelectTextOnCheck = autoSelectTextOnCheck;
|
|
4321
|
+
return this;
|
|
4322
|
+
}
|
|
4323
|
+
|
|
4324
|
+
/**
|
|
4325
|
+
* @returns {boolean}
|
|
4326
|
+
*/
|
|
4327
|
+
getAutoSelectTextOnCheck() {
|
|
4328
|
+
return this._p.autoSelectTextOnCheck;
|
|
4329
|
+
}
|
|
4330
|
+
|
|
4312
4331
|
/**
|
|
4313
4332
|
* @param {number} window
|
|
4314
4333
|
* @returns {SelectBox}
|
|
@@ -4686,6 +4705,8 @@ class SelectBox {
|
|
|
4686
4705
|
|
|
4687
4706
|
if (p.dropList.hasFocusedItem()) {
|
|
4688
4707
|
p.dropList.setFocusedItemAtIndex(p.dropList.getFocusedItemIndex());
|
|
4708
|
+
} else if (!p.multi && this.getValue() !== undefined) {
|
|
4709
|
+
p.dropList.setFocusedItemByValue(this.getValue());
|
|
4689
4710
|
}
|
|
4690
4711
|
|
|
4691
4712
|
return this;
|
|
@@ -5159,6 +5180,11 @@ class SelectBox {
|
|
|
5159
5180
|
case 'check': {
|
|
5160
5181
|
if (!p.multi) return;
|
|
5161
5182
|
|
|
5183
|
+
if (p.autoSelectTextOnCheck && p.input && document.activeElement === p.input) {
|
|
5184
|
+
// Select the text in the input, without causing any focus changes
|
|
5185
|
+
p.input.setSelectionRange(0, p.input.value.length);
|
|
5186
|
+
}
|
|
5187
|
+
|
|
5162
5188
|
const item = /**@type DropList.Item*/event.item;
|
|
5163
5189
|
const value = event.value;
|
|
5164
5190
|
|
|
@@ -5239,6 +5265,11 @@ class SelectBox {
|
|
|
5239
5265
|
case 'groupcheck': {
|
|
5240
5266
|
if (!p.multi) return;
|
|
5241
5267
|
|
|
5268
|
+
if (p.autoSelectTextOnCheck && p.input && document.activeElement === p.input) {
|
|
5269
|
+
// Select the text in the input, without causing any focus changes
|
|
5270
|
+
p.input.setSelectionRange(0, p.input.value.length);
|
|
5271
|
+
}
|
|
5272
|
+
|
|
5242
5273
|
if (event.affectedCount) {
|
|
5243
5274
|
this._scheduleSync(p.sortSelectedItems ? 'full' : 'render_base');
|
|
5244
5275
|
}
|