@syncfusion/ej2-treegrid 22.1.36 → 22.1.37

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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 22.1.36
3
+ * version : 22.1.37
4
4
  * Copyright Syncfusion Inc. 2001 - 2020. All rights reserved.
5
5
  * Use of this code is subject to the terms of our license.
6
6
  * A copy of the current license can be obtained at any time by e-mailing
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "_from": "@syncfusion/ej2-treegrid@*",
3
- "_id": "@syncfusion/ej2-treegrid@21.1.36",
3
+ "_id": "@syncfusion/ej2-treegrid@22.1.36",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-kruhXjj64HWfP7/3sgBNO8ds5WTf90FYh+Gw+AeaE6Ebq6fUgavPGjVmZbo4gfbO9TmEcSnQbT9f+bClNhIziA==",
5
+ "_integrity": "sha512-v4Iu+lVo/s6DbIN6B2tpcuh7jPfd9YmIexRJ36AEq/+COecwEQJ9Svj4BwgHhqmArel/uC7MIHXeiuyRU7/5nw==",
6
6
  "_location": "/@syncfusion/ej2-treegrid",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
@@ -24,8 +24,8 @@
24
24
  "/@syncfusion/ej2-react-treegrid",
25
25
  "/@syncfusion/ej2-vue-treegrid"
26
26
  ],
27
- "_resolved": "https://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-treegrid/-/ej2-treegrid-21.1.36.tgz",
28
- "_shasum": "868c98e4823b60d1462d83aea652e8f292da0363",
27
+ "_resolved": "https://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-treegrid/-/ej2-treegrid-22.1.36.tgz",
28
+ "_shasum": "863e6c49ec54bc9b0717212ba2e55c6cd50f7467",
29
29
  "_spec": "@syncfusion/ej2-treegrid@*",
30
30
  "_where": "/jenkins/workspace/elease-automation_release_21.1.1/packages/included",
31
31
  "author": {
@@ -38,8 +38,8 @@
38
38
  "dependencies": {
39
39
  "@syncfusion/ej2-base": "~22.1.34",
40
40
  "@syncfusion/ej2-data": "~22.1.36",
41
- "@syncfusion/ej2-grids": "~22.1.36",
42
- "@syncfusion/ej2-popups": "~22.1.36"
41
+ "@syncfusion/ej2-grids": "~22.1.37",
42
+ "@syncfusion/ej2-popups": "~22.1.37"
43
43
  },
44
44
  "deprecated": false,
45
45
  "description": "Essential JS 2 TreeGrid Component",
@@ -66,6 +66,6 @@
66
66
  "url": "git+https://github.com/syncfusion/ej2-treegrid.git"
67
67
  },
68
68
  "typings": "index.d.ts",
69
- "version": "22.1.36",
69
+ "version": "22.1.37",
70
70
  "sideEffects": false
71
71
  }
@@ -86,6 +86,12 @@ export declare class TreeGrid extends Component<HTMLElement> implements INotifyP
86
86
  private isAddedFromGantt;
87
87
  private isIndentEnabled;
88
88
  private indentOutdentAction;
89
+ private isCollapsedEventTriggered;
90
+ private isCollapsingEventTriggered;
91
+ private isExpandedEventTriggered;
92
+ private isExpandingEventTriggered;
93
+ private collapseAllPrevent;
94
+ private expandAllPrevent;
89
95
  /**
90
96
  * The `sortModule` is used to manipulate sorting in TreeGrid.
91
97
  */
@@ -1732,6 +1738,7 @@ export declare class TreeGrid extends Component<HTMLElement> implements INotifyP
1732
1738
  * @returns {void}
1733
1739
  */
1734
1740
  expandRow(row: HTMLTableRowElement, record?: Object, key?: Object, level?: number): void;
1741
+ private expandRows;
1735
1742
  private expandCollapseAllChildren;
1736
1743
  private setHeightForFrozenContent;
1737
1744
  private getCollapseExpandRecords;
@@ -1744,6 +1751,7 @@ export declare class TreeGrid extends Component<HTMLElement> implements INotifyP
1744
1751
  * @returns {void}
1745
1752
  */
1746
1753
  collapseRow(row: HTMLTableRowElement, record?: Object, key?: Object): void;
1754
+ private collapseRows;
1747
1755
  private updateExpandStateMapping;
