@syncfusion/ej2-treegrid 33.1.47 → 33.2.3

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,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 33.1.47
3
+ * version : 33.2.3
4
4
  * Copyright Syncfusion Inc. 2001 - 2025. All rights reserved.
5
5
  * Use of this code is subject to the terms of our license.
6
6
  * A copy of the current license can be obtained at any time by e-mailing
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syncfusion/ej2-treegrid",
3
- "version": "33.1.47",
3
+ "version": "33.2.3",
4
4
  "description": "Essential JS 2 TreeGrid Component",
5
5
  "author": "Syncfusion Inc.",
6
6
  "license": "SEE LICENSE IN license",
@@ -8,10 +8,10 @@
8
8
  "module": "./index.js",
9
9
  "es2015": "./dist/es6/ej2-treegrid.es5.js",
10
10
  "dependencies": {
11
- "@syncfusion/ej2-base": "~33.1.45",
12
- "@syncfusion/ej2-data": "~33.1.45",
13
- "@syncfusion/ej2-grids": "~33.1.47",
14
- "@syncfusion/ej2-popups": "~33.1.44"
11
+ "@syncfusion/ej2-base": "~33.2.3",
12
+ "@syncfusion/ej2-data": "~33.2.3",
13
+ "@syncfusion/ej2-grids": "~33.2.3",
14
+ "@syncfusion/ej2-popups": "~33.2.3"
15
15
  },
16
16
  "devDependencies": {},
