@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
@@ -2013,7 +2013,7 @@ var Render = /** @__PURE__ @class */ (function () {
2013
2013
  var cellRenderer = new CellRenderer(_this.parent.grid, _this.parent.grid.serviceLocator);
2014
2014
  var td = rows.length >= rowsObj.length
2015
2015
  ? _this.parent.getCellFromIndex(rowsObj[parseInt(j.toString(), 10)].index, cellIndex - indent)
2016
- : _this.parent.getRows()[rowsObj[parseInt(j.toString(), 10)].index].querySelector('.e-templatecell');
2016
+ : rows[rowsObj[parseInt(j.toString(), 10)].index].querySelector('.e-templatecell');
2017
2017
  cellRenderer.refreshTD(td, cell, rowsObj[parseInt(j.toString(), 10)].data, { index: rowsObj[parseInt(j.toString(), 10)]["" + rowIdx] });
2018
2018
  var treecell = _this.parent.getRows()[parseInt(j.toString(), 10)]
2019
2019
  .cells[parseInt(cellIndex.toString(), 10)];
@@ -4723,10 +4723,6 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4723
4723
  if (_this.pageSettings.pageSizeMode === 'Root') {
4724
4724
  _this.grid.selectionModule['totalRecordsCount'] = _this.grid.currentViewData.length;
4725
4725
  }
4726
- if (!isNullOrUndefined(_this.selectionSettings) && !_this.selectionSettings.persistSelection &&
4727
- _this.enableVirtualization && args.rowIndex === _this.selectedRowIndex && _this.isGantt) {
4728
- args.cancel = false;
4729
- }
4730
4726
  _this.trigger(rowSelecting, args);
4731
4727
  };
4732
4728
  this.grid.rowDeselecting = function (args) {
@@ -5903,7 +5899,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
5903
5899
  */
5904
5900
  TreeGrid.prototype.closeEdit = function () {
5905
5901
  if (this.grid.editModule) {
5906
- this.grid.editModule.closeEdit();
5902
+ this.editModule['closeEdit']();
5907
5903
  }
5908
5904
  };
5909
5905
  /**
@@ -7608,7 +7604,9 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
7608
7604
  * @returns {void}
7609
7605
  */
7610
7606
  TreeGrid.prototype.clearSelection = function () {
7611
- this.grid.selectionModule['actualTarget'] = null;
7607
+ if (!isNullOrUndefined(this.grid.selectionModule)) {
7608
+ this.grid.selectionModule['actualTarget'] = null;
7609
+ }
7612
7610
  this.grid.clearSelection();
7613
7611
  };
7614
7612
  /**
@@ -12377,7 +12375,7 @@ var Edit = /** @__PURE__ @class */ (function () {
12377
12375
  this.recordDoubleClick(args);
12378
12376
  }
12379
12377
  if (args.action === 'escape') {
12380
- this.parent.closeEdit();
12378
+ this.closeEdit();
12381
12379
  }
12382
12380
  };
12383
12381
  Edit.prototype.deleteUniqueID = function (value) {
@@ -12445,6 +12443,9 @@ var Edit = /** @__PURE__ @class */ (function () {
12445
12443
  Edit.prototype.batchCancel = function () {
12446
12444
  if (this.parent.editSettings.mode === 'Cell') {
12447
12445
  var cellDetails = getValue('editModule.cellDetails', this.parent.grid.editModule);
12446
+ if (!isNullOrUndefined(this.editedRowIndex)) {
12447
+ cellDetails.rowIndex = this.editedRowIndex;
12448
+ }
12448
12449
  var treeCell = this.parent.getCellFromIndex(cellDetails.rowIndex, this.parent.treeColumnIndex);
12449
12450
  this.parent.renderModule.cellRender({
12450
12451
  data: cellDetails.rowData,
@@ -12766,6 +12767,7 @@ var Edit = /** @__PURE__ @class */ (function () {
12766
12767
  this.prevAriaRowIndex = '-1';
12767
12768
  }
12768
12769
  if (!this.parent.enableVirtualization || this.parent.enableVirtualization && !Object.keys(this.parent.grid.contentModule['emptyRowData']).length) {
12770
+ this.isScrollByFocus = true;
12769
12771
  focussedElement.focus();
12770
12772
  }
12771
12773
  if (this.parent.enableVirtualization && !Object.keys(this.parent.grid.contentModule['emptyRowData']).length) {
@@ -13149,6 +13151,18 @@ var Edit = /** @__PURE__ @class */ (function () {
13149
13151
  this.parent.grid.editModule.editCell(rowIndex, field);
13150
13152
  }
13151
13153
  };
13154
+ /**
13155
+ * Cancels edited state.
13156
+ *
13157
+ * @returns {void}
13158
+ */
13159
+ Edit.prototype.closeEdit = function () {
13160
+ if (this.parent.enableVirtualization && this.parent.grid.editSettings.mode === 'Batch' && this.parent.grid.pageSettings.currentPage > 1) {
13161
+ this.editedRowIndex = this.parent.grid.editModule.editModule['cellDetails'].rowIndex;
13162
+ this.parent.grid.editModule.editModule['cellDetails'].rowIndex = parseInt(this.parent.getRows()[this.parent.grid.editModule.editModule['cellDetails'].rowIndex].getAttribute('data-rowIndex'), 10);
13163
+ }
13164
+ this.parent.grid.editModule.closeEdit();
13165
+ };
13152
13166
  return Edit;
13153
13167
  }());
13154
13168
 
@@ -13338,9 +13352,12 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
13338
13352
  if (this.parent.enableVirtualization && this.parent.isFrozenGrid()) {
13339
13353
  return this.getRowCollection(index, true);
13340
13354
  }
13341
- else {
13342
- return this.parent.getDataRows().filter(function (e) { return parseInt(e.getAttribute('data-rowindex'), 10) === index; })[0];
13355
+ var dataRows = this.parent.getDataRows();
13356
+ var targetRow = dataRows.find(function (e) { return parseInt(e.getAttribute('data-rowindex'), 10) === index; });
13357
+ if (!targetRow && this.parent.isEdit && this.parent.editSettings.mode === 'Batch') {
13358
+ return index != null ? this.parent.getRows()[parseInt(index.toString(), 10)] : undefined;
13343
13359
  }
13360
+ return targetRow;
13344
13361
  };
13345
13362
  VirtualTreeContentRenderer.prototype.getFrozenRightVirtualRowByIndex = function (index) {
13346
13363
  return this.getRowCollection(index, false, false, true);
@@ -13713,8 +13730,7 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
13713
13730
  - this.parent.pageSettings.pageSize;
13714
13731
  index = (index > 0) ? index : 0;
13715
13732
  if (!isNullOrUndefined(this["" + selectedRowIndex]) && this["" + selectedRowIndex] !== -1 && index !== this["" + selectedRowIndex] &&
13716
- ((this.parent.rowHeight * this.parent.pageSettings.pageSize) < content.scrollTop) &&
13717
- !(this.parent.root && this.parent.root.treeGrid && this.parent.root.treeGrid.isGantt)) {
13733
+ ((this.parent.rowHeight * this.parent.pageSettings.pageSize) < content.scrollTop)) {
13718
13734
  index = this["" + selectedRowIndex];
13719
13735
  }
13720
13736
  this.startIndex = index;
@@ -13741,9 +13757,15 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
13741
13757
  firsttdinx = +attr; // this.parent.getContent().querySelector('.e-content tr').getAttribute('data-rowindex');
13742
13758
  }
13743
13759
  if (firsttdinx === 0) {
13744
- this.translateY = !isNullOrUndefined(this.endIndex) ?
13745
- (this.endIndex - this.parent.pageSettings.pageSize) * (this.parent.rowHeight ?
13746
- this.parent.rowHeight : this.parent.getRowHeight()) : 0;
13760
+ if (this.endIndex - this.startIndex < this.parent.pageSettings.pageSize) {
13761
+ this.translateY = !isNullOrUndefined(this.endIndex) ?
13762
+ (this.endIndex - this.parent.pageSettings.pageSize) * (this.parent.rowHeight ?
13763
+ this.parent.rowHeight : this.parent.getRowHeight()) : 0;
13764
+ }
13765
+ else {
13766
+ this.translateY = (scrollArgs.offset.top - (outBuffer * rowHeight) > 0) ?
13767
+ scrollArgs.offset.top - (outBuffer * rowHeight) + rowHeight : 0;
13768
+ }
13747
13769
  }
13748
13770
  else if (this.parent.getFrozenColumns() > 0) {
13749
13771
  scrollArgs.offset.top = scrollArgs.offset.top + 80;
@@ -13759,7 +13781,7 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
13759
13781
  var nextSetResIndex = ~~(content.scrollTop / rowHeight);
13760
13782
  var isLastBlock = (this["" + selectedRowIndex] + this.parent.pageSettings.pageSize) < this.totalRecords ? false : true;
13761
13783
  if (!isNullOrUndefined(this["" + selectedRowIndex]) && this["" + selectedRowIndex] !== -1 &&
13762
- nextSetResIndex !== this["" + selectedRowIndex] && !isLastBlock && !(this.parent.root && this.parent.root.treeGrid && this.parent.root.treeGrid.isGantt)) {
13784
+ nextSetResIndex !== this["" + selectedRowIndex] && !isLastBlock) {
13763
13785
  nextSetResIndex = this["" + selectedRowIndex];
13764
13786
  }
13765
13787
  var lastIndex = nextSetResIndex + this.parent.pageSettings.pageSize;
@@ -13777,6 +13799,8 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
13777
13799
  ((this.startIndex - currentViewData[0]["" + indexValue]) < (this.parent.pageSettings.pageSize / 2)) && this.parent.selectionModule.isRowSelected) {
13778
13800
  this.startIndex = currentViewData[0]["" + indexValue] + (this.parent.pageSettings.pageSize / 2);
13779
13801
  }
13802
+ var selectedIndex = this.parent.root.selectedRowIndex;
13803
+ this.startIndex = selectedIndex !== -1 && selectedIndex !== this.startIndex ? this.startIndex - 1 : this.startIndex;
13780
13804
  if (scrollArgs.offset.top > (rowHeight * this.totalRecords)) {
13781
13805
  this.translateY = this.getTranslateY(scrollArgs.offset.top, content.getBoundingClientRect().height);
13782
13806
  }
@@ -13785,10 +13809,7 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
13785
13809
  this.translateY = (this.totalRecords * rowHeight) - ((this.endIndex - this.startIndex) * rowHeight);
13786
13810
  }
13787
13811
  else {
13788
- if (this.parent.allowRowDragAndDrop) {
13789
- this.translateY = scrollArgs.offset.top - rowHeight * 2;
13790
- }
13791
- else if (this.parent.getFrozenColumns() > 0) {
13812
+ if (this.parent.getFrozenColumns() > 0) {
13792
13813
  this.translateY = scrollArgs.offset.top - ((rowHeight * 2) + this.parent.pageSettings.pageSize);
13793
13814
  }
13794
13815
  else {
@@ -13945,7 +13966,12 @@ var TreeInterSectionObserver = /** @__PURE__ @class */ (function (_super) {
13945
13966
  var debounced100 = debounce(callback, delay);
13946
13967
  var debounced50 = debounce(callback, 50);
13947
13968
  this["" + options].prevTop = this["" + options].prevLeft = 0;
13969
+ var isScrollByFocus = 'isScrollByFocus';
13948
13970
  return function (e) {
13971
+ if (instance.isEdit && instance.root.editModule["" + isScrollByFocus]) {
13972
+ instance.root.editModule["" + isScrollByFocus] = false;
13973
+ return;
13974
+ }
13949
13975
  var top = _this["" + options].movableContainer ? _this["" + options].container.scrollTop : e.target.scrollTop;
13950
13976
  var left = _this["" + options].movableContainer ? _this["" + options].scrollbar.scrollLeft : e.target.scrollLeft;
13951
13977
  var direction = _this["" + options].prevTop < top ? 'down' : 'up';