@syncfusion/ej2-treegrid 20.2.44 → 20.2.45

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.
@@ -2202,7 +2202,7 @@ var DataManipulation = /** @__PURE__ @class */ (function () {
2202
2202
  currentData.index = this.storedIndex;
2203
2203
  }
2204
2204
  if ((!isNullOrUndefined(currentData[this.parent.childMapping]) && !isCountRequired(this.parent)) ||
2205
- ((currentData[this.parent.hasChildMapping]) && isCountRequired(this.parent) && this.parent.initialRender)) {
2205
+ ((currentData[this.parent.hasChildMapping]) && isCountRequired(this.parent) && (this.parent.initialRender || isNullOrUndefined(this.parent['dataResults'].result)))) {
2206
2206
  currentData.hasChildRecords = true;
2207
2207
  if (this.parent.enableCollapseAll || !isNullOrUndefined(this.parent.dataStateChange)
2208
2208
  && isNullOrUndefined(currentData[this.parent.childMapping])) {
@@ -2842,7 +2842,7 @@ function editAction(details, control, isSelfReference, addRowIndex, selectedInde
2842
2842
  var childRecords = parentData ? parentData[control.childMapping] : [];
2843
2843
  for (var p = childRecords.length - 1; p >= 0; p--) {
2844
2844
  if (childRecords[p][control.idMapping] === currentData_1[control.idMapping]) {
2845
- if (!control.enableImmutableMode) {
2845
+ if (!control.enableImmutableMode && parentData.childRecords.length === parentData['Children'].length) {
2846
2846
  parentData['childRecords'].splice(p, 1);
2847
2847
  }
2848
2848
  childRecords.splice(p, 1);
@@ -4593,7 +4593,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4593
4593
  treeGridColumn[prop] = column[i][prop];
4594
4594
  }
4595
4595
  else if (prop === 'columns' && !isNullOrUndefined(column[i][prop])) {
4596
- gridColumn[prop] = this.getGridColumns(column[i][prop], false, index);
4596
+ gridColumn[prop] = this.getGridColumns(column[i][prop], false, this.columnModel.length - 1);
4597
4597
  treeGridColumn[prop] = column[i][prop];
4598
4598
  }
4599
4599
  else if (this.initialRender && !isNullOrUndefined(treeColumn) && this.enablePersistence && prop === 'edit') {
@@ -5385,15 +5385,15 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
5385
5385
  }
5386
5386
  }
5387
5387
  }
5388
- var merge$$1 = 'deepMerge';
5389
- this[merge$$1] = ['columns']; // Workaround for blazor updateModel
5388
+ var deepMerge = 'deepMerge';
5389
+ this[deepMerge] = ['columns']; // Workaround for blazor updateModel
5390
5390
  if (this.grid.columns.length !== this.columnModel.length) {
5391
5391
  this.stackedHeader = true;
5392
5392
  }
5393
5393
  if (!this.stackedHeader) {
5394
- this.setProperties({ columns: this.columnModel }, true);
5394
+ merge(this.columns, this.columnModel);
5395
5395
  }
5396
- this[merge$$1] = undefined; // Workaround for blazor updateModel
5396
+ this[deepMerge] = undefined; // Workaround for blazor updateModel
5397
5397
  return this.columnModel;
5398
5398
  };
5399
5399
  /**
@@ -10125,9 +10125,9 @@ var ContextMenu$1 = /** @__PURE__ @class */ (function () {
10125
10125
  && !(isNullOrUndefined(editRecord)) && !(editRecord.classList.contains('e-menu-hide'))) {
10126
10126
  editRecord.style.display = 'none';
10127
10127
  }
10128
- if (indent || outdent) {
10129
- var tObj = this.parent;
10130
- var selectedrow = tObj.getSelectedRows()[0];
10128
+ var tObj = this.parent;
10129
+ var selectedrow = tObj.getSelectedRows()[0];
10130
+ if ((indent || outdent) && !isNullOrUndefined(selectedrow)) {
10131
10131
  var targetElement = args.event.target.closest('td');
10132
10132
  if (isNullOrUndefined(targetElement) || (!isNullOrUndefined(targetElement) && !targetElement.classList.contains('e-rowcell'))) {
10133
10133
  indent.style.display = outdent.style.display = 'none';
@@ -10139,31 +10139,32 @@ var ContextMenu$1 = /** @__PURE__ @class */ (function () {
10139
10139
  else if (args['name'] !== 'rowDeselected' || (!isNullOrUndefined(selectedrow) && tObj.grid.isCheckBoxSelection)) {
10140
10140
  var selectedItem = tObj.getCurrentViewRecords()[selectedrow.rowIndex];
10141
10141
  if (!isNullOrUndefined(selectedItem)) {
10142
- if ((selectedItem.level > tObj.getCurrentViewRecords()[selectedrow.rowIndex - 1].level)) {
10142
+ if ((selectedItem.level > tObj.getCurrentViewRecords()[selectedrow.rowIndex - 1].level) || this.parent.editSettings.mode === 'Batch'
10143
+ || this.parent.editSettings.mode === 'Cell') {
10143
10144
  indent.style.display = 'none';
10144
10145
  }
10145
10146
  else {
10146
10147
  indent.style.display = 'block';
10147
10148
  }
10148
- if (selectedItem.level === tObj.getCurrentViewRecords()[selectedrow.rowIndex - 1].level) {
10149
+ if ((selectedItem.level === tObj.getCurrentViewRecords()[selectedrow.rowIndex - 1].level) && this.parent.editSettings.mode !== 'Batch'
10150
+ && this.parent.editSettings.mode !== 'Cell') {
10149
10151
  indent.style.display = 'block';
10150
10152
  }
10151
- if (selectedItem.level === 0) {
10153
+ if ((selectedItem.level === 0) || this.parent.editSettings.mode === 'Batch'
10154
+ || this.parent.editSettings.mode === 'Cell') {
10152
10155
  outdent.style.display = 'none';
10153
10156
  }
10154
- if (selectedItem.level !== 0) {
10157
+ else {
10155
10158
  outdent.style.display = 'block';
10156
10159
  }
10157
10160
  }
10158
10161
  }
10159
- if (args['name'] === 'rowDeselected' && isNullOrUndefined(selectedrow) && !tObj.grid.isCheckBoxSelection) {
10160
- if (this.parent.toolbar['includes']('Indent')) {
10161
- indent.style.display = 'none';
10162
- }
10163
- if (this.parent.toolbar['includes']('Outdent')) {
10164
- outdent.style.display = 'none';
10165
- }
10166
- }
10162
+ }
10163
+ }
10164
+ else {
10165
+ if (tObj.grid.isEdit && isNullOrUndefined(selectedrow)) {
10166
+ indent.style.display = 'none';
10167
+ outdent.style.display = 'none';
10167
10168
  }
10168
10169
  }
10169
10170
  };
@@ -12357,6 +12358,8 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
12357
12358
  var upScroll = (scrollArgs.offset.top - this.translateY) < 0;
12358
12359
  var downScroll = Math.ceil(scrollArgs.offset.top - this.translateY) >= scrollHeight;
12359
12360
  var selectedRowIndex = 'selectedRowIndex';
12361
+ var currentViewData = this.parent.currentViewData;
12362
+ var indexValue = 'index';
12360
12363
  if (upScroll && (scrollArgs.direction !== 'right' && scrollArgs.direction !== 'left')) {
12361
12364
  var vHeight = +(this.parent.height.toString().indexOf('%') < 0 ? this.parent.height :
12362
12365
  this.parent.element.getBoundingClientRect().height);
@@ -12375,6 +12378,10 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
12375
12378
  this.endIndex = lastInx;
12376
12379
  this.startIndex = (this.startIndex - remains) < 0 ? 0 : (this.startIndex - remains);
12377
12380
  }
12381
+ if (currentViewData.length && ((currentViewData[0][indexValue] - this.startIndex) < (this.parent.pageSettings.pageSize / 2))) {
12382
+ this.startIndex = currentViewData[0][indexValue] - (this.parent.pageSettings.pageSize / 2);
12383
+ this.endIndex = this.startIndex + this.parent.pageSettings.pageSize;
12384
+ }
12378
12385
  //var firsttdinx = parseInt(this.parent.getContent().querySelector('.e-content td').getAttribute('index'), 0);
12379
12386
  var rowPt = Math.ceil(scrollArgs.offset.top / this.parent.getRowHeight());
12380
12387
  rowPt = rowPt % this.parent.pageSettings.pageSize;
@@ -12413,6 +12420,10 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
12413
12420
  }
12414
12421
  this.startIndex = !isLastBlock ? lastIndex - this.parent.pageSettings.pageSize : nextSetResIndex;
12415
12422
  this.endIndex = lastIndex;
12423
+ if (currentViewData.length && this.startIndex > currentViewData[0][indexValue] &&
12424
+ ((this.startIndex - currentViewData[0][indexValue]) < (this.parent.pageSettings.pageSize / 2))) {
12425
+ this.startIndex = currentViewData[0][indexValue] + (this.parent.pageSettings.pageSize / 2);
12426
+ }
12416
12427
  if (scrollArgs.offset.top > (this.parent.getRowHeight() * this.totalRecords)) {
12417
12428
  this.translateY = this.getTranslateY(scrollArgs.offset.top, content.getBoundingClientRect().height);
12418
12429
  }