@syncfusion/ej2-treegrid 29.2.8 → 30.1.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 (96) hide show
  1. package/.eslintrc.json +2 -0
  2. package/dist/ej2-treegrid.min.js +2 -2
  3. package/dist/ej2-treegrid.umd.min.js +2 -2
  4. package/dist/ej2-treegrid.umd.min.js.map +1 -1
  5. package/dist/es6/ej2-treegrid.es2015.js +254 -140
  6. package/dist/es6/ej2-treegrid.es2015.js.map +1 -1
  7. package/dist/es6/ej2-treegrid.es5.js +314 -169
  8. package/dist/es6/ej2-treegrid.es5.js.map +1 -1
  9. package/dist/global/ej2-treegrid.min.js +2 -2
  10. package/dist/global/ej2-treegrid.min.js.map +1 -1
  11. package/dist/global/index.d.ts +1 -1
  12. package/package.json +5 -5
  13. package/src/treegrid/actions/batch-edit.d.ts +1 -0
  14. package/src/treegrid/actions/batch-edit.js +57 -29
  15. package/src/treegrid/actions/clipboard.js +5 -8
  16. package/src/treegrid/actions/crud-actions.js +3 -1
  17. package/src/treegrid/actions/detail-row.js +7 -8
  18. package/src/treegrid/actions/edit.d.ts +1 -0
  19. package/src/treegrid/actions/edit.js +26 -11
  20. package/src/treegrid/actions/filter.js +2 -5
  21. package/src/treegrid/actions/rowdragdrop.js +7 -13
  22. package/src/treegrid/actions/selection.js +7 -0
  23. package/src/treegrid/actions/summary.js +2 -16
  24. package/src/treegrid/actions/toolbar.js +2 -2
  25. package/src/treegrid/base/data.js +34 -14
  26. package/src/treegrid/base/treegrid-model.d.ts +7 -0
  27. package/src/treegrid/base/treegrid.d.ts +7 -0
  28. package/src/treegrid/base/treegrid.js +86 -52
  29. package/src/treegrid/renderer/virtual-row-model-generator.js +13 -5
  30. package/src/treegrid/renderer/virtual-tree-content-render.d.ts +1 -0
  31. package/src/treegrid/renderer/virtual-tree-content-render.js +64 -6
  32. package/styles/bds-lite.css +30 -0
  33. package/styles/bds.css +30 -0
  34. package/styles/bootstrap-dark-lite.css +30 -0
  35. package/styles/bootstrap-dark.css +30 -0
  36. package/styles/bootstrap-lite.css +30 -0
  37. package/styles/bootstrap.css +30 -0
  38. package/styles/bootstrap4-lite.css +30 -0
  39. package/styles/bootstrap4.css +30 -0
  40. package/styles/bootstrap5-dark-lite.css +30 -0
  41. package/styles/bootstrap5-dark.css +30 -0
  42. package/styles/bootstrap5-lite.css +30 -0
  43. package/styles/bootstrap5.3-lite.css +30 -0
  44. package/styles/bootstrap5.3.css +30 -0
  45. package/styles/bootstrap5.css +30 -0
  46. package/styles/fabric-dark-lite.css +30 -0
  47. package/styles/fabric-dark.css +30 -0
  48. package/styles/fabric-lite.css +30 -0
  49. package/styles/fabric.css +30 -0
  50. package/styles/fluent-dark-lite.css +30 -0
  51. package/styles/fluent-dark.css +30 -0
  52. package/styles/fluent-lite.css +30 -0
  53. package/styles/fluent.css +30 -0
  54. package/styles/fluent2-lite.css +30 -0
  55. package/styles/fluent2.css +30 -3
  56. package/styles/highcontrast-light-lite.css +30 -0
  57. package/styles/highcontrast-light.css +30 -0
  58. package/styles/highcontrast-lite.css +30 -0
  59. package/styles/highcontrast.css +30 -0
  60. package/styles/material-dark-lite.css +30 -0
  61. package/styles/material-dark.css +30 -0
  62. package/styles/material-lite.css +30 -0
  63. package/styles/material.css +30 -0
  64. package/styles/material3-dark-lite.css +30 -0
  65. package/styles/material3-dark.css +30 -0
  66. package/styles/material3-lite.css +30 -0
  67. package/styles/material3.css +30 -0
  68. package/styles/tailwind-dark-lite.css +30 -0
  69. package/styles/tailwind-dark.css +30 -0
  70. package/styles/tailwind-lite.css +30 -0
  71. package/styles/tailwind.css +30 -0
  72. package/styles/tailwind3-lite.css +30 -0
  73. package/styles/tailwind3.css +30 -0
  74. package/styles/treegrid/_bigger.scss +66 -66
  75. package/styles/treegrid/_layout.scss +39 -0
  76. package/styles/treegrid/bds.css +30 -0
  77. package/styles/treegrid/bootstrap-dark.css +30 -0
  78. package/styles/treegrid/bootstrap.css +30 -0
  79. package/styles/treegrid/bootstrap4.css +30 -0
  80. package/styles/treegrid/bootstrap5-dark.css +30 -0
  81. package/styles/treegrid/bootstrap5.3.css +30 -0
  82. package/styles/treegrid/bootstrap5.css +30 -0
  83. package/styles/treegrid/fabric-dark.css +30 -0
  84. package/styles/treegrid/fabric.css +30 -0
  85. package/styles/treegrid/fluent-dark.css +30 -0
  86. package/styles/treegrid/fluent.css +30 -0
  87. package/styles/treegrid/fluent2.css +30 -3
  88. package/styles/treegrid/highcontrast-light.css +30 -0
  89. package/styles/treegrid/highcontrast.css +30 -0
  90. package/styles/treegrid/material-dark.css +30 -0
  91. package/styles/treegrid/material.css +30 -0
  92. package/styles/treegrid/material3-dark.css +30 -0
  93. package/styles/treegrid/material3.css +30 -0
  94. package/styles/treegrid/tailwind-dark.css +30 -0
  95. package/styles/treegrid/tailwind.css +30 -0
  96. package/styles/treegrid/tailwind3.css +30 -0
@@ -1,5 +1,5 @@
1
1
  import { merge, Property, ChildProperty, Collection, isNullOrUndefined, Browser, removeClass, addClass, getValue, createElement, setValue, extend as extend$1, Internationalization, getEnumValue, compile, Component, L10n, EventHandler, KeyboardEvents, SanitizeHtmlHelper, Complex, Event, NotifyPropertyChanges, closest, setStyleAttribute, select, classList, debounce, remove } from '@syncfusion/ej2-base';
2
- import { Logger as Logger$1, Grid, detailLists, Clipboard, getObject, parentsUntil, Print as Print$1, templateCompiler, appendChildren, extend, CellRenderer, getUid, CellType, Freeze as Freeze$1, getNumberFormat, getActualProperties, iterateArrayOrObject, RowDropSettings as RowDropSettings$1, Reorder as Reorder$1, Resize as Resize$1, RowDD as RowDD$1, Scroll, VirtualRowModelGenerator, Filter as Filter$1, ExcelExport as ExcelExport$1, Data, ExportHelper, PdfExport as PdfExport$1, Page as Page$1, Toolbar as Toolbar$1, Aggregate as Aggregate$1, calculateAggregate, Sort as Sort$1, ColumnMenu as ColumnMenu$1, ContextMenu as ContextMenu$1, Edit as Edit$1, resetRowIndex, CommandColumn as CommandColumn$1, DetailRow as DetailRow$1, VirtualContentRenderer, Cell, InterSectionObserver, getTransformValues, VirtualScroll as VirtualScroll$1, RenderType, VirtualHeaderRenderer, ColumnChooser as ColumnChooser$1, InfiniteScroll as InfiniteScroll$1, RowRenderer } from '@syncfusion/ej2-grids';
2
+ import { Logger as Logger$1, Grid, detailLists, Clipboard, getObject, parentsUntil, Print as Print$1, templateCompiler, appendChildren, extend, CellRenderer, getUid, CellType, Freeze as Freeze$1, getNumberFormat, getActualProperties, iterateArrayOrObject, RowDropSettings as RowDropSettings$1, Reorder as Reorder$1, Resize as Resize$1, RowDD as RowDD$1, Scroll, VirtualRowModelGenerator, Filter as Filter$1, ExcelExport as ExcelExport$1, Data, ExportHelper, PdfExport as PdfExport$1, Page as Page$1, Toolbar as Toolbar$1, Aggregate as Aggregate$1, calculateAggregate, Sort as Sort$1, ColumnMenu as ColumnMenu$1, ContextMenu as ContextMenu$1, Edit as Edit$1, resetRowIndex, CommandColumn as CommandColumn$1, DetailRow as DetailRow$1, VirtualContentRenderer, Cell, getVisiblePage, InterSectionObserver, getTransformValues, VirtualScroll as VirtualScroll$1, RenderType, VirtualHeaderRenderer, ColumnChooser as ColumnChooser$1, InfiniteScroll as InfiniteScroll$1, RowRenderer } from '@syncfusion/ej2-grids';
3
3
  import { createCheckBox } from '@syncfusion/ej2-buttons';
