@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
@@ -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,13 +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 (_this.enableVirtualization && args.rowIndex === _this.selectedRowIndex && !_this.enablePersistence) {
4727
- args.cancel = true;
4728
- }
4729
- if (!isNullOrUndefined(_this.selectionSettings) && !_this.selectionSettings.persistSelection &&
4730
- _this.enableVirtualization && args.rowIndex === _this.selectedRowIndex && _this.isGantt) {
4731
- args.cancel = false;
4732
- }
4733
4726
  _this.trigger(rowSelecting, args);
4734
4727
  };
4735
4728
  this.grid.rowDeselecting = function (args) {
@@ -5906,7 +5899,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
5906
5899
  */
5907
5900
  TreeGrid.prototype.closeEdit = function () {
5908
5901
  if (this.grid.editModule) {
5909
- this.grid.editModule.closeEdit();
5902
+ this.editModule['closeEdit']();
5910
5903
  }
5911
5904
  };
5912
5905
  /**
@@ -7611,7 +7604,9 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
7611
7604
  * @returns {void}
7612
7605
  */
7613
7606
  TreeGrid.prototype.clearSelection = function () {
7614
- this.grid.selectionModule['actualTarget'] = null;
7607
+ if (!isNullOrUndefined(this.grid.selectionModule)) {
7608
+ this.grid.selectionModule['actualTarget'] = null;
7609
+ }
7615
7610
  this.grid.clearSelection();
7616
7611
  };
7617
7612
  /**
@@ -12380,7 +12375,7 @@ var Edit = /** @__PURE__ @class */ (function () {
12380
12375
  this.recordDoubleClick(args);
12381
12376
  }
12382
12377
  if (args.action === 'escape') {
12383
- this.parent.closeEdit();
12378
+ this.closeEdit();
12384
12379
  }
12385
12380
  };
12386
12381
  Edit.prototype.deleteUniqueID = function (value) {
@@ -12448,6 +12443,9 @@ var Edit = /** @__PURE__ @class */ (function () {
12448
12443
  Edit.prototype.batchCancel = function () {
12449
12444
  if (this.parent.editSettings.mode === 'Cell') {
12450
12445
  var cellDetails = getValue('editModule.cellDetails', this.parent.grid.editModule);
12446
+ if (!isNullOrUndefined(this.editedRowIndex)) {
12447
+ cellDetails.rowIndex = this.editedRowIndex;
12448
+ }
12451
12449
  var treeCell = this.parent.getCellFromIndex(cellDetails.rowIndex, this.parent.treeColumnIndex);
12452
12450
  this.parent.renderModule.cellRender({
12453
12451
  data: cellDetails.rowData,
@@ -12769,6 +12767,7 @@ var Edit = /** @__PURE__ @class */ (function () {
12769
12767
  this.prevAriaRowIndex = '-1';
12770
12768
  }
12771
12769
  if (!this.parent.enableVirtualization || this.parent.enableVirtualization && !Object.keys(this.parent.grid.contentModule['emptyRowData']).length) {
12770
+ this.isScrollByFocus = true;
12772
12771
  focussedElement.focus();
12773
12772
  }
12774
12773
  if (this.parent.enableVirtualization && !Object.keys(this.parent.grid.contentModule['emptyRowData']).length) {
@@ -13152,6 +13151,18 @@ var Edit = /** @__PURE__ @class */ (function () {
13152
13151
  this.parent.grid.editModule.editCell(rowIndex, field);
13153
13152
  }
13154
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
+ };
13155
13166
  return Edit;
13156
13167
  }());
13157
13168
 
@@ -13341,9 +13352,12 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
13341
13352
  if (this.parent.enableVirtualization && this.parent.isFrozenGrid()) {
13342
13353
  return this.getRowCollection(index, true);
13343
13354
  }
13344
- else {
13345
- 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;
13346
13359
  }
13360
+ return targetRow;
13347
13361
  };
13348
13362
  VirtualTreeContentRenderer.prototype.getFrozenRightVirtualRowByIndex = function (index) {
13349
13363
  return this.getRowCollection(index, false, false, true);
@@ -13703,7 +13717,7 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
13703
13717
  content = this.parent.getContent().querySelector('.e-content');
13704
13718
  }
13705
13719
  var scrollHeight = outBuffer * rowHeight;
13706
- var upScroll = (scrollArgs.offset.top - this.translateY) <= 0;
13720
+ var upScroll = (scrollArgs.offset.top - this.translateY) < 0;
13707
13721
  var downScroll = Math.ceil(scrollArgs.offset.top - this.translateY) + rowHeight >= scrollHeight;
13708
13722
  var selectedRowIndex = 'selectedRowIndex';
13709
13723
  var currentViewData = this.parent.currentViewData;
@@ -13716,8 +13730,7 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
13716
13730
  - this.parent.pageSettings.pageSize;
13717
13731
  index = (index > 0) ? index : 0;
13718
13732
  if (!isNullOrUndefined(this["" + selectedRowIndex]) && this["" + selectedRowIndex] !== -1 && index !== this["" + selectedRowIndex] &&
13719
- ((this.parent.rowHeight * this.parent.pageSettings.pageSize) < content.scrollTop) &&
13720
- !(this.parent.root && this.parent.root.treeGrid && this.parent.root.treeGrid.isGantt)) {
13733
+ ((this.parent.rowHeight * this.parent.pageSettings.pageSize) < content.scrollTop)) {
13721
13734
  index = this["" + selectedRowIndex];
13722
13735
  }
13723
13736
  this.startIndex = index;
@@ -13744,8 +13757,9 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
13744
13757
  firsttdinx = +attr; // this.parent.getContent().querySelector('.e-content tr').getAttribute('data-rowindex');
13745
13758
  }
13746
13759
  if (firsttdinx === 0) {
13747
- this.translateY = (scrollArgs.offset.top - (outBuffer * rowHeight) > 0) ?
13748
- scrollArgs.offset.top - (outBuffer * this.parent.getRowHeight()) + rowHeight : 0;
13760
+ this.translateY = !isNullOrUndefined(this.endIndex) ?
13761
+ (this.endIndex - this.parent.pageSettings.pageSize) * (this.parent.rowHeight ?
13762
+ this.parent.rowHeight : this.parent.getRowHeight()) : 0;
13749
13763
  }
13750
13764
  else if (this.parent.getFrozenColumns() > 0) {
13751
13765
  scrollArgs.offset.top = scrollArgs.offset.top + 80;
@@ -13761,7 +13775,7 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
13761
13775
  var nextSetResIndex = ~~(content.scrollTop / rowHeight);
13762
13776
  var isLastBlock = (this["" + selectedRowIndex] + this.parent.pageSettings.pageSize) < this.totalRecords ? false : true;
13763
13777
  if (!isNullOrUndefined(this["" + selectedRowIndex]) && this["" + selectedRowIndex] !== -1 &&
13764
- nextSetResIndex !== this["" + selectedRowIndex] && !isLastBlock && !(this.parent.root && this.parent.root.treeGrid && this.parent.root.treeGrid.isGantt)) {
13778
+ nextSetResIndex !== this["" + selectedRowIndex] && !isLastBlock) {
13765
13779
  nextSetResIndex = this["" + selectedRowIndex];
13766
13780
  }
13767
13781
  var lastIndex = nextSetResIndex + this.parent.pageSettings.pageSize;
@@ -13947,7 +13961,12 @@ var TreeInterSectionObserver = /** @__PURE__ @class */ (function (_super) {
13947
13961
  var debounced100 = debounce(callback, delay);
13948
13962
  var debounced50 = debounce(callback, 50);
13949
13963
  this["" + options].prevTop = this["" + options].prevLeft = 0;
13964
+ var isScrollByFocus = 'isScrollByFocus';
13950
13965
  return function (e) {
13966
+ if (instance.isEdit && instance.root.editModule["" + isScrollByFocus]) {
13967
+ instance.root.editModule["" + isScrollByFocus] = false;
13968
+ return;
13969
+ }
13951
13970
  var top = _this["" + options].movableContainer ? _this["" + options].container.scrollTop : e.target.scrollTop;
13952
13971
  var left = _this["" + options].movableContainer ? _this["" + options].scrollbar.scrollLeft : e.target.scrollLeft;
13953
13972
  var direction = _this["" + options].prevTop < top ? 'down' : 'up';