@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.cjs.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
|
'use strict';
|
|
@@ -8820,7 +8820,7 @@ var checkCorrectnessOfIteration = checkCorrectnessOfIteration$2;
|
|
|
8820
8820
|
var setToStringTag = setToStringTag$4;
|
|
8821
8821
|
var inheritIfRequired = inheritIfRequired$2;
|
|
8822
8822
|
|
|
8823
|
-
var collection$
|
|
8823
|
+
var collection$2 = function (CONSTRUCTOR_NAME, wrapper, common) {
|
|
8824
8824
|
var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;
|
|
8825
8825
|
var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;
|
|
8826
8826
|
var ADDER = IS_MAP ? 'set' : 'add';
|
|
@@ -8933,7 +8933,7 @@ var InternalStateModule = internalState;
|
|
|
8933
8933
|
var setInternalState = InternalStateModule.set;
|
|
8934
8934
|
var internalStateGetterFor = InternalStateModule.getterFor;
|
|
8935
8935
|
|
|
8936
|
-
var collectionStrong$
|
|
8936
|
+
var collectionStrong$2 = {
|
|
8937
8937
|
getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
|
|
8938
8938
|
var Constructor = wrapper(function (that, iterable) {
|
|
8939
8939
|
anInstance(that, Prototype);
|
|
@@ -9123,14 +9123,14 @@ var collectionStrong$1 = {
|
|
|
9123
9123
|
};
|
|
9124
9124
|
|
|
9125
9125
|
'use strict';
|
|
9126
|
-
var collection = collection$
|
|
9127
|
-
var collectionStrong = collectionStrong$
|
|
9126
|
+
var collection$1 = collection$2;
|
|
9127
|
+
var collectionStrong$1 = collectionStrong$2;
|
|
9128
9128
|
|
|
9129
9129
|
// `Set` constructor
|
|
9130
9130
|
// https://tc39.es/ecma262/#sec-set-objects
|
|
9131
|
-
collection('Set', function (init) {
|
|
9131
|
+
collection$1('Set', function (init) {
|
|
9132
9132
|
return function Set() { return init(this, arguments.length ? arguments[0] : undefined); };
|
|
9133
|
-
}, collectionStrong);
|
|
9133
|
+
}, collectionStrong$1);
|
|
9134
9134
|
|
|
9135
9135
|
var web_domCollections_iterator = {};
|
|
9136
9136
|
|
|
@@ -9370,6 +9370,20 @@ $$2({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
|
|
|
9370
9370
|
}
|
|
9371
9371
|
});
|
|
9372
9372
|
|
|
9373
|
+
var es_map = {};
|
|
9374
|
+
|
|
9375
|
+
var es_map_constructor = {};
|
|
9376
|
+
|
|
9377
|
+
'use strict';
|
|
9378
|
+
var collection = collection$2;
|
|
9379
|
+
var collectionStrong = collectionStrong$2;
|
|
9380
|
+
|
|
9381
|
+
// `Map` constructor
|
|
9382
|
+
// https://tc39.es/ecma262/#sec-map-objects
|
|
9383
|
+
collection('Map', function (init) {
|
|
9384
|
+
return function Map() { return init(this, arguments.length ? arguments[0] : undefined); };
|
|
9385
|
+
}, collectionStrong);
|
|
9386
|
+
|
|
9373
9387
|
var es_array_findIndex = {};
|
|
9374
9388
|
|
|
9375
9389
|
'use strict';
|
|
@@ -9935,6 +9949,7 @@ var SelectBox = /*#__PURE__*/function () {
|
|
|
9935
9949
|
}
|
|
9936
9950
|
|
|
9937
9951
|
this.setItems(o.items);
|
|
9952
|
+
delete o.items; // we do not need this in memory anymore
|
|
9938
9953
|
|
|
9939
9954
|
if (o.multi && Array.isArray(o.selectedValues)) {
|
|
9940
9955
|
this.setSelectedValues(o.selectedValues);
|
|
@@ -10086,6 +10101,8 @@ var SelectBox = /*#__PURE__*/function () {
|
|
|
10086
10101
|
p.filteredItems = null;
|
|
10087
10102
|
p.itemsChanged = true;
|
|
10088
10103
|
|
|
10104
|
+
this._updateItemByValueMap();
|
|
10105
|
+
|
|
10089
10106
|
if (resetValues) {
|
|
10090
10107
|
this.setSelectedValues(this.getSelectedValues());
|
|
10091
10108
|
}
|
|
@@ -10115,9 +10132,9 @@ var SelectBox = /*#__PURE__*/function () {
|
|
|
10115
10132
|
} }, { key: "updateItemByValue", value:
|
|
10116
10133
|
|
|
10117
10134
|
function updateItemByValue(value, newItem) {
|
|
10118
|
-
var p = this._p
|
|
10135
|
+
var p = this._p;
|
|
10119
10136
|
|
|
10120
|
-
var existingItem = p.
|
|
10137
|
+
var existingItem = p.itemByValueMap.get(value);
|
|
10121
10138
|
if (existingItem)
|
|
10122
10139
|
Object.assign(existingItem, newItem);
|
|
10123
10140
|
|
|
@@ -10639,11 +10656,17 @@ var SelectBox = /*#__PURE__*/function () {
|
|
|
10639
10656
|
*/ }, { key: "setValueProp", value:
|
|
10640
10657
|
function setValueProp(prop) {
|
|
10641
10658
|
var p = this._p;
|
|
10659
|
+
|
|
10660
|
+
if (p.valueProp === prop)
|
|
10661
|
+
return this;
|
|
10662
|
+
|
|
10642
10663
|
p.valueProp = prop;
|
|
10643
10664
|
|
|
10644
10665
|
if (p.dropList)
|
|
10645
10666
|
p.dropList.setValueProp(prop);
|
|
10646
10667
|
|
|
10668
|
+
this._updateItemByValueMap();
|
|
10669
|
+
|
|
10647
10670
|
return this;
|
|
10648
10671
|
}
|
|
10649
10672
|
|
|
@@ -10788,19 +10811,19 @@ var SelectBox = /*#__PURE__*/function () {
|
|
|
10788
10811
|
var selectedValues = [];
|
|
10789
10812
|
var selectedItems = [];var _iterator2 = _createForOfIteratorHelper(
|
|
10790
10813
|
|
|
10791
|
-
values),_step2;try {
|
|
10814
|
+
values),_step2;try {for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {var value = _step2.value;
|
|
10792
10815
|
if (set.has(value))
|
|
10793
|
-
|
|
10816
|
+
continue;
|
|
10794
10817
|
set.add(value);
|
|
10795
10818
|
|
|
10796
10819
|
selectedValues.push(value);
|
|
10797
10820
|
|
|
10798
|
-
var item = p.
|
|
10821
|
+
var item = p.itemByValueMap.get(value);
|
|
10799
10822
|
if (item !== undefined) {
|
|
10800
10823
|
selectedItems.push(item);
|
|
10801
10824
|
} else {
|
|
10802
10825
|
selectedItems.push(_defineProperty({}, p.valueProp, value));
|
|
10803
|
-
}
|
|
10826
|
+
}
|
|
10804
10827
|
}} catch (err) {_iterator2.e(err);} finally {_iterator2.f();}
|
|
10805
10828
|
|
|
10806
10829
|
p.selectedValues = selectedValues;
|
|
@@ -11016,6 +11039,21 @@ var SelectBox = /*#__PURE__*/function () {
|
|
|
11016
11039
|
return this;
|
|
11017
11040
|
}
|
|
11018
11041
|
|
|
11042
|
+
/**
|
|
11043
|
+
* Prepare the mapping between values and items.
|
|
11044
|
+
* This reduces search time greatly (i.e when checking items), especially when Vue proxies are in place.
|
|
11045
|
+
* @private
|
|
11046
|
+
*/ }, { key: "_updateItemByValueMap", value:
|
|
11047
|
+
function _updateItemByValueMap() {
|
|
11048
|
+
var p = this._p;
|
|
11049
|
+
|
|
11050
|
+
var itemByValueMap = p.itemByValueMap = new Map();
|
|
11051
|
+
var valueProp = p.valueProp;var _iterator3 = _createForOfIteratorHelper(
|
|
11052
|
+
p.items),_step3;try {for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {var item = _step3.value;
|
|
11053
|
+
itemByValueMap.set(item[valueProp], item);
|
|
11054
|
+
}} catch (err) {_iterator3.e(err);} finally {_iterator3.f();}
|
|
11055
|
+
}
|
|
11056
|
+
|
|
11019
11057
|
/** @private */ }, { key: "_renderBase", value:
|
|
11020
11058
|
function _renderBase() {var _this4 = this;
|
|
11021
11059
|
var p = this._p;
|
|
@@ -11926,9 +11964,9 @@ var SelectBox = /*#__PURE__*/function () {
|
|
|
11926
11964
|
var p = this._p;
|
|
11927
11965
|
|
|
11928
11966
|
if (this[DestroyedSymbol])
|
|
11929
|
-
return;var
|
|
11967
|
+
return;var _iterator4 = _createForOfIteratorHelper(
|
|
11930
11968
|
|
|
11931
|
-
queue),
|
|
11969
|
+
queue),_step4;try {for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {var op = _step4.value;
|
|
11932
11970
|
switch (op.mode) {
|
|
11933
11971
|
case 'full':
|
|
11934
11972
|
this._syncFull(true);
|
|
@@ -11993,7 +12031,7 @@ var SelectBox = /*#__PURE__*/function () {
|
|
|
11993
12031
|
this._syncFull(false);
|
|
11994
12032
|
break;}
|
|
11995
12033
|
|
|
11996
|
-
}} catch (err) {
|
|
12034
|
+
}} catch (err) {_iterator4.e(err);} finally {_iterator4.f();}
|
|
11997
12035
|
} }, { key: "_cleanupSingleWrapper", value:
|
|
11998
12036
|
|
|
11999
12037
|
function _cleanupSingleWrapper() {
|
|
@@ -12368,19 +12406,19 @@ var SelectBox = /*#__PURE__*/function () {
|
|
|
12368
12406
|
if (value === RestMultiItemsSymbol) {
|
|
12369
12407
|
var items = (p.treatGroupSelectionAsItems ? p.selectedItems : p.selectedItems.filter(function (x) {return !x._group;})).
|
|
12370
12408
|
slice(p.maxMultiItems);
|
|
12371
|
-
var itemsToRemove = [];var
|
|
12409
|
+
var itemsToRemove = [];var _iterator5 = _createForOfIteratorHelper(
|
|
12372
12410
|
|
|
12373
|
-
items),
|
|
12411
|
+
items),_step5;try {for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {var _item3 = _step5.value;
|
|
12374
12412
|
var removeselEvt = { value: value, item: _item3, cancel: false };
|
|
12375
12413
|
this._trigger('removesel:before', removeselEvt);
|
|
12376
12414
|
if (!removeselEvt.cancel)
|
|
12377
12415
|
itemsToRemove.push(_item3);
|
|
12378
|
-
}} catch (err) {
|
|
12416
|
+
}} catch (err) {_iterator5.e(err);} finally {_iterator5.f();}
|
|
12379
12417
|
|
|
12380
12418
|
if (itemsToRemove.length > 0) {
|
|
12381
|
-
this._removeMultiItemElementByIndex(p.multiItemEls.length - 1);var
|
|
12419
|
+
this._removeMultiItemElementByIndex(p.multiItemEls.length - 1);var _iterator6 = _createForOfIteratorHelper(
|
|
12382
12420
|
|
|
12383
|
-
itemsToRemove),
|
|
12421
|
+
itemsToRemove),_step6;try {for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {var _item2 = _step6.value;
|
|
12384
12422
|
// sync selection
|
|
12385
12423
|
var idx = p.selectedItems.indexOf(_item2);
|
|
12386
12424
|
if (idx === -1)
|
|
@@ -12391,7 +12429,7 @@ var SelectBox = /*#__PURE__*/function () {
|
|
|
12391
12429
|
p.selectionChanged = true;
|
|
12392
12430
|
p.resortBySelectionNeeded = true;
|
|
12393
12431
|
}
|
|
12394
|
-
}} catch (err) {
|
|
12432
|
+
}} catch (err) {_iterator6.e(err);} finally {_iterator6.f();}
|
|
12395
12433
|
}
|
|
12396
12434
|
|
|
12397
12435
|
if (items.length > itemsToRemove.length) {
|