@syncfusion/ej2-treegrid 20.3.48 → 20.3.50

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 : 20.3.48
3
+ * version : 20.3.50
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@20.3.47",
3
+ "_id": "@syncfusion/ej2-treegrid@20.3.49",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-h6rSxBpMoZDLav2suqY58wIzpy42bpTtxPL/2APnJc98TC6Nk2c7seEgn4iJkc2hJ7AzZ+BEaTpJU72+r+W7vg==",
5
+ "_integrity": "sha512-48n9ELayHVf9o6D/gd4RUFkaaZLi8jbQw9ayr7xU+9E5iTtIzjzM+MagsBcmi3g6cGX9ia+ZA1jAMgVAbZkuSA==",
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": "http://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-treegrid/-/ej2-treegrid-20.3.47.tgz",
28
- "_shasum": "1847003b673227740c5a591d0292fe16bc4615b8",
27
+ "_resolved": "http://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-treegrid/-/ej2-treegrid-20.3.49.tgz",
28
+ "_shasum": "a830c8b6226e2b1d86a1ba0b50b1d9879604fbc2",
29
29
  "_spec": "@syncfusion/ej2-treegrid@*",
30
30
  "_where": "/jenkins/workspace/automation_release_19.1.0.1-ZPMUBNQ6AUYH6YGEFBPVYMEQLRRW2SLD4XCZ6GATNZJFYJ3RIAOA/packages/included",
31
31
  "author": {
@@ -36,10 +36,10 @@
36
36
  },
37
37
  "bundleDependencies": false,
38
38
  "dependencies": {
39
- "@syncfusion/ej2-base": "~20.3.48",
40
- "@syncfusion/ej2-data": "~20.3.47",
41
- "@syncfusion/ej2-grids": "~20.3.48",
42
- "@syncfusion/ej2-popups": "~20.3.48"
39
+ "@syncfusion/ej2-base": "~20.3.50",
40
+ "@syncfusion/ej2-data": "~20.3.50",
41
+ "@syncfusion/ej2-grids": "~20.3.50",
42
+ "@syncfusion/ej2-popups": "~20.3.50"
43
43
  },
44
44
  "deprecated": false,
45
45
  "description": "Essential JS 2 TreeGrid Component",
@@ -60,6 +60,6 @@
60
60
  "url": "git+https://github.com/syncfusion/ej2-treegrid.git"
61
61
  },
62
62
  "typings": "index.d.ts",
63
- "version": "20.3.48",
63
+ "version": "20.3.50",
64
64
  "sideEffects": false
65
65
  }
