@syncfusion/ej2-treegrid 27.1.57 → 27.2.3

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 (74) hide show
  1. package/dist/ej2-treegrid.min.js +2 -2
  2. package/dist/ej2-treegrid.umd.min.js +2 -2
  3. package/dist/ej2-treegrid.umd.min.js.map +1 -1
  4. package/dist/es6/ej2-treegrid.es2015.js +46 -20
  5. package/dist/es6/ej2-treegrid.es2015.js.map +1 -1
  6. package/dist/es6/ej2-treegrid.es5.js +46 -20
  7. package/dist/es6/ej2-treegrid.es5.js.map +1 -1
  8. package/dist/global/ej2-treegrid.min.js +2 -2
  9. package/dist/global/ej2-treegrid.min.js.map +1 -1
  10. package/dist/global/index.d.ts +1 -1
  11. package/package.json +9 -9
  12. package/src/treegrid/actions/edit.d.ts +8 -0
  13. package/src/treegrid/actions/edit.js +17 -1
  14. package/src/treegrid/base/treegrid.js +4 -6
  15. package/src/treegrid/renderer/render.js +1 -1
  16. package/src/treegrid/renderer/virtual-tree-content-render.js +24 -12
  17. package/styles/bootstrap-dark-lite.css +1 -1
  18. package/styles/bootstrap-dark.css +1 -1
  19. package/styles/bootstrap-lite.css +1 -1
  20. package/styles/bootstrap.css +1 -1
  21. package/styles/bootstrap4-lite.css +1 -1
  22. package/styles/bootstrap4.css +1 -1
  23. package/styles/bootstrap5-dark-lite.css +1 -1
  24. package/styles/bootstrap5-dark.css +1 -1
  25. package/styles/bootstrap5-lite.css +1 -1
  26. package/styles/bootstrap5.3-lite.css +1 -1
  27. package/styles/bootstrap5.3.css +1 -1
  28. package/styles/bootstrap5.css +1 -1
  29. package/styles/fabric-dark-lite.css +1 -1
  30. package/styles/fabric-dark.css +1 -1
  31. package/styles/fabric-lite.css +1 -1
  32. package/styles/fabric.css +1 -1
  33. package/styles/fluent-dark-lite.css +1 -1
  34. package/styles/fluent-dark.css +1 -1
  35. package/styles/fluent-lite.css +1 -1
  36. package/styles/fluent.css +1 -1
  37. package/styles/fluent2-lite.css +2 -3
  38. package/styles/fluent2.css +2 -3
  39. package/styles/highcontrast-light-lite.css +1 -1
  40. package/styles/highcontrast-light.css +1 -1
  41. package/styles/highcontrast-lite.css +1 -1
  42. package/styles/highcontrast.css +1 -1
  43. package/styles/material-dark-lite.css +1 -1
  44. package/styles/material-dark.css +1 -1
  45. package/styles/material-lite.css +1 -1
  46. package/styles/material.css +1 -1
  47. package/styles/material3-dark-lite.css +1 -1
  48. package/styles/material3-dark.css +1 -1
  49. package/styles/material3-lite.css +1 -1
  50. package/styles/material3.css +1 -1
  51. package/styles/tailwind-dark-lite.css +1 -1
  52. package/styles/tailwind-dark.css +1 -1
  53. package/styles/tailwind-lite.css +1 -1
  54. package/styles/tailwind.css +1 -1
  55. package/styles/treegrid/_layout.scss +1 -1
  56. package/styles/treegrid/bootstrap-dark.css +1 -1
  57. package/styles/treegrid/bootstrap.css +1 -1
  58. package/styles/treegrid/bootstrap4.css +1 -1
  59. package/styles/treegrid/bootstrap5-dark.css +1 -1
  60. package/styles/treegrid/bootstrap5.3.css +1 -1
  61. package/styles/treegrid/bootstrap5.css +1 -1
  62. package/styles/treegrid/fabric-dark.css +1 -1
  63. package/styles/treegrid/fabric.css +1 -1
  64. package/styles/treegrid/fluent-dark.css +1 -1
  65. package/styles/treegrid/fluent.css +1 -1
  66. package/styles/treegrid/fluent2.css +2 -3
  67. package/styles/treegrid/highcontrast-light.css +1 -1
  68. package/styles/treegrid/highcontrast.css +1 -1
  69. package/styles/treegrid/material-dark.css +1 -1
  70. package/styles/treegrid/material.css +1 -1
  71. package/styles/treegrid/material3-dark.css +1 -1
  72. package/styles/treegrid/material3.css +1 -1
  73. package/styles/treegrid/tailwind-dark.css +1 -1
  74. package/styles/treegrid/tailwind.css +1 -1
