@syncfusion/ej2-gantt 19.4.55 → 20.1.47-1460716
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 +1072 -1047
- package/README.md +75 -75
- package/dist/ej2-gantt.umd.min.js +1 -10
- package/dist/ej2-gantt.umd.min.js.map +1 -1
- package/dist/es6/ej2-gantt.es2015.js +341 -240
- package/dist/es6/ej2-gantt.es2015.js.map +1 -1
- package/dist/es6/ej2-gantt.es5.js +713 -598
- package/dist/es6/ej2-gantt.es5.js.map +1 -1
- package/dist/global/ej2-gantt.min.js +1 -10
- package/dist/global/ej2-gantt.min.js.map +1 -1
- package/dist/global/index.d.ts +0 -9
- package/dist/ts/components.ts +4 -0
- package/dist/ts/gantt/actions/actions.ts +18 -0
- package/dist/ts/gantt/actions/cell-edit.ts +606 -0
- package/dist/ts/gantt/actions/chart-scroll.ts +167 -0
- package/dist/ts/gantt/actions/column-menu.ts +35 -0
- package/dist/ts/gantt/actions/column-reorder.ts +52 -0
- package/dist/ts/gantt/actions/column-resize.ts +52 -0
- package/dist/ts/gantt/actions/connector-line-edit.ts +829 -0
- package/dist/ts/gantt/actions/context-menu.ts +754 -0
- package/dist/ts/gantt/actions/day-markers.ts +80 -0
- package/dist/ts/gantt/actions/dependency.ts +692 -0
- package/dist/ts/gantt/actions/dialog-edit.ts +2208 -0
- package/dist/ts/gantt/actions/edit.ts +3499 -0
- package/dist/ts/gantt/actions/excel-export.ts +61 -0
- package/dist/ts/gantt/actions/filter.ts +302 -0
- package/dist/ts/gantt/actions/keyboard.ts +306 -0
- package/dist/ts/gantt/actions/pdf-export.ts +214 -0
- package/dist/ts/gantt/actions/rowdragdrop.ts +839 -0
- package/dist/ts/gantt/actions/selection.ts +536 -0
- package/dist/ts/gantt/actions/sort.ts +98 -0
- package/dist/ts/gantt/actions/taskbar-edit.ts +1940 -0
- package/dist/ts/gantt/actions/toolbar.ts +489 -0
- package/dist/ts/gantt/actions/virtual-scroll.ts +60 -0
- package/dist/ts/gantt/base/common.ts +9 -0
- package/dist/ts/gantt/base/constant.ts +13 -0
- package/dist/ts/gantt/base/css-constants.ts +148 -0
- package/dist/ts/gantt/base/date-processor.ts +1257 -0
- package/dist/ts/gantt/base/enum.ts +372 -0
- package/dist/ts/gantt/base/gantt-chart.ts +1248 -0
- package/dist/ts/gantt/base/gantt.ts +4069 -0
- package/dist/ts/gantt/base/interface.ts +955 -0
- package/dist/ts/gantt/base/splitter.ts +174 -0
- package/dist/ts/gantt/base/task-processor.ts +2217 -0
- package/dist/ts/gantt/base/tree-grid.ts +694 -0
- package/dist/ts/gantt/base/utils.ts +208 -0
- package/dist/ts/gantt/export/export-helper.ts +552 -0
- package/dist/ts/gantt/export/pdf-base/dictionary.ts +152 -0
- package/dist/ts/gantt/export/pdf-base/pdf-borders.ts +277 -0
- package/dist/ts/gantt/export/pdf-base/pdf-grid-table.ts +901 -0
- package/dist/ts/gantt/export/pdf-base/pdf-style/gantt-theme.ts +131 -0
- package/dist/ts/gantt/export/pdf-base/pdf-style/style.ts +91 -0
- package/dist/ts/gantt/export/pdf-base/treegrid-layouter.ts +414 -0
- package/dist/ts/gantt/export/pdf-connector-line.ts +422 -0
- package/dist/ts/gantt/export/pdf-gantt.ts +282 -0
- package/dist/ts/gantt/export/pdf-taskbar.ts +395 -0
- package/dist/ts/gantt/export/pdf-timeline.ts +202 -0
- package/dist/ts/gantt/export/pdf-treegrid.ts +406 -0
- package/dist/ts/gantt/models/add-dialog-field-settings.ts +33 -0
- package/dist/ts/gantt/models/column.ts +464 -0
- package/dist/ts/gantt/models/day-working-time.ts +22 -0
- package/dist/ts/gantt/models/edit-dialog-field-settings.ts +33 -0
- package/dist/ts/gantt/models/edit-settings.ts +79 -0
- package/dist/ts/gantt/models/event-marker.ts +27 -0
- package/dist/ts/gantt/models/filter-settings.ts +53 -0
- package/dist/ts/gantt/models/holiday.ts +34 -0
- package/dist/ts/gantt/models/label-settings.ts +30 -0
- package/dist/ts/gantt/models/models.ts +36 -0
- package/dist/ts/gantt/models/resource-fields.ts +38 -0
- package/dist/ts/gantt/models/search-settings.ts +77 -0
- package/dist/ts/gantt/models/selection-settings.ts +56 -0
- package/dist/ts/gantt/models/sort-settings.ts +50 -0
- package/dist/ts/gantt/models/splitter-settings.ts +47 -0
- package/dist/ts/gantt/models/task-fields.ts +171 -0
- package/dist/ts/gantt/models/timeline-settings.ts +112 -0
- package/dist/ts/gantt/models/tooltip-settings.ts +46 -0
- package/dist/ts/gantt/renderer/chart-rows.ts +1838 -0
- package/dist/ts/gantt/renderer/connector-line.ts +1025 -0
- package/dist/ts/gantt/renderer/edit-tooltip.ts +228 -0
- package/dist/ts/gantt/renderer/event-marker.ts +96 -0
- package/dist/ts/gantt/renderer/nonworking-day.ts +205 -0
- package/dist/ts/gantt/renderer/render.ts +5 -0
- package/dist/ts/gantt/renderer/timeline.ts +1397 -0
- package/dist/ts/gantt/renderer/tooltip.ts +450 -0
- package/dist/ts/gantt/renderer/virtual-content-render.ts +50 -0
- package/license +9 -9
- package/package.json +80 -80
- package/src/gantt/actions/cell-edit.js +2 -1
- package/src/gantt/actions/dialog-edit.js +2 -1
- package/src/gantt/actions/edit.js +36 -9
- package/src/gantt/actions/rowdragdrop.js +37 -15
- package/src/gantt/actions/selection.js +3 -2
- package/src/gantt/actions/taskbar-edit.js +24 -24
- package/src/gantt/base/date-processor.js +0 -1
- package/src/gantt/base/gantt-chart.js +36 -5
- package/src/gantt/base/gantt-model.d.ts +779 -779
- package/src/gantt/base/gantt.d.ts +27 -27
- package/src/gantt/base/gantt.js +35 -76
- package/src/gantt/base/splitter.js +1 -0
- package/src/gantt/base/task-processor.js +13 -13
- package/src/gantt/base/tree-grid.js +3 -1
- package/src/gantt/export/pdf-base/treegrid-layouter.js +13 -13
- package/src/gantt/export/pdf-connector-line.js +11 -11
- package/src/gantt/export/pdf-gantt.js +24 -24
- package/src/gantt/export/pdf-taskbar.js +11 -11
- package/src/gantt/export/pdf-treegrid.js +13 -13
- package/src/gantt/models/add-dialog-field-settings-model.d.ts +21 -21
- package/src/gantt/models/add-dialog-field-settings.js +19 -19
- package/src/gantt/models/day-working-time-model.d.ts +11 -11
- package/src/gantt/models/day-working-time.js +19 -19
- package/src/gantt/models/edit-dialog-field-settings-model.d.ts +21 -21
- package/src/gantt/models/edit-dialog-field-settings.js +19 -19
- package/src/gantt/models/edit-settings-model.d.ts +50 -50
- package/src/gantt/models/edit-settings.js +19 -19
- package/src/gantt/models/event-marker-model.d.ts +16 -16
- package/src/gantt/models/event-marker.js +19 -19
- package/src/gantt/models/filter-settings-model.d.ts +34 -34
- package/src/gantt/models/filter-settings.js +19 -19
- package/src/gantt/models/holiday-model.d.ts +21 -21
- package/src/gantt/models/holiday.js +19 -19
- package/src/gantt/models/label-settings-model.d.ts +16 -16
- package/src/gantt/models/label-settings.js +19 -19
- package/src/gantt/models/resource-fields-model.d.ts +21 -21
- package/src/gantt/models/resource-fields.js +19 -19
- package/src/gantt/models/search-settings-model.d.ts +56 -56
- package/src/gantt/models/search-settings.js +19 -19
- package/src/gantt/models/selection-settings-model.d.ts +35 -35
- package/src/gantt/models/selection-settings.js +19 -19
- package/src/gantt/models/sort-settings-model.d.ts +24 -24
- package/src/gantt/models/sort-settings.js +19 -19
- package/src/gantt/models/splitter-settings-model.d.ts +30 -30
- package/src/gantt/models/splitter-settings.js +19 -19
- package/src/gantt/models/task-fields-model.d.ts +110 -110
- package/src/gantt/models/task-fields.js +19 -19
- package/src/gantt/models/timeline-settings-model.d.ts +71 -71
- package/src/gantt/models/timeline-settings.js +19 -19
- package/src/gantt/models/tooltip-settings-model.d.ts +26 -26
- package/src/gantt/models/tooltip-settings.js +19 -19
- package/src/gantt/renderer/chart-rows.js +49 -37
- package/src/gantt/renderer/connector-line.js +22 -18
- package/src/gantt/renderer/event-marker.js +1 -0
- package/src/gantt/renderer/nonworking-day.js +13 -6
- package/src/gantt/renderer/timeline.d.ts +1 -0
- package/src/gantt/renderer/timeline.js +51 -12
- package/src/gantt/renderer/tooltip.js +11 -3
- package/styles/bootstrap-dark.css +442 -427
- package/styles/bootstrap.css +442 -433
- package/styles/bootstrap4.css +454 -479
- package/styles/bootstrap5-dark.css +457 -433
- package/styles/bootstrap5.css +457 -433
- package/styles/fabric-dark.css +438 -421
- package/styles/fabric.css +445 -428
- package/styles/fluent-dark.css +1938 -0
- package/styles/fluent-dark.scss +1 -0
- package/styles/fluent.css +1938 -0
- package/styles/fluent.scss +1 -0
- package/styles/gantt/_all.scss +2 -2
- package/styles/gantt/_bootstrap-dark-definition.scss +210 -156
- package/styles/gantt/_bootstrap-definition.scss +211 -157
- package/styles/gantt/_bootstrap4-definition.scss +213 -158
- package/styles/gantt/_bootstrap5-definition.scss +215 -162
- package/styles/gantt/_fabric-dark-definition.scss +211 -157
- package/styles/gantt/_fabric-definition.scss +211 -157
- package/styles/gantt/_fluent-dark-definition.scss +1 -0
- package/styles/gantt/_fluent-definition.scss +215 -162
- package/styles/gantt/_fusionnew-definition.scss +214 -0
- package/styles/gantt/_highcontrast-definition.scss +211 -157
- package/styles/gantt/_highcontrast-light-definition.scss +211 -157
- package/styles/gantt/_layout.scss +1446 -1027
- package/styles/gantt/_material-dark-definition.scss +212 -157
- package/styles/gantt/_material-definition.scss +212 -157
- package/styles/gantt/_material3-definition.scss +215 -0
- package/styles/gantt/_tailwind-definition.scss +215 -161
- package/styles/gantt/_theme.scss +702 -668
- package/styles/gantt/bootstrap-dark.css +442 -427
- package/styles/gantt/bootstrap.css +442 -433
- package/styles/gantt/bootstrap4.css +454 -479
- package/styles/gantt/bootstrap5-dark.css +457 -433
- package/styles/gantt/bootstrap5.css +457 -433
- package/styles/gantt/fabric-dark.css +438 -421
- package/styles/gantt/fabric.css +445 -428
- package/styles/gantt/fluent-dark.css +1938 -0
- package/styles/gantt/fluent-dark.scss +22 -0
- package/styles/gantt/fluent.css +1938 -0
- package/styles/gantt/fluent.scss +22 -0
- package/styles/gantt/highcontrast-light.css +405 -405
- package/styles/gantt/highcontrast.css +444 -456
- package/styles/gantt/icons/_bootstrap-dark.scss +124 -113
- package/styles/gantt/icons/_bootstrap.scss +124 -113
- package/styles/gantt/icons/_bootstrap4.scss +124 -113
- package/styles/gantt/icons/_bootstrap5.scss +124 -112
- package/styles/gantt/icons/_fabric-dark.scss +124 -112
- package/styles/gantt/icons/_fabric.scss +124 -112
- package/styles/gantt/icons/_fluent-dark.scss +1 -0
- package/styles/gantt/icons/_fluent.scss +124 -112
- package/styles/gantt/icons/_fusionnew.scss +120 -0
- package/styles/gantt/icons/_highcontrast.scss +124 -112
- package/styles/gantt/icons/_material-dark.scss +124 -112
- package/styles/gantt/icons/_material.scss +124 -112
- package/styles/gantt/icons/_material3.scss +124 -0
- package/styles/gantt/icons/_tailwind-dark.scss +124 -113
- package/styles/gantt/icons/_tailwind.scss +124 -113
- package/styles/gantt/material-dark.css +446 -417
- package/styles/gantt/material.css +445 -419
- package/styles/gantt/tailwind-dark.css +452 -482
- package/styles/gantt/tailwind.css +449 -479
- package/styles/highcontrast-light.css +405 -405
- package/styles/highcontrast.css +444 -456
- package/styles/material-dark.css +446 -417
- package/styles/material.css +445 -419
- package/styles/tailwind-dark.css +452 -482
- package/styles/tailwind.css +449 -479
|
@@ -0,0 +1,694 @@
|
|
|
1
|
+
import { Gantt } from './gantt';
|
|
2
|
+
import { TreeGrid, ColumnModel } from '@syncfusion/ej2-treegrid';
|
|
3
|
+
import { createElement, isNullOrUndefined, getValue, extend, EventHandler, deleteObject } from '@syncfusion/ej2-base';
|
|
4
|
+
import { FilterEventArgs, SortEventArgs, FailureEventArgs } from '@syncfusion/ej2-grids';
|
|
5
|
+
import { setValue, getElement } from '@syncfusion/ej2-base';
|
|
6
|
+
import { Deferred, Query } from '@syncfusion/ej2-data';
|
|
7
|
+
import { TaskFieldsModel } from '../models/models';
|
|
8
|
+
import { ColumnModel as GanttColumnModel, Column as GanttColumn } from '../models/column';
|
|
9
|
+
import { ITaskData, IGanttData } from './interface';
|
|
10
|
+
import { DataStateChangeEventArgs } from '@syncfusion/ej2-treegrid';
|
|
11
|
+
import { QueryCellInfoEventArgs, HeaderCellInfoEventArgs, RowDataBoundEventArgs } from '@syncfusion/ej2-grids';
|
|
12
|
+
import { ColumnMenuOpenEventArgs, ColumnMenuClickEventArgs } from '@syncfusion/ej2-grids';
|
|
13
|
+
import { isCountRequired } from './utils';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* TreeGrid related code goes here
|
|
17
|
+
*
|
|
18
|
+
* @param {object} args .
|
|
19
|
+
* @returns {void} .
|
|
20
|
+
*/
|
|
21
|
+
export class GanttTreeGrid {
|
|
22
|
+
private parent: Gantt;
|
|
23
|
+
private treeGridElement: HTMLElement;
|
|
24
|
+
public treeGridColumns: ColumnModel[];
|
|
25
|
+
/**
|
|
26
|
+
* @private
|
|
27
|
+
*/
|
|
28
|
+
public currentEditRow: {};
|
|
29
|
+
private previousScroll: { top: number, left: number } = { top: 0, left: 0 };
|
|
30
|
+
/** @hidden */
|
|
31
|
+
public prevCurrentView: Object;
|
|
32
|
+
|
|
33
|
+
constructor(parent: Gantt) {
|
|
34
|
+
this.parent = parent;
|
|
35
|
+
this.parent.treeGrid = new TreeGrid();
|
|
36
|
+
this.parent.treeGrid.allowSelection = false;
|
|
37
|
+
this.parent.treeGrid.allowKeyboard = this.parent.allowKeyboard;
|
|
38
|
+
this.parent.treeGrid.enableImmutableMode = this.parent.enableImmutableMode;
|
|
39
|
+
this.treeGridColumns = [];
|
|
40
|
+
this.validateGanttColumns();
|
|
41
|
+
this.addEventListener();
|
|
42
|
+
}
|
|
43
|
+
private addEventListener(): void {
|
|
44
|
+
this.parent.on('renderPanels', this.createContainer, this);
|
|
45
|
+
this.parent.on('chartScroll', this.updateScrollTop, this);
|
|
46
|
+
this.parent.on('destroy', this.destroy, this);
|
|
47
|
+
this.parent.treeGrid.on('renderReactTemplate', this.renderReactTemplate, this);
|
|
48
|
+
}
|
|
49
|
+
private renderReactTemplate(args: Object[]): void {
|
|
50
|
+
const portals: string = 'portals';
|
|
51
|
+
this.parent[portals] = args;
|
|
52
|
+
this.parent.renderTemplates();
|
|
53
|
+
}
|
|
54
|
+
private createContainer(): void {
|
|
55
|
+
//let height: number = this.parent.ganttHeight - this.parent.toolbarModule.element.offsetHeight - 46;
|
|
56
|
+
this.treeGridElement = createElement('div', {
|
|
57
|
+
id: 'treeGrid' + this.parent.element.id, className: 'e-gantt-tree-grid'
|
|
58
|
+
// styles: 'height:' + height + 'px;'
|
|
59
|
+
});
|
|
60
|
+
const tempHeader: HTMLElement = createElement('div', { className: 'e-gantt-temp-header' });
|
|
61
|
+
this.parent.treeGridPane.appendChild(this.treeGridElement);
|
|
62
|
+
this.treeGridElement.appendChild(tempHeader);
|
|
63
|
+
this.parent.treeGridPane.classList.add('e-temp-content');
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Method to initiate TreeGrid
|
|
67
|
+
*
|
|
68
|
+
* @returns {void} .
|
|
69
|
+
*/
|
|
70
|
+
public renderTreeGrid(): void {
|
|
71
|
+
this.composeProperties();
|
|
72
|
+
this.bindEvents();
|
|
73
|
+
const root: string = 'root';
|
|
74
|
+
this.parent.treeGrid[root] = this.parent[root] ? this.parent[root] : this.parent;
|
|
75
|
+
this.parent.treeGrid.appendTo(this.treeGridElement);
|
|
76
|
+
this.wireEvents();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
private composeProperties(): void {
|
|
80
|
+
this.parent.treeGrid.showColumnMenu = this.parent.showColumnMenu;
|
|
81
|
+
this.parent.treeGrid.columnMenuItems = this.parent.columnMenuItems;
|
|
82
|
+
this.parent.treeGrid.childMapping = isNullOrUndefined(this.parent.taskFields.child) ? '' : this.parent.taskFields.child;
|
|
83
|
+
this.parent.treeGrid.treeColumnIndex = this.parent.treeColumnIndex;
|
|
84
|
+
this.parent.treeGrid.columns = this.treeGridColumns;
|
|
85
|
+
if (this.parent.dataSource instanceof Object && isCountRequired(this.parent)) {
|
|
86
|
+
// In order to bind the observable data at load time, hasChildMapping is necessary to be mapped.
|
|
87
|
+
this.parent.treeGrid.hasChildMapping = 'isParent';
|
|
88
|
+
const count: number = getValue('count', this.parent.dataSource);
|
|
89
|
+
this.parent.treeGrid.dataSource = {result: this.parent.flatData, count: count};
|
|
90
|
+
} else {
|
|
91
|
+
this.parent.treeGrid.hasChildMapping = null;
|
|
92
|
+
this.parent.treeGrid.dataSource = this.parent.flatData;
|
|
93
|
+
}
|
|
94
|
+
this.parent.treeGrid.expandStateMapping = this.parent.taskFields.expandState;
|
|
95
|
+
const isGantt: string = 'isGantt';
|
|
96
|
+
this.parent.treeGrid[isGantt] = true;
|
|
97
|
+
this.parent.treeGrid.rowHeight = this.parent.rowHeight;
|
|
98
|
+
this.parent.treeGrid.gridLines = this.parent.gridLines;
|
|
99
|
+
if (this.parent.searchSettings.fields.length !== 0 || this.parent.searchSettings.key !== '') {
|
|
100
|
+
this.parent.treeGrid.searchSettings = this.parent.searchSettings;
|
|
101
|
+
}
|
|
102
|
+
const isJsComponent: string = 'isJsComponent';
|
|
103
|
+
this.parent.treeGrid[isJsComponent] = true;
|
|
104
|
+
let toolbarHeight: number = 0;
|
|
105
|
+
if (!isNullOrUndefined(this.parent.toolbarModule) && !isNullOrUndefined(this.parent.toolbarModule.element)) {
|
|
106
|
+
toolbarHeight = this.parent.toolbarModule.element.offsetHeight;
|
|
107
|
+
}
|
|
108
|
+
this.parent.treeGrid.height = this.parent.ganttHeight - toolbarHeight - 46;
|
|
109
|
+
}
|
|
110
|
+
private getContentDiv(): HTMLElement {
|
|
111
|
+
return this.treeGridElement.querySelector('.e-content');
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
private getHeaderDiv(): HTMLElement {
|
|
115
|
+
return this.treeGridElement.querySelector('.e-headercontent');
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
private getScrollbarWidth(): number {
|
|
119
|
+
const outer: HTMLElement = document.createElement('div');
|
|
120
|
+
outer.style.visibility = 'hidden';
|
|
121
|
+
outer.style.overflow = 'scroll';
|
|
122
|
+
outer.style.msOverflowStyle = 'scrollbar';
|
|
123
|
+
const inner: HTMLElement = document.createElement('div');
|
|
124
|
+
outer.appendChild(inner);
|
|
125
|
+
this.parent.element.appendChild(outer);
|
|
126
|
+
const scrollbarWidth: number = (outer.offsetWidth - inner.offsetWidth);
|
|
127
|
+
outer.parentNode.removeChild(outer);
|
|
128
|
+
return scrollbarWidth;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* @returns {void} .
|
|
132
|
+
* @private
|
|
133
|
+
*/
|
|
134
|
+
public ensureScrollBar(): void {
|
|
135
|
+
const content: HTMLElement = this.getContentDiv();
|
|
136
|
+
const headerDiv: HTMLElement = this.getHeaderDiv();
|
|
137
|
+
const scrollWidth: number = this.getScrollbarWidth();
|
|
138
|
+
const isMobile: boolean = /Android|Mac|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
|
139
|
+
if (scrollWidth !== 0) {
|
|
140
|
+
content.style.cssText += 'width: calc(100% + ' + (scrollWidth + 1) + 'px);';
|
|
141
|
+
} else {
|
|
142
|
+
content.classList.add('e-gantt-scroll-padding');
|
|
143
|
+
}
|
|
144
|
+
if (scrollWidth === 0 && isMobile) {
|
|
145
|
+
headerDiv.style.cssText += 'width: calc(100% + 17px);';
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
private bindEvents(): void {
|
|
149
|
+
this.parent.treeGrid.dataBound = this.dataBound.bind(this);
|
|
150
|
+
this.parent.treeGrid.collapsing = this.collapsing.bind(this);
|
|
151
|
+
this.parent.treeGrid.collapsed = this.collapsed.bind(this);
|
|
152
|
+
this.parent.treeGrid.expanding = this.expanding.bind(this);
|
|
153
|
+
this.parent.treeGrid.expanded = this.expanded.bind(this);
|
|
154
|
+
this.parent.treeGrid.actionBegin = this.actionBegin.bind(this);
|
|
155
|
+
this.parent.treeGrid.actionComplete = this.treeActionComplete.bind(this);
|
|
156
|
+
this.parent.treeGrid.created = this.created.bind(this);
|
|
157
|
+
this.parent.treeGrid.actionFailure = this.actionFailure.bind(this);
|
|
158
|
+
this.parent.treeGrid.queryCellInfo = this.queryCellInfo.bind(this);
|
|
159
|
+
this.parent.treeGrid.headerCellInfo = this.headerCellInfo.bind(this);
|
|
160
|
+
this.parent.treeGrid.rowDataBound = this.rowDataBound.bind(this);
|
|
161
|
+
this.parent.treeGrid.columnMenuOpen = this.columnMenuOpen.bind(this);
|
|
162
|
+
this.parent.treeGrid.columnMenuClick = this.columnMenuClick.bind(this);
|
|
163
|
+
this.parent.treeGrid.beforeDataBound = this.beforeDataBound.bind(this);
|
|
164
|
+
this.parent.treeGrid.dataStateChange = this.dataStateChange.bind(this);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
private beforeDataBound(args: object): void {
|
|
168
|
+
this.parent.updatedRecords = this.parent.virtualScrollModule && this.parent.enableVirtualization ?
|
|
169
|
+
getValue('virtualScrollModule.visualData', this.parent.treeGrid) : getValue('result', args);
|
|
170
|
+
if (this.parent.virtualScrollModule && this.parent.enableVirtualization) {
|
|
171
|
+
this.parent.updateContentHeight(args);
|
|
172
|
+
}
|
|
173
|
+
setValue('contentModule.objectEqualityChecker', this.objectEqualityChecker, this.parent.treeGrid.grid);
|
|
174
|
+
}
|
|
175
|
+
private dataBound(args: object): void {
|
|
176
|
+
this.ensureScrollBar();
|
|
177
|
+
this.parent.treeDataBound(args);
|
|
178
|
+
this.prevCurrentView = extend([], [], this.parent.currentViewData, true);
|
|
179
|
+
}
|
|
180
|
+
private dataStateChange(args: DataStateChangeEventArgs): void {
|
|
181
|
+
if (args.action && args.action.requestType === 'refresh') {
|
|
182
|
+
this.parent.treeGrid.dataSource = {
|
|
183
|
+
result: getValue('result', this.parent.treeGrid.dataSource),
|
|
184
|
+
count: getValue('count', this.parent.treeGrid.dataSource)
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
this.parent.trigger('dataStateChange', args);
|
|
188
|
+
}
|
|
189
|
+
private collapsing(args: object): void | Deferred {
|
|
190
|
+
// Collapsing event
|
|
191
|
+
const callBackPromise: Deferred = new Deferred();
|
|
192
|
+
if (!this.parent.ganttChartModule.isExpandCollapseFromChart) {
|
|
193
|
+
const collapsingArgs: object = this.createExpandCollapseArgs(args);
|
|
194
|
+
this.parent.ganttChartModule.collapseGanttRow(collapsingArgs);
|
|
195
|
+
setValue('cancel', getValue('cancel', collapsingArgs), args);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
private expanding(args: object): void | Deferred {
|
|
199
|
+
// Expanding event
|
|
200
|
+
const callBackPromise: Deferred = new Deferred();
|
|
201
|
+
if (!this.parent.ganttChartModule.isExpandCollapseFromChart) {
|
|
202
|
+
const expandingArgs: object = this.createExpandCollapseArgs(args);
|
|
203
|
+
this.parent.ganttChartModule.expandGanttRow(expandingArgs);
|
|
204
|
+
setValue('cancel', getValue('cancel', expandingArgs), args);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
private collapsed(args: object): void {
|
|
208
|
+
if (!this.parent.ganttChartModule.isExpandCollapseFromChart && !this.parent.isExpandCollapseLevelMethod) {
|
|
209
|
+
const collapsedArgs: object = this.createExpandCollapseArgs(args);
|
|
210
|
+
this.parent.ganttChartModule.collapsedGanttRow(collapsedArgs);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
private expanded(args: object): void {
|
|
214
|
+
if (!this.parent.ganttChartModule.isExpandCollapseFromChart && !this.parent.isExpandCollapseLevelMethod) {
|
|
215
|
+
if(!args['data'].length) {
|
|
216
|
+
const expandedArgs: object = this.createExpandCollapseArgs(args);
|
|
217
|
+
this.parent.ganttChartModule.expandedGanttRow(expandedArgs);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
private actionBegin(args: FilterEventArgs | SortEventArgs): void {
|
|
222
|
+
this.parent.notify('actionBegin', args);
|
|
223
|
+
let flag:boolean = getValue('doubleClickTarget', this.parent.treeGrid.editModule);
|
|
224
|
+
if(flag !== null){
|
|
225
|
+
setValue('doubleClickTarget', null, this.parent.treeGrid.editModule);
|
|
226
|
+
}
|
|
227
|
+
this.parent.trigger('actionBegin', args);
|
|
228
|
+
}// eslint-disable-next-line
|
|
229
|
+
private created(args: object): void {
|
|
230
|
+
this.updateKeyConfigSettings();
|
|
231
|
+
}
|
|
232
|
+
private actionFailure(args: FailureEventArgs): void {
|
|
233
|
+
this.parent.trigger('actionFailure', args);
|
|
234
|
+
}
|
|
235
|
+
private queryCellInfo = (args: QueryCellInfoEventArgs) => {
|
|
236
|
+
this.parent.trigger('queryCellInfo', args);
|
|
237
|
+
}
|
|
238
|
+
private headerCellInfo = (args: HeaderCellInfoEventArgs) => {
|
|
239
|
+
this.parent.trigger('headerCellInfo', args);
|
|
240
|
+
}
|
|
241
|
+
private rowDataBound = (args: RowDataBoundEventArgs) => {
|
|
242
|
+
this.parent.trigger('rowDataBound', args);
|
|
243
|
+
}
|
|
244
|
+
private columnMenuOpen = (args: ColumnMenuOpenEventArgs) => {
|
|
245
|
+
this.parent.notify('columnMenuOpen', args);
|
|
246
|
+
this.parent.trigger('columnMenuOpen', args);
|
|
247
|
+
}
|
|
248
|
+
private columnMenuClick = (args: ColumnMenuClickEventArgs) => {
|
|
249
|
+
this.parent.trigger('columnMenuClick', args);
|
|
250
|
+
}
|
|
251
|
+
private createExpandCollapseArgs(args: object): object {
|
|
252
|
+
const record: IGanttData = getValue('data', args);
|
|
253
|
+
const gridRow: Node = getValue('row', args);
|
|
254
|
+
let chartRow: Node;
|
|
255
|
+
chartRow = this.parent.ganttChartModule.getChartRows()[this.parent.currentViewData.indexOf(record)];
|
|
256
|
+
const eventArgs: object = { data: record, gridRow: gridRow, chartRow: chartRow, cancel: false };
|
|
257
|
+
return eventArgs;
|
|
258
|
+
}
|
|
259
|
+
// eslint-disable-next-line valid-jsdoc
|
|
260
|
+
private objectEqualityChecker = (old: Object, current: Object) => {
|
|
261
|
+
if (old) {
|
|
262
|
+
const keys: string[] = Object.keys(old);
|
|
263
|
+
let isEqual: boolean = true;
|
|
264
|
+
const excludeKeys: string[] = ['Children', 'childRecords', 'taskData', 'uniqueID', 'parentItem', 'parentUniqueID', 'ganttProperties'];
|
|
265
|
+
for (let i: number = 0; i < keys.length; i++) {
|
|
266
|
+
/* eslint-disable-next-line */
|
|
267
|
+
const oldKey: any = old[keys[i]] instanceof Date ? new Date(old[keys[i]]).getTime() : old[keys[i]];
|
|
268
|
+
/* eslint-disable-next-line */
|
|
269
|
+
const currentKey: any = current[keys[i]] instanceof Date ? new Date(current[keys[i]]).getTime() : current[keys[i]];
|
|
270
|
+
if (oldKey !== currentKey && excludeKeys.indexOf(keys[i]) === -1) {
|
|
271
|
+
this.parent.modifiedRecords.push(current);
|
|
272
|
+
isEqual = false; break;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
return isEqual;
|
|
276
|
+
} else {
|
|
277
|
+
return false;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
private treeActionComplete(args: object): void {
|
|
281
|
+
const updatedArgs: object = extend({}, args, true);
|
|
282
|
+
if (getValue('requestType', args) === 'sorting') {
|
|
283
|
+
this.parent.notify('updateModel', {});
|
|
284
|
+
deleteObject(updatedArgs, 'isFrozen');
|
|
285
|
+
} else if (getValue('requestType', args) === 'filtering') {
|
|
286
|
+
this.parent.notify('updateModel', {});
|
|
287
|
+
const focussedElement: HTMLElement = this.parent.element.querySelector('.e-treegrid');
|
|
288
|
+
focussedElement.focus();
|
|
289
|
+
} else if (getValue('type', args) === 'save') {
|
|
290
|
+
if (this.parent.editModule && this.parent.editModule.cellEditModule) {
|
|
291
|
+
const data: IGanttData = getValue('data', args);
|
|
292
|
+
if (!isNullOrUndefined(data) && !isNullOrUndefined(this.parent.getTaskByUniqueID(data.uniqueID))) {
|
|
293
|
+
/* eslint-disable-next-line */
|
|
294
|
+
this.parent.getTaskByUniqueID(data.uniqueID).taskData[this.parent.taskFields.duration] = data.taskData[this.parent.taskFields.duration];
|
|
295
|
+
if (!isNullOrUndefined(data.taskData[this.parent.taskFields.resourceInfo])) {
|
|
296
|
+
/* eslint-disable-next-line */
|
|
297
|
+
this.parent.getTaskByUniqueID(data.uniqueID).taskData[this.parent.taskFields.resourceInfo] = data.taskData[this.parent.taskFields.resourceInfo];
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
this.parent.editModule.cellEditModule.initiateCellEdit(args, this.currentEditRow);
|
|
301
|
+
this.currentEditRow = {};
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
if (getValue('requestType', args) === 'filterafteropen') {
|
|
305
|
+
this.parent.notify('actionComplete', args);
|
|
306
|
+
}
|
|
307
|
+
if (getValue('requestType', args) === 'searching') {
|
|
308
|
+
this.parent.notify('actionComplete', args);
|
|
309
|
+
}
|
|
310
|
+
if (!isNullOrUndefined(getValue('batchChanges', args)) && !isNullOrUndefined(this.parent.toolbarModule)) {
|
|
311
|
+
this.parent.toolbarModule.refreshToolbarItems();
|
|
312
|
+
}
|
|
313
|
+
if (this.parent.isCancelled) {
|
|
314
|
+
setValue('requestType', 'cancel', updatedArgs);
|
|
315
|
+
setValue('action', 'CellEditing', updatedArgs);
|
|
316
|
+
this.parent.isCancelled = false;
|
|
317
|
+
}
|
|
318
|
+
if (getValue('requestType', args) === 'refresh' && isNullOrUndefined(getValue('type', args)) && this.parent.addDeleteRecord) {
|
|
319
|
+
if (this.parent.selectedRowIndex != -1) {
|
|
320
|
+
this.parent.selectRow(this.parent.selectedRowIndex);
|
|
321
|
+
if (this.parent.selectedRowIndex > this.parent.currentViewData.length - 1) {
|
|
322
|
+
this.parent.selectedRowIndex = -1
|
|
323
|
+
}
|
|
324
|
+
} else {
|
|
325
|
+
this.parent.selectRow(0);
|
|
326
|
+
}
|
|
327
|
+
this.parent.addDeleteRecord = false;
|
|
328
|
+
}
|
|
329
|
+
this.parent.trigger('actionComplete', updatedArgs);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
private updateKeyConfigSettings(): void {
|
|
333
|
+
delete this.parent.treeGrid.grid.keyboardModule.keyConfigs.delete;
|
|
334
|
+
delete this.parent.treeGrid.grid.keyboardModule.keyConfigs.insert;
|
|
335
|
+
delete this.parent.treeGrid.grid.keyboardModule.keyConfigs.upArrow;
|
|
336
|
+
delete this.parent.treeGrid.grid.keyboardModule.keyConfigs.downArrow;
|
|
337
|
+
delete this.parent.treeGrid.grid.keyboardModule.keyConfigs.ctrlHome;
|
|
338
|
+
delete this.parent.treeGrid.grid.keyboardModule.keyConfigs.ctrlEnd;
|
|
339
|
+
delete this.parent.treeGrid.grid.keyboardModule.keyConfigs.enter;
|
|
340
|
+
delete this.parent.treeGrid.grid.keyboardModule.keyConfigs.tab;
|
|
341
|
+
delete this.parent.treeGrid.grid.keyboardModule.keyConfigs.shiftTab;
|
|
342
|
+
delete this.parent.treeGrid.keyboardModule.keyConfigs.enter;
|
|
343
|
+
delete this.parent.treeGrid.keyboardModule.keyConfigs.upArrow;
|
|
344
|
+
delete this.parent.treeGrid.keyboardModule.keyConfigs.downArrow;
|
|
345
|
+
delete this.parent.treeGrid.keyboardModule.keyConfigs.ctrlShiftUpArrow;
|
|
346
|
+
delete this.parent.treeGrid.keyboardModule.keyConfigs.ctrlShiftDownArrow;
|
|
347
|
+
delete this.parent.treeGrid.keyboardModule.keyConfigs.ctrlUpArrow;
|
|
348
|
+
delete this.parent.treeGrid.keyboardModule.keyConfigs.ctrlDownArrow;
|
|
349
|
+
delete this.parent.treeGrid.keyboardModule.keyConfigs.tab;
|
|
350
|
+
delete this.parent.treeGrid.keyboardModule.keyConfigs.shiftTab;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Method to bind internal events on TreeGrid element
|
|
355
|
+
*
|
|
356
|
+
* @returns {void} .
|
|
357
|
+
*/
|
|
358
|
+
private wireEvents(): void {
|
|
359
|
+
const content: HTMLElement = this.parent.treeGrid.element.querySelector('.e-content');
|
|
360
|
+
if (content) {
|
|
361
|
+
EventHandler.add(content, 'scroll', this.scrollHandler, this);
|
|
362
|
+
}
|
|
363
|
+
if (this.parent.isAdaptive) {
|
|
364
|
+
EventHandler.add(this.parent.treeGridPane, 'click', this.treeGridClickHandler, this);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
private unWireEvents(): void {
|
|
368
|
+
const content: HTMLElement = this.parent.treeGrid.element &&
|
|
369
|
+
this.parent.treeGrid.element.querySelector('.e-content');
|
|
370
|
+
if (content) {
|
|
371
|
+
EventHandler.remove(content, 'scroll', this.scrollHandler);
|
|
372
|
+
}
|
|
373
|
+
if (this.parent.isAdaptive) {
|
|
374
|
+
EventHandler.remove(this.parent.treeGridPane, 'click', this.treeGridClickHandler);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
// eslint-disable-next-line
|
|
378
|
+
private scrollHandler(e: WheelEvent): void {
|
|
379
|
+
const content: HTMLElement = this.parent.treeGrid.element.querySelector('.e-content');
|
|
380
|
+
if (content.scrollTop !== this.previousScroll.top) {
|
|
381
|
+
this.parent.notify('grid-scroll', { top: content.scrollTop });
|
|
382
|
+
}
|
|
383
|
+
this.previousScroll.top = content.scrollTop;
|
|
384
|
+
if (this.parent.contextMenuModule && this.parent.contextMenuModule.isOpen) {
|
|
385
|
+
this.parent.contextMenuModule.contextMenu.close();
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* @returns {void} .
|
|
390
|
+
* @private
|
|
391
|
+
*/
|
|
392
|
+
public validateGanttColumns(): void {
|
|
393
|
+
const ganttObj: Gantt = this.parent;
|
|
394
|
+
const length: number = ganttObj.columns.length;
|
|
395
|
+
const tasks: TaskFieldsModel = this.parent.taskFields;
|
|
396
|
+
this.parent.columnMapping = {};
|
|
397
|
+
this.parent.columnByField = {};
|
|
398
|
+
this.parent.customColumns = [];
|
|
399
|
+
const tasksMapping: string[] = ['id', 'name', 'startDate', 'endDate', 'duration', 'dependency',
|
|
400
|
+
'progress', 'baselineStartDate', 'baselineEndDate', 'resourceInfo', 'notes', 'work', 'manual', 'type'];
|
|
401
|
+
for (let i: number = 0; i < length; i++) {
|
|
402
|
+
let column: GanttColumnModel = {};
|
|
403
|
+
if (typeof ganttObj.columns[i] === 'string') {
|
|
404
|
+
column.field = ganttObj.columns[i] as string;
|
|
405
|
+
} else {
|
|
406
|
+
column = <GanttColumnModel>ganttObj.columns[i];
|
|
407
|
+
}
|
|
408
|
+
let columnName: string[] = [];
|
|
409
|
+
if (tasksMapping.length > 0) {
|
|
410
|
+
columnName = tasksMapping.filter((name: string) => {
|
|
411
|
+
return column.field === tasks[name];
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
if (columnName.length === 0) {
|
|
415
|
+
if (column.field === this.parent.resourceFields.group) {
|
|
416
|
+
continue;
|
|
417
|
+
}
|
|
418
|
+
this.parent.customColumns.push(column.field);
|
|
419
|
+
column.headerText = column.headerText ? column.headerText : column.field;
|
|
420
|
+
column.width = column.width ? column.width : 150;
|
|
421
|
+
column.editType = column.editType ? column.editType : 'stringedit';
|
|
422
|
+
column.type = column.type ? column.type : 'string';
|
|
423
|
+
this.bindTreeGridColumnProperties(column, true);
|
|
424
|
+
continue;
|
|
425
|
+
} else {
|
|
426
|
+
const index: number = tasksMapping.indexOf(columnName[0]);
|
|
427
|
+
tasksMapping.splice(index, 1);
|
|
428
|
+
this.createTreeGridColumn(column, true);
|
|
429
|
+
this.parent.columnMapping[columnName[0]] = column.field;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/** Create default columns with task settings property */
|
|
434
|
+
for (let j: number = 0; j < tasksMapping.length; j++) {
|
|
435
|
+
const column: GanttColumnModel = {};
|
|
436
|
+
if (!isNullOrUndefined(tasks[tasksMapping[j]])) {
|
|
437
|
+
column.field = tasks[tasksMapping[j]];
|
|
438
|
+
this.createTreeGridColumn(column, length === 0);
|
|
439
|
+
this.parent.columnMapping[tasksMapping[j]] = column.field;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
if (this.parent.viewType !== 'ProjectView') {
|
|
443
|
+
const column: GanttColumnModel = {};
|
|
444
|
+
this.composeUniqueIDColumn(column);
|
|
445
|
+
this.createTreeGridColumn(column, true);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
*
|
|
451
|
+
* @param {GanttColumnModel} column .
|
|
452
|
+
* @param {boolean} isDefined .
|
|
453
|
+
* @returns {void} .
|
|
454
|
+
*/
|
|
455
|
+
private createTreeGridColumn(column: GanttColumnModel, isDefined?: boolean): void {
|
|
456
|
+
const taskSettings: TaskFieldsModel = this.parent.taskFields;
|
|
457
|
+
column.disableHtmlEncode = !isNullOrUndefined(column.disableHtmlEncode) ? column.disableHtmlEncode : this.parent.disableHtmlEncode;
|
|
458
|
+
if (taskSettings.id !== column.field) {
|
|
459
|
+
column.clipMode = column.clipMode ? column.clipMode : 'EllipsisWithTooltip';
|
|
460
|
+
}
|
|
461
|
+
if (taskSettings.id === column.field) {
|
|
462
|
+
/** Id column */
|
|
463
|
+
this.composeIDColumn(column);
|
|
464
|
+
} else if (taskSettings.name === column.field) {
|
|
465
|
+
/** Name column */
|
|
466
|
+
column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('name');
|
|
467
|
+
column.width = column.width ? column.width : 150;
|
|
468
|
+
column.editType = column.editType ? column.editType : 'stringedit';
|
|
469
|
+
column.type = column.type ? column.type : 'string';
|
|
470
|
+
} else if (taskSettings.startDate === column.field) {
|
|
471
|
+
/** Name column */
|
|
472
|
+
column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('startDate');
|
|
473
|
+
column.editType = column.editType ? column.editType :
|
|
474
|
+
this.parent.getDateFormat().toLowerCase().indexOf('hh') !== -1 ? 'datetimepickeredit' : 'datepickeredit';
|
|
475
|
+
column.format = column.format ? column.format : { type: 'date', format: this.parent.getDateFormat() };
|
|
476
|
+
column.width = column.width ? column.width : 150;
|
|
477
|
+
column.edit = { params: { renderDayCell: this.parent.renderWorkingDayCell.bind(this.parent) } };
|
|
478
|
+
} else if (taskSettings.endDate === column.field) {
|
|
479
|
+
column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('endDate');
|
|
480
|
+
column.format = column.format ? column.format : { type: 'date', format: this.parent.getDateFormat() };
|
|
481
|
+
column.editType = column.editType ? column.editType :
|
|
482
|
+
this.parent.getDateFormat().toLowerCase().indexOf('hh') !== -1 ? 'datetimepickeredit' : 'datepickeredit';
|
|
483
|
+
column.width = column.width ? column.width : 150;
|
|
484
|
+
column.edit = { params: { renderDayCell: this.parent.renderWorkingDayCell.bind(this.parent) } };
|
|
485
|
+
} else if (taskSettings.duration === column.field) {
|
|
486
|
+
column.width = column.width ? column.width : 150;
|
|
487
|
+
column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('duration');
|
|
488
|
+
column.valueAccessor = column.valueAccessor ? column.valueAccessor : !isNullOrUndefined(column.edit) ? null :
|
|
489
|
+
this.durationValueAccessor.bind(this);
|
|
490
|
+
column.editType = column.editType ? column.editType : 'stringedit';
|
|
491
|
+
column.type = 'string';
|
|
492
|
+
} else if (taskSettings.progress === column.field) {
|
|
493
|
+
this.composeProgressColumn(column);
|
|
494
|
+
} else if (taskSettings.dependency === column.field) {
|
|
495
|
+
column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('dependency');
|
|
496
|
+
column.width = column.width ? column.width : 150;
|
|
497
|
+
column.editType = column.editType ? column.editType : 'stringedit';
|
|
498
|
+
column.type = 'string';
|
|
499
|
+
column.allowFiltering = column.allowFiltering === false ? false : true;
|
|
500
|
+
} else if (taskSettings.resourceInfo === column.field) {
|
|
501
|
+
this.composeResourceColumn(column);
|
|
502
|
+
} else if (taskSettings.notes === column.field) {
|
|
503
|
+
column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('notes');
|
|
504
|
+
column.width = column.width ? column.width : 150;
|
|
505
|
+
column.editType = column.editType ? column.editType : 'stringedit';
|
|
506
|
+
if (!this.parent.showInlineNotes) {
|
|
507
|
+
if (!column.template) {
|
|
508
|
+
column.template = '<div class="e-ganttnotes-info">' +
|
|
509
|
+
'<span class="e-icons e-notes-info"></span></div>';
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
} else if (taskSettings.baselineStartDate === column.field ||
|
|
513
|
+
taskSettings.baselineEndDate === column.field) {
|
|
514
|
+
const colName: string = (taskSettings.baselineEndDate === column.field) ? 'baselineEndDate' :
|
|
515
|
+
'baselineStartDate';
|
|
516
|
+
column.width = column.width ? column.width : 150;
|
|
517
|
+
column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant(colName);
|
|
518
|
+
column.format = column.format ? column.format : { type: 'date', format: this.parent.getDateFormat() };
|
|
519
|
+
column.editType = column.editType ? column.editType :
|
|
520
|
+
this.parent.getDateFormat().toLowerCase().indexOf('hh') !== -1 ? 'datetimepickeredit' : 'datepickeredit';
|
|
521
|
+
} else if (taskSettings.work === column.field) {
|
|
522
|
+
column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('work');
|
|
523
|
+
column.width = column.width ? column.width : 150;
|
|
524
|
+
column.valueAccessor = column.valueAccessor ? column.valueAccessor : this.workValueAccessor.bind(this);
|
|
525
|
+
column.editType = column.editType ? column.editType : 'numericedit';
|
|
526
|
+
|
|
527
|
+
} else if (taskSettings.type === column.field) {
|
|
528
|
+
column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('taskType');
|
|
529
|
+
column.width = column.width ? column.width : 150;
|
|
530
|
+
//column.type = 'string';
|
|
531
|
+
column.editType = 'dropdownedit';
|
|
532
|
+
column.valueAccessor = column.valueAccessor ? column.valueAccessor : this.taskTypeValueAccessor.bind(this);
|
|
533
|
+
} else if (taskSettings.manual === column.field && this.parent.taskMode === 'Custom') {
|
|
534
|
+
column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('taskMode');
|
|
535
|
+
column.width = column.width ? column.width : 120;
|
|
536
|
+
column.editType = column.editType ? column.editType : 'dropdownedit';
|
|
537
|
+
column.valueAccessor = column.valueAccessor ? column.valueAccessor : this.modeValueAccessor.bind(this);
|
|
538
|
+
column.edit = {
|
|
539
|
+
params:
|
|
540
|
+
{
|
|
541
|
+
query: new Query(),
|
|
542
|
+
dataSource: [
|
|
543
|
+
{ id: 1, text: this.parent.localeObj.getConstant('manual'), value: true },
|
|
544
|
+
{ id: 2, text: this.parent.localeObj.getConstant('auto'), value: false }
|
|
545
|
+
],
|
|
546
|
+
fields: { text: 'text', value: 'value'}
|
|
547
|
+
}
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
this.bindTreeGridColumnProperties(column, isDefined);
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Compose Resource columns
|
|
554
|
+
*
|
|
555
|
+
* @param {GanttColumnModel} column .
|
|
556
|
+
* @returns {void} .
|
|
557
|
+
*/
|
|
558
|
+
private composeResourceColumn(column: GanttColumnModel): void {
|
|
559
|
+
column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('resourceName');
|
|
560
|
+
column.width = column.width ? column.width : 150;
|
|
561
|
+
column.type = 'string';
|
|
562
|
+
column.valueAccessor = column.valueAccessor ? column.valueAccessor : this.resourceValueAccessor.bind(this);
|
|
563
|
+
column.allowFiltering = column.allowFiltering === false ? false : true;
|
|
564
|
+
}
|
|
565
|
+
/**
|
|
566
|
+
* @param {IGanttData} data .
|
|
567
|
+
* @returns {object} .
|
|
568
|
+
* @private
|
|
569
|
+
*/
|
|
570
|
+
public getResourceIds(data: IGanttData): object {
|
|
571
|
+
const value: Object[] = getValue(this.parent.taskFields.resourceInfo, data.taskData);
|
|
572
|
+
const id: number[] = [];
|
|
573
|
+
if (!isNullOrUndefined(value)) {
|
|
574
|
+
for (let i: number = 0; i < value.length; i++) {
|
|
575
|
+
id.push(typeof value[i] === 'object' ? value[i][this.parent.resourceFields.id] : value[i]);
|
|
576
|
+
}
|
|
577
|
+
return id;
|
|
578
|
+
} else {
|
|
579
|
+
return value;
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* Create Id column
|
|
584
|
+
*
|
|
585
|
+
* @param {GanttColumnModel} column .
|
|
586
|
+
* @returns {void} .
|
|
587
|
+
*/
|
|
588
|
+
private composeIDColumn(column: GanttColumnModel): void {
|
|
589
|
+
const isProjectView: boolean = this.parent.viewType === 'ProjectView';
|
|
590
|
+
column.isPrimaryKey = isProjectView ? true : false;
|
|
591
|
+
column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('id');
|
|
592
|
+
column.width = column.width ? column.width : 100;
|
|
593
|
+
column.allowEditing = column.allowEditing ? column.allowEditing : false;
|
|
594
|
+
column.editType = column.editType ? column.editType : 'numericedit';
|
|
595
|
+
column.valueAccessor = isProjectView ? null : this.idValueAccessor.bind(this);
|
|
596
|
+
}
|
|
597
|
+
private composeUniqueIDColumn(column: GanttColumnModel): void {
|
|
598
|
+
column.field = 'rowUniqueID';
|
|
599
|
+
column.isPrimaryKey = true;
|
|
600
|
+
column.headerText = 'UniqueID';
|
|
601
|
+
column.allowEditing = false;
|
|
602
|
+
column.visible = false;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* Create progress column
|
|
607
|
+
*
|
|
608
|
+
* @param {GanttColumnModel} column .
|
|
609
|
+
* @returns {void} .
|
|
610
|
+
*/
|
|
611
|
+
private composeProgressColumn(column: GanttColumnModel): void {
|
|
612
|
+
column.headerText = column.headerText ? column.headerText : this.parent.localeObj.getConstant('progress');
|
|
613
|
+
column.width = column.width ? column.width : 150;
|
|
614
|
+
column.editType = column.editType ? column.editType : 'numericedit';
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
/**
|
|
618
|
+
* @param {GanttColumnModel} newGanttColumn .
|
|
619
|
+
* @param {boolean} isDefined .
|
|
620
|
+
* @returns {void} .
|
|
621
|
+
*/
|
|
622
|
+
private bindTreeGridColumnProperties(newGanttColumn: GanttColumnModel, isDefined?: boolean): void {
|
|
623
|
+
const treeGridColumn: ColumnModel = {}; const ganttColumn: GanttColumnModel = {};
|
|
624
|
+
for (const prop of Object.keys(newGanttColumn)) {
|
|
625
|
+
treeGridColumn[prop] = ganttColumn[prop] = newGanttColumn[prop];
|
|
626
|
+
}
|
|
627
|
+
this.parent.columnByField[ganttColumn.field] = ganttColumn;
|
|
628
|
+
this.parent.ganttColumns.push(new GanttColumn(ganttColumn));
|
|
629
|
+
if (isDefined) {
|
|
630
|
+
this.treeGridColumns.push(treeGridColumn);
|
|
631
|
+
}
|
|
632
|
+
}// eslint-disable-next-line
|
|
633
|
+
private durationValueAccessor(field: string, data: IGanttData, column: GanttColumnModel): string {
|
|
634
|
+
const ganttProp: ITaskData = data.ganttProperties;
|
|
635
|
+
if (!isNullOrUndefined(ganttProp)) {
|
|
636
|
+
return this.parent.dataOperation.getDurationString(ganttProp.duration, ganttProp.durationUnit);
|
|
637
|
+
}
|
|
638
|
+
return '';
|
|
639
|
+
}// eslint-disable-next-line
|
|
640
|
+
private resourceValueAccessor(field: string, data: IGanttData, column: GanttColumnModel): string {
|
|
641
|
+
const ganttProp: ITaskData = data.ganttProperties;
|
|
642
|
+
if (!isNullOrUndefined(ganttProp)) {
|
|
643
|
+
return ganttProp.resourceNames;
|
|
644
|
+
}
|
|
645
|
+
return '';
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
private workValueAccessor(field: string, data: IGanttData, column: GanttColumnModel): string { // eslint-disable-line
|
|
649
|
+
const ganttProp: ITaskData = data.ganttProperties;
|
|
650
|
+
if (!isNullOrUndefined(ganttProp)) {
|
|
651
|
+
return this.parent.dataOperation.getWorkString(ganttProp.work, ganttProp.workUnit);
|
|
652
|
+
}
|
|
653
|
+
return '';
|
|
654
|
+
}
|
|
655
|
+
private taskTypeValueAccessor(field: string, data: IGanttData, column: GanttColumnModel): string { // eslint-disable-line
|
|
656
|
+
const ganttProp: ITaskData = data.ganttProperties;
|
|
657
|
+
if (!isNullOrUndefined(ganttProp)) {
|
|
658
|
+
return ganttProp.taskType;
|
|
659
|
+
}
|
|
660
|
+
return '';
|
|
661
|
+
}
|
|
662
|
+
private modeValueAccessor(field: string, data: IGanttData, column: GanttColumnModel): string { // eslint-disable-line
|
|
663
|
+
if (data[field]) {
|
|
664
|
+
return 'Manual';
|
|
665
|
+
} else {
|
|
666
|
+
return 'Auto';
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
private idValueAccessor(field: string, data: IGanttData, column: GanttColumnModel): string { // eslint-disable-line
|
|
671
|
+
return data.level === 0 ? 'R-' + data.ganttProperties.taskId : 'T-' + data.ganttProperties.taskId;
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
private updateScrollTop(args: object): void {
|
|
675
|
+
this.treeGridElement.querySelector('.e-content').scrollTop = getValue('top', args);
|
|
676
|
+
this.previousScroll.top = this.treeGridElement.querySelector('.e-content').scrollTop;
|
|
677
|
+
}
|
|
678
|
+
private treeGridClickHandler(e: PointerEvent): void {
|
|
679
|
+
this.parent.notify('treeGridClick', e);
|
|
680
|
+
}
|
|
681
|
+
private removeEventListener(): void {
|
|
682
|
+
this.parent.off('renderPanels', this.createContainer);
|
|
683
|
+
this.parent.off('chartScroll', this.updateScrollTop);
|
|
684
|
+
this.parent.off('destroy', this.destroy);
|
|
685
|
+
this.parent.treeGrid.off('reactTemplateRender', this.renderReactTemplate);
|
|
686
|
+
}
|
|
687
|
+
private destroy(): void {
|
|
688
|
+
this.removeEventListener();
|
|
689
|
+
this.unWireEvents();
|
|
690
|
+
if (this.parent.treeGrid.element) {
|
|
691
|
+
this.parent.treeGrid.destroy();
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
}
|