4
4
  import { DataManager, ODataAdaptor, WebApiAdaptor, WebMethodAdaptor, CacheAdaptor, UrlAdaptor, Query, DataUtil, RemoteSaveAdaptor, Deferred, JsonAdaptor, Predicate as Predicate$1 } from '@syncfusion/ej2-data';
5
5
  import { showSpinner, hideSpinner, createSpinner } from '@syncfusion/ej2-popups';
@@ -519,12 +519,13 @@ class TreeClipboard extends Clipboard {
519
519
  if (i > 0) {
520
520
  this.treeCopyContent += '\n';
521
521
  }
522
- if (!rows[selectedIndexes[parseInt(i.toString(), 10)]].classList.contains('e-summaryrow')) {
523
- const cells = [].slice.call(rows[selectedIndexes[parseInt(i.toString(), 10)]].querySelectorAll('.e-rowcell'));
522
+ const selectedRowIndex = selectedIndexes[parseInt(i.toString(), 10)];
523
+ if (!rows[selectedRowIndex].classList.contains('e-summaryrow')) {
524
+ const cells = [].slice.call(rows[selectedRowIndex].querySelectorAll('.e-rowcell'));
524
525
  const uniqueid = this.treeGridParent.getSelectedRecords()[parseInt(i.toString(), 10)][`${uniqueID}`];
525
526
  if (this.copiedUniqueIdCollection.indexOf(uniqueid) === -1) {
526
527
  if (this.treeGridParent.copyHierarchyMode === 'Parent' || this.treeGridParent.copyHierarchyMode === 'Both') {
527
- this.parentContentData(currentRecords, selectedIndexes[parseInt(i.toString(), 10)], rows, withHeader, i);
528
+ this.parentContentData(currentRecords, selectedRowIndex, rows, withHeader, i);
528
529
  }
529
530
  this[`${getCopyData}`](cells, false, '\t', withHeader);
530
531
  this.treeCopyContent += this[`${copyContent}`];
@@ -537,11 +538,7 @@ class TreeClipboard extends Clipboard {
537
538
  }
538
539
  }
539
540
  if (withHeader) {
540
- const headerTextArray = [];
541
- for (let i = 0; i < this.treeGridParent.getVisibleColumns().length; i++) {
542
- headerTextArray[parseInt(i.toString(), 10)] =
543
- this.treeGridParent.getVisibleColumns()[parseInt(i.toString(), 10)].headerText;
544
- }
541
+ const headerTextArray = this.treeGridParent.getVisibleColumns().map((col) => col.headerText);
545
542
  this[`${getCopyData}`](headerTextArray, false, '\t', withHeader);
546
543
  this.treeCopyContent = this[`${copyContent}`] + '\n' + this.treeCopyContent;
547
544
  }
@@ -1356,6 +1353,13 @@ class Selection {
1356
1353
  this.headerSelection();
1357
1354
  }
1358
1355
  }
1356
+ else {
1357
+ if ((requestType === 'filtering' || requestType === 'searching' || requestType === 'refresh')
1358
+ && !isRemoteData(this.parent)) {
1359
+ this.selectedItems = [];
1360
+ this.selectedIndexes = [];
1361
+ }
1362
+ }
1359
1363
  }
1360
1364
  }
