@syncfusion/ej2-treegrid 19.3.44 → 19.3.48

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 (57) hide show
  1. package/CHANGELOG.md +39 -0
  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 +286 -93
  5. package/dist/es6/ej2-treegrid.es2015.js.map +1 -1
  6. package/dist/es6/ej2-treegrid.es5.js +322 -125
  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/batch-edit.js +19 -7
  13. package/src/treegrid/actions/crud-actions.js +1 -0
  14. package/src/treegrid/actions/edit.js +14 -7
  15. package/src/treegrid/actions/freeze-column.js +2 -1
  16. package/src/treegrid/actions/rowdragdrop.js +69 -46
  17. package/src/treegrid/actions/selection.js +29 -6
  18. package/src/treegrid/actions/virtual-scroll.js +15 -4
  19. package/src/treegrid/base/constant.d.ts +4 -0
  20. package/src/treegrid/base/constant.js +4 -0
  21. package/src/treegrid/base/treegrid-model.d.ts +8 -0
  22. package/src/treegrid/base/treegrid.d.ts +8 -0
  23. package/src/treegrid/base/treegrid.js +46 -17
  24. package/src/treegrid/renderer/render.js +9 -1
  25. package/src/treegrid/renderer/virtual-row-model-generator.d.ts +1 -0
  26. package/src/treegrid/renderer/virtual-row-model-generator.js +12 -0
  27. package/src/treegrid/renderer/virtual-tree-content-render.d.ts +2 -1
  28. package/src/treegrid/renderer/virtual-tree-content-render.js +102 -35
  29. package/styles/bootstrap-dark.css +1 -1
  30. package/styles/bootstrap.css +1 -1
  31. package/styles/bootstrap4.css +6 -1
  32. package/styles/bootstrap5-dark.css +32 -27
  33. package/styles/bootstrap5.css +32 -27
  34. package/styles/fabric-dark.css +1 -1
  35. package/styles/fabric.css +1 -1
  36. package/styles/highcontrast-light.css +1 -1
  37. package/styles/highcontrast.css +1 -1
  38. package/styles/material-dark.css +1 -1
  39. package/styles/material.css +1 -1
  40. package/styles/tailwind-dark.css +27 -27
  41. package/styles/tailwind.css +1 -1
  42. package/styles/treegrid/_bootstrap5-definition.scss +4 -4
  43. package/styles/treegrid/_layout.scss +1 -1
  44. package/styles/treegrid/_tailwind-definition.scss +4 -4
  45. package/styles/treegrid/bootstrap-dark.css +1 -1
  46. package/styles/treegrid/bootstrap.css +1 -1
  47. package/styles/treegrid/bootstrap4.css +6 -1
  48. package/styles/treegrid/bootstrap5-dark.css +32 -27
  49. package/styles/treegrid/bootstrap5.css +32 -27
  50. package/styles/treegrid/fabric-dark.css +1 -1
  51. package/styles/treegrid/fabric.css +1 -1
  52. package/styles/treegrid/highcontrast-light.css +1 -1
  53. package/styles/treegrid/highcontrast.css +1 -1
  54. package/styles/treegrid/material-dark.css +1 -1
  55. package/styles/treegrid/material.css +1 -1
  56. package/styles/treegrid/tailwind-dark.css +27 -27
  57. package/styles/treegrid/tailwind.css +1 -1
@@ -1,5 +1,5 @@
1
- import { Browser, ChildProperty, Collection, Complex, Component, Event, EventHandler, Internationalization, KeyboardEvents, L10n, NotifyPropertyChanges, Property, addClass, classList, closest, compile, createElement, extend, getEnumValue, getValue, isNullOrUndefined, merge, remove, removeClass, select, setValue } from '@syncfusion/ej2-base';
2
- import { Aggregate, Cell, CellType, Clipboard, ColumnChooser, ColumnMenu, CommandColumn, ContextMenu, DetailRow, Edit, ExcelExport, Filter, Freeze, Grid, InfiniteScroll, InterSectionObserver, Logger, Page, PdfExport, Print, RenderType, Reorder, Resize, RowDD, RowDropSettings, RowRenderer, Scroll, Sort, Toolbar, VirtualContentRenderer, VirtualRowModelGenerator, VirtualScroll, appendChildren, calculateAggregate, detailLists, extend as extend$1, getActualProperties, getObject, getUid, iterateArrayOrObject, parentsUntil, resetRowIndex, templateCompiler } from '@syncfusion/ej2-grids';
1
+ import { Browser, ChildProperty, Collection, Complex, Component, Event, EventHandler, Internationalization, KeyboardEvents, L10n, NotifyPropertyChanges, Property, addClass, classList, closest, compile, createElement, debounce, extend, getEnumValue, getValue, isNullOrUndefined, merge, remove, removeClass, select, setValue } from '@syncfusion/ej2-base';
2
+ import { Aggregate, Cell, CellType, Clipboard, ColumnChooser, ColumnMenu, CommandColumn, ContextMenu, DetailRow, Edit, ExcelExport, Filter, Freeze, Grid, InfiniteScroll, InterSectionObserver, Logger, Page, PdfExport, Print, RenderType, Reorder, Resize, RowDD, RowDropSettings, RowRenderer, Scroll, Sort, Toolbar, VirtualContentRenderer, VirtualHeaderRenderer, VirtualRowModelGenerator, VirtualScroll, appendChildren, calculateAggregate, detailLists, extend as extend$1, getActualProperties, getObject, getUid, iterateArrayOrObject, parentsUntil, resetRowIndex, templateCompiler } from '@syncfusion/ej2-grids';
3
3
  import { createCheckBox } from '@syncfusion/ej2-buttons';
4
4
  import { CacheAdaptor, DataManager, DataUtil, Deferred, JsonAdaptor, ODataAdaptor, Predicate, Query, RemoteSaveAdaptor, UrlAdaptor, WebApiAdaptor, WebMethodAdaptor } from '@syncfusion/ej2-data';
5
5
  import { createSpinner, hideSpinner, showSpinner } from '@syncfusion/ej2-popups';
@@ -447,6 +447,8 @@ var virtualColumnIndex = 'virtualColumnIndex';
447
447
  /** @hidden */
448
448
  var virtualActionArgs = 'virtual-action-args';
449
449
  /** @hidden */
450
+ var destroy = 'destroy';
451
+ /** @hidden */
450
452
  var dataListener = 'data-listener';
451
453
  /** @hidden */
452
454
  var indexModifier = 'index-modifier';
@@ -474,6 +476,8 @@ var rowsRemove = 'rows-remove';
474
476
  var rowdraging = 'row-draging';
475
477
  /** @hidden */
476
478
  var rowDropped = 'row-dropped';
479
+ /** @hidden */
480
+ var autoCol = 'auto-col';
477
481
 
