@syncfusion/ej2-treegrid 20.1.48 → 20.1.51
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 +18 -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 +3719 -3531
- package/dist/es6/ej2-treegrid.es2015.js.map +1 -1
- package/dist/es6/ej2-treegrid.es5.js +5213 -5024
- 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 +7 -7
- package/src/treegrid/actions/batch-edit.js +1 -1
- package/src/treegrid/actions/crud-actions.js +6 -1
- package/src/treegrid/actions/edit.js +2 -2
- package/src/treegrid/actions/rowdragdrop.d.ts +13 -0
- package/src/treegrid/actions/rowdragdrop.js +127 -7
- package/src/treegrid/actions/toolbar.d.ts +0 -1
- package/src/treegrid/actions/toolbar.js +50 -79
- package/src/treegrid/actions/virtual-scroll.js +1 -1
- package/src/treegrid/base/treegrid.d.ts +20 -0
- package/src/treegrid/base/treegrid.js +60 -13
- package/src/treegrid/models/column.d.ts +9 -0
- package/src/treegrid/models/column.js +19 -0
- package/src/treegrid/models/rowdrop-settings.d.ts +9 -1
- package/src/treegrid/renderer/render.d.ts +6 -0
- package/src/treegrid/renderer/render.js +27 -1
- package/src/treegrid/renderer/virtual-tree-content-render.js +1 -1
|
@@ -38,7 +38,6 @@ import { isRemoteData, isOffline, extendArray, isCountRequired, findChildrenReco
|
|
|
38
38
|
import { Grid, Logger } from '@syncfusion/ej2-grids';
|
|
39
39
|
import { Render } from '../renderer/render';
|
|
40
40
|
import { DataManipulation } from './data';
|
|
41
|
-
import { RowDD } from '../actions/rowdragdrop';
|
|
42
41
|
import { iterateArrayOrObject } from '@syncfusion/ej2-grids';
|
|
43
42
|
import { ToolbarItem, ContextMenuItems } from '../enum';
|
|
44
43
|
import { PageSettings } from '../models/page-settings';
|
|
@@ -68,6 +67,8 @@ var TreeGrid = /** @class */ (function (_super) {
|
|
|
68
67
|
_this.changedRecords = 'changedRecords';
|
|
69
68
|
_this.deletedRecords = 'deletedRecords';
|
|
70
69
|
_this.addedRecords = 'addedRecords';
|
|
70
|
+
_this.indentOutdentAction = 'indentOutdentAction';
|
|
71
|
+
_this.modifiedRecords = [];
|
|
71
72
|
_this.objectEqualityChecker = function (old, current) {
|
|
72
73
|
if (old) {
|
|
73
74
|
var keys = Object.keys(old);
|
|
@@ -476,14 +477,14 @@ var TreeGrid = /** @class */ (function (_super) {
|
|
|
476
477
|
return modules;
|
|
477
478
|
};
|
|
478
479
|
TreeGrid.prototype.extendRequiredModules = function (modules) {
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
480
|
+
var IsRowDDInjected = this.injectedModules.filter(function (e) {
|
|
481
|
+
return e.name === 'RowDD';
|
|
482
|
+
});
|
|
483
|
+
if (this.allowRowDragAndDrop || IsRowDDInjected.length) {
|
|
484
|
+
if ((!isNullOrUndefined(this.toolbar) && (this.toolbar['includes']('Indent') ||
|
|
485
|
+
this.toolbar['includes']('Outdent')))) {
|
|
486
|
+
this.isIndentEnabled = true;
|
|
487
|
+
}
|
|
487
488
|
modules.push({
|
|
488
489
|
member: 'rowDragAndDrop',
|
|
489
490
|
args: [this]
|
|
@@ -612,6 +613,9 @@ var TreeGrid = /** @class */ (function (_super) {
|
|
|
612
613
|
var root = 'root';
|
|
613
614
|
this.grid[root] = this[root] ? this[root] : this;
|
|
614
615
|
this.grid.appendTo(gridContainer);
|
|
616
|
+
if (this.isIndentEnabled) {
|
|
617
|
+
this.refreshToolbarItems();
|
|
618
|
+
}
|
|
615
619
|
this.wireEvents();
|
|
616
620
|
this.renderComplete();
|
|
617
621
|
var destroyTemplate = 'destroyTemplate';
|
|
@@ -625,6 +629,15 @@ var TreeGrid = /** @class */ (function (_super) {
|
|
|
625
629
|
}
|
|
626
630
|
};
|
|
627
631
|
};
|
|
632
|
+
TreeGrid.prototype.refreshToolbarItems = function () {
|
|
633
|
+
var toolbarElement = this.toolbarModule.getToolbar();
|
|
634
|
+
var indentID = this.element.id + '_gridcontrol_indent';
|
|
635
|
+
var outdentID = this.element.id + '_gridcontrol_outdent';
|
|
636
|
+
var indentElement = toolbarElement.querySelector('#' + indentID).parentElement;
|
|
637
|
+
var outdentElement = toolbarElement.querySelector('#' + outdentID).parentElement;
|
|
638
|
+
indentElement.classList.add('e-hidden');
|
|
639
|
+
outdentElement.classList.add('e-hidden');
|
|
640
|
+
};
|
|
628
641
|
TreeGrid.prototype.afterGridRender = function () {
|
|
629
642
|
if (!isNullOrUndefined(this.grid.clipboardModule)) {
|
|
630
643
|
this.grid.clipboardModule.destroy();
|
|
@@ -1104,14 +1117,24 @@ var TreeGrid = /** @class */ (function (_super) {
|
|
|
1104
1117
|
}
|
|
1105
1118
|
if (_this.action === 'indenting' || _this.action === 'outdenting') {
|
|
1106
1119
|
_this.action = _this.action === 'indenting' ? 'indented' : 'outdented';
|
|
1120
|
+
var selectedItem_1 = [_this.selectedRecords];
|
|
1107
1121
|
var actionArgs = {
|
|
1122
|
+
data: selectedItem_1,
|
|
1123
|
+
dropIndex: _this.dropIndex,
|
|
1124
|
+
dropPosition: _this.dropPosition,
|
|
1125
|
+
modifiedRecords: _this.modifiedRecords,
|
|
1108
1126
|
requestType: _this.action,
|
|
1109
|
-
data: _this.selectedRecords,
|
|
1110
1127
|
row: _this.selectedRows
|
|
1111
1128
|
};
|
|
1112
1129
|
_this.trigger(events.actionComplete, actionArgs);
|
|
1130
|
+
var currentPageItem = _this.getCurrentViewRecords().filter(function (e) {
|
|
1131
|
+
return e.uniqueID === selectedItem_1[0].uniqueID;
|
|
1132
|
+
});
|
|
1133
|
+
if (!currentPageItem.length) {
|
|
1134
|
+
_this.refreshToolbarItems();
|
|
1135
|
+
}
|
|
1113
1136
|
_this.action = '';
|
|
1114
|
-
_this.selectedRecords = _this.selectedRows = [];
|
|
1137
|
+
_this.selectedRecords = _this.selectedRows = _this.modifiedRecords = [];
|
|
1115
1138
|
}
|
|
1116
1139
|
else {
|
|
1117
1140
|
_this.trigger(events.actionComplete, args);
|
|
@@ -1315,7 +1338,7 @@ var TreeGrid = /** @class */ (function (_super) {
|
|
|
1315
1338
|
case ToolbarItem.RowIndent:
|
|
1316
1339
|
tooltipText = this.l10n.getConstant('RowIndent');
|
|
1317
1340
|
items.push({
|
|
1318
|
-
text: tooltipText, tooltipText: tooltipText,
|
|
1341
|
+
text: tooltipText, tooltipText: tooltipText,
|
|
1319
1342
|
prefixIcon: 'e-indent', id: this.element.id + '_gridcontrol_indent'
|
|
1320
1343
|
});
|
|
1321
1344
|
break;
|
|
@@ -1323,7 +1346,7 @@ var TreeGrid = /** @class */ (function (_super) {
|
|
|
1323
1346
|
case ToolbarItem.RowOutdent:
|
|
1324
1347
|
tooltipText = this.l10n.getConstant('RowOutdent');
|
|
1325
1348
|
items.push({
|
|
1326
|
-
text: tooltipText, tooltipText: tooltipText,
|
|
1349
|
+
text: tooltipText, tooltipText: tooltipText,
|
|
1327
1350
|
prefixIcon: 'e-outdent', id: this.element.id + '_gridcontrol_outdent'
|
|
1328
1351
|
});
|
|
1329
1352
|
break;
|
|
@@ -3463,6 +3486,30 @@ var TreeGrid = /** @class */ (function (_super) {
|
|
|
3463
3486
|
TreeGrid.prototype.reorderRows = function (fromIndexes, toIndex, position) {
|
|
3464
3487
|
this.rowDragAndDropModule.reorderRows(fromIndexes, toIndex, position);
|
|
3465
3488
|
};
|
|
3489
|
+
/**
|
|
3490
|
+
* Indents the record to one level of hierarchy. Moves the selected row as the last child of its previous row.
|
|
3491
|
+
*
|
|
3492
|
+
* @param {Object} record – specifies the record to do indented
|
|
3493
|
+
* @returns {void}
|
|
3494
|
+
*/
|
|
3495
|
+
TreeGrid.prototype.indent = function (record) {
|
|
3496
|
+
if (!isNullOrUndefined(this.rowDragAndDropModule)) {
|
|
3497
|
+
record = record;
|
|
3498
|
+
this.rowDragAndDropModule[this.indentOutdentAction](record, 'indent');
|
|
3499
|
+
}
|
|
3500
|
+
};
|
|
3501
|
+
/**
|
|
3502
|
+
* Outdent the record to one level of hierarchy. Moves the selected row as sibling to its parent row.
|
|
3503
|
+
*
|
|
3504
|
+
* @param {Object} record – specifies the record to do outdented
|
|
3505
|
+
* @returns {void}
|
|
3506
|
+
*/
|
|
3507
|
+
TreeGrid.prototype.outdent = function (record) {
|
|
3508
|
+
if (!isNullOrUndefined(this.rowDragAndDropModule)) {
|
|
3509
|
+
record = record;
|
|
3510
|
+
this.rowDragAndDropModule[this.indentOutdentAction](record, 'outdent');
|
|
3511
|
+
}
|
|
3512
|
+
};
|
|
3466
3513
|
var TreeGrid_1;
|
|
3467
3514
|
__decorate([
|
|
3468
3515
|
Property(0)
|
|
@@ -326,7 +326,16 @@ export declare class Column {
|
|
|
326
326
|
* @default null
|
|
327
327
|
*/
|
|
328
328
|
freeze: freezeDirection;
|
|
329
|
+
private parent;
|
|
329
330
|
constructor(options: ColumnModel);
|
|
331
|
+
/**
|
|
332
|
+
* Update the State changes reflected for TreeGrid columndirective in react platform.
|
|
333
|
+
*
|
|
334
|
+
* @param {Column} column - specifies the column
|
|
335
|
+
* @returns {void}
|
|
336
|
+
* @hidden
|
|
337
|
+
*/
|
|
338
|
+
private setProperties;
|
|
330
339
|
}
|
|
331
340
|
/**
|
|
332
341
|
* Interface for a TreeGrid class Column
|
|
@@ -71,6 +71,25 @@ var Column = /** @class */ (function () {
|
|
|
71
71
|
this.filter = {};
|
|
72
72
|
merge(this, options);
|
|
73
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Update the State changes reflected for TreeGrid columndirective in react platform.
|
|
76
|
+
*
|
|
77
|
+
* @param {Column} column - specifies the column
|
|
78
|
+
* @returns {void}
|
|
79
|
+
* @hidden
|
|
80
|
+
*/
|
|
81
|
+
Column.prototype.setProperties = function (column) {
|
|
82
|
+
//Angular two way binding
|
|
83
|
+
var keys = Object.keys(column);
|
|
84
|
+
for (var i = 0; i < keys.length; i++) {
|
|
85
|
+
this[keys[i]] = column[keys[i]];
|
|
86
|
+
//Refresh the react columnTemplates on state change
|
|
87
|
+
if (this.parent && this.parent['isReact'] && keys[i] === 'template') {
|
|
88
|
+
var refreshReactColumnTemplateByUid = 'refreshReactColumnTemplateByUid';
|
|
89
|
+
this.parent.clipboardModule['treeGridParent'].renderModule[refreshReactColumnTemplateByUid](this.uid);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
};
|
|
74
93
|
return Column;
|
|
75
94
|
}());
|
|
76
95
|
export { Column };
|
|
@@ -13,7 +13,15 @@ export declare class RowDropSettings extends ChildProperty<RowDropSettings> {
|
|
|
13
13
|
}
|
|
14
14
|
export interface TreeActionEventArgs {
|
|
15
15
|
requestType?: string;
|
|
16
|
-
data?: ITreeData[];
|
|
16
|
+
data?: ITreeData | ITreeData[];
|
|
17
17
|
row?: Object[];
|
|
18
18
|
cancel?: boolean;
|
|
19
|
+
/** Defines the corresponding action */
|
|
20
|
+
action?: string;
|
|
21
|
+
/** Defines the target element from index. */
|
|
22
|
+
dropIndex?: number;
|
|
23
|
+
/** Defines drop position of the dragged record */
|
|
24
|
+
dropPosition?: string;
|
|
25
|
+
/** Defines the modified records. */
|
|
26
|
+
modifiedRecords?: ITreeData[];
|
|
19
27
|
}
|
|
@@ -29,6 +29,12 @@ export declare class Render {
|
|
|
29
29
|
*/
|
|
30
30
|
cellRender(args: QueryCellInfoEventArgs): void;
|
|
31
31
|
private updateTreeCell;
|
|
32
|
+
/**
|
|
33
|
+
* @param {string} columnUid - Defines column uid
|
|
34
|
+
* @returns {void}
|
|
35
|
+
* @hidden
|
|
36
|
+
*/
|
|
37
|
+
private refreshReactColumnTemplateByUid;
|
|
32
38
|
private columnTemplateResult;
|
|
33
39
|
private reactTemplateRender;
|
|
34
40
|
destroy(): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getObject, appendChildren } from '@syncfusion/ej2-grids';
|
|
2
|
-
import { templateCompiler, extend } from '@syncfusion/ej2-grids';
|
|
2
|
+
import { templateCompiler, extend, CellRenderer } from '@syncfusion/ej2-grids';
|
|
3
3
|
import { addClass, createElement, isNullOrUndefined, getValue } from '@syncfusion/ej2-base';
|
|
4
4
|
import * as events from '../base/constant';
|
|
5
5
|
import { isRemoteData, isOffline, getExpandStatus, isFilterChildHierarchy } from '../utils';
|
|
@@ -275,6 +275,32 @@ var Render = /** @class */ (function () {
|
|
|
275
275
|
args.cell.innerHTML = '';
|
|
276
276
|
}
|
|
277
277
|
};
|
|
278
|
+
/**
|
|
279
|
+
* @param {string} columnUid - Defines column uid
|
|
280
|
+
* @returns {void}
|
|
281
|
+
* @hidden
|
|
282
|
+
*/
|
|
283
|
+
Render.prototype.refreshReactColumnTemplateByUid = function (columnUid) {
|
|
284
|
+
var _this = this;
|
|
285
|
+
if (this.parent.isReact) {
|
|
286
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
287
|
+
this.parent.clearTemplate(['columnTemplate'], undefined, function () {
|
|
288
|
+
var cells = 'cells';
|
|
289
|
+
var rowIdx = 'index';
|
|
290
|
+
var rowsObj = _this.parent.grid.getRowsObject();
|
|
291
|
+
var indent = _this.parent.grid.getIndentCount();
|
|
292
|
+
var cellIndex = _this.parent.grid.getNormalizedColumnIndex(columnUid);
|
|
293
|
+
for (var j = 0; j < rowsObj.length; j++) {
|
|
294
|
+
if (rowsObj[j].isDataRow && !isNullOrUndefined(rowsObj[j].index)) {
|
|
295
|
+
var cell = rowsObj[j][cells][cellIndex];
|
|
296
|
+
var cellRenderer = new CellRenderer(_this.parent.grid, _this.parent.grid.serviceLocator);
|
|
297
|
+
var td = _this.parent.getCellFromIndex(rowsObj[j].index, cellIndex - indent);
|
|
298
|
+
cellRenderer.refreshTD(td, cell, rowsObj[j].data, { index: rowsObj[j][rowIdx] });
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
};
|
|
278
304
|
Render.prototype.columnTemplateResult = function (args) {
|
|
279
305
|
this.templateResult = args.template;
|
|
280
306
|
};
|
|
@@ -126,7 +126,7 @@ var VirtualTreeContentRenderer = /** @class */ (function (_super) {
|
|
|
126
126
|
getValue('virtualEle', this).setVirtualHeight(this.parent.getRowHeight() * e.count, '100%');
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
if ((!isNullOrUndefined(e.requestType) && e.requestType.toString() === 'collapseAll') || this.isDataSourceChanged) {
|
|
129
|
+
if ((!isNullOrUndefined(e.requestType) && e.requestType.toString() === 'collapseAll') || (this.isDataSourceChanged && this.startIndex === -1)) {
|
|
130
130
|
this.contents.scrollTop = 0;
|
|
131
131
|
this.isDataSourceChanged = false;
|
|
132
132
|
}
|