@syncfusion/ej2-treegrid 20.2.39 → 20.2.40
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 +15 -0
- 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 +111 -62
- package/dist/es6/ej2-treegrid.es2015.js.map +1 -1
- package/dist/es6/ej2-treegrid.es5.js +116 -67
- 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 +8 -8
- package/src/treegrid/actions/batch-edit.js +37 -15
- package/src/treegrid/actions/context-menu.js +1 -0
- package/src/treegrid/actions/edit.d.ts +1 -0
- package/src/treegrid/actions/edit.js +37 -23
- package/src/treegrid/actions/infinite-scroll.js +6 -3
- package/src/treegrid/actions/rowdragdrop.js +5 -5
- package/src/treegrid/actions/selection.js +1 -1
- 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 +14 -7
- package/src/treegrid/renderer/render.js +1 -1
- package/src/treegrid/renderer/virtual-tree-content-render.d.ts +1 -1
- package/src/treegrid/renderer/virtual-tree-content-render.js +10 -10
- package/src/treegrid/utils.js +1 -1
|
@@ -497,6 +497,8 @@ var rowdraging = 'row-draging';
|
|
|
497
497
|
var rowDropped = 'row-dropped';
|
|
498
498
|
/** @hidden */
|
|
499
499
|
var autoCol = 'auto-col';
|
|
500
|
+
/** @hidden */
|
|
501
|
+
var rowDeselecting = 'rowDeselecting';
|
|
500
502
|
|
|
501
503
|
var __extends$4 = (undefined && undefined.__extends) || (function () {
|
|
502
504
|
var extendStatics = function (d, b) {
|
|
@@ -797,7 +799,7 @@ function findChildrenRecords(records) {
|
|
|
797
799
|
return [];
|
|
798
800
|
}
|
|
799
801
|
if (!isNullOrUndefined(records.childRecords)) {
|
|
800
|
-
var childRecords = records.childRecords;
|
|
802
|
+
var childRecords = records.childRecords.filter(function (items) { return !items.isSummaryRow; });
|
|
801
803
|
var keys = Object.keys(childRecords);
|
|
802
804
|
for (var i = 0, len = keys.length; i < len; i++) {
|
|
803
805
|
datas.push(childRecords[i]);
|
|
@@ -1314,7 +1316,7 @@ var Selection = /** @__PURE__ @class */ (function () {
|
|
|
1314
1316
|
childData = (!isNullOrUndefined(this.parent.filterModule) && this.parent.filterModule.filteredResult.length > 0) ?
|
|
1315
1317
|
this.parent.getCurrentViewRecords() : this.parent.flatData;
|
|
1316
1318
|
childData.forEach(function (record) {
|
|
1317
|
-
if (_this.parent.enableVirtualization) {
|
|
1319
|
+
if (_this.parent.enableVirtualization && record.childRecords.length > 0) {
|
|
1318
1320
|
if (record.hasChildRecords) {
|
|
1319
1321
|
_this.updateParentSelection(record);
|
|
1320
1322
|
}
|
|
@@ -1733,7 +1735,7 @@ var Render = /** @__PURE__ @class */ (function () {
|
|
|
1733
1735
|
var templateFn = 'templateFn';
|
|
1734
1736
|
var colindex = args.column.index;
|
|
1735
1737
|
if (isNullOrUndefined(treeColumn.field)) {
|
|
1736
|
-
args.cell.setAttribute('
|
|
1738
|
+
args.cell.setAttribute('data-colindex', colindex + '');
|
|
1737
1739
|
}
|
|
1738
1740
|
if (treeColumn.field === args.column.field && !isNullOrUndefined(treeColumn.template)) {
|
|
1739
1741
|
args.column.template = treeColumn.template;
|
|
@@ -3925,16 +3927,23 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
|
|
|
3925
3927
|
TreeGrid.prototype.triggerEvents = function (args) {
|
|
3926
3928
|
this.trigger(getObject('name', args), args);
|
|
3927
3929
|
};
|
|
3930
|
+
TreeGrid.prototype.IsExpandCollapseClicked = function (args) {
|
|
3931
|
+
if (!isNullOrUndefined(args.target) && (args.target.classList.contains('e-treegridexpand')
|
|
3932
|
+
|| args.target.classList.contains('e-treegridcollapse') || args.target.classList.contains('e-summarycell'))) {
|
|
3933
|
+
args.cancel = true;
|
|
3934
|
+
return;
|
|
3935
|
+
}
|
|
3936
|
+
};
|
|
3928
3937
|
TreeGrid.prototype.bindGridEvents = function () {
|
|
3929
3938
|
var _this = this;
|
|
3930
3939
|
this.grid.rowSelecting = function (args) {
|
|
3931
|
-
|
|
3932
|
-
|| args.target.classList.contains('e-treegridcollapse') || args.target.classList.contains('e-summarycell'))) {
|
|
3933
|
-
args.cancel = true;
|
|
3934
|
-
return;
|
|
3935
|
-
}
|
|
3940
|
+
_this.IsExpandCollapseClicked(args);
|
|
3936
3941
|
_this.trigger(rowSelecting, args);
|
|
3937
3942
|
};
|
|
3943
|
+
this.grid.rowDeselecting = function (args) {
|
|
3944
|
+
_this.IsExpandCollapseClicked(args);
|
|
3945
|
+
_this.trigger(rowDeselecting, args);
|
|
3946
|
+
};
|
|
3938
3947
|
this.grid.rowSelected = function (args) {
|
|
3939
3948
|
if (_this.enableVirtualization && args.isHeaderCheckboxClicked &&
|
|
3940
3949
|
_this.grid.currentViewData.length !== _this.grid.selectionModule.selectedRowIndexes.length) {
|
|
@@ -5719,7 +5728,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
|
|
|
5719
5728
|
}
|
|
5720
5729
|
else if (isNullOrUndefined(record)) {
|
|
5721
5730
|
if (this.detailTemplate) {
|
|
5722
|
-
record = this.grid.getCurrentViewRecords()[row.getAttribute('
|
|
5731
|
+
record = this.grid.getCurrentViewRecords()[row.getAttribute('data-rowindex')];
|
|
5723
5732
|
}
|
|
5724
5733
|
else {
|
|
5725
5734
|
record = this.grid.getCurrentViewRecords()[row.rowIndex];
|
|
@@ -5997,7 +6006,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
|
|
|
5997
6006
|
row = gridRows[rowIndex];
|
|
5998
6007
|
}
|
|
5999
6008
|
else {
|
|
6000
|
-
rowIndex = +row.getAttribute('
|
|
6009
|
+
rowIndex = +row.getAttribute('data-rowindex');
|
|
6001
6010
|
}
|
|
6002
6011
|
if (!isNullOrUndefined(row)) {
|
|
6003
6012
|
row.setAttribute('aria-expanded', action === 'expand' ? 'true' : 'false');
|
|
@@ -7402,7 +7411,7 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
|
|
|
7402
7411
|
dropIndex = this.selectedRow.rowIndex - 1;
|
|
7403
7412
|
}
|
|
7404
7413
|
if (this.parent.enableVirtualization && this.parent.allowRowDragAndDrop && this.selectedRecord) {
|
|
7405
|
-
dropIndex = parseInt(this.selectedRow.getAttribute('
|
|
7414
|
+
dropIndex = parseInt(this.selectedRow.getAttribute('data-rowindex'), 10) - 1;
|
|
7406
7415
|
}
|
|
7407
7416
|
tObj[action] = 'indenting';
|
|
7408
7417
|
tObj[droppedIndex] = dropIndex;
|
|
@@ -7421,7 +7430,7 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
|
|
|
7421
7430
|
}
|
|
7422
7431
|
}
|
|
7423
7432
|
if (this.parent.enableVirtualization && this.parent.allowRowDragAndDrop && this.selectedRecord) {
|
|
7424
|
-
dropIndex = parseInt(this.parent.getRows()[dropIndex].getAttribute('
|
|
7433
|
+
dropIndex = parseInt(this.parent.getRows()[dropIndex].getAttribute('data-rowindex'), 10);
|
|
7425
7434
|
}
|
|
7426
7435
|
tObj[action] = 'outdenting';
|
|
7427
7436
|
tObj[droppedIndex] = dropIndex;
|
|
@@ -7441,7 +7450,7 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
|
|
|
7441
7450
|
if (!actionArgs.cancel) {
|
|
7442
7451
|
if (actionArgs.action === 'indenting') {
|
|
7443
7452
|
if (_this.parent.enableVirtualization && _this.parent.allowRowDragAndDrop) {
|
|
7444
|
-
_this.reorderRows([parseInt(_this.selectedRow.getAttribute('
|
|
7453
|
+
_this.reorderRows([parseInt(_this.selectedRow.getAttribute('data-rowindex'), 10)], dropIndex, 'child');
|
|
7445
7454
|
}
|
|
7446
7455
|
else {
|
|
7447
7456
|
_this.reorderRows([_this.selectedRow.rowIndex], dropIndex, 'child');
|
|
@@ -7449,7 +7458,7 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
|
|
|
7449
7458
|
}
|
|
7450
7459
|
else if (actionArgs.action === 'outdenting') {
|
|
7451
7460
|
if (_this.parent.enableVirtualization && _this.parent.allowRowDragAndDrop) {
|
|
7452
|
-
_this.reorderRows([parseInt(_this.selectedRow.getAttribute('
|
|
7461
|
+
_this.reorderRows([parseInt(_this.selectedRow.getAttribute('data-rowindex'), 10)], dropIndex, 'below');
|
|
7453
7462
|
}
|
|
7454
7463
|
else {
|
|
7455
7464
|
_this.reorderRows([_this.selectedRow.rowIndex], dropIndex, 'below');
|
|
@@ -8075,7 +8084,7 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
|
|
|
8075
8084
|
}
|
|
8076
8085
|
};
|
|
8077
8086
|
RowDD$$1.prototype.getTargetIdx = function (targetRow) {
|
|
8078
|
-
return targetRow ? parseInt(targetRow.getAttribute('
|
|
8087
|
+
return targetRow ? parseInt(targetRow.getAttribute('data-rowindex'), 10) : 0;
|
|
8079
8088
|
};
|
|
8080
8089
|
RowDD$$1.prototype.getParentData = function (record, data) {
|
|
8081
8090
|
var parentItem = record.parentItem;
|
|
@@ -10161,6 +10170,7 @@ var ContextMenu$1 = /** @__PURE__ @class */ (function () {
|
|
|
10161
10170
|
if (args.item.id === 'Above' || args.item.id === 'Below' || args.item.id === 'Child') {
|
|
10162
10171
|
this.parent.notify('savePreviousRowPosition', args);
|
|
10163
10172
|
this.parent.setProperties({ editSettings: { newRowPosition: args.item.id } }, true);
|
|
10173
|
+
this.parent.editModule['isAddedRowByContextMenu'] = true;
|
|
10164
10174
|
this.parent.addRecord();
|
|
10165
10175
|
}
|
|
10166
10176
|
if (args.item.id === this.parent.element.id + '_gridcontrol_cmenu_Indent' || args.item.id === this.parent.element.id + '_gridcontrol_cmenu_Outdent') {
|
|
@@ -10432,10 +10442,11 @@ var BatchEdit = /** @__PURE__ @class */ (function () {
|
|
|
10432
10442
|
this.parent.editModule[isTabLastRow] = false;
|
|
10433
10443
|
return;
|
|
10434
10444
|
}
|
|
10435
|
-
if (this.parent.editModule['isAddedRowByMethod'] && !isNullOrUndefined(this.parent.editModule['addRowIndex']) &&
|
|
10445
|
+
if (this.parent.editModule['isAddedRowByMethod'] && !isNullOrUndefined(this.parent.editModule['addRowIndex']) &&
|
|
10446
|
+
!this.parent.editModule['isAddedRowByContextMenu'] && (this.parent.grid.selectedRowIndex === -1 || this.parent.editModule['batchEditModule'].isAdd)) {
|
|
10436
10447
|
this.selectedIndex = this.parent.editModule['selectedIndex'];
|
|
10437
10448
|
this.addRowIndex = this.parent.editModule['addRowIndex'];
|
|
10438
|
-
this.addRowRecord = this.parent.getCurrentViewRecords()[this.selectedIndex];
|
|
10449
|
+
this.addRowRecord = this.batchRecords.length ? this.batchRecords[this.selectedIndex] : this.parent.getCurrentViewRecords()[this.selectedIndex];
|
|
10439
10450
|
}
|
|
10440
10451
|
else {
|
|
10441
10452
|
this.selectedIndex = this.parent.grid.selectedRowIndex;
|
|
@@ -10482,6 +10493,11 @@ var BatchEdit = /** @__PURE__ @class */ (function () {
|
|
|
10482
10493
|
// }
|
|
10483
10494
|
}
|
|
10484
10495
|
focusModule.getContent().matrix.current = [actualIndex, focusModule.getContent().matrix.current[1]];
|
|
10496
|
+
if (this.parent.editModule['isAddedRowByMethod'] && !isNullOrUndefined(this.parent.editModule['addRowIndex']) && !this.parent.editModule['isAddedRowByContextMenu']) {
|
|
10497
|
+
var newlyAddedRecords = this.parent.getBatchChanges()['addedRecords'];
|
|
10498
|
+
var index = parseInt(this.parent.getContentTable().getElementsByClassName('e-insertedrow')[newlyAddedRecords.length - 1].getAttribute('data-rowindex'), 10);
|
|
10499
|
+
this.batchRecords.splice(index, 0, newlyAddedRecords[newlyAddedRecords.length - 1]);
|
|
10500
|
+
}
|
|
10485
10501
|
}
|
|
10486
10502
|
};
|
|
10487
10503
|
BatchEdit.prototype.beforeBatchDelete = function (args) {
|
|
@@ -10507,7 +10523,7 @@ var BatchEdit = /** @__PURE__ @class */ (function () {
|
|
|
10507
10523
|
childs = findChildrenRecords(data);
|
|
10508
10524
|
uid = this.parent.getSelectedRows()[0].getAttribute('data-uid');
|
|
10509
10525
|
}
|
|
10510
|
-
var parentRowIndex = parseInt(this.parent.grid.getRowElementByUID(uid).getAttribute('
|
|
10526
|
+
var parentRowIndex = parseInt(this.parent.grid.getRowElementByUID(uid).getAttribute('data-rowindex'), 10);
|
|
10511
10527
|
if (childs.length) {
|
|
10512
10528
|
var totalCount = parentRowIndex + childs.length;
|
|
10513
10529
|
var firstChildIndex = parentRowIndex + 1;
|
|
@@ -10544,7 +10560,7 @@ var BatchEdit = /** @__PURE__ @class */ (function () {
|
|
|
10544
10560
|
BatchEdit.prototype.updateRowIndex = function () {
|
|
10545
10561
|
var rows = this.parent.grid.getDataRows();
|
|
10546
10562
|
for (var i = 0; i < rows.length; i++) {
|
|
10547
|
-
rows[i].setAttribute('
|
|
10563
|
+
rows[i].setAttribute('data-rowindex', i.toString());
|
|
10548
10564
|
}
|
|
10549
10565
|
var freeze = (this.parent.getFrozenLeftColumnsCount() > 0 ||
|
|
10550
10566
|
this.parent.getFrozenRightColumnsCount() > 0) ? true : false;
|
|
@@ -10552,9 +10568,9 @@ var BatchEdit = /** @__PURE__ @class */ (function () {
|
|
|
10552
10568
|
var mRows = this.parent.grid.getMovableDataRows();
|
|
10553
10569
|
var freezeRightRows = this.parent.grid.getFrozenRightDataRows();
|
|
10554
10570
|
for (var i = 0; i < mRows.length; i++) {
|
|
10555
|
-
mRows[i].setAttribute('
|
|
10571
|
+
mRows[i].setAttribute('data-rowindex', i.toString());
|
|
10556
10572
|
if (freeze) {
|
|
10557
|
-
freezeRightRows[i].setAttribute('
|
|
10573
|
+
freezeRightRows[i].setAttribute('data-rowindex', i.toString());
|
|
10558
10574
|
}
|
|
10559
10575
|
}
|
|
10560
10576
|
}
|
|
@@ -10614,7 +10630,9 @@ var BatchEdit = /** @__PURE__ @class */ (function () {
|
|
|
10614
10630
|
if (!isNullOrUndefined(this.batchAddedRecords)) {
|
|
10615
10631
|
for (var i = 0; i < this.batchAddedRecords.length; i++) {
|
|
10616
10632
|
index = data.map(function (e) { return e[primaryKey]; }).indexOf(this.batchAddedRecords[i][primaryKey]);
|
|
10617
|
-
|
|
10633
|
+
if (index !== -1) {
|
|
10634
|
+
data.splice(index, 1);
|
|
10635
|
+
}
|
|
10618
10636
|
if (this.parent.editSettings.newRowPosition === 'Child') {
|
|
10619
10637
|
index = currentViewRecords.map(function (e) { return e[primaryKey]; })
|
|
10620
10638
|
.indexOf(this.batchAddedRecords[i][parentItem] ? this.batchAddedRecords[i][parentItem][primaryKey]
|
|
@@ -10680,9 +10698,12 @@ var BatchEdit = /** @__PURE__ @class */ (function () {
|
|
|
10680
10698
|
}
|
|
10681
10699
|
if (this.parent.editSettings.newRowPosition !== 'Bottom' && !Object.hasOwnProperty.call(args, 'updatedRecords')) {
|
|
10682
10700
|
data.splice(data.length - addRecords.length, addRecords.length);
|
|
10683
|
-
if (this.parent.editModule['isAddedRowByMethod'] && addRecords.length && !isNullOrUndefined(this.parent.editModule['addRowIndex'])) {
|
|
10684
|
-
|
|
10685
|
-
|
|
10701
|
+
if (this.parent.editModule['isAddedRowByMethod'] && addRecords.length && !isNullOrUndefined(this.parent.editModule['addRowIndex']) && !this.parent.editModule['isAddedRowByContextMenu']) {
|
|
10702
|
+
addRecords.reverse();
|
|
10703
|
+
for (var i_1 = 0; i_1 < addRecords.length; i_1++) {
|
|
10704
|
+
var index_1 = parseInt(this.parent.getContentTable().getElementsByClassName('e-insertedrow')[i_1].getAttribute('data-rowindex'), 10);
|
|
10705
|
+
data.splice(index_1, 0, addRecords[i_1]);
|
|
10706
|
+
}
|
|
10686
10707
|
}
|
|
10687
10708
|
if (!this.parent.allowPaging && data.length !== currentViewRecords.length) {
|
|
10688
10709
|
if (currentViewRecords.length > addRecords.length) {
|
|
@@ -10702,6 +10723,9 @@ var BatchEdit = /** @__PURE__ @class */ (function () {
|
|
|
10702
10723
|
if (this.batchAddRowRecord.length === 0) {
|
|
10703
10724
|
this.batchAddRowRecord.push(this.parent.flatData[args.index]);
|
|
10704
10725
|
}
|
|
10726
|
+
if (this.parent.editModule['isAddedRowByContextMenu']) {
|
|
10727
|
+
addRecords.reverse();
|
|
10728
|
+
}
|
|
10705
10729
|
for (i = 0; i < addRecords.length; i++) {
|
|
10706
10730
|
var taskData = extend({}, addRecords[i]);
|
|
10707
10731
|
delete taskData.parentItem;
|
|
@@ -10714,6 +10738,11 @@ var BatchEdit = /** @__PURE__ @class */ (function () {
|
|
|
10714
10738
|
if (!isNullOrUndefined(taskData.primaryParent)) {
|
|
10715
10739
|
delete taskData.primaryParent;
|
|
10716
10740
|
}
|
|
10741
|
+
if (addRecords.length > 1 && this.parent.editModule['isAddedRowByContextMenu']) {
|
|
10742
|
+
var rowPosition = this.parent.editSettings.newRowPosition;
|
|
10743
|
+
this.parent.editSettings.newRowPosition = this.parent.editModule['previousNewRowPosition'];
|
|
10744
|
+
this.parent.editModule['previousNewRowPosition'] = rowPosition;
|
|
10745
|
+
}
|
|
10717
10746
|
addRecords[i].taskData = taskData;
|
|
10718
10747
|
addRowRecord = this.batchAddRowRecord[i];
|
|
10719
10748
|
if (isNullOrUndefined(addRowRecord)) {
|
|
@@ -10753,15 +10782,18 @@ var BatchEdit = /** @__PURE__ @class */ (function () {
|
|
|
10753
10782
|
}
|
|
10754
10783
|
}
|
|
10755
10784
|
this.parent.parentData = [];
|
|
10756
|
-
for (var
|
|
10757
|
-
data[
|
|
10758
|
-
setValue('uniqueIDCollection.' + data[
|
|
10759
|
-
if (!data[
|
|
10760
|
-
this.parent.parentData.push(data[
|
|
10785
|
+
for (var i_2 = 0; i_2 < data.length; i_2++) {
|
|
10786
|
+
data[i_2][index] = i_2;
|
|
10787
|
+
setValue('uniqueIDCollection.' + data[i_2][uniqueID] + '.index', i_2, this.parent);
|
|
10788
|
+
if (!data[i_2][level]) {
|
|
10789
|
+
this.parent.parentData.push(data[i_2]);
|
|
10761
10790
|
}
|
|
10762
10791
|
}
|
|
10763
10792
|
}
|
|
10764
10793
|
this.batchAddRowRecord = this.batchAddedRecords = this.batchRecords = this.batchDeletedRecords = this.currentViewRecords = [];
|
|
10794
|
+
if (this.parent.editModule['isAddedRowByContextMenu']) {
|
|
10795
|
+
this.parent.editModule['isAddedRowByContextMenu'] = false;
|
|
10796
|
+
}
|
|
10765
10797
|
};
|
|
10766
10798
|
BatchEdit.prototype.getActualRowObjectIndex = function (index) {
|
|
10767
10799
|
var rows = this.parent.grid.getDataRows();
|
|
@@ -10831,6 +10863,7 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
|
|
|
10831
10863
|
this.deletedRecords = 'deletedRecords';
|
|
10832
10864
|
this.prevAriaRowIndex = '-1';
|
|
10833
10865
|
this.isAddedRowByMethod = false;
|
|
10866
|
+
this.isAddedRowByContextMenu = false;
|
|
10834
10867
|
Grid.Inject(Edit);
|
|
10835
10868
|
this.parent = parent;
|
|
10836
10869
|
this.isSelfReference = !isNullOrUndefined(parent.parentIdMapping);
|
|
@@ -10881,7 +10914,7 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
|
|
|
10881
10914
|
Edit$$1.prototype.getRowPosition = function (addArgs) {
|
|
10882
10915
|
addArgs.newRowPosition = this.parent.editSettings.newRowPosition;
|
|
10883
10916
|
addArgs.addRowIndex = this.addRowIndex;
|
|
10884
|
-
addArgs.
|
|
10917
|
+
addArgs.dataRowIndex = +this.prevAriaRowIndex;
|
|
10885
10918
|
};
|
|
10886
10919
|
Edit$$1.prototype.beforeStartEdit = function (args) {
|
|
10887
10920
|
this.parent.trigger(actionBegin, args);
|
|
@@ -11037,7 +11070,7 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
|
|
|
11037
11070
|
if (!(this.parent.grid.editSettings.allowEditing) || this.parent.grid.isEdit) {
|
|
11038
11071
|
return;
|
|
11039
11072
|
}
|
|
11040
|
-
var column = this.parent.grid.getColumnByIndex(+target.closest('td.e-rowcell').getAttribute('
|
|
11073
|
+
var column = this.parent.grid.getColumnByIndex(+target.closest('td.e-rowcell').getAttribute('data-colindex'));
|
|
11041
11074
|
if (this.parent.editSettings.mode === 'Cell' && !this.isOnBatch && column && !column.isPrimaryKey &&
|
|
11042
11075
|
this.parent.editSettings.allowEditing && column.allowEditing && !(target.classList.contains('e-treegridexpand') ||
|
|
11043
11076
|
target.classList.contains('e-treegridcollapse')) && this.parent.editSettings.allowEditOnDblClick) {
|
|
@@ -11045,8 +11078,8 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
|
|
|
11045
11078
|
this.parent.grid.setProperties({ selectedRowIndex: args.rowIndex }, true);
|
|
11046
11079
|
if (this.parent.enableVirtualization) {
|
|
11047
11080
|
var tr = parentsUntil(args.target, 'e-row');
|
|
11048
|
-
this.prevAriaRowIndex = tr.getAttribute('
|
|
11049
|
-
tr.setAttribute('
|
|
11081
|
+
this.prevAriaRowIndex = tr.getAttribute('data-rowindex');
|
|
11082
|
+
tr.setAttribute('data-rowindex', tr.rowIndex + '');
|
|
11050
11083
|
}
|
|
11051
11084
|
this.updateGridEditMode('Batch');
|
|
11052
11085
|
}
|
|
@@ -11086,7 +11119,7 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
|
|
|
11086
11119
|
var prom = args[promise];
|
|
11087
11120
|
delete args[promise];
|
|
11088
11121
|
if (this.parent.enableVirtualization && !isNullOrUndefined(this.prevAriaRowIndex) && this.prevAriaRowIndex !== '-1') {
|
|
11089
|
-
args.row.setAttribute('
|
|
11122
|
+
args.row.setAttribute('data-rowindex', this.prevAriaRowIndex);
|
|
11090
11123
|
this.prevAriaRowIndex = undefined;
|
|
11091
11124
|
}
|
|
11092
11125
|
if (this.keyPress !== 'enter') {
|
|
@@ -11422,8 +11455,8 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
|
|
|
11422
11455
|
}
|
|
11423
11456
|
}
|
|
11424
11457
|
var rows = this.parent.grid.getDataRows();
|
|
11425
|
-
var firstAriaIndex = rows.length ? +rows[0].getAttribute('
|
|
11426
|
-
var lastAriaIndex = rows.length ? +rows[rows.length - 1].getAttribute('
|
|
11458
|
+
var firstAriaIndex = rows.length ? +rows[0].getAttribute('data-rowindex') : 0;
|
|
11459
|
+
var lastAriaIndex = rows.length ? +rows[rows.length - 1].getAttribute('data-rowindex') : 0;
|
|
11427
11460
|
var withinRange = this.selectedIndex >= firstAriaIndex && this.selectedIndex <= lastAriaIndex;
|
|
11428
11461
|
var isVirtualization = this.parent.enableVirtualization && this.addRowIndex > -1 && this.prevAriaRowIndex !== '-1';
|
|
11429
11462
|
if (this.parent.editSettings.mode !== 'Dialog') {
|
|
@@ -11493,20 +11526,27 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
|
|
|
11493
11526
|
focussedElement.focus();
|
|
11494
11527
|
}
|
|
11495
11528
|
}
|
|
11496
|
-
if (this.parent.editSettings.mode === 'Batch' && !isNullOrUndefined(this.addRowIndex) && this.addRowIndex !== -1) {
|
|
11529
|
+
if (this.parent.editSettings.mode === 'Batch' && !isNullOrUndefined(this.addRowIndex) && this.addRowIndex !== -1 && this['isAddedRowByMethod'] && !this.isAddedRowByContextMenu) {
|
|
11497
11530
|
index = this.batchEditModule.getAddRowIndex();
|
|
11498
11531
|
this.selectedIndex = this.batchEditModule.getSelectedIndex();
|
|
11499
|
-
|
|
11500
|
-
|
|
11501
|
-
|
|
11502
|
-
|
|
11503
|
-
|
|
11504
|
-
|
|
11505
|
-
|
|
11506
|
-
|
|
11507
|
-
this.parent.editModule.batchEditModule['batchAddRowRecord'].push(this.parent.editModule.batchEditModule['addRowRecord']);
|
|
11508
|
-
this.parent.editModule.batchEditModule['batchAddedRecords'].push(args['data']);
|
|
11532
|
+
var batchAddedRecords = this.parent.getBatchChanges()['addedRecords'];
|
|
11533
|
+
var newlyAddedRecord = void 0;
|
|
11534
|
+
if (batchAddedRecords.length) {
|
|
11535
|
+
for (var i = 0; i < batchAddedRecords.length; i++) {
|
|
11536
|
+
if (isNullOrUndefined(batchAddedRecords[i].uniqueID)) {
|
|
11537
|
+
newlyAddedRecord = batchAddedRecords[i];
|
|
11538
|
+
}
|
|
11539
|
+
}
|
|
11509
11540
|
}
|
|
11541
|
+
var args = {
|
|
11542
|
+
action: 'add',
|
|
11543
|
+
data: newlyAddedRecord,
|
|
11544
|
+
index: index,
|
|
11545
|
+
seletedRow: 0
|
|
11546
|
+
};
|
|
11547
|
+
this.beginAddEdit(args);
|
|
11548
|
+
this.batchEditModule['batchAddRowRecord'].push(this.batchEditModule['addRowRecord']);
|
|
11549
|
+
this.batchEditModule['batchAddedRecords'].push(args['data']);
|
|
11510
11550
|
}
|
|
11511
11551
|
};
|
|
11512
11552
|
// private beforeDataBound(args: BeforeDataBoundArgs): void {
|
|
@@ -11573,7 +11613,7 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
|
|
|
11573
11613
|
this.selectedIndex = this.parent.grid.selectedRowIndex;
|
|
11574
11614
|
}
|
|
11575
11615
|
if (this.parent.enableVirtualization) {
|
|
11576
|
-
var selector = '.e-row[
|
|
11616
|
+
var selector = '.e-row[data-rowindex="' + this.selectedIndex + '"]';
|
|
11577
11617
|
var row = void 0;
|
|
11578
11618
|
if (this.selectedIndex > -1 && this.parent.editSettings.newRowPosition !== 'Top' &&
|
|
11579
11619
|
this.parent.editSettings.newRowPosition !== 'Bottom') {
|
|
@@ -11583,7 +11623,7 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
|
|
|
11583
11623
|
}
|
|
11584
11624
|
else {
|
|
11585
11625
|
if (this.prevAriaRowIndex && this.prevAriaRowIndex !== '-1') {
|
|
11586
|
-
selector = '.e-row[
|
|
11626
|
+
selector = '.e-row[data-rowindex="' + this.prevAriaRowIndex + '"]';
|
|
11587
11627
|
row = this.parent.getContent().querySelector(selector);
|
|
11588
11628
|
this.addRowIndex = row ? row.rowIndex : 0;
|
|
11589
11629
|
}
|
|
@@ -11642,10 +11682,16 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
|
|
|
11642
11682
|
var key = this.parent.grid.getPrimaryKeyFieldNames()[0];
|
|
11643
11683
|
var position = null;
|
|
11644
11684
|
value.taskData = isNullOrUndefined(value.taskData) ? extend({}, args.data) : value.taskData;
|
|
11645
|
-
var currentData =
|
|
11685
|
+
var currentData = void 0;
|
|
11686
|
+
if (this.parent.editSettings.mode === 'Batch' && this['isAddedRowByMethod'] && !isNullOrUndefined(this.addRowIndex)) {
|
|
11687
|
+
currentData = this.batchEditModule['batchRecords'];
|
|
11688
|
+
}
|
|
11689
|
+
else {
|
|
11690
|
+
currentData = this.parent.grid.getCurrentViewRecords();
|
|
11691
|
+
}
|
|
11646
11692
|
if (this.parent.enableVirtualization && args.index !== 0) {
|
|
11647
11693
|
this.addRowIndex = this.parent.grid.getCurrentViewRecords().indexOf(this.addRowRecord);
|
|
11648
|
-
this.selectedIndex = parseInt(this.parent.getRows()[this.addRowIndex].getAttribute('
|
|
11694
|
+
this.selectedIndex = parseInt(this.parent.getRows()[this.addRowIndex].getAttribute('data-rowindex'), 10);
|
|
11649
11695
|
}
|
|
11650
11696
|
var index = this.addRowIndex;
|
|
11651
11697
|
value.uniqueID = getUid(this.parent.element.id + '_data_');
|
|
@@ -11658,7 +11704,7 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
|
|
|
11658
11704
|
var isVirtualization = this.parent.enableVirtualization && this.addRowIndex > -1 && this.prevAriaRowIndex !== '-1';
|
|
11659
11705
|
var rows = this.parent.getRows();
|
|
11660
11706
|
var firstAriaIndex = rows.length ? currentData.indexOf(currentData[0]) : 0;
|
|
11661
|
-
var lastAriaIndex = rows.length ? +rows[rows.length - 1].getAttribute('
|
|
11707
|
+
var lastAriaIndex = rows.length ? +rows[rows.length - 1].getAttribute('data-rowindex') : 0;
|
|
11662
11708
|
var withinRange = this.selectedIndex >= firstAriaIndex && this.selectedIndex <= lastAriaIndex;
|
|
11663
11709
|
if (currentData.length) {
|
|
11664
11710
|
idMapping = currentData[this.addRowIndex][this.parent.idMapping];
|
|
@@ -12023,7 +12069,7 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
|
|
|
12023
12069
|
return new TreeVirtualRowModelGenerator(this.parent);
|
|
12024
12070
|
};
|
|
12025
12071
|
VirtualTreeContentRenderer.prototype.getRowByIndex = function (index) {
|
|
12026
|
-
return this.parent.getDataRows().filter(function (e) { return parseInt(e.getAttribute('
|
|
12072
|
+
return this.parent.getDataRows().filter(function (e) { return parseInt(e.getAttribute('data-rowindex'), 10) === index; })[0];
|
|
12027
12073
|
};
|
|
12028
12074
|
VirtualTreeContentRenderer.prototype.addEventListener = function () {
|
|
12029
12075
|
this.parent.on(virtualActionArgs, this.virtualOtherAction, this);
|
|
@@ -12202,7 +12248,7 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
|
|
|
12202
12248
|
return new Cell(opt);
|
|
12203
12249
|
};
|
|
12204
12250
|
VirtualTreeContentRenderer.prototype.beginEdit = function (e) {
|
|
12205
|
-
var selector = '.e-row[
|
|
12251
|
+
var selector = '.e-row[data-rowindex="' + e.index + '"]';
|
|
12206
12252
|
var index = this.parent.getContent().querySelector(selector).rowIndex;
|
|
12207
12253
|
var rowData = this.parent.getCurrentViewRecords()[index];
|
|
12208
12254
|
e.data = rowData;
|
|
@@ -12210,14 +12256,14 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
|
|
|
12210
12256
|
VirtualTreeContentRenderer.prototype.beginAdd = function (args) {
|
|
12211
12257
|
var addAction = 'addActionBegin';
|
|
12212
12258
|
var isAdd = 'isAdd';
|
|
12213
|
-
var addArgs = { newRowPosition: this.rowPosition, addRowIndex: this.addRowIndex,
|
|
12259
|
+
var addArgs = { newRowPosition: this.rowPosition, addRowIndex: this.addRowIndex, dataRowIndex: this.dataRowIndex };
|
|
12214
12260
|
this.parent.notify('get-row-position', addArgs);
|
|
12215
12261
|
this.rowPosition = addArgs.newRowPosition;
|
|
12216
12262
|
this.addRowIndex = addArgs.addRowIndex;
|
|
12217
|
-
this.
|
|
12263
|
+
this.dataRowIndex = addArgs.dataRowIndex;
|
|
12218
12264
|
var rows = this.parent.getRows();
|
|
12219
|
-
var firstAriaIndex = rows.length ? +rows[0].getAttribute('
|
|
12220
|
-
var lastAriaIndex = rows.length ? +rows[rows.length - 1].getAttribute('
|
|
12265
|
+
var firstAriaIndex = rows.length ? +rows[0].getAttribute('data-rowindex') : 0;
|
|
12266
|
+
var lastAriaIndex = rows.length ? +rows[rows.length - 1].getAttribute('data-rowindex') : 0;
|
|
12221
12267
|
var withInRange = this.parent.selectedRowIndex >= firstAriaIndex && this.parent.selectedRowIndex <= lastAriaIndex;
|
|
12222
12268
|
if (!(this.rowPosition === 'Top' || this.rowPosition === 'Bottom')) {
|
|
12223
12269
|
this[isAdd] = true;
|
|
@@ -12268,11 +12314,11 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
|
|
|
12268
12314
|
};
|
|
12269
12315
|
VirtualTreeContentRenderer.prototype.onActionComplete = function (args) {
|
|
12270
12316
|
if (args.requestType === 'add') {
|
|
12271
|
-
var addArgs = { newRowPosition: this.rowPosition, addRowIndex: this.addRowIndex,
|
|
12317
|
+
var addArgs = { newRowPosition: this.rowPosition, addRowIndex: this.addRowIndex, dataRowIndex: this.dataRowIndex };
|
|
12272
12318
|
this.parent.notify('get-row-position', addArgs);
|
|
12273
12319
|
this.rowPosition = addArgs.newRowPosition;
|
|
12274
12320
|
this.addRowIndex = addArgs.addRowIndex;
|
|
12275
|
-
this.
|
|
12321
|
+
this.dataRowIndex = addArgs.dataRowIndex;
|
|
12276
12322
|
}
|
|
12277
12323
|
var actionComplete$$1 = 'actionComplete';
|
|
12278
12324
|
_super.prototype[actionComplete$$1].call(this, args);
|
|
@@ -12335,7 +12381,7 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
|
|
|
12335
12381
|
!isNullOrUndefined(this.parent.getContent().querySelectorAll('.e-content tr')[rowPt])) {
|
|
12336
12382
|
var attr = this.parent.getContent().querySelectorAll('.e-content tr')[rowPt]
|
|
12337
12383
|
.querySelector('td').getAttribute('index');
|
|
12338
|
-
firsttdinx = +attr; // this.parent.getContent().querySelector('.e-content tr').getAttribute('
|
|
12384
|
+
firsttdinx = +attr; // this.parent.getContent().querySelector('.e-content tr').getAttribute('data-rowindex');
|
|
12339
12385
|
}
|
|
12340
12386
|
if (firsttdinx === 0) {
|
|
12341
12387
|
if (this.parent.allowRowDragAndDrop) {
|
|
@@ -12434,7 +12480,7 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
|
|
|
12434
12480
|
var isAdd = 'isAdd';
|
|
12435
12481
|
if (this[isAdd] && !this.parent.getContent().querySelector('.e-content').querySelector('.e-addedrow')) {
|
|
12436
12482
|
if (!(this.rowPosition === 'Top' || this.rowPosition === 'Bottom')) {
|
|
12437
|
-
if (this.
|
|
12483
|
+
if (this.dataRowIndex >= this.startIndex) {
|
|
12438
12484
|
this.restoreNewRow();
|
|
12439
12485
|
}
|
|
12440
12486
|
else if (this.addRowIndex && this.addRowIndex > -1) {
|
|
@@ -13037,6 +13083,9 @@ var InfiniteScroll$1 = /** @__PURE__ @class */ (function () {
|
|
|
13037
13083
|
});
|
|
13038
13084
|
var actionArgs = getValue('actionArgs', pageingDetails.actionArgs);
|
|
13039
13085
|
var actions = getValue('actions', this.parent.grid.infiniteScrollModule);
|
|
13086
|
+
if (this.parent.grid.infiniteScrollModule['isInitialRender'] && !this.parent.initialRender) {
|
|
13087
|
+
this.parent.grid.pageSettings.currentPage = 1;
|
|
13088
|
+
}
|
|
13040
13089
|
var initial = actions.some(function (value) { return value === actionArgs.requestType; });
|
|
13041
13090
|
var initialRender = initial ? true : this.parent.initialRender ? true : false;
|
|
13042
13091
|
this.visualData = visualData;
|
|
@@ -13051,8 +13100,8 @@ var InfiniteScroll$1 = /** @__PURE__ @class */ (function () {
|
|
|
13051
13100
|
this.parent.infiniteScrollSettings.initialBlocks = this.parent.infiniteScrollSettings.maxBlocks;
|
|
13052
13101
|
}
|
|
13053
13102
|
var size = initialRender ?
|
|
13054
|
-
this.parent.pageSettings.pageSize * this.parent.infiniteScrollSettings.initialBlocks :
|
|
13055
|
-
this.parent.pageSettings.pageSize;
|
|
13103
|
+
this.parent.grid.pageSettings.pageSize * this.parent.infiniteScrollSettings.initialBlocks :
|
|
13104
|
+
this.parent.grid.pageSettings.pageSize;
|
|
13056
13105
|
var current = this.parent.grid.pageSettings.currentPage;
|
|
13057
13106
|
if (!isNullOrUndefined(actionArgs)) {
|
|
13058
13107
|
var lastIndex = getValue('lastIndex', this.parent.grid.infiniteScrollModule);
|
|
@@ -13070,7 +13119,7 @@ var InfiniteScroll$1 = /** @__PURE__ @class */ (function () {
|
|
|
13070
13119
|
else {
|
|
13071
13120
|
if ((pageingDetails.actionArgs['action'] === 'expand' || pageingDetails.actionArgs['action'] === 'collapse') && this.parent.grid.pageSettings.currentPage !== 1) {
|
|
13072
13121
|
current = 1;
|
|
13073
|
-
size = this.parent.pageSettings.pageSize * this.parent.grid.pageSettings.currentPage;
|
|
13122
|
+
size = this.parent.grid.pageSettings.pageSize * this.parent.grid.pageSettings.currentPage;
|
|
13074
13123
|
}
|
|
13075
13124
|
query = query.page(current, size);
|
|
13076
13125
|
}
|
|
@@ -13242,5 +13291,5 @@ var InfiniteScroll$1 = /** @__PURE__ @class */ (function () {
|
|
|
13242
13291
|
* Export TreeGrid component
|
|
13243
13292
|
*/
|
|
13244
13293
|
|
|
13245
|
-
export { TreeGrid, load, rowDataBound, dataBound, queryCellInfo, beforeDataBound, actionBegin, dataStateChange, actionComplete, rowSelecting, rowSelected, checkboxChange, rowDeselected, toolbarClick, beforeExcelExport, beforePdfExport, resizeStop, expanded, expanding, collapsed, collapsing, remoteExpand, localPagedExpandCollapse, pagingActions, printGridInit, contextMenuOpen, contextMenuClick, beforeCopy, beforePaste, savePreviousRowPosition, crudAction, beginEdit, beginAdd, recordDoubleClick, cellSave, cellSaved, cellEdit, batchDelete, batchCancel, batchAdd, beforeBatchDelete, beforeBatchAdd, beforeBatchSave, batchSave, keyPressed, updateData, doubleTap, virtualColumnIndex, virtualActionArgs, destroy, dataListener, indexModifier, beforeStartEdit, beforeBatchCancel, batchEditFormRendered, detailDataBound, rowDrag, rowDragStartHelper, rowDrop, rowDragStart, rowsAdd, rowsRemove, rowdraging, rowDropped, autoCol, DataManipulation, Reorder$1 as Reorder, Resize$1 as Resize, RowDD$1 as RowDD, Column, EditSettings, Predicate$1 as Predicate, FilterSettings, PageSettings, SearchSettings, SelectionSettings, AggregateColumn, AggregateRow, SortDescriptor, SortSettings, RowDropSettings$1 as RowDropSettings, InfiniteScrollSettings, Render, TreeVirtualRowModelGenerator, isRemoteData, isCountRequired, isCheckboxcolumn, isFilterChildHierarchy, findParentRecords, getExpandStatus, findChildrenRecords, isOffline, extendArray, getPlainData, getParentData, isHidden, ToolbarItem, ContextMenuItems, Filter$1 as Filter, ExcelExport$1 as ExcelExport, PdfExport$1 as PdfExport, Page$1 as Page, Toolbar$1 as Toolbar, Aggregate$1 as Aggregate, Sort$1 as Sort, TreeClipboard, ColumnMenu$1 as ColumnMenu, ContextMenu$1 as ContextMenu, Edit$1 as Edit, CommandColumn$1 as CommandColumn, Selection, DetailRow$1 as DetailRow, VirtualScroll$1 as VirtualScroll, TreeVirtual, Freeze$1 as Freeze, ColumnChooser$1 as ColumnChooser, Logger$1 as Logger, treeGridDetails, InfiniteScroll$1 as InfiniteScroll };
|
|
13294
|
+
export { TreeGrid, load, rowDataBound, dataBound, queryCellInfo, beforeDataBound, actionBegin, dataStateChange, actionComplete, rowSelecting, rowSelected, checkboxChange, rowDeselected, toolbarClick, beforeExcelExport, beforePdfExport, resizeStop, expanded, expanding, collapsed, collapsing, remoteExpand, localPagedExpandCollapse, pagingActions, printGridInit, contextMenuOpen, contextMenuClick, beforeCopy, beforePaste, savePreviousRowPosition, crudAction, beginEdit, beginAdd, recordDoubleClick, cellSave, cellSaved, cellEdit, batchDelete, batchCancel, batchAdd, beforeBatchDelete, beforeBatchAdd, beforeBatchSave, batchSave, keyPressed, updateData, doubleTap, virtualColumnIndex, virtualActionArgs, destroy, dataListener, indexModifier, beforeStartEdit, beforeBatchCancel, batchEditFormRendered, detailDataBound, rowDrag, rowDragStartHelper, rowDrop, rowDragStart, rowsAdd, rowsRemove, rowdraging, rowDropped, autoCol, rowDeselecting, DataManipulation, Reorder$1 as Reorder, Resize$1 as Resize, RowDD$1 as RowDD, Column, EditSettings, Predicate$1 as Predicate, FilterSettings, PageSettings, SearchSettings, SelectionSettings, AggregateColumn, AggregateRow, SortDescriptor, SortSettings, RowDropSettings$1 as RowDropSettings, InfiniteScrollSettings, Render, TreeVirtualRowModelGenerator, isRemoteData, isCountRequired, isCheckboxcolumn, isFilterChildHierarchy, findParentRecords, getExpandStatus, findChildrenRecords, isOffline, extendArray, getPlainData, getParentData, isHidden, ToolbarItem, ContextMenuItems, Filter$1 as Filter, ExcelExport$1 as ExcelExport, PdfExport$1 as PdfExport, Page$1 as Page, Toolbar$1 as Toolbar, Aggregate$1 as Aggregate, Sort$1 as Sort, TreeClipboard, ColumnMenu$1 as ColumnMenu, ContextMenu$1 as ContextMenu, Edit$1 as Edit, CommandColumn$1 as CommandColumn, Selection, DetailRow$1 as DetailRow, VirtualScroll$1 as VirtualScroll, TreeVirtual, Freeze$1 as Freeze, ColumnChooser$1 as ColumnChooser, Logger$1 as Logger, treeGridDetails, InfiniteScroll$1 as InfiniteScroll };
|
|
13246
13295
|
//# sourceMappingURL=ej2-treegrid.es5.js.map
|