@syncfusion/ej2-treegrid 32.2.7 → 33.1.44

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.
@@ -1,5 +1,5 @@
1
1
  import { Property, merge, ChildProperty, Collection, isNullOrUndefined, Browser, removeClass, addClass, getValue, createElement, setValue, extend as extend$1, Internationalization, getEnumValue, compile, Component, L10n, EventHandler, KeyboardEvents, SanitizeHtmlHelper, Complex, Event, NotifyPropertyChanges, closest, setStyleAttribute, select, classList, debounce, remove } from '@syncfusion/ej2-base';
2
- import { Grid, Logger as Logger$1, detailLists, Clipboard, getObject, parentsUntil, Print as Print$1, templateCompiler, appendChildren, extend, CellRenderer, getUid, CellType, Freeze as Freeze$1, getNumberFormat, getActualProperties, iterateArrayOrObject, RowDropSettings as RowDropSettings$1, Reorder as Reorder$1, Resize as Resize$1, Scroll, RowDD as RowDD$1, VirtualRowModelGenerator, Filter as Filter$1, Data, ExportHelper, ExcelExport as ExcelExport$1, PdfExport as PdfExport$1, Page as Page$1, Toolbar as Toolbar$1, calculateAggregate, Aggregate as Aggregate$1, Sort as Sort$1, ColumnMenu as ColumnMenu$1, ContextMenu as ContextMenu$1, resetRowIndex, Edit as Edit$1, CommandColumn as CommandColumn$1, DetailRow as DetailRow$1, Cell, getVisiblePage, VirtualContentRenderer, InterSectionObserver, getTransformValues, RenderType, VirtualHeaderRenderer, VirtualScroll as VirtualScroll$1, ColumnChooser as ColumnChooser$1, getRowIndexFromElement, RowRenderer, InfiniteScroll as InfiniteScroll$1 } from '@syncfusion/ej2-grids';
2
+ import { Grid, Logger as Logger$1, detailLists, Clipboard, getObject, parentsUntil, Print as Print$1, templateCompiler, appendChildren, extend, CellRenderer, getUid, CellType, Freeze as Freeze$1, getNumberFormat, setEnableSeamlessScrolling, getActualProperties, iterateArrayOrObject, RowDropSettings as RowDropSettings$1, Reorder as Reorder$1, Resize as Resize$1, Scroll, RowDD as RowDD$1, VirtualRowModelGenerator, Filter as Filter$1, Data, ExportHelper, ExcelExport as ExcelExport$1, PdfExport as PdfExport$1, Page as Page$1, Toolbar as Toolbar$1, calculateAggregate, Aggregate as Aggregate$1, Sort as Sort$1, ColumnMenu as ColumnMenu$1, ContextMenu as ContextMenu$1, resetRowIndex, Edit as Edit$1, CommandColumn as CommandColumn$1, DetailRow as DetailRow$1, Cell, getVisiblePage, VirtualContentRenderer, InterSectionObserver, getTransformValues, RenderType, VirtualHeaderRenderer, VirtualScroll as VirtualScroll$1, ColumnChooser as ColumnChooser$1, getRowIndexFromElement, RowRenderer, InfiniteScroll as InfiniteScroll$1 } from '@syncfusion/ej2-grids';
3
3
  import { createCheckBox } from '@syncfusion/ej2-buttons';
4
4
  import { DataManager, ODataAdaptor, WebApiAdaptor, WebMethodAdaptor, CacheAdaptor, UrlAdaptor, Query, DataUtil, RemoteSaveAdaptor, Deferred, JsonAdaptor, Predicate as Predicate$1 } from '@syncfusion/ej2-data';
5
5
  import { showSpinner, hideSpinner, createSpinner } from '@syncfusion/ej2-popups';