@@ -1139,7 +1139,12 @@ var RowDD = /** @class */ (function () {
1139
1139
  }
1140
1140
  length = record.childRecords.length;
1141
1141
  for (var i = 0; i < length; i++) {
1142
- currentRecord = getValue('uniqueIDCollection.' + record.childRecords[i].uniqueID, tObj);
1142
+ if (!this.isMultipleGrid) {
1143
+ currentRecord = getValue('uniqueIDCollection.' + record.childRecords[i].uniqueID, tObj);
1144
+ }
1145
+ else {
1146
+ currentRecord = record.childRecords[i];
1147
+ }
1143
1148
  count++;
1144
1149
  tObj.flatData.splice(count, 0, currentRecord);
1145
1150
  setValue('uniqueIDCollection.' + currentRecord.uniqueID, currentRecord, this.parent);
@@ -1161,7 +1166,12 @@ var RowDD = /** @class */ (function () {
1161
1166
  }
1162
1167
  length = record.childRecords.length;
1163
1168
  for (var i = 0; i < length; i++) {
1164
- currentRecord = getValue('uniqueIDCollection.' + record.childRecords[i].uniqueID, this.parent);
1169
+ if (!this.isMultipleGrid) {
1170
+ currentRecord = getValue('uniqueIDCollection.' + record.childRecords[i].uniqueID, this.parent);
1171
+ }
1172
+ else {
1173
+ currentRecord = record.childRecords[i];
1174
+ }
1165
1175
  var parentData = void 0;
1166
1176
  if (record.parentItem) {
1167
1177
  parentData = getParentData(this.parent, record.parentItem.uniqueID);
@@ -223,7 +223,7 @@ var DataManipulation = /** @class */ (function () {
223
223
  }
224
224
  }
225
225
  else {
226
- if (!isNullOrUndefined(records)) {
226
+ if (!isNullOrUndefined(records) && !((this.parent.loadChildOnDemand) && isCountRequired(this.parent) && !isNullOrUndefined(this.parent['dataResults']['expandRecord']))) {
227
227
  this.convertToFlatData(records);
228
228
  }
229
229
  }
@@ -377,8 +377,8 @@ var DataManipulation = /** @class */ (function () {
377
377
  if (!Object.prototype.hasOwnProperty.call(currentData, 'index')) {
378
378
  currentData.index = this.storedIndex;
379
379
  }
380
- if ((!isNullOrUndefined(currentData[this.parent.childMapping]) && !isCountRequired(this.parent)) || ((currentData[this.parent.hasChildMapping]) &&
381
- isCountRequired(this.parent) && (this.parent.initialRender || isNullOrUndefined(this.parent['dataResults'].result) || this.parent.enableInfiniteScrolling))) {
380
+ if ((!isNullOrUndefined(currentData[this.parent.childMapping]) && !isCountRequired(this.parent)) ||
381
+ ((currentData[this.parent.hasChildMapping]) && isCountRequired(this.parent))) {
382
382
  currentData.hasChildRecords = true;
383
383
  if (this.parent.enableCollapseAll || !isNullOrUndefined(this.parent.dataStateChange)
384
384
  && isNullOrUndefined(currentData[this.parent.childMapping])) {
@@ -1752,6 +1752,7 @@ export declare class TreeGrid extends Component<HTMLElement> implements INotifyP
1752
1752
  collapseAll(): void;
1753
1753
  private expandCollapseAll;
1754
1754
  private expandCollapse;
1755
+ private updateGridRowsVisible;
1755
1756
  private updateChildOnDemand;
1756
1757
  private remoteExpand;
1757
1758
  private localExpand;
@@ -1096,7 +1096,7 @@ var TreeGrid = /** @class */ (function (_super) {
1096
1096
  }
1097
1097
  _this.notify('actionBegin', { editAction: args });
1098
1098
  if (!isRemoteData(_this) && !isNullOrUndefined(_this.filterModule) && !isCountRequired(_this)
1099
- && (_this.grid.filterSettings.columns.length === 0 || _this.grid.searchSettings.key.length === 0)) {
1099
+ && (_this.grid.filterSettings.columns.length === 0 && _this.grid.searchSettings.key.length === 0)) {
1100
1100
  _this.notify('clearFilters', { flatData: _this.grid.dataSource });
1101
1101
  _this.grid.setProperties({ dataSource: _this.dataResults.result }, true);
1102
1102
  if (isNullOrUndefined(_this.grid['changedProperties'].dataSource)) {
@@ -2807,11 +2807,13 @@ var TreeGrid = /** @class */ (function (_super) {
2807
2807
  }
2808
2808
  });
2809
2809
  if (rows.length) {
2810
- if (action === 'collapse') {
2811
- this.collapseRow(rows[0]);
2812
- }
2813
- else {
2814
- this.expandRow(rows[0]);
2810
+ for (var i = 0; i < rows.length; i++) {
2811
+ if (action === 'collapse') {
2812
+ this.collapseRow(rows[i]);
2813
+ }
2814
+ else {
2815
+ this.expandRow(rows[i]);
2816
+ }
2815
2817
  }
2816
2818
  }
2817
2819
  else if (this.allowPaging) {
@@ -2840,7 +2842,7 @@ var TreeGrid = /** @class */ (function (_super) {
2840
2842
  return e.parentUniqueID === record.uniqueID;
2841
2843
  });
2842
2844
  var targetEle;
2843
- if (!isRemoteData(this) && action === 'expand' && this.isSelfReference && isCountRequired(this) && !childRecords.length) {
2845
+ if ((!isRemoteData(this) && action === 'expand' && this.isSelfReference && isCountRequired(this) && !childRecords.length) || (action === 'collapse' || (this.isExpandAll && this.loadChildOnDemand) && !isRemoteData(this) && this.isSelfReference && isCountRequired(this))) {
2844
2846
  this.updateChildOnDemand(expandingArgs);
2845
2847
  }
2846
2848
  var gridRows = this.getRows();
@@ -2934,10 +2936,34 @@ var TreeGrid = /** @class */ (function (_super) {
2934
2936
  }
2935
2937
  this.notify('rowExpandCollapse', { detailrows: detailrows, action: displayAction, record: record, row: row });
2936
2938
  this.updateAltRow(gridRows);
2939
+ this.updateGridRowsVisible();
2940
+ }
2941
+ };
2942
+ TreeGrid.prototype.updateGridRowsVisible = function () {
2943
+ var rowsToRefresh = this.grid.getRowsObject();
2944
+ var rows = this.getRows();
2945
+ for (var i = 0; i < rows.length; i++) {
2946
+ for (var j = 0; j < rowsToRefresh.length; j++) {
2947
+ if (rows[i].dataset.uid === rowsToRefresh[j].uid) {
2948
+ rowsToRefresh[j].visible = rows[i].style.display === 'none' ? false : true;
2949
+ }
2950
+ }
2937
2951
  }
2952
+ this.grid.notify('refresh-Expand-and-Collapse', { rows: rowsToRefresh });
2938
2953
  };
2939
2954
  TreeGrid.prototype.updateChildOnDemand = function (expandingArgs) {
2940
2955
  var _this = this;
2956
+ if (expandingArgs.requestType === 'collapse' && isCountRequired(this)) {
2957
+ var flatDataRecords = this.flatData.slice();
2958
+ for (var i = 0; i < flatDataRecords.length; i++) {
2959
+ if (flatDataRecords[i]['parentUniqueID'] === expandingArgs.data['uniqueID']) {
2960
+ flatDataRecords.splice(i, 1);
2961
+ i = i - 1;
2962
+ }
2963
+ }
2964
+ this.dataResults.result = flatDataRecords;
2965
+ return;
2966
+ }
2941
2967
  var deff = new Deferred();
2942
2968
  var childDataBind = 'childDataBind';
2943
2969
  expandingArgs[childDataBind] = deff.resolve;
@@ -2945,7 +2971,12 @@ var TreeGrid = /** @class */ (function (_super) {
2945
2971
  this.trigger(events.dataStateChange, expandingArgs);
2946
2972
  deff.promise.then(function () {
2947
2973
  if (expandingArgs.childData.length) {
2948
- _this.flatData = _this.infiniteScrollData;
2974
+ if (isCountRequired(_this)) {
2975
+ _this.flatData = _this.dataResults.result;
2976
+ }
2977
+ if (_this.enableInfiniteScrolling && isCountRequired(_this)) {
2978
+ _this.flatData = _this.infiniteScrollData;
2979
+ }
2949
2980
  var currentData = (_this.flatData);
2950
2981
  var index = 0;
2951
2982
  for (var i = 0; i < currentData.length; i++) {
@@ -2980,7 +3011,13 @@ var TreeGrid = /** @class */ (function (_super) {
2980
3011
  (childData[i][_this.hasChildMapping] && isCountRequired(_this))) {
2981
3012
  childData[i].hasChildRecords = true;
2982
3013
  }
2983
- currentData.splice(index + 1 + i, record[_this.childMapping] && record[_this.childMapping][i] ? 1 : 0, childData[i]);
3014
+ if (isCountRequired(_this) && record[_this.childMapping] && record[_this.childMapping][i]) {
3015
+ currentData.splice(index + 1 + i, 0, childData[i]);
3016
+ }
3017
+ else {
3018
+ currentData.splice(index + 1 + i, record[_this.childMapping] &&
3019
+ record[_this.childMapping][i] ? 1 : 0, childData[i]);
3020
+ }
2984
3021
  }
2985
3022
  else {
2986
3023
  currentData.splice(index + 1 + i, 1);
@@ -2994,6 +3031,10 @@ var TreeGrid = /** @class */ (function (_super) {
2994
3031
  data_1.push(expandingArgs.childData[j]);
2995
3032
  }
2996
3033
  }
3034
+ if (isCountRequired(_this) && _this.loadChildOnDemand && expandingArgs.requestType === 'expand') {
3035
+ _this.dataResults['expandRecord'] = {};
3036
+ _this.dataResults['expandRecord'] = expandingArgs.data;
3037
+ }
2997
3038
  _this.isExpandRefresh = true;
2998
3039
  var scrollHeightBeforeRefresh = _this.getContentTable().parentElement.scrollTop;
2999
3040
  _this.grid.refresh();
@@ -214,7 +214,12 @@ var Render = /** @class */ (function () {
214
214
  args.cell.querySelector('.e-treecell').innerHTML = summaryData;
215
215
  }
216
216
  else {
217
- args.cell.innerHTML = summaryData;
217
+ if (args.column.template) {
218
+ args.cell.innerHTML = null;
219
+ }
220
+ else {
221
+ args.cell.innerHTML = summaryData;
222
+ }
218
223
  }
219
224
  }
220
225
  if (isNullOrUndefined(this.parent.rowTemplate)) {
@@ -49,7 +49,11 @@ var TreeVirtualRowModelGenerator = /** @class */ (function (_super) {
49
49
  var info = this.getDataInfo();
50
50
  if (!isNullOrUndefined(notifyArgs.virtualInfo)) {
51
51
  if (notifyArgs.virtualInfo.direction !== 'right' && notifyArgs.virtualInfo.direction !== 'left') {
52
- notifyArgs.virtualInfo.blockIndexes = info.blockIndexes;
52
+ if (!((this.parent.dataSource instanceof DataManager && this.parent.dataSource.dataSource.url !== undefined
53
+ && !this.parent.dataSource.dataSource.offline && this.parent.dataSource.dataSource.url !== '') || isCountRequired(this.parent))
54
+ || notifyArgs.virtualInfo.blockIndexes.length === 1) {
55
+ notifyArgs.virtualInfo.blockIndexes = info.blockIndexes;
56
+ }
53
57
  }
54
58
  else {
55
59
  notifyArgs.virtualInfo.blockIndexes = this.getBlockIndexes(notifyArgs.virtualInfo.page);
@@ -62,7 +62,7 @@ export declare class TreeInterSectionObserver extends InterSectionObserver {
62
62
  private newPos;
63
63
  private lastPos;
64
64
  private timer;
65
- observes(callback: Function, onEnterCallback: Function): void;
65
+ observes(callback: Function, onEnterCallback: Function, instance: IGrid): void;
66
66
  private clear;
67
67
  private virtualScrollHandlers;
68
68
  }
@@ -114,7 +114,7 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
114
114
  this.parent[action]('data-ready', this.onDataReady, this);
115
115
  this.parent[action]('refresh-virtual-block', this.refreshContentRows, this);
116
116
  this.fn = function () {
117
- _this.observers.observes(function (scrollArgs) { return _this.scrollListeners(scrollArgs); }, _this.onEnteredAction());
117
+ _this.observers.observes(function (scrollArgs) { return _this.scrollListeners(scrollArgs); }, _this.onEnteredAction(), _this.parent);
118
118
  _this.parent.off('content-ready', _this.fn);
119
119
  };
120
120
  this.parent.addEventListener('dataBound', this.dataBoundEvent.bind(this));
@@ -443,7 +443,9 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
443
443
  }
444
444
  }
445
445
  if (((downScroll && (scrollArgs.offset.top < (this.parent.getRowHeight() * this.totalRecords)))
446
- || (upScroll)) || (scrollArgs.direction === 'right' || scrollArgs.direction === 'left')) {
446
+ || (upScroll)) || (scrollArgs.direction === 'right' || scrollArgs.direction === 'left') ||
447
+ ((this.parent.dataSource instanceof DataManager && this.parent.dataSource.dataSource.url !== undefined
448
+ && !this.parent.dataSource.dataSource.offline && this.parent.dataSource.dataSource.url !== '') || isCountRequired(this.parent))) {
447
449
  var viewInfo = this.currentInfo = getValue('getInfoFromView', this).apply(this, [scrollArgs.direction, info, scrollArgs.offset]);
448
450
  this.previousInfo = viewInfo;
449
451
  this.parent.setColumnIndexesInView(this.parent.enableColumnVirtualization ? viewInfo.columnIndexes : []);
@@ -564,27 +566,27 @@ var TreeInterSectionObserver = /** @class */ (function (_super) {
564
566
  _this.timer = 0;
565
567
  return _this;
566
568
  }
567
- TreeInterSectionObserver.prototype.observes = function (callback, onEnterCallback) {
569
+ TreeInterSectionObserver.prototype.observes = function (callback, onEnterCallback, instance) {
568
570
  var containerRect = 'containerRect';
569
571
  _super.prototype[containerRect] = getValue('options', this).container.getBoundingClientRect();
570
- EventHandler.add(getValue('options', this).container, 'scroll', this.virtualScrollHandlers(callback, onEnterCallback), this);
572
+ EventHandler.add(getValue('options', this).container, 'scroll', this.virtualScrollHandlers(callback, onEnterCallback, instance), this);
571
573
  if (getValue('options', this).movableContainer) {
572
574
  var movableContainerRect = 'movableContainerRect';
573
575
  _super.prototype[movableContainerRect] = getValue('options', this).movableContainer.getBoundingClientRect();
574
- EventHandler.add(getValue('options', this).movableContainer, 'scroll', this.virtualScrollHandlers(callback, onEnterCallback), this);
576
+ EventHandler.add(getValue('options', this).movableContainer, 'scroll', this.virtualScrollHandlers(callback, onEnterCallback, instance), this);
575
577
  }
576
578
  };
577
579
  TreeInterSectionObserver.prototype.clear = function () {
578
580
  this.lastPos = null;
579
581
  };
580
- TreeInterSectionObserver.prototype.virtualScrollHandlers = function (callback, onEnterCallback) {
582
+ TreeInterSectionObserver.prototype.virtualScrollHandlers = function (callback, onEnterCallback, instance) {
581
583
  var _this = this;
582
584
  var delay = Browser.info.name === 'chrome' ? 200 : 100;
583
585
  var options = 'options';
584
586
  var movableEle = 'movableEle';
585
587
  var element = 'element';
586
588
  var fromWheel = 'fromWheel';
587
- var debounced100 = debounce(callback, delay);
589
+ //const debounced100: Function = debounce(callback, delay);
588
590
  var debounced50 = debounce(callback, 50);
589
591
  this[options].prevTop = this[options].prevLeft = 0;
590
592
  return function (e) {
@@ -622,15 +624,23 @@ var TreeInterSectionObserver = /** @class */ (function (_super) {
622
624
  }
623
625
  }
624
626
  if (check) {
625
- var fn = debounced100;
627
+ var fn = debounced50;
626
628
  if (current.axis === 'X') {
627
- fn = debounced50;
628
629
  fn({ direction: direction, sentinel: current, offset: { top: top, left: left },
629
630
  focusElement: document.activeElement });
630
631
  }
631
632
  else {
632
- callback({ direction: direction, sentinel: current, offset: { top: top, left: left },
633
- focusElement: document.activeElement });
633
+ if ((instance.dataSource instanceof DataManager && instance.dataSource.dataSource.url !== undefined
634
+ && !instance.dataSource.dataSource.offline && instance.dataSource.dataSource.url !== '') || isCountRequired(instance)) {
635
+ fn({ direction: direction, sentinel: current, offset: { top: top, left: left },
636
+ focusElement: document.activeElement });
637
+ }
638
+ else {
639
+ callback({
640
+ direction: direction, sentinel: current, offset: { top: top, left: left },
641
+ focusElement: document.activeElement
642
+ });
643
+ }
634
644
  }
635
645
  }
636
646
  _this[fromWheel] = false;