@syncfusion/ej2-treegrid 20.1.59 → 20.2.38

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.
Files changed (70) hide show
  1. package/CHANGELOG.md +11 -51
  2. package/dist/ej2-treegrid.umd.min.js +2 -2
  3. package/dist/ej2-treegrid.umd.min.js.map +1 -1
  4. package/dist/es6/ej2-treegrid.es2015.js +213 -119
  5. package/dist/es6/ej2-treegrid.es2015.js.map +1 -1
  6. package/dist/es6/ej2-treegrid.es5.js +218 -124
  7. package/dist/es6/ej2-treegrid.es5.js.map +1 -1
  8. package/dist/global/ej2-treegrid.min.js +2 -2
  9. package/dist/global/ej2-treegrid.min.js.map +1 -1
  10. package/dist/global/index.d.ts +1 -1
  11. package/helpers/e2e/index.js +8 -6
  12. package/helpers/e2e/treegridhelper.js +82 -65
  13. package/package.json +9 -9
  14. package/src/treegrid/actions/batch-edit.js +6 -1
  15. package/src/treegrid/actions/edit.js +12 -5
  16. package/src/treegrid/actions/rowdragdrop.js +46 -9
  17. package/src/treegrid/actions/selection.js +6 -1
  18. package/src/treegrid/actions/sort.js +11 -0
  19. package/src/treegrid/base/data.js +14 -2
  20. package/src/treegrid/base/treegrid.js +8 -4
  21. package/src/treegrid/renderer/render.js +3 -1
  22. package/src/treegrid/renderer/virtual-tree-content-render.js +13 -3
  23. package/styles/bootstrap-dark.css +9 -0
  24. package/styles/bootstrap.css +9 -0
  25. package/styles/bootstrap4.css +9 -0
  26. package/styles/bootstrap5-dark.css +9 -0
  27. package/styles/bootstrap5.css +9 -0
  28. package/styles/fabric-dark.css +9 -0
  29. package/styles/fabric.css +9 -0
  30. package/styles/fluent-dark.css +9 -0
  31. package/styles/fluent.css +9 -0
  32. package/styles/highcontrast-light.css +9 -0
  33. package/styles/highcontrast.css +9 -0
  34. package/styles/material-dark.css +9 -0
  35. package/styles/material.css +9 -0
  36. package/styles/tailwind-dark.css +9 -0
  37. package/styles/tailwind.css +9 -0
  38. package/styles/treegrid/_fusionnew-definition.scss +29 -0
  39. package/styles/treegrid/_icons.scss +11 -0
  40. package/styles/treegrid/_material3-definition.scss +29 -0
  41. package/styles/treegrid/bootstrap-dark.css +9 -0
  42. package/styles/treegrid/bootstrap.css +9 -0
  43. package/styles/treegrid/bootstrap4.css +9 -0
  44. package/styles/treegrid/bootstrap5-dark.css +9 -0
  45. package/styles/treegrid/bootstrap5.css +9 -0
  46. package/styles/treegrid/fabric-dark.css +9 -0
  47. package/styles/treegrid/fabric.css +9 -0
  48. package/styles/treegrid/fluent-dark.css +9 -0
  49. package/styles/treegrid/fluent.css +9 -0
  50. package/styles/treegrid/highcontrast-light.css +9 -0
  51. package/styles/treegrid/highcontrast.css +9 -0
  52. package/styles/treegrid/icons/_bootstrap-dark.scss +11 -0
  53. package/styles/treegrid/icons/_bootstrap.scss +11 -0
  54. package/styles/treegrid/icons/_bootstrap4.scss +11 -0
  55. package/styles/treegrid/icons/_bootstrap5.scss +11 -0
  56. package/styles/treegrid/icons/_fabric-dark.scss +11 -0
  57. package/styles/treegrid/icons/_fabric.scss +11 -0
  58. package/styles/treegrid/icons/_fluent.scss +11 -0
  59. package/styles/treegrid/icons/_fusionnew.scss +26 -0
  60. package/styles/treegrid/icons/_highcontrast-light.scss +11 -0
  61. package/styles/treegrid/icons/_highcontrast.scss +11 -0
  62. package/styles/treegrid/icons/_material-dark.scss +11 -0
  63. package/styles/treegrid/icons/_material.scss +11 -0
  64. package/styles/treegrid/icons/_material3.scss +26 -0
  65. package/styles/treegrid/icons/_tailwind-dark.scss +11 -0
  66. package/styles/treegrid/icons/_tailwind.scss +11 -0
  67. package/styles/treegrid/material-dark.css +9 -0
  68. package/styles/treegrid/material.css +9 -0
  69. package/styles/treegrid/tailwind-dark.css +9 -0
  70. package/styles/treegrid/tailwind.css +9 -0