@@ -3311,7 +3311,6 @@ var DataManipulation = /** @__PURE__ @class */ (function () {
3311
3311
  var results = dataObj instanceof DataManager ? dataObj.dataSource.json : dataObj;
3312
3312
  var count = isCountRequired(this.parent) ? getValue('count', this.parent.dataSource)
3313
3313
  : results.length;
3314
- var qry = new Query();
3315
3314
  var gridQuery = getObject('query', args);
3316
3315
  var filterQuery;
3317
3316
  var searchQuery;
@@ -3327,11 +3326,7 @@ var DataManipulation = /** @__PURE__ @class */ (function () {
3327
3326
  gridQuery = getValue('grid.renderModule.data', this.parent).filterQuery(gridQuery);
3328
3327
  gridQuery = getValue('grid.renderModule.data', this.parent).searchQuery(gridQuery);
3329
3328
  }
3330
- var fltrQuery = gridQuery.queries.filter(function (q) { return q.fn === 'onWhere'; });
3331
- var srchQuery = gridQuery.queries.filter(function (q) { return q.fn === 'onSearch'; });
3332
- qry.queries = fltrQuery.concat(srchQuery);
3333
- var filteredData = new DataManager(results).executeLocal(qry);
3334
- this.parent.notify('updateFilterRecs', { data: filteredData });
3329
+ this.parent.getData({ query: gridQuery, isFilter: true });
3335
3330
  results = this.dataResults.result;
3336
3331
  this.dataResults.result = null;
3337
3332
  if (this.parent.grid.aggregates.length > 0) {
@@ -3356,34 +3351,8 @@ var DataManipulation = /** @__PURE__ @class */ (function () {
3356
3351
  }
3357
3352
  if (this.parent.grid.sortSettings.columns.length > 0 || this.isSortAction) {
3358
3353
  this.isSortAction = false;
3359
- var parentData = this.parent.parentData;
3360
3354
  var query = getObject('query', args);
3361
- var srtQry = new Query();
3362
- for (var srt = this.parent.grid.sortSettings.columns.length - 1; srt >= 0; srt--) {
3363
- var getColumnByField = 'getColumnByField';
3364
- var col = this.parent.grid.renderModule.data["" + getColumnByField](this.parent.grid.
3365
- sortSettings.columns[parseInt(srt.toString(), 10)].field);
3366
- var compFun = col.sortComparer && isOffline(this.parent) ?
3367
- col.sortComparer.bind(col) :
3368
- this.parent.grid.sortSettings.columns[parseInt(srt.toString(), 10)].direction;
3369
- srtQry.sortBy(this.parent.grid.sortSettings.columns[parseInt(srt.toString(), 10)].field, compFun);
3370
- }
3371
- var modifiedData = new DataManager(parentData).executeLocal(srtQry);
3372
- if (this.parent.allowRowDragAndDrop && !isNullOrUndefined(this.parent.rowDragAndDropModule['draggedRecord']) &&
3373
- this.parent.rowDragAndDropModule['droppedRecord'].hasChildRecords && this.parent.rowDragAndDropModule['dropPosition'] !== 'middleSegment') {
3374
- var dragdIndex = modifiedData.indexOf(this.parent.rowDragAndDropModule['draggedRecord']);
3375
- modifiedData.splice(dragdIndex, 1);
3376
- var dropdIndex = modifiedData.indexOf(this.parent.rowDragAndDropModule['droppedRecord']);
3377
- if (this.parent.rowDragAndDropModule['droppedRecord'].hasChildRecords && this.parent.rowDragAndDropModule['dropPosition'] === 'topSegment') {
3378
- modifiedData.splice(dropdIndex, 0, this.parent.rowDragAndDropModule['draggedRecord']);
3379
- }
3380
- else if (this.parent.rowDragAndDropModule['dropPosition'] === 'bottomSegment') {
3381
- modifiedData.splice(dropdIndex + 1, 0, this.parent.rowDragAndDropModule['draggedRecord']);
3382
- }
3383
- }
3384
- var sortArgs = { modifiedData: modifiedData, filteredData: results, srtQry: srtQry };
3385
- this.parent.notify('createSort', sortArgs);
3386
- results = sortArgs.modifiedData;
3355
+ results = this.parent.getData({ query: query, isSort: true });
3387
3356
  this.dataResults.result = null;
3388
3357
  this.sortedData = results;
3389
3358
  this.parent.notify('updateModel', {});
@@ -4351,6 +4320,8 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4351
4320
  _this.isComponentRefresh = false;
4352
4321
  _this.isVirtualExpandCollapse = false;
4353
4322
  _this.isInfiniteCollapse = false;
4323
+ /** @hidden */
4324
+ _this.enableSeamlessScrolling = false;
4354
4325
  _this.objectEqualityChecker = function (old, current) {
4355
4326
  if (old) {
4356
4327
  var keys = Object.keys(old);
@@ -5098,7 +5069,15 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
5098
5069
  this.renderModule = new Render(this);
5099
5070
  this.dataModule = new DataManipulation(this);
5100
5071
  this.printModule = new Print(this);
5101
- this.trigger(load);
5072
+ if (this.enableVirtualization || this.enableColumnVirtualization) {
5073
+ var args = { enableSeamlessScrolling: this.enableSeamlessScrolling };
5074
+ this.trigger(load, args);
5075
+ this.enableSeamlessScrolling = args.enableSeamlessScrolling;
5076
+ setEnableSeamlessScrolling(this.enableSeamlessScrolling);
5077
+ }
5078
+ else {
5079
+ this.trigger(load);
5080
+ }
5102
5081
  this.autoGenerateColumns();
5103
5082
  this.initialRender = true;
5104
5083
  if (!isNullOrUndefined(this.dataSource)) {
@@ -5371,6 +5350,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
5371
5350
  this.grid.clipMode = getActualProperties(this.clipMode);
5372
5351
  this.grid.enableColumnSpan = this.enableColumnSpan;
5373
5352
  this.grid.enableRowSpan = this.enableRowSpan;
5353
+ this.grid.enableSeamlessScrolling = this.enableSeamlessScrolling;
5374
5354
  var templateInstance = 'templateDotnetInstance';
5375
5355
  this.grid["" + templateInstance] = this["" + templateInstance];
5376
5356
  var isJsComponent = 'isJsComponent';
@@ -5848,7 +5828,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
5848
5828
  }
5849
5829
  _this.notify('updateGridActions', args);
5850
5830
  _this.isVirtualExpandCollapse = false;
5851
- if (args.requestType === 'save' && _this.aggregates.map(function (ag) { return ag.showChildSummary === true; }).length) {
5831
+ if (args.requestType === 'save' && _this.aggregates.some(function (ag) { return ag.showChildSummary === true; })) {
5852
5832
  _this.grid.refresh();
5853
5833
  }
5854
5834
  if ((args.action === 'clearFilter' || args.action === 'clear-filter' || args.requestType === 'sorting') && _this.enableInfiniteScrolling) {
@@ -6594,6 +6574,115 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
6594
6574
  }
6595
6575
  }
6596
6576
  };
6577
+ /**
6578
+ * Retrieves all records that match the current search criteria and are sorted according to the active sort settings.
6579
+ *
6580
+ * This method processes the data source by applying search filters and sort operations,
6581
+ * returning the searched and sorted records excluding summary rows.
6582
+ *
6583
+ * @param {Object} args - Optional arguments object to control query execution behavior.
6584
+ * @param {Query} args.query - Optional custom Query object to override the default generated query.
6585
+ * @param {boolean} args.isFilter - Optional flag to include only filtered records without sorting (default: false).
6586
+ * @param {boolean} args.isSort - Optional flag to apply only sorting without filtering (default: false).
6587
+ *
6588
+ * @returns {ITreeData[]} - Array of searched and sorted TreeGrid records with summary rows excluded.
6589
+ * @hidden
6590
+ */
6591
+ TreeGrid.prototype.getData = function (args) {
6592
+ var dataObj = isCountRequired(this) ? getValue('result', this.grid.dataSource)
6593
+ : this.grid.dataSource;
6594
+ var results = dataObj instanceof DataManager ? dataObj.dataSource.json : dataObj;
6595
+ var gridQuery = (!isNullOrUndefined(args) && args.query) ? args.query : this.getDataModule().baseModule.generateQuery();
6596
+ var filterQuery;
6597
+ var searchQuery;
6598
+ if (!isNullOrUndefined(gridQuery)) {
6599
+ filterQuery = gridQuery.queries.filter(function (q) { return q.fn === 'onWhere'; });
6600
+ searchQuery = gridQuery.queries.filter(function (q) { return q.fn === 'onSearch'; });
6601
+ }
6602
+ var skipFilterSearch = (!isNullOrUndefined(args) && args.isSort);
6603
+ if (!skipFilterSearch && (this.grid.allowFiltering && this.grid.filterSettings.columns.length) ||
6604
+ (this.grid.searchSettings.key.length > 0) && (!isNullOrUndefined(gridQuery))
6605
+ || ((filterQuery && filterQuery.length > 0) || (searchQuery && searchQuery.length > 0))) {
6606
+ var filterQuery_1 = gridQuery.queries.filter(function (q) { return q.fn === 'onWhere'; });
6607
+ var searchQuery_1 = gridQuery.queries.filter(function (q) { return q.fn === 'onSearch'; });
6608
+ var query = new Query();
6609
+ query.queries = filterQuery_1.concat(searchQuery_1);
6610
+ var filteredData = new DataManager(results).executeLocal(query);
6611
+ this.notify('updateFilterRecs', { data: filteredData });
6612
+ results = isRemoteData(this) ? this.dataResults : this.filterModule.filteredResult;
6613
+ if (!isNullOrUndefined(args) && args.isFilter) {
6614
+ return isRemoteData(this) ? results.result.filter(function (item) { return !item.isSummaryRow; })
6615
+ : results.filter(function (item) { return !item.isSummaryRow; });
6616
+ }
6617
+ }
6618
+ var sortQuery = gridQuery.queries.filter(function (q) { return q.fn === 'onSortBy'; });
6619
+ if (this.grid.sortSettings.columns.length > 0 || sortQuery.length) {
6620
+ var parentData = this.parentData;
6621
+ var query = new Query();
6622
+ query.queries = sortQuery;
6623
+ var modifiedData = new DataManager(parentData).executeLocal(query);
6624
+ if (this.allowRowDragAndDrop && !isNullOrUndefined(this.rowDragAndDropModule['draggedRecord']) &&
6625
+ this.rowDragAndDropModule['droppedRecord'].hasChildRecords && this.rowDragAndDropModule['dropPosition'] !== 'middleSegment') {
6626
+ var dragdIndex = modifiedData.indexOf(this.rowDragAndDropModule['draggedRecord']);
6627
+ modifiedData.splice(dragdIndex, 1);
6628
+ var dropdIndex = modifiedData.indexOf(this.rowDragAndDropModule['droppedRecord']);
6629
+ if (this.rowDragAndDropModule['droppedRecord'].hasChildRecords && this.rowDragAndDropModule['dropPosition'] === 'topSegment') {
6630
+ modifiedData.splice(dropdIndex, 0, this.rowDragAndDropModule['draggedRecord']);
6631
+ }
6632
+ else if (this.rowDragAndDropModule['dropPosition'] === 'bottomSegment') {
6633
+ modifiedData.splice(dropdIndex + 1, 0, this.rowDragAndDropModule['draggedRecord']);
6634
+ }
6635
+ }
6636
+ var sortArgs = { modifiedData: modifiedData, filteredData: results, srtQry: query };
6637
+ this.notify('createSort', sortArgs);
6638
+ results = isRemoteData(this) ? this.dataResults : sortArgs.modifiedData;
6639
+ }
6640
+ return isRemoteData(this) ? this.dataResults.result.filter(function (item) { return !item.isSummaryRow; })
6641
+ : results.filter(function (item) { return !item.isSummaryRow; });
6642
+ };
6643
+ /**
6644
+ * Retrieves the processed Tree Grid data based on current operations such as
6645
+ * sorting, filtering, and searching. Maintains hierarchy and current structure.
6646
+ *
6647
+ * For local data: when skipPage is true (the default), it returns all available records;
6648
+ * when skipPage is false, it returns only the records for the current page.
6649
+ * For remote data: it always returns only the records for the current page.
6650
+ *
6651
+ * @param {boolean} skipPage - if set to false, returns only the records for the current page.
6652
+ * @returns {ITreeData[]} - Array of tree records (summary rows excluded).
6653
+ * @hidden
6654
+ */
6655
+ TreeGrid.prototype.getProcessedRecords = function (skipPage) {
6656
+ var _this = this;
6657
+ var result;
6658
+ if (skipPage !== true || isRemoteData(this)) {
6659
+ result = this.getData();
6660
+ var dm = new DataManager(result);
6661
+ var expanded = new Predicate$1('expanded', 'notequal', null).or('expanded', 'notequal', undefined);
6662
+ var parents_1 = dm.executeLocal(new Query().where(expanded));
6663
+ var visualData = parents_1.filter(function (e) {
6664
+ return getExpandStatus(_this, e);
6665
+ });
6666
+ var query = new Query();
6667
+ if (this.allowPaging || this.enableVirtualization || this.enableInfiniteScrolling) {
6668
+ var pageSize = this.grid.pageSettings.pageSize;
6669
+ var currentPage = this.grid.pageSettings.currentPage;
6670
+ if (visualData.length < (currentPage * pageSize)) {
6671
+ currentPage = (Math.floor(visualData.length / pageSize)) + ((visualData.length % pageSize) ? 1 : 0);
6672
+ currentPage = currentPage ? currentPage : 1;
6673
+ this.grid.setProperties({ pageSettings: { currentPage: currentPage } }, true);
6674
+ }
6675
+ var skip = pageSize * (currentPage - 1);
6676
+ query = query.skip(skip).take(pageSize);
6677
+ }
6678
+ dm.dataSource.json = visualData;
6679
+ result = dm.executeLocal(query);
6680
+ }
6681
+ else {
6682
+ result = this.getData();
6683
+ }
6684
+ return result;
6685
+ };
6597
6686
  /**
6598
6687
  * Retrieves all the TreeGrid row elements.
6599
6688
  *
@@ -6850,11 +6939,6 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
6850
6939
  rowData.hasChildRecords = record.hasChildRecords;
6851
6940
  rowData.parentUniqueID = record.parentUniqueID;
6852
6941
  rowData.expanded = record.expanded;
6853
- if (this.enableVirtualization) {
6854
- this.grid.selectionModule.selectedRowIndexes = this.grid.selectionModule.selectedRowIndexes.indexOf(record.index) === -1
6855
- && (this.selectedRowIndex >= 0 && this.selectedRowIndex !== record.index) ? [record.index] :
6856
- this.grid.selectionModule.selectedRowIndexes;
6857
- }
6858
6942
  this.grid.setRowData(key, rowData);
6859
6943
  var visibleRecords = this.getVisibleRecords();
6860
6944
  if (visibleRecords.length > 0 && key === (visibleRecords[visibleRecords.length - 1])["" + primaryKey]) {
@@ -10826,10 +10910,16 @@ var RowDD = /** @__PURE__ @class */ (function () {
10826
10910
  var droppedRecord = void 0;
10827
10911
  if (isNullOrUndefined(args.dropIndex)) {
10828
10912
  var primaryKeyField = this.parent.getPrimaryKeyFieldNames()[0];
10829
- var rowIndex = tObj.selectedRowIndex === -1 ?
10913
+ var rowIndex_1 = tObj.selectedRowIndex === -1 ?
10830
10914
  (this.parent.grid.getRowIndexByPrimaryKey(args.data[0]["" + primaryKeyField])) - 1
10831
10915
  : tObj.getSelectedRowIndexes()[0] - 1;
10832
- var record = tObj.getCurrentViewRecords()[parseInt(rowIndex.toString(), 10)];
10916
+ var record = void 0;
10917
+ if (this.parent.enableVirtualization) {
10918
+ record = tObj.getCurrentViewRecords().find(function (e) { return e.index === rowIndex_1; });
10919
+ }
10920
+ else {
10921
+ record = tObj.getCurrentViewRecords()[parseInt(rowIndex_1.toString(), 10)];
10922
+ }
10833
10923
  this.getParentData(record, args.data);
10834
10924
  }
10835
10925
  else {
@@ -11867,11 +11957,22 @@ var ExcelExport = /** @__PURE__ @class */ (function () {
11867
11957
  var query = new Query();
11868
11958
  if (!_this.isLocal()) {
11869
11959
  query = _this.generateQuery(query);
11870
- query.queries = _this.parent.grid.getDataModule().generateQuery().queries;
11871
- query = ExportHelper.getQuery(_this.parent.grid, data);
11872
- if (isNullOrUndefined(_this.parent.filterModule)) {
11873
- query.queries = query.queries.slice(1, 2);
11874
- query.params = query.params.slice(0, 0);
11960
+ var hasFilter = _this.parent.grid.filterSettings &&
11961
+ Array.isArray(_this.parent.grid.filterSettings.columns) &&
11962
+ _this.parent.grid.filterSettings.columns.length > 0;
11963
+ var hasSearch = _this.parent.grid.searchSettings &&
11964
+ typeof _this.parent.grid.searchSettings.key === 'string' &&
11965
+ _this.parent.grid.searchSettings.key.trim().length > 0;
11966
+ var hasSorting = _this.parent.grid.sortSettings &&
11967
+ Array.isArray(_this.parent.grid.sortSettings.columns) &&
11968
+ _this.parent.grid.sortSettings.columns.length > 0;
11969
+ if (hasFilter || hasSearch || hasSorting) {
11970
+ query.queries = _this.parent.grid.getDataModule().generateQuery().queries;
11971
+ query = ExportHelper.getQuery(_this.parent.grid, data);
11972
+ if (isNullOrUndefined(_this.parent.filterModule)) {
11973
+ query.queries = query.queries.slice(1, 2);
11974
+ query.params = query.params.slice(0, 0);
11975
+ }
11875
11976
  }
11876
11977
  setValue('query', query, property);
11877
11978
  }
@@ -11908,11 +12009,30 @@ var ExcelExport = /** @__PURE__ @class */ (function () {
11908
12009
  return query;
11909
12010
  };
11910
12011
  ExcelExport.prototype.manipulateExportProperties = function (property, dtSrc, queryResult) {
12012
+ var _this = this;
11911
12013
  //count not required for this query
11912
12014
  var args = Object();
11913
12015
  if (!isNullOrUndefined(this.parent.grid.getDataModule())) {
11914
12016
  setValue('query', this.parent.grid.getDataModule().generateQuery(true), args);
11915
12017
  }
12018
+ if (!this.isLocal() && !isNullOrUndefined(property) &&
12019
+ !isNullOrUndefined(property.isCollapsedStatePersist) &&
12020
+ property.isCollapsedStatePersist === false) {
12021
+ if (args.query && args.query.queries && args.query.queries.length) {
12022
+ args.query.queries = args.query.queries.filter(function (q) {
12023
+ if (q.fn === 'onWhere' && q.e) {
12024
+ var preds = q.e;
12025
+ if (preds && preds.field === _this.parent.parentIdMapping && (preds.value === null || preds.value === 'null')) {
12026
+ return false;
12027
+ }
12028
+ }
12029
+ return true;
12030
+ });
12031
+ }
12032
+ if (args.query && args.query.params && args.query.params.length) {
12033
+ args.query.params = args.query.params.filter(function (param) { return param.key !== 'IdMapping'; });
12034
+ }
12035
+ }
11916
12036
  setValue('isExport', true, args);
11917
12037
  if (!isNullOrUndefined(property) && !isNullOrUndefined(property.exportType)) {
11918
12038
  setValue('exportType', property.exportType, args);
@@ -12128,7 +12248,7 @@ var PdfExport = /** @__PURE__ @class */ (function () {
12128
12248
  };
12129
12249
  PdfExport.prototype.manipulatePdfProperties = function (prop, dtSrc, queryResult) {
12130
12250
  var _this = this;
12131
- var args = {};
12251
+ var args = Object();
12132
12252
  //count not required for this query
12133
12253
  var isLocal = !isRemoteData(this.parent) && isOffline(this.parent);
12134
12254
  setValue('query', this.parent.grid.getDataModule().generateQuery(true), args);
@@ -15274,7 +15394,11 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
15274
15394
  && this.parent.dataSource.dataSource.offline && this.parent.dataSource.dataSource.url !== '') || !isCountRequired(this.parent)) {
15275
15395
  this.parent["" + action]('data-ready', this.onDataReady, this);
15276
15396
  this.parent["" + action]('refresh-virtual-block', this.refreshContentRows, this);
15397
+ this.parent.on(destroy, this.destroy, this);
15277
15398
  this.fn = function () {
15399
+ if (_this.parent.root.enableSeamlessScrolling) {
15400
+ window.addEventListener('resize', _this.updateScrollbar.bind(_this));
15401
+ }
15278
15402
  _this.observers.observes(function (scrollArgs) { return _this.scrollListeners(scrollArgs); }, _this.onEnteredAction(), _this.parent);
15279
15403
  var gObj = _this.parent;
15280
15404
  if (gObj.root.enablePersistence && gObj.root.scrollPosition) {
@@ -15324,6 +15448,10 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
15324
15448
  var virtualCellFocus = 'virtualCellFocus';
15325
15449
  _super.prototype["" + virtualCellFocus].call(this, e);
15326
15450
  };
15451
+ VirtualTreeContentRenderer.prototype.updateScrollbar = function () {
15452
+ var updateScrollbarOnResize = 'updateScrollbarOnResize';
15453
+ _super.prototype["" + updateScrollbarOnResize].call(this);
15454
+ };
15327
15455
  /**
15328
15456
  * Handles the data ready event for the virtual tree grid content renderer.
15329
15457
  *
@@ -15364,9 +15492,6 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
15364
15492
  _super.prototype.renderTable.call(this);
15365
15493
  if (!(this.parent.dataSource instanceof DataManager && this.parent.dataSource.dataSource.url !== undefined
15366
15494
  && this.parent.dataSource.dataSource.offline && this.parent.dataSource.dataSource.url !== '') || !isCountRequired(this.parent)) {
15367
- if (this.observers) {
15368
- this.observers.disconnect();
15369
- }
15370
15495
  getValue('observer', this).options.debounceEvent = false;
15371
15496
  this.observers = new TreeInterSectionObserver(getValue('observer', this).element, getValue('observer', this).options);
15372
15497
  this.contents = this.getPanel().firstChild;
@@ -15447,7 +15572,7 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
15447
15572
  }
15448
15573
  var treeGridParent = this.parent.clipboardModule['treeGridParent'];
15449
15574
  if (isNullOrUndefined(treeGridParent.editModule) ||
15450
- isNullOrUndefined(treeGridParent.editModule['addRowIndex']) || args.selectedIndex !== 0) {
15575
+ isNullOrUndefined(treeGridParent.editModule['addRowIndex']) || args.selectedIndex !== -1) {
15451
15576
  if (!isNullOrUndefined(treeGridParent.grid.sortModule) && treeGridParent.grid.sortModule['sortedColumns'].length > 0) {
15452
15577
  var sortedData = treeGridParent.dataModule['sortedData'];
15453
15578
  if (!isNullOrUndefined(sortedData) && sortedData.length > 0) {
@@ -15747,16 +15872,28 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
15747
15872
  var maxLeft = _this.vgenerator.cOffsets[idx - 1];
15748
15873
  x = x > maxLeft ? maxLeft : x; //TODO: This fix horizontal scrollbar jumping issue in column virtualization.
15749
15874
  }
15750
- var y = _this.getTranslateY(e.top, height, xAxis && top_1 === e.top ? _this.prevInfo : undefined, true);
15875
+ var isRowScrollAction = _this.prevInfo && _this.prevInfo.page === 1 &&
15876
+ (direction !== _this.prevInfo.direction || direction !== _this.prevInfo.direction);
15877
+ var translateY = _this.getTranslateY(e.top, height, xAxis && top_1 === e.top ? _this.prevInfo : undefined, isRowScrollAction ? false : true);
15751
15878
  if (!_this.parent.isFrozenGrid() || _this.parent.enableVirtualMaskRow) {
15752
15879
  if (_this.parent.enableVirtualMaskRow) {
15753
15880
  var upScroll = (e.top - _this.translateY) < 0;
15754
- y = (Math.round(_this.translateY) > y && !upScroll) ? Math.round(_this.translateY) : y;
15755
- _this.virtualEle.adjustTable(x, y);
15881
+ translateY = (Math.round(_this.translateY) > translateY && !upScroll) ? Math.round(_this.translateY) : translateY;
15882
+ _this.virtualEle.adjustTable(x, translateY);
15756
15883
  }
15757
15884
  else {
15758
15885
  _this.virtualEle.adjustTable(x, _this.translateY);
15759
15886
  }
15887
+ var wrapperBottom = _this.virtualEle.wrapper.getBoundingClientRect().bottom;
15888
+ var contentBottom = _this.virtualEle.content.getBoundingClientRect().bottom;
15889
+ if (direction === 'up' && _this.prevInfo.page === Math.ceil(_this.getTotalBlocks() / 2) &&
15890
+ Math.round(wrapperBottom) < Math.round(contentBottom)) {
15891
+ var bottomGap = Math.round(contentBottom) - Math.round(wrapperBottom);
15892
+ var adjustedTranslateY = Math.min(translateY + bottomGap, _this.offsets[_this['maxBlock']]);
15893
+ if (adjustedTranslateY !== translateY) {
15894
+ _this.virtualEle.adjustTable(x, adjustedTranslateY);
15895
+ }
15896
+ }
15760
15897
  if (_this.parent.enableColumnVirtualization) {
15761
15898
  _this.header.virtualEle.adjustTable(x, 0);
15762
15899
  if (_this.parent.isFrozenGrid()) {
@@ -15873,6 +16010,9 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
15873
16010
  (this.parent.pageSettings.pageSize / 2) && (this.endIndex - nextSetResIndex) < (this.parent.pageSettings.pageSize / 2)) {
15874
16011
  this.startIndex = lastIndex - (this.parent.pageSettings.pageSize / 2);
15875
16012
  }
16013
+ if (this.totalRecords < this.parent.pageSettings.pageSize) {
16014
+ this.startIndex = 0;
16015
+ }
15876
16016
  if (scrollArgs.offset.top > (rowHeight * this.totalRecords)) {
15877
16017
  this.translateY = this.getTranslateY(scrollArgs.offset.top, content.getBoundingClientRect().height);
15878
16018
  }
@@ -16082,9 +16222,16 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
16082
16222
  this.parent.off('refresh-virtual-editform-cells', this.refreshCell);
16083
16223
  this.parent.off('virtaul-cell-focus', this.cellFocus);
16084
16224
  this.parent.off('virtual-scroll-edit', this.restoreEditState);
16085
- if (this.observers) {
16086
- this.observers.disconnect();
16225
+ this.parent.off(destroy, this.destroy);
16226
+ if (this.parent.root.enableSeamlessScrolling) {
16227
+ window.removeEventListener('resize', this.updateScrollbar);
16228
+ }
16229
+ };
16230
+ VirtualTreeContentRenderer.prototype.destroy = function () {
16231
+ if (this.parent.isDestroyed) {
16232
+ return;
16087
16233
  }
16234
+ this.removeEventListener();
16088
16235
  };
16089
16236
  return VirtualTreeContentRenderer;
16090
16237
  }(VirtualContentRenderer));
@@ -16098,6 +16245,9 @@ var TreeInterSectionObserver = /** @__PURE__ @class */ (function (_super) {
16098
16245
  _this.timer = 0;
16099
16246
  return _this;
16100
16247
  }
16248
+ TreeInterSectionObserver.prototype.onWheelEvent = function () {
16249
+ this.isWheeling = true;
16250
+ };
16101
16251
  /**
16102
16252
  * Sets up observers to monitor scroll events on a given container
16103
16253
  * and its movable companion within a virtual grid setup.
@@ -16110,28 +16260,28 @@ var TreeInterSectionObserver = /** @__PURE__ @class */ (function (_super) {
16110
16260
  TreeInterSectionObserver.prototype.observes = function (callback, onEnterCallback, instance) {
16111
16261
  var containerRect = 'containerRect';
16112
16262
  _super.prototype["" + containerRect] = getValue('options', this).container.getBoundingClientRect();
16113
- this.containerEl = getValue('options', this).container;
16114
- this.containerScrollHandler = this.virtualScrollHandlers(callback, onEnterCallback, instance);
16115
- EventHandler.add(this.containerEl, 'scroll', this.containerScrollHandler, this);
16116
- if (getValue('options', this).movableContainer) {
16117
- var movableContainerRect = 'movableContainerRect';
16118
- _super.prototype["" + movableContainerRect] = getValue('options', this).movableContainer.getBoundingClientRect();
16119
- this.movableContainerEl = getValue('options', this).movableContainer;
16120
- this.movableScrollHandler = this.virtualScrollHandlers(callback, onEnterCallback, instance);
16121
- EventHandler.add(this.movableContainerEl, 'scroll', this.movableScrollHandler, this);
16122
- }
16123
- };
16124
- TreeInterSectionObserver.prototype.disconnect = function () {
16125
- if (this.containerEl && this.containerScrollHandler) {
16126
- EventHandler.remove(this.containerEl, 'scroll', this.containerScrollHandler);
16127
- this.containerScrollHandler = null;
16263
+ var options = getValue('options', this);
16264
+ EventHandler.add(options.container, 'wheel', this.onWheelEvent, this);
16265
+ if (!isNullOrUndefined(options.horizontalScrollbar)) {
16266
+ EventHandler.add(options.horizontalScrollbar, 'wheel', this.onWheelEvent, this);
16267
+ EventHandler.add(options.horizontalScrollbar, 'scroll', this.onVirtualContentScrolling(), this);
16128
16268
  }
16129
- if (this.movableContainerEl && this.movableScrollHandler) {
16130
- EventHandler.remove(this.movableContainerEl, 'scroll', this.movableScrollHandler);
16131
- this.movableScrollHandler = null;
16269
+ if (!isNullOrUndefined(options.verticalScrollbar)) {
16270
+ EventHandler.add(options.verticalScrollbar, 'wheel', this.onWheelEvent, this);
16271
+ EventHandler.add(options.verticalScrollbar, 'scroll', this.onVirtualContentScrolling(), this);
16132
16272
  }
16133
- this.containerEl = null;
16134
- this.movableContainerEl = null;
16273
+ EventHandler.add(options.container, 'scroll', this.virtualScrollHandlers(callback, onEnterCallback, instance), this);
16274
+ };
16275
+ TreeInterSectionObserver.prototype.onVirtualContentScrolling = function () {
16276
+ var _this = this;
16277
+ return function (e) {
16278
+ if (e.target.classList.contains('e-virtual-vertical-scrollbar')) {
16279
+ getValue('options', _this).container.scrollTop = e.target.scrollTop;
16280
+ }
16281
+ if (e.target.classList.contains('e-virtual-horizontal-scrollbar')) {
16282
+ getValue('options', _this).container.scrollLeft = e.target.scrollLeft;
16283
+ }
16284
+ };
16135
16285
  };
16136
16286
  /**
16137
16287
  * Clears the last known position.
@@ -16177,6 +16327,12 @@ var TreeInterSectionObserver = /** @__PURE__ @class */ (function (_super) {
16177
16327
  direction = _this["" + options].prevLeft === left ? direction : _this["" + options].prevLeft < left ? 'right' : 'left';
16178
16328
  _this["" + options].prevTop = top;
16179
16329
  _this["" + options].prevLeft = left;
16330
+ if (!isNullOrUndefined(_this["" + options].verticalScrollbar)) {
16331
+ _this["" + options].verticalScrollbar.scrollTop = _this["" + options].container.scrollTop;
16332
+ }
16333
+ if (!isNullOrUndefined(_this["" + options].horizontalScrollbar)) {
16334
+ _this["" + options].horizontalScrollbar.scrollLeft = _this["" + options].container.scrollLeft;
16335
+ }
16180
16336
  var current = _this.sentinelInfo["" + direction];
16181
16337
  var delta = 0;
16182
16338
  _this.newPos = top;