@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 __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;
@@ -534,7 +534,7 @@ class TreeClipboard extends Clipboard {
534
534
  this.treeCopyContent += '\n';
535
535
  }
536
536
  if (!rows[selectedIndexes[parseInt(i.toString(), 10)]].classList.contains('e-summaryrow')) {
537
- const cells = [].slice.call(rows[selectedIndexes[parseInt(i.toString(), 10)]].querySelectorAll('.e-rowcell:not(.e-hide)'));
537
+ const cells = [].slice.call(rows[selectedIndexes[parseInt(i.toString(), 10)]].querySelectorAll('.e-rowcell'));
538
538
  const uniqueid = this.treeGridParent.getSelectedRecords()[parseInt(i.toString(), 10)][`${uniqueID}`];
539
539
  if (this.copiedUniqueIdCollection.indexOf(uniqueid) === -1) {
540
540
  if (this.treeGridParent.copyHierarchyMode === 'Parent' || this.treeGridParent.copyHierarchyMode === 'Both') {
@@ -596,7 +596,7 @@ class TreeClipboard extends Clipboard {
596
596
  if (!isNullOrUndefined(currentRecords[parseInt(selectedIndex.toString(), 10)][`${parentItem}`]) &&
597
597
  currentRecords[parseInt(j.toString(), 10)][`${uniqueID}`] === currentRecords[parseInt(selectedIndex.toString(), 10)][`${parentItem}`][`${uniqueID}`]) {
598
598
  selectedIndex = j;
599
- const cells = [].slice.call(rows[parseInt(selectedIndex.toString(), 10)].querySelectorAll('.e-rowcell:not(.e-hide)'));
599
+ const cells = [].slice.call(rows[parseInt(selectedIndex.toString(), 10)].querySelectorAll('.e-rowcell'));
600
600
  const uniqueid = currentRecords[parseInt(j.toString(), 10)][`${uniqueID}`];
601
601
  if (this.copiedUniqueIdCollection.indexOf(uniqueid) === -1) {
602
602
  this[`${getCopyData}`](cells, false, '\t', withHeader);
@@ -651,7 +651,7 @@ class TreeClipboard extends Clipboard {
651
651
  for (let j = 0; j < currentRecords.length; j++) {
652
652
  if (!isNullOrUndefined(childData[parseInt(i.toString(), 10)][`${uniqueID}`]) && currentRecords[parseInt(j.toString(), 10)][`${uniqueID}`] === childData[parseInt(i.toString(), 10)][`${uniqueID}`]) {
653
653
  if ((!isNullOrUndefined(rows[parseInt(j.toString(), 10)])) && !rows[parseInt(j.toString(), 10)].classList.contains('e-summaryrow')) {
654
- const cells = [].slice.call(rows[parseInt(j.toString(), 10)].querySelectorAll('.e-rowcell:not(.e-hide)'));
654
+ const cells = [].slice.call(rows[parseInt(j.toString(), 10)].querySelectorAll('.e-rowcell'));
655
655
  const uniqueid = currentRecords[parseInt(j.toString(), 10)][`${uniqueID}`];
656
656
  if (this.copiedUniqueIdCollection.indexOf(uniqueid) === -1) {
657
657
  this[`${getCopyData}`](cells, false, '\t', withHeader);
@@ -1232,8 +1232,8 @@ class Selection {
1232
1232
  if (this.parent.frozenRows || this.parent.getFrozenColumns()) {
1233
1233
  movableTr = this.parent.getDataRows()[parseInt(recordIndex.toString(), 10)];
1234
1234
  }
1235
- checkbox = tr.querySelectorAll('.e-frame')[0] ? tr.querySelectorAll('.e-frame')[0]
1236
- : movableTr.querySelectorAll('.e-frame')[0];
1235
+ checkbox = tr.querySelectorAll('.e-hierarchycheckbox .e-frame')[0] ? tr.querySelectorAll('.e-hierarchycheckbox .e-frame')[0]
1236
+ : movableTr.querySelectorAll('.e-hierarchycheckbox .e-frame')[0];
1237
1237
  if (!isNullOrUndefined(checkbox)) {
1238
1238
  removeClass([checkbox], ['e-check', 'e-stop', 'e-uncheck']);
1239
1239
  }
@@ -1566,7 +1566,18 @@ class Render {
1566
1566
  this.parent[`${lastRowBorder}`](args.row, true);
1567
1567
  }
1568
1568
  }
1569
- this.parent.trigger(rowDataBound, args);
1569
+ if (this.parent.isReact) {
1570
+ const renderReactTemplates = 'renderReactTemplates';
1571
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
1572
+ const thisRef = this;
1573
+ // tslint:disable-next-line:typedef
1574
+ thisRef.parent[`${renderReactTemplates}`](function () {
1575
+ thisRef.parent.trigger(rowDataBound, args);
1576
+ });
1577
+ }
1578
+ else {
1579
+ this.parent.trigger(rowDataBound, args);
1580
+ }
1570
1581
  }
1571
1582
  /**
1572
1583
  * cell renderer for tree column index cell
@@ -1727,7 +1738,10 @@ class Render {
1727
1738
  }
1728
1739
  }
1729
1740
  }
1730
- if (isNullOrUndefined(this.parent.rowTemplate)) {
1741
+ this.parent['args'] = args;
1742
+ if ((isNullOrUndefined(this.parent.rowTemplate) && !(this.parent.isReact))
1743
+ || ((this.parent.isReact) &&
1744
+ !args.column['template'])) {
1731
1745
  this.parent.trigger(queryCellInfo, args);
1732
1746
  }
1733
1747
  }
@@ -1764,7 +1778,12 @@ class Render {
1764
1778
  this.parent.grid[`${portals}`] = this.parent[`${portals}`];
1765
1779
  }
1766
1780
  this.parent.notify('renderReactTemplate', this.parent[`${portals}`]);
1767
- this.parent[`${renderReactTemplates}`]();
1781
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
1782
+ const thisRef = this;
1783
+ // tslint:disable-next-line:typedef
1784
+ thisRef.parent[`${renderReactTemplates}`](function () {
1785
+ thisRef.parent.trigger(queryCellInfo, args);
1786
+ });
1768
1787
  }
1769
1788
  else {
1770
1789
  const str = 'isStringTemplate';
@@ -1817,12 +1836,13 @@ class Render {
1817
1836
  columnTemplateResult(args) {
1818
1837
  this.templateResult = args.template;
1819
1838
  }
1820
- reactTemplateRender(args) {
1839
+ // eslint-disable-next-line
1840
+ reactTemplateRender(args, callBack) {
1821
1841
  const renderReactTemplates = 'renderReactTemplates';
1822
1842
  const portals = 'portals';
1823
1843
  this.parent[`${portals}`] = args;
1824
1844
  this.parent.notify('renderReactTemplate', this.parent[`${portals}`]);
1825
- this.parent[`${renderReactTemplates}`]();
1845
+ this.parent[`${renderReactTemplates}`](callBack);
1826
1846
  }
1827
1847
  destroy() {
1828
1848
  this.parent.grid.off('template-result', this.columnTemplateResult);
@@ -3815,6 +3835,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
3815
3835
  wireEvents() {
3816
3836
  EventHandler.add(this.grid.element, 'click', this.mouseClickHandler, this);
3817
3837
  EventHandler.add(this.element, 'touchend', this.mouseClickHandler, this);
3838
+ EventHandler.add(this.element, 'mousemove', this.mouseMoveHandler, this);
3818
3839
  this.keyboardModule = new KeyboardEvents(this.element, {
3819
3840
  keyAction: this.treeGridkeyActionHandler.bind(this),
3820
3841
  keyConfigs: this.keyConfigs,
@@ -5285,6 +5306,20 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5285
5306
  }
5286
5307
  }
5287
5308
  }
5309
+ mouseMoveHandler(e) {
5310
+ let showTooltip = false;
5311
+ const cols = this.getColumns();
5312
+ if (this.clipMode === 'EllipsisWithTooltip') {
5313
+ showTooltip = true;
5314
+ }
5315
+ const element = parentsUntil(e.target, 'e-ellipsistooltip');
5316
+ 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) {
5317
+ const tooltip = new Tooltip({
5318
+ content: element.textContent
5319
+ });
5320
+ tooltip.appendTo(element);
5321
+ }
5322
+ }
5288
5323
  /**
5289
5324
  * Returns TreeGrid rows
5290
5325
  *
@@ -6762,12 +6797,12 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
6762
6797
  treeColumnRowTemplate() {
6763
6798
  let rows = this.getContentTable().rows;
6764
6799
  rows = [].slice.call(rows);
6765
- let rowsObject = this.grid.getRowsObject();
6800
+ const rowsObject = this.grid.getRowsObject();
6766
6801
  for (let i = 0; i < rows.length; i++) {
6767
6802
  const rcell = this.grid.getContentTable().rows[parseInt(i.toString(), 10)]
6768
6803
  .cells[this.treeColumnIndex];
6769
6804
  const row = rows[parseInt(i.toString(), 10)];
6770
- const rowData = rowsObject.length != 0 ? rowsObject[parseInt(i.toString(), 10)].data : new Object();
6805
+ const rowData = rowsObject.length !== 0 ? rowsObject[parseInt(i.toString(), 10)].data : new Object();
6771
6806
  const arg = { data: rowData, row: row, cell: rcell, column: this.getColumns()[this.treeColumnIndex] };
6772
6807
  this.renderModule.cellRender(arg);
6773
6808
  }
@@ -9625,7 +9660,7 @@ class ExcelExport$1 {
9625
9660
  if (!this.isLocal()) {
9626
9661
  this.parent.flatData = [];
9627
9662
  }
9628
- if (property && property.dataSource) {
9663
+ if (property && property.dataSource && this.isLocal()) {
9629
9664
  const flatsData = this.parent.flatData;
9630
9665
  const dataSrc = property.dataSource instanceof DataManager ? property.dataSource.dataSource.json : property.dataSource;
9631
9666
  this.parent.dataModule.convertToFlatData(dataSrc);
@@ -9634,6 +9669,7 @@ class ExcelExport$1 {
9634
9669
  }
9635
9670
  property = isNullOrUndefined(property) ? Object() : property;
9636
9671
  property.dataSource = new DataManager({ json: dtSrc });
9672
+ property.query = args['query'];
9637
9673
  return property;
9638
9674
  }
9639
9675
  /**
@@ -9817,7 +9853,7 @@ class PdfExport$1 {
9817
9853
  if (!isLocal) {
9818
9854
  this.parent.flatData = [];
9819
9855
  }
9820
- if (prop && prop.dataSource) {
9856
+ if (prop && prop.dataSource && isLocal) {
9821
9857
  const flatDatas = this.parent.flatData;
9822
9858
  const dataSrc = prop.dataSource instanceof DataManager ? prop.dataSource.dataSource.json : prop.dataSource;
9823
9859
  this.parent.dataModule.convertToFlatData(dataSrc);
@@ -9826,6 +9862,7 @@ class PdfExport$1 {
9826
9862
  }
9827
9863
  prop = isNullOrUndefined(prop) ? {} : prop;
9828
9864
  prop.dataSource = new DataManager({ json: dtSrc });
9865
+ prop.query = args['query'];
9829
9866
  return prop;
9830
9867
  }
9831
9868
  /**
@@ -10394,7 +10431,12 @@ class Aggregate$1 {
10394
10431
  if (this.parent.isReact) {
10395
10432
  const renderReactTemplates = 'renderReactTemplates';
10396
10433
  tempObj.fn(single[summaryColumn.columnName], this.parent, tempObj.property, '', null, null, cellElement);
10397
- this.parent[`${renderReactTemplates}`]();
10434
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
10435
+ const thisRef = this;
10436
+ // tslint:disable-next-line:typedef
10437
+ thisRef.parent[`${renderReactTemplates}`](function () {
10438
+ thisRef.parent.trigger(queryCellInfo, thisRef.parent['args']);
10439
+ });
10398
10440
  }
10399
10441
  else {
10400
10442
  appendChildren(cellElement, tempObj.fn(single[summaryColumn.columnName], this.parent, tempObj.property));
@@ -13279,7 +13321,8 @@ class VirtualScroll$1 {
13279
13321
  this.parent.grid.getContent().firstElementChild.scrollTop = 0;
13280
13322
  this.parent.grid.notify(virtualActionArgs, { setTop: true });
13281
13323
  }
13282
- if ((requestType === 'save' && pageingDetails.actionArgs.index >= (counts.count - this.parent.grid.pageSettings.pageSize)) || (requestType === 'refresh' && this.parent['isGantt'] && this.parent['isAddedFromGantt'])) {
13324
+ if ((requestType === 'save' && pageingDetails.actionArgs.index >= (counts.count - this.parent.grid.pageSettings.pageSize)) || (requestType === 'refresh' && this.parent['isGantt'] && this.parent['isAddedFromGantt']
13325
+ && this.parent.grid.pageSettings.currentPage === this.parent.grid.contentModule['maxPage'])) {
13283
13326
  startIndex = counts.startIndex + (counts.count - counts.endIndex);
13284
13327
  endIndex = counts.count;
13285
13328
  this.parent['isAddedFromGantt'] = false;