@syncfusion/ej2-treegrid 32.2.4 → 32.2.9

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.
@@ -5521,23 +5521,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5521
5521
  if (args.requestType === 'save' && this.aggregates.map((ag) => ag.showChildSummary === true).length) {
5522
5522
  this.grid.refresh();
5523
5523
  }
5524
- if (args.action === 'filter') {
5525
- if (!args.isCollapseMaintain && this.filterModule['currentFilterObject'] !== '' && this.enableVirtualization && !this.initialRender && !this.expandStateMapping && !(isRemoteData(this) && this.enableVirtualization)) {
5526
- this.expandAll();
5527
- }
5528
- }
5529
- if (args.requestType === 'searching') {
5530
- if (!args.isCollapseMaintain && this.searchSettings.key !== '' && this.enableVirtualization && !this.initialRender && !this.expandStateMapping && !(isRemoteData(this) && this.enableVirtualization)) {
5531
- this.expandAll();
5532
- }
5533
- }
5534
- if (args.action === 'clearFilter' && this.enableCollapseAll) {
5535
- this.collapseAll();
5536
- }
5537
- if (args.action === 'clearFilter' && this.enableInfiniteScrolling) {
5538
- this.expandAll();
5539
- }
5540
- if (args.requestType === 'sorting' && this.enableInfiniteScrolling) {
5524
+ if ((args.action === 'clearFilter' || args.action === 'clear-filter' || args.requestType === 'sorting') && this.enableInfiniteScrolling) {
5541
5525
  this.expandAll();
5542
5526
  }
5543
5527
  if (this.action === 'indenting' || this.action === 'outdenting') {
@@ -11457,11 +11441,22 @@ class ExcelExport {
11457
11441
  let query = new Query();
11458
11442
  if (!this.isLocal()) {
11459
11443
  query = this.generateQuery(query);
11460
- query.queries = this.parent.grid.getDataModule().generateQuery().queries;
11461
- query = ExportHelper.getQuery(this.parent.grid, data);
11462
- if (isNullOrUndefined(this.parent.filterModule)) {
11463
- query.queries = query.queries.slice(1, 2);
11464
- query.params = query.params.slice(0, 0);
11444
+ const hasFilter = this.parent.grid.filterSettings &&
11445
+ Array.isArray(this.parent.grid.filterSettings.columns) &&
11446
+ this.parent.grid.filterSettings.columns.length > 0;
11447
+ const hasSearch = this.parent.grid.searchSettings &&
11448
+ typeof this.parent.grid.searchSettings.key === 'string' &&
11449
+ this.parent.grid.searchSettings.key.trim().length > 0;
11450
+ const hasSorting = this.parent.grid.sortSettings &&
11451
+ Array.isArray(this.parent.grid.sortSettings.columns) &&
11452
+ this.parent.grid.sortSettings.columns.length > 0;
11453
+ if (hasFilter || hasSearch || hasSorting) {
11454
+ query.queries = this.parent.grid.getDataModule().generateQuery().queries;
11455
+ query = ExportHelper.getQuery(this.parent.grid, data);
11456
+ if (isNullOrUndefined(this.parent.filterModule)) {
11457
+ query.queries = query.queries.slice(1, 2);
11458
+ query.params = query.params.slice(0, 0);
11459
+ }
11465
11460
  }
11466
11461
  setValue('query', query, property);
11467
11462
  }
@@ -11503,6 +11498,24 @@ class ExcelExport {
11503
11498
  if (!isNullOrUndefined(this.parent.grid.getDataModule())) {
11504
11499
  setValue('query', this.parent.grid.getDataModule().generateQuery(true), args);
11505
11500
  }
11501
+ if (!this.isLocal() && !isNullOrUndefined(property) &&
11502
+ !isNullOrUndefined(property.isCollapsedStatePersist) &&
11503
+ property.isCollapsedStatePersist === false) {
11504
+ if (args.query && args.query.queries && args.query.queries.length) {
11505
+ args.query.queries = args.query.queries.filter((q) => {
11506
+ if (q.fn === 'onWhere' && q.e) {
11507
+ const preds = q.e;
11508
+ if (preds && preds.field === this.parent.parentIdMapping && (preds.value === null || preds.value === 'null')) {
11509
+ return false;
11510
+ }
11511
+ }
11512
+ return true;
11513
+ });
11514
+ }
11515
+ if (args.query && args.query.params && args.query.params.length) {
11516
+ args.query.params = args.query.params.filter((param) => param.key !== 'IdMapping');
11517
+ }
11518
+ }
11506
11519
  setValue('isExport', true, args);
11507
11520
  if (!isNullOrUndefined(property) && !isNullOrUndefined(property.exportType)) {
11508
11521
  setValue('exportType', property.exportType, args);
@@ -11609,6 +11622,7 @@ class PdfExport {
11609
11622
  * @param {TreeGrid} parent - Tree Grid instance
11610
11623
  */
11611
11624
  constructor(parent) {
11625
+ this.isCollapsedStatePersist = false;
11612
11626
  Grid.Inject(PdfExport$1);
11613
11627
  this.parent = parent;
11614
11628
  this.dataResults = {};
@@ -11661,6 +11675,18 @@ class PdfExport {
11661
11675
  const prop = Object();
11662
11676
  const isLocal = !isRemoteData(this.parent) && isOffline(this.parent);
11663
11677
  setValue('cancel', false, prop);
11678
+ if (!isNullOrUndefined(pdfExportProperties)) {
11679
+ this.isCollapsedStatePersist = pdfExportProperties.isCollapsedStatePersist;
11680
+ }
11681
+ if (!isNullOrUndefined(pdfExportProperties)) {
11682
+ if (!isLocal && !isNullOrUndefined(pdfExportProperties.dataSource) && !pdfExportProperties.dataSource['dataSource']) {
11683
+ return this.parent.grid.pdfExportModule.Map(this.parent.grid, pdfExportProperties, isMultipleExport, pdfDoc, isBlob);
11684
+ }
11685
+ if (pdfExportProperties.exportType === 'CurrentPage') {
11686
+ pdfExportProperties.dataSource = this.parent.getCurrentViewRecords();
11687
+ return this.parent.grid.pdfExportModule.Map(this.parent.grid, pdfExportProperties, isMultipleExport, pdfDoc, isBlob);
11688
+ }
11689
+ }
11664
11690
  return new Promise((resolve) => {
11665
11691
  const dm = isLocal && !(dtSrc instanceof DataManager) ? new DataManager(dtSrc)
11666
11692
  : this.parent.dataSource;
@@ -11702,10 +11728,27 @@ class PdfExport {
11702
11728
  return query;
11703
11729
  }
11704
11730
  manipulatePdfProperties(prop, dtSrc, queryResult) {
11705
- let args = {};
11731
+ let args = Object();
11706
11732
  //count not required for this query
11707
11733
  const isLocal = !isRemoteData(this.parent) && isOffline(this.parent);
11708
11734
  setValue('query', this.parent.grid.getDataModule().generateQuery(true), args);
11735
+ if (!isLocal && !isNullOrUndefined(prop) && !isNullOrUndefined(prop.isCollapsedStatePersist)
11736
+ && prop.isCollapsedStatePersist === false) {
11737
+ if (args.query && args.query.queries && args.query.queries.length) {
11738
+ args.query.queries = args.query.queries.filter((q) => {
11739
+ if (q.fn === 'onWhere' && q.e) {
11740
+ const preds = q.e;
11741
+ if (preds && preds.field === this.parent.parentIdMapping && (preds.value === null || preds.value === 'null')) {
11742
+ return false;
11743
+ }
11744
+ }
11745
+ return true;
11746
+ });
11747
+ }
11748
+ if (args.query && args.query.params && args.query.params.length) {
11749
+ args.query.params = args.query.params.filter((param) => param.key !== 'IdMapping');
11750
+ }
11751
+ }
11709
11752
  setValue('isExport', true, args);
11710
11753
  setValue('isPdfExport', true, args);
11711
11754
  if (!isNullOrUndefined(prop) && !isNullOrUndefined(prop.isCollapsedStatePersist)) {
@@ -12396,6 +12439,12 @@ class Sort {
12396
12439
  this.iterateSort(data, srtQry);
12397
12440
  this.storedIndex = -1;
12398
12441
  sortParams.modifiedData = this.flatSortedData;
12442
+ if (srtQry.queries.filter((q) => q.fn === 'onSortBy').length > 0) {
12443
+ this.sortedResult = this.flatSortedData.filter((item) => !item.isSummaryRow);
12444
+ }
12445
+ else {
12446
+ this.sortedResult = [];
12447
+ }
12399
12448
  this.flatSortedData = [];
12400
12449
  }
12401
12450
  iterateSort(data, srtQry) {
@@ -15356,6 +15405,9 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
15356
15405
  (this.parent.pageSettings.pageSize / 2) && (this.endIndex - nextSetResIndex) < (this.parent.pageSettings.pageSize / 2)) {
15357
15406
  this.startIndex = lastIndex - (this.parent.pageSettings.pageSize / 2);
15358
15407
  }
15408
+ if (this.totalRecords < this.parent.pageSettings.pageSize) {
15409
+ this.startIndex = 0;
15410
+ }
15359
15411
  if (scrollArgs.offset.top > (rowHeight * this.totalRecords)) {
15360
15412
  this.translateY = this.getTranslateY(scrollArgs.offset.top, content.getBoundingClientRect().height);
15361
15413
  }