@syncfusion/ej2-treegrid 28.2.4 → 29.1.33

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 (84) hide show
  1. package/README.md +2 -2
  2. package/dist/ej2-treegrid.min.js +2 -2
  3. package/dist/ej2-treegrid.umd.min.js +2 -2
  4. package/dist/ej2-treegrid.umd.min.js.map +1 -1
  5. package/dist/es6/ej2-treegrid.es2015.js +1275 -519
  6. package/dist/es6/ej2-treegrid.es2015.js.map +1 -1
  7. package/dist/es6/ej2-treegrid.es5.js +1277 -519
  8. package/dist/es6/ej2-treegrid.es5.js.map +1 -1
  9. package/dist/global/ej2-treegrid.min.js +2 -2
  10. package/dist/global/ej2-treegrid.min.js.map +1 -1
  11. package/dist/global/index.d.ts +1 -1
  12. package/package.json +10 -10
  13. package/src/treegrid/actions/batch-edit.js +12 -5
  14. package/src/treegrid/actions/edit.js +12 -12
  15. package/src/treegrid/actions/page.js +1 -1
  16. package/src/treegrid/actions/rowdragdrop.d.ts +21 -1
  17. package/src/treegrid/actions/rowdragdrop.js +248 -48
  18. package/src/treegrid/actions/summary.js +1 -1
  19. package/src/treegrid/actions/virtual-scroll.d.ts +34 -1
  20. package/src/treegrid/actions/virtual-scroll.js +58 -11
  21. package/src/treegrid/base/constant.d.ts +0 -4
  22. package/src/treegrid/base/constant.js +0 -4
  23. package/src/treegrid/base/data.js +48 -47
  24. package/src/treegrid/base/treegrid-model.d.ts +195 -208
  25. package/src/treegrid/base/treegrid.d.ts +598 -411
  26. package/src/treegrid/base/treegrid.js +523 -306
  27. package/src/treegrid/enum.d.ts +77 -80
  28. package/src/treegrid/enum.js +2 -2
  29. package/src/treegrid/models/column.d.ts +122 -177
  30. package/src/treegrid/models/column.js +14 -26
  31. package/src/treegrid/models/edit-settings-model.d.ts +24 -25
  32. package/src/treegrid/models/edit-settings.d.ts +25 -26
  33. package/src/treegrid/models/edit-settings.js +1 -1
  34. package/src/treegrid/models/filter-settings-model.d.ts +41 -49
  35. package/src/treegrid/models/filter-settings.d.ts +43 -51
  36. package/src/treegrid/models/filter-settings.js +2 -2
  37. package/src/treegrid/models/infinite-scroll-settings-model.d.ts +4 -4
  38. package/src/treegrid/models/infinite-scroll-settings.d.ts +4 -4
  39. package/src/treegrid/models/infinite-scroll-settings.js +1 -1
  40. package/src/treegrid/models/loading-indicator-model.d.ts +3 -4
  41. package/src/treegrid/models/loading-indicator.d.ts +4 -4
  42. package/src/treegrid/models/loading-indicator.js +1 -1
  43. package/src/treegrid/models/page-settings-model.d.ts +10 -13
  44. package/src/treegrid/models/page-settings.d.ts +11 -14
  45. package/src/treegrid/models/page-settings.js +1 -1
  46. package/src/treegrid/models/rowdrop-settings-model.d.ts +1 -1
  47. package/src/treegrid/models/rowdrop-settings.d.ts +13 -6
  48. package/src/treegrid/models/rowdrop-settings.js +1 -1
  49. package/src/treegrid/models/search-settings-model.d.ts +13 -11
  50. package/src/treegrid/models/search-settings.d.ts +14 -12
  51. package/src/treegrid/models/search-settings.js +1 -1
  52. package/src/treegrid/models/selection-settings-model.d.ts +18 -29
  53. package/src/treegrid/models/selection-settings.d.ts +18 -29
  54. package/src/treegrid/models/sort-settings-model.d.ts +8 -5
  55. package/src/treegrid/models/sort-settings.d.ts +10 -7
  56. package/src/treegrid/models/sort-settings.js +2 -2
  57. package/src/treegrid/models/summary-model.d.ts +28 -29
  58. package/src/treegrid/models/summary.d.ts +32 -30
  59. package/src/treegrid/models/summary.js +4 -1
  60. package/src/treegrid/models/textwrap-settings-model.d.ts +7 -4
  61. package/src/treegrid/models/textwrap-settings.d.ts +8 -5
  62. package/src/treegrid/models/textwrap-settings.js +1 -1
  63. package/src/treegrid/renderer/render.js +11 -5
  64. package/src/treegrid/renderer/virtual-row-model-generator.js +5 -4
  65. package/src/treegrid/renderer/virtual-tree-content-render.d.ts +277 -0
  66. package/src/treegrid/renderer/virtual-tree-content-render.js +328 -35
  67. package/src/treegrid/utils.d.ts +1 -1
  68. package/styles/bootstrap-lite.css +0 -12
  69. package/styles/bootstrap.css +0 -12
  70. package/styles/bootstrap5-dark-lite.css +1 -1
  71. package/styles/bootstrap5-dark.css +1 -1
  72. package/styles/treegrid/_layout.scss +0 -1
  73. package/styles/treegrid/_material-dark-definition.scss +2 -2
  74. package/styles/treegrid/_material-definition.scss +2 -2
  75. package/styles/treegrid/bootstrap.css +0 -12
  76. package/styles/treegrid/bootstrap5-dark.css +1 -1
  77. package/styles/treegrid/icons/_bootstrap.scss +0 -17
  78. package/styles/treegrid/icons/_bootstrap5.scss +1 -1
  79. package/styles/treegrid/icons/_fabric-dark.scss +1 -1
  80. package/styles/treegrid/icons/_fabric.scss +1 -1
  81. package/styles/treegrid/icons/_fluent2.scss +1 -1
  82. package/styles/treegrid/icons/_fusionnew.scss +1 -0
  83. package/styles/treegrid/icons/_highcontrast-light.scss +1 -1
  84. package/styles/treegrid/icons/_tailwind-dark.scss +2 -2