1748
1756
  /**
1749
1757
  * Expands the records at specific hierarchical level
@@ -2610,28 +2610,70 @@ var TreeGrid = /** @class */ (function (_super) {
2610
2610
  */
2611
2611
  TreeGrid.prototype.expandRow = function (row, record, key, level) {
2612
2612
  var _this = this;
2613
+ var parentRec = this.parentData;
2614
+ if (!this.enableVirtualization) {
2615
+ parentRec = this.flatData.filter(function (e) {
2616
+ return e.hasChildRecords;
2617
+ });
2618
+ }
2613
2619
  record = this.getCollapseExpandRecords(row, record);
2614
2620
  if (!isNullOrUndefined(row) && row.cells[0].classList.contains('e-lastrowcell')) {
2615
2621
  this.lastRowBorder(row, false);
2616
2622
  }
2617
- var args = { data: record, row: row, cancel: false };
2618
- this.trigger(events.expanding, args, function (expandingArgs) {
2619
- if (!expandingArgs.cancel) {
2620
- _this.expandCollapse('expand', row, record);
2621
- if (expandingArgs.expandAll) {
2622
- _this.expandCollapseAllChildren(record, 'expand', key, level);
2623
- }
2624
- var children = 'Children';
2625
- if (!(isRemoteData(_this) && !isOffline(_this)) && (!isCountRequired(_this) || !isNullOrUndefined(record["" + children]))) {
2626
- var collapseArgs = { data: record, row: row };
2627
- _this.setHeightForFrozenContent();
2628
- if (!isNullOrUndefined(_this.expandStateMapping)) {
2629
- _this.updateExpandStateMapping(collapseArgs.data, true);
2623
+ if (this.isExpandAll && !isRemoteData(this)) {
2624
+ var args = { data: parentRec, row: row, cancel: false };
2625
+ var pagerValuePresent = false;
2626
+ if (this.grid.pagerModule && !isNullOrUndefined(this.grid.pagerModule.pagerObj.pagerdropdownModule)) {
2627
+ pagerValuePresent = this.grid.pagerModule.pagerObj.pagerdropdownModule['dropDownListObject'].value ? true : false;
2628
+ }
2629
+ if (!this.isExpandingEventTriggered) {
2630
+ this.trigger(events.expanding, args, function (expandingArgs) {
2631
+ _this.expandAllPrevent = expandingArgs.cancel;
2632
+ if (!expandingArgs.cancel) {
2633
+ if (expandingArgs.expandAll) {
2634
+ _this.expandCollapseAllChildren(record, 'expand', key, level);
2635
+ }
2636
+ _this.expandRows(row, record, parentRec, key, level);
2630
2637
  }
2631
- _this.trigger(events.expanded, collapseArgs);
2638
+ });
2639
+ }
2640
+ else if ((!this.allowPaging || (pagerValuePresent && this.grid.pagerModule.pagerObj.pagerdropdownModule['dropDownListObject'].value === 'All')) &&
2641
+ !this.expandAllPrevent && this.isExpandingEventTriggered) {
2642
+ this.expandRows(row, record, parentRec, key, level);
2643
+ }
2644
+ this.isExpandingEventTriggered = true;
2645
+ }
2646
+ else if (!this.isExpandAll || (this.isExpandAll && isRemoteData(this))) {
2647
+ var args = { data: record, row: row, cancel: false };
2648
+ this.trigger(events.expanding, args, function (expandingArgs) {
2649
+ if (!expandingArgs.cancel) {
2650
+ if (expandingArgs.expandAll) {
2651
+ _this.expandCollapseAllChildren(record, 'expand', key, level);
2652
+ }
2653
+ _this.expandRows(row, record, parentRec, key, level);
2632
2654
  }
2655
+ });
2656
+ }
2657
+ };
2658
+ // Internal method to handle the rows expand
2659
+ TreeGrid.prototype.expandRows = function (row, record, parentRec, key, level) {
2660
+ this.expandCollapse('expand', row, record);
2661
+ var children = 'Children';
2662
+ if (!(isRemoteData(this) && !isOffline(this)) && (!isCountRequired(this) || !isNullOrUndefined(record["" + children]))) {
2663
+ var expandArgs = { data: record, row: row };
2664
+ this.setHeightForFrozenContent();
2665
+ if (!isNullOrUndefined(this.expandStateMapping)) {
2666
+ this.updateExpandStateMapping(expandArgs.data, true);
2633
2667
  }
2634
- });
2668
+ if (this.isExpandAll && !this.isExpandedEventTriggered) {
2669
+ this.isExpandedEventTriggered = true;
2670
+ expandArgs = { data: parentRec, row: row };
2671
+ this.trigger(events.expanded, expandArgs);
2672
+ }
2673
+ else if (!this.isExpandAll) {
2674
+ this.trigger(events.expanded, expandArgs);
2675
+ }
2676
+ }
2635
2677
  };
2636
2678
  TreeGrid.prototype.expandCollapseAllChildren = function (record, action, key, level) {
2637
2679
  if ((!isNullOrUndefined(key) && record[this.getPrimaryKeyFieldNames()[0]] !== key) ||
@@ -2689,31 +2731,65 @@ var TreeGrid = /** @class */ (function (_super) {
2689
2731
  */
2690
2732
  TreeGrid.prototype.collapseRow = function (row, record, key) {
2691
2733
  var _this = this;
2734
+ var parentRec = this.parentData;
2735
+ if (!this.enableVirtualization) {
2736
+ parentRec = this.flatData.filter(function (e) {
2737
+ return e.hasChildRecords;
2738
+ });
2739
+ }
2692
2740
  record = this.getCollapseExpandRecords(row, record);
2693
- var args = { data: record, row: row, cancel: false };
2694
- this.trigger(events.collapsing, args, function (collapsingArgs) {
2695
- if (!collapsingArgs.cancel) {
2696
- if (collapsingArgs.collapseAll) {
2697
- _this.expandCollapseAllChildren(record, 'collapse', key);
2698
- }
2699
- _this.expandCollapse('collapse', row, record);
2700
- var collapseArgs = { data: record, row: row };
2701
- if (!isRemoteData(_this)) {
2702
- _this.setHeightForFrozenContent();
2703
- if (!isNullOrUndefined(_this.expandStateMapping)) {
2704
- _this.updateExpandStateMapping(collapseArgs.data, false);
2705
- }
2706
- _this.trigger(events.collapsed, collapseArgs);
2707
- if (_this.enableInfiniteScrolling) {
2708
- var scrollHeight = _this.grid.getContent().firstElementChild.scrollHeight;
2709
- var scrollTop = _this.grid.getContent().firstElementChild.scrollTop;
2710
- if ((scrollHeight - scrollTop) < _this.grid.getRowHeight() + +_this.height) {
2711
- _this.grid.getContent().firstElementChild.scrollBy(0, _this.grid.getRowHeight());
2741
+ if (this.isCollapseAll && !isRemoteData(this)) {
2742
+ var args = { data: parentRec, row: row, cancel: false };
2743
+ if (!this.isCollapsingEventTriggered) {
2744
+ this.trigger(events.collapsing, args, function (collapsingArgs) {
2745
+ _this.collapseAllPrevent = collapsingArgs.cancel;
2746
+ if (!collapsingArgs.cancel) {
2747
+ if (collapsingArgs.collapseAll) {
2748
+ _this.expandCollapseAllChildren(record, 'collapse', key);
2712
2749
  }
2750
+ _this.collapseRows(row, record, parentRec, key);
2713
2751
  }
2752
+ });
2753
+ }
2754
+ else if (!this.allowPaging && !this.collapseAllPrevent && this.isCollapsingEventTriggered) {
2755
+ this.collapseRows(row, record, parentRec, key);
2756
+ }
2757
+ this.isCollapsingEventTriggered = true;
2758
+ }
2759
+ else if (!this.isCollapseAll || (this.isCollapseAll && isRemoteData(this))) {
2760
+ var args = { data: record, row: row, cancel: false };
2761
+ this.trigger(events.collapsing, args, function (collapsingArgs) {
2762
+ if (!collapsingArgs.cancel) {
2763
+ _this.collapseRows(row, record, parentRec, key);
2764
+ }
2765
+ });
2766
+ }
2767
+ };
2768
+ // Internal method for handling the rows collapse
2769
+ TreeGrid.prototype.collapseRows = function (row, record, parentRec, key) {
2770
+ this.expandCollapse('collapse', row, record);
2771
+ var collapseArgs = { data: record, row: row };
2772
+ if (!isRemoteData(this)) {
2773
+ this.setHeightForFrozenContent();
2774
+ if (!isNullOrUndefined(this.expandStateMapping)) {
2775
+ this.updateExpandStateMapping(collapseArgs.data, false);
2776
+ }
2777
+ if (this.isCollapseAll && !this.isCollapsedEventTriggered) {
2778
+ this.isCollapsedEventTriggered = true;
2779
+ collapseArgs = { data: parentRec, row: row };
2780
+ this.trigger(events.collapsed, collapseArgs);
2781
+ }
2782
+ else if (!this.isCollapseAll) {
2783
+ this.trigger(events.collapsed, collapseArgs);
2784
+ }
2785
+ if (this.enableInfiniteScrolling) {
2786
+ var scrollHeight = this.grid.getContent().firstElementChild.scrollHeight;
2787
+ var scrollTop = this.grid.getContent().firstElementChild.scrollTop;
2788
+ if ((scrollHeight - scrollTop) < this.grid.getRowHeight() + +this.height) {
2789
+ this.grid.getContent().firstElementChild.scrollBy(0, this.grid.getRowHeight());
2714
2790
  }
2715
2791
  }
2716
- });
2792
+ }
2717
2793
  };
2718
2794
  TreeGrid.prototype.updateExpandStateMapping = function (record, state) {
2719
2795
  var totalRecords = record;
@@ -2876,6 +2952,8 @@ var TreeGrid = /** @class */ (function (_super) {
2876
2952
  * @returns {void}
2877
2953
  */
2878
2954
  TreeGrid.prototype.expandAll = function () {
2955
+ this.isExpandedEventTriggered = false;
2956
+ this.isExpandingEventTriggered = false;
2879
2957
  this.expandCollapseAll('expand');
2880
2958
  };
2881
2959
  /**
@@ -2884,6 +2962,8 @@ var TreeGrid = /** @class */ (function (_super) {
2884
2962
  * @returns {void}
2885
2963
  */
2886
2964
  TreeGrid.prototype.collapseAll = function () {
2965
+ this.isCollapsedEventTriggered = false;
2966
+ this.isCollapsingEventTriggered = false;
2887
2967
  this.expandCollapseAll('collapse');
2888
2968
  };
2889
2969
  TreeGrid.prototype.expandCollapseAll = function (action) {
@@ -105,7 +105,8 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
105
105
  this.startIndex = 0;
106
106
  this.endIndex = this.parent.pageSettings.pageSize - 1;
107
107
  }
108
- if ((this.endIndex - this.startIndex !== this.parent.pageSettings.pageSize) && (this.totalRecords > this.parent.pageSettings.pageSize) &&
108
+ if ((this.endIndex - this.startIndex !== this.parent.pageSettings.pageSize) &&
109
+ (this.totalRecords > this.parent.pageSettings.pageSize) &&
109
110
  (this.endIndex === this.totalRecords)) {
110
111
  args.startIndex = this.endIndex - this.parent.pageSettings.pageSize;
111
112
  args.endIndex = this.endIndex;
@@ -428,6 +429,7 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
428
429
  this.translateY = scrollArgs.offset.top - rowHeight * 2;
429
430
  }
430
431
  else {
432
+ scrollArgs.offset.top = content.scrollTop;
431
433
  this.translateY = scrollArgs.offset.top;
432
434
  }
433
435
  }
@@ -448,7 +450,7 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
448
450
  lastIndex = nextSetResIndex +
449
451
  (this.totalRecords - nextSetResIndex);
450
452
  }
451
- this.startIndex = !isLastBlock || isNullOrUndefined(this["" + selectedRowIndex]) ? lastIndex - this.parent.pageSettings.pageSize : nextSetResIndex;
453
+ this.startIndex = !isLastBlock || isNullOrUndefined(this['' + selectedRowIndex]) ? lastIndex - this.parent.pageSettings.pageSize : nextSetResIndex;
452
454
  this.endIndex = lastIndex;
453
455
  if ((nextSetResIndex + this.parent.pageSettings.pageSize) > this.totalRecords && (this.endIndex - this.startIndex) <
454
456
  (this.parent.pageSettings.pageSize / 2) && (this.endIndex - nextSetResIndex) < (this.parent.pageSettings.pageSize / 2)) {