@syncfusion/ej2-treegrid 20.2.39 → 20.2.44

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 (item) { return !item.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]);
@@ -1314,7 +1316,7 @@ var Selection = /** @__PURE__ @class */ (function () {
1314
1316
  childData = (!isNullOrUndefined(this.parent.filterModule) && this.parent.filterModule.filteredResult.length > 0) ?
1315
1317
  this.parent.getCurrentViewRecords() : this.parent.flatData;
1316
1318
  childData.forEach(function (record) {
1317
- if (_this.parent.enableVirtualization) {
1319
+ if (_this.parent.enableVirtualization && record.childRecords.length > 0) {
1318
1320
  if (record.hasChildRecords) {
1319
1321
  _this.updateParentSelection(record);
1320
1322
  }
@@ -1733,7 +1735,7 @@ var Render = /** @__PURE__ @class */ (function () {
1733
1735
  var templateFn = 'templateFn';
1734
1736
  var colindex = args.column.index;
1735
1737
  if (isNullOrUndefined(treeColumn.field)) {
1736
- args.cell.setAttribute('aria-colindex', colindex + '');
1738
+ args.cell.setAttribute('data-colindex', colindex + '');
1737
1739
  }
1738
1740
  if (treeColumn.field === args.column.field && !isNullOrUndefined(treeColumn.template)) {
1739
1741
  args.column.template = treeColumn.template;
@@ -3925,16 +3927,23 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
3925
3927
  TreeGrid.prototype.triggerEvents = function (args) {
3926
3928
  this.trigger(getObject('name', args), args);
3927
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
+ };
3928
3937
  TreeGrid.prototype.bindGridEvents = function () {
3929
3938
  var _this = this;
3930
3939
  this.grid.rowSelecting = 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
- }
3940
+ _this.IsExpandCollapseClicked(args);
3936
3941
  _this.trigger(rowSelecting, args);
3937
3942
  };
3943
+ this.grid.rowDeselecting = function (args) {
3944
+ _this.IsExpandCollapseClicked(args);
3945
+ _this.trigger(rowDeselecting, args);
3946
+ };
3938
3947
  this.grid.rowSelected = function (args) {
3939
3948
  if (_this.enableVirtualization && args.isHeaderCheckboxClicked &&
3940
3949
  _this.grid.currentViewData.length !== _this.grid.selectionModule.selectedRowIndexes.length) {
@@ -5719,7 +5728,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
5719
5728
  }
5720
5729
  else if (isNullOrUndefined(record)) {
5721
5730
  if (this.detailTemplate) {
5722
- record = this.grid.getCurrentViewRecords()[row.getAttribute('aria-rowindex')];
5731
+ record = this.grid.getCurrentViewRecords()[row.getAttribute('data-rowindex')];
5723
5732
  }
5724
5733
  else {
5725
5734
  record = this.grid.getCurrentViewRecords()[row.rowIndex];
@@ -5997,7 +6006,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
5997
6006
  row = gridRows[rowIndex];
5998
6007
  }
5999
6008
  else {
6000
- rowIndex = +row.getAttribute('aria-rowindex');
6009
+ rowIndex = +row.getAttribute('data-rowindex');
6001
6010
  }
6002
6011
  if (!isNullOrUndefined(row)) {
6003
6012
  row.setAttribute('aria-expanded', action === 'expand' ? 'true' : 'false');
@@ -7402,7 +7411,7 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
7402
7411
  dropIndex = this.selectedRow.rowIndex - 1;
7403
7412
  }
7404
7413
  if (this.parent.enableVirtualization && this.parent.allowRowDragAndDrop && this.selectedRecord) {
7405
- dropIndex = parseInt(this.selectedRow.getAttribute('aria-rowindex'), 10) - 1;
7414
+ dropIndex = parseInt(this.selectedRow.getAttribute('data-rowindex'), 10) - 1;
7406
7415
  }
7407
7416
  tObj[action] = 'indenting';
7408
7417
  tObj[droppedIndex] = dropIndex;
@@ -7421,7 +7430,7 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
7421
7430
  }
7422
7431
  }
7423
7432
  if (this.parent.enableVirtualization && this.parent.allowRowDragAndDrop && this.selectedRecord) {
7424
- dropIndex = parseInt(this.parent.getRows()[dropIndex].getAttribute('aria-rowindex'), 10);
7433
+ dropIndex = parseInt(this.parent.getRows()[dropIndex].getAttribute('data-rowindex'), 10);
7425
7434
  }
7426
7435
  tObj[action] = 'outdenting';
7427
7436
  tObj[droppedIndex] = dropIndex;
@@ -7441,7 +7450,7 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
7441
7450
  if (!actionArgs.cancel) {
7442
7451
  if (actionArgs.action === 'indenting') {
7443
7452
  if (_this.parent.enableVirtualization && _this.parent.allowRowDragAndDrop) {
7444
- _this.reorderRows([parseInt(_this.selectedRow.getAttribute('aria-rowindex'), 10)], dropIndex, 'child');
7453
+ _this.reorderRows([parseInt(_this.selectedRow.getAttribute('data-rowindex'), 10)], dropIndex, 'child');
7445
7454
  }
7446
7455
  else {
7447
7456
  _this.reorderRows([_this.selectedRow.rowIndex], dropIndex, 'child');
@@ -7449,7 +7458,7 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
7449
7458
  }
7450
7459
  else if (actionArgs.action === 'outdenting') {
7451
7460
  if (_this.parent.enableVirtualization && _this.parent.allowRowDragAndDrop) {
7452
- _this.reorderRows([parseInt(_this.selectedRow.getAttribute('aria-rowindex'), 10)], dropIndex, 'below');
7461
+ _this.reorderRows([parseInt(_this.selectedRow.getAttribute('data-rowindex'), 10)], dropIndex, 'below');
7453
7462
  }
7454
7463
  else {
7455
7464
  _this.reorderRows([_this.selectedRow.rowIndex], dropIndex, 'below');
@@ -8075,7 +8084,7 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
8075
8084
  }
8076
8085
  };
8077
8086
  RowDD$$1.prototype.getTargetIdx = function (targetRow) {
8078
- return targetRow ? parseInt(targetRow.getAttribute('aria-rowindex'), 10) : 0;
8087
+ return targetRow ? parseInt(targetRow.getAttribute('data-rowindex'), 10) : 0;
8079
8088
  };
8080
8089
  RowDD$$1.prototype.getParentData = function (record, data) {
8081
8090
  var parentItem = record.parentItem;
@@ -8876,7 +8885,8 @@ var Filter$1 = /** @__PURE__ @class */ (function () {
8876
8885
  }
8877
8886
  }
8878
8887
  else {
8879
- if (parent['expanded'] === false && this.parent.getVisibleRecords().indexOf(record) === -1 && isNullOrUndefined(this.parent['dataResults']['action'])) {
8888
+ if ((!this.parent.enableCollapseAll || !this.parent.initialRender && isNullOrUndefined(this.parent['dataResults']['result']))
8889
+ && parent['expanded'] === false && this.parent.getVisibleRecords().indexOf(record) === -1) {
8880
8890
  this.parent.expandRow(this.parent.getRows()[parent['index']], parent);
8881
8891
  }
8882
8892
  this.addParentRecord(parent);
@@ -10161,6 +10171,7 @@ var ContextMenu$1 = /** @__PURE__ @class */ (function () {
10161
10171
  if (args.item.id === 'Above' || args.item.id === 'Below' || args.item.id === 'Child') {
10162
10172
  this.parent.notify('savePreviousRowPosition', args);
10163
10173
  this.parent.setProperties({ editSettings: { newRowPosition: args.item.id } }, true);
10174
+ this.parent.editModule['isAddedRowByContextMenu'] = true;
10164
10175
  this.parent.addRecord();
10165
10176
  }
10166
10177
  if (args.item.id === this.parent.element.id + '_gridcontrol_cmenu_Indent' || args.item.id === this.parent.element.id + '_gridcontrol_cmenu_Outdent') {
@@ -10432,10 +10443,12 @@ var BatchEdit = /** @__PURE__ @class */ (function () {
10432
10443
  this.parent.editModule[isTabLastRow] = false;
10433
10444
  return;
10434
10445
  }
10435
- if (this.parent.editModule['isAddedRowByMethod'] && !isNullOrUndefined(this.parent.editModule['addRowIndex']) && this.parent.grid.selectedRowIndex === -1) {
10446
+ if (this.parent.editModule['isAddedRowByMethod'] && !isNullOrUndefined(this.parent.editModule['addRowIndex']) &&
10447
+ !this.parent.editModule['isAddedRowByContextMenu'] && (this.parent.grid.selectedRowIndex === -1 || this.parent.editModule['batchEditModule'].isAdd)) {
10436
10448
  this.selectedIndex = this.parent.editModule['selectedIndex'];
10437
10449
  this.addRowIndex = this.parent.editModule['addRowIndex'];
10438
- this.addRowRecord = this.parent.getCurrentViewRecords()[this.selectedIndex];
10450
+ this.addRowRecord = this.batchRecords.length ? this.batchRecords[this.selectedIndex]
10451
+ : this.parent.getCurrentViewRecords()[this.selectedIndex];
10439
10452
  }
10440
10453
  else {
10441
10454
  this.selectedIndex = this.parent.grid.selectedRowIndex;
@@ -10482,6 +10495,11 @@ var BatchEdit = /** @__PURE__ @class */ (function () {
10482
10495
  // }
10483
10496
  }
10484
10497
  focusModule.getContent().matrix.current = [actualIndex, focusModule.getContent().matrix.current[1]];
10498
+ if (this.parent.editModule['isAddedRowByMethod'] && !isNullOrUndefined(this.parent.editModule['addRowIndex']) && !this.parent.editModule['isAddedRowByContextMenu']) {
10499
+ var newlyAddedRecords = this.parent.getBatchChanges()['addedRecords'];
10500
+ var index = parseInt(this.parent.getContentTable().getElementsByClassName('e-insertedrow')[newlyAddedRecords.length - 1].getAttribute('data-rowindex'), 10);
10501
+ this.batchRecords.splice(index, 0, newlyAddedRecords[newlyAddedRecords.length - 1]);
10502
+ }
10485
10503
  }
10486
10504
  };
10487
10505
  BatchEdit.prototype.beforeBatchDelete = function (args) {
@@ -10507,7 +10525,7 @@ var BatchEdit = /** @__PURE__ @class */ (function () {
10507
10525
  childs = findChildrenRecords(data);
10508
10526
  uid = this.parent.getSelectedRows()[0].getAttribute('data-uid');
10509
10527
  }
10510
- var parentRowIndex = parseInt(this.parent.grid.getRowElementByUID(uid).getAttribute('aria-rowindex'), 10);
10528
+ var parentRowIndex = parseInt(this.parent.grid.getRowElementByUID(uid).getAttribute('data-rowindex'), 10);
10511
10529
  if (childs.length) {
10512
10530
  var totalCount = parentRowIndex + childs.length;
10513
10531
  var firstChildIndex = parentRowIndex + 1;
@@ -10544,7 +10562,7 @@ var BatchEdit = /** @__PURE__ @class */ (function () {
10544
10562
  BatchEdit.prototype.updateRowIndex = function () {
10545
10563
  var rows = this.parent.grid.getDataRows();
10546
10564
  for (var i = 0; i < rows.length; i++) {
10547
- rows[i].setAttribute('aria-rowindex', i.toString());
10565
+ rows[i].setAttribute('data-rowindex', i.toString());
10548
10566
  }
10549
10567
  var freeze = (this.parent.getFrozenLeftColumnsCount() > 0 ||
10550
10568
  this.parent.getFrozenRightColumnsCount() > 0) ? true : false;
@@ -10552,9 +10570,9 @@ var BatchEdit = /** @__PURE__ @class */ (function () {
10552
10570
  var mRows = this.parent.grid.getMovableDataRows();
10553
10571
  var freezeRightRows = this.parent.grid.getFrozenRightDataRows();
10554
10572
  for (var i = 0; i < mRows.length; i++) {
10555
- mRows[i].setAttribute('aria-rowindex', i.toString());
10573
+ mRows[i].setAttribute('data-rowindex', i.toString());
10556
10574
  if (freeze) {
10557
- freezeRightRows[i].setAttribute('aria-rowindex', i.toString());
10575
+ freezeRightRows[i].setAttribute('data-rowindex', i.toString());
10558
10576
  }
10559
10577
  }
10560
10578
  }
@@ -10614,7 +10632,9 @@ var BatchEdit = /** @__PURE__ @class */ (function () {
10614
10632
  if (!isNullOrUndefined(this.batchAddedRecords)) {
10615
10633
  for (var i = 0; i < this.batchAddedRecords.length; i++) {
10616
10634
  index = data.map(function (e) { return e[primaryKey]; }).indexOf(this.batchAddedRecords[i][primaryKey]);
10617
- data.splice(index, 1);
10635
+ if (index !== -1) {
10636
+ data.splice(index, 1);
10637
+ }
10618
10638
  if (this.parent.editSettings.newRowPosition === 'Child') {
10619
10639
  index = currentViewRecords.map(function (e) { return e[primaryKey]; })
10620
10640
  .indexOf(this.batchAddedRecords[i][parentItem] ? this.batchAddedRecords[i][parentItem][primaryKey]
@@ -10680,9 +10700,12 @@ var BatchEdit = /** @__PURE__ @class */ (function () {
10680
10700
  }
10681
10701
  if (this.parent.editSettings.newRowPosition !== 'Bottom' && !Object.hasOwnProperty.call(args, 'updatedRecords')) {
10682
10702
  data.splice(data.length - addRecords.length, addRecords.length);
10683
- if (this.parent.editModule['isAddedRowByMethod'] && addRecords.length && !isNullOrUndefined(this.parent.editModule['addRowIndex'])) {
10684
- var index_1 = parseInt(this.parent.getContentTable().getElementsByClassName('e-insertedrow')[0].getAttribute('aria-rowindex'), 10);
10685
- data.splice(index_1, 0, addRecords[0]);
10703
+ if (this.parent.editModule['isAddedRowByMethod'] && addRecords.length && !isNullOrUndefined(this.parent.editModule['addRowIndex']) && !this.parent.editModule['isAddedRowByContextMenu']) {
10704
+ addRecords.reverse();
10705
+ for (var i_1 = 0; i_1 < addRecords.length; i_1++) {
10706
+ var index_1 = parseInt(this.parent.getContentTable().getElementsByClassName('e-insertedrow')[i_1].getAttribute('data-rowindex'), 10);
10707
+ data.splice(index_1, 0, addRecords[i_1]);
10708
+ }
10686
10709
  }
10687
10710
  if (!this.parent.allowPaging && data.length !== currentViewRecords.length) {
10688
10711
  if (currentViewRecords.length > addRecords.length) {
@@ -10702,6 +10725,9 @@ var BatchEdit = /** @__PURE__ @class */ (function () {
10702
10725
  if (this.batchAddRowRecord.length === 0) {
10703
10726
  this.batchAddRowRecord.push(this.parent.flatData[args.index]);
10704
10727
  }
10728
+ if (this.parent.editModule['isAddedRowByContextMenu']) {
10729
+ addRecords.reverse();
10730
+ }
10705
10731
  for (i = 0; i < addRecords.length; i++) {
10706
10732
  var taskData = extend({}, addRecords[i]);
10707
10733
  delete taskData.parentItem;
@@ -10714,6 +10740,11 @@ var BatchEdit = /** @__PURE__ @class */ (function () {
10714
10740
  if (!isNullOrUndefined(taskData.primaryParent)) {
10715
10741
  delete taskData.primaryParent;
10716
10742
  }
10743
+ if (addRecords.length > 1 && this.parent.editModule['isAddedRowByContextMenu']) {
10744
+ var rowPosition = this.parent.editSettings.newRowPosition;
10745
+ this.parent.editSettings.newRowPosition = this.parent.editModule['previousNewRowPosition'];
10746
+ this.parent.editModule['previousNewRowPosition'] = rowPosition;
10747
+ }
10717
10748
  addRecords[i].taskData = taskData;
10718
10749
  addRowRecord = this.batchAddRowRecord[i];
10719
10750
  if (isNullOrUndefined(addRowRecord)) {
@@ -10753,15 +10784,18 @@ var BatchEdit = /** @__PURE__ @class */ (function () {
10753
10784
  }
10754
10785
  }
10755
10786
  this.parent.parentData = [];
10756
- for (var i_1 = 0; i_1 < data.length; i_1++) {
10757
- data[i_1][index] = i_1;
10758
- setValue('uniqueIDCollection.' + data[i_1][uniqueID] + '.index', i_1, this.parent);
10759
- if (!data[i_1][level]) {
10760
- this.parent.parentData.push(data[i_1]);
10787
+ for (var i_2 = 0; i_2 < data.length; i_2++) {
10788
+ data[i_2][index] = i_2;
10789
+ setValue('uniqueIDCollection.' + data[i_2][uniqueID] + '.index', i_2, this.parent);
10790
+ if (!data[i_2][level]) {
10791
+ this.parent.parentData.push(data[i_2]);
10761
10792
  }
10762
10793
  }
10763
10794
  }
10764
10795
  this.batchAddRowRecord = this.batchAddedRecords = this.batchRecords = this.batchDeletedRecords = this.currentViewRecords = [];
10796
+ if (this.parent.editModule['isAddedRowByContextMenu']) {
10797
+ this.parent.editModule['isAddedRowByContextMenu'] = false;
10798
+ }
10765
10799
  };
10766
10800
  BatchEdit.prototype.getActualRowObjectIndex = function (index) {
10767
10801
  var rows = this.parent.grid.getDataRows();
@@ -10831,6 +10865,7 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
10831
10865
  this.deletedRecords = 'deletedRecords';
10832
10866
  this.prevAriaRowIndex = '-1';
10833
10867
  this.isAddedRowByMethod = false;
10868
+ this.isAddedRowByContextMenu = false;
10834
10869
  Grid.Inject(Edit);
10835
10870
  this.parent = parent;
10836
10871
  this.isSelfReference = !isNullOrUndefined(parent.parentIdMapping);
@@ -10881,7 +10916,7 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
10881
10916
  Edit$$1.prototype.getRowPosition = function (addArgs) {
10882
10917
  addArgs.newRowPosition = this.parent.editSettings.newRowPosition;
10883
10918
  addArgs.addRowIndex = this.addRowIndex;
10884
- addArgs.ariaRowIndex = +this.prevAriaRowIndex;
10919
+ addArgs.dataRowIndex = +this.prevAriaRowIndex;
10885
10920
  };
10886
10921
  Edit$$1.prototype.beforeStartEdit = function (args) {
10887
10922
  this.parent.trigger(actionBegin, args);
@@ -11037,7 +11072,7 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
11037
11072
  if (!(this.parent.grid.editSettings.allowEditing) || this.parent.grid.isEdit) {
11038
11073
  return;
11039
11074
  }
11040
- var column = this.parent.grid.getColumnByIndex(+target.closest('td.e-rowcell').getAttribute('aria-colindex'));
11075
+ var column = this.parent.grid.getColumnByIndex(+target.closest('td.e-rowcell').getAttribute('data-colindex'));
11041
11076
  if (this.parent.editSettings.mode === 'Cell' && !this.isOnBatch && column && !column.isPrimaryKey &&
11042
11077
  this.parent.editSettings.allowEditing && column.allowEditing && !(target.classList.contains('e-treegridexpand') ||
11043
11078
  target.classList.contains('e-treegridcollapse')) && this.parent.editSettings.allowEditOnDblClick) {
@@ -11045,8 +11080,8 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
11045
11080
  this.parent.grid.setProperties({ selectedRowIndex: args.rowIndex }, true);
11046
11081
  if (this.parent.enableVirtualization) {
11047
11082
  var tr = parentsUntil(args.target, 'e-row');
11048
- this.prevAriaRowIndex = tr.getAttribute('aria-rowindex');
11049
- tr.setAttribute('aria-rowindex', tr.rowIndex + '');
11083
+ this.prevAriaRowIndex = tr.getAttribute('data-rowindex');
11084
+ tr.setAttribute('data-rowindex', tr.rowIndex + '');
11050
11085
  }
11051
11086
  this.updateGridEditMode('Batch');
11052
11087
  }
@@ -11086,7 +11121,7 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
11086
11121
  var prom = args[promise];
11087
11122
  delete args[promise];
11088
11123
  if (this.parent.enableVirtualization && !isNullOrUndefined(this.prevAriaRowIndex) && this.prevAriaRowIndex !== '-1') {
11089
- args.row.setAttribute('aria-rowindex', this.prevAriaRowIndex);
11124
+ args.row.setAttribute('data-rowindex', this.prevAriaRowIndex);
11090
11125
  this.prevAriaRowIndex = undefined;
11091
11126
  }
11092
11127
  if (this.keyPress !== 'enter') {
@@ -11422,8 +11457,8 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
11422
11457
  }
11423
11458
  }
11424
11459
  var rows = this.parent.grid.getDataRows();
11425
- var firstAriaIndex = rows.length ? +rows[0].getAttribute('aria-rowindex') : 0;
11426
- var lastAriaIndex = rows.length ? +rows[rows.length - 1].getAttribute('aria-rowindex') : 0;
11460
+ var firstAriaIndex = rows.length ? +rows[0].getAttribute('data-rowindex') : 0;
11461
+ var lastAriaIndex = rows.length ? +rows[rows.length - 1].getAttribute('data-rowindex') : 0;
11427
11462
  var withinRange = this.selectedIndex >= firstAriaIndex && this.selectedIndex <= lastAriaIndex;
11428
11463
  var isVirtualization = this.parent.enableVirtualization && this.addRowIndex > -1 && this.prevAriaRowIndex !== '-1';
11429
11464
  if (this.parent.editSettings.mode !== 'Dialog') {
@@ -11493,20 +11528,27 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
11493
11528
  focussedElement.focus();
11494
11529
  }
11495
11530
  }
11496
- if (this.parent.editSettings.mode === 'Batch' && !isNullOrUndefined(this.addRowIndex) && this.addRowIndex !== -1) {
11531
+ if (this.parent.editSettings.mode === 'Batch' && !isNullOrUndefined(this.addRowIndex) && this.addRowIndex !== -1 && this['isAddedRowByMethod'] && !this.isAddedRowByContextMenu) {
11497
11532
  index = this.batchEditModule.getAddRowIndex();
11498
11533
  this.selectedIndex = this.batchEditModule.getSelectedIndex();
11499
- if (this.parent.editModule['isAddedRowByMethod']) {
11500
- var args = {
11501
- action: 'add',
11502
- data: this.parent.getBatchChanges()['addedRecords'][0],
11503
- index: index,
11504
- seletedRow: 0
11505
- };
11506
- this.parent.editModule.beginAddEdit(args);
11507
- this.parent.editModule.batchEditModule['batchAddRowRecord'].push(this.parent.editModule.batchEditModule['addRowRecord']);
11508
- this.parent.editModule.batchEditModule['batchAddedRecords'].push(args['data']);
11534
+ var batchAddedRecords = this.parent.getBatchChanges()['addedRecords'];
11535
+ var newlyAddedRecord = void 0;
11536
+ if (batchAddedRecords.length) {
11537
+ for (var i = 0; i < batchAddedRecords.length; i++) {
11538
+ if (isNullOrUndefined(batchAddedRecords[i].uniqueID)) {
11539
+ newlyAddedRecord = batchAddedRecords[i];
11540
+ }
11541
+ }
11509
11542
  }
11543
+ var args = {
11544
+ action: 'add',
11545
+ data: newlyAddedRecord,
11546
+ index: index,
11547
+ seletedRow: 0
11548
+ };
11549
+ this.beginAddEdit(args);
11550
+ this.batchEditModule['batchAddRowRecord'].push(this.batchEditModule['addRowRecord']);
11551
+ this.batchEditModule['batchAddedRecords'].push(args['data']);
11510
11552
  }
11511
11553
  };
11512
11554
  // private beforeDataBound(args: BeforeDataBoundArgs): void {
@@ -11573,7 +11615,7 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
11573
11615
  this.selectedIndex = this.parent.grid.selectedRowIndex;
11574
11616
  }
11575
11617
  if (this.parent.enableVirtualization) {
11576
- var selector = '.e-row[aria-rowindex="' + this.selectedIndex + '"]';
11618
+ var selector = '.e-row[data-rowindex="' + this.selectedIndex + '"]';
11577
11619
  var row = void 0;
11578
11620
  if (this.selectedIndex > -1 && this.parent.editSettings.newRowPosition !== 'Top' &&
11579
11621
  this.parent.editSettings.newRowPosition !== 'Bottom') {
@@ -11583,7 +11625,7 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
11583
11625
  }
11584
11626
  else {
11585
11627
  if (this.prevAriaRowIndex && this.prevAriaRowIndex !== '-1') {
11586
- selector = '.e-row[aria-rowindex="' + this.prevAriaRowIndex + '"]';
11628
+ selector = '.e-row[data-rowindex="' + this.prevAriaRowIndex + '"]';
11587
11629
  row = this.parent.getContent().querySelector(selector);
11588
11630
  this.addRowIndex = row ? row.rowIndex : 0;
11589
11631
  }
@@ -11642,10 +11684,16 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
11642
11684
  var key = this.parent.grid.getPrimaryKeyFieldNames()[0];
11643
11685
  var position = null;
11644
11686
  value.taskData = isNullOrUndefined(value.taskData) ? extend({}, args.data) : value.taskData;
11645
- var currentData = this.parent.grid.getCurrentViewRecords();
11687
+ var currentData = void 0;
11688
+ if (this.parent.editSettings.mode === 'Batch' && this['isAddedRowByMethod'] && !isNullOrUndefined(this.addRowIndex)) {
11689
+ currentData = this.batchEditModule['batchRecords'];
11690
+ }
11691
+ else {
11692
+ currentData = this.parent.grid.getCurrentViewRecords();
11693
+ }
11646
11694
  if (this.parent.enableVirtualization && args.index !== 0) {
11647
11695
  this.addRowIndex = this.parent.grid.getCurrentViewRecords().indexOf(this.addRowRecord);
11648
- this.selectedIndex = parseInt(this.parent.getRows()[this.addRowIndex].getAttribute('aria-rowindex'), 10);
11696
+ this.selectedIndex = parseInt(this.parent.getRows()[this.addRowIndex].getAttribute('data-rowindex'), 10);
11649
11697
  }
11650
11698
  var index = this.addRowIndex;
11651
11699
  value.uniqueID = getUid(this.parent.element.id + '_data_');
@@ -11658,7 +11706,7 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
11658
11706
  var isVirtualization = this.parent.enableVirtualization && this.addRowIndex > -1 && this.prevAriaRowIndex !== '-1';
11659
11707
  var rows = this.parent.getRows();
11660
11708
  var firstAriaIndex = rows.length ? currentData.indexOf(currentData[0]) : 0;
11661
- var lastAriaIndex = rows.length ? +rows[rows.length - 1].getAttribute('aria-rowindex') : 0;
11709
+ var lastAriaIndex = rows.length ? +rows[rows.length - 1].getAttribute('data-rowindex') : 0;
11662
11710
  var withinRange = this.selectedIndex >= firstAriaIndex && this.selectedIndex <= lastAriaIndex;
11663
11711
  if (currentData.length) {
11664
11712
  idMapping = currentData[this.addRowIndex][this.parent.idMapping];
@@ -12023,7 +12071,7 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
12023
12071
  return new TreeVirtualRowModelGenerator(this.parent);
12024
12072
  };
12025
12073
  VirtualTreeContentRenderer.prototype.getRowByIndex = function (index) {
12026
- return this.parent.getDataRows().filter(function (e) { return parseInt(e.getAttribute('aria-rowindex'), 10) === index; })[0];
12074
+ return this.parent.getDataRows().filter(function (e) { return parseInt(e.getAttribute('data-rowindex'), 10) === index; })[0];
12027
12075
  };
12028
12076
  VirtualTreeContentRenderer.prototype.addEventListener = function () {
12029
12077
  this.parent.on(virtualActionArgs, this.virtualOtherAction, this);
@@ -12202,7 +12250,7 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
12202
12250
  return new Cell(opt);
12203
12251
  };
12204
12252
  VirtualTreeContentRenderer.prototype.beginEdit = function (e) {
12205
- var selector = '.e-row[aria-rowindex="' + e.index + '"]';
12253
+ var selector = '.e-row[data-rowindex="' + e.index + '"]';
12206
12254
  var index = this.parent.getContent().querySelector(selector).rowIndex;
12207
12255
  var rowData = this.parent.getCurrentViewRecords()[index];
12208
12256
  e.data = rowData;
@@ -12210,14 +12258,14 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
12210
12258
  VirtualTreeContentRenderer.prototype.beginAdd = function (args) {
12211
12259
  var addAction = 'addActionBegin';
12212
12260
  var isAdd = 'isAdd';
12213
- var addArgs = { newRowPosition: this.rowPosition, addRowIndex: this.addRowIndex, ariaRowIndex: this.ariaRowIndex };
12261
+ var addArgs = { newRowPosition: this.rowPosition, addRowIndex: this.addRowIndex, dataRowIndex: this.dataRowIndex };
12214
12262
  this.parent.notify('get-row-position', addArgs);
12215
12263
  this.rowPosition = addArgs.newRowPosition;
12216
12264
  this.addRowIndex = addArgs.addRowIndex;
12217
- this.ariaRowIndex = addArgs.ariaRowIndex;
12265
+ this.dataRowIndex = addArgs.dataRowIndex;
12218
12266
  var rows = this.parent.getRows();
12219
- var firstAriaIndex = rows.length ? +rows[0].getAttribute('aria-rowindex') : 0;
12220
- var lastAriaIndex = rows.length ? +rows[rows.length - 1].getAttribute('aria-rowindex') : 0;
12267
+ var firstAriaIndex = rows.length ? +rows[0].getAttribute('data-rowindex') : 0;
12268
+ var lastAriaIndex = rows.length ? +rows[rows.length - 1].getAttribute('data-rowindex') : 0;
12221
12269
  var withInRange = this.parent.selectedRowIndex >= firstAriaIndex && this.parent.selectedRowIndex <= lastAriaIndex;
12222
12270
  if (!(this.rowPosition === 'Top' || this.rowPosition === 'Bottom')) {
12223
12271
  this[isAdd] = true;
@@ -12268,11 +12316,11 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
12268
12316
  };
12269
12317
  VirtualTreeContentRenderer.prototype.onActionComplete = function (args) {
12270
12318
  if (args.requestType === 'add') {
12271
- var addArgs = { newRowPosition: this.rowPosition, addRowIndex: this.addRowIndex, ariaRowIndex: this.ariaRowIndex };
12319
+ var addArgs = { newRowPosition: this.rowPosition, addRowIndex: this.addRowIndex, dataRowIndex: this.dataRowIndex };
12272
12320
  this.parent.notify('get-row-position', addArgs);
12273
12321
  this.rowPosition = addArgs.newRowPosition;
12274
12322
  this.addRowIndex = addArgs.addRowIndex;
12275
- this.ariaRowIndex = addArgs.ariaRowIndex;
12323
+ this.dataRowIndex = addArgs.dataRowIndex;
12276
12324
  }
12277
12325
  var actionComplete$$1 = 'actionComplete';
12278
12326
  _super.prototype[actionComplete$$1].call(this, args);
@@ -12335,7 +12383,7 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
12335
12383
  !isNullOrUndefined(this.parent.getContent().querySelectorAll('.e-content tr')[rowPt])) {
12336
12384
  var attr = this.parent.getContent().querySelectorAll('.e-content tr')[rowPt]
12337
12385
  .querySelector('td').getAttribute('index');
12338
- firsttdinx = +attr; // this.parent.getContent().querySelector('.e-content tr').getAttribute('aria-rowindex');
12386
+ firsttdinx = +attr; // this.parent.getContent().querySelector('.e-content tr').getAttribute('data-rowindex');
12339
12387
  }
12340
12388
  if (firsttdinx === 0) {
12341
12389
  if (this.parent.allowRowDragAndDrop) {
@@ -12434,7 +12482,7 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
12434
12482
  var isAdd = 'isAdd';
12435
12483
  if (this[isAdd] && !this.parent.getContent().querySelector('.e-content').querySelector('.e-addedrow')) {
12436
12484
  if (!(this.rowPosition === 'Top' || this.rowPosition === 'Bottom')) {
12437
- if (this.ariaRowIndex >= this.startIndex) {
12485
+ if (this.dataRowIndex >= this.startIndex) {
12438
12486
  this.restoreNewRow();
12439
12487
  }
12440
12488
  else if (this.addRowIndex && this.addRowIndex > -1) {
@@ -13037,6 +13085,9 @@ var InfiniteScroll$1 = /** @__PURE__ @class */ (function () {
13037
13085
  });
13038
13086
  var actionArgs = getValue('actionArgs', pageingDetails.actionArgs);
13039
13087
  var actions = getValue('actions', this.parent.grid.infiniteScrollModule);
13088
+ if (this.parent.grid.infiniteScrollModule['isInitialRender'] && !this.parent.initialRender) {
13089
+ this.parent.grid.pageSettings.currentPage = 1;
13090
+ }
13040
13091
  var initial = actions.some(function (value) { return value === actionArgs.requestType; });
13041
13092
  var initialRender = initial ? true : this.parent.initialRender ? true : false;
13042
13093
  this.visualData = visualData;
@@ -13051,8 +13102,8 @@ var InfiniteScroll$1 = /** @__PURE__ @class */ (function () {
13051
13102
  this.parent.infiniteScrollSettings.initialBlocks = this.parent.infiniteScrollSettings.maxBlocks;
13052
13103
  }
13053
13104
  var size = initialRender ?
13054
- this.parent.pageSettings.pageSize * this.parent.infiniteScrollSettings.initialBlocks :
13055
- this.parent.pageSettings.pageSize;
13105
+ this.parent.grid.pageSettings.pageSize * this.parent.infiniteScrollSettings.initialBlocks :
13106
+ this.parent.grid.pageSettings.pageSize;
13056
13107
  var current = this.parent.grid.pageSettings.currentPage;
13057
13108
  if (!isNullOrUndefined(actionArgs)) {
13058
13109
  var lastIndex = getValue('lastIndex', this.parent.grid.infiniteScrollModule);
@@ -13070,7 +13121,7 @@ var InfiniteScroll$1 = /** @__PURE__ @class */ (function () {
13070
13121
  else {
13071
13122
  if ((pageingDetails.actionArgs['action'] === 'expand' || pageingDetails.actionArgs['action'] === 'collapse') && this.parent.grid.pageSettings.currentPage !== 1) {
13072
13123
  current = 1;
13073
- size = this.parent.pageSettings.pageSize * this.parent.grid.pageSettings.currentPage;
13124
+ size = this.parent.grid.pageSettings.pageSize * this.parent.grid.pageSettings.currentPage;
13074
13125
  }
13075
13126
  query = query.page(current, size);
13076
13127
  }
@@ -13242,5 +13293,5 @@ var InfiniteScroll$1 = /** @__PURE__ @class */ (function () {
13242
13293
  * Export TreeGrid component
13243
13294
  */
13244
13295
 
13245
- 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 };
13296
+ 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 };
13246
13297
  //# sourceMappingURL=ej2-treegrid.es5.js.map