@@ -19,7 +19,12 @@ import { TreeVirtualRowModelGenerator } from '../renderer/virtual-row-model-gene
19
19
  import * as events from '../base/constant';
20
20
  import { isNullOrUndefined, EventHandler, getValue, setValue, Browser, debounce } from '@syncfusion/ej2-base';
21
21
  import { DataManager } from '@syncfusion/ej2-data';
22
- import { isCountRequired, isRemoteData } from '../utils';
22
+ import { isCountRequired } from '../utils';
23
+ /**
24
+ * VirtualTreeContentRenderer
25
+ *
26
+ * @hidden
27
+ */
23
28
  var VirtualTreeContentRenderer = /** @class */ (function (_super) {
24
29
  __extends(VirtualTreeContentRenderer, _super);
25
30
  function VirtualTreeContentRenderer(parent, locator) {
@@ -41,23 +46,45 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
41
46
  VirtualTreeContentRenderer.prototype.getModelGenerator = function () {
42
47
  return new TreeVirtualRowModelGenerator(this.parent);
43
48
  };
49
+ /**
50
+ * Retrieves the row element for a given row index.
51
+ *
52
+ * @param {number} index - The index of the row to retrieve.
53
+ * @returns {Element} The row element at the specified index.
54
+ */
44
55
  VirtualTreeContentRenderer.prototype.getRowByIndex = function (index) {
45
56
  if (this.parent.enableVirtualization && this.parent.isFrozenGrid()) {
46
57
  return this.getRowCollection(index, true);
47
58
  }
48
59
  var dataRows = this.parent.getDataRows();
49
- var targetRow = dataRows.find(function (e) { return parseInt(e.getAttribute('data-rowindex'), 10) === index; });
60
+ var targetRow = dataRows.find(function (e) { return parseInt(e.getAttribute('aria-rowindex'), 10) - 1 === index; });
50
61
  if (!targetRow && this.parent.isEdit && this.parent.editSettings.mode === 'Batch') {
51
62
  return index != null ? this.parent.getRows()[parseInt(index.toString(), 10)] : undefined;
52
63
  }
53
64
  return targetRow;
54
65
  };
66
+ /**
67
+ * Retrieves the frozen right virtual row element by its index.
68
+ *
69
+ * @param {number} index - The index of the row to be retrieved.
70
+ * @returns {Element} The DOM element representing the frozen right virtual row.
71
+ */
55
72
  VirtualTreeContentRenderer.prototype.getFrozenRightVirtualRowByIndex = function (index) {
56
73
  return this.getRowCollection(index, false, false, true);
57
74
  };
75
+ /**
76
+ * Retrieves the row or record from the virtual tree grid based on the provided index.
77
+ * Considers conditions such as frozen rows and pagination for accurate retrieval.
78
+ *
79
+ * @param {number} index - The index of the desired row or record.
80
+ * @param {boolean} isMovable - Specifies if the content is movable.
81
+ * @param {boolean} [isRowObject] - Optional. Determines if the return value should be a row object.
82
+ * @param {boolean} [isFrozenRight] - Optional. Used for determining frozen right rows.
83
+ * @returns {Element | Object} - The HTML element or row object.
84
+ */
58
85
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
59
86
  VirtualTreeContentRenderer.prototype.getRowCollection = function (index, isMovable, isRowObject, isFrozenRight) {
60
- var startIdx = parseInt(this.parent.getRows()[0].getAttribute(literals.dataRowIndex), 10);
87
+ var startIdx = parseInt(this.parent.getRows()[0].getAttribute(literals.ariaRowIndex), 10) - 1;
61
88
  var rowCollection = this.parent.getDataRows();
62
89
  var collection = isRowObject ? this.parent.getCurrentViewRecords() : rowCollection;
63
90
  var selectedRow = collection[index - startIdx];
@@ -71,12 +98,27 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
71
98
  this.parent.getRowsObject()[parseInt(index.toString(), 10)].data : selectedRow;
72
99
  }
73
100
  }
101
+ if (selectedRow == null && index != null && this.parent.editSettings.mode === 'Batch' && this.parent.isEdit && isMovable) {
102
+ selectedRow = rowCollection[parseInt(index.toString(), 10)];
103
+ }
74
104
  return selectedRow;
75
105
  };
106
+ /**
107
+ * @hidden
108
+ * @returns {void}
109
+ */
76
110
  VirtualTreeContentRenderer.prototype.addEventListener = function () {
77
111
  this.parent.on(events.virtualActionArgs, this.virtualOtherAction, this);
78
112
  this.parent.on(events.indexModifier, this.indexModifier, this);
79
113
  };
114
+ /**
115
+ * Handles virtual scrolling actions based on the provided arguments.
116
+ *
117
+ * @param {Object} args - The argument object.
118
+ * @param {boolean} args.setTop - Determines if the virtual scroll position should reset to top.
119
+ * @param {boolean} args.isExpandCollapse - Determines if the action is part of an expand/collapse operation.
120
+ * @returns {void}
121
+ */
80
122
  VirtualTreeContentRenderer.prototype.virtualOtherAction = function (args) {
81
123
  if (args.setTop) {
82
124
  this.translateY = 0;
@@ -87,10 +129,22 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
87
129
  this.isExpandCollapse = true;
88
130
  }
89
131
  };
132
+ /**
133
+ * Modifies the index based on various conditions such as record addition, deletion, or data source changes.
134
+ *
135
+ * @private
136
+ * @param {Object} args - Contains parameters for the current operation.
137
+ * @param {number} args.startIndex - The starting index for the modification.
138
+ * @param {number} args.endIndex - The ending index for the modification.
139
+ * @param {number} args.count - The number of items affected in the operation.
140
+ * @param {string} args.requestType - The type of request, such as 'insert', 'delete', or 'update'.
141
+ * @returns {void}
142
+ */
90
143
  VirtualTreeContentRenderer.prototype.indexModifier = function (args) {
91
144
  var content = this.parent.getContent().querySelector('.e-content');
145
+ var pageSize = this.parent.pageSettings.pageSize;
92
146
  if ((this.recordAdded || args.requestType === 'delete' && this.endIndex > args.count - this.parent.pageSettings.pageSize) && this.startIndex > -1 && this.endIndex > -1) {
93
- if (this.endIndex > args.count - this.parent.pageSettings.pageSize) {
147
+ if (this.endIndex > args.count - pageSize) {
94
148
  var nextSetResIndex = ~~(content.scrollTop / this.parent.getRowHeight());
95
149
  var lastIndex = nextSetResIndex + this.parent.getRows().length;
96
150
  if (lastIndex > args.count) {
@@ -108,12 +162,12 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
108
162
  }
109
163
  if (this.isDataSourceChanged) {
110
164
  this.startIndex = 0;
111
- this.endIndex = this.parent.pageSettings.pageSize - 1;
165
+ this.endIndex = pageSize - 1;
112
166
  }
113
- if ((this.endIndex - this.startIndex !== this.parent.pageSettings.pageSize) &&
114
- (this.totalRecords > this.parent.pageSettings.pageSize)
167
+ if ((this.endIndex - this.startIndex !== pageSize) &&
168
+ (this.totalRecords > pageSize)
115
169
  && (this.endIndex === this.totalRecords)) {
116
- args.startIndex = this.endIndex - this.parent.pageSettings.pageSize;
170
+ args.startIndex = this.endIndex - pageSize;
117
171
  args.endIndex = this.endIndex;
118
172
  }
119
173
  else {
@@ -121,6 +175,12 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
121
175
  args.endIndex = this.endIndex;
122
176
  }
123
177
  };
178
+ /**
179
+ * Handles the addition or removal of event listeners for virtual scrolling in a TreeGrid.
180
+ *
181
+ * @param {string} action - The action to perform, either 'on' or 'off'.
182
+ * @returns {void}
183
+ */
124
184
  VirtualTreeContentRenderer.prototype.eventListener = function (action) {
125
185
  var _this = this;
126
186
  if (!(this.parent.dataSource instanceof DataManager && this.parent.dataSource.dataSource.url !== undefined
@@ -147,6 +207,7 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
147
207
  this.parent.addEventListener('rowSelected', this.rowSelectedEvent.bind(this));
148
208
  this.parent["" + action]('select-virtual-Row', this.toSelectVirtualRow, this);
149
209
  this.parent.on('content-ready', this.fn, this);
210
+ this.parent.addEventListener(events.actionBegin, this.handleActionBegin.bind(this));
150
211
  this.parent.addEventListener(events.actionComplete, this.onActionComplete.bind(this));
151
212
  this.parent["" + action]('virtual-scroll-edit-action-begin', this.beginEdit, this);
152
213
  this.parent["" + action]('virtual-scroll-add-action-begin', this.beginAdd, this);
@@ -157,15 +218,30 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
157
218
  this.parent["" + action]('select-row-on-context-open', this.toSelectRowOnContextOpen, this);
158
219
  this.parent["" + action]('refresh-virtual-editform-cells', this.refreshCell, this);
159
220
  this.parent["" + action]('virtaul-cell-focus', this.cellFocus, this);
221
+ this.parent["" + action]('virtual-scroll-edit', this.restoreEditState, this);
160
222
  }
161
223
  else {
162
224
  _super.prototype.eventListener.call(this, 'on');
163
225
  }
164
226
  };
227
+ /**
228
+ * Handles cell focus transitions in a virtualized tree grid component
229
+ * when a keyboard event is triggered.
230
+ *
231
+ * @param {KeyboardEventArgs} e - The keyboard event arguments that contain
232
+ * information about the key action.
233
+ * @returns {void}
234
+ */
165
235
  VirtualTreeContentRenderer.prototype.cellFocus = function (e) {
166
236
  var virtualCellFocus = 'virtualCellFocus';
167
237
  _super.prototype["" + virtualCellFocus].call(this, e);
168
238
  };
239
+ /**
240
+ * Handles the data ready event for the virtual tree grid content renderer.
241
+ *
242
+ * @param {NotifyArgs} [e] - The notification arguments that contain information about the data.
243
+ * @returns {void}
244
+ */
169
245
  VirtualTreeContentRenderer.prototype.onDataReady = function (e) {
170
246
  _super.prototype.onDataReady.call(this, e);
171
247
  if (!(this.parent.dataSource instanceof DataManager && this.parent.dataSource.dataSource.url !== undefined
@@ -190,6 +266,12 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
190
266
  }
191
267
  }
192
268
  };
269
+ /**
270
+ * Renders the table for the virtual tree content. It sets up a new `TreeInterSectionObserver`
271
+ * based on certain conditions regarding the data source and counting requirements.
272
+ *
273
+ * @returns {void}
274
+ */
193
275
  VirtualTreeContentRenderer.prototype.renderTable = function () {
194
276
  _super.prototype.renderTable.call(this);
195
277
  if (!(this.parent.dataSource instanceof DataManager && this.parent.dataSource.dataSource.url !== undefined
@@ -199,6 +281,17 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
199
281
  this.contents = this.getPanel().firstChild;
200
282
  }
201
283
  };
284
+ /**
285
+ * Calculates the translateY value for a virtual tree grid based on the scroll top, container height,
286
+ * and additional virtual scrolling information. This method specifically handles logic for remote
287
+ * data sources and ensures smooth scrolling with respect to expansion states.
288
+ *
289
+ * @param {number} sTop - The scroll top position.
290
+ * @param {number} cHeight - The height of the container.
291
+ * @param {VirtualInfo} [info] - Optional virtual scrolling information.
292
+ * @param {boolean} [isOnenter] - Flag indicating if the scroll event is on enter.
293
+ * @returns {number} The calculated translateY value.
294
+ */
202
295
  VirtualTreeContentRenderer.prototype.getTranslateY = function (sTop, cHeight, info, isOnenter) {
203
296
  if ((this.parent.dataSource instanceof DataManager && this.parent.dataSource.dataSource.url !== undefined
204
297
  && !this.parent.dataSource.dataSource.offline && this.parent.dataSource.dataSource.url !== '') || isCountRequired(this.parent)) {
@@ -206,15 +299,15 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
206
299
  this.isRemoteExpand = false;
207
300
  return this.preTranslate;
208
301
  }
209
- else {
210
- this.preTranslate = _super.prototype.getTranslateY.call(this, sTop, cHeight, info, isOnenter);
211
- return _super.prototype.getTranslateY.call(this, sTop, cHeight, info, isOnenter);
212
- }
213
- }
214
- else {
215
- return _super.prototype.getTranslateY.call(this, sTop, cHeight, info, isOnenter);
302
+ this.preTranslate = _super.prototype.getTranslateY.call(this, sTop, cHeight, info, isOnenter);
216
303
  }
304
+ return _super.prototype.getTranslateY.call(this, sTop, cHeight, info, isOnenter);
217
305
  };
306
+ /**
307
+ * Handles the dataBound event to calculate and set the initial row top position for the grid.
308
+ *
309
+ * @returns {void}
310
+ */
218
311
  VirtualTreeContentRenderer.prototype.dataBoundEvent = function () {
219
312
  var dataBoundEve = 'dataBound';
220
313
  var initialRowTop = 'initialRowTop';
@@ -231,11 +324,27 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
231
324
  }
232
325
  _super.prototype["" + dataBoundEve].call(this);
233
326
  };
327
+ /**
328
+ * Handles the row selection event for virtual tree grid rows.
329
+ * It invokes the base class's rowSelected method and notifies
330
+ * the parent component about a virtual transformation change.
331
+ *
332
+ * @param {RowSelectEventArgs} args - The arguments related to the row selection event.
333
+ * @returns {void} This method does not return a value.
334
+ */
234
335
  VirtualTreeContentRenderer.prototype.rowSelectedEvent = function (args) {
235
336
  var rowSelected = 'rowSelected';
236
337
  _super.prototype["" + rowSelected].call(this, args);
237
338
  this.parent.notify('virtualTransform', { requestType: 'transformChange' });
238
339
  };
340
+ /**
341
+ * Handles virtual row selection in TreeGrid.
342
+ *
343
+ * @param {Object} args - The argument object containing the selected index.
344
+ * @param {number} args.selectedIndex - The index of the row to be selected.
345
+ *
346
+ * @returns {void}
347
+ */
239
348
  VirtualTreeContentRenderer.prototype.toSelectVirtualRow = function (args) {
240
349
  if (this.parent.isEdit) {
241
350
  return;
@@ -258,9 +367,20 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
258
367
  _super.prototype["" + selectVirtualRow].call(this, args);
259
368
  }
260
369
  };
370
+ /**
371
+ * Refreshes the cells for the given row object by regenerating them.
372
+ *
373
+ * @param {Row<Column>} rowObj - The row object for which the cells need to be refreshed.
374
+ * @returns {void} This method does not return any value.
375
+ */
261
376
  VirtualTreeContentRenderer.prototype.refreshCell = function (rowObj) {
262
377
  rowObj.cells = this.generateCells();
263
378
  };
379
+ /**
380
+ * Generates an array of cells for each column in the parent.
381
+ *
382
+ * @returns {Cell<Column>[]} An array of cells for the corresponding columns.
383
+ */
264
384
  VirtualTreeContentRenderer.prototype.generateCells = function () {
265
385
  var cells = [];
266
386
  for (var i = 0; i < this.parent.columns.length; i++) {
@@ -268,6 +388,18 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
268
388
  }
269
389
  return cells;
270
390
  };
391
+ /**
392
+ * Generates a cell object with provided column and row configurations.
393
+ *
394
+ * @param {Column} col - The Column object which holds the column configuration.
395
+ * @param {string} [rowId] - An optional string that represents the row ID.
396
+ * @param {CellType} [cellType] - An optional CellType enum to specify the type of the cell.
397
+ * @param {number} [colSpan] - An optional number to specify the column span of the cell.
398
+ * @param {number} [oIndex] - An optional number for the order index of the cell.
399
+ * @param {Object} [foreignKeyData] - An optional object for foreign key data associated with the column.
400
+ *
401
+ * @returns {Cell<Column>} Returns a newly created Cell object of type Column.
402
+ */
271
403
  VirtualTreeContentRenderer.prototype.generateCell = function (col, rowId, cellType, colSpan, oIndex, foreignKeyData) {
272
404
  var opt = {
273
405
  'visible': col.visible,
@@ -286,13 +418,29 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
286
418
  }
287
419
  return new Cell(opt);
288
420
  };
421
+ /**
422
+ * Begins the edit operation for a specified row in the grid.
423
+ * Updates the `editedRowIndex` and assigns row data to the event data.
424
+ *
425
+ * @param {{ data: Object, index: number }} e - An object containing the row data and index.
426
+ * @param {Object} e.data - The data of the row to be edited.
427
+ * @param {number} e.index - The index of the row to be edited.
428
+ * @returns {void}
429
+ */
289
430
  VirtualTreeContentRenderer.prototype.beginEdit = function (e) {
290
431
  this['editedRowIndex'] = e.index;
291
- var selector = '.e-row[data-rowindex="' + e.index + '"]';
432
+ var selector = '.e-row[aria-rowindex="' + (e.index + 1) + '"]';
292
433
  var index = this.parent.getContent().querySelector(selector).rowIndex;
293
434
  var rowData = this.parent.getCurrentViewRecords()[parseInt(index.toString(), 10)];
294
435
  e.data = rowData;
295
436
  };
437
+ /**
438
+ * Begins the process of adding a new row in the tree grid.
439
+ *
440
+ * @param {Object} args - The arguments for adding a new row.
441
+ * @param {boolean} args.startEdit - A flag indicating whether to start editing.
442
+ * @returns {void}
443
+ */
296
444
  VirtualTreeContentRenderer.prototype.beginAdd = function (args) {
297
445
  var addAction = 'addActionBegin';
298
446
  var isAdd = 'isAdd';
@@ -302,8 +450,8 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
302
450
  this.addRowIndex = addArgs.addRowIndex;
303
451
  this.dataRowIndex = addArgs.dataRowIndex;
304
452
  var rows = this.parent.getRows();
305
- var firstAriaIndex = rows.length ? +rows[0].getAttribute('data-rowindex') : 0;
306
- var lastAriaIndex = rows.length ? +rows[rows.length - 1].getAttribute('data-rowindex') : 0;
453
+ var firstAriaIndex = rows.length ? +rows[0].getAttribute('aria-rowindex') - 1 : 0;
454
+ var lastAriaIndex = rows.length ? +rows[rows.length - 1].getAttribute('aria-rowindex') - 1 : 0;
307
455
  var withInRange = this.parent.selectedRowIndex >= firstAriaIndex && this.parent.selectedRowIndex <= lastAriaIndex;
308
456
  if (!(this.rowPosition === 'Top' || this.rowPosition === 'Bottom')) {
309
457
  this["" + isAdd] = true;
@@ -313,10 +461,21 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
313
461
  _super.prototype["" + addAction].call(this, args);
314
462
  }
315
463
  };
464
+ /**
465
+ * Restores the edit state of the tree grid content. This method calls the
466
+ * base class method to handle the restoration logic.
467
+ *
468
+ * @returns {void} This method does not return any value.
469
+ */
316
470
  VirtualTreeContentRenderer.prototype.restoreEditState = function () {
317
471
  var restoreEdit = 'restoreEdit';
318
472
  _super.prototype["" + restoreEdit].call(this);
319
473
  };
474
+ /**
475
+ * Resets the edit state if certain conditions are met.
476
+ *
477
+ * @returns {void}
478
+ */
320
479
  VirtualTreeContentRenderer.prototype.resetIseditValue = function () {
321
480
  var resetIsEdit = 'resetIsedit';
322
481
  var isAdd = 'isAdd';
@@ -325,6 +484,12 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
325
484
  _super.prototype["" + resetIsEdit].call(this);
326
485
  }
327
486
  };
487
+ /**
488
+ * Handles the successful editing operation when virtual scrolling is enabled.
489
+ * Checks if a row has been added to the tree grid and sets the `recordAdded` flag accordingly.
490
+ *
491
+ * @returns {void}
492
+ */
328
493
  VirtualTreeContentRenderer.prototype.virtualEditSuccess = function () {
329
494
  var isAdd = 'isAdd';
330
495
  var content = this.parent.getContent().querySelector('.e-content');
@@ -332,14 +497,33 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
332
497
  this.recordAdded = true;
333
498
  }
334
499
  };
500
+ /**
501
+ * Cancels the edit operation for the provided data.
502
+ *
503
+ * @param {Object} args - The arguments containing the data to cancel edit for.
504
+ * @param {Object} args.data - The specific data object for which the edit operation needs to be canceled.
505
+ * @returns {void}
506
+ */
335
507
  VirtualTreeContentRenderer.prototype.cancelEdit = function (args) {
336
508
  var editCancel = 'editCancel';
337
509
  _super.prototype["" + editCancel].call(this, args);
338
510
  };
511
+ /**
512
+ * Handles the action of selecting a row when the context menu is opened.
513
+ *
514
+ * @param {Object} args - An object containing related parameters.
515
+ * @param {boolean} args.isOpen - A flag indicating whether the context menu is open.
516
+ * @returns {void} This method does not return any value.
517
+ */
339
518
  VirtualTreeContentRenderer.prototype.toSelectRowOnContextOpen = function (args) {
340
519
  var selectRowOnContextOpen = 'selectRowOnContextOpen';
341
520
  _super.prototype["" + selectRowOnContextOpen].call(this, args);
342
521
  };
522
+ /**
523
+ * Restores a new row in the grid when necessary by adding it back to the content.
524
+ *
525
+ * @returns {void} This method does not return any value.
526
+ */
343
527
  VirtualTreeContentRenderer.prototype.restoreNewRow = function () {
344
528
  var isAdd = 'isAdd';
345
529
  var content = this.parent.getContent().querySelector('.e-content');
@@ -348,10 +532,41 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
348
532
  this.parent.editModule.addRecord(null, this.parent.root.editModule.selectedIndex);
349
533
  }
350
534
  };
535
+ /**
536
+ * Retrieves virtual data for operations like adding or canceling rows in the grid.
537
+ *
538
+ * @param {Object} data - An object containing properties to determine the virtual data processing.
539
+ * @param {Object} data.virtualData - The virtual data object to be processed.
540
+ * @param {boolean} data.isAdd - A boolean indicating if the operation is an addition.
541
+ * @param {boolean} data.isCancel - A boolean indicating if the operation is a cancellation.
542
+ * @returns {void} This method does not return any value.
543
+ */
351
544
  VirtualTreeContentRenderer.prototype.getData = function (data) {
352
545
  var getVirtualData = 'getVirtualData';
353
546
  _super.prototype["" + getVirtualData].call(this, data);
354
547
  };
548
+ /**
549
+ * Initiates the beginning of an action within the tree grid component.
550
+ * This method is invoked before any action is performed, allowing for
551
+ * any necessary modifications or cancellations of the upcoming action.
552
+ *
553
+ * @param {NotifyArgs} args - The arguments associated with the action,
554
+ * providing context and specifics about what is being commenced.
555
+ * @returns {void}
556
+ */
557
+ VirtualTreeContentRenderer.prototype.handleActionBegin = function (args) {
558
+ var actionBegin = 'actionBegin';
559
+ _super.prototype["" + actionBegin].call(this, args);
560
+ };
561
+ /**
562
+ * Handles the completion of various actions, such as adding a new row.
563
+ * Updates row positions and indexes based on the action completed.
564
+ *
565
+ * @param {NotifyArgs} args - An object containing the details of the completed action.
566
+ * Specifically, it includes the `requestType` which determines the type
567
+ * of action that was completed.
568
+ * @returns {void} This method does not return any value.
569
+ */
355
570
  VirtualTreeContentRenderer.prototype.onActionComplete = function (args) {
356
571
  if (args.requestType === 'add') {
357
572
  var addArgs = { newRowPosition: this.rowPosition, addRowIndex: this.addRowIndex, dataRowIndex: this.dataRowIndex };
@@ -363,6 +578,19 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
363
578
  var actionComplete = 'actionComplete';
364
579
  _super.prototype["" + actionComplete].call(this, args);
365
580
  };
581
+ /**
582
+ * Creates a callback function to be executed during virtual scrolling actions.
583
+ * This function handles the adjustment of virtual elements and rendering logic,
584
+ * particularly optimizing for non-IE browsers, wheel events, and virtual masks.
585
+ *
586
+ * @returns {Function} A function that handles scrolling and adjusts table rendering.
587
+ * @param {HTMLElement} element - The HTML element involved in the action.
588
+ * @param {SentinelType} current - The type of sentinel indicating the scroll.
589
+ * @param {string} direction - The scroll direction.
590
+ * @param {Offsets} e - The offset values indicating the current scroll position.
591
+ * @param {boolean} isWheel - Indicates if the scrolling was initiated by a mouse wheel.
592
+ * @param {boolean} check - A boolean flag for additional control logic.
593
+ */
366
594
  VirtualTreeContentRenderer.prototype.onEnteredAction = function () {
367
595
  var _this = this;
368
596
  return function (element, current, direction, e, isWheel, check) {
@@ -405,8 +633,17 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
405
633
  }
406
634
  };
407
635
  };
636
+ /**
637
+ * Handles scroll events to manage virtual scrolling and row rendering.
638
+ * Adjusts view information, row indexes, and translates viewport positioning
639
+ * based on the given scroll arguments.
640
+ *
641
+ * @param {ScrollArg} scrollArgs - Contains the scroll offsets, sentinel information, direction of scroll, and other related details.
642
+ * @returns {void} - No return value. It adjusts scrolling state internally.
643
+ */
408
644
  VirtualTreeContentRenderer.prototype.scrollListeners = function (scrollArgs) {
409
645
  this['scrollAfterEdit']();
646
+ this.shouldPreventScrolling(scrollArgs);
410
647
  if (this.parent.root.enablePersistence) {
411
648
  this.parent.root.scrollPosition = scrollArgs.offset;
412
649
  }
@@ -426,9 +663,11 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
426
663
  if (upScroll && (scrollArgs.direction !== 'right' && scrollArgs.direction !== 'left') && !isNullOrUndefined(content)) {
427
664
  var vHeight = +(this.parent.height.toString().indexOf('%') < 0 ? parseInt(this.parent.height.toString(), 10) :
428
665
  this.parent.element.getBoundingClientRect().height);
429
- var index = (~~(content.scrollTop / rowHeight)
430
- + Math.ceil(vHeight / rowHeight))
431
- - this.parent.pageSettings.pageSize;
666
+ // Calculate the integer number of rows that are scrolled past plus the number of rows that fit within the visible height
667
+ var scrolledRows = Math.floor(content.scrollTop / rowHeight);
668
+ var visibleRows = Math.ceil(vHeight / rowHeight);
669
+ // Calculate the index by subtracting the page size from the total rows taken into account
670
+ var index = scrolledRows + visibleRows - this.parent.pageSettings.pageSize;
432
671
  index = (index > 0) ? index : 0;
433
672
  if (!isNullOrUndefined(this["" + selectedRowIndex]) && this["" + selectedRowIndex] !== -1 && index !== this["" + selectedRowIndex] &&
434
673
  ((this.parent.rowHeight * this.parent.pageSettings.pageSize) < content.scrollTop) && !this.parent.allowRowDragAndDrop) {
@@ -505,20 +744,19 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
505
744
  this.parent.selectionModule && this.parent.selectionModule.isRowSelected) {
506
745
  this.startIndex = currentViewData[0]["" + indexValue] + (this.parent.pageSettings.pageSize / 2);
507
746
  }
508
- if (this.parent.root.isSelfReference) {
509
- var selectedIndex = this.parent.root.selectedRowIndex;
510
- this.startIndex = selectedIndex !== -1 && selectedIndex !== this.startIndex ? this.startIndex - 1 : this.startIndex;
511
- }
512
747
  if (scrollArgs.offset.top > (rowHeight * this.totalRecords)) {
513
748
  this.translateY = this.getTranslateY(scrollArgs.offset.top, content.getBoundingClientRect().height);
514
749
  }
515
750
  else {
516
751
  if (this.totalRecords === this.endIndex) {
517
- if (isLastBlock) {
518
- this.translateY = (this.totalRecords * rowHeight) - (this.parent.pageSettings.pageSize * rowHeight);
519
- }
520
- else {
521
- this.translateY = (this.totalRecords * rowHeight) - ((this.endIndex - this.startIndex) * rowHeight);
752
+ if (this.totalRecords === this.endIndex) {
753
+ if (this.parent.isEdit) {
754
+ this.translateY = ((this.totalRecords * rowHeight) - (this.parent.pageSettings.pageSize * rowHeight))
755
+ + rowHeight;
756
+ }
757
+ else {
758
+ this.translateY = (this.totalRecords * rowHeight) - (this.parent.pageSettings.pageSize * rowHeight);
759
+ }
522
760
  }
523
761
  }
524
762
  else {
@@ -531,24 +769,23 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
531
769
  }
532
770
  }
533
771
  }
534
- if (isRemoteData(this.parent) || ((downScroll && (scrollArgs.offset.top < (rowHeight * this.totalRecords)))
772
+ if (((downScroll && scrollArgs.direction !== 'up' && (scrollArgs.offset.top < (rowHeight * this.totalRecords)))
535
773
  || (upScroll)) || (scrollArgs.direction === 'right' || scrollArgs.direction === 'left') ||
536
774
  ((this.parent.dataSource instanceof DataManager && this.parent.dataSource.dataSource.url !== undefined
537
775
  && !this.parent.dataSource.dataSource.offline && this.parent.dataSource.dataSource.url !== '') && (downScroll || upScroll) || isCountRequired(this.parent))) {
538
776
  var viewInfo = this.currentInfo = getValue('getInfoFromView', this).apply(this, [scrollArgs.direction, info, scrollArgs.offset]);
539
777
  this.previousInfo = viewInfo;
540
- if (this.prevInfo && ((info.axis === 'Y' && this.prevInfo.blockIndexes.toString() === viewInfo.blockIndexes.toString())
778
+ if (this.prevInfo && viewInfo.event !== 'refresh-virtual-block' && ((info.axis === 'Y' && this.prevInfo.blockIndexes.toString() === viewInfo.blockIndexes.toString())
541
779
  || ((info.axis === 'X' && this.prevInfo.columnIndexes.toString() === viewInfo.columnIndexes.toString())
542
780
  || (this.parent.isFrozenGrid() && this.parent.getVisibleFrozenLeftCount() >= viewInfo.columnIndexes[0]
543
781
  && this.prevInfo.columnIndexes.toString().includes(viewInfo.columnIndexes.toString()))))) {
544
782
  this.parent.removeMaskRow();
545
- this.parent.notify('removeGanttShimmer', { requestType: 'hideShimmer' });
546
783
  if (Browser.isIE) {
547
784
  this.parent.hideSpinner();
548
785
  }
549
786
  this.requestType = this.requestType === 'virtualscroll' ? this['empty'] : this.requestType;
550
787
  if (info.axis === 'Y') {
551
- this['restoreEdit']();
788
+ this.restoreEditState();
552
789
  }
553
790
  return;
554
791
  }
@@ -576,9 +813,32 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
576
813
  }
577
814
  }
578
815
  };
816
+ /**
817
+ * Prevents scrolling under specific conditions related to adding a new row.
818
+ *
819
+ * @param {ScrollArg} scrollArgs - The scroll event arguments containing offset details.
820
+ * @returns {void}
821
+ */
822
+ VirtualTreeContentRenderer.prototype.shouldPreventScrolling = function (scrollArgs) {
823
+ var addedRow = this.parent.element.querySelector('.e-addedrow');
824
+ if (addedRow && this.rowPosition !== 'Top' && this.rowPosition !== 'Bottom' && scrollArgs.offset.top !== 0) {
825
+ this.parent.closeEdit();
826
+ return;
827
+ }
828
+ };
829
+ /**
830
+ * Appends content to the target element. Handles dynamic adjustments for remote data sources,
831
+ * frozen columns, and virtual scrolling.
832
+ *
833
+ * @param {HTMLElement} target - The target HTML element where content is to be appended.
834
+ * @param {DocumentFragment} newChild - The new content as a DocumentFragment to append.
835
+ * @param {NotifyArgs} e - Object containing information about the operation.
836
+ * @returns {void}
837
+ */
579
838
  VirtualTreeContentRenderer.prototype.appendContent = function (target, newChild, e) {
580
839
  if ((this.parent.dataSource instanceof DataManager && this.parent.dataSource.dataSource.url !== undefined
581
- && !this.parent.dataSource.dataSource.offline && this.parent.dataSource.dataSource.url !== '') || isCountRequired(this.parent) || isRemoteData(this.parent)) {
840
+ && !this.parent.dataSource.dataSource.offline && this.parent.dataSource.dataSource.url !== '') || isCountRequired(this.parent)
841
+ || (this.parent.isFrozenGrid() && (e.requestType === undefined || !isNullOrUndefined(e.virtualInfo) && (e.virtualInfo.direction === 'right' || e.virtualInfo.direction === 'left')))) {
582
842
  if (getValue('isExpandCollapse', e)) {
583
843
  this.isRemoteExpand = true;
584
844
  }
@@ -606,6 +866,9 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
606
866
  target.appendChild(newChild);
607
867
  var replace = 'replaceWith';
608
868
  this.getTable().querySelector('tbody')["" + replace](target);
869
+ if (e.requestType === 'virtualscroll' && e.virtualInfo.sentinelInfo.axis === 'Y') {
870
+ this.isExpandCollapse = false;
871
+ }
609
872
  if (!this.isExpandCollapse || this.translateY === 0) {
610
873
  this.translateY = this.translateY < 0 ? 0 : this.translateY;
611
874
  getValue('virtualEle', this).adjustTable(cOffset, this.translateY);
@@ -638,6 +901,12 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
638
901
  _super.prototype["" + ensureSelectedRowPosition].call(this);
639
902
  }
640
903
  };
904
+ /**
905
+ * Unsubscribes all event listeners to prevent memory leaks.
906
+ * This method is called when the component is being destroyed or when event listeners need to be cleaned up.
907
+ *
908
+ * @returns {void}
909
+ */
641
910
  VirtualTreeContentRenderer.prototype.removeEventListener = function () {
642
911
  if (this.parent.isDestroyed) {
643
912
  return;
@@ -658,6 +927,7 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
658
927
  this.parent.off('select-row-on-context-open', this.toSelectRowOnContextOpen);
659
928
  this.parent.off('refresh-virtual-editform-cells', this.refreshCell);
660
929
  this.parent.off('virtaul-cell-focus', this.cellFocus);
930
+ this.parent.off('virtual-scroll-edit', this.restoreEditState);
661
931
  };
662
932
  return VirtualTreeContentRenderer;
663
933
  }(VirtualContentRenderer));
@@ -672,6 +942,15 @@ var TreeInterSectionObserver = /** @class */ (function (_super) {
672
942
  _this.timer = 0;
673
943
  return _this;
674
944
  }
945
+ /**
946
+ * Sets up observers to monitor scroll events on a given container
947
+ * and its movable companion within a virtual grid setup.
948
+ *
949
+ * @param {Function} callback - Function to call when a scroll event is detected.
950
+ * @param {Function} onEnterCallback - Function to call when a specific event, like entering a region, is detected.
951
+ * @param {IGrid} instance - The grid instance that requires observation.
952
+ * @returns {void}
953
+ */
675
954
  TreeInterSectionObserver.prototype.observes = function (callback, onEnterCallback, instance) {
676
955
  var containerRect = 'containerRect';
677
956
  _super.prototype["" + containerRect] = getValue('options', this).container.getBoundingClientRect();
@@ -682,9 +961,23 @@ var TreeInterSectionObserver = /** @class */ (function (_super) {
682
961
  EventHandler.add(getValue('options', this).movableContainer, 'scroll', this.virtualScrollHandlers(callback, onEnterCallback, instance), this);
683
962
  }
684
963
  };
964
+ /**
965
+ * Clears the last known position.
966
+ *
967
+ * @returns {void} No value is returned from this function.
968
+ */
685
969
  TreeInterSectionObserver.prototype.clear = function () {
686
970
  this.lastPos = null;
687
971
  };
972
+ /**
973
+ * Handles virtual scrolling events and manages scroll direction and debouncing for rendering updates.
974
+ *
975
+ * @private
976
+ * @param {Function} callback - Function to call on scroll end.
977
+ * @param {Function} onEnterCallback - Function to call on entering a virtual scrolling area.
978
+ * @param {IGrid} instance - The grid instance on which virtual scrolling is being implemented.
979
+ * @returns {Function} - A function that processes scroll events.
980
+ */
688
981
  TreeInterSectionObserver.prototype.virtualScrollHandlers = function (callback, onEnterCallback, instance) {
689
982
  var _this = this;
690
983
  var delay = Browser.info.name === 'chrome' ? 200 : 100;