@syncfusion/ej2-treegrid 27.1.56 → 27.2.2

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 +38 -19
  5. package/dist/es6/ej2-treegrid.es2015.js.map +1 -1
  6. package/dist/es6/ej2-treegrid.es5.js +38 -19
  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 -9
  15. package/src/treegrid/renderer/render.js +1 -1
  16. package/src/treegrid/renderer/virtual-tree-content-render.js +16 -8
  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,13 +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 (this.enableVirtualization && args.rowIndex === this.selectedRowIndex && !this.enablePersistence) {
4432
- args.cancel = true;
4433
- }
4434
- if (!isNullOrUndefined(this.selectionSettings) && !this.selectionSettings.persistSelection &&
4435
- this.enableVirtualization && args.rowIndex === this.selectedRowIndex && this.isGantt) {
4436
- args.cancel = false;
4437
- }
4438
4431
  this.trigger(rowSelecting, args);
4439
4432
  };
4440
4433
  this.grid.rowDeselecting = (args) => {
@@ -5599,7 +5592,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5599
5592
  */
5600
5593
  closeEdit() {
5601
5594
  if (this.grid.editModule) {
5602
- this.grid.editModule.closeEdit();
5595
+ this.editModule['closeEdit']();
5603
5596
  }
5604
5597
  }
5605
5598
  /**
@@ -7275,7 +7268,9 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
7275
7268
  * @returns {void}
7276
7269
  */
7277
7270
  clearSelection() {
7278
- this.grid.selectionModule['actualTarget'] = null;
7271
+ if (!isNullOrUndefined(this.grid.selectionModule)) {
7272
+ this.grid.selectionModule['actualTarget'] = null;
7273
+ }
7279
7274
  this.grid.clearSelection();
7280
7275
  }
7281
7276
  /**
@@ -11974,7 +11969,7 @@ class Edit {
11974
11969
  this.recordDoubleClick(args);
11975
11970
  }
11976
11971
  if (args.action === 'escape') {
11977
- this.parent.closeEdit();
11972
+ this.closeEdit();
11978
11973
  }
11979
11974
  }
11980
11975
  deleteUniqueID(value) {
@@ -12041,6 +12036,9 @@ class Edit {
12041
12036
  batchCancel() {
12042
12037
  if (this.parent.editSettings.mode === 'Cell') {
12043
12038
  const cellDetails = getValue('editModule.cellDetails', this.parent.grid.editModule);
12039
+ if (!isNullOrUndefined(this.editedRowIndex)) {
12040
+ cellDetails.rowIndex = this.editedRowIndex;
12041
+ }
12044
12042
  const treeCell = this.parent.getCellFromIndex(cellDetails.rowIndex, this.parent.treeColumnIndex);
12045
12043
  this.parent.renderModule.cellRender({
12046
12044
  data: cellDetails.rowData,
@@ -12361,6 +12359,7 @@ class Edit {
12361
12359
  this.prevAriaRowIndex = '-1';
12362
12360
  }
12363
12361
  if (!this.parent.enableVirtualization || this.parent.enableVirtualization && !Object.keys(this.parent.grid.contentModule['emptyRowData']).length) {
12362
+ this.isScrollByFocus = true;
12364
12363
  focussedElement.focus();
12365
12364
  }
12366
12365
  if (this.parent.enableVirtualization && !Object.keys(this.parent.grid.contentModule['emptyRowData']).length) {
@@ -12740,6 +12739,18 @@ class Edit {
12740
12739
  this.parent.grid.editModule.editCell(rowIndex, field);
12741
12740
  }
12742
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
+ }
12743
12754
  }
12744
12755
 
12745
12756
  /**
@@ -12911,9 +12922,12 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
12911
12922
  if (this.parent.enableVirtualization && this.parent.isFrozenGrid()) {
12912
12923
  return this.getRowCollection(index, true);
12913
12924
  }
12914
- else {
12915
- 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;
12916
12929
  }
12930
+ return targetRow;
12917
12931
  }
12918
12932
  getFrozenRightVirtualRowByIndex(index) {
12919
12933
  return this.getRowCollection(index, false, false, true);
@@ -13271,7 +13285,7 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
13271
13285
  content = this.parent.getContent().querySelector('.e-content');
13272
13286
  }
13273
13287
  const scrollHeight = outBuffer * rowHeight;
13274
- const upScroll = (scrollArgs.offset.top - this.translateY) <= 0;
13288
+ const upScroll = (scrollArgs.offset.top - this.translateY) < 0;
13275
13289
  const downScroll = Math.ceil(scrollArgs.offset.top - this.translateY) + rowHeight >= scrollHeight;
13276
13290
  const selectedRowIndex = 'selectedRowIndex';
13277
13291
  const currentViewData = this.parent.currentViewData;
@@ -13284,8 +13298,7 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
13284
13298
  - this.parent.pageSettings.pageSize;
13285
13299
  index = (index > 0) ? index : 0;
13286
13300
  if (!isNullOrUndefined(this[`${selectedRowIndex}`]) && this[`${selectedRowIndex}`] !== -1 && index !== this[`${selectedRowIndex}`] &&
13287
- ((this.parent.rowHeight * this.parent.pageSettings.pageSize) < content.scrollTop) &&
13288
- !(this.parent.root && this.parent.root.treeGrid && this.parent.root.treeGrid.isGantt)) {
13301
+ ((this.parent.rowHeight * this.parent.pageSettings.pageSize) < content.scrollTop)) {
13289
13302
  index = this[`${selectedRowIndex}`];
13290
13303
  }
13291
13304
  this.startIndex = index;
@@ -13312,8 +13325,9 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
13312
13325
  firsttdinx = +attr; // this.parent.getContent().querySelector('.e-content tr').getAttribute('data-rowindex');
13313
13326
  }
13314
13327
  if (firsttdinx === 0) {
13315
- this.translateY = (scrollArgs.offset.top - (outBuffer * rowHeight) > 0) ?
13316
- scrollArgs.offset.top - (outBuffer * this.parent.getRowHeight()) + rowHeight : 0;
13328
+ this.translateY = !isNullOrUndefined(this.endIndex) ?
13329
+ (this.endIndex - this.parent.pageSettings.pageSize) * (this.parent.rowHeight ?
13330
+ this.parent.rowHeight : this.parent.getRowHeight()) : 0;
13317
13331
  }
13318
13332
  else if (this.parent.getFrozenColumns() > 0) {
13319
13333
  scrollArgs.offset.top = scrollArgs.offset.top + 80;
@@ -13329,7 +13343,7 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
13329
13343
  let nextSetResIndex = ~~(content.scrollTop / rowHeight);
13330
13344
  const isLastBlock = (this[`${selectedRowIndex}`] + this.parent.pageSettings.pageSize) < this.totalRecords ? false : true;
13331
13345
  if (!isNullOrUndefined(this[`${selectedRowIndex}`]) && this[`${selectedRowIndex}`] !== -1 &&
13332
- nextSetResIndex !== this[`${selectedRowIndex}`] && !isLastBlock && !(this.parent.root && this.parent.root.treeGrid && this.parent.root.treeGrid.isGantt)) {
13346
+ nextSetResIndex !== this[`${selectedRowIndex}`] && !isLastBlock) {
13333
13347
  nextSetResIndex = this[`${selectedRowIndex}`];
13334
13348
  }
13335
13349
  let lastIndex = nextSetResIndex + this.parent.pageSettings.pageSize;
@@ -13511,7 +13525,12 @@ class TreeInterSectionObserver extends InterSectionObserver {
13511
13525
  const debounced100 = debounce(callback, delay);
13512
13526
  const debounced50 = debounce(callback, 50);
13513
13527
  this[`${options}`].prevTop = this[`${options}`].prevLeft = 0;
13528
+ const isScrollByFocus = 'isScrollByFocus';
13514
13529
  return (e) => {
13530
+ if (instance.isEdit && instance.root.editModule[`${isScrollByFocus}`]) {
13531
+ instance.root.editModule[`${isScrollByFocus}`] = false;
13532
+ return;
13533
+ }
13515
13534
  const top = this[`${options}`].movableContainer ? this[`${options}`].container.scrollTop : e.target.scrollTop;
13516
13535
  const left = this[`${options}`].movableContainer ? this[`${options}`].scrollbar.scrollLeft : e.target.scrollLeft;
13517
13536
  let direction = this[`${options}`].prevTop < top ? 'down' : 'up';