@syncfusion/ej2-treegrid 25.2.5 → 26.1.35-469198
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/.eslintrc.json +243 -259
- package/README.md +83 -83
- package/dist/ej2-treegrid.min.js +1 -10
- package/dist/ej2-treegrid.umd.min.js +1 -10
- package/dist/ej2-treegrid.umd.min.js.map +1 -1
- package/dist/es6/ej2-treegrid.es2015.js +706 -532
- package/dist/es6/ej2-treegrid.es2015.js.map +1 -1
- package/dist/es6/ej2-treegrid.es5.js +1222 -1047
- package/dist/es6/ej2-treegrid.es5.js.map +1 -1
- package/dist/global/ej2-treegrid.min.js +1 -10
- package/dist/global/ej2-treegrid.min.js.map +1 -1
- package/dist/global/index.d.ts +0 -9
- package/dist/ts/undefined +602 -0
- package/license +9 -9
- package/package.json +70 -70
- package/src/treegrid/actions/clipboard.js +13 -13
- package/src/treegrid/actions/edit.js +8 -7
- package/src/treegrid/actions/excel-export.js +4 -3
- package/src/treegrid/actions/logger.js +13 -13
- package/src/treegrid/actions/page.js +4 -0
- package/src/treegrid/actions/rowdragdrop.js +29 -14
- package/src/treegrid/actions/selection.js +4 -1
- package/src/treegrid/actions/virtual-scroll.js +13 -13
- package/src/treegrid/base/constant.js +2 -0
- package/src/treegrid/base/data.js +2 -1
- package/src/treegrid/base/interface.js +0 -1
- package/src/treegrid/base/treegrid-model.d.ts +875 -875
- package/src/treegrid/base/treegrid.js +260 -92
- package/src/treegrid/models/column-model.d.ts +6 -6
- package/src/treegrid/models/column.js +19 -19
- package/src/treegrid/models/edit-settings-model.d.ts +72 -72
- package/src/treegrid/models/edit-settings.js +19 -19
- package/src/treegrid/models/filter-settings-model.d.ts +206 -206
- package/src/treegrid/models/filter-settings.js +19 -19
- package/src/treegrid/models/infinite-scroll-settings-model.d.ts +16 -16
- package/src/treegrid/models/infinite-scroll-settings.js +19 -19
- package/src/treegrid/models/loading-indicator.js +19 -19
- package/src/treegrid/models/page-settings-model.d.ts +46 -46
- package/src/treegrid/models/page-settings.js +19 -19
- package/src/treegrid/models/rowdrop-settings-model.d.ts +6 -6
- package/src/treegrid/models/rowdrop-settings.js +19 -19
- package/src/treegrid/models/search-settings-model.d.ts +60 -60
- package/src/treegrid/models/search-settings.js +19 -19
- package/src/treegrid/models/selection-settings-model.d.ts +66 -66
- package/src/treegrid/models/selection-settings.js +19 -19
- package/src/treegrid/models/sort-settings-model.d.ts +24 -24
- package/src/treegrid/models/sort-settings.js +19 -19
- package/src/treegrid/models/summary-model.d.ts +64 -64
- package/src/treegrid/models/summary.js +19 -19
- package/src/treegrid/models/textwrap-settings-model.d.ts +9 -9
- package/src/treegrid/models/textwrap-settings.js +19 -19
- package/src/treegrid/renderer/render.js +3 -1
- package/src/treegrid/renderer/virtual-row-model-generator.js +15 -15
- package/src/treegrid/renderer/virtual-tree-content-render.js +15 -14
- package/styles/bds-lite.css +745 -0
- package/styles/bds-lite.scss +18 -0
- package/styles/bds.css +765 -0
- package/styles/bds.scss +19 -0
- package/styles/bootstrap-dark-lite.css +506 -0
- package/styles/bootstrap-dark-lite.scss +18 -0
- package/styles/bootstrap-dark.css +187 -117
- package/styles/bootstrap-dark.scss +19 -1
- package/styles/bootstrap-lite.css +509 -0
- package/styles/bootstrap-lite.scss +18 -0
- package/styles/bootstrap.css +190 -121
- package/styles/bootstrap.scss +19 -1
- package/styles/bootstrap4-lite.css +550 -0
- package/styles/bootstrap4-lite.scss +18 -0
- package/styles/bootstrap4.css +194 -133
- package/styles/bootstrap4.scss +19 -1
- package/styles/bootstrap5-dark-lite.css +545 -0
- package/styles/bootstrap5-dark-lite.scss +18 -0
- package/styles/bootstrap5-dark.css +189 -123
- package/styles/bootstrap5-dark.scss +19 -1
- package/styles/bootstrap5-lite.css +545 -0
- package/styles/bootstrap5-lite.scss +18 -0
- package/styles/bootstrap5.3-lite.css +1637 -0
- package/styles/bootstrap5.3-lite.scss +18 -0
- package/styles/bootstrap5.3.css +1657 -0
- package/styles/bootstrap5.3.scss +19 -0
- package/styles/bootstrap5.css +188 -122
- package/styles/bootstrap5.scss +19 -1
- package/styles/fabric-dark-lite.css +485 -0
- package/styles/fabric-dark-lite.scss +18 -0
- package/styles/fabric-dark.css +188 -118
- package/styles/fabric-dark.scss +19 -1
- package/styles/fabric-lite.css +485 -0
- package/styles/fabric-lite.scss +18 -0
- package/styles/fabric.css +188 -111
- package/styles/fabric.scss +19 -1
- package/styles/fluent-dark-lite.css +548 -0
- package/styles/fluent-dark-lite.scss +18 -0
- package/styles/fluent-dark.css +195 -116
- package/styles/fluent-dark.scss +19 -1
- package/styles/fluent-lite.css +548 -0
- package/styles/fluent-lite.scss +18 -0
- package/styles/fluent.css +195 -116
- package/styles/fluent.scss +19 -1
- package/styles/fluent2-lite.css +1856 -0
- package/styles/fluent2-lite.scss +18 -0
- package/styles/fluent2.css +1879 -0
- package/styles/fluent2.scss +19 -0
- package/styles/highcontrast-light-lite.css +491 -0
- package/styles/highcontrast-light-lite.scss +18 -0
- package/styles/highcontrast-light.css +185 -103
- package/styles/highcontrast-light.scss +19 -1
- package/styles/highcontrast-lite.css +498 -0
- package/styles/highcontrast-lite.scss +18 -0
- package/styles/highcontrast.css +196 -107
- package/styles/highcontrast.scss +19 -1
- package/styles/material-dark-lite.css +567 -0
- package/styles/material-dark-lite.scss +18 -0
- package/styles/material-dark.css +220 -105
- package/styles/material-dark.scss +19 -1
- package/styles/material-lite.css +591 -0
- package/styles/material-lite.scss +18 -0
- package/styles/material.css +234 -129
- package/styles/material.scss +19 -1
- package/styles/material3-dark-lite.css +1666 -0
- package/styles/material3-dark-lite.scss +18 -0
- package/styles/material3-dark.css +1310 -187
- package/styles/material3-dark.scss +19 -1
- package/styles/material3-lite.css +1668 -0
- package/styles/material3-lite.scss +18 -0
- package/styles/material3.css +1311 -242
- package/styles/material3.scss +19 -1
- package/styles/tailwind-dark-lite.css +518 -0
- package/styles/tailwind-dark-lite.scss +18 -0
- package/styles/tailwind-dark.css +196 -103
- package/styles/tailwind-dark.scss +19 -1
- package/styles/tailwind-lite.css +518 -0
- package/styles/tailwind-lite.scss +18 -0
- package/styles/tailwind.css +196 -103
- package/styles/tailwind.scss +19 -1
- package/styles/tailwind3-lite.css +1697 -0
- package/styles/tailwind3-lite.scss +18 -0
- package/styles/tailwind3.css +1717 -0
- package/styles/tailwind3.scss +19 -0
- package/styles/treegrid/_all.scss +2 -2
- package/styles/treegrid/_bds-definition.scss +49 -28
- package/styles/treegrid/_bigger.scss +66 -0
- package/styles/treegrid/_bootstrap-dark-definition.scss +54 -30
- package/styles/treegrid/_bootstrap-definition.scss +54 -30
- package/styles/treegrid/_bootstrap4-definition.scss +54 -30
- package/styles/treegrid/_bootstrap5-definition.scss +49 -28
- package/styles/treegrid/_bootstrap5.3-definition.scss +49 -0
- package/styles/treegrid/_fabric-dark-definition.scss +54 -30
- package/styles/treegrid/_fabric-definition.scss +54 -30
- package/styles/treegrid/_fluent-definition.scss +50 -29
- package/styles/treegrid/_fluent2-definition.scss +49 -0
- package/styles/treegrid/_fusionnew-definition.scss +49 -28
- package/styles/treegrid/_highcontrast-definition.scss +54 -30
- package/styles/treegrid/_highcontrast-light-definition.scss +54 -30
- package/styles/treegrid/_icons.scss +47 -37
- package/styles/treegrid/_layout.scss +530 -455
- package/styles/treegrid/_material-dark-definition.scss +54 -30
- package/styles/treegrid/_material-definition.scss +54 -30
- package/styles/treegrid/_material3-definition.scss +49 -28
- package/styles/treegrid/_tailwind-definition.scss +49 -28
- package/styles/treegrid/_tailwind3-definition.scss +49 -0
- package/styles/treegrid/_theme.scss +1 -1
- package/styles/treegrid/bds.css +765 -0
- package/styles/treegrid/bds.scss +19 -0
- package/styles/treegrid/bootstrap-dark.css +187 -117
- package/styles/treegrid/bootstrap-dark.scss +1 -0
- package/styles/treegrid/bootstrap.css +190 -121
- package/styles/treegrid/bootstrap.scss +1 -0
- package/styles/treegrid/bootstrap4.css +194 -133
- package/styles/treegrid/bootstrap4.scss +1 -0
- package/styles/treegrid/bootstrap5-dark.css +189 -123
- package/styles/treegrid/bootstrap5-dark.scss +1 -0
- package/styles/treegrid/bootstrap5.3.css +1657 -0
- package/styles/treegrid/bootstrap5.3.scss +19 -0
- package/styles/treegrid/bootstrap5.css +188 -122
- package/styles/treegrid/bootstrap5.scss +1 -0
- package/styles/treegrid/fabric-dark.css +188 -118
- package/styles/treegrid/fabric-dark.scss +1 -0
- package/styles/treegrid/fabric.css +188 -111
- package/styles/treegrid/fabric.scss +1 -0
- package/styles/treegrid/fluent-dark.css +195 -116
- package/styles/treegrid/fluent-dark.scss +1 -0
- package/styles/treegrid/fluent.css +195 -116
- package/styles/treegrid/fluent.scss +1 -0
- package/styles/treegrid/fluent2.css +1879 -0
- package/styles/treegrid/fluent2.scss +19 -0
- package/styles/treegrid/highcontrast-light.css +185 -103
- package/styles/treegrid/highcontrast-light.scss +1 -0
- package/styles/treegrid/highcontrast.css +196 -107
- package/styles/treegrid/highcontrast.scss +1 -0
- package/styles/treegrid/icons/_bds.scss +37 -37
- package/styles/treegrid/icons/_bootstrap-dark.scss +47 -37
- package/styles/treegrid/icons/_bootstrap.scss +47 -37
- package/styles/treegrid/icons/_bootstrap4.scss +47 -37
- package/styles/treegrid/icons/_bootstrap5.3.scss +47 -0
- package/styles/treegrid/icons/_bootstrap5.scss +47 -37
- package/styles/treegrid/icons/_fabric-dark.scss +47 -37
- package/styles/treegrid/icons/_fabric.scss +47 -37
- package/styles/treegrid/icons/_fluent.scss +47 -37
- package/styles/treegrid/icons/_fluent2.scss +47 -0
- package/styles/treegrid/icons/_fusionnew.scss +30 -26
- package/styles/treegrid/icons/_highcontrast-light.scss +47 -37
- package/styles/treegrid/icons/_highcontrast.scss +47 -37
- package/styles/treegrid/icons/_material-dark.scss +47 -37
- package/styles/treegrid/icons/_material.scss +47 -37
- package/styles/treegrid/icons/_material3.scss +47 -37
- package/styles/treegrid/icons/_tailwind-dark.scss +47 -37
- package/styles/treegrid/icons/_tailwind.scss +47 -37
- package/styles/treegrid/icons/_tailwind3.scss +47 -0
- package/styles/treegrid/material-dark.css +220 -105
- package/styles/treegrid/material-dark.scss +1 -0
- package/styles/treegrid/material.css +234 -129
- package/styles/treegrid/material.scss +1 -0
- package/styles/treegrid/material3-dark.css +1310 -187
- package/styles/treegrid/material3-dark.scss +2 -1
- package/styles/treegrid/material3.css +1311 -242
- package/styles/treegrid/material3.scss +2 -1
- package/styles/treegrid/tailwind-dark.css +196 -103
- package/styles/treegrid/tailwind-dark.scss +1 -0
- package/styles/treegrid/tailwind.css +196 -103
- package/styles/treegrid/tailwind.scss +1 -0
- package/styles/treegrid/tailwind3.css +1717 -0
- package/styles/treegrid/tailwind3.scss +19 -0
- package/CHANGELOG.md +0 -250
- package/helpers/e2e/index.d.ts +0 -1
- package/helpers/e2e/index.js +0 -8
- package/helpers/e2e/treegridhelper.d.ts +0 -21
- package/helpers/e2e/treegridhelper.js +0 -83
- package/index.d.ts +0 -4
- package/index.js +0 -4
- package/src/index.d.ts +0 -4
- package/src/treegrid/actions/batch-edit.d.ts +0 -73
- package/src/treegrid/actions/clipboard.d.ts +0 -36
- package/src/treegrid/actions/column-chooser.d.ts +0 -37
- package/src/treegrid/actions/column-menu.d.ts +0 -24
- package/src/treegrid/actions/command-column.d.ts +0 -24
- package/src/treegrid/actions/context-menu.d.ts +0 -42
- package/src/treegrid/actions/crud-actions.d.ts +0 -66
- package/src/treegrid/actions/detail-row.d.ts +0 -39
- package/src/treegrid/actions/edit.d.ts +0 -112
- package/src/treegrid/actions/excel-export.d.ts +0 -59
- package/src/treegrid/actions/filter.d.ts +0 -57
- package/src/treegrid/actions/freeze-column.d.ts +0 -28
- package/src/treegrid/actions/index.d.ts +0 -24
- package/src/treegrid/actions/infinite-scroll.d.ts +0 -96
- package/src/treegrid/actions/logger.d.ts +0 -25
- package/src/treegrid/actions/page.d.ts +0 -67
- package/src/treegrid/actions/pdf-export.d.ts +0 -55
- package/src/treegrid/actions/print.d.ts +0 -37
- package/src/treegrid/actions/reorder.d.ts +0 -36
- package/src/treegrid/actions/resize.d.ts +0 -36
- package/src/treegrid/actions/rowdragdrop.d.ts +0 -113
- package/src/treegrid/actions/selection.d.ts +0 -51
- package/src/treegrid/actions/sort.d.ts +0 -63
- package/src/treegrid/actions/summary.d.ts +0 -47
- package/src/treegrid/actions/toolbar.d.ts +0 -52
- package/src/treegrid/actions/virtual-scroll.d.ts +0 -53
- package/src/treegrid/base/constant.d.ts +0 -160
- package/src/treegrid/base/data.d.ts +0 -90
- package/src/treegrid/base/index.d.ts +0 -11
- package/src/treegrid/base/interface.d.ts +0 -182
- package/src/treegrid/base/treegrid.d.ts +0 -2186
- package/src/treegrid/enum.d.ts +0 -155
- package/src/treegrid/index.d.ts +0 -9
- package/src/treegrid/models/column.d.ts +0 -752
- package/src/treegrid/models/edit-settings.d.ts +0 -90
- package/src/treegrid/models/filter-settings.d.ts +0 -203
- package/src/treegrid/models/index.d.ts +0 -24
- package/src/treegrid/models/infinite-scroll-settings.d.ts +0 -25
- package/src/treegrid/models/loading-indicator.d.ts +0 -19
- package/src/treegrid/models/page-settings.d.ts +0 -60
- package/src/treegrid/models/rowdrop-settings.d.ts +0 -27
- package/src/treegrid/models/search-settings.d.ts +0 -71
- package/src/treegrid/models/selection-settings.d.ts +0 -79
- package/src/treegrid/models/sort-settings.d.ts +0 -40
- package/src/treegrid/models/summary.d.ts +0 -124
- package/src/treegrid/models/textwrap-settings.d.ts +0 -16
- package/src/treegrid/renderer/index.d.ts +0 -5
- package/src/treegrid/renderer/render.d.ts +0 -41
- package/src/treegrid/renderer/virtual-row-model-generator.d.ts +0 -16
- package/src/treegrid/renderer/virtual-tree-content-render.d.ts +0 -75
- package/src/treegrid/utils.d.ts +0 -70
- package/treegrid.d.ts +0 -4
- package/treegrid.js +0 -4
- package/tslint.json +0 -111
package/dist/global/index.d.ts
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* filename: index.d.ts
|
|
3
|
-
* version : 25.2.5
|
|
4
|
-
* Copyright Syncfusion Inc. 2001 - 2023. All rights reserved.
|
|
5
|
-
* Use of this code is subject to the terms of our license.
|
|
6
|
-
* A copy of the current license can be obtained at any time by e-mailing
|
|
7
|
-
* licensing@syncfusion.com. Any infringement will be prosecuted under
|
|
8
|
-
* applicable laws.
|
|
9
|
-
*/
|
|
10
1
|
import * as _treegrid from '@syncfusion/ej2-treegrid';
|
|
11
2
|
|
|
12
3
|
export declare namespace ej {
|
|
@@ -0,0 +1,602 @@
|
|
|
1
|
+
import { ITreeData } from '../base/interface';
|
|
2
|
+
import { isNullOrUndefined, extend, setValue, getValue } from '@syncfusion/ej2-base';
|
|
3
|
+
import { TreeGrid } from '../base';
|
|
4
|
+
import * as events from '../base/constant';
|
|
5
|
+
import { DataManager } from '@syncfusion/ej2-data';
|
|
6
|
+
import { findChildrenRecords, getParentData, extendArray } from '../utils';
|
|
7
|
+
import { BeforeBatchSaveArgs, getUid, CellSaveArgs, NotifyArgs, Column, Row, BatchChanges, BeforeBatchDeleteArgs } from '@syncfusion/ej2-grids';
|
|
8
|
+
import { BatchAddArgs, BeforeBatchAddArgs } from '@syncfusion/ej2-grids';
|
|
9
|
+
import { updateParentRow, editAction } from './crud-actions';
|
|
10
|
+
import { FocusStrategy } from '@syncfusion/ej2-grids/src/grid/services/focus-strategy';
|
|
11
|
+
import { classList } from '@syncfusion/ej2-base';
|
|
12
|
+
import { RowPosition } from '../enum';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* `BatchEdit` module is used to handle batch editing actions.
|
|
16
|
+
*
|
|
17
|
+
* @hidden
|
|
18
|
+
*/
|
|
19
|
+
export class BatchEdit {
|
|
20
|
+
private parent: TreeGrid;
|
|
21
|
+
private isSelfReference: boolean;
|
|
22
|
+
private addRowRecord: ITreeData;
|
|
23
|
+
private batchChildCount: number = 0;
|
|
24
|
+
private addedRecords: string = 'addedRecords';
|
|
25
|
+
private deletedRecords: string = 'deletedRecords';
|
|
26
|
+
private matrix: Object[];
|
|
27
|
+
private batchRecords: Object[];
|
|
28
|
+
private currentViewRecords: Object[];
|
|
29
|
+
private batchAddedRecords: Object[] = [];
|
|
30
|
+
private batchDeletedRecords: Object[] = [];
|
|
31
|
+
private batchIndex: number;
|
|
32
|
+
private batchAddRowRecord: Object[] = [];
|
|
33
|
+
private isAdd: boolean;
|
|
34
|
+
private newBatchRowAdded: boolean;
|
|
35
|
+
private selectedIndex: number;
|
|
36
|
+
private addRowIndex: number;
|
|
37
|
+
|
|
38
|
+
constructor(parent: TreeGrid) {
|
|
39
|
+
this.parent = parent;
|
|
40
|
+
this.isSelfReference = !isNullOrUndefined(parent.parentIdMapping);
|
|
41
|
+
this.batchRecords = [];
|
|
42
|
+
this.currentViewRecords = [];
|
|
43
|
+
this.isAdd = false;
|
|
44
|
+
this.addEventListener();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public addEventListener(): void {
|
|
48
|
+
this.parent.on(events.cellSaved, this.cellSaved, this);
|
|
49
|
+
this.parent.on(events.batchAdd, this.batchAdd, this);
|
|
50
|
+
this.parent.on(events.beforeBatchAdd, this.beforeBatchAdd, this);
|
|
51
|
+
this.parent.on(events.batchSave, this.batchSave, this);
|
|
52
|
+
this.parent.on(events.beforeBatchDelete, this.beforeBatchDelete, this);
|
|
53
|
+
this.parent.on(events.beforeBatchSave, this.beforeBatchSave, this);
|
|
54
|
+
this.parent.on('batchPageAction', this.batchPageAction, this);
|
|
55
|
+
this.parent.on('batchCancelAction', this.batchCancelAction, this);
|
|
56
|
+
this.parent.grid.on('immutable-batch-cancel', this.immutableBatchAction, this);
|
|
57
|
+
this.parent.grid.on('next-cell-index', this.nextCellIndex, this);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* @hidden
|
|
61
|
+
* @returns {void}
|
|
62
|
+
*/
|
|
63
|
+
public removeEventListener(): void {
|
|
64
|
+
if (this.parent.isDestroyed) { return; }
|
|
65
|
+
this.parent.off(events.cellSaved, this.cellSaved);
|
|
66
|
+
this.parent.off(events.batchAdd, this.batchAdd);
|
|
67
|
+
this.parent.off(events.batchSave, this.batchSave);
|
|
68
|
+
this.parent.off(events.beforeBatchAdd, this.beforeBatchAdd);
|
|
69
|
+
this.parent.off(events.beforeBatchDelete, this.beforeBatchDelete);
|
|
70
|
+
this.parent.off(events.beforeBatchSave, this.beforeBatchSave);
|
|
71
|
+
this.parent.off('batchPageAction', this.batchPageAction);
|
|
72
|
+
this.parent.off('batchCancelAction', this.batchCancelAction);
|
|
73
|
+
this.parent.grid.off('immutable-batch-cancel', this.immutableBatchAction);
|
|
74
|
+
this.parent.grid.off('next-cell-index', this.nextCellIndex);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* To destroy the editModule
|
|
78
|
+
*
|
|
79
|
+
* @returns {void}
|
|
80
|
+
* @hidden
|
|
81
|
+
*/
|
|
82
|
+
public destroy(): void {
|
|
83
|
+
this.removeEventListener();
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* @hidden
|
|
87
|
+
* @returns {Object[]} Returns modified records in batch editing.
|
|
88
|
+
*/
|
|
89
|
+
public getBatchRecords(): Object[] {
|
|
90
|
+
return this.batchRecords;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* @hidden
|
|
94
|
+
* @returns {number} Returns index of newly add row
|
|
95
|
+
*/
|
|
96
|
+
public getAddRowIndex(): number {
|
|
97
|
+
return this.addRowIndex;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* @hidden
|
|
101
|
+
* @returns {number} Returns selected row index
|
|
102
|
+
*/
|
|
103
|
+
public getSelectedIndex(): number {
|
|
104
|
+
return this.selectedIndex;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* @hidden
|
|
108
|
+
* @returns {number} Returns newly added child count
|
|
109
|
+
*/
|
|
110
|
+
public getBatchChildCount(): number {
|
|
111
|
+
return this.batchChildCount;
|
|
112
|
+
}
|
|
113
|
+
private batchPageAction(): void {
|
|
114
|
+
const data: Object[] = <Object[]>(this.parent.grid.dataSource instanceof DataManager ?
|
|
115
|
+
this.parent.grid.dataSource.dataSource.json : this.parent.grid.dataSource);
|
|
116
|
+
const primaryKey: string = this.parent.grid.getPrimaryKeyFieldNames()[0];
|
|
117
|
+
let index: number;
|
|
118
|
+
if (!isNullOrUndefined(this.batchAddedRecords) && this.batchAddedRecords.length) {
|
|
119
|
+
for (let i: number = 0; i < this.batchAddedRecords.length; i++) {
|
|
120
|
+
index = data.map((e: Object) => { return e[`${primaryKey}`]; }).indexOf(this.batchAddedRecords[parseInt(i.toString(), 10)][`${primaryKey}`]);
|
|
121
|
+
data.splice(index, 1);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
this.batchAddedRecords = this.batchRecords = this.batchAddRowRecord = this.batchDeletedRecords = this.currentViewRecords = [];
|
|
125
|
+
}
|
|
126
|
+
private cellSaved(args: CellSaveArgs): void {
|
|
127
|
+
const actualCellIndex: number = args.column.index;
|
|
128
|
+
if (actualCellIndex === this.parent.treeColumnIndex) {
|
|
129
|
+
this.parent.renderModule.cellRender({ data: args.rowData, cell: args.cell,
|
|
130
|
+
column: this.parent.grid.getColumnByIndex(args.column.index)
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
if (this.isAdd && this.parent.editSettings.mode === 'Batch' && this.parent.editSettings.newRowPosition !== 'Bottom') {
|
|
134
|
+
const data: Object[] = <Object[]>(this.parent.grid.dataSource instanceof DataManager ?
|
|
135
|
+
this.parent.grid.dataSource.dataSource.json : this.parent.grid.dataSource);
|
|
136
|
+
let added: ITreeData; const level: string = 'level';
|
|
137
|
+
const primaryKey: string = this.parent.grid.getPrimaryKeyFieldNames()[0]; let currentDataIndex: number;
|
|
138
|
+
let indexvalue: number;
|
|
139
|
+
const parentItem: string = 'parentItem'; const uniqueID: string = 'uniqueID';
|
|
140
|
+
const parentRecord: ITreeData = this.selectedIndex > -1 ? this.batchRecords[parseInt(this.addRowIndex.toString(), 10)][`${parentItem}`] : null;
|
|
141
|
+
let idMapping: Object; let parentUniqueID: string; let parentIdMapping: string;
|
|
142
|
+
let rowObjectIndex: number = this.parent.editSettings.newRowPosition === 'Top' || this.selectedIndex === -1 ? 0 :
|
|
143
|
+
this.parent.editSettings.newRowPosition === 'Above' ? this.addRowIndex
|
|
144
|
+
: this.addRowIndex + 1;
|
|
145
|
+
rowObjectIndex = this.getActualRowObjectIndex(rowObjectIndex);
|
|
146
|
+
if (this.newBatchRowAdded) {
|
|
147
|
+
if (this.batchRecords.length) {
|
|
148
|
+
idMapping = this.batchRecords[this.addRowIndex][this.parent.idMapping];
|
|
149
|
+
parentIdMapping = this.batchRecords[this.addRowIndex][this.parent.parentIdMapping];
|
|
150
|
+
if (this.batchRecords[parseInt(this.addRowIndex.toString(), 10)][`${parentItem}`]) {
|
|
151
|
+
parentUniqueID = this.batchRecords[parseInt(this.addRowIndex.toString(), 10)][`${parentItem}`][`${uniqueID}`];
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
this.batchAddedRecords = extendArray(this.batchAddedRecords);
|
|
155
|
+
this.batchAddRowRecord = extendArray(this.batchAddRowRecord);
|
|
156
|
+
this.batchAddRowRecord.push(this.batchRecords[this.addRowIndex]);
|
|
157
|
+
added = this.parent.grid.getRowsObject()[parseInt(rowObjectIndex.toString(), 10)].changes;
|
|
158
|
+
added.uniqueID = getUid(this.parent.element.id + '_data_');
|
|
159
|
+
setValue('uniqueIDCollection.' + added.uniqueID , added, this.parent);
|
|
160
|
+
if (!Object.prototype.hasOwnProperty.call(added, 'level')) {
|
|
161
|
+
this.batchIndex = this.selectedIndex === -1 ? 0 : this.batchIndex;
|
|
162
|
+
if (this.parent.editSettings.newRowPosition === 'Child') {
|
|
163
|
+
added.primaryParent = parentRecord;
|
|
164
|
+
if (this.selectedIndex > -1) {
|
|
165
|
+
added.parentItem = extend({}, this.batchRecords[this.addRowIndex]);
|
|
166
|
+
added.parentUniqueID = added.parentItem.uniqueID;
|
|
167
|
+
delete added.parentItem.childRecords; delete added.parentItem[this.parent.childMapping];
|
|
168
|
+
added.level = added.parentItem.level + 1; added.index = this.batchIndex;
|
|
169
|
+
const childRecordCount: number = findChildrenRecords(this.batchRecords[this.addRowIndex]).length;
|
|
170
|
+
let record: ITreeData = findChildrenRecords(this.batchRecords[this.addRowIndex])[childRecordCount - 1];
|
|
171
|
+
record = isNullOrUndefined(record) ? this.batchRecords[this.addRowIndex] : record;
|
|
172
|
+
currentDataIndex = data.map((e: Object) => { return e[`${primaryKey}`]; }).indexOf(record[`${primaryKey}`]);
|
|
173
|
+
if (this.isSelfReference) {
|
|
174
|
+
added[this.parent.parentIdMapping] = idMapping;
|
|
175
|
+
}
|
|
176
|
+
updateParentRow(primaryKey, added.parentItem, 'add', this.parent, this.isSelfReference, added);
|
|
177
|
+
}
|
|
178
|
+
} else if ((this.parent.editSettings.newRowPosition === 'Above' || this.parent.editSettings.newRowPosition === 'Below')
|
|
179
|
+
&& !isNullOrUndefined(this.batchRecords[this.addRowIndex])) {
|
|
180
|
+
added.level = this.batchRecords[parseInt(this.addRowIndex.toString(), 10)][`${level}`];
|
|
181
|
+
if (added.level && this.selectedIndex > -1) {
|
|
182
|
+
added.parentItem = parentRecord; added.parentUniqueID = parentUniqueID;
|
|
183
|
+
delete added.parentItem.childRecords; delete added.parentItem[this.parent.childMapping];
|
|
184
|
+
}
|
|
185
|
+
added.index = this.parent.editSettings.newRowPosition === 'Below' ? this.batchIndex : this.batchIndex - 1;
|
|
186
|
+
if (this.parent.editSettings.newRowPosition === 'Below' && this.selectedIndex > -1) {
|
|
187
|
+
const childRecordCount: number = findChildrenRecords(this.batchRecords[this.addRowIndex]).length;
|
|
188
|
+
let record: ITreeData = findChildrenRecords(this.batchRecords[this.addRowIndex])[childRecordCount - 1];
|
|
189
|
+
record = isNullOrUndefined(record) ? this.batchRecords[this.addRowIndex] : record;
|
|
190
|
+
currentDataIndex = data.map((e: Object) => { return e[`${primaryKey}`]; }).indexOf(record[`${primaryKey}`]);
|
|
191
|
+
}
|
|
192
|
+
if (this.parent.editSettings.newRowPosition === 'Above' && this.selectedIndex > -1) {
|
|
193
|
+
const record: ITreeData = this.batchRecords[this.addRowIndex];
|
|
194
|
+
currentDataIndex = data.map((e: Object) => { return e[`${primaryKey}`]; }).indexOf(record[`${primaryKey}`]);
|
|
195
|
+
}
|
|
196
|
+
if (this.isSelfReference) {
|
|
197
|
+
added[this.parent.parentIdMapping] = parentIdMapping;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
added.index = added.index === -1 ? 0 : added.index;
|
|
201
|
+
added.hasChildRecords = false; added.childRecords = [];
|
|
202
|
+
this.batchRecords.splice(added.index, 0, added);
|
|
203
|
+
this.currentViewRecords.splice(added.index, 0, added);
|
|
204
|
+
if (currentDataIndex) {
|
|
205
|
+
indexvalue = currentDataIndex;
|
|
206
|
+
} else { indexvalue = added.index; }
|
|
207
|
+
if (this.parent.editSettings.newRowPosition !== 'Above') {
|
|
208
|
+
indexvalue = added.index === 0 ? indexvalue : indexvalue + 1;
|
|
209
|
+
}
|
|
210
|
+
data.splice(indexvalue, 0, added);
|
|
211
|
+
this.batchAddedRecords.push(added);
|
|
212
|
+
}
|
|
213
|
+
this.parent.grid.getRowsObject()[parseInt(rowObjectIndex.toString(), 10)].data = added;
|
|
214
|
+
this.newBatchRowAdded = false;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
private beforeBatchAdd(e: BeforeBatchAddArgs): void {
|
|
220
|
+
const isTabLastRow: string = 'isTabLastRow';
|
|
221
|
+
if (this.parent.editSettings.mode === 'Cell' && this.parent.editModule[`${isTabLastRow}`]) {
|
|
222
|
+
e.cancel = true;
|
|
223
|
+
this.parent.editModule[`${isTabLastRow}`] = false;
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
if (this.parent.editModule['isAddedRowByMethod'] && !isNullOrUndefined(this.parent.editModule['addRowIndex']) &&
|
|
227
|
+
!this.parent.editModule['isAddedRowByContextMenu'] && (this.parent.grid.selectedRowIndex === -1 || this.parent.editModule['batchEditModule'].isAdd)) {
|
|
228
|
+
this.selectedIndex = this.parent.editModule['selectedIndex'];
|
|
229
|
+
this.addRowIndex = this.parent.editModule['addRowIndex'];
|
|
230
|
+
this.addRowRecord = this.batchRecords.length ? this.batchRecords[this.selectedIndex]
|
|
231
|
+
: this.parent.getCurrentViewRecords()[this.selectedIndex];
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
this.selectedIndex = this.parent.grid.selectedRowIndex;
|
|
235
|
+
this.addRowIndex = this.parent.grid.selectedRowIndex > -1 ? this.parent.grid.selectedRowIndex : 0;
|
|
236
|
+
this.parent.editModule['addRowIndex'] = this.parent.grid.selectedRowIndex > -1 ? this.parent.grid.selectedRowIndex : 0;
|
|
237
|
+
this.addRowRecord = this.parent.getSelectedRecords()[0];
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
private batchAdd(e: BatchAddArgs): void {
|
|
242
|
+
if (this.parent.editSettings.newRowPosition !== 'Bottom') {
|
|
243
|
+
this.isAdd = true; this.newBatchRowAdded = true; let actualIndex: number = 0;
|
|
244
|
+
if (!this.batchRecords.length) {
|
|
245
|
+
this.batchAddedRecords = [];
|
|
246
|
+
this.batchRecords = extendArray(this.parent.grid.getCurrentViewRecords());
|
|
247
|
+
this.currentViewRecords = extendArray(this.parent.grid.getCurrentViewRecords());
|
|
248
|
+
}
|
|
249
|
+
if (this.parent.editModule['isAddedRowByMethod'] && !isNullOrUndefined(this.parent.editModule['addRowIndex'])) {
|
|
250
|
+
classList(this.parent.grid.getDataRows()[0], ['e-batchrow'], []);
|
|
251
|
+
}
|
|
252
|
+
if (this.parent.editSettings.newRowPosition !== 'Top') {
|
|
253
|
+
let records: Object[] = this.parent.grid.getCurrentViewRecords();
|
|
254
|
+
if (this.parent.editSettings.mode === 'Batch' && (this.parent.getBatchChanges()[this.addedRecords].length > 1
|
|
255
|
+
|| this.parent.getBatchChanges()[this.deletedRecords].length)) {
|
|
256
|
+
records = this.batchRecords;
|
|
257
|
+
}
|
|
258
|
+
this.updateChildCount(records);
|
|
259
|
+
this.parent.notify(events.beginAdd, {});
|
|
260
|
+
this.batchChildCount = 0;
|
|
261
|
+
}
|
|
262
|
+
this.updateRowIndex();
|
|
263
|
+
// update focus module, need to refix this once grid source modified.
|
|
264
|
+
const focusModule: FocusStrategy = getValue('focusModule', this.parent.grid);
|
|
265
|
+
const table: Element = this.parent.getContentTable();
|
|
266
|
+
if (this.parent.getBatchChanges()[this.deletedRecords].length && this.parent.editSettings.newRowPosition === 'Above') {
|
|
267
|
+
actualIndex = (e.row as HTMLTableRowElement).rowIndex;
|
|
268
|
+
focusModule.getContent().matrix.matrix = this.matrix as number[][];
|
|
269
|
+
} else {
|
|
270
|
+
actualIndex = (table.getElementsByClassName('e-batchrow')[0] as HTMLTableRowElement).rowIndex;
|
|
271
|
+
// if (this.parent.frozenRows || this.parent.frozenColumns) {
|
|
272
|
+
// actualIndex = this.batchIndex;
|
|
273
|
+
// }
|
|
274
|
+
}
|
|
275
|
+
focusModule.getContent().matrix.current = [actualIndex, focusModule.getContent().matrix.current[1]];
|
|
276
|
+
if (this.parent.editModule['isAddedRowByMethod'] && !isNullOrUndefined(this.parent.editModule['addRowIndex']) && !this.parent.editModule['isAddedRowByContextMenu']) {
|
|
277
|
+
const newlyAddedRecords: ITreeData[] = this.parent.getBatchChanges()['addedRecords'];
|
|
278
|
+
const index: number = parseInt(this.parent.getContentTable().getElementsByClassName('e-insertedrow')[newlyAddedRecords.length - 1].getAttribute('data-rowindex'), 10);
|
|
279
|
+
this.batchRecords.splice(index, 0, newlyAddedRecords[newlyAddedRecords.length - 1]);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
private beforeBatchDelete(args?: BeforeBatchDeleteArgs): void {
|
|
284
|
+
if (!this.batchRecords.length) {
|
|
285
|
+
this.batchRecords = extendArray(this.parent.grid.getCurrentViewRecords());
|
|
286
|
+
this.currentViewRecords = extendArray(this.parent.grid.getCurrentViewRecords());
|
|
287
|
+
}
|
|
288
|
+
const focusModule: FocusStrategy = getValue('focusModule', this.parent.grid);
|
|
289
|
+
this.matrix = focusModule.getContent().matrix.matrix;
|
|
290
|
+
const row: Element[] = []; let records: ITreeData[] = [];
|
|
291
|
+
const primarykey: string = this.parent.grid.getPrimaryKeyFieldNames()[0];
|
|
292
|
+
let data: ITreeData;
|
|
293
|
+
let childs: ITreeData[];
|
|
294
|
+
let uid: string;
|
|
295
|
+
if (!isNullOrUndefined(args.row) && this.parent.getSelectedRows().indexOf(args.row as Element) === -1) {
|
|
296
|
+
data = args.rowData;
|
|
297
|
+
childs = findChildrenRecords(data);
|
|
298
|
+
uid = (args.row as Element).getAttribute('data-uid');
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
301
|
+
data = this.parent.grid.getSelectedRecords()[this.parent.grid.getSelectedRecords().length - 1];
|
|
302
|
+
childs = findChildrenRecords(data);
|
|
303
|
+
uid = this.parent.getSelectedRows()[0].getAttribute('data-uid');
|
|
304
|
+
}
|
|
305
|
+
const parentRowIndex: number = parseInt(this.parent.grid.getRowElementByUID(uid).getAttribute('data-rowindex'), 10);
|
|
306
|
+
if (childs.length){
|
|
307
|
+
const totalCount: number = parentRowIndex + childs.length; const firstChildIndex: number = parentRowIndex + 1;
|
|
308
|
+
for (let i: number = firstChildIndex; i <= totalCount; i++){
|
|
309
|
+
row.push(this.parent.grid.getDataRows()[parseInt(i.toString(), 10)] as Element);
|
|
310
|
+
if (this.parent.frozenRows || this.parent.frozenColumns || this.parent.getFrozenColumns()) {
|
|
311
|
+
row.push(this.parent.grid.getHeaderContent()[parseInt(i.toString(), 10)] as Element);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
if (!isNullOrUndefined(data.parentItem)) {
|
|
316
|
+
const parentItem: ITreeData = getParentData(this.parent, data.parentItem.uniqueID);
|
|
317
|
+
if (!isNullOrUndefined(parentItem) && parentItem.hasChildRecords) {
|
|
318
|
+
const childIndex: number = parentItem.childRecords.indexOf(data);
|
|
319
|
+
parentItem.childRecords.splice(childIndex, 1);
|
|
320
|
+
}
|
|
321
|
+
this.batchDeletedRecords = extendArray(this.batchDeletedRecords);
|
|
322
|
+
this.batchDeletedRecords.push(data);
|
|
323
|
+
}
|
|
324
|
+
childs.push(data);
|
|
325
|
+
records = childs;
|
|
326
|
+
for (let i: number = 0; i < records.length; i++) {
|
|
327
|
+
const indexvalue: number = this.batchRecords.map((e: Object) => { return e[`${primarykey}`]; }).indexOf(records[parseInt(i.toString(), 10)][`${primarykey}`]);
|
|
328
|
+
if (indexvalue !== -1) {
|
|
329
|
+
this.batchRecords.splice(indexvalue , 1);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
for (let i: number = 0; i < row.length; i++) {
|
|
333
|
+
if (!isNullOrUndefined(row[parseInt(i.toString(), 10)])) {
|
|
334
|
+
this.parent.grid.selectionModule.selectedRecords.push(row[parseInt(i.toString(), 10)]);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
private updateRowIndex(): void {
|
|
339
|
+
const rows: Element[] = this.parent.grid.getDataRows();
|
|
340
|
+
for (let i: number = 0 ; i < rows.length; i++) {
|
|
341
|
+
rows[parseInt(i.toString(), 10)].setAttribute('data-rowindex', i.toString());
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
private updateChildCount(records: Object[]): void {
|
|
345
|
+
const primaryKey: string = this.parent.grid.getPrimaryKeyFieldNames()[0];
|
|
346
|
+
const addedRecords: string = 'addedRecords';
|
|
347
|
+
const parentItem: string = this.parent.editSettings.newRowPosition === 'Child' ? 'primaryParent' : 'parentItem';
|
|
348
|
+
for (let i: number = 0; i < this.parent.getBatchChanges()[`${addedRecords}`].length; i++ ) {
|
|
349
|
+
if (!isNullOrUndefined(this.parent.getBatchChanges()[`${addedRecords}`][parseInt(i.toString(), 10)][`${parentItem}`])) {
|
|
350
|
+
if (this.parent.getBatchChanges()[`${addedRecords}`][parseInt(i.toString(), 10)][`${parentItem}`][`${primaryKey}`] === records[parseInt(this.addRowIndex.toString(), 10)][`${primaryKey}`]) {
|
|
351
|
+
this.batchChildCount = this.batchChildCount + 1;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
private beforeBatchSave(e: BeforeBatchSaveArgs): void {
|
|
358
|
+
const changeRecords: string = 'changedRecords'; const deleterecords: string = 'deletedRecords';
|
|
359
|
+
const changedRecords: ITreeData[] = e.batchChanges[`${changeRecords}`];
|
|
360
|
+
if (e.batchChanges[`${changeRecords}`].length) {
|
|
361
|
+
let columnName: string;
|
|
362
|
+
for (let i: number = 0; i < changedRecords.length; i++) {
|
|
363
|
+
editAction({ value: <ITreeData>changedRecords[parseInt(i.toString(), 10)], action: 'edit' }, this.parent,
|
|
364
|
+
this.isSelfReference, this.addRowIndex, this.selectedIndex, columnName);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
if (e.batchChanges[`${deleterecords}`].length) {
|
|
368
|
+
const deletedRecords: ITreeData[] = e.batchChanges[`${deleterecords}`];
|
|
369
|
+
const record: ITreeData[] = deletedRecords;
|
|
370
|
+
for (let i: number = 0; i < record.length; i++) {
|
|
371
|
+
this.deleteUniqueID(record[parseInt(i.toString(), 10)].uniqueID);
|
|
372
|
+
const childs: ITreeData[] = findChildrenRecords(record[parseInt(i.toString(), 10)]);
|
|
373
|
+
for (let c: number = 0; c < childs.length; c++) {
|
|
374
|
+
this.deleteUniqueID(childs[parseInt(c.toString(), 10)].uniqueID);
|
|
375
|
+
}
|
|
376
|
+
e.batchChanges[`${deleterecords}`] = [...e.batchChanges[`${deleterecords}`], ...childs];
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
this.isAdd = false;
|
|
380
|
+
}
|
|
381
|
+
private deleteUniqueID( value: string) : void {
|
|
382
|
+
const idFilter: string = 'uniqueIDFilterCollection';
|
|
383
|
+
delete this.parent[`${idFilter}`][`${value}`];
|
|
384
|
+
const id: string = 'uniqueIDCollection';
|
|
385
|
+
delete this.parent[`${id}`][`${value}`];
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
private batchCancelAction() : void {
|
|
389
|
+
const targetElement: string = 'targetElement'; let index: number; const parentItem: string = 'parentItem';
|
|
390
|
+
const indexvalue: string = 'index';
|
|
391
|
+
const currentViewRecords: Object[] = this.parent.grid.getCurrentViewRecords(); const childRecords: string = 'childRecords';
|
|
392
|
+
const data: Object[] = <Object[]>(this.parent.grid.dataSource instanceof DataManager ?
|
|
393
|
+
this.parent.grid.dataSource.dataSource.json : this.parent.grid.dataSource);
|
|
394
|
+
const primaryKey: string = this.parent.grid.getPrimaryKeyFieldNames()[0];
|
|
395
|
+
if (!isNullOrUndefined(this.batchAddedRecords)) {
|
|
396
|
+
for (let i: number = 0; i < this.batchAddedRecords.length; i++) {
|
|
397
|
+
index = data.map((e: Object) => { return e[`${primaryKey}`]; }).indexOf(this.batchAddedRecords[parseInt(i.toString(), 10)][`${primaryKey}`]);
|
|
398
|
+
if (index !== -1) {
|
|
399
|
+
data.splice(index, 1);
|
|
400
|
+
}
|
|
401
|
+
if (this.parent.editSettings.newRowPosition === 'Child') {
|
|
402
|
+
index = currentViewRecords.map((e: Object) => { return e[`${primaryKey}`]; })
|
|
403
|
+
.indexOf(this.batchAddedRecords[parseInt(i.toString(), 10)][`${parentItem}`] ? this.batchAddedRecords[parseInt(i.toString(), 10)][`${parentItem}`][`${primaryKey}`]
|
|
404
|
+
: this.batchAddedRecords[parseInt(i.toString(), 10)][`${primaryKey}`]);
|
|
405
|
+
if (!isNullOrUndefined(currentViewRecords[parseInt(index.toString(), 10)])) {
|
|
406
|
+
const children: Object[] = currentViewRecords[parseInt(index.toString(), 10)][`${childRecords}`];
|
|
407
|
+
for (let j: number = 0; children && j < children.length; j++) {
|
|
408
|
+
if (children[parseInt(j.toString(), 10)][`${primaryKey}`] === this.batchAddedRecords[parseInt(i.toString(), 10)][`${primaryKey}`]) {
|
|
409
|
+
currentViewRecords[parseInt(index.toString(), 10)][`${childRecords}`].splice(j, 1);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
if (!isNullOrUndefined(this.parent[`${targetElement}`])) {
|
|
417
|
+
const row: HTMLTableRowElement = this.parent[`${targetElement}`].closest('tr');
|
|
418
|
+
this.parent.collapseRow(row);
|
|
419
|
+
this.parent[`${targetElement}`] = null;
|
|
420
|
+
}
|
|
421
|
+
if (!isNullOrUndefined(this.batchDeletedRecords)) {
|
|
422
|
+
for (let i: number = 0; i < this.batchDeletedRecords.length; i++) {
|
|
423
|
+
if (!isNullOrUndefined(this.batchDeletedRecords[parseInt(i.toString(), 10)][`${parentItem}`])) {
|
|
424
|
+
index = currentViewRecords.map((e: Object) => { return e[`${primaryKey}`]; })
|
|
425
|
+
.indexOf(this.batchDeletedRecords[parseInt(i.toString(), 10)][`${parentItem}`][`${primaryKey}`]);
|
|
426
|
+
const positionIndex: number = this.batchDeletedRecords[parseInt(i.toString(), 10)][`${indexvalue}`] === 0 ? this.batchDeletedRecords[parseInt(i.toString(), 10)][`${indexvalue}`] :
|
|
427
|
+
this.batchDeletedRecords[parseInt(i.toString(), 10)][`${indexvalue}`] - 1;
|
|
428
|
+
if (!isNullOrUndefined(currentViewRecords[parseInt(index.toString(), 10)])) {
|
|
429
|
+
currentViewRecords[parseInt(index.toString(), 10)][`${childRecords}`].splice(positionIndex, 0, this.batchDeletedRecords[parseInt(i.toString(), 10)]);
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
this.batchAddedRecords = this.batchRecords = this.batchAddRowRecord = this.currentViewRecords = [];
|
|
435
|
+
this.batchRecords = extendArray(this.parent.grid.getCurrentViewRecords()); this.batchIndex = 0;
|
|
436
|
+
this.currentViewRecords = extendArray(this.parent.grid.getCurrentViewRecords());
|
|
437
|
+
this.batchDeletedRecords = [];
|
|
438
|
+
this.parent.grid.renderModule.refresh();
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
private batchSave(args: { updatedRecords: BatchChanges, index: number }) : void {
|
|
442
|
+
if (this.parent.editSettings.mode === 'Batch') {
|
|
443
|
+
let i: number; const batchChanges: Object = Object.hasOwnProperty.call(args, 'updatedRecords') ? args.updatedRecords : this.parent.getBatchChanges(); const deletedRecords: string = 'deletedRecords';
|
|
444
|
+
const addedRecords: string = 'addedRecords'; const index: string = 'index'; const uniqueID: string = 'uniqueID';
|
|
445
|
+
const data: Object[] = <Object[]>(this.parent.grid.dataSource instanceof DataManager ?
|
|
446
|
+
this.parent.grid.dataSource.dataSource.json : this.parent.grid.dataSource);
|
|
447
|
+
let currentViewRecords: Object[] = this.parent.grid.getCurrentViewRecords();
|
|
448
|
+
const primarykey: string = this.parent.grid.getPrimaryKeyFieldNames()[0]; const level: string = 'level';
|
|
449
|
+
const addRecords: ITreeData[] = batchChanges[`${addedRecords}`]; const parentItem: string = 'parentItem';
|
|
450
|
+
let selectedIndex: number; let addRowIndex: number; let columnName: string;
|
|
451
|
+
let addRowRecord: ITreeData; const childRecords: string = 'childRecords';
|
|
452
|
+
if (addRecords.length > 1 && this.parent.editSettings.newRowPosition !== 'Bottom') {
|
|
453
|
+
addRecords.reverse();
|
|
454
|
+
}
|
|
455
|
+
if (this.parent.editSettings.newRowPosition !== 'Bottom' && !Object.hasOwnProperty.call(args, 'updatedRecords')) {
|
|
456
|
+
data.splice(data.length - addRecords.length, addRecords.length);
|
|
457
|
+
if (this.parent.editModule['isAddedRowByMethod'] && addRecords.length && !isNullOrUndefined(this.parent.editModule['addRowIndex']) && !this.parent.editModule['isAddedRowByContextMenu']) {
|
|
458
|
+
addRecords.reverse();
|
|
459
|
+
for (let i: number = 0; i < addRecords.length; i++) {
|
|
460
|
+
const index: number = parseInt(this.parent.getContentTable().getElementsByClassName('e-insertedrow')[parseInt(i.toString(), 10)].getAttribute('data-rowindex'), 10);
|
|
461
|
+
data.splice(index, 0, addRecords[parseInt(i.toString(), 10)]);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
if (!this.parent.allowPaging && data.length !== currentViewRecords.length) {
|
|
465
|
+
if (currentViewRecords.length > addRecords.length) {
|
|
466
|
+
currentViewRecords.splice(currentViewRecords.length - addRecords.length, addRecords.length);
|
|
467
|
+
}
|
|
468
|
+
} else {
|
|
469
|
+
const totalRecords: Object[] = extendArray(data);
|
|
470
|
+
if (totalRecords.length) {
|
|
471
|
+
const startIndex: number = totalRecords.map((e: Object) => { return e[`${primarykey}`]; })
|
|
472
|
+
.indexOf(currentViewRecords[0][`${primarykey}`]);
|
|
473
|
+
const endIndex: number = startIndex + this.parent.grid.pageSettings.pageSize;
|
|
474
|
+
currentViewRecords = totalRecords.splice(startIndex, endIndex);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
if (this.batchAddRowRecord.length === 0) { this.batchAddRowRecord.push(this.parent.flatData[args.index]); }
|
|
479
|
+
if (this.parent.editModule['isAddedRowByContextMenu']) {
|
|
480
|
+
addRecords.reverse();
|
|
481
|
+
}
|
|
482
|
+
for (i = 0; i < addRecords.length; i++) {
|
|
483
|
+
const taskData: ITreeData = extend({}, addRecords[parseInt(i.toString(), 10)]);
|
|
484
|
+
delete taskData.parentItem; delete taskData.uniqueID; delete taskData.index; delete taskData.level;
|
|
485
|
+
delete taskData.hasChildRecords; delete taskData.childRecords; delete taskData.parentUniqueID;
|
|
486
|
+
if (!isNullOrUndefined(taskData.primaryParent)) {
|
|
487
|
+
delete taskData.primaryParent;
|
|
488
|
+
}
|
|
489
|
+
if (addRecords.length > 1 && this.parent.editModule['isAddedRowByContextMenu']) {
|
|
490
|
+
const rowPosition: RowPosition = this.parent.editSettings.newRowPosition;
|
|
491
|
+
this.parent.editSettings.newRowPosition = this.parent.editModule['previousNewRowPosition'];
|
|
492
|
+
this.parent.editModule['previousNewRowPosition'] = rowPosition;
|
|
493
|
+
}
|
|
494
|
+
addRecords[parseInt(i.toString(), 10)].taskData = taskData;
|
|
495
|
+
addRowRecord = this.batchAddRowRecord[parseInt(i.toString(), 10)];
|
|
496
|
+
if (isNullOrUndefined(addRowRecord)) {
|
|
497
|
+
addRowRecord = this.batchAddRowRecord[i - 1];
|
|
498
|
+
}
|
|
499
|
+
if (this.isSelfReference) {
|
|
500
|
+
if (!isNullOrUndefined(addRecords[parseInt(i.toString(), 10)].parentItem)) {
|
|
501
|
+
updateParentRow(primarykey, addRecords[parseInt(i.toString(), 10)].parentItem, 'add', this.parent, this.isSelfReference, addRecords[parseInt(i.toString(), 10)]);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
if (!isNullOrUndefined(addRowRecord)) {
|
|
505
|
+
addRowIndex = addRowRecord.index;
|
|
506
|
+
}
|
|
507
|
+
if (this.parent.editSettings.newRowPosition !== 'Top' && this.parent.editSettings.newRowPosition !== 'Bottom') {
|
|
508
|
+
if (isNullOrUndefined(addRecords[parseInt(i.toString(), 10)].parentItem) && this.selectedIndex === -1) {
|
|
509
|
+
selectedIndex = -1;
|
|
510
|
+
addRowRecord = null;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
editAction({ value: addRecords[parseInt(i.toString(), 10)], action: 'add' }, this.parent,
|
|
514
|
+
this.isSelfReference, addRowIndex, selectedIndex, columnName, addRowRecord);
|
|
515
|
+
selectedIndex = null;
|
|
516
|
+
if (this.parent.editSettings.newRowPosition === 'Child' && !isNullOrUndefined(addRecords[parseInt(i.toString(), 10)][`${parentItem}`]) &&
|
|
517
|
+
(isNullOrUndefined(this.parent.editModule['addRowIndex']) || this.isSelfReference)) {
|
|
518
|
+
const indexValue: number = currentViewRecords.map((e: Object) => { return e[`${primarykey}`]; })
|
|
519
|
+
.indexOf(addRecords[parseInt(i.toString(), 10)][`${parentItem}`][`${primarykey}`]);
|
|
520
|
+
const children: Object[] = currentViewRecords[parseInt(indexValue.toString(), 10)][`${childRecords}`];
|
|
521
|
+
for (let j: number = 0; j < children.length; j++) {
|
|
522
|
+
if (children[parseInt(j.toString(), 10)][`${primarykey}`] === addRecords[parseInt(i.toString(), 10)][`${primarykey}`]) {
|
|
523
|
+
currentViewRecords[parseInt(indexValue.toString(), 10)][`${childRecords}`].splice(j, 1);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
if (batchChanges[`${deletedRecords}`].length) {
|
|
529
|
+
for (i = 0; i < batchChanges[`${deletedRecords}`].length; i++) {
|
|
530
|
+
editAction({ value: batchChanges[`${deletedRecords}`][parseInt(i.toString(), 10)], action: 'delete' }, this.parent,
|
|
531
|
+
this.isSelfReference, addRowIndex, selectedIndex, columnName, addRowRecord);
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
this.parent.parentData = [];
|
|
535
|
+
for (let i: number = 0; i < data.length; i++) {
|
|
536
|
+
data[parseInt(i.toString(), 10)][`${index}`] = i;
|
|
537
|
+
setValue('uniqueIDCollection.' + data[parseInt(i.toString(), 10)][`${uniqueID}`] + '.index', i, this.parent);
|
|
538
|
+
if (!data[parseInt(i.toString(), 10)][`${level}`]) {
|
|
539
|
+
this.parent.parentData.push(data[parseInt(i.toString(), 10)]);
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
this.batchAddRowRecord = this.batchAddedRecords = this.batchRecords = this.batchDeletedRecords = this.currentViewRecords = [];
|
|
544
|
+
if (this.parent.editModule['isAddedRowByContextMenu']) {
|
|
545
|
+
this.parent.editModule['isAddedRowByContextMenu'] = false;
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
private getActualRowObjectIndex(index: number): number {
|
|
550
|
+
const rows: Element[] = this.parent.grid.getDataRows();
|
|
551
|
+
if ((this.parent.editSettings.newRowPosition === 'Below' || this.parent.editSettings.newRowPosition === 'Child')
|
|
552
|
+
&& this.selectedIndex > -1) {
|
|
553
|
+
if (!isNullOrUndefined(this.batchRecords[this.addRowIndex]) && (this.batchRecords[this.addRowIndex] as ITreeData).expanded) {
|
|
554
|
+
if (this.parent.getBatchChanges()[this.addedRecords].length > 1
|
|
555
|
+
|| this.parent.getBatchChanges()[this.deletedRecords].length) {
|
|
556
|
+
index += findChildrenRecords(this.batchRecords[this.addRowIndex]).length;
|
|
557
|
+
if (this.parent.editSettings.newRowPosition !== 'Child') {
|
|
558
|
+
const batchChildCount: number = this.getBatchChildCount();
|
|
559
|
+
index = index + batchChildCount;
|
|
560
|
+
}
|
|
561
|
+
} else {
|
|
562
|
+
index += findChildrenRecords(this.batchRecords[this.addRowIndex]).length;
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
if (index >= rows.length) {
|
|
566
|
+
index = rows.length - 1;
|
|
567
|
+
}
|
|
568
|
+
this.updateChildCount(this.parent.grid.getCurrentViewRecords());
|
|
569
|
+
if (this.batchChildCount) {
|
|
570
|
+
index += this.batchChildCount;
|
|
571
|
+
}
|
|
572
|
+
this.batchChildCount = 0;
|
|
573
|
+
}
|
|
574
|
+
return index;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
private immutableBatchAction(e: { rows: Row<Column>[], args?: NotifyArgs }): void {
|
|
578
|
+
e.args.cancel = true;
|
|
579
|
+
const changes: Object = this.parent.grid.getBatchChanges();
|
|
580
|
+
let addedRecords: Object[] = []; const index: string = 'index';
|
|
581
|
+
if (Object.keys(changes).length) {
|
|
582
|
+
addedRecords = (<{ addedRecords?: Object[] }>changes).addedRecords;
|
|
583
|
+
}
|
|
584
|
+
for (let i: number = 0; i < addedRecords.length; i++) {
|
|
585
|
+
e.rows.splice(addedRecords[parseInt(i.toString(), 10)][`${index}`], 1);
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
private nextCellIndex(args: NotifyArgs): void {
|
|
590
|
+
const index: string = 'index'; const rowIndex: string = 'rowIndex';
|
|
591
|
+
if (this.parent.getSelectedRows().length) {
|
|
592
|
+
args[`${index}`] = this.parent.getSelectedRows()[0][`${rowIndex}`];
|
|
593
|
+
}
|
|
594
|
+
else {
|
|
595
|
+
args[`${index}`] = this.batchIndex;
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
|
package/license
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
Essential JS 2 library is available under the Syncfusion Essential Studio program, and can be licensed either under the Syncfusion Community License Program or the Syncfusion commercial license.
|
|
2
|
-
|
|
3
|
-
To be qualified for the Syncfusion Community License Program you must have a gross revenue of less than one (1) million U.S. dollars ($1,000,000.00 USD) per year and have less than five (5) developers in your organization, and agree to be bound by Syncfusion’s terms and conditions.
|
|
4
|
-
|
|
5
|
-
Customers who do not qualify for the community license can contact sales@syncfusion.com for commercial licensing options.
|
|
6
|
-
|
|
7
|
-
Under no circumstances can you use this product without (1) either a Community License or a commercial license and (2) without agreeing and abiding by Syncfusion’s license containing all terms and conditions.
|
|
8
|
-
|
|
9
|
-
The Syncfusion license that contains the terms and conditions can be found at
|
|
1
|
+
Essential JS 2 library is available under the Syncfusion Essential Studio program, and can be licensed either under the Syncfusion Community License Program or the Syncfusion commercial license.
|
|
2
|
+
|
|
3
|
+
To be qualified for the Syncfusion Community License Program you must have a gross revenue of less than one (1) million U.S. dollars ($1,000,000.00 USD) per year and have less than five (5) developers in your organization, and agree to be bound by Syncfusion’s terms and conditions.
|
|
4
|
+
|
|
5
|
+
Customers who do not qualify for the community license can contact sales@syncfusion.com for commercial licensing options.
|
|
6
|
+
|
|
7
|
+
Under no circumstances can you use this product without (1) either a Community License or a commercial license and (2) without agreeing and abiding by Syncfusion’s license containing all terms and conditions.
|
|
8
|
+
|
|
9
|
+
The Syncfusion license that contains the terms and conditions can be found at
|
|
10
10
|
https://www.syncfusion.com/content/downloads/syncfusion_license.pdf
|