@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.
- package/CHANGELOG.md +19 -0
- 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 +132 -47
- package/dist/es6/ej2-treegrid.es2015.js.map +1 -1
- package/dist/es6/ej2-treegrid.es5.js +132 -47
- 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 +9 -9
- package/src/treegrid/actions/edit.js +6 -1
- package/src/treegrid/actions/selection.js +0 -1
- package/src/treegrid/actions/virtual-scroll.js +2 -2
- package/src/treegrid/base/treegrid.d.ts +8 -0
- package/src/treegrid/base/treegrid.js +115 -35
- package/src/treegrid/renderer/virtual-tree-content-render.js +9 -7
|
@@ -1276,9 +1276,7 @@ class Selection {
|
|
|
1276
1276
|
if (recordIndex > -1) {
|
|
1277
1277
|
if (!isNullOrUndefined(checkbox)) {
|
|
1278
1278
|
checkbox.classList.add(checkBoxclass);
|
|
1279
|
-
const chkstate = checkState === 'check' ? 'checked' : checkState === 'uncheck' ? 'unchecked' : 'mixed';
|
|
1280
1279
|
tr.querySelector('.e-treecheckselect').setAttribute('aria-checked', checkState === 'check' ? 'true' : checkState === 'uncheck' ? 'false' : 'mixed');
|
|
1281
|
-
tr.querySelector('.e-frame').setAttribute('title', 'checkbox' + chkstate);
|
|
1282
1280
|
}
|
|
1283
1281
|
}
|
|
1284
1282
|
}
|
|
@@ -5884,28 +5882,70 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
|
|
|
5884
5882
|
* @returns {void}
|
|
5885
5883
|
*/
|
|
5886
5884
|
expandRow(row, record, key, level) {
|
|
5885
|
+
let parentRec = this.parentData;
|
|
5886
|
+
if (!this.enableVirtualization) {
|
|
5887
|
+
parentRec = this.flatData.filter((e) => {
|
|
5888
|
+
return e.hasChildRecords;
|
|
5889
|
+
});
|
|
5890
|
+
}
|
|
5887
5891
|
record = this.getCollapseExpandRecords(row, record);
|
|
5888
5892
|
if (!isNullOrUndefined(row) && row.cells[0].classList.contains('e-lastrowcell')) {
|
|
5889
5893
|
this.lastRowBorder(row, false);
|
|
5890
5894
|
}
|
|
5891
|
-
|
|
5892
|
-
|
|
5893
|
-
|
|
5894
|
-
|
|
5895
|
-
|
|
5896
|
-
|
|
5897
|
-
|
|
5898
|
-
|
|
5899
|
-
|
|
5900
|
-
|
|
5901
|
-
|
|
5902
|
-
|
|
5903
|
-
|
|
5895
|
+
if (this.isExpandAll && !isRemoteData(this)) {
|
|
5896
|
+
const args = { data: parentRec, row: row, cancel: false };
|
|
5897
|
+
let pagerValuePresent = false;
|
|
5898
|
+
if (this.grid.pagerModule && !isNullOrUndefined(this.grid.pagerModule.pagerObj.pagerdropdownModule)) {
|
|
5899
|
+
pagerValuePresent = this.grid.pagerModule.pagerObj.pagerdropdownModule['dropDownListObject'].value ? true : false;
|
|
5900
|
+
}
|
|
5901
|
+
if (!this.isExpandingEventTriggered) {
|
|
5902
|
+
this.trigger(expanding, args, (expandingArgs) => {
|
|
5903
|
+
this.expandAllPrevent = expandingArgs.cancel;
|
|
5904
|
+
if (!expandingArgs.cancel) {
|
|
5905
|
+
if (expandingArgs.expandAll) {
|
|
5906
|
+
this.expandCollapseAllChildren(record, 'expand', key, level);
|
|
5907
|
+
}
|
|
5908
|
+
this.expandRows(row, record, parentRec, key, level);
|
|
5909
|
+
}
|
|
5910
|
+
});
|
|
5911
|
+
}
|
|
5912
|
+
else if ((!this.allowPaging || (pagerValuePresent && this.grid.pagerModule.pagerObj.pagerdropdownModule['dropDownListObject'].value === 'All')) &&
|
|
5913
|
+
!this.expandAllPrevent && this.isExpandingEventTriggered) {
|
|
5914
|
+
this.expandRows(row, record, parentRec, key, level);
|
|
5915
|
+
}
|
|
5916
|
+
this.isExpandingEventTriggered = true;
|
|
5917
|
+
}
|
|
5918
|
+
else if (!this.isExpandAll || (this.isExpandAll && isRemoteData(this))) {
|
|
5919
|
+
const args = { data: record, row: row, cancel: false };
|
|
5920
|
+
this.trigger(expanding, args, (expandingArgs) => {
|
|
5921
|
+
if (!expandingArgs.cancel) {
|
|
5922
|
+
if (expandingArgs.expandAll) {
|
|
5923
|
+
this.expandCollapseAllChildren(record, 'expand', key, level);
|
|
5904
5924
|
}
|
|
5905
|
-
this.
|
|
5925
|
+
this.expandRows(row, record, parentRec, key, level);
|
|
5906
5926
|
}
|
|
5927
|
+
});
|
|
5928
|
+
}
|
|
5929
|
+
}
|
|
5930
|
+
// Internal method to handle the rows expand
|
|
5931
|
+
expandRows(row, record, parentRec, key, level) {
|
|
5932
|
+
this.expandCollapse('expand', row, record);
|
|
5933
|
+
const children = 'Children';
|
|
5934
|
+
if (!(isRemoteData(this) && !isOffline(this)) && (!isCountRequired(this) || !isNullOrUndefined(record[`${children}`]))) {
|
|
5935
|
+
let expandArgs = { data: record, row: row };
|
|
5936
|
+
this.setHeightForFrozenContent();
|
|
5937
|
+
if (!isNullOrUndefined(this.expandStateMapping)) {
|
|
5938
|
+
this.updateExpandStateMapping(expandArgs.data, true);
|
|
5907
5939
|
}
|
|
5908
|
-
|
|
5940
|
+
if (this.isExpandAll && !this.isExpandedEventTriggered) {
|
|
5941
|
+
this.isExpandedEventTriggered = true;
|
|
5942
|
+
expandArgs = { data: parentRec, row: row };
|
|
5943
|
+
this.trigger(expanded, expandArgs);
|
|
5944
|
+
}
|
|
5945
|
+
else if (!this.isExpandAll) {
|
|
5946
|
+
this.trigger(expanded, expandArgs);
|
|
5947
|
+
}
|
|
5948
|
+
}
|
|
5909
5949
|
}
|
|
5910
5950
|
expandCollapseAllChildren(record, action, key, level) {
|
|
5911
5951
|
if ((!isNullOrUndefined(key) && record[this.getPrimaryKeyFieldNames()[0]] !== key) ||
|
|
@@ -5962,31 +6002,65 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
|
|
|
5962
6002
|
* @returns {void}
|
|
5963
6003
|
*/
|
|
5964
6004
|
collapseRow(row, record, key) {
|
|
6005
|
+
let parentRec = this.parentData;
|
|
6006
|
+
if (!this.enableVirtualization) {
|
|
6007
|
+
parentRec = this.flatData.filter((e) => {
|
|
6008
|
+
return e.hasChildRecords;
|
|
6009
|
+
});
|
|
6010
|
+
}
|
|
5965
6011
|
record = this.getCollapseExpandRecords(row, record);
|
|
5966
|
-
|
|
5967
|
-
|
|
5968
|
-
if (!
|
|
5969
|
-
|
|
5970
|
-
this.
|
|
5971
|
-
|
|
5972
|
-
|
|
5973
|
-
|
|
5974
|
-
if (!isRemoteData(this)) {
|
|
5975
|
-
this.setHeightForFrozenContent();
|
|
5976
|
-
if (!isNullOrUndefined(this.expandStateMapping)) {
|
|
5977
|
-
this.updateExpandStateMapping(collapseArgs.data, false);
|
|
5978
|
-
}
|
|
5979
|
-
this.trigger(collapsed, collapseArgs);
|
|
5980
|
-
if (this.enableInfiniteScrolling) {
|
|
5981
|
-
const scrollHeight = this.grid.getContent().firstElementChild.scrollHeight;
|
|
5982
|
-
const scrollTop = this.grid.getContent().firstElementChild.scrollTop;
|
|
5983
|
-
if ((scrollHeight - scrollTop) < this.grid.getRowHeight() + +this.height) {
|
|
5984
|
-
this.grid.getContent().firstElementChild.scrollBy(0, this.grid.getRowHeight());
|
|
6012
|
+
if (this.isCollapseAll && !isRemoteData(this)) {
|
|
6013
|
+
const args = { data: parentRec, row: row, cancel: false };
|
|
6014
|
+
if (!this.isCollapsingEventTriggered) {
|
|
6015
|
+
this.trigger(collapsing, args, (collapsingArgs) => {
|
|
6016
|
+
this.collapseAllPrevent = collapsingArgs.cancel;
|
|
6017
|
+
if (!collapsingArgs.cancel) {
|
|
6018
|
+
if (collapsingArgs.collapseAll) {
|
|
6019
|
+
this.expandCollapseAllChildren(record, 'collapse', key);
|
|
5985
6020
|
}
|
|
6021
|
+
this.collapseRows(row, record, parentRec, key);
|
|
5986
6022
|
}
|
|
6023
|
+
});
|
|
6024
|
+
}
|
|
6025
|
+
else if (!this.allowPaging && !this.collapseAllPrevent && this.isCollapsingEventTriggered) {
|
|
6026
|
+
this.collapseRows(row, record, parentRec, key);
|
|
6027
|
+
}
|
|
6028
|
+
this.isCollapsingEventTriggered = true;
|
|
6029
|
+
}
|
|
6030
|
+
else if (!this.isCollapseAll || (this.isCollapseAll && isRemoteData(this))) {
|
|
6031
|
+
const args = { data: record, row: row, cancel: false };
|
|
6032
|
+
this.trigger(collapsing, args, (collapsingArgs) => {
|
|
6033
|
+
if (!collapsingArgs.cancel) {
|
|
6034
|
+
this.collapseRows(row, record, parentRec, key);
|
|
5987
6035
|
}
|
|
6036
|
+
});
|
|
6037
|
+
}
|
|
6038
|
+
}
|
|
6039
|
+
// Internal method for handling the rows collapse
|
|
6040
|
+
collapseRows(row, record, parentRec, key) {
|
|
6041
|
+
this.expandCollapse('collapse', row, record);
|
|
6042
|
+
let collapseArgs = { data: record, row: row };
|
|
6043
|
+
if (!isRemoteData(this)) {
|
|
6044
|
+
this.setHeightForFrozenContent();
|
|
6045
|
+
if (!isNullOrUndefined(this.expandStateMapping)) {
|
|
6046
|
+
this.updateExpandStateMapping(collapseArgs.data, false);
|
|
5988
6047
|
}
|
|
5989
|
-
|
|
6048
|
+
if (this.isCollapseAll && !this.isCollapsedEventTriggered) {
|
|
6049
|
+
this.isCollapsedEventTriggered = true;
|
|
6050
|
+
collapseArgs = { data: parentRec, row: row };
|
|
6051
|
+
this.trigger(collapsed, collapseArgs);
|
|
6052
|
+
}
|
|
6053
|
+
else if (!this.isCollapseAll) {
|
|
6054
|
+
this.trigger(collapsed, collapseArgs);
|
|
6055
|
+
}
|
|
6056
|
+
if (this.enableInfiniteScrolling) {
|
|
6057
|
+
const scrollHeight = this.grid.getContent().firstElementChild.scrollHeight;
|
|
6058
|
+
const scrollTop = this.grid.getContent().firstElementChild.scrollTop;
|
|
6059
|
+
if ((scrollHeight - scrollTop) < this.grid.getRowHeight() + +this.height) {
|
|
6060
|
+
this.grid.getContent().firstElementChild.scrollBy(0, this.grid.getRowHeight());
|
|
6061
|
+
}
|
|
6062
|
+
}
|
|
6063
|
+
}
|
|
5990
6064
|
}
|
|
5991
6065
|
updateExpandStateMapping(record, state) {
|
|
5992
6066
|
const totalRecords = record;
|
|
@@ -6143,6 +6217,8 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
|
|
|
6143
6217
|
* @returns {void}
|
|
6144
6218
|
*/
|
|
6145
6219
|
expandAll() {
|
|
6220
|
+
this.isExpandedEventTriggered = false;
|
|
6221
|
+
this.isExpandingEventTriggered = false;
|
|
6146
6222
|
this.expandCollapseAll('expand');
|
|
6147
6223
|
}
|
|
6148
6224
|
/**
|
|
@@ -6151,6 +6227,8 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
|
|
|
6151
6227
|
* @returns {void}
|
|
6152
6228
|
*/
|
|
6153
6229
|
collapseAll() {
|
|
6230
|
+
this.isCollapsedEventTriggered = false;
|
|
6231
|
+
this.isCollapsingEventTriggered = false;
|
|
6154
6232
|
this.expandCollapseAll('collapse');
|
|
6155
6233
|
}
|
|
6156
6234
|
expandCollapseAll(action) {
|
|
@@ -11950,7 +12028,8 @@ class Edit$1 {
|
|
|
11950
12028
|
this.addRowIndex = this.parent.grid.selectedRowIndex > -1 ? this.parent.grid.selectedRowIndex : 0;
|
|
11951
12029
|
}
|
|
11952
12030
|
}
|
|
11953
|
-
if (this.isAddedRowByMethod
|
|
12031
|
+
if ((this.isAddedRowByMethod || (this.isAddedRowByContextMenu && this.parent.grid.selectedRowIndex !== -1)) &&
|
|
12032
|
+
(this.parent.enableVirtualization || this.parent.enableInfiniteScrolling)) {
|
|
11954
12033
|
this.addRowRecord = this.parent.flatData[this.parent.grid.selectedRowIndex];
|
|
11955
12034
|
if (this.parent.enableVirtualization && this.isAddedRowByContextMenu) {
|
|
11956
12035
|
this.addRowRecord = this.parent.getCurrentViewRecords()[this.addRowIndex];
|
|
@@ -11968,6 +12047,10 @@ class Edit$1 {
|
|
|
11968
12047
|
&& !isNullOrUndefined(this.parent.getSelectedRecords()[0])) {
|
|
11969
12048
|
this.addRowRecord = this.parent.getSelectedRecords()[0];
|
|
11970
12049
|
}
|
|
12050
|
+
if (isNullOrUndefined(this.addRowRecord) && this.parent.getCurrentViewRecords().length > this.addRowIndex &&
|
|
12051
|
+
args.requestType === 'save' && this.parent.getSelectedRecords().length !== 0) {
|
|
12052
|
+
this.addRowRecord = this.parent.getCurrentViewRecords()[this.addRowIndex];
|
|
12053
|
+
}
|
|
11971
12054
|
this.isAddedRowByMethod = false;
|
|
11972
12055
|
args = this.beginAddEdit(args);
|
|
11973
12056
|
// if (args.requestType === 'save' &&
|
|
@@ -12410,7 +12493,7 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
|
|
|
12410
12493
|
}
|
|
12411
12494
|
indexModifier(args) {
|
|
12412
12495
|
const content$$1 = this.parent.getContent().querySelector('.e-content');
|
|
12413
|
-
if (this.recordAdded && this.startIndex > -1 && this.endIndex > -1) {
|
|
12496
|
+
if ((this.recordAdded || args.requestType === 'delete' && this.endIndex > args.count - this.parent.pageSettings.pageSize) && this.startIndex > -1 && this.endIndex > -1) {
|
|
12414
12497
|
if (this.endIndex > args.count - this.parent.pageSettings.pageSize) {
|
|
12415
12498
|
const nextSetResIndex = ~~(content$$1.scrollTop / this.parent.getRowHeight());
|
|
12416
12499
|
let lastIndex = nextSetResIndex + this.parent.getRows().length;
|
|
@@ -12431,7 +12514,8 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
|
|
|
12431
12514
|
this.startIndex = 0;
|
|
12432
12515
|
this.endIndex = this.parent.pageSettings.pageSize - 1;
|
|
12433
12516
|
}
|
|
12434
|
-
if ((this.endIndex - this.startIndex !== this.parent.pageSettings.pageSize) &&
|
|
12517
|
+
if ((this.endIndex - this.startIndex !== this.parent.pageSettings.pageSize) &&
|
|
12518
|
+
(this.totalRecords > this.parent.pageSettings.pageSize) &&
|
|
12435
12519
|
(this.endIndex === this.totalRecords)) {
|
|
12436
12520
|
args.startIndex = this.endIndex - this.parent.pageSettings.pageSize;
|
|
12437
12521
|
args.endIndex = this.endIndex;
|
|
@@ -12748,6 +12832,7 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
|
|
|
12748
12832
|
firsttdinx = +attr; // this.parent.getContent().querySelector('.e-content tr').getAttribute('data-rowindex');
|
|
12749
12833
|
}
|
|
12750
12834
|
if (firsttdinx === 0) {
|
|
12835
|
+
scrollArgs.offset.top = content$$1.scrollTop;
|
|
12751
12836
|
if (this.parent.allowRowDragAndDrop) {
|
|
12752
12837
|
this.translateY = scrollArgs.offset.top - rowHeight * 2;
|
|
12753
12838
|
}
|
|
@@ -12772,7 +12857,7 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
|
|
|
12772
12857
|
lastIndex = nextSetResIndex +
|
|
12773
12858
|
(this.totalRecords - nextSetResIndex);
|
|
12774
12859
|
}
|
|
12775
|
-
this.startIndex = !isLastBlock || isNullOrUndefined(this[
|
|
12860
|
+
this.startIndex = !isLastBlock || isNullOrUndefined(this['' + selectedRowIndex]) ? lastIndex - this.parent.pageSettings.pageSize : nextSetResIndex;
|
|
12776
12861
|
this.endIndex = lastIndex;
|
|
12777
12862
|
if ((nextSetResIndex + this.parent.pageSettings.pageSize) > this.totalRecords && (this.endIndex - this.startIndex) <
|
|
12778
12863
|
(this.parent.pageSettings.pageSize / 2) && (this.endIndex - nextSetResIndex) < (this.parent.pageSettings.pageSize / 2)) {
|
|
@@ -12786,12 +12871,12 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
|
|
|
12786
12871
|
this.translateY = this.getTranslateY(scrollArgs.offset.top, content$$1.getBoundingClientRect().height);
|
|
12787
12872
|
}
|
|
12788
12873
|
else {
|
|
12789
|
-
if (this.
|
|
12790
|
-
this.translateY =
|
|
12874
|
+
if (this.totalRecords === this.endIndex) {
|
|
12875
|
+
this.translateY = (this.totalRecords * rowHeight) - ((this.endIndex - this.startIndex) * rowHeight);
|
|
12791
12876
|
}
|
|
12792
12877
|
else {
|
|
12793
|
-
if (this.
|
|
12794
|
-
this.translateY =
|
|
12878
|
+
if (this.parent.allowRowDragAndDrop) {
|
|
12879
|
+
this.translateY = scrollArgs.offset.top - rowHeight * 2;
|
|
12795
12880
|
}
|
|
12796
12881
|
else {
|
|
12797
12882
|
this.translateY = scrollArgs.offset.top;
|
|
@@ -13095,7 +13180,7 @@ class VirtualScroll$1 {
|
|
|
13095
13180
|
});
|
|
13096
13181
|
this.visualData = visualData;
|
|
13097
13182
|
this.parent.grid.notify(dataListener, { data: visualData });
|
|
13098
|
-
const counts = { startIndex: -1, endIndex: -1, count: pageingDetails.count };
|
|
13183
|
+
const counts = { startIndex: -1, endIndex: -1, count: pageingDetails.count, requestType: pageingDetails.actionArgs.requestType };
|
|
13099
13184
|
this.parent.grid.notify(indexModifier, counts);
|
|
13100
13185
|
let startIndex = counts.startIndex;
|
|
13101
13186
|
let endIndex = counts.endIndex;
|
|
@@ -13118,7 +13203,7 @@ class VirtualScroll$1 {
|
|
|
13118
13203
|
this.parent.grid.getContent().firstElementChild.scrollTop = 0;
|
|
13119
13204
|
this.parent.grid.notify(virtualActionArgs, { setTop: true });
|
|
13120
13205
|
}
|
|
13121
|
-
if (requestType === 'save' || (requestType === 'refresh' && this.parent['isGantt'] && this.parent['isAddedFromGantt'])) {
|
|
13206
|
+
if ((requestType === 'save' && pageingDetails.actionArgs.index >= (counts.count - this.parent.grid.pageSettings.pageSize)) || (requestType === 'refresh' && this.parent['isGantt'] && this.parent['isAddedFromGantt'])) {
|
|
13122
13207
|
startIndex = counts.startIndex + (counts.count - counts.endIndex);
|
|
13123
13208
|
endIndex = counts.count;
|
|
13124
13209
|
this.parent['isAddedFromGantt'] = false;
|