@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
package/dist/global/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* filename: index.d.ts
|
|
3
|
-
* version : 20.2.
|
|
3
|
+
* version : 20.2.40
|
|
4
4
|
* Copyright Syncfusion Inc. 2001 - 2020. All rights reserved.
|
|
5
5
|
* Use of this code is subject to the terms of our license.
|
|
6
6
|
* A copy of the current license can be obtained at any time by e-mailing
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_from": "@syncfusion/ej2-treegrid@*",
|
|
3
|
-
"_id": "@syncfusion/ej2-treegrid@20.2.
|
|
3
|
+
"_id": "@syncfusion/ej2-treegrid@20.2.39",
|
|
4
4
|
"_inBundle": false,
|
|
5
|
-
"_integrity": "sha512-
|
|
5
|
+
"_integrity": "sha512-5rBNYV7TLamFp9Hc0N6hCtVjsqk1ZxtGLsP49vRZQRTAc2zps0a3OwOVsfGQkh6YTwyojMRNwsiV+GeHUXe+6w==",
|
|
6
6
|
"_location": "/@syncfusion/ej2-treegrid",
|
|
7
7
|
"_phantomChildren": {},
|
|
8
8
|
"_requested": {
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"/@syncfusion/ej2-react-treegrid",
|
|
25
25
|
"/@syncfusion/ej2-vue-treegrid"
|
|
26
26
|
],
|
|
27
|
-
"_resolved": "http://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-treegrid/-/ej2-treegrid-20.2.
|
|
28
|
-
"_shasum": "
|
|
27
|
+
"_resolved": "http://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-treegrid/-/ej2-treegrid-20.2.39.tgz",
|
|
28
|
+
"_shasum": "45ce481300501f03d225973a53a749b17c4fab18",
|
|
29
29
|
"_spec": "@syncfusion/ej2-treegrid@*",
|
|
30
30
|
"_where": "/jenkins/workspace/automation_release_19.1.0.1-ZPMUBNQ6AUYH6YGEFBPVYMEQLRRW2SLD4XCZ6GATNZJFYJ3RIAOA/packages/included",
|
|
31
31
|
"author": {
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
},
|
|
37
37
|
"bundleDependencies": false,
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@syncfusion/ej2-base": "~20.2.
|
|
39
|
+
"@syncfusion/ej2-base": "~20.2.39",
|
|
40
40
|
"@syncfusion/ej2-data": "~20.2.38",
|
|
41
|
-
"@syncfusion/ej2-grids": "~20.2.
|
|
42
|
-
"@syncfusion/ej2-popups": "~20.2.
|
|
41
|
+
"@syncfusion/ej2-grids": "~20.2.40",
|
|
42
|
+
"@syncfusion/ej2-popups": "~20.2.40"
|
|
43
43
|
},
|
|
44
44
|
"deprecated": false,
|
|
45
45
|
"description": "Essential JS 2 TreeGrid Component",
|
|
@@ -60,6 +60,6 @@
|
|
|
60
60
|
"url": "git+https://github.com/syncfusion/ej2-treegrid.git"
|
|
61
61
|
},
|
|
62
62
|
"typings": "index.d.ts",
|
|
63
|
-
"version": "20.2.
|
|
63
|
+
"version": "20.2.40",
|
|
64
64
|
"sideEffects": false
|
|
65
65
|
}
|
|
@@ -237,10 +237,11 @@ var BatchEdit = /** @class */ (function () {
|
|
|
237
237
|
this.parent.editModule[isTabLastRow] = false;
|
|
238
238
|
return;
|
|
239
239
|
}
|
|
240
|
-
if (this.parent.editModule['isAddedRowByMethod'] && !isNullOrUndefined(this.parent.editModule['addRowIndex']) &&
|
|
240
|
+
if (this.parent.editModule['isAddedRowByMethod'] && !isNullOrUndefined(this.parent.editModule['addRowIndex']) &&
|
|
241
|
+
!this.parent.editModule['isAddedRowByContextMenu'] && (this.parent.grid.selectedRowIndex === -1 || this.parent.editModule['batchEditModule'].isAdd)) {
|
|
241
242
|
this.selectedIndex = this.parent.editModule['selectedIndex'];
|
|
242
243
|
this.addRowIndex = this.parent.editModule['addRowIndex'];
|
|
243
|
-
this.addRowRecord = this.parent.getCurrentViewRecords()[this.selectedIndex];
|
|
244
|
+
this.addRowRecord = this.batchRecords.length ? this.batchRecords[this.selectedIndex] : this.parent.getCurrentViewRecords()[this.selectedIndex];
|
|
244
245
|
}
|
|
245
246
|
else {
|
|
246
247
|
this.selectedIndex = this.parent.grid.selectedRowIndex;
|
|
@@ -287,6 +288,11 @@ var BatchEdit = /** @class */ (function () {
|
|
|
287
288
|
// }
|
|
288
289
|
}
|
|
289
290
|
focusModule.getContent().matrix.current = [actualIndex, focusModule.getContent().matrix.current[1]];
|
|
291
|
+
if (this.parent.editModule['isAddedRowByMethod'] && !isNullOrUndefined(this.parent.editModule['addRowIndex']) && !this.parent.editModule['isAddedRowByContextMenu']) {
|
|
292
|
+
var newlyAddedRecords = this.parent.getBatchChanges()['addedRecords'];
|
|
293
|
+
var index = parseInt(this.parent.getContentTable().getElementsByClassName('e-insertedrow')[newlyAddedRecords.length - 1].getAttribute('data-rowindex'), 10);
|
|
294
|
+
this.batchRecords.splice(index, 0, newlyAddedRecords[newlyAddedRecords.length - 1]);
|
|
295
|
+
}
|
|
290
296
|
}
|
|
291
297
|
};
|
|
292
298
|
BatchEdit.prototype.beforeBatchDelete = function (args) {
|
|
@@ -312,7 +318,7 @@ var BatchEdit = /** @class */ (function () {
|
|
|
312
318
|
childs = findChildrenRecords(data);
|
|
313
319
|
uid = this.parent.getSelectedRows()[0].getAttribute('data-uid');
|
|
314
320
|
}
|
|
315
|
-
var parentRowIndex = parseInt(this.parent.grid.getRowElementByUID(uid).getAttribute('
|
|
321
|
+
var parentRowIndex = parseInt(this.parent.grid.getRowElementByUID(uid).getAttribute('data-rowindex'), 10);
|
|
316
322
|
if (childs.length) {
|
|
317
323
|
var totalCount = parentRowIndex + childs.length;
|
|
318
324
|
var firstChildIndex = parentRowIndex + 1;
|
|
@@ -349,7 +355,7 @@ var BatchEdit = /** @class */ (function () {
|
|
|
349
355
|
BatchEdit.prototype.updateRowIndex = function () {
|
|
350
356
|
var rows = this.parent.grid.getDataRows();
|
|
351
357
|
for (var i = 0; i < rows.length; i++) {
|
|
352
|
-
rows[i].setAttribute('
|
|
358
|
+
rows[i].setAttribute('data-rowindex', i.toString());
|
|
353
359
|
}
|
|
354
360
|
var freeze = (this.parent.getFrozenLeftColumnsCount() > 0 ||
|
|
355
361
|
this.parent.getFrozenRightColumnsCount() > 0) ? true : false;
|
|
@@ -357,9 +363,9 @@ var BatchEdit = /** @class */ (function () {
|
|
|
357
363
|
var mRows = this.parent.grid.getMovableDataRows();
|
|
358
364
|
var freezeRightRows = this.parent.grid.getFrozenRightDataRows();
|
|
359
365
|
for (var i = 0; i < mRows.length; i++) {
|
|
360
|
-
mRows[i].setAttribute('
|
|
366
|
+
mRows[i].setAttribute('data-rowindex', i.toString());
|
|
361
367
|
if (freeze) {
|
|
362
|
-
freezeRightRows[i].setAttribute('
|
|
368
|
+
freezeRightRows[i].setAttribute('data-rowindex', i.toString());
|
|
363
369
|
}
|
|
364
370
|
}
|
|
365
371
|
}
|
|
@@ -419,7 +425,9 @@ var BatchEdit = /** @class */ (function () {
|
|
|
419
425
|
if (!isNullOrUndefined(this.batchAddedRecords)) {
|
|
420
426
|
for (var i = 0; i < this.batchAddedRecords.length; i++) {
|
|
421
427
|
index = data.map(function (e) { return e[primaryKey]; }).indexOf(this.batchAddedRecords[i][primaryKey]);
|
|
422
|
-
|
|
428
|
+
if (index !== -1) {
|
|
429
|
+
data.splice(index, 1);
|
|
430
|
+
}
|
|
423
431
|
if (this.parent.editSettings.newRowPosition === 'Child') {
|
|
424
432
|
index = currentViewRecords.map(function (e) { return e[primaryKey]; })
|
|
425
433
|
.indexOf(this.batchAddedRecords[i][parentItem] ? this.batchAddedRecords[i][parentItem][primaryKey]
|
|
@@ -485,9 +493,12 @@ var BatchEdit = /** @class */ (function () {
|
|
|
485
493
|
}
|
|
486
494
|
if (this.parent.editSettings.newRowPosition !== 'Bottom' && !Object.hasOwnProperty.call(args, 'updatedRecords')) {
|
|
487
495
|
data.splice(data.length - addRecords.length, addRecords.length);
|
|
488
|
-
if (this.parent.editModule['isAddedRowByMethod'] && addRecords.length && !isNullOrUndefined(this.parent.editModule['addRowIndex'])) {
|
|
489
|
-
|
|
490
|
-
|
|
496
|
+
if (this.parent.editModule['isAddedRowByMethod'] && addRecords.length && !isNullOrUndefined(this.parent.editModule['addRowIndex']) && !this.parent.editModule['isAddedRowByContextMenu']) {
|
|
497
|
+
addRecords.reverse();
|
|
498
|
+
for (var i_1 = 0; i_1 < addRecords.length; i_1++) {
|
|
499
|
+
var index_1 = parseInt(this.parent.getContentTable().getElementsByClassName('e-insertedrow')[i_1].getAttribute('data-rowindex'), 10);
|
|
500
|
+
data.splice(index_1, 0, addRecords[i_1]);
|
|
501
|
+
}
|
|
491
502
|
}
|
|
492
503
|
if (!this.parent.allowPaging && data.length !== currentViewRecords.length) {
|
|
493
504
|
if (currentViewRecords.length > addRecords.length) {
|
|
@@ -507,6 +518,9 @@ var BatchEdit = /** @class */ (function () {
|
|
|
507
518
|
if (this.batchAddRowRecord.length === 0) {
|
|
508
519
|
this.batchAddRowRecord.push(this.parent.flatData[args.index]);
|
|
509
520
|
}
|
|
521
|
+
if (this.parent.editModule['isAddedRowByContextMenu']) {
|
|
522
|
+
addRecords.reverse();
|
|
523
|
+
}
|
|
510
524
|
for (i = 0; i < addRecords.length; i++) {
|
|
511
525
|
var taskData = extend({}, addRecords[i]);
|
|
512
526
|
delete taskData.parentItem;
|
|
@@ -519,6 +533,11 @@ var BatchEdit = /** @class */ (function () {
|
|
|
519
533
|
if (!isNullOrUndefined(taskData.primaryParent)) {
|
|
520
534
|
delete taskData.primaryParent;
|
|
521
535
|
}
|
|
536
|
+
if (addRecords.length > 1 && this.parent.editModule['isAddedRowByContextMenu']) {
|
|
537
|
+
var rowPosition = this.parent.editSettings.newRowPosition;
|
|
538
|
+
this.parent.editSettings.newRowPosition = this.parent.editModule['previousNewRowPosition'];
|
|
539
|
+
this.parent.editModule['previousNewRowPosition'] = rowPosition;
|
|
540
|
+
}
|
|
522
541
|
addRecords[i].taskData = taskData;
|
|
523
542
|
addRowRecord = this.batchAddRowRecord[i];
|
|
524
543
|
if (isNullOrUndefined(addRowRecord)) {
|
|
@@ -558,15 +577,18 @@ var BatchEdit = /** @class */ (function () {
|
|
|
558
577
|
}
|
|
559
578
|
}
|
|
560
579
|
this.parent.parentData = [];
|
|
561
|
-
for (var
|
|
562
|
-
data[
|
|
563
|
-
setValue('uniqueIDCollection.' + data[
|
|
564
|
-
if (!data[
|
|
565
|
-
this.parent.parentData.push(data[
|
|
580
|
+
for (var i_2 = 0; i_2 < data.length; i_2++) {
|
|
581
|
+
data[i_2][index] = i_2;
|
|
582
|
+
setValue('uniqueIDCollection.' + data[i_2][uniqueID] + '.index', i_2, this.parent);
|
|
583
|
+
if (!data[i_2][level]) {
|
|
584
|
+
this.parent.parentData.push(data[i_2]);
|
|
566
585
|
}
|
|
567
586
|
}
|
|
568
587
|
}
|
|
569
588
|
this.batchAddRowRecord = this.batchAddedRecords = this.batchRecords = this.batchDeletedRecords = this.currentViewRecords = [];
|
|
589
|
+
if (this.parent.editModule['isAddedRowByContextMenu']) {
|
|
590
|
+
this.parent.editModule['isAddedRowByContextMenu'] = false;
|
|
591
|
+
}
|
|
570
592
|
};
|
|
571
593
|
BatchEdit.prototype.getActualRowObjectIndex = function (index) {
|
|
572
594
|
var rows = this.parent.grid.getDataRows();
|
|
@@ -93,6 +93,7 @@ var ContextMenu = /** @class */ (function () {
|
|
|
93
93
|
if (args.item.id === 'Above' || args.item.id === 'Below' || args.item.id === 'Child') {
|
|
94
94
|
this.parent.notify('savePreviousRowPosition', args);
|
|
95
95
|
this.parent.setProperties({ editSettings: { newRowPosition: args.item.id } }, true);
|
|
96
|
+
this.parent.editModule['isAddedRowByContextMenu'] = true;
|
|
96
97
|
this.parent.addRecord();
|
|
97
98
|
}
|
|
98
99
|
if (args.item.id === this.parent.element.id + '_gridcontrol_cmenu_Indent' || args.item.id === this.parent.element.id + '_gridcontrol_cmenu_Outdent') {
|
|
@@ -21,6 +21,7 @@ var Edit = /** @class */ (function () {
|
|
|
21
21
|
this.deletedRecords = 'deletedRecords';
|
|
22
22
|
this.prevAriaRowIndex = '-1';
|
|
23
23
|
this.isAddedRowByMethod = false;
|
|
24
|
+
this.isAddedRowByContextMenu = false;
|
|
24
25
|
Grid.Inject(GridEdit);
|
|
25
26
|
this.parent = parent;
|
|
26
27
|
this.isSelfReference = !isNullOrUndefined(parent.parentIdMapping);
|
|
@@ -71,7 +72,7 @@ var Edit = /** @class */ (function () {
|
|
|
71
72
|
Edit.prototype.getRowPosition = function (addArgs) {
|
|
72
73
|
addArgs.newRowPosition = this.parent.editSettings.newRowPosition;
|
|
73
74
|
addArgs.addRowIndex = this.addRowIndex;
|
|
74
|
-
addArgs.
|
|
75
|
+
addArgs.dataRowIndex = +this.prevAriaRowIndex;
|
|
75
76
|
};
|
|
76
77
|
Edit.prototype.beforeStartEdit = function (args) {
|
|
77
78
|
this.parent.trigger(events.actionBegin, args);
|
|
@@ -227,7 +228,7 @@ var Edit = /** @class */ (function () {
|
|
|
227
228
|
if (!(this.parent.grid.editSettings.allowEditing) || this.parent.grid.isEdit) {
|
|
228
229
|
return;
|
|
229
230
|
}
|
|
230
|
-
var column = this.parent.grid.getColumnByIndex(+target.closest('td.e-rowcell').getAttribute('
|
|
231
|
+
var column = this.parent.grid.getColumnByIndex(+target.closest('td.e-rowcell').getAttribute('data-colindex'));
|
|
231
232
|
if (this.parent.editSettings.mode === 'Cell' && !this.isOnBatch && column && !column.isPrimaryKey &&
|
|
232
233
|
this.parent.editSettings.allowEditing && column.allowEditing && !(target.classList.contains('e-treegridexpand') ||
|
|
233
234
|
target.classList.contains('e-treegridcollapse')) && this.parent.editSettings.allowEditOnDblClick) {
|
|
@@ -235,8 +236,8 @@ var Edit = /** @class */ (function () {
|
|
|
235
236
|
this.parent.grid.setProperties({ selectedRowIndex: args.rowIndex }, true);
|
|
236
237
|
if (this.parent.enableVirtualization) {
|
|
237
238
|
var tr = parentsUntil(args.target, 'e-row');
|
|
238
|
-
this.prevAriaRowIndex = tr.getAttribute('
|
|
239
|
-
tr.setAttribute('
|
|
239
|
+
this.prevAriaRowIndex = tr.getAttribute('data-rowindex');
|
|
240
|
+
tr.setAttribute('data-rowindex', tr.rowIndex + '');
|
|
240
241
|
}
|
|
241
242
|
this.updateGridEditMode('Batch');
|
|
242
243
|
}
|
|
@@ -276,7 +277,7 @@ var Edit = /** @class */ (function () {
|
|
|
276
277
|
var prom = args[promise];
|
|
277
278
|
delete args[promise];
|
|
278
279
|
if (this.parent.enableVirtualization && !isNullOrUndefined(this.prevAriaRowIndex) && this.prevAriaRowIndex !== '-1') {
|
|
279
|
-
args.row.setAttribute('
|
|
280
|
+
args.row.setAttribute('data-rowindex', this.prevAriaRowIndex);
|
|
280
281
|
this.prevAriaRowIndex = undefined;
|
|
281
282
|
}
|
|
282
283
|
if (this.keyPress !== 'enter') {
|
|
@@ -612,8 +613,8 @@ var Edit = /** @class */ (function () {
|
|
|
612
613
|
}
|
|
613
614
|
}
|
|
614
615
|
var rows = this.parent.grid.getDataRows();
|
|
615
|
-
var firstAriaIndex = rows.length ? +rows[0].getAttribute('
|
|
616
|
-
var lastAriaIndex = rows.length ? +rows[rows.length - 1].getAttribute('
|
|
616
|
+
var firstAriaIndex = rows.length ? +rows[0].getAttribute('data-rowindex') : 0;
|
|
617
|
+
var lastAriaIndex = rows.length ? +rows[rows.length - 1].getAttribute('data-rowindex') : 0;
|
|
617
618
|
var withinRange = this.selectedIndex >= firstAriaIndex && this.selectedIndex <= lastAriaIndex;
|
|
618
619
|
var isVirtualization = this.parent.enableVirtualization && this.addRowIndex > -1 && this.prevAriaRowIndex !== '-1';
|
|
619
620
|
if (this.parent.editSettings.mode !== 'Dialog') {
|
|
@@ -683,20 +684,27 @@ var Edit = /** @class */ (function () {
|
|
|
683
684
|
focussedElement.focus();
|
|
684
685
|
}
|
|
685
686
|
}
|
|
686
|
-
if (this.parent.editSettings.mode === 'Batch' && !isNullOrUndefined(this.addRowIndex) && this.addRowIndex !== -1) {
|
|
687
|
+
if (this.parent.editSettings.mode === 'Batch' && !isNullOrUndefined(this.addRowIndex) && this.addRowIndex !== -1 && this['isAddedRowByMethod'] && !this.isAddedRowByContextMenu) {
|
|
687
688
|
index = this.batchEditModule.getAddRowIndex();
|
|
688
689
|
this.selectedIndex = this.batchEditModule.getSelectedIndex();
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
this.parent.editModule.batchEditModule['batchAddRowRecord'].push(this.parent.editModule.batchEditModule['addRowRecord']);
|
|
698
|
-
this.parent.editModule.batchEditModule['batchAddedRecords'].push(args['data']);
|
|
690
|
+
var batchAddedRecords = this.parent.getBatchChanges()['addedRecords'];
|
|
691
|
+
var newlyAddedRecord = void 0;
|
|
692
|
+
if (batchAddedRecords.length) {
|
|
693
|
+
for (var i = 0; i < batchAddedRecords.length; i++) {
|
|
694
|
+
if (isNullOrUndefined(batchAddedRecords[i].uniqueID)) {
|
|
695
|
+
newlyAddedRecord = batchAddedRecords[i];
|
|
696
|
+
}
|
|
697
|
+
}
|
|
699
698
|
}
|
|
699
|
+
var args = {
|
|
700
|
+
action: 'add',
|
|
701
|
+
data: newlyAddedRecord,
|
|
702
|
+
index: index,
|
|
703
|
+
seletedRow: 0
|
|
704
|
+
};
|
|
705
|
+
this.beginAddEdit(args);
|
|
706
|
+
this.batchEditModule['batchAddRowRecord'].push(this.batchEditModule['addRowRecord']);
|
|
707
|
+
this.batchEditModule['batchAddedRecords'].push(args['data']);
|
|
700
708
|
}
|
|
701
709
|
};
|
|
702
710
|
// private beforeDataBound(args: BeforeDataBoundArgs): void {
|
|
@@ -763,7 +771,7 @@ var Edit = /** @class */ (function () {
|
|
|
763
771
|
this.selectedIndex = this.parent.grid.selectedRowIndex;
|
|
764
772
|
}
|
|
765
773
|
if (this.parent.enableVirtualization) {
|
|
766
|
-
var selector = '.e-row[
|
|
774
|
+
var selector = '.e-row[data-rowindex="' + this.selectedIndex + '"]';
|
|
767
775
|
var row = void 0;
|
|
768
776
|
if (this.selectedIndex > -1 && this.parent.editSettings.newRowPosition !== 'Top' &&
|
|
769
777
|
this.parent.editSettings.newRowPosition !== 'Bottom') {
|
|
@@ -773,7 +781,7 @@ var Edit = /** @class */ (function () {
|
|
|
773
781
|
}
|
|
774
782
|
else {
|
|
775
783
|
if (this.prevAriaRowIndex && this.prevAriaRowIndex !== '-1') {
|
|
776
|
-
selector = '.e-row[
|
|
784
|
+
selector = '.e-row[data-rowindex="' + this.prevAriaRowIndex + '"]';
|
|
777
785
|
row = this.parent.getContent().querySelector(selector);
|
|
778
786
|
this.addRowIndex = row ? row.rowIndex : 0;
|
|
779
787
|
}
|
|
@@ -832,10 +840,16 @@ var Edit = /** @class */ (function () {
|
|
|
832
840
|
var key = this.parent.grid.getPrimaryKeyFieldNames()[0];
|
|
833
841
|
var position = null;
|
|
834
842
|
value.taskData = isNullOrUndefined(value.taskData) ? extend({}, args.data) : value.taskData;
|
|
835
|
-
var currentData =
|
|
843
|
+
var currentData = void 0;
|
|
844
|
+
if (this.parent.editSettings.mode === 'Batch' && this['isAddedRowByMethod'] && !isNullOrUndefined(this.addRowIndex)) {
|
|
845
|
+
currentData = this.batchEditModule['batchRecords'];
|
|
846
|
+
}
|
|
847
|
+
else {
|
|
848
|
+
currentData = this.parent.grid.getCurrentViewRecords();
|
|
849
|
+
}
|
|
836
850
|
if (this.parent.enableVirtualization && args.index !== 0) {
|
|
837
851
|
this.addRowIndex = this.parent.grid.getCurrentViewRecords().indexOf(this.addRowRecord);
|
|
838
|
-
this.selectedIndex = parseInt(this.parent.getRows()[this.addRowIndex].getAttribute('
|
|
852
|
+
this.selectedIndex = parseInt(this.parent.getRows()[this.addRowIndex].getAttribute('data-rowindex'), 10);
|
|
839
853
|
}
|
|
840
854
|
var index = this.addRowIndex;
|
|
841
855
|
value.uniqueID = getUid(this.parent.element.id + '_data_');
|
|
@@ -848,7 +862,7 @@ var Edit = /** @class */ (function () {
|
|
|
848
862
|
var isVirtualization = this.parent.enableVirtualization && this.addRowIndex > -1 && this.prevAriaRowIndex !== '-1';
|
|
849
863
|
var rows = this.parent.getRows();
|
|
850
864
|
var firstAriaIndex = rows.length ? currentData.indexOf(currentData[0]) : 0;
|
|
851
|
-
var lastAriaIndex = rows.length ? +rows[rows.length - 1].getAttribute('
|
|
865
|
+
var lastAriaIndex = rows.length ? +rows[rows.length - 1].getAttribute('data-rowindex') : 0;
|
|
852
866
|
var withinRange = this.selectedIndex >= firstAriaIndex && this.selectedIndex <= lastAriaIndex;
|
|
853
867
|
if (currentData.length) {
|
|
854
868
|
idMapping = currentData[this.addRowIndex][this.parent.idMapping];
|
|
@@ -137,6 +137,9 @@ var InfiniteScroll = /** @class */ (function () {
|
|
|
137
137
|
});
|
|
138
138
|
var actionArgs = getValue('actionArgs', pageingDetails.actionArgs);
|
|
139
139
|
var actions = getValue('actions', this.parent.grid.infiniteScrollModule);
|
|
140
|
+
if (this.parent.grid.infiniteScrollModule['isInitialRender'] && !this.parent.initialRender) {
|
|
141
|
+
this.parent.grid.pageSettings.currentPage = 1;
|
|
142
|
+
}
|
|
140
143
|
var initial = actions.some(function (value) { return value === actionArgs.requestType; });
|
|
141
144
|
var initialRender = initial ? true : this.parent.initialRender ? true : false;
|
|
142
145
|
this.visualData = visualData;
|
|
@@ -151,8 +154,8 @@ var InfiniteScroll = /** @class */ (function () {
|
|
|
151
154
|
this.parent.infiniteScrollSettings.initialBlocks = this.parent.infiniteScrollSettings.maxBlocks;
|
|
152
155
|
}
|
|
153
156
|
var size = initialRender ?
|
|
154
|
-
this.parent.pageSettings.pageSize * this.parent.infiniteScrollSettings.initialBlocks :
|
|
155
|
-
this.parent.pageSettings.pageSize;
|
|
157
|
+
this.parent.grid.pageSettings.pageSize * this.parent.infiniteScrollSettings.initialBlocks :
|
|
158
|
+
this.parent.grid.pageSettings.pageSize;
|
|
156
159
|
var current = this.parent.grid.pageSettings.currentPage;
|
|
157
160
|
if (!isNullOrUndefined(actionArgs)) {
|
|
158
161
|
var lastIndex = getValue('lastIndex', this.parent.grid.infiniteScrollModule);
|
|
@@ -170,7 +173,7 @@ var InfiniteScroll = /** @class */ (function () {
|
|
|
170
173
|
else {
|
|
171
174
|
if ((pageingDetails.actionArgs['action'] === 'expand' || pageingDetails.actionArgs['action'] === 'collapse') && this.parent.grid.pageSettings.currentPage !== 1) {
|
|
172
175
|
current = 1;
|
|
173
|
-
size = this.parent.pageSettings.pageSize * this.parent.grid.pageSettings.currentPage;
|
|
176
|
+
size = this.parent.grid.pageSettings.pageSize * this.parent.grid.pageSettings.currentPage;
|
|
174
177
|
}
|
|
175
178
|
query = query.page(current, size);
|
|
176
179
|
}
|
|
@@ -190,7 +190,7 @@ var RowDD = /** @class */ (function () {
|
|
|
190
190
|
dropIndex = this.selectedRow.rowIndex - 1;
|
|
191
191
|
}
|
|
192
192
|
if (this.parent.enableVirtualization && this.parent.allowRowDragAndDrop && this.selectedRecord) {
|
|
193
|
-
dropIndex = parseInt(this.selectedRow.getAttribute('
|
|
193
|
+
dropIndex = parseInt(this.selectedRow.getAttribute('data-rowindex'), 10) - 1;
|
|
194
194
|
}
|
|
195
195
|
tObj[action] = 'indenting';
|
|
196
196
|
tObj[droppedIndex] = dropIndex;
|
|
@@ -209,7 +209,7 @@ var RowDD = /** @class */ (function () {
|
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
211
|
if (this.parent.enableVirtualization && this.parent.allowRowDragAndDrop && this.selectedRecord) {
|
|
212
|
-
dropIndex = parseInt(this.parent.getRows()[dropIndex].getAttribute('
|
|
212
|
+
dropIndex = parseInt(this.parent.getRows()[dropIndex].getAttribute('data-rowindex'), 10);
|
|
213
213
|
}
|
|
214
214
|
tObj[action] = 'outdenting';
|
|
215
215
|
tObj[droppedIndex] = dropIndex;
|
|
@@ -229,7 +229,7 @@ var RowDD = /** @class */ (function () {
|
|
|
229
229
|
if (!actionArgs.cancel) {
|
|
230
230
|
if (actionArgs.action === 'indenting') {
|
|
231
231
|
if (_this.parent.enableVirtualization && _this.parent.allowRowDragAndDrop) {
|
|
232
|
-
_this.reorderRows([parseInt(_this.selectedRow.getAttribute('
|
|
232
|
+
_this.reorderRows([parseInt(_this.selectedRow.getAttribute('data-rowindex'), 10)], dropIndex, 'child');
|
|
233
233
|
}
|
|
234
234
|
else {
|
|
235
235
|
_this.reorderRows([_this.selectedRow.rowIndex], dropIndex, 'child');
|
|
@@ -237,7 +237,7 @@ var RowDD = /** @class */ (function () {
|
|
|
237
237
|
}
|
|
238
238
|
else if (actionArgs.action === 'outdenting') {
|
|
239
239
|
if (_this.parent.enableVirtualization && _this.parent.allowRowDragAndDrop) {
|
|
240
|
-
_this.reorderRows([parseInt(_this.selectedRow.getAttribute('
|
|
240
|
+
_this.reorderRows([parseInt(_this.selectedRow.getAttribute('data-rowindex'), 10)], dropIndex, 'below');
|
|
241
241
|
}
|
|
242
242
|
else {
|
|
243
243
|
_this.reorderRows([_this.selectedRow.rowIndex], dropIndex, 'below');
|
|
@@ -863,7 +863,7 @@ var RowDD = /** @class */ (function () {
|
|
|
863
863
|
}
|
|
864
864
|
};
|
|
865
865
|
RowDD.prototype.getTargetIdx = function (targetRow) {
|
|
866
|
-
return targetRow ? parseInt(targetRow.getAttribute('
|
|
866
|
+
return targetRow ? parseInt(targetRow.getAttribute('data-rowindex'), 10) : 0;
|
|
867
867
|
};
|
|
868
868
|
RowDD.prototype.getParentData = function (record, data) {
|
|
869
869
|
var parentItem = record.parentItem;
|
|
@@ -440,7 +440,7 @@ var Selection = /** @class */ (function () {
|
|
|
440
440
|
childData = (!isNullOrUndefined(this.parent.filterModule) && this.parent.filterModule.filteredResult.length > 0) ?
|
|
441
441
|
this.parent.getCurrentViewRecords() : this.parent.flatData;
|
|
442
442
|
childData.forEach(function (record) {
|
|
443
|
-
if (_this.parent.enableVirtualization) {
|
|
443
|
+
if (_this.parent.enableVirtualization && record.childRecords.length > 0) {
|
|
444
444
|
if (record.hasChildRecords) {
|
|
445
445
|
_this.updateParentSelection(record);
|
|
446
446
|
}
|
|
@@ -1222,6 +1222,7 @@ export declare class TreeGrid extends Component<HTMLElement> implements INotifyP
|
|
|
1222
1222
|
private convertTreeData;
|
|
1223
1223
|
private bindGridProperties;
|
|
1224
1224
|
private triggerEvents;
|
|
1225
|
+
private IsExpandCollapseClicked;
|
|
1225
1226
|
private bindGridEvents;
|
|
1226
1227
|
private lastRowBorder;
|
|
1227
1228
|
private isPixelHeight;
|
|
@@ -743,16 +743,23 @@ var TreeGrid = /** @class */ (function (_super) {
|
|
|
743
743
|
TreeGrid.prototype.triggerEvents = function (args) {
|
|
744
744
|
this.trigger(getObject('name', args), args);
|
|
745
745
|
};
|
|
746
|
+
TreeGrid.prototype.IsExpandCollapseClicked = function (args) {
|
|
747
|
+
if (!isNullOrUndefined(args.target) && (args.target.classList.contains('e-treegridexpand')
|
|
748
|
+
|| args.target.classList.contains('e-treegridcollapse') || args.target.classList.contains('e-summarycell'))) {
|
|
749
|
+
args.cancel = true;
|
|
750
|
+
return;
|
|
751
|
+
}
|
|
752
|
+
};
|
|
746
753
|
TreeGrid.prototype.bindGridEvents = function () {
|
|
747
754
|
var _this = this;
|
|
748
755
|
this.grid.rowSelecting = function (args) {
|
|
749
|
-
|
|
750
|
-
|| args.target.classList.contains('e-treegridcollapse') || args.target.classList.contains('e-summarycell'))) {
|
|
751
|
-
args.cancel = true;
|
|
752
|
-
return;
|
|
753
|
-
}
|
|
756
|
+
_this.IsExpandCollapseClicked(args);
|
|
754
757
|
_this.trigger(events.rowSelecting, args);
|
|
755
758
|
};
|
|
759
|
+
this.grid.rowDeselecting = function (args) {
|
|
760
|
+
_this.IsExpandCollapseClicked(args);
|
|
761
|
+
_this.trigger(events.rowDeselecting, args);
|
|
762
|
+
};
|
|
756
763
|
this.grid.rowSelected = function (args) {
|
|
757
764
|
if (_this.enableVirtualization && args.isHeaderCheckboxClicked &&
|
|
758
765
|
_this.grid.currentViewData.length !== _this.grid.selectionModule.selectedRowIndexes.length) {
|
|
@@ -2537,7 +2544,7 @@ var TreeGrid = /** @class */ (function (_super) {
|
|
|
2537
2544
|
}
|
|
2538
2545
|
else if (isNullOrUndefined(record)) {
|
|
2539
2546
|
if (this.detailTemplate) {
|
|
2540
|
-
record = this.grid.getCurrentViewRecords()[row.getAttribute('
|
|
2547
|
+
record = this.grid.getCurrentViewRecords()[row.getAttribute('data-rowindex')];
|
|
2541
2548
|
}
|
|
2542
2549
|
else {
|
|
2543
2550
|
record = this.grid.getCurrentViewRecords()[row.rowIndex];
|
|
@@ -2815,7 +2822,7 @@ var TreeGrid = /** @class */ (function (_super) {
|
|
|
2815
2822
|
row = gridRows[rowIndex];
|
|
2816
2823
|
}
|
|
2817
2824
|
else {
|
|
2818
|
-
rowIndex = +row.getAttribute('
|
|
2825
|
+
rowIndex = +row.getAttribute('data-rowindex');
|
|
2819
2826
|
}
|
|
2820
2827
|
if (!isNullOrUndefined(row)) {
|
|
2821
2828
|
row.setAttribute('aria-expanded', action === 'expand' ? 'true' : 'false');
|
|
@@ -227,7 +227,7 @@ var Render = /** @class */ (function () {
|
|
|
227
227
|
var templateFn = 'templateFn';
|
|
228
228
|
var colindex = args.column.index;
|
|
229
229
|
if (isNullOrUndefined(treeColumn.field)) {
|
|
230
|
-
args.cell.setAttribute('
|
|
230
|
+
args.cell.setAttribute('data-colindex', colindex + '');
|
|
231
231
|
}
|
|
232
232
|
if (treeColumn.field === args.column.field && !isNullOrUndefined(treeColumn.template)) {
|
|
233
233
|
args.column.template = treeColumn.template;
|
|
@@ -11,7 +11,7 @@ export declare class VirtualTreeContentRenderer extends VirtualContentRenderer {
|
|
|
11
11
|
private maxiPage;
|
|
12
12
|
private rowPosition;
|
|
13
13
|
private addRowIndex;
|
|
14
|
-
private
|
|
14
|
+
private dataRowIndex;
|
|
15
15
|
private recordAdded;
|
|
16
16
|
/** @hidden */
|
|
17
17
|
startIndex: number;
|
|
@@ -41,7 +41,7 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
|
|
|
41
41
|
return new TreeVirtualRowModelGenerator(this.parent);
|
|
42
42
|
};
|
|
43
43
|
VirtualTreeContentRenderer.prototype.getRowByIndex = function (index) {
|
|
44
|
-
return this.parent.getDataRows().filter(function (e) { return parseInt(e.getAttribute('
|
|
44
|
+
return this.parent.getDataRows().filter(function (e) { return parseInt(e.getAttribute('data-rowindex'), 10) === index; })[0];
|
|
45
45
|
};
|
|
46
46
|
VirtualTreeContentRenderer.prototype.addEventListener = function () {
|
|
47
47
|
this.parent.on(events.virtualActionArgs, this.virtualOtherAction, this);
|
|
@@ -220,7 +220,7 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
|
|
|
220
220
|
return new Cell(opt);
|
|
221
221
|
};
|
|
222
222
|
VirtualTreeContentRenderer.prototype.beginEdit = function (e) {
|
|
223
|
-
var selector = '.e-row[
|
|
223
|
+
var selector = '.e-row[data-rowindex="' + e.index + '"]';
|
|
224
224
|
var index = this.parent.getContent().querySelector(selector).rowIndex;
|
|
225
225
|
var rowData = this.parent.getCurrentViewRecords()[index];
|
|
226
226
|
e.data = rowData;
|
|
@@ -228,14 +228,14 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
|
|
|
228
228
|
VirtualTreeContentRenderer.prototype.beginAdd = function (args) {
|
|
229
229
|
var addAction = 'addActionBegin';
|
|
230
230
|
var isAdd = 'isAdd';
|
|
231
|
-
var addArgs = { newRowPosition: this.rowPosition, addRowIndex: this.addRowIndex,
|
|
231
|
+
var addArgs = { newRowPosition: this.rowPosition, addRowIndex: this.addRowIndex, dataRowIndex: this.dataRowIndex };
|
|
232
232
|
this.parent.notify('get-row-position', addArgs);
|
|
233
233
|
this.rowPosition = addArgs.newRowPosition;
|
|
234
234
|
this.addRowIndex = addArgs.addRowIndex;
|
|
235
|
-
this.
|
|
235
|
+
this.dataRowIndex = addArgs.dataRowIndex;
|
|
236
236
|
var rows = this.parent.getRows();
|
|
237
|
-
var firstAriaIndex = rows.length ? +rows[0].getAttribute('
|
|
238
|
-
var lastAriaIndex = rows.length ? +rows[rows.length - 1].getAttribute('
|
|
237
|
+
var firstAriaIndex = rows.length ? +rows[0].getAttribute('data-rowindex') : 0;
|
|
238
|
+
var lastAriaIndex = rows.length ? +rows[rows.length - 1].getAttribute('data-rowindex') : 0;
|
|
239
239
|
var withInRange = this.parent.selectedRowIndex >= firstAriaIndex && this.parent.selectedRowIndex <= lastAriaIndex;
|
|
240
240
|
if (!(this.rowPosition === 'Top' || this.rowPosition === 'Bottom')) {
|
|
241
241
|
this[isAdd] = true;
|
|
@@ -286,11 +286,11 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
|
|
|
286
286
|
};
|
|
287
287
|
VirtualTreeContentRenderer.prototype.onActionComplete = function (args) {
|
|
288
288
|
if (args.requestType === 'add') {
|
|
289
|
-
var addArgs = { newRowPosition: this.rowPosition, addRowIndex: this.addRowIndex,
|
|
289
|
+
var addArgs = { newRowPosition: this.rowPosition, addRowIndex: this.addRowIndex, dataRowIndex: this.dataRowIndex };
|
|
290
290
|
this.parent.notify('get-row-position', addArgs);
|
|
291
291
|
this.rowPosition = addArgs.newRowPosition;
|
|
292
292
|
this.addRowIndex = addArgs.addRowIndex;
|
|
293
|
-
this.
|
|
293
|
+
this.dataRowIndex = addArgs.dataRowIndex;
|
|
294
294
|
}
|
|
295
295
|
var actionComplete = 'actionComplete';
|
|
296
296
|
_super.prototype[actionComplete].call(this, args);
|
|
@@ -353,7 +353,7 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
|
|
|
353
353
|
!isNullOrUndefined(this.parent.getContent().querySelectorAll('.e-content tr')[rowPt])) {
|
|
354
354
|
var attr = this.parent.getContent().querySelectorAll('.e-content tr')[rowPt]
|
|
355
355
|
.querySelector('td').getAttribute('index');
|
|
356
|
-
firsttdinx = +attr; // this.parent.getContent().querySelector('.e-content tr').getAttribute('
|
|
356
|
+
firsttdinx = +attr; // this.parent.getContent().querySelector('.e-content tr').getAttribute('data-rowindex');
|
|
357
357
|
}
|
|
358
358
|
if (firsttdinx === 0) {
|
|
359
359
|
if (this.parent.allowRowDragAndDrop) {
|
|
@@ -452,7 +452,7 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
|
|
|
452
452
|
var isAdd = 'isAdd';
|
|
453
453
|
if (this[isAdd] && !this.parent.getContent().querySelector('.e-content').querySelector('.e-addedrow')) {
|
|
454
454
|
if (!(this.rowPosition === 'Top' || this.rowPosition === 'Bottom')) {
|
|
455
|
-
if (this.
|
|
455
|
+
if (this.dataRowIndex >= this.startIndex) {
|
|
456
456
|
this.restoreNewRow();
|
|
457
457
|
}
|
|
458
458
|
else if (this.addRowIndex && this.addRowIndex > -1) {
|
package/src/treegrid/utils.js
CHANGED
|
@@ -121,7 +121,7 @@ export function findChildrenRecords(records) {
|
|
|
121
121
|
return [];
|
|
122
122
|
}
|
|
123
123
|
if (!isNullOrUndefined(records.childRecords)) {
|
|
124
|
-
var childRecords = records.childRecords;
|
|
124
|
+
var childRecords = records.childRecords.filter(function (items) { return !items.isSummaryRow; });
|
|
125
125
|
var keys = Object.keys(childRecords);
|
|
126
126
|
for (var i = 0, len = keys.length; i < len; i++) {
|
|
127
127
|
datas.push(childRecords[i]);
|