@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 __extends$1 = (undefined && undefined.__extends) || (function () {
8
8
  var extendStatics = function (d, b) {
@@ -1896,11 +1896,21 @@ var Render = /** @__PURE__ @class */ (function () {
1896
1896
  }
1897
1897
  }
1898
1898
  this.parent['args'] = args;
1899
- if ((isNullOrUndefined(this.parent.rowTemplate) && !(this.parent.isReact))
1900
- || ((this.parent.isReact) &&
1901
- !args.column['template'])) {
1899
+ var columnModel = getValue('columnModel', this.parent);
1900
+ var treeColumn = columnModel[this.parent.treeColumnIndex];
1901
+ if ((isNullOrUndefined(this.parent.rowTemplate) && !(this.parent.isReact))) {
1902
1902
  this.parent.trigger(queryCellInfo, args);
1903
1903
  }
1904
+ else if (((this.parent.isReact) &&
1905
+ treeColumn.field !== args.column.field)) {
1906
+ var renderReactTemplates = 'renderReactTemplates';
1907
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
1908
+ var thisRef_2 = this;
1909
+ // tslint:disable-next-line:typedef
1910
+ thisRef_2.parent["" + renderReactTemplates](function () {
1911
+ thisRef_2.parent.trigger(queryCellInfo, args);
1912
+ });
1913
+ }
1904
1914
  };
1905
1915
  Render.prototype.updateTreeCell = function (args, cellElement) {
1906
1916
  var columnModel = getValue('columnModel', this.parent);
@@ -1936,10 +1946,10 @@ var Render = /** @__PURE__ @class */ (function () {
1936
1946
  }
1937
1947
  this.parent.notify('renderReactTemplate', this.parent["" + portals]);
1938
1948
  // eslint-disable-next-line @typescript-eslint/no-this-alias
1939
- var thisRef_2 = this;
1949
+ var thisRef_3 = this;
1940
1950
  // tslint:disable-next-line:typedef
1941
- thisRef_2.parent["" + renderReactTemplates](function () {
1942
- thisRef_2.parent.trigger(queryCellInfo, args);
1951
+ thisRef_3.parent["" + renderReactTemplates](function () {
1952
+ thisRef_3.parent.trigger(queryCellInfo, args);
1943
1953
  });
1944
1954
  }
1945
1955
  else {
@@ -3711,7 +3721,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
3711
3721
  return false;
3712
3722
  }
3713
3723
  };
3714
- TreeGrid_1.Inject(Selection);
3724
+ TreeGrid_1.Inject(Selection, Logger$1);
3715
3725
  setValue('mergePersistData', _this.mergePersistTreeGridData, _this);
3716
3726
  var logger = 'Logger';
3717
3727
  if (!isNullOrUndefined(_this.injectedModules["" + logger])) {
@@ -4120,7 +4130,6 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4120
4130
  TreeGrid.prototype.wireEvents = function () {
4121
4131
  EventHandler.add(this.grid.element, 'click', this.mouseClickHandler, this);
4122
4132
  EventHandler.add(this.element, 'touchend', this.mouseClickHandler, this);
4123
- EventHandler.add(this.element, 'mousemove', this.mouseMoveHandler, this);
4124
4133
  this.keyboardModule = new KeyboardEvents(this.element, {
4125
4134
  keyAction: this.treeGridkeyActionHandler.bind(this),
4126
4135
  keyConfigs: this.keyConfigs,
@@ -4144,78 +4153,94 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4144
4153
  return modules;
4145
4154
  }
4146
4155
  modules.push({
4147
- member: 'filter', args: [this, this.filterSettings]
4156
+ member: 'filter', args: [this, this.filterSettings],
4157
+ name: 'Filter'
4148
4158
  });
4149
4159
  if (!isNullOrUndefined(this.toolbar)) {
4150
4160
  modules.push({
4151
4161
  member: 'toolbar',
4152
- args: [this]
4162
+ args: [this],
4163
+ name: 'Toolbar'
4153
4164
  });
4154
4165
  }
4155
4166
  if (this.contextMenuItems) {
4156
4167
  modules.push({
4157
4168
  member: 'contextMenu',
4158
- args: [this]
4169
+ args: [this],
4170
+ name: 'ContextMenu'
4159
4171
  });
4160
4172
  }
4161
4173
  if (this.allowPaging) {
4162
4174
  modules.push({
4163
4175
  member: 'pager',
4164
- args: [this, this.pageSettings]
4176
+ args: [this, this.pageSettings],
4177
+ name: 'Page'
4165
4178
  });
4166
4179
  }
4167
4180
  if (this.allowReordering) {
4168
4181
  modules.push({
4169
4182
  member: 'reorder',
4170
- args: [this]
4183
+ args: [this],
4184
+ name: 'Reorder'
4171
4185
  });
4172
4186
  }
4173
4187
  if (this.allowSorting) {
4174
4188
  modules.push({
4175
4189
  member: 'sort',
4176
- args: [this]
4190
+ args: [this],
4191
+ name: 'Sort'
4177
4192
  });
4178
4193
  }
4179
4194
  if (this.aggregates.length > 0) {
4180
4195
  modules.push({
4181
- member: 'summary', args: [this]
4196
+ member: 'summary', args: [this],
4197
+ name: 'Aggregate'
4198
+ });
4199
+ }
4200
+ if (this.allowResizing) {
4201
+ modules.push({
4202
+ member: 'resize', args: [this],
4203
+ name: 'Resize'
4182
4204
  });
4183
4205
  }
4184
- modules.push({
4185
- member: 'resize', args: [this]
4186
- });
4187
4206
  if (this.allowExcelExport) {
4188
4207
  modules.push({
4189
- member: 'ExcelExport', args: [this]
4208
+ member: 'ExcelExport', args: [this],
4209
+ name: 'ExcelExport'
4190
4210
  });
4191
4211
  }
4192
4212
  var freezePresent = this.injectedModules.filter(function (e) {
4193
4213
  return e.prototype.getModuleName() === 'freeze';
4194
4214
  });
4195
- if (this.frozenColumns || this.frozenRows || this.getFrozenColumns() ||
4196
- this.grid.getFrozenLeftColumnsCount() || this.grid.getFrozenRightColumnsCount() || freezePresent.length) {
4215
+ if ((this.frozenColumns || this.frozenRows || this.getFrozenColumns() ||
4216
+ this.grid.getFrozenLeftColumnsCount() || this.grid.getFrozenRightColumnsCount()) && freezePresent.length > 0) {
4197
4217
  modules.push({
4198
- member: 'freeze', args: [this]
4218
+ member: 'freeze', args: [this],
4219
+ name: 'Freeze'
4199
4220
  });
4200
4221
  }
4201
4222
  if (this.detailTemplate) {
4202
4223
  modules.push({
4203
- member: 'detailRow', args: [this]
4224
+ member: 'detailRow', args: [this],
4225
+ name: 'DetailRow'
4204
4226
  });
4205
4227
  }
4206
4228
  if (this.allowPdfExport) {
4207
4229
  modules.push({
4208
- member: 'PdfExport', args: [this]
4230
+ member: 'PdfExport', args: [this],
4231
+ name: 'PdfExport'
4209
4232
  });
4210
4233
  }
4211
4234
  if (this.showColumnMenu) {
4212
4235
  modules.push({
4213
- member: 'columnMenu', args: [this]
4236
+ member: 'columnMenu', args: [this],
4237
+ name: 'ColumnMenu'
4214
4238
  });
4215
4239
  }
4216
4240
  if (this.showColumnChooser) {
4217
4241
  modules.push({
4218
- member: 'ColumnChooser', args: [this]
4242
+ member: 'ColumnChooser', args: [this],
4243
+ name: 'ColumnChooser'
4219
4244
  });
4220
4245
  }
4221
4246
  this.extendRequiredModules(modules);
@@ -4232,37 +4257,43 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4232
4257
  }
4233
4258
  modules.push({
4234
4259
  member: 'rowDragAndDrop',
4235
- args: [this]
4260
+ args: [this],
4261
+ name: 'RowDD'
4236
4262
  });
4237
4263
  }
4238
4264
  if (this.editSettings.allowAdding || this.editSettings.allowDeleting || this.editSettings.allowEditing) {
4239
4265
  modules.push({
4240
4266
  member: 'edit',
4241
- args: [this]
4267
+ args: [this],
4268
+ name: 'Edit'
4242
4269
  });
4243
4270
  }
4244
4271
  if (this.isCommandColumn(this.columns)) {
4245
4272
  modules.push({
4246
4273
  member: 'commandColumn',
4247
- args: [this]
4274
+ args: [this],
4275
+ name: 'CommandColumn'
4248
4276
  });
4249
4277
  }
4250
4278
  if (this.allowSelection) {
4251
4279
  modules.push({
4252
4280
  member: 'selection',
4253
- args: [this]
4281
+ args: [this],
4282
+ name: 'Selection'
4254
4283
  });
4255
4284
  }
4256
4285
  if (this.enableVirtualization) {
4257
4286
  modules.push({
4258
4287
  member: 'virtualScroll',
4259
- args: [this]
4288
+ args: [this],
4289
+ name: 'VirtualScroll'
4260
4290
  });
4261
4291
  }
4262
4292
  if (this.enableInfiniteScrolling) {
4263
4293
  modules.push({
4264
4294
  member: 'infiniteScroll',
4265
- args: [this]
4295
+ args: [this],
4296
+ name: 'InfiniteScroll'
4266
4297
  });
4267
4298
  }
4268
4299
  modules.push({
@@ -4289,6 +4320,16 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4289
4320
  if (this.grid && this.grid.element) {
4290
4321
  EventHandler.remove(this.grid.element, 'click', this.mouseClickHandler);
4291
4322
  }
4323
+ if (this.element) {
4324
+ EventHandler.remove(this.element, 'touchend', this.mouseClickHandler);
4325
+ if (this.keyboardModule) {
4326
+ this.keyboardModule.destroy();
4327
+ this.keyboardModule = null;
4328
+ }
4329
+ if (this.allowKeyboard) {
4330
+ this.element.removeAttribute('tabIndex');
4331
+ }
4332
+ }
4292
4333
  };
4293
4334
  /**
4294
4335
  * Logs tree grid error message on console
@@ -5591,6 +5632,11 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
5591
5632
  target.classList.contains('e-treegridcollapse')) && (!this.isEditCollapse && !this.grid.isEdit)) {
5592
5633
  this.expandCollapseRequest(target);
5593
5634
  }
5635
+ var isEllipsisTooltip = 'isEllipsisTooltip';
5636
+ if ((target.classList.contains('e-treegridexpand') || target.classList.contains('e-treegridcollapse')) &&
5637
+ (this.grid["" + isEllipsisTooltip]())) {
5638
+ this.grid['toolTipObj'].close();
5639
+ }
5594
5640
  this.isEditCollapse = false;
5595
5641
  this.notify('checkboxSelection', { target: target });
5596
5642
  if (this.grid.isCheckBoxSelection && !this.grid.isPersistSelection) {
@@ -5606,20 +5652,6 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
5606
5652
  }
5607
5653
  }
5608
5654
  };
5609
- TreeGrid.prototype.mouseMoveHandler = function (e) {
5610
- var showTooltip = false;
5611
- var cols = this.getColumns();
5612
- if (this.clipMode === 'EllipsisWithTooltip') {
5613
- showTooltip = true;
5614
- }
5615
- var element = parentsUntil(e.target, 'e-ellipsistooltip');
5616
- 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) {
5617
- var tooltip = new Tooltip({
5618
- content: element.textContent
5619
- });
5620
- tooltip.appendTo(element);
5621
- }
5622
- };
5623
5655
  /**
5624
5656
  * Returns TreeGrid rows
5625
5657
  *
@@ -6718,11 +6750,16 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
6718
6750
  this.expandCollapseAll('collapse');
6719
6751
  };
6720
6752
  TreeGrid.prototype.expandCollapseAll = function (action) {
6721
- var rows = this.getRows().filter(function (e) {
6722
- return e.querySelector('.e-treegrid' + (action === 'expand' ? 'collapse' : 'expand'));
6723
- });
6724
- if (!rows.length && this.getRows().length) {
6725
- rows.push(this.getRows()[0]);
6753
+ var rows;
6754
+ if (this.rowTemplate) {
6755
+ rows = [].slice.call(this.grid.getContentTable().querySelectorAll('tr')).filter(function (e) {
6756
+ return e.querySelector('.e-treegrid' + (action === 'expand' ? 'collapse' : 'expand'));
6757
+ });
6758
+ }
6759
+ else {
6760
+ rows = this.getRows().filter(function (e) {
6761
+ return e.querySelector('.e-treegrid' + (action === 'expand' ? 'collapse' : 'expand'));
6762
+ });
6726
6763
  }
6727
6764
  this.isExpandAll = true;
6728
6765
  this.isCollapseAll = true;
@@ -7803,7 +7840,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
7803
7840
  Property(false)
7804
7841
  ], TreeGrid.prototype, "enableColumnVirtualization", void 0);
7805
7842
  __decorate([
7806
- Property(false)
7843
+ Property(true)
7807
7844
  ], TreeGrid.prototype, "enableHtmlSanitizer", void 0);
7808
7845
  __decorate([
7809
7846
  Property(false)
@@ -9632,8 +9669,10 @@ var TreeVirtualRowModelGenerator = /** @__PURE__ @class */ (function (_super) {
9632
9669
  notifyArgs.requestType = 'refresh';
9633
9670
  }
9634
9671
  var rows = _super.prototype.generateRows.call(this, data, notifyArgs);
9635
- for (var r = 0; r < rows.length; r++) {
9636
- rows[parseInt(r.toString(), 10)].index = (this.visualData).indexOf(rows[parseInt(r.toString(), 10)].data);
9672
+ if (!isNullOrUndefined((this.visualData))) {
9673
+ for (var r = 0; r < rows.length; r++) {
9674
+ rows[parseInt(r.toString(), 10)].index = (this.visualData).indexOf(rows[parseInt(r.toString(), 10)].data);
9675
+ }
9637
9676
  }
9638
9677
  return rows;
9639
9678
  }
@@ -10827,12 +10866,7 @@ var Aggregate$1 = /** @__PURE__ @class */ (function () {
10827
10866
  if (this.parent.isReact) {
10828
10867
  var renderReactTemplates = 'renderReactTemplates';
10829
10868
  tempObj.fn(single[summaryColumn.columnName], this.parent, tempObj.property, '', null, null, cellElement);
10830
- // eslint-disable-next-line @typescript-eslint/no-this-alias
10831
- var thisRef_1 = this;
10832
- // tslint:disable-next-line:typedef
10833
- thisRef_1.parent["" + renderReactTemplates](function () {
10834
- thisRef_1.parent.trigger(queryCellInfo, thisRef_1.parent['args']);
10835
- });
10869
+ this.parent["" + renderReactTemplates]();
10836
10870
  }
10837
10871
  else {
10838
10872
  appendChildren(cellElement, tempObj.fn(single[summaryColumn.columnName], this.parent, tempObj.property));
@@ -13780,10 +13814,16 @@ var VirtualScroll$1 = /** @__PURE__ @class */ (function () {
13780
13814
  this.parent.grid.getContent().firstElementChild.scrollTop = 0;
13781
13815
  this.parent.grid.notify(virtualActionArgs, { setTop: true });
13782
13816
  }
13783
- if ((requestType === 'save' && pageingDetails.actionArgs.index >= (counts.count - this.parent.grid.pageSettings.pageSize)) || (requestType === 'refresh' && this.parent['isGantt'] && this.parent['isAddedFromGantt']
13784
- && this.parent.grid.pageSettings.currentPage === this.parent.grid.contentModule['maxPage'])) {
13785
- startIndex = counts.startIndex + (counts.count - counts.endIndex);
13786
- endIndex = counts.count;
13817
+ if ((requestType === 'save' && pageingDetails.actionArgs.index >= (counts.count - this.parent.grid.pageSettings.pageSize)) || (requestType === 'refresh' && this.parent['isGantt'] && this.parent['isAddedFromGantt'])) {
13818
+ var modifiedStartIndex = counts.startIndex + (counts.count - counts.endIndex);
13819
+ if (counts.startIndex <= modifiedStartIndex && counts.endIndex <= modifiedStartIndex) {
13820
+ startIndex = counts.startIndex;
13821
+ endIndex = counts.endIndex;
13822
+ }
13823
+ else {
13824
+ startIndex = modifiedStartIndex;
13825
+ endIndex = counts.count;
13826
+ }
13787
13827
  this.parent['isAddedFromGantt'] = false;
13788
13828
  }
13789
13829
  //if ((this.prevendIndex !== -1 && this.prevstartIndex !== -1) &&