478
482
  var __extends$4 = (undefined && undefined.__extends) || (function () {
479
483
  var extendStatics = function (d, b) {
@@ -1111,11 +1115,11 @@ var Selection = /** @__PURE__ @class */ (function () {
1111
1115
  var length = 0;
1112
1116
  if (!isNullOrUndefined(this.parent.filterModule) && this.parent.filterModule.filteredResult.length > 0) {
1113
1117
  var filterResult = this.parent.filterModule.filteredResult;
1114
- if (this.filteredList.length == 0) {
1118
+ if (this.filteredList.length === 0) {
1115
1119
  this.filteredList = filterResult;
1116
1120
  }
1117
1121
  else {
1118
- if (this.filteredList != filterResult) {
1122
+ if (this.filteredList !== filterResult) {
1119
1123
  this.filteredList = filterResult;
1120
1124
  }
1121
1125
  }
@@ -1207,6 +1211,9 @@ var Selection = /** @__PURE__ @class */ (function () {
1207
1211
  (!isNullOrUndefined(this.parent.filterModule) && this.parent.filterModule.filteredResult.length > 0))) {
1208
1212
  this.selectedItems.push(checkedRecord);
1209
1213
  }
1214
+ if (this.selectedItems.indexOf(checkedRecord) === -1 && this.parent.enableVirtualization && ((!isNullOrUndefined(this.parent.filterModule) && this.parent.filterModule.filteredResult.length > 0))) {
1215
+ this.selectedItems.push(checkedRecord);
1216
+ }
1210
1217
  if (this.selectedItems.indexOf(checkedRecord) === -1 && (!isNullOrUndefined(this.parent.filterModule) &&
1211
1218
  this.parent.filterModule.filteredResult.length === 0)) {
1212
1219
  this.selectedItems.push(checkedRecord);
@@ -1280,11 +1287,31 @@ var Selection = /** @__PURE__ @class */ (function () {
1280
1287
  childData = (!isNullOrUndefined(this.parent.filterModule) && this.parent.filterModule.filteredResult.length > 0) ?
1281
1288
  this.parent.getCurrentViewRecords() : this.parent.flatData;
1282
1289
  childData.forEach(function (record) {
1283
- if (record.hasChildRecords) {
1284
- _this.updateParentSelection(record);
1290
+ if (_this.parent.enableVirtualization) {
1291
+ if (record.hasChildRecords) {
1292
+ _this.updateParentSelection(record);
1293
+ }
1294
+ else {
1295
+ _this.updateSelectedItems(record, record.checkboxState);
1296
+ }
1297
+ var child = findChildrenRecords(record);
1298
+ child = _this.getFilteredChildRecords(child);
1299
+ for (var i = 0; i < child.length; i++) {
1300
+ if (child[i].hasChildRecords) {
1301
+ _this.updateParentSelection(child[i]);
1302
+ }
1303
+ else if (!(child[i].hasChildRecords) && !isNullOrUndefined(child[i])) {
1304
+ _this.updateSelectedItems(child[i], child[i].checkboxState);
1305
+ }
1306
+ }
1285
1307
  }
1286
1308
  else {
1287
- _this.updateSelectedItems(record, record.checkboxState);
1309
+ if (record.hasChildRecords) {
1310
+ _this.updateParentSelection(record);
1311
+ }
1312
+ else {
1313
+ _this.updateSelectedItems(record, record.checkboxState);
1314
+ }
1288
1315
  }
1289
1316
  });
1290
1317
  this.headerSelection();
@@ -1548,7 +1575,15 @@ var Render = /** @__PURE__ @class */ (function () {
1548
1575
  else {
1549
1576
  index = data.index;
1550
1577
  }
1551
- if (grid.getColumnIndexByUid(args.column.uid) === this.parent.treeColumnIndex && (args.requestType === 'add' || args.requestType
1578
+ var columnIndex;
1579
+ var getVirtualColIndexByUid = 'getVirtualColIndexByUid';
1580
+ if (this.parent.enableColumnVirtualization && !this.parent.initialRender) {
1581
+ columnIndex = this.parent[getVirtualColIndexByUid](args.column.uid);
1582
+ }
1583
+ else {
1584
+ columnIndex = grid.getColumnIndexByUid(args.column.uid);
1585
+ }
1586
+ if (columnIndex === this.parent.treeColumnIndex && (args.requestType === 'add' || args.requestType
1552
1587
  === 'rowDragAndDrop' || args.requestType === 'delete' || isNullOrUndefined(args.cell.querySelector('.e-treecell')))) {
1553
1588
  var container = createElement('div', { className: 'e-treecolumn-container' });
1554
1589
  var emptyExpandIcon = createElement('span', {
@@ -2732,6 +2767,7 @@ function editAction(details, control, isSelfReference, addRowIndex, selectedInde
2732
2767
  var childRecords = parentData ? parentData[control.childMapping] : [];
2733
2768
  for (var p = childRecords.length - 1; p >= 0; p--) {
2734
2769
  if (childRecords[p][control.idMapping] === currentData_1[control.idMapping]) {
2770
+ parentData['childRecords'].splice(p, 1);
2735
2771
  childRecords.splice(p, 1);
2736
2772
  if (!childRecords.length) {
2737
2773
  parentData.hasChildRecords = false;
@@ -3502,7 +3538,8 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
3502
3538
  member: 'ExcelExport', args: [this]
3503
3539
  });
3504
3540
  }
3505
- if (this.frozenColumns || this.frozenRows || this.getFrozenColumns() || this.grid.getFrozenLeftColumnsCount() || this.grid.getFrozenRightColumnsCount()) {
3541
+ if (this.frozenColumns || this.frozenRows || this.getFrozenColumns() ||
3542
+ this.grid.getFrozenLeftColumnsCount() || this.grid.getFrozenRightColumnsCount()) {
3506
3543
  modules.push({
3507
3544
  member: 'freeze', args: [this]
3508
3545
  });
@@ -3723,6 +3760,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
3723
3760
  this.grid.allowSorting = this.allowSorting;
3724
3761
  this.grid.allowFiltering = this.allowFiltering;
3725
3762
  this.grid.enableVirtualization = this.enableVirtualization;
3763
+ this.grid.enableColumnVirtualization = this.enableColumnVirtualization;
3726
3764
  this.grid.enableInfiniteScrolling = this.enableInfiniteScrolling;
3727
3765
  this.grid.infiniteScrollSettings = this.infiniteScrollSettings;
3728
3766
  this.grid.width = this.width;
@@ -4084,6 +4122,10 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4084
4122
  && (_this.grid.filterSettings.columns.length === 0 || _this.grid.searchSettings.key.length === 0)) {
4085
4123
  _this.notify('clearFilters', { flatData: _this.grid.dataSource });
4086
4124
  _this.grid.setProperties({ dataSource: _this.dataResults.result }, true);
4125
+ if (isNullOrUndefined(_this.grid['changedProperties'].dataSource)) {
4126
+ _this.grid.renderModule.data.dataManager = _this.grid.dataSource instanceof DataManager ? _this.grid.dataSource :
4127
+ (isNullOrUndefined(_this.grid.dataSource) ? new DataManager() : new DataManager(_this.grid.dataSource));
4128
+ }
4087
4129
  }
4088
4130
  var callBackPromise = new Deferred();
4089
4131
  _this.trigger(actionBegin, args, function (actionArgs) {
@@ -4109,7 +4151,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4109
4151
  _this.notify(batchSave, args);
4110
4152
  }
4111
4153
  _this.notify('updateGridActions', args);
4112
- if (args.requestType === 'save' && _this.aggregates.map(function (ag) { return ag.showChildSummary == true; }).length) {
4154
+ if (args.requestType === 'save' && _this.aggregates.map(function (ag) { return ag.showChildSummary === true; }).length) {
4113
4155
  _this.grid.refresh();
4114
4156
  }
4115
4157
  _this.trigger(actionComplete, args);
@@ -4405,6 +4447,9 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4405
4447
  case 'enableVirtualization':
4406
4448
  this.grid.enableVirtualization = this.enableVirtualization;
4407
4449
  break;
4450
+ case 'enableColumnVirtualization':
4451
+ this.grid.enableColumnVirtualization = this.enableColumnVirtualization;
4452
+ break;
4408
4453
  case 'toolbar':
4409
4454
  this.grid.toolbar = this.getGridToolbar();
4410
4455
  break;
@@ -4628,6 +4673,11 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4628
4673
  if (isNullOrUndefined(this.grid)) {
4629
4674
  return;
4630
4675
  }
4676
+ if (!isNullOrUndefined(this.rowDropSettings.targetID) &&
4677
+ isNullOrUndefined(document.getElementById(this.grid.rowDropSettings.targetID))) {
4678
+ document.getElementById(this.rowDropSettings.targetID).id = this.grid.rowDropSettings.targetID;
4679
+ this.rowDropSettings.targetID = this.grid.rowDropSettings.targetID;
4680
+ }
4631
4681
  _super.prototype.dataBind.call(this);
4632
4682
  this.grid.dataBind();
4633
4683
  };
@@ -4639,7 +4689,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4639
4689
  */
4640
4690
  TreeGrid.prototype.getPersistData = function () {
4641
4691
  var keyEntity = ['pageSettings', 'sortSettings',
4642
- 'filterSettings', 'columns', 'searchSettings', 'selectedRowIndex'];
4692
+ 'filterSettings', 'columns', 'searchSettings', 'selectedRowIndex', 'treeColumnIndex'];
4643
4693
  var ignoreOnPersist = {
4644
4694
  pageSettings: ['template', 'pageSizes', 'pageSizeMode', 'enableQueryString', 'totalRecordsCount', 'pageCount'],
4645
4695
  filterSettings: ['type', 'mode', 'showFilterBarStatus', 'immediateModeDelay', 'ignoreAccent', 'hierarchyMode'],
@@ -4650,9 +4700,9 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4650
4700
  'commandTemplate', 'commands', 'dataSource'];
4651
4701
  for (var i = 0; i < keyEntity.length; i++) {
4652
4702
  var currentObject = this[keyEntity[i]];
4653
- for (var _i = 0, _a = ignoreOnPersist[keyEntity[i]]; _i < _a.length; _i++) {
4654
- var val = _a[_i];
4655
- delete currentObject[val];
4703
+ for (var k = 0, val = ignoreOnPersist[keyEntity[i]]; (!isNullOrUndefined(val) && k < val.length); k++) {
4704
+ var objVal = val[k];
4705
+ delete currentObject[objVal];
4656
4706
  }
4657
4707
  }
4658
4708
  this.ignoreInArrays(ignoreOnColumn, this.columns);
@@ -5055,6 +5105,16 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
5055
5105
  TreeGrid.prototype.getColumnIndexByField = function (field) {
5056
5106
  return this.grid.getColumnIndexByField(field);
5057
5107
  };
5108
+ TreeGrid.prototype.getVirtualColIndexByUid = function (uid) {
5109
+ var columnModel = 'columnModel';
5110
+ var index = iterateArrayOrObject(this.grid[columnModel], function (item, index) {
5111
+ if (item.uid === uid) {
5112
+ return index;
5113
+ }
5114
+ return undefined;
5115
+ })[0];
5116
+ return !isNullOrUndefined(index) ? index : -1;
5117
+ };
5058
5118
  /**
5059
5119
  * Gets a column index by UID.
5060
5120
  *
@@ -5083,18 +5143,20 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
5083
5143
  temp = this.columnModel[this.treeColumnIndex].template;
5084
5144
  field = this.columnModel[this.treeColumnIndex].field;
5085
5145
  }
5086
- this.columnModel = [];
5087
5146
  var stackedHeader = false;
5088
5147
  var gridColumn;
5089
- for (var i = 0; i < gridColumns.length; i++) {
5090
- gridColumn = {};
5091
- for (var _i = 0, _a = Object.keys(gridColumns[i]); _i < _a.length; _i++) {
5092
- var prop = _a[_i];
5093
- gridColumn[prop] = gridColumns[i][prop];
5094
- }
5095
- this.columnModel.push(new Column(gridColumn));
5096
- if (field === this.columnModel[i].field && (!isNullOrUndefined(temp) && temp !== '')) {
5097
- this.columnModel[i].template = temp;
5148
+ if (!this.enableColumnVirtualization || (this.enableColumnVirtualization && this.columnModel.length === gridColumns.length)) {
5149
+ this.columnModel = [];
5150
+ for (var i = 0; i < gridColumns.length; i++) {
5151
+ gridColumn = {};
5152
+ for (var _i = 0, _a = Object.keys(gridColumns[i]); _i < _a.length; _i++) {
5153
+ var prop = _a[_i];
5154
+ gridColumn[prop] = gridColumns[i][prop];
5155
+ }
5156
+ this.columnModel.push(new Column(gridColumn));
5157
+ if (field === this.columnModel[i].field && (!isNullOrUndefined(temp) && temp !== '')) {
5158
+ this.columnModel[i].template = temp;
5159
+ }
5098
5160
  }
5099
5161
  }
5100
5162
  var merge$$1 = 'deepMerge';
@@ -5466,7 +5528,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
5466
5528
  var row = getObject('rows', rec);
5467
5529
  var record = getObject('records', rec);
5468
5530
  for (var i = 0; i < record.length; i++) {
5469
- if (record[i].parentItem != undefined) {
5531
+ if (record[i].parentItem !== undefined) {
5470
5532
  var pindex = this.flatData[record[i].parentItem.index].index;
5471
5533
  if (this.flatData[pindex].expanded === false) {
5472
5534
  record.push(this.flatData[pindex]);
@@ -6431,6 +6493,9 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
6431
6493
  __decorate([
6432
6494
  Property(false)
6433
6495
  ], TreeGrid.prototype, "enableVirtualization", void 0);
6496
+ __decorate([
6497
+ Property(false)
6498
+ ], TreeGrid.prototype, "enableColumnVirtualization", void 0);
6434
6499
  __decorate([
6435
6500
  Property(false)
6436
6501
  ], TreeGrid.prototype, "enableInfiniteScrolling", void 0);
@@ -7112,7 +7177,8 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
7112
7177
  var bottomRowSegment = middleRowSegment + divide;
7113
7178
  var mouseEvent = getObject('originalEvent.event', args);
7114
7179
  var touchEvent = getObject('originalEvent.event', args);
7115
- var posy = (mouseEvent.type == "mousemove") ? mouseEvent.pageY : ((!isNullOrUndefined(touchEvent) && !isNullOrUndefined(touchEvent.changedTouches)) ? touchEvent.changedTouches[0].pageY : null);
7180
+ var posy = (mouseEvent.type === 'mousemove') ? mouseEvent.pageY : ((!isNullOrUndefined(touchEvent) &&
7181
+ !isNullOrUndefined(touchEvent.changedTouches)) ? touchEvent.changedTouches[0].pageY : null);
7116
7182
  var isTopSegment = posy <= topRowSegment;
7117
7183
  var isMiddleRowSegment = (posy > topRowSegment && posy <= middleRowSegment);
7118
7184
  var isBottomRowSegment = (posy > middleRowSegment && posy <= bottomRowSegment);
@@ -7339,7 +7405,7 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
7339
7405
  }
7340
7406
  else {
7341
7407
  if (args.target && closest(args.target, '#' + tObj.rowDropSettings.targetID) || parentsUntil(args.target, 'e-treegrid') &&
7342
- parentsUntil(args.target, 'e-treegrid').id === tObj.rowDropSettings.targetID) {
7408
+ parentsUntil(args.target, 'e-treegrid').id === tObj.rowDropSettings.targetID || args.target && document.getElementById(tObj.rowDropSettings.targetID)) {
7343
7409
  setValue('dropPosition', this.dropPosition, args);
7344
7410
  tObj.trigger(rowDrop, args);
7345
7411
  if (!args.cancel && tObj.rowDropSettings.targetID) {
@@ -7480,7 +7546,7 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
7480
7546
  RowDD$$1.prototype.dropRows = function (args, isByMethod) {
7481
7547
  if (this.dropPosition !== 'Invalid' && !isRemoteData(this.parent)) {
7482
7548
  var tObj = this.parent;
7483
- var draggedRecord = void 0;
7549
+ var draggedRecord_2;
7484
7550
  var droppedRecord = void 0;
7485
7551
  if (isNullOrUndefined(args.dropIndex)) {
7486
7552
  var rowIndex = tObj.getSelectedRowIndexes()[0] - 1;
@@ -7512,76 +7578,93 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
7512
7578
  if (!isNullOrUndefined(this.parent.idMapping)) {
7513
7579
  dragRecords.reverse();
7514
7580
  }
7515
- for (var i = 0; i < dragLength; i++) {
7516
- draggedRecord = dragRecords[i];
7517
- this.draggedRecord = draggedRecord;
7518
- if (this.dropPosition !== 'Invalid') {
7581
+ var _loop_2 = function (i) {
7582
+ draggedRecord_2 = dragRecords[i];
7583
+ this_1.draggedRecord = draggedRecord_2;
7584
+ if (this_1.dropPosition !== 'Invalid') {
7519
7585
  if (!tObj.rowDropSettings.targetID || isByMethod) {
7520
- this.deleteDragRow();
7586
+ this_1.deleteDragRow();
7521
7587
  }
7522
- if (this.draggedRecord === this.droppedRecord) {
7523
- var correctIndex = this.getTargetIdx(args.target.offsetParent.parentElement);
7588
+ if (this_1.draggedRecord === this_1.droppedRecord) {
7589
+ var correctIndex = this_1.getTargetIdx(args.target.offsetParent.parentElement);
7524
7590
  if (isNaN(correctIndex)) {
7525
- correctIndex = this.getTargetIdx(args.target.parentElement);
7591
+ correctIndex = this_1.getTargetIdx(args.target.parentElement);
7526
7592
  }
7527
7593
  args.dropIndex = correctIndex;
7528
- droppedRecord = this.droppedRecord = this.parent.getCurrentViewRecords()[args.dropIndex];
7594
+ droppedRecord = this_1.droppedRecord = this_1.parent.getCurrentViewRecords()[args.dropIndex];
7529
7595
  }
7530
- var recordIndex1 = this.treeGridData.indexOf(droppedRecord);
7531
- this.dropAtTop(recordIndex1);
7532
- if (this.dropPosition === 'bottomSegment') {
7596
+ if (droppedRecord.parentItem || this_1.dropPosition === 'middleSegment') {
7597
+ var parentRecords = tObj.parentData;
7598
+ var newParentIndex = parentRecords.indexOf(this_1.draggedRecord);
7599
+ if (newParentIndex !== -1) {
7600
+ parentRecords.splice(newParentIndex, 1);
7601
+ }
7602
+ }
7603
+ var recordIndex1 = this_1.treeGridData.indexOf(droppedRecord);
7604
+ this_1.dropAtTop(recordIndex1);
7605
+ if (this_1.dropPosition === 'bottomSegment') {
7533
7606
  if (!droppedRecord.hasChildRecords) {
7534
- if (this.parent.parentIdMapping) {
7535
- this.treeData.splice(recordIndex1 + 1, 0, this.draggedRecord.taskData);
7607
+ if (this_1.parent.parentIdMapping) {
7608
+ this_1.treeData.splice(recordIndex1 + 1, 0, this_1.draggedRecord.taskData);
7536
7609
  }
7537
- this.treeGridData.splice(recordIndex1 + 1, 0, this.draggedRecord);
7610
+ this_1.treeGridData.splice(recordIndex1 + 1, 0, this_1.draggedRecord);
7538
7611
  }
7539
7612
  else {
7540
- count = this.getChildCount(droppedRecord, 0);
7541
- if (this.parent.parentIdMapping) {
7542
- this.treeData.splice(recordIndex1 + count + 1, 0, this.draggedRecord.taskData);
7613
+ count = this_1.getChildCount(droppedRecord, 0);
7614
+ if (this_1.parent.parentIdMapping) {
7615
+ this_1.treeData.splice(recordIndex1 + count + 1, 0, this_1.draggedRecord.taskData);
7543
7616
  }
7544
- this.treeGridData.splice(recordIndex1 + count + 1, 0, this.draggedRecord);
7617
+ this_1.treeGridData.splice(recordIndex1 + count + 1, 0, this_1.draggedRecord);
7545
7618
  }
7546
7619
  if (isNullOrUndefined(droppedRecord.parentItem)) {
7547
- delete draggedRecord.parentItem;
7548
- draggedRecord.level = 0;
7549
- if (this.parent.parentIdMapping) {
7550
- draggedRecord[this.parent.parentIdMapping] = null;
7620
+ delete draggedRecord_2.parentItem;
7621
+ draggedRecord_2.level = 0;
7622
+ if (this_1.parent.parentIdMapping) {
7623
+ draggedRecord_2[this_1.parent.parentIdMapping] = null;
7551
7624
  }
7552
7625
  }
7553
7626
  if (droppedRecord.parentItem) {
7554
- var rec = this.getChildrecordsByParentID(droppedRecord.parentUniqueID);
7627
+ var rec = this_1.getChildrecordsByParentID(droppedRecord.parentUniqueID);
7555
7628
  var childRecords = rec[0].childRecords;
7556
7629
  var droppedRecordIndex = childRecords.indexOf(droppedRecord) + 1;
7557
- childRecords.splice(droppedRecordIndex, 0, draggedRecord);
7558
- draggedRecord.parentItem = droppedRecord.parentItem;
7559
- draggedRecord.parentUniqueID = droppedRecord.parentUniqueID;
7560
- if (this.parent.parentIdMapping) {
7561
- draggedRecord[this.parent.parentIdMapping] = droppedRecord[this.parent.parentIdMapping];
7562
- draggedRecord.parentItem = droppedRecord.parentItem;
7563
- draggedRecord.level = droppedRecord.level;
7630
+ childRecords.splice(droppedRecordIndex, 0, draggedRecord_2);
7631
+ draggedRecord_2.parentItem = droppedRecord.parentItem;
7632
+ draggedRecord_2.parentUniqueID = droppedRecord.parentUniqueID;
7633
+ if (this_1.parent.parentIdMapping) {
7634
+ draggedRecord_2[this_1.parent.parentIdMapping] = droppedRecord[this_1.parent.parentIdMapping];
7635
+ draggedRecord_2.parentItem = droppedRecord.parentItem;
7636
+ draggedRecord_2.level = droppedRecord.level;
7564
7637
  }
7565
7638
  }
7566
- if (draggedRecord.hasChildRecords) {
7639
+ if (draggedRecord_2.hasChildRecords) {
7567
7640
  var level = 1;
7568
- this.updateChildRecordLevel(draggedRecord, level);
7569
- this.updateChildRecord(draggedRecord, recordIndex1 + count + 1);
7641
+ this_1.updateChildRecordLevel(draggedRecord_2, level);
7642
+ this_1.updateChildRecord(draggedRecord_2, recordIndex1 + count + 1);
7570
7643
  }
7571
7644
  }
7572
- this.dropMiddle(recordIndex1);
7645
+ this_1.dropMiddle(recordIndex1);
7573
7646
  }
7574
- if (isNullOrUndefined(draggedRecord.parentItem)) {
7647
+ if (isNullOrUndefined(draggedRecord_2.parentItem)) {
7575
7648
  var parentRecords = tObj.parentData;
7576
- var newParentIndex = parentRecords.indexOf(this.droppedRecord);
7577
- if (this.dropPosition === 'bottomSegment') {
7578
- parentRecords.splice(newParentIndex + 1, 0, draggedRecord);
7649
+ var newParentIndex = parentRecords.indexOf(this_1.droppedRecord);
7650
+ var nonRepeat_1 = 0;
7651
+ parentRecords.filter(function (e) {
7652
+ if (draggedRecord_2.uniqueID === e.uniqueID) {
7653
+ nonRepeat_1++;
7654
+ }
7655
+ });
7656
+ if (this_1.dropPosition === 'bottomSegment' && nonRepeat_1 === 0) {
7657
+ parentRecords.splice(newParentIndex + 1, 0, draggedRecord_2);
7579
7658
  }
7580
- else if (this.dropPosition === 'topSegment') {
7581
- parentRecords.splice(newParentIndex, 0, draggedRecord);
7659
+ else if (this_1.dropPosition === 'topSegment' && nonRepeat_1 === 0) {
7660
+ parentRecords.splice(newParentIndex, 0, draggedRecord_2);
7582
7661
  }
7583
7662
  }
7584
7663
  tObj.rowDragAndDropModule.refreshGridDataSource();
7664
+ };
7665
+ var this_1 = this;
7666
+ for (var i = 0; i < dragLength; i++) {
7667
+ _loop_2(i);
7585
7668
  }
7586
7669
  }
7587
7670
  };
@@ -7649,6 +7732,11 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
7649
7732
  draggedRecord.parentItem = parentItem;
7650
7733
  draggedRecord.parentUniqueID = droppedRecord.uniqueID;
7651
7734
  droppedRecord.childRecords.splice(droppedRecord.childRecords.length, 0, draggedRecord);
7735
+ var isSelfReference = 'isSelfReference';
7736
+ if (tObj[isSelfReference]) {
7737
+ droppedRecord[tObj.childMapping] = [];
7738
+ droppedRecord[tObj.childMapping].splice(droppedRecord[tObj.childMapping].length, 0, draggedRecord);
7739
+ }
7652
7740
  if (!isNullOrUndefined(draggedRecord) && !tObj.parentIdMapping && !isNullOrUndefined(droppedRecord.taskData[childItem])) {
7653
7741
  droppedRecord.taskData[tObj.childMapping].splice(droppedRecord.childRecords.length, 0, draggedRecord.taskData);
7654
7742
  }
@@ -7687,7 +7775,7 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
7687
7775
  }
7688
7776
  length = record.childRecords.length;
7689
7777
  for (var i = 0; i < length; i++) {
7690
- currentRecord = record.childRecords[i];
7778
+ currentRecord = getValue('uniqueIDCollection.' + record.childRecords[i].uniqueID, tObj);
7691
7779
  count++;
7692
7780
  tObj.flatData.splice(count, 0, currentRecord);
7693
7781
  setValue('uniqueIDCollection.' + currentRecord.uniqueID, currentRecord, this.parent);
@@ -7709,7 +7797,7 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
7709
7797
  }
7710
7798
  length = record.childRecords.length;
7711
7799
  for (var i = 0; i < length; i++) {
7712
- currentRecord = record.childRecords[i];
7800
+ currentRecord = getValue('uniqueIDCollection.' + record.childRecords[i].uniqueID, this.parent);
7713
7801
  var parentData = void 0;
7714
7802
  if (record.parentItem) {
7715
7803
  parentData = getParentData(this.parent, record.parentItem.uniqueID);
@@ -7979,7 +8067,19 @@ var TreeVirtualRowModelGenerator = /** @__PURE__ @class */ (function (_super) {
7979
8067
  TreeVirtualRowModelGenerator.prototype.getDatas = function (args) {
7980
8068
  this.visualData = args.data;
7981
8069
  };
8070
+ TreeVirtualRowModelGenerator.prototype.getDataInfo = function () {
8071
+ return _super.prototype.getData.call(this);
8072
+ };
7982
8073
  TreeVirtualRowModelGenerator.prototype.generateRows = function (data, notifyArgs) {
8074
+ var info = this.getDataInfo();
8075
+ if (!isNullOrUndefined(notifyArgs.virtualInfo)) {
8076
+ if (notifyArgs.virtualInfo.direction !== 'right' && notifyArgs.virtualInfo.direction !== 'left') {
8077
+ notifyArgs.virtualInfo.blockIndexes = info.blockIndexes;
8078
+ }
8079
+ else {
8080
+ notifyArgs.virtualInfo.blockIndexes = this.getBlockIndexes(notifyArgs.virtualInfo.page);
8081
+ }
8082
+ }
7983
8083
  if ((this.parent.dataSource instanceof DataManager && this.parent.dataSource.dataSource.url !== undefined
7984
8084
  && !this.parent.dataSource.dataSource.offline && this.parent.dataSource.dataSource.url !== '') || isCountRequired(this.parent)) {
7985
8085
  return _super.prototype.generateRows.call(this, data, notifyArgs);
@@ -9529,10 +9629,11 @@ var BatchEdit = /** @__PURE__ @class */ (function () {
9529
9629
  if (frozenCols && args.columnObject.index > frozenCols) {
9530
9630
  actualCellIndex = actualCellIndex + frozenCols;
9531
9631
  }
9532
- var freeze = (this.parent.getFrozenLeftColumnsCount() > 0 || this.parent.getFrozenRightColumnsCount() > 0) ? true : false;
9632
+ var freeze = (this.parent.getFrozenLeftColumnsCount() > 0 ||
9633
+ this.parent.getFrozenRightColumnsCount() > 0) ? true : false;
9533
9634
  if (freeze) {
9534
9635
  var colCount = this.parent.getFrozenLeftColumnsCount() + actualCellIndex;
9535
- if (colCount == this.parent.treeColumnIndex) {
9636
+ if (colCount === this.parent.treeColumnIndex) {
9536
9637
  this.parent.renderModule.cellRender({ data: args.rowData, cell: args.cell,
9537
9638
  column: this.parent.grid.getColumnByIndex(args.cell.cellIndex)
9538
9639
  });
@@ -9694,7 +9795,7 @@ var BatchEdit = /** @__PURE__ @class */ (function () {
9694
9795
  focusModule.getContent().matrix.current = [actualIndex, focusModule.getContent().matrix.current[1]];
9695
9796
  }
9696
9797
  };
9697
- BatchEdit.prototype.beforeBatchDelete = function () {
9798
+ BatchEdit.prototype.beforeBatchDelete = function (args) {
9698
9799
  if (!this.batchRecords.length) {
9699
9800
  this.batchRecords = extendArray(this.parent.grid.getCurrentViewRecords());
9700
9801
  this.currentViewRecords = extendArray(this.parent.grid.getCurrentViewRecords());
@@ -9704,9 +9805,19 @@ var BatchEdit = /** @__PURE__ @class */ (function () {
9704
9805
  var row = [];
9705
9806
  var records = [];
9706
9807
  var primarykey = this.parent.grid.getPrimaryKeyFieldNames()[0];
9707
- var data = this.parent.grid.getSelectedRecords()[this.parent.grid.getSelectedRecords().length - 1];
9708
- var childs = findChildrenRecords(data);
9709
- var uid = this.parent.getSelectedRows()[0].getAttribute('data-uid');
9808
+ var data;
9809
+ var childs;
9810
+ var uid;
9811
+ if (!isNullOrUndefined(args.row) && this.parent.getSelectedRows().indexOf(args.row) === -1) {
9812
+ data = args.rowData;
9813
+ childs = findChildrenRecords(data);
9814
+ uid = args.row.getAttribute('data-uid');
9815
+ }
9816
+ else {
9817
+ data = this.parent.grid.getSelectedRecords()[this.parent.grid.getSelectedRecords().length - 1];
9818
+ childs = findChildrenRecords(data);
9819
+ uid = this.parent.getSelectedRows()[0].getAttribute('data-uid');
9820
+ }
9710
9821
  var parentRowIndex = parseInt(this.parent.grid.getRowElementByUID(uid).getAttribute('aria-rowindex'), 10);
9711
9822
  if (childs.length) {
9712
9823
  var totalCount = parentRowIndex + childs.length;
@@ -9746,7 +9857,8 @@ var BatchEdit = /** @__PURE__ @class */ (function () {
9746
9857
  for (var i = 0; i < rows.length; i++) {
9747
9858
  rows[i].setAttribute('aria-rowindex', i.toString());
9748
9859
  }
9749
- var freeze = (this.parent.getFrozenLeftColumnsCount() > 0 || this.parent.getFrozenRightColumnsCount() > 0) ? true : false;
9860
+ var freeze = (this.parent.getFrozenLeftColumnsCount() > 0 ||
9861
+ this.parent.getFrozenRightColumnsCount() > 0) ? true : false;
9750
9862
  if (this.parent.frozenRows || this.parent.getFrozenColumns() || this.parent.frozenColumns || freeze) {
9751
9863
  var mRows = this.parent.grid.getMovableDataRows();
9752
9864
  var freezeRightRows = this.parent.grid.getFrozenRightDataRows();
@@ -10259,7 +10371,7 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
10259
10371
  if (args.action === 'f2') {
10260
10372
  this.recordDoubleClick(args);
10261
10373
  }
10262
- if (args.action == 'escape') {
10374
+ if (args.action === 'escape') {
10263
10375
  this.parent.closeEdit();
10264
10376
  }
10265
10377
  };
@@ -10370,12 +10482,13 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
10370
10482
  });
10371
10483
  }
10372
10484
  else {
10373
- var freeze = (this.parent.getFrozenLeftColumnsCount() > 0 || this.parent.getFrozenRightColumnsCount() > 0) ? true : false;
10485
+ var freeze = (this.parent.getFrozenLeftColumnsCount() > 0 ||
10486
+ this.parent.getFrozenRightColumnsCount() > 0) ? true : false;
10374
10487
  if (freeze) {
10375
- if (this.parent.getRows().indexOf(row_1) != -1) {
10488
+ if (this.parent.getRows().indexOf(row_1) !== -1) {
10376
10489
  rowIndex_1 = this.parent.getRows().indexOf(row_1);
10377
10490
  }
10378
- else if (this.parent.getFrozenRightRows().indexOf(row_1) != -1) {
10491
+ else if (this.parent.getFrozenRightRows().indexOf(row_1) !== -1) {
10379
10492
  rowIndex_1 = this.parent.getFrozenRightRows().indexOf(row_1);
10380
10493
  }
10381
10494
  else {
@@ -10442,7 +10555,8 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
10442
10555
  this.isOnBatch = false;
10443
10556
  }
10444
10557
  this.enableToolbarItems('save');
10445
- var freeze = (this.parent.getFrozenLeftColumnsCount() > 0 || this.parent.getFrozenRightColumnsCount() > 0) ? true : false;
10558
+ var freeze = (this.parent.getFrozenLeftColumnsCount() > 0 ||
10559
+ this.parent.getFrozenRightColumnsCount() > 0) ? true : false;
10446
10560
  if (freeze) {
10447
10561
  if (args.cell.closest('.e-frozen-left-header') || args.cell.closest('.e-frozen-left-content')) {
10448
10562
  mRow = this.parent.grid.getRows()[rowIndex];
@@ -10479,7 +10593,7 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
10479
10593
  type: 'save', column: this.parent.getColumnByField(args.columnName), data: args.rowData,
10480
10594
  previousData: args.previousValue, row: row, target: args.cell
10481
10595
  };
10482
- if (this.parent.aggregates.map(function (ag) { return ag.showChildSummary == true; }).length) {
10596
+ if (this.parent.aggregates.map(function (ag) { return ag.showChildSummary === true; }).length) {
10483
10597
  this.parent.grid.refresh();
10484
10598
  }
10485
10599
  this.parent.trigger(actionComplete, saveArgs);
@@ -10521,6 +10635,10 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
10521
10635
  }
10522
10636
  }
10523
10637
  setValue('uniqueIDCollection.' + data[i].uniqueID + '.index', i, this.parent);
10638
+ var adaptor = this.parent.dataSource.adaptor;
10639
+ if ((isRemoteData(this.parent) || adaptor instanceof RemoteSaveAdaptor)) {
10640
+ setValue('uniqueIDCollection.' + data[i].uniqueID, data[i], this.parent);
10641
+ }
10524
10642
  if (!data[i].level) {
10525
10643
  this.parent.parentData.push(data[i]);
10526
10644
  }
@@ -10640,7 +10758,8 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
10640
10758
  this.parent.grid.contentModule[r].splice(0, 1);
10641
10759
  this.parent.grid.contentModule[r].splice(rowObjectIndex, 0, newRowObject);
10642
10760
  }
10643
- var freeze = (this.parent.getFrozenLeftColumnsCount() > 0 || this.parent.getFrozenRightColumnsCount() > 0) ? true : false;
10761
+ var freeze = (this.parent.getFrozenLeftColumnsCount() > 0 ||
10762
+ this.parent.getFrozenRightColumnsCount() > 0) ? true : false;
10644
10763
  if (this.parent.frozenRows || this.parent.getFrozenColumns() || this.parent.frozenColumns || freeze) {
10645
10764
  var movableRows = this.parent.getMovableDataRows();
10646
10765
  var frows = 'freezeRows';
@@ -11207,9 +11326,9 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
11207
11326
  if (!(this.parent.dataSource instanceof DataManager && this.parent.dataSource.dataSource.url !== undefined
11208
11327
  && this.parent.dataSource.dataSource.offline && this.parent.dataSource.dataSource.url !== '') || !isCountRequired(this.parent)) {
11209
11328
  this.parent[action]('data-ready', this.onDataReady, this);
11210
- //this.parent[action]('refresh-virtual-block', this.refreshContentRows, this);
11329
+ this.parent[action]('refresh-virtual-block', this.refreshContentRows, this);
11211
11330
  this.fn = function () {
11212
- _this.observers.observes(function (scrollArgs) { return _this.scrollListeners(scrollArgs); });
11331
+ _this.observers.observes(function (scrollArgs) { return _this.scrollListeners(scrollArgs); }, _this.onEnteredAction());
11213
11332
  _this.parent.off('content-ready', _this.fn);
11214
11333
  };
11215
11334
  this.parent.addEventListener('dataBound', this.dataBoundEvent.bind(this));
@@ -11241,7 +11360,9 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
11241
11360
  && this.parent.dataSource.dataSource.offline && this.parent.dataSource.dataSource.url !== '') || !isCountRequired(this.parent)) {
11242
11361
  if (!isNullOrUndefined(e.count)) {
11243
11362
  this.totalRecords = e.count;
11244
- getValue('virtualEle', this).setVirtualHeight(this.parent.getRowHeight() * e.count, '100%');
11363
+ if (!this.parent.enableColumnVirtualization) {
11364
+ getValue('virtualEle', this).setVirtualHeight(this.parent.getRowHeight() * e.count, '100%');
11365
+ }
11245
11366
  }
11246
11367
  if ((!isNullOrUndefined(e.requestType) && e.requestType.toString() === 'collapseAll') || this.isDataSourceChanged) {
11247
11368
  this.contents.scrollTop = 0;
@@ -11299,6 +11420,10 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
11299
11420
  return;
11300
11421
  }
11301
11422
  var selectVirtualRow = 'selectVirtualRow';
11423
+ var containerRect = 'containerRect';
11424
+ if (isNullOrUndefined(this.observer[containerRect])) {
11425
+ this.observer[containerRect] = this.observers[containerRect];
11426
+ }
11302
11427
  _super.prototype[selectVirtualRow].call(this, args);
11303
11428
  };
11304
11429
  VirtualTreeContentRenderer.prototype.refreshCell = function (rowObj) {
@@ -11405,15 +11530,39 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
11405
11530
  var actionComplete$$1 = 'actionComplete';
11406
11531
  _super.prototype[actionComplete$$1].call(this, args);
11407
11532
  };
11533
+ VirtualTreeContentRenderer.prototype.onEnteredAction = function () {
11534
+ var _this = this;
11535
+ return function (element, current, direction, e, isWheel, check) {
11536
+ var directVirtualRender = 'directVirtualRender';
11537
+ if (!_this.parent[directVirtualRender]) { // with this property, columns are rendered without debouncing on horizontal scroll.
11538
+ var preventEvent = 'preventEvent';
11539
+ if (Browser.isIE && !isWheel && check && !_this[preventEvent]) {
11540
+ _this.parent.showSpinner();
11541
+ }
11542
+ var xAxis = current.axis === 'X';
11543
+ var x = _this.getColumnOffset(xAxis ? _this.vgenerator.getColumnIndexes()[0] - 1 : _this.prevInfo.columnIndexes[0]
11544
+ - 1);
11545
+ if (xAxis) {
11546
+ var idx = Object.keys(_this.vgenerator.cOffsets).length - _this.prevInfo.columnIndexes.length;
11547
+ var maxLeft = _this.vgenerator.cOffsets[idx - 1];
11548
+ x = x > maxLeft ? maxLeft : x; //TODO: This fix horizontal scrollbar jumping issue in column virtualization.
11549
+ }
11550
+ _this.virtualEle.adjustTable(x, _this.translateY);
11551
+ if (_this.parent.enableColumnVirtualization) {
11552
+ _this.header.virtualEle.adjustTable(x, 0);
11553
+ }
11554
+ }
11555
+ };
11556
+ };
11408
11557
  VirtualTreeContentRenderer.prototype.scrollListeners = function (scrollArgs) {
11409
11558
  var info = scrollArgs.sentinel;
11410
- var outBuffer = 10; //this.parent.pageSettings.pageSize - Math.ceil(this.parent.pageSettings.pageSize / 1.5);
11559
+ var outBuffer = this.parent.pageSettings.pageSize - Math.ceil(this.parent.pageSettings.pageSize / 2);
11411
11560
  var content = this.parent.getContent().querySelector('.e-content');
11412
11561
  var scrollHeight = outBuffer * this.parent.getRowHeight();
11413
11562
  var upScroll = (scrollArgs.offset.top - this.translateY) < 0;
11414
11563
  var downScroll = Math.ceil(scrollArgs.offset.top - this.translateY) >= scrollHeight;
11415
11564
  var selectedRowIndex = 'selectedRowIndex';
11416
- if (upScroll) {
11565
+ if (upScroll && (scrollArgs.direction !== 'right' && scrollArgs.direction !== 'left')) {
11417
11566
  var vHeight = +(this.parent.height.toString().indexOf('%') < 0 ? this.parent.height :
11418
11567
  this.parent.element.getBoundingClientRect().height);
11419
11568
  var index = (~~(content.scrollTop / this.parent.getRowHeight())
@@ -11450,7 +11599,7 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
11450
11599
  scrollArgs.offset.top - (outBuffer * height) + 10 : 0;
11451
11600
  }
11452
11601
  }
11453
- else if (downScroll) {
11602
+ else if (downScroll && (scrollArgs.direction !== 'right' && scrollArgs.direction !== 'left')) {
11454
11603
  var nextSetResIndex = ~~(content.scrollTop / this.parent.getRowHeight());
11455
11604
  var isLastBlock = (this[selectedRowIndex] + this.parent.pageSettings.pageSize) < this.totalRecords ? false : true;
11456
11605
  if (!isNullOrUndefined(this[selectedRowIndex]) && this[selectedRowIndex] !== -1 &&
@@ -11471,14 +11620,17 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
11471
11620
  this.translateY = scrollArgs.offset.top;
11472
11621
  }
11473
11622
  }
11474
- if ((downScroll && (scrollArgs.offset.top < (this.parent.getRowHeight() * this.totalRecords)))
11475
- || (upScroll)) {
11476
- var viewInfo = getValue('getInfoFromView', this).apply(this, [scrollArgs.direction, info, scrollArgs.offset]);
11623
+ if (((downScroll && (scrollArgs.offset.top < (this.parent.getRowHeight() * this.totalRecords)))
11624
+ || (upScroll)) || (scrollArgs.direction === 'right' || scrollArgs.direction === 'left')) {
11625
+ var viewInfo = this.currentInfo = getValue('getInfoFromView', this).apply(this, [scrollArgs.direction, info, scrollArgs.offset]);
11477
11626
  this.previousInfo = viewInfo;
11627
+ this.parent.setColumnIndexesInView(this.parent.enableColumnVirtualization ? viewInfo.columnIndexes : []);
11478
11628
  var page = viewInfo.loadNext && !viewInfo.loadSelf ? viewInfo.nextInfo.page : viewInfo.page;
11479
11629
  this.parent.setProperties({ pageSettings: { currentPage: page } }, true);
11480
- viewInfo.event = viewInfo.event === 'refresh-virtual-block' ? 'model-changed' : viewInfo.event;
11481
- this.parent.notify(viewInfo.event, { requestType: 'virtualscroll', focusElement: scrollArgs.focusElement });
11630
+ if (scrollArgs.direction !== 'right' && scrollArgs.direction !== 'left') {
11631
+ viewInfo.event = viewInfo.event === 'refresh-virtual-block' ? 'model-changed' : viewInfo.event;
11632
+ }
11633
+ this.parent.notify(viewInfo.event, { requestType: 'virtualscroll', virtualInfo: viewInfo, focusElement: scrollArgs.focusElement });
11482
11634
  }
11483
11635
  };
11484
11636
  VirtualTreeContentRenderer.prototype.appendContent = function (target, newChild, e) {
@@ -11495,7 +11647,14 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
11495
11647
  getValue('currentInfo', this) : e.virtualInfo;
11496
11648
  var cBlock = (info.columnIndexes[0]) - 1;
11497
11649
  var cOffset = this.getColumnOffset(cBlock);
11498
- this.virtualEle.setWrapperWidth(null, (Browser.isIE || Browser.info.name === 'edge'));
11650
+ var width = void 0;
11651
+ if (this.parent.enableColumnVirtualization) {
11652
+ this.header.virtualEle.adjustTable(cOffset, 0);
11653
+ var cIndex = info.columnIndexes;
11654
+ width = this.getColumnOffset(cIndex[cIndex.length - 1]) - this.getColumnOffset(cIndex[0] - 1) + '';
11655
+ this.header.virtualEle.setWrapperWidth(width);
11656
+ }
11657
+ this.virtualEle.setWrapperWidth(width, (Browser.isIE || Browser.info.name === 'edge'));
11499
11658
  target = this.parent.createElement('tbody');
11500
11659
  target.appendChild(newChild);
11501
11660
  var replace = 'replaceWith';
@@ -11507,8 +11666,12 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
11507
11666
  this.isExpandCollapse = false;
11508
11667
  }
11509
11668
  setValue('prevInfo', this.previousInfo ? this.previousInfo : info, this);
11669
+ if (e.requestType === 'virtualscroll' && e.virtualInfo.sentinelInfo.axis === 'X') {
11670
+ this.parent.notify(autoCol, {});
11671
+ }
11510
11672
  var focusCell = 'focusCell';
11511
11673
  var restoreAdd = 'restoreAdd';
11674
+ var ensureSelectedRowPosition = 'ensureSelectedRowPosition';
11512
11675
  _super.prototype[focusCell].call(this, e);
11513
11676
  var isAdd = 'isAdd';
11514
11677
  if (this[isAdd] && !this.parent.getContent().querySelector('.e-content').querySelector('.e-addedrow')) {
@@ -11524,6 +11687,7 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
11524
11687
  }
11525
11688
  this.restoreEditState();
11526
11689
  _super.prototype[restoreAdd].call(this);
11690
+ _super.prototype[ensureSelectedRowPosition].call(this);
11527
11691
  }
11528
11692
  };
11529
11693
  VirtualTreeContentRenderer.prototype.removeEventListener = function () {
@@ -11559,28 +11723,34 @@ var TreeInterSectionObserver = /** @__PURE__ @class */ (function (_super) {
11559
11723
  _this.timer = 0;
11560
11724
  return _this;
11561
11725
  }
11562
- TreeInterSectionObserver.prototype.observes = function (callback) {
11726
+ TreeInterSectionObserver.prototype.observes = function (callback, onEnterCallback) {
11563
11727
  var containerRect = 'containerRect';
11564
11728
  _super.prototype[containerRect] = getValue('options', this).container.getBoundingClientRect();
11565
- EventHandler.add(getValue('options', this).container, 'scroll', this.virtualScrollHandlers(callback), this);
11729
+ EventHandler.add(getValue('options', this).container, 'scroll', this.virtualScrollHandlers(callback, onEnterCallback), this);
11566
11730
  };
11567
11731
  TreeInterSectionObserver.prototype.clear = function () {
11568
11732
  this.lastPos = null;
11569
11733
  };
11570
- TreeInterSectionObserver.prototype.virtualScrollHandlers = function (callback) {
11734
+ TreeInterSectionObserver.prototype.virtualScrollHandlers = function (callback, onEnterCallback) {
11571
11735
  var _this = this;
11572
- var prevTop = 0;
11573
- var prevLeft = 0;
11736
+ var delay = Browser.info.name === 'chrome' ? 200 : 100;
11737
+ var options = 'options';
11738
+ var movableEle = 'movableEle';
11739
+ var element = 'element';
11740
+ var fromWheel = 'fromWheel';
11741
+ var debounced100 = debounce(callback, delay);
11742
+ var debounced50 = debounce(callback, 50);
11743
+ this[options].prevTop = this[options].prevLeft = 0;
11574
11744
  return function (e) {
11575
- var scrollTop = e.target.scrollTop;
11576
- var scrollLeft = e.target.scrollLeft;
11577
- var direction = prevTop < scrollTop ? 'down' : 'up';
11578
- direction = prevLeft === scrollLeft ? direction : prevLeft < scrollLeft ? 'right' : 'left';
11579
- prevTop = scrollTop;
11580
- prevLeft = scrollLeft;
11581
- var current = getValue('sentinelInfo', _this)[direction];
11745
+ var top = _this[options].movableContainer ? _this[options].container.scrollTop : e.target.scrollTop;
11746
+ var left = _this[options].movableContainer ? _this[options].scrollbar.scrollLeft : e.target.scrollLeft;
11747
+ var direction = _this[options].prevTop < top ? 'down' : 'up';
11748
+ direction = _this[options].prevLeft === left ? direction : _this[options].prevLeft < left ? 'right' : 'left';
11749
+ _this[options].prevTop = top;
11750
+ _this[options].prevLeft = left;
11751
+ var current = _this.sentinelInfo[direction];
11582
11752
  var delta = 0;
11583
- _this.newPos = scrollTop;
11753
+ _this.newPos = top;
11584
11754
  if (_this.lastPos != null) { // && newPos < maxScroll
11585
11755
  delta = _this.newPos - _this.lastPos;
11586
11756
  }
@@ -11589,19 +11759,35 @@ var TreeInterSectionObserver = /** @__PURE__ @class */ (function (_super) {
11589
11759
  clearTimeout(_this.timer);
11590
11760
  }
11591
11761
  _this.timer = setTimeout(_this.clear, 0);
11592
- /*if (this.options.axes.indexOf(current.axis) === -1) {
11593
- return;
11594
- }*/
11595
- /*if(delta > 45 || delta < -45){
11596
- this.isWheeling = true;
11597
- }*/
11598
11762
  if ((delta > 100 || delta < -100) && (e && e.preventDefault)) {
11599
11763
  e.returnValue = false;
11600
11764
  e.preventDefault();
11601
11765
  }
11602
- callback({ direction: direction, isWheel: _this.isWheeling,
11603
- sentinel: current, offset: { top: scrollTop, left: scrollLeft },
11604
- focusElement: document.activeElement });
11766
+ if (_this[options].axes.indexOf(current.axis) === -1) {
11767
+ return;
11768
+ }
11769
+ var check = _this.check(direction);
11770
+ if (current.entered && current.axis === 'X') {
11771
+ if (_this[movableEle] && (direction === 'right' || direction === 'left')) {
11772
+ onEnterCallback(_this[movableEle], current, direction, { top: top, left: left }, _this[fromWheel], check);
11773
+ }
11774
+ else {
11775
+ onEnterCallback(_this[element], current, direction, { top: top, left: left }, _this[fromWheel], check);
11776
+ }
11777
+ }
11778
+ if (check) {
11779
+ var fn = debounced100;
11780
+ if (current.axis === 'X') {
11781
+ fn = debounced50;
11782
+ fn({ direction: direction, sentinel: current, offset: { top: top, left: left },
11783
+ focusElement: document.activeElement });
11784
+ }
11785
+ else {
11786
+ callback({ direction: direction, sentinel: current, offset: { top: top, left: left },
11787
+ focusElement: document.activeElement });
11788
+ }
11789
+ }
11790
+ _this[fromWheel] = false;
11605
11791
  };
11606
11792
  };
11607
11793
  return TreeInterSectionObserver;
@@ -11655,8 +11841,12 @@ var VirtualScroll$1 = /** @__PURE__ @class */ (function () {
11655
11841
  * @returns {void}
11656
11842
  */
11657
11843
  VirtualScroll$$1.prototype.addEventListener = function () {
11844
+ if (this.parent.isDestroyed) {
11845
+ return;
11846
+ }
11658
11847
  this.parent.on(localPagedExpandCollapse, this.collapseExpandVirtualchilds, this);
11659
11848
  this.parent.on(pagingActions, this.virtualPageAction, this);
11849
+ this.parent.on(destroy, this.destroy, this);
11660
11850
  };
11661
11851
  /**
11662
11852
  * @hidden
@@ -11668,6 +11858,7 @@ var VirtualScroll$1 = /** @__PURE__ @class */ (function () {
11668
11858
  }
11669
11859
  this.parent.off(localPagedExpandCollapse, this.collapseExpandVirtualchilds);
11670
11860
  this.parent.off(pagingActions, this.virtualPageAction);
11861
+ this.parent.off(destroy, this.destroy);
11671
11862
  };
11672
11863
  VirtualScroll$$1.prototype.collapseExpandVirtualchilds = function (row) {
11673
11864
  this.parent.grid.notify(virtualActionArgs, { isExpandCollapse: true });
@@ -11723,7 +11914,7 @@ var VirtualScroll$1 = /** @__PURE__ @class */ (function () {
11723
11914
  var resourceCount = this.parent.getRows();
11724
11915
  var sIndex = visualData.indexOf(this.expandCollapseRec);
11725
11916
  var tempdata = visualData.slice(sIndex, sIndex + resourceCount.length);
11726
- if (tempdata.length < resourceCount.length && sIndex >= 0) {
11917
+ if (tempdata.length < resourceCount.length && sIndex >= 0 && startIndex !== 0) {
11727
11918
  sIndex = visualData.length - resourceCount.length;
11728
11919
  sIndex = sIndex > 0 ? sIndex : 0;
11729
11920
  startIndex = sIndex;
@@ -11734,17 +11925,17 @@ var VirtualScroll$1 = /** @__PURE__ @class */ (function () {
11734
11925
  endIndex = this.parent.grid.pageSettings.pageSize - 1;
11735
11926
  this.parent.grid.notify(virtualActionArgs, { setTop: true });
11736
11927
  }
11737
- this.expandCollapseRec = null;
11738
11928
  }
11739
11929
  //}
11740
- if (!isNullOrUndefined(this.expandCollapseRec) && this.parent.enableCollapseAll) {
11930
+ if ((this.parent.enableCollapseAll || this.parent.expandStateMapping) && !isNullOrUndefined(this.expandCollapseRec)) {
11741
11931
  if (pageingDetails.count < this.parent.getRows()[0].getBoundingClientRect().height) {
11742
- startIndex = visualData[0].index;
11932
+ startIndex = 0;
11743
11933
  }
11744
11934
  else {
11745
11935
  startIndex = this.prevstartIndex === -1 ? 0 : this.prevstartIndex;
11746
11936
  }
11747
11937
  }
11938
+ this.expandCollapseRec = null;
11748
11939
  pageingDetails.result = visualData.slice(startIndex, endIndex);
11749
11940
  this.prevstartIndex = startIndex;
11750
11941
  this.prevendIndex = endIndex;
@@ -11774,8 +11965,13 @@ var TreeVirtual = /** @__PURE__ @class */ (function (_super) {
11774
11965
  return 'treeVirtualScroll';
11775
11966
  };
11776
11967
  TreeVirtual.prototype.instantiateRenderers = function () {
11968
+ var parentGrid = getValue('parent', this);
11777
11969
  getValue('parent', this).log(['limitation', 'virtual_height'], 'virtualization');
11778
11970
  var renderer = getValue('locator', this).getService('rendererFactory');
11971
+ if (parentGrid.enableColumnVirtualization) {
11972
+ getValue('addRenderer', renderer)
11973
+ .apply(renderer, [RenderType.Header, new VirtualHeaderRenderer(getValue('parent', this), getValue('locator', this))]);
11974
+ }
11779
11975
  getValue('addRenderer', renderer)
11780
11976
  .apply(renderer, [RenderType.Content, new VirtualTreeContentRenderer(getValue('parent', this), getValue('locator', this))]);
11781
11977
  //renderer.addRenderer(RenderType.Content, new VirtualTreeContentRenderer(getValue('parent', this), getValue('locator', this)));
@@ -11831,7 +12027,8 @@ var Freeze$1 = /** @__PURE__ @class */ (function () {
11831
12027
  var frozenrows = this.parent.getRows();
11832
12028
  var rows;
11833
12029
  var frozenRightRows;
11834
- var freeze = (this.parent.getFrozenLeftColumnsCount() > 0 || this.parent.getFrozenRightColumnsCount() > 0) ? true : false;
12030
+ var freeze = (this.parent.getFrozenLeftColumnsCount() > 0 ||
12031
+ this.parent.getFrozenRightColumnsCount() > 0) ? true : false;
11835
12032
  if (freeze) {
11836
12033
  frozenRightRows = this.parent.getFrozenRightRows().filter(function (e) {
11837
12034
  return e.querySelector('.e-gridrowindex' + args.record.index + 'level' + (args.record.level + 1));
@@ -12257,5 +12454,5 @@ var InfiniteScroll$1 = /** @__PURE__ @class */ (function () {
12257
12454
  * Export TreeGrid component
12258
12455
  */
12259
12456
 
12260
- export { TreeGrid, load, rowDataBound, dataBound, queryCellInfo, beforeDataBound, actionBegin, dataStateChange, actionComplete, rowSelecting, rowSelected, checkboxChange, rowDeselected, toolbarClick, beforeExcelExport, beforePdfExport, resizeStop, expanded, expanding, collapsed, collapsing, remoteExpand, localPagedExpandCollapse, pagingActions, printGridInit, contextMenuOpen, contextMenuClick, beforeCopy, beforePaste, savePreviousRowPosition, crudAction, beginEdit, beginAdd, recordDoubleClick, cellSave, cellSaved, cellEdit, batchDelete, batchCancel, batchAdd, beforeBatchDelete, beforeBatchAdd, beforeBatchSave, batchSave, keyPressed, updateData, doubleTap, virtualColumnIndex, virtualActionArgs, dataListener, indexModifier, beforeStartEdit, beforeBatchCancel, batchEditFormRendered, detailDataBound, rowDrag, rowDragStartHelper, rowDrop, rowDragStart, rowsAdd, rowsRemove, rowdraging, rowDropped, DataManipulation, Reorder$1 as Reorder, Resize$1 as Resize, RowDD$1 as RowDD, Column, EditSettings, Predicate$1 as Predicate, FilterSettings, PageSettings, SearchSettings, SelectionSettings, AggregateColumn, AggregateRow, SortDescriptor, SortSettings, RowDropSettings$1 as RowDropSettings, InfiniteScrollSettings, Render, TreeVirtualRowModelGenerator, isRemoteData, isCountRequired, isCheckboxcolumn, isFilterChildHierarchy, findParentRecords, getExpandStatus, findChildrenRecords, isOffline, extendArray, getPlainData, getParentData, isHidden, ToolbarItem, ContextMenuItems, Filter$1 as Filter, ExcelExport$1 as ExcelExport, PdfExport$1 as PdfExport, Page$1 as Page, Toolbar$1 as Toolbar, Aggregate$1 as Aggregate, Sort$1 as Sort, TreeClipboard, ColumnMenu$1 as ColumnMenu, ContextMenu$1 as ContextMenu, Edit$1 as Edit, CommandColumn$1 as CommandColumn, Selection, DetailRow$1 as DetailRow, VirtualScroll$1 as VirtualScroll, TreeVirtual, Freeze$1 as Freeze, ColumnChooser$1 as ColumnChooser, Logger$1 as Logger, treeGridDetails, InfiniteScroll$1 as InfiniteScroll };
12457
+ export { TreeGrid, load, rowDataBound, dataBound, queryCellInfo, beforeDataBound, actionBegin, dataStateChange, actionComplete, rowSelecting, rowSelected, checkboxChange, rowDeselected, toolbarClick, beforeExcelExport, beforePdfExport, resizeStop, expanded, expanding, collapsed, collapsing, remoteExpand, localPagedExpandCollapse, pagingActions, printGridInit, contextMenuOpen, contextMenuClick, beforeCopy, beforePaste, savePreviousRowPosition, crudAction, beginEdit, beginAdd, recordDoubleClick, cellSave, cellSaved, cellEdit, batchDelete, batchCancel, batchAdd, beforeBatchDelete, beforeBatchAdd, beforeBatchSave, batchSave, keyPressed, updateData, doubleTap, virtualColumnIndex, virtualActionArgs, destroy, dataListener, indexModifier, beforeStartEdit, beforeBatchCancel, batchEditFormRendered, detailDataBound, rowDrag, rowDragStartHelper, rowDrop, rowDragStart, rowsAdd, rowsRemove, rowdraging, rowDropped, autoCol, DataManipulation, Reorder$1 as Reorder, Resize$1 as Resize, RowDD$1 as RowDD, Column, EditSettings, Predicate$1 as Predicate, FilterSettings, PageSettings, SearchSettings, SelectionSettings, AggregateColumn, AggregateRow, SortDescriptor, SortSettings, RowDropSettings$1 as RowDropSettings, InfiniteScrollSettings, Render, TreeVirtualRowModelGenerator, isRemoteData, isCountRequired, isCheckboxcolumn, isFilterChildHierarchy, findParentRecords, getExpandStatus, findChildrenRecords, isOffline, extendArray, getPlainData, getParentData, isHidden, ToolbarItem, ContextMenuItems, Filter$1 as Filter, ExcelExport$1 as ExcelExport, PdfExport$1 as PdfExport, Page$1 as Page, Toolbar$1 as Toolbar, Aggregate$1 as Aggregate, Sort$1 as Sort, TreeClipboard, ColumnMenu$1 as ColumnMenu, ContextMenu$1 as ContextMenu, Edit$1 as Edit, CommandColumn$1 as CommandColumn, Selection, DetailRow$1 as DetailRow, VirtualScroll$1 as VirtualScroll, TreeVirtual, Freeze$1 as Freeze, ColumnChooser$1 as ColumnChooser, Logger$1 as Logger, treeGridDetails, InfiniteScroll$1 as InfiniteScroll };
12261
12458
  //# sourceMappingURL=ej2-treegrid.es5.js.map