@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.
Files changed (212) hide show
  1. package/CHANGELOG.md +1072 -1047
  2. package/README.md +75 -75
  3. package/dist/ej2-gantt.umd.min.js +1 -10
  4. package/dist/ej2-gantt.umd.min.js.map +1 -1
  5. package/dist/es6/ej2-gantt.es2015.js +341 -240
  6. package/dist/es6/ej2-gantt.es2015.js.map +1 -1
  7. package/dist/es6/ej2-gantt.es5.js +713 -598
  8. package/dist/es6/ej2-gantt.es5.js.map +1 -1
  9. package/dist/global/ej2-gantt.min.js +1 -10
  10. package/dist/global/ej2-gantt.min.js.map +1 -1
  11. package/dist/global/index.d.ts +0 -9
  12. package/dist/ts/components.ts +4 -0
  13. package/dist/ts/gantt/actions/actions.ts +18 -0
  14. package/dist/ts/gantt/actions/cell-edit.ts +606 -0
  15. package/dist/ts/gantt/actions/chart-scroll.ts +167 -0
  16. package/dist/ts/gantt/actions/column-menu.ts +35 -0
  17. package/dist/ts/gantt/actions/column-reorder.ts +52 -0
  18. package/dist/ts/gantt/actions/column-resize.ts +52 -0
  19. package/dist/ts/gantt/actions/connector-line-edit.ts +829 -0
  20. package/dist/ts/gantt/actions/context-menu.ts +754 -0
  21. package/dist/ts/gantt/actions/day-markers.ts +80 -0
  22. package/dist/ts/gantt/actions/dependency.ts +692 -0
  23. package/dist/ts/gantt/actions/dialog-edit.ts +2208 -0
  24. package/dist/ts/gantt/actions/edit.ts +3499 -0
  25. package/dist/ts/gantt/actions/excel-export.ts +61 -0
  26. package/dist/ts/gantt/actions/filter.ts +302 -0
  27. package/dist/ts/gantt/actions/keyboard.ts +306 -0
  28. package/dist/ts/gantt/actions/pdf-export.ts +214 -0
  29. package/dist/ts/gantt/actions/rowdragdrop.ts +839 -0
  30. package/dist/ts/gantt/actions/selection.ts +536 -0
  31. package/dist/ts/gantt/actions/sort.ts +98 -0
  32. package/dist/ts/gantt/actions/taskbar-edit.ts +1940 -0
  33. package/dist/ts/gantt/actions/toolbar.ts +489 -0
  34. package/dist/ts/gantt/actions/virtual-scroll.ts +60 -0
  35. package/dist/ts/gantt/base/common.ts +9 -0
  36. package/dist/ts/gantt/base/constant.ts +13 -0
  37. package/dist/ts/gantt/base/css-constants.ts +148 -0
  38. package/dist/ts/gantt/base/date-processor.ts +1257 -0
  39. package/dist/ts/gantt/base/enum.ts +372 -0
  40. package/dist/ts/gantt/base/gantt-chart.ts +1248 -0
  41. package/dist/ts/gantt/base/gantt.ts +4069 -0
  42. package/dist/ts/gantt/base/interface.ts +955 -0
  43. package/dist/ts/gantt/base/splitter.ts +174 -0
  44. package/dist/ts/gantt/base/task-processor.ts +2217 -0
  45. package/dist/ts/gantt/base/tree-grid.ts +694 -0
  46. package/dist/ts/gantt/base/utils.ts +208 -0
  47. package/dist/ts/gantt/export/export-helper.ts +552 -0
  48. package/dist/ts/gantt/export/pdf-base/dictionary.ts +152 -0
  49. package/dist/ts/gantt/export/pdf-base/pdf-borders.ts +277 -0
  50. package/dist/ts/gantt/export/pdf-base/pdf-grid-table.ts +901 -0
  51. package/dist/ts/gantt/export/pdf-base/pdf-style/gantt-theme.ts +131 -0
  52. package/dist/ts/gantt/export/pdf-base/pdf-style/style.ts +91 -0
  53. package/dist/ts/gantt/export/pdf-base/treegrid-layouter.ts +414 -0
  54. package/dist/ts/gantt/export/pdf-connector-line.ts +422 -0
  55. package/dist/ts/gantt/export/pdf-gantt.ts +282 -0
  56. package/dist/ts/gantt/export/pdf-taskbar.ts +395 -0
  57. package/dist/ts/gantt/export/pdf-timeline.ts +202 -0
  58. package/dist/ts/gantt/export/pdf-treegrid.ts +406 -0
  59. package/dist/ts/gantt/models/add-dialog-field-settings.ts +33 -0
  60. package/dist/ts/gantt/models/column.ts +464 -0
  61. package/dist/ts/gantt/models/day-working-time.ts +22 -0
  62. package/dist/ts/gantt/models/edit-dialog-field-settings.ts +33 -0
  63. package/dist/ts/gantt/models/edit-settings.ts +79 -0
  64. package/dist/ts/gantt/models/event-marker.ts +27 -0
  65. package/dist/ts/gantt/models/filter-settings.ts +53 -0
  66. package/dist/ts/gantt/models/holiday.ts +34 -0
  67. package/dist/ts/gantt/models/label-settings.ts +30 -0
  68. package/dist/ts/gantt/models/models.ts +36 -0
  69. package/dist/ts/gantt/models/resource-fields.ts +38 -0
  70. package/dist/ts/gantt/models/search-settings.ts +77 -0
  71. package/dist/ts/gantt/models/selection-settings.ts +56 -0
  72. package/dist/ts/gantt/models/sort-settings.ts +50 -0
  73. package/dist/ts/gantt/models/splitter-settings.ts +47 -0
  74. package/dist/ts/gantt/models/task-fields.ts +171 -0
  75. package/dist/ts/gantt/models/timeline-settings.ts +112 -0
  76. package/dist/ts/gantt/models/tooltip-settings.ts +46 -0
  77. package/dist/ts/gantt/renderer/chart-rows.ts +1838 -0
  78. package/dist/ts/gantt/renderer/connector-line.ts +1025 -0
  79. package/dist/ts/gantt/renderer/edit-tooltip.ts +228 -0
  80. package/dist/ts/gantt/renderer/event-marker.ts +96 -0
  81. package/dist/ts/gantt/renderer/nonworking-day.ts +205 -0
  82. package/dist/ts/gantt/renderer/render.ts +5 -0
  83. package/dist/ts/gantt/renderer/timeline.ts +1397 -0
  84. package/dist/ts/gantt/renderer/tooltip.ts +450 -0
  85. package/dist/ts/gantt/renderer/virtual-content-render.ts +50 -0
  86. package/license +9 -9
  87. package/package.json +80 -80
  88. package/src/gantt/actions/cell-edit.js +2 -1
  89. package/src/gantt/actions/dialog-edit.js +2 -1
  90. package/src/gantt/actions/edit.js +36 -9
  91. package/src/gantt/actions/rowdragdrop.js +37 -15
  92. package/src/gantt/actions/selection.js +3 -2
  93. package/src/gantt/actions/taskbar-edit.js +24 -24
  94. package/src/gantt/base/date-processor.js +0 -1
  95. package/src/gantt/base/gantt-chart.js +36 -5
  96. package/src/gantt/base/gantt-model.d.ts +779 -779
  97. package/src/gantt/base/gantt.d.ts +27 -27
  98. package/src/gantt/base/gantt.js +35 -76
  99. package/src/gantt/base/splitter.js +1 -0
  100. package/src/gantt/base/task-processor.js +13 -13
  101. package/src/gantt/base/tree-grid.js +3 -1
  102. package/src/gantt/export/pdf-base/treegrid-layouter.js +13 -13
  103. package/src/gantt/export/pdf-connector-line.js +11 -11
  104. package/src/gantt/export/pdf-gantt.js +24 -24
  105. package/src/gantt/export/pdf-taskbar.js +11 -11
  106. package/src/gantt/export/pdf-treegrid.js +13 -13
  107. package/src/gantt/models/add-dialog-field-settings-model.d.ts +21 -21
  108. package/src/gantt/models/add-dialog-field-settings.js +19 -19
  109. package/src/gantt/models/day-working-time-model.d.ts +11 -11
  110. package/src/gantt/models/day-working-time.js +19 -19
  111. package/src/gantt/models/edit-dialog-field-settings-model.d.ts +21 -21
  112. package/src/gantt/models/edit-dialog-field-settings.js +19 -19
  113. package/src/gantt/models/edit-settings-model.d.ts +50 -50
  114. package/src/gantt/models/edit-settings.js +19 -19
  115. package/src/gantt/models/event-marker-model.d.ts +16 -16
  116. package/src/gantt/models/event-marker.js +19 -19
  117. package/src/gantt/models/filter-settings-model.d.ts +34 -34
  118. package/src/gantt/models/filter-settings.js +19 -19
  119. package/src/gantt/models/holiday-model.d.ts +21 -21
  120. package/src/gantt/models/holiday.js +19 -19
  121. package/src/gantt/models/label-settings-model.d.ts +16 -16
  122. package/src/gantt/models/label-settings.js +19 -19
  123. package/src/gantt/models/resource-fields-model.d.ts +21 -21
  124. package/src/gantt/models/resource-fields.js +19 -19
  125. package/src/gantt/models/search-settings-model.d.ts +56 -56
  126. package/src/gantt/models/search-settings.js +19 -19
  127. package/src/gantt/models/selection-settings-model.d.ts +35 -35
  128. package/src/gantt/models/selection-settings.js +19 -19
  129. package/src/gantt/models/sort-settings-model.d.ts +24 -24
  130. package/src/gantt/models/sort-settings.js +19 -19
  131. package/src/gantt/models/splitter-settings-model.d.ts +30 -30
  132. package/src/gantt/models/splitter-settings.js +19 -19
  133. package/src/gantt/models/task-fields-model.d.ts +110 -110
  134. package/src/gantt/models/task-fields.js +19 -19
  135. package/src/gantt/models/timeline-settings-model.d.ts +71 -71
  136. package/src/gantt/models/timeline-settings.js +19 -19
  137. package/src/gantt/models/tooltip-settings-model.d.ts +26 -26
  138. package/src/gantt/models/tooltip-settings.js +19 -19
  139. package/src/gantt/renderer/chart-rows.js +49 -37
  140. package/src/gantt/renderer/connector-line.js +22 -18
  141. package/src/gantt/renderer/event-marker.js +1 -0
  142. package/src/gantt/renderer/nonworking-day.js +13 -6
  143. package/src/gantt/renderer/timeline.d.ts +1 -0
  144. package/src/gantt/renderer/timeline.js +51 -12
  145. package/src/gantt/renderer/tooltip.js +11 -3
  146. package/styles/bootstrap-dark.css +442 -427
  147. package/styles/bootstrap.css +442 -433
  148. package/styles/bootstrap4.css +454 -479
  149. package/styles/bootstrap5-dark.css +457 -433
  150. package/styles/bootstrap5.css +457 -433
  151. package/styles/fabric-dark.css +438 -421
  152. package/styles/fabric.css +445 -428
  153. package/styles/fluent-dark.css +1938 -0
  154. package/styles/fluent-dark.scss +1 -0
  155. package/styles/fluent.css +1938 -0
  156. package/styles/fluent.scss +1 -0
  157. package/styles/gantt/_all.scss +2 -2
  158. package/styles/gantt/_bootstrap-dark-definition.scss +210 -156
  159. package/styles/gantt/_bootstrap-definition.scss +211 -157
  160. package/styles/gantt/_bootstrap4-definition.scss +213 -158
  161. package/styles/gantt/_bootstrap5-definition.scss +215 -162
  162. package/styles/gantt/_fabric-dark-definition.scss +211 -157
  163. package/styles/gantt/_fabric-definition.scss +211 -157
  164. package/styles/gantt/_fluent-dark-definition.scss +1 -0
  165. package/styles/gantt/_fluent-definition.scss +215 -162
  166. package/styles/gantt/_fusionnew-definition.scss +214 -0
  167. package/styles/gantt/_highcontrast-definition.scss +211 -157
  168. package/styles/gantt/_highcontrast-light-definition.scss +211 -157
  169. package/styles/gantt/_layout.scss +1446 -1027
  170. package/styles/gantt/_material-dark-definition.scss +212 -157
  171. package/styles/gantt/_material-definition.scss +212 -157
  172. package/styles/gantt/_material3-definition.scss +215 -0
  173. package/styles/gantt/_tailwind-definition.scss +215 -161
  174. package/styles/gantt/_theme.scss +702 -668
  175. package/styles/gantt/bootstrap-dark.css +442 -427
  176. package/styles/gantt/bootstrap.css +442 -433
  177. package/styles/gantt/bootstrap4.css +454 -479
  178. package/styles/gantt/bootstrap5-dark.css +457 -433
  179. package/styles/gantt/bootstrap5.css +457 -433
  180. package/styles/gantt/fabric-dark.css +438 -421
  181. package/styles/gantt/fabric.css +445 -428
  182. package/styles/gantt/fluent-dark.css +1938 -0
  183. package/styles/gantt/fluent-dark.scss +22 -0
  184. package/styles/gantt/fluent.css +1938 -0
  185. package/styles/gantt/fluent.scss +22 -0
  186. package/styles/gantt/highcontrast-light.css +405 -405
  187. package/styles/gantt/highcontrast.css +444 -456
  188. package/styles/gantt/icons/_bootstrap-dark.scss +124 -113
  189. package/styles/gantt/icons/_bootstrap.scss +124 -113
  190. package/styles/gantt/icons/_bootstrap4.scss +124 -113
  191. package/styles/gantt/icons/_bootstrap5.scss +124 -112
  192. package/styles/gantt/icons/_fabric-dark.scss +124 -112
  193. package/styles/gantt/icons/_fabric.scss +124 -112
  194. package/styles/gantt/icons/_fluent-dark.scss +1 -0
  195. package/styles/gantt/icons/_fluent.scss +124 -112
  196. package/styles/gantt/icons/_fusionnew.scss +120 -0
  197. package/styles/gantt/icons/_highcontrast.scss +124 -112
  198. package/styles/gantt/icons/_material-dark.scss +124 -112
  199. package/styles/gantt/icons/_material.scss +124 -112
  200. package/styles/gantt/icons/_material3.scss +124 -0
  201. package/styles/gantt/icons/_tailwind-dark.scss +124 -113
  202. package/styles/gantt/icons/_tailwind.scss +124 -113
  203. package/styles/gantt/material-dark.css +446 -417
  204. package/styles/gantt/material.css +445 -419
  205. package/styles/gantt/tailwind-dark.css +452 -482
  206. package/styles/gantt/tailwind.css +449 -479
  207. package/styles/highcontrast-light.css +405 -405
  208. package/styles/highcontrast.css +444 -456
  209. package/styles/material-dark.css +446 -417
  210. package/styles/material.css +445 -419
  211. package/styles/tailwind-dark.css +452 -482
  212. package/styles/tailwind.css +449 -479
