@syncfusion/ej2-treegrid 20.2.39 → 20.2.44
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 +23 -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 +114 -63
- package/dist/es6/ej2-treegrid.es2015.js.map +1 -1
- package/dist/es6/ej2-treegrid.es5.js +119 -68
- 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/batch-edit.js +38 -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/filter.js +2 -1
- 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
|
@@ -438,6 +438,8 @@ const rowdraging = 'row-draging';
|
|
|
438
438
|
const rowDropped = 'row-dropped';
|
|
439
439
|
/** @hidden */
|
|
440
440
|
const autoCol = 'auto-col';
|
|
441
|
+
/** @hidden */
|
|
442
|
+
const rowDeselecting = 'rowDeselecting';
|
|
441
443
|
|
|
442
444
|
/**
|
|
443
445
|
* The `Clipboard` module is used to handle clipboard copy action.
|
|
@@ -722,7 +724,7 @@ function findChildrenRecords(records) {
|
|
|
722
724
|
return [];
|
|
723
725
|
}
|
|
724
726
|
if (!isNullOrUndefined(records.childRecords)) {
|
|
725
|
-
const childRecords = records.childRecords;
|
|
727
|
+
const childRecords = records.childRecords.filter((item) => !item.isSummaryRow);
|
|
726
728
|
const keys = Object.keys(childRecords);
|
|
727
729
|
for (let i = 0, len = keys.length; i < len; i++) {
|
|
728
730
|
datas.push(childRecords[i]);
|
|
@@ -1236,7 +1238,7 @@ class Selection {
|
|
|
1236
1238
|
childData = (!isNullOrUndefined(this.parent.filterModule) && this.parent.filterModule.filteredResult.length > 0) ?
|
|
1237
1239
|
this.parent.getCurrentViewRecords() : this.parent.flatData;
|
|
1238
1240
|
childData.forEach((record) => {
|
|
1239
|
-
if (this.parent.enableVirtualization) {
|
|
1241
|
+
if (this.parent.enableVirtualization && record.childRecords.length > 0) {
|
|
1240
1242
|
if (record.hasChildRecords) {
|
|
1241
1243
|
this.updateParentSelection(record);
|
|
1242
1244
|
}
|
|
@@ -1617,7 +1619,7 @@ class Render {
|
|
|
1617
1619
|
const templateFn = 'templateFn';
|
|
1618
1620
|
const colindex = args.column.index;
|
|
1619
1621
|
if (isNullOrUndefined(treeColumn.field)) {
|
|
1620
|
-
args.cell.setAttribute('
|
|
1622
|
+
args.cell.setAttribute('data-colindex', colindex + '');
|
|
1621
1623
|
}
|
|
1622
1624
|
if (treeColumn.field === args.column.field && !isNullOrUndefined(treeColumn.template)) {
|
|
1623
1625
|
args.column.template = treeColumn.template;
|
|
@@ -3678,15 +3680,22 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
|
|
|
3678
3680
|
triggerEvents(args) {
|
|
3679
3681
|
this.trigger(getObject('name', args), args);
|
|
3680
3682
|
}
|
|
3683
|
+
IsExpandCollapseClicked(args) {
|
|
3684
|
+
if (!isNullOrUndefined(args.target) && (args.target.classList.contains('e-treegridexpand')
|
|
3685
|
+
|| args.target.classList.contains('e-treegridcollapse') || args.target.classList.contains('e-summarycell'))) {
|
|
3686
|
+
args.cancel = true;
|
|
3687
|
+
return;
|
|
3688
|
+
}
|
|
3689
|
+
}
|
|
3681
3690
|
bindGridEvents() {
|
|
3682
3691
|
this.grid.rowSelecting = (args) => {
|
|
3683
|
-
|
|
3684
|
-
|| args.target.classList.contains('e-treegridcollapse') || args.target.classList.contains('e-summarycell'))) {
|
|
3685
|
-
args.cancel = true;
|
|
3686
|
-
return;
|
|
3687
|
-
}
|
|
3692
|
+
this.IsExpandCollapseClicked(args);
|
|
3688
3693
|
this.trigger(rowSelecting, args);
|
|
3689
3694
|
};
|
|
3695
|
+
this.grid.rowDeselecting = (args) => {
|
|
3696
|
+
this.IsExpandCollapseClicked(args);
|
|
3697
|
+
this.trigger(rowDeselecting, args);
|
|
3698
|
+
};
|
|
3690
3699
|
this.grid.rowSelected = (args) => {
|
|
3691
3700
|
if (this.enableVirtualization && args.isHeaderCheckboxClicked &&
|
|
3692
3701
|
this.grid.currentViewData.length !== this.grid.selectionModule.selectedRowIndexes.length) {
|
|
@@ -5458,7 +5467,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
|
|
|
5458
5467
|
}
|
|
5459
5468
|
else if (isNullOrUndefined(record)) {
|
|
5460
5469
|
if (this.detailTemplate) {
|
|
5461
|
-
record = this.grid.getCurrentViewRecords()[row.getAttribute('
|
|
5470
|
+
record = this.grid.getCurrentViewRecords()[row.getAttribute('data-rowindex')];
|
|
5462
5471
|
}
|
|
5463
5472
|
else {
|
|
5464
5473
|
record = this.grid.getCurrentViewRecords()[row.rowIndex];
|
|
@@ -5729,7 +5738,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
|
|
|
5729
5738
|
row = gridRows[rowIndex];
|
|
5730
5739
|
}
|
|
5731
5740
|
else {
|
|
5732
|
-
rowIndex = +row.getAttribute('
|
|
5741
|
+
rowIndex = +row.getAttribute('data-rowindex');
|
|
5733
5742
|
}
|
|
5734
5743
|
if (!isNullOrUndefined(row)) {
|
|
5735
5744
|
row.setAttribute('aria-expanded', action === 'expand' ? 'true' : 'false');
|
|
@@ -7115,7 +7124,7 @@ class RowDD$1 {
|
|
|
7115
7124
|
dropIndex = this.selectedRow.rowIndex - 1;
|
|
7116
7125
|
}
|
|
7117
7126
|
if (this.parent.enableVirtualization && this.parent.allowRowDragAndDrop && this.selectedRecord) {
|
|
7118
|
-
dropIndex = parseInt(this.selectedRow.getAttribute('
|
|
7127
|
+
dropIndex = parseInt(this.selectedRow.getAttribute('data-rowindex'), 10) - 1;
|
|
7119
7128
|
}
|
|
7120
7129
|
tObj[action] = 'indenting';
|
|
7121
7130
|
tObj[droppedIndex] = dropIndex;
|
|
@@ -7134,7 +7143,7 @@ class RowDD$1 {
|
|
|
7134
7143
|
}
|
|
7135
7144
|
}
|
|
7136
7145
|
if (this.parent.enableVirtualization && this.parent.allowRowDragAndDrop && this.selectedRecord) {
|
|
7137
|
-
dropIndex = parseInt(this.parent.getRows()[dropIndex].getAttribute('
|
|
7146
|
+
dropIndex = parseInt(this.parent.getRows()[dropIndex].getAttribute('data-rowindex'), 10);
|
|
7138
7147
|
}
|
|
7139
7148
|
tObj[action] = 'outdenting';
|
|
7140
7149
|
tObj[droppedIndex] = dropIndex;
|
|
@@ -7153,7 +7162,7 @@ class RowDD$1 {
|
|
|
7153
7162
|
if (!actionArgs.cancel) {
|
|
7154
7163
|
if (actionArgs.action === 'indenting') {
|
|
7155
7164
|
if (this.parent.enableVirtualization && this.parent.allowRowDragAndDrop) {
|
|
7156
|
-
this.reorderRows([parseInt(this.selectedRow.getAttribute('
|
|
7165
|
+
this.reorderRows([parseInt(this.selectedRow.getAttribute('data-rowindex'), 10)], dropIndex, 'child');
|
|
7157
7166
|
}
|
|
7158
7167
|
else {
|
|
7159
7168
|
this.reorderRows([this.selectedRow.rowIndex], dropIndex, 'child');
|
|
@@ -7161,7 +7170,7 @@ class RowDD$1 {
|
|
|
7161
7170
|
}
|
|
7162
7171
|
else if (actionArgs.action === 'outdenting') {
|
|
7163
7172
|
if (this.parent.enableVirtualization && this.parent.allowRowDragAndDrop) {
|
|
7164
|
-
this.reorderRows([parseInt(this.selectedRow.getAttribute('
|
|
7173
|
+
this.reorderRows([parseInt(this.selectedRow.getAttribute('data-rowindex'), 10)], dropIndex, 'below');
|
|
7165
7174
|
}
|
|
7166
7175
|
else {
|
|
7167
7176
|
this.reorderRows([this.selectedRow.rowIndex], dropIndex, 'below');
|
|
@@ -7787,7 +7796,7 @@ class RowDD$1 {
|
|
|
7787
7796
|
}
|
|
7788
7797
|
}
|
|
7789
7798
|
getTargetIdx(targetRow) {
|
|
7790
|
-
return targetRow ? parseInt(targetRow.getAttribute('
|
|
7799
|
+
return targetRow ? parseInt(targetRow.getAttribute('data-rowindex'), 10) : 0;
|
|
7791
7800
|
}
|
|
7792
7801
|
getParentData(record, data) {
|
|
7793
7802
|
const parentItem = record.parentItem;
|
|
@@ -8548,7 +8557,8 @@ class Filter$1 {
|
|
|
8548
8557
|
}
|
|
8549
8558
|
}
|
|
8550
8559
|
else {
|
|
8551
|
-
if (parent
|
|
8560
|
+
if ((!this.parent.enableCollapseAll || !this.parent.initialRender && isNullOrUndefined(this.parent['dataResults']['result']))
|
|
8561
|
+
&& parent['expanded'] === false && this.parent.getVisibleRecords().indexOf(record) === -1) {
|
|
8552
8562
|
this.parent.expandRow(this.parent.getRows()[parent['index']], parent);
|
|
8553
8563
|
}
|
|
8554
8564
|
this.addParentRecord(parent);
|
|
@@ -9813,6 +9823,7 @@ class ContextMenu$1 {
|
|
|
9813
9823
|
if (args.item.id === 'Above' || args.item.id === 'Below' || args.item.id === 'Child') {
|
|
9814
9824
|
this.parent.notify('savePreviousRowPosition', args);
|
|
9815
9825
|
this.parent.setProperties({ editSettings: { newRowPosition: args.item.id } }, true);
|
|
9826
|
+
this.parent.editModule['isAddedRowByContextMenu'] = true;
|
|
9816
9827
|
this.parent.addRecord();
|
|
9817
9828
|
}
|
|
9818
9829
|
if (args.item.id === this.parent.element.id + '_gridcontrol_cmenu_Indent' || args.item.id === this.parent.element.id + '_gridcontrol_cmenu_Outdent') {
|
|
@@ -10083,10 +10094,12 @@ class BatchEdit {
|
|
|
10083
10094
|
this.parent.editModule[isTabLastRow] = false;
|
|
10084
10095
|
return;
|
|
10085
10096
|
}
|
|
10086
|
-
if (this.parent.editModule['isAddedRowByMethod'] && !isNullOrUndefined(this.parent.editModule['addRowIndex']) &&
|
|
10097
|
+
if (this.parent.editModule['isAddedRowByMethod'] && !isNullOrUndefined(this.parent.editModule['addRowIndex']) &&
|
|
10098
|
+
!this.parent.editModule['isAddedRowByContextMenu'] && (this.parent.grid.selectedRowIndex === -1 || this.parent.editModule['batchEditModule'].isAdd)) {
|
|
10087
10099
|
this.selectedIndex = this.parent.editModule['selectedIndex'];
|
|
10088
10100
|
this.addRowIndex = this.parent.editModule['addRowIndex'];
|
|
10089
|
-
this.addRowRecord = this.
|
|
10101
|
+
this.addRowRecord = this.batchRecords.length ? this.batchRecords[this.selectedIndex]
|
|
10102
|
+
: this.parent.getCurrentViewRecords()[this.selectedIndex];
|
|
10090
10103
|
}
|
|
10091
10104
|
else {
|
|
10092
10105
|
this.selectedIndex = this.parent.grid.selectedRowIndex;
|
|
@@ -10133,6 +10146,11 @@ class BatchEdit {
|
|
|
10133
10146
|
// }
|
|
10134
10147
|
}
|
|
10135
10148
|
focusModule.getContent().matrix.current = [actualIndex, focusModule.getContent().matrix.current[1]];
|
|
10149
|
+
if (this.parent.editModule['isAddedRowByMethod'] && !isNullOrUndefined(this.parent.editModule['addRowIndex']) && !this.parent.editModule['isAddedRowByContextMenu']) {
|
|
10150
|
+
const newlyAddedRecords = this.parent.getBatchChanges()['addedRecords'];
|
|
10151
|
+
const index = parseInt(this.parent.getContentTable().getElementsByClassName('e-insertedrow')[newlyAddedRecords.length - 1].getAttribute('data-rowindex'), 10);
|
|
10152
|
+
this.batchRecords.splice(index, 0, newlyAddedRecords[newlyAddedRecords.length - 1]);
|
|
10153
|
+
}
|
|
10136
10154
|
}
|
|
10137
10155
|
}
|
|
10138
10156
|
beforeBatchDelete(args) {
|
|
@@ -10158,7 +10176,7 @@ class BatchEdit {
|
|
|
10158
10176
|
childs = findChildrenRecords(data);
|
|
10159
10177
|
uid = this.parent.getSelectedRows()[0].getAttribute('data-uid');
|
|
10160
10178
|
}
|
|
10161
|
-
const parentRowIndex = parseInt(this.parent.grid.getRowElementByUID(uid).getAttribute('
|
|
10179
|
+
const parentRowIndex = parseInt(this.parent.grid.getRowElementByUID(uid).getAttribute('data-rowindex'), 10);
|
|
10162
10180
|
if (childs.length) {
|
|
10163
10181
|
const totalCount = parentRowIndex + childs.length;
|
|
10164
10182
|
const firstChildIndex = parentRowIndex + 1;
|
|
@@ -10195,7 +10213,7 @@ class BatchEdit {
|
|
|
10195
10213
|
updateRowIndex() {
|
|
10196
10214
|
const rows = this.parent.grid.getDataRows();
|
|
10197
10215
|
for (let i = 0; i < rows.length; i++) {
|
|
10198
|
-
rows[i].setAttribute('
|
|
10216
|
+
rows[i].setAttribute('data-rowindex', i.toString());
|
|
10199
10217
|
}
|
|
10200
10218
|
const freeze = (this.parent.getFrozenLeftColumnsCount() > 0 ||
|
|
10201
10219
|
this.parent.getFrozenRightColumnsCount() > 0) ? true : false;
|
|
@@ -10203,9 +10221,9 @@ class BatchEdit {
|
|
|
10203
10221
|
const mRows = this.parent.grid.getMovableDataRows();
|
|
10204
10222
|
const freezeRightRows = this.parent.grid.getFrozenRightDataRows();
|
|
10205
10223
|
for (let i = 0; i < mRows.length; i++) {
|
|
10206
|
-
mRows[i].setAttribute('
|
|
10224
|
+
mRows[i].setAttribute('data-rowindex', i.toString());
|
|
10207
10225
|
if (freeze) {
|
|
10208
|
-
freezeRightRows[i].setAttribute('
|
|
10226
|
+
freezeRightRows[i].setAttribute('data-rowindex', i.toString());
|
|
10209
10227
|
}
|
|
10210
10228
|
}
|
|
10211
10229
|
}
|
|
@@ -10265,7 +10283,9 @@ class BatchEdit {
|
|
|
10265
10283
|
if (!isNullOrUndefined(this.batchAddedRecords)) {
|
|
10266
10284
|
for (let i = 0; i < this.batchAddedRecords.length; i++) {
|
|
10267
10285
|
index = data.map((e) => { return e[primaryKey]; }).indexOf(this.batchAddedRecords[i][primaryKey]);
|
|
10268
|
-
|
|
10286
|
+
if (index !== -1) {
|
|
10287
|
+
data.splice(index, 1);
|
|
10288
|
+
}
|
|
10269
10289
|
if (this.parent.editSettings.newRowPosition === 'Child') {
|
|
10270
10290
|
index = currentViewRecords.map((e) => { return e[primaryKey]; })
|
|
10271
10291
|
.indexOf(this.batchAddedRecords[i][parentItem] ? this.batchAddedRecords[i][parentItem][primaryKey]
|
|
@@ -10331,9 +10351,12 @@ class BatchEdit {
|
|
|
10331
10351
|
}
|
|
10332
10352
|
if (this.parent.editSettings.newRowPosition !== 'Bottom' && !Object.hasOwnProperty.call(args, 'updatedRecords')) {
|
|
10333
10353
|
data.splice(data.length - addRecords.length, addRecords.length);
|
|
10334
|
-
if (this.parent.editModule['isAddedRowByMethod'] && addRecords.length && !isNullOrUndefined(this.parent.editModule['addRowIndex'])) {
|
|
10335
|
-
|
|
10336
|
-
|
|
10354
|
+
if (this.parent.editModule['isAddedRowByMethod'] && addRecords.length && !isNullOrUndefined(this.parent.editModule['addRowIndex']) && !this.parent.editModule['isAddedRowByContextMenu']) {
|
|
10355
|
+
addRecords.reverse();
|
|
10356
|
+
for (let i = 0; i < addRecords.length; i++) {
|
|
10357
|
+
const index = parseInt(this.parent.getContentTable().getElementsByClassName('e-insertedrow')[i].getAttribute('data-rowindex'), 10);
|
|
10358
|
+
data.splice(index, 0, addRecords[i]);
|
|
10359
|
+
}
|
|
10337
10360
|
}
|
|
10338
10361
|
if (!this.parent.allowPaging && data.length !== currentViewRecords.length) {
|
|
10339
10362
|
if (currentViewRecords.length > addRecords.length) {
|
|
@@ -10353,6 +10376,9 @@ class BatchEdit {
|
|
|
10353
10376
|
if (this.batchAddRowRecord.length === 0) {
|
|
10354
10377
|
this.batchAddRowRecord.push(this.parent.flatData[args.index]);
|
|
10355
10378
|
}
|
|
10379
|
+
if (this.parent.editModule['isAddedRowByContextMenu']) {
|
|
10380
|
+
addRecords.reverse();
|
|
10381
|
+
}
|
|
10356
10382
|
for (i = 0; i < addRecords.length; i++) {
|
|
10357
10383
|
const taskData = extend({}, addRecords[i]);
|
|
10358
10384
|
delete taskData.parentItem;
|
|
@@ -10365,6 +10391,11 @@ class BatchEdit {
|
|
|
10365
10391
|
if (!isNullOrUndefined(taskData.primaryParent)) {
|
|
10366
10392
|
delete taskData.primaryParent;
|
|
10367
10393
|
}
|
|
10394
|
+
if (addRecords.length > 1 && this.parent.editModule['isAddedRowByContextMenu']) {
|
|
10395
|
+
const rowPosition = this.parent.editSettings.newRowPosition;
|
|
10396
|
+
this.parent.editSettings.newRowPosition = this.parent.editModule['previousNewRowPosition'];
|
|
10397
|
+
this.parent.editModule['previousNewRowPosition'] = rowPosition;
|
|
10398
|
+
}
|
|
10368
10399
|
addRecords[i].taskData = taskData;
|
|
10369
10400
|
addRowRecord = this.batchAddRowRecord[i];
|
|
10370
10401
|
if (isNullOrUndefined(addRowRecord)) {
|
|
@@ -10413,6 +10444,9 @@ class BatchEdit {
|
|
|
10413
10444
|
}
|
|
10414
10445
|
}
|
|
10415
10446
|
this.batchAddRowRecord = this.batchAddedRecords = this.batchRecords = this.batchDeletedRecords = this.currentViewRecords = [];
|
|
10447
|
+
if (this.parent.editModule['isAddedRowByContextMenu']) {
|
|
10448
|
+
this.parent.editModule['isAddedRowByContextMenu'] = false;
|
|
10449
|
+
}
|
|
10416
10450
|
}
|
|
10417
10451
|
getActualRowObjectIndex(index) {
|
|
10418
10452
|
const rows = this.parent.grid.getDataRows();
|
|
@@ -10481,6 +10515,7 @@ class Edit$1 {
|
|
|
10481
10515
|
this.deletedRecords = 'deletedRecords';
|
|
10482
10516
|
this.prevAriaRowIndex = '-1';
|
|
10483
10517
|
this.isAddedRowByMethod = false;
|
|
10518
|
+
this.isAddedRowByContextMenu = false;
|
|
10484
10519
|
Grid.Inject(Edit);
|
|
10485
10520
|
this.parent = parent;
|
|
10486
10521
|
this.isSelfReference = !isNullOrUndefined(parent.parentIdMapping);
|
|
@@ -10531,7 +10566,7 @@ class Edit$1 {
|
|
|
10531
10566
|
getRowPosition(addArgs) {
|
|
10532
10567
|
addArgs.newRowPosition = this.parent.editSettings.newRowPosition;
|
|
10533
10568
|
addArgs.addRowIndex = this.addRowIndex;
|
|
10534
|
-
addArgs.
|
|
10569
|
+
addArgs.dataRowIndex = +this.prevAriaRowIndex;
|
|
10535
10570
|
}
|
|
10536
10571
|
beforeStartEdit(args) {
|
|
10537
10572
|
this.parent.trigger(actionBegin, args);
|
|
@@ -10686,7 +10721,7 @@ class Edit$1 {
|
|
|
10686
10721
|
if (!(this.parent.grid.editSettings.allowEditing) || this.parent.grid.isEdit) {
|
|
10687
10722
|
return;
|
|
10688
10723
|
}
|
|
10689
|
-
const column = this.parent.grid.getColumnByIndex(+target.closest('td.e-rowcell').getAttribute('
|
|
10724
|
+
const column = this.parent.grid.getColumnByIndex(+target.closest('td.e-rowcell').getAttribute('data-colindex'));
|
|
10690
10725
|
if (this.parent.editSettings.mode === 'Cell' && !this.isOnBatch && column && !column.isPrimaryKey &&
|
|
10691
10726
|
this.parent.editSettings.allowEditing && column.allowEditing && !(target.classList.contains('e-treegridexpand') ||
|
|
10692
10727
|
target.classList.contains('e-treegridcollapse')) && this.parent.editSettings.allowEditOnDblClick) {
|
|
@@ -10694,8 +10729,8 @@ class Edit$1 {
|
|
|
10694
10729
|
this.parent.grid.setProperties({ selectedRowIndex: args.rowIndex }, true);
|
|
10695
10730
|
if (this.parent.enableVirtualization) {
|
|
10696
10731
|
const tr = parentsUntil(args.target, 'e-row');
|
|
10697
|
-
this.prevAriaRowIndex = tr.getAttribute('
|
|
10698
|
-
tr.setAttribute('
|
|
10732
|
+
this.prevAriaRowIndex = tr.getAttribute('data-rowindex');
|
|
10733
|
+
tr.setAttribute('data-rowindex', tr.rowIndex + '');
|
|
10699
10734
|
}
|
|
10700
10735
|
this.updateGridEditMode('Batch');
|
|
10701
10736
|
}
|
|
@@ -10734,7 +10769,7 @@ class Edit$1 {
|
|
|
10734
10769
|
const prom = args[promise];
|
|
10735
10770
|
delete args[promise];
|
|
10736
10771
|
if (this.parent.enableVirtualization && !isNullOrUndefined(this.prevAriaRowIndex) && this.prevAriaRowIndex !== '-1') {
|
|
10737
|
-
args.row.setAttribute('
|
|
10772
|
+
args.row.setAttribute('data-rowindex', this.prevAriaRowIndex);
|
|
10738
10773
|
this.prevAriaRowIndex = undefined;
|
|
10739
10774
|
}
|
|
10740
10775
|
if (this.keyPress !== 'enter') {
|
|
@@ -11069,8 +11104,8 @@ class Edit$1 {
|
|
|
11069
11104
|
}
|
|
11070
11105
|
}
|
|
11071
11106
|
const rows = this.parent.grid.getDataRows();
|
|
11072
|
-
const firstAriaIndex = rows.length ? +rows[0].getAttribute('
|
|
11073
|
-
const lastAriaIndex = rows.length ? +rows[rows.length - 1].getAttribute('
|
|
11107
|
+
const firstAriaIndex = rows.length ? +rows[0].getAttribute('data-rowindex') : 0;
|
|
11108
|
+
const lastAriaIndex = rows.length ? +rows[rows.length - 1].getAttribute('data-rowindex') : 0;
|
|
11074
11109
|
const withinRange = this.selectedIndex >= firstAriaIndex && this.selectedIndex <= lastAriaIndex;
|
|
11075
11110
|
const isVirtualization = this.parent.enableVirtualization && this.addRowIndex > -1 && this.prevAriaRowIndex !== '-1';
|
|
11076
11111
|
if (this.parent.editSettings.mode !== 'Dialog') {
|
|
@@ -11140,20 +11175,27 @@ class Edit$1 {
|
|
|
11140
11175
|
focussedElement.focus();
|
|
11141
11176
|
}
|
|
11142
11177
|
}
|
|
11143
|
-
if (this.parent.editSettings.mode === 'Batch' && !isNullOrUndefined(this.addRowIndex) && this.addRowIndex !== -1) {
|
|
11178
|
+
if (this.parent.editSettings.mode === 'Batch' && !isNullOrUndefined(this.addRowIndex) && this.addRowIndex !== -1 && this['isAddedRowByMethod'] && !this.isAddedRowByContextMenu) {
|
|
11144
11179
|
index = this.batchEditModule.getAddRowIndex();
|
|
11145
11180
|
this.selectedIndex = this.batchEditModule.getSelectedIndex();
|
|
11146
|
-
|
|
11147
|
-
|
|
11148
|
-
|
|
11149
|
-
|
|
11150
|
-
|
|
11151
|
-
|
|
11152
|
-
|
|
11153
|
-
|
|
11154
|
-
this.parent.editModule.batchEditModule['batchAddRowRecord'].push(this.parent.editModule.batchEditModule['addRowRecord']);
|
|
11155
|
-
this.parent.editModule.batchEditModule['batchAddedRecords'].push(args['data']);
|
|
11181
|
+
const batchAddedRecords = this.parent.getBatchChanges()['addedRecords'];
|
|
11182
|
+
let newlyAddedRecord;
|
|
11183
|
+
if (batchAddedRecords.length) {
|
|
11184
|
+
for (let i = 0; i < batchAddedRecords.length; i++) {
|
|
11185
|
+
if (isNullOrUndefined(batchAddedRecords[i].uniqueID)) {
|
|
11186
|
+
newlyAddedRecord = batchAddedRecords[i];
|
|
11187
|
+
}
|
|
11188
|
+
}
|
|
11156
11189
|
}
|
|
11190
|
+
const args = {
|
|
11191
|
+
action: 'add',
|
|
11192
|
+
data: newlyAddedRecord,
|
|
11193
|
+
index: index,
|
|
11194
|
+
seletedRow: 0
|
|
11195
|
+
};
|
|
11196
|
+
this.beginAddEdit(args);
|
|
11197
|
+
this.batchEditModule['batchAddRowRecord'].push(this.batchEditModule['addRowRecord']);
|
|
11198
|
+
this.batchEditModule['batchAddedRecords'].push(args['data']);
|
|
11157
11199
|
}
|
|
11158
11200
|
}
|
|
11159
11201
|
// private beforeDataBound(args: BeforeDataBoundArgs): void {
|
|
@@ -11216,7 +11258,7 @@ class Edit$1 {
|
|
|
11216
11258
|
this.selectedIndex = this.parent.grid.selectedRowIndex;
|
|
11217
11259
|
}
|
|
11218
11260
|
if (this.parent.enableVirtualization) {
|
|
11219
|
-
let selector = '.e-row[
|
|
11261
|
+
let selector = '.e-row[data-rowindex="' + this.selectedIndex + '"]';
|
|
11220
11262
|
let row;
|
|
11221
11263
|
if (this.selectedIndex > -1 && this.parent.editSettings.newRowPosition !== 'Top' &&
|
|
11222
11264
|
this.parent.editSettings.newRowPosition !== 'Bottom') {
|
|
@@ -11226,7 +11268,7 @@ class Edit$1 {
|
|
|
11226
11268
|
}
|
|
11227
11269
|
else {
|
|
11228
11270
|
if (this.prevAriaRowIndex && this.prevAriaRowIndex !== '-1') {
|
|
11229
|
-
selector = '.e-row[
|
|
11271
|
+
selector = '.e-row[data-rowindex="' + this.prevAriaRowIndex + '"]';
|
|
11230
11272
|
row = this.parent.getContent().querySelector(selector);
|
|
11231
11273
|
this.addRowIndex = row ? row.rowIndex : 0;
|
|
11232
11274
|
}
|
|
@@ -11285,10 +11327,16 @@ class Edit$1 {
|
|
|
11285
11327
|
const key = this.parent.grid.getPrimaryKeyFieldNames()[0];
|
|
11286
11328
|
let position = null;
|
|
11287
11329
|
value.taskData = isNullOrUndefined(value.taskData) ? extend({}, args.data) : value.taskData;
|
|
11288
|
-
|
|
11330
|
+
let currentData;
|
|
11331
|
+
if (this.parent.editSettings.mode === 'Batch' && this['isAddedRowByMethod'] && !isNullOrUndefined(this.addRowIndex)) {
|
|
11332
|
+
currentData = this.batchEditModule['batchRecords'];
|
|
11333
|
+
}
|
|
11334
|
+
else {
|
|
11335
|
+
currentData = this.parent.grid.getCurrentViewRecords();
|
|
11336
|
+
}
|
|
11289
11337
|
if (this.parent.enableVirtualization && args.index !== 0) {
|
|
11290
11338
|
this.addRowIndex = this.parent.grid.getCurrentViewRecords().indexOf(this.addRowRecord);
|
|
11291
|
-
this.selectedIndex = parseInt(this.parent.getRows()[this.addRowIndex].getAttribute('
|
|
11339
|
+
this.selectedIndex = parseInt(this.parent.getRows()[this.addRowIndex].getAttribute('data-rowindex'), 10);
|
|
11292
11340
|
}
|
|
11293
11341
|
let index = this.addRowIndex;
|
|
11294
11342
|
value.uniqueID = getUid(this.parent.element.id + '_data_');
|
|
@@ -11301,7 +11349,7 @@ class Edit$1 {
|
|
|
11301
11349
|
const isVirtualization = this.parent.enableVirtualization && this.addRowIndex > -1 && this.prevAriaRowIndex !== '-1';
|
|
11302
11350
|
const rows = this.parent.getRows();
|
|
11303
11351
|
const firstAriaIndex = rows.length ? currentData.indexOf(currentData[0]) : 0;
|
|
11304
|
-
const lastAriaIndex = rows.length ? +rows[rows.length - 1].getAttribute('
|
|
11352
|
+
const lastAriaIndex = rows.length ? +rows[rows.length - 1].getAttribute('data-rowindex') : 0;
|
|
11305
11353
|
const withinRange = this.selectedIndex >= firstAriaIndex && this.selectedIndex <= lastAriaIndex;
|
|
11306
11354
|
if (currentData.length) {
|
|
11307
11355
|
idMapping = currentData[this.addRowIndex][this.parent.idMapping];
|
|
@@ -11648,7 +11696,7 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
|
|
|
11648
11696
|
return new TreeVirtualRowModelGenerator(this.parent);
|
|
11649
11697
|
}
|
|
11650
11698
|
getRowByIndex(index) {
|
|
11651
|
-
return this.parent.getDataRows().filter((e) => parseInt(e.getAttribute('
|
|
11699
|
+
return this.parent.getDataRows().filter((e) => parseInt(e.getAttribute('data-rowindex'), 10) === index)[0];
|
|
11652
11700
|
}
|
|
11653
11701
|
addEventListener() {
|
|
11654
11702
|
this.parent.on(virtualActionArgs, this.virtualOtherAction, this);
|
|
@@ -11826,7 +11874,7 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
|
|
|
11826
11874
|
return new Cell(opt);
|
|
11827
11875
|
}
|
|
11828
11876
|
beginEdit(e) {
|
|
11829
|
-
const selector = '.e-row[
|
|
11877
|
+
const selector = '.e-row[data-rowindex="' + e.index + '"]';
|
|
11830
11878
|
const index = this.parent.getContent().querySelector(selector).rowIndex;
|
|
11831
11879
|
const rowData = this.parent.getCurrentViewRecords()[index];
|
|
11832
11880
|
e.data = rowData;
|
|
@@ -11834,14 +11882,14 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
|
|
|
11834
11882
|
beginAdd(args) {
|
|
11835
11883
|
const addAction = 'addActionBegin';
|
|
11836
11884
|
const isAdd = 'isAdd';
|
|
11837
|
-
const addArgs = { newRowPosition: this.rowPosition, addRowIndex: this.addRowIndex,
|
|
11885
|
+
const addArgs = { newRowPosition: this.rowPosition, addRowIndex: this.addRowIndex, dataRowIndex: this.dataRowIndex };
|
|
11838
11886
|
this.parent.notify('get-row-position', addArgs);
|
|
11839
11887
|
this.rowPosition = addArgs.newRowPosition;
|
|
11840
11888
|
this.addRowIndex = addArgs.addRowIndex;
|
|
11841
|
-
this.
|
|
11889
|
+
this.dataRowIndex = addArgs.dataRowIndex;
|
|
11842
11890
|
const rows = this.parent.getRows();
|
|
11843
|
-
const firstAriaIndex = rows.length ? +rows[0].getAttribute('
|
|
11844
|
-
const lastAriaIndex = rows.length ? +rows[rows.length - 1].getAttribute('
|
|
11891
|
+
const firstAriaIndex = rows.length ? +rows[0].getAttribute('data-rowindex') : 0;
|
|
11892
|
+
const lastAriaIndex = rows.length ? +rows[rows.length - 1].getAttribute('data-rowindex') : 0;
|
|
11845
11893
|
const withInRange = this.parent.selectedRowIndex >= firstAriaIndex && this.parent.selectedRowIndex <= lastAriaIndex;
|
|
11846
11894
|
if (!(this.rowPosition === 'Top' || this.rowPosition === 'Bottom')) {
|
|
11847
11895
|
this[isAdd] = true;
|
|
@@ -11892,11 +11940,11 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
|
|
|
11892
11940
|
}
|
|
11893
11941
|
onActionComplete(args) {
|
|
11894
11942
|
if (args.requestType === 'add') {
|
|
11895
|
-
const addArgs = { newRowPosition: this.rowPosition, addRowIndex: this.addRowIndex,
|
|
11943
|
+
const addArgs = { newRowPosition: this.rowPosition, addRowIndex: this.addRowIndex, dataRowIndex: this.dataRowIndex };
|
|
11896
11944
|
this.parent.notify('get-row-position', addArgs);
|
|
11897
11945
|
this.rowPosition = addArgs.newRowPosition;
|
|
11898
11946
|
this.addRowIndex = addArgs.addRowIndex;
|
|
11899
|
-
this.
|
|
11947
|
+
this.dataRowIndex = addArgs.dataRowIndex;
|
|
11900
11948
|
}
|
|
11901
11949
|
const actionComplete$$1 = 'actionComplete';
|
|
11902
11950
|
super[actionComplete$$1](args);
|
|
@@ -11958,7 +12006,7 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
|
|
|
11958
12006
|
!isNullOrUndefined(this.parent.getContent().querySelectorAll('.e-content tr')[rowPt])) {
|
|
11959
12007
|
const attr = this.parent.getContent().querySelectorAll('.e-content tr')[rowPt]
|
|
11960
12008
|
.querySelector('td').getAttribute('index');
|
|
11961
|
-
firsttdinx = +attr; // this.parent.getContent().querySelector('.e-content tr').getAttribute('
|
|
12009
|
+
firsttdinx = +attr; // this.parent.getContent().querySelector('.e-content tr').getAttribute('data-rowindex');
|
|
11962
12010
|
}
|
|
11963
12011
|
if (firsttdinx === 0) {
|
|
11964
12012
|
if (this.parent.allowRowDragAndDrop) {
|
|
@@ -12057,7 +12105,7 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
|
|
|
12057
12105
|
const isAdd = 'isAdd';
|
|
12058
12106
|
if (this[isAdd] && !this.parent.getContent().querySelector('.e-content').querySelector('.e-addedrow')) {
|
|
12059
12107
|
if (!(this.rowPosition === 'Top' || this.rowPosition === 'Bottom')) {
|
|
12060
|
-
if (this.
|
|
12108
|
+
if (this.dataRowIndex >= this.startIndex) {
|
|
12061
12109
|
this.restoreNewRow();
|
|
12062
12110
|
}
|
|
12063
12111
|
else if (this.addRowIndex && this.addRowIndex > -1) {
|
|
@@ -12630,6 +12678,9 @@ class InfiniteScroll$1 {
|
|
|
12630
12678
|
});
|
|
12631
12679
|
const actionArgs = getValue('actionArgs', pageingDetails.actionArgs);
|
|
12632
12680
|
const actions = getValue('actions', this.parent.grid.infiniteScrollModule);
|
|
12681
|
+
if (this.parent.grid.infiniteScrollModule['isInitialRender'] && !this.parent.initialRender) {
|
|
12682
|
+
this.parent.grid.pageSettings.currentPage = 1;
|
|
12683
|
+
}
|
|
12633
12684
|
const initial = actions.some((value) => { return value === actionArgs.requestType; });
|
|
12634
12685
|
const initialRender = initial ? true : this.parent.initialRender ? true : false;
|
|
12635
12686
|
this.visualData = visualData;
|
|
@@ -12644,8 +12695,8 @@ class InfiniteScroll$1 {
|
|
|
12644
12695
|
this.parent.infiniteScrollSettings.initialBlocks = this.parent.infiniteScrollSettings.maxBlocks;
|
|
12645
12696
|
}
|
|
12646
12697
|
let size = initialRender ?
|
|
12647
|
-
this.parent.pageSettings.pageSize * this.parent.infiniteScrollSettings.initialBlocks :
|
|
12648
|
-
this.parent.pageSettings.pageSize;
|
|
12698
|
+
this.parent.grid.pageSettings.pageSize * this.parent.infiniteScrollSettings.initialBlocks :
|
|
12699
|
+
this.parent.grid.pageSettings.pageSize;
|
|
12649
12700
|
let current = this.parent.grid.pageSettings.currentPage;
|
|
12650
12701
|
if (!isNullOrUndefined(actionArgs)) {
|
|
12651
12702
|
const lastIndex = getValue('lastIndex', this.parent.grid.infiniteScrollModule);
|
|
@@ -12663,7 +12714,7 @@ class InfiniteScroll$1 {
|
|
|
12663
12714
|
else {
|
|
12664
12715
|
if ((pageingDetails.actionArgs['action'] === 'expand' || pageingDetails.actionArgs['action'] === 'collapse') && this.parent.grid.pageSettings.currentPage !== 1) {
|
|
12665
12716
|
current = 1;
|
|
12666
|
-
size = this.parent.pageSettings.pageSize * this.parent.grid.pageSettings.currentPage;
|
|
12717
|
+
size = this.parent.grid.pageSettings.pageSize * this.parent.grid.pageSettings.currentPage;
|
|
12667
12718
|
}
|
|
12668
12719
|
query = query.page(current, size);
|
|
12669
12720
|
}
|
|
@@ -12830,5 +12881,5 @@ class InfiniteScroll$1 {
|
|
|
12830
12881
|
* Export TreeGrid component
|
|
12831
12882
|
*/
|
|
12832
12883
|
|
|
12833
|
-
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 };
|
|
12884
|
+
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 };
|
|
12834
12885
|
//# sourceMappingURL=ej2-treegrid.es2015.js.map
|