@syncfusion/ej2-treegrid 20.1.60 → 20.2.39

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 +12 -52
  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 +208 -119
  5. package/dist/es6/ej2-treegrid.es2015.js.map +1 -1
  6. package/dist/es6/ej2-treegrid.es5.js +213 -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 +5 -4
  21. package/src/treegrid/renderer/render.js +1 -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
  }
@@ -2293,8 +2199,8 @@ var DataManipulation = /** @__PURE__ @class */ (function () {
2293
2199
  if (!Object.prototype.hasOwnProperty.call(currentData, 'index')) {
2294
2200
  currentData.index = this.storedIndex;
2295
2201
  }
2296
- if (!isNullOrUndefined(currentData[this.parent.childMapping]) ||
2297
- (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)) {
2298
2204
  currentData.hasChildRecords = true;
2299
2205
  if (this.parent.enableCollapseAll || !isNullOrUndefined(this.parent.dataStateChange)
2300
2206
  && isNullOrUndefined(currentData[this.parent.childMapping])) {
@@ -2446,6 +2352,18 @@ var DataManipulation = /** @__PURE__ @class */ (function () {
2446
2352
  srtQry.sortBy(this.parent.grid.sortSettings.columns[srt].field, compFun);
2447
2353
  }
2448
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
+ }
2449
2367
  var sortArgs = { modifiedData: modifiedData, filteredData: results, srtQry: srtQry };
2450
2368
  this.parent.notify('createSort', sortArgs);
2451
2369
  results = sortArgs.modifiedData;
@@ -3662,7 +3580,6 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
3662
3580
  TreeGrid.prototype.requiredModules = function () {
3663
3581
  var modules = [];
3664
3582
  var splitFrozenCount = 'splitFrozenCount';
3665
- this.freezeModule = new Freeze$1(this);
3666
3583
  this.grid[splitFrozenCount](this.getGridColumns(this.columns));
3667
3584
  if (this.isDestroyed) {
3668
3585
  return modules;
@@ -3713,8 +3630,11 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
3713
3630
  member: 'ExcelExport', args: [this]
3714
3631
  });
3715
3632
  }
3633
+ var freezePresent = this.injectedModules.filter(function (e) {
3634
+ return e.prototype.getModuleName() === 'freeze';
3635
+ });
3716
3636
  if (this.frozenColumns || this.frozenRows || this.getFrozenColumns() ||
3717
- this.grid.getFrozenLeftColumnsCount() || this.grid.getFrozenRightColumnsCount() || this.freezeModule) {
3637
+ this.grid.getFrozenLeftColumnsCount() || this.grid.getFrozenRightColumnsCount() || freezePresent.length) {
3718
3638
  modules.push({
3719
3639
  member: 'freeze', args: [this]
3720
3640
  });
@@ -6231,7 +6151,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
6231
6151
  var args = { data: record, row: row };
6232
6152
  var rows = [];
6233
6153
  rows = gridRows.filter(function (r) {
6234
- 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')));
6235
6155
  });
6236
6156
  if (action === 'expand') {
6237
6157
  this.notify(remoteExpand, { record: record, rows: rows, parentRow: row });
@@ -7376,7 +7296,8 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
7376
7296
  this.parent[dropPosition] = this.dropPosition;
7377
7297
  var data = [];
7378
7298
  for (var i = 0; i < fromIndexes.length; i++) {
7379
- data[i] = this.parent.getCurrentViewRecords()[fromIndexes[i]];
7299
+ var index = this.parent.getRowByIndex(fromIndexes[i]).rowIndex;
7300
+ data[i] = this.parent.getCurrentViewRecords()[index];
7380
7301
  }
7381
7302
  var isByMethod = true;
7382
7303
  var args = {
@@ -7480,6 +7401,9 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
7480
7401
  else {
7481
7402
  dropIndex = this.selectedRow.rowIndex - 1;
7482
7403
  }
7404
+ if (this.parent.enableVirtualization && this.parent.allowRowDragAndDrop && this.selectedRecord) {
7405
+ dropIndex = parseInt(this.selectedRow.getAttribute('aria-rowindex'), 10) - 1;
7406
+ }
7483
7407
  tObj[action] = 'indenting';
7484
7408
  tObj[droppedIndex] = dropIndex;
7485
7409
  this.eventTrigger('indenting', dropIndex);
@@ -7496,6 +7420,9 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
7496
7420
  dropIndex = i;
7497
7421
  }
7498
7422
  }
7423
+ if (this.parent.enableVirtualization && this.parent.allowRowDragAndDrop && this.selectedRecord) {
7424
+ dropIndex = parseInt(this.parent.getRows()[dropIndex].getAttribute('aria-rowindex'), 10);
7425
+ }
7499
7426
  tObj[action] = 'outdenting';
7500
7427
  tObj[droppedIndex] = dropIndex;
7501
7428
  this.eventTrigger('outdenting', dropIndex);
@@ -7513,10 +7440,20 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
7513
7440
  this.parent.trigger(actionBegin, actionArgs, function (actionArgs) {
7514
7441
  if (!actionArgs.cancel) {
7515
7442
  if (actionArgs.action === 'indenting') {
7516
- _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
+ }
7517
7449
  }
7518
7450
  else if (actionArgs.action === 'outdenting') {
7519
- _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
+ }
7520
7457
  }
7521
7458
  }
7522
7459
  });
@@ -7711,9 +7648,17 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
7711
7648
  RowDD$$1.prototype.removeLastrowBorder = function (element) {
7712
7649
  var isEmptyRow = element && (element.classList.contains('e-emptyrow') || element.classList.contains('e-columnheader')
7713
7650
  || element.classList.contains('e-detailrow'));
7714
- var islastRowIndex = element && !isEmptyRow &&
7715
- this.parent.getRowByIndex(this.parent.getCurrentViewRecords().length - 1).getAttribute('data-uid') !==
7716
- 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
+ }
7717
7662
  var canremove = islastRowIndex || this.dropPosition === 'topSegment';
7718
7663
  if (this.parent.element.getElementsByClassName('e-lastrow-border').length > 0 && element && (islastRowIndex || canremove)) {
7719
7664
  this.parent.element.getElementsByClassName('e-lastrow-border')[0].remove();
@@ -7747,7 +7692,12 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
7747
7692
  rowPositionHeight = rowEle.offsetTop - scrollTop;
7748
7693
  }
7749
7694
  // let scrollTop = (tObj.grid.scrollModule as any).content.scrollTop;
7750
- rowTop = rowPositionHeight + contentHeight + roundOff;
7695
+ if (this.parent.enableVirtualization) {
7696
+ rowTop = rowEle.getBoundingClientRect().top;
7697
+ }
7698
+ else {
7699
+ rowTop = rowPositionHeight + contentHeight + roundOff;
7700
+ }
7751
7701
  var rowBottom = rowTop + row[0].offsetHeight;
7752
7702
  var difference = rowBottom - rowTop;
7753
7703
  var divide = difference / 3;
@@ -7827,7 +7777,7 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
7827
7777
  RowDD$$1.prototype.addLastRowborder = function (trElement) {
7828
7778
  var isEmptyRow = trElement && (trElement.classList.contains('e-emptyrow') ||
7829
7779
  trElement.classList.contains('e-columnheader') || trElement.classList.contains('e-detailrow'));
7830
- 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') ===
7831
7781
  trElement.getAttribute('data-uid')) {
7832
7782
  var bottomborder = this.parent.createElement('div', { className: 'e-lastrow-border' });
7833
7783
  var gridcontentEle = this.parent.getContent();
@@ -8169,7 +8119,13 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
8169
8119
  }
8170
8120
  else {
8171
8121
  args.dropIndex = args.dropIndex === args.fromIndex ? this.getTargetIdx(args.target.parentElement) : args.dropIndex;
8172
- 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
+ }
8173
8129
  }
8174
8130
  var dragRecords = [];
8175
8131
  droppedRecord = this.droppedRecord;
@@ -8246,6 +8202,7 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
8246
8202
  childRecords.splice(droppedRecordIndex, 0, draggedRecord_2);
8247
8203
  draggedRecord_2.parentItem = droppedRecord.parentItem;
8248
8204
  draggedRecord_2.parentUniqueID = droppedRecord.parentUniqueID;
8205
+ draggedRecord_2.level = droppedRecord.level;
8249
8206
  if (this_1.parent.parentIdMapping) {
8250
8207
  draggedRecord_2[this_1.parent.parentIdMapping] = droppedRecord[this_1.parent.parentIdMapping];
8251
8208
  draggedRecord_2.parentItem = droppedRecord.parentItem;
@@ -10019,6 +9976,17 @@ var Sort$1 = /** @__PURE__ @class */ (function () {
10019
9976
  }
10020
9977
  if (data[d].hasChildRecords) {
10021
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
+ }
10022
9990
  this.iterateSort(childSort, srtQry);
10023
9991
  }
10024
9992
  }
@@ -10838,7 +10806,12 @@ var BatchEdit = /** @__PURE__ @class */ (function () {
10838
10806
  BatchEdit.prototype.nextCellIndex = function (args) {
10839
10807
  var index = 'index';
10840
10808
  var rowIndex = 'rowIndex';
10841
- 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
+ }
10842
10815
  };
10843
10816
  return BatchEdit;
10844
10817
  }());