17
17
  "keywords": [
@@ -1,6 +1,5 @@
1
1
  import { getObject, Filter as GridFilter, Grid } from '@syncfusion/ej2-grids';
2
2
  import { isNullOrUndefined, setValue, getValue } from '@syncfusion/ej2-base';
3
- import { getExpandStatus } from '../utils';
4
3
  import { getParentData } from '../utils';
5
4
  /**
6
5
  * TreeGrid Filter module will handle filtering action
@@ -98,27 +97,6 @@ var Filter = /** @class */ (function () {
98
97
  if (this.flatFilteredData.length > 0 && this.isHierarchyFilter) {
99
98
  this.updateFilterLevel();
100
99
  }
101
- if (hierarchyMode === 'None') {
102
- var _loop_1 = function (i) {
103
- var record = this_1.filteredResult[parseInt(i.toString(), 10)];
104
- if (!isNullOrUndefined(record.parentItem)) {
105
- var parentUID_1 = record.parentItem.uniqueID;
106
- var parentPresent = this_1.filteredResult.some(function (r) {
107
- return !isNullOrUndefined(r.uniqueID) && r.uniqueID === parentUID_1;
108
- });
109
- if (parentPresent) {
110
- setValue('isCollapsedChild', !getExpandStatus(this_1.parent, record, this_1.parent.parentData), record);
111
- }
112
- else {
113
- setValue('isCollapsedChild', false, record);
114
- }
115
- }
116
- };
117
- var this_1 = this;
118
- for (var i = 0; i < this.filteredResult.length; i++) {
119
- _loop_1(i);
120
- }
121
- }
122
100
  this.parent.notify('updateAction', { result: this.filteredResult });
123
101
  };
124
102
  Filter.prototype.updateParentFilteredRecord = function (record) {
@@ -243,9 +221,6 @@ var Filter = /** @class */ (function () {
243
221
  currentRecord.hasFilteredChildRecords = null;
244
222
  currentRecord.filterLevel = null;
245
223
  }
246
- if (!isNullOrUndefined(currentRecord.isCollapsedChild)) {
247
- currentRecord.isCollapsedChild = null;
248
- }
249
224
  }
250
225
  this.filteredResult = [];
251
226
  this.parent.notify('updateResults', { result: flatData, count: flatData.length });
@@ -576,7 +576,7 @@ var RowDD = /** @class */ (function () {
576
576
  this.removeLastrowBorder(rowEle);
577
577
  for (var i = 0; i < args.rows.length; i++) {
578
578
  if (!isNullOrUndefined(rowEle) && rowEle.getAttribute('data-uid') === args.rows[parseInt(i.toString(), 10)].getAttribute('data-uid')
579
- || !parentsUntil(args.target, 'e-gridcontent')) {
579
+ || !parentsUntil(args.target, 'e-gridcontent') || rowEle.classList.contains('e-summaryrow')) {
580
580
  this.dropPosition = 'Invalid';
581
581
  this.addErrorElem();
582
582
  if (isNullOrUndefined(this.parent.rowDropSettings.targetID)) {
@@ -1088,8 +1088,10 @@ var RowDD = /** @class */ (function () {
1088
1088
  RowDD.prototype.rowDropped = function (args) {
1089
1089
  if (!isNullOrUndefined(this.parent.aggregates[0]) && this.parent.aggregates[0].showChildSummary) {
1090
1090
  var records = this.parent.grid.getCurrentViewRecords();
1091
- args.fromIndex = records[args.fromIndex].index;
1092
- args.dropIndex = records[args.dropIndex].index;
1091
+ if (!isNullOrUndefined(records[records[args.fromIndex].index]) && !isNullOrUndefined(records[records[args.dropIndex].index])) {
1092
+ args.fromIndex = records[args.fromIndex].index;
1093
+ args.dropIndex = records[args.dropIndex].index;
1094
+ }
1093
1095
  }
1094
1096
  var tObj = this.parent;
1095
1097
  var parentItem = 'parentItem';
@@ -1614,14 +1616,16 @@ var RowDD = /** @class */ (function () {
1614
1616
  else {
1615
1617
  currentRecord = record.childRecords[parseInt(i.toString(), 10)];
1616
1618
  }
1617
- count++;
1618
- tObj.flatData.splice(count, 0, currentRecord);
1619
- setValue('uniqueIDCollection.' + currentRecord.uniqueID, currentRecord, this.parent);
1620
- if (tObj.parentIdMapping) {
1621
- this.treeData.splice(count, 0, currentRecord.taskData);
1622
- }
1623
- if (currentRecord.hasChildRecords) {
1624
- count = this.updateChildRecord(currentRecord, count);
1619
+ if (!isNullOrUndefined(currentRecord)) {
1620
+ count++;
1621
+ tObj.flatData.splice(count, 0, currentRecord);
1622
+ setValue('uniqueIDCollection.' + currentRecord.uniqueID, currentRecord, this.parent);
1623
+ if (tObj.parentIdMapping) {
1624
+ this.treeData.splice(count, 0, currentRecord.taskData);
1625
+ }
1626
+ if (currentRecord.hasChildRecords) {
1627
+ count = this.updateChildRecord(currentRecord, count);
1628
+ }
1625
1629
  }
1626
1630
  }
1627
1631
  return count;
@@ -1648,17 +1652,19 @@ var RowDD = /** @class */ (function () {
1648
1652
  else {
1649
1653
  currentRecord = record.childRecords[parseInt(i.toString(), 10)];
1650
1654
  }
1651
- var parentData = void 0;
1652
- if (record.parentItem) {
1653
- parentData = getParentData(this.parent, record.parentItem.uniqueID);
1654
- }
1655
- if (isNullOrUndefined(parentData) && !isNullOrUndefined(record.parentItem)) {
1656
- parentData = record.parentItem;
1657
- }
1658
- currentRecord.level = record.parentItem ? parentData.level + level : record.level + 1;
1659
- if (currentRecord.hasChildRecords) {
1660
- level--;
1661
- level = this.updateChildRecordLevel(currentRecord, level);
1655
+ if (!isNullOrUndefined(currentRecord)) {
1656
+ var parentData = void 0;
1657
+ if (record.parentItem) {
1658
+ parentData = getParentData(this.parent, record.parentItem.uniqueID);
1659
+ }
1660
+ if (isNullOrUndefined(parentData) && !isNullOrUndefined(record.parentItem)) {
1661
+ parentData = record.parentItem;
1662
+ }
1663
+ currentRecord.level = record.parentItem ? parentData.level + level : record.level + 1;
1664
+ if (currentRecord.hasChildRecords) {
1665
+ level--;
1666
+ level = this.updateChildRecordLevel(currentRecord, level);
1667
+ }
1662
1668
  }
1663
1669
  }
1664
1670
  return level;
@@ -1788,22 +1794,29 @@ var RowDD = /** @class */ (function () {
1788
1794
  treeGridData = this.parent.dataSource;
1789
1795
  }
1790
1796
  for (var i_2 = 0; i_2 < treeGridData.length; i_2++) {
1791
- if (treeGridData[parseInt(i_2.toString(), 10)][this.parent.idMapping] === currentRecord.taskData[this.parent.idMapping]) {
1792
- idx = i_2;
1797
+ if (!isNullOrUndefined(currentRecord.taskData)) {
1798
+ if (treeGridData[parseInt(i_2.toString(), 10)][this.parent.idMapping] === currentRecord.taskData[this.parent.idMapping]) {
1799
+ idx = i_2;
1800
+ break;
1801
+ }
1793
1802
  }
1794
1803
  }
1795
1804
  for (var i_3 = 0; i_3 < this.treeGridData.length; i_3++) {
1796
- if (this.treeGridData[parseInt(i_3.toString(), 10)][this.parent.idMapping]
1797
- === currentRecord.taskData[this.parent.idMapping]) {
1798
- idz = i_3;
1799
- break;
1805
+ if (!isNullOrUndefined(currentRecord.taskData)) {
1806
+ if (this.treeGridData[parseInt(i_3.toString(), 10)][this.parent.idMapping]
1807
+ === currentRecord.taskData[this.parent.idMapping]) {
1808
+ idz = i_3;
1809
+ break;
1810
+ }
1800
1811
  }
1801
1812
  }
1802
1813
  if (idx !== -1 && !isNullOrUndefined(idx)) {
1803
1814
  dataSource.splice(idx, 1);
1815
+ idx = -1;
1804
1816
  }
1805
1817
  if (idz !== -1 && !isNullOrUndefined(idz)) {
1806
1818
  this.treeGridData.splice(idz, 1);
1819
+ idz = -1;
1807
1820
  }
1808
1821
  if (currentRecord.hasChildRecords) {
1809
1822
  this.removeChildItem(currentRecord);
@@ -1824,7 +1837,7 @@ var RowDD = /** @class */ (function () {
1824
1837
  }
1825
1838
  for (var i = 0; i < record.childRecords.length; i++) {
1826
1839
  currentRecord = record.childRecords[parseInt(i.toString(), 10)];
1827
- count++;
1840
+ count = currentRecord.isSummaryRow ? count : count + 1;
1828
1841
  if (currentRecord.hasChildRecords) {
1829
1842
  count = this.getChildCount(currentRecord, count);
1830
1843
  }
@@ -66,6 +66,7 @@ export declare class VirtualScroll {
66
66
  * @returns {void}
67
67
  */
68
68
  private virtualPageAction;
69
+ private adjustRangeForExpandCollapse;
69
70
  /**
70
71
  * To destroy the virtualScroll module
71
72
  *
@@ -135,7 +135,13 @@ var VirtualScroll = /** @class */ (function () {
135
135
  var isFlatHierarchy = this.parent.filterSettings.hierarchyMode === 'Child' ||
136
136
  this.parent.filterSettings.hierarchyMode === 'None';
137
137
  var visualData = isFiltering && isFlatHierarchy
138
- ? parents
138
+ ? parents.filter(function (e) {
139
+ if (isNullOrUndefined(e.parentItem)) {
140
+ return true;
141
+ }
142
+ var hasParentInFilteredList = parents.some(function (p) { return p.uniqueID === e.parentItem.uniqueID; });
143
+ return hasParentInFilteredList ? getExpandStatus(_this.parent, e, parents) : true;
144
+ })
139
145
  : parents.filter(function (e) { return getExpandStatus(_this.parent, e, parents); });
140
146
  this.visualData = visualData;
141
147
  pageingDetails.count = visualData.length;
@@ -191,28 +197,9 @@ var VirtualScroll = /** @class */ (function () {
191
197
  endIndex = startIndex + this.parent.grid.pageSettings.pageSize;
192
198
  }
193
199
  if (!isNullOrUndefined(this.expandCollapseRec)) {
194
- var resourceCount = this.parent.grid.pageSettings.pageSize;
195
- var sIndex = visualData.indexOf(this.expandCollapseRec);
196
- var tempdata = visualData.slice(sIndex, sIndex + resourceCount);
197
- if (tempdata.length < resourceCount && sIndex >= 0 && startIndex !== 0) {
198
- sIndex = visualData.length - resourceCount;
199
- sIndex = sIndex > 0 ? sIndex : 0;
200
- endIndex = visualData.length;
201
- if (endIndex - startIndex < resourceCount) {
202
- var newRowsCount = sIndex - startIndex;
203
- startIndex = sIndex;
204
- if (visualData.indexOf(this.expandCollapseRec) > visualData.length - resourceCount / 2) {
205
- var newTranslateY = startIndex * this.parent.grid.getRowHeight();
206
- this.parent.grid.contentModule['translateY'] = newTranslateY;
207
- this.parent.grid.contentModule.virtualEle.adjustTable(0, newTranslateY);
208
- }
209
- }
210
- }
211
- else if (getValue('isCollapseAll', this.parent)) {
212
- startIndex = 0;
213
- endIndex = this.parent.grid.pageSettings.pageSize - 1;
214
- this.parent.grid.notify(events.virtualActionArgs, { setTop: true });
215
- }
200
+ var result = this.adjustRangeForExpandCollapse(startIndex, endIndex, visualData);
201
+ startIndex = result.startIndex;
202
+ endIndex = result.endIndex;
216
203
  }
217
204
  //}
218
205
  if (this.prevrequestType === 'collapseAll' && pageingDetails.actionArgs.requestType === 'virtualscroll'
@@ -243,6 +230,30 @@ var VirtualScroll = /** @class */ (function () {
243
230
  }
244
231
  this.parent.notify('updateAction', pageingDetails);
245
232
  };
233
+ VirtualScroll.prototype.adjustRangeForExpandCollapse = function (startIndex, endIndex, visualData) {
234
+ var pageSize = this.parent.grid.pageSettings.pageSize;
235
+ var expandedRecordIndex = visualData.indexOf(this.expandCollapseRec);
236
+ var pageWindowRecords = visualData.slice(expandedRecordIndex, expandedRecordIndex + pageSize);
237
+ if (pageWindowRecords.length < pageSize && expandedRecordIndex >= 0 && startIndex !== 0) {
238
+ var startForLastPage = visualData.length - pageSize;
239
+ startForLastPage = startForLastPage > 0 ? startForLastPage : 0;
240
+ endIndex = visualData.length;
241
+ if (endIndex - startIndex < pageSize) {
242
+ startIndex = startForLastPage;
243
+ if (expandedRecordIndex > visualData.length - pageSize / 2) {
244
+ var viewportTranslateY = startIndex * this.parent.grid.getRowHeight();
245
+ this.parent.grid.contentModule['translateY'] = viewportTranslateY;
246
+ this.parent.grid.contentModule.virtualEle.adjustTable(0, viewportTranslateY);
247
+ }
248
+ }
249
+ }
250
+ else if (getValue('isCollapseAll', this.parent)) {
251
+ startIndex = 0;
252
+ endIndex = this.parent.grid.pageSettings.pageSize - 1;
253
+ this.parent.grid.notify(events.virtualActionArgs, { setTop: true });
254
+ }
255
+ return { startIndex: startIndex, endIndex: endIndex };
256
+ };
246
257
  /**
247
258
  * To destroy the virtualScroll module
248
259
  *
@@ -66,10 +66,6 @@ export interface ITreeData {
66
66
  * Specifies the Primary data
67
67
  */
68
68
  primaryParent?: ITreeData;
69
- /**
70
- * Specifies the child record collapsed state
71
- */
72
- isCollapsedChild?: ITreeData;
73
69
  }
74
70
  /** Specifies the Tree Grid ExcelExport properties */
75
71
  export interface TreeGridExcelExportProperties extends ExcelExportProperties {
@@ -895,7 +895,7 @@ var TreeGrid = /** @class */ (function (_super) {
895
895
  var portals = 'portals';
896
896
  if (!(_this.isReact && isNullOrUndefined(_this["" + portals]))) {
897
897
  var isGantt = _this['isFromGantt'] && !isNullOrUndefined(_this['root'].clearTemplate) &&
898
- _this['root'].chartRowsModule['isGridRowRefreshed'];
898
+ (_this['root'].chartRowsModule['isGridRowRefreshed'] || _this['root']['registeredTemplate']);
899
899
  if (isGantt) {
900
900
  _this['root'].clearTemplate(args, index, callback);
901
901
  }
@@ -32,16 +32,6 @@ var Render = /** @class */ (function () {
32
32
  }
33
33
  var data = args.data;
34
34
  var parentData = data.parentItem;
35
- if (!isNullOrUndefined(parentData) && data.isCollapsedChild && !isNullOrUndefined(args.row)) {
36
- this.parent['toggleRowVisibility'](args.row, 'e-childrow-hidden');
37
- var rowsObj = this.parent.grid.getRowsObject();
38
- if (!this.parent.grid.isFrozenGrid() && !isNullOrUndefined(args.row.getAttribute('data-uid'))) {
39
- var row = rowsObj.filter(function (e) { return e.uid === args.row.getAttribute('data-uid'); })[0];
40
- if (row) {
41
- row.visible = false;
42
- }
43
- }
44
- }
45
35
  if (!isNullOrUndefined(data.parentItem) && !isFilterChildHierarchy(this.parent) &&
46
36
  (!(this.parent.allowPaging && !(this.parent.pageSettings.pageSizeMode === 'Root')) ||
47
37
  (isRemoteData(this.parent) && !isOffline(this.parent)))) {
@@ -713,7 +713,7 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
713
713
  this.parent.root.scrollPosition = scrollArgs.offset;
714
714
  }
715
715
  var info = scrollArgs.sentinel;
716
- var rowHeight = this.parent.getRowHeight();
716
+ var rowHeight = parseInt(this.parent.getRowHeight().toString(), 10);
717
717
  var outBuffer = this.parent.pageSettings.pageSize - Math.ceil(this.parent.pageSettings.pageSize / 2);
718
718
  var content;
719
719
  if (!isNullOrUndefined(this.parent.contentModule)) {