@syncfusion/ej2-treegrid 24.2.8 → 25.1.35

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 (56) hide show
  1. package/CHANGELOG.md +2 -53
  2. package/dist/ej2-treegrid.min.js +2 -2
  3. package/dist/ej2-treegrid.umd.min.js +2 -2
  4. package/dist/ej2-treegrid.umd.min.js.map +1 -1
  5. package/dist/es6/ej2-treegrid.es2015.js +102 -62
  6. package/dist/es6/ej2-treegrid.es2015.js.map +1 -1
  7. package/dist/es6/ej2-treegrid.es5.js +105 -65
  8. package/dist/es6/ej2-treegrid.es5.js.map +1 -1
  9. package/dist/global/ej2-treegrid.min.js +2 -2
  10. package/dist/global/ej2-treegrid.min.js.map +1 -1
  11. package/dist/global/index.d.ts +1 -1
  12. package/package.json +10 -10
  13. package/src/treegrid/actions/summary.js +1 -7
  14. package/src/treegrid/actions/virtual-scroll.js +10 -4
  15. package/src/treegrid/base/treegrid-model.d.ts +3 -3
  16. package/src/treegrid/base/treegrid.d.ts +2 -3
  17. package/src/treegrid/base/treegrid.js +74 -48
  18. package/src/treegrid/renderer/render.js +16 -6
  19. package/src/treegrid/renderer/virtual-row-model-generator.js +4 -2
  20. package/styles/bootstrap-dark.css +8 -0
  21. package/styles/bootstrap.css +8 -0
  22. package/styles/bootstrap4.css +8 -0
  23. package/styles/bootstrap5-dark.css +8 -0
  24. package/styles/bootstrap5.css +8 -0
  25. package/styles/fabric-dark.css +8 -0
  26. package/styles/fabric.css +8 -0
  27. package/styles/fluent-dark.css +8 -0
  28. package/styles/fluent.css +8 -0
  29. package/styles/highcontrast-light.css +8 -0
  30. package/styles/highcontrast.css +8 -0
  31. package/styles/material-dark.css +8 -0
  32. package/styles/material.css +8 -0
  33. package/styles/material3-dark.css +8 -0
  34. package/styles/material3.css +8 -0
  35. package/styles/tailwind-dark.css +8 -0
  36. package/styles/tailwind.css +8 -0
  37. package/styles/treegrid/_bds-definition.scss +28 -0
  38. package/styles/treegrid/_layout.scss +9 -1
  39. package/styles/treegrid/bootstrap-dark.css +8 -0
  40. package/styles/treegrid/bootstrap.css +8 -0
  41. package/styles/treegrid/bootstrap4.css +8 -0
  42. package/styles/treegrid/bootstrap5-dark.css +8 -0
  43. package/styles/treegrid/bootstrap5.css +8 -0
  44. package/styles/treegrid/fabric-dark.css +8 -0
  45. package/styles/treegrid/fabric.css +8 -0
  46. package/styles/treegrid/fluent-dark.css +8 -0
  47. package/styles/treegrid/fluent.css +8 -0
  48. package/styles/treegrid/highcontrast-light.css +8 -0
  49. package/styles/treegrid/highcontrast.css +8 -0
  50. package/styles/treegrid/icons/_bds.scss +37 -0
  51. package/styles/treegrid/material-dark.css +8 -0
  52. package/styles/treegrid/material.css +8 -0
  53. package/styles/treegrid/material3-dark.css +8 -0
  54. package/styles/treegrid/material3.css +8 -0
  55. package/styles/treegrid/tailwind-dark.css +8 -0
  56. package/styles/treegrid/tailwind.css +8 -0
