@syncfusion/ej2-treegrid 20.2.36 → 20.2.40

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.
@@ -497,6 +497,8 @@ var rowdraging = 'row-draging';
497
497
  var rowDropped = 'row-dropped';
498
498
  /** @hidden */
499
499
  var autoCol = 'auto-col';
500
+ /** @hidden */
501
+ var rowDeselecting = 'rowDeselecting';
500
502
 
501
503
  var __extends$4 = (undefined && undefined.__extends) || (function () {
502
504
  var extendStatics = function (d, b) {
@@ -797,7 +799,7 @@ function findChildrenRecords(records) {
797
799
  return [];
798
800
  }
799
801
  if (!isNullOrUndefined(records.childRecords)) {
800
- var childRecords = records.childRecords;
802
+ var childRecords = records.childRecords.filter(function (items) { return !items.isSummaryRow; });
801
803
  var keys = Object.keys(childRecords);
802
804
  for (var i = 0, len = keys.length; i < len; i++) {
803
805
  datas.push(childRecords[i]);
@@ -1119,7 +1121,12 @@ var Selection = /** @__PURE__ @class */ (function () {
1119
1121
  if (indeter > 0 || (checkChildRecords > 0 && checkChildRecords !== length)) {
1120
1122
  record.checkboxState = 'indeterminate';
1121
1123
  }
1122
- else if (checkChildRecords === 0 && indeter === 0) {
1124
+ else if (checkChildRecords === 0 && (!record.hasFilteredChildRecords || isNullOrUndefined(record.hasFilteredChildRecords)) && !isNullOrUndefined(this.parent['dataResults']['actionArgs']) &&
1125
+ (this.parent['dataResults']['actionArgs'].requestType === 'searching' || this.parent['dataResults']['actionArgs'].requestType === 'filtering') && record.checkboxState === 'check') {
1126
+ record.checkboxState = 'check';
1127
+ }
1128
+ else if ((checkChildRecords === 0 && indeter === 0) || (checkChildRecords === 0 && record.hasFilteredChildRecords && !isNullOrUndefined(this.parent['dataResults']['actionArgs']) &&
1129
+ (this.parent['dataResults']['actionArgs'].requestType === 'searching' || this.parent['dataResults']['actionArgs'].requestType === 'filtering') && record.checkboxState === 'check')) {
1123
1130
  record.checkboxState = 'uncheck';
1124
1131
  }
1125
1132
  else {
@@ -1309,7 +1316,7 @@ var Selection = /** @__PURE__ @class */ (function () {
1309
1316
  childData = (!isNullOrUndefined(this.parent.filterModule) && this.parent.filterModule.filteredResult.length > 0) ?
1310
1317
  this.parent.getCurrentViewRecords() : this.parent.flatData;
1311
1318
  childData.forEach(function (record) {
1312
- if (_this.parent.enableVirtualization) {
1319
+ if (_this.parent.enableVirtualization && record.childRecords.length > 0) {
1313
1320
  if (record.hasChildRecords) {
1314
1321
  _this.updateParentSelection(record);
1315
1322
  }
@@ -1548,7 +1555,7 @@ var Render = /** @__PURE__ @class */ (function () {
1548
1555
  var parentrec = this.parent.getCurrentViewRecords().filter(function (rec) {
1549
1556
  return getValue(proxy_1.idMapping, rec) === getValue(proxy_1.parentIdMapping, data);
1550
1557
  });
1551
- if (parentrec.length > 0) {
1558
+ if (parentrec.length > 0 && !parentrec[0].isSummaryRow) {
1552
1559
  var display = parentrec[0].expanded ? 'table-row' : 'none';
1553
1560
  args.row.setAttribute('style', 'display: ' + display + ';');
1554
1561
  }
@@ -1728,7 +1735,7 @@ var Render = /** @__PURE__ @class */ (function () {
1728
1735
  var templateFn = 'templateFn';
1729
1736
  var colindex = args.column.index;
1730
1737
  if (isNullOrUndefined(treeColumn.field)) {
1731
- args.cell.setAttribute('aria-colindex', colindex + '');
1738
+ args.cell.setAttribute('data-colindex', colindex + '');
1732
1739
  }
1733
1740
  if (treeColumn.field === args.column.field && !isNullOrUndefined(treeColumn.template)) {
1734
1741
  args.column.template = treeColumn.template;
@@ -2194,8 +2201,8 @@ var DataManipulation = /** @__PURE__ @class */ (function () {
2194
2201
  if (!Object.prototype.hasOwnProperty.call(currentData, 'index')) {
2195
2202
  currentData.index = this.storedIndex;
2196
2203
  }
2197
- if (!isNullOrUndefined(currentData[this.parent.childMapping]) ||
2198
- (currentData[this.parent.hasChildMapping] && isCountRequired(this.parent))) {
2204
+ if ((!isNullOrUndefined(currentData[this.parent.childMapping]) && !isCountRequired(this.parent)) ||
2205
+ ((currentData[this.parent.hasChildMapping]) && isCountRequired(this.parent) && this.parent.initialRender)) {
2199
2206
  currentData.hasChildRecords = true;
2200
2207
  if (this.parent.enableCollapseAll || !isNullOrUndefined(this.parent.dataStateChange)
2201
2208
  && isNullOrUndefined(currentData[this.parent.childMapping])) {
@@ -3920,16 +3927,23 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
3920
3927
  TreeGrid.prototype.triggerEvents = function (args) {
3921
3928
  this.trigger(getObject('name', args), args);
3922
3929
  };
3930
+ TreeGrid.prototype.IsExpandCollapseClicked = function (args) {
3931
+ if (!isNullOrUndefined(args.target) && (args.target.classList.contains('e-treegridexpand')
3932
+ || args.target.classList.contains('e-treegridcollapse') || args.target.classList.contains('e-summarycell'))) {
3933
+ args.cancel = true;
3934
+ return;
3935
+ }
3936
+ };
3923
3937
  TreeGrid.prototype.bindGridEvents = function () {
3924
3938
  var _this = this;
3925
3939
  this.grid.rowSelecting = function (args) {
3926
- if (!isNullOrUndefined(args.target) && (args.target.classList.contains('e-treegridexpand')
3927
- || args.target.classList.contains('e-treegridcollapse') || args.target.classList.contains('e-summarycell'))) {
3928
- args.cancel = true;
3929
- return;
3930
- }
3940
+ _this.IsExpandCollapseClicked(args);
3931
3941
  _this.trigger(rowSelecting, args);
3932
3942
  };
3943
+ this.grid.rowDeselecting = function (args) {
3944
+ _this.IsExpandCollapseClicked(args);
3945
+ _this.trigger(rowDeselecting, args);
3946
+ };
3933
3947
  this.grid.rowSelected = function (args) {
3934
3948
  if (_this.enableVirtualization && args.isHeaderCheckboxClicked &&
3935
3949
  _this.grid.currentViewData.length !== _this.grid.selectionModule.selectedRowIndexes.length) {
@@ -5714,7 +5728,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
5714
5728
  }
5715
5729
  else if (isNullOrUndefined(record)) {
5716
5730
  if (this.detailTemplate) {
5717
- record = this.grid.getCurrentViewRecords()[row.getAttribute('aria-rowindex')];
5731
+ record = this.grid.getCurrentViewRecords()[row.getAttribute('data-rowindex')];
5718
5732
  }
5719
5733
  else {
5720
5734
  record = this.grid.getCurrentViewRecords()[row.rowIndex];
@@ -5992,7 +6006,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
5992
6006
  row = gridRows[rowIndex];
5993
6007
  }
5994
6008
  else {
5995
- rowIndex = +row.getAttribute('aria-rowindex');
6009
+ rowIndex = +row.getAttribute('data-rowindex');
5996
6010
  }
5997
6011
  if (!isNullOrUndefined(row)) {
5998
6012
  row.setAttribute('aria-expanded', action === 'expand' ? 'true' : 'false');
@@ -6146,7 +6160,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
6146
6160
  var args = { data: record, row: row };
6147
6161
  var rows = [];
6148
6162
  rows = gridRows.filter(function (r) {
6149
- return r.querySelector('.e-gridrowindex' + record.index + 'level' + (record.level + 1));
6163
+ return ((r.querySelector('.e-gridrowindex' + record.index + 'level' + (record.level + 1))) || (r.querySelector('.e-gridrowindex' + record.index + 'level0' + '.e-summarycell')));
6150
6164
  });
6151
6165
  if (action === 'expand') {
6152
6166
  this.notify(remoteExpand, { record: record, rows: rows, parentRow: row });
@@ -7397,7 +7411,7 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
7397
7411
  dropIndex = this.selectedRow.rowIndex - 1;
7398
7412
  }
7399
7413
  if (this.parent.enableVirtualization && this.parent.allowRowDragAndDrop && this.selectedRecord) {
7400
- dropIndex = parseInt(this.selectedRow.getAttribute('aria-rowindex'), 10) - 1;
7414
+ dropIndex = parseInt(this.selectedRow.getAttribute('data-rowindex'), 10) - 1;
7401
7415
  }
7402
7416
  tObj[action] = 'indenting';
7403
7417
  tObj[droppedIndex] = dropIndex;
@@ -7416,7 +7430,7 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
7416
7430
  }
7417
7431
  }
7418
7432
  if (this.parent.enableVirtualization && this.parent.allowRowDragAndDrop && this.selectedRecord) {
7419
- dropIndex = parseInt(this.parent.getRows()[dropIndex].getAttribute('aria-rowindex'), 10);
7433
+ dropIndex = parseInt(this.parent.getRows()[dropIndex].getAttribute('data-rowindex'), 10);
7420
7434
  }
7421
7435
  tObj[action] = 'outdenting';
7422
7436
  tObj[droppedIndex] = dropIndex;
@@ -7436,7 +7450,7 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
7436
7450
  if (!actionArgs.cancel) {
7437
7451
  if (actionArgs.action === 'indenting') {
7438
7452
  if (_this.parent.enableVirtualization && _this.parent.allowRowDragAndDrop) {
7439
- _this.reorderRows([parseInt(_this.selectedRow.getAttribute('aria-rowindex'), 10)], dropIndex, 'child');
7453
+ _this.reorderRows([parseInt(_this.selectedRow.getAttribute('data-rowindex'), 10)], dropIndex, 'child');
7440
7454
  }
7441
7455
  else {
7442
7456
  _this.reorderRows([_this.selectedRow.rowIndex], dropIndex, 'child');
@@ -7444,7 +7458,7 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
7444
7458
  }
7445
7459
  else if (actionArgs.action === 'outdenting') {
7446
7460
  if (_this.parent.enableVirtualization && _this.parent.allowRowDragAndDrop) {
7447
- _this.reorderRows([parseInt(_this.selectedRow.getAttribute('aria-rowindex'), 10)], dropIndex, 'below');
7461
+ _this.reorderRows([parseInt(_this.selectedRow.getAttribute('data-rowindex'), 10)], dropIndex, 'below');
7448
7462
  }
7449
7463
  else {
7450
7464
  _this.reorderRows([_this.selectedRow.rowIndex], dropIndex, 'below');
@@ -8070,7 +8084,7 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
8070
8084
  }
8071
8085
  };
8072
8086
  RowDD$$1.prototype.getTargetIdx = function (targetRow) {
8073
- return targetRow ? parseInt(targetRow.getAttribute('aria-rowindex'), 10) : 0;
8087
+ return targetRow ? parseInt(targetRow.getAttribute('data-rowindex'), 10) : 0;
8074
8088
  };
8075
8089
  RowDD$$1.prototype.getParentData = function (record, data) {
8076
8090
  var parentItem = record.parentItem;
@@ -10156,6 +10170,7 @@ var ContextMenu$1 = /** @__PURE__ @class */ (function () {
10156
10170
  if (args.item.id === 'Above' || args.item.id === 'Below' || args.item.id === 'Child') {
10157
10171
  this.parent.notify('savePreviousRowPosition', args);
10158
10172
  this.parent.setProperties({ editSettings: { newRowPosition: args.item.id } }, true);
10173
+ this.parent.editModule['isAddedRowByContextMenu'] = true;
10159
10174
  this.parent.addRecord();
10160
10175
  }
10161
10176
  if (args.item.id === this.parent.element.id + '_gridcontrol_cmenu_Indent' || args.item.id === this.parent.element.id + '_gridcontrol_cmenu_Outdent') {
@@ -10427,10 +10442,11 @@ var BatchEdit = /** @__PURE__ @class */ (function () {
10427
10442
  this.parent.editModule[isTabLastRow] = false;
10428
10443
  return;
10429
10444
  }
10430
- if (this.parent.editModule['isAddedRowByMethod'] && !isNullOrUndefined(this.parent.editModule['addRowIndex']) && this.parent.grid.selectedRowIndex === -1) {
10445
+ if (this.parent.editModule['isAddedRowByMethod'] && !isNullOrUndefined(this.parent.editModule['addRowIndex']) &&
10446
+ !this.parent.editModule['isAddedRowByContextMenu'] && (this.parent.grid.selectedRowIndex === -1 || this.parent.editModule['batchEditModule'].isAdd)) {
10431
10447
  this.selectedIndex = this.parent.editModule['selectedIndex'];
10432
10448
  this.addRowIndex = this.parent.editModule['addRowIndex'];
10433
- this.addRowRecord = this.parent.getCurrentViewRecords()[this.selectedIndex];
10449
+ this.addRowRecord = this.batchRecords.length ? this.batchRecords[this.selectedIndex] : this.parent.getCurrentViewRecords()[this.selectedIndex];
10434
10450
  }
10435
10451
  else {
10436
10452
  this.selectedIndex = this.parent.grid.selectedRowIndex;
@@ -10477,6 +10493,11 @@ var BatchEdit = /** @__PURE__ @class */ (function () {
10477
10493
  // }
10478
10494
  }
10479
10495
  focusModule.getContent().matrix.current = [actualIndex, focusModule.getContent().matrix.current[1]];
10496
+ if (this.parent.editModule['isAddedRowByMethod'] && !isNullOrUndefined(this.parent.editModule['addRowIndex']) && !this.parent.editModule['isAddedRowByContextMenu']) {
10497
+ var newlyAddedRecords = this.parent.getBatchChanges()['addedRecords'];
10498
+ var index = parseInt(this.parent.getContentTable().getElementsByClassName('e-insertedrow')[newlyAddedRecords.length - 1].getAttribute('data-rowindex'), 10);
10499
+ this.batchRecords.splice(index, 0, newlyAddedRecords[newlyAddedRecords.length - 1]);
10500
+ }
10480
10501
  }
10481
10502
  };
10482
10503
  BatchEdit.prototype.beforeBatchDelete = function (args) {
@@ -10502,7 +10523,7 @@ var BatchEdit = /** @__PURE__ @class */ (function () {
10502
10523
  childs = findChildrenRecords(data);
10503
10524
  uid = this.parent.getSelectedRows()[0].getAttribute('data-uid');
10504
10525
  }
10505
- var parentRowIndex = parseInt(this.parent.grid.getRowElementByUID(uid).getAttribute('aria-rowindex'), 10);
10526
+ var parentRowIndex = parseInt(this.parent.grid.getRowElementByUID(uid).getAttribute('data-rowindex'), 10);
10506
10527
  if (childs.length) {
10507
10528
  var totalCount = parentRowIndex + childs.length;
10508
10529
  var firstChildIndex = parentRowIndex + 1;
@@ -10539,7 +10560,7 @@ var BatchEdit = /** @__PURE__ @class */ (function () {
10539
10560
  BatchEdit.prototype.updateRowIndex = function () {
10540
10561
  var rows = this.parent.grid.getDataRows();
10541
10562
  for (var i = 0; i < rows.length; i++) {
10542
- rows[i].setAttribute('aria-rowindex', i.toString());
10563
+ rows[i].setAttribute('data-rowindex', i.toString());
10543
10564
  }
10544
10565
  var freeze = (this.parent.getFrozenLeftColumnsCount() > 0 ||
10545
10566
  this.parent.getFrozenRightColumnsCount() > 0) ? true : false;
@@ -10547,9 +10568,9 @@ var BatchEdit = /** @__PURE__ @class */ (function () {
10547
10568
  var mRows = this.parent.grid.getMovableDataRows();
10548
10569
  var freezeRightRows = this.parent.grid.getFrozenRightDataRows();
10549
10570
  for (var i = 0; i < mRows.length; i++) {
10550
- mRows[i].setAttribute('aria-rowindex', i.toString());
10571
+ mRows[i].setAttribute('data-rowindex', i.toString());
10551
10572
  if (freeze) {
10552
- freezeRightRows[i].setAttribute('aria-rowindex', i.toString());
10573
+ freezeRightRows[i].setAttribute('data-rowindex', i.toString());
10553
10574
  }
10554
10575
  }
10555
10576
  }
@@ -10609,7 +10630,9 @@ var BatchEdit = /** @__PURE__ @class */ (function () {
10609
10630
  if (!isNullOrUndefined(this.batchAddedRecords)) {
10610
10631
  for (var i = 0; i < this.batchAddedRecords.length; i++) {
10611
10632
  index = data.map(function (e) { return e[primaryKey]; }).indexOf(this.batchAddedRecords[i][primaryKey]);
10612
- data.splice(index, 1);
10633
+ if (index !== -1) {
10634
+ data.splice(index, 1);
10635
+ }
10613
10636
  if (this.parent.editSettings.newRowPosition === 'Child') {
10614
10637
  index = currentViewRecords.map(function (e) { return e[primaryKey]; })
10615
10638
  .indexOf(this.batchAddedRecords[i][parentItem] ? this.batchAddedRecords[i][parentItem][primaryKey]
@@ -10675,9 +10698,12 @@ var BatchEdit = /** @__PURE__ @class */ (function () {
10675
10698
  }
10676
10699
  if (this.parent.editSettings.newRowPosition !== 'Bottom' && !Object.hasOwnProperty.call(args, 'updatedRecords')) {
10677
10700
  data.splice(data.length - addRecords.length, addRecords.length);
10678
- if (this.parent.editModule['isAddedRowByMethod'] && addRecords.length && !isNullOrUndefined(this.parent.editModule['addRowIndex'])) {
10679
- var index_1 = parseInt(this.parent.getContentTable().getElementsByClassName('e-insertedrow')[0].getAttribute('aria-rowindex'), 10);
10680
- data.splice(index_1, 0, addRecords[0]);
10701
+ if (this.parent.editModule['isAddedRowByMethod'] && addRecords.length && !isNullOrUndefined(this.parent.editModule['addRowIndex']) && !this.parent.editModule['isAddedRowByContextMenu']) {
10702
+ addRecords.reverse();
10703
+ for (var i_1 = 0; i_1 < addRecords.length; i_1++) {
10704
+ var index_1 = parseInt(this.parent.getContentTable().getElementsByClassName('e-insertedrow')[i_1].getAttribute('data-rowindex'), 10);
10705
+ data.splice(index_1, 0, addRecords[i_1]);
10706
+ }
10681
10707
  }
10682
10708
  if (!this.parent.allowPaging && data.length !== currentViewRecords.length) {
10683
10709
  if (currentViewRecords.length > addRecords.length) {
@@ -10697,6 +10723,9 @@ var BatchEdit = /** @__PURE__ @class */ (function () {
10697
10723
  if (this.batchAddRowRecord.length === 0) {
10698
10724
  this.batchAddRowRecord.push(this.parent.flatData[args.index]);
10699
10725
  }
10726
+ if (this.parent.editModule['isAddedRowByContextMenu']) {
10727
+ addRecords.reverse();
10728
+ }
10700
10729
  for (i = 0; i < addRecords.length; i++) {
10701
10730
  var taskData = extend({}, addRecords[i]);
10702
10731
  delete taskData.parentItem;
@@ -10709,6 +10738,11 @@ var BatchEdit = /** @__PURE__ @class */ (function () {
10709
10738
  if (!isNullOrUndefined(taskData.primaryParent)) {
10710
10739
  delete taskData.primaryParent;
10711
10740
  }
10741
+ if (addRecords.length > 1 && this.parent.editModule['isAddedRowByContextMenu']) {
10742
+ var rowPosition = this.parent.editSettings.newRowPosition;
10743
+ this.parent.editSettings.newRowPosition = this.parent.editModule['previousNewRowPosition'];
10744
+ this.parent.editModule['previousNewRowPosition'] = rowPosition;
10745
+ }
10712
10746
  addRecords[i].taskData = taskData;
10713
10747
  addRowRecord = this.batchAddRowRecord[i];
10714
10748
  if (isNullOrUndefined(addRowRecord)) {
@@ -10748,15 +10782,18 @@ var BatchEdit = /** @__PURE__ @class */ (function () {
10748
10782
  }
10749
10783
  }
10750
10784
  this.parent.parentData = [];
10751
- for (var i_1 = 0; i_1 < data.length; i_1++) {
10752
- data[i_1][index] = i_1;
10753
- setValue('uniqueIDCollection.' + data[i_1][uniqueID] + '.index', i_1, this.parent);
10754
- if (!data[i_1][level]) {
10755
- this.parent.parentData.push(data[i_1]);
10785
+ for (var i_2 = 0; i_2 < data.length; i_2++) {
10786
+ data[i_2][index] = i_2;
10787
+ setValue('uniqueIDCollection.' + data[i_2][uniqueID] + '.index', i_2, this.parent);
10788
+ if (!data[i_2][level]) {
10789
+ this.parent.parentData.push(data[i_2]);
10756
10790
  }
10757
10791
  }
10758
10792
  }
10759
10793
  this.batchAddRowRecord = this.batchAddedRecords = this.batchRecords = this.batchDeletedRecords = this.currentViewRecords = [];
10794
+ if (this.parent.editModule['isAddedRowByContextMenu']) {
10795
+ this.parent.editModule['isAddedRowByContextMenu'] = false;
10796
+ }
10760
10797
  };
10761
10798
  BatchEdit.prototype.getActualRowObjectIndex = function (index) {
10762
10799
  var rows = this.parent.grid.getDataRows();
@@ -10826,6 +10863,7 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
10826
10863
  this.deletedRecords = 'deletedRecords';
10827
10864
  this.prevAriaRowIndex = '-1';
10828
10865
  this.isAddedRowByMethod = false;
10866
+ this.isAddedRowByContextMenu = false;
10829
10867
  Grid.Inject(Edit);
10830
10868
  this.parent = parent;
10831
10869
  this.isSelfReference = !isNullOrUndefined(parent.parentIdMapping);
@@ -10876,7 +10914,7 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
10876
10914
  Edit$$1.prototype.getRowPosition = function (addArgs) {
10877
10915
  addArgs.newRowPosition = this.parent.editSettings.newRowPosition;
10878
10916
  addArgs.addRowIndex = this.addRowIndex;
10879
- addArgs.ariaRowIndex = +this.prevAriaRowIndex;
10917
+ addArgs.dataRowIndex = +this.prevAriaRowIndex;
10880
10918
  };
10881
10919
  Edit$$1.prototype.beforeStartEdit = function (args) {
10882
10920
  this.parent.trigger(actionBegin, args);
@@ -11032,7 +11070,7 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
11032
11070
  if (!(this.parent.grid.editSettings.allowEditing) || this.parent.grid.isEdit) {
11033
11071
  return;
11034
11072
  }
11035
- var column = this.parent.grid.getColumnByIndex(+target.closest('td.e-rowcell').getAttribute('aria-colindex'));
11073
+ var column = this.parent.grid.getColumnByIndex(+target.closest('td.e-rowcell').getAttribute('data-colindex'));
11036
11074
  if (this.parent.editSettings.mode === 'Cell' && !this.isOnBatch && column && !column.isPrimaryKey &&
11037
11075
  this.parent.editSettings.allowEditing && column.allowEditing && !(target.classList.contains('e-treegridexpand') ||
11038
11076
  target.classList.contains('e-treegridcollapse')) && this.parent.editSettings.allowEditOnDblClick) {
@@ -11040,8 +11078,8 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
11040
11078
  this.parent.grid.setProperties({ selectedRowIndex: args.rowIndex }, true);
11041
11079
  if (this.parent.enableVirtualization) {
11042
11080
  var tr = parentsUntil(args.target, 'e-row');
11043
- this.prevAriaRowIndex = tr.getAttribute('aria-rowindex');
11044
- tr.setAttribute('aria-rowindex', tr.rowIndex + '');
11081
+ this.prevAriaRowIndex = tr.getAttribute('data-rowindex');
11082
+ tr.setAttribute('data-rowindex', tr.rowIndex + '');
11045
11083
  }
11046
11084
  this.updateGridEditMode('Batch');
11047
11085
  }
@@ -11081,7 +11119,7 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
11081
11119
  var prom = args[promise];
11082
11120
  delete args[promise];
11083
11121
  if (this.parent.enableVirtualization && !isNullOrUndefined(this.prevAriaRowIndex) && this.prevAriaRowIndex !== '-1') {
11084
- args.row.setAttribute('aria-rowindex', this.prevAriaRowIndex);
11122
+ args.row.setAttribute('data-rowindex', this.prevAriaRowIndex);
11085
11123
  this.prevAriaRowIndex = undefined;
11086
11124
  }
11087
11125
  if (this.keyPress !== 'enter') {
@@ -11337,9 +11375,11 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
11337
11375
  this.parent.parentData.push(data[i]);
11338
11376
  }
11339
11377
  }
11340
- if (details.action === 'add' && this.previousNewRowPosition != null) {
11341
- this.parent.setProperties({ editSettings: { newRowPosition: this.previousNewRowPosition } }, true);
11342
- this.previousNewRowPosition = null;
11378
+ if (!this.parent.enableInfiniteScrolling) {
11379
+ if (details.action === 'add' && this.previousNewRowPosition != null) {
11380
+ this.parent.setProperties({ editSettings: { newRowPosition: this.previousNewRowPosition } }, true);
11381
+ this.previousNewRowPosition = null;
11382
+ }
11343
11383
  }
11344
11384
  };
11345
11385
  Edit$$1.prototype.updateIndex = function (data, rows, records) {
@@ -11415,8 +11455,8 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
11415
11455
  }
11416
11456
  }
11417
11457
  var rows = this.parent.grid.getDataRows();
11418
- var firstAriaIndex = rows.length ? +rows[0].getAttribute('aria-rowindex') : 0;
11419
- var lastAriaIndex = rows.length ? +rows[rows.length - 1].getAttribute('aria-rowindex') : 0;
11458
+ var firstAriaIndex = rows.length ? +rows[0].getAttribute('data-rowindex') : 0;
11459
+ var lastAriaIndex = rows.length ? +rows[rows.length - 1].getAttribute('data-rowindex') : 0;
11420
11460
  var withinRange = this.selectedIndex >= firstAriaIndex && this.selectedIndex <= lastAriaIndex;
11421
11461
  var isVirtualization = this.parent.enableVirtualization && this.addRowIndex > -1 && this.prevAriaRowIndex !== '-1';
11422
11462
  if (this.parent.editSettings.mode !== 'Dialog') {
@@ -11486,20 +11526,27 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
11486
11526
  focussedElement.focus();
11487
11527
  }
11488
11528
  }
11489
- if (this.parent.editSettings.mode === 'Batch' && !isNullOrUndefined(this.addRowIndex) && this.addRowIndex !== -1) {
11529
+ if (this.parent.editSettings.mode === 'Batch' && !isNullOrUndefined(this.addRowIndex) && this.addRowIndex !== -1 && this['isAddedRowByMethod'] && !this.isAddedRowByContextMenu) {
11490
11530
  index = this.batchEditModule.getAddRowIndex();
11491
11531
  this.selectedIndex = this.batchEditModule.getSelectedIndex();
11492
- if (this.parent.editModule['isAddedRowByMethod']) {
11493
- var args = {
11494
- action: 'add',
11495
- data: this.parent.getBatchChanges()['addedRecords'][0],
11496
- index: index,
11497
- seletedRow: 0
11498
- };
11499
- this.parent.editModule.beginAddEdit(args);
11500
- this.parent.editModule.batchEditModule['batchAddRowRecord'].push(this.parent.editModule.batchEditModule['addRowRecord']);
11501
- this.parent.editModule.batchEditModule['batchAddedRecords'].push(args['data']);
11532
+ var batchAddedRecords = this.parent.getBatchChanges()['addedRecords'];
11533
+ var newlyAddedRecord = void 0;
11534
+ if (batchAddedRecords.length) {
11535
+ for (var i = 0; i < batchAddedRecords.length; i++) {
11536
+ if (isNullOrUndefined(batchAddedRecords[i].uniqueID)) {
11537
+ newlyAddedRecord = batchAddedRecords[i];
11538
+ }
11539
+ }
11502
11540
  }
11541
+ var args = {
11542
+ action: 'add',
11543
+ data: newlyAddedRecord,
11544
+ index: index,
11545
+ seletedRow: 0
11546
+ };
11547
+ this.beginAddEdit(args);
11548
+ this.batchEditModule['batchAddRowRecord'].push(this.batchEditModule['addRowRecord']);
11549
+ this.batchEditModule['batchAddedRecords'].push(args['data']);
11503
11550
  }
11504
11551
  };
11505
11552
  // private beforeDataBound(args: BeforeDataBoundArgs): void {
@@ -11566,7 +11613,7 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
11566
11613
  this.selectedIndex = this.parent.grid.selectedRowIndex;
11567
11614
  }
11568
11615
  if (this.parent.enableVirtualization) {
11569
- var selector = '.e-row[aria-rowindex="' + this.selectedIndex + '"]';
11616
+ var selector = '.e-row[data-rowindex="' + this.selectedIndex + '"]';
11570
11617
  var row = void 0;
11571
11618
  if (this.selectedIndex > -1 && this.parent.editSettings.newRowPosition !== 'Top' &&
11572
11619
  this.parent.editSettings.newRowPosition !== 'Bottom') {
@@ -11576,7 +11623,7 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
11576
11623
  }
11577
11624
  else {
11578
11625
  if (this.prevAriaRowIndex && this.prevAriaRowIndex !== '-1') {
11579
- selector = '.e-row[aria-rowindex="' + this.prevAriaRowIndex + '"]';
11626
+ selector = '.e-row[data-rowindex="' + this.prevAriaRowIndex + '"]';
11580
11627
  row = this.parent.getContent().querySelector(selector);
11581
11628
  this.addRowIndex = row ? row.rowIndex : 0;
11582
11629
  }
@@ -11587,14 +11634,19 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
11587
11634
  }
11588
11635
  else {
11589
11636
  if (this.isAddedRowByMethod && (this.parent.enableVirtualization || this.parent.enableInfiniteScrolling)) {
11590
- this.addRowIndex = args.index;
11637
+ if (args.index !== 0) {
11638
+ this.addRowIndex = args.index;
11639
+ }
11640
+ else {
11641
+ this.addRowIndex = this.parent.grid.selectedRowIndex;
11642
+ }
11591
11643
  }
11592
11644
  else {
11593
11645
  this.addRowIndex = this.parent.grid.selectedRowIndex > -1 ? this.parent.grid.selectedRowIndex : 0;
11594
11646
  }
11595
11647
  }
11596
11648
  if (this.isAddedRowByMethod && (this.parent.enableVirtualization || this.parent.enableInfiniteScrolling)) {
11597
- this.addRowRecord = this.parent.flatData[args.index];
11649
+ this.addRowRecord = this.parent.flatData[this.parent.grid.selectedRowIndex];
11598
11650
  }
11599
11651
  else {
11600
11652
  this.addRowRecord = this.parent.getSelectedRecords()[0];
@@ -11630,10 +11682,16 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
11630
11682
  var key = this.parent.grid.getPrimaryKeyFieldNames()[0];
11631
11683
  var position = null;
11632
11684
  value.taskData = isNullOrUndefined(value.taskData) ? extend({}, args.data) : value.taskData;
11633
- var currentData = this.parent.grid.getCurrentViewRecords();
11685
+ var currentData = void 0;
11686
+ if (this.parent.editSettings.mode === 'Batch' && this['isAddedRowByMethod'] && !isNullOrUndefined(this.addRowIndex)) {
11687
+ currentData = this.batchEditModule['batchRecords'];
11688
+ }
11689
+ else {
11690
+ currentData = this.parent.grid.getCurrentViewRecords();
11691
+ }
11634
11692
  if (this.parent.enableVirtualization && args.index !== 0) {
11635
11693
  this.addRowIndex = this.parent.grid.getCurrentViewRecords().indexOf(this.addRowRecord);
11636
- this.selectedIndex = parseInt(this.parent.getRows()[this.addRowIndex].getAttribute('aria-rowindex'), 10);
11694
+ this.selectedIndex = parseInt(this.parent.getRows()[this.addRowIndex].getAttribute('data-rowindex'), 10);
11637
11695
  }
11638
11696
  var index = this.addRowIndex;
11639
11697
  value.uniqueID = getUid(this.parent.element.id + '_data_');
@@ -11646,7 +11704,7 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
11646
11704
  var isVirtualization = this.parent.enableVirtualization && this.addRowIndex > -1 && this.prevAriaRowIndex !== '-1';
11647
11705
  var rows = this.parent.getRows();
11648
11706
  var firstAriaIndex = rows.length ? currentData.indexOf(currentData[0]) : 0;
11649
- var lastAriaIndex = rows.length ? +rows[rows.length - 1].getAttribute('aria-rowindex') : 0;
11707
+ var lastAriaIndex = rows.length ? +rows[rows.length - 1].getAttribute('data-rowindex') : 0;
11650
11708
  var withinRange = this.selectedIndex >= firstAriaIndex && this.selectedIndex <= lastAriaIndex;
11651
11709
  if (currentData.length) {
11652
11710
  idMapping = currentData[this.addRowIndex][this.parent.idMapping];
@@ -12011,7 +12069,7 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
12011
12069
  return new TreeVirtualRowModelGenerator(this.parent);
12012
12070
  };
12013
12071
  VirtualTreeContentRenderer.prototype.getRowByIndex = function (index) {
12014
- return this.parent.getDataRows().filter(function (e) { return parseInt(e.getAttribute('aria-rowindex'), 10) === index; })[0];
12072
+ return this.parent.getDataRows().filter(function (e) { return parseInt(e.getAttribute('data-rowindex'), 10) === index; })[0];
12015
12073
  };
12016
12074
  VirtualTreeContentRenderer.prototype.addEventListener = function () {
12017
12075
  this.parent.on(virtualActionArgs, this.virtualOtherAction, this);
@@ -12096,7 +12154,7 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
12096
12154
  getValue('virtualEle', this).setVirtualHeight(this.parent.getRowHeight() * e.count, '100%');
12097
12155
  }
12098
12156
  }
12099
- if ((!isNullOrUndefined(e.requestType) && e.requestType.toString() === 'collapseAll') || (this.isDataSourceChanged && this.startIndex === -1)) {
12157
+ if ((!isNullOrUndefined(e.requestType) && e.requestType.toString() === 'collapseAll') || (this.isDataSourceChanged && (this.startIndex === -1 || this.startIndex === 0 && this['preStartIndex'] === 0))) {
12100
12158
  this.contents.scrollTop = 0;
12101
12159
  this.isDataSourceChanged = false;
12102
12160
  }
@@ -12190,7 +12248,7 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
12190
12248
  return new Cell(opt);
12191
12249
  };
12192
12250
  VirtualTreeContentRenderer.prototype.beginEdit = function (e) {
12193
- var selector = '.e-row[aria-rowindex="' + e.index + '"]';
12251
+ var selector = '.e-row[data-rowindex="' + e.index + '"]';
12194
12252
  var index = this.parent.getContent().querySelector(selector).rowIndex;
12195
12253
  var rowData = this.parent.getCurrentViewRecords()[index];
12196
12254
  e.data = rowData;
@@ -12198,14 +12256,14 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
12198
12256
  VirtualTreeContentRenderer.prototype.beginAdd = function (args) {
12199
12257
  var addAction = 'addActionBegin';
12200
12258
  var isAdd = 'isAdd';
12201
- var addArgs = { newRowPosition: this.rowPosition, addRowIndex: this.addRowIndex, ariaRowIndex: this.ariaRowIndex };
12259
+ var addArgs = { newRowPosition: this.rowPosition, addRowIndex: this.addRowIndex, dataRowIndex: this.dataRowIndex };
12202
12260
  this.parent.notify('get-row-position', addArgs);
12203
12261
  this.rowPosition = addArgs.newRowPosition;
12204
12262
  this.addRowIndex = addArgs.addRowIndex;
12205
- this.ariaRowIndex = addArgs.ariaRowIndex;
12263
+ this.dataRowIndex = addArgs.dataRowIndex;
12206
12264
  var rows = this.parent.getRows();
12207
- var firstAriaIndex = rows.length ? +rows[0].getAttribute('aria-rowindex') : 0;
12208
- var lastAriaIndex = rows.length ? +rows[rows.length - 1].getAttribute('aria-rowindex') : 0;
12265
+ var firstAriaIndex = rows.length ? +rows[0].getAttribute('data-rowindex') : 0;
12266
+ var lastAriaIndex = rows.length ? +rows[rows.length - 1].getAttribute('data-rowindex') : 0;
12209
12267
  var withInRange = this.parent.selectedRowIndex >= firstAriaIndex && this.parent.selectedRowIndex <= lastAriaIndex;
12210
12268
  if (!(this.rowPosition === 'Top' || this.rowPosition === 'Bottom')) {
12211
12269
  this[isAdd] = true;
@@ -12256,11 +12314,11 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
12256
12314
  };
12257
12315
  VirtualTreeContentRenderer.prototype.onActionComplete = function (args) {
12258
12316
  if (args.requestType === 'add') {
12259
- var addArgs = { newRowPosition: this.rowPosition, addRowIndex: this.addRowIndex, ariaRowIndex: this.ariaRowIndex };
12317
+ var addArgs = { newRowPosition: this.rowPosition, addRowIndex: this.addRowIndex, dataRowIndex: this.dataRowIndex };
12260
12318
  this.parent.notify('get-row-position', addArgs);
12261
12319
  this.rowPosition = addArgs.newRowPosition;
12262
12320
  this.addRowIndex = addArgs.addRowIndex;
12263
- this.ariaRowIndex = addArgs.ariaRowIndex;
12321
+ this.dataRowIndex = addArgs.dataRowIndex;
12264
12322
  }
12265
12323
  var actionComplete$$1 = 'actionComplete';
12266
12324
  _super.prototype[actionComplete$$1].call(this, args);
@@ -12323,7 +12381,7 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
12323
12381
  !isNullOrUndefined(this.parent.getContent().querySelectorAll('.e-content tr')[rowPt])) {
12324
12382
  var attr = this.parent.getContent().querySelectorAll('.e-content tr')[rowPt]
12325
12383
  .querySelector('td').getAttribute('index');
12326
- firsttdinx = +attr; // this.parent.getContent().querySelector('.e-content tr').getAttribute('aria-rowindex');
12384
+ firsttdinx = +attr; // this.parent.getContent().querySelector('.e-content tr').getAttribute('data-rowindex');
12327
12385
  }
12328
12386
  if (firsttdinx === 0) {
12329
12387
  if (this.parent.allowRowDragAndDrop) {
@@ -12422,7 +12480,7 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
12422
12480
  var isAdd = 'isAdd';
12423
12481
  if (this[isAdd] && !this.parent.getContent().querySelector('.e-content').querySelector('.e-addedrow')) {
12424
12482
  if (!(this.rowPosition === 'Top' || this.rowPosition === 'Bottom')) {
12425
- if (this.ariaRowIndex >= this.startIndex) {
12483
+ if (this.dataRowIndex >= this.startIndex) {
12426
12484
  this.restoreNewRow();
12427
12485
  }
12428
12486
  else if (this.addRowIndex && this.addRowIndex > -1) {
@@ -13025,6 +13083,9 @@ var InfiniteScroll$1 = /** @__PURE__ @class */ (function () {
13025
13083
  });
13026
13084
  var actionArgs = getValue('actionArgs', pageingDetails.actionArgs);
13027
13085
  var actions = getValue('actions', this.parent.grid.infiniteScrollModule);
13086
+ if (this.parent.grid.infiniteScrollModule['isInitialRender'] && !this.parent.initialRender) {
13087
+ this.parent.grid.pageSettings.currentPage = 1;
13088
+ }
13028
13089
  var initial = actions.some(function (value) { return value === actionArgs.requestType; });
13029
13090
  var initialRender = initial ? true : this.parent.initialRender ? true : false;
13030
13091
  this.visualData = visualData;
@@ -13039,8 +13100,8 @@ var InfiniteScroll$1 = /** @__PURE__ @class */ (function () {
13039
13100
  this.parent.infiniteScrollSettings.initialBlocks = this.parent.infiniteScrollSettings.maxBlocks;
13040
13101
  }
13041
13102
  var size = initialRender ?
13042
- this.parent.pageSettings.pageSize * this.parent.infiniteScrollSettings.initialBlocks :
13043
- this.parent.pageSettings.pageSize;
13103
+ this.parent.grid.pageSettings.pageSize * this.parent.infiniteScrollSettings.initialBlocks :
13104
+ this.parent.grid.pageSettings.pageSize;
13044
13105
  var current = this.parent.grid.pageSettings.currentPage;
13045
13106
  if (!isNullOrUndefined(actionArgs)) {
13046
13107
  var lastIndex = getValue('lastIndex', this.parent.grid.infiniteScrollModule);
@@ -13058,7 +13119,7 @@ var InfiniteScroll$1 = /** @__PURE__ @class */ (function () {
13058
13119
  else {
13059
13120
  if ((pageingDetails.actionArgs['action'] === 'expand' || pageingDetails.actionArgs['action'] === 'collapse') && this.parent.grid.pageSettings.currentPage !== 1) {
13060
13121
  current = 1;
13061
- size = this.parent.pageSettings.pageSize * this.parent.grid.pageSettings.currentPage;
13122
+ size = this.parent.grid.pageSettings.pageSize * this.parent.grid.pageSettings.currentPage;
13062
13123
  }
13063
13124
  query = query.page(current, size);
13064
13125
  }
@@ -13230,5 +13291,5 @@ var InfiniteScroll$1 = /** @__PURE__ @class */ (function () {
13230
13291
  * Export TreeGrid component
13231
13292
  */
13232
13293
 
13233
- export { TreeGrid, load, rowDataBound, dataBound, queryCellInfo, beforeDataBound, actionBegin, dataStateChange, actionComplete, rowSelecting, rowSelected, checkboxChange, rowDeselected, toolbarClick, beforeExcelExport, beforePdfExport, resizeStop, expanded, expanding, collapsed, collapsing, remoteExpand, localPagedExpandCollapse, pagingActions, printGridInit, contextMenuOpen, contextMenuClick, beforeCopy, beforePaste, savePreviousRowPosition, crudAction, beginEdit, beginAdd, recordDoubleClick, cellSave, cellSaved, cellEdit, batchDelete, batchCancel, batchAdd, beforeBatchDelete, beforeBatchAdd, beforeBatchSave, batchSave, keyPressed, updateData, doubleTap, virtualColumnIndex, virtualActionArgs, destroy, dataListener, indexModifier, beforeStartEdit, beforeBatchCancel, batchEditFormRendered, detailDataBound, rowDrag, rowDragStartHelper, rowDrop, rowDragStart, rowsAdd, rowsRemove, rowdraging, rowDropped, autoCol, DataManipulation, Reorder$1 as Reorder, Resize$1 as Resize, RowDD$1 as RowDD, Column, EditSettings, Predicate$1 as Predicate, FilterSettings, PageSettings, SearchSettings, SelectionSettings, AggregateColumn, AggregateRow, SortDescriptor, SortSettings, RowDropSettings$1 as RowDropSettings, InfiniteScrollSettings, Render, TreeVirtualRowModelGenerator, isRemoteData, isCountRequired, isCheckboxcolumn, isFilterChildHierarchy, findParentRecords, getExpandStatus, findChildrenRecords, isOffline, extendArray, getPlainData, getParentData, isHidden, ToolbarItem, ContextMenuItems, Filter$1 as Filter, ExcelExport$1 as ExcelExport, PdfExport$1 as PdfExport, Page$1 as Page, Toolbar$1 as Toolbar, Aggregate$1 as Aggregate, Sort$1 as Sort, TreeClipboard, ColumnMenu$1 as ColumnMenu, ContextMenu$1 as ContextMenu, Edit$1 as Edit, CommandColumn$1 as CommandColumn, Selection, DetailRow$1 as DetailRow, VirtualScroll$1 as VirtualScroll, TreeVirtual, Freeze$1 as Freeze, ColumnChooser$1 as ColumnChooser, Logger$1 as Logger, treeGridDetails, InfiniteScroll$1 as InfiniteScroll };
13294
+ export { TreeGrid, load, rowDataBound, dataBound, queryCellInfo, beforeDataBound, actionBegin, dataStateChange, actionComplete, rowSelecting, rowSelected, checkboxChange, rowDeselected, toolbarClick, beforeExcelExport, beforePdfExport, resizeStop, expanded, expanding, collapsed, collapsing, remoteExpand, localPagedExpandCollapse, pagingActions, printGridInit, contextMenuOpen, contextMenuClick, beforeCopy, beforePaste, savePreviousRowPosition, crudAction, beginEdit, beginAdd, recordDoubleClick, cellSave, cellSaved, cellEdit, batchDelete, batchCancel, batchAdd, beforeBatchDelete, beforeBatchAdd, beforeBatchSave, batchSave, keyPressed, updateData, doubleTap, virtualColumnIndex, virtualActionArgs, destroy, dataListener, indexModifier, beforeStartEdit, beforeBatchCancel, batchEditFormRendered, detailDataBound, rowDrag, rowDragStartHelper, rowDrop, rowDragStart, rowsAdd, rowsRemove, rowdraging, rowDropped, autoCol, rowDeselecting, DataManipulation, Reorder$1 as Reorder, Resize$1 as Resize, RowDD$1 as RowDD, Column, EditSettings, Predicate$1 as Predicate, FilterSettings, PageSettings, SearchSettings, SelectionSettings, AggregateColumn, AggregateRow, SortDescriptor, SortSettings, RowDropSettings$1 as RowDropSettings, InfiniteScrollSettings, Render, TreeVirtualRowModelGenerator, isRemoteData, isCountRequired, isCheckboxcolumn, isFilterChildHierarchy, findParentRecords, getExpandStatus, findChildrenRecords, isOffline, extendArray, getPlainData, getParentData, isHidden, ToolbarItem, ContextMenuItems, Filter$1 as Filter, ExcelExport$1 as ExcelExport, PdfExport$1 as PdfExport, Page$1 as Page, Toolbar$1 as Toolbar, Aggregate$1 as Aggregate, Sort$1 as Sort, TreeClipboard, ColumnMenu$1 as ColumnMenu, ContextMenu$1 as ContextMenu, Edit$1 as Edit, CommandColumn$1 as CommandColumn, Selection, DetailRow$1 as DetailRow, VirtualScroll$1 as VirtualScroll, TreeVirtual, Freeze$1 as Freeze, ColumnChooser$1 as ColumnChooser, Logger$1 as Logger, treeGridDetails, InfiniteScroll$1 as InfiniteScroll };
13234
13295
  //# sourceMappingURL=ej2-treegrid.es5.js.map