@@ -1854,7 +1854,7 @@ class Render {
1854
1854
  const cellRenderer = new CellRenderer(this.parent.grid, this.parent.grid.serviceLocator);
1855
1855
  const td = rows.length >= rowsObj.length
1856
1856
  ? this.parent.getCellFromIndex(rowsObj[parseInt(j.toString(), 10)].index, cellIndex - indent)
1857
- : this.parent.getRows()[rowsObj[parseInt(j.toString(), 10)].index].querySelector('.e-templatecell');
1857
+ : rows[rowsObj[parseInt(j.toString(), 10)].index].querySelector('.e-templatecell');
1858
1858
  cellRenderer.refreshTD(td, cell, rowsObj[parseInt(j.toString(), 10)].data, { index: rowsObj[parseInt(j.toString(), 10)][`${rowIdx}`] });
1859
1859
  const treecell = this.parent.getRows()[parseInt(j.toString(), 10)]
1860
1860
  .cells[parseInt(cellIndex.toString(), 10)];
@@ -4428,10 +4428,6 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4428
4428
  if (this.pageSettings.pageSizeMode === 'Root') {
4429
4429
  this.grid.selectionModule['totalRecordsCount'] = this.grid.currentViewData.length;
4430
4430
  }
4431
- if (!isNullOrUndefined(this.selectionSettings) && !this.selectionSettings.persistSelection &&
4432
- this.enableVirtualization && args.rowIndex === this.selectedRowIndex && this.isGantt) {
4433
- args.cancel = false;
4434
- }
4435
4431
  this.trigger(rowSelecting, args);
4436
4432
  };
4437
4433
  this.grid.rowDeselecting = (args) => {
@@ -5596,7 +5592,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5596
5592
  */
5597
5593
  closeEdit() {
5598
5594
  if (this.grid.editModule) {
5599
- this.grid.editModule.closeEdit();
5595
+ this.editModule['closeEdit']();
5600
5596
  }
5601
5597
  }
5602
5598
  /**
@@ -7272,7 +7268,9 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
7272
7268
  * @returns {void}
7273
7269
  */
7274
7270
  clearSelection() {
7275
- this.grid.selectionModule['actualTarget'] = null;
7271
+ if (!isNullOrUndefined(this.grid.selectionModule)) {
7272
+ this.grid.selectionModule['actualTarget'] = null;
7273
+ }
7276
7274
  this.grid.clearSelection();
7277
7275
  }
7278
7276
  /**
@@ -11971,7 +11969,7 @@ class Edit {
11971
11969
  this.recordDoubleClick(args);
11972
11970
  }
11973
11971
  if (args.action === 'escape') {
11974
- this.parent.closeEdit();
11972
+ this.closeEdit();
11975
11973
  }
11976
11974
  }
11977
11975
  deleteUniqueID(value) {
@@ -12038,6 +12036,9 @@ class Edit {
12038
12036
  batchCancel() {
12039
12037
  if (this.parent.editSettings.mode === 'Cell') {
12040
12038
  const cellDetails = getValue('editModule.cellDetails', this.parent.grid.editModule);
12039
+ if (!isNullOrUndefined(this.editedRowIndex)) {
12040
+ cellDetails.rowIndex = this.editedRowIndex;
12041
+ }
12041
12042
  const treeCell = this.parent.getCellFromIndex(cellDetails.rowIndex, this.parent.treeColumnIndex);
12042
12043
  this.parent.renderModule.cellRender({
12043
12044
  data: cellDetails.rowData,
@@ -12358,6 +12359,7 @@ class Edit {
12358
12359
  this.prevAriaRowIndex = '-1';
12359
12360
  }
12360
12361
  if (!this.parent.enableVirtualization || this.parent.enableVirtualization && !Object.keys(this.parent.grid.contentModule['emptyRowData']).length) {
12362
+ this.isScrollByFocus = true;
12361
12363
  focussedElement.focus();
12362
12364
  }
12363
12365
  if (this.parent.enableVirtualization && !Object.keys(this.parent.grid.contentModule['emptyRowData']).length) {
@@ -12737,6 +12739,18 @@ class Edit {
12737
12739
  this.parent.grid.editModule.editCell(rowIndex, field);
12738
12740
  }
12739
12741
  }
12742
+ /**
12743
+ * Cancels edited state.
12744
+ *
12745
+ * @returns {void}
12746
+ */
12747
+ closeEdit() {
12748
+ if (this.parent.enableVirtualization && this.parent.grid.editSettings.mode === 'Batch' && this.parent.grid.pageSettings.currentPage > 1) {
12749
+ this.editedRowIndex = this.parent.grid.editModule.editModule['cellDetails'].rowIndex;
12750
+ this.parent.grid.editModule.editModule['cellDetails'].rowIndex = parseInt(this.parent.getRows()[this.parent.grid.editModule.editModule['cellDetails'].rowIndex].getAttribute('data-rowIndex'), 10);
12751
+ }
12752
+ this.parent.grid.editModule.closeEdit();
12753
+ }
12740
12754
  }
