@syncfusion/ej2-treegrid 22.1.36 → 22.1.38

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.38
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.37",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-kruhXjj64HWfP7/3sgBNO8ds5WTf90FYh+Gw+AeaE6Ebq6fUgavPGjVmZbo4gfbO9TmEcSnQbT9f+bClNhIziA==",
5
+ "_integrity": "sha512-3/h0c3spLymY4K/c6i+JtMPxdjUZ3c2eCuvAgOjaIeW3AJ1U3CabeTHD9NYvmkly66Y+lpe8x17/hF+ccHj5PQ==",
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.37.tgz",
28
+ "_shasum": "31343969eed0b4698dec8a7f2e75d09a0b2b7d70",
29
29
  "_spec": "@syncfusion/ej2-treegrid@*",
30
30
  "_where": "/jenkins/workspace/elease-automation_release_21.1.1/packages/included",
31
31
  "author": {
@@ -36,10 +36,10 @@
36
36
  },
37
37
  "bundleDependencies": false,
38
38
  "dependencies": {
39
- "@syncfusion/ej2-base": "~22.1.34",
40
- "@syncfusion/ej2-data": "~22.1.36",
41
- "@syncfusion/ej2-grids": "~22.1.36",
42
- "@syncfusion/ej2-popups": "~22.1.36"
39
+ "@syncfusion/ej2-base": "~22.1.38",
40
+ "@syncfusion/ej2-data": "~22.1.38",
41
+ "@syncfusion/ej2-grids": "~22.1.38",
42
+ "@syncfusion/ej2-popups": "~22.1.38"
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.38",
70
70
  "sideEffects": false
71
71
  }
@@ -838,7 +838,8 @@ var Edit = /** @class */ (function () {
838
838
  this.addRowIndex = this.parent.grid.selectedRowIndex > -1 ? this.parent.grid.selectedRowIndex : 0;
839
839
  }
840
840
  }
