@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';
@@ -388,6 +388,8 @@ const virtualColumnIndex = 'virtualColumnIndex';
388
388
  /** @hidden */
389
389
  const virtualActionArgs = 'virtual-action-args';
390
390
  /** @hidden */
391
+ const destroy = 'destroy';
392
+ /** @hidden */
391
393
  const dataListener = 'data-listener';
392
394
  /** @hidden */
393
395
  const indexModifier = 'index-modifier';
@@ -415,6 +417,8 @@ const rowsRemove = 'rows-remove';
415
417
  const rowdraging = 'row-draging';
416
418
  /** @hidden */
417
419
  const rowDropped = 'row-dropped';
420
+ /** @hidden */
421
+ const autoCol = 'auto-col';
418
422
 
419
423
  /**
420
424
  * The `Clipboard` module is used to handle clipboard copy action.
@@ -1033,12 +1037,12 @@ class Selection {
1033
1037
  let index = -1;
1034
1038
  let length = 0;
1035
1039
  if (!isNullOrUndefined(this.parent.filterModule) && this.parent.filterModule.filteredResult.length > 0) {
1036
- var filterResult = this.parent.filterModule.filteredResult;
1037
- if (this.filteredList.length == 0) {
1040
+ const filterResult = this.parent.filterModule.filteredResult;
1041
+ if (this.filteredList.length === 0) {
1038
1042
  this.filteredList = filterResult;
1039
1043
  }
1040
1044
  else {
1041
- if (this.filteredList != filterResult) {
1045
+ if (this.filteredList !== filterResult) {
1042
1046
  this.filteredList = filterResult;
1043
1047
  }
1044
1048
  }
@@ -1130,6 +1134,9 @@ class Selection {
1130
1134
  (!isNullOrUndefined(this.parent.filterModule) && this.parent.filterModule.filteredResult.length > 0))) {
1131
1135
  this.selectedItems.push(checkedRecord);
1132
1136
  }
1137
+ if (this.selectedItems.indexOf(checkedRecord) === -1 && this.parent.enableVirtualization && ((!isNullOrUndefined(this.parent.filterModule) && this.parent.filterModule.filteredResult.length > 0))) {
1138
+ this.selectedItems.push(checkedRecord);
1139
+ }
1133
1140
  if (this.selectedItems.indexOf(checkedRecord) === -1 && (!isNullOrUndefined(this.parent.filterModule) &&
1134
1141
  this.parent.filterModule.filteredResult.length === 0)) {
1135
1142
  this.selectedItems.push(checkedRecord);
@@ -1202,11 +1209,31 @@ class Selection {
1202
1209
  childData = (!isNullOrUndefined(this.parent.filterModule) && this.parent.filterModule.filteredResult.length > 0) ?
1203
1210
  this.parent.getCurrentViewRecords() : this.parent.flatData;
1204
1211
  childData.forEach((record) => {
1205
- if (record.hasChildRecords) {
1206
- this.updateParentSelection(record);
1212
+ if (this.parent.enableVirtualization) {
1213
+ if (record.hasChildRecords) {
1214
+ this.updateParentSelection(record);
1215
+ }
1216
+ else {
1217
+ this.updateSelectedItems(record, record.checkboxState);
1218
+ }
1219
+ let child = findChildrenRecords(record);
1220
+ child = this.getFilteredChildRecords(child);
1221
+ for (let i = 0; i < child.length; i++) {
1222
+ if (child[i].hasChildRecords) {
1223
+ this.updateParentSelection(child[i]);
1224
+ }
1225
+ else if (!(child[i].hasChildRecords) && !isNullOrUndefined(child[i])) {
1226
+ this.updateSelectedItems(child[i], child[i].checkboxState);
1227
+ }
1228
+ }
1207
1229
  }
1208
1230
  else {
1209
- this.updateSelectedItems(record, record.checkboxState);
1231
+ if (record.hasChildRecords) {
1232
+ this.updateParentSelection(record);
1233
+ }
1234
+ else {
1235
+ this.updateSelectedItems(record, record.checkboxState);
1236
+ }
1210
1237
  }
1211
1238
  });
1212
1239
  this.headerSelection();
@@ -1432,7 +1459,15 @@ class Render {
1432
1459
  else {
1433
1460
  index = data.index;
1434
1461
  }
1435
- if (grid.getColumnIndexByUid(args.column.uid) === this.parent.treeColumnIndex && (args.requestType === 'add' || args.requestType
1462
+ let columnIndex;
1463
+ const getVirtualColIndexByUid = 'getVirtualColIndexByUid';
1464
+ if (this.parent.enableColumnVirtualization && !this.parent.initialRender) {
1465
+ columnIndex = this.parent[getVirtualColIndexByUid](args.column.uid);
1466
+ }
1467
+ else {
1468
+ columnIndex = grid.getColumnIndexByUid(args.column.uid);
1469
+ }
1470
+ if (columnIndex === this.parent.treeColumnIndex && (args.requestType === 'add' || args.requestType
1436
1471
  === 'rowDragAndDrop' || args.requestType === 'delete' || isNullOrUndefined(args.cell.querySelector('.e-treecell')))) {
1437
1472
  const container = createElement('div', { className: 'e-treecolumn-container' });
1438
1473
  const emptyExpandIcon = createElement('span', {
@@ -1489,7 +1524,7 @@ class Render {
1489
1524
  else if (this.templateResult) {
1490
1525
  this.templateResult = null;
1491
1526
  }
1492
- let freeze = (grid.getFrozenLeftColumnsCount() > 0 || grid.getFrozenRightColumnsCount() > 0) ? true : false;
1527
+ const freeze = (grid.getFrozenLeftColumnsCount() > 0 || grid.getFrozenRightColumnsCount() > 0) ? true : false;
1493
1528
  if (!freeze) {
1494
1529
  if (frozenColumns > this.parent.treeColumnIndex && frozenColumns > 0 &&
1495
1530
  grid.getColumnIndexByUid(args.column.uid) === frozenColumns) {
@@ -1506,9 +1541,9 @@ class Render {
1506
1541
  }
1507
1542
  }
1508
1543
  else {
1509
- let freezerightColumns = grid.getFrozenRightColumns();
1510
- let freezeLeftColumns = grid.getFrozenLeftColumns();
1511
- let movableColumns = grid.getMovableColumns();
1544
+ const freezerightColumns = grid.getFrozenRightColumns();
1545
+ const freezeLeftColumns = grid.getFrozenLeftColumns();
1546
+ const movableColumns = grid.getMovableColumns();
1512
1547
  if ((freezerightColumns.length > 0) && freezerightColumns[0].field === args.column.field) {
1513
1548
  addClass([args.cell], 'e-gridrowindex' + index + 'level' + data.level);
1514
1549
  }
@@ -2527,6 +2562,7 @@ function editAction(details, control, isSelfReference, addRowIndex, selectedInde
2527
2562
  const childRecords = parentData ? parentData[control.childMapping] : [];
2528
2563
  for (let p = childRecords.length - 1; p >= 0; p--) {
2529
2564
  if (childRecords[p][control.idMapping] === currentData[control.idMapping]) {
2565
+ parentData['childRecords'].splice(p, 1);
2530
2566
  childRecords.splice(p, 1);
2531
2567
  if (!childRecords.length) {
2532
2568
  parentData.hasChildRecords = false;
@@ -3259,7 +3295,8 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
3259
3295
  member: 'ExcelExport', args: [this]
3260
3296
  });
3261
3297
  }
3262
- if (this.frozenColumns || this.frozenRows || this.getFrozenColumns() || this.grid.getFrozenLeftColumnsCount() || this.grid.getFrozenRightColumnsCount()) {
3298
+ if (this.frozenColumns || this.frozenRows || this.getFrozenColumns() ||
3299
+ this.grid.getFrozenLeftColumnsCount() || this.grid.getFrozenRightColumnsCount()) {
3263
3300
  modules.push({
3264
3301
  member: 'freeze', args: [this]
3265
3302
  });
@@ -3477,6 +3514,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
3477
3514
  this.grid.allowSorting = this.allowSorting;
3478
3515
  this.grid.allowFiltering = this.allowFiltering;
3479
3516
  this.grid.enableVirtualization = this.enableVirtualization;
3517
+ this.grid.enableColumnVirtualization = this.enableColumnVirtualization;
3480
3518
  this.grid.enableInfiniteScrolling = this.enableInfiniteScrolling;
3481
3519
  this.grid.infiniteScrollSettings = this.infiniteScrollSettings;
3482
3520
  this.grid.width = this.width;
@@ -3833,6 +3871,10 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
3833
3871
  && (this.grid.filterSettings.columns.length === 0 || this.grid.searchSettings.key.length === 0)) {
3834
3872
  this.notify('clearFilters', { flatData: this.grid.dataSource });
3835
3873
  this.grid.setProperties({ dataSource: this.dataResults.result }, true);
3874
+ if (isNullOrUndefined(this.grid['changedProperties'].dataSource)) {
3875
+ this.grid.renderModule.data.dataManager = this.grid.dataSource instanceof DataManager ? this.grid.dataSource :
3876
+ (isNullOrUndefined(this.grid.dataSource) ? new DataManager() : new DataManager(this.grid.dataSource));
3877
+ }
3836
3878
  }
3837
3879
  const callBackPromise = new Deferred();
3838
3880
  this.trigger(actionBegin, args, (actionArgs) => {
@@ -3858,7 +3900,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
3858
3900
  this.notify(batchSave, args);
3859
3901
  }
3860
3902
  this.notify('updateGridActions', args);
3861
- if (args.requestType === 'save' && this.aggregates.map((ag) => ag.showChildSummary == true).length) {
3903
+ if (args.requestType === 'save' && this.aggregates.map((ag) => ag.showChildSummary === true).length) {
3862
3904
  this.grid.refresh();
3863
3905
  }
3864
3906
  this.trigger(actionComplete, args);
@@ -4148,6 +4190,9 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4148
4190
  case 'enableVirtualization':
4149
4191
  this.grid.enableVirtualization = this.enableVirtualization;
4150
4192
  break;
4193
+ case 'enableColumnVirtualization':
4194
+ this.grid.enableColumnVirtualization = this.enableColumnVirtualization;
4195
+ break;
4151
4196
  case 'toolbar':
4152
4197
  this.grid.toolbar = this.getGridToolbar();
4153
4198
  break;
@@ -4371,6 +4416,11 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4371
4416
  if (isNullOrUndefined(this.grid)) {
4372
4417
  return;
4373
4418
  }
4419
+ if (!isNullOrUndefined(this.rowDropSettings.targetID) &&
4420
+ isNullOrUndefined(document.getElementById(this.grid.rowDropSettings.targetID))) {
4421
+ document.getElementById(this.rowDropSettings.targetID).id = this.grid.rowDropSettings.targetID;
4422
+ this.rowDropSettings.targetID = this.grid.rowDropSettings.targetID;
4423
+ }
4374
4424
  super.dataBind();
4375
4425
  this.grid.dataBind();
4376
4426
  }
@@ -4382,7 +4432,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4382
4432
  */