@@ -2,7 +2,7 @@ import { Browser, ChildProperty, Collection, Complex, Component, Event, EventHan
2
2
  import { Aggregate, Cell, CellRenderer, 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, getNumberFormat, getObject, getTransformValues, 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
- import { Tooltip, createSpinner, hideSpinner, showSpinner } from '@syncfusion/ej2-popups';
5
+ import { createSpinner, hideSpinner, showSpinner } from '@syncfusion/ej2-popups';
6
6
 
7
7
  var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
8
8
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -1739,11 +1739,21 @@ class Render {
1739
1739
  }
1740
1740
  }
1741
1741
  this.parent['args'] = args;
1742
- if ((isNullOrUndefined(this.parent.rowTemplate) && !(this.parent.isReact))
1743
- || ((this.parent.isReact) &&
1744
- !args.column['template'])) {
1742
+ const columnModel = getValue('columnModel', this.parent);
1743
+ const treeColumn = columnModel[this.parent.treeColumnIndex];
1744
+ if ((isNullOrUndefined(this.parent.rowTemplate) && !(this.parent.isReact))) {
1745
1745
  this.parent.trigger(queryCellInfo, args);
1746
1746
  }
1747
+ else if (((this.parent.isReact) &&
1748
+ treeColumn.field !== args.column.field)) {
1749
+ const renderReactTemplates = 'renderReactTemplates';
1750
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
1751
+ const thisRef = this;
1752
+ // tslint:disable-next-line:typedef
1753
+ thisRef.parent[`${renderReactTemplates}`](function () {
1754
+ thisRef.parent.trigger(queryCellInfo, args);
1755
+ });
1756
+ }
1747
1757
  }
1748
1758
  updateTreeCell(args, cellElement) {
1749
1759
  const columnModel = getValue('columnModel', this.parent);
@@ -3424,7 +3434,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
3424
3434
  return false;
3425
3435
  }
3426
3436
  };
3427
- TreeGrid_1.Inject(Selection);
3437
+ TreeGrid_1.Inject(Selection, Logger$1);
3428
3438
  setValue('mergePersistData', this.mergePersistTreeGridData, this);
3429
3439
  const logger = 'Logger';