1361
1365
  getCheckedrecords() {
@@ -2113,6 +2117,15 @@ class DataManipulation {
2113
2117
  if (parentRec) {
2114
2118
  records[parseInt(rec.toString(), 10)].level = parentRec.level + 1;
2115
2119
  }
2120
+ else {
2121
+ const parentRec = args.actual.flatData.find((record) => record[`${this.parent.idMapping}`] === parentID);
2122
+ if (isNullOrUndefined(parentRec[`${this.parent.parentIdMapping}`])) {
2123
+ records[parseInt(rec.toString(), 10)].level = 1;
2124
+ }
2125
+ else {
2126
+ records[parseInt(rec.toString(), 10)].level = parentRec.level + 1;
2127
+ }
2128
+ }
2116
2129
  }
2117
2130
  else {
2118
2131
  records[parseInt(rec.toString(), 10)].level = 0;
@@ -2207,33 +2220,33 @@ class DataManipulation {
2207
2220
  fetchRemoteChildData(rowDetails) {
2208
2221
  const args = { row: rowDetails.parentRow, data: rowDetails.record };
2209
2222
  const dm = this.parent.dataSource;
2210
- const qry = this.parent.grid.getDataModule().generateQuery();
2211
- const clonequries = qry.queries.filter((e) => e.fn !== 'onPage' && e.fn !== 'onWhere');
2212
- qry.queries = clonequries;
2213
- qry.isCountRequired = true;
2223
+ const query = this.parent.grid.getDataModule().generateQuery();
2224
+ const clonequries = query.queries.filter((e) => e.fn !== 'onPage' && e.fn !== 'onWhere');
2225
+ query.queries = clonequries;
2226
+ query.isCountRequired = true;
2214
2227
  let idMappingValue = parseInt(rowDetails.record[this.parent.idMapping], 10);
2215
2228
  if (isNaN(idMappingValue)) {
2216
2229
  idMappingValue = rowDetails.record[this.parent.idMapping].toString();
2217
2230
  }
2218
2231
  if (this.parent.enableVirtualization && rowDetails.action === 'remoteExpand') {
2219
- qry.take(this.parent.pageSettings.pageSize);
2232
+ query.take(this.parent.grid.pageSettings.pageSize);
2220
2233
  const expandDetail = [];
2221
2234
  expandDetail.push('ExpandingAction', idMappingValue.toString());
2222
- qry.expand(expandDetail);
2235
+ query.expand(expandDetail);
2223
2236
  }
2224
2237
  else if (this.parent.enableVirtualization && rowDetails.action === 'collapse') {
2225
- qry.take(this.parent.grid.pageSettings.pageSize);
2238
+ query.take(this.parent.grid.pageSettings.pageSize);
2226
2239
  const expandDetail = [];
2227
2240
  expandDetail.push('CollapsingAction', idMappingValue.toString());
2228
- qry.expand(expandDetail);
2241
+ query.expand(expandDetail);
2229
2242
  }
2230
- qry.where(this.parent.parentIdMapping, 'equal', rowDetails.record[this.parent.idMapping]);
2243
+ query.where(this.parent.parentIdMapping, 'equal', rowDetails.record[this.parent.idMapping]);
2231
2244
  if (rowDetails.action === 'remoteExpand' && this.parent.grid.filterSettings && this.parent.grid.filterSettings.columns.length) {
2232
2245
  const filterqry = this.parent.grid.getDataModule().generateQuery().queries.filter((e) => e.fn !== 'onPage' && typeof e.e.predicates !== 'undefined');
2233
- qry.queries.push(filterqry[0]);
2246
+ query.queries.push(filterqry[0]);
2234
2247
  }
2235
2248
  showSpinner(this.parent.element);
2236
- dm.executeQuery(qry).then((e) => {
2249
+ dm.executeQuery(query).then((e) => {
2237
2250
  const remoteExpandedData = 'remoteExpandedData';
2238
2251
  const remoteCollapsedData = 'remoteCollapsedData';
2239
2252
  const level = 'level';
@@ -2406,8 +2419,15 @@ class DataManipulation {
2406
2419
  record.expanded = false;
2407
2420
  }
2408
2421
  }
2409
- datas.splice(inx + r + 1, 0, record);
2422
+ const exists = datas.some((data) => data[`${this.parent.idMapping}`] === record[this.parent.idMapping]);
2423
+ if (!exists) {
2424
+ datas.splice(inx + r + 1, 0, record);
2425
+ }
2410
2426
  }
2427
+ const localIdMapping = this.parent.idMapping;
2428
+ datas.sort(function (firstRecord, secondRecord) {
2429
+ return firstRecord[`${localIdMapping}`] - secondRecord[`${localIdMapping}`];
2430
+ });
2411
2431
  setValue('result', datas, e);
2412
2432
  setValue('action', 'beforecontentrender', e);
2413
2433
  this.parent.trigger(actionComplete, e);
@@ -2450,7 +2470,8 @@ class DataManipulation {
2450
2470
  const contentModule = getValue('grid.contentModule', this.parent);
2451
2471
  const currentInfo = getValue('currentInfo', contentModule);
2452
2472
  const prevInfo = getValue('prevInfo', contentModule);
2453
- if (currentInfo.loadNext && this.parent.grid.pageSettings.currentPage === currentInfo.nextInfo.page) {
2473
+ if (currentInfo.loadNext && this.parent.grid.pageSettings.currentPage === currentInfo.nextInfo.page
2474
+ && !this.parent.loadChildOnDemand) {
2454
2475
  this.parent.grid.pageSettings.currentPage = prevInfo.page;
2455
2476
  }
2456
2477
  }
@@ -3352,7 +3373,9 @@ function updateParentRow(key, record, action, control, isSelfReference, child) {
3352
3373
  }
3353
3374
  else {
3354
3375
  if (!isNullOrUndefined(child) && record[`${key}`] !== child[`${key}`]) {
3355
- record.childRecords.push(child);
3376
+ if (!record.childRecords.some((records) => records.uniqueID === child.uniqueID)) {
3377
+ record.childRecords.push(child);
3378
+ }
3356
3379
  }
3357
3380
  }
3358
3381
  if (record.childRecords.indexOf(childRecords) === -1 && record[`${key}`] !== child[`${key}`]) {
@@ -3817,7 +3840,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
3817
3840
  parentTarget = target.parentElement;
3818
3841
  if (!isNullOrUndefined(parentTarget)) {
3819
3842
  const cellIndex = parentTarget.cellIndex;
3820
- if (this.grid.getColumnByIndex(cellIndex).editType === 'dropdownedit' && isNullOrUndefined(this.grid.getColumnByIndex(cellIndex).edit['obj'])) {
3843
+ if (cellIndex && this.grid.getColumnByIndex(cellIndex).editType === 'dropdownedit' && isNullOrUndefined(this.grid.getColumnByIndex(cellIndex).edit['obj'])) {
3821
3844
  parentTarget = target;
3822
3845
  }
3823
3846
  summaryElement = this.findnextRowElement(parentTarget);
@@ -3825,8 +3848,11 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
3825
3848
  const cellIndex = target.cellIndex;
3826
3849
  const row = summaryElement.children[parseInt(cellIndex.toString(), 10)];
3827
3850
  if (!isNullOrUndefined(row) && !this.grid.isEdit) {
3828
- addClass([row], 'e-focused');
3829
- addClass([row], 'e-focus');
3851
+ const focusedCells = this.grid.getContent().querySelectorAll('.e-rowcell.e-focused, .e-rowcell.e-focus');
3852
+ focusedCells.forEach((cell) => {
3853
+ removeClass([cell], ['e-focused', 'e-focus']);
3854
+ });
3855
+ addClass([row], ['e-focused', 'e-focus']);
3830
3856
  }
3831
3857
  }
3832
3858
  else {
@@ -3846,7 +3872,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
3846
3872
  parentTarget = target.parentElement;
3847
3873
  if (!isNullOrUndefined(parentTarget)) {
3848
3874
  const cellIndex = parentTarget.cellIndex;
3849
- if (this.grid.getColumnByIndex(cellIndex).editType === 'dropdownedit' && isNullOrUndefined(this.grid.getColumnByIndex(cellIndex).edit['obj'])) {
3875
+ if (cellIndex && this.grid.getColumnByIndex(cellIndex).editType === 'dropdownedit' && isNullOrUndefined(this.grid.getColumnByIndex(cellIndex).edit['obj'])) {
3850
3876
  parentTarget = target;
3851
3877
  }
3852
3878
  summaryElement = this.findPreviousRowElement(parentTarget);
@@ -3855,8 +3881,11 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
3855
3881
  if (!isNullOrUndefined(cellIndex)) {
3856
3882
  const row = summaryElement.children[parseInt(cellIndex.toString(), 10)];
3857
3883
  if (!isNullOrUndefined(row) && !this.grid.isEdit) {
3858
- addClass([row], 'e-focused');
3859
- addClass([row], 'e-focus');
3884
+ const focusedCells = this.grid.getContent().querySelectorAll('.e-rowcell.e-focused, .e-rowcell.e-focus');
3885
+ focusedCells.forEach((cell) => {
3886
+ removeClass([cell], ['e-focused', 'e-focus']);
3887
+ });
3888
+ addClass([row], ['e-focused', 'e-focus']);
3860
3889
  }
3861
3890
  }
3862
3891
  }
@@ -4221,11 +4250,14 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4221
4250
  const destroyTemplate = 'destroyTemplate';
4222
4251
  const destroyTemplateFn = this.grid[`${destroyTemplate}`];
4223
4252
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4224
- this.grid[`${destroyTemplate}`] = (args, index) => {
4253
+ this.grid[`${destroyTemplate}`] = (args, index, callback) => {
4225
4254
  destroyTemplateFn.apply(this.grid);
4226
4255
  const portals = 'portals';
4227
4256
  if (!(this.isReact && isNullOrUndefined(this[`${portals}`]))) {
4228
- this.clearTemplate(args, index);
4257
+ this.clearTemplate(args, index, callback);
4258
+ }
4259
+ else if (!isNullOrUndefined(callback)) {
4260
+ callback();
4229
4261
  }
4230
4262
  };
4231
4263
  }
@@ -4325,12 +4357,13 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4325
4357
  }
4326
4358
  if (data instanceof Array && data.length > 0 && Object.prototype.hasOwnProperty.call(data[0], 'level')) {
4327
4359
  this.flatData = data;
4328
- this.flatData.filter((e) => {
4329
- setValue('uniqueIDCollection.' + e.uniqueID, e, this);
4330
- if (e.level === 0 && !this.parentData.some((record) => record.uniqueID === e.uniqueID)) {
4331
- this.parentData.push(e);
4360
+ for (let i = 0, len = this.flatData.length; i < len; i++) {
4361
+ const rowData = this.flatData[parseInt(i.toString(), 10)];
4362
+ setValue('uniqueIDCollection.' + rowData['uniqueID'], rowData, this);
4363
+ if (rowData.level === 0 && !this.parentData.some((record) => record.uniqueID === rowData.uniqueID)) {
4364
+ this.parentData.push(rowData);
4332
4365
  }
4333
- });
4366
+ }
4334
4367
  }
4335
4368
  else {
4336
4369
  if (isCountRequired(this)) {
@@ -4420,6 +4453,9 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4420
4453
  this.grid[`${isJsComponent}`] = true;
4421
4454
  const enableHtmlSanitizer = 'enableHtmlSanitizer';
4422
4455
  this.grid[`${enableHtmlSanitizer}`] = this.enableHtmlSanitizer;
4456
+ this.grid.enableStickyHeader = this.enableStickyHeader;
4457
+ const isTreeGrid = 'isTreeGrid';
4458
+ this.grid[`${isTreeGrid}`] = true;
4423
4459
  }
4424
4460
  triggerEvents(args) {
4425
4461
  this.trigger(getObject('name', args), args);
@@ -4555,6 +4591,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4555
4591
  }
4556
4592
  extendedGridDataBoundEvent() {
4557
4593
  this.grid.dataBound = (args) => {
4594
+ this.lastRowBorderEventListener();
4558
4595
  this.updateRowTemplate();
4559
4596
  this.updateColumnModel();
4560
4597
  this.updateAltRow(this.getRows());
@@ -4647,6 +4684,9 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4647
4684
  }
4648
4685
  };
4649
4686
  }
4687
+ lastRowBorderEventListener() {
4688
+ this.grid.on('last-rowcell-border-updated', this.lastRowCellBorderUpdated, this);
4689
+ }
4650
4690
  bindCallBackEvents() {
4651
4691
  this.grid.toolbarClick = (args) => {
4652
4692
  if ((args.item.id === this.grid.element.id + '_excelexport' && this.allowExcelExport === false) ||
@@ -4810,6 +4850,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4810
4850
  if (args.requestType === 'sorting' && args.target && args.target.parentElement &&
4811
4851
  args.target.parentElement.classList.contains('e-hierarchycheckbox')) {
4812
4852
  args.cancel = true;
4853
+ return;
4813
4854
  }
4814
4855
  const requestType = getObject('requestType', args);
4815
4856
  if (requestType === 'reorder') {
@@ -5006,11 +5047,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5006
5047
  const record = this.dataSource[0];
5007
5048
  // }
5008
5049
  const keys = Object.keys(record);
5009
- for (let i = 0; i < keys.length; i++) {
5010
- if ([this.childMapping, this.parentIdMapping].indexOf(keys[parseInt(i.toString(), 10)]) === -1) {
5011
- this.columns.push(keys[parseInt(i.toString(), 10)]);
5012
- }
5013
- }
5050
+ this.columns = keys.filter((key) => { return [this.childMapping, this.parentIdMapping].indexOf(key) === -1; });
5014
5051
  }
5015
5052
  }
5016
5053
  getGridEditSettings() {
@@ -5162,7 +5199,9 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5162
5199
  gridColumn.field = treeGridColumn.field = this.columns[parseInt(i.toString(), 10)];
5163
5200
  }
5164
5201
  else {
5165
- for (const prop of Object.keys(column[parseInt(i.toString(), 10)])) {
5202
+ const columnProps = Object.keys(column[parseInt(i.toString(), 10)]);
5203
+ for (let j = 0; j < columnProps.length; j++) {
5204
+ const prop = columnProps[parseInt(j.toString(), 10)];
5166
5205
  if (index === this.treeColumnIndex && prop === 'template') {
5167
5206
  treeGridColumn[`${prop}`] = column[parseInt(i.toString(), 10)][`${prop}`];
5168
5207
  }
@@ -5332,6 +5371,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5332
5371
  break;
5333
5372
  case 'rowHeight':
5334
5373
  this.grid.rowHeight = this.rowHeight;
5374
+ this.refresh();
5335
5375
  break;
5336
5376
  case 'height':
5337
5377
  if (!isNullOrUndefined(this.height) && typeof (this.height) === 'string' && this.height.indexOf('%') !== -1) {
@@ -5407,6 +5447,9 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5407
5447
  case 'columnMenuItems':
5408
5448
  this.grid.columnMenuItems = getActualProperties(this.columnMenuItems);
5409
5449
  break;
5450
+ case 'enableStickyHeader':
5451
+ this.grid.enableStickyHeader = this.enableStickyHeader;
5452
+ break;
5410
5453
  case 'editSettings':
5411
5454
  if (this.grid.isEdit && this.grid.editSettings.mode === 'Normal' && newProp[`${prop}`].mode &&
5412
5455
  (newProp[`${prop}`].mode === 'Cell' || newProp[`${prop}`].mode === 'Row')) {
@@ -5557,7 +5600,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5557
5600
  const checkedTarget = this.grid.getHeaderContent().querySelector('.e-checkselectall');
5558
5601
  const checkedLen = this.grid.getSelectedRowIndexes().length;
5559
5602
  const totalRecords = this.getCurrentViewRecords().length;
5560
- if (checkedLen === totalRecords) {
5603
+ if (totalRecords > 0 && checkedLen === totalRecords) {
5561
5604
  const spanEle = checkedTarget.nextElementSibling;
5562
5605
  removeClass([spanEle], ['e-stop', 'e-uncheck']);
5563
5606
  addClass([spanEle], ['e-check']);
@@ -6291,13 +6334,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
6291
6334
  * @returns {Column[]} - Returns an array of visible column objects.
6292
6335
  */
6293
6336
  getVisibleColumns() {
6294
- const cols = [];
6295
- for (const col of this.columnModel) {
6296
- if (col.visible) {
6297
- cols.push(col);
6298
- }
6299
- }
6300
- return cols;
6337
+ return this.columnModel.filter((col) => col.visible);
6301
6338
  }
6302
6339
  /**
6303
6340
  * Displays a loading spinner overlay across the TreeGrid for any data action or long-running process.
@@ -6425,17 +6462,12 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
6425
6462
  getTreeColumn() {
6426
6463
  const columnModel = 'columnModel';
6427
6464
  const treeColumn = this[`${columnModel}`][this.treeColumnIndex];
6428
- let treeIndex;
6429
6465
  const updatedCols = this.getColumns();
6430
- for (let f = 0; f < updatedCols.length; f++) {
6431
- const treeColumnfield = getObject('field', treeColumn);
6432
- const parentColumnfield = getObject('field', updatedCols[parseInt(f.toString(), 10)]);
6433
- if (treeColumnfield === parentColumnfield) {
6434
- treeIndex = f;
6435
- break;
6436
- }
6466
+ const treeColumnField = getObject('field', treeColumn);
6467
+ const treeIndex = updatedCols.findIndex((col) => getObject('field', col) === treeColumnField);
6468
+ if (!isNullOrUndefined(treeIndex)) {
6469
+ this.setProperties({ treeColumnIndex: treeIndex }, true);
6437
6470
  }
6438
- this.setProperties({ treeColumnIndex: treeIndex }, true);
6439
6471
  }
6440
6472
  /**
6441
6473
  * Refreshes the header section of the TreeGrid to reflect any structural or data changes.
@@ -6883,8 +6915,12 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
6883
6915
  if (this.editSettings.mode === 'Batch') {
6884
6916
  const obj = 'dialogObj';
6885
6917
  const showDialog = 'showDialog';
6886
- if ((this.getBatchChanges()[this.changedRecords].length || this.getBatchChanges()[this.deletedRecords].length ||
6887
- this.getBatchChanges()[this.addedRecords].length) && this.editSettings.showConfirmDialog) {
6918
+ const changes = this.getBatchChanges ? this.getBatchChanges() : {};
6919
+ const changed = Array.isArray(changes.changedRecords) ? changes.changedRecords : [];
6920
+ const deleted = Array.isArray(changes.deletedRecords) ? changes.deletedRecords : [];
6921
+ const added = Array.isArray(changes.addedRecords) ? changes.addedRecords : [];
6922
+ const hasChanges = changed.length > 0 || deleted.length > 0 || added.length > 0;
6923
+ if (hasChanges && this.editSettings.showConfirmDialog) {
6888
6924
  const dialogObj = this.grid.editModule[`${obj}`];
6889
6925
  this.grid.editModule[`${showDialog}`]('CancelEdit', dialogObj);
6890
6926
  return;
@@ -6910,8 +6946,12 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
6910
6946
  if (this.editSettings.mode === 'Batch') {
6911
6947
  const obj = 'dialogObj';
6912
6948
  const showDialog = 'showDialog';
6913
- if ((this.getBatchChanges()[this.changedRecords].length || this.getBatchChanges()[this.deletedRecords].length ||
6914
- this.getBatchChanges()[this.addedRecords].length) && this.editSettings.showConfirmDialog) {
6949
+ const changes = this.getBatchChanges ? this.getBatchChanges() : {};
6950
+ const changed = Array.isArray(changes.changedRecords) ? changes.changedRecords : [];
6951
+ const deleted = Array.isArray(changes.deletedRecords) ? changes.deletedRecords : [];
6952
+ const added = Array.isArray(changes.addedRecords) ? changes.addedRecords : [];
6953
+ const hasChanges = changed.length > 0 || deleted.length > 0 || added.length > 0;
6954
+ if (hasChanges && this.editSettings.showConfirmDialog) {
6915
6955
  const dialogObj = this.grid.editModule[`${obj}`];
6916
6956
  this.grid.editModule[`${showDialog}`]('CancelEdit', dialogObj);
6917
6957
  return;
@@ -7197,6 +7237,8 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
7197
7237
  remoteExpand(action, row, record) {
7198
7238
  let gridRows = this.getRows();
7199
7239
  const fetchRemoteChildData = 'fetchRemoteChildData';
7240
+ const requestType = getValue('isCollapseAll', this) ? 'collapseAll' : 'refresh';
7241
+ this.grid.contentModule.requestType = requestType;
7200
7242
  if (this.rowTemplate) {
7201
7243
  const rows = this.getContentTable().rows;
7202
7244
  gridRows = [].slice.call(rows);
@@ -7263,6 +7305,13 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
7263
7305
  gridRowsObject[parseInt(currentIndex.toString(), 10)].visible !== false) {
7264
7306
  gridRowsObject[parseInt(currentIndex.toString(), 10)].visible = true;
7265
7307
  }
7308
+ if (this.detailTemplate) {
7309
+ gridRows.forEach((row) => {
7310
+ if (row.classList.contains('e-detailrow') && row.style.display === 'none') {
7311
+ row.style.display = '';
7312
+ }
7313
+ });
7314
+ }
7266
7315
  const detailrows = gridRows.filter((r) => r.classList.contains('e-griddetailrowindex' + record.index + 'level' + (record.level + 1)));
7267
7316
  for (let i = 0; i < rows.length; i++) {
7268
7317
  if (!isNullOrUndefined(rows[parseInt(i.toString(), 10)])) {
@@ -7421,7 +7470,6 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
7421
7470
  addListener() {
7422
7471
  this.on('updateResults', this.updateResultModel, this);
7423
7472
  this.grid.on('initial-end', this.afterGridRender, this);
7424
- this.grid.on('last-rowcell-border-updated', this.lastRowCellBorderUpdated, this);
7425
7473
  }
7426
7474
  updateResultModel(returnResult) {
7427
7475
  this.dataResults = returnResult;
@@ -8014,6 +8062,9 @@ __decorate$b([
8014
8062
  __decorate$b([
8015
8063
  Property(false)
8016
8064
  ], TreeGrid.prototype, "enableImmutableMode", void 0);
8065
+ __decorate$b([
8066
+ Property(false)
8067
+ ], TreeGrid.prototype, "enableStickyHeader", void 0);
8017
8068
  __decorate$b([
8018
8069
  Property('auto')
8019
8070
  ], TreeGrid.prototype, "height", void 0);
@@ -10012,20 +10063,13 @@ class RowDD {
10012
10063
  if (deletedRow.hasChildRecords && deletedRow.childRecords.length > 0) {
10013
10064
  this.removeChildItem(deletedRow);
10014
10065
  }
10015
- let idx;
10016
- let idz;
10017
10066
  const treeGridData = dataSource;
10018
- for (let i = 0; i < treeGridData.length; i++) {
10019
- if (treeGridData[parseInt(i.toString(), 10)][this.parent.idMapping] === deletedRow.taskData[this.parent.idMapping]) {
10020
- idx = i;
10021
- }
10022
- }
10023
- for (let i = 0; i < this.treeGridData.length; i++) {
10024
- if (this.treeGridData[parseInt(i.toString(), 10)][this.parent.idMapping]
10025
- === deletedRow.taskData[this.parent.idMapping]) {
10026
- idz = i;
10027
- }
10028
- }
10067
+ const idx = treeGridData.findIndex((data) => {
10068
+ return data[this.parent.idMapping] === deletedRow.taskData[this.parent.idMapping];
10069
+ });
10070
+ const idz = this.treeGridData.findIndex((data) => {
10071
+ return data[this.parent.idMapping] === deletedRow.taskData[this.parent.idMapping];
10072
+ });
10029
10073
  if (idx !== -1 && !isNullOrUndefined(idx)) {
10030
10074
  dataSource.splice(idx, 1);
10031
10075
  }
@@ -10260,10 +10304,15 @@ class TreeVirtualRowModelGenerator extends VirtualRowModelGenerator {
10260
10304
  }
10261
10305
  generateRows(data, notifyArgs) {
10262
10306
  const info = this.getDataInfo();
10263
- if (!isNullOrUndefined(notifyArgs.virtualInfo)) {
10264
- if ((!isRemoteData(this.parent.root) || isCountRequired(this.parent))
10265
- || notifyArgs.virtualInfo.blockIndexes.length === 1) {
10266
- notifyArgs.virtualInfo.blockIndexes = info.blockIndexes;
10307
+ if (notifyArgs.requestType === 'refresh' && notifyArgs.isExpandCollapse) {
10308
+ notifyArgs.virtualInfo = this['prevInfo'];
10309
+ }
10310
+ if (!isNullOrUndefined(notifyArgs.virtualInfo) && !(this.parent.root.loadChildOnDemand && isRemoteData(this.parent.root))) {
10311
+ if (notifyArgs.virtualInfo.direction !== 'right' && notifyArgs.virtualInfo.direction !== 'left') {
10312
+ if ((!isRemoteData(this.parent.root) || isCountRequired(this.parent))
10313
+ || notifyArgs.virtualInfo.blockIndexes.length === 1) {
10314
+ notifyArgs.virtualInfo.blockIndexes = info.blockIndexes;
10315
+ }
10267
10316
  }
10268
10317
  else {
10269
10318
  notifyArgs.virtualInfo.blockIndexes = this.getBlockIndexes(notifyArgs.virtualInfo.page);
@@ -10304,7 +10353,10 @@ class TreeVirtualRowModelGenerator extends VirtualRowModelGenerator {
10304
10353
  else if (action === 'virtualscroll' && this.cache[parseInt(currentPage.toString(), 10)] &&
10305
10354
  this.cache[parseInt(currentPage.toString(), 10)].length >
10306
10355
  (this.parent.contentModule).getBlockSize()) {
10307
- delete this.cache[parseInt(currentPage.toString(), 10)];
10356
+ if (this.cache[parseInt(currentPage.toString(), 10)].length > (this.parent.contentModule).getBlockSize()) {
10357
+ this.cache[parseInt(currentPage.toString(), 10)] =
10358
+ this.cache[parseInt(currentPage.toString(), 10)].slice(0, (this.parent.contentModule).getBlockSize());
10359
+ }
10308
10360
  }
10309
10361
  }
10310
10362
  else {
@@ -10391,11 +10443,11 @@ class Filter {
10391
10443
  this.filteredParentRecs = [];
10392
10444
  this.filteredResult = [];
10393
10445
  this.isHierarchyFilter = false;
10446
+ const hierarchyMode = this.parent.grid.searchSettings.key === '' ? this.parent.filterSettings.hierarchyMode
10447
+ : this.parent.searchSettings.hierarchyMode;
10394
10448
  for (let f = 0; f < this.flatFilteredData.length; f++) {
10395
10449
  const rec = this.flatFilteredData[parseInt(f.toString(), 10)];
10396
10450
  this.addParentRecord(rec);
10397
- const hierarchyMode = this.parent.grid.searchSettings.key === '' ? this.parent.filterSettings.hierarchyMode
10398
- : this.parent.searchSettings.hierarchyMode;
10399
10451
  if (((hierarchyMode === 'Child' || hierarchyMode === 'None') &&
10400
10452
  (this.parent.grid.filterSettings.columns.length !== 0 || this.parent.grid.searchSettings.key !== ''))) {
10401
10453
  this.isHierarchyFilter = true;
@@ -10407,8 +10459,6 @@ class Filter {
10407
10459
  const parent = getObject('parentItem', rec);
10408
10460
  if (!isNullOrUndefined(parent)) {
10409
10461
  const parRecord = getParentData(this.parent, rec.parentItem.uniqueID, true);
10410
- //let parRecord: Object = this.flatFilteredData.filter((e: ITreeData) => {
10411
- // return e.uniqueID === rec.parentItem.uniqueID; })[0];
10412
10462
  setValue('hasFilteredChildRecords', true, parRecord);
10413
10463
  if (parRecord && parRecord.parentItem) {
10414
10464
  this.updateParentFilteredRecord(parRecord);
@@ -10432,7 +10482,6 @@ class Filter {
10432
10482
  }
10433
10483
  addParentRecord(record) {
10434
10484
  const parent = getParentData(this.parent, record.parentUniqueID);
10435
- //let parent: Object = this.parent.flatData.filter((e: ITreeData) => {return e.uniqueID === record.parentUniqueID; })[0];
10436
10485
  const hierarchyMode = this.parent.grid.searchSettings.key === '' ? this.parent.filterSettings.hierarchyMode
10437
10486
  : this.parent.searchSettings.hierarchyMode;
10438
10487
  if (hierarchyMode === 'None' && (this.parent.grid.filterSettings.columns.length !== 0
@@ -11188,8 +11237,8 @@ class Toolbar {
11188
11237
  }
11189
11238
  row = (!isNullOrUndefined(selectedrow) && selectedrow.rowIndex !== row.rowIndex) ? selectedrow : row;
11190
11239
  if (indentEle !== null && outdentEle !== null) {
11191
- indentElement = toolbarElement.querySelector('#' + indentID).parentElement;
11192
- outdentElement = toolbarElement.querySelector('#' + outdentID).parentElement;
11240
+ indentElement = indentEle.parentElement;
11241
+ outdentElement = outdentEle.parentElement;
11193
11242
  if (row.rowIndex === 0 || tObj.getSelectedRowIndexes().length > 1) {
11194
11243
  indentElement.classList.add('e-hidden');
11195
11244
  outdentElement.classList.add('e-hidden');
@@ -11322,14 +11371,7 @@ class Aggregate {
11322
11371
  calculateSummaryValue(summaryQuery, filteredData, isSort) {
11323
11372
  this.summaryQuery = summaryQuery;
11324
11373
  let parentRecord;
11325
- const parentDataLength = Object.keys(filteredData).length;
11326
- const parentData = [];
11327
- for (let p = 0, len = parentDataLength; p < len; p++) {
11328
- const summaryRow = getObject('isSummaryRow', filteredData[parseInt(p.toString(), 10)]);
11329
- if (!summaryRow) {
11330
- parentData.push(filteredData[parseInt(p.toString(), 10)]);
11331
- }
11332
- }
11374
+ const parentData = filteredData.filter((data) => !getObject('isSummaryRow', data));
11333
11375
  const parentRecords = findParentRecords(parentData);
11334
11376
  const flatRecords = parentData.slice();
11335
11377
  const summaryLength = Object.keys(this.parent.aggregates).length;
@@ -11482,14 +11524,7 @@ class Aggregate {
11482
11524
  appendChildren(cellElement, tempObj.fn(single[summaryColumn.columnName], this.parent, tempObj.property));
11483
11525
  }
11484
11526
  const value = single[`${summaryColumn.columnName}`][`${summaryKey}`];
11485
- let summaryValue;
11486
- if (cellElement.innerHTML.indexOf(value) === -1) {
11487
- summaryValue = cellElement.innerHTML + value;
11488
- return summaryValue;
11489
- }
11490
- else {
11491
- return cellElement.innerHTML;
11492
- }
11527
+ return cellElement.innerHTML.indexOf(value) === -1 ? cellElement.innerHTML + value : cellElement.innerHTML;
11493
11528
  }
11494
11529
  getFormatFromType(summaryformat, type) {
11495
11530
  if (isNullOrUndefined(type) || typeof summaryformat !== 'string') {
@@ -11855,6 +11890,7 @@ class BatchEdit {
11855
11890
  this.parent.on('batchCancelAction', this.batchCancelAction, this);
11856
11891
  this.parent.grid.on('immutable-batch-cancel', this.immutableBatchAction, this);
11857
11892
  this.parent.grid.on('next-cell-index', this.nextCellIndex, this);
11893
+ this.parent.grid.on('cellfocused', this.onCellFocused, this);
11858
11894
  }
11859
11895
  /**
11860
11896
  * @hidden
@@ -11874,6 +11910,7 @@ class BatchEdit {
11874
11910
  this.parent.off('batchCancelAction', this.batchCancelAction);
11875
11911
  this.parent.grid.off('immutable-batch-cancel', this.immutableBatchAction);
11876
11912
  this.parent.grid.off('next-cell-index', this.nextCellIndex);
11913
+ this.parent.grid.off('cellfocused', this.onCellFocused);
11877
11914
  }
11878
11915
  /**
11879
11916
  * To destroy the editModule
@@ -11915,11 +11952,11 @@ class BatchEdit {
11915
11952
  batchPageAction() {
11916
11953
  const data = (this.parent.grid.dataSource instanceof DataManager ?
11917
11954
  this.parent.grid.dataSource.dataSource.json : this.parent.grid.dataSource);
11918
- const primaryKey = this.parent.grid.getPrimaryKeyFieldNames()[0];
11955
+ const primaryKeyField = this.parent.grid.getPrimaryKeyFieldNames()[0];
11919
11956
  let index;
11920
11957
  if (!isNullOrUndefined(this.batchAddedRecords) && this.batchAddedRecords.length) {
11921
11958
  for (let i = 0; i < this.batchAddedRecords.length; i++) {
11922
- index = data.map((e) => { return e[`${primaryKey}`]; }).indexOf(this.batchAddedRecords[parseInt(i.toString(), 10)][`${primaryKey}`]);
11959
+ index = data.findIndex((e) => { return e[`${primaryKeyField}`] === this.batchAddedRecords[parseInt(i.toString(), 10)][`${primaryKeyField}`]; });
11923
11960
  data.splice(index, 1);
11924
11961
  }
11925
11962
  }
@@ -12146,7 +12183,7 @@ class BatchEdit {
12146
12183
  childs.push(data);
12147
12184
  records = childs;
12148
12185
  for (let i = 0; i < records.length; i++) {
12149
- const indexvalue = this.batchRecords.map((e) => { return e[`${primarykey}`]; }).indexOf(records[parseInt(i.toString(), 10)][`${primarykey}`]);
12186
+ const indexvalue = this.batchRecords.findIndex((e) => { return e[`${primarykey}`] === records[parseInt(i.toString(), 10)][`${primarykey}`]; });
12150
12187
  if (indexvalue !== -1) {
12151
12188
  this.batchRecords.splice(indexvalue, 1);
12152
12189
  }
@@ -12165,11 +12202,11 @@ class BatchEdit {
12165
12202
  }
12166
12203
  updateChildCount(records) {
12167
12204
  const primaryKey = this.parent.grid.getPrimaryKeyFieldNames()[0];
12168
- const addedRecords = 'addedRecords';
12205
+ const addedRecords = this.parent.getBatchChanges().addedRecords || [];
12169
12206
  const parentItem = this.parent.editSettings.newRowPosition === 'Child' ? 'primaryParent' : 'parentItem';
12170
- for (let i = 0; i < this.parent.getBatchChanges()[`${addedRecords}`].length; i++) {
12171
- if (!isNullOrUndefined(this.parent.getBatchChanges()[`${addedRecords}`][parseInt(i.toString(), 10)][`${parentItem}`])) {
12172
- if (this.parent.getBatchChanges()[`${addedRecords}`][parseInt(i.toString(), 10)][`${parentItem}`][`${primaryKey}`] === records[parseInt(this.addRowIndex.toString(), 10)][`${primaryKey}`]) {
12207
+ for (let i = 0; i < addedRecords.length; i++) {
12208
+ if (!isNullOrUndefined(addedRecords[parseInt(i.toString(), 10)][`${parentItem}`])) {
12209
+ if (addedRecords[parseInt(i.toString(), 10)][`${parentItem}`][`${primaryKey}`] === records[parseInt(this.addRowIndex.toString(), 10)][`${primaryKey}`]) {
12173
12210
  this.batchChildCount = this.batchChildCount + 1;
12174
12211
  }
12175
12212
  }
@@ -12217,7 +12254,7 @@ class BatchEdit {
12217
12254
  const primaryKey = this.parent.grid.getPrimaryKeyFieldNames()[0];
12218
12255
  if (!isNullOrUndefined(this.batchAddedRecords)) {
12219
12256
  for (let i = 0; i < this.batchAddedRecords.length; i++) {
12220
- index = data.map((e) => { return e[`${primaryKey}`]; }).indexOf(this.batchAddedRecords[parseInt(i.toString(), 10)][`${primaryKey}`]);
12257
+ index = data.findIndex((e) => { return e[`${primaryKey}`] === this.batchAddedRecords[parseInt(i.toString(), 10)][`${primaryKey}`]; });
12221
12258
  if (index !== -1) {
12222
12259
  data.splice(index, 1);
12223
12260
  }
@@ -12229,7 +12266,7 @@ class BatchEdit {
12229
12266
  const children = currentViewRecords[parseInt(index.toString(), 10)][`${childRecords}`];
12230
12267
  for (let j = 0; children && j < children.length; j++) {
12231
12268
  if (children[parseInt(j.toString(), 10)][`${primaryKey}`] === this.batchAddedRecords[parseInt(i.toString(), 10)][`${primaryKey}`]) {
12232
- currentViewRecords[parseInt(index.toString(), 10)][`${childRecords}`].splice(j, 1);
12269
+ children.splice(j, 1);
12233
12270
  }
12234
12271
  }
12235
12272
  }
@@ -12360,9 +12397,11 @@ class BatchEdit {
12360
12397
  const indexValue = currentViewRecords.map((e) => { return e[`${primarykey}`]; })
12361
12398
  .indexOf(addRecords[parseInt(i.toString(), 10)][`${parentItem}`][`${primarykey}`]);
12362
12399
  const children = currentViewRecords[parseInt(indexValue.toString(), 10)][`${childRecords}`];
12363
- for (let j = 0; j < children.length; j++) {
12364
- if (children[parseInt(j.toString(), 10)][`${primarykey}`] === addRecords[parseInt(i.toString(), 10)][`${primarykey}`]) {
12365
- currentViewRecords[parseInt(indexValue.toString(), 10)][`${childRecords}`].splice(j, 1);
12400
+ if (!isNullOrUndefined(addRowIndex) && children.some((records) => records.uniqueID === addRowRecord.uniqueID)) {
12401
+ for (let j = 0; j < children.length; j++) {
12402
+ if (children[parseInt(j.toString(), 10)][`${primarykey}`] === addRecords[parseInt(i.toString(), 10)][`${primarykey}`]) {
12403
+ currentViewRecords[parseInt(indexValue.toString(), 10)][`${childRecords}`].splice(j, 1);
12404
+ }
12366
12405
  }
12367
12406
  }
12368
12407
  }
@@ -12443,6 +12482,15 @@ class BatchEdit {
12443
12482
  args[`${index}`] = this.batchIndex;
12444
12483
  }
12445
12484
  }
12485
+ onCellFocused(e) {
12486
+ if (this.parent.editSettings.mode === 'Cell' && this.parent.grid.isEdit && e.keyArgs) {
12487
+ if (e.keyArgs.action === 'shiftEnter') {
12488
+ e.keyArgs.preventDefault();
12489
+ this.parent.endEdit();
12490
+ return;
12491
+ }
12492
+ }
12493
+ }
12446
12494
  }
12447
12495
 
12448
12496
  /**
@@ -12461,6 +12509,7 @@ class Edit {
12461
12509
  this.prevAriaRowIndex = '-1';
12462
12510
  this.isAddedRowByMethod = false;
12463
12511
  this.isAddedRowByContextMenu = false;
12512
+ this.isIndexUndefined = false;
12464
12513
  Grid.Inject(Edit$1);
12465
12514
  this.parent = parent;
12466
12515
  this.isSelfReference = !isNullOrUndefined(parent.parentIdMapping);
@@ -12712,7 +12761,7 @@ class Edit {
12712
12761
  }
12713
12762
  }
12714
12763
  keyPressed(args) {
12715
- if (this.isOnBatch) {
12764
+ if (this.isOnBatch || args.action === 'tab' || args.action === 'shiftTab') {
12716
12765
  this.keyPress = args.action;
12717
12766
  }
12718
12767
  if (args.action === 'f2') {
@@ -13248,9 +13297,10 @@ class Edit {
13248
13297
  this.addRowRecord = this.parent.flatData[args.index];
13249
13298
  this.addRowIndex = args.index;
13250
13299
  }
13251
- if (this.parent.editSettings.newRowPosition === 'Child' &&
13300
+ if (this.parent.editSettings.newRowPosition === 'Child' && this.isIndexUndefined &&
13252
13301
  !isNullOrUndefined(this.parent.getSelectedRecords()[0])) {
13253
13302
  this.addRowRecord = this.parent.getSelectedRecords()[0];
13303
+ this.isIndexUndefined = false;
13254
13304
  }
13255
13305
  if (isNullOrUndefined(this.addRowRecord) && this.parent.getCurrentViewRecords().length > this.addRowIndex &&
13256
13306
  args.requestType === 'save' && this.parent.getSelectedRecords().length !== 0) {
@@ -13306,7 +13356,7 @@ class Edit {
13306
13356
  const lastAriaIndex = rows.length ? +rows[rows.length - 1].getAttribute('aria-rowindex') - 1 : 0;
13307
13357
  const withinRange = this.parent.enableVirtualization && args.index !== 0 ? true :
13308
13358
  this.selectedIndex >= firstAriaIndex && this.selectedIndex <= lastAriaIndex;
13309
- if (currentData.length) {
13359
+ if (currentData.length && !isNullOrUndefined(index)) {
13310
13360
  idMapping = currentData[this.addRowIndex][this.parent.idMapping];
13311
13361
  parentIdMapping = currentData[this.addRowIndex][this.parent.parentIdMapping];
13312
13362
  if (currentData[this.addRowIndex].parentItem) {
@@ -13314,7 +13364,7 @@ class Edit {
13314
13364
  }
13315
13365
  parentItem = currentData[this.addRowIndex].parentItem;
13316
13366
  }
13317
- if (this.parent.editSettings.newRowPosition !== 'Top' && currentData.length) {
13367
+ if (this.parent.editSettings.newRowPosition !== 'Top' && currentData.length && !isNullOrUndefined(index)) {
13318
13368
  level = currentData[this.addRowIndex].level;
13319
13369
  if (this.parent.editSettings.newRowPosition === 'Above') {
13320
13370
  position = 'before';
@@ -13391,12 +13441,16 @@ class Edit {
13391
13441
  }
13392
13442
  if (args.requestType === 'delete') {
13393
13443
  const deletedValues = args.data;
13394
- for (let i = 0; i < deletedValues.length; i++) {
13395
- if (deletedValues[parseInt(i.toString(), 10)].parentItem) {
13396
- const parentItem = getParentData(this.parent, deletedValues[parseInt(i.toString(), 10)].parentItem.uniqueID);
13397
- if (!isNullOrUndefined(parentItem) && parentItem.hasChildRecords) {
13398
- const childIndex = parentItem.childRecords.indexOf(deletedValues[parseInt(i.toString(), 10)]);
13399
- parentItem.childRecords.splice(childIndex, 1);
13444
+ const primaryKeyField = this.parent.getPrimaryKeyFieldNames();
13445
+ if (!isNullOrUndefined(primaryKeyField) && primaryKeyField.length > 0) {
13446
+ for (let i = 0; i < deletedValues.length; i++) {
13447
+ const deletevalue = deletedValues[parseInt(i.toString(), 10)].parentItem;
13448
+ if (deletevalue) {
13449
+ const parentItem = getParentData(this.parent, deletevalue.uniqueID);
13450
+ if (!isNullOrUndefined(parentItem) && parentItem.hasChildRecords) {
13451
+ const childIndex = parentItem.childRecords.findIndex((child) => deletedValues[parseInt(i.toString(), 10)][primaryKeyField[0]] === child[primaryKeyField[0]]);
13452
+ parentItem.childRecords.splice(childIndex, 1);
13453
+ }
13400
13454
  }
13401
13455
  }
13402
13456
  }
@@ -13412,6 +13466,9 @@ class Edit {
13412
13466
  if (this.parent.editSettings.newRowPosition === this.previousNewRowPosition || this.previousNewRowPosition === null) {
13413
13467
  this.previousNewRowPosition = this.parent.editSettings.newRowPosition;
13414
13468
  }
13469
+ if (isNullOrUndefined(index)) {
13470
+ this.isIndexUndefined = true;
13471
+ }
13415
13472
  if (!this.isSelfReference && !isNullOrUndefined(data) && Object.hasOwnProperty.call(data, this.parent.childMapping)) {
13416
13473
  const addRecords = [];
13417
13474
  const previousEditMode = this.parent.editSettings.mode;
@@ -13584,12 +13641,12 @@ class DetailRow {
13584
13641
  args[`${visible}`] = false;
13585
13642
  }
13586
13643
  dataBoundArg() {
13587
- const detailele = this.parent.getRows().filter((e) => {
13644
+ const detailRows = this.parent.getRows().filter((e) => {
13588
13645
  return !e.classList.contains('e-detailrow');
13589
13646
  });
13590
- for (let i = 0; i < detailele.length; i++) {
13591
- const elements = detailele[parseInt(i.toString(), 10)].getElementsByClassName('e-detailrowcollapse');
13592
- const detailData = this.parent.grid.getRowObjectFromUID(detailele[parseInt(i.toString(), 10)].getAttribute('data-Uid'));
13647
+ for (let i = 0; i < detailRows.length; i++) {
13648
+ const elements = detailRows[parseInt(i.toString(), 10)].getElementsByClassName('e-detailrowcollapse');
13649
+ const detailData = this.parent.grid.getRowObjectFromUID(detailRows[parseInt(i.toString(), 10)].getAttribute('data-Uid'));
13593
13650
  const parentItem = getObject('parentItem', this.parent.grid.getCurrentViewRecords()[parseInt(i.toString(), 10)]);
13594
13651
  if (isNullOrUndefined(parentItem) || !isNullOrUndefined(parentItem) &&
13595
13652
  getExpandStatus(this.parent, detailData.data, this.parent.grid.getCurrentViewRecords())) {
@@ -13625,10 +13682,9 @@ class DetailRow {
13625
13682
  }
13626
13683
  actioncomplete(args) {
13627
13684
  if (args.requestType === 'beginEdit' || args.requestType === 'add') {
13628
- const spann = (args.row.querySelectorAll('.e-editcell')[0].getAttribute('colSpan'));
13629
- const colum = parseInt(spann, 10) - 1;
13630
- const updtdcolum = colum.toString();
13631
- args.row.querySelectorAll('.e-editcell')[0].setAttribute('colSpan', updtdcolum);
13685
+ const colSpan = (args.row.querySelectorAll('.e-editcell')[0].getAttribute('colSpan'));
13686
+ const colum = parseInt(colSpan, 10) - 1;
13687
+ args.row.querySelectorAll('.e-editcell')[0].setAttribute('colSpan', colum.toString());
13632
13688
  }
13633
13689
  const focusElement = this.parent.grid.contentModule.getRows();
13634
13690
  for (let i = 0; i < focusElement.length; i++) {
@@ -13845,6 +13901,7 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
13845
13901
  this.parent[`${action}`]('refresh-virtual-editform-cells', this.refreshCell, this);
13846
13902
  this.parent[`${action}`]('virtaul-cell-focus', this.cellFocus, this);
13847
13903
  this.parent[`${action}`]('virtual-scroll-edit', this.restoreEditState, this);
13904
+ this.parent[`${action}`]('set-virtual-page-query', this.SetVirtualPageQury, this);
13848
13905
  }
13849
13906
  else {
13850
13907
  super.eventListener('on');
@@ -14097,6 +14154,18 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
14097
14154
  const restoreEdit = 'restoreEdit';
14098
14155
  super[`${restoreEdit}`]();
14099
14156
  }
14157
+ SetVirtualPageQury(args) {
14158
+ let visiblePage = [];
14159
+ if (this.prevInfo && this.prevInfo.blockIndexes) {
14160
+ visiblePage = getVisiblePage(this.prevInfo.blockIndexes);
14161
+ }
14162
+ if ((this.requestType === 'refresh') && visiblePage.length) {
14163
+ args.query.skip(this.parent.pageSettings.pageSize * (visiblePage[0] - 1));
14164
+ args.query.take(this.parent.pageSettings.pageSize * visiblePage.length);
14165
+ args.skipPage = true;
14166
+ return;
14167
+ }
14168
+ }
14100
14169
  /**
14101
14170
  * Resets the edit state if certain conditions are met.
14102
14171
  *
@@ -14236,6 +14305,19 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
14236
14305
  const xAxis = current.axis === 'X';
14237
14306
  let x = this.getColumnOffset(xAxis ? this.vgenerator.getColumnIndexes()[0] - 1 : this.prevInfo.columnIndexes[0]
14238
14307
  - 1);
14308
+ if (this.parent.isFrozenGrid() && this.parent.enableColumnVirtualization && this.currentInfo &&
14309
+ this.currentInfo.columnIndexes) {
14310
+ const cBlock = this.currentInfo.columnIndexes[0] - 1;
14311
+ let frzLeftWidth = 0;
14312
+ this.parent.getColumns().filter((col) => {
14313
+ if (col.visible && col.freeze === 'Left') {
14314
+ frzLeftWidth += parseInt(col.width.toString(), 10);
14315
+ }
14316
+ });
14317
+ if (cBlock > this.parent.getVisibleFrozenLeftCount()) {
14318
+ x = x - frzLeftWidth;
14319
+ }
14320
+ }
14239
14321
  if (xAxis) {
14240
14322
  const idx = Object.keys(this.vgenerator.cOffsets).length - this.prevInfo.columnIndexes.length;
14241
14323
  const maxLeft = this.vgenerator.cOffsets[idx - 1];
@@ -14253,6 +14335,9 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
14253
14335
  }
14254
14336
  if (this.parent.enableColumnVirtualization) {
14255
14337
  this.header.virtualEle.adjustTable(x, 0);
14338
+ if (this.parent.isFrozenGrid()) {
14339
+ this.parent.contentModule['resetStickyLeftPos'](x);
14340
+ }
14256
14341
  }
14257
14342
  }
14258
14343
  }
@@ -14397,10 +14482,10 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
14397
14482
  if (((downScroll && scrollArgs.direction !== 'up' && (scrollArgs.offset.top < (rowHeight * this.totalRecords)))
14398
14483
  || (upScroll)) || (scrollArgs.direction === 'right' || scrollArgs.direction === 'left') ||
14399
14484
  ((this.parent.dataSource instanceof DataManager && this.parent.dataSource.dataSource.url !== undefined
14400
- && !this.parent.dataSource.dataSource.offline && this.parent.dataSource.dataSource.url !== '') && (downScroll || upScroll) || isCountRequired(this.parent))) {
14485
+ && !this.parent.dataSource.dataSource.offline && this.parent.dataSource.dataSource.url !== ''))) {
14401
14486
  const viewInfo = this.currentInfo = getValue('getInfoFromView', this).apply(this, [scrollArgs.direction, info, scrollArgs.offset]);
14402
14487
  this.previousInfo = viewInfo;
14403
- if (this.prevInfo && viewInfo.event !== 'refresh-virtual-block' && ((info.axis === 'Y' && this.prevInfo.blockIndexes.toString() === viewInfo.blockIndexes.toString())
14488
+ if (this.prevInfo && ((info.axis === 'Y' && this.prevInfo.blockIndexes.toString() === viewInfo.blockIndexes.toString())
14404
14489
  || ((info.axis === 'X' && this.prevInfo.columnIndexes.toString() === viewInfo.columnIndexes.toString())
14405
14490
  || (this.parent.isFrozenGrid() && this.parent.getVisibleFrozenLeftCount() >= viewInfo.columnIndexes[0]
14406
14491
  && this.prevInfo.columnIndexes.toString().includes(viewInfo.columnIndexes.toString()))))) {
@@ -14422,7 +14507,7 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
14422
14507
  viewInfo.loadNext = false;
14423
14508
  }
14424
14509
  this.requestType = 'virtualscroll';
14425
- if (scrollArgs.direction !== 'right' && scrollArgs.direction !== 'left') {
14510
+ if (scrollArgs.direction !== 'right' && scrollArgs.direction !== 'left' && !isRemoteData(this.parent.root)) {
14426
14511
  viewInfo.event = viewInfo.event === 'refresh-virtual-block' ? 'model-changed' : viewInfo.event;
14427
14512
  }
14428
14513
  if (this.parent.enableVirtualMaskRow) {
@@ -14479,7 +14564,7 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
14479
14564
  getValue('currentInfo', this).page && getValue('currentInfo', this).page !== e.virtualInfo.page ?
14480
14565
  getValue('currentInfo', this) : e.virtualInfo;
14481
14566
  const cBlock = (info.columnIndexes[0]) - 1;
14482
- const cOffset = this.getColumnOffset(cBlock);
14567
+ let cOffset = this.getColumnOffset(cBlock);
14483
14568
  let width;
14484
14569
  if (this.parent.enableColumnVirtualization) {
14485
14570
  this.header.virtualEle.adjustTable(cOffset, 0);
@@ -14495,9 +14580,33 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
14495
14580
  if (e.requestType === 'virtualscroll' && e.virtualInfo.sentinelInfo.axis === 'Y') {
14496
14581
  this.isExpandCollapse = false;
14497
14582
  }
14583
+ let reduceWidth = 0;
14584
+ if (this.parent.enableColumnVirtualization && this.parent.isFrozenGrid()) {
14585
+ let frzLeftWidth = 0;
14586
+ this.parent.getColumns().filter((col) => {
14587
+ if (col.visible) {
14588
+ reduceWidth += parseInt(col.width.toString(), 10);
14589
+ if (col.freeze === 'Left') {
14590
+ frzLeftWidth += parseInt(col.width.toString(), 10);
14591
+ }
14592
+ }
14593
+ });
14594
+ const cIndex = info.columnIndexes;
14595
+ width = this.getColumnOffset(cIndex[cIndex.length - 1]) - this.getColumnOffset(cIndex[0] - 1) + '';
14596
+ if (cBlock > this.parent.getVisibleFrozenLeftCount()) {
14597
+ cOffset = cOffset - frzLeftWidth;
14598
+ }
14599
+ this.resetStickyLeftPos(cOffset, newChild);
14600
+ }
14498
14601
  if (!this.isExpandCollapse || this.translateY === 0) {
14499
14602
  this.translateY = this.translateY < 0 ? 0 : this.translateY;
14500
14603
  getValue('virtualEle', this).adjustTable(cOffset, this.translateY);
14604
+ if (this.parent.enableColumnVirtualization) {
14605
+ this.header.virtualEle.adjustTable(cOffset, 0);
14606
+ if (this.parent.isFrozenGrid()) {
14607
+ this.resetStickyLeftPos(cOffset);
14608
+ }
14609
+ }
14501
14610
  }
14502
14611
  else {
14503
14612
  this.isExpandCollapse = false;
@@ -14611,7 +14720,12 @@ class TreeInterSectionObserver extends InterSectionObserver {
14611
14720
  this[`${options}`].prevTop = this[`${options}`].prevLeft = 0;
14612
14721
  const isScrollByFocus = 'isScrollByFocus';
14613
14722
  return (e) => {
14614
- if (instance.isEdit && instance.root.editModule[`${isScrollByFocus}`]) {
14723
+ const keyPress = 'keyPress';
14724
+ let keyaction;
14725
+ if (instance && instance.root && instance.root.editModule && instance.root.editModule[`${keyPress}`]) {
14726
+ keyaction = instance.root.editModule[`${keyPress}`];
14727
+ }
14728
+ if ((instance.isEdit && instance.root.editModule[`${isScrollByFocus}`]) || (instance.isEdit && (keyaction === 'tab' || keyaction === 'shiftTab'))) {
14615
14729
  instance.root.editModule[`${isScrollByFocus}`] = false;
14616
14730
  return;
14617
14731
  }