@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
|
@@ -3776,6 +3776,7 @@ let DropDownList = class DropDownList extends DropDownBase {
|
|
|
3776
3776
|
this.bindClearEvent();
|
|
3777
3777
|
}
|
|
3778
3778
|
windowResize() {
|
|
3779
|
+
this.updateFloatLabelOverflowWidth();
|
|
3779
3780
|
if (this.isPopupOpen) {
|
|
3780
3781
|
this.popupObj.refreshPosition(this.inputWrapper.container);
|
|
3781
3782
|
}
|
|
@@ -8147,6 +8148,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
8147
8148
|
this.isNodeChecked = false;
|
|
8148
8149
|
this.isFromFilterChange = false;
|
|
8149
8150
|
this.fallbackValue = [];
|
|
8151
|
+
this.uncheckedNodeId = null;
|
|
8150
8152
|
}
|
|
8151
8153
|
/**
|
|
8152
8154
|
* Get the properties to be maintained in the persisted state.
|
|
@@ -9612,8 +9614,129 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
9612
9614
|
checkOnClick: true
|
|
9613
9615
|
});
|
|
9614
9616
|
this.treeObj.root = this.root ? this.root : this;
|
|
9617
|
+
this.treeObj.filterIndeterminateNodes = [];
|
|
9618
|
+
this.treeObj.filterCheckedNodes = [];
|
|
9615
9619
|
this.treeObj.appendTo(this.tree);
|
|
9616
9620
|
}
|
|
9621
|
+
updateIndeterminateNodes() {
|
|
9622
|
+
if (!(this.allowFiltering && this.treeSettings.autoCheck) || (this.isRemoteData || this.treeSettings.loadOnDemand)) {
|
|
9623
|
+
return;
|
|
9624
|
+
}
|
|
9625
|
+
const checkedNodes = Array.isArray(this.value) ? this.value.slice() : [];
|
|
9626
|
+
const checkedSet = {};
|
|
9627
|
+
for (let i = 0; i < checkedNodes.length; i++) {
|
|
9628
|
+
checkedSet[checkedNodes[i]] = true;
|
|
9629
|
+
}
|
|
9630
|
+
const treeData = this.treeObj.element.classList.contains('e-filtering') ? this.treeData : this.treeItems;
|
|
9631
|
+
const valueField = this.fields.value;
|
|
9632
|
+
const parentValueField = this.fields.parentValue;
|
|
9633
|
+
const hasChildrenField = this.fields.hasChildren;
|
|
9634
|
+
const childField = this.fields.child;
|
|
9635
|
+
const indeterminateNodes = [];
|
|
9636
|
+
const childrenMap = {};
|
|
9637
|
+
for (let i = 0; i < treeData.length; i++) {
|
|
9638
|
+
const node = treeData[i];
|
|
9639
|
+
const nodeId = getValue(valueField, node);
|
|
9640
|
+
const nodePid = getValue(parentValueField, node);
|
|
9641
|
+
if (isNullOrUndefined(node) || isNullOrUndefined(nodeId) || isNullOrUndefined(nodePid)) {
|
|
9642
|
+
continue;
|
|
9643
|
+
}
|
|
9644
|
+
const parentId = nodePid.toString();
|
|
9645
|
+
if (!childrenMap[parentId]) {
|
|
9646
|
+
childrenMap[parentId] = [];
|
|
9647
|
+
}
|
|
9648
|
+
childrenMap[parentId].push(nodeId.toString());
|
|
9649
|
+
}
|
|
9650
|
+
const allNodes = treeData.slice();
|
|
9651
|
+
if (!isNullOrUndefined(childField)) {
|
|
9652
|
+
const collectNestedChildren = (nodes, fields) => {
|
|
9653
|
+
if (!nodes) {
|
|
9654
|
+
return;
|
|
9655
|
+
}
|
|
9656
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
9657
|
+
const node = nodes[i];
|
|
9658
|
+
if (isNullOrUndefined(node)) {
|
|
9659
|
+
continue;
|
|
9660
|
+
}
|
|
9661
|
+
const nodeId = getValue(fields.value, node);
|
|
9662
|
+
if (isNullOrUndefined(nodeId)) {
|
|
9663
|
+
continue;
|
|
9664
|
+
}
|
|
9665
|
+
allNodes.push(node);
|
|
9666
|
+
const childMapper = fields.child;
|
|
9667
|
+
let childrenArr;
|
|
9668
|
+
if (typeof childMapper === 'string') {
|
|
9669
|
+
childrenArr = node[childMapper];
|
|
9670
|
+
}
|
|
9671
|
+
else if (!isNullOrUndefined(childMapper)) {
|
|
9672
|
+
childrenArr = node[childMapper.value];
|
|
9673
|
+
}
|
|
9674
|
+
else {
|
|
9675
|
+
childrenArr = null;
|
|
9676
|
+
}
|
|
9677
|
+
if (!isNullOrUndefined(childrenArr) && Array.isArray(childrenArr) && childrenArr.length) {
|
|
9678
|
+
const parentId = nodeId.toString();
|
|
9679
|
+
if (!childrenMap[parentId]) {
|
|
9680
|
+
childrenMap[parentId] = [];
|
|
9681
|
+
}
|
|
9682
|
+
for (let k = 0; k < childrenArr.length; k++) {
|
|
9683
|
+
const childId = getValue(fields.value, childrenArr[k]);
|
|
9684
|
+
if (!isNullOrUndefined(childId) && childrenMap[parentId].indexOf(childId.toString()) === -1) {
|
|
9685
|
+
childrenMap[parentId].push(childId.toString());
|
|
9686
|
+
}
|
|
9687
|
+
}
|
|
9688
|
+
const nextFields = (typeof childMapper !== 'string' && !isNullOrUndefined(childMapper)) ?
|
|
9689
|
+
childMapper : fields;
|
|
9690
|
+
collectNestedChildren(childrenArr, nextFields);
|
|
9691
|
+
}
|
|
9692
|
+
}
|
|
9693
|
+
};
|
|
9694
|
+
collectNestedChildren(treeData, this.fields);
|
|
9695
|
+
}
|
|
9696
|
+
for (let i = 0; i < allNodes.length; i++) {
|
|
9697
|
+
const node = allNodes[i];
|
|
9698
|
+
const nodeId = getValue(valueField, node);
|
|
9699
|
+
if (isNullOrUndefined(node) || isNullOrUndefined(nodeId)) {
|
|
9700
|
+
continue;
|
|
9701
|
+
}
|
|
9702
|
+
const nodeIdStr = nodeId.toString();
|
|
9703
|
+
if (hasChildrenField && getValue(hasChildrenField, node) === false) {
|
|
9704
|
+
continue;
|
|
9705
|
+
}
|
|
9706
|
+
if (checkedSet[nodeIdStr]) {
|
|
9707
|
+
continue;
|
|
9708
|
+
}
|
|
9709
|
+
const descendants = [];
|
|
9710
|
+
const queue = childrenMap[nodeIdStr] ? childrenMap[nodeIdStr].slice() : [];
|
|
9711
|
+
let head = 0;
|
|
9712
|
+
while (head < queue.length) {
|
|
9713
|
+
const current = queue[head];
|
|
9714
|
+
head++;
|
|
9715
|
+
descendants.push(current);
|
|
9716
|
+
const kids = childrenMap[current];
|
|
9717
|
+
if (kids) {
|
|
9718
|
+
for (let j = 0; j < kids.length; j++) {
|
|
9719
|
+
queue.push(kids[j]);
|
|
9720
|
+
}
|
|
9721
|
+
}
|
|
9722
|
+
}
|
|
9723
|
+
if (descendants.length === 0) {
|
|
9724
|
+
continue;
|
|
9725
|
+
}
|
|
9726
|
+
let checkedDescendantCount = 0;
|
|
9727
|
+
for (let j = 0; j < descendants.length; j++) {
|
|
9728
|
+
if (checkedSet[descendants[j]]) {
|
|
9729
|
+
checkedDescendantCount++;
|
|
9730
|
+
}
|
|
9731
|
+
}
|
|
9732
|
+
if (checkedDescendantCount > 0 && checkedDescendantCount < descendants.length &&
|
|
9733
|
+
indeterminateNodes.indexOf(nodeIdStr) === -1) {
|
|
9734
|
+
indeterminateNodes.push(nodeIdStr);
|
|
9735
|
+
}
|
|
9736
|
+
}
|
|
9737
|
+
this.treeObj.filterCheckedNodes = checkedNodes;
|
|
9738
|
+
this.treeObj.filterIndeterminateNodes = indeterminateNodes;
|
|
9739
|
+
}
|
|
9617
9740
|
/* To render the popup element */
|
|
9618
9741
|
renderPopup() {
|
|
9619
9742
|
if (this.isFilteredData) {
|
|
@@ -9910,6 +10033,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
9910
10033
|
this.isFilterRestore = false;
|
|
9911
10034
|
}
|
|
9912
10035
|
}
|
|
10036
|
+
this.updateIndeterminateNodes();
|
|
9913
10037
|
}
|
|
9914
10038
|
restoreFilterSelection() {
|
|
9915
10039
|
if (this.treeObj.checkedNodes) {
|
|
@@ -10160,6 +10284,8 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
10160
10284
|
const eventArgs = this.getEventArgs(args);
|
|
10161
10285
|
this.trigger('select', eventArgs);
|
|
10162
10286
|
this.isNodeChecked = args.action === 'check';
|
|
10287
|
+
this.uncheckedNodeId = args.action === 'uncheck' && !isNullOrUndefined(args.data[0]) ?
|
|
10288
|
+
getValue('id', args.data[0]).toString() : null;
|
|
10163
10289
|
if (this.isFilteredData && args.action === 'uncheck') {
|
|
10164
10290
|
const id = getValue('id', args.data[0]).toString();
|
|
10165
10291
|
this.removeSelectedData(id, true);
|
|
@@ -10192,17 +10318,8 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
10192
10318
|
this.triggerChangeEvent(this.keyEventArgs);
|
|
10193
10319
|
this.isValueChange = false;
|
|
10194
10320
|
}
|
|
10195
|
-
|
|
10196
|
-
|
|
10197
|
-
for (let i = 0; i < treeData.length; i++) {
|
|
10198
|
-
for (let j = 0; j < this.treeData.length; j++) {
|
|
10199
|
-
if (treeData[i].id === this.treeData[j].id) {
|
|
10200
|
-
this.treeData[j].selected = treeData[i].selected !== undefined ?
|
|
10201
|
-
treeData[i].selected : false;
|
|
10202
|
-
}
|
|
10203
|
-
}
|
|
10204
|
-
}
|
|
10205
|
-
}
|
|
10321
|
+
this.updateIndeterminateNodes();
|
|
10322
|
+
this.uncheckedNodeId = null;
|
|
10206
10323
|
}
|
|
10207
10324
|
beforeCheck(args) {
|
|
10208
10325
|
if (args.isInteracted) {
|
|
@@ -10494,14 +10611,12 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
10494
10611
|
}
|
|
10495
10612
|
}
|
|
10496
10613
|
}
|
|
10497
|
-
getFilteredTreeData() {
|
|
10498
|
-
return this.treeData;
|
|
10499
|
-
}
|
|
10500
10614
|
getChildren(parentId, result) {
|
|
10501
|
-
|
|
10502
|
-
|
|
10503
|
-
|
|
10504
|
-
|
|
10615
|
+
this.treeData.forEach((item) => {
|
|
10616
|
+
const itemId = !isNullOrUndefined(item) ? getValue(this.fields.value, item) : null;
|
|
10617
|
+
const itemPid = !isNullOrUndefined(item) ? getValue(this.fields.parentValue, item) : null;
|
|
10618
|
+
if (!isNullOrUndefined(itemId) && !isNullOrUndefined(itemPid) && itemPid.toString() === parentId.toString()) {
|
|
10619
|
+
const childId = itemId.toString();
|
|
10505
10620
|
if (result.indexOf(childId) === -1) {
|
|
10506
10621
|
result.push(childId);
|
|
10507
10622
|
this.getChildren(childId, result);
|
|
@@ -10510,35 +10625,15 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
10510
10625
|
});
|
|
10511
10626
|
}
|
|
10512
10627
|
getDirectChildren(parentId) {
|
|
10513
|
-
return this.
|
|
10514
|
-
.filter((childNode) =>
|
|
10515
|
-
|
|
10516
|
-
|
|
10517
|
-
|
|
10518
|
-
|
|
10519
|
-
|
|
10520
|
-
if (isNullOrUndefined(node) || isNullOrUndefined(node.id)) {
|
|
10521
|
-
return;
|
|
10522
|
-
}
|
|
10523
|
-
if (isNullOrUndefined(node.pid)) {
|
|
10524
|
-
const rootId = node.id.toString();
|
|
10525
|
-
const currentValues = this.value.map((item) => item.toString());
|
|
10526
|
-
if (currentValues.indexOf(rootId) === -1) {
|
|
10527
|
-
const childValues = [];
|
|
10528
|
-
this.getChildren(rootId, childValues);
|
|
10529
|
-
const hasSelectedChild = childValues.some((childId) => currentValues.indexOf(childId) !== -1);
|
|
10530
|
-
if (hasSelectedChild) {
|
|
10531
|
-
this.value.push(rootId);
|
|
10532
|
-
}
|
|
10533
|
-
}
|
|
10534
|
-
}
|
|
10535
|
-
});
|
|
10628
|
+
return this.treeData
|
|
10629
|
+
.filter((childNode) => {
|
|
10630
|
+
const childId = !isNullOrUndefined(childNode) ? getValue(this.fields.value, childNode) : null;
|
|
10631
|
+
const childPid = !isNullOrUndefined(childNode) ? getValue(this.fields.parentValue, childNode) : null;
|
|
10632
|
+
return !isNullOrUndefined(childId) && !isNullOrUndefined(childPid) && childPid.toString() === parentId;
|
|
10633
|
+
})
|
|
10634
|
+
.map((childNode) => getValue(this.fields.value, childNode).toString());
|
|
10536
10635
|
}
|
|
10537
10636
|
updateFilteredAutoCheckValues() {
|
|
10538
|
-
const treeData = this.getFilteredTreeData();
|
|
10539
|
-
if (!this.isNodeChecked && Array.isArray(this.value) && this.value.length > 0 && this.showCheckBox) {
|
|
10540
|
-
this.restoreRootParentValues();
|
|
10541
|
-
}
|
|
10542
10637
|
let currentValues = Array.isArray(this.value) ? this.value.map((item) => item.toString()) : [];
|
|
10543
10638
|
const removeParent = (parentId) => {
|
|
10544
10639
|
this.value = this.value.filter((value) => value.toString() !== parentId);
|
|
@@ -10549,12 +10644,14 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
10549
10644
|
this.value.push(value);
|
|
10550
10645
|
}
|
|
10551
10646
|
});
|
|
10552
|
-
treeData.forEach((node) => {
|
|
10553
|
-
|
|
10647
|
+
this.treeData.forEach((node) => {
|
|
10648
|
+
const nodeId = isNullOrUndefined(node) ? null : getValue(this.fields.value, node);
|
|
10649
|
+
const nodeHasChild = !isNullOrUndefined(node) && !!this.fields.hasChildren && getValue(this.fields.hasChildren, node) === true;
|
|
10650
|
+
if (isNullOrUndefined(nodeId)) {
|
|
10554
10651
|
return;
|
|
10555
10652
|
}
|
|
10556
|
-
const parentId =
|
|
10557
|
-
if (
|
|
10653
|
+
const parentId = nodeId.toString();
|
|
10654
|
+
if (nodeHasChild && this.value.indexOf(parentId) !== -1) {
|
|
10558
10655
|
const childValues = [];
|
|
10559
10656
|
this.getChildren(parentId, childValues);
|
|
10560
10657
|
if (this.value.indexOf(parentId) === -1) {
|
|
@@ -10568,14 +10665,16 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
10568
10665
|
}
|
|
10569
10666
|
currentValues = this.value.map((item) => item.toString());
|
|
10570
10667
|
});
|
|
10571
|
-
treeData.forEach((node) => {
|
|
10572
|
-
|
|
10668
|
+
this.treeData.forEach((node) => {
|
|
10669
|
+
const nodeId = isNullOrUndefined(node) ? null : getValue(this.fields.value, node);
|
|
10670
|
+
const nodeHasChild = !isNullOrUndefined(node) && !!this.fields.hasChildren && getValue(this.fields.hasChildren, node) === true;
|
|
10671
|
+
if (isNullOrUndefined(nodeId)) {
|
|
10573
10672
|
return;
|
|
10574
10673
|
}
|
|
10575
|
-
if (!
|
|
10674
|
+
if (!nodeHasChild) {
|
|
10576
10675
|
return;
|
|
10577
10676
|
}
|
|
10578
|
-
const parentId =
|
|
10677
|
+
const parentId = nodeId.toString();
|
|
10579
10678
|
const directChildren = this.getDirectChildren(parentId);
|
|
10580
10679
|
if (!directChildren.length) {
|
|
10581
10680
|
return;
|
|
@@ -10607,14 +10706,19 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
10607
10706
|
return;
|
|
10608
10707
|
}
|
|
10609
10708
|
const removeValues = [];
|
|
10610
|
-
treeData.forEach((node) => {
|
|
10611
|
-
|
|
10709
|
+
this.treeData.forEach((node) => {
|
|
10710
|
+
const nodeId = isNullOrUndefined(node) ? null : getValue(this.fields.value, node);
|
|
10711
|
+
const nodeHasChild = !isNullOrUndefined(node) && !!this.fields.hasChildren && getValue(this.fields.hasChildren, node) === true;
|
|
10712
|
+
if (isNullOrUndefined(nodeId)) {
|
|
10713
|
+
return;
|
|
10714
|
+
}
|
|
10715
|
+
if (!nodeHasChild) {
|
|
10612
10716
|
return;
|
|
10613
10717
|
}
|
|
10614
|
-
|
|
10718
|
+
const parentId = nodeId.toString();
|
|
10719
|
+
if (parentId !== this.uncheckedNodeId) {
|
|
10615
10720
|
return;
|
|
10616
10721
|
}
|
|
10617
|
-
const parentId = node.id.toString();
|
|
10618
10722
|
if (currentValues.indexOf(parentId) === -1) {
|
|
10619
10723
|
const childValues = [];
|
|
10620
10724
|
this.getChildren(parentId, childValues);
|
|
@@ -10630,18 +10734,20 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
10630
10734
|
let stabilized = false;
|
|
10631
10735
|
const valueBeforeReconciliation = [...this.value];
|
|
10632
10736
|
let iterationCount = 0;
|
|
10633
|
-
const maxIterations = treeData.length + 1;
|
|
10737
|
+
const maxIterations = this.treeData.length + 1;
|
|
10634
10738
|
while (!stabilized && iterationCount < maxIterations) {
|
|
10635
10739
|
stabilized = true;
|
|
10636
10740
|
iterationCount++;
|
|
10637
|
-
treeData.forEach((node) => {
|
|
10638
|
-
|
|
10741
|
+
this.treeData.forEach((node) => {
|
|
10742
|
+
const nodeId = isNullOrUndefined(node) ? null : getValue(this.fields.value, node);
|
|
10743
|
+
const nodeHasChild = !isNullOrUndefined(node) && !!this.fields.hasChildren && getValue(this.fields.hasChildren, node) === true;
|
|
10744
|
+
if (isNullOrUndefined(nodeId)) {
|
|
10639
10745
|
return;
|
|
10640
10746
|
}
|
|
10641
|
-
if (!
|
|
10747
|
+
if (!nodeHasChild) {
|
|
10642
10748
|
return;
|
|
10643
10749
|
}
|
|
10644
|
-
const parentId =
|
|
10750
|
+
const parentId = nodeId.toString();
|
|
10645
10751
|
const directChildren = this.getDirectChildren(parentId);
|
|
10646
10752
|
if (!directChildren.length) {
|
|
10647
10753
|
return;
|
|
@@ -10680,7 +10786,8 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
10680
10786
|
if (!this.isFilteredData) {
|
|
10681
10787
|
this.selectedData = [];
|
|
10682
10788
|
}
|
|
10683
|
-
if (this.
|
|
10789
|
+
if (!this.isRemoteData && !this.treeSettings.loadOnDemand && this.treeSettings.autoCheck &&
|
|
10790
|
+
this.isFilteredData && !isNullOrUndefined(this.value)) {
|
|
10684
10791
|
this.updateFilteredAutoCheckValues();
|
|
10685
10792
|
}
|
|
10686
10793
|
if (!isNullOrUndefined(this.value)) {
|
|
@@ -10757,6 +10864,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
10757
10864
|
else {
|
|
10758
10865
|
this.inputWrapper.setAttribute('aria-label', this.getModuleName());
|
|
10759
10866
|
}
|
|
10867
|
+
this.updateIndeterminateNodes();
|
|
10760
10868
|
}
|
|
10761
10869
|
setChipValues(text, value) {
|
|
10762
10870
|
if (!this.inputWrapper.contains(this.chipWrapper)) {
|
|
@@ -13789,6 +13897,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13789
13897
|
}
|
|
13790
13898
|
}
|
|
13791
13899
|
onPopupShown(e) {
|
|
13900
|
+
this.sanitizeData();
|
|
13792
13901
|
if (Browser.isDevice && (this.mode === 'CheckBox' && this.allowFiltering)) {
|
|
13793
13902
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
13794
13903
|
const proxy = this;
|
|
@@ -15411,7 +15520,10 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
15411
15520
|
}
|
|
15412
15521
|
}
|
|
15413
15522
|
this.UpdateSkeleton();
|
|
15414
|
-
const
|
|
15523
|
+
const hasOnlyVirtualItems = this.ulElement && this.ulElement.querySelector('li.e-virtual-list') &&
|
|
15524
|
+
this.ulElement.querySelectorAll('li:not(.e-virtual-list)').length === 0;
|
|
15525
|
+
const targetElement = hasOnlyVirtualItems ? this.list : this.ulElement;
|
|
15526
|
+
const scrollEle = targetElement.querySelectorAll('li.' + dropDownBaseClasses.li
|
|
15415
15527
|
+ ':not(.' + HIDE_LIST + ')' + ':not(.e-reorder-hide)');
|
|
15416
15528
|
if (scrollEle.length > 0) {
|
|
15417
15529
|
let element = scrollEle[(isHome) ? 0 : (scrollEle.length - 1)];
|
|
@@ -17288,6 +17400,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
17288
17400
|
}
|
|
17289
17401
|
windowResize() {
|
|
17290
17402
|
this.refreshPopup();
|
|
17403
|
+
this.calculateWidth();
|
|
17404
|
+
this.updateFloatLabelOverflowWidth();
|
|
17291
17405
|
if ((!this.inputFocus || this.mode === 'CheckBox') && this.viewWrapper && this.viewWrapper.parentElement) {
|
|
17292
17406
|
this.updateDelimView();
|
|
17293
17407
|
}
|
|
@@ -17515,6 +17629,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
17515
17629
|
}
|
|
17516
17630
|
this.preventSetCurrentData = false;
|
|
17517
17631
|
this.initializeData();
|
|
17632
|
+
this.sanitizeData();
|
|
17518
17633
|
this.updateDataAttribute(this.htmlAttributes);
|
|
17519
17634
|
super.preRender();
|
|
17520
17635
|
}
|
|
@@ -17545,6 +17660,56 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
17545
17660
|
endIndex: this.itemCount
|
|
17546
17661
|
};
|
|
17547
17662
|
}
|
|
17663
|
+
sanitizeData() {
|
|
17664
|
+
if (this.enableVirtualization && this.mode === 'CheckBox') {
|
|
17665
|
+
if (this.dataSource && Array.isArray(this.dataSource) && !(this.dataSource instanceof DataManager)) {
|
|
17666
|
+
const cleanedDataSource = [];
|
|
17667
|
+
for (let i = 0; i < this.dataSource.length; i++) {
|
|
17668
|
+
const item = this.dataSource[i];
|
|
17669
|
+
if (item !== null && item !== undefined && item !== '') {
|
|
17670
|
+
if (typeof item === 'object') {
|
|
17671
|
+
const itemValue = getValue((this.fields.value ? this.fields.value : 'value'), item);
|
|
17672
|
+
if (this.fields.value !== null) {
|
|
17673
|
+
if (itemValue !== null && itemValue !== undefined && itemValue !== '') {
|
|
17674
|
+
cleanedDataSource.push(item);
|
|
17675
|
+
}
|
|
17676
|
+
}
|
|
17677
|
+
else {
|
|
17678
|
+
cleanedDataSource.push(item);
|
|
17679
|
+
}
|
|
17680
|
+
}
|
|
17681
|
+
else if (typeof item === 'string') {
|
|
17682
|
+
if (item !== null && item !== undefined && item.trim() !== '') {
|
|
17683
|
+
cleanedDataSource.push(item);
|
|
17684
|
+
}
|
|
17685
|
+
}
|
|
17686
|
+
else {
|
|
17687
|
+
cleanedDataSource.push(item);
|
|
17688
|
+
}
|
|
17689
|
+
}
|
|
17690
|
+
}
|
|
17691
|
+
if (cleanedDataSource.length !== this.dataSource.length) {
|
|
17692
|
+
this.setProperties({ dataSource: cleanedDataSource }, true);
|
|
17693
|
+
}
|
|
17694
|
+
}
|
|
17695
|
+
if (this.value && Array.isArray(this.value) && this.value.length > 0) {
|
|
17696
|
+
const cleanedValue = [];
|
|
17697
|
+
for (let i = 0; i < this.value.length; i++) {
|
|
17698
|
+
const val = this.value[i];
|
|
17699
|
+
if (val !== null && val !== undefined && val !== '') {
|
|
17700
|
+
cleanedValue.push(val);
|
|
17701
|
+
}
|
|
17702
|
+
}
|
|
17703
|
+
if (cleanedValue.length !== this.value.length) {
|
|
17704
|
+
this.setProperties({ value: cleanedValue }, true);
|
|
17705
|
+
}
|
|
17706
|
+
}
|
|
17707
|
+
return true;
|
|
17708
|
+
}
|
|
17709
|
+
else {
|
|
17710
|
+
return false;
|
|
17711
|
+
}
|
|
17712
|
+
}
|
|
17548
17713
|
updateData(delimiterChar, e, isInitialVirtualData) {
|
|
17549
17714
|
let data = '';
|
|
17550
17715
|
const delim = this.mode === 'Delimiter' || this.mode === 'CheckBox';
|
|
@@ -17687,6 +17852,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
17687
17852
|
|| this.list.querySelector('.e-ul') && this.list.querySelector('.e-ul').childElementCount === 0)) {
|
|
17688
17853
|
isEmptyData = true;
|
|
17689
17854
|
}
|
|
17855
|
+
this.sanitizeData();
|
|
17690
17856
|
super.render(null, isEmptyData);
|
|
17691
17857
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17692
17858
|
this.totalItemCount = this.dataSource && this.dataSource.length ? this.dataSource.length : 0;
|
|
@@ -19417,6 +19583,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
19417
19583
|
switch (prop) {
|
|
19418
19584
|
case 'query':
|
|
19419
19585
|
case 'dataSource':
|
|
19586
|
+
this.sanitizeData();
|
|
19420
19587
|
if (this.mode === 'CheckBox' && this.showSelectAll) {
|
|
19421
19588
|
if (!isNullOrUndefined(this.popupObj)) {
|
|
19422
19589
|
this.popupObj.destroy();
|
|
@@ -19439,6 +19606,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
19439
19606
|
this.updateVal(this.value, this.value, 'text');
|
|
19440
19607
|
break;
|
|
19441
19608
|
case 'value':
|
|
19609
|
+
this.sanitizeData();
|
|
19442
19610
|
if (this.fields.disabled) {
|
|
19443
19611
|
this.removeDisabledItemsValue(this.value);
|
|
19444
19612
|
}
|
|
@@ -19870,6 +20038,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
19870
20038
|
}
|
|
19871
20039
|
this.firstItem = this.dataSource && this.dataSource.length > 0 ? this.dataSource[0] : null;
|
|
19872
20040
|
const args = { cancel: false };
|
|
20041
|
+
const oldValue = extend([], this.value, [], true);
|
|
20042
|
+
const oldData = extend([], this.dataSource, [], true);
|
|
19873
20043
|
this.trigger('beforeOpen', args, (args) => {
|
|
19874
20044
|
if (!args.cancel) {
|
|
19875
20045
|
if (!this.ulElement) {
|
|
@@ -19881,6 +20051,50 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
19881
20051
|
if (this.inputElement && this.mode !== 'CheckBox') {
|
|
19882
20052
|
this.focusIn();
|
|
19883
20053
|
}
|
|
20054
|
+
if (this.enableVirtualization && this.mode === 'CheckBox') {
|
|
20055
|
+
if (JSON.stringify(oldData) !== JSON.stringify(this.dataSource) && this.sanitizeData() && this.showSelectAll) {
|
|
20056
|
+
this.renderPopup();
|
|
20057
|
+
}
|
|
20058
|
+
if (!isNullOrUndefined(oldValue) && !isNullOrUndefined(this.value) &&
|
|
20059
|
+
JSON.stringify(oldValue) !== JSON.stringify(this.value) && this.sanitizeData()) {
|
|
20060
|
+
if (this.fields.disabled) {
|
|
20061
|
+
this.removeDisabledItemsValue(this.value);
|
|
20062
|
+
}
|
|
20063
|
+
if (!this.validateValues(this.value, oldValue)) {
|
|
20064
|
+
return;
|
|
20065
|
+
}
|
|
20066
|
+
if (this.isVue && !this.changeOnBlur && !this.validateValues(this.value, oldValue)) {
|
|
20067
|
+
return;
|
|
20068
|
+
}
|
|
20069
|
+
this.updateVal(this.value, oldValue, 'value', this.enableVirtualization);
|
|
20070
|
+
this.addValidInputClass();
|
|
20071
|
+
if (this.showSelectAll) {
|
|
20072
|
+
this.renderPopup();
|
|
20073
|
+
const totalCount = this.dataSource instanceof DataManager ? 0 :
|
|
20074
|
+
this.dataSource.length;
|
|
20075
|
+
const selectedCount = this.value ? this.value.length : 0;
|
|
20076
|
+
if (selectedCount === totalCount) {
|
|
20077
|
+
let frame = null;
|
|
20078
|
+
if (this.popupObj) {
|
|
20079
|
+
frame = this.popupObj.element.querySelector('.e-selectall-parent .e-frame');
|
|
20080
|
+
}
|
|
20081
|
+
if (frame) {
|
|
20082
|
+
frame.classList.add('e-check');
|
|
20083
|
+
frame.classList.remove('e-uncheck');
|
|
20084
|
+
frame.classList.remove('e-stop');
|
|
20085
|
+
}
|
|
20086
|
+
}
|
|
20087
|
+
}
|
|
20088
|
+
if (!this.closePopupOnSelect && this.isPopupOpen()) {
|
|
20089
|
+
this.refreshPopup();
|
|
20090
|
+
}
|
|
20091
|
+
if (this.isPopupOpen() && this.list && this.list.querySelector('.e-active.e-disable')) {
|
|
20092
|
+
const activeItems = this.list.querySelectorAll('li.' + dropDownBaseClasses.li + '.e-active' + '.e-disable');
|
|
20093
|
+
removeClass(activeItems, 'e-disable');
|
|
20094
|
+
}
|
|
20095
|
+
this.preventChange = this.isAngular && this.preventChange ? !this.preventChange : this.preventChange;
|
|
20096
|
+
}
|
|
20097
|
+
}
|
|
19884
20098
|
return;
|
|
19885
20099
|
}
|
|
19886
20100
|
if (this.mode === 'CheckBox' && Browser.isDevice && this.allowFiltering && this.isDeviceFullScreen) {
|
|
@@ -20035,6 +20249,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
20035
20249
|
// eslint-disable-next-line
|
|
20036
20250
|
this.value = [...this.value];
|
|
20037
20251
|
}
|
|
20252
|
+
this.sanitizeData();
|
|
20038
20253
|
this.setDynValue = this.initStatus = false;
|
|
20039
20254
|
this.isSelectAll = false;
|
|
20040
20255
|
this.selectAllEventEle = [];
|
|
@@ -24654,7 +24869,7 @@ let Mention = class Mention extends DropDownBase {
|
|
|
24654
24869
|
? lastWordRange.substring(lastWordRange.lastIndexOf(this.mentionChar) + 1).trim()
|
|
24655
24870
|
: lastWordRange.replace(this.mentionChar, '');
|
|
24656
24871
|
}
|
|
24657
|
-
if (this.queryString !== '' && e.keyCode === 8 && lastWordRange.includes(this.mentionChar) && !this.isPopupOpen &&
|
|
24872
|
+
if (this.queryString !== '' && e.keyCode === 8 && lastWordRange.includes(this.mentionChar) && !this.isPopupOpen && !isNullOrUndefined(this.displayTemplate) &&
|
|
24658
24873
|
((typeof this.displayTemplate === 'function' ? this.displayTemplate() : this.displayTemplate)).includes(this.mentionChar)) {
|
|
24659
24874
|
this.queryString = '';
|
|
24660
24875
|
}
|