@@ -11369,9 +11342,11 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
11369
11342
  this.parent.parentData.push(data[i]);
11370
11343
  }
11371
11344
  }
11372
- if (details.action === 'add' && this.previousNewRowPosition != null) {
11373
- this.parent.setProperties({ editSettings: { newRowPosition: this.previousNewRowPosition } }, true);
11374
- 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
+ }
11375
11350
  }
11376
11351
  };
11377
11352
  Edit$$1.prototype.updateIndex = function (data, rows, records) {
@@ -11619,14 +11594,19 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
11619
11594
  }
11620
11595
  else {
11621
11596
  if (this.isAddedRowByMethod && (this.parent.enableVirtualization || this.parent.enableInfiniteScrolling)) {
11622
- 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
+ }
11623
11603
  }
11624
11604
  else {
11625
11605
  this.addRowIndex = this.parent.grid.selectedRowIndex > -1 ? this.parent.grid.selectedRowIndex : 0;
11626
11606
  }
11627
11607
  }
11628
11608
  if (this.isAddedRowByMethod && (this.parent.enableVirtualization || this.parent.enableInfiniteScrolling)) {
11629
- this.addRowRecord = this.parent.flatData[args.index];
11609
+ this.addRowRecord = this.parent.flatData[this.parent.grid.selectedRowIndex];
11630
11610
  }