841
- if (this.isAddedRowByMethod && (this.parent.enableVirtualization || this.parent.enableInfiniteScrolling)) {
841
+ if ((this.isAddedRowByMethod || (this.isAddedRowByContextMenu && this.parent.grid.selectedRowIndex !== -1)) &&
842
+ (this.parent.enableVirtualization || this.parent.enableInfiniteScrolling)) {
842
843
  this.addRowRecord = this.parent.flatData[this.parent.grid.selectedRowIndex];
843
844
  if (this.parent.enableVirtualization && this.isAddedRowByContextMenu) {
844
845
  this.addRowRecord = this.parent.getCurrentViewRecords()[this.addRowIndex];
@@ -856,6 +857,10 @@ var Edit = /** @class */ (function () {
856
857
  && !isNullOrUndefined(this.parent.getSelectedRecords()[0])) {
857
858
  this.addRowRecord = this.parent.getSelectedRecords()[0];
858
859
  }
860
+ if (isNullOrUndefined(this.addRowRecord) && this.parent.getCurrentViewRecords().length > this.addRowIndex &&
861
+ args.requestType === 'save' && this.parent.getSelectedRecords().length !== 0) {
862
+ this.addRowRecord = this.parent.getCurrentViewRecords()[this.addRowIndex];
863
+ }
859
864
  this.isAddedRowByMethod = false;
860
865
  args = this.beginAddEdit(args);
861
866
  // if (args.requestType === 'save' &&
@@ -414,7 +414,6 @@ var Selection = /** @class */ (function () {
414
414
  checkbox.classList.add(checkBoxclass);
415
415
  var chkstate = checkState === 'check' ? 'checked' : checkState === 'uncheck' ? 'unchecked' : 'mixed';
416
416
  tr.querySelector('.e-treecheckselect').setAttribute('aria-checked', checkState === 'check' ? 'true' : checkState === 'uncheck' ? 'false' : 'mixed');
417
- tr.querySelector('.e-frame').setAttribute('title', 'checkbox' + chkstate);
418
417
  }
419
418
  }
420
419
  };
@@ -101,7 +101,7 @@ var VirtualScroll = /** @class */ (function () {
101
101
  });
102
102
  this.visualData = visualData;
103
103
  this.parent.grid.notify(events.dataListener, { data: visualData });
104
- var counts = { startIndex: -1, endIndex: -1, count: pageingDetails.count };
104
+ var counts = { startIndex: -1, endIndex: -1, count: pageingDetails.count, requestType: pageingDetails.actionArgs.requestType };
105
105
  this.parent.grid.notify(events.indexModifier, counts);
106
106
  var startIndex = counts.startIndex;
107
107
  var endIndex = counts.endIndex;
@@ -124,7 +124,7 @@ var VirtualScroll = /** @class */ (function () {
124
124
  this.parent.grid.getContent().firstElementChild.scrollTop = 0;
125
125
  this.parent.grid.notify(events.virtualActionArgs, { setTop: true });
126
126
  }
127
- if (requestType === 'save' || (requestType === 'refresh' && this.parent['isGantt'] && this.parent['isAddedFromGantt'])) {
127
+ if ((requestType === 'save' && pageingDetails.actionArgs.index >= (counts.count - this.parent.grid.pageSettings.pageSize)) || (requestType === 'refresh' && this.parent['isGantt'] && this.parent['isAddedFromGantt'])) {
128
128
  startIndex = counts.startIndex + (counts.count - counts.endIndex);
129
129
  endIndex = counts.count;
130
130
  this.parent['isAddedFromGantt'] = false;
@@ -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) {
@@ -84,7 +84,7 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
84
84
  };
85
85
  VirtualTreeContentRenderer.prototype.indexModifier = function (args) {
86
86
  var content = this.parent.getContent().querySelector('.e-content');
87
- if (this.recordAdded && this.startIndex > -1 && this.endIndex > -1) {
87
+ if ((this.recordAdded || args.requestType === 'delete' && this.endIndex > args.count - this.parent.pageSettings.pageSize) && this.startIndex > -1 && this.endIndex > -1) {
88
88
  if (this.endIndex > args.count - this.parent.pageSettings.pageSize) {
89
89
  var nextSetResIndex = ~~(content.scrollTop / this.parent.getRowHeight());
90
90
  var lastIndex = nextSetResIndex + this.parent.getRows().length;
@@ -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;
@@ -424,6 +425,7 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
424
425
  firsttdinx = +attr; // this.parent.getContent().querySelector('.e-content tr').getAttribute('data-rowindex');
425
426
  }
426
427
  if (firsttdinx === 0) {
428
+ scrollArgs.offset.top = content.scrollTop;
427
429
  if (this.parent.allowRowDragAndDrop) {
428
430
  this.translateY = scrollArgs.offset.top - rowHeight * 2;
429
431
  }
@@ -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)) {
@@ -462,12 +464,12 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
462
464
  this.translateY = this.getTranslateY(scrollArgs.offset.top, content.getBoundingClientRect().height);
463
465
  }
464
466
  else {
465
- if (this.parent.allowRowDragAndDrop) {
466
- this.translateY = scrollArgs.offset.top - rowHeight * 2;
467
+ if (this.totalRecords === this.endIndex) {
468
+ this.translateY = (this.totalRecords * rowHeight) - ((this.endIndex - this.startIndex) * rowHeight);
467
469
  }
468
470
  else {
469
- if (this.totalRecords === this.endIndex) {
470
- this.translateY = (this.totalRecords * rowHeight) - ((this.endIndex - this.startIndex) * rowHeight);
471
+ if (this.parent.allowRowDragAndDrop) {
472
+ this.translateY = scrollArgs.offset.top - rowHeight * 2;
471
473
  }
472
474
  else {
473
475
  this.translateY = scrollArgs.offset.top;