12741
12755
 
12742
12756
  /**
@@ -12908,9 +12922,12 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
12908
12922
  if (this.parent.enableVirtualization && this.parent.isFrozenGrid()) {
12909
12923
  return this.getRowCollection(index, true);
12910
12924
  }
12911
- else {
12912
- return this.parent.getDataRows().filter((e) => parseInt(e.getAttribute('data-rowindex'), 10) === index)[0];
12925
+ const dataRows = this.parent.getDataRows();
12926
+ const targetRow = dataRows.find((e) => parseInt(e.getAttribute('data-rowindex'), 10) === index);
12927
+ if (!targetRow && this.parent.isEdit && this.parent.editSettings.mode === 'Batch') {
12928
+ return index != null ? this.parent.getRows()[parseInt(index.toString(), 10)] : undefined;
12913
12929
  }
12930
+ return targetRow;
12914
12931
  }
12915
12932
  getFrozenRightVirtualRowByIndex(index) {
12916
12933
  return this.getRowCollection(index, false, false, true);
@@ -13281,8 +13298,7 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
13281
13298
  - this.parent.pageSettings.pageSize;
13282
13299
  index = (index > 0) ? index : 0;
13283
13300
  if (!isNullOrUndefined(this[`${selectedRowIndex}`]) && this[`${selectedRowIndex}`] !== -1 && index !== this[`${selectedRowIndex}`] &&
13284
- ((this.parent.rowHeight * this.parent.pageSettings.pageSize) < content.scrollTop) &&
13285
- !(this.parent.root && this.parent.root.treeGrid && this.parent.root.treeGrid.isGantt)) {
13301
+ ((this.parent.rowHeight * this.parent.pageSettings.pageSize) < content.scrollTop)) {
13286
13302
  index = this[`${selectedRowIndex}`];
13287
13303
  }
13288
13304
  this.startIndex = index;
@@ -13309,9 +13325,15 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
13309
13325
  firsttdinx = +attr; // this.parent.getContent().querySelector('.e-content tr').getAttribute('data-rowindex');
13310
13326
  }
13311
13327
  if (firsttdinx === 0) {
13312
- this.translateY = !isNullOrUndefined(this.endIndex) ?
13313
- (this.endIndex - this.parent.pageSettings.pageSize) * (this.parent.rowHeight ?
13314
- this.parent.rowHeight : this.parent.getRowHeight()) : 0;
13328
+ if (this.endIndex - this.startIndex < this.parent.pageSettings.pageSize) {
13329
+ this.translateY = !isNullOrUndefined(this.endIndex) ?
13330
+ (this.endIndex - this.parent.pageSettings.pageSize) * (this.parent.rowHeight ?
13331
+ this.parent.rowHeight : this.parent.getRowHeight()) : 0;
13332
+ }
13333
+ else {
13334
+ this.translateY = (scrollArgs.offset.top - (outBuffer * rowHeight) > 0) ?
13335
+ scrollArgs.offset.top - (outBuffer * rowHeight) + rowHeight : 0;
13336
+ }
13315
13337
  }
13316
13338
  else if (this.parent.getFrozenColumns() > 0) {
13317
13339
  scrollArgs.offset.top = scrollArgs.offset.top + 80;
@@ -13327,7 +13349,7 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
13327
13349
  let nextSetResIndex = ~~(content.scrollTop / rowHeight);
13328
13350
  const isLastBlock = (this[`${selectedRowIndex}`] + this.parent.pageSettings.pageSize) < this.totalRecords ? false : true;
13329
13351
  if (!isNullOrUndefined(this[`${selectedRowIndex}`]) && this[`${selectedRowIndex}`] !== -1 &&
13330
- nextSetResIndex !== this[`${selectedRowIndex}`] && !isLastBlock && !(this.parent.root && this.parent.root.treeGrid && this.parent.root.treeGrid.isGantt)) {
13352
+ nextSetResIndex !== this[`${selectedRowIndex}`] && !isLastBlock) {
13331
13353
  nextSetResIndex = this[`${selectedRowIndex}`];
13332
13354
  }
13333
13355
  let lastIndex = nextSetResIndex + this.parent.pageSettings.pageSize;
@@ -13345,6 +13367,8 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
13345
13367
  ((this.startIndex - currentViewData[0][`${indexValue}`]) < (this.parent.pageSettings.pageSize / 2)) && this.parent.selectionModule.isRowSelected) {
13346
13368
  this.startIndex = currentViewData[0][`${indexValue}`] + (this.parent.pageSettings.pageSize / 2);
13347
13369
  }
13370
+ const selectedIndex = this.parent.root.selectedRowIndex;
13371
+ this.startIndex = selectedIndex !== -1 && selectedIndex !== this.startIndex ? this.startIndex - 1 : this.startIndex;
13348
13372
  if (scrollArgs.offset.top > (rowHeight * this.totalRecords)) {
13349
13373
  this.translateY = this.getTranslateY(scrollArgs.offset.top, content.getBoundingClientRect().height);
13350
13374
  }
@@ -13353,10 +13377,7 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
13353
13377
  this.translateY = (this.totalRecords * rowHeight) - ((this.endIndex - this.startIndex) * rowHeight);
13354
13378
  }
13355
13379
  else {
13356
- if (this.parent.allowRowDragAndDrop) {
13357
- this.translateY = scrollArgs.offset.top - rowHeight * 2;
13358
- }
13359
- else if (this.parent.getFrozenColumns() > 0) {
13380
+ if (this.parent.getFrozenColumns() > 0) {
13360
13381
  this.translateY = scrollArgs.offset.top - ((rowHeight * 2) + this.parent.pageSettings.pageSize);
13361
13382
  }
13362
13383
  else {
@@ -13509,7 +13530,12 @@ class TreeInterSectionObserver extends InterSectionObserver {
13509
13530
  const debounced100 = debounce(callback, delay);
13510
13531
  const debounced50 = debounce(callback, 50);
13511
13532
  this[`${options}`].prevTop = this[`${options}`].prevLeft = 0;
13533
+ const isScrollByFocus = 'isScrollByFocus';
13512
13534
  return (e) => {
13535
+ if (instance.isEdit && instance.root.editModule[`${isScrollByFocus}`]) {
13536
+ instance.root.editModule[`${isScrollByFocus}`] = false;
13537
+ return;
13538
+ }
13513
13539
  const top = this[`${options}`].movableContainer ? this[`${options}`].container.scrollTop : e.target.scrollTop;
13514
13540
  const left = this[`${options}`].movableContainer ? this[`${options}`].scrollbar.scrollLeft : e.target.scrollLeft;
13515
13541
  let direction = this[`${options}`].prevTop < top ? 'down' : 'up';