@syncfusion/ej2-gantt 19.4.56 → 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 -1060
- 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 +274 -176
- package/dist/es6/ej2-gantt.es2015.js.map +1 -1
- package/dist/es6/ej2-gantt.es5.js +642 -534
- 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 +11 -2
- package/src/gantt/actions/rowdragdrop.js +37 -15
- 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 +9 -4
- 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 +22 -22
- 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 +48 -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,489 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Toolbar action related code goes here
|
|
3
|
+
*/
|
|
4
|
+
import { Gantt } from '../base/gantt';
|
|
5
|
+
import { Toolbar as NavToolbar, ItemModel, ClickEventArgs } from '@syncfusion/ej2-navigations';
|
|
6
|
+
import { createElement, extend, isNullOrUndefined, remove, getValue, EventHandler, addClass } from '@syncfusion/ej2-base';
|
|
7
|
+
import * as cls from '../base/css-constants';
|
|
8
|
+
import * as events from '../base/constant';
|
|
9
|
+
import { RowSelectEventArgs } from '@syncfusion/ej2-grids';
|
|
10
|
+
import { ToolbarItem } from '../base/enum';
|
|
11
|
+
import { EditSettingsModel } from '../models/edit-settings-model';
|
|
12
|
+
import { TextBox } from '@syncfusion/ej2-inputs';
|
|
13
|
+
import { IGanttData } from '../base/common';
|
|
14
|
+
export class Toolbar {
|
|
15
|
+
private parent: Gantt;
|
|
16
|
+
private predefinedItems: { [key: string]: ItemModel } = {};
|
|
17
|
+
private id: string;
|
|
18
|
+
public toolbar: NavToolbar;
|
|
19
|
+
private items: string[] = ['Add', 'Edit', 'Update', 'Delete', 'Cancel', 'ExpandAll', 'CollapseAll', 'Search',
|
|
20
|
+
'PrevTimeSpan', 'NextTimeSpan', 'ZoomIn', 'ZoomOut', 'ZoomToFit', 'ExcelExport',
|
|
21
|
+
'CsvExport', 'PdfExport', 'Indent', 'Outdent'];
|
|
22
|
+
public element: HTMLElement;
|
|
23
|
+
private searchElement: HTMLInputElement;
|
|
24
|
+
constructor(parent: Gantt) {
|
|
25
|
+
this.parent = parent;
|
|
26
|
+
this.id = this.parent.element.id;
|
|
27
|
+
this.parent.on('ui-toolbarupdate', this.propertyChanged, this);
|
|
28
|
+
}
|
|
29
|
+
private getModuleName(): string {
|
|
30
|
+
return 'toolbar';
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @returns {void} .
|
|
34
|
+
* @private
|
|
35
|
+
*/
|
|
36
|
+
public renderToolbar(): void {
|
|
37
|
+
const toolbarItems: (ToolbarItem | string | ItemModel)[] = this.parent.toolbar || [];
|
|
38
|
+
if (toolbarItems.length > 0) {
|
|
39
|
+
this.element = createElement(
|
|
40
|
+
'div', { id: this.parent.controlId + '_Gantt_Toolbar', className: cls.toolbar }
|
|
41
|
+
);
|
|
42
|
+
if (this.parent.treeGrid.grid.headerModule) {
|
|
43
|
+
this.parent.element.insertBefore(this.element, this.parent.treeGridPane.offsetParent);
|
|
44
|
+
} else {
|
|
45
|
+
this.parent.element.appendChild(this.element);
|
|
46
|
+
}
|
|
47
|
+
const preItems: ToolbarItem[] = ['Add', 'Edit', 'Update', 'Delete', 'Cancel', 'ExpandAll', 'CollapseAll',
|
|
48
|
+
'PrevTimeSpan', 'NextTimeSpan', 'ZoomIn', 'ZoomOut', 'ZoomToFit', 'ExcelExport', 'CsvExport',
|
|
49
|
+
'PdfExport', 'Indent', 'Outdent'];
|
|
50
|
+
for (const item of preItems) {
|
|
51
|
+
const itemStr: string = item.toLowerCase();
|
|
52
|
+
const localeName: string = item[0].toLowerCase() + item.slice(1);
|
|
53
|
+
this.predefinedItems[item] = {
|
|
54
|
+
id: this.parent.element.id + '_' + itemStr, prefixIcon: 'e-' + itemStr,
|
|
55
|
+
text: this.parent.isAdaptive ? '' : this.parent.localeObj.getConstant(localeName),
|
|
56
|
+
tooltipText: this.parent.localeObj.getConstant(localeName) + ((localeName === 'add' ||
|
|
57
|
+
localeName === 'edit' || localeName === 'delete') ? this.parent.localeObj.getConstant('task') :
|
|
58
|
+
(localeName === 'expandAll' || localeName === 'collapseAll') ?
|
|
59
|
+
this.parent.localeObj.getConstant('tasks') : ''),
|
|
60
|
+
align: this.parent.isAdaptive ? 'Right' : 'Left'
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
const searchLocalText: string = this.parent.localeObj.getConstant('search');
|
|
64
|
+
if (this.parent.isAdaptive) {
|
|
65
|
+
(this.predefinedItems as { Search: ItemModel }).Search = {
|
|
66
|
+
id: this.id + '_searchbutton',
|
|
67
|
+
prefixIcon: 'e-search-icon',
|
|
68
|
+
tooltipText: searchLocalText,
|
|
69
|
+
align: 'Right'
|
|
70
|
+
};
|
|
71
|
+
} else {
|
|
72
|
+
(this.predefinedItems as { Search: ItemModel }).Search = {
|
|
73
|
+
id: this.id + '_search',
|
|
74
|
+
template: '<div class="e-input-group e-search" role="search">' +
|
|
75
|
+
'<input id="' + this.id + '_searchbar" class="e-input" name="input" type="search"' +
|
|
76
|
+
// eslint-disable-next-line
|
|
77
|
+
'placeholder= \"' + searchLocalText + '\"/>' +
|
|
78
|
+
'<span id="' + this.id + '_searchbutton" class="e-input-group-icon e-search-icon e-icons"' +
|
|
79
|
+
'tabindex="-1" title="' + searchLocalText + '" aria-label= "search"></span>' +
|
|
80
|
+
'</div>',
|
|
81
|
+
tooltipText: searchLocalText,
|
|
82
|
+
align: 'Right', cssClass: 'e-search-wrapper'
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
this.createToolbar();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
private createToolbar(): void {
|
|
90
|
+
const items: ItemModel[] = this.getItems();
|
|
91
|
+
this.toolbar = new NavToolbar({
|
|
92
|
+
items: items,
|
|
93
|
+
clicked: this.toolbarClickHandler.bind(this),
|
|
94
|
+
height: this.parent.isAdaptive ? 48 : 'auto'
|
|
95
|
+
});
|
|
96
|
+
this.toolbar.isStringTemplate = true;
|
|
97
|
+
this.toolbar.appendTo(this.element);
|
|
98
|
+
const cancelItem: Element = this.element.querySelector('#' + this.parent.element.id + '_cancel');
|
|
99
|
+
const updateItem: Element = this.element.querySelector('#' + this.parent.element.id + '_update');
|
|
100
|
+
if (cancelItem) {
|
|
101
|
+
addClass([cancelItem], cls.focusCell);
|
|
102
|
+
}
|
|
103
|
+
if (updateItem) {
|
|
104
|
+
addClass([updateItem], cls.focusCell);
|
|
105
|
+
}
|
|
106
|
+
if (this.parent.isAdaptive) {
|
|
107
|
+
this.element.insertBefore(this.getSearchBarElement(), this.element.childNodes[0]);
|
|
108
|
+
this.searchElement = this.element.querySelector('#' + this.parent.element.id + '_searchbar');
|
|
109
|
+
const textObj: TextBox = new TextBox({
|
|
110
|
+
placeholder: this.parent.localeObj.getConstant('search'),
|
|
111
|
+
floatLabelType: 'Never',
|
|
112
|
+
showClearButton: true
|
|
113
|
+
});
|
|
114
|
+
textObj.appendTo(this.searchElement);
|
|
115
|
+
} else {
|
|
116
|
+
this.searchElement = this.element.querySelector('#' + this.parent.element.id + '_searchbar');
|
|
117
|
+
}
|
|
118
|
+
if (this.parent.filterModule) {
|
|
119
|
+
this.wireEvent();
|
|
120
|
+
if (this.parent.searchSettings) {
|
|
121
|
+
this.updateSearchTextBox();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (this.parent.readOnly) {
|
|
125
|
+
this.enableItems(
|
|
126
|
+
[this.parent.element.id + '_add', this.parent.element.id + '_update', this.parent.element.id + '_delete'
|
|
127
|
+
, this.parent.element.id + '_cancel', this.parent.element.id + '_indent', this.parent.element.id + '_outdent'],
|
|
128
|
+
false);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
private getSearchBarElement(): HTMLElement {
|
|
132
|
+
const div: HTMLElement = createElement('div', { className: 'e-adaptive-searchbar', styles: 'display: none' });
|
|
133
|
+
const textbox: HTMLElement = createElement('input', { attrs: { type: 'text' }, id: this.parent.element.id + '_searchbar' });
|
|
134
|
+
const span: HTMLElement = createElement('span', { className: 'e-backarrowspan e-icons' });
|
|
135
|
+
span.onclick = () => {
|
|
136
|
+
div.style.display = 'none';
|
|
137
|
+
(this.element.childNodes[1] as HTMLElement).style.display = 'block';
|
|
138
|
+
};
|
|
139
|
+
div.appendChild(span);
|
|
140
|
+
div.appendChild(textbox);
|
|
141
|
+
return div;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
private wireEvent(): void {
|
|
145
|
+
if (this.searchElement) {
|
|
146
|
+
EventHandler.add(this.searchElement, 'keyup', this.keyUpHandler, this);
|
|
147
|
+
EventHandler.add(this.searchElement, 'focus', this.focusHandler, this);
|
|
148
|
+
EventHandler.add(this.searchElement, 'blur', this.blurHandler, this);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
private propertyChanged(property: object): void {
|
|
152
|
+
const module: string = getValue('module', property);
|
|
153
|
+
if (module !== this.getModuleName() || !this.parent.toolbar) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
if (this.element && this.element.parentNode) {
|
|
157
|
+
remove(this.element);
|
|
158
|
+
}
|
|
159
|
+
this.renderToolbar();
|
|
160
|
+
this.refreshToolbarItems();
|
|
161
|
+
}
|
|
162
|
+
private unWireEvent(): void {
|
|
163
|
+
if (this.searchElement) {
|
|
164
|
+
EventHandler.remove(this.searchElement, 'keyup', this.keyUpHandler);
|
|
165
|
+
EventHandler.remove(this.searchElement, 'focus', this.focusHandler);
|
|
166
|
+
EventHandler.remove(this.searchElement, 'blur', this.blurHandler);
|
|
167
|
+
this.searchElement = null;
|
|
168
|
+
}
|
|
169
|
+
this.parent.off('ui-toolbarupdate', this.propertyChanged);
|
|
170
|
+
}
|
|
171
|
+
private keyUpHandler(e: { keyCode: number }): void {
|
|
172
|
+
if (e.keyCode === 13 && this.parent.searchSettings.key !== this.searchElement.value) {
|
|
173
|
+
this.parent.searchSettings.key = this.searchElement.value;
|
|
174
|
+
this.parent.dataBind();
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
private focusHandler(e: FocusEvent): void {
|
|
178
|
+
(e.target as HTMLElement).parentElement.classList.add('e-input-focus');
|
|
179
|
+
}
|
|
180
|
+
private blurHandler(e: FocusEvent): void {
|
|
181
|
+
(e.target as HTMLElement).parentElement.classList.remove('e-input-focus');
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Method to set value for search input box
|
|
185
|
+
*
|
|
186
|
+
* @returns {void} .
|
|
187
|
+
* @hidden
|
|
188
|
+
*/
|
|
189
|
+
public updateSearchTextBox(): void {
|
|
190
|
+
if (this.searchElement && this.searchElement.value !== this.parent.searchSettings.key) {
|
|
191
|
+
this.searchElement.value = this.parent.searchSettings.key;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
private getItems(): ItemModel[] {
|
|
195
|
+
const items: ItemModel[] = [];
|
|
196
|
+
const toolbarItems: (ToolbarItem | string | ItemModel)[] = this.parent.toolbar;
|
|
197
|
+
let searchIndex: number = -1;
|
|
198
|
+
toolbarItems.forEach((item: string | ItemModel, index: number) => {
|
|
199
|
+
if ((typeof (item) === 'string' && item === 'Search') ||
|
|
200
|
+
((typeof (item) === 'object') && item.text === 'Search')) {
|
|
201
|
+
searchIndex = index;
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
if (searchIndex > -1) {
|
|
205
|
+
const searchItem: (string | ItemModel)[] = toolbarItems.splice(searchIndex, 1);
|
|
206
|
+
toolbarItems.push(searchItem[0]);
|
|
207
|
+
}
|
|
208
|
+
for (const item of toolbarItems) {
|
|
209
|
+
if (typeof item === 'string') {
|
|
210
|
+
items.push(this.getItemObject(item));
|
|
211
|
+
} else {
|
|
212
|
+
items.push(this.getItem(item));
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return items;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
private getItem(itemObject: ItemModel): ItemModel {
|
|
219
|
+
const item: ItemModel = this.predefinedItems[itemObject.text];
|
|
220
|
+
return item ? extend(item, item, itemObject) : itemObject;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
private getItemObject(itemName: string): ItemModel {
|
|
224
|
+
return this.predefinedItems[itemName] || { text: itemName, id: this.id + '_' + itemName };
|
|
225
|
+
}
|
|
226
|
+
private toolbarClickHandler(arg: ClickEventArgs): void {
|
|
227
|
+
const gObj: Gantt = this.parent;
|
|
228
|
+
const gID: string = this.id;
|
|
229
|
+
extend(arg, { cancel: false });
|
|
230
|
+
gObj.trigger(events.toolbarClick, arg, (args: ClickEventArgs) => {
|
|
231
|
+
if (args.cancel) {
|
|
232
|
+
return;
|
|
233
|
+
} else {
|
|
234
|
+
if (this.parent.isAdaptive === true) {
|
|
235
|
+
if (args.item.id === gID + '_edit' || args.item.id === gID + '_add' || args.item.id === gID + '_delete'
|
|
236
|
+
|| args.item.id === gID + '_searchbutton' || args.item.id === gID + '_expandall'
|
|
237
|
+
|| args.item.id === gID + '_collapseall') {
|
|
238
|
+
if (this.parent.selectionModule && this.parent.selectionSettings.type === 'Multiple') {
|
|
239
|
+
this.parent.selectionModule.hidePopUp();
|
|
240
|
+
(<HTMLElement>document.getElementsByClassName('e-gridpopup')[0]).style.display = 'none';
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
switch (!isNullOrUndefined(args.item) && args.item.id) {
|
|
245
|
+
case gID + '_edit':
|
|
246
|
+
if (gObj.editModule && gObj.editSettings.allowEditing) {
|
|
247
|
+
gObj.editModule.dialogModule.openToolbarEditDialog();
|
|
248
|
+
}
|
|
249
|
+
break;
|
|
250
|
+
case gID + '_indent':
|
|
251
|
+
if (gObj.editModule && gObj.selectionModule.getSelectedRecords().length) {
|
|
252
|
+
gObj.indent();
|
|
253
|
+
}
|
|
254
|
+
break;
|
|
255
|
+
case gID + '_outdent':
|
|
256
|
+
if (gObj.editModule && gObj.selectionModule.getSelectedRecords().length) {
|
|
257
|
+
gObj.outdent();
|
|
258
|
+
}
|
|
259
|
+
break;
|
|
260
|
+
case gID + '_update':
|
|
261
|
+
gObj.editModule.cellEditModule.isCellEdit = false;
|
|
262
|
+
gObj.treeGrid.grid.saveCell();
|
|
263
|
+
break;
|
|
264
|
+
case gID + '_cancel':
|
|
265
|
+
gObj.cancelEdit();
|
|
266
|
+
break;
|
|
267
|
+
case gID + '_add':
|
|
268
|
+
if (gObj.editModule && gObj.editSettings.allowAdding) {
|
|
269
|
+
gObj.editModule.dialogModule.openAddDialog();
|
|
270
|
+
}
|
|
271
|
+
break;
|
|
272
|
+
case gID + '_delete':
|
|
273
|
+
if (this.parent.selectionModule && this.parent.editModule) {
|
|
274
|
+
if ((this.parent.selectionSettings.mode !== 'Cell' && this.parent.selectionModule.selectedRowIndexes.length)
|
|
275
|
+
|| (this.parent.selectionSettings.mode === 'Cell' &&
|
|
276
|
+
this.parent.selectionModule.getSelectedRowCellIndexes().length)) {
|
|
277
|
+
this.parent.editModule.startDeleteAction();
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
break;
|
|
281
|
+
case gID + '_search':
|
|
282
|
+
{
|
|
283
|
+
const searchButtonId: string = getValue('originalEvent.target.id', args);
|
|
284
|
+
if (searchButtonId === this.parent.element.id + '_searchbutton' && this.parent.filterModule) {
|
|
285
|
+
const keyVal: string =
|
|
286
|
+
(<HTMLInputElement>this.element.querySelector('#' + this.parent.element.id + '_searchbar')).value;
|
|
287
|
+
if (this.parent.searchSettings.key !== keyVal) {
|
|
288
|
+
this.parent.searchSettings.key = keyVal;
|
|
289
|
+
this.parent.dataBind();
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
break;
|
|
293
|
+
}
|
|
294
|
+
case gID + '_searchbutton':
|
|
295
|
+
{
|
|
296
|
+
const adaptiveSearchbar: HTMLElement = this.element.querySelector('.e-adaptive-searchbar');
|
|
297
|
+
(adaptiveSearchbar.parentElement.childNodes[1] as HTMLElement).style.display = 'none';
|
|
298
|
+
adaptiveSearchbar.style.display = 'block';
|
|
299
|
+
break;
|
|
300
|
+
}
|
|
301
|
+
case gID + '_expandall':
|
|
302
|
+
this.parent.ganttChartModule.expandCollapseAll('expand');
|
|
303
|
+
break;
|
|
304
|
+
case gID + '_collapseall':
|
|
305
|
+
this.parent.ganttChartModule.expandCollapseAll('collapse');
|
|
306
|
+
break;
|
|
307
|
+
case gID + '_prevtimespan':
|
|
308
|
+
this.parent.previousTimeSpan();
|
|
309
|
+
break;
|
|
310
|
+
case gID + '_nexttimespan':
|
|
311
|
+
this.parent.nextTimeSpan();
|
|
312
|
+
break;
|
|
313
|
+
case gID + '_zoomin':
|
|
314
|
+
this.zoomIn();
|
|
315
|
+
break;
|
|
316
|
+
case gID + '_zoomout':
|
|
317
|
+
this.zoomOut();
|
|
318
|
+
break;
|
|
319
|
+
case gID + '_zoomtofit':
|
|
320
|
+
this.zoomToFit();
|
|
321
|
+
break;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
*
|
|
328
|
+
* @returns {void} .
|
|
329
|
+
* @private
|
|
330
|
+
*/
|
|
331
|
+
public zoomIn(): void {
|
|
332
|
+
this.parent.timelineModule.processZooming(true);
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
*
|
|
336
|
+
* @returns {void} .
|
|
337
|
+
* @private
|
|
338
|
+
*/
|
|
339
|
+
public zoomToFit(): void {
|
|
340
|
+
this.parent.timelineModule.processZoomToFit();
|
|
341
|
+
this.parent.ganttChartModule.updateScrollLeft(0);
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
*
|
|
345
|
+
* @returns {void} .
|
|
346
|
+
* @private
|
|
347
|
+
*/
|
|
348
|
+
public zoomOut(): void {
|
|
349
|
+
this.parent.timelineModule.processZooming(false);
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* To refresh toolbar items bases current state of tasks
|
|
353
|
+
*
|
|
354
|
+
* @param {RowSelectEventArgs} args .
|
|
355
|
+
* @returns {void} .
|
|
356
|
+
*/
|
|
357
|
+
public refreshToolbarItems(args?: RowSelectEventArgs): void {
|
|
358
|
+
const gObj: Gantt = this.parent;
|
|
359
|
+
let enableItems: string[] = [];
|
|
360
|
+
let disableItems: string[] = [];
|
|
361
|
+
const edit: EditSettingsModel = gObj.editSettings;
|
|
362
|
+
const gID: string = this.id;
|
|
363
|
+
const ind: number = gObj.selectedRowIndex;
|
|
364
|
+
let previousGanttRecord: IGanttData;
|
|
365
|
+
const isSelected: boolean = gObj.selectionModule ? gObj.selectionModule.selectedRowIndexes.length === 1 ||
|
|
366
|
+
gObj.selectionModule.getSelectedRowCellIndexes().length === 1 ? true : false : false;
|
|
367
|
+
const toolbarItems: ItemModel[] = this.toolbar ? this.toolbar.items : [];
|
|
368
|
+
const toolbarDefaultItems: string[] = [gID + '_add', gID + '_edit', gID + '_delete',
|
|
369
|
+
gID + '_update', gID + '_cancel', gID + '_indent', gID + '_outdent'];
|
|
370
|
+
const isResouceParent: boolean = (this.parent.viewType === 'ResourceView' && getValue('data.level', args) !== 0
|
|
371
|
+
|| this.parent.viewType === 'ProjectView');
|
|
372
|
+
if (!isNullOrUndefined(this.parent.editModule)) {
|
|
373
|
+
const touchEdit: boolean = gObj.editModule.taskbarEditModule ?
|
|
374
|
+
gObj.editModule.taskbarEditModule.touchEdit : false;
|
|
375
|
+
const hasData: number = gObj.flatData && gObj.flatData.length;
|
|
376
|
+
// eslint-disable-next-line
|
|
377
|
+
edit.allowAdding && !touchEdit ? enableItems.push(gID + '_add') : disableItems.push(gID + '_add');
|
|
378
|
+
// eslint-disable-next-line
|
|
379
|
+
edit.allowEditing && isResouceParent && hasData && isSelected && !touchEdit ?
|
|
380
|
+
enableItems.push(gID + '_edit') : disableItems.push(gID + '_edit');
|
|
381
|
+
if (!edit.allowEditing || ind === 0 || ind === -1 || !hasData || !isSelected || this.parent.viewType === 'ResourceView') {
|
|
382
|
+
disableItems.push(gID + '_indent');
|
|
383
|
+
disableItems.push(gID + '_outdent');
|
|
384
|
+
} else {
|
|
385
|
+
if (gObj.updatedRecords[ind].level === 0 && hasData && !touchEdit) {
|
|
386
|
+
enableItems.push(gID + '_indent');
|
|
387
|
+
disableItems.push(gID + '_outdent');
|
|
388
|
+
} else {
|
|
389
|
+
previousGanttRecord = gObj.updatedRecords[ind - 1];
|
|
390
|
+
if ((gObj.updatedRecords[ind].level - previousGanttRecord.level === 1) && ind !== -1) {
|
|
391
|
+
disableItems.push(gID + '_indent');
|
|
392
|
+
enableItems.push(gID + '_outdent');
|
|
393
|
+
} else if (ind !== -1) {
|
|
394
|
+
enableItems.push(gID + '_indent');
|
|
395
|
+
enableItems.push(gID + '_outdent');
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
const isDeleteSelected: boolean = gObj.selectionModule ? gObj.selectionModule.selectedRowIndexes.length > 0 ||
|
|
400
|
+
gObj.selectionModule.getSelectedRowCellIndexes().length > 0 ? true : false : false;
|
|
401
|
+
// eslint-disable-next-line
|
|
402
|
+
edit.allowDeleting && isResouceParent && hasData && isDeleteSelected && !touchEdit ?
|
|
403
|
+
enableItems.push(gID + '_delete') : disableItems.push(gID + '_delete');
|
|
404
|
+
if (gObj.editSettings.mode === 'Auto' && !isNullOrUndefined(gObj.editModule.cellEditModule)
|
|
405
|
+
&& gObj.editModule.cellEditModule.isCellEdit) {
|
|
406
|
+
// New initialization for enableItems and disableItems during isCellEdit
|
|
407
|
+
enableItems = [];
|
|
408
|
+
enableItems.push(gID + '_update', gID + '_cancel');
|
|
409
|
+
disableItems = [];
|
|
410
|
+
for (let t: number = 0; t < toolbarItems.length; t++) {
|
|
411
|
+
if (toolbarItems[t].id !== gID + '_update' && toolbarItems[t].id !== gID + '_cancel' &&
|
|
412
|
+
toolbarDefaultItems.indexOf(toolbarItems[t].id) !== -1) {
|
|
413
|
+
disableItems.push(toolbarItems[t].id);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
} else {
|
|
417
|
+
disableItems.push(gID + '_update', gID + '_cancel');
|
|
418
|
+
for (let t: number = 0; t < toolbarItems.length; t++) {
|
|
419
|
+
if (enableItems.indexOf(toolbarItems[t].id) === -1 && disableItems.indexOf(toolbarItems[t].id) === -1) {
|
|
420
|
+
enableItems.push(toolbarItems[t].id);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
} else {
|
|
425
|
+
disableItems.push(gID + '_delete');
|
|
426
|
+
disableItems.push(gID + '_add');
|
|
427
|
+
disableItems.push(gID + '_edit');
|
|
428
|
+
disableItems.push(gID + '_update');
|
|
429
|
+
disableItems.push(gID + '_cancel');
|
|
430
|
+
}
|
|
431
|
+
for (let e: number = 0; e < enableItems.length; e++) {
|
|
432
|
+
let index: number;
|
|
433
|
+
for (let t: number = 0; t < toolbarItems.length; t++) {
|
|
434
|
+
if (toolbarItems[t].id === enableItems[e]) {
|
|
435
|
+
index = t;
|
|
436
|
+
break;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
if (toolbarItems.length > 0) {
|
|
440
|
+
this.toolbar.hideItem(index, false);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
for (let d: number = 0; d < disableItems.length; d++) {
|
|
444
|
+
let index: number;
|
|
445
|
+
for (let t: number = 0; t < toolbarItems.length; t++) {
|
|
446
|
+
if (toolbarItems[t].id === disableItems[d]) {
|
|
447
|
+
index = t;
|
|
448
|
+
break;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
if (toolbarItems.length > 0) {
|
|
452
|
+
this.toolbar.hideItem(index, true);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* Enables or disables ToolBar items.
|
|
459
|
+
*
|
|
460
|
+
* @param {string[]} items - Defines the collection of itemID of ToolBar items.
|
|
461
|
+
* @param {boolean} isEnable - Defines the items to be enabled or disabled.
|
|
462
|
+
* @returns {void} .
|
|
463
|
+
* @hidden
|
|
464
|
+
*/
|
|
465
|
+
public enableItems(items: string[], isEnable: boolean): void {
|
|
466
|
+
for (const item of items) {
|
|
467
|
+
const element: HTMLElement = this.element.querySelector('#' + item);
|
|
468
|
+
if (element) {
|
|
469
|
+
this.toolbar.enableItems(element.parentElement, isEnable);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* Destroys the Sorting of TreeGrid.
|
|
476
|
+
*
|
|
477
|
+
* @function destroy
|
|
478
|
+
* @returns {void} .
|
|
479
|
+
* @private
|
|
480
|
+
*/
|
|
481
|
+
public destroy(): void {
|
|
482
|
+
if (this.parent.isDestroyed) { return; }
|
|
483
|
+
this.toolbar.destroy();
|
|
484
|
+
if (this.parent.filterModule) {
|
|
485
|
+
this.unWireEvent();
|
|
486
|
+
}
|
|
487
|
+
remove(this.element);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Gantt } from '../base/gantt';
|
|
2
|
+
import { TreeGrid, VirtualScroll as TreeGridVirtualScroll } from '@syncfusion/ej2-treegrid';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Gantt Virtual Scroll module will handle Virtualization
|
|
6
|
+
*
|
|
7
|
+
* @hidden
|
|
8
|
+
*/
|
|
9
|
+
export class VirtualScroll {
|
|
10
|
+
private parent: Gantt;
|
|
11
|
+
constructor(parent?: Gantt) {
|
|
12
|
+
this.parent = parent;
|
|
13
|
+
this.bindTreeGridProperties();
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Get module name
|
|
17
|
+
*
|
|
18
|
+
* @returns {void} .
|
|
19
|
+
*/
|
|
20
|
+
protected getModuleName(): string {
|
|
21
|
+
return 'virtualScroll';
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Bind virtual-scroll related properties from Gantt to TreeGrid
|
|
26
|
+
*
|
|
27
|
+
* @returns {void} .
|
|
28
|
+
*/
|
|
29
|
+
private bindTreeGridProperties(): void {
|
|
30
|
+
this.parent.treeGrid.enableVirtualization = this.parent.enableVirtualization;
|
|
31
|
+
TreeGrid.Inject(TreeGridVirtualScroll);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @returns {number} .
|
|
36
|
+
* @private
|
|
37
|
+
*/
|
|
38
|
+
public getTopPosition(): number {
|
|
39
|
+
const virtualTable: HTMLElement = this.parent.ganttChartModule.scrollElement.querySelector('.e-virtualtable');
|
|
40
|
+
const translates: string[] = virtualTable.style.transform.split(',');
|
|
41
|
+
let top: string;
|
|
42
|
+
if (translates.length > 1) {
|
|
43
|
+
top = translates[1].trim().split(')')[0];
|
|
44
|
+
} else {
|
|
45
|
+
let transformString: string = virtualTable.style.transform;
|
|
46
|
+
top = transformString.substring(transformString.lastIndexOf("(") + 1, transformString.lastIndexOf(")"))
|
|
47
|
+
}
|
|
48
|
+
return parseFloat(top);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* To destroy the virtual scroll module.
|
|
52
|
+
*
|
|
53
|
+
* @returns {void} .
|
|
54
|
+
* @private
|
|
55
|
+
*/
|
|
56
|
+
public destroy(): void {
|
|
57
|
+
// destroy module
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was to define all public and internal events
|
|
3
|
+
*/
|
|
4
|
+
/** @hidden */
|
|
5
|
+
export const load: string = 'load';
|
|
6
|
+
/** @hidden */
|
|
7
|
+
export const rowDataBound: string = 'rowDataBound';
|
|
8
|
+
/** @hidden */
|
|
9
|
+
export const queryCellInfo: string = 'queryCellInfo';
|
|
10
|
+
/** @hidden */
|
|
11
|
+
export const toolbarClick: string = 'toolbarClick';
|
|
12
|
+
/** @hidden */
|
|
13
|
+
export const keyPressed: string = 'key-pressed';
|