@syncfusion/ej2-treegrid 23.2.7 → 24.1.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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 { createSpinner, hideSpinner, showSpinner } from '@syncfusion/ej2-popups';
5
+ import { Tooltip, 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) {
@@ -649,7 +649,7 @@ var TreeClipboard = /** @__PURE__ @class */ (function (_super) {
649
649
  this.treeCopyContent += '\n';
650
650
  }
651
651
  if (!rows[selectedIndexes[parseInt(i.toString(), 10)]].classList.contains('e-summaryrow')) {
652
- var cells = [].slice.call(rows[selectedIndexes[parseInt(i.toString(), 10)]].querySelectorAll('.e-rowcell:not(.e-hide)'));
652
+ var cells = [].slice.call(rows[selectedIndexes[parseInt(i.toString(), 10)]].querySelectorAll('.e-rowcell'));
653
653
  var uniqueid = this.treeGridParent.getSelectedRecords()[parseInt(i.toString(), 10)]["" + uniqueID];
654
654
  if (this.copiedUniqueIdCollection.indexOf(uniqueid) === -1) {
655
655
  if (this.treeGridParent.copyHierarchyMode === 'Parent' || this.treeGridParent.copyHierarchyMode === 'Both') {
@@ -711,7 +711,7 @@ var TreeClipboard = /** @__PURE__ @class */ (function (_super) {
711
711
  if (!isNullOrUndefined(currentRecords[parseInt(selectedIndex.toString(), 10)]["" + parentItem]) &&
712
712
  currentRecords[parseInt(j.toString(), 10)]["" + uniqueID] === currentRecords[parseInt(selectedIndex.toString(), 10)]["" + parentItem]["" + uniqueID]) {
713
713
  selectedIndex = j;
714
- var cells = [].slice.call(rows[parseInt(selectedIndex.toString(), 10)].querySelectorAll('.e-rowcell:not(.e-hide)'));
714
+ var cells = [].slice.call(rows[parseInt(selectedIndex.toString(), 10)].querySelectorAll('.e-rowcell'));
715
715
  var uniqueid = currentRecords[parseInt(j.toString(), 10)]["" + uniqueID];
716
716
  if (this.copiedUniqueIdCollection.indexOf(uniqueid) === -1) {
717
717
  this["" + getCopyData](cells, false, '\t', withHeader);
@@ -766,7 +766,7 @@ var TreeClipboard = /** @__PURE__ @class */ (function (_super) {
766
766
  for (var j = 0; j < currentRecords.length; j++) {
767
767
  if (!isNullOrUndefined(childData[parseInt(i.toString(), 10)]["" + uniqueID]) && currentRecords[parseInt(j.toString(), 10)]["" + uniqueID] === childData[parseInt(i.toString(), 10)]["" + uniqueID]) {
768
768
  if ((!isNullOrUndefined(rows[parseInt(j.toString(), 10)])) && !rows[parseInt(j.toString(), 10)].classList.contains('e-summaryrow')) {
769
- var cells = [].slice.call(rows[parseInt(j.toString(), 10)].querySelectorAll('.e-rowcell:not(.e-hide)'));
769
+ var cells = [].slice.call(rows[parseInt(j.toString(), 10)].querySelectorAll('.e-rowcell'));
770
770
  var uniqueid = currentRecords[parseInt(j.toString(), 10)]["" + uniqueID];
771
771
  if (this.copiedUniqueIdCollection.indexOf(uniqueid) === -1) {
772
772
  this["" + getCopyData](cells, false, '\t', withHeader);
@@ -1350,8 +1350,8 @@ var Selection = /** @__PURE__ @class */ (function () {
1350
1350
  if (this.parent.frozenRows || this.parent.getFrozenColumns()) {
1351
1351
  movableTr = this.parent.getDataRows()[parseInt(recordIndex.toString(), 10)];
1352
1352
  }
1353
- checkbox = tr.querySelectorAll('.e-frame')[0] ? tr.querySelectorAll('.e-frame')[0]
1354
- : movableTr.querySelectorAll('.e-frame')[0];
1353
+ checkbox = tr.querySelectorAll('.e-hierarchycheckbox .e-frame')[0] ? tr.querySelectorAll('.e-hierarchycheckbox .e-frame')[0]
1354
+ : movableTr.querySelectorAll('.e-hierarchycheckbox .e-frame')[0];
1355
1355
  if (!isNullOrUndefined(checkbox)) {
1356
1356
  removeClass([checkbox], ['e-check', 'e-stop', 'e-uncheck']);
1357
1357
  }
@@ -1723,7 +1723,18 @@ var Render = /** @__PURE__ @class */ (function () {
1723
1723
  this.parent["" + lastRowBorder](args.row, true);
1724
1724
  }
1725
1725
  }
1726
- this.parent.trigger(rowDataBound, args);
1726
+ if (this.parent.isReact) {
1727
+ var renderReactTemplates = 'renderReactTemplates';
1728
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
1729
+ var thisRef_1 = this;
1730
+ // tslint:disable-next-line:typedef
1731
+ thisRef_1.parent["" + renderReactTemplates](function () {
1732
+ thisRef_1.parent.trigger(rowDataBound, args);
1733
+ });
1734
+ }
1735
+ else {
1736
+ this.parent.trigger(rowDataBound, args);
1737
+ }
1727
1738
  };
1728
1739
  /**
1729
1740
  * cell renderer for tree column index cell
@@ -1884,7 +1895,10 @@ var Render = /** @__PURE__ @class */ (function () {
1884
1895
  }
1885
1896
  }
1886
1897
  }
1887
- if (isNullOrUndefined(this.parent.rowTemplate)) {
1898
+ this.parent['args'] = args;
1899
+ if ((isNullOrUndefined(this.parent.rowTemplate) && !(this.parent.isReact))
1900
+ || ((this.parent.isReact) &&
1901
+ !args.column['template'])) {
1888
1902
  this.parent.trigger(queryCellInfo, args);
1889
1903
  }
1890
1904
  };
@@ -1921,7 +1935,12 @@ var Render = /** @__PURE__ @class */ (function () {
1921
1935
  this.parent.grid["" + portals] = this.parent["" + portals];
1922
1936
  }
1923
1937
  this.parent.notify('renderReactTemplate', this.parent["" + portals]);
1924
- this.parent["" + renderReactTemplates]();
1938
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
1939
+ var thisRef_2 = this;
1940
+ // tslint:disable-next-line:typedef
1941
+ thisRef_2.parent["" + renderReactTemplates](function () {
1942
+ thisRef_2.parent.trigger(queryCellInfo, args);
1943
+ });
1925
1944
  }
1926
1945
  else {
1927
1946
  var str = 'isStringTemplate';
@@ -1975,12 +1994,13 @@ var Render = /** @__PURE__ @class */ (function () {
1975
1994
  Render.prototype.columnTemplateResult = function (args) {
1976
1995
  this.templateResult = args.template;
1977
1996
  };
1978
- Render.prototype.reactTemplateRender = function (args) {
1997
+ // eslint-disable-next-line
1998
+ Render.prototype.reactTemplateRender = function (args, callBack) {
1979
1999
  var renderReactTemplates = 'renderReactTemplates';
1980
2000
  var portals = 'portals';
1981
2001
  this.parent["" + portals] = args;
1982
2002
  this.parent.notify('renderReactTemplate', this.parent["" + portals]);
1983
- this.parent["" + renderReactTemplates]();
2003
+ this.parent["" + renderReactTemplates](callBack);
1984
2004
  };
1985
2005
  Render.prototype.destroy = function () {
1986
2006
  this.parent.grid.off('template-result', this.columnTemplateResult);
@@ -4104,6 +4124,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4104
4124
  TreeGrid.prototype.wireEvents = function () {
4105
4125
  EventHandler.add(this.grid.element, 'click', this.mouseClickHandler, this);
4106
4126
  EventHandler.add(this.element, 'touchend', this.mouseClickHandler, this);
4127
+ EventHandler.add(this.element, 'mousemove', this.mouseMoveHandler, this);
4107
4128
  this.keyboardModule = new KeyboardEvents(this.element, {
4108
4129
  keyAction: this.treeGridkeyActionHandler.bind(this),
4109
4130
  keyConfigs: this.keyConfigs,
@@ -5589,6 +5610,20 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
5589
5610
  }
5590
5611
  }
5591
5612
  };
5613
+ TreeGrid.prototype.mouseMoveHandler = function (e) {
5614
+ var showTooltip = false;
5615
+ var cols = this.getColumns();
5616
+ if (this.clipMode === 'EllipsisWithTooltip') {
5617
+ showTooltip = true;
5618
+ }
5619
+ var element = parentsUntil(e.target, 'e-ellipsistooltip');
5620
+ 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) {
5621
+ var tooltip = new Tooltip({
5622
+ content: element.textContent
5623
+ });
5624
+ tooltip.appendTo(element);
5625
+ }
5626
+ };
5592
5627
  /**
5593
5628
  * Returns TreeGrid rows
5594
5629
  *
@@ -7096,7 +7131,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
7096
7131
  var rcell = this.grid.getContentTable().rows[parseInt(i.toString(), 10)]
7097
7132
  .cells[this.treeColumnIndex];
7098
7133
  var row = rows[parseInt(i.toString(), 10)];
7099
- var rowData = rowsObject.length != 0 ? rowsObject[parseInt(i.toString(), 10)].data : new Object();
7134
+ var rowData = rowsObject.length !== 0 ? rowsObject[parseInt(i.toString(), 10)].data : new Object();
7100
7135
  var arg = { data: rowData, row: row, cell: rcell, column: this.getColumns()[this.treeColumnIndex] };
7101
7136
  this.renderModule.cellRender(arg);
7102
7137
  }
@@ -10005,7 +10040,7 @@ var ExcelExport$1 = /** @__PURE__ @class */ (function () {
10005
10040
  if (!this.isLocal()) {
10006
10041
  this.parent.flatData = [];
10007
10042
  }
10008
- if (property && property.dataSource) {
10043
+ if (property && property.dataSource && this.isLocal()) {
10009
10044
  var flatsData = this.parent.flatData;
10010
10045
  var dataSrc = property.dataSource instanceof DataManager ? property.dataSource.dataSource.json : property.dataSource;
10011
10046
  this.parent.dataModule.convertToFlatData(dataSrc);
@@ -10014,6 +10049,7 @@ var ExcelExport$1 = /** @__PURE__ @class */ (function () {
10014
10049
  }
10015
10050
  property = isNullOrUndefined(property) ? Object() : property;
10016
10051
  property.dataSource = new DataManager({ json: dtSrc });
10052
+ property.query = args['query'];
10017
10053
  return property;
10018
10054
  };
10019
10055
  /**
@@ -10199,7 +10235,7 @@ var PdfExport$1 = /** @__PURE__ @class */ (function () {
10199
10235
  if (!isLocal) {
10200
10236
  this.parent.flatData = [];
10201
10237
  }
10202
- if (prop && prop.dataSource) {
10238
+ if (prop && prop.dataSource && isLocal) {
10203
10239
  var flatDatas = this.parent.flatData;
10204
10240
  var dataSrc = prop.dataSource instanceof DataManager ? prop.dataSource.dataSource.json : prop.dataSource;
10205
10241
  this.parent.dataModule.convertToFlatData(dataSrc);
@@ -10208,6 +10244,7 @@ var PdfExport$1 = /** @__PURE__ @class */ (function () {
10208
10244
  }
10209
10245
  prop = isNullOrUndefined(prop) ? {} : prop;
10210
10246
  prop.dataSource = new DataManager({ json: dtSrc });
10247
+ prop.query = args['query'];
10211
10248
  return prop;
10212
10249
  };
10213
10250
  /**
@@ -10789,7 +10826,12 @@ var Aggregate$1 = /** @__PURE__ @class */ (function () {
10789
10826
  if (this.parent.isReact) {
10790
10827
  var renderReactTemplates = 'renderReactTemplates';
10791
10828
  tempObj.fn(single[summaryColumn.columnName], this.parent, tempObj.property, '', null, null, cellElement);
10792
- this.parent["" + renderReactTemplates]();
10829
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
10830
+ var thisRef_1 = this;
10831
+ // tslint:disable-next-line:typedef
10832
+ thisRef_1.parent["" + renderReactTemplates](function () {
10833
+ thisRef_1.parent.trigger(queryCellInfo, thisRef_1.parent['args']);
10834
+ });
10793
10835
  }
10794
10836
  else {
10795
10837
  appendChildren(cellElement, tempObj.fn(single[summaryColumn.columnName], this.parent, tempObj.property));
@@ -13725,7 +13767,8 @@ var VirtualScroll$1 = /** @__PURE__ @class */ (function () {
13725
13767
  this.parent.grid.getContent().firstElementChild.scrollTop = 0;
13726
13768
  this.parent.grid.notify(virtualActionArgs, { setTop: true });
13727
13769
  }
13728
- if ((requestType === 'save' && pageingDetails.actionArgs.index >= (counts.count - this.parent.grid.pageSettings.pageSize)) || (requestType === 'refresh' && this.parent['isGantt'] && this.parent['isAddedFromGantt'])) {
13770
+ if ((requestType === 'save' && pageingDetails.actionArgs.index >= (counts.count - this.parent.grid.pageSettings.pageSize)) || (requestType === 'refresh' && this.parent['isGantt'] && this.parent['isAddedFromGantt']
13771
+ && this.parent.grid.pageSettings.currentPage === this.parent.grid.contentModule['maxPage'])) {
13729
13772
  startIndex = counts.startIndex + (counts.count - counts.endIndex);
13730
13773
  endIndex = counts.count;
13731
13774
  this.parent['isAddedFromGantt'] = false;