@syncfusion/ej2-treegrid 26.2.8 → 26.2.9

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.
@@ -4865,6 +4865,16 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4865
4865
  _this.grid.selectionModule["" + updateRowSelection](_this.getRows()[parseInt(index.toString(), 10)], index);
4866
4866
  }
4867
4867
  }
4868
+ if (_this.enableVirtualization && _this.selectionSettings.persistSelection
4869
+ && !isNullOrUndefined(_this.virtualScrollModule.prevSelectedRecord)) {
4870
+ for (var i = 0; i < _this.virtualScrollModule.prevSelectedRecord.length; i++) {
4871
+ var updateRowSelection = 'updateRowSelection';
4872
+ var index =
4873
+ // eslint-disable-next-line max-len
4874
+ _this.getCurrentViewRecords().indexOf(_this.virtualScrollModule.prevSelectedRecord[parseInt(i.toString(), 10)]);
4875
+ _this.grid.selectionModule["" + updateRowSelection](_this.getRows()[parseInt(index.toString(), 10)], index);
4876
+ }
4877
+ }
4868
4878
  _this.trigger(dataBound, args);
4869
4879
  _this.initialRender = false;
4870
4880
  };
@@ -6665,22 +6675,13 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
6665
6675
  expandArgs = { data: parentRec, row: row };
6666
6676
  this.trigger(expanded, expandArgs);
6667
6677
  }
6678
+ else if (!this.isExpandAll && this.enableVirtualization && this.selectionSettings.persistSelection
6679
+ && !isNullOrUndefined(this.virtualScrollModule.prevSelectedRecord)) {
6680
+ this.virtualScrollModule.prevSelectedRecord = [];
6681
+ }
6668
6682
  else if (!this.isExpandAll) {
6669
6683
  this.trigger(expanded, expandArgs);
6670
6684
  }
6671
- if (record.expanded && this.enableVirtualization && this.selectionSettings.persistSelection
6672
- && !isNullOrUndefined(this.virtualScrollModule.prevSelectedRecord)) {
6673
- for (var i = 0; i < this.virtualScrollModule.prevSelectedRecord.length; i++) {
6674
- if (record.uniqueID ===
6675
- this.virtualScrollModule.prevSelectedRecord[parseInt(i.toString(), 10)].parentItem.uniqueID) {
6676
- var updateRowSelection = 'updateRowSelection';
6677
- var index =
6678
- // eslint-disable-next-line max-len
6679
- this.getCurrentViewRecords().indexOf(this.virtualScrollModule.prevSelectedRecord[parseInt(i.toString(), 10)]);
6680
- this.grid.selectionModule["" + updateRowSelection](this.getRows()[parseInt(index.toString(), 10)], index);
6681
- }
6682
- }
6683
- }
6684
6685
  }
6685
6686
  };
6686
6687
  TreeGrid.prototype.expandCollapseAllChildren = function (record, action, key, level) {
@@ -9152,7 +9153,7 @@ var RowDD = /** @__PURE__ @class */ (function () {
9152
9153
  this.canDrop = false;
9153
9154
  this.addErrorElem();
9154
9155
  }
9155
- if (!tObj.rowDropSettings.targetID && this.canDrop) {
9156
+ if (!tObj.rowDropSettings.targetID && this.canDrop && !isNullOrUndefined(args.rows[0])) {
9156
9157
  tObj.rowDragAndDropModule.updateIcon(args.rows, rowIdx, args);
9157
9158
  }
9158
9159
  if (isNullOrUndefined(tObj.rowDropSettings.targetID) && !this.canDrop) {
@@ -13682,14 +13683,17 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
13682
13683
  var info = scrollArgs.sentinel;
13683
13684
  var rowHeight = this.parent.getRowHeight();
13684
13685
  var outBuffer = this.parent.pageSettings.pageSize - Math.ceil(this.parent.pageSettings.pageSize / 2);
13685
- var content = this.parent.getContent().querySelector('.e-content');
13686
+ var content;
13687
+ if (!isNullOrUndefined(this.parent.contentModule)) {
13688
+ content = this.parent.getContent().querySelector('.e-content');
13689
+ }
13686
13690
  var scrollHeight = outBuffer * rowHeight;
13687
13691
  var upScroll = (scrollArgs.offset.top - this.translateY) <= 0;
13688
13692
  var downScroll = Math.ceil(scrollArgs.offset.top - this.translateY) + rowHeight >= scrollHeight;
13689
13693
  var selectedRowIndex = 'selectedRowIndex';
13690
13694
  var currentViewData = this.parent.currentViewData;
13691
13695
  var indexValue = 'index';
13692
- if (upScroll && (scrollArgs.direction !== 'right' && scrollArgs.direction !== 'left')) {
13696
+ if (upScroll && (scrollArgs.direction !== 'right' && scrollArgs.direction !== 'left') && !isNullOrUndefined(content)) {
13693
13697
  var vHeight = +(this.parent.height.toString().indexOf('%') < 0 ? parseInt(this.parent.height.toString(), 10) :
13694
13698
  this.parent.element.getBoundingClientRect().height);
13695
13699
  var index = (~~(content.scrollTop / rowHeight)
@@ -13737,7 +13741,7 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
13737
13741
  scrollArgs.offset.top - (outBuffer * rowHeight) + 10 : 0;
13738
13742
  }
13739
13743
  }
13740
- else if (downScroll && (scrollArgs.direction !== 'right' && scrollArgs.direction !== 'left')) {
13744
+ else if (downScroll && (scrollArgs.direction !== 'right' && scrollArgs.direction !== 'left') && !isNullOrUndefined(content)) {
13741
13745
  var nextSetResIndex = ~~(content.scrollTop / rowHeight);
13742
13746
  var isLastBlock = (this["" + selectedRowIndex] + this.parent.pageSettings.pageSize) < this.totalRecords ? false : true;
13743
13747
  if (!isNullOrUndefined(this["" + selectedRowIndex]) && this["" + selectedRowIndex] !== -1 &&
@@ -14016,6 +14020,7 @@ var VirtualScroll = /** @__PURE__ @class */ (function () {
14016
14020
  function VirtualScroll(parent) {
14017
14021
  this.prevstartIndex = -1;
14018
14022
  this.prevendIndex = -1;
14023
+ this.prevSelectedRecord = [];
14019
14024
  this.parent = parent;
14020
14025
  Grid.Inject(TreeVirtual);
14021
14026
  this.addEventListener();
@@ -14146,7 +14151,8 @@ var VirtualScroll = /** @__PURE__ @class */ (function () {
14146
14151
  }
14147
14152
  }
14148
14153
  //}
14149
- if (this.prevrequestType === 'collapseAll' && pageingDetails.actionArgs.requestType === 'virtualscroll' && !isNullOrUndefined(this.parent.idMapping)) {
14154
+ if (this.prevrequestType === 'collapseAll' && pageingDetails.actionArgs.requestType === 'virtualscroll'
14155
+ && !isNullOrUndefined(this.parent.idMapping) && startIndex === 0) {
14150
14156
  startIndex = 0;
14151
14157
  endIndex = this.parent.grid.pageSettings.pageSize - 1;
14152
14158
  this.parent.grid.notify(virtualActionArgs, { setTop: true });