@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.
@@ -438,6 +438,8 @@ const rowdraging = 'row-draging';
438
438
  const rowDropped = 'row-dropped';
439
439
  /** @hidden */
440
440
  const autoCol = 'auto-col';
441
+ /** @hidden */
442
+ const rowDeselecting = 'rowDeselecting';
441
443
 
442
444
  /**
443
445
  * The `Clipboard` module is used to handle clipboard copy action.
@@ -722,7 +724,7 @@ function findChildrenRecords(records) {
722
724
  return [];
723
725
  }
724
726
  if (!isNullOrUndefined(records.childRecords)) {
725
- const childRecords = records.childRecords;
727
+ const childRecords = records.childRecords.filter(items => !items.isSummaryRow);
726
728
  const keys = Object.keys(childRecords);
727
729
  for (let i = 0, len = keys.length; i < len; i++) {
728
730
  datas.push(childRecords[i]);
@@ -1043,7 +1045,12 @@ class Selection {
1043
1045
  if (indeter > 0 || (checkChildRecords > 0 && checkChildRecords !== length)) {
1044
1046
  record.checkboxState = 'indeterminate';
1045
1047
  }
1046
- else if (checkChildRecords === 0 && indeter === 0) {
1048
+ else if (checkChildRecords === 0 && (!record.hasFilteredChildRecords || isNullOrUndefined(record.hasFilteredChildRecords)) && !isNullOrUndefined(this.parent['dataResults']['actionArgs']) &&
1049
+ (this.parent['dataResults']['actionArgs'].requestType === 'searching' || this.parent['dataResults']['actionArgs'].requestType === 'filtering') && record.checkboxState === 'check') {
1050
+ record.checkboxState = 'check';
1051
+ }
1052
+ else if ((checkChildRecords === 0 && indeter === 0) || (checkChildRecords === 0 && record.hasFilteredChildRecords && !isNullOrUndefined(this.parent['dataResults']['actionArgs']) &&
1053
+ (this.parent['dataResults']['actionArgs'].requestType === 'searching' || this.parent['dataResults']['actionArgs'].requestType === 'filtering') && record.checkboxState === 'check')) {
1047
1054
  record.checkboxState = 'uncheck';
1048
1055
  }
1049
1056
  else {
@@ -1231,7 +1238,7 @@ class Selection {
1231
1238
  childData = (!isNullOrUndefined(this.parent.filterModule) && this.parent.filterModule.filteredResult.length > 0) ?
1232
1239
  this.parent.getCurrentViewRecords() : this.parent.flatData;
1233
1240
  childData.forEach((record) => {
1234
- if (this.parent.enableVirtualization) {
1241
+ if (this.parent.enableVirtualization && record.childRecords.length > 0) {
1235
1242
  if (record.hasChildRecords) {
1236
1243
  this.updateParentSelection(record);
1237
1244
  }
@@ -1432,7 +1439,7 @@ class Render {
1432
1439
  const parentrec = this.parent.getCurrentViewRecords().filter((rec) => {
1433
1440
  return getValue(proxy.idMapping, rec) === getValue(proxy.parentIdMapping, data);
1434
1441
  });
1435
- if (parentrec.length > 0) {
1442
+ if (parentrec.length > 0 && !parentrec[0].isSummaryRow) {
1436
1443
  const display = parentrec[0].expanded ? 'table-row' : 'none';
1437
1444
  args.row.setAttribute('style', 'display: ' + display + ';');
1438
1445
  }
@@ -1612,7 +1619,7 @@ class Render {
1612
1619
  const templateFn = 'templateFn';
1613
1620
  const colindex = args.column.index;
1614
1621
  if (isNullOrUndefined(treeColumn.field)) {
1615
- args.cell.setAttribute('aria-colindex', colindex + '');
1622
+ args.cell.setAttribute('data-colindex', colindex + '');
1616
1623
  }
1617
1624
  if (treeColumn.field === args.column.field && !isNullOrUndefined(treeColumn.template)) {
1618
1625
  args.column.template = treeColumn.template;
@@ -2072,8 +2079,8 @@ class DataManipulation {
2072
2079
  if (!Object.prototype.hasOwnProperty.call(currentData, 'index')) {
2073
2080
  currentData.index = this.storedIndex;
2074
2081
  }
2075
- if (!isNullOrUndefined(currentData[this.parent.childMapping]) ||
2076
- (currentData[this.parent.hasChildMapping] && isCountRequired(this.parent))) {
2082
+ if ((!isNullOrUndefined(currentData[this.parent.childMapping]) && !isCountRequired(this.parent)) ||
2083
+ ((currentData[this.parent.hasChildMapping]) && isCountRequired(this.parent) && this.parent.initialRender)) {
2077
2084
  currentData.hasChildRecords = true;
2078
2085
  if (this.parent.enableCollapseAll || !isNullOrUndefined(this.parent.dataStateChange)
2079
2086
  && isNullOrUndefined(currentData[this.parent.childMapping])) {
@@ -2227,9 +2234,9 @@ class DataManipulation {
2227
2234
  const modifiedData = new DataManager(parentData).executeLocal(srtQry);
2228
2235
  if (this.parent.allowRowDragAndDrop && !isNullOrUndefined(this.parent.rowDragAndDropModule['draggedRecord']) &&
2229
2236
  this.parent.rowDragAndDropModule['droppedRecord'].hasChildRecords && this.parent.rowDragAndDropModule['dropPosition'] !== 'middleSegment') {
2230
- var dragdIndex = modifiedData.indexOf(this.parent.rowDragAndDropModule['draggedRecord']);
2237
+ const dragdIndex = modifiedData.indexOf(this.parent.rowDragAndDropModule['draggedRecord']);
2231
2238
  modifiedData.splice(dragdIndex, 1);
2232
- var dropdIndex = modifiedData.indexOf(this.parent.rowDragAndDropModule['droppedRecord']);
2239
+ const dropdIndex = modifiedData.indexOf(this.parent.rowDragAndDropModule['droppedRecord']);
2233
2240
  if (this.parent.rowDragAndDropModule['droppedRecord'].hasChildRecords && this.parent.rowDragAndDropModule['dropPosition'] === 'topSegment') {
2234
2241
  modifiedData.splice(dropdIndex, 0, this.parent.rowDragAndDropModule['draggedRecord']);
2235
2242
  }
@@ -3673,15 +3680,22 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
3673
3680
  triggerEvents(args) {
3674
3681
  this.trigger(getObject('name', args), args);
3675
3682
  }
3683
+ IsExpandCollapseClicked(args) {
3684
+ if (!isNullOrUndefined(args.target) && (args.target.classList.contains('e-treegridexpand')
3685
+ || args.target.classList.contains('e-treegridcollapse') || args.target.classList.contains('e-summarycell'))) {
3686
+ args.cancel = true;
3687
+ return;
3688
+ }
3689
+ }
3676
3690
  bindGridEvents() {
3677
3691
  this.grid.rowSelecting = (args) => {
3678
- if (!isNullOrUndefined(args.target) && (args.target.classList.contains('e-treegridexpand')
3679
- || args.target.classList.contains('e-treegridcollapse') || args.target.classList.contains('e-summarycell'))) {
3680
- args.cancel = true;
3681
- return;
3682
- }
3692
+ this.IsExpandCollapseClicked(args);
3683
3693
  this.trigger(rowSelecting, args);
3684
3694
  };
3695
+ this.grid.rowDeselecting = (args) => {
3696
+ this.IsExpandCollapseClicked(args);
3697
+ this.trigger(rowDeselecting, args);
3698
+ };
3685
3699
  this.grid.rowSelected = (args) => {
3686
3700
  if (this.enableVirtualization && args.isHeaderCheckboxClicked &&
3687
3701
  this.grid.currentViewData.length !== this.grid.selectionModule.selectedRowIndexes.length) {
@@ -5453,7 +5467,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5453
5467
  }
5454
5468
  else if (isNullOrUndefined(record)) {
5455
5469
  if (this.detailTemplate) {
5456
- record = this.grid.getCurrentViewRecords()[row.getAttribute('aria-rowindex')];
5470
+ record = this.grid.getCurrentViewRecords()[row.getAttribute('data-rowindex')];
5457
5471
  }
5458
5472
  else {
5459
5473
  record = this.grid.getCurrentViewRecords()[row.rowIndex];
@@ -5724,7 +5738,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5724
5738
  row = gridRows[rowIndex];
5725
5739
  }
5726
5740
  else {
5727
- rowIndex = +row.getAttribute('aria-rowindex');
5741
+ rowIndex = +row.getAttribute('data-rowindex');
5728
5742
  }
5729
5743
  if (!isNullOrUndefined(row)) {
5730
5744
  row.setAttribute('aria-expanded', action === 'expand' ? 'true' : 'false');
@@ -5874,7 +5888,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5874
5888
  }
5875
5889
  const args = { data: record, row: row };
5876
5890
  let rows = [];
5877
- rows = gridRows.filter((r) => r.querySelector('.e-gridrowindex' + record.index + 'level' + (record.level + 1)));
5891
+ rows = gridRows.filter((r) => ((r.querySelector('.e-gridrowindex' + record.index + 'level' + (record.level + 1))) || (r.querySelector('.e-gridrowindex' + record.index + 'level0' + '.e-summarycell'))));
5878
5892
  if (action === 'expand') {
5879
5893
  this.notify(remoteExpand, { record: record, rows: rows, parentRow: row });
5880
5894
  const args = { row: row, data: record };
@@ -7110,7 +7124,7 @@ class RowDD$1 {
7110
7124
  dropIndex = this.selectedRow.rowIndex - 1;
7111
7125
  }
7112
7126
  if (this.parent.enableVirtualization && this.parent.allowRowDragAndDrop && this.selectedRecord) {
7113
- dropIndex = parseInt(this.selectedRow.getAttribute('aria-rowindex'), 10) - 1;
7127
+ dropIndex = parseInt(this.selectedRow.getAttribute('data-rowindex'), 10) - 1;
7114
7128
  }
7115
7129
  tObj[action] = 'indenting';
7116
7130
  tObj[droppedIndex] = dropIndex;
@@ -7129,7 +7143,7 @@ class RowDD$1 {
7129
7143
  }
7130
7144
  }
7131
7145
  if (this.parent.enableVirtualization && this.parent.allowRowDragAndDrop && this.selectedRecord) {
7132
- dropIndex = parseInt(this.parent.getRows()[dropIndex].getAttribute('aria-rowindex'), 10);
7146
+ dropIndex = parseInt(this.parent.getRows()[dropIndex].getAttribute('data-rowindex'), 10);
7133
7147
  }
7134
7148
  tObj[action] = 'outdenting';
7135
7149
  tObj[droppedIndex] = dropIndex;
@@ -7148,7 +7162,7 @@ class RowDD$1 {
7148
7162
  if (!actionArgs.cancel) {
7149
7163
  if (actionArgs.action === 'indenting') {
7150
7164
  if (this.parent.enableVirtualization && this.parent.allowRowDragAndDrop) {
7151
- this.reorderRows([parseInt(this.selectedRow.getAttribute('aria-rowindex'), 10)], dropIndex, 'child');
7165
+ this.reorderRows([parseInt(this.selectedRow.getAttribute('data-rowindex'), 10)], dropIndex, 'child');
7152
7166
  }
7153
7167
  else {
7154
7168
  this.reorderRows([this.selectedRow.rowIndex], dropIndex, 'child');
@@ -7156,7 +7170,7 @@ class RowDD$1 {
7156
7170
  }
7157
7171
  else if (actionArgs.action === 'outdenting') {
7158
7172
  if (this.parent.enableVirtualization && this.parent.allowRowDragAndDrop) {
7159
- this.reorderRows([parseInt(this.selectedRow.getAttribute('aria-rowindex'), 10)], dropIndex, 'below');
7173
+ this.reorderRows([parseInt(this.selectedRow.getAttribute('data-rowindex'), 10)], dropIndex, 'below');
7160
7174
  }
7161
7175
  else {
7162
7176
  this.reorderRows([this.selectedRow.rowIndex], dropIndex, 'below');
@@ -7372,7 +7386,7 @@ class RowDD$1 {
7372
7386
  }
7373
7387
  }
7374
7388
  updateIcon(row, index, args) {
7375
- let rowEle = args.target ? closest(args.target, 'tr') : null;
7389
+ const rowEle = args.target ? closest(args.target, 'tr') : null;
7376
7390
  this.dropPosition = undefined;
7377
7391
  let rowPositionHeight = 0;
7378
7392
  this.removeFirstrowBorder(rowEle);
@@ -7782,7 +7796,7 @@ class RowDD$1 {
7782
7796
  }
7783
7797
  }
7784
7798
  getTargetIdx(targetRow) {
7785
- return targetRow ? parseInt(targetRow.getAttribute('aria-rowindex'), 10) : 0;
7799
+ return targetRow ? parseInt(targetRow.getAttribute('data-rowindex'), 10) : 0;
7786
7800
  }
7787
7801
  getParentData(record, data) {
7788
7802
  const parentItem = record.parentItem;
@@ -9624,11 +9638,11 @@ class Sort$1 {
9624
9638
  this.flatSortedData[this.storedIndex] = data[d];
9625
9639
  }
9626
9640
  if (data[d].hasChildRecords) {
9627
- let childSort = (new DataManager(data[d].childRecords).executeLocal(srtQry));
9641
+ const childSort = (new DataManager(data[d].childRecords).executeLocal(srtQry));
9628
9642
  if (this.parent.allowRowDragAndDrop && data[d].childRecords.indexOf(this.parent.rowDragAndDropModule['draggedRecord']) !== -1 && this.parent.rowDragAndDropModule['dropPosition'] !== 'middleSegment') {
9629
- var dragdIndex = childSort.indexOf(this.parent.rowDragAndDropModule['draggedRecord']);
9643
+ const dragdIndex = childSort.indexOf(this.parent.rowDragAndDropModule['draggedRecord']);
9630
9644
  childSort.splice(dragdIndex, 1);
9631
- var dropdIndex = childSort.indexOf(this.parent.rowDragAndDropModule['droppedRecord']);
9645
+ const dropdIndex = childSort.indexOf(this.parent.rowDragAndDropModule['droppedRecord']);
9632
9646
  if (this.parent.rowDragAndDropModule['dropPosition'] === 'topSegment') {
9633
9647
  childSort.splice(dropdIndex, 0, this.parent.rowDragAndDropModule['draggedRecord']);
9634
9648
  }
@@ -9808,6 +9822,7 @@ class ContextMenu$1 {
9808
9822
  if (args.item.id === 'Above' || args.item.id === 'Below' || args.item.id === 'Child') {
9809
9823
  this.parent.notify('savePreviousRowPosition', args);
9810
9824
  this.parent.setProperties({ editSettings: { newRowPosition: args.item.id } }, true);
9825
+ this.parent.editModule['isAddedRowByContextMenu'] = true;
9811
9826
  this.parent.addRecord();
9812
9827
  }
9813
9828
  if (args.item.id === this.parent.element.id + '_gridcontrol_cmenu_Indent' || args.item.id === this.parent.element.id + '_gridcontrol_cmenu_Outdent') {
@@ -10078,10 +10093,11 @@ class BatchEdit {
10078
10093
  this.parent.editModule[isTabLastRow] = false;
10079
10094
  return;
10080
10095
  }
10081
- if (this.parent.editModule['isAddedRowByMethod'] && !isNullOrUndefined(this.parent.editModule['addRowIndex']) && this.parent.grid.selectedRowIndex === -1) {
10096
+ if (this.parent.editModule['isAddedRowByMethod'] && !isNullOrUndefined(this.parent.editModule['addRowIndex']) &&
10097
+ !this.parent.editModule['isAddedRowByContextMenu'] && (this.parent.grid.selectedRowIndex === -1 || this.parent.editModule['batchEditModule'].isAdd)) {
10082
10098
  this.selectedIndex = this.parent.editModule['selectedIndex'];
10083
10099
  this.addRowIndex = this.parent.editModule['addRowIndex'];
10084
- this.addRowRecord = this.parent.getCurrentViewRecords()[this.selectedIndex];
10100
+ this.addRowRecord = this.batchRecords.length ? this.batchRecords[this.selectedIndex] : this.parent.getCurrentViewRecords()[this.selectedIndex];
10085
10101
  }
10086
10102
  else {
10087
10103
  this.selectedIndex = this.parent.grid.selectedRowIndex;
@@ -10128,6 +10144,11 @@ class BatchEdit {
10128
10144
  // }
10129
10145
  }
10130
10146
  focusModule.getContent().matrix.current = [actualIndex, focusModule.getContent().matrix.current[1]];
10147
+ if (this.parent.editModule['isAddedRowByMethod'] && !isNullOrUndefined(this.parent.editModule['addRowIndex']) && !this.parent.editModule['isAddedRowByContextMenu']) {
10148
+ const newlyAddedRecords = this.parent.getBatchChanges()['addedRecords'];
10149
+ const index = parseInt(this.parent.getContentTable().getElementsByClassName('e-insertedrow')[newlyAddedRecords.length - 1].getAttribute('data-rowindex'), 10);
10150
+ this.batchRecords.splice(index, 0, newlyAddedRecords[newlyAddedRecords.length - 1]);
10151
+ }
10131
10152
  }
10132
10153
  }
10133
10154
  beforeBatchDelete(args) {
@@ -10153,7 +10174,7 @@ class BatchEdit {
10153
10174
  childs = findChildrenRecords(data);
10154
10175
  uid = this.parent.getSelectedRows()[0].getAttribute('data-uid');
10155
10176
  }
10156
- const parentRowIndex = parseInt(this.parent.grid.getRowElementByUID(uid).getAttribute('aria-rowindex'), 10);
10177
+ const parentRowIndex = parseInt(this.parent.grid.getRowElementByUID(uid).getAttribute('data-rowindex'), 10);
10157
10178
  if (childs.length) {
10158
10179
  const totalCount = parentRowIndex + childs.length;
10159
10180
  const firstChildIndex = parentRowIndex + 1;
@@ -10190,7 +10211,7 @@ class BatchEdit {
10190
10211
  updateRowIndex() {
10191
10212
  const rows = this.parent.grid.getDataRows();
10192
10213
  for (let i = 0; i < rows.length; i++) {
10193
- rows[i].setAttribute('aria-rowindex', i.toString());
10214
+ rows[i].setAttribute('data-rowindex', i.toString());
10194
10215
  }
10195
10216
  const freeze = (this.parent.getFrozenLeftColumnsCount() > 0 ||
10196
10217
  this.parent.getFrozenRightColumnsCount() > 0) ? true : false;
@@ -10198,9 +10219,9 @@ class BatchEdit {
10198
10219
  const mRows = this.parent.grid.getMovableDataRows();
10199
10220
  const freezeRightRows = this.parent.grid.getFrozenRightDataRows();
10200
10221
  for (let i = 0; i < mRows.length; i++) {
10201
- mRows[i].setAttribute('aria-rowindex', i.toString());
10222
+ mRows[i].setAttribute('data-rowindex', i.toString());
10202
10223
  if (freeze) {
10203
- freezeRightRows[i].setAttribute('aria-rowindex', i.toString());
10224
+ freezeRightRows[i].setAttribute('data-rowindex', i.toString());
10204
10225
  }
10205
10226
  }
10206
10227
  }
@@ -10260,7 +10281,9 @@ class BatchEdit {
10260
10281
  if (!isNullOrUndefined(this.batchAddedRecords)) {
10261
10282
  for (let i = 0; i < this.batchAddedRecords.length; i++) {
10262
10283
  index = data.map((e) => { return e[primaryKey]; }).indexOf(this.batchAddedRecords[i][primaryKey]);
10263
- data.splice(index, 1);
10284
+ if (index !== -1) {
10285
+ data.splice(index, 1);
10286
+ }
10264
10287
  if (this.parent.editSettings.newRowPosition === 'Child') {
10265
10288
  index = currentViewRecords.map((e) => { return e[primaryKey]; })
10266
10289
  .indexOf(this.batchAddedRecords[i][parentItem] ? this.batchAddedRecords[i][parentItem][primaryKey]
@@ -10326,9 +10349,12 @@ class BatchEdit {
10326
10349
  }
10327
10350
  if (this.parent.editSettings.newRowPosition !== 'Bottom' && !Object.hasOwnProperty.call(args, 'updatedRecords')) {
10328
10351
  data.splice(data.length - addRecords.length, addRecords.length);
10329
- if (this.parent.editModule['isAddedRowByMethod'] && addRecords.length && !isNullOrUndefined(this.parent.editModule['addRowIndex'])) {
10330
- const index = parseInt(this.parent.getContentTable().getElementsByClassName('e-insertedrow')[0].getAttribute('aria-rowindex'), 10);
10331
- data.splice(index, 0, addRecords[0]);
10352
+ if (this.parent.editModule['isAddedRowByMethod'] && addRecords.length && !isNullOrUndefined(this.parent.editModule['addRowIndex']) && !this.parent.editModule['isAddedRowByContextMenu']) {
10353
+ addRecords.reverse();
10354
+ for (let i = 0; i < addRecords.length; i++) {
10355
+ const index = parseInt(this.parent.getContentTable().getElementsByClassName('e-insertedrow')[i].getAttribute('data-rowindex'), 10);
10356
+ data.splice(index, 0, addRecords[i]);
10357
+ }
10332
10358
  }
10333
10359
  if (!this.parent.allowPaging && data.length !== currentViewRecords.length) {
10334
10360
  if (currentViewRecords.length > addRecords.length) {
@@ -10348,6 +10374,9 @@ class BatchEdit {
10348
10374
  if (this.batchAddRowRecord.length === 0) {
10349
10375
  this.batchAddRowRecord.push(this.parent.flatData[args.index]);
10350
10376
  }
10377
+ if (this.parent.editModule['isAddedRowByContextMenu']) {
10378
+ addRecords.reverse();
10379
+ }
10351
10380
  for (i = 0; i < addRecords.length; i++) {
10352
10381
  const taskData = extend({}, addRecords[i]);
10353
10382
  delete taskData.parentItem;
@@ -10360,6 +10389,11 @@ class BatchEdit {
10360
10389
  if (!isNullOrUndefined(taskData.primaryParent)) {
10361
10390
  delete taskData.primaryParent;
10362
10391
  }
10392
+ if (addRecords.length > 1 && this.parent.editModule['isAddedRowByContextMenu']) {
10393
+ const rowPosition = this.parent.editSettings.newRowPosition;
10394
+ this.parent.editSettings.newRowPosition = this.parent.editModule['previousNewRowPosition'];
10395
+ this.parent.editModule['previousNewRowPosition'] = rowPosition;
10396
+ }
10363
10397
  addRecords[i].taskData = taskData;
10364
10398
  addRowRecord = this.batchAddRowRecord[i];
10365
10399
  if (isNullOrUndefined(addRowRecord)) {
@@ -10408,6 +10442,9 @@ class BatchEdit {
10408
10442
  }
10409
10443
  }
10410
10444
  this.batchAddRowRecord = this.batchAddedRecords = this.batchRecords = this.batchDeletedRecords = this.currentViewRecords = [];
10445
+ if (this.parent.editModule['isAddedRowByContextMenu']) {
10446
+ this.parent.editModule['isAddedRowByContextMenu'] = false;
10447
+ }
10411
10448
  }
10412
10449
  getActualRowObjectIndex(index) {
10413
10450
  const rows = this.parent.grid.getDataRows();
@@ -10476,6 +10513,7 @@ class Edit$1 {
10476
10513
  this.deletedRecords = 'deletedRecords';
10477
10514
  this.prevAriaRowIndex = '-1';
10478
10515
  this.isAddedRowByMethod = false;
10516
+ this.isAddedRowByContextMenu = false;
10479
10517
  Grid.Inject(Edit);
10480
10518
  this.parent = parent;
10481
10519
  this.isSelfReference = !isNullOrUndefined(parent.parentIdMapping);
@@ -10526,7 +10564,7 @@ class Edit$1 {
10526
10564
  getRowPosition(addArgs) {
10527
10565
  addArgs.newRowPosition = this.parent.editSettings.newRowPosition;
10528
10566
  addArgs.addRowIndex = this.addRowIndex;
10529
- addArgs.ariaRowIndex = +this.prevAriaRowIndex;
10567
+ addArgs.dataRowIndex = +this.prevAriaRowIndex;
10530
10568
  }
10531
10569
  beforeStartEdit(args) {
10532
10570
  this.parent.trigger(actionBegin, args);
@@ -10681,7 +10719,7 @@ class Edit$1 {
10681
10719
  if (!(this.parent.grid.editSettings.allowEditing) || this.parent.grid.isEdit) {
10682
10720
  return;
10683
10721
  }
10684
- const column = this.parent.grid.getColumnByIndex(+target.closest('td.e-rowcell').getAttribute('aria-colindex'));
10722
+ const column = this.parent.grid.getColumnByIndex(+target.closest('td.e-rowcell').getAttribute('data-colindex'));
10685
10723
  if (this.parent.editSettings.mode === 'Cell' && !this.isOnBatch && column && !column.isPrimaryKey &&
10686
10724
  this.parent.editSettings.allowEditing && column.allowEditing && !(target.classList.contains('e-treegridexpand') ||
10687
10725
  target.classList.contains('e-treegridcollapse')) && this.parent.editSettings.allowEditOnDblClick) {
@@ -10689,8 +10727,8 @@ class Edit$1 {
10689
10727
  this.parent.grid.setProperties({ selectedRowIndex: args.rowIndex }, true);
10690
10728
  if (this.parent.enableVirtualization) {
10691
10729
  const tr = parentsUntil(args.target, 'e-row');
10692
- this.prevAriaRowIndex = tr.getAttribute('aria-rowindex');
10693
- tr.setAttribute('aria-rowindex', tr.rowIndex + '');
10730
+ this.prevAriaRowIndex = tr.getAttribute('data-rowindex');
10731
+ tr.setAttribute('data-rowindex', tr.rowIndex + '');
10694
10732
  }
10695
10733
  this.updateGridEditMode('Batch');
10696
10734
  }
@@ -10729,7 +10767,7 @@ class Edit$1 {
10729
10767
  const prom = args[promise];
10730
10768
  delete args[promise];
10731
10769
  if (this.parent.enableVirtualization && !isNullOrUndefined(this.prevAriaRowIndex) && this.prevAriaRowIndex !== '-1') {
10732
- args.row.setAttribute('aria-rowindex', this.prevAriaRowIndex);
10770
+ args.row.setAttribute('data-rowindex', this.prevAriaRowIndex);
10733
10771
  this.prevAriaRowIndex = undefined;
10734
10772
  }
10735
10773
  if (this.keyPress !== 'enter') {
@@ -10984,9 +11022,11 @@ class Edit$1 {
10984
11022
  this.parent.parentData.push(data[i]);
10985
11023
  }
10986
11024
  }
10987
- if (details.action === 'add' && this.previousNewRowPosition != null) {
10988
- this.parent.setProperties({ editSettings: { newRowPosition: this.previousNewRowPosition } }, true);
10989
- this.previousNewRowPosition = null;
11025
+ if (!this.parent.enableInfiniteScrolling) {
11026
+ if (details.action === 'add' && this.previousNewRowPosition != null) {
11027
+ this.parent.setProperties({ editSettings: { newRowPosition: this.previousNewRowPosition } }, true);
11028
+ this.previousNewRowPosition = null;
11029
+ }
10990
11030
  }
10991
11031
  }
10992
11032
  updateIndex(data, rows, records) {
@@ -11062,8 +11102,8 @@ class Edit$1 {
11062
11102
  }
11063
11103
  }
11064
11104
  const rows = this.parent.grid.getDataRows();
11065
- const firstAriaIndex = rows.length ? +rows[0].getAttribute('aria-rowindex') : 0;
11066
- const lastAriaIndex = rows.length ? +rows[rows.length - 1].getAttribute('aria-rowindex') : 0;
11105
+ const firstAriaIndex = rows.length ? +rows[0].getAttribute('data-rowindex') : 0;
11106
+ const lastAriaIndex = rows.length ? +rows[rows.length - 1].getAttribute('data-rowindex') : 0;
11067
11107
  const withinRange = this.selectedIndex >= firstAriaIndex && this.selectedIndex <= lastAriaIndex;
11068
11108
  const isVirtualization = this.parent.enableVirtualization && this.addRowIndex > -1 && this.prevAriaRowIndex !== '-1';
11069
11109
  if (this.parent.editSettings.mode !== 'Dialog') {
@@ -11133,20 +11173,27 @@ class Edit$1 {
11133
11173
  focussedElement.focus();
11134
11174
  }
11135
11175
  }
11136
- if (this.parent.editSettings.mode === 'Batch' && !isNullOrUndefined(this.addRowIndex) && this.addRowIndex !== -1) {
11176
+ if (this.parent.editSettings.mode === 'Batch' && !isNullOrUndefined(this.addRowIndex) && this.addRowIndex !== -1 && this['isAddedRowByMethod'] && !this.isAddedRowByContextMenu) {
11137
11177
  index = this.batchEditModule.getAddRowIndex();
11138
11178
  this.selectedIndex = this.batchEditModule.getSelectedIndex();
11139
- if (this.parent.editModule['isAddedRowByMethod']) {
11140
- const args = {
11141
- action: 'add',
11142
- data: this.parent.getBatchChanges()['addedRecords'][0],
11143
- index: index,
11144
- seletedRow: 0
11145
- };
11146
- this.parent.editModule.beginAddEdit(args);
11147
- this.parent.editModule.batchEditModule['batchAddRowRecord'].push(this.parent.editModule.batchEditModule['addRowRecord']);
11148
- this.parent.editModule.batchEditModule['batchAddedRecords'].push(args['data']);
11179
+ const batchAddedRecords = this.parent.getBatchChanges()['addedRecords'];
11180
+ let newlyAddedRecord;
11181
+ if (batchAddedRecords.length) {
11182
+ for (let i = 0; i < batchAddedRecords.length; i++) {
11183
+ if (isNullOrUndefined(batchAddedRecords[i].uniqueID)) {
11184
+ newlyAddedRecord = batchAddedRecords[i];
11185
+ }
11186
+ }
11149
11187
  }
11188
+ const args = {
11189
+ action: 'add',
11190
+ data: newlyAddedRecord,
11191
+ index: index,
11192
+ seletedRow: 0
11193
+ };
11194
+ this.beginAddEdit(args);
11195
+ this.batchEditModule['batchAddRowRecord'].push(this.batchEditModule['addRowRecord']);
11196
+ this.batchEditModule['batchAddedRecords'].push(args['data']);
11150
11197
  }
11151
11198
  }
11152
11199
  // private beforeDataBound(args: BeforeDataBoundArgs): void {
@@ -11209,7 +11256,7 @@ class Edit$1 {
11209
11256
  this.selectedIndex = this.parent.grid.selectedRowIndex;
11210
11257
  }
11211
11258
  if (this.parent.enableVirtualization) {
11212
- let selector = '.e-row[aria-rowindex="' + this.selectedIndex + '"]';
11259
+ let selector = '.e-row[data-rowindex="' + this.selectedIndex + '"]';
11213
11260
  let row;
11214
11261
  if (this.selectedIndex > -1 && this.parent.editSettings.newRowPosition !== 'Top' &&
11215
11262
  this.parent.editSettings.newRowPosition !== 'Bottom') {
@@ -11219,7 +11266,7 @@ class Edit$1 {
11219
11266
  }
11220
11267
  else {
11221
11268
  if (this.prevAriaRowIndex && this.prevAriaRowIndex !== '-1') {
11222
- selector = '.e-row[aria-rowindex="' + this.prevAriaRowIndex + '"]';
11269
+ selector = '.e-row[data-rowindex="' + this.prevAriaRowIndex + '"]';
11223
11270
  row = this.parent.getContent().querySelector(selector);
11224
11271
  this.addRowIndex = row ? row.rowIndex : 0;
11225
11272
  }
@@ -11230,14 +11277,19 @@ class Edit$1 {
11230
11277
  }
11231
11278
  else {
11232
11279
  if (this.isAddedRowByMethod && (this.parent.enableVirtualization || this.parent.enableInfiniteScrolling)) {
11233
- this.addRowIndex = args.index;
11280
+ if (args.index !== 0) {
11281
+ this.addRowIndex = args.index;
11282
+ }
11283
+ else {
11284
+ this.addRowIndex = this.parent.grid.selectedRowIndex;
11285
+ }
11234
11286
  }
11235
11287
  else {
11236
11288
  this.addRowIndex = this.parent.grid.selectedRowIndex > -1 ? this.parent.grid.selectedRowIndex : 0;
11237
11289
  }
11238
11290
  }
11239
11291
  if (this.isAddedRowByMethod && (this.parent.enableVirtualization || this.parent.enableInfiniteScrolling)) {
11240
- this.addRowRecord = this.parent.flatData[args.index];
11292
+ this.addRowRecord = this.parent.flatData[this.parent.grid.selectedRowIndex];
11241
11293
  }
11242
11294
  else {
11243
11295
  this.addRowRecord = this.parent.getSelectedRecords()[0];
@@ -11273,10 +11325,16 @@ class Edit$1 {
11273
11325
  const key = this.parent.grid.getPrimaryKeyFieldNames()[0];
11274
11326
  let position = null;
11275
11327
  value.taskData = isNullOrUndefined(value.taskData) ? extend({}, args.data) : value.taskData;
11276
- const currentData = this.parent.grid.getCurrentViewRecords();
11328
+ let currentData;
11329
+ if (this.parent.editSettings.mode === 'Batch' && this['isAddedRowByMethod'] && !isNullOrUndefined(this.addRowIndex)) {
11330
+ currentData = this.batchEditModule['batchRecords'];
11331
+ }
11332
+ else {
11333
+ currentData = this.parent.grid.getCurrentViewRecords();
11334
+ }
11277
11335
  if (this.parent.enableVirtualization && args.index !== 0) {
11278
11336
  this.addRowIndex = this.parent.grid.getCurrentViewRecords().indexOf(this.addRowRecord);
11279
- this.selectedIndex = parseInt(this.parent.getRows()[this.addRowIndex].getAttribute('aria-rowindex'), 10);
11337
+ this.selectedIndex = parseInt(this.parent.getRows()[this.addRowIndex].getAttribute('data-rowindex'), 10);
11280
11338
  }
11281
11339
  let index = this.addRowIndex;
11282
11340
  value.uniqueID = getUid(this.parent.element.id + '_data_');
@@ -11289,7 +11347,7 @@ class Edit$1 {
11289
11347
  const isVirtualization = this.parent.enableVirtualization && this.addRowIndex > -1 && this.prevAriaRowIndex !== '-1';
11290
11348
  const rows = this.parent.getRows();
11291
11349
  const firstAriaIndex = rows.length ? currentData.indexOf(currentData[0]) : 0;
11292
- const lastAriaIndex = rows.length ? +rows[rows.length - 1].getAttribute('aria-rowindex') : 0;
11350
+ const lastAriaIndex = rows.length ? +rows[rows.length - 1].getAttribute('data-rowindex') : 0;
11293
11351
  const withinRange = this.selectedIndex >= firstAriaIndex && this.selectedIndex <= lastAriaIndex;
11294
11352
  if (currentData.length) {
11295
11353
  idMapping = currentData[this.addRowIndex][this.parent.idMapping];
@@ -11636,7 +11694,7 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
11636
11694
  return new TreeVirtualRowModelGenerator(this.parent);
11637
11695
  }
11638
11696
  getRowByIndex(index) {
11639
- return this.parent.getDataRows().filter((e) => parseInt(e.getAttribute('aria-rowindex'), 10) === index)[0];
11697
+ return this.parent.getDataRows().filter((e) => parseInt(e.getAttribute('data-rowindex'), 10) === index)[0];
11640
11698
  }
11641
11699
  addEventListener() {
11642
11700
  this.parent.on(virtualActionArgs, this.virtualOtherAction, this);
@@ -11720,7 +11778,7 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
11720
11778
  getValue('virtualEle', this).setVirtualHeight(this.parent.getRowHeight() * e.count, '100%');
11721
11779
  }
11722
11780
  }
11723
- if ((!isNullOrUndefined(e.requestType) && e.requestType.toString() === 'collapseAll') || (this.isDataSourceChanged && this.startIndex === -1)) {
11781
+ if ((!isNullOrUndefined(e.requestType) && e.requestType.toString() === 'collapseAll') || (this.isDataSourceChanged && (this.startIndex === -1 || this.startIndex === 0 && this['preStartIndex'] === 0))) {
11724
11782
  this.contents.scrollTop = 0;
11725
11783
  this.isDataSourceChanged = false;
11726
11784
  }
@@ -11814,7 +11872,7 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
11814
11872
  return new Cell(opt);
11815
11873
  }
11816
11874
  beginEdit(e) {
11817
- const selector = '.e-row[aria-rowindex="' + e.index + '"]';
11875
+ const selector = '.e-row[data-rowindex="' + e.index + '"]';
11818
11876
  const index = this.parent.getContent().querySelector(selector).rowIndex;
11819
11877
  const rowData = this.parent.getCurrentViewRecords()[index];
11820
11878
  e.data = rowData;
@@ -11822,14 +11880,14 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
11822
11880
  beginAdd(args) {
11823
11881
  const addAction = 'addActionBegin';
11824
11882
  const isAdd = 'isAdd';
11825
- const addArgs = { newRowPosition: this.rowPosition, addRowIndex: this.addRowIndex, ariaRowIndex: this.ariaRowIndex };
11883
+ const addArgs = { newRowPosition: this.rowPosition, addRowIndex: this.addRowIndex, dataRowIndex: this.dataRowIndex };
11826
11884
  this.parent.notify('get-row-position', addArgs);
11827
11885
  this.rowPosition = addArgs.newRowPosition;
11828
11886
  this.addRowIndex = addArgs.addRowIndex;
11829
- this.ariaRowIndex = addArgs.ariaRowIndex;
11887
+ this.dataRowIndex = addArgs.dataRowIndex;
11830
11888
  const rows = this.parent.getRows();
11831
- const firstAriaIndex = rows.length ? +rows[0].getAttribute('aria-rowindex') : 0;
11832
- const lastAriaIndex = rows.length ? +rows[rows.length - 1].getAttribute('aria-rowindex') : 0;
11889
+ const firstAriaIndex = rows.length ? +rows[0].getAttribute('data-rowindex') : 0;
11890
+ const lastAriaIndex = rows.length ? +rows[rows.length - 1].getAttribute('data-rowindex') : 0;
11833
11891
  const withInRange = this.parent.selectedRowIndex >= firstAriaIndex && this.parent.selectedRowIndex <= lastAriaIndex;
11834
11892
  if (!(this.rowPosition === 'Top' || this.rowPosition === 'Bottom')) {
11835
11893
  this[isAdd] = true;
@@ -11880,11 +11938,11 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
11880
11938
  }
11881
11939
  onActionComplete(args) {
11882
11940
  if (args.requestType === 'add') {
11883
- const addArgs = { newRowPosition: this.rowPosition, addRowIndex: this.addRowIndex, ariaRowIndex: this.ariaRowIndex };
11941
+ const addArgs = { newRowPosition: this.rowPosition, addRowIndex: this.addRowIndex, dataRowIndex: this.dataRowIndex };
11884
11942
  this.parent.notify('get-row-position', addArgs);
11885
11943
  this.rowPosition = addArgs.newRowPosition;
11886
11944
  this.addRowIndex = addArgs.addRowIndex;
11887
- this.ariaRowIndex = addArgs.ariaRowIndex;
11945
+ this.dataRowIndex = addArgs.dataRowIndex;
11888
11946
  }
11889
11947
  const actionComplete$$1 = 'actionComplete';
11890
11948
  super[actionComplete$$1](args);
@@ -11946,7 +12004,7 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
11946
12004
  !isNullOrUndefined(this.parent.getContent().querySelectorAll('.e-content tr')[rowPt])) {
11947
12005
  const attr = this.parent.getContent().querySelectorAll('.e-content tr')[rowPt]
11948
12006
  .querySelector('td').getAttribute('index');
11949
- firsttdinx = +attr; // this.parent.getContent().querySelector('.e-content tr').getAttribute('aria-rowindex');
12007
+ firsttdinx = +attr; // this.parent.getContent().querySelector('.e-content tr').getAttribute('data-rowindex');
11950
12008
  }
11951
12009
  if (firsttdinx === 0) {
11952
12010
  if (this.parent.allowRowDragAndDrop) {
@@ -12045,7 +12103,7 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
12045
12103
  const isAdd = 'isAdd';
12046
12104
  if (this[isAdd] && !this.parent.getContent().querySelector('.e-content').querySelector('.e-addedrow')) {
12047
12105
  if (!(this.rowPosition === 'Top' || this.rowPosition === 'Bottom')) {
12048
- if (this.ariaRowIndex >= this.startIndex) {
12106
+ if (this.dataRowIndex >= this.startIndex) {
12049
12107
  this.restoreNewRow();
12050
12108
  }
12051
12109
  else if (this.addRowIndex && this.addRowIndex > -1) {
@@ -12618,6 +12676,9 @@ class InfiniteScroll$1 {
12618
12676
  });
12619
12677
  const actionArgs = getValue('actionArgs', pageingDetails.actionArgs);
12620
12678
  const actions = getValue('actions', this.parent.grid.infiniteScrollModule);
12679
+ if (this.parent.grid.infiniteScrollModule['isInitialRender'] && !this.parent.initialRender) {
12680
+ this.parent.grid.pageSettings.currentPage = 1;
12681
+ }
12621
12682
  const initial = actions.some((value) => { return value === actionArgs.requestType; });
12622
12683
  const initialRender = initial ? true : this.parent.initialRender ? true : false;
12623
12684
  this.visualData = visualData;
@@ -12632,8 +12693,8 @@ class InfiniteScroll$1 {
12632
12693
  this.parent.infiniteScrollSettings.initialBlocks = this.parent.infiniteScrollSettings.maxBlocks;
12633
12694
  }
12634
12695
  let size = initialRender ?
12635
- this.parent.pageSettings.pageSize * this.parent.infiniteScrollSettings.initialBlocks :
12636
- this.parent.pageSettings.pageSize;
12696
+ this.parent.grid.pageSettings.pageSize * this.parent.infiniteScrollSettings.initialBlocks :
12697
+ this.parent.grid.pageSettings.pageSize;
12637
12698
  let current = this.parent.grid.pageSettings.currentPage;
12638
12699
  if (!isNullOrUndefined(actionArgs)) {
12639
12700
  const lastIndex = getValue('lastIndex', this.parent.grid.infiniteScrollModule);
@@ -12651,7 +12712,7 @@ class InfiniteScroll$1 {
12651
12712
  else {
12652
12713
  if ((pageingDetails.actionArgs['action'] === 'expand' || pageingDetails.actionArgs['action'] === 'collapse') && this.parent.grid.pageSettings.currentPage !== 1) {
12653
12714
  current = 1;
12654
- size = this.parent.pageSettings.pageSize * this.parent.grid.pageSettings.currentPage;
12715
+ size = this.parent.grid.pageSettings.pageSize * this.parent.grid.pageSettings.currentPage;
12655
12716
  }
12656
12717
  query = query.page(current, size);
12657
12718
  }
@@ -12818,5 +12879,5 @@ class InfiniteScroll$1 {
12818
12879
  * Export TreeGrid component
12819
12880
  */
12820
12881
 
12821
- 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 };
12882
+ 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 };
12822
12883
  //# sourceMappingURL=ej2-treegrid.es2015.js.map