@syncfusion/ej2-treegrid 33.2.8 → 33.2.12

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.
@@ -8587,10 +8587,25 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
8587
8587
  this.grid.on('initial-end', this.afterGridRender, this);
8588
8588
  this.grid.on('partial-filter-update', this.partialFilterUpdate, this);
8589
8589
  this.grid.on('get-row-cells', this.getCellsByTableName, this);
8590
+ this.grid.on('save-complete', this.onSaveComplete, this);
8590
8591
  };
8591
8592
  TreeGrid.prototype.updateResultModel = function (returnResult) {
8592
8593
  this.dataResults = returnResult;
8593
8594
  };
8595
+ TreeGrid.prototype.onSaveComplete = function (args) {
8596
+ if (!this['isGantt'] && this.enableVirtualization && args.action === 'add'
8597
+ && (!isNullOrUndefined(args.index) && args.index !== -1) && args.data) {
8598
+ var primaryKeyField = this.getPrimaryKeyFieldNames()[0];
8599
+ var dataRecord = args.data;
8600
+ var addedRecordValue = Object.prototype.hasOwnProperty.call(dataRecord, primaryKeyField)
8601
+ ? dataRecord["" + primaryKeyField]
8602
+ : undefined;
8603
+ if (!isNullOrUndefined(addedRecordValue)) {
8604
+ var index = this.grid.getRowIndexByPrimaryKey(addedRecordValue);
8605
+ args.index = index !== -1 ? index : args.index;
8606
+ }
8607
+ }
8608
+ };
8594
8609
  /**
8595
8610
  * @hidden
8596
8611
  * @returns {void}
@@ -8604,6 +8619,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
8604
8619
  this.grid.off('last-rowcell-border-updated', this.lastRowCellBorderUpdated);
8605
8620
  this.grid.off('partial-filter-update', this.partialFilterUpdate);
8606
8621
  this.grid.off('get-row-cells', this.getCellsByTableName);
8622
+ this.grid.off('save-complete', this.onSaveComplete);
8607
8623
  };
8608
8624
  TreeGrid.prototype.getCellsByTableName = function (args) {
8609
8625
  if (!Array.isArray(args.elements)) {
@@ -15947,6 +15963,10 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
15947
15963
  this.parent.root.scrollPosition = scrollArgs.offset;
15948
15964
  }
15949
15965
  var info = scrollArgs.sentinel;
15966
+ var treeGridParent = null;
15967
+ if (this.parent.clipboardModule && this.parent.clipboardModule['treeGridParent']) {
15968
+ treeGridParent = this.parent.clipboardModule['treeGridParent'];
15969
+ }
15950
15970
  var rowHeight = parseInt(this.parent.getRowHeight().toString(), 10);
15951
15971
  var outBuffer = this.parent.pageSettings.pageSize - Math.ceil(this.parent.pageSettings.pageSize / 2);
15952
15972
  var content;
@@ -16024,7 +16044,7 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
16024
16044
  else if (downScroll && (scrollArgs.direction !== 'right' && scrollArgs.direction !== 'left') && !isNullOrUndefined(content)) {
16025
16045
  var nextSetResIndex = ~~(content.scrollTop / rowHeight);
16026
16046
  var isLastBlock = (this["" + selectedRowIndex] + this.parent.pageSettings.pageSize) < this.totalRecords ? false : true;
16027
- if (!isNullOrUndefined(this["" + selectedRowIndex]) && this["" + selectedRowIndex] !== -1 &&
16047
+ if (treeGridParent !== null && treeGridParent.isGantt && !isNullOrUndefined(this["" + selectedRowIndex]) && this["" + selectedRowIndex] !== -1 &&
16028
16048
  nextSetResIndex !== this["" + selectedRowIndex] && !isLastBlock && !this.parent.allowRowDragAndDrop) {
16029
16049
  nextSetResIndex = this["" + selectedRowIndex];
16030
16050
  }
@@ -16135,6 +16155,15 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
16135
16155
  * @returns {void}
16136
16156
  */
16137
16157
  VirtualTreeContentRenderer.prototype.appendContent = function (target, newChild, e) {
16158
+ var treeGridParent = null;
16159
+ if (this.parent.clipboardModule && this.parent.clipboardModule['treeGridParent']) {
16160
+ treeGridParent = this.parent.clipboardModule['treeGridParent'];
16161
+ }
16162
+ var totalBlocks = this.getTotalBlocks();
16163
+ var lastPage = Math.ceil(totalBlocks / 2);
16164
+ var isBottom = (this.parent.pageSettings.currentPage === lastPage) &&
16165
+ (treeGridParent && treeGridParent.flatData &&
16166
+ treeGridParent.flatData.length === e.index + 1);
16138
16167
  if ((this.parent.dataSource instanceof DataManager && this.parent.dataSource.dataSource.url !== undefined
16139
16168
  && !this.parent.dataSource.dataSource.offline && this.parent.dataSource.dataSource.url !== '') || isCountRequired(this.parent)
16140
16169
  || (this.parent.isFrozenGrid() && (e.requestType === undefined || !isNullOrUndefined(e.virtualInfo) && (e.virtualInfo.direction === 'right' || e.virtualInfo.direction === 'left')))) {
@@ -16219,6 +16248,14 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
16219
16248
  }
16220
16249
  }
16221
16250
  }
16251
+ if ((treeGridParent !== null && !treeGridParent.isGantt) && e.action === 'add' && isBottom) {
16252
+ var rowHeight = this.parent.getRowHeight();
16253
+ var pageSize = this.parent.pageSettings.pageSize;
16254
+ var newTranslateY = (this.totalRecords * rowHeight) - (pageSize * rowHeight);
16255
+ this.translateY = newTranslateY > 0 ? newTranslateY : this.translateY;
16256
+ this.virtualEle.adjustTable(cOffset, this.translateY);
16257
+ this.content.scrollTop = this.translateY;
16258
+ }
16222
16259
  this.restoreEditState();
16223
16260
  _super.prototype["" + restoreAdd].call(this);
16224
16261
  _super.prototype["" + ensureSelectedRowPosition].call(this);