@syncfusion/ej2-treegrid 20.2.44 → 20.2.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.
@@ -1142,6 +1142,8 @@ var Selection = /** @__PURE__ @class */ (function () {
1142
1142
  var _this = this;
1143
1143
  var index = -1;
1144
1144
  var length = 0;
1145
+ //This property used to maintain the check state of the currentview data after clear filtering
1146
+ var multiFilterCheckState = false;
1145
1147
  if (!isNullOrUndefined(this.parent.filterModule) && this.parent.filterModule.filteredResult.length > 0) {
1146
1148
  var filterResult = this.parent.filterModule.filteredResult;
1147
1149
  if (this.filteredList.length === 0) {
@@ -1150,6 +1152,10 @@ var Selection = /** @__PURE__ @class */ (function () {
1150
1152
  else {
1151
1153
  if (this.filteredList !== filterResult) {
1152
1154
  this.filteredList = filterResult;
1155
+ multiFilterCheckState = true;
1156
+ }
1157
+ else {
1158
+ multiFilterCheckState = false;
1153
1159
  }
1154
1160
  }
1155
1161
  }
@@ -1168,6 +1174,9 @@ var Selection = /** @__PURE__ @class */ (function () {
1168
1174
  if (data[i].checkboxState === 'check') {
1169
1175
  continue;
1170
1176
  }
1177
+ if (multiFilterCheckState) {
1178
+ continue;
1179
+ }
1171
1180
  data[i].checkboxState = 'check';
1172
1181
  this.updateSelectedItems(data[i], data[i].checkboxState);
1173
1182
  }
@@ -2202,7 +2211,7 @@ var DataManipulation = /** @__PURE__ @class */ (function () {
2202
2211
  currentData.index = this.storedIndex;
2203
2212
  }
2204
2213
  if ((!isNullOrUndefined(currentData[this.parent.childMapping]) && !isCountRequired(this.parent)) ||
2205
- ((currentData[this.parent.hasChildMapping]) && isCountRequired(this.parent) && this.parent.initialRender)) {
2214
+ ((currentData[this.parent.hasChildMapping]) && isCountRequired(this.parent) && (this.parent.initialRender || isNullOrUndefined(this.parent['dataResults'].result)))) {
2206
2215
  currentData.hasChildRecords = true;
2207
2216
  if (this.parent.enableCollapseAll || !isNullOrUndefined(this.parent.dataStateChange)
2208
2217
  && isNullOrUndefined(currentData[this.parent.childMapping])) {
@@ -2842,7 +2851,7 @@ function editAction(details, control, isSelfReference, addRowIndex, selectedInde
2842
2851
  var childRecords = parentData ? parentData[control.childMapping] : [];
2843
2852
  for (var p = childRecords.length - 1; p >= 0; p--) {
2844
2853
  if (childRecords[p][control.idMapping] === currentData_1[control.idMapping]) {
2845
- if (!control.enableImmutableMode) {
2854
+ if (!control.enableImmutableMode && parentData.childRecords.length === parentData['Children'].length) {
2846
2855
  parentData['childRecords'].splice(p, 1);
2847
2856
  }
2848
2857
  childRecords.splice(p, 1);
@@ -4310,6 +4319,19 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4310
4319
  if (args.requestType === 'save' && _this.aggregates.map(function (ag) { return ag.showChildSummary === true; }).length) {
4311
4320
  _this.grid.refresh();
4312
4321
  }
4322
+ if (args.action === 'filter') {
4323
+ if (_this.filterModule['currentFilterObject'] !== '' && _this.enableVirtualization && !_this.initialRender) {
4324
+ _this.expandAll();
4325
+ }
4326
+ }
4327
+ if (args.requestType === 'searching') {
4328
+ if (_this.searchSettings.key !== '' && _this.enableVirtualization && !_this.initialRender) {
4329
+ _this.expandAll();
4330
+ }
4331
+ }
4332
+ if (args.action === 'clearFilter' && _this.enableCollapseAll) {
4333
+ _this.collapseAll();
4334
+ }
4313
4335
  if (_this.action === 'indenting' || _this.action === 'outdenting') {
4314
4336
  _this.action = _this.action === 'indenting' ? 'indented' : 'outdented';
4315
4337
  var selectedItem_1 = [_this.selectedRecords];
@@ -4593,7 +4615,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4593
4615
  treeGridColumn[prop] = column[i][prop];
4594
4616
  }
4595
4617
  else if (prop === 'columns' && !isNullOrUndefined(column[i][prop])) {
4596
- gridColumn[prop] = this.getGridColumns(column[i][prop], false, index);
4618
+ gridColumn[prop] = this.getGridColumns(column[i][prop], false, this.columnModel.length - 1);
4597
4619
  treeGridColumn[prop] = column[i][prop];
4598
4620
  }
4599
4621
  else if (this.initialRender && !isNullOrUndefined(treeColumn) && this.enablePersistence && prop === 'edit') {
@@ -5385,15 +5407,15 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
5385
5407
  }
5386
5408
  }
5387
5409
  }
5388
- var merge$$1 = 'deepMerge';
5389
- this[merge$$1] = ['columns']; // Workaround for blazor updateModel
5410
+ var deepMerge = 'deepMerge';
5411
+ this[deepMerge] = ['columns']; // Workaround for blazor updateModel
5390
5412
  if (this.grid.columns.length !== this.columnModel.length) {
5391
5413
  this.stackedHeader = true;
5392
5414
  }
5393
5415
  if (!this.stackedHeader) {
5394
- this.setProperties({ columns: this.columnModel }, true);
5416
+ merge(this.columns, this.columnModel);
5395
5417
  }
5396
- this[merge$$1] = undefined; // Workaround for blazor updateModel
5418
+ this[deepMerge] = undefined; // Workaround for blazor updateModel
5397
5419
  return this.columnModel;
5398
5420
  };
5399
5421
  /**
@@ -8885,10 +8907,6 @@ var Filter$1 = /** @__PURE__ @class */ (function () {
8885
8907
  }
8886
8908
  }
8887
8909
  else {
8888
- if ((!this.parent.enableCollapseAll || !this.parent.initialRender && isNullOrUndefined(this.parent['dataResults']['result']))
8889
- && parent['expanded'] === false && this.parent.getVisibleRecords().indexOf(record) === -1) {
8890
- this.parent.expandRow(this.parent.getRows()[parent['index']], parent);
8891
- }
8892
8910
  this.addParentRecord(parent);
8893
8911
  }
8894
8912
  }
@@ -9570,53 +9588,55 @@ var Toolbar$1 = /** @__PURE__ @class */ (function () {
9570
9588
  this.parent.off(toolbarClick, this.toolbarClickHandler);
9571
9589
  };
9572
9590
  Toolbar$$1.prototype.refreshToolbar = function (args) {
9573
- var tObj = this.parent;
9574
- var indentElement;
9575
- var outdentElement;
9576
- var indentID = tObj.element.id + '_gridcontrol_indent';
9577
- var outdentID = tObj.element.id + '_gridcontrol_outdent';
9578
9591
  var toolbarElement = this.parent.grid.toolbarModule.getToolbar();
9579
- var indentEle = toolbarElement.querySelector('#' + indentID);
9580
- var outdentEle = toolbarElement.querySelector('#' + outdentID);
9581
- var row = args.row;
9582
- var selectedrow = tObj.getSelectedRows()[0];
9583
- if (!isNullOrUndefined(row[0])) {
9584
- row = row[0];
9585
- }
9586
- row = (!isNullOrUndefined(selectedrow) && selectedrow.rowIndex !== row.rowIndex) ? selectedrow : row;
9587
- if (indentEle !== null && outdentEle !== null) {
9588
- indentElement = toolbarElement.querySelector('#' + indentID).parentElement;
9589
- outdentElement = toolbarElement.querySelector('#' + outdentID).parentElement;
9590
- if (row.rowIndex === 0 || tObj.getSelectedRowIndexes().length > 1) {
9591
- indentElement.classList.add('e-hidden');
9592
- outdentElement.classList.add('e-hidden');
9593
- }
9594
- else if (args['name'] !== 'rowDeselected' || (!isNullOrUndefined(selectedrow) && tObj.grid.isCheckBoxSelection)) {
9595
- var selectedItem = tObj.getCurrentViewRecords()[row.rowIndex];
9596
- if (!isNullOrUndefined(selectedItem)) {
9597
- if ((selectedItem.level > tObj.getCurrentViewRecords()[row.rowIndex - 1].level)) {
9598
- indentElement.classList.add('e-hidden');
9599
- }
9600
- else {
9601
- indentElement.classList.remove('e-hidden');
9592
+ if (!isNullOrUndefined(toolbarElement)) {
9593
+ var tObj = this.parent;
9594
+ var indentElement = void 0;
9595
+ var outdentElement = void 0;
9596
+ var indentID = tObj.element.id + '_gridcontrol_indent';
9597
+ var outdentID = tObj.element.id + '_gridcontrol_outdent';
9598
+ var indentEle = toolbarElement.querySelector('#' + indentID);
9599
+ var outdentEle = toolbarElement.querySelector('#' + outdentID);
9600
+ var row = args.row;
9601
+ var selectedrow = tObj.getSelectedRows()[0];
9602
+ if (!isNullOrUndefined(row[0])) {
9603
+ row = row[0];
9604
+ }
9605
+ row = (!isNullOrUndefined(selectedrow) && selectedrow.rowIndex !== row.rowIndex) ? selectedrow : row;
9606
+ if (indentEle !== null && outdentEle !== null) {
9607
+ indentElement = toolbarElement.querySelector('#' + indentID).parentElement;
9608
+ outdentElement = toolbarElement.querySelector('#' + outdentID).parentElement;
9609
+ if (row.rowIndex === 0 || tObj.getSelectedRowIndexes().length > 1) {
9610
+ indentElement.classList.add('e-hidden');
9611
+ outdentElement.classList.add('e-hidden');
9612
+ }
9613
+ else if (args['name'] !== 'rowDeselected' || (!isNullOrUndefined(selectedrow) && tObj.grid.isCheckBoxSelection)) {
9614
+ var selectedItem = tObj.getCurrentViewRecords()[row.rowIndex];
9615
+ if (!isNullOrUndefined(selectedItem)) {
9616
+ if ((selectedItem.level > tObj.getCurrentViewRecords()[row.rowIndex - 1].level)) {
9617
+ indentElement.classList.add('e-hidden');
9618
+ }
9619
+ else {
9620
+ indentElement.classList.remove('e-hidden');
9621
+ }
9622
+ if (selectedItem.level === tObj.getCurrentViewRecords()[row.rowIndex - 1].level) {
9623
+ indentElement.classList.remove('e-hidden');
9624
+ }
9625
+ if (selectedItem.level === 0) {
9626
+ outdentElement.classList.add('e-hidden');
9627
+ }
9628
+ if (selectedItem.level !== 0) {
9629
+ outdentElement.classList.remove('e-hidden');
9630
+ }
9602
9631
  }
9603
- if (selectedItem.level === tObj.getCurrentViewRecords()[row.rowIndex - 1].level) {
9604
- indentElement.classList.remove('e-hidden');
9632
+ }
9633
+ if (args['name'] === 'rowDeselected' && isNullOrUndefined(selectedrow) && !tObj.grid.isCheckBoxSelection) {
9634
+ if (this.parent.toolbar['includes']('Indent')) {
9635
+ indentElement.classList.add('e-hidden');
9605
9636
  }
9606
- if (selectedItem.level === 0) {
9637
+ if (this.parent.toolbar['includes']('Outdent')) {
9607
9638
  outdentElement.classList.add('e-hidden');
9608
9639
  }
9609
- if (selectedItem.level !== 0) {
9610
- outdentElement.classList.remove('e-hidden');
9611
- }
9612
- }
9613
- }
9614
- if (args['name'] === 'rowDeselected' && isNullOrUndefined(selectedrow) && !tObj.grid.isCheckBoxSelection) {
9615
- if (this.parent.toolbar['includes']('Indent')) {
9616
- indentElement.classList.add('e-hidden');
9617
- }
9618
- if (this.parent.toolbar['includes']('Outdent')) {
9619
- outdentElement.classList.add('e-hidden');
9620
9640
  }
9621
9641
  }
9622
9642
  }
@@ -10125,9 +10145,9 @@ var ContextMenu$1 = /** @__PURE__ @class */ (function () {
10125
10145
  && !(isNullOrUndefined(editRecord)) && !(editRecord.classList.contains('e-menu-hide'))) {
10126
10146
  editRecord.style.display = 'none';
10127
10147
  }
10128
- if (indent || outdent) {
10129
- var tObj = this.parent;
10130
- var selectedrow = tObj.getSelectedRows()[0];
10148
+ var tObj = this.parent;
10149
+ var selectedrow = tObj.getSelectedRows()[0];
10150
+ if ((indent || outdent) && !isNullOrUndefined(selectedrow)) {
10131
10151
  var targetElement = args.event.target.closest('td');
10132
10152
  if (isNullOrUndefined(targetElement) || (!isNullOrUndefined(targetElement) && !targetElement.classList.contains('e-rowcell'))) {
10133
10153
  indent.style.display = outdent.style.display = 'none';
@@ -10139,31 +10159,32 @@ var ContextMenu$1 = /** @__PURE__ @class */ (function () {
10139
10159
  else if (args['name'] !== 'rowDeselected' || (!isNullOrUndefined(selectedrow) && tObj.grid.isCheckBoxSelection)) {
10140
10160
  var selectedItem = tObj.getCurrentViewRecords()[selectedrow.rowIndex];
10141
10161
  if (!isNullOrUndefined(selectedItem)) {
10142
- if ((selectedItem.level > tObj.getCurrentViewRecords()[selectedrow.rowIndex - 1].level)) {
10162
+ if ((selectedItem.level > tObj.getCurrentViewRecords()[selectedrow.rowIndex - 1].level) || this.parent.editSettings.mode === 'Batch'
10163
+ || this.parent.editSettings.mode === 'Cell') {
10143
10164
  indent.style.display = 'none';
10144
10165
  }
10145
10166
  else {
10146
10167
  indent.style.display = 'block';
10147
10168
  }
10148
- if (selectedItem.level === tObj.getCurrentViewRecords()[selectedrow.rowIndex - 1].level) {
10169
+ if ((selectedItem.level === tObj.getCurrentViewRecords()[selectedrow.rowIndex - 1].level) && this.parent.editSettings.mode !== 'Batch'
10170
+ && this.parent.editSettings.mode !== 'Cell') {
10149
10171
  indent.style.display = 'block';
10150
10172
  }
10151
- if (selectedItem.level === 0) {
10173
+ if ((selectedItem.level === 0) || this.parent.editSettings.mode === 'Batch'
10174
+ || this.parent.editSettings.mode === 'Cell') {
10152
10175
  outdent.style.display = 'none';
10153
10176
  }
10154
- if (selectedItem.level !== 0) {
10177
+ else {
10155
10178
  outdent.style.display = 'block';
10156
10179
  }
10157
10180
  }
10158
10181
  }
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
- }
10182
+ }
10183
+ }
10184
+ else {
10185
+ if (tObj.grid.isEdit && isNullOrUndefined(selectedrow)) {
10186
+ indent.style.display = 'none';
10187
+ outdent.style.display = 'none';
10167
10188
  }
10168
10189
  }
10169
10190
  };
@@ -12357,6 +12378,8 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
12357
12378
  var upScroll = (scrollArgs.offset.top - this.translateY) < 0;
12358
12379
  var downScroll = Math.ceil(scrollArgs.offset.top - this.translateY) >= scrollHeight;
12359
12380
  var selectedRowIndex = 'selectedRowIndex';
12381
+ var currentViewData = this.parent.currentViewData;
12382
+ var indexValue = 'index';
12360
12383
  if (upScroll && (scrollArgs.direction !== 'right' && scrollArgs.direction !== 'left')) {
12361
12384
  var vHeight = +(this.parent.height.toString().indexOf('%') < 0 ? this.parent.height :
12362
12385
  this.parent.element.getBoundingClientRect().height);
@@ -12375,6 +12398,10 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
12375
12398
  this.endIndex = lastInx;
12376
12399
  this.startIndex = (this.startIndex - remains) < 0 ? 0 : (this.startIndex - remains);
12377
12400
  }
12401
+ if (currentViewData.length && ((currentViewData[0][indexValue] - this.startIndex) < (this.parent.pageSettings.pageSize / 2))) {
12402
+ this.startIndex = currentViewData[0][indexValue] - (this.parent.pageSettings.pageSize / 2);
12403
+ this.endIndex = this.startIndex + this.parent.pageSettings.pageSize;
12404
+ }
12378
12405
  //var firsttdinx = parseInt(this.parent.getContent().querySelector('.e-content td').getAttribute('index'), 0);
12379
12406
  var rowPt = Math.ceil(scrollArgs.offset.top / this.parent.getRowHeight());
12380
12407
  rowPt = rowPt % this.parent.pageSettings.pageSize;
@@ -12413,6 +12440,10 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
12413
12440
  }
12414
12441
  this.startIndex = !isLastBlock ? lastIndex - this.parent.pageSettings.pageSize : nextSetResIndex;
12415
12442
  this.endIndex = lastIndex;
12443
+ if (currentViewData.length && this.startIndex > currentViewData[0][indexValue] &&
12444
+ ((this.startIndex - currentViewData[0][indexValue]) < (this.parent.pageSettings.pageSize / 2))) {
12445
+ this.startIndex = currentViewData[0][indexValue] + (this.parent.pageSettings.pageSize / 2);
12446
+ }
12416
12447
  if (scrollArgs.offset.top > (this.parent.getRowHeight() * this.totalRecords)) {
12417
12448
  this.translateY = this.getTranslateY(scrollArgs.offset.top, content.getBoundingClientRect().height);
12418
12449
  }