@syncfusion/ej2-treegrid 29.2.4 → 30.1.37

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 (97) 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 +251 -149
  6. package/dist/es6/ej2-treegrid.es2015.js.map +1 -1
  7. package/dist/es6/ej2-treegrid.es5.js +311 -178
  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 +15 -51
  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/sort.js +6 -1
  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/interface.d.ts +5 -1
  27. package/src/treegrid/base/treegrid-model.d.ts +8 -1
  28. package/src/treegrid/base/treegrid.d.ts +7 -0
  29. package/src/treegrid/base/treegrid.js +87 -53
  30. package/src/treegrid/renderer/virtual-row-model-generator.js +10 -13
  31. package/src/treegrid/renderer/virtual-tree-content-render.d.ts +1 -0
  32. package/src/treegrid/renderer/virtual-tree-content-render.js +65 -6
  33. package/styles/bds-lite.css +30 -0
  34. package/styles/bds.css +30 -0
  35. package/styles/bootstrap-dark-lite.css +30 -0
  36. package/styles/bootstrap-dark.css +30 -0
  37. package/styles/bootstrap-lite.css +30 -0
  38. package/styles/bootstrap.css +30 -0
  39. package/styles/bootstrap4-lite.css +30 -0
  40. package/styles/bootstrap4.css +30 -0
  41. package/styles/bootstrap5-dark-lite.css +30 -0
  42. package/styles/bootstrap5-dark.css +30 -0
  43. package/styles/bootstrap5-lite.css +30 -0
  44. package/styles/bootstrap5.3-lite.css +30 -0
  45. package/styles/bootstrap5.3.css +30 -0
  46. package/styles/bootstrap5.css +30 -0
  47. package/styles/fabric-dark-lite.css +30 -0
  48. package/styles/fabric-dark.css +30 -0
  49. package/styles/fabric-lite.css +30 -0
  50. package/styles/fabric.css +30 -0
  51. package/styles/fluent-dark-lite.css +30 -0
  52. package/styles/fluent-dark.css +30 -0
  53. package/styles/fluent-lite.css +30 -0
  54. package/styles/fluent.css +30 -0
  55. package/styles/fluent2-lite.css +30 -0
  56. package/styles/fluent2.css +30 -3
  57. package/styles/highcontrast-light-lite.css +30 -0
  58. package/styles/highcontrast-light.css +30 -0
  59. package/styles/highcontrast-lite.css +30 -0
  60. package/styles/highcontrast.css +30 -0
  61. package/styles/material-dark-lite.css +30 -0
  62. package/styles/material-dark.css +30 -0
  63. package/styles/material-lite.css +30 -0
  64. package/styles/material.css +30 -0
  65. package/styles/material3-dark-lite.css +30 -0
  66. package/styles/material3-dark.css +30 -0
  67. package/styles/material3-lite.css +30 -0
  68. package/styles/material3.css +30 -0
  69. package/styles/tailwind-dark-lite.css +30 -0
  70. package/styles/tailwind-dark.css +30 -0
  71. package/styles/tailwind-lite.css +30 -0
  72. package/styles/tailwind.css +30 -0
  73. package/styles/tailwind3-lite.css +30 -0
  74. package/styles/tailwind3.css +30 -0
  75. package/styles/treegrid/_bigger.scss +66 -66
  76. package/styles/treegrid/_layout.scss +39 -0
  77. package/styles/treegrid/bds.css +30 -0
  78. package/styles/treegrid/bootstrap-dark.css +30 -0
  79. package/styles/treegrid/bootstrap.css +30 -0
  80. package/styles/treegrid/bootstrap4.css +30 -0
  81. package/styles/treegrid/bootstrap5-dark.css +30 -0
  82. package/styles/treegrid/bootstrap5.3.css +30 -0
  83. package/styles/treegrid/bootstrap5.css +30 -0
  84. package/styles/treegrid/fabric-dark.css +30 -0
  85. package/styles/treegrid/fabric.css +30 -0
  86. package/styles/treegrid/fluent-dark.css +30 -0
  87. package/styles/treegrid/fluent.css +30 -0
  88. package/styles/treegrid/fluent2.css +30 -3
  89. package/styles/treegrid/highcontrast-light.css +30 -0
  90. package/styles/treegrid/highcontrast.css +30 -0
  91. package/styles/treegrid/material-dark.css +30 -0
  92. package/styles/treegrid/material.css +30 -0
  93. package/styles/treegrid/material3-dark.css +30 -0
  94. package/styles/treegrid/material3.css +30 -0
  95. package/styles/treegrid/tailwind-dark.css +30 -0
  96. package/styles/treegrid/tailwind.css +30 -0
  97. 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
  }
@@ -2113,6 +2110,15 @@ class DataManipulation {
2113
2110
  if (parentRec) {
2114
2111
  records[parseInt(rec.toString(), 10)].level = parentRec.level + 1;
2115
2112
  }
2113
+ else {
2114
+ const parentRec = args.actual.flatData.find((record) => record[`${this.parent.idMapping}`] === parentID);
2115
+ if (isNullOrUndefined(parentRec[`${this.parent.parentIdMapping}`])) {
2116
+ records[parseInt(rec.toString(), 10)].level = 1;
2117
+ }
2118
+ else {
2119
+ records[parseInt(rec.toString(), 10)].level = parentRec.level + 1;
2120
+ }
2121
+ }
2116
2122
  }
