@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.
@@ -2080,7 +2080,7 @@ class DataManipulation {
2080
2080
  currentData.index = this.storedIndex;
2081
2081
  }
2082
2082
  if ((!isNullOrUndefined(currentData[this.parent.childMapping]) && !isCountRequired(this.parent)) ||
2083
- ((currentData[this.parent.hasChildMapping]) && isCountRequired(this.parent) && this.parent.initialRender)) {
2083
+ ((currentData[this.parent.hasChildMapping]) && isCountRequired(this.parent) && (this.parent.initialRender || isNullOrUndefined(this.parent['dataResults'].result)))) {
2084
2084
  currentData.hasChildRecords = true;
2085
2085
  if (this.parent.enableCollapseAll || !isNullOrUndefined(this.parent.dataStateChange)
2086
2086
  && isNullOrUndefined(currentData[this.parent.childMapping])) {
@@ -2636,7 +2636,7 @@ function editAction(details, control, isSelfReference, addRowIndex, selectedInde
2636
2636
  const childRecords = parentData ? parentData[control.childMapping] : [];
2637
2637
  for (let p = childRecords.length - 1; p >= 0; p--) {
2638
2638
  if (childRecords[p][control.idMapping] === currentData[control.idMapping]) {
2639
- if (!control.enableImmutableMode) {
2639
+ if (!control.enableImmutableMode && parentData.childRecords.length === parentData['Children'].length) {
2640
2640
  parentData['childRecords'].splice(p, 1);
2641
2641
  }
2642
2642
  childRecords.splice(p, 1);
@@ -4336,7 +4336,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4336
4336
  treeGridColumn[prop] = column[i][prop];
4337
4337
  }
4338
4338
  else if (prop === 'columns' && !isNullOrUndefined(column[i][prop])) {
4339
- gridColumn[prop] = this.getGridColumns(column[i][prop], false, index);
4339
+ gridColumn[prop] = this.getGridColumns(column[i][prop], false, this.columnModel.length - 1);
4340
4340
  treeGridColumn[prop] = column[i][prop];
4341
4341
  }
4342
4342
  else if (this.initialRender && !isNullOrUndefined(treeColumn) && this.enablePersistence && prop === 'edit') {
@@ -5126,15 +5126,15 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5126
5126
  }
5127
5127
  }
5128
5128
  }
5129
- const merge$$1 = 'deepMerge';
5130
- this[merge$$1] = ['columns']; // Workaround for blazor updateModel
5129
+ const deepMerge = 'deepMerge';
5130
+ this[deepMerge] = ['columns']; // Workaround for blazor updateModel
5131
5131
  if (this.grid.columns.length !== this.columnModel.length) {
5132
5132
  this.stackedHeader = true;
5133
5133
  }
5134
5134
  if (!this.stackedHeader) {
5135
- this.setProperties({ columns: this.columnModel }, true);
5135
+ merge(this.columns, this.columnModel);
5136
5136
  }
5137
- this[merge$$1] = undefined; // Workaround for blazor updateModel
5137
+ this[deepMerge] = undefined; // Workaround for blazor updateModel
5138
5138
  return this.columnModel;
5139
5139
  }
5140
5140
  /**
@@ -9777,9 +9777,9 @@ class ContextMenu$1 {
9777
9777
  && !(isNullOrUndefined(editRecord)) && !(editRecord.classList.contains('e-menu-hide'))) {
9778
9778
  editRecord.style.display = 'none';
9779
9779
  }
9780
- if (indent || outdent) {
9781
- const tObj = this.parent;
9782
- const selectedrow = tObj.getSelectedRows()[0];
9780
+ const tObj = this.parent;
9781
+ const selectedrow = tObj.getSelectedRows()[0];
9782
+ if ((indent || outdent) && !isNullOrUndefined(selectedrow)) {
9783
9783
  const targetElement = args.event.target.closest('td');
9784
9784
  if (isNullOrUndefined(targetElement) || (!isNullOrUndefined(targetElement) && !targetElement.classList.contains('e-rowcell'))) {
9785
9785
  indent.style.display = outdent.style.display = 'none';
@@ -9791,31 +9791,32 @@ class ContextMenu$1 {
9791
9791
  else if (args['name'] !== 'rowDeselected' || (!isNullOrUndefined(selectedrow) && tObj.grid.isCheckBoxSelection)) {
9792
9792
  const selectedItem = tObj.getCurrentViewRecords()[selectedrow.rowIndex];
9793
9793
  if (!isNullOrUndefined(selectedItem)) {
9794
- if ((selectedItem.level > tObj.getCurrentViewRecords()[selectedrow.rowIndex - 1].level)) {
9794
+ if ((selectedItem.level > tObj.getCurrentViewRecords()[selectedrow.rowIndex - 1].level) || this.parent.editSettings.mode === 'Batch'
9795
+ || this.parent.editSettings.mode === 'Cell') {
9795
9796
  indent.style.display = 'none';
9796
9797
  }
9797
9798
  else {
9798
9799
  indent.style.display = 'block';
9799
9800
  }
9800
- if (selectedItem.level === tObj.getCurrentViewRecords()[selectedrow.rowIndex - 1].level) {
9801
+ if ((selectedItem.level === tObj.getCurrentViewRecords()[selectedrow.rowIndex - 1].level) && this.parent.editSettings.mode !== 'Batch'
9802
+ && this.parent.editSettings.mode !== 'Cell') {
9801
9803
  indent.style.display = 'block';
9802
9804
  }
9803
- if (selectedItem.level === 0) {
9805
+ if ((selectedItem.level === 0) || this.parent.editSettings.mode === 'Batch'
9806
+ || this.parent.editSettings.mode === 'Cell') {
9804
9807
  outdent.style.display = 'none';
9805
9808
  }
9806
- if (selectedItem.level !== 0) {
9809
+ else {
9807
9810
  outdent.style.display = 'block';
9808
9811
  }
9809
9812
  }
9810
9813
  }
9811
- if (args['name'] === 'rowDeselected' && isNullOrUndefined(selectedrow) && !tObj.grid.isCheckBoxSelection) {
9812
- if (this.parent.toolbar['includes']('Indent')) {
9813
- indent.style.display = 'none';
9814
- }
9815
- if (this.parent.toolbar['includes']('Outdent')) {
9816
- outdent.style.display = 'none';
9817
- }
9818
- }
9814
+ }
9815
+ }
9816
+ else {
9817
+ if (tObj.grid.isEdit && isNullOrUndefined(selectedrow)) {
9818
+ indent.style.display = 'none';
9819
+ outdent.style.display = 'none';
9819
9820
  }
9820
9821
  }
9821
9822
  }
@@ -11980,6 +11981,8 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
11980
11981
  const upScroll = (scrollArgs.offset.top - this.translateY) < 0;
11981
11982
  const downScroll = Math.ceil(scrollArgs.offset.top - this.translateY) >= scrollHeight;
11982
11983
  const selectedRowIndex = 'selectedRowIndex';
11984
+ const currentViewData = this.parent.currentViewData;
11985
+ const indexValue = 'index';
11983
11986
  if (upScroll && (scrollArgs.direction !== 'right' && scrollArgs.direction !== 'left')) {
11984
11987
  const vHeight = +(this.parent.height.toString().indexOf('%') < 0 ? this.parent.height :
11985
11988
  this.parent.element.getBoundingClientRect().height);
@@ -11998,6 +12001,10 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
11998
12001
  this.endIndex = lastInx;
11999
12002
  this.startIndex = (this.startIndex - remains) < 0 ? 0 : (this.startIndex - remains);
12000
12003
  }
12004
+ if (currentViewData.length && ((currentViewData[0][indexValue] - this.startIndex) < (this.parent.pageSettings.pageSize / 2))) {
12005
+ this.startIndex = currentViewData[0][indexValue] - (this.parent.pageSettings.pageSize / 2);
12006
+ this.endIndex = this.startIndex + this.parent.pageSettings.pageSize;
12007
+ }
12001
12008
  //var firsttdinx = parseInt(this.parent.getContent().querySelector('.e-content td').getAttribute('index'), 0);
12002
12009
  let rowPt = Math.ceil(scrollArgs.offset.top / this.parent.getRowHeight());
12003
12010
  rowPt = rowPt % this.parent.pageSettings.pageSize;
@@ -12036,6 +12043,10 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
12036
12043
  }
12037
12044
  this.startIndex = !isLastBlock ? lastIndex - this.parent.pageSettings.pageSize : nextSetResIndex;
12038
12045
  this.endIndex = lastIndex;
12046
+ if (currentViewData.length && this.startIndex > currentViewData[0][indexValue] &&
12047
+ ((this.startIndex - currentViewData[0][indexValue]) < (this.parent.pageSettings.pageSize / 2))) {
12048
+ this.startIndex = currentViewData[0][indexValue] + (this.parent.pageSettings.pageSize / 2);
12049
+ }
12039
12050
  if (scrollArgs.offset.top > (this.parent.getRowHeight() * this.totalRecords)) {
12040
12051
  this.translateY = this.getTranslateY(scrollArgs.offset.top, content.getBoundingClientRect().height);
12041
12052
  }