4383
4433
  getPersistData() {
4384
4434
  const keyEntity = ['pageSettings', 'sortSettings',
4385
- 'filterSettings', 'columns', 'searchSettings', 'selectedRowIndex'];
4435
+ 'filterSettings', 'columns', 'searchSettings', 'selectedRowIndex', 'treeColumnIndex'];
4386
4436
  const ignoreOnPersist = {
4387
4437
  pageSettings: ['template', 'pageSizes', 'pageSizeMode', 'enableQueryString', 'totalRecordsCount', 'pageCount'],
4388
4438
  filterSettings: ['type', 'mode', 'showFilterBarStatus', 'immediateModeDelay', 'ignoreAccent', 'hierarchyMode'],
@@ -4393,8 +4443,9 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4393
4443
  'commandTemplate', 'commands', 'dataSource'];
4394
4444
  for (let i = 0; i < keyEntity.length; i++) {
4395
4445
  const currentObject = this[keyEntity[i]];
4396
- for (const val of ignoreOnPersist[keyEntity[i]]) {
4397
- delete currentObject[val];
4446
+ for (let k = 0, val = ignoreOnPersist[keyEntity[i]]; (!isNullOrUndefined(val) && k < val.length); k++) {
4447
+ let objVal = val[k];
4448
+ delete currentObject[objVal];
4398
4449
  }
4399
4450
  }
4400
4451
  this.ignoreInArrays(ignoreOnColumn, this.columns);
@@ -4707,7 +4758,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4707
4758
  * @returns {Column} - Returns tree grid column
4708
4759
  */
4709
4760
  getColumnByUid(uid) {
4710
- let Columns = this.initialRender ? this.grid.columns : this.columns;
4761
+ const Columns = this.initialRender ? this.grid.columns : this.columns;
4711
4762
  return iterateArrayOrObject(Columns, (item) => {
4712
4763
  if (item.uid === uid) {
4713
4764
  return item;
@@ -4797,6 +4848,16 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4797
4848
  getColumnIndexByField(field) {
4798
4849
  return this.grid.getColumnIndexByField(field);
4799
4850
  }
4851
+ getVirtualColIndexByUid(uid) {
4852
+ const columnModel = 'columnModel';
4853
+ const index = iterateArrayOrObject(this.grid[columnModel], (item, index) => {
4854
+ if (item.uid === uid) {
4855
+ return index;
4856
+ }
4857
+ return undefined;
4858
+ })[0];
4859
+ return !isNullOrUndefined(index) ? index : -1;
4860
+ }
4800
4861
  /**
4801
4862
  * Gets a column index by UID.
4802
4863
  *
@@ -4825,17 +4886,19 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4825
4886
  temp = this.columnModel[this.treeColumnIndex].template;
4826
4887
  field = this.columnModel[this.treeColumnIndex].field;
4827
4888
  }
4828
- this.columnModel = [];
4829
4889
  let stackedHeader = false;
4830
4890
  let gridColumn;
4831
- for (let i = 0; i < gridColumns.length; i++) {
4832
- gridColumn = {};
4833
- for (const prop of Object.keys(gridColumns[i])) {
4834
- gridColumn[prop] = gridColumns[i][prop];
4835
- }
4836
- this.columnModel.push(new Column(gridColumn));
4837
- if (field === this.columnModel[i].field && (!isNullOrUndefined(temp) && temp !== '')) {
4838
- this.columnModel[i].template = temp;
4891
+ if (!this.enableColumnVirtualization || (this.enableColumnVirtualization && this.columnModel.length === gridColumns.length)) {
4892
+ this.columnModel = [];
4893
+ for (let i = 0; i < gridColumns.length; i++) {
4894
+ gridColumn = {};
4895
+ for (const prop of Object.keys(gridColumns[i])) {
4896
+ gridColumn[prop] = gridColumns[i][prop];
4897
+ }
4898
+ this.columnModel.push(new Column(gridColumn));
4899
+ if (field === this.columnModel[i].field && (!isNullOrUndefined(temp) && temp !== '')) {
4900
+ this.columnModel[i].template = temp;
4901
+ }
4839
4902
  }
4840
4903
  }
4841
4904
  const merge$$1 = 'deepMerge';
@@ -5138,7 +5201,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5138
5201
  });
5139
5202
  }
5140
5203
  setHeightForFrozenContent() {
5141
- let freeze = (this.grid.getFrozenLeftColumnsCount() > 0 || this.grid.getFrozenRightColumnsCount() > 0) ? true : false;
5204
+ const freeze = (this.grid.getFrozenLeftColumnsCount() > 0 || this.grid.getFrozenRightColumnsCount() > 0) ? true : false;
5142
5205
  if (this.grid.getFrozenColumns() > 0 || freeze) {
5143
5206
  this.grid.contentModule.refreshScrollOffset();
5144
5207
  }
@@ -5204,7 +5267,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5204
5267
  const row = getObject('rows', rec);
5205
5268
  const record = getObject('records', rec);
5206
5269
  for (let i = 0; i < record.length; i++) {
5207
- if (record[i].parentItem != undefined) {
5270
+ if (record[i].parentItem !== undefined) {
5208
5271
  const pindex = this.flatData[record[i].parentItem.index].index;
5209
5272
  if (this.flatData[pindex].expanded === false) {
5210
5273
  record.push(this.flatData[pindex]);
@@ -5528,7 +5591,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5528
5591
  else {
5529
5592
  rows = gridRows.filter((r) => r.querySelector('.e-gridrowindex' + record.index + 'level' + (record.level + 1)));
5530
5593
  }
5531
- let freeze = (this.grid.getFrozenLeftColumnsCount() > 0 || this.grid.getFrozenRightColumnsCount() > 0) ? true : false;
5594
+ const freeze = (this.grid.getFrozenLeftColumnsCount() > 0 || this.grid.getFrozenRightColumnsCount() > 0) ? true : false;
5532
5595
  if (this.frozenRows || this.frozenColumns || this.getFrozenColumns() || freeze) {
5533
5596
  movableRows = this.getMovableRows().filter((r) => r.querySelector('.e-gridrowindex' + record.index + 'level' + (record.level + 1)));
5534
5597
  }
@@ -5596,7 +5659,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5596
5659
  let childRecord;
5597
5660
  let movablerows = [];
5598
5661
  let rightrows = [];
5599
- let freeze = (this.getFrozenLeftColumnsCount() > 0 || this.getFrozenRightColumnsCount() > 0) ? true : false;
5662
+ const freeze = (this.getFrozenLeftColumnsCount() > 0 || this.getFrozenRightColumnsCount() > 0) ? true : false;
5600
5663
  if (freeze) {
5601
5664
  movablerows = this.getMovableRows().filter((r) => r.querySelector('.e-gridrowindex' + rowDetails.record.index + 'level' + (rowDetails.record.level + 1)));
5602
5665
  rightrows = this.getFrozenRightRows().filter((r) => r.querySelector('.e-gridrowindex' + rowDetails.record.index + 'level' + (rowDetails.record.level + 1)));
@@ -6154,6 +6217,9 @@ __decorate([
6154
6217
  __decorate([
6155
6218
  Property(false)
6156
6219
  ], TreeGrid.prototype, "enableVirtualization", void 0);
6220
+ __decorate([
6221
+ Property(false)
6222
+ ], TreeGrid.prototype, "enableColumnVirtualization", void 0);
6157
6223
  __decorate([
6158
6224
  Property(false)
6159
6225
  ], TreeGrid.prototype, "enableInfiniteScrolling", void 0);
@@ -6828,7 +6894,8 @@ class RowDD$1 {
6828
6894
  const bottomRowSegment = middleRowSegment + divide;
6829
6895
  const mouseEvent = getObject('originalEvent.event', args);
6830
6896
  const touchEvent = getObject('originalEvent.event', args);
6831
- const posy = (mouseEvent.type == "mousemove") ? mouseEvent.pageY : ((!isNullOrUndefined(touchEvent) && !isNullOrUndefined(touchEvent.changedTouches)) ? touchEvent.changedTouches[0].pageY : null);
6897
+ const posy = (mouseEvent.type === 'mousemove') ? mouseEvent.pageY : ((!isNullOrUndefined(touchEvent) &&
6898
+ !isNullOrUndefined(touchEvent.changedTouches)) ? touchEvent.changedTouches[0].pageY : null);
6832
6899
  const isTopSegment = posy <= topRowSegment;
6833
6900
  const isMiddleRowSegment = (posy > topRowSegment && posy <= middleRowSegment);
6834
6901
  const isBottomRowSegment = (posy > middleRowSegment && posy <= bottomRowSegment);
@@ -7055,7 +7122,7 @@ class RowDD$1 {
7055
7122
  }
7056
7123
  else {
7057
7124
  if (args.target && closest(args.target, '#' + tObj.rowDropSettings.targetID) || parentsUntil(args.target, 'e-treegrid') &&
7058
- parentsUntil(args.target, 'e-treegrid').id === tObj.rowDropSettings.targetID) {
7125
+ parentsUntil(args.target, 'e-treegrid').id === tObj.rowDropSettings.targetID || args.target && document.getElementById(tObj.rowDropSettings.targetID)) {
7059
7126
  setValue('dropPosition', this.dropPosition, args);
7060
7127
  tObj.trigger(rowDrop, args);
7061
7128
  if (!args.cancel && tObj.rowDropSettings.targetID) {
@@ -7243,6 +7310,13 @@ class RowDD$1 {
7243
7310
  args.dropIndex = correctIndex;
7244
7311
  droppedRecord = this.droppedRecord = this.parent.getCurrentViewRecords()[args.dropIndex];
7245
7312
  }
7313
+ if (droppedRecord.parentItem || this.dropPosition === 'middleSegment') {
7314
+ const parentRecords = tObj.parentData;
7315
+ const newParentIndex = parentRecords.indexOf(this.draggedRecord);
7316
+ if (newParentIndex !== -1) {
7317
+ parentRecords.splice(newParentIndex, 1);
7318
+ }
7319
+ }
7246
7320
  const recordIndex1 = this.treeGridData.indexOf(droppedRecord);
7247
7321
  this.dropAtTop(recordIndex1);
7248
7322
  if (this.dropPosition === 'bottomSegment') {
@@ -7290,10 +7364,16 @@ class RowDD$1 {
7290
7364
  if (isNullOrUndefined(draggedRecord.parentItem)) {
7291
7365
  const parentRecords = tObj.parentData;
7292
7366
  const newParentIndex = parentRecords.indexOf(this.droppedRecord);
7293
- if (this.dropPosition === 'bottomSegment') {
7367
+ let nonRepeat = 0;
7368
+ parentRecords.filter((e) => {
7369
+ if (draggedRecord.uniqueID === e.uniqueID) {
7370
+ nonRepeat++;
7371
+ }
7372
+ });
7373
+ if (this.dropPosition === 'bottomSegment' && nonRepeat === 0) {
7294
7374
  parentRecords.splice(newParentIndex + 1, 0, draggedRecord);
7295
7375
  }
7296
- else if (this.dropPosition === 'topSegment') {
7376
+ else if (this.dropPosition === 'topSegment' && nonRepeat === 0) {
7297
7377
  parentRecords.splice(newParentIndex, 0, draggedRecord);
7298
7378
  }
7299
7379
  }
@@ -7365,6 +7445,11 @@ class RowDD$1 {
7365
7445
  draggedRecord.parentItem = parentItem;
7366
7446
  draggedRecord.parentUniqueID = droppedRecord.uniqueID;
7367
7447
  droppedRecord.childRecords.splice(droppedRecord.childRecords.length, 0, draggedRecord);
7448
+ const isSelfReference = 'isSelfReference';
7449
+ if (tObj[isSelfReference]) {
7450
+ droppedRecord[tObj.childMapping] = [];
7451
+ droppedRecord[tObj.childMapping].splice(droppedRecord[tObj.childMapping].length, 0, draggedRecord);
7452
+ }
7368
7453
  if (!isNullOrUndefined(draggedRecord) && !tObj.parentIdMapping && !isNullOrUndefined(droppedRecord.taskData[childItem])) {
7369
7454
  droppedRecord.taskData[tObj.childMapping].splice(droppedRecord.childRecords.length, 0, draggedRecord.taskData);
7370
7455
  }
@@ -7403,7 +7488,7 @@ class RowDD$1 {
7403
7488
  }
7404
7489
  length = record.childRecords.length;
7405
7490
  for (let i = 0; i < length; i++) {
7406
- currentRecord = record.childRecords[i];
7491
+ currentRecord = getValue('uniqueIDCollection.' + record.childRecords[i].uniqueID, tObj);
7407
7492
  count++;
7408
7493
  tObj.flatData.splice(count, 0, currentRecord);
7409
7494
  setValue('uniqueIDCollection.' + currentRecord.uniqueID, currentRecord, this.parent);
@@ -7425,7 +7510,7 @@ class RowDD$1 {
7425
7510
  }
7426
7511
  length = record.childRecords.length;
7427
7512
  for (let i = 0; i < length; i++) {
7428
- currentRecord = record.childRecords[i];
7513
+ currentRecord = getValue('uniqueIDCollection.' + record.childRecords[i].uniqueID, this.parent);
7429
7514
  let parentData;
7430
7515
  if (record.parentItem) {
7431
7516
  parentData = getParentData(this.parent, record.parentItem.uniqueID);
@@ -7660,7 +7745,19 @@ class TreeVirtualRowModelGenerator extends VirtualRowModelGenerator {
7660
7745
  getDatas(args) {
7661
7746
  this.visualData = args.data;
7662
7747
  }
7748
+ getDataInfo() {
7749
+ return super.getData();
7750
+ }
7663
7751
  generateRows(data, notifyArgs) {
7752
+ const info = this.getDataInfo();
7753
+ if (!isNullOrUndefined(notifyArgs.virtualInfo)) {
7754
+ if (notifyArgs.virtualInfo.direction !== 'right' && notifyArgs.virtualInfo.direction !== 'left') {
7755
+ notifyArgs.virtualInfo.blockIndexes = info.blockIndexes;
7756
+ }
7757
+ else {
7758
+ notifyArgs.virtualInfo.blockIndexes = this.getBlockIndexes(notifyArgs.virtualInfo.page);
7759
+ }
7760
+ }
7664
7761
  if ((this.parent.dataSource instanceof DataManager && this.parent.dataSource.dataSource.url !== undefined
7665
7762
  && !this.parent.dataSource.dataSource.offline && this.parent.dataSource.dataSource.url !== '') || isCountRequired(this.parent)) {
7666
7763
  return super.generateRows(data, notifyArgs);
@@ -9188,10 +9285,11 @@ class BatchEdit {
9188
9285
  if (frozenCols && args.columnObject.index > frozenCols) {
9189
9286
  actualCellIndex = actualCellIndex + frozenCols;
9190
9287
  }
9191
- let freeze = (this.parent.getFrozenLeftColumnsCount() > 0 || this.parent.getFrozenRightColumnsCount() > 0) ? true : false;
9288
+ const freeze = (this.parent.getFrozenLeftColumnsCount() > 0 ||
9289
+ this.parent.getFrozenRightColumnsCount() > 0) ? true : false;
9192
9290
  if (freeze) {
9193
- let colCount = this.parent.getFrozenLeftColumnsCount() + actualCellIndex;
9194
- if (colCount == this.parent.treeColumnIndex) {
9291
+ const colCount = this.parent.getFrozenLeftColumnsCount() + actualCellIndex;
9292
+ if (colCount === this.parent.treeColumnIndex) {
9195
9293
  this.parent.renderModule.cellRender({ data: args.rowData, cell: args.cell,
9196
9294
  column: this.parent.grid.getColumnByIndex(args.cell.cellIndex)
9197
9295
  });
@@ -9353,7 +9451,7 @@ class BatchEdit {
9353
9451
  focusModule.getContent().matrix.current = [actualIndex, focusModule.getContent().matrix.current[1]];
9354
9452
  }
9355
9453
  }
9356
- beforeBatchDelete() {
9454
+ beforeBatchDelete(args) {
9357
9455
  if (!this.batchRecords.length) {
9358
9456
  this.batchRecords = extendArray(this.parent.grid.getCurrentViewRecords());
9359
9457
  this.currentViewRecords = extendArray(this.parent.grid.getCurrentViewRecords());
@@ -9363,9 +9461,19 @@ class BatchEdit {
9363
9461
  const row = [];
9364
9462
  let records = [];
9365
9463
  const primarykey = this.parent.grid.getPrimaryKeyFieldNames()[0];
9366
- const data = this.parent.grid.getSelectedRecords()[this.parent.grid.getSelectedRecords().length - 1];
9367
- const childs = findChildrenRecords(data);
9368
- const uid = this.parent.getSelectedRows()[0].getAttribute('data-uid');
9464
+ let data;
9465
+ let childs;
9466
+ let uid;
9467
+ if (!isNullOrUndefined(args.row) && this.parent.getSelectedRows().indexOf(args.row) === -1) {
9468
+ data = args.rowData;
9469
+ childs = findChildrenRecords(data);
9470
+ uid = args.row.getAttribute('data-uid');
9471
+ }
9472
+ else {
9473
+ data = this.parent.grid.getSelectedRecords()[this.parent.grid.getSelectedRecords().length - 1];
9474
+ childs = findChildrenRecords(data);
9475
+ uid = this.parent.getSelectedRows()[0].getAttribute('data-uid');
9476
+ }
9369
9477
  const parentRowIndex = parseInt(this.parent.grid.getRowElementByUID(uid).getAttribute('aria-rowindex'), 10);
9370
9478
  if (childs.length) {
9371
9479
  const totalCount = parentRowIndex + childs.length;
@@ -9405,7 +9513,8 @@ class BatchEdit {
9405
9513
  for (let i = 0; i < rows.length; i++) {
9406
9514
  rows[i].setAttribute('aria-rowindex', i.toString());
9407
9515
  }
9408
- let freeze = (this.parent.getFrozenLeftColumnsCount() > 0 || this.parent.getFrozenRightColumnsCount() > 0) ? true : false;
9516
+ const freeze = (this.parent.getFrozenLeftColumnsCount() > 0 ||
9517
+ this.parent.getFrozenRightColumnsCount() > 0) ? true : false;
9409
9518
  if (this.parent.frozenRows || this.parent.getFrozenColumns() || this.parent.frozenColumns || freeze) {
9410
9519
  const mRows = this.parent.grid.getMovableDataRows();
9411
9520
  const freezeRightRows = this.parent.grid.getFrozenRightDataRows();
@@ -9916,7 +10025,7 @@ class Edit$1 {
9916
10025
  if (args.action === 'f2') {
9917
10026
  this.recordDoubleClick(args);
9918
10027
  }
9919
- if (args.action == 'escape') {
10028
+ if (args.action === 'escape') {
9920
10029
  this.parent.closeEdit();
9921
10030
  }
9922
10031
  }
@@ -10025,12 +10134,13 @@ class Edit$1 {
10025
10134
  });
10026
10135
  }
10027
10136
  else {
10028
- let freeze = (this.parent.getFrozenLeftColumnsCount() > 0 || this.parent.getFrozenRightColumnsCount() > 0) ? true : false;
10137
+ const freeze = (this.parent.getFrozenLeftColumnsCount() > 0 ||
10138
+ this.parent.getFrozenRightColumnsCount() > 0) ? true : false;
10029
10139
  if (freeze) {
10030
- if (this.parent.getRows().indexOf(row) != -1) {
10140
+ if (this.parent.getRows().indexOf(row) !== -1) {
10031
10141
  rowIndex = this.parent.getRows().indexOf(row);
10032
10142
  }
10033
- else if (this.parent.getFrozenRightRows().indexOf(row) != -1) {
10143
+ else if (this.parent.getFrozenRightRows().indexOf(row) !== -1) {
10034
10144
  rowIndex = this.parent.getFrozenRightRows().indexOf(row);
10035
10145
  }
10036
10146
  else {
@@ -10097,7 +10207,8 @@ class Edit$1 {
10097
10207
  this.isOnBatch = false;
10098
10208
  }
10099
10209
  this.enableToolbarItems('save');
10100
- let freeze = (this.parent.getFrozenLeftColumnsCount() > 0 || this.parent.getFrozenRightColumnsCount() > 0) ? true : false;
10210
+ const freeze = (this.parent.getFrozenLeftColumnsCount() > 0 ||
10211
+ this.parent.getFrozenRightColumnsCount() > 0) ? true : false;
10101
10212
  if (freeze) {
10102
10213
  if (args.cell.closest('.e-frozen-left-header') || args.cell.closest('.e-frozen-left-content')) {
10103
10214
  mRow = this.parent.grid.getRows()[rowIndex];
@@ -10134,7 +10245,7 @@ class Edit$1 {
10134
10245
  type: 'save', column: this.parent.getColumnByField(args.columnName), data: args.rowData,
10135
10246
  previousData: args.previousValue, row: row, target: args.cell
10136
10247
  };
10137
- if (this.parent.aggregates.map((ag) => ag.showChildSummary == true).length) {
10248
+ if (this.parent.aggregates.map((ag) => ag.showChildSummary === true).length) {
10138
10249
  this.parent.grid.refresh();
10139
10250
  }
10140
10251
  this.parent.trigger(actionComplete, saveArgs);
@@ -10176,6 +10287,10 @@ class Edit$1 {
10176
10287
  }
10177
10288
  }
10178
10289
  setValue('uniqueIDCollection.' + data[i].uniqueID + '.index', i, this.parent);
10290
+ const adaptor = this.parent.dataSource.adaptor;
10291
+ if ((isRemoteData(this.parent) || adaptor instanceof RemoteSaveAdaptor)) {
10292
+ setValue('uniqueIDCollection.' + data[i].uniqueID, data[i], this.parent);
10293
+ }
10179
10294
  if (!data[i].level) {
10180
10295
  this.parent.parentData.push(data[i]);
10181
10296
  }
@@ -10295,7 +10410,8 @@ class Edit$1 {
10295
10410
  this.parent.grid.contentModule[r].splice(0, 1);
10296
10411
  this.parent.grid.contentModule[r].splice(rowObjectIndex, 0, newRowObject);
10297
10412
  }
10298
- let freeze = (this.parent.getFrozenLeftColumnsCount() > 0 || this.parent.getFrozenRightColumnsCount() > 0) ? true : false;
10413
+ const freeze = (this.parent.getFrozenLeftColumnsCount() > 0 ||
10414
+ this.parent.getFrozenRightColumnsCount() > 0) ? true : false;
10299
10415
  if (this.parent.frozenRows || this.parent.getFrozenColumns() || this.parent.frozenColumns || freeze) {
10300
10416
  const movableRows = this.parent.getMovableDataRows();
10301
10417
  const frows = 'freezeRows';
@@ -10843,9 +10959,9 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
10843
10959
  if (!(this.parent.dataSource instanceof DataManager && this.parent.dataSource.dataSource.url !== undefined
10844
10960
  && this.parent.dataSource.dataSource.offline && this.parent.dataSource.dataSource.url !== '') || !isCountRequired(this.parent)) {
10845
10961
  this.parent[action]('data-ready', this.onDataReady, this);
10846
- //this.parent[action]('refresh-virtual-block', this.refreshContentRows, this);
10962
+ this.parent[action]('refresh-virtual-block', this.refreshContentRows, this);
10847
10963
  this.fn = () => {
10848
- this.observers.observes((scrollArgs) => this.scrollListeners(scrollArgs));
10964
+ this.observers.observes((scrollArgs) => this.scrollListeners(scrollArgs), this.onEnteredAction());
10849
10965
  this.parent.off('content-ready', this.fn);
10850
10966
  };
10851
10967
  this.parent.addEventListener('dataBound', this.dataBoundEvent.bind(this));
@@ -10877,7 +10993,9 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
10877
10993
  && this.parent.dataSource.dataSource.offline && this.parent.dataSource.dataSource.url !== '') || !isCountRequired(this.parent)) {
10878
10994
  if (!isNullOrUndefined(e.count)) {
10879
10995
  this.totalRecords = e.count;
10880
- getValue('virtualEle', this).setVirtualHeight(this.parent.getRowHeight() * e.count, '100%');
10996
+ if (!this.parent.enableColumnVirtualization) {
10997
+ getValue('virtualEle', this).setVirtualHeight(this.parent.getRowHeight() * e.count, '100%');
10998
+ }
10881
10999
  }
10882
11000
  if ((!isNullOrUndefined(e.requestType) && e.requestType.toString() === 'collapseAll') || this.isDataSourceChanged) {
10883
11001
  this.contents.scrollTop = 0;
@@ -10935,6 +11053,10 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
10935
11053
  return;
10936
11054
  }
10937
11055
  const selectVirtualRow = 'selectVirtualRow';
11056
+ const containerRect = 'containerRect';
11057
+ if (isNullOrUndefined(this.observer[containerRect])) {
11058
+ this.observer[containerRect] = this.observers[containerRect];
11059
+ }
10938
11060
  super[selectVirtualRow](args);
10939
11061
  }
10940
11062
  refreshCell(rowObj) {
@@ -11041,15 +11163,38 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
11041
11163
  const actionComplete$$1 = 'actionComplete';
11042
11164
  super[actionComplete$$1](args);
11043
11165
  }
11166
+ onEnteredAction() {
11167
+ return (element, current, direction, e, isWheel, check) => {
11168
+ const directVirtualRender = 'directVirtualRender';
11169
+ if (!this.parent[directVirtualRender]) { // with this property, columns are rendered without debouncing on horizontal scroll.
11170
+ const preventEvent = 'preventEvent';
11171
+ if (Browser.isIE && !isWheel && check && !this[preventEvent]) {
11172
+ this.parent.showSpinner();
11173
+ }
11174
+ const xAxis = current.axis === 'X';
11175
+ let x = this.getColumnOffset(xAxis ? this.vgenerator.getColumnIndexes()[0] - 1 : this.prevInfo.columnIndexes[0]
11176
+ - 1);
11177
+ if (xAxis) {
11178
+ const idx = Object.keys(this.vgenerator.cOffsets).length - this.prevInfo.columnIndexes.length;
11179
+ const maxLeft = this.vgenerator.cOffsets[idx - 1];
11180
+ x = x > maxLeft ? maxLeft : x; //TODO: This fix horizontal scrollbar jumping issue in column virtualization.
11181
+ }
11182
+ this.virtualEle.adjustTable(x, this.translateY);
11183
+ if (this.parent.enableColumnVirtualization) {
11184
+ this.header.virtualEle.adjustTable(x, 0);
11185
+ }
11186
+ }
11187
+ };
11188
+ }
11044
11189
  scrollListeners(scrollArgs) {
11045
11190
  const info = scrollArgs.sentinel;
11046
- const outBuffer = 10; //this.parent.pageSettings.pageSize - Math.ceil(this.parent.pageSettings.pageSize / 1.5);
11191
+ const outBuffer = this.parent.pageSettings.pageSize - Math.ceil(this.parent.pageSettings.pageSize / 2);
11047
11192
  const content = this.parent.getContent().querySelector('.e-content');
11048
11193
  const scrollHeight = outBuffer * this.parent.getRowHeight();
11049
11194
  const upScroll = (scrollArgs.offset.top - this.translateY) < 0;
11050
11195
  const downScroll = Math.ceil(scrollArgs.offset.top - this.translateY) >= scrollHeight;
11051
11196
  const selectedRowIndex = 'selectedRowIndex';
11052
- if (upScroll) {
11197
+ if (upScroll && (scrollArgs.direction !== 'right' && scrollArgs.direction !== 'left')) {
11053
11198
  const vHeight = +(this.parent.height.toString().indexOf('%') < 0 ? this.parent.height :
11054
11199
  this.parent.element.getBoundingClientRect().height);
11055
11200
  let index = (~~(content.scrollTop / this.parent.getRowHeight())
@@ -11086,7 +11231,7 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
11086
11231
  scrollArgs.offset.top - (outBuffer * height) + 10 : 0;
11087
11232
  }
11088
11233
  }
11089
- else if (downScroll) {
11234
+ else if (downScroll && (scrollArgs.direction !== 'right' && scrollArgs.direction !== 'left')) {
11090
11235
  let nextSetResIndex = ~~(content.scrollTop / this.parent.getRowHeight());
11091
11236
  const isLastBlock = (this[selectedRowIndex] + this.parent.pageSettings.pageSize) < this.totalRecords ? false : true;
11092
11237
  if (!isNullOrUndefined(this[selectedRowIndex]) && this[selectedRowIndex] !== -1 &&
@@ -11107,14 +11252,17 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
11107
11252
  this.translateY = scrollArgs.offset.top;
11108
11253
  }
11109
11254
  }
11110
- if ((downScroll && (scrollArgs.offset.top < (this.parent.getRowHeight() * this.totalRecords)))
11111
- || (upScroll)) {
11112
- const viewInfo = getValue('getInfoFromView', this).apply(this, [scrollArgs.direction, info, scrollArgs.offset]);
11255
+ if (((downScroll && (scrollArgs.offset.top < (this.parent.getRowHeight() * this.totalRecords)))
11256
+ || (upScroll)) || (scrollArgs.direction === 'right' || scrollArgs.direction === 'left')) {
11257
+ const viewInfo = this.currentInfo = getValue('getInfoFromView', this).apply(this, [scrollArgs.direction, info, scrollArgs.offset]);
11113
11258
  this.previousInfo = viewInfo;
11259
+ this.parent.setColumnIndexesInView(this.parent.enableColumnVirtualization ? viewInfo.columnIndexes : []);
11114
11260
  const page = viewInfo.loadNext && !viewInfo.loadSelf ? viewInfo.nextInfo.page : viewInfo.page;
11115
11261
  this.parent.setProperties({ pageSettings: { currentPage: page } }, true);
11116
- viewInfo.event = viewInfo.event === 'refresh-virtual-block' ? 'model-changed' : viewInfo.event;
11117
- this.parent.notify(viewInfo.event, { requestType: 'virtualscroll', focusElement: scrollArgs.focusElement });
11262
+ if (scrollArgs.direction !== 'right' && scrollArgs.direction !== 'left') {
11263
+ viewInfo.event = viewInfo.event === 'refresh-virtual-block' ? 'model-changed' : viewInfo.event;
11264
+ }
11265
+ this.parent.notify(viewInfo.event, { requestType: 'virtualscroll', virtualInfo: viewInfo, focusElement: scrollArgs.focusElement });
11118
11266
  }
11119
11267
  }
11120
11268
  appendContent(target, newChild, e) {
@@ -11131,7 +11279,14 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
11131
11279
  getValue('currentInfo', this) : e.virtualInfo;
11132
11280
  const cBlock = (info.columnIndexes[0]) - 1;
11133
11281
  const cOffset = this.getColumnOffset(cBlock);
11134
- this.virtualEle.setWrapperWidth(null, (Browser.isIE || Browser.info.name === 'edge'));
11282
+ let width;
11283
+ if (this.parent.enableColumnVirtualization) {
11284
+ this.header.virtualEle.adjustTable(cOffset, 0);
11285
+ const cIndex = info.columnIndexes;
11286
+ width = this.getColumnOffset(cIndex[cIndex.length - 1]) - this.getColumnOffset(cIndex[0] - 1) + '';
11287
+ this.header.virtualEle.setWrapperWidth(width);
11288
+ }
11289
+ this.virtualEle.setWrapperWidth(width, (Browser.isIE || Browser.info.name === 'edge'));
11135
11290
  target = this.parent.createElement('tbody');
11136
11291
  target.appendChild(newChild);
11137
11292
  const replace = 'replaceWith';
@@ -11143,8 +11298,12 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
11143
11298
  this.isExpandCollapse = false;
11144
11299
  }
11145
11300
  setValue('prevInfo', this.previousInfo ? this.previousInfo : info, this);
11301
+ if (e.requestType === 'virtualscroll' && e.virtualInfo.sentinelInfo.axis === 'X') {
11302
+ this.parent.notify(autoCol, {});
11303
+ }
11146
11304
  const focusCell = 'focusCell';
11147
11305
  const restoreAdd = 'restoreAdd';
11306
+ const ensureSelectedRowPosition = 'ensureSelectedRowPosition';
11148
11307
  super[focusCell](e);
11149
11308
  const isAdd = 'isAdd';
11150
11309
  if (this[isAdd] && !this.parent.getContent().querySelector('.e-content').querySelector('.e-addedrow')) {
@@ -11160,6 +11319,7 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
11160
11319
  }
11161
11320
  this.restoreEditState();
11162
11321
  super[restoreAdd]();
11322
+ super[ensureSelectedRowPosition]();
11163
11323
  }
11164
11324
  }
11165
11325
  removeEventListener() {
@@ -11192,27 +11352,33 @@ class TreeInterSectionObserver extends InterSectionObserver {
11192
11352
  this.lastPos = 0;
11193
11353
  this.timer = 0;
11194
11354
  }
11195
- observes(callback) {
11355
+ observes(callback, onEnterCallback) {
11196
11356
  const containerRect = 'containerRect';
11197
11357
  super[containerRect] = getValue('options', this).container.getBoundingClientRect();
11198
- EventHandler.add(getValue('options', this).container, 'scroll', this.virtualScrollHandlers(callback), this);
11358
+ EventHandler.add(getValue('options', this).container, 'scroll', this.virtualScrollHandlers(callback, onEnterCallback), this);
11199
11359
  }
11200
11360
  clear() {
11201
11361
  this.lastPos = null;
11202
11362
  }
11203
- virtualScrollHandlers(callback) {
11204
- let prevTop = 0;
11205
- let prevLeft = 0;
11363
+ virtualScrollHandlers(callback, onEnterCallback) {
11364
+ const delay = Browser.info.name === 'chrome' ? 200 : 100;
11365
+ const options = 'options';
11366
+ const movableEle = 'movableEle';
11367
+ const element = 'element';
11368
+ const fromWheel = 'fromWheel';
11369
+ const debounced100 = debounce(callback, delay);
11370
+ const debounced50 = debounce(callback, 50);
11371
+ this[options].prevTop = this[options].prevLeft = 0;
11206
11372
  return (e) => {
11207
- const scrollTop = e.target.scrollTop;
11208
- const scrollLeft = e.target.scrollLeft;
11209
- let direction = prevTop < scrollTop ? 'down' : 'up';
11210
- direction = prevLeft === scrollLeft ? direction : prevLeft < scrollLeft ? 'right' : 'left';
11211
- prevTop = scrollTop;
11212
- prevLeft = scrollLeft;
11213
- const current = getValue('sentinelInfo', this)[direction];
11373
+ const top = this[options].movableContainer ? this[options].container.scrollTop : e.target.scrollTop;
11374
+ const left = this[options].movableContainer ? this[options].scrollbar.scrollLeft : e.target.scrollLeft;
11375
+ let direction = this[options].prevTop < top ? 'down' : 'up';
11376
+ direction = this[options].prevLeft === left ? direction : this[options].prevLeft < left ? 'right' : 'left';
11377
+ this[options].prevTop = top;
11378
+ this[options].prevLeft = left;
11379
+ const current = this.sentinelInfo[direction];
11214
11380
  let delta = 0;
11215
- this.newPos = scrollTop;
11381
+ this.newPos = top;
11216
11382
  if (this.lastPos != null) { // && newPos < maxScroll
11217
11383
  delta = this.newPos - this.lastPos;
11218
11384
  }
@@ -11221,19 +11387,35 @@ class TreeInterSectionObserver extends InterSectionObserver {
11221
11387
  clearTimeout(this.timer);
11222
11388
  }
11223
11389
  this.timer = setTimeout(this.clear, 0);
11224
- /*if (this.options.axes.indexOf(current.axis) === -1) {
11225
- return;
11226
- }*/
11227
- /*if(delta > 45 || delta < -45){
11228
- this.isWheeling = true;
11229
- }*/
11230
11390
  if ((delta > 100 || delta < -100) && (e && e.preventDefault)) {
11231
11391
  e.returnValue = false;
11232
11392
  e.preventDefault();
11233
11393
  }
11234
- callback({ direction: direction, isWheel: this.isWheeling,
11235
- sentinel: current, offset: { top: scrollTop, left: scrollLeft },
11236
- focusElement: document.activeElement });
11394
+ if (this[options].axes.indexOf(current.axis) === -1) {
11395
+ return;
11396
+ }
11397
+ const check = this.check(direction);
11398
+ if (current.entered && current.axis === 'X') {
11399
+ if (this[movableEle] && (direction === 'right' || direction === 'left')) {
11400
+ onEnterCallback(this[movableEle], current, direction, { top: top, left: left }, this[fromWheel], check);
11401
+ }
11402
+ else {
11403
+ onEnterCallback(this[element], current, direction, { top: top, left: left }, this[fromWheel], check);
11404
+ }
11405
+ }
11406
+ if (check) {
11407
+ let fn = debounced100;
11408
+ if (current.axis === 'X') {
11409
+ fn = debounced50;
11410
+ fn({ direction: direction, sentinel: current, offset: { top: top, left: left },
11411
+ focusElement: document.activeElement });
11412
+ }
11413
+ else {
11414
+ callback({ direction: direction, sentinel: current, offset: { top: top, left: left },
11415
+ focusElement: document.activeElement });
11416
+ }
11417
+ }
11418
+ this[fromWheel] = false;
11237
11419
  };
11238
11420
  }
11239
11421
  }
@@ -11273,8 +11455,12 @@ class VirtualScroll$1 {
11273
11455
  * @returns {void}
11274
11456
  */
11275
11457
  addEventListener() {
11458
+ if (this.parent.isDestroyed) {
11459
+ return;
11460
+ }
11276
11461
  this.parent.on(localPagedExpandCollapse, this.collapseExpandVirtualchilds, this);
11277
11462
  this.parent.on(pagingActions, this.virtualPageAction, this);
11463
+ this.parent.on(destroy, this.destroy, this);
11278
11464
  }
11279
11465
  /**
11280
11466
  * @hidden
@@ -11286,6 +11472,7 @@ class VirtualScroll$1 {
11286
11472
  }
11287
11473
  this.parent.off(localPagedExpandCollapse, this.collapseExpandVirtualchilds);
11288
11474
  this.parent.off(pagingActions, this.virtualPageAction);
11475
+ this.parent.off(destroy, this.destroy);
11289
11476
  }
11290
11477
  collapseExpandVirtualchilds(row) {
11291
11478
  this.parent.grid.notify(virtualActionArgs, { isExpandCollapse: true });
@@ -11340,7 +11527,7 @@ class VirtualScroll$1 {
11340
11527
  const resourceCount = this.parent.getRows();
11341
11528
  let sIndex = visualData.indexOf(this.expandCollapseRec);
11342
11529
  const tempdata = visualData.slice(sIndex, sIndex + resourceCount.length);
11343
- if (tempdata.length < resourceCount.length && sIndex >= 0) {
11530
+ if (tempdata.length < resourceCount.length && sIndex >= 0 && startIndex !== 0) {
11344
11531
  sIndex = visualData.length - resourceCount.length;
11345
11532
  sIndex = sIndex > 0 ? sIndex : 0;
11346
11533
  startIndex = sIndex;
@@ -11351,17 +11538,17 @@ class VirtualScroll$1 {
11351
11538
  endIndex = this.parent.grid.pageSettings.pageSize - 1;
11352
11539
  this.parent.grid.notify(virtualActionArgs, { setTop: true });
11353
11540
  }
11354
- this.expandCollapseRec = null;
11355
11541
  }
11356
11542
  //}
11357
- if (!isNullOrUndefined(this.expandCollapseRec) && this.parent.enableCollapseAll) {
11543
+ if ((this.parent.enableCollapseAll || this.parent.expandStateMapping) && !isNullOrUndefined(this.expandCollapseRec)) {
11358
11544
  if (pageingDetails.count < this.parent.getRows()[0].getBoundingClientRect().height) {
11359
- startIndex = visualData[0].index;
11545
+ startIndex = 0;
11360
11546
  }
11361
11547
  else {
11362
11548
  startIndex = this.prevstartIndex === -1 ? 0 : this.prevstartIndex;
11363
11549
  }
11364
11550
  }
11551
+ this.expandCollapseRec = null;
11365
11552
  pageingDetails.result = visualData.slice(startIndex, endIndex);
11366
11553
  this.prevstartIndex = startIndex;
11367
11554
  this.prevendIndex = endIndex;
@@ -11388,8 +11575,13 @@ class TreeVirtual extends VirtualScroll {
11388
11575
  return 'treeVirtualScroll';
11389
11576
  }
11390
11577
  instantiateRenderers() {
11578
+ const parentGrid = getValue('parent', this);
11391
11579
  getValue('parent', this).log(['limitation', 'virtual_height'], 'virtualization');
11392
11580
  const renderer = getValue('locator', this).getService('rendererFactory');
11581
+ if (parentGrid.enableColumnVirtualization) {
11582
+ getValue('addRenderer', renderer)
11583
+ .apply(renderer, [RenderType.Header, new VirtualHeaderRenderer(getValue('parent', this), getValue('locator', this))]);
11584
+ }
11393
11585
  getValue('addRenderer', renderer)
11394
11586
  .apply(renderer, [RenderType.Content, new VirtualTreeContentRenderer(getValue('parent', this), getValue('locator', this))]);
11395
11587
  //renderer.addRenderer(RenderType.Content, new VirtualTreeContentRenderer(getValue('parent', this), getValue('locator', this)));
@@ -11444,7 +11636,8 @@ class Freeze$1 {
11444
11636
  const frozenrows = this.parent.getRows();
11445
11637
  let rows;
11446
11638
  let frozenRightRows;
11447
- let freeze = (this.parent.getFrozenLeftColumnsCount() > 0 || this.parent.getFrozenRightColumnsCount() > 0) ? true : false;
11639
+ const freeze = (this.parent.getFrozenLeftColumnsCount() > 0 ||
11640
+ this.parent.getFrozenRightColumnsCount() > 0) ? true : false;
11448
11641
  if (freeze) {
11449
11642
  frozenRightRows = this.parent.getFrozenRightRows().filter((e) => e.querySelector('.e-gridrowindex' + args.record.index + 'level' + (args.record.level + 1)));
11450
11643
  }
@@ -11859,5 +12052,5 @@ class InfiniteScroll$1 {
11859
12052
  * Export TreeGrid component
11860
12053
  */
11861
12054
 
11862
- 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 };
12055
+ 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 };
11863
12056
  //# sourceMappingURL=ej2-treegrid.es2015.js.map