2117
2123
  else {
2118
2124
  records[parseInt(rec.toString(), 10)].level = 0;
@@ -2207,33 +2213,33 @@ class DataManipulation {
2207
2213
  fetchRemoteChildData(rowDetails) {
2208
2214
  const args = { row: rowDetails.parentRow, data: rowDetails.record };
2209
2215
  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;
2216
+ const query = this.parent.grid.getDataModule().generateQuery();
2217
+ const clonequries = query.queries.filter((e) => e.fn !== 'onPage' && e.fn !== 'onWhere');
2218
+ query.queries = clonequries;
2219
+ query.isCountRequired = true;
2214
2220
  let idMappingValue = parseInt(rowDetails.record[this.parent.idMapping], 10);
2215
2221
  if (isNaN(idMappingValue)) {
2216
2222
  idMappingValue = rowDetails.record[this.parent.idMapping].toString();
2217
2223
  }
2218
2224
  if (this.parent.enableVirtualization && rowDetails.action === 'remoteExpand') {
2219
- qry.take(this.parent.pageSettings.pageSize);
2225
+ query.take(this.parent.grid.pageSettings.pageSize);
2220
2226
  const expandDetail = [];
2221
2227
  expandDetail.push('ExpandingAction', idMappingValue.toString());
2222
- qry.expand(expandDetail);
2228
+ query.expand(expandDetail);
2223
2229
  }
2224
2230
  else if (this.parent.enableVirtualization && rowDetails.action === 'collapse') {
2225
- qry.take(this.parent.grid.pageSettings.pageSize);
2231
+ query.take(this.parent.grid.pageSettings.pageSize);
2226
2232
  const expandDetail = [];
2227
2233
  expandDetail.push('CollapsingAction', idMappingValue.toString());
2228
- qry.expand(expandDetail);
2234
+ query.expand(expandDetail);
2229
2235
  }
2230
- qry.where(this.parent.parentIdMapping, 'equal', rowDetails.record[this.parent.idMapping]);
2236
+ query.where(this.parent.parentIdMapping, 'equal', rowDetails.record[this.parent.idMapping]);
2231
2237
  if (rowDetails.action === 'remoteExpand' && this.parent.grid.filterSettings && this.parent.grid.filterSettings.columns.length) {
2232
2238
  const filterqry = this.parent.grid.getDataModule().generateQuery().queries.filter((e) => e.fn !== 'onPage' && typeof e.e.predicates !== 'undefined');
2233
- qry.queries.push(filterqry[0]);
2239
+ query.queries.push(filterqry[0]);
2234
2240
  }
2235
2241
  showSpinner(this.parent.element);
2236
- dm.executeQuery(qry).then((e) => {
2242
+ dm.executeQuery(query).then((e) => {
2237
2243
  const remoteExpandedData = 'remoteExpandedData';
2238
2244
  const remoteCollapsedData = 'remoteCollapsedData';
2239
2245
  const level = 'level';
@@ -2406,8 +2412,15 @@ class DataManipulation {
2406
2412
  record.expanded = false;
2407
2413
  }
2408
2414
  }
2409
- datas.splice(inx + r + 1, 0, record);
2415
+ const exists = datas.some((data) => data[`${this.parent.idMapping}`] === record[this.parent.idMapping]);
2416
+ if (!exists) {
2417
+ datas.splice(inx + r + 1, 0, record);
2418
+ }
2410
2419
  }
2420
+ const localIdMapping = this.parent.idMapping;
2421
+ datas.sort(function (firstRecord, secondRecord) {
2422
+ return firstRecord[`${localIdMapping}`] - secondRecord[`${localIdMapping}`];
2423
+ });
2411
2424
  setValue('result', datas, e);
2412
2425
  setValue('action', 'beforecontentrender', e);
2413
2426
  this.parent.trigger(actionComplete, e);
@@ -2450,7 +2463,8 @@ class DataManipulation {
2450
2463
  const contentModule = getValue('grid.contentModule', this.parent);
2451
2464
  const currentInfo = getValue('currentInfo', contentModule);
2452
2465
  const prevInfo = getValue('prevInfo', contentModule);
2453
- if (currentInfo.loadNext && this.parent.grid.pageSettings.currentPage === currentInfo.nextInfo.page) {
2466
+ if (currentInfo.loadNext && this.parent.grid.pageSettings.currentPage === currentInfo.nextInfo.page
2467
+ && !this.parent.loadChildOnDemand) {
2454
2468
  this.parent.grid.pageSettings.currentPage = prevInfo.page;
2455
2469
  }
2456
2470
  }
@@ -3352,7 +3366,9 @@ function updateParentRow(key, record, action, control, isSelfReference, child) {
3352
3366
  }
3353
3367
  else {
3354
3368
  if (!isNullOrUndefined(child) && record[`${key}`] !== child[`${key}`]) {
3355
- record.childRecords.push(child);
3369
+ if (!record.childRecords.some((records) => records.uniqueID === child.uniqueID)) {
3370
+ record.childRecords.push(child);
3371
+ }
3356
3372
  }
3357
3373
  }
3358
3374
  if (record.childRecords.indexOf(childRecords) === -1 && record[`${key}`] !== child[`${key}`]) {
@@ -3817,7 +3833,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
3817
3833
  parentTarget = target.parentElement;
3818
3834
  if (!isNullOrUndefined(parentTarget)) {
3819
3835
  const cellIndex = parentTarget.cellIndex;
3820
- if (this.grid.getColumnByIndex(cellIndex).editType === 'dropdownedit' && isNullOrUndefined(this.grid.getColumnByIndex(cellIndex).edit['obj'])) {
3836
+ if (cellIndex && this.grid.getColumnByIndex(cellIndex).editType === 'dropdownedit' && isNullOrUndefined(this.grid.getColumnByIndex(cellIndex).edit['obj'])) {
3821
3837
  parentTarget = target;
3822
3838
  }
3823
3839
  summaryElement = this.findnextRowElement(parentTarget);
@@ -3825,8 +3841,11 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
3825
3841
  const cellIndex = target.cellIndex;
3826
3842
  const row = summaryElement.children[parseInt(cellIndex.toString(), 10)];
3827
3843
  if (!isNullOrUndefined(row) && !this.grid.isEdit) {
3828
- addClass([row], 'e-focused');
3829
- addClass([row], 'e-focus');
3844
+ const focusedCells = this.grid.getContent().querySelectorAll('.e-rowcell.e-focused, .e-rowcell.e-focus');
3845
+ focusedCells.forEach((cell) => {
3846
+ removeClass([cell], ['e-focused', 'e-focus']);
3847
+ });
3848
+ addClass([row], ['e-focused', 'e-focus']);
3830
3849
  }
3831
3850
  }
3832
3851
  else {
@@ -3846,7 +3865,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
3846
3865
  parentTarget = target.parentElement;
3847
3866
  if (!isNullOrUndefined(parentTarget)) {
3848
3867
  const cellIndex = parentTarget.cellIndex;
3849
- if (this.grid.getColumnByIndex(cellIndex).editType === 'dropdownedit' && isNullOrUndefined(this.grid.getColumnByIndex(cellIndex).edit['obj'])) {
3868
+ if (cellIndex && this.grid.getColumnByIndex(cellIndex).editType === 'dropdownedit' && isNullOrUndefined(this.grid.getColumnByIndex(cellIndex).edit['obj'])) {
3850
3869
  parentTarget = target;
3851
3870
  }
3852
3871
  summaryElement = this.findPreviousRowElement(parentTarget);
@@ -3855,8 +3874,11 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
3855
3874
  if (!isNullOrUndefined(cellIndex)) {
3856
3875
  const row = summaryElement.children[parseInt(cellIndex.toString(), 10)];
3857
3876
  if (!isNullOrUndefined(row) && !this.grid.isEdit) {
3858
- addClass([row], 'e-focused');
3859
- addClass([row], 'e-focus');
3877
+ const focusedCells = this.grid.getContent().querySelectorAll('.e-rowcell.e-focused, .e-rowcell.e-focus');
3878
+ focusedCells.forEach((cell) => {
3879
+ removeClass([cell], ['e-focused', 'e-focus']);
3880
+ });
3881
+ addClass([row], ['e-focused', 'e-focus']);
3860
3882
  }
3861
3883
  }
3862
3884
  }
@@ -4221,11 +4243,14 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4221
4243
  const destroyTemplate = 'destroyTemplate';
4222
4244
  const destroyTemplateFn = this.grid[`${destroyTemplate}`];
4223
4245
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4224
- this.grid[`${destroyTemplate}`] = (args, index) => {
4246
+ this.grid[`${destroyTemplate}`] = (args, index, callback) => {
4225
4247
  destroyTemplateFn.apply(this.grid);
4226
4248
  const portals = 'portals';
4227
4249
  if (!(this.isReact && isNullOrUndefined(this[`${portals}`]))) {
4228
- this.clearTemplate(args, index);
4250
+ this.clearTemplate(args, index, callback);
4251
+ }
4252
+ else if (!isNullOrUndefined(callback)) {
4253
+ callback();
4229
4254
  }
4230
4255
  };
4231
4256
  }
@@ -4325,12 +4350,13 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4325
4350
  }
4326
4351
  if (data instanceof Array && data.length > 0 && Object.prototype.hasOwnProperty.call(data[0], 'level')) {
4327
4352
  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);
4353
+ for (let i = 0, len = this.flatData.length; i < len; i++) {
4354
+ const rowData = this.flatData[parseInt(i.toString(), 10)];
4355
+ setValue('uniqueIDCollection.' + rowData['uniqueID'], rowData, this);
4356
+ if (rowData.level === 0 && !this.parentData.some((record) => record.uniqueID === rowData.uniqueID)) {
4357
+ this.parentData.push(rowData);
4332
4358
  }
4333
- });
4359
+ }
4334
4360
  }
4335
4361
  else {
4336
4362
  if (isCountRequired(this)) {
@@ -4420,6 +4446,9 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4420
4446
  this.grid[`${isJsComponent}`] = true;
4421
4447
  const enableHtmlSanitizer = 'enableHtmlSanitizer';
4422
4448
  this.grid[`${enableHtmlSanitizer}`] = this.enableHtmlSanitizer;
4449
+ this.grid.enableStickyHeader = this.enableStickyHeader;
4450
+ const isTreeGrid = 'isTreeGrid';
4451
+ this.grid[`${isTreeGrid}`] = true;
4423
4452
  }
4424
4453
  triggerEvents(args) {
4425
4454
  this.trigger(getObject('name', args), args);
@@ -4555,6 +4584,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4555
4584
  }
4556
4585
  extendedGridDataBoundEvent() {
4557
4586
  this.grid.dataBound = (args) => {
4587
+ this.lastRowBorderEventListener();
4558
4588
  this.updateRowTemplate();
4559
4589
  this.updateColumnModel();
4560
4590
  this.updateAltRow(this.getRows());
@@ -4647,6 +4677,9 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4647
4677
  }
4648
4678
  };
4649
4679
  }
4680
+ lastRowBorderEventListener() {
4681
+ this.grid.on('last-rowcell-border-updated', this.lastRowCellBorderUpdated, this);
4682
+ }
4650
4683
  bindCallBackEvents() {
4651
4684
  this.grid.toolbarClick = (args) => {
4652
4685
  if ((args.item.id === this.grid.element.id + '_excelexport' && this.allowExcelExport === false) ||
@@ -4810,6 +4843,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4810
4843
  if (args.requestType === 'sorting' && args.target && args.target.parentElement &&
4811
4844
  args.target.parentElement.classList.contains('e-hierarchycheckbox')) {
4812
4845
  args.cancel = true;
4846
+ return;
4813
4847
  }
4814
4848
  const requestType = getObject('requestType', args);
4815
4849
  if (requestType === 'reorder') {
@@ -4870,12 +4904,12 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4870
4904
  this.grid.refresh();
4871
4905
  }
4872
4906
  if (args.action === 'filter') {
4873
- if (this.filterModule['currentFilterObject'] !== '' && this.enableVirtualization && !this.initialRender && !(isRemoteData(this) && this.enableVirtualization)) {
4907
+ if (!args.isCollapseMaintain && this.filterModule['currentFilterObject'] !== '' && this.enableVirtualization && !this.initialRender && !(isRemoteData(this) && this.enableVirtualization)) {
4874
4908
  this.expandAll();
4875
4909
  }
4876
4910
  }
4877
4911
  if (args.requestType === 'searching') {
4878
- if (this.searchSettings.key !== '' && this.enableVirtualization && !this.initialRender && !(isRemoteData(this) && this.enableVirtualization)) {
4912
+ if (!args.isCollapseMaintain && this.searchSettings.key !== '' && this.enableVirtualization && !this.initialRender && !(isRemoteData(this) && this.enableVirtualization)) {
4879
4913
  this.expandAll();
4880
4914
  }
4881
4915
  }
@@ -5006,11 +5040,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5006
5040
  const record = this.dataSource[0];
5007
5041
  // }
5008
5042
  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
- }
5043
+ this.columns = keys.filter((key) => { return [this.childMapping, this.parentIdMapping].indexOf(key) === -1; });
5014
5044
  }
5015
5045
  }
5016
5046
  getGridEditSettings() {
@@ -5162,7 +5192,9 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5162
5192
  gridColumn.field = treeGridColumn.field = this.columns[parseInt(i.toString(), 10)];
5163
5193
  }
5164
5194
  else {
5165
- for (const prop of Object.keys(column[parseInt(i.toString(), 10)])) {
5195
+ const columnProps = Object.keys(column[parseInt(i.toString(), 10)]);
5196
+ for (let j = 0; j < columnProps.length; j++) {
5197
+ const prop = columnProps[parseInt(j.toString(), 10)];
5166
5198
  if (index === this.treeColumnIndex && prop === 'template') {
5167
5199
  treeGridColumn[`${prop}`] = column[parseInt(i.toString(), 10)][`${prop}`];
5168
5200
  }
@@ -5332,6 +5364,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5332
5364
  break;
5333
5365
  case 'rowHeight':
5334
5366
  this.grid.rowHeight = this.rowHeight;
5367
+ this.refresh();
5335
5368
  break;
5336
5369
  case 'height':
5337
5370
  if (!isNullOrUndefined(this.height) && typeof (this.height) === 'string' && this.height.indexOf('%') !== -1) {
@@ -5407,6 +5440,9 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5407
5440
  case 'columnMenuItems':
5408
5441
  this.grid.columnMenuItems = getActualProperties(this.columnMenuItems);
5409
5442
  break;
5443
+ case 'enableStickyHeader':
5444
+ this.grid.enableStickyHeader = this.enableStickyHeader;
5445
+ break;
5410
5446
  case 'editSettings':
5411
5447
  if (this.grid.isEdit && this.grid.editSettings.mode === 'Normal' && newProp[`${prop}`].mode &&
5412
5448
  (newProp[`${prop}`].mode === 'Cell' || newProp[`${prop}`].mode === 'Row')) {
@@ -6291,13 +6327,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
6291
6327
  * @returns {Column[]} - Returns an array of visible column objects.
6292
6328
  */
6293
6329
  getVisibleColumns() {
6294
- const cols = [];
6295
- for (const col of this.columnModel) {
6296
- if (col.visible) {
6297
- cols.push(col);
6298
- }
6299
- }
6300
- return cols;
6330
+ return this.columnModel.filter((col) => col.visible);
6301
6331
  }
6302
6332
  /**
6303
6333
  * Displays a loading spinner overlay across the TreeGrid for any data action or long-running process.
@@ -6425,17 +6455,12 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
6425
6455
  getTreeColumn() {
6426
6456
  const columnModel = 'columnModel';
6427
6457
  const treeColumn = this[`${columnModel}`][this.treeColumnIndex];
6428
- let treeIndex;
6429
6458
  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
- }
6459
+ const treeColumnField = getObject('field', treeColumn);
6460
+ const treeIndex = updatedCols.findIndex((col) => getObject('field', col) === treeColumnField);
6461
+ if (!isNullOrUndefined(treeIndex)) {
6462
+ this.setProperties({ treeColumnIndex: treeIndex }, true);
6437
6463
  }
6438
- this.setProperties({ treeColumnIndex: treeIndex }, true);
6439
6464
  }
6440
6465
  /**
6441
6466
  * Refreshes the header section of the TreeGrid to reflect any structural or data changes.
@@ -6883,8 +6908,12 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
6883
6908
  if (this.editSettings.mode === 'Batch') {
6884
6909
  const obj = 'dialogObj';
6885
6910
  const showDialog = 'showDialog';
6886
- if ((this.getBatchChanges()[this.changedRecords].length || this.getBatchChanges()[this.deletedRecords].length ||
6887
- this.getBatchChanges()[this.addedRecords].length) && this.editSettings.showConfirmDialog) {
6911
+ const changes = this.getBatchChanges ? this.getBatchChanges() : {};
6912
+ const changed = Array.isArray(changes.changedRecords) ? changes.changedRecords : [];
6913
+ const deleted = Array.isArray(changes.deletedRecords) ? changes.deletedRecords : [];
6914
+ const added = Array.isArray(changes.addedRecords) ? changes.addedRecords : [];
6915
+ const hasChanges = changed.length > 0 || deleted.length > 0 || added.length > 0;
6916
+ if (hasChanges && this.editSettings.showConfirmDialog) {
6888
6917
  const dialogObj = this.grid.editModule[`${obj}`];
6889
6918
  this.grid.editModule[`${showDialog}`]('CancelEdit', dialogObj);
6890
6919
  return;
@@ -6910,8 +6939,12 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
6910
6939
  if (this.editSettings.mode === 'Batch') {
6911
6940
  const obj = 'dialogObj';
6912
6941
  const showDialog = 'showDialog';
6913
- if ((this.getBatchChanges()[this.changedRecords].length || this.getBatchChanges()[this.deletedRecords].length ||
6914
- this.getBatchChanges()[this.addedRecords].length) && this.editSettings.showConfirmDialog) {
6942
+ const changes = this.getBatchChanges ? this.getBatchChanges() : {};
6943
+ const changed = Array.isArray(changes.changedRecords) ? changes.changedRecords : [];
6944
+ const deleted = Array.isArray(changes.deletedRecords) ? changes.deletedRecords : [];
6945
+ const added = Array.isArray(changes.addedRecords) ? changes.addedRecords : [];
6946
+ const hasChanges = changed.length > 0 || deleted.length > 0 || added.length > 0;
6947
+ if (hasChanges && this.editSettings.showConfirmDialog) {
6915
6948
  const dialogObj = this.grid.editModule[`${obj}`];
6916
6949
  this.grid.editModule[`${showDialog}`]('CancelEdit', dialogObj);
6917
6950
  return;
@@ -7197,6 +7230,8 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
7197
7230
  remoteExpand(action, row, record) {
7198
7231
  let gridRows = this.getRows();
7199
7232
  const fetchRemoteChildData = 'fetchRemoteChildData';
7233
+ const requestType = getValue('isCollapseAll', this) ? 'collapseAll' : 'refresh';
7234
+ this.grid.contentModule.requestType = requestType;
7200
7235
  if (this.rowTemplate) {
7201
7236
  const rows = this.getContentTable().rows;
7202
7237
  gridRows = [].slice.call(rows);
@@ -7263,6 +7298,13 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
7263
7298
  gridRowsObject[parseInt(currentIndex.toString(), 10)].visible !== false) {
7264
7299
  gridRowsObject[parseInt(currentIndex.toString(), 10)].visible = true;
7265
7300
  }
7301
+ if (this.detailTemplate) {
7302
+ gridRows.forEach((row) => {
7303
+ if (row.classList.contains('e-detailrow') && row.style.display === 'none') {
7304
+ row.style.display = '';
7305
+ }
7306
+ });
7307
+ }
7266
7308
  const detailrows = gridRows.filter((r) => r.classList.contains('e-griddetailrowindex' + record.index + 'level' + (record.level + 1)));
7267
7309
  for (let i = 0; i < rows.length; i++) {
7268
7310
  if (!isNullOrUndefined(rows[parseInt(i.toString(), 10)])) {
@@ -7421,7 +7463,6 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
7421
7463
  addListener() {
7422
7464
  this.on('updateResults', this.updateResultModel, this);
7423
7465
  this.grid.on('initial-end', this.afterGridRender, this);
7424
- this.grid.on('last-rowcell-border-updated', this.lastRowCellBorderUpdated, this);
7425
7466
  }
7426
7467
  updateResultModel(returnResult) {
7427
7468
  this.dataResults = returnResult;
@@ -8014,6 +8055,9 @@ __decorate$b([
8014
8055
  __decorate$b([
8015
8056
  Property(false)
8016
8057
  ], TreeGrid.prototype, "enableImmutableMode", void 0);
8058
+ __decorate$b([
8059
+ Property(false)
8060
+ ], TreeGrid.prototype, "enableStickyHeader", void 0);
8017
8061
  __decorate$b([
8018
8062
  Property('auto')
8019
8063
  ], TreeGrid.prototype, "height", void 0);
@@ -10012,20 +10056,13 @@ class RowDD {
10012
10056
  if (deletedRow.hasChildRecords && deletedRow.childRecords.length > 0) {
10013
10057
  this.removeChildItem(deletedRow);
10014
10058
  }
10015
- let idx;
10016
- let idz;
10017
10059
  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
- }
10060
+ const idx = treeGridData.findIndex((data) => {
10061
+ return data[this.parent.idMapping] === deletedRow.taskData[this.parent.idMapping];
10062
+ });
10063
+ const idz = this.treeGridData.findIndex((data) => {
10064
+ return data[this.parent.idMapping] === deletedRow.taskData[this.parent.idMapping];
10065
+ });
10029
10066
  if (idx !== -1 && !isNullOrUndefined(idx)) {
10030
10067
  dataSource.splice(idx, 1);
10031
10068
  }
@@ -10259,19 +10296,13 @@ class TreeVirtualRowModelGenerator extends VirtualRowModelGenerator {
10259
10296
  return super.getData();
10260
10297
  }
10261
10298
  generateRows(data, notifyArgs) {
10262
- if (!isNullOrUndefined(notifyArgs.virtualInfo) && notifyArgs.virtualInfo.loadNext &&
10263
- notifyArgs.virtualInfo.nextInfo.page !== this.parent.pageSettings.currentPage) {
10264
- this.parent.setProperties({ pageSettings: { currentPage: notifyArgs.virtualInfo.nextInfo.page } }, true);
10265
- }
10266
- else if (!isNullOrUndefined(notifyArgs.virtualInfo) && !notifyArgs.virtualInfo.loadNext &&
10267
- notifyArgs.virtualInfo.page !== this.parent.pageSettings.currentPage) {
10268
- this.parent.setProperties({ pageSettings: { currentPage: notifyArgs.virtualInfo.page } }, true);
10269
- }
10270
10299
  const info = this.getDataInfo();
10271
- if (!isNullOrUndefined(notifyArgs.virtualInfo)) {
10300
+ if (notifyArgs.requestType === 'refresh' && notifyArgs.isExpandCollapse) {
10301
+ notifyArgs.virtualInfo = this['prevInfo'];
10302
+ }
10303
+ if (!isNullOrUndefined(notifyArgs.virtualInfo) && !(this.parent.root.loadChildOnDemand && isRemoteData(this.parent.root))) {
10272
10304
  if (notifyArgs.virtualInfo.direction !== 'right' && notifyArgs.virtualInfo.direction !== 'left') {
10273
- if (!((this.parent.dataSource instanceof DataManager && this.parent.dataSource.dataSource.url !== undefined
10274
- && !this.parent.dataSource.dataSource.offline && this.parent.dataSource.dataSource.url !== '') || isCountRequired(this.parent))
10305
+ if ((!isRemoteData(this.parent.root) || isCountRequired(this.parent))
10275
10306
  || notifyArgs.virtualInfo.blockIndexes.length === 1) {
10276
10307
  notifyArgs.virtualInfo.blockIndexes = info.blockIndexes;
10277
10308
  }
@@ -10315,7 +10346,10 @@ class TreeVirtualRowModelGenerator extends VirtualRowModelGenerator {
10315
10346
  else if (action === 'virtualscroll' && this.cache[parseInt(currentPage.toString(), 10)] &&
10316
10347
  this.cache[parseInt(currentPage.toString(), 10)].length >
10317
10348
  (this.parent.contentModule).getBlockSize()) {
10318
- delete this.cache[parseInt(currentPage.toString(), 10)];
10349
+ if (this.cache[parseInt(currentPage.toString(), 10)].length > (this.parent.contentModule).getBlockSize()) {
10350
+ this.cache[parseInt(currentPage.toString(), 10)] =
10351
+ this.cache[parseInt(currentPage.toString(), 10)].slice(0, (this.parent.contentModule).getBlockSize());
10352
+ }
10319
10353
  }
10320
10354
  }
10321
10355
  else {
@@ -10402,11 +10436,11 @@ class Filter {
10402
10436
  this.filteredParentRecs = [];
10403
10437
  this.filteredResult = [];
10404
10438
  this.isHierarchyFilter = false;
10439
+ const hierarchyMode = this.parent.grid.searchSettings.key === '' ? this.parent.filterSettings.hierarchyMode
10440
+ : this.parent.searchSettings.hierarchyMode;
10405
10441
  for (let f = 0; f < this.flatFilteredData.length; f++) {
10406
10442
  const rec = this.flatFilteredData[parseInt(f.toString(), 10)];
10407
10443
  this.addParentRecord(rec);
10408
- const hierarchyMode = this.parent.grid.searchSettings.key === '' ? this.parent.filterSettings.hierarchyMode
10409
- : this.parent.searchSettings.hierarchyMode;
10410
10444
  if (((hierarchyMode === 'Child' || hierarchyMode === 'None') &&
10411
10445
  (this.parent.grid.filterSettings.columns.length !== 0 || this.parent.grid.searchSettings.key !== ''))) {
10412
10446
  this.isHierarchyFilter = true;
@@ -10418,8 +10452,6 @@ class Filter {
10418
10452
  const parent = getObject('parentItem', rec);
10419
10453
  if (!isNullOrUndefined(parent)) {
10420
10454
  const parRecord = getParentData(this.parent, rec.parentItem.uniqueID, true);
10421
- //let parRecord: Object = this.flatFilteredData.filter((e: ITreeData) => {
10422
- // return e.uniqueID === rec.parentItem.uniqueID; })[0];
10423
10455
  setValue('hasFilteredChildRecords', true, parRecord);
10424
10456
  if (parRecord && parRecord.parentItem) {
10425
10457
  this.updateParentFilteredRecord(parRecord);
@@ -10443,7 +10475,6 @@ class Filter {
10443
10475
  }
10444
10476
  addParentRecord(record) {
10445
10477
  const parent = getParentData(this.parent, record.parentUniqueID);
10446
- //let parent: Object = this.parent.flatData.filter((e: ITreeData) => {return e.uniqueID === record.parentUniqueID; })[0];
10447
10478
  const hierarchyMode = this.parent.grid.searchSettings.key === '' ? this.parent.filterSettings.hierarchyMode
10448
10479
  : this.parent.searchSettings.hierarchyMode;
10449
10480
  if (hierarchyMode === 'None' && (this.parent.grid.filterSettings.columns.length !== 0
@@ -11199,8 +11230,8 @@ class Toolbar {
11199
11230
  }
11200
11231
  row = (!isNullOrUndefined(selectedrow) && selectedrow.rowIndex !== row.rowIndex) ? selectedrow : row;
11201
11232
  if (indentEle !== null && outdentEle !== null) {
11202
- indentElement = toolbarElement.querySelector('#' + indentID).parentElement;
11203
- outdentElement = toolbarElement.querySelector('#' + outdentID).parentElement;
11233
+ indentElement = indentEle.parentElement;
11234
+ outdentElement = outdentEle.parentElement;
11204
11235
  if (row.rowIndex === 0 || tObj.getSelectedRowIndexes().length > 1) {
11205
11236
  indentElement.classList.add('e-hidden');
11206
11237
  outdentElement.classList.add('e-hidden');
@@ -11333,14 +11364,7 @@ class Aggregate {
11333
11364
  calculateSummaryValue(summaryQuery, filteredData, isSort) {
11334
11365
  this.summaryQuery = summaryQuery;
11335
11366
  let parentRecord;
11336
- const parentDataLength = Object.keys(filteredData).length;
11337
- const parentData = [];
11338
- for (let p = 0, len = parentDataLength; p < len; p++) {
11339
- const summaryRow = getObject('isSummaryRow', filteredData[parseInt(p.toString(), 10)]);
11340
- if (!summaryRow) {
11341
- parentData.push(filteredData[parseInt(p.toString(), 10)]);
11342
- }
11343
- }
11367
+ const parentData = filteredData.filter((data) => !getObject('isSummaryRow', data));
11344
11368
  const parentRecords = findParentRecords(parentData);
11345
11369
  const flatRecords = parentData.slice();
11346
11370
  const summaryLength = Object.keys(this.parent.aggregates).length;
@@ -11493,14 +11517,7 @@ class Aggregate {
11493
11517
  appendChildren(cellElement, tempObj.fn(single[summaryColumn.columnName], this.parent, tempObj.property));
11494
11518
  }
11495
11519
  const value = single[`${summaryColumn.columnName}`][`${summaryKey}`];
11496
- let summaryValue;
11497
- if (cellElement.innerHTML.indexOf(value) === -1) {
11498
- summaryValue = cellElement.innerHTML + value;
11499
- return summaryValue;
11500
- }
11501
- else {
11502
- return cellElement.innerHTML;
11503
- }
11520
+ return cellElement.innerHTML.indexOf(value) === -1 ? cellElement.innerHTML + value : cellElement.innerHTML;
11504
11521
  }
11505
11522
  getFormatFromType(summaryformat, type) {
11506
11523
  if (isNullOrUndefined(type) || typeof summaryformat !== 'string') {
@@ -11582,8 +11599,13 @@ class Sort {
11582
11599
  this.flatSortedData = [];
11583
11600
  }
11584
11601
  iterateSort(data, srtQry) {
11602
+ const gridQuery = this.parent.query;
11603
+ let filterQuery = [];
11604
+ if (!isNullOrUndefined(gridQuery)) {
11605
+ filterQuery = gridQuery.queries.filter((q) => q.fn === 'onWhere');
11606
+ }
11585
11607
  for (let d = 0; d < data.length; d++) {
11586
- if (this.parent.grid.filterSettings.columns.length > 0 || this.parent.grid.searchSettings.key !== '') {
11608
+ if (filterQuery.length > 0 || this.parent.grid.filterSettings.columns.length > 0 || this.parent.grid.searchSettings.key !== '') {
11587
11609
  if (!isNullOrUndefined(getParentData(this.parent, data[parseInt(d.toString(), 10)].uniqueID, true))) {
11588
11610
  this.storedIndex++;
11589
11611
  this.flatSortedData[this.storedIndex] = data[parseInt(d.toString(), 10)];
@@ -11861,6 +11883,7 @@ class BatchEdit {
11861
11883
  this.parent.on('batchCancelAction', this.batchCancelAction, this);
11862
11884
  this.parent.grid.on('immutable-batch-cancel', this.immutableBatchAction, this);
11863
11885
  this.parent.grid.on('next-cell-index', this.nextCellIndex, this);
11886
+ this.parent.grid.on('cellfocused', this.onCellFocused, this);
11864
11887
  }
11865
11888
  /**
11866
11889
  * @hidden
@@ -11880,6 +11903,7 @@ class BatchEdit {
11880
11903
  this.parent.off('batchCancelAction', this.batchCancelAction);
11881
11904
  this.parent.grid.off('immutable-batch-cancel', this.immutableBatchAction);
11882
11905
  this.parent.grid.off('next-cell-index', this.nextCellIndex);
11906
+ this.parent.grid.off('cellfocused', this.onCellFocused);
11883
11907
  }
11884
11908
  /**
11885
11909
  * To destroy the editModule
@@ -11921,11 +11945,11 @@ class BatchEdit {
11921
11945
  batchPageAction() {
11922
11946
  const data = (this.parent.grid.dataSource instanceof DataManager ?
11923
11947
  this.parent.grid.dataSource.dataSource.json : this.parent.grid.dataSource);
11924
- const primaryKey = this.parent.grid.getPrimaryKeyFieldNames()[0];
11948
+ const primaryKeyField = this.parent.grid.getPrimaryKeyFieldNames()[0];
11925
11949
  let index;
11926
11950
  if (!isNullOrUndefined(this.batchAddedRecords) && this.batchAddedRecords.length) {
11927
11951
  for (let i = 0; i < this.batchAddedRecords.length; i++) {
11928
- index = data.map((e) => { return e[`${primaryKey}`]; }).indexOf(this.batchAddedRecords[parseInt(i.toString(), 10)][`${primaryKey}`]);
11952
+ index = data.findIndex((e) => { return e[`${primaryKeyField}`] === this.batchAddedRecords[parseInt(i.toString(), 10)][`${primaryKeyField}`]; });
11929
11953
  data.splice(index, 1);
11930
11954
  }
11931
11955
  }
@@ -12152,7 +12176,7 @@ class BatchEdit {
12152
12176
  childs.push(data);
12153
12177
  records = childs;
12154
12178
  for (let i = 0; i < records.length; i++) {
12155
- const indexvalue = this.batchRecords.map((e) => { return e[`${primarykey}`]; }).indexOf(records[parseInt(i.toString(), 10)][`${primarykey}`]);
12179
+ const indexvalue = this.batchRecords.findIndex((e) => { return e[`${primarykey}`] === records[parseInt(i.toString(), 10)][`${primarykey}`]; });
12156
12180
  if (indexvalue !== -1) {
12157
12181
  this.batchRecords.splice(indexvalue, 1);
12158
12182
  }
@@ -12171,11 +12195,11 @@ class BatchEdit {
12171
12195
  }
12172
12196
  updateChildCount(records) {
12173
12197
  const primaryKey = this.parent.grid.getPrimaryKeyFieldNames()[0];
12174
- const addedRecords = 'addedRecords';
12198
+ const addedRecords = this.parent.getBatchChanges().addedRecords || [];
12175
12199
  const parentItem = this.parent.editSettings.newRowPosition === 'Child' ? 'primaryParent' : 'parentItem';
12176
- for (let i = 0; i < this.parent.getBatchChanges()[`${addedRecords}`].length; i++) {
12177
- if (!isNullOrUndefined(this.parent.getBatchChanges()[`${addedRecords}`][parseInt(i.toString(), 10)][`${parentItem}`])) {
12178
- if (this.parent.getBatchChanges()[`${addedRecords}`][parseInt(i.toString(), 10)][`${parentItem}`][`${primaryKey}`] === records[parseInt(this.addRowIndex.toString(), 10)][`${primaryKey}`]) {
12200
+ for (let i = 0; i < addedRecords.length; i++) {
12201
+ if (!isNullOrUndefined(addedRecords[parseInt(i.toString(), 10)][`${parentItem}`])) {
12202
+ if (addedRecords[parseInt(i.toString(), 10)][`${parentItem}`][`${primaryKey}`] === records[parseInt(this.addRowIndex.toString(), 10)][`${primaryKey}`]) {
12179
12203
  this.batchChildCount = this.batchChildCount + 1;
12180
12204
  }
12181
12205
  }
@@ -12223,7 +12247,7 @@ class BatchEdit {
12223
12247
  const primaryKey = this.parent.grid.getPrimaryKeyFieldNames()[0];
12224
12248
  if (!isNullOrUndefined(this.batchAddedRecords)) {
12225
12249
  for (let i = 0; i < this.batchAddedRecords.length; i++) {
12226
- index = data.map((e) => { return e[`${primaryKey}`]; }).indexOf(this.batchAddedRecords[parseInt(i.toString(), 10)][`${primaryKey}`]);
12250
+ index = data.findIndex((e) => { return e[`${primaryKey}`] === this.batchAddedRecords[parseInt(i.toString(), 10)][`${primaryKey}`]; });
12227
12251
  if (index !== -1) {
12228
12252
  data.splice(index, 1);
12229
12253
  }
@@ -12235,7 +12259,7 @@ class BatchEdit {
12235
12259
  const children = currentViewRecords[parseInt(index.toString(), 10)][`${childRecords}`];
12236
12260
  for (let j = 0; children && j < children.length; j++) {
12237
12261
  if (children[parseInt(j.toString(), 10)][`${primaryKey}`] === this.batchAddedRecords[parseInt(i.toString(), 10)][`${primaryKey}`]) {
12238
- currentViewRecords[parseInt(index.toString(), 10)][`${childRecords}`].splice(j, 1);
12262
+ children.splice(j, 1);
12239
12263
  }
12240
12264
  }
12241
12265
  }
@@ -12366,9 +12390,11 @@ class BatchEdit {
12366
12390
  const indexValue = currentViewRecords.map((e) => { return e[`${primarykey}`]; })
12367
12391
  .indexOf(addRecords[parseInt(i.toString(), 10)][`${parentItem}`][`${primarykey}`]);
12368
12392
  const children = currentViewRecords[parseInt(indexValue.toString(), 10)][`${childRecords}`];
12369
- for (let j = 0; j < children.length; j++) {
12370
- if (children[parseInt(j.toString(), 10)][`${primarykey}`] === addRecords[parseInt(i.toString(), 10)][`${primarykey}`]) {
12371
- currentViewRecords[parseInt(indexValue.toString(), 10)][`${childRecords}`].splice(j, 1);
12393
+ if (!isNullOrUndefined(addRowIndex) && children.some((records) => records.uniqueID === addRowRecord.uniqueID)) {
12394
+ for (let j = 0; j < children.length; j++) {
12395
+ if (children[parseInt(j.toString(), 10)][`${primarykey}`] === addRecords[parseInt(i.toString(), 10)][`${primarykey}`]) {
12396
+ currentViewRecords[parseInt(indexValue.toString(), 10)][`${childRecords}`].splice(j, 1);
12397
+ }
12372
12398
  }
12373
12399
  }
12374
12400
  }
@@ -12449,6 +12475,15 @@ class BatchEdit {
12449
12475
  args[`${index}`] = this.batchIndex;
12450
12476
  }
12451
12477
  }
12478
+ onCellFocused(e) {
12479
+ if (this.parent.editSettings.mode === 'Cell' && this.parent.grid.isEdit && e.keyArgs) {
12480
+ if (e.keyArgs.action === 'shiftEnter') {
12481
+ e.keyArgs.preventDefault();
12482
+ this.parent.endEdit();
12483
+ return;
12484
+ }
12485
+ }
12486
+ }
12452
12487
  }
12453
12488
 
12454
12489
  /**
@@ -12467,6 +12502,7 @@ class Edit {
12467
12502
  this.prevAriaRowIndex = '-1';
12468
12503
  this.isAddedRowByMethod = false;
12469
12504
  this.isAddedRowByContextMenu = false;
12505
+ this.isIndexUndefined = false;
12470
12506
  Grid.Inject(Edit$1);
12471
12507
  this.parent = parent;
12472
12508
  this.isSelfReference = !isNullOrUndefined(parent.parentIdMapping);
@@ -12718,7 +12754,7 @@ class Edit {
12718
12754
  }
12719
12755
  }
12720
12756
  keyPressed(args) {
12721
- if (this.isOnBatch) {
12757
+ if (this.isOnBatch || args.action === 'tab' || args.action === 'shiftTab') {
12722
12758
  this.keyPress = args.action;
12723
12759
  }
12724
12760
  if (args.action === 'f2') {
@@ -13254,9 +13290,10 @@ class Edit {
13254
13290
  this.addRowRecord = this.parent.flatData[args.index];
13255
13291
  this.addRowIndex = args.index;
13256
13292
  }
13257
- if (this.parent.editSettings.newRowPosition === 'Child' &&
13293
+ if (this.parent.editSettings.newRowPosition === 'Child' && this.isIndexUndefined &&
13258
13294
  !isNullOrUndefined(this.parent.getSelectedRecords()[0])) {
13259
13295
  this.addRowRecord = this.parent.getSelectedRecords()[0];
13296
+ this.isIndexUndefined = false;
13260
13297
  }
13261
13298
  if (isNullOrUndefined(this.addRowRecord) && this.parent.getCurrentViewRecords().length > this.addRowIndex &&
13262
13299
  args.requestType === 'save' && this.parent.getSelectedRecords().length !== 0) {
@@ -13312,7 +13349,7 @@ class Edit {
13312
13349
  const lastAriaIndex = rows.length ? +rows[rows.length - 1].getAttribute('aria-rowindex') - 1 : 0;
13313
13350
  const withinRange = this.parent.enableVirtualization && args.index !== 0 ? true :
13314
13351
  this.selectedIndex >= firstAriaIndex && this.selectedIndex <= lastAriaIndex;
13315
- if (currentData.length) {
13352
+ if (currentData.length && !isNullOrUndefined(index)) {
13316
13353
  idMapping = currentData[this.addRowIndex][this.parent.idMapping];
13317
13354
  parentIdMapping = currentData[this.addRowIndex][this.parent.parentIdMapping];
13318
13355
  if (currentData[this.addRowIndex].parentItem) {
@@ -13320,7 +13357,7 @@ class Edit {
13320
13357
  }
13321
13358
  parentItem = currentData[this.addRowIndex].parentItem;
13322
13359
  }
13323
- if (this.parent.editSettings.newRowPosition !== 'Top' && currentData.length) {
13360
+ if (this.parent.editSettings.newRowPosition !== 'Top' && currentData.length && !isNullOrUndefined(index)) {
13324
13361
  level = currentData[this.addRowIndex].level;
13325
13362
  if (this.parent.editSettings.newRowPosition === 'Above') {
13326
13363
  position = 'before';
@@ -13397,12 +13434,16 @@ class Edit {
13397
13434
  }
13398
13435
  if (args.requestType === 'delete') {
13399
13436
  const deletedValues = args.data;
13400
- for (let i = 0; i < deletedValues.length; i++) {
13401
- if (deletedValues[parseInt(i.toString(), 10)].parentItem) {
13402
- const parentItem = getParentData(this.parent, deletedValues[parseInt(i.toString(), 10)].parentItem.uniqueID);
13403
- if (!isNullOrUndefined(parentItem) && parentItem.hasChildRecords) {
13404
- const childIndex = parentItem.childRecords.indexOf(deletedValues[parseInt(i.toString(), 10)]);
13405
- parentItem.childRecords.splice(childIndex, 1);
13437
+ const primaryKeyField = this.parent.getPrimaryKeyFieldNames();
13438
+ if (!isNullOrUndefined(primaryKeyField) && primaryKeyField.length > 0) {
13439
+ for (let i = 0; i < deletedValues.length; i++) {
13440
+ const deletevalue = deletedValues[parseInt(i.toString(), 10)].parentItem;
13441
+ if (deletevalue) {
13442
+ const parentItem = getParentData(this.parent, deletevalue.uniqueID);
13443
+ if (!isNullOrUndefined(parentItem) && parentItem.hasChildRecords) {
13444
+ const childIndex = parentItem.childRecords.findIndex((child) => deletedValues[parseInt(i.toString(), 10)][primaryKeyField[0]] === child[primaryKeyField[0]]);
13445
+ parentItem.childRecords.splice(childIndex, 1);
13446
+ }
13406
13447
  }
13407
13448
  }
13408
13449
  }
@@ -13418,6 +13459,9 @@ class Edit {
13418
13459
  if (this.parent.editSettings.newRowPosition === this.previousNewRowPosition || this.previousNewRowPosition === null) {
13419
13460
  this.previousNewRowPosition = this.parent.editSettings.newRowPosition;
13420
13461
  }
13462
+ if (isNullOrUndefined(index)) {
13463
+ this.isIndexUndefined = true;
13464
+ }
13421
13465
  if (!this.isSelfReference && !isNullOrUndefined(data) && Object.hasOwnProperty.call(data, this.parent.childMapping)) {
13422
13466
  const addRecords = [];
13423
13467
  const previousEditMode = this.parent.editSettings.mode;
@@ -13590,12 +13634,12 @@ class DetailRow {
13590
13634
  args[`${visible}`] = false;
13591
13635
  }
13592
13636
  dataBoundArg() {
13593
- const detailele = this.parent.getRows().filter((e) => {
13637
+ const detailRows = this.parent.getRows().filter((e) => {
13594
13638
  return !e.classList.contains('e-detailrow');
13595
13639
  });
13596
- for (let i = 0; i < detailele.length; i++) {
13597
- const elements = detailele[parseInt(i.toString(), 10)].getElementsByClassName('e-detailrowcollapse');
13598
- const detailData = this.parent.grid.getRowObjectFromUID(detailele[parseInt(i.toString(), 10)].getAttribute('data-Uid'));
13640
+ for (let i = 0; i < detailRows.length; i++) {
13641
+ const elements = detailRows[parseInt(i.toString(), 10)].getElementsByClassName('e-detailrowcollapse');
13642
+ const detailData = this.parent.grid.getRowObjectFromUID(detailRows[parseInt(i.toString(), 10)].getAttribute('data-Uid'));
13599
13643
  const parentItem = getObject('parentItem', this.parent.grid.getCurrentViewRecords()[parseInt(i.toString(), 10)]);
13600
13644
  if (isNullOrUndefined(parentItem) || !isNullOrUndefined(parentItem) &&
13601
13645
  getExpandStatus(this.parent, detailData.data, this.parent.grid.getCurrentViewRecords())) {
@@ -13631,10 +13675,9 @@ class DetailRow {
13631
13675
  }
13632
13676
  actioncomplete(args) {
13633
13677
  if (args.requestType === 'beginEdit' || args.requestType === 'add') {
13634
- const spann = (args.row.querySelectorAll('.e-editcell')[0].getAttribute('colSpan'));
13635
- const colum = parseInt(spann, 10) - 1;
13636
- const updtdcolum = colum.toString();
13637
- args.row.querySelectorAll('.e-editcell')[0].setAttribute('colSpan', updtdcolum);
13678
+ const colSpan = (args.row.querySelectorAll('.e-editcell')[0].getAttribute('colSpan'));
13679
+ const colum = parseInt(colSpan, 10) - 1;
13680
+ args.row.querySelectorAll('.e-editcell')[0].setAttribute('colSpan', colum.toString());
13638
13681
  }
13639
13682
  const focusElement = this.parent.grid.contentModule.getRows();
13640
13683
  for (let i = 0; i < focusElement.length; i++) {
@@ -13851,6 +13894,7 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
13851
13894
  this.parent[`${action}`]('refresh-virtual-editform-cells', this.refreshCell, this);
13852
13895
  this.parent[`${action}`]('virtaul-cell-focus', this.cellFocus, this);
13853
13896
  this.parent[`${action}`]('virtual-scroll-edit', this.restoreEditState, this);
13897
+ this.parent[`${action}`]('set-virtual-page-query', this.SetVirtualPageQury, this);
13854
13898
  }
13855
13899
  else {
13856
13900
  super.eventListener('on');
@@ -14103,6 +14147,18 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
14103
14147
  const restoreEdit = 'restoreEdit';
14104
14148
  super[`${restoreEdit}`]();
14105
14149
  }
14150
+ SetVirtualPageQury(args) {
14151
+ let visiblePage = [];
14152
+ if (this.prevInfo && this.prevInfo.blockIndexes) {
14153
+ visiblePage = getVisiblePage(this.prevInfo.blockIndexes);
14154
+ }
14155
+ if ((this.requestType === 'refresh') && visiblePage.length) {
14156
+ args.query.skip(this.parent.pageSettings.pageSize * (visiblePage[0] - 1));
14157
+ args.query.take(this.parent.pageSettings.pageSize * visiblePage.length);
14158
+ args.skipPage = true;
14159
+ return;
14160
+ }
14161
+ }
14106
14162
  /**
14107
14163
  * Resets the edit state if certain conditions are met.
14108
14164
  *
@@ -14242,6 +14298,19 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
14242
14298
  const xAxis = current.axis === 'X';
14243
14299
  let x = this.getColumnOffset(xAxis ? this.vgenerator.getColumnIndexes()[0] - 1 : this.prevInfo.columnIndexes[0]
14244
14300
  - 1);
14301
+ if (this.parent.isFrozenGrid() && this.parent.enableColumnVirtualization && this.currentInfo &&
14302
+ this.currentInfo.columnIndexes) {
14303
+ const cBlock = this.currentInfo.columnIndexes[0] - 1;
14304
+ let frzLeftWidth = 0;
14305
+ this.parent.getColumns().filter((col) => {
14306
+ if (col.visible && col.freeze === 'Left') {
14307
+ frzLeftWidth += parseInt(col.width.toString(), 10);
14308
+ }
14309
+ });
14310
+ if (cBlock > this.parent.getVisibleFrozenLeftCount()) {
14311
+ x = x - frzLeftWidth;
14312
+ }
14313
+ }
14245
14314
  if (xAxis) {
14246
14315
  const idx = Object.keys(this.vgenerator.cOffsets).length - this.prevInfo.columnIndexes.length;
14247
14316
  const maxLeft = this.vgenerator.cOffsets[idx - 1];
@@ -14259,6 +14328,9 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
14259
14328
  }
14260
14329
  if (this.parent.enableColumnVirtualization) {
14261
14330
  this.header.virtualEle.adjustTable(x, 0);
14331
+ if (this.parent.isFrozenGrid()) {
14332
+ this.parent.contentModule['resetStickyLeftPos'](x);
14333
+ }
14262
14334
  }
14263
14335
  }
14264
14336
  }
@@ -14403,14 +14475,15 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
14403
14475
  if (((downScroll && scrollArgs.direction !== 'up' && (scrollArgs.offset.top < (rowHeight * this.totalRecords)))
14404
14476
  || (upScroll)) || (scrollArgs.direction === 'right' || scrollArgs.direction === 'left') ||
14405
14477
  ((this.parent.dataSource instanceof DataManager && this.parent.dataSource.dataSource.url !== undefined
14406
- && !this.parent.dataSource.dataSource.offline && this.parent.dataSource.dataSource.url !== '') && (downScroll || upScroll) || isCountRequired(this.parent))) {
14478
+ && !this.parent.dataSource.dataSource.offline && this.parent.dataSource.dataSource.url !== ''))) {
14407
14479
  const viewInfo = this.currentInfo = getValue('getInfoFromView', this).apply(this, [scrollArgs.direction, info, scrollArgs.offset]);
14408
14480
  this.previousInfo = viewInfo;
14409
- if (this.prevInfo && viewInfo.event !== 'refresh-virtual-block' && ((info.axis === 'Y' && this.prevInfo.blockIndexes.toString() === viewInfo.blockIndexes.toString())
14481
+ if (this.prevInfo && ((info.axis === 'Y' && this.prevInfo.blockIndexes.toString() === viewInfo.blockIndexes.toString())
14410
14482
  || ((info.axis === 'X' && this.prevInfo.columnIndexes.toString() === viewInfo.columnIndexes.toString())
14411
14483
  || (this.parent.isFrozenGrid() && this.parent.getVisibleFrozenLeftCount() >= viewInfo.columnIndexes[0]
14412
14484
  && this.prevInfo.columnIndexes.toString().includes(viewInfo.columnIndexes.toString()))))) {
14413
14485
  this.parent.removeMaskRow();
14486
+ this.parent.notify('removeGanttShimmer', { requestType: 'hideShimmer' });
14414
14487
  if (Browser.isIE) {
14415
14488
  this.parent.hideSpinner();
14416
14489
  }
@@ -14427,7 +14500,7 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
14427
14500
  viewInfo.loadNext = false;
14428
14501
  }
14429
14502
  this.requestType = 'virtualscroll';
14430
- if (scrollArgs.direction !== 'right' && scrollArgs.direction !== 'left') {
14503
+ if (scrollArgs.direction !== 'right' && scrollArgs.direction !== 'left' && !isRemoteData(this.parent.root)) {
14431
14504
  viewInfo.event = viewInfo.event === 'refresh-virtual-block' ? 'model-changed' : viewInfo.event;
14432
14505
  }
14433
14506
  if (this.parent.enableVirtualMaskRow) {
@@ -14484,7 +14557,7 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
14484
14557
  getValue('currentInfo', this).page && getValue('currentInfo', this).page !== e.virtualInfo.page ?
14485
14558
  getValue('currentInfo', this) : e.virtualInfo;
14486
14559
  const cBlock = (info.columnIndexes[0]) - 1;
14487
- const cOffset = this.getColumnOffset(cBlock);
14560
+ let cOffset = this.getColumnOffset(cBlock);
14488
14561
  let width;
14489
14562
  if (this.parent.enableColumnVirtualization) {
14490
14563
  this.header.virtualEle.adjustTable(cOffset, 0);
@@ -14500,9 +14573,33 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
14500
14573
  if (e.requestType === 'virtualscroll' && e.virtualInfo.sentinelInfo.axis === 'Y') {
14501
14574
  this.isExpandCollapse = false;
14502
14575
  }
14576
+ let reduceWidth = 0;
14577
+ if (this.parent.enableColumnVirtualization && this.parent.isFrozenGrid()) {
14578
+ let frzLeftWidth = 0;
14579
+ this.parent.getColumns().filter((col) => {
14580
+ if (col.visible) {
14581
+ reduceWidth += parseInt(col.width.toString(), 10);
14582
+ if (col.freeze === 'Left') {
14583
+ frzLeftWidth += parseInt(col.width.toString(), 10);
14584
+ }
14585
+ }
14586
+ });
14587
+ const cIndex = info.columnIndexes;
14588
+ width = this.getColumnOffset(cIndex[cIndex.length - 1]) - this.getColumnOffset(cIndex[0] - 1) + '';
14589
+ if (cBlock > this.parent.getVisibleFrozenLeftCount()) {
14590
+ cOffset = cOffset - frzLeftWidth;
14591
+ }
14592
+ this.resetStickyLeftPos(cOffset, newChild);
14593
+ }
14503
14594
  if (!this.isExpandCollapse || this.translateY === 0) {
14504
14595
  this.translateY = this.translateY < 0 ? 0 : this.translateY;
14505
14596
  getValue('virtualEle', this).adjustTable(cOffset, this.translateY);
14597
+ if (this.parent.enableColumnVirtualization) {
14598
+ this.header.virtualEle.adjustTable(cOffset, 0);
14599
+ if (this.parent.isFrozenGrid()) {
14600
+ this.resetStickyLeftPos(cOffset);
14601
+ }
14602
+ }
14506
14603
  }
14507
14604
  else {
14508
14605
  this.isExpandCollapse = false;
@@ -14616,7 +14713,12 @@ class TreeInterSectionObserver extends InterSectionObserver {
14616
14713
  this[`${options}`].prevTop = this[`${options}`].prevLeft = 0;
14617
14714
  const isScrollByFocus = 'isScrollByFocus';
14618
14715
  return (e) => {
14619
- if (instance.isEdit && instance.root.editModule[`${isScrollByFocus}`]) {
14716
+ const keyPress = 'keyPress';
14717
+ let keyaction;
14718
+ if (instance && instance.root && instance.root.editModule && instance.root.editModule[`${keyPress}`]) {
14719
+ keyaction = instance.root.editModule[`${keyPress}`];
14720
+ }
14721
+ if ((instance.isEdit && instance.root.editModule[`${isScrollByFocus}`]) || (instance.isEdit && (keyaction === 'tab' || keyaction === 'shiftTab'))) {
14620
14722
  instance.root.editModule[`${isScrollByFocus}`] = false;
14621
14723
  return;
14622
14724
  }