@@ -1119,7 +1119,12 @@ var Selection = /** @__PURE__ @class */ (function () {
1119
1119
  if (indeter > 0 || (checkChildRecords > 0 && checkChildRecords !== length)) {
1120
1120
  record.checkboxState = 'indeterminate';
1121
1121
  }
1122
- else if (checkChildRecords === 0 && indeter === 0) {
1122
+ else if (checkChildRecords === 0 && (!record.hasFilteredChildRecords || isNullOrUndefined(record.hasFilteredChildRecords)) && !isNullOrUndefined(this.parent['dataResults']['actionArgs']) &&
1123
+ (this.parent['dataResults']['actionArgs'].requestType === 'searching' || this.parent['dataResults']['actionArgs'].requestType === 'filtering') && record.checkboxState === 'check') {
1124
+ record.checkboxState = 'check';
1125
+ }
1126
+ else if ((checkChildRecords === 0 && indeter === 0) || (checkChildRecords === 0 && record.hasFilteredChildRecords && !isNullOrUndefined(this.parent['dataResults']['actionArgs']) &&
1127
+ (this.parent['dataResults']['actionArgs'].requestType === 'searching' || this.parent['dataResults']['actionArgs'].requestType === 'filtering') && record.checkboxState === 'check')) {
1123
1128
  record.checkboxState = 'uncheck';
1124
1129
  }
1125
1130
  else {
@@ -1350,105 +1355,6 @@ var Selection = /** @__PURE__ @class */ (function () {
1350
1355
  return Selection;
1351
1356
  }());
1352
1357
 
1353
- /**
1354
- * TreeGrid Freeze module
1355
- *
1356
- * @hidden
1357
- */
1358
- var Freeze$1 = /** @__PURE__ @class */ (function () {
1359
- /**
1360
- * Constructor for render module
1361
- *
1362
- * @param {TreeGrid} parent - Tree Grid instance
1363
- */
1364
- function Freeze$$1(parent) {
1365
- Grid.Inject(Freeze);
1366
- this.parent = parent;
1367
- this.addEventListener();
1368
- }
1369
- Freeze$$1.prototype.addEventListener = function () {
1370
- this.parent.on('rowExpandCollapse', this.rowExpandCollapse, this);
1371
- this.parent.on('dataBoundArg', this.dataBoundArg, this);
1372
- this.parent.grid.on('dblclick', this.dblClickHandler, this);
1373
- };
1374
- Freeze$$1.prototype.removeEventListener = function () {
1375
- if (this.parent.isDestroyed) {
1376
- return;
1377
- }
1378
- this.parent.off('rowExpandCollapse', this.rowExpandCollapse);
1379
- this.parent.off('dataBoundArg', this.dataBoundArg);
1380
- this.parent.grid.off('dblclick', this.dblClickHandler);
1381
- };
1382
- Freeze$$1.prototype.rowExpandCollapse = function (args) {
1383
- var movableRows = this.parent.getMovableDataRows();
1384
- var frozenrows = this.parent.getRows();
1385
- var rows;
1386
- var frozenRightRows;
1387
- var freeze = (this.parent.getFrozenLeftColumnsCount() > 0 ||
1388
- this.parent.getFrozenRightColumnsCount() > 0) ? true : false;
1389
- if (freeze) {
1390
- frozenRightRows = this.parent.getFrozenRightRows().filter(function (e) {
1391
- return e.querySelector('.e-gridrowindex' + args.record.index + 'level' + (args.record.level + 1));
1392
- });
1393
- }
1394
- if (!args.detailrows.length) {
1395
- rows = movableRows.filter(function (e) {
1396
- return e.querySelector('.e-gridrowindex' + args.record.index + 'level' + (args.record.level + 1));
1397
- });
1398
- }
1399
- else {
1400
- rows = args.detailrows;
1401
- }
1402
- for (var i = 0; i < rows.length; i++) {
1403
- var rData = this.parent.grid.getRowObjectFromUID(rows[i].getAttribute('data-Uid')).data;
1404
- rows[i].style.display = args.action;
1405
- if (freeze) {
1406
- frozenRightRows[i].style.display = args.action;
1407
- }
1408
- var queryselector = args.action === 'none' ? '.e-treecolumn-container .e-treegridcollapse'
1409
- : '.e-treecolumn-container .e-treegridexpand';
1410
- if (frozenrows[rows[i].rowIndex].querySelector(queryselector)) {
1411
- var cRow = [];
1412
- for (var i_1 = 0; i_1 < movableRows.length; i_1++) {
1413
- if (movableRows[i_1].querySelector('.e-gridrowindex' + rData.index + 'level' + (rData.level + 1))) {
1414
- cRow.push(movableRows[i_1]);
1415
- }
1416
- }
1417
- if (cRow.length) {
1418
- this.rowExpandCollapse({ detailrows: cRow, action: args.action });
1419
- }
1420
- }
1421
- }
1422
- };
1423
- Freeze$$1.prototype.dblClickHandler = function (e) {
1424
- if (parentsUntil(e.target, 'e-rowcell') &&
1425
- this.parent.grid.editSettings.allowEditOnDblClick && this.parent.editSettings.mode !== 'Cell') {
1426
- this.parent.grid.editModule.startEdit(parentsUntil(e.target, 'e-row'));
1427
- }
1428
- };
1429
- Freeze$$1.prototype.dataBoundArg = function () {
1430
- var checkboxColumn = this.parent.getColumns().filter(function (e) {
1431
- return e.showCheckbox;
1432
- });
1433
- if (checkboxColumn.length && this.parent.freezeModule && this.parent.initialRender) {
1434
- addClass([this.parent.element.getElementsByClassName('e-grid')[0]], 'e-checkselection');
1435
- }
1436
- };
1437
- Freeze$$1.prototype.destroy = function () {
1438
- this.removeEventListener();
1439
- };
1440
- /**
1441
- * For internal use only - Get the module name.
1442
- *
1443
- * @private
1444
- * @returns {string} Returns Freeze module name
1445
- */
1446
- Freeze$$1.prototype.getModuleName = function () {
1447
- return 'freeze';
1448
- };
1449
- return Freeze$$1;
1450
- }());
1451
-
1452
1358
  /**
1453
1359
  * TreeGrid Print module
1454
1360
  *
@@ -1647,7 +1553,7 @@ var Render = /** @__PURE__ @class */ (function () {
1647
1553
  var parentrec = this.parent.getCurrentViewRecords().filter(function (rec) {
1648
1554
  return getValue(proxy_1.idMapping, rec) === getValue(proxy_1.parentIdMapping, data);
1649
1555
  });
1650
- if (parentrec.length > 0) {
1556
+ if (parentrec.length > 0 && !parentrec[0].isSummaryRow) {
1651
1557
  var display = parentrec[0].expanded ? 'table-row' : 'none';
1652
1558
  args.row.setAttribute('style', 'display: ' + display + ';');
1653
1559
  }
@@ -1896,6 +1802,8 @@ var Render = /** @__PURE__ @class */ (function () {
1896
1802
  var cellRenderer = new CellRenderer(_this.parent.grid, _this.parent.grid.serviceLocator);
1897
1803
  var td = _this.parent.getCellFromIndex(rowsObj[j].index, cellIndex - indent);
1898
1804
  cellRenderer.refreshTD(td, cell, rowsObj[j].data, { index: rowsObj[j][rowIdx] });
1805
+ var treecell = _this.parent.getRows()[j].cells[cellIndex];
1806
+ _this.cellRender({ data: rowsObj[j].data, cell: treecell, column: cell.column });
1899
1807
  }
1900
1808
  }
1901
1809
  });
@@ -2291,8 +2199,8 @@ var DataManipulation = /** @__PURE__ @class */ (function () {
2291
2199
  if (!Object.prototype.hasOwnProperty.call(currentData, 'index')) {
2292
2200
  currentData.index = this.storedIndex;
2293
2201
  }
2294
- if (!isNullOrUndefined(currentData[this.parent.childMapping]) ||
2295
- (currentData[this.parent.hasChildMapping] && isCountRequired(this.parent))) {
2202
+ if ((!isNullOrUndefined(currentData[this.parent.childMapping]) && !isCountRequired(this.parent)) ||
2203
+ ((currentData[this.parent.hasChildMapping]) && isCountRequired(this.parent) && this.parent.initialRender)) {
2296
2204
  currentData.hasChildRecords = true;
2297
2205
  if (this.parent.enableCollapseAll || !isNullOrUndefined(this.parent.dataStateChange)
2298
2206
  && isNullOrUndefined(currentData[this.parent.childMapping])) {
@@ -2444,6 +2352,18 @@ var DataManipulation = /** @__PURE__ @class */ (function () {
2444
2352
  srtQry.sortBy(this.parent.grid.sortSettings.columns[srt].field, compFun);
2445
2353
  }
2446
2354
  var modifiedData = new DataManager(parentData).executeLocal(srtQry);
2355
+ if (this.parent.allowRowDragAndDrop && !isNullOrUndefined(this.parent.rowDragAndDropModule['draggedRecord']) &&
2356
+ this.parent.rowDragAndDropModule['droppedRecord'].hasChildRecords && this.parent.rowDragAndDropModule['dropPosition'] !== 'middleSegment') {
2357
+ var dragdIndex = modifiedData.indexOf(this.parent.rowDragAndDropModule['draggedRecord']);
2358
+ modifiedData.splice(dragdIndex, 1);
2359
+ var dropdIndex = modifiedData.indexOf(this.parent.rowDragAndDropModule['droppedRecord']);
2360
+ if (this.parent.rowDragAndDropModule['droppedRecord'].hasChildRecords && this.parent.rowDragAndDropModule['dropPosition'] === 'topSegment') {
2361
+ modifiedData.splice(dropdIndex, 0, this.parent.rowDragAndDropModule['draggedRecord']);
2362
+ }
2363
+ else if (this.parent.rowDragAndDropModule['dropPosition'] === 'bottomSegment') {
2364
+ modifiedData.splice(dropdIndex + 1, 0, this.parent.rowDragAndDropModule['draggedRecord']);
2365
+ }
2366
+ }
2447
2367
  var sortArgs = { modifiedData: modifiedData, filteredData: results, srtQry: srtQry };
2448
2368
  this.parent.notify('createSort', sortArgs);
2449
2369
  results = sortArgs.modifiedData;
@@ -3660,7 +3580,6 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
3660
3580
  TreeGrid.prototype.requiredModules = function () {
3661
3581
  var modules = [];
3662
3582
  var splitFrozenCount = 'splitFrozenCount';
3663
- this.freezeModule = new Freeze$1(this);
3664
3583
  this.grid[splitFrozenCount](this.getGridColumns(this.columns));
3665
3584
  if (this.isDestroyed) {
3666
3585
  return modules;
@@ -3711,8 +3630,11 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
3711
3630
  member: 'ExcelExport', args: [this]
3712
3631
  });
3713
3632
  }
3633
+ var freezePresent = this.injectedModules.filter(function (e) {
3634
+ return e.prototype.getModuleName() === 'freeze';
3635
+ });
3714
3636
  if (this.frozenColumns || this.frozenRows || this.getFrozenColumns() ||
3715
- this.grid.getFrozenLeftColumnsCount() || this.grid.getFrozenRightColumnsCount() || this.freezeModule) {
3637
+ this.grid.getFrozenLeftColumnsCount() || this.grid.getFrozenRightColumnsCount() || freezePresent.length) {
3716
3638
  modules.push({
3717
3639
  member: 'freeze', args: [this]
3718
3640
  });
@@ -4665,6 +4587,9 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4665
4587
  gridColumn[prop] = this.getGridColumns(column[i][prop], false, index);
4666
4588
  treeGridColumn[prop] = column[i][prop];
4667
4589
  }
4590
+ else if (this.initialRender && !isNullOrUndefined(treeColumn) && this.enablePersistence && prop === 'edit') {
4591
+ gridColumn[prop] = treeGridColumn[prop] = treeColumn[prop];
4592
+ }
4668
4593
  else if (!(treeColumn) || prop !== 'sortComparer') {
4669
4594
  gridColumn[prop] = treeGridColumn[prop] = column[i][prop];
4670
4595
  }
@@ -6226,7 +6151,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
6226
6151
  var args = { data: record, row: row };
6227
6152
  var rows = [];
6228
6153
  rows = gridRows.filter(function (r) {
6229
- return r.querySelector('.e-gridrowindex' + record.index + 'level' + (record.level + 1));
6154
+ return ((r.querySelector('.e-gridrowindex' + record.index + 'level' + (record.level + 1))) || (r.querySelector('.e-gridrowindex' + record.index + 'level0' + '.e-summarycell')));
6230
6155
  });
6231
6156
  if (action === 'expand') {
6232
6157
  this.notify(remoteExpand, { record: record, rows: rows, parentRow: row });
@@ -7371,7 +7296,8 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
7371
7296
  this.parent[dropPosition] = this.dropPosition;
7372
7297
  var data = [];
7373
7298
  for (var i = 0; i < fromIndexes.length; i++) {
7374
- data[i] = this.parent.getCurrentViewRecords()[fromIndexes[i]];
7299
+ var index = this.parent.getRowByIndex(fromIndexes[i]).rowIndex;
7300
+ data[i] = this.parent.getCurrentViewRecords()[index];
7375
7301
  }
7376
7302
  var isByMethod = true;
7377
7303
  var args = {
@@ -7475,6 +7401,9 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
7475
7401
  else {
7476
7402
  dropIndex = this.selectedRow.rowIndex - 1;
7477
7403
  }
7404
+ if (this.parent.enableVirtualization && this.parent.allowRowDragAndDrop && this.selectedRecord) {
7405
+ dropIndex = parseInt(this.selectedRow.getAttribute('aria-rowindex'), 10) - 1;
7406
+ }
7478
7407
  tObj[action] = 'indenting';
7479
7408
  tObj[droppedIndex] = dropIndex;
7480
7409
  this.eventTrigger('indenting', dropIndex);
@@ -7491,6 +7420,9 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
7491
7420
  dropIndex = i;
7492
7421
  }
7493
7422
  }
7423
+ if (this.parent.enableVirtualization && this.parent.allowRowDragAndDrop && this.selectedRecord) {
7424
+ dropIndex = parseInt(this.parent.getRows()[dropIndex].getAttribute('aria-rowindex'), 10);
7425
+ }
7494
7426
  tObj[action] = 'outdenting';
7495
7427
  tObj[droppedIndex] = dropIndex;
7496
7428
  this.eventTrigger('outdenting', dropIndex);
@@ -7508,10 +7440,20 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
7508
7440
  this.parent.trigger(actionBegin, actionArgs, function (actionArgs) {
7509
7441
  if (!actionArgs.cancel) {
7510
7442
  if (actionArgs.action === 'indenting') {
7511
- _this.reorderRows([_this.selectedRow.rowIndex], dropIndex, 'child');
7443
+ if (_this.parent.enableVirtualization && _this.parent.allowRowDragAndDrop) {
7444
+ _this.reorderRows([parseInt(_this.selectedRow.getAttribute('aria-rowindex'), 10)], dropIndex, 'child');
7445
+ }
7446
+ else {
7447
+ _this.reorderRows([_this.selectedRow.rowIndex], dropIndex, 'child');
7448
+ }
7512
7449
  }
7513
7450
  else if (actionArgs.action === 'outdenting') {
7514
- _this.reorderRows([_this.selectedRow.rowIndex], dropIndex, 'below');
7451
+ if (_this.parent.enableVirtualization && _this.parent.allowRowDragAndDrop) {
7452
+ _this.reorderRows([parseInt(_this.selectedRow.getAttribute('aria-rowindex'), 10)], dropIndex, 'below');
7453
+ }
7454
+ else {
7455
+ _this.reorderRows([_this.selectedRow.rowIndex], dropIndex, 'below');
7456
+ }
7515
7457
  }
7516
7458
  }
7517
7459
  });
@@ -7706,9 +7648,17 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
7706
7648
  RowDD$$1.prototype.removeLastrowBorder = function (element) {
7707
7649
  var isEmptyRow = element && (element.classList.contains('e-emptyrow') || element.classList.contains('e-columnheader')
7708
7650
  || element.classList.contains('e-detailrow'));
7709
- var islastRowIndex = element && !isEmptyRow &&
7710
- this.parent.getRowByIndex(this.parent.getCurrentViewRecords().length - 1).getAttribute('data-uid') !==
7711
- element.getAttribute('data-uid');
7651
+ var islastRowIndex;
7652
+ if (this.parent.enableVirtualization) {
7653
+ islastRowIndex = element && !isEmptyRow &&
7654
+ this.parent.getRows()[this.parent.getCurrentViewRecords().length - 1].getAttribute('data-uid') !==
7655
+ element.getAttribute('data-uid');
7656
+ }
7657
+ else {
7658
+ islastRowIndex = element && !isEmptyRow &&
7659
+ this.parent.getRowByIndex(this.parent.getCurrentViewRecords().length - 1).getAttribute('data-uid') !==
7660
+ element.getAttribute('data-uid');
7661
+ }
7712
7662
  var canremove = islastRowIndex || this.dropPosition === 'topSegment';
7713
7663
  if (this.parent.element.getElementsByClassName('e-lastrow-border').length > 0 && element && (islastRowIndex || canremove)) {
7714
7664
  this.parent.element.getElementsByClassName('e-lastrow-border')[0].remove();
@@ -7742,7 +7692,12 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
7742
7692
  rowPositionHeight = rowEle.offsetTop - scrollTop;
7743
7693
  }
7744
7694
  // let scrollTop = (tObj.grid.scrollModule as any).content.scrollTop;
7745
- rowTop = rowPositionHeight + contentHeight + roundOff;
7695
+ if (this.parent.enableVirtualization) {
7696
+ rowTop = rowEle.getBoundingClientRect().top;
7697
+ }
7698
+ else {
7699
+ rowTop = rowPositionHeight + contentHeight + roundOff;
7700
+ }
7746
7701
  var rowBottom = rowTop + row[0].offsetHeight;
7747
7702
  var difference = rowBottom - rowTop;
7748
7703
  var divide = difference / 3;
@@ -7822,7 +7777,7 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
7822
7777
  RowDD$$1.prototype.addLastRowborder = function (trElement) {
7823
7778
  var isEmptyRow = trElement && (trElement.classList.contains('e-emptyrow') ||
7824
7779
  trElement.classList.contains('e-columnheader') || trElement.classList.contains('e-detailrow'));
7825
- if (trElement && !isEmptyRow && this.parent.getRowByIndex(this.parent.getCurrentViewRecords().length - 1).getAttribute('data-uid') ===
7780
+ if (trElement && !isEmptyRow && this.parent.getRows()[this.parent.getCurrentViewRecords().length - 1].getAttribute('data-uid') ===
7826
7781
  trElement.getAttribute('data-uid')) {
7827
7782
  var bottomborder = this.parent.createElement('div', { className: 'e-lastrow-border' });
7828
7783
  var gridcontentEle = this.parent.getContent();
@@ -8164,7 +8119,13 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
8164
8119
  }
8165
8120
  else {
8166
8121
  args.dropIndex = args.dropIndex === args.fromIndex ? this.getTargetIdx(args.target.parentElement) : args.dropIndex;
8167
- this.droppedRecord = tObj.getCurrentViewRecords()[args.dropIndex];
8122
+ if (this.parent.enableVirtualization) {
8123
+ var index = this.parent.getRowByIndex(args.dropIndex).rowIndex;
8124
+ this.droppedRecord = tObj.getCurrentViewRecords()[index];
8125
+ }
8126
+ else {
8127
+ this.droppedRecord = tObj.getCurrentViewRecords()[args.dropIndex];
8128
+ }
8168
8129
  }
8169
8130
  var dragRecords = [];
8170
8131
  droppedRecord = this.droppedRecord;
@@ -8241,6 +8202,7 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
8241
8202
  childRecords.splice(droppedRecordIndex, 0, draggedRecord_2);
8242
8203
  draggedRecord_2.parentItem = droppedRecord.parentItem;
8243
8204
  draggedRecord_2.parentUniqueID = droppedRecord.parentUniqueID;
8205
+ draggedRecord_2.level = droppedRecord.level;
8244
8206
  if (this_1.parent.parentIdMapping) {
8245
8207
  draggedRecord_2[this_1.parent.parentIdMapping] = droppedRecord[this_1.parent.parentIdMapping];
8246
8208
  draggedRecord_2.parentItem = droppedRecord.parentItem;
@@ -10014,6 +9976,17 @@ var Sort$1 = /** @__PURE__ @class */ (function () {
10014
9976
  }
10015
9977
  if (data[d].hasChildRecords) {
10016
9978
  var childSort = (new DataManager(data[d].childRecords).executeLocal(srtQry));
9979
+ if (this.parent.allowRowDragAndDrop && data[d].childRecords.indexOf(this.parent.rowDragAndDropModule['draggedRecord']) !== -1 && this.parent.rowDragAndDropModule['dropPosition'] !== 'middleSegment') {
9980
+ var dragdIndex = childSort.indexOf(this.parent.rowDragAndDropModule['draggedRecord']);
9981
+ childSort.splice(dragdIndex, 1);
9982
+ var dropdIndex = childSort.indexOf(this.parent.rowDragAndDropModule['droppedRecord']);
9983
+ if (this.parent.rowDragAndDropModule['dropPosition'] === 'topSegment') {
9984
+ childSort.splice(dropdIndex, 0, this.parent.rowDragAndDropModule['draggedRecord']);
9985
+ }
9986
+ else if (this.parent.rowDragAndDropModule['dropPosition'] === 'bottomSegment') {
9987
+ childSort.splice(dropdIndex + 1, 0, this.parent.rowDragAndDropModule['draggedRecord']);
9988
+ }
9989
+ }
10017
9990
  this.iterateSort(childSort, srtQry);
10018
9991
  }
10019
9992
  }
@@ -10833,7 +10806,12 @@ var BatchEdit = /** @__PURE__ @class */ (function () {
10833
10806
  BatchEdit.prototype.nextCellIndex = function (args) {
10834
10807
  var index = 'index';
10835
10808
  var rowIndex = 'rowIndex';
10836
- args[index] = this.parent.getSelectedRows()[0][rowIndex];
10809
+ if (this.parent.getSelectedRows().length) {
10810
+ args[index] = this.parent.getSelectedRows()[0][rowIndex];
10811
+ }
10812
+ else {
10813
+ args[index] = this.batchIndex;
10814
+ }
10837
10815
  };
10838
10816
  return BatchEdit;
10839
10817
  }());
@@ -11364,9 +11342,11 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
11364
11342
  this.parent.parentData.push(data[i]);
11365
11343
  }
11366
11344
  }
11367
- if (details.action === 'add' && this.previousNewRowPosition != null) {
11368
- this.parent.setProperties({ editSettings: { newRowPosition: this.previousNewRowPosition } }, true);
11369
- this.previousNewRowPosition = null;
11345
+ if (!this.parent.enableInfiniteScrolling) {
11346
+ if (details.action === 'add' && this.previousNewRowPosition != null) {
11347
+ this.parent.setProperties({ editSettings: { newRowPosition: this.previousNewRowPosition } }, true);
11348
+ this.previousNewRowPosition = null;
11349
+ }
11370
11350
  }
11371
11351
  };
11372
11352
  Edit$$1.prototype.updateIndex = function (data, rows, records) {
@@ -11614,14 +11594,19 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
11614
11594
  }
11615
11595
  else {
11616
11596
  if (this.isAddedRowByMethod && (this.parent.enableVirtualization || this.parent.enableInfiniteScrolling)) {
11617
- this.addRowIndex = args.index;
11597
+ if (args.index !== 0) {
11598
+ this.addRowIndex = args.index;
11599
+ }
11600
+ else {
11601
+ this.addRowIndex = this.parent.grid.selectedRowIndex;
11602
+ }
11618
11603
  }
11619
11604
  else {
11620
11605
  this.addRowIndex = this.parent.grid.selectedRowIndex > -1 ? this.parent.grid.selectedRowIndex : 0;
11621
11606
  }
11622
11607
  }
11623
11608
  if (this.isAddedRowByMethod && (this.parent.enableVirtualization || this.parent.enableInfiniteScrolling)) {
11624
- this.addRowRecord = this.parent.flatData[args.index];
11609
+ this.addRowRecord = this.parent.flatData[this.parent.grid.selectedRowIndex];
11625
11610
  }
11626
11611
  else {
11627
11612
  this.addRowRecord = this.parent.getSelectedRecords()[0];
@@ -12123,7 +12108,7 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
12123
12108
  getValue('virtualEle', this).setVirtualHeight(this.parent.getRowHeight() * e.count, '100%');
12124
12109
  }
12125
12110
  }
12126
- if ((!isNullOrUndefined(e.requestType) && e.requestType.toString() === 'collapseAll') || (this.isDataSourceChanged && this.startIndex === -1)) {
12111
+ if ((!isNullOrUndefined(e.requestType) && e.requestType.toString() === 'collapseAll') || (this.isDataSourceChanged && (this.startIndex === -1 || this.startIndex === 0 && this['preStartIndex'] === 0))) {
12127
12112
  this.contents.scrollTop = 0;
12128
12113
  this.isDataSourceChanged = false;
12129
12114
  }
@@ -12353,7 +12338,12 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
12353
12338
  firsttdinx = +attr; // this.parent.getContent().querySelector('.e-content tr').getAttribute('aria-rowindex');
12354
12339
  }
12355
12340
  if (firsttdinx === 0) {
12356
- this.translateY = scrollArgs.offset.top;
12341
+ if (this.parent.allowRowDragAndDrop) {
12342
+ this.translateY = scrollArgs.offset.top - this.parent.getRowHeight() * 2;
12343
+ }
12344
+ else {
12345
+ this.translateY = scrollArgs.offset.top;
12346
+ }
12357
12347
  }
12358
12348
  else {
12359
12349
  var height = this.parent.getRowHeight();
@@ -12379,7 +12369,12 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
12379
12369
  this.translateY = this.getTranslateY(scrollArgs.offset.top, content.getBoundingClientRect().height);
12380
12370
  }
12381
12371
  else {
12382
- this.translateY = scrollArgs.offset.top;
12372
+ if (this.parent.allowRowDragAndDrop) {
12373
+ this.translateY = scrollArgs.offset.top - this.parent.getRowHeight() * 2;
12374
+ }
12375
+ else {
12376
+ this.translateY = scrollArgs.offset.top;
12377
+ }
12383
12378
  }
12384
12379
  }
12385
12380
  if (((downScroll && (scrollArgs.offset.top < (this.parent.getRowHeight() * this.totalRecords)))
@@ -12764,6 +12759,105 @@ var TreeVirtual = /** @__PURE__ @class */ (function (_super) {
12764
12759
  return TreeVirtual;
12765
12760
  }(VirtualScroll));
12766
12761
 
12762
+ /**
12763
+ * TreeGrid Freeze module
12764
+ *
12765
+ * @hidden
12766
+ */
12767
+ var Freeze$1 = /** @__PURE__ @class */ (function () {
12768
+ /**
12769
+ * Constructor for render module
12770
+ *
12771
+ * @param {TreeGrid} parent - Tree Grid instance
12772
+ */
12773
+ function Freeze$$1(parent) {
12774
+ Grid.Inject(Freeze);
12775
+ this.parent = parent;
12776
+ this.addEventListener();
12777
+ }
12778
+ Freeze$$1.prototype.addEventListener = function () {
12779
+ this.parent.on('rowExpandCollapse', this.rowExpandCollapse, this);
12780
+ this.parent.on('dataBoundArg', this.dataBoundArg, this);
12781
+ this.parent.grid.on('dblclick', this.dblClickHandler, this);
12782
+ };
12783
+ Freeze$$1.prototype.removeEventListener = function () {
12784
+ if (this.parent.isDestroyed) {
12785
+ return;
12786
+ }
12787
+ this.parent.off('rowExpandCollapse', this.rowExpandCollapse);
12788
+ this.parent.off('dataBoundArg', this.dataBoundArg);
12789
+ this.parent.grid.off('dblclick', this.dblClickHandler);
12790
+ };
12791
+ Freeze$$1.prototype.rowExpandCollapse = function (args) {
12792
+ var movableRows = this.parent.getMovableDataRows();
12793
+ var frozenrows = this.parent.getRows();
12794
+ var rows;
12795
+ var frozenRightRows;
12796
+ var freeze = (this.parent.getFrozenLeftColumnsCount() > 0 ||
12797
+ this.parent.getFrozenRightColumnsCount() > 0) ? true : false;
12798
+ if (freeze) {
12799
+ frozenRightRows = this.parent.getFrozenRightRows().filter(function (e) {
12800
+ return e.querySelector('.e-gridrowindex' + args.record.index + 'level' + (args.record.level + 1));
12801
+ });
12802
+ }
12803
+ if (!args.detailrows.length) {
12804
+ rows = movableRows.filter(function (e) {
12805
+ return e.querySelector('.e-gridrowindex' + args.record.index + 'level' + (args.record.level + 1));
12806
+ });
12807
+ }
12808
+ else {
12809
+ rows = args.detailrows;
12810
+ }
12811
+ for (var i = 0; i < rows.length; i++) {
12812
+ var rData = this.parent.grid.getRowObjectFromUID(rows[i].getAttribute('data-Uid')).data;
12813
+ rows[i].style.display = args.action;
12814
+ if (freeze) {
12815
+ frozenRightRows[i].style.display = args.action;
12816
+ }
12817
+ var queryselector = args.action === 'none' ? '.e-treecolumn-container .e-treegridcollapse'
12818
+ : '.e-treecolumn-container .e-treegridexpand';
12819
+ if (frozenrows[rows[i].rowIndex].querySelector(queryselector)) {
12820
+ var cRow = [];
12821
+ for (var i_1 = 0; i_1 < movableRows.length; i_1++) {
12822
+ if (movableRows[i_1].querySelector('.e-gridrowindex' + rData.index + 'level' + (rData.level + 1))) {
12823
+ cRow.push(movableRows[i_1]);
12824
+ }
12825
+ }
12826
+ if (cRow.length) {
12827
+ this.rowExpandCollapse({ detailrows: cRow, action: args.action });
12828
+ }
12829
+ }
12830
+ }
12831
+ };
12832
+ Freeze$$1.prototype.dblClickHandler = function (e) {
12833
+ if (parentsUntil(e.target, 'e-rowcell') &&
12834
+ this.parent.grid.editSettings.allowEditOnDblClick && this.parent.editSettings.mode !== 'Cell') {
12835
+ this.parent.grid.editModule.startEdit(parentsUntil(e.target, 'e-row'));
12836
+ }
12837
+ };
12838
+ Freeze$$1.prototype.dataBoundArg = function () {
12839
+ var checkboxColumn = this.parent.getColumns().filter(function (e) {
12840
+ return e.showCheckbox;
12841
+ });
12842
+ if (checkboxColumn.length && this.parent.freezeModule && this.parent.initialRender) {
12843
+ addClass([this.parent.element.getElementsByClassName('e-grid')[0]], 'e-checkselection');
12844
+ }
12845
+ };
12846
+ Freeze$$1.prototype.destroy = function () {
12847
+ this.removeEventListener();
12848
+ };
12849
+ /**
12850
+ * For internal use only - Get the module name.
12851
+ *
12852
+ * @private
12853
+ * @returns {string} Returns Freeze module name
12854
+ */
12855
+ Freeze$$1.prototype.getModuleName = function () {
12856
+ return 'freeze';
12857
+ };
12858
+ return Freeze$$1;
12859
+ }());
12860
+
12767
12861
  /**
12768
12862
  * TreeGrid ColumnChooser module
12769
12863
  *