@syncfusion/ej2-dropdowns 34.2.4 → 34.2.5

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.
@@ -1,12 +1,3 @@
1
- /*!
2
- * filename: index.d.ts
3
- * version : 34.2.4
4
- * Copyright Syncfusion Inc. 2001 - 2025. All rights reserved.
5
- * Use of this code is subject to the terms of our license.
6
- * A copy of the current license can be obtained at any time by e-mailing
7
- * licensing@syncfusion.com. Any infringement will be prosecuted under
8
- * applicable laws.
9
- */
10
1
  import * as _dropdowns from '@syncfusion/ej2-dropdowns';
11
2
 
12
3
  export declare namespace ej {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syncfusion/ej2-dropdowns",
3
- "version": "34.2.4",
3
+ "version": "34.2.5",
4
4
  "description": "Essential JS 2 DropDown Components",
5
5
  "author": "Syncfusion Inc.",
6
6
  "license": "SEE LICENSE IN license",
@@ -8,11 +8,11 @@
8
8
  "module": "./index.js",
9
9
  "es2015": "./dist/es6/ej2-dropdowns.es5.js",
10
10
  "dependencies": {
11
- "@syncfusion/ej2-base": "~34.2.4",
11
+ "@syncfusion/ej2-base": "~34.2.5",
12
12
  "@syncfusion/ej2-data": "~34.2.2",
13
13
  "@syncfusion/ej2-inputs": "~34.2.2",
14
14
  "@syncfusion/ej2-lists": "~34.2.2",
15
- "@syncfusion/ej2-navigations": "~34.2.4",
15
+ "@syncfusion/ej2-navigations": "~34.2.5",
16
16
  "@syncfusion/ej2-notifications": "~34.2.2",
17
17
  "@syncfusion/ej2-popups": "~34.2.4"
18
18
  },
@@ -846,6 +846,7 @@ export declare class DropDownTree extends Component<HTMLElement> implements INot
846
846
  private getNestedItems;
847
847
  private getChildType;
848
848
  private renderTree;
849
+ private updateIndeterminateNodes;
849
850
  private renderPopup;
850
851
  private checkCollision;
851
852
  private removeFocus;
@@ -1680,8 +1680,129 @@ var DropDownTree = /** @class */ (function (_super) {
1680
1680
  checkOnClick: true
1681
1681
  });
1682
1682
  this.treeObj.root = this.root ? this.root : this;
1683
+ this.treeObj.filterIndeterminateNodes = [];
1684
+ this.treeObj.filterCheckedNodes = [];
1683
1685
  this.treeObj.appendTo(this.tree);
1684
1686
  };
1687
+ DropDownTree.prototype.updateIndeterminateNodes = function () {
1688
+ if (!(this.allowFiltering && this.treeSettings.autoCheck) || (this.isRemoteData || this.treeSettings.loadOnDemand)) {
1689
+ return;
1690
+ }
1691
+ var checkedNodes = Array.isArray(this.value) ? this.value.slice() : [];
1692
+ var checkedSet = {};
1693
+ for (var i = 0; i < checkedNodes.length; i++) {
1694
+ checkedSet[checkedNodes[i]] = true;
1695
+ }
1696
+ var treeData = this.treeObj.element.classList.contains('e-filtering') ? this.treeData : this.treeItems;
1697
+ var valueField = this.fields.value;
1698
+ var parentValueField = this.fields.parentValue;
1699
+ var hasChildrenField = this.fields.hasChildren;
1700
+ var childField = this.fields.child;
1701
+ var indeterminateNodes = [];
1702
+ var childrenMap = {};
1703
+ for (var i = 0; i < treeData.length; i++) {
1704
+ var node = treeData[i];
1705
+ var nodeId = getValue(valueField, node);
1706
+ var nodePid = getValue(parentValueField, node);
1707
+ if (isNOU(node) || isNOU(nodeId) || isNOU(nodePid)) {
1708
+ continue;
1709
+ }
1710
+ var parentId = nodePid.toString();
1711
+ if (!childrenMap[parentId]) {
1712
+ childrenMap[parentId] = [];
1713
+ }
1714
+ childrenMap[parentId].push(nodeId.toString());
1715
+ }
1716
+ var allNodes = treeData.slice();
1717
+ if (!isNOU(childField)) {
1718
+ var collectNestedChildren_1 = function (nodes, fields) {
1719
+ if (!nodes) {
1720
+ return;
1721
+ }
1722
+ for (var i = 0; i < nodes.length; i++) {
1723
+ var node = nodes[i];
1724
+ if (isNOU(node)) {
1725
+ continue;
1726
+ }
1727
+ var nodeId = getValue(fields.value, node);
1728
+ if (isNOU(nodeId)) {
1729
+ continue;
1730
+ }
1731
+ allNodes.push(node);
1732
+ var childMapper = fields.child;
1733
+ var childrenArr = void 0;
1734
+ if (typeof childMapper === 'string') {
1735
+ childrenArr = node[childMapper];
1736
+ }
1737
+ else if (!isNOU(childMapper)) {
1738
+ childrenArr = node[childMapper.value];
1739
+ }
1740
+ else {
1741
+ childrenArr = null;
1742
+ }
1743
+ if (!isNOU(childrenArr) && Array.isArray(childrenArr) && childrenArr.length) {
1744
+ var parentId = nodeId.toString();
1745
+ if (!childrenMap[parentId]) {
1746
+ childrenMap[parentId] = [];
1747
+ }
1748
+ for (var k = 0; k < childrenArr.length; k++) {
1749
+ var childId = getValue(fields.value, childrenArr[k]);
1750
+ if (!isNOU(childId) && childrenMap[parentId].indexOf(childId.toString()) === -1) {
1751
+ childrenMap[parentId].push(childId.toString());
1752
+ }
1753
+ }
1754
+ var nextFields = (typeof childMapper !== 'string' && !isNOU(childMapper)) ?
1755
+ childMapper : fields;
1756
+ collectNestedChildren_1(childrenArr, nextFields);
1757
+ }
1758
+ }
1759
+ };
1760
+ collectNestedChildren_1(treeData, this.fields);
1761
+ }
1762
+ for (var i = 0; i < allNodes.length; i++) {
1763
+ var node = allNodes[i];
1764
+ var nodeId = getValue(valueField, node);
1765
+ if (isNOU(node) || isNOU(nodeId)) {
1766
+ continue;
1767
+ }
1768
+ var nodeIdStr = nodeId.toString();
1769
+ if (hasChildrenField && getValue(hasChildrenField, node) === false) {
1770
+ continue;
1771
+ }
1772
+ if (checkedSet[nodeIdStr]) {
1773
+ continue;
1774
+ }
1775
+ var descendants = [];
1776
+ var queue = childrenMap[nodeIdStr] ? childrenMap[nodeIdStr].slice() : [];
1777
+ var head = 0;
1778
+ while (head < queue.length) {
1779
+ var current = queue[head];
1780
+ head++;
1781
+ descendants.push(current);
1782
+ var kids = childrenMap[current];
1783
+ if (kids) {
1784
+ for (var j = 0; j < kids.length; j++) {
1785
+ queue.push(kids[j]);
1786
+ }
1787
+ }
1788
+ }
1789
+ if (descendants.length === 0) {
1790
+ continue;
1791
+ }
1792
+ var checkedDescendantCount = 0;
1793
+ for (var j = 0; j < descendants.length; j++) {
1794
+ if (checkedSet[descendants[j]]) {
1795
+ checkedDescendantCount++;
1796
+ }
1797
+ }
1798
+ if (checkedDescendantCount > 0 && checkedDescendantCount < descendants.length &&
1799
+ indeterminateNodes.indexOf(nodeIdStr) === -1) {
1800
+ indeterminateNodes.push(nodeIdStr);
1801
+ }
1802
+ }
1803
+ this.treeObj.filterCheckedNodes = checkedNodes;
1804
+ this.treeObj.filterIndeterminateNodes = indeterminateNodes;
1805
+ };
1685
1806
  /* To render the popup element */