@@ -0,0 +1,4069 @@
1
+ import { Component, createElement, Complex, addClass, removeClass, Event, EmitType, formatUnit, Browser } from '@syncfusion/ej2-base';
2
+ import { Internationalization, extend, getValue, isObjectArray, isObject, setValue, isUndefined } from '@syncfusion/ej2-base';
3
+ import { Property, NotifyPropertyChanges, INotifyPropertyChanged, L10n, ModuleDeclaration, EventHandler } from '@syncfusion/ej2-base';
4
+ import { isNullOrUndefined, KeyboardEvents, KeyboardEventArgs, Collection, append, remove } from '@syncfusion/ej2-base';
5
+ import { createSpinner, showSpinner, hideSpinner, Dialog } from '@syncfusion/ej2-popups';
6
+ import { RowDragEventArgs } from '@syncfusion/ej2-grids';
7
+ import { GanttModel } from './gantt-model';
8
+ import { TaskProcessor } from './task-processor';
9
+ import { GanttChart } from './gantt-chart';
10
+ import { Timeline } from '../renderer/timeline';
11
+ import { GanttTreeGrid } from './tree-grid';
12
+ import { Toolbar } from '../actions/toolbar';
13
+ import { IGanttData, IWorkingTimeRange, IQueryTaskbarInfoEventArgs, BeforeTooltipRenderEventArgs, IDependencyEventArgs } from './interface';
14
+ import { DataStateChangeEventArgs } from '@syncfusion/ej2-treegrid';
15
+ import { ITaskbarEditedEventArgs, IParent, ITaskData, PdfColumnHeaderQueryCellInfoEventArgs } from './interface';
16
+ import { ICollapsingEventArgs, CellEditArgs, PdfQueryTimelineCellInfoEventArgs } from './interface';
17
+ import { IConnectorLineObject, IValidateArgs, IValidateMode, ITaskAddedEventArgs, IKeyPressedEventArgs } from './interface';
18
+ import { PdfExportProperties, ISplitterResizedEventArgs } from './interface';
19
+ import { ZoomEventArgs, IActionBeginEventArgs, CellSelectingEventArgs, RowDeselectEventArgs, PdfQueryCellInfoEventArgs } from './interface';
20
+ import { ITimeSpanEventArgs, ZoomTimelineSettings, QueryCellInfoEventArgs, RowDataBoundEventArgs, RowSelectEventArgs } from './interface';
21
+ import { TaskFieldsModel, TimelineSettingsModel, SplitterSettingsModel, SortSettings, SortSettingsModel } from '../models/models';
22
+ import { EventMarkerModel, AddDialogFieldSettingsModel, EditDialogFieldSettingsModel, EditSettingsModel } from '../models/models';
23
+ import { HolidayModel, DayWorkingTimeModel, FilterSettingsModel, SelectionSettingsModel } from '../models/models';
24
+ import { TaskFields, TimelineSettings, Holiday, EventMarker, DayWorkingTime, EditSettings, SelectionSettings } from '../models/models';
25
+ import { FilterSettings, SplitterSettings, TooltipSettings, LabelSettings, LabelSettingsModel } from '../models/models';
26
+ import { SearchSettingsModel, SearchSettings, ResourceFields, ResourceFieldsModel } from '../models/models';
27
+ import { ItemModel, ClickEventArgs } from '@syncfusion/ej2-navigations';
28
+ import { DateProcessor } from './date-processor';
29
+ import { ChartRows } from '../renderer/chart-rows';
30
+ import { Dependency } from '../actions/dependency';
31
+ import * as cls from './css-constants';
32
+ import { Query, DataManager } from '@syncfusion/ej2-data';
33
+ import { Column, ColumnModel } from '../models/column';
34
+ import { TreeGrid, FilterSettingsModel as TreeGridFilterSettingModel } from '@syncfusion/ej2-treegrid';
35
+ import { Sort } from '../actions/sort';
36
+ import { CellSelectEventArgs, ISelectedCell, ContextMenuItemModel } from '@syncfusion/ej2-grids';
37
+ import { CellDeselectEventArgs, IIndex, FailureEventArgs } from '@syncfusion/ej2-grids';
38
+ import { HeaderCellInfoEventArgs, ColumnMenuClickEventArgs, ColumnMenuOpenEventArgs } from '@syncfusion/ej2-grids';
39
+ import { ColumnMenuItemModel, ExcelQueryCellInfoEventArgs } from '@syncfusion/ej2-grids';
40
+ import { ExcelExportProperties, ExcelExportCompleteArgs, ExcelHeaderQueryCellInfoEventArgs } from '@syncfusion/ej2-grids';
41
+ import { RowDD } from '../actions/rowdragdrop';
42
+ import { Filter } from '../actions/filter';
43
+ import { PageEventArgs, FilterEventArgs, SortEventArgs, ResizeArgs, ColumnDragEventArgs, getActualProperties } from '@syncfusion/ej2-grids';
44
+ import { RenderDayCellEventArgs } from '@syncfusion/ej2-calendars';
45
+ import { ConnectorLine } from '../renderer/connector-line';
46
+ import { ConnectorLineEdit } from '../actions/connector-line-edit';
47
+ import { Edit } from '../actions/edit';
48
+ import { Splitter } from './splitter';
49
+ import { ResizeEventArgs, ResizingEventArgs } from '@syncfusion/ej2-layouts';
50
+ import { TooltipSettingsModel } from '../models/tooltip-settings-model';
51
+ import { Tooltip } from '../renderer/tooltip';
52
+ import { ToolbarItem, ColumnMenuItem, RowPosition, DurationUnit, SortDirection } from './enum';
53
+ import { GridLine, ContextMenuItem, ScheduleMode, ViewType } from './enum';
54
+ import { Selection } from '../actions/selection';
55
+ import { ExcelExport } from '../actions/excel-export';
56
+ import { DayMarkers } from '../actions/day-markers';
57
+ import { ContextMenu } from './../actions/context-menu';
58
+ import { RowSelectingEventArgs } from './interface';
59
+ import { ContextMenuOpenEventArgs as CMenuOpenEventArgs, ContextMenuClickEventArgs as CMenuClickEventArgs } from './interface';
60
+ import { ColumnMenu } from '../actions/column-menu';
61
+ import { ITaskbarClickEventArgs, RecordDoubleClickEventArgs, IMouseMoveEventArgs } from './interface';
62
+ import { PdfExport } from '../actions/pdf-export';
63
+ import { WorkUnit, TaskType } from './enum';
64
+ import { FocusModule } from '../actions/keyboard';
65
+ import { VirtualScroll } from '../actions/virtual-scroll';
66
+ import { isCountRequired } from './utils';
67
+ import { TaskbarEdit } from '../actions/taskbar-edit';
68
+ /**
69
+ *
70
+ * Represents the Gantt chart component.
71
+ * ```html
72
+ * <div id='gantt'></div>
73
+ * <script>
74
+ * var ganttObject = new Gantt({
75
+ * taskFields: { id: 'taskId', name: 'taskName', startDate: 'startDate', duration: 'duration' }
76
+ * });
77
+ * ganttObject.appendTo('#gantt');
78
+ * </script>
79
+ * ```
80
+ */
81
+ @NotifyPropertyChanges
82
+ export class Gantt extends Component<HTMLElement>
83
+ implements INotifyPropertyChanged {
84
+ /** @hidden */
85
+ public chartPane: HTMLElement;
86
+ /** @hidden */
87
+ public treeGridPane: HTMLElement;
88
+ /** @hidden */
89
+ public splitterElement: HTMLElement;
90
+ /** @hidden */
91
+ public toolbarModule: Toolbar;
92
+ /** @hidden */
93
+ public focusModule: FocusModule;
94
+ /** @hidden */
95
+ public ganttChartModule: GanttChart;
96
+ /** @hidden */
97
+ public treeGridModule: GanttTreeGrid;
98
+ /** @hidden */
99
+ public chartRowsModule: ChartRows;
100
+ /** @hidden */
101
+ public connectorLineModule: ConnectorLine;
102
+ public taskbarEditModule: TaskbarEdit;
103
+ /** @hidden */
104
+ public connectorLineEditModule: ConnectorLineEdit;
105
+ /** @hidden */
106
+ public splitterModule: Splitter;
107
+ /** @hidden */
108
+ public isCancelled: boolean = false;
109
+ /** @hidden */
110
+ public treeGrid: TreeGrid;
111
+ /** @hidden */
112
+ public controlId: string;
113
+ /** @hidden */
114
+ public ganttHeight: number;
115
+ /** @hidden */
116
+ public ganttWidth: number;
117
+ /** @hidden */
118
+ public predecessorModule: Dependency;
119
+ /** @hidden */
120
+ public localeObj: L10n;
121
+ /** @hidden */
122
+ public dataOperation: TaskProcessor;
123
+ /** @hidden */
124
+ public flatData: IGanttData[];
125
+ /** @hidden */
126
+ public currentViewData: IGanttData[];
127
+ /** @hidden */
128
+ public updatedRecords: IGanttData[];
129
+ /** @hidden */
130
+ public ids: string[];
131
+ /** resource-task Ids */
132
+ /** @hidden */
133
+ public taskIds: string[];
134
+ /** @hidden */
135
+ public previousRecords: object = {};
136
+ /** @hidden */
137
+ public editedRecords: IGanttData[] = [];
138
+ /** @hidden */
139
+ public modifiedRecords: IGanttData[] = [];
140
+ /** @hidden */
141
+ public isOnEdit: boolean = false;
142
+ /** @hidden */
143
+ public isOnDelete: boolean = false;
144
+ /** @hidden */
145
+ public secondsPerDay: number;
146
+ /** @hidden */
147
+ public nonWorkingHours: number[];
148
+ /** @hidden */
149
+ public workingTimeRanges: IWorkingTimeRange[];
150
+ /** @hidden */
151
+ public nonWorkingTimeRanges: IWorkingTimeRange[];
152
+ /** @hidden */
153
+ public defaultStartTime?: number;
154
+ /** @hidden */
155
+ public defaultEndTime?: number;
156
+ /** @hidden */
157
+ public nonWorkingDayIndex?: number[];
158
+ /** @hidden */
159
+ public durationUnitTexts?: Object;
160
+ /** @hidden */
161
+ public durationUnitEditText?: Object;
162
+ /** @hidden */
163
+ public isMileStoneEdited?: Object;
164
+ /** @hidden */
165
+ public chartVerticalLineContainer?: HTMLElement;
166
+ /** @hidden */
167
+ public updatedConnectorLineCollection?: IConnectorLineObject[];
168
+ /** @hidden */
169
+ public connectorLineIds?: string[];
170
+ /** @hidden */
171
+ public predecessorsCollection?: IGanttData[];
172
+ /** @hidden */
173
+ public isInPredecessorValidation?: boolean;
174
+ /** @hidden */
175
+ public isValidationEnabled?: boolean;
176
+ /** @hidden */
177
+ public isLoad?: boolean;
178
+ /** @hidden */
179
+ public editedTaskBarItem?: IGanttData;
180
+ /** @hidden */
181
+ public validationDialogElement?: Dialog;
182
+ /** @hidden */
183
+ public currentEditedArgs?: IValidateArgs;
184
+ /** @hidden */
185
+ public dialogValidateMode?: IValidateMode;
186
+ /** @hidden */
187
+ public perDayWidth?: number;
188
+ /** @hidden */
189
+ public zoomingProjectStartDate?: Date;
190
+ /** @hidden */
191
+ public zoomingProjectEndDate?: Date;
192
+ /** @hidden */
193
+ public cloneProjectStartDate?: Date;
194
+ /** @hidden */
195
+ public cloneProjectEndDate?: Date;
196
+ /** @hidden */
197
+ public totalHolidayDates?: number[];
198
+ /** @hidden */
199
+ public columnMapping?: { [key: string]: string; };
200
+ /** @hidden */
201
+ public ganttColumns: ColumnModel[];
202
+ /** @hidden */
203
+ public isExpandCollapseLevelMethod: boolean = false;
204
+ /** @hidden */
205
+ public isDynamicData: boolean = false;
206
+ /** @hidden */
207
+ public contentHeight: number;
208
+ /** @hidden */
209
+ // eslint-disable-next-line
210
+ public isAdaptive: Boolean;
211
+ /**
212
+ * The `sortModule` is used to manipulate sorting operation in Gantt.
213
+ */
214
+ public sortModule: Sort;
215
+ /**
216
+ * The `filterModule` is used to manipulate filtering operation in Gantt.
217
+ */
218
+ public filterModule: Filter;
219
+ /** @hidden */
220
+ public scrollBarLeft: number;
221
+ /** @hidden */
222
+ public isTimelineRoundOff: boolean;
223
+ /** @hidden */
224
+ public columnByField: Object;
225
+ /** @hidden */
226
+ public customColumns: string[];
227
+ /**
228
+ * The `editModule` is used to handle Gantt record manipulation.
229
+ */
230
+ public editModule: Edit;
231
+ /**
232
+ * The `selectionModule` is used to manipulate selection operation in Gantt.
233
+ */
234
+ public selectionModule: Selection;
235
+ /**
236
+ * The `virtualScrollModule` is used to handle virtual scroll in Gantt.
237
+ */
238
+ public virtualScrollModule: VirtualScroll;
239
+ /**
240
+ * The `excelExportModule` is used to exporting Gantt data in excel format.
241
+ */
242
+ public excelExportModule: ExcelExport;
243
+ /**
244
+ * The `rowDragandDrop` is used to manipulate Row Reordering in Gantt.
245
+ */
246
+ public rowDragAndDropModule: RowDD;
247
+ /**
248
+ * The `dayMarkersModule` is used to manipulate event markers operation in Gantt.
249
+ */
250
+ public dayMarkersModule: DayMarkers;
251
+ /** @hidden */
252
+ public isConnectorLineUpdate: boolean = false;
253
+ /** @hidden */
254
+ public tooltipModule: Tooltip;
255
+ /** @hidden */
256
+ public globalize: Internationalization;
257
+ /** @hidden */
258
+ public keyConfig: { [key: string]: string };
259
+ /**
260
+ * The `keyboardModule` is used to manipulate keyboard interactions in Gantt.
261
+ */
262
+ public keyboardModule: KeyboardEvents;
263
+ /**
264
+ * The `contextMenuModule` is used to invoke context menu in Gantt.
265
+ */
266
+ public contextMenuModule: ContextMenu;
267
+ /**
268
+ * The `columnMenuModule` is used to manipulate column menu items in Gantt.
269
+ */
270
+ public columnMenuModule: ColumnMenu;
271
+ /**
272
+ * The `pdfExportModule` is used to exporting Gantt data in PDF format.
273
+ */
274
+ public pdfExportModule: PdfExport;
275
+ /** @hidden */
276
+ public staticSelectedRowIndex: number = -1;
277
+ protected needsID: boolean = true;
278
+ /** @hidden */
279
+ public showActiveElement: boolean = true;
280
+ /** @hidden */
281
+ public addDeleteRecord: boolean = false;
282
+ /** @hidden */
283
+ public enableHeaderFocus: boolean = true;
284
+ /** @hidden */
285
+ public enableValidation: boolean = true;
286
+ /**
287
+ * Enables or disables the key board interaction of Gantt.
288
+ *
289
+ * @default true
290
+ */
291
+ @Property(true)
292
+ public allowKeyboard: boolean;
293
+ /**
294
+ * If `enableImmutableMode` is set to true, the Gantt Chart will reuse old rows if it exists in the new result instead of
295
+ * full refresh while performing the Gantt actions.
296
+ *
297
+ * @default false
298
+ */
299
+ @Property(false)
300
+ public enableImmutableMode: boolean;
301
+
302
+ /**
303
+ * If `disableHtmlEncode` is set to true, it encodes the HTML of the header and content cells.
304
+ *
305
+ * @default true
306
+ */
307
+ @Property(true)
308
+ public disableHtmlEncode: boolean;
309
+ /**
310
+ * Enables or disables the focusing the task bar on click action.
311
+ *
312
+ * @default true
313
+ */
314
+ @Property(true)
315
+ public autoFocusTasks: boolean;
316
+
317
+ /**
318
+ * If `allowSelection` is set to true, it allows selection of (highlight row) Gantt chart rows by clicking it.
319
+ *
320
+ * @default true
321
+ */
322
+ @Property(true)
323
+ public allowSelection: boolean;
324
+
325
+ /**
326
+ * If `allowSorting` is set to true, it allows sorting of gantt chart tasks when column header is clicked.
327
+ *
328
+ * @default false
329
+ */
330
+ @Property(false)
331
+ public allowSorting: boolean;
332
+
333
+ /**
334
+ * If `enablePredecessorValidation` is set to true, it allows to validate the predecessor link.
335
+ *
336
+ * @default true
337
+ */
338
+ @Property(true)
339
+ public enablePredecessorValidation: boolean;
340
+
341
+ /**
342
+ * If `showColumnMenu` set to true, then it will enable the column menu options in each columns.
343
+ *
344
+ * @default false
345
+ */
346
+ @Property(false)
347
+ public showColumnMenu: boolean;
348
+
349
+ /**
350
+ * `columnMenuItems` defines both built-in and custom column menu items.
351
+ * <br><br>
352
+ * The available built-in items are,
353
+ * * `ColumnChooser` - To show/hide the TreeGrid columns.
354
+ * * `SortAscending` - Sort the current column in ascending order.
355
+ * * `SortDescending` - Sort the current column in descending order.
356
+ * * `Filter` - Filter options will show based on filterSettings property.
357
+ *
358
+ * @default null
359
+ */
360
+ @Property()
361
+ public columnMenuItems: ColumnMenuItem[] | ColumnMenuItemModel[];
362
+
363
+ /**
364
+ * By default, task schedule dates are calculated with system time zone.If Gantt chart assigned with specific time zone,
365
+ * then schedule dates are calculated as given time zone date value.
366
+ *
367
+ * @default null
368
+ */
369
+ @Property()
370
+ public timezone: string;
371
+ /**
372
+ * If `collapseAllParentTasks` set to true, then root tasks are rendered with collapsed state.
373
+ *
374
+ * @default false
375
+ */
376
+ @Property(false)
377
+ public collapseAllParentTasks: boolean;
378
+ /**
379
+ * If `highlightWeekends` set to true, then all weekend days are highlighted in week - day timeline mode.
380
+ *
381
+ * @default false
382
+ */
383
+ @Property(false)
384
+ public highlightWeekends: boolean;
385
+ /**
386
+ * To define expander column index in Grid.
387
+ *
388
+ * @default 0
389
+ * @aspType int
390
+ */
391
+ @Property(0)
392
+ public treeColumnIndex: number;
393
+ /**
394
+ * It is used to render Gantt chart rows and tasks.
395
+ * `dataSource` value was defined as array of JavaScript objects or instances of `DataManager`.
396
+ * {% codeBlock src='gantt/dataSource/index.md' %}{% endcodeBlock %}
397
+ *
398
+ * @isGenericType true
399
+ * @default []
400
+ */
401
+ @Property([])
402
+ public dataSource: Object[] | DataManager | Object;
403
+ /**
404
+ * `durationUnit` Specifies the duration unit for each tasks whether day or hour or minute.
405
+ * * `day`: Sets the duration unit as day.
406
+ * * `hour`: Sets the duration unit as hour.
407
+ * * `minute`: Sets the duration unit as minute.
408
+ *
409
+ * @default day
410
+ */
411
+ @Property('day')
412
+ public durationUnit: DurationUnit;
413
+ /**
414
+ * Defines the external [`Query`](https://ej2.syncfusion.com/documentation/data/api-query.html)
415
+ * that will be executed along with data processing.
416
+ *
417
+ * @default null
418
+ */
419
+ @Property(null)
420
+ public query: Query;
421
+ /**
422
+ * Specifies the dateFormat for Gantt, given format is displayed in tooltip and Grid cells.
423
+ * By default, the format is based on the culture.
424
+ */
425
+ @Property(null)
426
+ public dateFormat: string;
427
+ /**
428
+ * Defines the height of the Gantt component container.
429
+ *
430
+ * @default 'auto'
431
+ */
432
+ @Property('auto')
433
+ public height: number | string;
434
+
435
+ /**
436
+ * If `renderBaseline` is set to `true`, then baselines are rendered for tasks.
437
+ *
438
+ * @default false
439
+ */
440
+ @Property(false)
441
+ public renderBaseline: boolean;
442
+
443
+ /**
444
+ * Configures the grid lines in tree grid and gantt chart.
445
+ */
446
+ @Property('Horizontal')
447
+ public gridLines: GridLine;
448
+
449
+ /**
450
+ * Defines the right, left and inner task labels in task bar.
451
+ * {% codeBlock src='gantt/labelSettings/index.md' %}{% endcodeBlock %}
452
+ */
453
+ @Complex<LabelSettingsModel>({}, LabelSettings)
454
+ public labelSettings: LabelSettingsModel;
455
+
456
+ /**
457
+ * The task bar template that renders customized child task bars from the given template.
458
+ *
459
+ * @default null
460
+ */
461
+ @Property(null)
462
+ public taskbarTemplate: string;
463
+
464
+ /**
465
+ * The parent task bar template that renders customized parent task bars from the given template.
466
+ *
467
+ * @default null
468
+ */
469
+ @Property(null)
470
+ public parentTaskbarTemplate: string;
471
+
472
+ /**
473
+ * The milestone template that renders customized milestone task from the given template.
474
+ *
475
+ * @default null
476
+ */
477
+ @Property(null)
478
+ public milestoneTemplate: string;
479
+
480
+ /**
481
+ * Defines the baseline bar color.
482
+ */
483
+ @Property()
484
+ public baselineColor: string;
485
+
486
+ /**
487
+ * Defines the width of the Gantt component container.
488
+ *
489
+ * @default 'auto'
490
+ */
491
+ @Property('auto')
492
+ public width: number | string;
493
+
494
+ /**
495
+ * If `enableVirtualization` set to true, then the Gantt will render only the rows visible within the view-port.
496
+ * and load subsequent rows on vertical scrolling. This helps to load large dataset in Gantt.
497
+ *
498
+ * @default false
499
+ */
500
+ @Property(false)
501
+ public enableVirtualization: boolean;
502
+
503
+ /**
504
+ * `toolbar` defines the toolbar items of the Gantt.
505
+ * It contains built-in and custom toolbar items
506
+ * If an array value is assigned, it is considered as the list of built-in and custom toolbar items in the Gantt's toolbar.
507
+ * <br><br>
508
+ * The available built-in toolbar items are:
509
+ * * Add: Adds a new record.
510
+ * * Edit: Edits the selected task.
511
+ * * Update: Updates the edited task.
512
+ * * Delete: Deletes the selected task.
513
+ * * Cancel: Cancels the edit state.
514
+ * * Search: Searches tasks by the given key.
515
+ * * ExpandAll: Expands all the task of Gantt.
516
+ * * CollapseAll: Collapses all the task of Gantt.
517
+ * * PrevTimeSpan: Extends timeline with one unit before the timeline start date.
518
+ * * NextTimeSpan: Extends timeline with one unit after the timeline finish date.
519
+ * * ZoomIn: ZoomIn the Gantt control.
520
+ * * ZoomOut: ZoomOut the Gantt control.
521
+ * * ZoomToFit: Display the all tasks within the viewable Gantt chart.
522
+ * * ExcelExport: To export in Excel format.
523
+ * * CsvExport : To export in CSV format.
524
+ * * Indent: To indent a task to one level.
525
+ * * Outdent: To outdent a task from one level.
526
+ *
527
+ * @default null
528
+ */
529
+ @Property()
530
+ public toolbar: (ToolbarItem | string | ItemModel)[];
531
+
532
+ /**
533
+ * Defines workweek of project.
534
+ *
535
+ * @default ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday']
536
+ */
537
+ @Property(['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'])
538
+ public workWeek: string[];
539
+ /**
540
+ * Defines weekend days are considered as working day or not.
541
+ *
542
+ * @default false
543
+ */
544
+ @Property(false)
545
+ public includeWeekend: boolean;
546
+ /**
547
+ * Enables or disables rendering of unscheduled tasks in Gantt.
548
+ *
549
+ * @default false
550
+ */
551
+ @Property(false)
552
+ public allowUnscheduledTasks: boolean;
553
+ /**
554
+ * To show notes column cell values inside the cell or in tooltip.
555
+ *
556
+ * @default false
557
+ * @deprecated
558
+ */
559
+ @Property(false)
560
+ public showInlineNotes: boolean;
561
+ /**
562
+ * Defines height value for grid rows and chart rows in Gantt.
563
+ *
564
+ * @default 36
565
+ * @aspType int
566
+ */
567
+ @Property(36)
568
+ public rowHeight: number;
569
+ /**
570
+ * Defines height of taskbar element in Gantt.
571
+ *
572
+ * @aspType int?
573
+ */
574
+ @Property(null)
575
+ public taskbarHeight: number;
576
+
577
+ /**
578
+ * Defines start date of the project, if `projectStartDate` value not set then it will be calculated from data source.
579
+ *
580
+ * @default null
581
+ */
582
+ @Property(null)
583
+ public projectStartDate: Date | string;
584
+
585
+ /**
586
+ * Defines end date of the project, if `projectEndDate` value not set then it will be calculated from data source.
587
+ *
588
+ * @default null
589
+ */
590
+ @Property(null)
591
+ public projectEndDate: Date | string;
592
+ /**
593
+ * Defines mapping property to get resource id value from resource collection.
594
+ *
595
+ * @default null
596
+ */
597
+ @Property(null)
598
+ public resourceIDMapping: string;
599
+ /**
600
+ * Defines mapping property to get resource name value from resource collection.
601
+ *
602
+ * @default null
603
+ */
604
+ @Property(null)
605
+ public resourceNameMapping: string;
606
+ /**
607
+ * Defines resource collection assigned for projects.
608
+ *
609
+ * @default []
610
+ */
611
+ @Property([])
612
+ public resources: object[];
613
+ /**
614
+ * Defines segment collection assigned for tasks.
615
+ *
616
+ * @default []
617
+ */
618
+ @Property([])
619
+ public segmentData: object[];
620
+ /**
621
+ * Defines background color of dependency lines.
622
+ *
623
+ * @default null
624
+ */
625
+ @Property(null)
626
+ public connectorLineBackground: string;
627
+ /**
628
+ * Defines width of dependency lines.
629
+ *
630
+ * @default 1
631
+ * @aspType int
632
+ */
633
+ @Property(1)
634
+ public connectorLineWidth: number;
635
+ /**
636
+ * Defines column collection displayed in grid
637
+ * If the `columns` declaration was empty then `columns` are automatically populated from `taskSettings` value.
638
+ * {% codeBlock src='gantt/columns/index.md' %}{% endcodeBlock %}
639
+ *
640
+ * @default []
641
+ */
642
+ @Property([])
643
+ public columns: Column[] | string[] | ColumnModel[];
644
+ /**
645
+ * Defines the tabs and fields to be included in the add dialog.
646
+ * If the value was empty, then it will be calculated from `taskSettings` and `columns` value.
647
+ * {% codeBlock src='gantt/addDialogFields/index.md' %}{% endcodeBlock %}
648
+ *
649
+ * @default []
650
+ */
651
+ @Property([])
652
+ public addDialogFields: AddDialogFieldSettingsModel[];
653
+ /**
654
+ * Defines the tabs and fields to be included in the edit dialog.
655
+ * If the value was empty, then it will be calculated from `taskSettings` and `columns` value.
656
+ * {% codeBlock src='gantt/editDialogFields/index.md' %}{% endcodeBlock %}
657
+ *
658
+ * @default []
659
+ */
660
+ @Property([])
661
+ public editDialogFields: EditDialogFieldSettingsModel[];
662
+ /**
663
+ * The `selectedRowIndex` allows you to select a row at initial rendering.
664
+ * You can also get the currently selected row index.
665
+ *
666
+ * @default -1
667
+ * @aspType int
668
+ */
669
+ @Property(-1)
670
+ public selectedRowIndex: number;
671
+ /**
672
+ * `workUnit` Specifies the work unit for each tasks whether day or hour or minute.
673
+ * * `day`: Sets the work unit as day.
674
+ * * `hour`: Sets the work unit as hour.
675
+ * * `minute`: Sets the work unit as minute.
676
+ *
677
+ * @default hour
678
+ */
679
+ @Property('hour')
680
+ public workUnit: WorkUnit;
681
+ /**
682
+ * `taskType` Specifies the task type for task whether fixedUnit or fixedWork or fixedDuration.
683
+ * * `fixedUnit`: Sets the task type as fixedUnit.
684
+ * * `fixedWork`: Sets the task type as fixedWork.
685
+ * * `fixedDuration`: Sets the task type as fixedDuration.
686
+ *
687
+ * @default fixedUnit
688
+ */
689
+ @Property('FixedUnit')
690
+ public taskType: TaskType;
691
+ /**
692
+ * Defines the view type of the Gantt.
693
+ */
694
+ @Property('ProjectView')
695
+ public viewType: ViewType;
696
+ /**
697
+ * Defines customized working time of project.
698
+ * {% codeBlock src='gantt/dayWorkingTime/index.md' %}{% endcodeBlock %}
699
+ */
700
+ @Collection<DayWorkingTimeModel>([{ from: 8, to: 12 }, { from: 13, to: 17 }], DayWorkingTime)
701
+ public dayWorkingTime: DayWorkingTimeModel[];
702
+ /**
703
+ * Defines holidays presented in project timeline.
704
+ * {% codeBlock src='gantt/holidays/index.md' %}{% endcodeBlock %}
705
+ *
706
+ * @default []
707
+ */
708
+ @Collection<HolidayModel>([], Holiday)
709
+ public holidays: HolidayModel[];
710
+ /**
711
+ * Defines events and status of project throughout the timeline.
712
+ * {% codeBlock src='gantt/eventMarkers/index.md' %}{% endcodeBlock %}
713
+ *
714
+ * @default []
715
+ */
716
+ @Collection<EventMarkerModel>([], EventMarker)
717
+ public eventMarkers: EventMarkerModel[];
718
+ /**
719
+ * Defines mapping properties to find task values such as id, start date, end date, duration and progress values from data source.
720
+ * {% codeBlock src='gantt/taskFields/index.md' %}{% endcodeBlock %}
721
+ */
722
+ @Complex<TaskFieldsModel>({}, TaskFields)
723
+ public taskFields: TaskFieldsModel;
724
+ /**
725
+ * Defines mapping properties to find resource values such as id, name, unit and group from resource collection.
726
+ */
727
+ @Complex<ResourceFieldsModel>({}, ResourceFields)
728
+ public resourceFields: ResourceFieldsModel;
729
+
730
+ /**
731
+ * Configures timeline settings of Gantt.
732
+ * Defines default timeline modes or customized top tier mode and bottom tier mode or single tier only.
733
+ * {% codeBlock src='gantt/timelineSettings/index.md' %}{% endcodeBlock %}
734
+ */
735
+ @Complex<TimelineSettingsModel>({}, TimelineSettings)
736
+ public timelineSettings: TimelineSettingsModel;
737
+ /**
738
+ * Configure zooming levels of Gantt Timeline
739
+ */
740
+ public zoomingLevels: ZoomTimelineSettings[];
741
+ /**
742
+ * Configures current zooming level of Gantt.
743
+ */
744
+ public currentZoomingLevel: ZoomTimelineSettings;
745
+
746
+ /**
747
+ * Configures the sort settings of the Gantt.
748
+ * {% codeBlock src='gantt/sortSettings/index.md' %}{% endcodeBlock %}
749
+ *
750
+ * @default {columns:[]}
751
+ */
752
+ @Complex<SortSettingsModel>({}, SortSettings)
753
+ public sortSettings: SortSettingsModel;
754
+
755
+ /**
756
+ * Configures edit settings of Gantt.
757
+ * {% codeBlock src='gantt/editSettings/index.md' %}{% endcodeBlock %}
758
+ *
759
+ * @default { allowAdding: false, allowEditing: false, allowDeleting: false, mode:'Auto',
760
+ * showDeleteConfirmDialog: false }
761
+ */
762
+ @Complex<EditSettingsModel>({}, EditSettings)
763
+ public editSettings: EditSettingsModel;
764
+ /**
765
+ * Enables or disables default tooltip of Gantt element and defines customized tooltip for Gantt elements.
766
+ * {% codeBlock src='gantt/tooltipSettings/index.md' %}{% endcodeBlock %}
767
+ *
768
+ * @default { showTooltip: true }
769
+ */
770
+ @Complex<TooltipSettingsModel>({}, TooltipSettings)
771
+ public tooltipSettings: TooltipSettingsModel;
772
+ /**
773
+ * Configures the selection settings.
774
+ * {% codeBlock src='gantt/selectionSettings/index.md' %}{% endcodeBlock %}
775
+ *
776
+ * @default {mode: 'Row', type: 'Single'}
777
+ */
778
+ @Complex<SelectionSettingsModel>({}, SelectionSettings)
779
+ public selectionSettings: SelectionSettingsModel;
780
+ /**
781
+ * Enables or disables filtering support in Gantt.
782
+ *
783
+ * @default false
784
+ */
785
+ @Property(false)
786
+ public allowFiltering: boolean;
787
+
788
+ /**
789
+ * If `allowExcelExport` set to true, then it will allow the user to export Gantt to Excel and CSV file.
790
+ *
791
+ * @default false
792
+ */
793
+ @Property(false)
794
+ public allowExcelExport: boolean;
795
+
796
+ /**
797
+ * If `allowRowDragAndDrop` set to true, then it will allow the user to perform drag and drop action in Gantt.
798
+ *
799
+ * @default false
800
+ */
801
+ @Property(false)
802
+ public allowRowDragAndDrop: boolean;
803
+ /**
804
+ * If `allowReordering` is set to true, Gantt columns can be reordered.
805
+ * Reordering can be done by drag and drop of a particular column from one index to another index.
806
+ *
807
+ * @default false
808
+ */
809
+ @Property(false)
810
+ public allowReordering: boolean;
811
+
812
+ /**
813
+ * If `readOnly` is set to true, Gantt cannot be edited.
814
+ *
815
+ * @default false
816
+ */
817
+ @Property(false)
818
+ public readOnly: boolean;
819
+
820
+ /**
821
+ * If `allowResizing` is set to true, Gantt columns can be resized.
822
+ *
823
+ * @default false
824
+ */
825
+ @Property(false)
826
+ public allowResizing: boolean;
827
+
828
+ /**
829
+ * If `enableContextMenu` is set to true, Enable context menu in Gantt.
830
+ *
831
+ * @default false
832
+ */
833
+ @Property(false)
834
+ public enableContextMenu: boolean;
835
+ /**
836
+ * `contextMenuItems` defines both built-in and custom context menu items.
837
+ * {% codeBlock src='gantt/contextMenuItems/index.md' %}{% endcodeBlock %}
838
+ *
839
+ * @default null
840
+ */
841
+ @Property()
842
+ public contextMenuItems: ContextMenuItem[] | ContextMenuItemModel[];
843
+ /**
844
+ * If `allowPdfExport` set to true, then it will allow the user to export Gantt to PDF file.
845
+ *
846
+ * @default false
847
+ */
848
+ @Property(false)
849
+ public allowPdfExport: boolean;
850
+ /**
851
+ * If `validateManualTasksOnLinking` is set to true,
852
+ * it enables date validation while connecting manually scheduled tasks with predecessor
853
+ *
854
+ * @default false
855
+ */
856
+
857
+ @Property(false)
858
+ public validateManualTasksOnLinking: boolean;
859
+ /**
860
+ * It enables to render the child taskbar on parent row for resource view Gantt.
861
+ *
862
+ * @default false
863
+ */
864
+ @Property(false)
865
+ public enableMultiTaskbar: boolean;
866
+ /**
867
+ * It enables to render the overallocation container for resource view Gantt.
868
+ *
869
+ * @default false
870
+ */
871
+ @Property(false)
872
+ public showOverAllocation: boolean;
873
+ /**
874
+ * Specifies task schedule mode for a project.
875
+ */
876
+ @Property('Auto')
877
+ public taskMode: ScheduleMode;
878
+
879
+ /**
880
+ * Configures the filter settings for Gantt.
881
+ * {% codeBlock src='gantt/filterSettings/index.md' %}{% endcodeBlock %}
882
+ *
883
+ * @default {columns: [], type: 'Menu' }
884
+ */
885
+ @Complex<FilterSettingsModel>({}, FilterSettings)
886
+ public filterSettings: FilterSettingsModel;
887
+
888
+ /**
889
+ * Configures the search settings for Gantt.
890
+ * {% codeBlock src='gantt/searchSettings/index.md' %}{% endcodeBlock %}
891
+ */
892
+ @Complex<SearchSettingsModel>({}, SearchSettings)
893
+ public searchSettings: SearchSettingsModel;
894
+
895
+ /**
896
+ * Configures the splitter settings for Gantt.
897
+ * {% codeBlock src='gantt/splitterSettings/index.md' %}{% endcodeBlock %}
898
+ */
899
+ @Complex<SplitterSettingsModel>({}, SplitterSettings)
900
+ public splitterSettings: SplitterSettingsModel;
901
+
902
+ /**
903
+ * @private
904
+ */
905
+ public timelineModule: Timeline;
906
+
907
+ /**
908
+ * @private
909
+ */
910
+ public dateValidationModule: DateProcessor;
911
+
912
+ /**
913
+ * @private
914
+ */
915
+ public isTreeGridRendered: boolean = false;
916
+
917
+ /**
918
+ * @private
919
+ */
920
+ public isFromOnPropertyChange: boolean = false;
921
+
922
+ /**
923
+ * @private
924
+ */
925
+ public isGanttChartRendered: boolean = false;
926
+
927
+ /**
928
+ * @private
929
+ */
930
+ public isEdit: boolean = false;
931
+
932
+ /**
933
+ * This will be triggered after the taskbar element is appended to the Gantt element.
934
+ *
935
+ * @event queryTaskbarInfo
936
+      */
937
+ @Event()
938
+ public queryTaskbarInfo: EmitType<IQueryTaskbarInfoEventArgs>;
939
+
940
+ /**
941
+ * Triggers before Gantt data is exported to Excel file.
942
+ *
943
+ * @deprecated
944
+ * @event beforeExcelExport
945
+ */
946
+ @Event()
947
+ public beforeExcelExport: EmitType<Object>;
948
+ /**
949
+ * Triggers after Gantt data is exported to Excel file.
950
+ *
951
+ * @deprecated
952
+ * @event excelExportComplete
953
+ */
954
+ @Event()
955
+ public excelExportComplete: EmitType<ExcelExportCompleteArgs>;
956
+ /**
957
+ * Triggers before exporting each cell to Excel file.
958
+ * You can also customize the Excel cells.
959
+ *
960
+ * @deprecated
961
+ * @event excelQueryCellInfo
962
+ */
963
+ @Event()
964
+ public excelQueryCellInfo: EmitType<ExcelQueryCellInfoEventArgs>;
965
+
966
+ /**
967
+ * Triggers before exporting each header cell to Excel file.
968
+ * You can also customize the Excel cells.
969
+ *
970
+ * @deprecated
971
+ * @event excelHeaderQueryCellInfo
972
+ */
973
+ @Event()
974
+ public excelHeaderQueryCellInfo: EmitType<ExcelHeaderQueryCellInfoEventArgs>;
975
+ /**
976
+ * Triggers when row elements are dragged (moved) continuously.
977
+ *
978
+ * @event rowDrag
979
+ * @deprecated
980
+ */
981
+ @Event()
982
+ public rowDrag: EmitType<RowDragEventArgs>;
983
+ /**
984
+ * Triggers when row element’s drag(move) starts.
985
+ *
986
+ * @event rowDragStart
987
+ * @deprecated
988
+ */
989
+ @Event()
990
+ public rowDragStart: EmitType<RowDragEventArgs>;
991
+
992
+ /**
993
+ * Triggers when row element’s before drag(move).
994
+ *
995
+ * @event rowDragStartHelper
996
+ */
997
+ @Event()
998
+ public rowDragStartHelper: EmitType<RowDragEventArgs>;
999
+ /**
1000
+ * Triggers when row elements are dropped on the target row.
1001
+ *
1002
+ * @event rowDrop
1003
+ */
1004
+ @Event()
1005
+ public rowDrop: EmitType<RowDragEventArgs>;
1006
+
1007
+ /**
1008
+ * This will be triggered before the row getting collapsed.
1009
+ *
1010
+ * @event collapsing
1011
+ */
1012
+ @Event()
1013
+ public collapsing: EmitType<ICollapsingEventArgs>;
1014
+
1015
+ /**
1016
+ * This will be triggered after the row getting collapsed.
1017
+ *
1018
+ * @event collapsed
1019
+ */
1020
+ @Event()
1021
+ public collapsed: EmitType<ICollapsingEventArgs>;
1022
+
1023
+ /**
1024
+ * This will be triggered before the row getting expanded.
1025
+ *
1026
+ * @event expanding
1027
+ */
1028
+ @Event()
1029
+ public expanding: EmitType<ICollapsingEventArgs>;
1030
+
1031
+ /**
1032
+ * This will be triggered after the row getting expanded.
1033
+ *
1034
+ * @event expanded
1035
+ */
1036
+ @Event()
1037
+ public expanded: EmitType<ICollapsingEventArgs>;
1038
+
1039
+ /**
1040
+ * Triggers when Gantt actions such as sorting, filtering, searching etc., starts.
1041
+ *
1042
+ * @event actionBegin
1043
+ */
1044
+ @Event()
1045
+ public actionBegin: EmitType<Object | PageEventArgs | FilterEventArgs | SortEventArgs | ITimeSpanEventArgs | IDependencyEventArgs | ITaskAddedEventArgs | ZoomEventArgs>; // eslint-disable-line
1046
+
1047
+ /**
1048
+ * Triggers when Gantt actions such as sorting, filtering, searching etc. are completed.
1049
+ *
1050
+ * @event actionComplete
1051
+ */
1052
+ @Event()
1053
+ public actionComplete: EmitType<FilterEventArgs | SortEventArgs | ITaskAddedEventArgs | IKeyPressedEventArgs | ZoomEventArgs>;
1054
+
1055
+ /**
1056
+ * Triggers when actions are failed.
1057
+ *
1058
+ * @event actionFailure
1059
+ */
1060
+ @Event()
1061
+ public actionFailure: EmitType<FailureEventArgs>;
1062
+
1063
+ /**
1064
+ * Triggers when the Gantt actions such as Sorting, Editing etc., are done.
1065
+ * In this event,the current view data and total record count should be assigned to the `dataSource` based on the action performed.
1066
+ *
1067
+ * @event dataStateChange
1068
+ */
1069
+ @Event()
1070
+ public dataStateChange: EmitType<DataStateChangeEventArgs>;
1071
+
1072
+ /**
1073
+ * This will be triggered taskbar was dragged and dropped on new position.
1074
+ *
1075
+ * @event taskbarEdited
1076
+      */
1077
+ @Event()
1078
+ public taskbarEdited: EmitType<ITaskbarEditedEventArgs>;
1079
+
1080
+ /**
1081
+ * This will be triggered when a task get saved by cell edit.
1082
+ *
1083
+ * @event endEdit
1084
+      */
1085
+ @Event()
1086
+ public endEdit: EmitType<ITaskbarEditedEventArgs>;
1087
+
1088
+ /**
1089
+ * This will be triggered a cell get begins to edit.
1090
+ *
1091
+ * @event cellEdit
1092
+ */
1093
+ @Event()
1094
+ public cellEdit: EmitType<CellEditArgs>;
1095
+
1096
+ /**
1097
+      * Triggered before the Gantt control gets rendered.
1098
+ *
1099
+      * @event load
1100
+ */
1101
+ @Event()
1102
+ public load: EmitType<Object>;
1103
+
1104
+ /**
1105
+      * Triggers when the component is created.
1106
+ *
1107
+      * @event created
1108
+      */
1109
+ @Event()
1110
+ public created: EmitType<Object>;
1111
+
1112
+ /**
1113
+      * Triggers when the component is destroyed.
1114
+ *
1115
+      * @event destroyed
1116
+      */
1117
+ @Event()
1118
+ public destroyed: EmitType<Object>;
1119
+
1120
+ /**
1121
+ * This event will be triggered when taskbar was in dragging state.
1122
+ *
1123
+ * @event taskbarEditing
1124
+      */
1125
+ @Event()
1126
+ public taskbarEditing: EmitType<ITaskbarEditedEventArgs>;
1127
+
1128
+ /**
1129
+ * Triggers when data source is populated in the Grid.
1130
+ *
1131
+      * @event dataBound
1132
+ */
1133
+ @Event()
1134
+ public dataBound: EmitType<Object>;
1135
+
1136
+ /**
1137
+ * Triggers when column resize starts.
1138
+ *
1139
+ * @deprecated
1140
+ * @event resizeStart
1141
+ */
1142
+ @Event()
1143
+ public resizeStart: EmitType<ResizeArgs>;
1144
+
1145
+ /**
1146
+ * Triggers on column resizing.
1147
+ *
1148
+ * @deprecated
1149
+ * @event resizing
1150
+ */
1151
+ @Event()
1152
+ public resizing: EmitType<ResizeArgs>;
1153
+
1154
+ /**
1155
+ * Triggers when column resize ends.
1156
+ *
1157
+ * @deprecated
1158
+ * @event resizeStop
1159
+ */
1160
+ @Event()
1161
+ public resizeStop: EmitType<ResizeArgs>;
1162
+
1163
+ /**
1164
+ * Triggers when splitter resizing starts.
1165
+ *
1166
+ * @event splitterResizeStart
1167
+ */
1168
+ @Event()
1169
+ public splitterResizeStart: EmitType<ResizeEventArgs>;
1170
+
1171
+ /**
1172
+ * Triggers when splitter bar was dragging.
1173
+ *
1174
+ * @event splitterResizing
1175
+ */
1176
+ @Event()
1177
+ public splitterResizing: EmitType<ResizingEventArgs>;
1178
+
1179
+ /**
1180
+ * Triggers when splitter resizing action completed.
1181
+ *
1182
+ * @event splitterResized
1183
+ */
1184
+ @Event()
1185
+ public splitterResized: EmitType<ISplitterResizedEventArgs>;
1186
+
1187
+ /**
1188
+ * Triggers when column header element drag (move) starts.
1189
+ *
1190
+ * @deprecated
1191
+ * @event columnDragStart
1192
+ */
1193
+ @Event()
1194
+ public columnDragStart: EmitType<ColumnDragEventArgs>;
1195
+
1196
+ /**
1197
+ * Triggers when column header element is dragged (moved) continuously.
1198
+ *
1199
+ * @deprecated
1200
+ * @event columnDrag
1201
+ */
1202
+ @Event()
1203
+ public columnDrag: EmitType<ColumnDragEventArgs>;
1204
+
1205
+ /**
1206
+ * Triggers when a column header element is dropped on the target column.
1207
+ *
1208
+ * @deprecated
1209
+ * @event columnDrop
1210
+ */
1211
+ @Event()
1212
+ public columnDrop: EmitType<ColumnDragEventArgs>;
1213
+
1214
+ /**
1215
+ * Triggers before tooltip get rendered.
1216
+ *
1217
+ * @event beforeTooltipRender
1218
+      */
1219
+ @Event()
1220
+ public beforeTooltipRender: EmitType<BeforeTooltipRenderEventArgs>;
1221
+
1222
+ /**
1223
+ * Triggers before row selection occurs.
1224
+ *
1225
+ * @event rowSelecting
1226
+ */
1227
+ @Event()
1228
+ public rowSelecting: EmitType<RowSelectingEventArgs>;
1229
+
1230
+ /**
1231
+ * Triggers after row selection occurs.
1232
+ *
1233
+ * @event rowSelected
1234
+ */
1235
+ @Event()
1236
+ public rowSelected: EmitType<RowSelectEventArgs>;
1237
+
1238
+ /**
1239
+ * Triggers before deselecting the selected row.
1240
+ *
1241
+ * @deprecated
1242
+ * @event rowDeselecting
1243
+ */
1244
+ @Event()
1245
+ public rowDeselecting: EmitType<RowDeselectEventArgs>;
1246
+
1247
+ /**
1248
+     * Triggers when a selected row is deselected.
1249
+ *
1250
+ * @event rowDeselected
1251
+ */
1252
+ @Event()
1253
+ public rowDeselected: EmitType<RowDeselectEventArgs>;
1254
+
1255
+
1256
+ /**
1257
+ * Triggers before any cell selection occurs.
1258
+ *
1259
+ * @event cellSelecting
1260
+ */
1261
+ @Event()
1262
+ public cellSelecting: EmitType<CellSelectingEventArgs>;
1263
+
1264
+ /**
1265
+ * Triggers after a cell is selected.
1266
+ *
1267
+ * @event cellSelected
1268
+ */
1269
+ @Event()
1270
+ public cellSelected: EmitType<CellSelectEventArgs>;
1271
+
1272
+ /**
1273
+ * Triggers before the selected cell is deselecting.
1274
+ *
1275
+ * @deprecated
1276
+ * @event cellDeselecting
1277
+ */
1278
+ @Event()
1279
+ public cellDeselecting: EmitType<CellDeselectEventArgs>;
1280
+
1281
+ /**
1282
+   * Triggers when a particular selected cell is deselected.
1283
+ *
1284
+ * @deprecated
1285
+    * @event cellDeselected
1286
+    */
1287
+ @Event()
1288
+ public cellDeselected: EmitType<CellDeselectEventArgs>;
1289
+
1290
+ /**
1291
+ * This will be triggered before the header cell element is appended to the Grid element.
1292
+ *
1293
+ * @event queryCellInfo
1294
+ */
1295
+ @Event()
1296
+ public queryCellInfo: EmitType<QueryCellInfoEventArgs>;
1297
+
1298
+ /**
1299
+ * This will be triggered before the header cell element is appended to the Grid element.
1300
+ *
1301
+ * @event headerCellInfo
1302
+ */
1303
+ @Event()
1304
+ public headerCellInfo: EmitType<HeaderCellInfoEventArgs>;
1305
+
1306
+ /**
1307
+ * This will be triggered before the row element is appended to the Grid element.
1308
+ *
1309
+ * @event rowDataBound
1310
+ */
1311
+ @Event()
1312
+ public rowDataBound: EmitType<RowDataBoundEventArgs>;
1313
+
1314
+ /**
1315
+ * Triggers before column menu opens.
1316
+ *
1317
+ * @deprecated
1318
+      * @event columnMenuOpen
1319
+      */
1320
+ @Event()
1321
+ public columnMenuOpen: EmitType<ColumnMenuOpenEventArgs>;
1322
+
1323
+ /**
1324
+ * Triggers when toolbar item was clicked.
1325
+ *
1326
+ * @event toolbarClick
1327
+ */
1328
+ @Event()
1329
+ public toolbarClick: EmitType<ClickEventArgs>;
1330
+ /**
1331
+ * Triggers when click on column menu.
1332
+ *
1333
+ * @event columnMenuClick
1334
+ */
1335
+ @Event()
1336
+ public columnMenuClick: EmitType<ColumnMenuClickEventArgs>;
1337
+ /**
1338
+ * Triggers before context menu opens.
1339
+ *
1340
+ * @event contextMenuOpen
1341
+ */
1342
+ @Event()
1343
+ public contextMenuOpen: EmitType<CMenuOpenEventArgs>;
1344
+
1345
+ /**
1346
+ * Triggers when click on context menu.
1347
+ *
1348
+ * @event contextMenuClick
1349
+ */
1350
+ @Event()
1351
+ public contextMenuClick: EmitType<CMenuClickEventArgs>;
1352
+
1353
+ constructor(options?: GanttModel, element?: string | HTMLElement) {
1354
+ super(options, element);
1355
+ }
1356
+
1357
+ /**
1358
+ * This event will be triggered when click on taskbar element.
1359
+ *
1360
+ * @deprecated
1361
+ * @event onTaskbarClick
1362
+      */
1363
+ @Event()
1364
+ public onTaskbarClick: EmitType<ITaskbarClickEventArgs>;
1365
+
1366
+ /**
1367
+ * This event will be triggered when double click on record.
1368
+ *
1369
+ * @deprecated
1370
+ * @event recordDoubleClick
1371
+      */
1372
+ @Event()
1373
+ public recordDoubleClick: EmitType<RecordDoubleClickEventArgs>;
1374
+
1375
+ /**
1376
+ * This event will be triggered when mouse move on Gantt.
1377
+ *
1378
+ * @deprecated
1379
+ * @event onMouseMove
1380
+      */
1381
+ @Event()
1382
+ public onMouseMove: EmitType<IMouseMoveEventArgs>;
1383
+
1384
+ /**
1385
+ * Triggers before Gantt data is exported to PDF document.
1386
+ *
1387
+ * @event beforePdfExport
1388
+ * @deprecated
1389
+ */
1390
+ @Event()
1391
+ public beforePdfExport: EmitType<Object>;
1392
+ /**
1393
+ * Triggers after TreeGrid data is exported to PDF document.
1394
+ *
1395
+ * @event pdfExportComplete
1396
+ * @deprecated
1397
+ */
1398
+ @Event()
1399
+ public pdfExportComplete: EmitType<Object>;
1400
+ /**
1401
+ * Triggers before exporting each cell to PDF document. You can also customize the PDF cells.
1402
+ *
1403
+      * @event pdfQueryCellInfo
1404
+ * @deprecated
1405
+      */
1406
+ @Event()
1407
+ public pdfQueryCellInfo: EmitType<PdfQueryCellInfoEventArgs>;
1408
+ /**
1409
+ * Triggers before exporting each taskbar to PDF document. You can also customize the taskbar.
1410
+ *
1411
+ * @event pdfQueryTaskbarInfo
1412
+ * @deprecated
1413
+ */
1414
+ @Event()
1415
+ public pdfQueryTaskbarInfo: EmitType<Object>;
1416
+ /**
1417
+ * Triggers before exporting each cell to PDF document. You can also customize the PDF cells.
1418
+ *
1419
+ * @event pdfQueryTimelineCellInfo
1420
+ * @deprecated
1421
+ */
1422
+ @Event()
1423
+ public pdfQueryTimelineCellInfo: EmitType<PdfQueryTimelineCellInfoEventArgs>;
1424
+ /**
1425
+ * Triggers before exporting each header cell to PDF document. You can also customize the PDF cells.
1426
+ *
1427
+ * @event pdfColumnHeaderQueryCellInfo
1428
+ * @deprecated
1429
+ */
1430
+ @Event()
1431
+ public pdfColumnHeaderQueryCellInfo: EmitType<PdfColumnHeaderQueryCellInfoEventArgs>;
1432
+ /**
1433
+ * To get the module name
1434
+ *
1435
+ * @returns {string} .
1436
+ * @private
1437
+ */
1438
+ public getModuleName(): string {
1439
+ return 'gantt';
1440
+ }
1441
+ /**
1442
+ * For internal use only - Initialize the event handler
1443
+ *
1444
+ * @returns {void} .
1445
+ * @private
1446
+ */
1447
+ protected preRender(): void {
1448
+ this.initProperties();
1449
+ }
1450
+ private initProperties(): void {
1451
+ this.globalize = new Internationalization(this.locale);
1452
+ this.isAdaptive = Browser.isDevice;
1453
+ this.flatData = [];
1454
+ this.currentViewData = [];
1455
+ this.updatedRecords = [];
1456
+ this.ids = [];
1457
+ this.ganttColumns = [];
1458
+ this.localeObj = new L10n(this.getModuleName(), this.getDefaultLocale(), this.locale);
1459
+ this.dataOperation = new TaskProcessor(this);
1460
+ this.nonWorkingHours = [];
1461
+ this.nonWorkingTimeRanges = [];
1462
+ this.workingTimeRanges = [];
1463
+ this.defaultEndTime = null;
1464
+ this.defaultStartTime = null;
1465
+ this.durationUnitTexts = {
1466
+ days: 'days',
1467
+ hours: 'hours',
1468
+ minutes: 'minutes',
1469
+ day: 'day',
1470
+ hour: 'hour',
1471
+ minute: 'minute'
1472
+ };
1473
+ this.durationUnitEditText = {
1474
+ minute: ['m', 'min', 'minute', 'minutes'],
1475
+ hour: ['h', 'hr', 'hour', 'hours'],
1476
+ day: ['d', 'dy', 'day', 'days']
1477
+ };
1478
+ this.perDayWidth = null;
1479
+ this.isMileStoneEdited = false;
1480
+ this.chartVerticalLineContainer = null;
1481
+ this.updatedConnectorLineCollection = [];
1482
+ this.connectorLineIds = [];
1483
+ this.predecessorsCollection = [];
1484
+ this.isInPredecessorValidation = this.enablePredecessorValidation;
1485
+ this.isValidationEnabled = true;
1486
+ this.isLoad = true;
1487
+ this.editedTaskBarItem = null;
1488
+ this.validationDialogElement = null;
1489
+ this.currentEditedArgs = {};
1490
+ this.dialogValidateMode = {
1491
+ respectLink: false,
1492
+ removeLink: false,
1493
+ preserveLinkWithEditing: true
1494
+ };
1495
+ this.secondsPerDay = this.dataOperation.getSecondsPerDay();
1496
+ this.nonWorkingDayIndex = [];
1497
+ this.dataOperation.getNonWorkingDayIndex();
1498
+ this.columnMapping = {};
1499
+ this.controlId = this.element.id;
1500
+ this.cloneProjectStartDate = null;
1501
+ this.cloneProjectEndDate = null;
1502
+ this.totalHolidayDates = this.dataOperation.getHolidayDates();
1503
+ this.ganttChartModule = new GanttChart(this);
1504
+ this.timelineModule = new Timeline(this);
1505
+ this.chartRowsModule = new ChartRows(this);
1506
+ this.treeGridModule = new GanttTreeGrid(this);
1507
+ this.dateValidationModule = new DateProcessor(this);
1508
+ this.predecessorModule = new Dependency(this);
1509
+ this.connectorLineModule = new ConnectorLine(this);
1510
+ this.splitterModule = new Splitter(this);
1511
+ this.tooltipModule = new Tooltip(this);
1512
+ this.keyConfig = {
1513
+ home: 'home',
1514
+ end: 'end',
1515
+ downArrow: 'downarrow',
1516
+ upArrow: 'uparrow',
1517
+ collapseAll: 'ctrl+uparrow',
1518
+ expandAll: 'ctrl+downarrow',
1519
+ collapseRow: 'ctrl+shift+uparrow',
1520
+ expandRow: 'ctrl+shift+downarrow',
1521
+ saveRequest: '13', // enter
1522
+ cancelRequest: '27', //Esc
1523
+ addRow: 'insert', // insert key
1524
+ addRowDialog: 'ctrl+insert',
1525
+ editRowDialog: 'ctrl+f2',
1526
+ delete: 'delete',
1527
+ tab: 'tab',
1528
+ shiftTab: 'shift+tab',
1529
+ focusTask: 'shift+f5',
1530
+ indentLevel: 'shift+leftarrow',
1531
+ outdentLevel: 'shift+rightarrow',
1532
+ focusSearch: 'ctrl+shift+70', //F Key
1533
+ contextMenu: 'shift+F10' //F Key
1534
+ };
1535
+ this.focusModule = new FocusModule(this);
1536
+ this.zoomingLevels = this.getZoomingLevels();
1537
+ this.resourceFieldsMapping();
1538
+ if (isNullOrUndefined(this.resourceFields.unit)) { //set resourceUnit as unit if not mapping
1539
+ this.resourceFields.unit = 'unit';
1540
+ }
1541
+ if (!isNullOrUndefined(this.taskFields.work)) {
1542
+ this.taskType = 'FixedWork';
1543
+ }
1544
+ this.taskIds = [];
1545
+ }
1546
+ /**
1547
+ * @returns {string} .
1548
+ * @private
1549
+ */
1550
+ public getDateFormat(): string {
1551
+ if (!isNullOrUndefined(this.dateFormat)) {
1552
+ return this.dateFormat;
1553
+ } else {
1554
+ const ganttDateFormat: string = this.globalize.getDatePattern({ skeleton: 'yMd' });
1555
+ return ganttDateFormat;
1556
+ }
1557
+ }
1558
+
1559
+ /**
1560
+ * To get timezone offset.
1561
+ *
1562
+ * @returns {number} .
1563
+ * @private
1564
+ */
1565
+ private getDefaultTZOffset(): number {
1566
+ const janMonth: Date = new Date(new Date().getFullYear(), 0, 1);
1567
+ const julMonth: Date = new Date(new Date().getFullYear(), 6, 1); //Because there is no reagions DST inbetwwen this range
1568
+ return Math.max(janMonth.getTimezoneOffset(), julMonth.getTimezoneOffset());
1569
+ }
1570
+
1571
+ /**
1572
+ * To check whether the date is in DST.
1573
+ *
1574
+ * @param {Date} date .
1575
+ * @returns {boolean} .
1576
+ * @private
1577
+ */
1578
+ public isInDst(date: Date): boolean {
1579
+ return date.getTimezoneOffset() < this.getDefaultTZOffset();
1580
+ }
1581
+
1582
+ /**
1583
+ * Method to map resource fields.
1584
+ *
1585
+ * @returns {void} .
1586
+ */
1587
+ private resourceFieldsMapping(): void {
1588
+ const resourceSettings: ResourceFieldsModel = this.resourceFields;
1589
+ resourceSettings.id = !isNullOrUndefined(resourceSettings.id) ? resourceSettings.id : this.resourceIDMapping;
1590
+ resourceSettings.name = !isNullOrUndefined(resourceSettings.name) ? resourceSettings.name : this.resourceNameMapping;
1591
+ }
1592
+ /**
1593
+ * To validate height and width
1594
+ *
1595
+ * @param {string | number} value .
1596
+ * @returns {string} .
1597
+ */
1598
+ private validateDimentionValue(value: string | number): string {
1599
+ if (!isNullOrUndefined(value)) {
1600
+ if (typeof (value) === 'string' && value !== 'auto' && value.indexOf('%') === -1) {
1601
+ return value.indexOf('px') === -1 ? value + 'px' : value;
1602
+ } else if (typeof (value) === 'number') {
1603
+ return value + 'px';
1604
+ } else {
1605
+ return value.toString();
1606
+ }
1607
+ } else {
1608
+ return null;
1609
+ }
1610
+ }
1611
+
1612
+ /**
1613
+ * To calculate dimensions of Gantt control
1614
+ *
1615
+ * @returns {void} .
1616
+ */
1617
+ private calculateDimensions(): void {
1618
+ let settingsHeight: string = this.validateDimentionValue(this.height);
1619
+ let settingsWidth: string = this.validateDimentionValue(this.width);
1620
+ if (!isNullOrUndefined(this.width) && typeof (this.width) === 'string' && this.width.indexOf('%') !== -1) {
1621
+ settingsWidth = this.width;
1622
+ }
1623
+ const elementStyleHeight: string = this.element.style.height;
1624
+ const elementStyleWidth: string = this.element.style.width;
1625
+ if (settingsWidth) {
1626
+ this.element.style.width = settingsWidth;
1627
+ }
1628
+ if (settingsHeight) {
1629
+ this.element.style.height = settingsHeight;
1630
+ }
1631
+ if (!settingsHeight && !elementStyleHeight) {
1632
+ this.element.style.height = 'auto'; // old 450px
1633
+ }
1634
+ if (!settingsWidth && !elementStyleWidth) {
1635
+ this.element.style.width = 'auto';
1636
+ }
1637
+ this.ganttHeight = this.element.offsetHeight;
1638
+ this.ganttWidth = this.element.offsetWidth;
1639
+ }
1640
+ /**
1641
+ * @returns {void} .
1642
+ * @private
1643
+ */
1644
+ protected render(): void {
1645
+ if ((<{ isReact?: boolean }>this).isReact) {
1646
+ (<{ isReact?: boolean }>this.treeGrid).isReact = true;
1647
+ (<{ isReact?: boolean }>this.treeGrid.grid).isReact = true;
1648
+ }
1649
+ createSpinner({ target: this.element }, this.createElement);
1650
+ this.trigger('load', {});
1651
+ this.element.classList.add(cls.root);
1652
+ if (this.isAdaptive) {
1653
+ this.element.classList.add(cls.adaptive);
1654
+ } else {
1655
+ this.element.classList.remove(cls.adaptive);
1656
+ }
1657
+ this.calculateDimensions();
1658
+ if (!isNullOrUndefined(this.toolbarModule)) {
1659
+ this.renderToolbar();
1660
+ }
1661
+ this.splitterModule.renderSplitter();
1662
+ this.notify('renderPanels', null);
1663
+ this.showSpinner();
1664
+ this.dataOperation.checkDataBinding();
1665
+ }
1666
+ /**
1667
+ * Method used to show spinner.
1668
+ *
1669
+ * @returns {void} .
1670
+ */
1671
+ public showSpinner(): void {
1672
+ showSpinner(this.element);
1673
+ }
1674
+ /**
1675
+ * Method used to hide spinner.
1676
+ *
1677
+ * @returns {void} .
1678
+ */
1679
+ public hideSpinner(): void {
1680
+ hideSpinner(this.element);
1681
+ }
1682
+ /**
1683
+ * @returns {void} .
1684
+ * @private
1685
+ */
1686
+ public processTimeline(): void {
1687
+ this.timelineModule.processTimelineUnit();
1688
+ this.timelineModule.calculateZoomingLevelsPerDayWidth(); // To calculate the perDaywidth
1689
+ }
1690
+ /**
1691
+ * @param {boolean} isChange .
1692
+ * @returns {void} .
1693
+ * @private
1694
+ */
1695
+ public renderGantt(isChange?: boolean): void {
1696
+ // predecessor calculation
1697
+ if (this.predecessorModule && this.taskFields.dependency) {
1698
+ this.predecessorModule['parentIds'] = [];
1699
+ this.predecessorModule['parentRecord'] = [];
1700
+ this.predecessorModule.updatePredecessors();
1701
+ if (this.isInPredecessorValidation && this.enableValidation) {
1702
+ this.predecessorModule.updatedRecordsDateByPredecessor();
1703
+ }
1704
+ }
1705
+ if (this.enableValidation) {
1706
+ this.dataOperation.calculateProjectDates();
1707
+ this.timelineModule.validateTimelineProp();
1708
+ }
1709
+ if (isChange) {
1710
+ this.isFromOnPropertyChange = isChange;
1711
+ if (this.enableValidation) {
1712
+ this.dataOperation.updateGanttData();
1713
+ }
1714
+ if (this.dataSource instanceof Object && isCountRequired(this)) {
1715
+ const count: number = getValue('count', this.dataSource);
1716
+ this.treeGrid.dataSource = {result: this.flatData, count: count};
1717
+ } else {
1718
+ this.treeGrid.dataSource = this.flatData;
1719
+ }
1720
+ } else {
1721
+ if (this.enableValidation) {
1722
+ this.dataOperation.updateGanttData();
1723
+ }
1724
+ this.treeGridPane.classList.remove('e-temp-content');
1725
+ remove(this.treeGridPane.querySelector('.e-gantt-temp-header'));
1726
+ this.notify('dataReady', {});
1727
+ if (this.enableContextMenu) {
1728
+ this.notify('initiate-contextMenu', {});
1729
+ }
1730
+ this.renderTreeGrid();
1731
+ this.wireEvents();
1732
+ this.notify('initPredessorDialog', {});
1733
+ }
1734
+ this.splitterModule.updateSplitterPosition();
1735
+ if (this.gridLines === 'Vertical' || this.gridLines === 'Both') {
1736
+ this.renderChartVerticalLines();
1737
+ }
1738
+ }
1739
+ private wireEvents(): void {
1740
+ if (this.allowKeyboard) {
1741
+ this.keyboardModule = new KeyboardEvents(
1742
+ this.element,
1743
+ {
1744
+ keyAction: this.keyActionHandler.bind(this),
1745
+ keyConfigs: this.keyConfig,
1746
+ eventName: 'keydown'
1747
+ });
1748
+ }
1749
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1750
+ EventHandler.add(window as any, 'resize', this.windowResize, this);
1751
+ }
1752
+ /**
1753
+ * Method trigger while user perform window resize.
1754
+ *
1755
+ * @returns {void} .
1756
+ * @private
1757
+ */
1758
+ public windowResize(): void {
1759
+ if (!isNullOrUndefined(this.element)) {
1760
+ this.updateContentHeight();
1761
+ this.ganttChartModule.updateWidthAndHeight(); // Updating chart scroll conatiner height for row mismatch
1762
+ this.treeGridModule.ensureScrollBar();
1763
+ if (this.predecessorModule && this.taskFields.dependency) {
1764
+ this.updateRowHeightInConnectorLine(this.updatedConnectorLineCollection);
1765
+ this.connectorLineModule.renderConnectorLines(this.updatedConnectorLineCollection);
1766
+ }
1767
+ }
1768
+ }
1769
+ public keyActionHandler(e: KeyboardEventArgs): void {
1770
+ this.focusModule.onKeyPress(e);
1771
+ }
1772
+ /**
1773
+ * Method for updating row height value in connector line collections
1774
+ *
1775
+ * @param {IConnectorLineObject[]} collection .
1776
+ * @returns {void} .
1777
+ * @private
1778
+ */
1779
+ private updateRowHeightInConnectorLine(collection: IConnectorLineObject[]): void {
1780
+ if (collection && collection.length) {
1781
+ const rowHeight: number = this.ganttChartModule.getChartRows()[0]
1782
+ && this.ganttChartModule.getChartRows()[0].getBoundingClientRect().height;
1783
+ if (rowHeight && !isNaN(rowHeight)) {
1784
+ for (let count: number = 0; count < collection.length; count++) {
1785
+ collection[count].rowHeight = rowHeight;
1786
+ }
1787
+ }
1788
+ }
1789
+ }
1790
+ /**
1791
+ * @returns {void} .
1792
+ * @private
1793
+ */
1794
+ protected renderToolbar(): void {
1795
+ if (!isNullOrUndefined(this.toolbarModule)) {
1796
+ this.toolbarModule.renderToolbar();
1797
+ this.toolbarModule.refreshToolbarItems();
1798
+ }
1799
+ }
1800
+ /**
1801
+ * @returns {void} .
1802
+ * @private
1803
+ */
1804
+ protected renderTreeGrid(): void {
1805
+ this.treeGridModule.renderTreeGrid();
1806
+ }
1807
+ private updateCurrentViewData(): void {
1808
+ this.currentViewData = this.treeGrid.getCurrentViewRecords().slice();
1809
+ }
1810
+ /**
1811
+ * @param {IGanttData} records .
1812
+ * @returns {IGanttData} .
1813
+ * @private
1814
+ */
1815
+ public getRecordFromFlatdata(records: IGanttData[]): IGanttData[] {
1816
+ const updatedRecord: IGanttData[] = [];
1817
+ for (let i: number = 0; i < records.length; i++) {
1818
+ updatedRecord.push(this.getTaskByUniqueID(records[i].uniqueID));
1819
+ }
1820
+ return updatedRecord;
1821
+ }
1822
+ /**
1823
+ * @param {object} args .
1824
+ * @returns {void} .
1825
+ * @private
1826
+ */
1827
+ public updateContentHeight(args?: object): void {
1828
+ if (this.virtualScrollModule && this.enableVirtualization && !isNullOrUndefined(args)) {
1829
+ const length: number = getValue('result.length', args);
1830
+ this.contentHeight = length * this.rowHeight;
1831
+ } else {
1832
+ const expandedRecords: IGanttData[] = this.virtualScrollModule && this.enableVirtualization ?
1833
+ this.currentViewData : this.getExpandedRecords(this.currentViewData);
1834
+ let height: number;
1835
+ const chartRow: Element = this.ganttChartModule.getChartRows()[0];
1836
+ if (!isNullOrUndefined(chartRow) && chartRow.getBoundingClientRect().height > 0) {
1837
+ height = chartRow.getBoundingClientRect().height;
1838
+ } else {
1839
+ height = this.rowHeight;
1840
+ }
1841
+ this.contentHeight = expandedRecords.length * height;
1842
+ }
1843
+ }
1844
+ /**
1845
+ * To get expand status.
1846
+ *
1847
+ * @param {IGanttData} data .
1848
+ * @returns {boolean} .
1849
+ * @private
1850
+ */
1851
+ public getExpandStatus(data: IGanttData): boolean {
1852
+ const parentRecord: IGanttData = this.getParentTask(data.parentItem);
1853
+ if (!isNullOrUndefined(parentRecord)) {
1854
+ if (parentRecord.expanded === false) {
1855
+ return false;
1856
+ } else if (parentRecord.parentItem) {
1857
+ const parentData: IGanttData = this.getParentTask(parentRecord.parentItem);
1858
+ if (parentData.expanded === false) {
1859
+ return false;
1860
+ } else {
1861
+ return this.getExpandStatus(this.getParentTask(parentRecord.parentItem));
1862
+ }
1863
+ } else {
1864
+ return true;
1865
+ }
1866
+ } else {
1867
+ return true;
1868
+ }
1869
+ }
1870
+ /**
1871
+ * Get expanded records from given record collection.
1872
+ *
1873
+ * @param {IGanttData[]} records - Defines record collection.
1874
+ * @returns {IGanttData[]} .
1875
+ * @deprecated
1876
+ */
1877
+ public getExpandedRecords(records: IGanttData[]): IGanttData[] {
1878
+ if (isNullOrUndefined(records)) {
1879
+ return [];
1880
+ }
1881
+ const expandedRecords: IGanttData[] = records.filter((record: IGanttData) => {
1882
+ return this.getExpandStatus(record) === true;
1883
+ });
1884
+ return expandedRecords;
1885
+ }
1886
+ /**
1887
+ * Getting the Zooming collections of the Gantt control
1888
+ *
1889
+ * @returns {ZoomTimelineSettings} .
1890
+ * @private
1891
+ */
1892
+ public getZoomingLevels(): ZoomTimelineSettings[] {
1893
+ const zoomingLevels: ZoomTimelineSettings[] = [
1894
+ {
1895
+ topTier: { unit: 'Year', format: 'yyyy', count: 50 },
1896
+ bottomTier: { unit: 'Year', format: 'yyyy', count: 10 }, timelineUnitSize: 99, level: 0,
1897
+ timelineViewMode: 'Year', weekStartDay: 0, updateTimescaleView: true, weekendBackground: null, showTooltip: true
1898
+ },
1899
+ {
1900
+ topTier: { unit: 'Year', format: 'yyyy', count: 20 },
1901
+ bottomTier: { unit: 'Year', format: 'yyyy', count: 5 }, timelineUnitSize: 99, level: 1,
1902
+ timelineViewMode: 'Year', weekStartDay: 0, updateTimescaleView: true, weekendBackground: null, showTooltip: true
1903
+ },
1904
+ {
1905
+ topTier: { unit: 'Year', format: 'yyyy', count: 5 },
1906
+ bottomTier: { unit: 'Year', format: 'yyyy', count: 1 }, timelineUnitSize: 99, level: 2,
1907
+ timelineViewMode: 'Year', weekStartDay: 0, updateTimescaleView: true, weekendBackground: null, showTooltip: true
1908
+ },
1909
+ {
1910
+ topTier: { unit: 'Year', format: 'MMM, yy', count: 1 },
1911
+ bottomTier: {
1912
+ unit: 'Month', formatter: this.displayHalfValue, count: 6
1913
+ }, timelineUnitSize: 66, level: 3,
1914
+ timelineViewMode: 'Year', weekStartDay: 0, updateTimescaleView: true, weekendBackground: null, showTooltip: true
1915
+ },
1916
+ {
1917
+ topTier: { unit: 'Year', format: 'MMM, yy', count: 1 },
1918
+ bottomTier: {
1919
+ unit: 'Month', formatter: this.displayHalfValue, count: 6
1920
+ }, timelineUnitSize: 99, level: 4,
1921
+ timelineViewMode: 'Year', weekStartDay: 0, updateTimescaleView: true, weekendBackground: null, showTooltip: true
1922
+ },
1923
+ {
1924
+ topTier: { unit: 'Year', format: 'MMM, yy', count: 1 },
1925
+ bottomTier: {
1926
+ unit: 'Month', formatter: this.displayQuarterValue, count: 3
1927
+ }, timelineUnitSize: 66, level: 5,
1928
+ timelineViewMode: 'Year', weekStartDay: 0, updateTimescaleView: true, weekendBackground: null, showTooltip: true
1929
+ },
1930
+ {
1931
+ topTier: { unit: 'Year', format: 'yyyy', count: 1 },
1932
+ bottomTier: {
1933
+ unit: 'Month', formatter: this.displayQuarterValue, count: 3
1934
+ }, timelineUnitSize: 99, level: 6,
1935
+ timelineViewMode: 'Year', weekStartDay: 0, updateTimescaleView: true, weekendBackground: null, showTooltip: true
1936
+ },
1937
+ {
1938
+ topTier: { unit: 'Year', format: 'yyyy', count: 1 },
1939
+ bottomTier: { unit: 'Month', format: 'MMM yyyy', count: 1 }, timelineUnitSize: 99, level: 7,
1940
+ timelineViewMode: 'Year', weekStartDay: 0, updateTimescaleView: true, weekendBackground: null, showTooltip: true
1941
+ },
1942
+ {
1943
+ topTier: { unit: 'Month', format: 'MMM, yy', count: 1 },
1944
+ bottomTier: { unit: 'Week', format: 'dd', count: 1 }, timelineUnitSize: 33, level: 8,
1945
+ timelineViewMode: 'Month', weekStartDay: 0, updateTimescaleView: true, weekendBackground: null, showTooltip: true
1946
+ },
1947
+ {
1948
+ topTier: { unit: 'Month', format: 'MMM, yyyy', count: 1 },
1949
+ bottomTier: { unit: 'Week', format: 'dd MMM', count: 1 }, timelineUnitSize: 66, level: 9,
1950
+ timelineViewMode: 'Month', weekStartDay: 0, updateTimescaleView: true, weekendBackground: null, showTooltip: true
1951
+ },
1952
+ {
1953
+ topTier: { unit: 'Month', format: 'MMM, yyyy', count: 1 },
1954
+ bottomTier: { unit: 'Week', format: 'dd MMM', count: 1 }, timelineUnitSize: 99, level: 10,
1955
+ timelineViewMode: 'Month', weekStartDay: 0, updateTimescaleView: true, weekendBackground: null, showTooltip: true
1956
+ },
1957
+ {
1958
+ topTier: { unit: 'Week', format: 'MMM dd, yyyy', count: 1 },
1959
+ bottomTier: { unit: 'Day', format: 'd', count: 1 }, timelineUnitSize: 33, level: 11,
1960
+ timelineViewMode: 'Week', weekStartDay: 0, updateTimescaleView: true, weekendBackground: null, showTooltip: true
1961
+ },
1962
+ {
1963
+ topTier: { unit: 'Week', format: 'MMM dd, yyyy', count: 1 },
1964
+ bottomTier: { unit: 'Day', format: 'd', count: 1 }, timelineUnitSize: 66, level: 12,
1965
+ timelineViewMode: 'Week', weekStartDay: 0, updateTimescaleView: true, weekendBackground: null, showTooltip: true
1966
+ },
1967
+ {
1968
+ topTier: { unit: 'Week', format: 'MMM dd, yyyy', count: 1 },
1969
+ bottomTier: { unit: 'Day', format: 'd', count: 1 }, timelineUnitSize: 99, level: 13,
1970
+ timelineViewMode: 'Week', weekStartDay: 0, updateTimescaleView: true, weekendBackground: null, showTooltip: true
1971
+ },
1972
+ {
1973
+ topTier: { unit: 'Day', format: 'E dd yyyy', count: 1 },
1974
+ bottomTier: { unit: 'Hour', format: 'hh a', count: 12 }, timelineUnitSize: 66, level: 14,
1975
+ timelineViewMode: 'Day', weekStartDay: 0, updateTimescaleView: true, weekendBackground: null, showTooltip: true
1976
+ },
1977
+ {
1978
+ topTier: { unit: 'Day', format: 'E dd yyyy', count: 1 },
1979
+ bottomTier: { unit: 'Hour', format: 'hh a', count: 12 }, timelineUnitSize: 99, level: 15,
1980
+ timelineViewMode: 'Day', weekStartDay: 0, updateTimescaleView: true, weekendBackground: null, showTooltip: true
1981
+ },
1982
+ {
1983
+ topTier: { unit: 'Day', format: 'E dd yyyy', count: 1 },
1984
+ bottomTier: { unit: 'Hour', format: 'hh a', count: 6 }, timelineUnitSize: 66, level: 16,
1985
+ timelineViewMode: 'Day', weekStartDay: 0, updateTimescaleView: true, weekendBackground: null, showTooltip: true
1986
+ },
1987
+ {
1988
+ topTier: { unit: 'Day', format: 'E dd yyyy', count: 1 },
1989
+ bottomTier: { unit: 'Hour', format: 'hh a', count: 6 }, timelineUnitSize: 99, level: 17,
1990
+ timelineViewMode: 'Day', weekStartDay: 0, updateTimescaleView: true, weekendBackground: null, showTooltip: true
1991
+ },
1992
+ {
1993
+ topTier: { unit: 'Day', format: 'E dd yyyy', count: 1 },
1994
+ bottomTier: { unit: 'Hour', format: 'hh a', count: 2 }, timelineUnitSize: 66, level: 18,
1995
+ timelineViewMode: 'Day', weekStartDay: 0, updateTimescaleView: true, weekendBackground: null, showTooltip: true
1996
+ },
1997
+ {
1998
+ topTier: { unit: 'Day', format: 'E dd yyyy', count: 1 },
1999
+ bottomTier: { unit: 'Hour', format: 'hh a', count: 2 }, timelineUnitSize: 99, level: 19,
2000
+ timelineViewMode: 'Day', weekStartDay: 0, updateTimescaleView: true, weekendBackground: null, showTooltip: true
2001
+ },
2002
+ {
2003
+ topTier: { unit: 'Day', format: 'E dd yyyy', count: 1 },
2004
+ bottomTier: { unit: 'Hour', format: 'hh a', count: 1 }, timelineUnitSize: 66, level: 20,
2005
+ timelineViewMode: 'Day', weekStartDay: 0, updateTimescaleView: true, weekendBackground: null, showTooltip: true
2006
+ },
2007
+ {
2008
+ topTier: { unit: 'Day', format: 'E dd yyyy', count: 1 },
2009
+ bottomTier: { unit: 'Hour', format: 'hh a', count: 1 }, timelineUnitSize: 99, level: 21,
2010
+ timelineViewMode: 'Day', weekStartDay: 0, updateTimescaleView: true, weekendBackground: null, showTooltip: true
2011
+ },
2012
+ {
2013
+ topTier: { unit: 'Hour', format: 'ddd MMM, h a', count: 1 },
2014
+ bottomTier: { unit: 'Minutes', format: 'mm', count: 30 }, timelineUnitSize: 66, level: 22,
2015
+ timelineViewMode: 'Hour', weekStartDay: 0, updateTimescaleView: true, weekendBackground: null, showTooltip: true
2016
+ },
2017
+ {
2018
+ topTier: { unit: 'Hour', format: 'ddd MMM, h a', count: 1 },
2019
+ bottomTier: { unit: 'Minutes', format: 'mm', count: 15 }, timelineUnitSize: 66, level: 23,
2020
+ timelineViewMode: 'Hour', weekStartDay: 0, updateTimescaleView: true, weekendBackground: null, showTooltip: true
2021
+ },
2022
+ {
2023
+ topTier: { unit: 'Hour', format: 'ddd MMM, h a', count: 1 },
2024
+ bottomTier: { unit: 'Minutes', format: 'mm', count: 1 }, timelineUnitSize: 66, level: 24,
2025
+ timelineViewMode: 'Hour', weekStartDay: 0, updateTimescaleView: true, weekendBackground: null, showTooltip: true
2026
+ }
2027
+
2028
+ ];
2029
+ return zoomingLevels;
2030
+ }
2031
+ private displayQuarterValue(date: Date): string {
2032
+ const month: number = date.getMonth();
2033
+ if (month >= 0 && month <= 2) {
2034
+ return 'Q1';
2035
+ } else if (month >= 3 && month <= 5) {
2036
+ return 'Q2';
2037
+ } else if (month >= 6 && month <= 8) {
2038
+ return 'Q3';
2039
+ } else {
2040
+ return 'Q4';
2041
+ }
2042
+ }
2043
+ private displayHalfValue(date: Date): string {
2044
+ const month: number = date.getMonth();
2045
+ if (month >= 0 && month <= 5) {
2046
+ return 'H1';
2047
+ } else {
2048
+ return 'H2';
2049
+ }
2050
+ }
2051
+
2052
+ /**
2053
+ *
2054
+ * @param {Date} date .
2055
+ * @param {string} format .
2056
+ * @returns {string} .
2057
+ */
2058
+ public getFormatedDate(date: Date, format?: string): string {
2059
+ if (isNullOrUndefined(date)) {
2060
+ return null;
2061
+ }
2062
+ if (isNullOrUndefined(format)) {
2063
+ format = this.getDateFormat();
2064
+ }
2065
+ return this.globalize.formatDate(date, { format: format });
2066
+ }
2067
+ /**
2068
+ * Get duration value as string combined with duration and unit values.
2069
+ *
2070
+ * @param {number} duration - Defines the duration.
2071
+ * @param {string} durationUnit - Defines the duration unit.
2072
+ * @returns {string} .
2073
+ */
2074
+ public getDurationString(duration: number, durationUnit: string): string {
2075
+ const value: string = this.dateValidationModule.getDurationString(duration, durationUnit);
2076
+ return value;
2077
+ }
2078
+ /**
2079
+ * Get work value as string combined with work and unit values.
2080
+ *
2081
+ * @param {number} work - Defines the work value.
2082
+ * @param {string} workUnit - Defines the work unit.
2083
+ * @returns {string} .
2084
+ */
2085
+ public getWorkString(work: number, workUnit: string): string {
2086
+ const value: string = this.dateValidationModule.getWorkString(work, workUnit);
2087
+ return value;
2088
+ }
2089
+ /**
2090
+ *
2091
+ * @param {object} args .
2092
+ * @returns {void} .
2093
+ * @private
2094
+ */
2095
+ public treeDataBound(args: object): void {
2096
+ this.element.getElementsByClassName('e-chart-root-container')[0]['style'].height = '100%';
2097
+ let gridHeight: string = this.element.getElementsByClassName('e-gridcontent')[0]['style'].height;
2098
+ let timelineContainer: number = this.element.getElementsByClassName('e-timeline-header-container')[0]['offsetHeight'];
2099
+ gridHeight = 'calc(100% - ' + timelineContainer + 'px)';
2100
+ // eslint-disable-next-line
2101
+ this.element.getElementsByClassName('e-chart-scroll-container e-content')[0]['style'].height = 'calc(100% - ' + timelineContainer + 'px)';
2102
+ if (!isNullOrUndefined(this.toolbarModule) && !isNullOrUndefined(this.toolbarModule.element)) {
2103
+ this.splitterElement.style.height = 'calc(100% - ' + this.toolbarModule.element.offsetHeight + 'px)';
2104
+ } else {
2105
+ this.splitterElement.style.height = '100%';
2106
+ }
2107
+ if (this.isLoad) {
2108
+ this.updateCurrentViewData();
2109
+ if (!this.enableVirtualization) {
2110
+ this.updateContentHeight();
2111
+ }
2112
+ if (!this.isTreeGridRendered) {
2113
+ this.isTreeGridRendered = true;
2114
+ let toolbarHeight: number = 0;
2115
+ if (!isNullOrUndefined(this.toolbarModule) && !isNullOrUndefined(this.toolbarModule.element)) {
2116
+ toolbarHeight = this.toolbarModule.element.offsetHeight;
2117
+ }
2118
+ if (this.timelineModule.isSingleTier) {
2119
+ addClass(this.treeGrid.element.querySelectorAll('.e-headercell'), cls.timelineSingleHeaderOuterDiv);
2120
+ addClass(this.treeGrid.element.querySelectorAll('.e-columnheader'), cls.timelineSingleHeaderOuterDiv);
2121
+ } else {
2122
+ removeClass(this.treeGrid.element.querySelectorAll('.e-headercell'), cls.timelineSingleHeaderOuterDiv);
2123
+ removeClass(this.treeGrid.element.querySelectorAll('.e-columnheader'), cls.timelineSingleHeaderOuterDiv);
2124
+ }
2125
+ this.treeGrid.height = '100%';
2126
+ this.notify('tree-grid-created', {});
2127
+ this.createGanttPopUpElement();
2128
+ this.hideSpinner();
2129
+ setValue('isGanttCreated', true, args);
2130
+ this.renderComplete();
2131
+ }
2132
+ } else {
2133
+ this.getCurrentRecords(args);
2134
+ }
2135
+ this.notify('recordsUpdated', {});
2136
+ this.isLoad = false;
2137
+ this.trigger('dataBound', args);
2138
+ }
2139
+ /**
2140
+ * @param {object} args .
2141
+ * @returns {void} .
2142
+ * @private
2143
+ */
2144
+ // eslint-disable-next-line
2145
+ private getCurrentRecords(args: object): void {
2146
+ if (this.predecessorModule && this.taskFields.dependency) {
2147
+ this.connectorLineModule.removePreviousConnectorLines(this.currentViewData);
2148
+ }
2149
+ this.updateCurrentViewData();
2150
+ if (!this.enableVirtualization) {
2151
+ this.updateContentHeight();
2152
+ }
2153
+ // this.chartRowsModule.refreshGanttRows();
2154
+ if (this.virtualScrollModule && this.enableVirtualization) {
2155
+ this.ganttChartModule.virtualRender.adjustTable();
2156
+ this.ganttChartModule.scrollObject.updateTopPosition();
2157
+ }
2158
+ }
2159
+
2160
+ /**
2161
+ * Called internally, if any of the property value changed.
2162
+ *
2163
+ * @param {GanttModel} newProp .
2164
+ * @param {GanttModel} oldProp .
2165
+ * @returns {void} .
2166
+ * @private
2167
+ */
2168
+ // eslint-disable-next-line
2169
+ public onPropertyChanged(newProp: GanttModel, oldProp: GanttModel): void {
2170
+ let isRefresh: boolean = false;
2171
+ // eslint-disable-next-line
2172
+ for (let prop of Object.keys(newProp)) {
2173
+ switch (prop) {
2174
+ case 'allowSelection':
2175
+ case 'allowRowDragAndDrop':
2176
+ case 'allowFiltering':
2177
+ case 'showColumnMenu':
2178
+ case 'allowResizing':
2179
+ case 'allowReordering':
2180
+ case 'enableImmutableMode':
2181
+ this.treeGrid[prop] = this[prop];
2182
+ this.treeGrid.dataBind();
2183
+ break;
2184
+ case 'workWeek':
2185
+ this.dataOperation.getNonWorkingDayIndex();
2186
+ this.dataOperation.reUpdateGanttData();
2187
+ this.chartRowsModule.initiateTemplates();
2188
+ if (this.taskFields.dependency) {
2189
+ this.predecessorModule.updatedRecordsDateByPredecessor();
2190
+ }
2191
+ this.chartRowsModule.refreshGanttRows();
2192
+ this.treeGrid.refreshColumns();
2193
+ this.timelineModule.refreshTimeline();
2194
+ break;
2195
+ case 'toolbar':
2196
+ this.notify('ui-toolbarupdate', { module: 'toolbar', properties: newProp });
2197
+ break;
2198
+ case 'columnMenuItems':
2199
+ this.treeGrid.grid.columnMenuItems = getActualProperties(this.columnMenuItems);
2200
+ break;
2201
+ case 'eventMarkers':
2202
+ case 'highlightWeekends':
2203
+ this.notify('ui-update', { module: 'day-markers', properties: newProp });
2204
+ break;
2205
+ case 'sortSettings':
2206
+ this.treeGrid.sortSettings = getActualProperties(this.sortSettings);
2207
+ this.treeGrid.dataBind();
2208
+ break;
2209
+ case 'timelineSettings':
2210
+ this.timelineModule.refreshTimeline();
2211
+ break;
2212
+ case 'rowHeight':
2213
+ case 'taskbarHeight':
2214
+ this.treeGrid.rowHeight = this.rowHeight;
2215
+ this.treeGrid.dataBind();
2216
+ this.chartRowsModule.initiateTemplates();
2217
+ this.timelineModule.updateChartByNewTimeline();
2218
+ if (this.taskFields.dependency) {
2219
+ this.ganttChartModule.reRenderConnectorLines();
2220
+ }
2221
+ break;
2222
+ case 'timezone':
2223
+ this.dataOperation.checkDataBinding(true);
2224
+ break;
2225
+ case 'filterSettings':
2226
+ this.treeGrid.filterSettings = getActualProperties(this.filterSettings) as TreeGridFilterSettingModel;
2227
+ this.treeGrid.dataBind();
2228
+ break;
2229
+ case 'gridLines':
2230
+ this.treeGrid.gridLines = this.gridLines;
2231
+ this.treeGrid.dataBind();
2232
+ this.renderChartGridLines();
2233
+ break;
2234
+ case 'tooltipSettings':
2235
+ if (this.tooltipModule.toolTipObj) {
2236
+ this.tooltipModule.toolTipObj.destroy();
2237
+ }
2238
+ this.tooltipModule.createTooltip();
2239
+ break;
2240
+ case 'splitterSettings':
2241
+ this.splitterModule.updateSplitterPosition();
2242
+ break;
2243
+ case 'selectionSettings':
2244
+ this.treeGrid.selectionSettings = getActualProperties(this.selectionSettings);
2245
+ this.treeGrid.grid.selectionSettings.enableToggle = this.selectionSettings.enableToggle;
2246
+ this.treeGrid.dataBind();
2247
+ break;
2248
+ case 'searchSettings':
2249
+ if (newProp.searchSettings.key !== ("" || undefined)) {
2250
+ this.treeGrid.grid.searchSettings = getActualProperties(this.searchSettings);
2251
+ this.treeGrid.grid.dataBind();
2252
+ }
2253
+ this.treeGrid.searchSettings = getActualProperties(this.searchSettings);
2254
+ this.treeGrid.dataBind();
2255
+ if (this.toolbarModule) {
2256
+ this.toolbarModule.updateSearchTextBox();
2257
+ }
2258
+ break;
2259
+ case 'labelSettings':
2260
+ case 'renderBaseline':
2261
+ case 'baselineColor':
2262
+ this.chartRowsModule.initiateTemplates();
2263
+ this.chartRowsModule.refreshGanttRows();
2264
+ break;
2265
+ case 'resourceIDMapping':
2266
+ case 'resourceNameMapping':
2267
+ case 'resources':
2268
+ this.dataOperation.reUpdateResources();
2269
+ this.treeGrid.refreshColumns();
2270
+ this.chartRowsModule.initiateTemplates();
2271
+ this.chartRowsModule.refreshGanttRows();
2272
+ break;
2273
+ case 'includeWeekend':
2274
+ case 'dayWorkingTime':
2275
+ case 'allowUnscheduledTasks':
2276
+ case 'holidays':
2277
+ if (prop === 'holidays') {
2278
+ this.totalHolidayDates = this.dataOperation.getHolidayDates();
2279
+ this.notify('ui-update', { module: 'day-markers', properties: newProp });
2280
+ }
2281
+ this.dataOperation.reUpdateGanttData();
2282
+ this.treeGrid.refreshColumns();
2283
+ this.chartRowsModule.initiateTemplates();
2284
+ this.chartRowsModule.refreshGanttRows();
2285
+ break;
2286
+ case 'addDialogFields':
2287
+ case 'editDialogFields':
2288
+ if (this.editModule && this.editModule.dialogModule) {
2289
+ this.editModule.dialogModule.processDialogFields();
2290
+ }
2291
+ break;
2292
+ case 'columns':
2293
+ this.treeGridModule.treeGridColumns = [];
2294
+ this.treeGridModule.validateGanttColumns();
2295
+ this.treeGrid.columns = this.treeGridModule.treeGridColumns;
2296
+ this.chartRowsModule.initiateTemplates();
2297
+ this.timelineModule.updateChartByNewTimeline();
2298
+ break;
2299
+ case 'width':
2300
+ case 'height':
2301
+ this.reUpdateDimention();
2302
+ break;
2303
+ case 'editSettings':
2304
+ this.treeGrid.editSettings.allowAdding = this.editSettings.allowAdding;
2305
+ this.treeGrid.editSettings.allowDeleting = this.editSettings.allowDeleting;
2306
+ this.treeGrid.editSettings.showDeleteConfirmDialog = this.editSettings.showDeleteConfirmDialog;
2307
+ this.treeGrid.editSettings.allowEditing = this.editSettings.allowEditing;
2308
+ this.treeGrid.editSettings.allowNextRowEdit = this.editSettings.allowNextRowEdit;
2309
+ if (!isNullOrUndefined(this.editModule)) {
2310
+ this.editModule.reUpdateEditModules();
2311
+ }
2312
+ if (!isNullOrUndefined(this.toolbarModule)) {
2313
+ this.toolbarModule.refreshToolbarItems();
2314
+ }
2315
+ break;
2316
+ case 'connectorLineBackground':
2317
+ case 'connectorLineWidth':
2318
+ if (this.taskFields.dependency) {
2319
+ this.connectorLineModule.initPublicProp();
2320
+ this.ganttChartModule.reRenderConnectorLines();
2321
+ }
2322
+ break;
2323
+ case 'treeColumnIndex':
2324
+ this.treeGrid.treeColumnIndex = this.treeColumnIndex;
2325
+ break;
2326
+ case 'projectStartDate':
2327
+ case 'projectEndDate':
2328
+ this.dataOperation.calculateProjectDates();
2329
+ this.updateProjectDates(
2330
+ this.cloneProjectStartDate, this.cloneProjectEndDate, this.isTimelineRoundOff);
2331
+ break;
2332
+ case 'selectedRowIndex':
2333
+ if (!isNullOrUndefined(this.selectionModule)) {
2334
+ this.selectionModule.selectRowByIndex();
2335
+ }
2336
+ break;
2337
+ case 'dataSource':
2338
+ this.closeGanttActions();
2339
+ if (this.dataSource instanceof Object && isCountRequired(this)) {
2340
+ // In order to bind the observable data at load time, hasChildMapping is necessary to be mapped.
2341
+ this.treeGrid.hasChildMapping = 'isParent';
2342
+ const count: number = getValue('count', this.dataSource);
2343
+ this.treeGrid.dataSource = {result: this.flatData, count: count};
2344
+ } else {
2345
+ this.treeGrid.hasChildMapping = null;
2346
+ }
2347
+ this.dataOperation.checkDataBinding(true);
2348
+ break;
2349
+ case 'enableContextMenu':
2350
+ case 'contextMenuItems':
2351
+ if (this.enableContextMenu || prop === 'contextMenuItems') {
2352
+ this.notify('reRender-contextMenu', { module: 'contextMenu', enable: this.contextMenuItems });
2353
+ } else {
2354
+ this.treeGrid.contextMenuItems = [];
2355
+ }
2356
+ this.treeGrid.dataBind();
2357
+ break;
2358
+ case 'currencyCode':
2359
+ case 'locale':
2360
+ case 'enableRtl':
2361
+ case 'readOnly':
2362
+ case 'viewType':
2363
+ isRefresh = true;
2364
+ break;
2365
+ case 'validateManualTasksOnLinking':
2366
+ this.validateManualTasksOnLinking = newProp.validateManualTasksOnLinking;
2367
+ break;
2368
+ case 'showOverAllocation':
2369
+ this.updateOverAllocationCotainer();
2370
+ break;
2371
+ }
2372
+ }
2373
+ if (isRefresh) {
2374
+ this.refresh();
2375
+ }
2376
+ }
2377
+
2378
+ private updateOverAllocationCotainer(): void {
2379
+ if (this.showOverAllocation && this.viewType === 'ResourceView') {
2380
+ this.ganttChartModule.renderOverAllocationContainer();
2381
+ } else {
2382
+ const rangeContainer: HTMLElement = this.element.querySelector('.' + cls.rangeContainer);
2383
+ if (rangeContainer) {
2384
+ rangeContainer.innerHTML = '';
2385
+ }
2386
+ }
2387
+ }
2388
+
2389
+ /**
2390
+ * Get the properties to be maintained in the persisted state.
2391
+ *
2392
+ * @returns {string} .
2393
+ * @private
2394
+ */
2395
+ public getPersistData(): string {
2396
+ const keyEntity: string[] = ['allowSelection'];
2397
+ return this.addOnPersist(keyEntity);
2398
+ }
2399
+ /**
2400
+ * @returns {void} .
2401
+ * @private
2402
+ */
2403
+ public destroy(): void {
2404
+ this.notify('destroy', {});
2405
+ if (!isNullOrUndefined(this.validationDialogElement) && !this.validationDialogElement.isDestroyed) {
2406
+ this.validationDialogElement.destroy();
2407
+ }
2408
+ const modules: string[] = ['ganttChartModule', 'timelineModule', 'chartRowsModule',
2409
+ 'treeGridModule', 'ganttDataUpdatesModule', 'dateValidationModule', 'tooltipModule'];
2410
+ for (let i: number = 0; i < modules.length; i++) {
2411
+ if (this[modules[i]]) {
2412
+ this[modules[i]] = null;
2413
+ }
2414
+ }
2415
+ if (this.keyboardModule) {
2416
+ this.keyboardModule.destroy();
2417
+ }
2418
+ if(this.editModule && this.editModule.dialogModule){
2419
+
2420
+ this.editModule.dialogModule.destroy();
2421
+ }
2422
+ super.destroy();
2423
+ this.chartVerticalLineContainer = null;
2424
+ this.element.innerHTML = '';
2425
+ removeClass([this.element], cls.root);
2426
+ this.element.innerHTML = '';
2427
+ this.isTreeGridRendered = false;
2428
+ this.resetTemplates();
2429
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2430
+ EventHandler.remove(window as any, 'resize', this.windowResize);
2431
+ }
2432
+ /**
2433
+ * Method to get taskbarHeight.
2434
+ *
2435
+ * @returns {number} .
2436
+ * @public
2437
+ */
2438
+ public getTaskbarHeight(): number {
2439
+ return this.chartRowsModule.taskBarHeight;
2440
+ }
2441
+
2442
+ /**
2443
+ * To provide the array of modules needed for component rendering
2444
+ *
2445
+ * @returns {ModuleDeclaration[]} .
2446
+ * @hidden
2447
+ */
2448
+ public requiredModules(): ModuleDeclaration[] {
2449
+ const modules: ModuleDeclaration[] = [];
2450
+ if (this.isDestroyed) { return modules; }
2451
+ if (this.allowSorting) {
2452
+ modules.push({
2453
+ member: 'sort',
2454
+ args: [this]
2455
+ });
2456
+ }
2457
+ if (this.allowFiltering || (this.toolbar && this.toolbar.indexOf('Search') !== -1)) {
2458
+ modules.push({
2459
+ member: 'filter',
2460
+ args: [this]
2461
+ });
2462
+ }
2463
+ if (this.allowReordering) {
2464
+ modules.push({
2465
+ member: 'reorder',
2466
+ args: [this]
2467
+ });
2468
+ }
2469
+ if (this.allowExcelExport) {
2470
+ modules.push({
2471
+ member: 'excelExport',
2472
+ args: [this]
2473
+ });
2474
+ }
2475
+ if (this.allowRowDragAndDrop) {
2476
+ modules.push({
2477
+ member: 'rowDragAndDrop',
2478
+ args: [this]
2479
+ });
2480
+ }
2481
+ if (this.allowResizing) {
2482
+ modules.push({
2483
+ member: 'resize',
2484
+ args: [this]
2485
+ });
2486
+ }
2487
+ if (this.toolbar) {
2488
+ modules.push({
2489
+ member: 'toolbar',
2490
+ args: [this]
2491
+ });
2492
+ }
2493
+ if (this.editSettings.allowAdding || this.editSettings.allowEditing || this.editSettings.allowDeleting
2494
+ || this.editSettings.allowTaskbarEditing || this.allowRowDragAndDrop) {
2495
+ modules.push({
2496
+ member: 'edit',
2497
+ args: [this]
2498
+ });
2499
+ }
2500
+ if (this.allowSelection) {
2501
+ modules.push({
2502
+ member: 'selection',
2503
+ args: [this]
2504
+ });
2505
+ }
2506
+ if (this.tooltipSettings.showTooltip) {
2507
+ modules.push({
2508
+ member: 'tooltip',
2509
+ args: [this]
2510
+ });
2511
+ }
2512
+ if (this.highlightWeekends || (this.holidays && this.holidays.length > 0)
2513
+ || (this.eventMarkers && this.eventMarkers.length > 0)) {
2514
+ modules.push({
2515
+ member: 'dayMarkers',
2516
+ args: [this]
2517
+ });
2518
+ }
2519
+ if (this.enableContextMenu) {
2520
+ modules.push({
2521
+ member: 'contextMenu',
2522
+ args: [this]
2523
+ });
2524
+ }
2525
+ if (this.showColumnMenu) {
2526
+ modules.push({
2527
+ member: 'columnMenu',
2528
+ args: [this]
2529
+ });
2530
+ }
2531
+ if (this.allowPdfExport) {
2532
+ modules.push({
2533
+ member: 'pdfExport',
2534
+ args: [this]
2535
+ });
2536
+ }
2537
+ if (this.enableVirtualization) {
2538
+ modules.push({
2539
+ member: 'virtualScroll',
2540
+ args: [this]
2541
+ });
2542
+ }
2543
+ return modules;
2544
+ }
2545
+ /**
2546
+ * Sorts a column with the given options.
2547
+ *
2548
+ * @param {string} columnName - Defines the column name to be sorted.
2549
+ * @param {SortDirection} direction - Defines the direction of sorting field.
2550
+ * @param {boolean} isMultiSort - Specifies whether the previous sorted columns are to be maintained.
2551
+ * @returns {void} .
2552
+ */
2553
+ public sortColumn(columnName: string, direction: SortDirection, isMultiSort?: boolean): void {
2554
+ if (this.sortModule && this.allowSorting) {
2555
+ this.sortModule.sortColumn(columnName, direction, isMultiSort);
2556
+ }
2557
+ }
2558
+
2559
+ /**
2560
+ * Clears all the sorted columns of the Gantt.
2561
+ *
2562
+ * @returns {void} .
2563
+ */
2564
+ public clearSorting(): void {
2565
+ this.sortModule.clearSorting();
2566
+ }
2567
+
2568
+ /**
2569
+ * To validate and render chart horizontal and vertical lines in the Gantt
2570
+ *
2571
+ * @returns {void} .
2572
+ * @hidden
2573
+ */
2574
+ public renderChartGridLines(): void {
2575
+ const className: string = 'e-chart-row-border';
2576
+ const verticalLines: HTMLElement = this.chartVerticalLineContainer;
2577
+ const chartRowsTD: NodeListOf<HTMLTableDataCellElement> =
2578
+ document.getElementById(this.element.id + 'GanttTaskTableBody').querySelectorAll('td');
2579
+ if (this.gridLines === 'Vertical') {
2580
+ if (isNullOrUndefined(verticalLines)) {
2581
+ this.renderChartVerticalLines();
2582
+ } else {
2583
+ if (verticalLines.style.display === 'none') {
2584
+ verticalLines.style.display = 'block';
2585
+ }
2586
+ }
2587
+ if (chartRowsTD[0].classList.contains(className)) {
2588
+ for (let c: number = 0; c < chartRowsTD.length; c++) {
2589
+ removeClass([chartRowsTD[c]], className);
2590
+ }
2591
+ }
2592
+ } else if (this.gridLines === 'Horizontal') {
2593
+ if (!isNullOrUndefined(verticalLines)) {
2594
+ verticalLines.style.display = 'none';
2595
+ }
2596
+ if (!chartRowsTD[0].classList.contains(className)) {
2597
+ for (let c: number = 0; c < chartRowsTD.length; c++) {
2598
+ addClass([chartRowsTD[c]], className);
2599
+ }
2600
+ }
2601
+ } else if (this.gridLines === 'Both') {
2602
+ if (isNullOrUndefined(verticalLines)) {
2603
+ this.renderChartVerticalLines();
2604
+ } else {
2605
+ if (verticalLines.style.display === 'none') {
2606
+ verticalLines.style.display = 'block';
2607
+ }
2608
+ }
2609
+ if (!chartRowsTD[0].classList.contains(className)) {
2610
+ for (let c: number = 0; c < chartRowsTD.length; c++) {
2611
+ addClass([chartRowsTD[c]], className);
2612
+ }
2613
+ }
2614
+ } else if (this.gridLines === 'None') {
2615
+ if (!isNullOrUndefined(verticalLines) && verticalLines.style.display !== 'none') {
2616
+ verticalLines.style.display = 'none';
2617
+ }
2618
+ if (chartRowsTD[0].classList.contains(className)) {
2619
+ for (let c: number = 0; c < chartRowsTD.length; c++) {
2620
+ removeClass([chartRowsTD[c]], className);
2621
+ }
2622
+ }
2623
+ }
2624
+ }
2625
+
2626
+ /**
2627
+ * To update height of the Grid lines in the Gantt chart side.
2628
+ *
2629
+ * @returns {void} .
2630
+ * @private
2631
+ */
2632
+ public updateGridLineContainerHeight(): void {
2633
+ if (this.chartVerticalLineContainer) {
2634
+ this.chartVerticalLineContainer.style.height = formatUnit(this.contentHeight);
2635
+ }
2636
+ }
2637
+
2638
+ /**
2639
+ * To get actual height of grid lines, holidays, weekend and event markers.
2640
+ *
2641
+ * @returns {number} .
2642
+ * @private
2643
+ */
2644
+ public getContentHeight(): number {
2645
+ const scrollHeight: number = this.ganttChartModule.scrollElement.offsetHeight - 16; //16 is horizontal scrollbar height
2646
+ const contentHeight: number = this.ganttChartModule.chartBodyContent.offsetHeight;
2647
+ const height: number = contentHeight < scrollHeight ? contentHeight : scrollHeight;
2648
+ return height;
2649
+ }
2650
+
2651
+ /**
2652
+ * To update height of the Grid lines in the Gantt chart side.
2653
+ *
2654
+ * @returns {void} .
2655
+ * @private
2656
+ */
2657
+ public reUpdateDimention(): void {
2658
+ let toolbarHeight: number = 0;
2659
+ this.calculateDimensions();
2660
+ if (!isNullOrUndefined(this.toolbarModule) && !isNullOrUndefined(this.toolbarModule.element)) {
2661
+ this.toolbarModule.toolbar.refresh();
2662
+ this.toolbarModule.refreshToolbarItems();
2663
+ toolbarHeight = this.toolbarModule.element.offsetHeight;
2664
+ }
2665
+ this.treeGrid.height = this.ganttHeight - toolbarHeight -
2666
+ (this.treeGrid.grid.getHeaderContent() as HTMLElement).offsetHeight;
2667
+ this.splitterModule.splitterObject.height = (this.ganttHeight - toolbarHeight).toString();
2668
+ if (!isNullOrUndefined( this.chartVerticalLineContainer)) {
2669
+ this.chartVerticalLineContainer.style.height = this.ganttHeight + 'px';
2670
+ }
2671
+ if (!isNullOrUndefined(this.dayMarkersModule)) {
2672
+ const holidayContainer: HTMLElement = getValue('nonworkingDayRender.holidayContainer', this.dayMarkersModule);
2673
+ const weekendContainer: HTMLElement = getValue('nonworkingDayRender.weekendContainer', this.dayMarkersModule);
2674
+ const eventMarkersContainer: HTMLElement = getValue('eventMarkerRender.eventMarkersContainer', this.dayMarkersModule);
2675
+ if (holidayContainer) {
2676
+ holidayContainer.style.height = this.ganttHeight + 'px';
2677
+ }
2678
+ if (weekendContainer) {
2679
+ weekendContainer.style.height = this.ganttHeight + 'px';
2680
+ }
2681
+ if (eventMarkersContainer) {
2682
+ eventMarkersContainer.style.height = this.ganttHeight + 'px';
2683
+ }
2684
+ }
2685
+ this.splitterModule.splitterObject.width = this.ganttWidth.toString();
2686
+ this.ganttChartModule.scrollObject.
2687
+ setHeight(this.ganttHeight - this.ganttChartModule.chartTimelineContainer.offsetHeight - toolbarHeight);
2688
+ }
2689
+
2690
+ /**
2691
+ * To render vertical lines in the Gantt chart side.
2692
+ *
2693
+ * @returns {void} .
2694
+ */
2695
+ private renderChartVerticalLines(): void {
2696
+ if (!this.element.contains(this.chartVerticalLineContainer)) {
2697
+ this.chartVerticalLineContainer = createElement('div', {
2698
+ id: this.element.id + 'line-container',
2699
+ styles: 'position:absolute;height:100%;z-index:1'
2700
+ });
2701
+ this.ganttChartModule.chartBodyContent.appendChild(this.chartVerticalLineContainer);
2702
+ }
2703
+ this.chartVerticalLineContainer.innerHTML = '';
2704
+ let headerTable: Element = this.element.getElementsByClassName('e-timeline-header-table-container')[1];
2705
+ if (isNullOrUndefined(headerTable)) {
2706
+ headerTable = this.element.getElementsByClassName('e-timeline-header-table-container')[0];
2707
+ }
2708
+ const thElements: HTMLCollectionOf<HTMLTableHeaderCellElement> =
2709
+ headerTable.getElementsByTagName('th') as HTMLCollectionOf<HTMLTableHeaderCellElement>;
2710
+ const thLength: number = thElements.length;
2711
+ let thWidth: string;
2712
+ let leftPos: number = 0;
2713
+ const containerDiv: HTMLElement = createElement('div');
2714
+ for (let n: number = 0; n < thLength; n++) {
2715
+ leftPos = n === 0 ? -1 : (leftPos + parseFloat(thWidth));
2716
+ thWidth = (thElements[n] as HTMLElement).style.width;
2717
+ const divElement: HTMLElement = createElement('div', {
2718
+ className: 'e-line-container-cell',
2719
+ styles: 'left:' + leftPos + 'px'
2720
+ });
2721
+ containerDiv.appendChild(divElement);
2722
+ }
2723
+ this.chartVerticalLineContainer.innerHTML = containerDiv.innerHTML;
2724
+ }
2725
+
2726
+ /**
2727
+ * Method to get default localized text of the Gantt.
2728
+ *
2729
+ * @returns {void} .
2730
+ * @hidden
2731
+ */
2732
+ public getDefaultLocale(): Object {
2733
+ const ganttLocale: Object = {
2734
+ emptyRecord: 'No records to display',
2735
+ id: 'ID',
2736
+ name: 'Name',
2737
+ startDate: 'Start Date',
2738
+ endDate: 'End Date',
2739
+ duration: 'Duration',
2740
+ progress: 'Progress',
2741
+ dependency: 'Dependency',
2742
+ notes: 'Notes',
2743
+ baselineStartDate: 'Baseline Start Date',
2744
+ baselineEndDate: 'Baseline End Date',
2745
+ taskMode: 'Task Mode',
2746
+ changeScheduleMode: 'Change Schedule Mode',
2747
+ subTasksStartDate: 'SubTasks Start Date',
2748
+ subTasksEndDate: 'SubTasks End Date',
2749
+ scheduleStartDate: 'Schedule Start Date',
2750
+ scheduleEndDate: 'Schedule End Date',
2751
+ auto: 'Auto',
2752
+ manual: 'Manual',
2753
+ type: 'Type',
2754
+ offset: 'Offset',
2755
+ resourceName: 'Resources',
2756
+ resourceID: 'Resource ID',
2757
+ day: 'day',
2758
+ hour: 'hour',
2759
+ minute: 'minute',
2760
+ days: 'days',
2761
+ hours: 'hours',
2762
+ minutes: 'minutes',
2763
+ generalTab: 'General',
2764
+ customTab: 'Custom Columns',
2765
+ writeNotes: 'Write Notes',
2766
+ addDialogTitle: 'New Task',
2767
+ editDialogTitle: 'Task Information',
2768
+ add: 'Add',
2769
+ edit: 'Edit',
2770
+ update: 'Update',
2771
+ delete: 'Delete',
2772
+ cancel: 'Cancel',
2773
+ search: 'Search',
2774
+ task: ' task',
2775
+ tasks: ' tasks',
2776
+ zoomIn: 'Zoom in',
2777
+ zoomOut: 'Zoom out',
2778
+ zoomToFit: 'Zoom to fit',
2779
+ excelExport: 'Excel export',
2780
+ csvExport: 'CSV export',
2781
+ pdfExport: 'Pdf export',
2782
+ expandAll: 'Expand all',
2783
+ collapseAll: 'Collapse all',
2784
+ nextTimeSpan: 'Next timespan',
2785
+ prevTimeSpan: 'Previous timespan',
2786
+ saveButton: 'Save',
2787
+ taskBeforePredecessorFS: 'You moved "{0}" to start before "{1}" finishes and the two tasks are linked.'
2788
+ + 'As the result, the links cannot be honored. Select one action below to perform',
2789
+ taskAfterPredecessorFS: 'You moved "{0}" away from "{1}" and the two tasks are linked.'
2790
+ + 'As the result, the links cannot be honored. Select one action below to perform',
2791
+ taskBeforePredecessorSS: 'You moved "{0}" to start before "{1}" starts and the two tasks are linked.'
2792
+ + 'As the result, the links cannot be honored. Select one action below to perform',
2793
+ taskAfterPredecessorSS: 'You moved "{0}" to start after "{1}" starts and the two tasks are linked.'
2794
+ + 'As the result, the links cannot be honored. Select one action below to perform',
2795
+ taskBeforePredecessorFF: 'You moved "{0}" to finish before "{1}" finishes and the two tasks are linked.'
2796
+ + 'As the result, the links cannot be honored. Select one action below to perform',
2797
+ taskAfterPredecessorFF: 'You moved "{0}" to finish after "{1}" finishes and the two tasks are linked.'
2798
+ + 'As the result, the links cannot be honored. Select one action below to perform',
2799
+ taskBeforePredecessorSF: 'You moved "{0}" away from "{1}" to starts and the two tasks are linked.'
2800
+ + 'As the result, the links cannot be honored. Select one action below to perform',
2801
+ taskAfterPredecessorSF: 'You moved "{0}" to finish after "{1}" starts and the two tasks are linked.'
2802
+ + 'As the result, the links cannot be honored. Select one action below to perform',
2803
+ okText: 'Ok',
2804
+ confirmDelete: 'Are you sure you want to Delete Record?',
2805
+ from: 'From',
2806
+ to: 'To',
2807
+ taskLink: 'Task Link',
2808
+ lag: 'Lag',
2809
+ start: 'Start',
2810
+ finish: 'Finish',
2811
+ enterValue: 'Enter the value',
2812
+ taskInformation: 'Task Information',
2813
+ deleteTask: 'Delete Task',
2814
+ deleteDependency: 'Delete Dependency',
2815
+ convert: 'Convert',
2816
+ save: 'Save',
2817
+ above: 'Above',
2818
+ below: 'Below',
2819
+ child: 'Child',
2820
+ milestone: 'Milestone',
2821
+ toTask: 'To Task',
2822
+ toMilestone: 'To Milestone',
2823
+ eventMarkers: 'Event markers',
2824
+ leftTaskLabel: 'Left task label',
2825
+ rightTaskLabel: 'Right task label',
2826
+ timelineCell: 'Timeline cell',
2827
+ confirmPredecessorDelete: 'Are you sure you want to remove dependency link?',
2828
+ unit: 'Unit',
2829
+ work: 'Work',
2830
+ taskType: 'Task Type',
2831
+ unassignedTask: 'Unassigned Task',
2832
+ group: 'Group',
2833
+ indent: 'Indent',
2834
+ outdent: 'Outdent',
2835
+ segments: 'Segments',
2836
+ splitTask: 'Split Task',
2837
+ mergeTask: 'Merge Task',
2838
+ left: 'Left',
2839
+ right: 'Right'
2840
+ };
2841
+ return ganttLocale;
2842
+ }
2843
+ /**
2844
+ * To remove sorted records of particular column.
2845
+ *
2846
+ * @param {string} columnName - Defines the sorted column name.
2847
+ * @returns {void} .
2848
+ */
2849
+ public removeSortColumn(columnName: string): void {
2850
+ this.sortModule.removeSortColumn(columnName);
2851
+ }
2852
+ /**
2853
+ *
2854
+ * @param {object} args .
2855
+ * @returns {void} .
2856
+ * @private
2857
+ */
2858
+ public actionBeginTask(args: object): boolean | void {
2859
+ this.trigger('actionBegin', args);
2860
+ }
2861
+
2862
+ /**
2863
+ * To move horizontal scroll bar of Gantt to specific date.
2864
+ *
2865
+ * @param {string} date - Defines the task date of data.
2866
+ * @returns {void} .
2867
+ */
2868
+ public scrollToDate(date: string): void {
2869
+ const tempDate: Date = this.dateValidationModule.getDateFromFormat(date);
2870
+ const left: number = this.dataOperation.getTaskLeft(tempDate, false);
2871
+ this.ganttChartModule.updateScrollLeft(left);
2872
+
2873
+ }
2874
+ /**
2875
+ * To move horizontal scroll bar of Gantt to specific task id.
2876
+ *
2877
+ * @param {string} taskId - Defines the task id of data.
2878
+ * @returns {void} .
2879
+ */
2880
+ public scrollToTask(taskId: string): void {
2881
+ if (this.ids.indexOf(taskId) !== -1) {
2882
+ const left: number = this.flatData[this.ids.indexOf(taskId)].ganttProperties.left;
2883
+ this.ganttChartModule.updateScrollLeft(left);
2884
+ }
2885
+ }
2886
+ /**
2887
+ * To set scroll left and top in chart side.
2888
+ *
2889
+ * @param {number} left - Defines the scroll left value of chart side.
2890
+ * @param {number} top - Defines the scroll top value of chart side.
2891
+ * @returns {void} .
2892
+ */
2893
+ public updateChartScrollOffset(left: number, top: number): void {
2894
+ if (!isNullOrUndefined(left)) {
2895
+ left = this.ganttChartModule.scrollElement.scrollWidth <= left ?
2896
+ this.ganttChartModule.scrollElement.scrollWidth : left;
2897
+ this.ganttChartModule.scrollObject.setScrollLeft(left);
2898
+ }
2899
+ if (!isNullOrUndefined(top)) {
2900
+ top = this.ganttChartModule.scrollElement.scrollHeight <= top ? this.ganttChartModule.scrollElement.scrollHeight : top;
2901
+ this.ganttChartModule.scrollObject.setScrollTop(top);
2902
+ }
2903
+ }
2904
+ /**
2905
+ * Get parent task by clone parent item.
2906
+ *
2907
+ * @param {IParent} cloneParent - Defines the clone parent item.
2908
+ * @returns {IGanttData} .
2909
+ * @hidden
2910
+ */
2911
+ public getParentTask(cloneParent: IParent): IGanttData {
2912
+ if (!isNullOrUndefined(cloneParent)) {
2913
+ const parent: IGanttData[] = this.flatData.filter((val: IGanttData) => {
2914
+ return cloneParent.uniqueID === val.uniqueID;
2915
+ });
2916
+ if (parent.length > 0) {
2917
+ return parent[0];
2918
+ } else {
2919
+ return null;
2920
+ }
2921
+ } else {
2922
+ return null;
2923
+ }
2924
+ }
2925
+
2926
+ /**
2927
+ * Get parent task by clone parent item.
2928
+ *
2929
+ * @param {IGanttData} ganttRecord .
2930
+ * @param {number} level .
2931
+ * @returns {IGanttData} .
2932
+ * @hidden
2933
+ */
2934
+ public getRootParent(ganttRecord: IGanttData, level: number): IGanttData {
2935
+ if (ganttRecord.level === level) {
2936
+ return ganttRecord;
2937
+ }
2938
+ return this.getRootParent(this.getParentTask(ganttRecord.parentItem), level);
2939
+ }
2940
+ /**
2941
+ * Filters TreeGrid row by column name with the given options.
2942
+ *
2943
+ * @param {string} fieldName - Defines the field name of the column.
2944
+ * @param {string} filterOperator - Defines the operator to filter records.
2945
+ * @param {string | number | Date | boolean | number[] | string[] | Date[] | boolean[]} filterValue - Defines the value
2946
+ * used to filter records.
2947
+ * @param {string} predicate - Defines the relationship between one filter query and another by using AND or OR predicate.
2948
+ * @param {boolean} matchCase - If match case is set to true, TreeGrid filters the records with exact match.if false, it filters case
2949
+ * insensitive records (uppercase and lowercase letters treated the same).
2950
+ * @param {boolean} ignoreAccent - If ignoreAccent set to true,
2951
+ * then filter ignores the diacritic characters or accents while filtering.
2952
+ * @returns {void} .
2953
+ */
2954
+ public filterByColumn(
2955
+ fieldName: string, filterOperator: string, filterValue: string | number | Date | boolean | number[] | string[] | Date[] | boolean[],
2956
+ predicate?: string, matchCase?: boolean, ignoreAccent?: boolean): void {
2957
+ this.treeGrid.filterByColumn(
2958
+ fieldName, filterOperator, filterValue, predicate, matchCase, ignoreAccent
2959
+ );
2960
+ }
2961
+
2962
+ /**
2963
+ * Export Gantt data to Excel file(.xlsx).
2964
+ *
2965
+ * @param {ExcelExportProperties} excelExportProperties - Defines the export properties of the Gantt.
2966
+ * @param {boolean} isMultipleExport - Define to enable multiple export.
2967
+ * @param {workbook} workbook - Defines the Workbook if multiple export is enabled.
2968
+ * @param {boolean} isBlob - If 'isBlob' set to true, then it will be returned as blob data.
2969
+ * @returns {Promise<any>} .
2970
+ */
2971
+ public excelExport(
2972
+ excelExportProperties?: ExcelExportProperties, isMultipleExport?: boolean,
2973
+ /* eslint-disable-next-line */
2974
+ workbook?: any, isBlob?: boolean): Promise<any> {
2975
+ return this.excelExportModule ? this.treeGrid.excelExport(excelExportProperties, isMultipleExport, workbook, isBlob) : null;
2976
+ }
2977
+
2978
+ /**
2979
+ * Export Gantt data to CSV file.
2980
+ *
2981
+ * @param {ExcelExportProperties} excelExportProperties - Defines the export properties of the Gantt.
2982
+ * @param {boolean} isMultipleExport - Define to enable multiple export.
2983
+ * @param {workbook} workbook - Defines the Workbook if multiple export is enabled.
2984
+ * @param {boolean} isBlob - If 'isBlob' set to true, then it will be returned as blob data.
2985
+ * @returns {Promise<any>} .
2986
+ */
2987
+ public csvExport(
2988
+ excelExportProperties?: ExcelExportProperties,
2989
+ /* eslint-disable-next-line */
2990
+ isMultipleExport?: boolean, workbook?: any, isBlob?: boolean): Promise<any> {
2991
+ return this.excelExportModule ? this.treeGrid.csvExport(excelExportProperties, isMultipleExport, workbook, isBlob) : null;
2992
+ }
2993
+ /**
2994
+ * Export Gantt data to PDF document.
2995
+ *
2996
+ * @param {PdfExportProperties} pdfExportProperties - Defines the export properties of the Gantt.
2997
+ * @param {isMultipleExport} isMultipleExport - Define to enable multiple export.
2998
+ * @param {pdfDoc} pdfDoc - Defined the Pdf Document if multiple export is enabled.
2999
+ * @returns {Promise<any>} .
3000
+ */
3001
+ public pdfExport(pdfExportProperties?: PdfExportProperties, isMultipleExport?: boolean, pdfDoc?: Object): Promise<Object> {
3002
+ return this.pdfExportModule ? this.pdfExportModule.export(pdfExportProperties, isMultipleExport, pdfDoc)
3003
+ : null;
3004
+ }
3005
+ /**
3006
+ * Clears the filtered columns in Gantt.
3007
+ *
3008
+ * Can also be used to clear filtering of a specific column in Gantt.
3009
+ *
3010
+ * @param {string[]} fields - Defines the specific column to remove filter.
3011
+ * @returns {void} .
3012
+ */
3013
+ public clearFiltering(fields?: string[]): void {
3014
+ this.treeGrid.grid.clearFiltering(fields);
3015
+ }
3016
+ /**
3017
+ * Removes filtered column by field name.
3018
+ *
3019
+ * @param {string} field - Defines column field name to remove filter.
3020
+ * @returns {void} .
3021
+ * @hidden
3022
+ */
3023
+ public removeFilteredColsByField(field: string): void {
3024
+ this.treeGrid.removeFilteredColsByField(field, false);
3025
+ }
3026
+ /**
3027
+ * Method to set holidays and non working days in date time and date picker controls
3028
+ *
3029
+ * @param {RenderDayCellEventArgs} args .
3030
+ * @returns {void} .
3031
+ * @private
3032
+ */
3033
+ public renderWorkingDayCell(args: RenderDayCellEventArgs): void {
3034
+ const includeWeekend: boolean = this.taskMode !== 'Auto' ? true : this.includeWeekend ? true : false;
3035
+ const nonWorkingDays: number[] = !includeWeekend ? this.nonWorkingDayIndex : [];
3036
+ const holidays: number[] = this.totalHolidayDates;
3037
+ if (nonWorkingDays.length > 0 && nonWorkingDays.indexOf(args.date.getDay()) !== -1) {
3038
+ args.isDisabled = true;
3039
+ } else if (holidays.length > 0) {
3040
+ const tempDate: Date = new Date(args.date.getTime());
3041
+ tempDate.setHours(0, 0, 0);
3042
+ if (holidays.indexOf(tempDate.getTime()) !== -1) {
3043
+ args.isDisabled = true;
3044
+ }
3045
+ }
3046
+ }
3047
+ /**
3048
+ * To update timeline at start point with one unit.
3049
+ *
3050
+ * @param {string} mode .
3051
+ * @returns {void} .
3052
+ * @public
3053
+ */
3054
+ public previousTimeSpan(mode?: string): void {
3055
+ this.timelineModule.performTimeSpanAction(
3056
+ 'prevTimeSpan', 'publicMethod',
3057
+ new Date(this.timelineModule.timelineStartDate.getTime()), new Date(this.timelineModule.timelineEndDate.getTime()), mode);
3058
+ }
3059
+ /**
3060
+ * To update timeline at end point with one unit.
3061
+ *
3062
+ * @param {string} mode .
3063
+ * @returns {void} .
3064
+ * @public
3065
+ */
3066
+ public nextTimeSpan(mode?: string): void {
3067
+ this.timelineModule.performTimeSpanAction(
3068
+ 'nextTimeSpan', 'publicMethod',
3069
+ new Date(this.timelineModule.timelineStartDate.getTime()), new Date(this.timelineModule.timelineEndDate.getTime()), mode);
3070
+ }
3071
+
3072
+ /**
3073
+ * To validate project start date and end date.
3074
+ *
3075
+ * @param {Date} startDate - Defines start date of project.
3076
+ * @param {Date} endDate - Defines end date of project.
3077
+ * @param {boolean} isTimelineRoundOff - Defines project start date and end date need to be round off or not.
3078
+ * @param {string} isFrom .
3079
+ * @returns {void} .
3080
+ * @public
3081
+ */
3082
+ public updateProjectDates(startDate: Date, endDate: Date, isTimelineRoundOff: boolean, isFrom?: string): void {
3083
+ this.timelineModule.totalTimelineWidth = 0;
3084
+ this.cloneProjectStartDate = startDate;
3085
+ this.cloneProjectEndDate = endDate;
3086
+ this.isTimelineRoundOff = isTimelineRoundOff;
3087
+ this.timelineModule.refreshTimelineByTimeSpan();
3088
+ this.dataOperation.reUpdateGanttDataPosition();
3089
+ this.timelineModule.updateChartByNewTimeline();
3090
+ this.ganttChartModule.chartBodyContent.style.width = formatUnit(this.timelineModule.totalTimelineWidth);
3091
+ this.ganttChartModule.updateLastRowBottomWidth();
3092
+ if (this.gridLines === 'Vertical' || this.gridLines === 'Both') {
3093
+ this.renderChartVerticalLines();
3094
+ }
3095
+ if (this.taskFields.dependency) {
3096
+ this.ganttChartModule.reRenderConnectorLines();
3097
+ }
3098
+ if (isFrom !== 'beforeAdd') {
3099
+ this.notify('selectRowByIndex', {});
3100
+ }
3101
+ }
3102
+
3103
+ /**
3104
+ * Split the taskbar into segment by the given date
3105
+ *
3106
+ * @param {string} taskId - Defines the id of a task to be split.
3107
+ * @param {string} splitDate - Defines in which date the taskbar must be split up.
3108
+ * @returns {void} .
3109
+ * @public
3110
+ */
3111
+
3112
+ public splitTask(taskId: number | string, splitDate: Date | Date[]): void {
3113
+ this.isEdit = true;
3114
+ this.chartRowsModule.splitTask(taskId, splitDate);
3115
+ }
3116
+
3117
+ /**
3118
+ * merge the split taskbar with the given segment indexes.
3119
+ *
3120
+ * @param {string} taskId - Defines the id of a task to be split.
3121
+ * @param {string} segmentIndexes - Defines the object array of indexes which must be merged.
3122
+ * @returns {void} .
3123
+ * @public
3124
+ */
3125
+ public mergeTask(taskId: number | string, segmentIndexes: { firstSegmentIndex: number, secondSegmentIndex: number }[]): void {
3126
+ this.chartRowsModule.mergeTask(taskId, segmentIndexes);
3127
+ }
3128
+
3129
+ /**
3130
+ * Changes the TreeGrid column positions by field names.
3131
+ *
3132
+ * @param {string} fromFName - Defines origin field name.
3133
+ * @param {string} toFName - Defines destination field name.
3134
+ * @returns {void} .
3135
+ * @public
3136
+ */
3137
+ public reorderColumns(fromFName: string | string[], toFName: string): void {
3138
+ this.treeGrid.reorderColumns(fromFName, toFName);
3139
+ }
3140
+ /**
3141
+ * Method to clear edited collections in gantt set edit flag value
3142
+ *
3143
+ * @param {boolean} isStart .
3144
+ * @returns {void} .
3145
+ * @private
3146
+ */
3147
+ public initiateEditAction(isStart: boolean): void {
3148
+ this.isOnEdit = isStart;
3149
+ this.previousRecords = {};
3150
+ this.editedRecords = [];
3151
+ }
3152
+ /**
3153
+ *
3154
+ * @param {string} field Method to update value in Gantt record and make clone record for this
3155
+ * @param {IGanttData | ITaskData} record .
3156
+ * @param {boolean} isTaskData .
3157
+ * @returns {void} .
3158
+ * @private
3159
+ */
3160
+ /* eslint-disable-next-line */
3161
+ public setRecordValue(field: string, value: any, record: IGanttData | ITaskData, isTaskData?: boolean): void {
3162
+ if (this.isOnEdit || this.isOnDelete) {
3163
+ this.makeCloneData(field, record, isTaskData);
3164
+ const id: string = isTaskData ? (record as ITaskData).rowUniqueID : (record as IGanttData).ganttProperties.rowUniqueID;
3165
+ const task: IGanttData = this.getRecordByID(id);
3166
+ if (task && this.editedRecords.indexOf(task) === -1) {
3167
+ this.editedRecords.push(task);
3168
+ if (this.enableImmutableMode) {
3169
+ this.modifiedRecords.push(task);
3170
+ }
3171
+ }
3172
+ }
3173
+ value = isUndefined(value) ? null : value;
3174
+ setValue(field, value, record);
3175
+ }
3176
+ private makeCloneData(field: string, record: IGanttData | ITaskData, isTaskData?: boolean): void {
3177
+ let cloneData: IGanttData;
3178
+ /* eslint-disable-next-line */
3179
+ const value: any = getValue(field, record);
3180
+ /* eslint-disable-next-line */
3181
+ let prevValue: any;
3182
+ /* eslint-disable-next-line */
3183
+ let clonedValue: any;
3184
+ if (isTaskData) {
3185
+ field = 'ganttProperties.' + field;
3186
+ }
3187
+ if (isNullOrUndefined(this.previousRecords[record.uniqueID])) {
3188
+ const tempData: IGanttData = {} as IGanttData;
3189
+ this.previousRecords[record.uniqueID] = tempData;
3190
+ }
3191
+ /* eslint-disable-next-line */
3192
+ cloneData = this.previousRecords[record.uniqueID];
3193
+ /* eslint-disable-next-line */
3194
+ prevValue = getValue(field, cloneData);
3195
+ if (isUndefined(prevValue)) {
3196
+ if (value instanceof Date) {
3197
+ clonedValue = new Date(value.getTime());
3198
+ } else if (isObjectArray(value)) {
3199
+ clonedValue = extend([], value, [], true);
3200
+ } else if (isObject(value)) {
3201
+ clonedValue = extend({}, {}, value, true);
3202
+ } else {
3203
+ clonedValue = value;
3204
+ }
3205
+ if (!isUndefined(clonedValue)) {
3206
+ setValue(field, clonedValue, cloneData);
3207
+ } else {
3208
+ setValue(field, null, cloneData);
3209
+ }
3210
+ }
3211
+ }
3212
+ private closeGanttActions(): void {
3213
+ if (this.editModule) {
3214
+ if (this.editModule.cellEditModule && this.editModule.cellEditModule.isCellEdit) {
3215
+ this.treeGrid.closeEdit();
3216
+ this.editModule.cellEditModule.isCellEdit = false;
3217
+ if (!isNullOrUndefined(this.toolbarModule)) {
3218
+ this.toolbarModule.refreshToolbarItems();
3219
+ }
3220
+ } else if (this.editModule.dialogModule && this.editModule.dialogModule.dialogObj &&
3221
+ this.editModule.dialogModule.dialogObj.visible) {
3222
+ this.editModule.dialogModule.dialogObj.hide();
3223
+ this.editModule.dialogModule.dialogClose();
3224
+ }
3225
+ }
3226
+ }
3227
+ /**
3228
+ * Method to get task by uniqueId value.
3229
+ *
3230
+ * @param {string} id - Defines the task id.
3231
+ * @returns {IGanttData} .
3232
+ * @isGenericType true
3233
+ */
3234
+ public getTaskByUniqueID(id: string): IGanttData {
3235
+ const value: IGanttData[] = this.flatData.filter((val: IGanttData) => {
3236
+ return val.uniqueID === id;
3237
+ });
3238
+ if (value.length > 0) {
3239
+ return value[0];
3240
+ } else {
3241
+ return null;
3242
+ }
3243
+ }
3244
+ /**
3245
+ * Method to get record by id value.
3246
+ *
3247
+ * @param {string} id - Defines the id of record.
3248
+ * @returns {IGanttData} .
3249
+ * @isGenericType true
3250
+ */
3251
+ public getRecordByID(id: string): IGanttData {
3252
+ if (isNullOrUndefined(id)) {
3253
+ return null;
3254
+ }
3255
+ return this.flatData[this.ids.indexOf(id.toString())];
3256
+ }
3257
+ /**
3258
+ * Method to set splitter position.
3259
+ *
3260
+ * @param {string|number} value - Define value to splitter settings property.
3261
+ * @param {string} type - Defines name of internal splitter settings property.
3262
+ * @returns {void} .
3263
+ */
3264
+ public setSplitterPosition(value: string | number, type: string): void {
3265
+ const tempSplitterSettings: Object = {};
3266
+ tempSplitterSettings[type] = value;
3267
+ const splitterPosition: string = this.splitterModule.calculateSplitterPosition(
3268
+ tempSplitterSettings, true);
3269
+ const pane1: HTMLElement = this.splitterModule.splitterObject.element.querySelectorAll('.e-pane')[0] as HTMLElement;
3270
+ const pane2: HTMLElement = this.splitterModule.splitterObject.element.querySelectorAll('.e-pane')[1] as HTMLElement;
3271
+ this.splitterModule.splitterPreviousPositionGrid = pane1.scrollWidth + 1 + 'px';
3272
+ this.splitterModule.splitterPreviousPositionChart = pane2.scrollWidth + 1 + 'px';
3273
+ this.splitterModule.splitterObject.paneSettings[0].size = splitterPosition;
3274
+ this.splitterModule.triggerCustomResizedEvent();
3275
+ }
3276
+ /**
3277
+ * Expand the records by index value.
3278
+ *
3279
+ * @param {number[] | number} index - Defines the index of rows to be expand.
3280
+ * @returns {void} .
3281
+ * @public
3282
+ */
3283
+ public expandByIndex(index: number[] | number): void {
3284
+ if (typeof index === 'number') {
3285
+ const args: object = this.contructExpandCollapseArgs(null, index);
3286
+ this.ganttChartModule.isExpandCollapseFromChart = true;
3287
+ this.ganttChartModule.expandGanttRow(args);
3288
+ } else {
3289
+ for (let i: number = 0; i < index.length; i++) {
3290
+ if (typeof index[i] === 'number') {
3291
+ const ind: number = index[i];
3292
+ const args: object = this.contructExpandCollapseArgs(null, ind);
3293
+ this.ganttChartModule.isExpandCollapseFromChart = true;
3294
+ this.ganttChartModule.expandGanttRow(args);
3295
+ }
3296
+ }
3297
+ }
3298
+ }
3299
+ /**
3300
+ * Expand the record by task id.
3301
+ *
3302
+ * @param {number} id - Defines the id of task.
3303
+ * @returns {void} .
3304
+ * @public
3305
+ */
3306
+ public expandByID(id: number): void {
3307
+ const args: object = this.contructExpandCollapseArgs(id);
3308
+ this.ganttChartModule.isExpandCollapseFromChart = true;
3309
+ this.ganttChartModule.expandGanttRow(args);
3310
+ }
3311
+ /**
3312
+ * Collapse the record by index value.
3313
+ *
3314
+ * @param {number} index - Defines the index of row.
3315
+ * @returns {void} .
3316
+ * @public
3317
+ */
3318
+ public collapseByIndex(index: number): void {
3319
+ const args: object = this.contructExpandCollapseArgs(null, index);
3320
+ this.ganttChartModule.isExpandCollapseFromChart = true;
3321
+ this.ganttChartModule.collapseGanttRow(args);
3322
+ }
3323
+ /**
3324
+ * Collapse the record by id value.
3325
+ *
3326
+ * @param {number} id - Defines the id of task.
3327
+ * @returns {void} .
3328
+ * @public
3329
+ */
3330
+ public collapseByID(id: number): void {
3331
+ const args: object = this.contructExpandCollapseArgs(id);
3332
+ this.ganttChartModule.isExpandCollapseFromChart = true;
3333
+ this.ganttChartModule.collapseGanttRow(args);
3334
+ }
3335
+
3336
+ /**
3337
+ * Method to add record.
3338
+ *
3339
+ * @param {Object[] | IGanttData | Object} data - Defines record to add.
3340
+ * @param {RowPosition} rowPosition - Defines the position of row.
3341
+ * @param {number} rowIndex - Defines the row index.
3342
+ * @returns {void} .
3343
+ * @public
3344
+ */
3345
+ public addRecord(data?: Object[] | IGanttData | Object, rowPosition?: RowPosition, rowIndex?: number): void {
3346
+ if (this.editModule && this.editSettings.allowAdding) {
3347
+ if (this.viewType === 'ResourceView') {
3348
+ this.editModule.addRowPosition = rowPosition;
3349
+ this.editModule.addRowIndex = rowIndex;
3350
+ const resources: Object[] = data[this.taskFields.resourceInfo];
3351
+ let id: string;
3352
+ let parentTask: IGanttData;
3353
+ if (!isNullOrUndefined(resources) && resources.length) {
3354
+ for (let i: number = 0; i < resources.length; i++) {
3355
+ id = (typeof resources[i] === 'object') ? resources[i][this.resourceFields.id] :
3356
+ resources[0];
3357
+ parentTask = this.flatData[this.getTaskIds().indexOf('R' + id)];
3358
+ if (parentTask) {
3359
+ break;
3360
+ }
3361
+ }
3362
+ if (parentTask && parentTask.childRecords.length || parentTask.level === 0) {
3363
+ const dropChildRecord: IGanttData = parentTask.childRecords[rowIndex];
3364
+ if (dropChildRecord) {
3365
+ const position: RowPosition = rowPosition === 'Above' || rowPosition === 'Below' ? rowPosition :
3366
+ 'Child';
3367
+ if (position === 'Child') {
3368
+ this.editModule.addRecord(data, position, this.getTaskIds().indexOf('R' + id));
3369
+ } else {
3370
+ this.editModule.addRecord(data, position, this.flatData.indexOf(dropChildRecord));
3371
+ }
3372
+ } else {
3373
+ this.editModule.addRecord(data, 'Child', this.getTaskIds().indexOf('R' + id));
3374
+ }
3375
+ } else {
3376
+ this.editModule.addRecord(data, 'Bottom');
3377
+ }
3378
+ } else {
3379
+ this.editModule.addRecord(data, 'Bottom');
3380
+ }
3381
+ this.editModule.addRowPosition = null;
3382
+ this.editModule.addRowIndex = null;
3383
+ } else {
3384
+ this.editModule.addRecord(data, rowPosition, rowIndex);
3385
+ }
3386
+ }
3387
+ }
3388
+
3389
+ /**
3390
+ * Method to update record by ID.
3391
+ *
3392
+ * @param {Object} data - Defines the data to modify.
3393
+ * @returns {void} .
3394
+ * @public
3395
+ */
3396
+ public updateRecordByID(data: Object): void {
3397
+ if (this.editModule && this.editSettings.allowEditing) {
3398
+ this.editModule.updateRecordByID(data);
3399
+ }
3400
+ }
3401
+ /**
3402
+ * To update existing taskId with new unique Id.
3403
+ *
3404
+ * @param {number | string} currentId .
3405
+ * @param {number | string} newId .
3406
+ * @returns {void} .
3407
+ */
3408
+ public updateTaskId(currentId: number | string, newId: number | string): void {
3409
+ if (this.editModule && this.editSettings.allowEditing) {
3410
+ this.editModule.updateTaskId(currentId, newId);
3411
+ }
3412
+ }
3413
+ /**
3414
+ * Public method to expand particular level of rows.
3415
+ *
3416
+ * @returns {void} .
3417
+ * @param {number} level .
3418
+ * @private
3419
+ */
3420
+ public expandAtLevel(level: number): void {
3421
+ if(this.enableVirtualization) {
3422
+ this.isExpandCollapseLevelMethod = true;
3423
+ }
3424
+ this.ganttChartModule.expandAtLevel(level);
3425
+ }
3426
+ /**
3427
+ * To indent the level of selected task to the hierarchical Gantt task.
3428
+ *
3429
+ * @returns {void} .
3430
+ * @public
3431
+ */
3432
+ public indent(): void {
3433
+ if (this.editModule && this.editSettings.allowEditing) {
3434
+ this.editModule.indent();
3435
+ }
3436
+ }
3437
+ /**
3438
+ * To outdent the level of selected task from the hierarchical Gantt task.
3439
+ *
3440
+ * @returns {void} .
3441
+ * @public
3442
+ */
3443
+ public outdent(): void {
3444
+ if (this.editModule && this.editSettings.allowEditing) {
3445
+ this.editModule.outdent();
3446
+ }
3447
+ }
3448
+ /**
3449
+ * To perform Zoom in action on Gantt timeline.
3450
+ *
3451
+ * @returns {void} .
3452
+ * @public
3453
+ */
3454
+ public zoomIn(): void {
3455
+ this.timelineModule.processZooming(true);
3456
+ }
3457
+ /**
3458
+ * To perform zoom out action on Gantt timeline.
3459
+ *
3460
+ * @returns {void} .
3461
+ * @public
3462
+ */
3463
+ public zoomOut(): void {
3464
+ this.timelineModule.processZooming(false);
3465
+ }
3466
+ /**
3467
+ * To show all project task in available chart width
3468
+ *
3469
+ * @returns {void} .
3470
+ * @public
3471
+ */
3472
+ public fitToProject(): void {
3473
+ this.timelineModule.processZoomToFit();
3474
+ this.ganttChartModule.updateScrollLeft(0);
3475
+ }
3476
+ /**
3477
+ * Reorder the rows based on given indexes and position
3478
+ *
3479
+ * @param {number[]} fromIndexes .
3480
+ * @param {number} toIndex .
3481
+ * @param {string} position .
3482
+ * @returns {void} .
3483
+ */
3484
+ public reorderRows(fromIndexes: number[], toIndex: number, position: string): void {
3485
+ this.rowDragAndDropModule.reorderRows(fromIndexes, toIndex, position);
3486
+ }
3487
+ /**
3488
+ * Method to update record by Index.
3489
+ *
3490
+ * @param {number} index - Defines the index of data to modify.
3491
+ * @param {object} data - Defines the data to modify.
3492
+ * @returns {void} .
3493
+ * @public
3494
+ */
3495
+ public updateRecordByIndex(index: number, data: Object): void {
3496
+ if (this.editModule && this.editSettings.allowEditing) {
3497
+ const tasks: TaskFieldsModel = this.taskFields;
3498
+ const record: IGanttData = this.updatedRecords.length > 0 ?
3499
+ !isNullOrUndefined(this.updatedRecords[index]) ? this.updatedRecords[index] : null : null;
3500
+ if (!isNullOrUndefined(record)) {
3501
+ data[tasks.id] = record[tasks.id];
3502
+ this.editModule.updateRecordByID(data);
3503
+ }
3504
+ }
3505
+ }
3506
+
3507
+ /**
3508
+ * To add dependency for Task.
3509
+ *
3510
+ * @param {number} id - Defines the ID of data to modify.
3511
+ * @param {string} predecessorString - Defines the predecessor string to add.
3512
+ * @returns {void} .
3513
+ * @public
3514
+ */
3515
+ public addPredecessor(id: number, predecessorString: string): void {
3516
+ const ganttRecord: IGanttData = this.getRecordByID(id.toString());
3517
+ if (this.editModule && !isNullOrUndefined(ganttRecord) && this.editSettings.allowTaskbarEditing) {
3518
+ this.connectorLineEditModule.addPredecessor(ganttRecord, predecessorString);
3519
+ }
3520
+ }
3521
+ /**
3522
+ * To remove dependency from task.
3523
+ *
3524
+ * @param {number} id - Defines the ID of task to modify.
3525
+ * @returns {void} .
3526
+ * @public
3527
+ */
3528
+ public removePredecessor(id: number): void {
3529
+ const ganttRecord: IGanttData = this.getRecordByID(id.toString());
3530
+ if (this.editModule && !isNullOrUndefined(ganttRecord) && this.editSettings.allowTaskbarEditing) {
3531
+ this.connectorLineEditModule.removePredecessor(ganttRecord);
3532
+ }
3533
+ }
3534
+ /**
3535
+ * To modify current dependency values of Task by task id.
3536
+ *
3537
+ * @param {number} id - Defines the ID of data to modify.
3538
+ * @param {string} predecessorString - Defines the predecessor string to update.
3539
+ * @returns {void} .
3540
+ * @public
3541
+ */
3542
+ public updatePredecessor(id: number, predecessorString: string): void {
3543
+ const ganttRecord: IGanttData = this.getRecordByID(id.toString());
3544
+ if (this.editModule && !isNullOrUndefined(ganttRecord) && this.editSettings.allowTaskbarEditing) {
3545
+ this.connectorLineEditModule.updatePredecessor(ganttRecord, predecessorString);
3546
+ }
3547
+ }
3548
+
3549
+ /**
3550
+ * Method to open Add dialog.
3551
+ *
3552
+ * @returns {void} .
3553
+ * @public
3554
+ */
3555
+ public openAddDialog(): void {
3556
+ if (this.editModule && this.editModule.dialogModule && this.editSettings.allowAdding) {
3557
+ this.editModule.dialogModule.openAddDialog();
3558
+ }
3559
+ }
3560
+
3561
+ /**
3562
+ * Method to open Edit dialog.
3563
+ *
3564
+ * @param {number } taskId - Defines the id of task.
3565
+ * @returns {void} .
3566
+ * @public
3567
+ */
3568
+ public openEditDialog(taskId?: number): void {
3569
+ if (this.editModule && this.editModule.dialogModule && this.editSettings.allowEditing) {
3570
+ this.editModule.dialogModule.openEditDialog(taskId);
3571
+ }
3572
+ }
3573
+
3574
+ /**
3575
+ * Changes the TreeGrid column positions by field names.
3576
+ *
3577
+ * @param {string | number} id .
3578
+ * @param {number} index .
3579
+ * @returns {void} .
3580
+ * @private
3581
+ */
3582
+ private contructExpandCollapseArgs(id: string | number, index?: number): object {
3583
+ let chartRow: Element;
3584
+ let record: IGanttData;
3585
+ let rowIndex: number;
3586
+ if (isNullOrUndefined(index)) {
3587
+ record = this.getRecordByID(id.toString());
3588
+ chartRow = this.getRowByID(id);
3589
+ rowIndex = getValue('rowIndex', chartRow);
3590
+ } else if (!isNullOrUndefined(index)) {
3591
+ chartRow = this.getRowByIndex(index);
3592
+ rowIndex = getValue('rowIndex', chartRow);
3593
+ record = this.currentViewData[rowIndex];
3594
+ }
3595
+ const gridRow: Node = this.treeGrid.getRows()[rowIndex];
3596
+ return { data: record, gridRow: gridRow, chartRow: chartRow, cancel: false };
3597
+ }
3598
+
3599
+ /**
3600
+ * Method to get chart row value by index.
3601
+ *
3602
+ * @param {number} index - Defines the index of row.
3603
+ * @returns {HTMLElement} .
3604
+ */
3605
+ public getRowByIndex(index: number): HTMLElement {
3606
+ try {
3607
+ const gridRows: NodeList = this.element.querySelectorAll('.e-chart-row');
3608
+ if (!isNullOrUndefined(index)) {
3609
+ return gridRows[index] as HTMLElement;
3610
+ } else {
3611
+ return null;
3612
+ }
3613
+ } catch (e) {
3614
+ return null;
3615
+ }
3616
+ }
3617
+ /**
3618
+ * Method to get the row element by task id.
3619
+ *
3620
+ * @param {string | number} id - Defines the id of task.
3621
+ * @returns {HTMLElement} .
3622
+ */
3623
+ public getRowByID(id: string | number): HTMLElement {
3624
+ const record: IGanttData = this.getRecordByID(id.toString());
3625
+ const index: number = this.updatedRecords.indexOf(record);
3626
+ if (index !== -1) {
3627
+ return this.getRowByIndex(index);
3628
+ } else {
3629
+ return null;
3630
+ }
3631
+ }
3632
+ /**
3633
+ * Method to get class name for unscheduled tasks
3634
+ *
3635
+ * @param {ITaskData} ganttProp .
3636
+ * @returns {string} .
3637
+ * @private
3638
+ */
3639
+ public getUnscheduledTaskClass(ganttProp: ITaskData): string {
3640
+ if (isNullOrUndefined(ganttProp.startDate) && isNullOrUndefined(ganttProp.endDate) &&
3641
+ isNullOrUndefined(ganttProp.duration)) {
3642
+ return ' ' + cls.traceUnscheduledTask;
3643
+ } else if (isNullOrUndefined(ganttProp.startDate) || isNullOrUndefined(ganttProp.endDate) ||
3644
+ isNullOrUndefined(ganttProp.duration)) {
3645
+ return ' ' + cls.traceUnscheduledTask;
3646
+ } else {
3647
+ return '';
3648
+ }
3649
+ }
3650
+ /**
3651
+ * Method to get class name for unscheduled tasks
3652
+ *
3653
+ * @param {ITaskData} ganttProp .
3654
+ * @returns {boolean} .
3655
+ * @private
3656
+ */
3657
+ public isUnscheduledTask(ganttProp: ITaskData): boolean {
3658
+ if (isNullOrUndefined(ganttProp.startDate) || isNullOrUndefined(ganttProp.endDate) ||
3659
+ isNullOrUndefined(ganttProp.duration)) {
3660
+ return true;
3661
+ } else {
3662
+ return false;
3663
+ }
3664
+ }
3665
+ private createGanttPopUpElement(): void {
3666
+ const popup: Element = this.createElement('div', { className: 'e-ganttpopup', styles: 'display:none;' });
3667
+ const content: Element = this.createElement('div', { className: 'e-content', attrs: { tabIndex: '-1' } });
3668
+ append([content, this.createElement('div', { className: 'e-uptail e-tail' })], popup);
3669
+ content.appendChild(this.createElement('span'));
3670
+ append([content, this.createElement('div', { className: 'e-downtail e-tail' })], popup);
3671
+ document.getElementById(this.element.id + 'GanttChart').appendChild(popup);
3672
+ }
3673
+ /**
3674
+ * Method to get predecessor value as string.
3675
+ *
3676
+ * @param {string} type .
3677
+ * @returns {HTMLElement} .
3678
+ * @private
3679
+ */
3680
+ public getPredecessorTextValue(type: string): string {
3681
+ let textValue: string;
3682
+ switch (type) {
3683
+ case 'SS':
3684
+ textValue = this.localeObj.getConstant('start') + '-' + this.localeObj.getConstant('start');
3685
+ break;
3686
+ case 'FF':
3687
+ textValue = this.localeObj.getConstant('finish') + '-' + this.localeObj.getConstant('finish');
3688
+ break;
3689
+ case 'SF':
3690
+ textValue = this.localeObj.getConstant('start') + '-' + this.localeObj.getConstant('finish');
3691
+ break;
3692
+ case 'FS':
3693
+ textValue = this.localeObj.getConstant('finish') + '-' + this.localeObj.getConstant('start');
3694
+ break;
3695
+ }
3696
+ return textValue;
3697
+ }
3698
+ /**
3699
+ * Method to perform search action in Gantt.
3700
+ *
3701
+ * @param {string} keyVal - Defines key value to search.
3702
+ * @returns {void} .
3703
+ */
3704
+ public search(keyVal: string): void {
3705
+ if (this.filterModule) {
3706
+ this.searchSettings.key = keyVal;
3707
+ this.dataBind();
3708
+ }
3709
+ }
3710
+
3711
+ /**
3712
+ * Method to get offset rect value
3713
+ *
3714
+ * @param {HTMLElement} element .
3715
+ * @returns {number} .
3716
+ * @hidden
3717
+ */
3718
+ public getOffsetRect(element: HTMLElement): { top: number, left: number, width?: number, height?: number } {
3719
+ const box: ClientRect = element.getBoundingClientRect();
3720
+ const scrollTop: number = window.pageYOffset || document.documentElement.scrollTop
3721
+ || document.body.scrollTop;
3722
+ const scrollLeft: number = window.pageXOffset || document.documentElement.scrollLeft ||
3723
+ document.body.scrollLeft;
3724
+ const clientTop: number = document.documentElement.clientTop || document.body.clientTop || 0;
3725
+ const clientLeft: number = document.documentElement.clientLeft || document.body.clientLeft || 0;
3726
+ const top: number = box.top + scrollTop - clientTop;
3727
+ const left: number = box.left + scrollLeft - clientLeft;
3728
+ return { top: Math.round(top), left: Math.round(left), width: box.width, height: box.height };
3729
+ }
3730
+
3731
+ /**
3732
+ * Method to expand all the rows of Gantt.
3733
+ *
3734
+ * @returns {void} .
3735
+ * @public
3736
+ */
3737
+ public expandAll(): void {
3738
+ this.ganttChartModule.expandCollapseAll('expand');
3739
+ }
3740
+ /**
3741
+ * Method to update data source.
3742
+ *
3743
+ * @returns {void} .
3744
+ * @param {object[]} dataSource - Defines a collection of data.
3745
+ * @param {object} args - Defines the projectStartDate and projectEndDate values.
3746
+ * @public
3747
+ */
3748
+ public updateDataSource(dataSource: Object[], args: object): void {
3749
+ this.isDynamicData = true;
3750
+ if (!isNullOrUndefined(args)) {
3751
+ for (let prop of Object.keys(args)) { // eslint-disable-line
3752
+ switch (prop) {
3753
+ case 'projectStartDate':
3754
+ this.setProperties({ projectStartDate: args[prop] }, true);
3755
+ break;
3756
+ case 'projectEndDate':
3757
+ this.setProperties({ projectEndDate: args[prop] }, true);
3758
+ break;
3759
+ }
3760
+ }
3761
+ }
3762
+ this.dataSource = dataSource;
3763
+ }
3764
+
3765
+ /**
3766
+ * Method to collapse all the rows of Gantt.
3767
+ *
3768
+ * @returns {void} .
3769
+ * @public
3770
+ */
3771
+ public collapseAll(): void {
3772
+ this.ganttChartModule.expandCollapseAll('collapse');
3773
+ }
3774
+
3775
+ /**
3776
+ * Gets the columns from the TreeGrid.
3777
+ *
3778
+ * @returns {Column[]} .
3779
+ * @public
3780
+ */
3781
+ public getGridColumns(): Column[] {
3782
+ return this.treeGrid.getColumns();
3783
+ }
3784
+
3785
+ /**
3786
+ * Method to column from given column collection based on field value
3787
+ *
3788
+ * @param {string} field .
3789
+ * @param {ColumnModel[]} columns .
3790
+ * @returns {ColumnModel} .
3791
+ * @private
3792
+ */
3793
+ public getColumnByField(field: string, columns: ColumnModel[]): ColumnModel {
3794
+ const column: ColumnModel[] = columns.filter((value: ColumnModel) => {
3795
+ return value.field === field;
3796
+ });
3797
+ return column.length > 0 ? column[0] : null;
3798
+ }
3799
+
3800
+ /**
3801
+ * Gets the Gantt columns.
3802
+ *
3803
+ * @returns {ColumnModel[]} .
3804
+ * @public
3805
+ */
3806
+ public getGanttColumns(): ColumnModel[] {
3807
+ return this.ganttColumns;
3808
+ }
3809
+
3810
+ /**
3811
+ * Shows a column by its column name.
3812
+ *
3813
+ * @param {string|string[]} keys - Defines a single or collection of column names.
3814
+ * @param {string} showBy - Defines the column key either as field name or header text.
3815
+ * @returns {void} .
3816
+ * @public
3817
+ */
3818
+ public showColumn(keys: string | string[], showBy?: string): void {
3819
+ this.treeGrid.showColumns(keys, showBy);
3820
+ }
3821
+
3822
+ /**
3823
+ * Hides a column by column name.
3824
+ *
3825
+ * @param {string|string[]} keys - Defines a single or collection of column names.
3826
+ * @param {string} hideBy - Defines the column key either as field name or header text.
3827
+ * @returns {void} .
3828
+ * @public
3829
+ */
3830
+ public hideColumn(keys: string | string[], hideBy?: string): void {
3831
+ this.treeGrid.hideColumns(keys, hideBy);
3832
+ }
3833
+
3834
+ /**
3835
+ * To set scroll top for chart scroll container.
3836
+ *
3837
+ * @param {number} scrollTop - Defines scroll top value for scroll container.
3838
+ * @returns {void} .
3839
+ * @public
3840
+ */
3841
+ public setScrollTop(scrollTop: number): void {
3842
+ this.ganttChartModule.scrollObject.setScrollTop(scrollTop);
3843
+ }
3844
+
3845
+ /**
3846
+ * Cancels edited state.
3847
+ *
3848
+ * @returns {void} .
3849
+ * @public
3850
+ */
3851
+ public cancelEdit(): void {
3852
+ this.isCancelled = true;
3853
+ this.closeGanttActions();
3854
+ }
3855
+
3856
+ /**
3857
+ * Selects a cell by the given index.
3858
+ *
3859
+ * @param {IIndex} cellIndex - Defines the row and column indexes.
3860
+ * @param {boolean} isToggle - If set to true, then it toggles the selection.
3861
+ * @returns {void} .
3862
+ */
3863
+ public selectCell(cellIndex: IIndex, isToggle?: boolean): void {
3864
+ if (this.selectionModule) {
3865
+ this.selectionModule.selectCell(cellIndex, isToggle);
3866
+ }
3867
+ }
3868
+
3869
+ /**
3870
+ * Selects a collection of cells by row and column indexes.
3871
+ *
3872
+ * @param {ISelectedCell[]} rowCellIndexes - Specifies the row and column indexes.
3873
+ * @returns {void} .
3874
+ */
3875
+ public selectCells(rowCellIndexes: ISelectedCell[]): void {
3876
+ if (this.selectionModule) {
3877
+ this.selectionModule.selectCells(rowCellIndexes);
3878
+ }
3879
+ }
3880
+ /**
3881
+ * Selects a row by given index.
3882
+ *
3883
+ * @param {number} index - Defines the row index.
3884
+ * @param {boolean} isToggle - If set to true, then it toggles the selection.
3885
+ * @returns {void} .
3886
+ */
3887
+ public selectRow(index: number, isToggle?: boolean): void {
3888
+ if (this.selectionModule) {
3889
+ this.selectionModule.selectRow(index, isToggle);
3890
+ }
3891
+ }
3892
+
3893
+ /**
3894
+ * Selects a collection of rows by indexes.
3895
+ *
3896
+ * @param {number[]} records - Defines the collection of row indexes.
3897
+ * @returns {void} .
3898
+ */
3899
+ public selectRows(records: number[]): void {
3900
+ if (this.selectionModule) {
3901
+ this.selectionModule.selectRows(records);
3902
+ }
3903
+ }
3904
+ /**
3905
+ * Method to delete record.
3906
+ *
3907
+ * @param {number | string } taskDetail - Defines the details of data to delete.
3908
+ * @returns {void} .
3909
+ * @public
3910
+ */
3911
+ public deleteRecord(taskDetail: number | string | number[] | string[] | IGanttData | IGanttData[]): void {
3912
+ if (this.editModule) {
3913
+ this.editModule.deleteRecord(taskDetail);
3914
+ }
3915
+ }
3916
+ /**
3917
+ * Enables or disables ToolBar items.
3918
+ *
3919
+ * @param {string[]} items - Defines the collection of itemID of ToolBar items.
3920
+ * @param {boolean} isEnable - Defines the items to be enabled or disabled.
3921
+ * @returns {void} .
3922
+ */
3923
+ public enableItems(items: string[], isEnable: boolean): void {
3924
+ if (this.toolbarModule) {
3925
+ this.toolbarModule.enableItems(items, isEnable);
3926
+ }
3927
+ }
3928
+ /**
3929
+ * Deselects the current selected rows and cells.
3930
+ *
3931
+ * @returns {void} .
3932
+ */
3933
+ public clearSelection(): void {
3934
+ if (this.selectionModule) {
3935
+ this.selectionModule.clearSelection();
3936
+ }
3937
+ }
3938
+ /**
3939
+ * @param {ITaskAddedEventArgs | IActionBeginEventArgs} args .
3940
+ * @returns {ITaskAddedEventArgs | IActionBeginEventArgs} .
3941
+ * @hidden
3942
+ */
3943
+ public updateDataArgs(args: ITaskAddedEventArgs | IActionBeginEventArgs): ITaskAddedEventArgs | IActionBeginEventArgs {
3944
+ if (!Array.isArray(args.data)) {
3945
+ const customData: IGanttData[] = [];
3946
+ customData.push(args.data);
3947
+ setValue('data', customData, args);
3948
+ }
3949
+ return args;
3950
+ }
3951
+ /**
3952
+ * Method to convert task data to milestone data.
3953
+ *
3954
+ * @param {string} id - Defines id of record.
3955
+ * @returns {void} .
3956
+ * @public
3957
+ */
3958
+ public convertToMilestone(id: string): void {
3959
+ const rowData: IGanttData = this.getRecordByID(id);
3960
+ if (!isNullOrUndefined(rowData)) {
3961
+ const data: Object = extend({}, {}, rowData.taskData, true);
3962
+ const taskfields: TaskFieldsModel = this.taskFields;
3963
+ if (data[taskfields.startDate]) {
3964
+ this.setRecordValue(taskfields.startDate, rowData.ganttProperties.startDate, data, true);
3965
+ }
3966
+ if (!isNullOrUndefined(taskfields.duration)) {
3967
+ data[taskfields.duration] = 0;
3968
+ } else {
3969
+ data[taskfields.startDate] = new Date(rowData.ganttProperties.startDate);
3970
+ data[taskfields.endDate] = new Date(rowData.ganttProperties.endDate);
3971
+ }
3972
+ if (!isNullOrUndefined(taskfields.milestone)) {
3973
+ if (data[taskfields.milestone] === false) {
3974
+ data[taskfields.milestone] = true;
3975
+ }
3976
+ }
3977
+ if (!isNullOrUndefined(taskfields.progress)) {
3978
+ data[taskfields.progress] = 0;
3979
+ }
3980
+ if (!isNullOrUndefined(taskfields.child) && data[taskfields.child]) {
3981
+ data[taskfields.child] = [];
3982
+ }
3983
+ if (!isNullOrUndefined(taskfields.parentID) && data[taskfields.parentID]) {
3984
+ data[taskfields.parentID] = null;
3985
+ }
3986
+ if (!isNullOrUndefined(taskfields.segments)) {
3987
+ data[taskfields.segments] = null;
3988
+ }
3989
+ if (!isNullOrUndefined(this.contextMenuModule) &&
3990
+ this.contextMenuModule.isOpen &&
3991
+ this.contextMenuModule.item === 'Milestone') {
3992
+ if (!isNullOrUndefined(taskfields.dependency)) {
3993
+ data[taskfields.dependency] = null;
3994
+ }
3995
+ const position: RowPosition = 'Below';
3996
+ this.addRecord(data, position);
3997
+ } else {
3998
+ if (!rowData.hasChildRecords && !rowData.ganttProperties.isMilestone) {
3999
+ this.updateRecordByID(data);
4000
+ }
4001
+ }
4002
+ }
4003
+ }
4004
+ /**
4005
+ * To change the mode of a record.
4006
+ *
4007
+ * @param {object} data .
4008
+ * @returns {void} .
4009
+ */
4010
+ public changeTaskMode(data: Object): void {
4011
+ const tasks: TaskFieldsModel = this.taskFields;
4012
+ const ganttData: IGanttData = this.getRecordByID(data[tasks.id]);
4013
+ const ganttProp: ITaskData = ganttData.ganttProperties;
4014
+ this.isOnEdit = true;
4015
+ this.setRecordValue('isAutoSchedule', !ganttProp.isAutoSchedule, ganttProp, true);
4016
+ if (!isNullOrUndefined(this.taskFields.manual)) {
4017
+ this.setRecordValue('taskData.' + tasks.manual, !ganttProp.isAutoSchedule, ganttData);
4018
+ this.setRecordValue(tasks.manual, !ganttProp.isAutoSchedule, ganttData);
4019
+ }
4020
+ this.editModule.updateTaskScheduleModes(ganttData);
4021
+ const args: ITaskbarEditedEventArgs = {
4022
+ data: ganttData
4023
+ };
4024
+ this.editModule.initiateUpdateAction(args);
4025
+ }
4026
+ /**
4027
+ * @returns {string[]} .
4028
+ * @private
4029
+ */
4030
+ public getTaskIds(): string[] {
4031
+ return this.taskIds;
4032
+ }
4033
+ /**
4034
+ * @param {IGanttData} data .
4035
+ * @returns {void} .
4036
+ * @private
4037
+ */
4038
+ public setTaskIds(data: IGanttData): void {
4039
+ if (this.viewType !== 'ProjectView') {
4040
+ let id: string = data.ganttProperties.taskId;
4041
+ id = data.level === 0 ? 'R' + id : 'T' + id;
4042
+ this.taskIds.push(id);
4043
+ }
4044
+ }
4045
+ /**
4046
+ * To render the react templates
4047
+ *
4048
+ * @returns {void} .
4049
+ * @hidden
4050
+ */
4051
+ public renderTemplates(): void {
4052
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4053
+ if ((this as any).isReact) {
4054
+ this.renderReactTemplates();
4055
+ }
4056
+ }
4057
+ /**
4058
+ * To reset the react templates
4059
+ *
4060
+ * @returns {void} .
4061
+ * @hidden
4062
+ */
4063
+ public resetTemplates(): void {
4064
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4065
+ if ((this as any).isReact) {
4066
+ this.clearTemplate();
4067
+ }
4068
+ }
4069
+ }