@syncfusion/ej2-treegrid 32.1.25 → 32.2.4
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.
- package/dist/ej2-treegrid.min.js +2 -2
- package/dist/ej2-treegrid.umd.min.js +2 -2
- package/dist/ej2-treegrid.umd.min.js.map +1 -1
- package/dist/es6/ej2-treegrid.es2015.js +116 -22
- package/dist/es6/ej2-treegrid.es2015.js.map +1 -1
- package/dist/es6/ej2-treegrid.es5.js +118 -22
- package/dist/es6/ej2-treegrid.es5.js.map +1 -1
- package/dist/global/ej2-treegrid.min.js +2 -2
- package/dist/global/ej2-treegrid.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +5 -5
- package/src/treegrid/actions/batch-edit.js +4 -1
- package/src/treegrid/actions/infinite-scroll.d.ts +8 -0
- package/src/treegrid/actions/infinite-scroll.js +83 -3
- package/src/treegrid/base/constant.d.ts +2 -0
- package/src/treegrid/base/constant.js +2 -0
- package/src/treegrid/base/treegrid.d.ts +1 -0
- package/src/treegrid/base/treegrid.js +28 -17
package/dist/global/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* filename: index.d.ts
|
|
3
|
-
* version : 32.
|
|
3
|
+
* version : 32.2.4
|
|
4
4
|
* Copyright Syncfusion Inc. 2001 - 2025. 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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@syncfusion/ej2-treegrid",
|
|
3
|
-
"version": "32.
|
|
3
|
+
"version": "32.2.4",
|
|
4
4
|
"description": "Essential JS 2 TreeGrid Component",
|
|
5
5
|
"author": "Syncfusion Inc.",
|
|
6
6
|
"license": "SEE LICENSE IN license",
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
"module": "./index.js",
|
|
9
9
|
"es2015": "./dist/es6/ej2-treegrid.es5.js",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@syncfusion/ej2-base": "~32.
|
|
12
|
-
"@syncfusion/ej2-data": "~32.
|
|
13
|
-
"@syncfusion/ej2-grids": "~32.
|
|
14
|
-
"@syncfusion/ej2-popups": "~32.
|
|
11
|
+
"@syncfusion/ej2-base": "~32.2.3",
|
|
12
|
+
"@syncfusion/ej2-data": "~32.2.3",
|
|
13
|
+
"@syncfusion/ej2-grids": "~32.2.3",
|
|
14
|
+
"@syncfusion/ej2-popups": "~32.2.4"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {},
|
|
17
17
|
"keywords": [
|
|
@@ -228,7 +228,7 @@ var BatchEdit = /** @class */ (function () {
|
|
|
228
228
|
return;
|
|
229
229
|
}
|
|
230
230
|
if (this.parent.editModule['isAddedRowByMethod'] && !isNullOrUndefined(this.parent.editModule['addRowIndex']) &&
|
|
231
|
-
!this.parent.editModule['isAddedRowByContextMenu'] && (this.parent.
|
|
231
|
+
!this.parent.editModule['isAddedRowByContextMenu'] && (this.parent.editModule['selectedIndex'] >= 0 || this.parent.editModule['batchEditModule'].isAdd)) {
|
|
232
232
|
this.selectedIndex = this.parent.editModule['selectedIndex'];
|
|
233
233
|
this.addRowIndex = this.parent.editModule['addRowIndex'];
|
|
234
234
|
this.addRowRecord = this.batchRecords.length ? this.batchRecords[this.selectedIndex]
|
|
@@ -603,6 +603,9 @@ var BatchEdit = /** @class */ (function () {
|
|
|
603
603
|
if (this.parent.editModule['isAddedRowByContextMenu']) {
|
|
604
604
|
this.parent.editModule['isAddedRowByContextMenu'] = false;
|
|
605
605
|
}
|
|
606
|
+
if (this.parent.editModule['isAddedRowByMethod']) {
|
|
607
|
+
this.parent.editModule['isAddedRowByMethod'] = false;
|
|
608
|
+
}
|
|
606
609
|
};
|
|
607
610
|
BatchEdit.prototype.getActualRowObjectIndex = function (index) {
|
|
608
611
|
var rows = this.parent.grid.getDataRows();
|
|
@@ -7,6 +7,10 @@ import { TreeGrid } from '../base/treegrid';
|
|
|
7
7
|
export declare class InfiniteScroll {
|
|
8
8
|
private parent;
|
|
9
9
|
private visualData;
|
|
10
|
+
private maxPage;
|
|
11
|
+
private treeAction;
|
|
12
|
+
private collapsedData;
|
|
13
|
+
private dataBoundFunction;
|
|
10
14
|
/**
|
|
11
15
|
* Constructor for VirtualScroll module
|
|
12
16
|
*
|
|
@@ -30,6 +34,10 @@ export declare class InfiniteScroll {
|
|
|
30
34
|
* @returns {void}
|
|
31
35
|
*/
|
|
32
36
|
removeEventListener(): void;
|
|
37
|
+
private dataBound;
|
|
38
|
+
private onDataReady;
|
|
39
|
+
private collapseActionComplete;
|
|
40
|
+
private makeCollapseRequest;
|
|
33
41
|
/**
|
|
34
42
|
* Handles the Expand Collapse action for Remote data with infinite scrolling.
|
|
35
43
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Grid, InfiniteScroll as GridInfiniteScroll } from '@syncfusion/ej2-grids';
|
|
1
|
+
import { Grid, InfiniteScroll as GridInfiniteScroll, getRowIndexFromElement } from '@syncfusion/ej2-grids';
|
|
2
2
|
import { RowRenderer, resetRowIndex } from '@syncfusion/ej2-grids';
|
|
3
3
|
import { getValue, isNullOrUndefined, remove } from '@syncfusion/ej2-base';
|
|
4
4
|
import * as events from '../base/constant';
|
|
@@ -40,6 +40,10 @@ var InfiniteScroll = /** @class */ (function () {
|
|
|
40
40
|
this.parent.grid.on('infinite-edit-handler', this.infiniteEditHandler, this);
|
|
41
41
|
this.parent.grid.on('infinite-crud-cancel', this.createRows, this);
|
|
42
42
|
this.parent.grid.on('content-ready', this.contentready, this);
|
|
43
|
+
this.parent.on(events.collapseActionComplete, this.collapseActionComplete, this);
|
|
44
|
+
this.parent.grid.on('data-ready', this.onDataReady, this);
|
|
45
|
+
this.dataBoundFunction = this.dataBound.bind(this);
|
|
46
|
+
this.parent.addEventListener(events.dataBound, this.dataBoundFunction);
|
|
43
47
|
};
|
|
44
48
|
/**
|
|
45
49
|
* @hidden
|
|
@@ -55,6 +59,53 @@ var InfiniteScroll = /** @class */ (function () {
|
|
|
55
59
|
this.parent.off(events.pagingActions, this.infinitePageAction);
|
|
56
60
|
this.parent.grid.off('infinite-crud-cancel', this.createRows);
|
|
57
61
|
this.parent.grid.off('content-ready', this.contentready);
|
|
62
|
+
this.parent.off(events.collapseActionComplete, this.collapseActionComplete);
|
|
63
|
+
this.parent.grid.off('data-ready', this.onDataReady);
|
|
64
|
+
this.parent.removeEventListener(events.dataBound, this.dataBoundFunction);
|
|
65
|
+
};
|
|
66
|
+
InfiniteScroll.prototype.dataBound = function () {
|
|
67
|
+
if (this.treeAction === 'collapse') {
|
|
68
|
+
this.treeAction = 'refresh';
|
|
69
|
+
this.makeCollapseRequest();
|
|
70
|
+
}
|
|
71
|
+
else if (this.treeAction === 'refresh') {
|
|
72
|
+
this.treeAction = null;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
InfiniteScroll.prototype.onDataReady = function (e) {
|
|
76
|
+
if (!isNullOrUndefined(e.count) && e.requestType !== 'infiniteScroll') {
|
|
77
|
+
this.maxPage = Math.ceil(e.count / this.parent.pageSettings.pageSize);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
InfiniteScroll.prototype.collapseActionComplete = function (args) {
|
|
81
|
+
if (!this.parent.infiniteScrollSettings.enableCache && args.isCollapse) {
|
|
82
|
+
var contentBounds = this.parent.getContent().firstElementChild.getBoundingClientRect();
|
|
83
|
+
var tableBounds = this.parent.grid.contentModule.getTable().getBoundingClientRect();
|
|
84
|
+
if (Math.round(tableBounds.bottom - this.parent.grid.getRowHeight()) <= Math.round(contentBounds.bottom)) {
|
|
85
|
+
this.treeAction = 'collapse';
|
|
86
|
+
this.collapsedData = args.data;
|
|
87
|
+
this.makeCollapseRequest(args);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
InfiniteScroll.prototype.makeCollapseRequest = function (args) {
|
|
92
|
+
var rows = this.parent.getRows();
|
|
93
|
+
var index = getRowIndexFromElement(rows[rows.length - 1]);
|
|
94
|
+
var previousPage = this.parent.grid.pageSettings.currentPage;
|
|
95
|
+
var nextPage = Math.ceil(index / this.parent.grid.pageSettings.pageSize) + 1;
|
|
96
|
+
if ((previousPage >= this.maxPage) || (nextPage > this.maxPage)) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
this.parent.grid.pageSettings.currentPage = nextPage;
|
|
100
|
+
this.parent['isInfiniteCollapse'] = true;
|
|
101
|
+
var scrollArg = {
|
|
102
|
+
requestType: 'infiniteScroll',
|
|
103
|
+
currentPage: this.parent.grid.pageSettings.currentPage,
|
|
104
|
+
prevPage: previousPage,
|
|
105
|
+
startIndex: index + 1,
|
|
106
|
+
direction: 'down'
|
|
107
|
+
};
|
|
108
|
+
this.parent.grid.notify('model-changed', scrollArg);
|
|
58
109
|
};
|
|
59
110
|
/**
|
|
60
111
|
* Handles the Expand Collapse action for Remote data with infinite scrolling.
|
|
@@ -114,6 +165,7 @@ var InfiniteScroll = /** @class */ (function () {
|
|
|
114
165
|
* @returns {void}
|
|
115
166
|
*/
|
|
116
167
|
InfiniteScroll.prototype.infinitePageAction = function (pageingDetails) {
|
|
168
|
+
var _this = this;
|
|
117
169
|
var dm = new DataManager(pageingDetails.result);
|
|
118
170
|
var expanded = new Predicate('expanded', 'notequal', null).or('expanded', 'notequal', undefined);
|
|
119
171
|
var visualData = dm.executeLocal(new Query().where(expanded));
|
|
@@ -145,7 +197,12 @@ var InfiniteScroll = /** @class */ (function () {
|
|
|
145
197
|
if (!isCache && actionArgs.requestType === 'delete') {
|
|
146
198
|
var skip = lastIndex - actionArgs.data.length + 1;
|
|
147
199
|
var take = actionArgs.data.length;
|
|
148
|
-
|
|
200
|
+
if (skip < 0) {
|
|
201
|
+
query = query.take(take);
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
query = query.skip(skip).take(take);
|
|
205
|
+
}
|
|
149
206
|
}
|
|
150
207
|
else if (isCache && actionArgs.requestType === 'delete' ||
|
|
151
208
|
(actionArgs.requestType === 'save' && actionArgs.action === 'add')) {
|
|
@@ -153,13 +210,36 @@ var InfiniteScroll = /** @class */ (function () {
|
|
|
153
210
|
query = query.take(this.parent.infiniteScrollSettings.initialBlocks * this.parent.pageSettings.pageSize);
|
|
154
211
|
}
|
|
155
212
|
else {
|
|
156
|
-
|
|
213
|
+
if (this.treeAction !== 'collapse' && this.treeAction !== 'refresh') {
|
|
214
|
+
query = query.page(current, size);
|
|
215
|
+
}
|
|
157
216
|
}
|
|
158
217
|
}
|
|
159
218
|
else {
|
|
160
219
|
query = query.page(current, size);
|
|
161
220
|
}
|
|
162
221
|
dm.dataSource.json = visualData;
|
|
222
|
+
if (this.treeAction === 'collapse') {
|
|
223
|
+
var rows = this.parent.getRows();
|
|
224
|
+
var skip = getRowIndexFromElement(rows[rows.length - 1]) + 1;
|
|
225
|
+
query = query.skip(skip);
|
|
226
|
+
var renderedChildDataCount = this.parent.grid.getRowsObject().filter(function (record) {
|
|
227
|
+
return record.data.parentUniqueID === _this.collapsedData.uniqueID;
|
|
228
|
+
}).length;
|
|
229
|
+
var remainingChildDataCount = this.collapsedData.childRecords.length - renderedChildDataCount;
|
|
230
|
+
if (remainingChildDataCount > 0) {
|
|
231
|
+
query = query.take(Math.max(remainingChildDataCount, 0));
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
query = query.take(this.parent.pageSettings.pageSize);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
else if (this.treeAction === 'refresh') {
|
|
238
|
+
var rows = this.parent.getRows();
|
|
239
|
+
var skip = getRowIndexFromElement(rows[rows.length - 1]) + 1;
|
|
240
|
+
query = query.skip(skip);
|
|
241
|
+
query = query.take(this.parent.infiniteScrollSettings.initialBlocks * this.parent.pageSettings.pageSize);
|
|
242
|
+
}
|
|
163
243
|
if (!isCache && !isNullOrUndefined(actionArgs) && actionArgs.requestType === 'save' && actionArgs.action === 'add') {
|
|
164
244
|
pageingDetails.result = [actionArgs.data];
|
|
165
245
|
}
|
|
@@ -126,6 +126,7 @@ export declare class TreeGrid extends Component<HTMLElement> implements INotifyP
|
|
|
126
126
|
private componentRefresh;
|
|
127
127
|
private isComponentRefresh;
|
|
128
128
|
private isVirtualExpandCollapse;
|
|
129
|
+
private isInfiniteCollapse;
|
|
129
130
|
private isExcel;
|
|
130
131
|
/** @hidden */
|
|
131
132
|
initialRender: boolean;
|
|
@@ -82,6 +82,7 @@ var TreeGrid = /** @class */ (function (_super) {
|
|
|
82
82
|
_this.componentRefresh = Component.prototype.refresh;
|
|
83
83
|
_this.isComponentRefresh = false;
|
|
84
84
|
_this.isVirtualExpandCollapse = false;
|
|
85
|
+
_this.isInfiniteCollapse = false;
|
|
85
86
|
_this.objectEqualityChecker = function (old, current) {
|
|
86
87
|
if (old) {
|
|
87
88
|
var keys = Object.keys(old);
|
|
@@ -958,12 +959,12 @@ var TreeGrid = /** @class */ (function (_super) {
|
|
|
958
959
|
var checkboxColumn = this.columnModel.filter(function (col) { return col.showCheckbox; });
|
|
959
960
|
var treeColumn = this.columns[this.treeColumnIndex];
|
|
960
961
|
if (checkboxColumn.length !== 0) {
|
|
961
|
-
if (checkboxColumn !== treeColumn) {
|
|
962
|
-
failureCases.push('ShowCheckbox column should not be defined other than the tree column.');
|
|
963
|
-
}
|
|
964
962
|
if (checkboxColumn.length > 1) {
|
|
965
963
|
failureCases.push('Only one column can have the ShowCheckbox option enabled.');
|
|
966
964
|
}
|
|
965
|
+
else if (checkboxColumn[0].field !== treeColumn.field) {
|
|
966
|
+
failureCases.push('ShowCheckbox column should not be defined other than the tree column.');
|
|
967
|
+
}
|
|
967
968
|
}
|
|
968
969
|
var alignColumn;
|
|
969
970
|
if (this.treeColumnIndex !== null && this.treeColumnIndex !== -1 && this.treeColumnIndex < this.columns.length) {
|
|
@@ -1595,6 +1596,12 @@ var TreeGrid = /** @class */ (function (_super) {
|
|
|
1595
1596
|
if (args.action === 'clearFilter' && _this.enableCollapseAll) {
|
|
1596
1597
|
_this.collapseAll();
|
|
1597
1598
|
}
|
|
1599
|
+
if (args.action === 'clearFilter' && _this.enableInfiniteScrolling) {
|
|
1600
|
+
_this.expandAll();
|
|
1601
|
+
}
|
|
1602
|
+
if (args.requestType === 'sorting' && _this.enableInfiniteScrolling) {
|
|
1603
|
+
_this.expandAll();
|
|
1604
|
+
}
|
|
1598
1605
|
if (_this.action === 'indenting' || _this.action === 'outdenting') {
|
|
1599
1606
|
_this.action = _this.action === 'indenting' ? 'indented' : 'outdented';
|
|
1600
1607
|
var selectedItem_1 = [_this.selectedRecords];
|
|
@@ -3450,13 +3457,6 @@ var TreeGrid = /** @class */ (function (_super) {
|
|
|
3450
3457
|
else if (!this.isCollapseAll) {
|
|
3451
3458
|
this.trigger(events.collapsed, collapseArgs);
|
|
3452
3459
|
}
|
|
3453
|
-
if (this.enableInfiniteScrolling) {
|
|
3454
|
-
var scrollHeight = this.grid.getContent().firstElementChild.scrollHeight;
|
|
3455
|
-
var scrollTop = this.grid.getContent().firstElementChild.scrollTop;
|
|
3456
|
-
if ((scrollHeight - scrollTop) < this.grid.getRowHeight() + +this.height) {
|
|
3457
|
-
this.grid.getContent().firstElementChild.scrollBy(0, this.grid.getRowHeight());
|
|
3458
|
-
}
|
|
3459
|
-
}
|
|
3460
3460
|
}
|
|
3461
3461
|
};
|
|
3462
3462
|
TreeGrid.prototype.updateExpandStateMapping = function (record, state) {
|
|
@@ -3840,10 +3840,13 @@ var TreeGrid = /** @class */ (function (_super) {
|
|
|
3840
3840
|
if ((!isCountRequired(this) || childRecords.length) || action === 'collapse') {
|
|
3841
3841
|
this.localExpand(action, row, record);
|
|
3842
3842
|
}
|
|
3843
|
+
if (this.enableInfiniteScrolling && action === 'collapse' && !this.isCollapseAll) {
|
|
3844
|
+
this.notify(events.collapseActionComplete, { isCollapse: true, data: record, row: row });
|
|
3845
|
+
}
|
|
3843
3846
|
var lastrowIdx = this.getVisibleRecords()[this.getVisibleRecords().length - 1]['index'];
|
|
3844
3847
|
var lastRow = this.getRowByIndex(lastrowIdx);
|
|
3845
3848
|
var borderElement = lastRow ? lastRow.nextElementSibling ? lastRow.nextElementSibling.classList.contains('e-detailrow') ? lastRow.nextElementSibling : lastRow : lastRow : null;
|
|
3846
|
-
if (this.grid.getContentTable().clientHeight <= this.grid.getContent().clientHeight && !isNullOrUndefined(borderElement) && !borderElement.cells[0].classList.contains('e-lastrowcell')) {
|
|
3849
|
+
if (!this.isInfiniteCollapse && this.grid.getContentTable().clientHeight <= this.grid.getContent().clientHeight && !isNullOrUndefined(borderElement) && !borderElement.cells[0].classList.contains('e-lastrowcell')) {
|
|
3847
3850
|
this.lastRowBorder(borderElement, true);
|
|
3848
3851
|
}
|
|
3849
3852
|
}
|
|
@@ -3858,7 +3861,7 @@ var TreeGrid = /** @class */ (function (_super) {
|
|
|
3858
3861
|
targetEle.closest('.e-treerowcell').classList.remove('e-cellselectionbackground');
|
|
3859
3862
|
targetEle.closest('.e-treerowcell').removeAttribute('aria-selected');
|
|
3860
3863
|
}
|
|
3861
|
-
if (this.isPixelHeight() && !row.cells[0].classList.contains('e-lastrowcell')) {
|
|
3864
|
+
if (this.isPixelHeight() && !row.cells[0].classList.contains('e-lastrowcell') && !this.isInfiniteCollapse) {
|
|
3862
3865
|
var totalRows = this.getRows();
|
|
3863
3866
|
var rows = this.getContentTable().rows;
|
|
3864
3867
|
totalRows = [].slice.call(rows);
|
|
@@ -3875,6 +3878,7 @@ var TreeGrid = /** @class */ (function (_super) {
|
|
|
3875
3878
|
this.notify('rowExpandCollapse', { detailrows: detailrows, action: displayAction, record: record, row: row });
|
|
3876
3879
|
this.updateAltRow(gridRows);
|
|
3877
3880
|
}
|
|
3881
|
+
this.isInfiniteCollapse = false;
|
|
3878
3882
|
};
|
|
3879
3883
|
TreeGrid.prototype.updateChildOnDemand = function (expandingArgs) {
|
|
3880
3884
|
var _this = this;
|
|
@@ -4007,11 +4011,18 @@ var TreeGrid = /** @class */ (function (_super) {
|
|
|
4007
4011
|
}
|
|
4008
4012
|
};
|
|
4009
4013
|
TreeGrid.prototype.localExpand = function (action, row, record) {
|
|
4014
|
+
var _this = this;
|
|
4010
4015
|
var rows;
|
|
4011
4016
|
var detailRow = row.nextElementSibling ? row.nextElementSibling.classList.contains('e-detailrow') ? row.nextElementSibling : null : null;
|
|
4012
|
-
var childRecords
|
|
4013
|
-
|
|
4014
|
-
|
|
4017
|
+
var childRecords;
|
|
4018
|
+
if (this.enableInfiniteScrolling) {
|
|
4019
|
+
childRecords = this.grid.getRowsObject().filter(function (e) { return e.data.parentUniqueID === record.uniqueID; });
|
|
4020
|
+
}
|
|
4021
|
+
else {
|
|
4022
|
+
childRecords = this.grid.currentViewData.filter(function (e) {
|
|
4023
|
+
return e.parentUniqueID === record.uniqueID;
|
|
4024
|
+
});
|
|
4025
|
+
}
|
|
4015
4026
|
if (this.isPixelHeight() && row.cells[0].classList.contains('e-lastrowcell')) {
|
|
4016
4027
|
this.lastRowBorder(row, false);
|
|
4017
4028
|
}
|
|
@@ -4051,9 +4062,9 @@ var TreeGrid = /** @class */ (function (_super) {
|
|
|
4051
4062
|
});
|
|
4052
4063
|
}
|
|
4053
4064
|
var gridRowsObject = this.grid.getRowsObject();
|
|
4054
|
-
var currentViewData = this.grid.currentViewData;
|
|
4065
|
+
var currentViewData = this.enableInfiniteScrolling ? this.grid.getRowsObject() : this.grid.currentViewData;
|
|
4055
4066
|
var currentRecord = currentViewData.filter(function (e) {
|
|
4056
|
-
return e.uniqueID === record.uniqueID;
|
|
4067
|
+
return _this.enableInfiniteScrolling ? e.data.uniqueID === record.uniqueID : e.uniqueID === record.uniqueID;
|
|
4057
4068
|
});
|
|
4058
4069
|
var currentIndex = currentViewData.indexOf(currentRecord[0]);
|
|
4059
4070
|
if (!isNullOrUndefined(gridRowsObject[parseInt(currentIndex.toString(), 10)].visible) &&
|