@danielgindi/selectbox 1.0.67 → 1.0.68
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 +60 -22
- 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 +28 -4
- 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 +60 -22
- 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 +27 -3
- package/package.json +1 -1
package/dist/lib.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @danielgindi/selectbox 1.0.
|
|
2
|
+
* @danielgindi/selectbox 1.0.68
|
|
3
3
|
* git://github.com/danielgindi/selectbox.git
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -8814,7 +8814,7 @@
|
|
|
8814
8814
|
var setToStringTag = setToStringTag$4;
|
|
8815
8815
|
var inheritIfRequired = inheritIfRequired$2;
|
|
8816
8816
|
|
|
8817
|
-
var collection$
|
|
8817
|
+
var collection$2 = function (CONSTRUCTOR_NAME, wrapper, common) {
|
|
8818
8818
|
var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;
|
|
8819
8819
|
var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;
|
|
8820
8820
|
var ADDER = IS_MAP ? 'set' : 'add';
|
|
@@ -8927,7 +8927,7 @@
|
|
|
8927
8927
|
var setInternalState = InternalStateModule.set;
|
|
8928
8928
|
var internalStateGetterFor = InternalStateModule.getterFor;
|
|
8929
8929
|
|
|
8930
|
-
var collectionStrong$
|
|
8930
|
+
var collectionStrong$2 = {
|
|
8931
8931
|
getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
|
|
8932
8932
|
var Constructor = wrapper(function (that, iterable) {
|
|
8933
8933
|
anInstance(that, Prototype);
|
|
@@ -9117,14 +9117,14 @@
|
|
|
9117
9117
|
};
|
|
9118
9118
|
|
|
9119
9119
|
'use strict';
|
|
9120
|
-
var collection = collection$
|
|
9121
|
-
var collectionStrong = collectionStrong$
|
|
9120
|
+
var collection$1 = collection$2;
|
|
9121
|
+
var collectionStrong$1 = collectionStrong$2;
|
|
9122
9122
|
|
|
9123
9123
|
// `Set` constructor
|
|
9124
9124
|
// https://tc39.es/ecma262/#sec-set-objects
|
|
9125
|
-
collection('Set', function (init) {
|
|
9125
|
+
collection$1('Set', function (init) {
|
|
9126
9126
|
return function Set() { return init(this, arguments.length ? arguments[0] : undefined); };
|
|
9127
|
-
}, collectionStrong);
|
|
9127
|
+
}, collectionStrong$1);
|
|
9128
9128
|
|
|
9129
9129
|
var web_domCollections_iterator = {};
|
|
9130
9130
|
|
|
@@ -9364,6 +9364,20 @@
|
|
|
9364
9364
|
}
|
|
9365
9365
|
});
|
|
9366
9366
|
|
|
9367
|
+
var es_map = {};
|
|
9368
|
+
|
|
9369
|
+
var es_map_constructor = {};
|
|
9370
|
+
|
|
9371
|
+
'use strict';
|
|
9372
|
+
var collection = collection$2;
|
|
9373
|
+
var collectionStrong = collectionStrong$2;
|
|
9374
|
+
|
|
9375
|
+
// `Map` constructor
|
|
9376
|
+
// https://tc39.es/ecma262/#sec-map-objects
|
|
9377
|
+
collection('Map', function (init) {
|
|
9378
|
+
return function Map() { return init(this, arguments.length ? arguments[0] : undefined); };
|
|
9379
|
+
}, collectionStrong);
|
|
9380
|
+
|
|
9367
9381
|
var es_array_findIndex = {};
|
|
9368
9382
|
|
|
9369
9383
|
'use strict';
|
|
@@ -9929,6 +9943,7 @@
|
|
|
9929
9943
|
}
|
|
9930
9944
|
|
|
9931
9945
|
this.setItems(o.items);
|
|
9946
|
+
delete o.items; // we do not need this in memory anymore
|
|
9932
9947
|
|
|
9933
9948
|
if (o.multi && Array.isArray(o.selectedValues)) {
|
|
9934
9949
|
this.setSelectedValues(o.selectedValues);
|
|
@@ -10080,6 +10095,8 @@
|
|
|
10080
10095
|
p.filteredItems = null;
|
|
10081
10096
|
p.itemsChanged = true;
|
|
10082
10097
|
|
|
10098
|
+
this._updateItemByValueMap();
|
|
10099
|
+
|
|
10083
10100
|
if (resetValues) {
|
|
10084
10101
|
this.setSelectedValues(this.getSelectedValues());
|
|
10085
10102
|
}
|
|
@@ -10109,9 +10126,9 @@
|
|
|
10109
10126
|
} }, { key: "updateItemByValue", value:
|
|
10110
10127
|
|
|
10111
10128
|
function updateItemByValue(value, newItem) {
|
|
10112
|
-
var p = this._p
|
|
10129
|
+
var p = this._p;
|
|
10113
10130
|
|
|
10114
|
-
var existingItem = p.
|
|
10131
|
+
var existingItem = p.itemByValueMap.get(value);
|
|
10115
10132
|
if (existingItem)
|
|
10116
10133
|
Object.assign(existingItem, newItem);
|
|
10117
10134
|
|
|
@@ -10633,11 +10650,17 @@
|
|
|
10633
10650
|
*/ }, { key: "setValueProp", value:
|
|
10634
10651
|
function setValueProp(prop) {
|
|
10635
10652
|
var p = this._p;
|
|
10653
|
+
|
|
10654
|
+
if (p.valueProp === prop)
|
|
10655
|
+
return this;
|
|
10656
|
+
|
|
10636
10657
|
p.valueProp = prop;
|
|
10637
10658
|
|
|
10638
10659
|
if (p.dropList)
|
|
10639
10660
|
p.dropList.setValueProp(prop);
|
|
10640
10661
|
|
|
10662
|
+
this._updateItemByValueMap();
|
|
10663
|
+
|
|
10641
10664
|
return this;
|
|
10642
10665
|
}
|
|
10643
10666
|
|
|
@@ -10782,19 +10805,19 @@
|
|
|
10782
10805
|
var selectedValues = [];
|
|
10783
10806
|
var selectedItems = [];var _iterator2 = _createForOfIteratorHelper(
|
|
10784
10807
|
|
|
10785
|
-
values),_step2;try {
|
|
10808
|
+
values),_step2;try {for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {var value = _step2.value;
|
|
10786
10809
|
if (set.has(value))
|
|
10787
|
-
|
|
10810
|
+
continue;
|
|
10788
10811
|
set.add(value);
|
|
10789
10812
|
|
|
10790
10813
|
selectedValues.push(value);
|
|
10791
10814
|
|
|
10792
|
-
var item = p.
|
|
10815
|
+
var item = p.itemByValueMap.get(value);
|
|
10793
10816
|
if (item !== undefined) {
|
|
10794
10817
|
selectedItems.push(item);
|
|
10795
10818
|
} else {
|
|
10796
10819
|
selectedItems.push(_defineProperty({}, p.valueProp, value));
|
|
10797
|
-
}
|
|
10820
|
+
}
|
|
10798
10821
|
}} catch (err) {_iterator2.e(err);} finally {_iterator2.f();}
|
|
10799
10822
|
|
|
10800
10823
|
p.selectedValues = selectedValues;
|
|
@@ -11010,6 +11033,21 @@
|
|
|
11010
11033
|
return this;
|
|
11011
11034
|
}
|
|
11012
11035
|
|
|
11036
|
+
/**
|
|
11037
|
+
* Prepare the mapping between values and items.
|
|
11038
|
+
* This reduces search time greatly (i.e when checking items), especially when Vue proxies are in place.
|
|
11039
|
+
* @private
|
|
11040
|
+
*/ }, { key: "_updateItemByValueMap", value:
|
|
11041
|
+
function _updateItemByValueMap() {
|
|
11042
|
+
var p = this._p;
|
|
11043
|
+
|
|
11044
|
+
var itemByValueMap = p.itemByValueMap = new Map();
|
|
11045
|
+
var valueProp = p.valueProp;var _iterator3 = _createForOfIteratorHelper(
|
|
11046
|
+
p.items),_step3;try {for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {var item = _step3.value;
|
|
11047
|
+
itemByValueMap.set(item[valueProp], item);
|
|
11048
|
+
}} catch (err) {_iterator3.e(err);} finally {_iterator3.f();}
|
|
11049
|
+
}
|
|
11050
|
+
|
|
11013
11051
|
/** @private */ }, { key: "_renderBase", value:
|
|
11014
11052
|
function _renderBase() {var _this4 = this;
|
|
11015
11053
|
var p = this._p;
|
|
@@ -11920,9 +11958,9 @@
|
|
|
11920
11958
|
var p = this._p;
|
|
11921
11959
|
|
|
11922
11960
|
if (this[DestroyedSymbol])
|
|
11923
|
-
return;var
|
|
11961
|
+
return;var _iterator4 = _createForOfIteratorHelper(
|
|
11924
11962
|
|
|
11925
|
-
queue),
|
|
11963
|
+
queue),_step4;try {for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {var op = _step4.value;
|
|
11926
11964
|
switch (op.mode) {
|
|
11927
11965
|
case 'full':
|
|
11928
11966
|
this._syncFull(true);
|
|
@@ -11987,7 +12025,7 @@
|
|
|
11987
12025
|
this._syncFull(false);
|
|
11988
12026
|
break;}
|
|
11989
12027
|
|
|
11990
|
-
}} catch (err) {
|
|
12028
|
+
}} catch (err) {_iterator4.e(err);} finally {_iterator4.f();}
|
|
11991
12029
|
} }, { key: "_cleanupSingleWrapper", value:
|
|
11992
12030
|
|
|
11993
12031
|
function _cleanupSingleWrapper() {
|
|
@@ -12362,19 +12400,19 @@
|
|
|
12362
12400
|
if (value === RestMultiItemsSymbol) {
|
|
12363
12401
|
var items = (p.treatGroupSelectionAsItems ? p.selectedItems : p.selectedItems.filter(function (x) {return !x._group;})).
|
|
12364
12402
|
slice(p.maxMultiItems);
|
|
12365
|
-
var itemsToRemove = [];var
|
|
12403
|
+
var itemsToRemove = [];var _iterator5 = _createForOfIteratorHelper(
|
|
12366
12404
|
|
|
12367
|
-
items),
|
|
12405
|
+
items),_step5;try {for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {var _item3 = _step5.value;
|
|
12368
12406
|
var removeselEvt = { value: value, item: _item3, cancel: false };
|
|
12369
12407
|
this._trigger('removesel:before', removeselEvt);
|
|
12370
12408
|
if (!removeselEvt.cancel)
|
|
12371
12409
|
itemsToRemove.push(_item3);
|
|
12372
|
-
}} catch (err) {
|
|
12410
|
+
}} catch (err) {_iterator5.e(err);} finally {_iterator5.f();}
|
|
12373
12411
|
|
|
12374
12412
|
if (itemsToRemove.length > 0) {
|
|
12375
|
-
this._removeMultiItemElementByIndex(p.multiItemEls.length - 1);var
|
|
12413
|
+
this._removeMultiItemElementByIndex(p.multiItemEls.length - 1);var _iterator6 = _createForOfIteratorHelper(
|
|
12376
12414
|
|
|
12377
|
-
itemsToRemove),
|
|
12415
|
+
itemsToRemove),_step6;try {for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {var _item2 = _step6.value;
|
|
12378
12416
|
// sync selection
|
|
12379
12417
|
var idx = p.selectedItems.indexOf(_item2);
|
|
12380
12418
|
if (idx === -1)
|
|
@@ -12385,7 +12423,7 @@
|
|
|
12385
12423
|
p.selectionChanged = true;
|
|
12386
12424
|
p.resortBySelectionNeeded = true;
|
|
12387
12425
|
}
|
|
12388
|
-
}} catch (err) {
|
|
12426
|
+
}} catch (err) {_iterator6.e(err);} finally {_iterator6.f();}
|
|
12389
12427
|
}
|
|
12390
12428
|
|
|
12391
12429
|
if (items.length > itemsToRemove.length) {
|