@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
|
@@ -1394,9 +1394,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
1394
1394
|
if (recordIndex > -1) {
|
|
1395
1395
|
if (!isNullOrUndefined(checkbox)) {
|
|
1396
1396
|
checkbox.classList.add(checkBoxclass);
|
|
1397
|
-
var chkstate = checkState === 'check' ? 'checked' : checkState === 'uncheck' ? 'unchecked' : 'mixed';
|
|
1398
1397
|
tr.querySelector('.e-treecheckselect').setAttribute('aria-checked', checkState === 'check' ? 'true' : checkState === 'uncheck' ? 'false' : 'mixed');
|
|
1399
|
-
tr.querySelector('.e-frame').setAttribute('title', 'checkbox' + chkstate);
|
|
1400
1398
|
}
|
|
1401
1399
|
}
|
|
1402
1400
|
};
|
|
@@ -6192,28 +6190,70 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
|
|
|
6192
6190
|
*/
|
|
6193
6191
|
TreeGrid.prototype.expandRow = function (row, record, key, level) {
|
|
6194
6192
|
var _this = this;
|
|
6193
|
+
var parentRec = this.parentData;
|
|
6194
|
+
if (!this.enableVirtualization) {
|
|
6195
|
+
parentRec = this.flatData.filter(function (e) {
|
|
6196
|
+
return e.hasChildRecords;
|
|
6197
|
+
});
|
|
6198
|
+
}
|
|
6195
6199
|
record = this.getCollapseExpandRecords(row, record);
|
|
6196
6200
|
if (!isNullOrUndefined(row) && row.cells[0].classList.contains('e-lastrowcell')) {
|
|
6197
6201
|
this.lastRowBorder(row, false);
|
|
6198
6202
|
}
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
-
|
|
6203
|
+
if (this.isExpandAll && !isRemoteData(this)) {
|
|
6204
|
+
var args = { data: parentRec, row: row, cancel: false };
|
|
6205
|
+
var pagerValuePresent = false;
|
|
6206
|
+
if (this.grid.pagerModule && !isNullOrUndefined(this.grid.pagerModule.pagerObj.pagerdropdownModule)) {
|
|
6207
|
+
pagerValuePresent = this.grid.pagerModule.pagerObj.pagerdropdownModule['dropDownListObject'].value ? true : false;
|
|
6208
|
+
}
|
|
6209
|
+
if (!this.isExpandingEventTriggered) {
|
|
6210
|
+
this.trigger(expanding, args, function (expandingArgs) {
|
|
6211
|
+
_this.expandAllPrevent = expandingArgs.cancel;
|
|
6212
|
+
if (!expandingArgs.cancel) {
|
|
6213
|
+
if (expandingArgs.expandAll) {
|
|
6214
|
+
_this.expandCollapseAllChildren(record, 'expand', key, level);
|
|
6215
|
+
}
|
|
6216
|
+
_this.expandRows(row, record, parentRec, key, level);
|
|
6217
|
+
}
|
|
6218
|
+
});
|
|
6219
|
+
}
|
|
6220
|
+
else if ((!this.allowPaging || (pagerValuePresent && this.grid.pagerModule.pagerObj.pagerdropdownModule['dropDownListObject'].value === 'All')) &&
|
|
6221
|
+
!this.expandAllPrevent && this.isExpandingEventTriggered) {
|
|
6222
|
+
this.expandRows(row, record, parentRec, key, level);
|
|
6223
|
+
}
|
|
6224
|
+
this.isExpandingEventTriggered = true;
|
|
6225
|
+
}
|
|
6226
|
+
else if (!this.isExpandAll || (this.isExpandAll && isRemoteData(this))) {
|
|
6227
|
+
var args = { data: record, row: row, cancel: false };
|
|
6228
|
+
this.trigger(expanding, args, function (expandingArgs) {
|
|
6229
|
+
if (!expandingArgs.cancel) {
|
|
6230
|
+
if (expandingArgs.expandAll) {
|
|
6231
|
+
_this.expandCollapseAllChildren(record, 'expand', key, level);
|
|
6212
6232
|
}
|
|
6213
|
-
_this.
|
|
6233
|
+
_this.expandRows(row, record, parentRec, key, level);
|
|
6214
6234
|
}
|
|
6235
|
+
});
|
|
6236
|
+
}
|
|
6237
|
+
};
|
|
6238
|
+
// Internal method to handle the rows expand
|
|
6239
|
+
TreeGrid.prototype.expandRows = function (row, record, parentRec, key, level) {
|
|
6240
|
+
this.expandCollapse('expand', row, record);
|
|
6241
|
+
var children = 'Children';
|
|
6242
|
+
if (!(isRemoteData(this) && !isOffline(this)) && (!isCountRequired(this) || !isNullOrUndefined(record["" + children]))) {
|
|
6243
|
+
var expandArgs = { data: record, row: row };
|
|
6244
|
+
this.setHeightForFrozenContent();
|
|
6245
|
+
if (!isNullOrUndefined(this.expandStateMapping)) {
|
|
6246
|
+
this.updateExpandStateMapping(expandArgs.data, true);
|
|
6215
6247
|
}
|
|
6216
|
-
|
|
6248
|
+
if (this.isExpandAll && !this.isExpandedEventTriggered) {
|
|
6249
|
+
this.isExpandedEventTriggered = true;
|
|
6250
|
+
expandArgs = { data: parentRec, row: row };
|
|
6251
|
+
this.trigger(expanded, expandArgs);
|
|
6252
|
+
}
|
|
6253
|
+
else if (!this.isExpandAll) {
|
|
6254
|
+
this.trigger(expanded, expandArgs);
|
|
6255
|
+
}
|
|
6256
|
+
}
|
|
6217
6257
|
};
|
|
6218
6258
|
TreeGrid.prototype.expandCollapseAllChildren = function (record, action, key, level) {
|
|
6219
6259
|
if ((!isNullOrUndefined(key) && record[this.getPrimaryKeyFieldNames()[0]] !== key) ||
|
|
@@ -6271,31 +6311,65 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
|
|
|
6271
6311
|
*/
|
|
6272
6312
|
TreeGrid.prototype.collapseRow = function (row, record, key) {
|
|
6273
6313
|
var _this = this;
|
|
6314
|
+
var parentRec = this.parentData;
|
|
6315
|
+
if (!this.enableVirtualization) {
|
|
6316
|
+
parentRec = this.flatData.filter(function (e) {
|
|
6317
|
+
return e.hasChildRecords;
|
|
6318
|
+
});
|
|
6319
|
+
}
|
|
6274
6320
|
record = this.getCollapseExpandRecords(row, record);
|
|
6275
|
-
|
|
6276
|
-
|
|
6277
|
-
if (!
|
|
6278
|
-
|
|
6279
|
-
_this.
|
|
6280
|
-
|
|
6281
|
-
|
|
6282
|
-
|
|
6283
|
-
if (!isRemoteData(_this)) {
|
|
6284
|
-
_this.setHeightForFrozenContent();
|
|
6285
|
-
if (!isNullOrUndefined(_this.expandStateMapping)) {
|
|
6286
|
-
_this.updateExpandStateMapping(collapseArgs.data, false);
|
|
6287
|
-
}
|
|
6288
|
-
_this.trigger(collapsed, collapseArgs);
|
|
6289
|
-
if (_this.enableInfiniteScrolling) {
|
|
6290
|
-
var scrollHeight = _this.grid.getContent().firstElementChild.scrollHeight;
|
|
6291
|
-
var scrollTop = _this.grid.getContent().firstElementChild.scrollTop;
|
|
6292
|
-
if ((scrollHeight - scrollTop) < _this.grid.getRowHeight() + +_this.height) {
|
|
6293
|
-
_this.grid.getContent().firstElementChild.scrollBy(0, _this.grid.getRowHeight());
|
|
6321
|
+
if (this.isCollapseAll && !isRemoteData(this)) {
|
|
6322
|
+
var args = { data: parentRec, row: row, cancel: false };
|
|
6323
|
+
if (!this.isCollapsingEventTriggered) {
|
|
6324
|
+
this.trigger(collapsing, args, function (collapsingArgs) {
|
|
6325
|
+
_this.collapseAllPrevent = collapsingArgs.cancel;
|
|
6326
|
+
if (!collapsingArgs.cancel) {
|
|
6327
|
+
if (collapsingArgs.collapseAll) {
|
|
6328
|
+
_this.expandCollapseAllChildren(record, 'collapse', key);
|
|
6294
6329
|
}
|
|
6330
|
+
_this.collapseRows(row, record, parentRec, key);
|
|
6295
6331
|
}
|
|
6332
|
+
});
|
|
6333
|
+
}
|
|
6334
|
+
else if (!this.allowPaging && !this.collapseAllPrevent && this.isCollapsingEventTriggered) {
|
|
6335
|
+
this.collapseRows(row, record, parentRec, key);
|
|
6336
|
+
}
|
|
6337
|
+
this.isCollapsingEventTriggered = true;
|
|
6338
|
+
}
|
|
6339
|
+
else if (!this.isCollapseAll || (this.isCollapseAll && isRemoteData(this))) {
|
|
6340
|
+
var args = { data: record, row: row, cancel: false };
|
|
6341
|
+
this.trigger(collapsing, args, function (collapsingArgs) {
|
|
6342
|
+
if (!collapsingArgs.cancel) {
|
|
6343
|
+
_this.collapseRows(row, record, parentRec, key);
|
|
6296
6344
|
}
|
|
6345
|
+
});
|
|
6346
|
+
}
|
|
6347
|
+
};
|
|
6348
|
+
// Internal method for handling the rows collapse
|
|
6349
|
+
TreeGrid.prototype.collapseRows = function (row, record, parentRec, key) {
|
|
6350
|
+
this.expandCollapse('collapse', row, record);
|
|
6351
|
+
var collapseArgs = { data: record, row: row };
|
|
6352
|
+
if (!isRemoteData(this)) {
|
|
6353
|
+
this.setHeightForFrozenContent();
|
|
6354
|
+
if (!isNullOrUndefined(this.expandStateMapping)) {
|
|
6355
|
+
this.updateExpandStateMapping(collapseArgs.data, false);
|
|
6297
6356
|
}
|
|
6298
|
-
|
|
6357
|
+
if (this.isCollapseAll && !this.isCollapsedEventTriggered) {
|
|
6358
|
+
this.isCollapsedEventTriggered = true;
|
|
6359
|
+
collapseArgs = { data: parentRec, row: row };
|
|
6360
|
+
this.trigger(collapsed, collapseArgs);
|
|
6361
|
+
}
|
|
6362
|
+
else if (!this.isCollapseAll) {
|
|
6363
|
+
this.trigger(collapsed, collapseArgs);
|
|
6364
|
+
}
|
|
6365
|
+
if (this.enableInfiniteScrolling) {
|
|
6366
|
+
var scrollHeight = this.grid.getContent().firstElementChild.scrollHeight;
|
|
6367
|
+
var scrollTop = this.grid.getContent().firstElementChild.scrollTop;
|
|
6368
|
+
if ((scrollHeight - scrollTop) < this.grid.getRowHeight() + +this.height) {
|
|
6369
|
+
this.grid.getContent().firstElementChild.scrollBy(0, this.grid.getRowHeight());
|
|
6370
|
+
}
|
|
6371
|
+
}
|
|
6372
|
+
}
|
|
6299
6373
|
};
|
|
6300
6374
|
TreeGrid.prototype.updateExpandStateMapping = function (record, state) {
|
|
6301
6375
|
var totalRecords = record;
|
|
@@ -6458,6 +6532,8 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
|
|
|
6458
6532
|
* @returns {void}
|
|
6459
6533
|
*/
|
|
6460
6534
|
TreeGrid.prototype.expandAll = function () {
|
|
6535
|
+
this.isExpandedEventTriggered = false;
|
|
6536
|
+
this.isExpandingEventTriggered = false;
|
|
6461
6537
|
this.expandCollapseAll('expand');
|
|
6462
6538
|
};
|
|
6463
6539
|
/**
|
|
@@ -6466,6 +6542,8 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
|
|
|
6466
6542
|
* @returns {void}
|
|
6467
6543
|
*/
|
|
6468
6544
|
TreeGrid.prototype.collapseAll = function () {
|
|
6545
|
+
this.isCollapsedEventTriggered = false;
|
|
6546
|
+
this.isCollapsingEventTriggered = false;
|
|
6469
6547
|
this.expandCollapseAll('collapse');
|
|
6470
6548
|
};
|
|
6471
6549
|
TreeGrid.prototype.expandCollapseAll = function (action) {
|
|
@@ -12357,7 +12435,8 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
|
|
|
12357
12435
|
this.addRowIndex = this.parent.grid.selectedRowIndex > -1 ? this.parent.grid.selectedRowIndex : 0;
|
|
12358
12436
|
}
|
|
12359
12437
|
}
|
|
12360
|
-
if (this.isAddedRowByMethod
|
|
12438
|
+
if ((this.isAddedRowByMethod || (this.isAddedRowByContextMenu && this.parent.grid.selectedRowIndex !== -1)) &&
|
|
12439
|
+
(this.parent.enableVirtualization || this.parent.enableInfiniteScrolling)) {
|
|
12361
12440
|
this.addRowRecord = this.parent.flatData[this.parent.grid.selectedRowIndex];
|
|
12362
12441
|
if (this.parent.enableVirtualization && this.isAddedRowByContextMenu) {
|
|
12363
12442
|
this.addRowRecord = this.parent.getCurrentViewRecords()[this.addRowIndex];
|
|
@@ -12375,6 +12454,10 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
|
|
|
12375
12454
|
&& !isNullOrUndefined(this.parent.getSelectedRecords()[0])) {
|
|
12376
12455
|
this.addRowRecord = this.parent.getSelectedRecords()[0];
|
|
12377
12456
|
}
|
|
12457
|
+
if (isNullOrUndefined(this.addRowRecord) && this.parent.getCurrentViewRecords().length > this.addRowIndex &&
|
|
12458
|
+
args.requestType === 'save' && this.parent.getSelectedRecords().length !== 0) {
|
|
12459
|
+
this.addRowRecord = this.parent.getCurrentViewRecords()[this.addRowIndex];
|
|
12460
|
+
}
|
|
12378
12461
|
this.isAddedRowByMethod = false;
|
|
12379
12462
|
args = this.beginAddEdit(args);
|
|
12380
12463
|
// if (args.requestType === 'save' &&
|
|
@@ -12835,7 +12918,7 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
|
|
|
12835
12918
|
};
|
|
12836
12919
|
VirtualTreeContentRenderer.prototype.indexModifier = function (args) {
|
|
12837
12920
|
var content$$1 = this.parent.getContent().querySelector('.e-content');
|
|
12838
|
-
if (this.recordAdded && this.startIndex > -1 && this.endIndex > -1) {
|
|
12921
|
+
if ((this.recordAdded || args.requestType === 'delete' && this.endIndex > args.count - this.parent.pageSettings.pageSize) && this.startIndex > -1 && this.endIndex > -1) {
|
|
12839
12922
|
if (this.endIndex > args.count - this.parent.pageSettings.pageSize) {
|
|
12840
12923
|
var nextSetResIndex = ~~(content$$1.scrollTop / this.parent.getRowHeight());
|
|
12841
12924
|
var lastIndex = nextSetResIndex + this.parent.getRows().length;
|
|
@@ -12856,7 +12939,8 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
|
|
|
12856
12939
|
this.startIndex = 0;
|
|
12857
12940
|
this.endIndex = this.parent.pageSettings.pageSize - 1;
|
|
12858
12941
|
}
|
|
12859
|
-
if ((this.endIndex - this.startIndex !== this.parent.pageSettings.pageSize) &&
|
|
12942
|
+
if ((this.endIndex - this.startIndex !== this.parent.pageSettings.pageSize) &&
|
|
12943
|
+
(this.totalRecords > this.parent.pageSettings.pageSize) &&
|
|
12860
12944
|
(this.endIndex === this.totalRecords)) {
|
|
12861
12945
|
args.startIndex = this.endIndex - this.parent.pageSettings.pageSize;
|
|
12862
12946
|
args.endIndex = this.endIndex;
|
|
@@ -13175,6 +13259,7 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
|
|
|
13175
13259
|
firsttdinx = +attr; // this.parent.getContent().querySelector('.e-content tr').getAttribute('data-rowindex');
|
|
13176
13260
|
}
|
|
13177
13261
|
if (firsttdinx === 0) {
|
|
13262
|
+
scrollArgs.offset.top = content$$1.scrollTop;
|
|
13178
13263
|
if (this.parent.allowRowDragAndDrop) {
|
|
13179
13264
|
this.translateY = scrollArgs.offset.top - rowHeight * 2;
|
|
13180
13265
|
}
|
|
@@ -13199,7 +13284,7 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
|
|
|
13199
13284
|
lastIndex = nextSetResIndex +
|
|
13200
13285
|
(this.totalRecords - nextSetResIndex);
|
|
13201
13286
|
}
|
|
13202
|
-
this.startIndex = !isLastBlock || isNullOrUndefined(this[
|
|
13287
|
+
this.startIndex = !isLastBlock || isNullOrUndefined(this['' + selectedRowIndex]) ? lastIndex - this.parent.pageSettings.pageSize : nextSetResIndex;
|
|
13203
13288
|
this.endIndex = lastIndex;
|
|
13204
13289
|
if ((nextSetResIndex + this.parent.pageSettings.pageSize) > this.totalRecords && (this.endIndex - this.startIndex) <
|
|
13205
13290
|
(this.parent.pageSettings.pageSize / 2) && (this.endIndex - nextSetResIndex) < (this.parent.pageSettings.pageSize / 2)) {
|
|
@@ -13213,12 +13298,12 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
|
|
|
13213
13298
|
this.translateY = this.getTranslateY(scrollArgs.offset.top, content$$1.getBoundingClientRect().height);
|
|
13214
13299
|
}
|
|
13215
13300
|
else {
|
|
13216
|
-
if (this.
|
|
13217
|
-
this.translateY =
|
|
13301
|
+
if (this.totalRecords === this.endIndex) {
|
|
13302
|
+
this.translateY = (this.totalRecords * rowHeight) - ((this.endIndex - this.startIndex) * rowHeight);
|
|
13218
13303
|
}
|
|
13219
13304
|
else {
|
|
13220
|
-
if (this.
|
|
13221
|
-
this.translateY =
|
|
13305
|
+
if (this.parent.allowRowDragAndDrop) {
|
|
13306
|
+
this.translateY = scrollArgs.offset.top - rowHeight * 2;
|
|
13222
13307
|
}
|
|
13223
13308
|
else {
|
|
13224
13309
|
this.translateY = scrollArgs.offset.top;
|
|
@@ -13541,7 +13626,7 @@ var VirtualScroll$1 = /** @__PURE__ @class */ (function () {
|
|
|
13541
13626
|
});
|
|
13542
13627
|
this.visualData = visualData;
|
|
13543
13628
|
this.parent.grid.notify(dataListener, { data: visualData });
|
|
13544
|
-
var counts = { startIndex: -1, endIndex: -1, count: pageingDetails.count };
|
|
13629
|
+
var counts = { startIndex: -1, endIndex: -1, count: pageingDetails.count, requestType: pageingDetails.actionArgs.requestType };
|
|
13545
13630
|
this.parent.grid.notify(indexModifier, counts);
|
|
13546
13631
|
var startIndex = counts.startIndex;
|
|
13547
13632
|
var endIndex = counts.endIndex;
|
|
@@ -13564,7 +13649,7 @@ var VirtualScroll$1 = /** @__PURE__ @class */ (function () {
|
|
|
13564
13649
|
this.parent.grid.getContent().firstElementChild.scrollTop = 0;
|
|
13565
13650
|
this.parent.grid.notify(virtualActionArgs, { setTop: true });
|
|
13566
13651
|
}
|
|
13567
|
-
if (requestType === 'save' || (requestType === 'refresh' && this.parent['isGantt'] && this.parent['isAddedFromGantt'])) {
|
|
13652
|
+
if ((requestType === 'save' && pageingDetails.actionArgs.index >= (counts.count - this.parent.grid.pageSettings.pageSize)) || (requestType === 'refresh' && this.parent['isGantt'] && this.parent['isAddedFromGantt'])) {
|
|
13568
13653
|
startIndex = counts.startIndex + (counts.count - counts.endIndex);
|
|
13569
13654
|
endIndex = counts.count;
|
|
13570
13655
|
this.parent['isAddedFromGantt'] = false;
|