1686
1807
  DropDownTree.prototype.renderPopup = function () {
1687
1808
  var _this = this;
@@ -1982,6 +2103,7 @@ var DropDownTree = /** @class */ (function (_super) {
1982
2103
  this.isFilterRestore = false;
1983
2104
  }
1984
2105
  }
2106
+ this.updateIndeterminateNodes();
1985
2107
  };
1986
2108
  DropDownTree.prototype.restoreFilterSelection = function () {
1987
2109
  if (this.treeObj.checkedNodes) {
@@ -2264,17 +2386,21 @@ var DropDownTree = /** @class */ (function (_super) {
2264
2386
  this.triggerChangeEvent(this.keyEventArgs);
2265
2387
  this.isValueChange = false;
2266
2388
  }
2267
- var treeData = this.treeObj.getTreeData();
2268
- if (this.showCheckBox && this.treeSettings.autoCheck && treeData.length > 0 && this.treeData && this.treeData.length > 0) {
2269
- for (var i = 0; i < treeData.length; i++) {
2270
- for (var j = 0; j < this.treeData.length; j++) {
2271
- if (treeData[i].id === this.treeData[j].id) {
2272
- this.treeData[j].selected = treeData[i].selected !== undefined ?
2273
- treeData[i].selected : false;
2389
+ if (!this.isRemoteData && !this.treeSettings.loadOnDemand) {
2390
+ var treeData = this.treeObj.getTreeData();
2391
+ if (this.showCheckBox && this.treeSettings.autoCheck &&
2392
+ treeData.length > 0 && this.treeData && this.treeData.length > 0) {
2393
+ for (var i = 0; i < treeData.length; i++) {
2394
+ for (var j = 0; j < this.treeData.length; j++) {
2395
+ if (treeData[i][this.fields.value] === this.treeData[j][this.fields.value]) {
2396
+ this.treeData[j].selected = treeData[i].selected !== undefined ?
2397
+ treeData[i].selected : false;
2398
+ }
2274
2399
  }
2275
2400
  }
2276
2401
  }
2277
2402
  }
2403
+ this.updateIndeterminateNodes();
2278
2404
  };
2279
2405
  DropDownTree.prototype.beforeCheck = function (args) {
2280
2406
  if (args.isInteracted) {
@@ -2764,7 +2890,8 @@ var DropDownTree = /** @class */ (function (_super) {
2764
2890
  if (!this.isFilteredData) {
2765
2891
  this.selectedData = [];
2766
2892
  }
2767
- if (this.treeSettings.autoCheck && this.isFilteredData && !isNOU(this.value)) {
2893
+ if (!this.isRemoteData && !this.treeSettings.loadOnDemand && this.treeSettings.autoCheck &&
2894
+ this.isFilteredData && !isNOU(this.value)) {
2768
2895
  this.updateFilteredAutoCheckValues();
2769
2896
  }
2770
2897
  if (!isNOU(this.value)) {
@@ -2843,6 +2970,7 @@ var DropDownTree = /** @class */ (function (_super) {
2843
2970
  else {
2844
2971
  this.inputWrapper.setAttribute('aria-label', this.getModuleName());
2845
2972
  }
2973
+ this.updateIndeterminateNodes();
2846
2974
  };
2847
2975
  DropDownTree.prototype.setChipValues = function (text, value) {
2848
2976
  if (!this.inputWrapper.contains(this.chipWrapper)) {