3430
3440
  if (!isNullOrUndefined(this.injectedModules[`${logger}`])) {
@@ -3831,7 +3841,6 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
3831
3841
  wireEvents() {
3832
3842
  EventHandler.add(this.grid.element, 'click', this.mouseClickHandler, this);
3833
3843
  EventHandler.add(this.element, 'touchend', this.mouseClickHandler, this);
3834
- EventHandler.add(this.element, 'mousemove', this.mouseMoveHandler, this);
3835
3844
  this.keyboardModule = new KeyboardEvents(this.element, {
3836
3845
  keyAction: this.treeGridkeyActionHandler.bind(this),
3837
3846
  keyConfigs: this.keyConfigs,
@@ -3855,78 +3864,94 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
3855
3864
  return modules;
3856
3865
  }
3857
3866
  modules.push({
3858
- member: 'filter', args: [this, this.filterSettings]
3867
+ member: 'filter', args: [this, this.filterSettings],
3868
+ name: 'Filter'
3859
3869
  });
3860
3870
  if (!isNullOrUndefined(this.toolbar)) {
3861
3871
  modules.push({
3862
3872
  member: 'toolbar',
3863
- args: [this]
3873
+ args: [this],
3874
+ name: 'Toolbar'
3864
3875
  });
3865
3876
  }
3866
3877
  if (this.contextMenuItems) {
3867
3878
  modules.push({
3868
3879
  member: 'contextMenu',
3869
- args: [this]
3880
+ args: [this],
3881
+ name: 'ContextMenu'
3870
3882
  });
3871
3883
  }
3872
3884
  if (this.allowPaging) {
3873
3885
  modules.push({
3874
3886
  member: 'pager',
3875
- args: [this, this.pageSettings]
3887
+ args: [this, this.pageSettings],
3888
+ name: 'Page'
3876
3889
  });
3877
3890
  }
3878
3891
  if (this.allowReordering) {
3879
3892
  modules.push({
3880
3893
  member: 'reorder',
3881
- args: [this]
3894
+ args: [this],
3895
+ name: 'Reorder'
3882
3896
  });
3883
3897
  }
3884
3898
  if (this.allowSorting) {
3885
3899
  modules.push({
3886
3900
  member: 'sort',
3887
- args: [this]
3901
+ args: [this],
3902
+ name: 'Sort'
3888
3903
  });
3889
3904
  }
3890
3905
  if (this.aggregates.length > 0) {
3891
3906
  modules.push({
3892
- member: 'summary', args: [this]
3907
+ member: 'summary', args: [this],
3908
+ name: 'Aggregate'
3909
+ });
3910
+ }
3911
+ if (this.allowResizing) {
3912
+ modules.push({
3913
+ member: 'resize', args: [this],
3914
+ name: 'Resize'
3893
3915
  });
3894
3916
  }
3895
- modules.push({
3896
- member: 'resize', args: [this]
3897
- });
3898
3917
  if (this.allowExcelExport) {
3899
3918
  modules.push({
3900
- member: 'ExcelExport', args: [this]
3919
+ member: 'ExcelExport', args: [this],
3920
+ name: 'ExcelExport'
3901
3921
  });
3902
3922
  }
3903
3923
  const freezePresent = this.injectedModules.filter((e) => {
3904
3924
  return e.prototype.getModuleName() === 'freeze';
3905
3925
  });
3906
- if (this.frozenColumns || this.frozenRows || this.getFrozenColumns() ||
3907
- this.grid.getFrozenLeftColumnsCount() || this.grid.getFrozenRightColumnsCount() || freezePresent.length) {
3926
+ if ((this.frozenColumns || this.frozenRows || this.getFrozenColumns() ||
3927
+ this.grid.getFrozenLeftColumnsCount() || this.grid.getFrozenRightColumnsCount()) && freezePresent.length > 0) {
3908
3928
  modules.push({
3909
- member: 'freeze', args: [this]
3929
+ member: 'freeze', args: [this],
3930
+ name: 'Freeze'
3910
3931
  });
3911
3932
  }
3912
3933
  if (this.detailTemplate) {
3913
3934
  modules.push({
3914
- member: 'detailRow', args: [this]
3935
+ member: 'detailRow', args: [this],
3936
+ name: 'DetailRow'
3915
3937
  });
3916
3938
  }
3917
3939
  if (this.allowPdfExport) {
3918
3940
  modules.push({
3919
- member: 'PdfExport', args: [this]
3941
+ member: 'PdfExport', args: [this],
3942
+ name: 'PdfExport'
3920
3943
  });
3921
3944
  }
3922
3945
  if (this.showColumnMenu) {
3923
3946
  modules.push({
3924
- member: 'columnMenu', args: [this]
3947
+ member: 'columnMenu', args: [this],
3948
+ name: 'ColumnMenu'
3925
3949
  });
3926
3950
  }
3927
3951
  if (this.showColumnChooser) {
3928
3952
  modules.push({
3929
- member: 'ColumnChooser', args: [this]
3953
+ member: 'ColumnChooser', args: [this],
3954
+ name: 'ColumnChooser'
3930
3955
  });
3931
3956
  }
3932
3957
  this.extendRequiredModules(modules);
@@ -3943,37 +3968,43 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
3943
3968
  }
3944
3969
  modules.push({
3945
3970
  member: 'rowDragAndDrop',
3946
- args: [this]
3971
+ args: [this],
3972
+ name: 'RowDD'
3947
3973
  });
3948
3974
  }
3949
3975
  if (this.editSettings.allowAdding || this.editSettings.allowDeleting || this.editSettings.allowEditing) {
3950
3976
  modules.push({
3951
3977
  member: 'edit',
3952
- args: [this]
3978
+ args: [this],
3979
+ name: 'Edit'
3953
3980
  });
3954
3981
  }
3955
3982
  if (this.isCommandColumn(this.columns)) {
3956
3983
  modules.push({
3957
3984
  member: 'commandColumn',
3958
- args: [this]
3985
+ args: [this],
3986
+ name: 'CommandColumn'
3959
3987
  });
3960
3988
  }
3961
3989
  if (this.allowSelection) {
3962
3990
  modules.push({
3963
3991
  member: 'selection',
3964
- args: [this]
3992
+ args: [this],
3993
+ name: 'Selection'
3965
3994
  });
3966
3995
  }
3967
3996
  if (this.enableVirtualization) {
3968
3997
  modules.push({
3969
3998
  member: 'virtualScroll',
3970
- args: [this]
3999
+ args: [this],
4000
+ name: 'VirtualScroll'
3971
4001
  });
3972
4002
  }
3973
4003
  if (this.enableInfiniteScrolling) {
3974
4004
  modules.push({
3975
4005
  member: 'infiniteScroll',
3976
- args: [this]
4006
+ args: [this],
4007
+ name: 'InfiniteScroll'
3977
4008
  });
3978
4009
  }
3979
4010
  modules.push({
@@ -3999,6 +4030,16 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
3999
4030
  if (this.grid && this.grid.element) {
4000
4031
  EventHandler.remove(this.grid.element, 'click', this.mouseClickHandler);
4001
4032
  }
4033
+ if (this.element) {
4034
+ EventHandler.remove(this.element, 'touchend', this.mouseClickHandler);
4035
+ if (this.keyboardModule) {
4036
+ this.keyboardModule.destroy();
4037
+ this.keyboardModule = null;
4038
+ }
4039
+ if (this.allowKeyboard) {
4040
+ this.element.removeAttribute('tabIndex');
4041
+ }
4042
+ }
4002
4043
  }
4003
4044
  /**
4004
4045
  * Logs tree grid error message on console
@@ -5287,6 +5328,11 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5287
5328
  target.classList.contains('e-treegridcollapse')) && (!this.isEditCollapse && !this.grid.isEdit)) {
5288
5329
  this.expandCollapseRequest(target);
5289
5330
  }
5331
+ const isEllipsisTooltip = 'isEllipsisTooltip';
5332
+ if ((target.classList.contains('e-treegridexpand') || target.classList.contains('e-treegridcollapse')) &&
5333
+ (this.grid[`${isEllipsisTooltip}`]())) {
5334
+ this.grid['toolTipObj'].close();
5335
+ }
5290
5336
  this.isEditCollapse = false;
5291
5337
  this.notify('checkboxSelection', { target: target });
5292
5338
  if (this.grid.isCheckBoxSelection && !this.grid.isPersistSelection) {
@@ -5302,20 +5348,6 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5302
5348
  }
5303
5349
  }
5304
5350
  }
5305
- mouseMoveHandler(e) {
5306
- let showTooltip = false;
5307
- const cols = this.getColumns();
5308
- if (this.clipMode === 'EllipsisWithTooltip') {
5309
- showTooltip = true;
5310
- }
5311
- const element = parentsUntil(e.target, 'e-ellipsistooltip');
5312
- if ((showTooltip || (this.treeColumnIndex !== -1 && cols[this.treeColumnIndex].clipMode === 'EllipsisWithTooltip')) && element !== null && parseInt(element.getAttribute('data-colindex'), 10) === this.treeColumnIndex && element.children[0].scrollWidth > element.children[0].clientWidth) {
5313
- const tooltip = new Tooltip({
5314
- content: element.textContent
5315
- });
5316
- tooltip.appendTo(element);
5317
- }
5318
- }
5319
5351
  /**
5320
5352
  * Returns TreeGrid rows
5321
5353
  *
@@ -6403,11 +6435,16 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
6403
6435
  this.expandCollapseAll('collapse');
6404
6436
  }
6405
6437
  expandCollapseAll(action) {
6406
- const rows = this.getRows().filter((e) => {
6407
- return e.querySelector('.e-treegrid' + (action === 'expand' ? 'collapse' : 'expand'));
6408
- });
6409
- if (!rows.length && this.getRows().length) {
6410
- rows.push(this.getRows()[0]);
6438
+ let rows;
6439
+ if (this.rowTemplate) {
6440
+ rows = [].slice.call(this.grid.getContentTable().querySelectorAll('tr')).filter((e) => {
6441
+ return e.querySelector('.e-treegrid' + (action === 'expand' ? 'collapse' : 'expand'));
6442
+ });
6443
+ }
6444
+ else {
6445
+ rows = this.getRows().filter((e) => {
6446
+ return e.querySelector('.e-treegrid' + (action === 'expand' ? 'collapse' : 'expand'));
6447
+ });
6411
6448
  }
6412
6449
  this.isExpandAll = true;
6413
6450
  this.isCollapseAll = true;
@@ -7470,7 +7507,7 @@ __decorate([
7470
7507
  Property(false)
7471
7508
  ], TreeGrid.prototype, "enableColumnVirtualization", void 0);
7472
7509
  __decorate([
7473
- Property(false)
7510
+ Property(true)
7474
7511
  ], TreeGrid.prototype, "enableHtmlSanitizer", void 0);
7475
7512
  __decorate([
7476
7513
  Property(false)
@@ -9255,8 +9292,10 @@ class TreeVirtualRowModelGenerator extends VirtualRowModelGenerator {
9255
9292
  notifyArgs.requestType = 'refresh';
9256
9293
  }
9257
9294
  const rows = super.generateRows(data, notifyArgs);
9258
- for (let r = 0; r < rows.length; r++) {
9259
- rows[parseInt(r.toString(), 10)].index = (this.visualData).indexOf(rows[parseInt(r.toString(), 10)].data);
9295
+ if (!isNullOrUndefined((this.visualData))) {
9296
+ for (let r = 0; r < rows.length; r++) {
9297
+ rows[parseInt(r.toString(), 10)].index = (this.visualData).indexOf(rows[parseInt(r.toString(), 10)].data);
9298
+ }
9260
9299
  }
9261
9300
  return rows;
9262
9301
  }
@@ -10432,12 +10471,7 @@ class Aggregate$1 {
10432
10471
  if (this.parent.isReact) {
10433
10472
  const renderReactTemplates = 'renderReactTemplates';
10434
10473
  tempObj.fn(single[summaryColumn.columnName], this.parent, tempObj.property, '', null, null, cellElement);
10435
- // eslint-disable-next-line @typescript-eslint/no-this-alias
10436
- const thisRef = this;
10437
- // tslint:disable-next-line:typedef
10438
- thisRef.parent[`${renderReactTemplates}`](function () {
10439
- thisRef.parent.trigger(queryCellInfo, thisRef.parent['args']);
10440
- });
10474
+ this.parent[`${renderReactTemplates}`]();
10441
10475
  }
10442
10476
  else {
10443
10477
  appendChildren(cellElement, tempObj.fn(single[summaryColumn.columnName], this.parent, tempObj.property));
@@ -13332,10 +13366,16 @@ class VirtualScroll$1 {
13332
13366
  this.parent.grid.getContent().firstElementChild.scrollTop = 0;
13333
13367
  this.parent.grid.notify(virtualActionArgs, { setTop: true });
13334
13368
  }
13335
- if ((requestType === 'save' && pageingDetails.actionArgs.index >= (counts.count - this.parent.grid.pageSettings.pageSize)) || (requestType === 'refresh' && this.parent['isGantt'] && this.parent['isAddedFromGantt']
13336
- && this.parent.grid.pageSettings.currentPage === this.parent.grid.contentModule['maxPage'])) {
13337
- startIndex = counts.startIndex + (counts.count - counts.endIndex);
13338
- endIndex = counts.count;
13369
+ if ((requestType === 'save' && pageingDetails.actionArgs.index >= (counts.count - this.parent.grid.pageSettings.pageSize)) || (requestType === 'refresh' && this.parent['isGantt'] && this.parent['isAddedFromGantt'])) {
13370
+ const modifiedStartIndex = counts.startIndex + (counts.count - counts.endIndex);
13371
+ if (counts.startIndex <= modifiedStartIndex && counts.endIndex <= modifiedStartIndex) {
13372
+ startIndex = counts.startIndex;
13373
+ endIndex = counts.endIndex;
13374
+ }
13375
+ else {
13376
+ startIndex = modifiedStartIndex;
13377
+ endIndex = counts.count;
13378
+ }
13339
13379
  this.parent['isAddedFromGantt'] = false;
13340
13380
  }
13341
13381
  //if ((this.prevendIndex !== -1 && this.prevstartIndex !== -1) &&