@syncfusion/ej2-dropdowns 34.2.4 → 34.2.6
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/README.md +11 -0
- package/dist/ej2-dropdowns.min.js +2 -2
- package/dist/ej2-dropdowns.umd.min.js +2 -2
- package/dist/ej2-dropdowns.umd.min.js.map +1 -1
- package/dist/es6/ej2-dropdowns.es2015.js +280 -65
- package/dist/es6/ej2-dropdowns.es2015.js.map +1 -1
- package/dist/es6/ej2-dropdowns.es5.js +279 -68
- package/dist/es6/ej2-dropdowns.es5.js.map +1 -1
- package/dist/global/ej2-dropdowns.min.js +2 -2
- package/dist/global/ej2-dropdowns.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +8 -8
- package/src/drop-down-list/drop-down-list.js +1 -0
- package/src/drop-down-tree/drop-down-tree.d.ts +2 -2
- package/src/drop-down-tree/drop-down-tree.js +169 -66
- package/src/mention/mention.js +1 -1
- package/src/multi-select/multi-select.d.ts +1 -0
- package/src/multi-select/multi-select.js +108 -1
- package/.eslintrc.json +0 -263
- package/aceconfig.js +0 -17
- package/tslint.json +0 -111
|
@@ -3885,6 +3885,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
|
|
|
3885
3885
|
this.bindClearEvent();
|
|
3886
3886
|
};
|
|
3887
3887
|
DropDownList.prototype.windowResize = function () {
|
|
3888
|
+
this.updateFloatLabelOverflowWidth();
|
|
3888
3889
|
if (this.isPopupOpen) {
|
|
3889
3890
|
this.popupObj.refreshPosition(this.inputWrapper.container);
|
|
3890
3891
|
}
|
|
@@ -8316,6 +8317,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
8316
8317
|
_this.isNodeChecked = false;
|
|
8317
8318
|
_this.isFromFilterChange = false;
|
|
8318
8319
|
_this.fallbackValue = [];
|
|
8320
|
+
_this.uncheckedNodeId = null;
|
|
8319
8321
|
return _this;
|
|
8320
8322
|
}
|
|
8321
8323
|
/**
|
|
@@ -9800,8 +9802,129 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
9800
9802
|
checkOnClick: true
|
|
9801
9803
|
});
|
|
9802
9804
|
this.treeObj.root = this.root ? this.root : this;
|
|
9805
|
+
this.treeObj.filterIndeterminateNodes = [];
|
|
9806
|
+
this.treeObj.filterCheckedNodes = [];
|
|
9803
9807
|
this.treeObj.appendTo(this.tree);
|
|
9804
9808
|
};
|
|
9809
|
+
DropDownTree.prototype.updateIndeterminateNodes = function () {
|
|
9810
|
+
if (!(this.allowFiltering && this.treeSettings.autoCheck) || (this.isRemoteData || this.treeSettings.loadOnDemand)) {
|
|
9811
|
+
return;
|
|
9812
|
+
}
|
|
9813
|
+
var checkedNodes = Array.isArray(this.value) ? this.value.slice() : [];
|
|
9814
|
+
var checkedSet = {};
|
|
9815
|
+
for (var i = 0; i < checkedNodes.length; i++) {
|
|
9816
|
+
checkedSet[checkedNodes[i]] = true;
|
|
9817
|
+
}
|
|
9818
|
+
var treeData = this.treeObj.element.classList.contains('e-filtering') ? this.treeData : this.treeItems;
|
|
9819
|
+
var valueField = this.fields.value;
|
|
9820
|
+
var parentValueField = this.fields.parentValue;
|
|
9821
|
+
var hasChildrenField = this.fields.hasChildren;
|
|
9822
|
+
var childField = this.fields.child;
|
|
9823
|
+
var indeterminateNodes = [];
|
|
9824
|
+
var childrenMap = {};
|
|
9825
|
+
for (var i = 0; i < treeData.length; i++) {
|
|
9826
|
+
var node = treeData[i];
|
|
9827
|
+
var nodeId = getValue(valueField, node);
|
|
9828
|
+
var nodePid = getValue(parentValueField, node);
|
|
9829
|
+
if (isNullOrUndefined(node) || isNullOrUndefined(nodeId) || isNullOrUndefined(nodePid)) {
|
|
9830
|
+
continue;
|
|
9831
|
+
}
|
|
9832
|
+
var parentId = nodePid.toString();
|
|
9833
|
+
if (!childrenMap[parentId]) {
|
|
9834
|
+
childrenMap[parentId] = [];
|
|
9835
|
+
}
|
|
9836
|
+
childrenMap[parentId].push(nodeId.toString());
|
|
9837
|
+
}
|
|
9838
|
+
var allNodes = treeData.slice();
|
|
9839
|
+
if (!isNullOrUndefined(childField)) {
|
|
9840
|
+
var collectNestedChildren_1 = function (nodes, fields) {
|
|
9841
|
+
if (!nodes) {
|
|
9842
|
+
return;
|
|
9843
|
+
}
|
|
9844
|
+
for (var i = 0; i < nodes.length; i++) {
|
|
9845
|
+
var node = nodes[i];
|
|
9846
|
+
if (isNullOrUndefined(node)) {
|
|
9847
|
+
continue;
|
|
9848
|
+
}
|
|
9849
|
+
var nodeId = getValue(fields.value, node);
|
|
9850
|
+
if (isNullOrUndefined(nodeId)) {
|
|
9851
|
+
continue;
|
|
9852
|
+
}
|
|
9853
|
+
allNodes.push(node);
|
|
9854
|
+
var childMapper = fields.child;
|
|
9855
|
+
var childrenArr = void 0;
|
|
9856
|
+
if (typeof childMapper === 'string') {
|
|
9857
|
+
childrenArr = node[childMapper];
|
|
9858
|
+
}
|
|
9859
|
+
else if (!isNullOrUndefined(childMapper)) {
|
|
9860
|
+
childrenArr = node[childMapper.value];
|
|
9861
|
+
}
|
|
9862
|
+
else {
|
|
9863
|
+
childrenArr = null;
|
|
9864
|
+
}
|
|
9865
|
+
if (!isNullOrUndefined(childrenArr) && Array.isArray(childrenArr) && childrenArr.length) {
|
|
9866
|
+
var parentId = nodeId.toString();
|
|
9867
|
+
if (!childrenMap[parentId]) {
|
|
9868
|
+
childrenMap[parentId] = [];
|
|
9869
|
+
}
|
|
9870
|
+
for (var k = 0; k < childrenArr.length; k++) {
|
|
9871
|
+
var childId = getValue(fields.value, childrenArr[k]);
|
|
9872
|
+
if (!isNullOrUndefined(childId) && childrenMap[parentId].indexOf(childId.toString()) === -1) {
|
|
9873
|
+
childrenMap[parentId].push(childId.toString());
|
|
9874
|
+
}
|
|
9875
|
+
}
|
|
9876
|
+
var nextFields = (typeof childMapper !== 'string' && !isNullOrUndefined(childMapper)) ?
|
|
9877
|
+
childMapper : fields;
|
|
9878
|
+
collectNestedChildren_1(childrenArr, nextFields);
|
|
9879
|
+
}
|
|
9880
|
+
}
|
|
9881
|
+
};
|
|
9882
|
+
collectNestedChildren_1(treeData, this.fields);
|
|
9883
|
+
}
|
|
9884
|
+
for (var i = 0; i < allNodes.length; i++) {
|
|
9885
|
+
var node = allNodes[i];
|
|
9886
|
+
var nodeId = getValue(valueField, node);
|
|
9887
|
+
if (isNullOrUndefined(node) || isNullOrUndefined(nodeId)) {
|
|
9888
|
+
continue;
|
|
9889
|
+
}
|
|
9890
|
+
var nodeIdStr = nodeId.toString();
|
|
9891
|
+
if (hasChildrenField && getValue(hasChildrenField, node) === false) {
|
|
9892
|
+
continue;
|
|
9893
|
+
}
|
|
9894
|
+
if (checkedSet[nodeIdStr]) {
|
|
9895
|
+
continue;
|
|
9896
|
+
}
|
|
9897
|
+
var descendants = [];
|
|
9898
|
+
var queue = childrenMap[nodeIdStr] ? childrenMap[nodeIdStr].slice() : [];
|
|
9899
|
+
var head = 0;
|
|
9900
|
+
while (head < queue.length) {
|
|
9901
|
+
var current = queue[head];
|
|
9902
|
+
head++;
|
|
9903
|
+
descendants.push(current);
|
|
9904
|
+
var kids = childrenMap[current];
|
|
9905
|
+
if (kids) {
|
|
9906
|
+
for (var j = 0; j < kids.length; j++) {
|
|
9907
|
+
queue.push(kids[j]);
|
|
9908
|
+
}
|
|
9909
|
+
}
|
|
9910
|
+
}
|
|
9911
|
+
if (descendants.length === 0) {
|
|
9912
|
+
continue;
|
|
9913
|
+
}
|
|
9914
|
+
var checkedDescendantCount = 0;
|
|
9915
|
+
for (var j = 0; j < descendants.length; j++) {
|
|
9916
|
+
if (checkedSet[descendants[j]]) {
|
|
9917
|
+
checkedDescendantCount++;
|
|
9918
|
+
}
|
|
9919
|
+
}
|
|
9920
|
+
if (checkedDescendantCount > 0 && checkedDescendantCount < descendants.length &&
|
|
9921
|
+
indeterminateNodes.indexOf(nodeIdStr) === -1) {
|
|
9922
|
+
indeterminateNodes.push(nodeIdStr);
|
|
9923
|
+
}
|
|
9924
|
+
}
|
|
9925
|
+
this.treeObj.filterCheckedNodes = checkedNodes;
|
|
9926
|
+
this.treeObj.filterIndeterminateNodes = indeterminateNodes;
|
|
9927
|
+
};
|
|
9805
9928
|
/* To render the popup element */
|
|
9806
9929
|
DropDownTree.prototype.renderPopup = function () {
|
|
9807
9930
|
var _this = this;
|
|
@@ -10102,6 +10225,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
10102
10225
|
this.isFilterRestore = false;
|
|
10103
10226
|
}
|
|
10104
10227
|
}
|
|
10228
|
+
this.updateIndeterminateNodes();
|
|
10105
10229
|
};
|
|
10106
10230
|
DropDownTree.prototype.restoreFilterSelection = function () {
|
|
10107
10231
|
if (this.treeObj.checkedNodes) {
|
|
@@ -10352,6 +10476,8 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
10352
10476
|
var eventArgs = this.getEventArgs(args);
|
|
10353
10477
|
this.trigger('select', eventArgs);
|
|
10354
10478
|
this.isNodeChecked = args.action === 'check';
|
|
10479
|
+
this.uncheckedNodeId = args.action === 'uncheck' && !isNullOrUndefined(args.data[0]) ?
|
|
10480
|
+
getValue('id', args.data[0]).toString() : null;
|
|
10355
10481
|
if (this.isFilteredData && args.action === 'uncheck') {
|
|
10356
10482
|
var id = getValue('id', args.data[0]).toString();
|
|
10357
10483
|
this.removeSelectedData(id, true);
|
|
@@ -10384,17 +10510,8 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
10384
10510
|
this.triggerChangeEvent(this.keyEventArgs);
|
|
10385
10511
|
this.isValueChange = false;
|
|
10386
10512
|
}
|
|
10387
|
-
|
|
10388
|
-
|
|
10389
|
-
for (var i = 0; i < treeData.length; i++) {
|
|
10390
|
-
for (var j = 0; j < this.treeData.length; j++) {
|
|
10391
|
-
if (treeData[i].id === this.treeData[j].id) {
|
|
10392
|
-
this.treeData[j].selected = treeData[i].selected !== undefined ?
|
|
10393
|
-
treeData[i].selected : false;
|
|
10394
|
-
}
|
|
10395
|
-
}
|
|
10396
|
-
}
|
|
10397
|
-
}
|
|
10513
|
+
this.updateIndeterminateNodes();
|
|
10514
|
+
this.uncheckedNodeId = null;
|
|
10398
10515
|
};
|
|
10399
10516
|
DropDownTree.prototype.beforeCheck = function (args) {
|
|
10400
10517
|
if (args.isInteracted) {
|
|
@@ -10688,15 +10805,13 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
10688
10805
|
}
|
|
10689
10806
|
}
|
|
10690
10807
|
};
|
|
10691
|
-
DropDownTree.prototype.getFilteredTreeData = function () {
|
|
10692
|
-
return this.treeData;
|
|
10693
|
-
};
|
|
10694
10808
|
DropDownTree.prototype.getChildren = function (parentId, result) {
|
|
10695
10809
|
var _this = this;
|
|
10696
|
-
|
|
10697
|
-
|
|
10698
|
-
|
|
10699
|
-
|
|
10810
|
+
this.treeData.forEach(function (item) {
|
|
10811
|
+
var itemId = !isNullOrUndefined(item) ? getValue(_this.fields.value, item) : null;
|
|
10812
|
+
var itemPid = !isNullOrUndefined(item) ? getValue(_this.fields.parentValue, item) : null;
|
|
10813
|
+
if (!isNullOrUndefined(itemId) && !isNullOrUndefined(itemPid) && itemPid.toString() === parentId.toString()) {
|
|
10814
|
+
var childId = itemId.toString();
|
|
10700
10815
|
if (result.indexOf(childId) === -1) {
|
|
10701
10816
|
result.push(childId);
|
|
10702
10817
|
_this.getChildren(childId, result);
|
|
@@ -10705,41 +10820,17 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
10705
10820
|
});
|
|
10706
10821
|
};
|
|
10707
10822
|
DropDownTree.prototype.getDirectChildren = function (parentId) {
|
|
10708
|
-
|
|
10823
|
+
var _this = this;
|
|
10824
|
+
return this.treeData
|
|
10709
10825
|
.filter(function (childNode) {
|
|
10710
|
-
|
|
10826
|
+
var childId = !isNullOrUndefined(childNode) ? getValue(_this.fields.value, childNode) : null;
|
|
10827
|
+
var childPid = !isNullOrUndefined(childNode) ? getValue(_this.fields.parentValue, childNode) : null;
|
|
10828
|
+
return !isNullOrUndefined(childId) && !isNullOrUndefined(childPid) && childPid.toString() === parentId;
|
|
10711
10829
|
})
|
|
10712
|
-
.map(function (childNode) { return childNode.
|
|
10713
|
-
};
|
|
10714
|
-
DropDownTree.prototype.restoreRootParentValues = function () {
|
|
10715
|
-
var _this = this;
|
|
10716
|
-
var treeData = this.getFilteredTreeData();
|
|
10717
|
-
treeData.forEach(function (node) {
|
|
10718
|
-
if (isNullOrUndefined(node) || isNullOrUndefined(node.id)) {
|
|
10719
|
-
return;
|
|
10720
|
-
}
|
|
10721
|
-
if (isNullOrUndefined(node.pid)) {
|
|
10722
|
-
var rootId = node.id.toString();
|
|
10723
|
-
var currentValues_1 = _this.value.map(function (item) {
|
|
10724
|
-
return item.toString();
|
|
10725
|
-
});
|
|
10726
|
-
if (currentValues_1.indexOf(rootId) === -1) {
|
|
10727
|
-
var childValues = [];
|
|
10728
|
-
_this.getChildren(rootId, childValues);
|
|
10729
|
-
var hasSelectedChild = childValues.some(function (childId) { return currentValues_1.indexOf(childId) !== -1; });
|
|
10730
|
-
if (hasSelectedChild) {
|
|
10731
|
-
_this.value.push(rootId);
|
|
10732
|
-
}
|
|
10733
|
-
}
|
|
10734
|
-
}
|
|
10735
|
-
});
|
|
10830
|
+
.map(function (childNode) { return getValue(_this.fields.value, childNode).toString(); });
|
|
10736
10831
|
};
|
|
10737
10832
|
DropDownTree.prototype.updateFilteredAutoCheckValues = function () {
|
|
10738
10833
|
var _this = this;
|
|
10739
|
-
var treeData = this.getFilteredTreeData();
|
|
10740
|
-
if (!this.isNodeChecked && Array.isArray(this.value) && this.value.length > 0 && this.showCheckBox) {
|
|
10741
|
-
this.restoreRootParentValues();
|
|
10742
|
-
}
|
|
10743
10834
|
var currentValues = Array.isArray(this.value) ? this.value.map(function (item) { return item.toString(); }) : [];
|
|
10744
10835
|
var removeParent = function (parentId) {
|
|
10745
10836
|
_this.value = _this.value.filter(function (value) { return value.toString() !== parentId; });
|
|
@@ -10750,12 +10841,14 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
10750
10841
|
_this.value.push(value);
|
|
10751
10842
|
}
|
|
10752
10843
|
});
|
|
10753
|
-
treeData.forEach(function (node) {
|
|
10754
|
-
|
|
10844
|
+
this.treeData.forEach(function (node) {
|
|
10845
|
+
var nodeId = isNullOrUndefined(node) ? null : getValue(_this.fields.value, node);
|
|
10846
|
+
var nodeHasChild = !isNullOrUndefined(node) && !!_this.fields.hasChildren && getValue(_this.fields.hasChildren, node) === true;
|
|
10847
|
+
if (isNullOrUndefined(nodeId)) {
|
|
10755
10848
|
return;
|
|
10756
10849
|
}
|
|
10757
|
-
var parentId =
|
|
10758
|
-
if (
|
|
10850
|
+
var parentId = nodeId.toString();
|
|
10851
|
+
if (nodeHasChild && _this.value.indexOf(parentId) !== -1) {
|
|
10759
10852
|
var childValues = [];
|
|
10760
10853
|
_this.getChildren(parentId, childValues);
|
|
10761
10854
|
if (_this.value.indexOf(parentId) === -1) {
|
|
@@ -10769,14 +10862,16 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
10769
10862
|
}
|
|
10770
10863
|
currentValues = _this.value.map(function (item) { return item.toString(); });
|
|
10771
10864
|
});
|
|
10772
|
-
treeData.forEach(function (node) {
|
|
10773
|
-
|
|
10865
|
+
this.treeData.forEach(function (node) {
|
|
10866
|
+
var nodeId = isNullOrUndefined(node) ? null : getValue(_this.fields.value, node);
|
|
10867
|
+
var nodeHasChild = !isNullOrUndefined(node) && !!_this.fields.hasChildren && getValue(_this.fields.hasChildren, node) === true;
|
|
10868
|
+
if (isNullOrUndefined(nodeId)) {
|
|
10774
10869
|
return;
|
|
10775
10870
|
}
|
|
10776
|
-
if (!
|
|
10871
|
+
if (!nodeHasChild) {
|
|
10777
10872
|
return;
|
|
10778
10873
|
}
|
|
10779
|
-
var parentId =
|
|
10874
|
+
var parentId = nodeId.toString();
|
|
10780
10875
|
var directChildren = _this.getDirectChildren(parentId);
|
|
10781
10876
|
if (!directChildren.length) {
|
|
10782
10877
|
return;
|
|
@@ -10810,14 +10905,19 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
10810
10905
|
return;
|
|
10811
10906
|
}
|
|
10812
10907
|
var removeValues = [];
|
|
10813
|
-
treeData.forEach(function (node) {
|
|
10814
|
-
|
|
10908
|
+
this.treeData.forEach(function (node) {
|
|
10909
|
+
var nodeId = isNullOrUndefined(node) ? null : getValue(_this.fields.value, node);
|
|
10910
|
+
var nodeHasChild = !isNullOrUndefined(node) && !!_this.fields.hasChildren && getValue(_this.fields.hasChildren, node) === true;
|
|
10911
|
+
if (isNullOrUndefined(nodeId)) {
|
|
10815
10912
|
return;
|
|
10816
10913
|
}
|
|
10817
|
-
if (!
|
|
10914
|
+
if (!nodeHasChild) {
|
|
10915
|
+
return;
|
|
10916
|
+
}
|
|
10917
|
+
var parentId = nodeId.toString();
|
|
10918
|
+
if (parentId !== _this.uncheckedNodeId) {
|
|
10818
10919
|
return;
|
|
10819
10920
|
}
|
|
10820
|
-
var parentId = node.id.toString();
|
|
10821
10921
|
if (currentValues.indexOf(parentId) === -1) {
|
|
10822
10922
|
var childValues = [];
|
|
10823
10923
|
_this.getChildren(parentId, childValues);
|
|
@@ -10833,18 +10933,20 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
10833
10933
|
var stabilized = false;
|
|
10834
10934
|
var valueBeforeReconciliation = this.value.slice();
|
|
10835
10935
|
var iterationCount = 0;
|
|
10836
|
-
var maxIterations = treeData.length + 1;
|
|
10936
|
+
var maxIterations = this.treeData.length + 1;
|
|
10837
10937
|
while (!stabilized && iterationCount < maxIterations) {
|
|
10838
10938
|
stabilized = true;
|
|
10839
10939
|
iterationCount++;
|
|
10840
|
-
treeData.forEach(function (node) {
|
|
10841
|
-
|
|
10940
|
+
this.treeData.forEach(function (node) {
|
|
10941
|
+
var nodeId = isNullOrUndefined(node) ? null : getValue(_this.fields.value, node);
|
|
10942
|
+
var nodeHasChild = !isNullOrUndefined(node) && !!_this.fields.hasChildren && getValue(_this.fields.hasChildren, node) === true;
|
|
10943
|
+
if (isNullOrUndefined(nodeId)) {
|
|
10842
10944
|
return;
|
|
10843
10945
|
}
|
|
10844
|
-
if (!
|
|
10946
|
+
if (!nodeHasChild) {
|
|
10845
10947
|
return;
|
|
10846
10948
|
}
|
|
10847
|
-
var parentId =
|
|
10949
|
+
var parentId = nodeId.toString();
|
|
10848
10950
|
var directChildren = _this.getDirectChildren(parentId);
|
|
10849
10951
|
if (!directChildren.length) {
|
|
10850
10952
|
return;
|
|
@@ -10884,7 +10986,8 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
10884
10986
|
if (!this.isFilteredData) {
|
|
10885
10987
|
this.selectedData = [];
|
|
10886
10988
|
}
|
|
10887
|
-
if (this.
|
|
10989
|
+
if (!this.isRemoteData && !this.treeSettings.loadOnDemand && this.treeSettings.autoCheck &&
|
|
10990
|
+
this.isFilteredData && !isNullOrUndefined(this.value)) {
|
|
10888
10991
|
this.updateFilteredAutoCheckValues();
|
|
10889
10992
|
}
|
|
10890
10993
|
if (!isNullOrUndefined(this.value)) {
|
|
@@ -10963,6 +11066,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
|
|
|
10963
11066
|
else {
|
|
10964
11067
|
this.inputWrapper.setAttribute('aria-label', this.getModuleName());
|
|
10965
11068
|
}
|
|
11069
|
+
this.updateIndeterminateNodes();
|
|
10966
11070
|
};
|
|
10967
11071
|
DropDownTree.prototype.setChipValues = function (text, value) {
|
|
10968
11072
|
if (!this.inputWrapper.contains(this.chipWrapper)) {
|
|
@@ -14057,6 +14161,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
14057
14161
|
};
|
|
14058
14162
|
MultiSelect.prototype.onPopupShown = function (e) {
|
|
14059
14163
|
var _this = this;
|
|
14164
|
+
this.sanitizeData();
|
|
14060
14165
|
if (Browser.isDevice && (this.mode === 'CheckBox' && this.allowFiltering)) {
|
|
14061
14166
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
14062
14167
|
var proxy_1 = this;
|
|
@@ -15681,7 +15786,10 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
15681
15786
|
}
|
|
15682
15787
|
}
|
|
15683
15788
|
this.UpdateSkeleton();
|
|
15684
|
-
var
|
|
15789
|
+
var hasOnlyVirtualItems = this.ulElement && this.ulElement.querySelector('li.e-virtual-list') &&
|
|
15790
|
+
this.ulElement.querySelectorAll('li:not(.e-virtual-list)').length === 0;
|
|
15791
|
+
var targetElement = hasOnlyVirtualItems ? this.list : this.ulElement;
|
|
15792
|
+
var scrollEle = targetElement.querySelectorAll('li.' + dropDownBaseClasses.li
|
|
15685
15793
|
+ ':not(.' + HIDE_LIST + ')' + ':not(.e-reorder-hide)');
|
|
15686
15794
|
if (scrollEle.length > 0) {
|
|
15687
15795
|
var element = scrollEle[(isHome) ? 0 : (scrollEle.length - 1)];
|
|
@@ -17575,6 +17683,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
17575
17683
|
};
|
|
17576
17684
|
MultiSelect.prototype.windowResize = function () {
|
|
17577
17685
|
this.refreshPopup();
|
|
17686
|
+
this.calculateWidth();
|
|
17687
|
+
this.updateFloatLabelOverflowWidth();
|
|
17578
17688
|
if ((!this.inputFocus || this.mode === 'CheckBox') && this.viewWrapper && this.viewWrapper.parentElement) {
|
|
17579
17689
|
this.updateDelimView();
|
|
17580
17690
|
}
|
|
@@ -17804,6 +17914,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
17804
17914
|
}
|
|
17805
17915
|
this.preventSetCurrentData = false;
|
|
17806
17916
|
this.initializeData();
|
|
17917
|
+
this.sanitizeData();
|
|
17807
17918
|
this.updateDataAttribute(this.htmlAttributes);
|
|
17808
17919
|
_super.prototype.preRender.call(this);
|
|
17809
17920
|
};
|
|
@@ -17834,6 +17945,56 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
17834
17945
|
endIndex: this.itemCount
|
|
17835
17946
|
};
|
|
17836
17947
|
};
|
|
17948
|
+
MultiSelect.prototype.sanitizeData = function () {
|
|
17949
|
+
if (this.enableVirtualization && this.mode === 'CheckBox') {
|
|
17950
|
+
if (this.dataSource && Array.isArray(this.dataSource) && !(this.dataSource instanceof DataManager)) {
|
|
17951
|
+
var cleanedDataSource = [];
|
|
17952
|
+
for (var i = 0; i < this.dataSource.length; i++) {
|
|
17953
|
+
var item = this.dataSource[i];
|
|
17954
|
+
if (item !== null && item !== undefined && item !== '') {
|
|
17955
|
+
if (typeof item === 'object') {
|
|
17956
|
+
var itemValue = getValue((this.fields.value ? this.fields.value : 'value'), item);
|
|
17957
|
+
if (this.fields.value !== null) {
|
|
17958
|
+
if (itemValue !== null && itemValue !== undefined && itemValue !== '') {
|
|
17959
|
+
cleanedDataSource.push(item);
|
|
17960
|
+
}
|
|
17961
|
+
}
|
|
17962
|
+
else {
|
|
17963
|
+
cleanedDataSource.push(item);
|
|
17964
|
+
}
|
|
17965
|
+
}
|
|
17966
|
+
else if (typeof item === 'string') {
|
|
17967
|
+
if (item !== null && item !== undefined && item.trim() !== '') {
|
|
17968
|
+
cleanedDataSource.push(item);
|
|
17969
|
+
}
|
|
17970
|
+
}
|
|
17971
|
+
else {
|
|
17972
|
+
cleanedDataSource.push(item);
|
|
17973
|
+
}
|
|
17974
|
+
}
|
|
17975
|
+
}
|
|
17976
|
+
if (cleanedDataSource.length !== this.dataSource.length) {
|
|
17977
|
+
this.setProperties({ dataSource: cleanedDataSource }, true);
|
|
17978
|
+
}
|
|
17979
|
+
}
|
|
17980
|
+
if (this.value && Array.isArray(this.value) && this.value.length > 0) {
|
|
17981
|
+
var cleanedValue = [];
|
|
17982
|
+
for (var i = 0; i < this.value.length; i++) {
|
|
17983
|
+
var val = this.value[i];
|
|
17984
|
+
if (val !== null && val !== undefined && val !== '') {
|
|
17985
|
+
cleanedValue.push(val);
|
|
17986
|
+
}
|
|
17987
|
+
}
|
|
17988
|
+
if (cleanedValue.length !== this.value.length) {
|
|
17989
|
+
this.setProperties({ value: cleanedValue }, true);
|
|
17990
|
+
}
|
|
17991
|
+
}
|
|
17992
|
+
return true;
|
|
17993
|
+
}
|
|
17994
|
+
else {
|
|
17995
|
+
return false;
|
|
17996
|
+
}
|
|
17997
|
+
};
|
|
17837
17998
|
MultiSelect.prototype.updateData = function (delimiterChar, e, isInitialVirtualData) {
|
|
17838
17999
|
var data = '';
|
|
17839
18000
|
var delim = this.mode === 'Delimiter' || this.mode === 'CheckBox';
|
|
@@ -17984,6 +18145,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
17984
18145
|
|| this.list.querySelector('.e-ul') && this.list.querySelector('.e-ul').childElementCount === 0)) {
|
|
17985
18146
|
isEmptyData = true;
|
|
17986
18147
|
}
|
|
18148
|
+
this.sanitizeData();
|
|
17987
18149
|
_super.prototype.render.call(this, null, isEmptyData);
|
|
17988
18150
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17989
18151
|
this.totalItemCount = this.dataSource && this.dataSource.length ? this.dataSource.length : 0;
|
|
@@ -19722,6 +19884,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
19722
19884
|
switch (prop) {
|
|
19723
19885
|
case 'query':
|
|
19724
19886
|
case 'dataSource':
|
|
19887
|
+
this.sanitizeData();
|
|
19725
19888
|
if (this.mode === 'CheckBox' && this.showSelectAll) {
|
|
19726
19889
|
if (!isNullOrUndefined(this.popupObj)) {
|
|
19727
19890
|
this.popupObj.destroy();
|
|
@@ -19744,6 +19907,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
19744
19907
|
this.updateVal(this.value, this.value, 'text');
|
|
19745
19908
|
break;
|
|
19746
19909
|
case 'value':
|
|
19910
|
+
this.sanitizeData();
|
|
19747
19911
|
if (this.fields.disabled) {
|
|
19748
19912
|
this.removeDisabledItemsValue(this.value);
|
|
19749
19913
|
}
|
|
@@ -20180,6 +20344,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
20180
20344
|
}
|
|
20181
20345
|
this.firstItem = this.dataSource && this.dataSource.length > 0 ? this.dataSource[0] : null;
|
|
20182
20346
|
var args = { cancel: false };
|
|
20347
|
+
var oldValue = extend([], this.value, [], true);
|
|
20348
|
+
var oldData = extend([], this.dataSource, [], true);
|
|
20183
20349
|
this.trigger('beforeOpen', args, function (args) {
|
|
20184
20350
|
if (!args.cancel) {
|
|
20185
20351
|
if (!_this.ulElement) {
|
|
@@ -20191,6 +20357,50 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
20191
20357
|
if (_this.inputElement && _this.mode !== 'CheckBox') {
|
|
20192
20358
|
_this.focusIn();
|
|
20193
20359
|
}
|
|
20360
|
+
if (_this.enableVirtualization && _this.mode === 'CheckBox') {
|
|
20361
|
+
if (JSON.stringify(oldData) !== JSON.stringify(_this.dataSource) && _this.sanitizeData() && _this.showSelectAll) {
|
|
20362
|
+
_this.renderPopup();
|
|
20363
|
+
}
|
|
20364
|
+
if (!isNullOrUndefined(oldValue) && !isNullOrUndefined(_this.value) &&
|
|
20365
|
+
JSON.stringify(oldValue) !== JSON.stringify(_this.value) && _this.sanitizeData()) {
|
|
20366
|
+
if (_this.fields.disabled) {
|
|
20367
|
+
_this.removeDisabledItemsValue(_this.value);
|
|
20368
|
+
}
|
|
20369
|
+
if (!_this.validateValues(_this.value, oldValue)) {
|
|
20370
|
+
return;
|
|
20371
|
+
}
|
|
20372
|
+
if (_this.isVue && !_this.changeOnBlur && !_this.validateValues(_this.value, oldValue)) {
|
|
20373
|
+
return;
|
|
20374
|
+
}
|
|
20375
|
+
_this.updateVal(_this.value, oldValue, 'value', _this.enableVirtualization);
|
|
20376
|
+
_this.addValidInputClass();
|
|
20377
|
+
if (_this.showSelectAll) {
|
|
20378
|
+
_this.renderPopup();
|
|
20379
|
+
var totalCount = _this.dataSource instanceof DataManager ? 0 :
|
|
20380
|
+
_this.dataSource.length;
|
|
20381
|
+
var selectedCount = _this.value ? _this.value.length : 0;
|
|
20382
|
+
if (selectedCount === totalCount) {
|
|
20383
|
+
var frame = null;
|
|
20384
|
+
if (_this.popupObj) {
|
|
20385
|
+
frame = _this.popupObj.element.querySelector('.e-selectall-parent .e-frame');
|
|
20386
|
+
}
|
|
20387
|
+
if (frame) {
|
|
20388
|
+
frame.classList.add('e-check');
|
|
20389
|
+
frame.classList.remove('e-uncheck');
|
|
20390
|
+
frame.classList.remove('e-stop');
|
|
20391
|
+
}
|
|
20392
|
+
}
|
|
20393
|
+
}
|
|
20394
|
+
if (!_this.closePopupOnSelect && _this.isPopupOpen()) {
|
|
20395
|
+
_this.refreshPopup();
|
|
20396
|
+
}
|
|
20397
|
+
if (_this.isPopupOpen() && _this.list && _this.list.querySelector('.e-active.e-disable')) {
|
|
20398
|
+
var activeItems = _this.list.querySelectorAll('li.' + dropDownBaseClasses.li + '.e-active' + '.e-disable');
|
|
20399
|
+
removeClass(activeItems, 'e-disable');
|
|
20400
|
+
}
|
|
20401
|
+
_this.preventChange = _this.isAngular && _this.preventChange ? !_this.preventChange : _this.preventChange;
|
|
20402
|
+
}
|
|
20403
|
+
}
|
|
20194
20404
|
return;
|
|
20195
20405
|
}
|
|
20196
20406
|
if (_this.mode === 'CheckBox' && Browser.isDevice && _this.allowFiltering && _this.isDeviceFullScreen) {
|
|
@@ -20347,6 +20557,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
|
|
|
20347
20557
|
// eslint-disable-next-line
|
|
20348
20558
|
this.value = this.value.slice();
|
|
20349
20559
|
}
|
|
20560
|
+
this.sanitizeData();
|
|
20350
20561
|
this.setDynValue = this.initStatus = false;
|
|
20351
20562
|
this.isSelectAll = false;
|
|
20352
20563
|
this.selectAllEventEle = [];
|
|
@@ -25056,7 +25267,7 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
|
|
|
25056
25267
|
? lastWordRange.substring(lastWordRange.lastIndexOf(this.mentionChar) + 1).trim()
|
|
25057
25268
|
: lastWordRange.replace(this.mentionChar, '');
|
|
25058
25269
|
}
|
|
25059
|
-
if (this.queryString !== '' && e.keyCode === 8 && lastWordRange.includes(this.mentionChar) && !this.isPopupOpen &&
|
|
25270
|
+
if (this.queryString !== '' && e.keyCode === 8 && lastWordRange.includes(this.mentionChar) && !this.isPopupOpen && !isNullOrUndefined(this.displayTemplate) &&
|
|
25060
25271
|
((typeof this.displayTemplate === 'function' ? this.displayTemplate() : this.displayTemplate)).includes(this.mentionChar)) {
|
|
25061
25272
|
this.queryString = '';
|
|
25062
25273
|
}
|