11631
11611
  else {
11632
11612
  this.addRowRecord = this.parent.getSelectedRecords()[0];
@@ -12128,7 +12108,7 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
12128
12108
  getValue('virtualEle', this).setVirtualHeight(this.parent.getRowHeight() * e.count, '100%');
12129
12109
  }
12130
12110
  }
12131
- 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))) {
12132
12112
  this.contents.scrollTop = 0;
12133
12113
  this.isDataSourceChanged = false;
12134
12114
  }
@@ -12358,7 +12338,12 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
12358
12338
  firsttdinx = +attr; // this.parent.getContent().querySelector('.e-content tr').getAttribute('aria-rowindex');
12359
12339
  }
12360
12340
  if (firsttdinx === 0) {
12361
- 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
+ }
12362
12347
  }
12363
12348
  else {
12364
12349
  var height = this.parent.getRowHeight();
@@ -12384,7 +12369,12 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
12384
12369
  this.translateY = this.getTranslateY(scrollArgs.offset.top, content.getBoundingClientRect().height);
12385
12370
  }
12386
12371
  else {
12387
- 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
+ }
12388
12378
  }
12389
12379
  }
12390
12380
  if (((downScroll && (scrollArgs.offset.top < (this.parent.getRowHeight() * this.totalRecords)))
@@ -12769,6 +12759,105 @@ var TreeVirtual = /** @__PURE__ @class */ (function (_super) {
12769
12759
  return TreeVirtual;
12770
12760
  }(VirtualScroll));
12771
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
+
12772
12861
  /**
12773
12862
  * TreeGrid ColumnChooser module
12774
12863
  *