@syncfusion/ej2-treegrid 33.1.46 → 33.1.49

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.
@@ -2180,16 +2180,6 @@ var Render = /** @__PURE__ @class */ (function () {
2180
2180
  }
2181
2181
  var data = args.data;
2182
2182
  var parentData = data.parentItem;
2183
- if (!isNullOrUndefined(parentData) && data.isCollapsedChild && !isNullOrUndefined(args.row)) {
2184
- this.parent['toggleRowVisibility'](args.row, 'e-childrow-hidden');
2185
- var rowsObj = this.parent.grid.getRowsObject();
2186
- if (!this.parent.grid.isFrozenGrid() && !isNullOrUndefined(args.row.getAttribute('data-uid'))) {
2187
- var row = rowsObj.filter(function (e) { return e.uid === args.row.getAttribute('data-uid'); })[0];
2188
- if (row) {
2189
- row.visible = false;
2190
- }
2191
- }
2192
- }
2193
2183
  if (!isNullOrUndefined(data.parentItem) && !isFilterChildHierarchy(this.parent) &&
2194
2184
  (!(this.parent.allowPaging && !(this.parent.pageSettings.pageSizeMode === 'Root')) ||
2195
2185
  (isRemoteData(this.parent) && !isOffline(this.parent)))) {
@@ -10196,7 +10186,7 @@ var RowDD = /** @__PURE__ @class */ (function () {
10196
10186
  this.removeLastrowBorder(rowEle);
10197
10187
  for (var i = 0; i < args.rows.length; i++) {
10198
10188
  if (!isNullOrUndefined(rowEle) && rowEle.getAttribute('data-uid') === args.rows[parseInt(i.toString(), 10)].getAttribute('data-uid')
10199
- || !parentsUntil(args.target, 'e-gridcontent')) {
10189
+ || !parentsUntil(args.target, 'e-gridcontent') || rowEle.classList.contains('e-summaryrow')) {
10200
10190
  this.dropPosition = 'Invalid';
10201
10191
  this.addErrorElem();
10202
10192
  if (isNullOrUndefined(this.parent.rowDropSettings.targetID)) {
@@ -10708,8 +10698,10 @@ var RowDD = /** @__PURE__ @class */ (function () {
10708
10698
  RowDD.prototype.rowDropped = function (args) {
10709
10699
  if (!isNullOrUndefined(this.parent.aggregates[0]) && this.parent.aggregates[0].showChildSummary) {
10710
10700
  var records = this.parent.grid.getCurrentViewRecords();
10711
- args.fromIndex = records[args.fromIndex].index;
10712
- args.dropIndex = records[args.dropIndex].index;
10701
+ if (!isNullOrUndefined(records[records[args.fromIndex].index]) && !isNullOrUndefined(records[records[args.dropIndex].index])) {
10702
+ args.fromIndex = records[args.fromIndex].index;
10703
+ args.dropIndex = records[args.dropIndex].index;
10704
+ }
10713
10705
  }
10714
10706
  var tObj = this.parent;
10715
10707
  var parentItem = 'parentItem';
@@ -11234,14 +11226,16 @@ var RowDD = /** @__PURE__ @class */ (function () {
11234
11226
  else {
11235
11227
  currentRecord = record.childRecords[parseInt(i.toString(), 10)];
11236
11228
  }
11237
- count++;
11238
- tObj.flatData.splice(count, 0, currentRecord);
11239
- setValue('uniqueIDCollection.' + currentRecord.uniqueID, currentRecord, this.parent);
11240
- if (tObj.parentIdMapping) {
11241
- this.treeData.splice(count, 0, currentRecord.taskData);
11242
- }
11243
- if (currentRecord.hasChildRecords) {
11244
- count = this.updateChildRecord(currentRecord, count);
11229
+ if (!isNullOrUndefined(currentRecord)) {
11230
+ count++;
11231
+ tObj.flatData.splice(count, 0, currentRecord);
11232
+ setValue('uniqueIDCollection.' + currentRecord.uniqueID, currentRecord, this.parent);
11233
+ if (tObj.parentIdMapping) {
11234
+ this.treeData.splice(count, 0, currentRecord.taskData);
11235
+ }
11236
+ if (currentRecord.hasChildRecords) {
11237
+ count = this.updateChildRecord(currentRecord, count);
11238
+ }
11245
11239
  }
11246
11240
  }
11247
11241
  return count;
@@ -11268,17 +11262,19 @@ var RowDD = /** @__PURE__ @class */ (function () {
11268
11262
  else {
11269
11263
  currentRecord = record.childRecords[parseInt(i.toString(), 10)];
11270
11264
  }
11271
- var parentData = void 0;
11272
- if (record.parentItem) {
11273
- parentData = getParentData(this.parent, record.parentItem.uniqueID);
11274
- }
11275
- if (isNullOrUndefined(parentData) && !isNullOrUndefined(record.parentItem)) {
11276
- parentData = record.parentItem;
11277
- }
11278
- currentRecord.level = record.parentItem ? parentData.level + level : record.level + 1;
11279
- if (currentRecord.hasChildRecords) {
11280
- level--;
11281
- level = this.updateChildRecordLevel(currentRecord, level);
11265
+ if (!isNullOrUndefined(currentRecord)) {
11266
+ var parentData = void 0;
11267
+ if (record.parentItem) {
11268
+ parentData = getParentData(this.parent, record.parentItem.uniqueID);
11269
+ }
11270
+ if (isNullOrUndefined(parentData) && !isNullOrUndefined(record.parentItem)) {
11271
+ parentData = record.parentItem;
11272
+ }
11273
+ currentRecord.level = record.parentItem ? parentData.level + level : record.level + 1;
11274
+ if (currentRecord.hasChildRecords) {
11275
+ level--;
11276
+ level = this.updateChildRecordLevel(currentRecord, level);
11277
+ }
11282
11278
  }
11283
11279
  }
11284
11280
  return level;
@@ -11408,22 +11404,29 @@ var RowDD = /** @__PURE__ @class */ (function () {
11408
11404
  treeGridData = this.parent.dataSource;
11409
11405
  }
11410
11406
  for (var i_2 = 0; i_2 < treeGridData.length; i_2++) {
11411
- if (treeGridData[parseInt(i_2.toString(), 10)][this.parent.idMapping] === currentRecord.taskData[this.parent.idMapping]) {
11412
- idx = i_2;
11407
+ if (!isNullOrUndefined(currentRecord.taskData)) {
11408
+ if (treeGridData[parseInt(i_2.toString(), 10)][this.parent.idMapping] === currentRecord.taskData[this.parent.idMapping]) {
11409
+ idx = i_2;
11410
+ break;
11411
+ }
11413
11412
  }
11414
11413
  }
11415
11414
  for (var i_3 = 0; i_3 < this.treeGridData.length; i_3++) {
11416
- if (this.treeGridData[parseInt(i_3.toString(), 10)][this.parent.idMapping]
11417
- === currentRecord.taskData[this.parent.idMapping]) {
11418
- idz = i_3;
11419
- break;
11415
+ if (!isNullOrUndefined(currentRecord.taskData)) {
11416
+ if (this.treeGridData[parseInt(i_3.toString(), 10)][this.parent.idMapping]
11417
+ === currentRecord.taskData[this.parent.idMapping]) {
11418
+ idz = i_3;
11419
+ break;
11420
+ }
11420
11421
  }
11421
11422
  }
11422
11423
  if (idx !== -1 && !isNullOrUndefined(idx)) {
11423
11424
  dataSource.splice(idx, 1);
11425
+ idx = -1;
11424
11426
  }
11425
11427
  if (idz !== -1 && !isNullOrUndefined(idz)) {
11426
11428
  this.treeGridData.splice(idz, 1);
11429
+ idz = -1;
11427
11430
  }
11428
11431
  if (currentRecord.hasChildRecords) {
11429
11432
  this.removeChildItem(currentRecord);
@@ -11444,7 +11447,7 @@ var RowDD = /** @__PURE__ @class */ (function () {
11444
11447
  }
11445
11448
  for (var i = 0; i < record.childRecords.length; i++) {
11446
11449
  currentRecord = record.childRecords[parseInt(i.toString(), 10)];
11447
- count++;
11450
+ count = currentRecord.isSummaryRow ? count : count + 1;
11448
11451
  if (currentRecord.hasChildRecords) {
11449
11452
  count = this.getChildCount(currentRecord, count);
11450
11453
  }
@@ -11760,25 +11763,6 @@ var Filter = /** @__PURE__ @class */ (function () {
11760
11763
  if (this.flatFilteredData.length > 0 && this.isHierarchyFilter) {
11761
11764
  this.updateFilterLevel();
11762
11765
  }
11763
- var _loop_1 = function (i) {
11764
- var record = this_1.filteredResult[parseInt(i.toString(), 10)];
11765
- if (!isNullOrUndefined(record.parentItem)) {
11766
- var parentUID_1 = record.parentItem.uniqueID;
11767
- var parentPresent = this_1.filteredResult.some(function (r) {
11768
- return !isNullOrUndefined(r.uniqueID) && r.uniqueID === parentUID_1;
11769
- });
11770
- if (parentPresent) {
11771
- record.isCollapsedChild = !getExpandStatus(this_1.parent, record, this_1.parent.parentData);
11772
- }
11773
- else {
11774
- record.isCollapsedChild = false;
11775
- }
11776
- }
11777
- };
11778
- var this_1 = this;
11779
- for (var i = 0; i < this.filteredResult.length; i++) {
11780
- _loop_1(i);
11781
- }
11782
11766
  this.parent.notify('updateAction', { result: this.filteredResult });
11783
11767
  };
11784
11768
  Filter.prototype.updateParentFilteredRecord = function (record) {
@@ -15966,7 +15950,7 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
15966
15950
  this.parent.root.scrollPosition = scrollArgs.offset;
15967
15951
  }
15968
15952
  var info = scrollArgs.sentinel;
15969
- var rowHeight = this.parent.getRowHeight();
15953
+ var rowHeight = parseInt(this.parent.getRowHeight().toString(), 10);
15970
15954
  var outBuffer = this.parent.pageSettings.pageSize - Math.ceil(this.parent.pageSettings.pageSize / 2);
15971
15955
  var content;
15972
15956
  if (!isNullOrUndefined(this.parent.contentModule)) {
@@ -16564,7 +16548,13 @@ var VirtualScroll = /** @__PURE__ @class */ (function () {
16564
16548
  var isFlatHierarchy = this.parent.filterSettings.hierarchyMode === 'Child' ||
16565
16549
  this.parent.filterSettings.hierarchyMode === 'None';
16566
16550
  var visualData = isFiltering && isFlatHierarchy
16567
- ? parents
16551
+ ? parents.filter(function (e) {
16552
+ if (isNullOrUndefined(e.parentItem)) {
16553
+ return true;
16554
+ }
16555
+ var hasParentInFilteredList = parents.some(function (p) { return p.uniqueID === e.parentItem.uniqueID; });
16556
+ return hasParentInFilteredList ? getExpandStatus(_this.parent, e) : true;
16557
+ })
16568
16558
  : parents.filter(function (e) { return getExpandStatus(_this.parent, e); });
16569
16559
  this.visualData = visualData;
16570
16560
  pageingDetails.count = visualData.length;
@@ -16620,27 +16610,9 @@ var VirtualScroll = /** @__PURE__ @class */ (function () {
16620
16610
  endIndex = startIndex + this.parent.grid.pageSettings.pageSize;
16621
16611
  }
16622
16612
  if (!isNullOrUndefined(this.expandCollapseRec)) {
16623
- var resourceCount = this.parent.grid.pageSettings.pageSize;
16624
- var sIndex = visualData.indexOf(this.expandCollapseRec);
16625
- var tempdata = visualData.slice(sIndex, sIndex + resourceCount);
16626
- if (tempdata.length < resourceCount && sIndex >= 0 && startIndex !== 0) {
16627
- sIndex = visualData.length - resourceCount;
16628
- sIndex = sIndex > 0 ? sIndex : 0;
16629
- endIndex = visualData.length;
16630
- if (endIndex - startIndex < resourceCount) {
16631
- startIndex = sIndex;
16632
- if (visualData.indexOf(this.expandCollapseRec) > visualData.length - resourceCount / 2) {
16633
- var newTranslateY = startIndex * this.parent.grid.getRowHeight();
16634
- this.parent.grid.contentModule['translateY'] = newTranslateY;
16635
- this.parent.grid.contentModule.virtualEle.adjustTable(0, newTranslateY);
16636
- }
16637
- }
16638
- }
16639
- else if (getValue('isCollapseAll', this.parent)) {
16640
- startIndex = 0;
16641
- endIndex = this.parent.grid.pageSettings.pageSize - 1;
16642
- this.parent.grid.notify(virtualActionArgs, { setTop: true });
16643
- }
16613
+ var result = this.adjustRangeForExpandCollapse(startIndex, endIndex, visualData);
16614
+ startIndex = result.startIndex;
16615
+ endIndex = result.endIndex;
16644
16616
  }
16645
16617
  //}
16646
16618
  if (this.prevrequestType === 'collapseAll' && pageingDetails.actionArgs.requestType === 'virtualscroll'
@@ -16671,6 +16643,30 @@ var VirtualScroll = /** @__PURE__ @class */ (function () {
16671
16643
  }
16672
16644
  this.parent.notify('updateAction', pageingDetails);
16673
16645
  };
16646
+ VirtualScroll.prototype.adjustRangeForExpandCollapse = function (startIndex, endIndex, visualData) {
16647
+ var pageSize = this.parent.grid.pageSettings.pageSize;
16648
+ var expandedRecordIndex = visualData.indexOf(this.expandCollapseRec);
16649
+ var pageWindowRecords = visualData.slice(expandedRecordIndex, expandedRecordIndex + pageSize);
16650
+ if (pageWindowRecords.length < pageSize && expandedRecordIndex >= 0 && startIndex !== 0) {
16651
+ var startForLastPage = visualData.length - pageSize;
16652
+ startForLastPage = startForLastPage > 0 ? startForLastPage : 0;
16653
+ endIndex = visualData.length;
16654
+ if (endIndex - startIndex < pageSize) {
16655
+ startIndex = startForLastPage;
16656
+ if (expandedRecordIndex > visualData.length - pageSize / 2) {
16657
+ var viewportTranslateY = startIndex * this.parent.grid.getRowHeight();
16658
+ this.parent.grid.contentModule['translateY'] = viewportTranslateY;
16659
+ this.parent.grid.contentModule.virtualEle.adjustTable(0, viewportTranslateY);
16660
+ }
16661
+ }
16662
+ }
16663
+ else if (getValue('isCollapseAll', this.parent)) {
16664
+ startIndex = 0;
16665
+ endIndex = this.parent.grid.pageSettings.pageSize - 1;
16666
+ this.parent.grid.notify(virtualActionArgs, { setTop: true });
16667
+ }
16668
+ return { startIndex: startIndex, endIndex: endIndex };
16669
+ };
16674
16670
  /**
16675
16671
  * To destroy the virtualScroll module
16676
16672
  *