@syncfusion/ej2-gantt 19.4.56 → 20.1.47-1460716

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (211) hide show
  1. package/CHANGELOG.md +1072 -1060
  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 +274 -176
  6. package/dist/es6/ej2-gantt.es2015.js.map +1 -1
  7. package/dist/es6/ej2-gantt.es5.js +642 -534
  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 +11 -2
  91. package/src/gantt/actions/rowdragdrop.js +37 -15
  92. package/src/gantt/actions/taskbar-edit.js +24 -24
  93. package/src/gantt/base/date-processor.js +0 -1
  94. package/src/gantt/base/gantt-chart.js +9 -4
  95. package/src/gantt/base/gantt-model.d.ts +779 -779
  96. package/src/gantt/base/gantt.d.ts +27 -27
  97. package/src/gantt/base/gantt.js +22 -22
  98. package/src/gantt/base/splitter.js +1 -0
  99. package/src/gantt/base/task-processor.js +13 -13
  100. package/src/gantt/base/tree-grid.js +3 -1
  101. package/src/gantt/export/pdf-base/treegrid-layouter.js +13 -13
  102. package/src/gantt/export/pdf-connector-line.js +11 -11
  103. package/src/gantt/export/pdf-gantt.js +24 -24
  104. package/src/gantt/export/pdf-taskbar.js +11 -11
  105. package/src/gantt/export/pdf-treegrid.js +13 -13
  106. package/src/gantt/models/add-dialog-field-settings-model.d.ts +21 -21
  107. package/src/gantt/models/add-dialog-field-settings.js +19 -19
  108. package/src/gantt/models/day-working-time-model.d.ts +11 -11
  109. package/src/gantt/models/day-working-time.js +19 -19
  110. package/src/gantt/models/edit-dialog-field-settings-model.d.ts +21 -21
  111. package/src/gantt/models/edit-dialog-field-settings.js +19 -19
  112. package/src/gantt/models/edit-settings-model.d.ts +50 -50
  113. package/src/gantt/models/edit-settings.js +19 -19
  114. package/src/gantt/models/event-marker-model.d.ts +16 -16
  115. package/src/gantt/models/event-marker.js +19 -19
  116. package/src/gantt/models/filter-settings-model.d.ts +34 -34
  117. package/src/gantt/models/filter-settings.js +19 -19
  118. package/src/gantt/models/holiday-model.d.ts +21 -21
  119. package/src/gantt/models/holiday.js +19 -19
  120. package/src/gantt/models/label-settings-model.d.ts +16 -16
  121. package/src/gantt/models/label-settings.js +19 -19
  122. package/src/gantt/models/resource-fields-model.d.ts +21 -21
  123. package/src/gantt/models/resource-fields.js +19 -19
  124. package/src/gantt/models/search-settings-model.d.ts +56 -56
  125. package/src/gantt/models/search-settings.js +19 -19
  126. package/src/gantt/models/selection-settings-model.d.ts +35 -35
  127. package/src/gantt/models/selection-settings.js +19 -19
  128. package/src/gantt/models/sort-settings-model.d.ts +24 -24
  129. package/src/gantt/models/sort-settings.js +19 -19
  130. package/src/gantt/models/splitter-settings-model.d.ts +30 -30
  131. package/src/gantt/models/splitter-settings.js +19 -19
  132. package/src/gantt/models/task-fields-model.d.ts +110 -110
  133. package/src/gantt/models/task-fields.js +19 -19
  134. package/src/gantt/models/timeline-settings-model.d.ts +71 -71
  135. package/src/gantt/models/timeline-settings.js +19 -19
  136. package/src/gantt/models/tooltip-settings-model.d.ts +26 -26
  137. package/src/gantt/models/tooltip-settings.js +19 -19
  138. package/src/gantt/renderer/chart-rows.js +49 -37
  139. package/src/gantt/renderer/connector-line.js +22 -18
  140. package/src/gantt/renderer/event-marker.js +1 -0
  141. package/src/gantt/renderer/nonworking-day.js +13 -6
  142. package/src/gantt/renderer/timeline.d.ts +1 -0
  143. package/src/gantt/renderer/timeline.js +48 -12
  144. package/src/gantt/renderer/tooltip.js +11 -3
  145. package/styles/bootstrap-dark.css +442 -427
  146. package/styles/bootstrap.css +442 -433
  147. package/styles/bootstrap4.css +454 -479
  148. package/styles/bootstrap5-dark.css +457 -433
  149. package/styles/bootstrap5.css +457 -433
  150. package/styles/fabric-dark.css +438 -421
  151. package/styles/fabric.css +445 -428
  152. package/styles/fluent-dark.css +1938 -0
  153. package/styles/fluent-dark.scss +1 -0
  154. package/styles/fluent.css +1938 -0
  155. package/styles/fluent.scss +1 -0
  156. package/styles/gantt/_all.scss +2 -2
  157. package/styles/gantt/_bootstrap-dark-definition.scss +210 -156
  158. package/styles/gantt/_bootstrap-definition.scss +211 -157
  159. package/styles/gantt/_bootstrap4-definition.scss +213 -158
  160. package/styles/gantt/_bootstrap5-definition.scss +215 -162
  161. package/styles/gantt/_fabric-dark-definition.scss +211 -157
  162. package/styles/gantt/_fabric-definition.scss +211 -157
  163. package/styles/gantt/_fluent-dark-definition.scss +1 -0
  164. package/styles/gantt/_fluent-definition.scss +215 -162
  165. package/styles/gantt/_fusionnew-definition.scss +214 -0
  166. package/styles/gantt/_highcontrast-definition.scss +211 -157
  167. package/styles/gantt/_highcontrast-light-definition.scss +211 -157
  168. package/styles/gantt/_layout.scss +1446 -1027
  169. package/styles/gantt/_material-dark-definition.scss +212 -157
  170. package/styles/gantt/_material-definition.scss +212 -157
  171. package/styles/gantt/_material3-definition.scss +215 -0
  172. package/styles/gantt/_tailwind-definition.scss +215 -161
  173. package/styles/gantt/_theme.scss +702 -668
  174. package/styles/gantt/bootstrap-dark.css +442 -427
  175. package/styles/gantt/bootstrap.css +442 -433
  176. package/styles/gantt/bootstrap4.css +454 -479
  177. package/styles/gantt/bootstrap5-dark.css +457 -433
  178. package/styles/gantt/bootstrap5.css +457 -433
  179. package/styles/gantt/fabric-dark.css +438 -421
  180. package/styles/gantt/fabric.css +445 -428
  181. package/styles/gantt/fluent-dark.css +1938 -0
  182. package/styles/gantt/fluent-dark.scss +22 -0
  183. package/styles/gantt/fluent.css +1938 -0
  184. package/styles/gantt/fluent.scss +22 -0
  185. package/styles/gantt/highcontrast-light.css +405 -405
  186. package/styles/gantt/highcontrast.css +444 -456
  187. package/styles/gantt/icons/_bootstrap-dark.scss +124 -113
  188. package/styles/gantt/icons/_bootstrap.scss +124 -113
  189. package/styles/gantt/icons/_bootstrap4.scss +124 -113
  190. package/styles/gantt/icons/_bootstrap5.scss +124 -112
  191. package/styles/gantt/icons/_fabric-dark.scss +124 -112
  192. package/styles/gantt/icons/_fabric.scss +124 -112
  193. package/styles/gantt/icons/_fluent-dark.scss +1 -0
  194. package/styles/gantt/icons/_fluent.scss +124 -112
  195. package/styles/gantt/icons/_fusionnew.scss +120 -0
  196. package/styles/gantt/icons/_highcontrast.scss +124 -112
  197. package/styles/gantt/icons/_material-dark.scss +124 -112
  198. package/styles/gantt/icons/_material.scss +124 -112
  199. package/styles/gantt/icons/_material3.scss +124 -0
  200. package/styles/gantt/icons/_tailwind-dark.scss +124 -113
  201. package/styles/gantt/icons/_tailwind.scss +124 -113
  202. package/styles/gantt/material-dark.css +446 -417
  203. package/styles/gantt/material.css +445 -419
  204. package/styles/gantt/tailwind-dark.css +452 -482
  205. package/styles/gantt/tailwind.css +449 -479
  206. package/styles/highcontrast-light.css +405 -405
  207. package/styles/highcontrast.css +444 -456
  208. package/styles/material-dark.css +446 -417
  209. package/styles/material.css +445 -419
  210. package/styles/tailwind-dark.css +452 -482
  211. package/styles/tailwind.css +449 -479
@@ -0,0 +1,552 @@
1
+ import { TaskFieldsModel } from './../models/task-fields-model.d';
2
+ import { PdfFontFamily } from '@syncfusion/ej2-pdf-export';
3
+ import { PdfStringFormat, PdfPageCountField, PdfPageNumberField } from '@syncfusion/ej2-pdf-export';
4
+ import { PdfPageTemplateElement, RectangleF, PdfCompositeField, PointF } from '@syncfusion/ej2-pdf-export';
5
+ import { PdfVerticalAlignment, PdfTextAlignment, PdfFont, PdfStandardFont } from '@syncfusion/ej2-pdf-export';
6
+ import { PdfFontStyle, PdfColor, PdfPen, PdfBrush, PdfSolidBrush, PdfDocument } from '@syncfusion/ej2-pdf-export';
7
+ import { PdfTreeGridColumn, PdfTreeGridRow, PdfTreeGridCell, PdfBorders, PdfPaddings } from './pdf-base/index';
8
+ import { ColumnModel } from './../models/column';
9
+ import { PdfGantt } from './pdf-gantt';
10
+ import {
11
+ IGanttData, PdfExportProperties, PdfQueryCellInfoEventArgs,
12
+ ITaskData, IGanttStyle, IConnectorLineObject, PdfGanttCellStyle, ITaskbarStyle, PdfColumnHeaderQueryCellInfoEventArgs,
13
+ PdfQueryTaskbarInfoEventArgs
14
+ } from './../base/interface';
15
+ import { Gantt } from './../base/gantt';
16
+ import { isNullOrUndefined, DateFormatOptions, Internationalization, getValue, extend } from '@syncfusion/ej2-base';
17
+ import { getForeignData, ValueFormatter } from '@syncfusion/ej2-grids';
18
+ import { pixelToPoint, isScheduledTask } from '../base/utils';
19
+ import { Timeline } from '../renderer/timeline';
20
+ import { PdfGanttTaskbarCollection } from './pdf-taskbar';
21
+ import { PdfGanttPredecessor } from './pdf-connector-line';
22
+
23
+
24
+ /**
25
+ * @hidden
26
+ * `ExportHelper` for `PdfExport` & `ExcelExport`
27
+ */
28
+ export class ExportHelper {
29
+ private parent: Gantt;
30
+ private flatData: IGanttData[];
31
+ private exportProps: PdfExportProperties;
32
+ private gantt: PdfGantt;
33
+ private rowIndex: number;
34
+ private colIndex: number;
35
+ private row: PdfTreeGridRow;
36
+ private columns: ColumnModel[];
37
+ private ganttStyle: IGanttStyle;
38
+ private pdfDoc: PdfDocument;
39
+ private exportValueFormatter: ExportValueFormatter;
40
+ private totalColumnWidth: number;
41
+ public constructor(parent: Gantt) {
42
+ this.parent = parent;
43
+ }
44
+ /**
45
+ * @param {IGanttData[]} data .
46
+ * @param {PdfGantt} gantt .
47
+ * @param {PdfExportProperties} props .
48
+ * @returns {void} .
49
+ * @private
50
+ */
51
+ public processGridExport(data: IGanttData[], gantt: PdfGantt, props: PdfExportProperties): void {
52
+ this.flatData = data;
53
+ this.gantt = gantt;
54
+ this.exportValueFormatter = new ExportValueFormatter(this.parent.locale);
55
+ this.exportProps = props;
56
+ this.rowIndex = 0;
57
+ this.colIndex = 0;
58
+ this.columns = this.parent.treeGrid.columns as ColumnModel[];
59
+ this.gantt.treeColumnIndex = this.parent.treeColumnIndex;
60
+ this.gantt.rowHeight = pixelToPoint(this.parent.rowHeight);
61
+ this.gantt.style.cellPadding.left = 0;
62
+ this.gantt.style.cellPadding.right = 0;
63
+ this.ganttStyle = this.gantt.ganttStyle;
64
+ this.gantt.borderColor = this.ganttStyle.chartGridLineColor;
65
+ this.processHeaderContent();
66
+ this.processGanttContent();
67
+ this.processTimeline();
68
+ this.processTaskbar();
69
+ this.processPredecessor();
70
+ }
71
+
72
+ private processHeaderContent(): void {
73
+ this.rowIndex++;
74
+ this.row = this.gantt.rows.addRow();
75
+ let index: number = 0;
76
+ this.columns.forEach((column: ColumnModel): void => {
77
+ if (this.isColumnVisible(column)) {
78
+ this.processColumnHeader(column, index);
79
+ index++;
80
+ }
81
+ });
82
+ }
83
+ private processColumnHeader(column: ColumnModel, index: number): void {
84
+ this.gantt.columns.add(1);
85
+ const pdfColumn: PdfTreeGridColumn = this.gantt.columns.getColumn(index);
86
+ if (this.parent.treeColumnIndex === index) {
87
+ pdfColumn.isTreeColumn = true;
88
+ }
89
+ const width: string | number = parseInt(column.width as string, 10);
90
+ pdfColumn.width = pixelToPoint(width);
91
+ this.totalColumnWidth += pdfColumn.width;
92
+ pdfColumn.headerText = column.headerText;
93
+ pdfColumn.field = column.field;
94
+ const cell: PdfTreeGridCell = this.row.cells.getCell(index);
95
+ cell.value = column.headerText;
96
+ cell.isHeaderCell = true;
97
+ const treeGridHeaderHeight: number = this.parent.timelineModule.isSingleTier ? 45 : 60;
98
+ this.copyStyles(this.ganttStyle.columnHeader, cell, false);
99
+ this.row.height = pixelToPoint(treeGridHeaderHeight);
100
+ if (column.headerTextAlign) {
101
+ cell.style.format.alignment = PdfTextAlignment[column.headerTextAlign];
102
+ }
103
+ const args: PdfColumnHeaderQueryCellInfoEventArgs = {
104
+ cell: cell,
105
+ style: cell.style,
106
+ value: cell.value,
107
+ column: column
108
+ };
109
+ if (this.parent.pdfColumnHeaderQueryCellInfo) {
110
+ this.parent.trigger('pdfColumnHeaderQueryCellInfo', args);
111
+ }
112
+ cell.value = args.value;
113
+ }
114
+
115
+ private isColumnVisible(column: ColumnModel): boolean {
116
+ const visibleColumn: boolean = column.visible || this.exportProps.includeHiddenColumn;
117
+ const templateColumn: boolean = !isNullOrUndefined(column.template) ? false : true;
118
+ return (visibleColumn && templateColumn);
119
+ }
120
+
121
+ private processGanttContent(): void {
122
+ if (this.flatData.length === 0) {
123
+ this.renderEmptyGantt();
124
+ } else {
125
+ this.flatData.forEach((data: IGanttData) => {
126
+ this.row = this.gantt.rows.addRow();
127
+ if (data.hasChildRecords) {
128
+ this.gantt.rows.getRow(this.rowIndex).isParentRow = true;
129
+ this.processRecordRow(data);
130
+ } else {
131
+ this.processRecordRow(data);
132
+ }
133
+ this.rowIndex++;
134
+ });
135
+ }
136
+ }
137
+ /**
138
+ * Method for processing the timeline details
139
+ *
140
+ * @returns {void} .
141
+ */
142
+ private processTimeline(): void {
143
+ const timelineSettings: Timeline = this.parent.timelineModule;
144
+ this.gantt.chartHeader.topTierHeight = this.gantt.chartHeader.bottomTierHeight
145
+ = (this.parent.timelineModule.isSingleTier ? 45 : 60 / 2);
146
+ this.gantt.chartHeader.topTierCellWidth = timelineSettings.topTierCellWidth;
147
+ this.gantt.chartHeader.bottomTierCellWidth = timelineSettings.bottomTierCellWidth;
148
+ this.gantt.chartHeader.topTier = extend([], [], timelineSettings.topTierCollection, true) as [];
149
+ this.gantt.chartHeader.bottomTier = extend([], [], timelineSettings.bottomTierCollection, true) as [];
150
+ this.gantt.chartHeader.width = timelineSettings.totalTimelineWidth;
151
+ this.gantt.chartHeader.height = this.gantt.rows.getRow(0).height;
152
+ this.gantt.timelineStartDate = new Date(timelineSettings.timelineStartDate.getTime());
153
+ }
154
+ /**
155
+ * Method for create the predecessor collection for rendering
156
+ *
157
+ * @returns {void} .
158
+ */
159
+ private processPredecessor(): void {
160
+ if (isNullOrUndefined(this.exportProps.showPredecessorLines) || this.exportProps.showPredecessorLines) {
161
+ this.parent.pdfExportModule.isPdfExport = true;
162
+ this.parent.predecessorModule.createConnectorLinesCollection();
163
+ this.parent.updatedConnectorLineCollection.forEach((data: IConnectorLineObject) => {
164
+ const predecessor: PdfGanttPredecessor = this.gantt.predecessor.add();
165
+ predecessor.parentLeft = data.parentLeft;
166
+ predecessor.childLeft = data.childLeft;
167
+ predecessor.parentWidth = data.parentWidth;
168
+ predecessor.childWidth = data.childWidth;
169
+ predecessor.parentIndex = data.parentIndex;
170
+ predecessor.childIndex = data.childIndex;
171
+ predecessor.rowHeight = data.rowHeight;
172
+ predecessor.type = data.type;
173
+ predecessor.milestoneParent = data.milestoneParent;
174
+ predecessor.milestoneChild = data.milestoneChild;
175
+ predecessor.lineWidth = this.parent.connectorLineWidth > 5 ? pixelToPoint(5) : pixelToPoint(this.parent.connectorLineWidth);
176
+ predecessor.connectorLineColor = this.ganttStyle.connectorLineColor;
177
+ this.gantt.predecessorCollection.push(predecessor);
178
+ });
179
+ this.parent.pdfExportModule.isPdfExport = false;
180
+ }
181
+ }
182
+
183
+ private processRecordRow(data: IGanttData): void {
184
+ this.colIndex = 0;
185
+ this.row.level = data.level;
186
+ this.columns.forEach((column: ColumnModel): void => {
187
+ if (this.isColumnVisible(column)) {
188
+ this.processRecordCell(data, column, this.row);
189
+ this.colIndex++;
190
+ }
191
+ });
192
+ }
193
+
194
+ private processRecordCell(data: IGanttData, column: ColumnModel, row: PdfTreeGridRow): void {
195
+ const cell: PdfTreeGridCell = row.cells.getCell(this.colIndex);
196
+ const taskFields: TaskFieldsModel = this.parent.taskFields;
197
+ const ganttProps: ITaskData = data.ganttProperties;
198
+ if (column.editType === 'datepickeredit' || column.editType === 'datetimepickeredit') {
199
+ cell.value = data[column.field];
200
+ } else if (column.field === taskFields.duration) {
201
+ cell.value = this.parent.getDurationString(ganttProps.duration, ganttProps.durationUnit);
202
+ } else if (column.field === taskFields.resourceInfo) {
203
+ cell.value = ganttProps.resourceNames;
204
+ } else if (column.field === taskFields.work) {
205
+ cell.value = this.parent.getWorkString(ganttProps.work, ganttProps.workUnit);
206
+ } else {
207
+ cell.value = !isNullOrUndefined(data[column.field]) ? data[column.field].toString() : '';
208
+ }
209
+ cell.isHeaderCell = false;
210
+ cell.style.padding = new PdfPaddings();
211
+ this.copyStyles(this.ganttStyle.cell, cell, row.isParentRow);
212
+ if (this.colIndex !== this.parent.treeColumnIndex) {
213
+ cell.style.format.alignment = PdfTextAlignment[column.textAlign];
214
+ } else {
215
+ cell.style.format.paragraphIndent = cell.row.level * 10;
216
+ }
217
+ const args: PdfQueryCellInfoEventArgs = {
218
+ data: data,
219
+ value: cell.value,
220
+ column: column,
221
+ style: cell.style,
222
+ cell: cell
223
+ };
224
+ args.value = this.exportValueFormatter.formatCellValue(args);
225
+ if (this.parent.pdfQueryCellInfo) {
226
+ this.parent.trigger('pdfQueryCellInfo', args);
227
+ }
228
+ cell.value = args.value;
229
+ }
230
+ /**
231
+ * Method for create the taskbar collection for rendering
232
+ *
233
+ * @returns {void} .
234
+ */
235
+ private processTaskbar(): void {
236
+ this.flatData.forEach((data: IGanttData) => {
237
+ const taskbar: PdfGanttTaskbarCollection = this.gantt.taskbar.add();
238
+ const ganttProp: ITaskData = data.ganttProperties;
239
+ taskbar.left = ganttProp.left;
240
+ taskbar.width = ganttProp.width;
241
+ if (taskbar.left < 0) {
242
+ taskbar.width = taskbar.width + taskbar.left;
243
+ taskbar.left = 0;
244
+ }
245
+ taskbar.progress = ganttProp.progress;
246
+ taskbar.isScheduledTask = isScheduledTask(ganttProp);
247
+ if (isScheduledTask) {
248
+ if (isNullOrUndefined(ganttProp.endDate) && isNullOrUndefined(ganttProp.duration)) {
249
+ taskbar.unscheduledTaskBy = 'startDate';
250
+ } else if (isNullOrUndefined(ganttProp.startDate) && isNullOrUndefined(ganttProp.duration)) {
251
+ taskbar.unscheduledTaskBy = 'endDate';
252
+ } else {
253
+ taskbar.unscheduledTaskBy = 'duration';
254
+ taskbar.unscheduleStarteDate = this.parent.dateValidationModule.getValidStartDate(data.ganttProperties);
255
+ taskbar.unscheduleEndDate = this.parent.dateValidationModule.getValidEndDate(data.ganttProperties);
256
+ }
257
+ } else {
258
+ taskbar.unscheduleStarteDate = null;
259
+ taskbar.unscheduleEndDate = null;
260
+ }
261
+ taskbar.startDate = ganttProp.startDate;
262
+ taskbar.endDate = ganttProp.endDate;
263
+ taskbar.height = this.parent.chartRowsModule.taskBarHeight;
264
+ taskbar.isMilestone = ganttProp.isMilestone;
265
+ taskbar.milestoneColor = new PdfColor(this.ganttStyle.taskbar.milestoneColor);
266
+ taskbar.isParentTask = data.hasChildRecords;
267
+ if (ganttProp.isMilestone) {
268
+ taskbar.height = ganttProp.width;
269
+ }
270
+ if (data[this.parent.labelSettings.leftLabel]) {
271
+ taskbar.leftTaskLabel.value = data[this.parent.labelSettings.leftLabel].toString();
272
+ }
273
+ if (data[this.parent.labelSettings.rightLabel]) {
274
+ taskbar.rightTaskLabel.value = data[this.parent.labelSettings.rightLabel].toString();
275
+ }
276
+ const reduceLeft: number = ganttProp.isMilestone ? Math.floor(this.parent.chartRowsModule.taskBarHeight / 2) + 33 : 33; // 33 indicates default timeline cell width
277
+ taskbar.rightTaskLabel.left = ganttProp.left + ganttProp.width + reduceLeft; // right label left value
278
+ taskbar.fontFamily = this.ganttStyle.fontFamily;
279
+ taskbar.progressWidth = ganttProp.progressWidth;
280
+ taskbar.labelColor = new PdfColor(this.ganttStyle.label.fontColor);
281
+ taskbar.progressFontColor = new PdfColor(this.ganttStyle.taskbar.progressFontColor);
282
+ if (taskbar.isParentTask) {
283
+ taskbar.taskColor = new PdfColor(this.ganttStyle.taskbar.parentTaskColor);
284
+ taskbar.taskBorderColor = new PdfColor(this.ganttStyle.taskbar.parentTaskBorderColor);
285
+ taskbar.progressColor = new PdfColor(this.ganttStyle.taskbar.parentProgressColor);
286
+ } else {
287
+ taskbar.taskColor = new PdfColor(this.ganttStyle.taskbar.taskColor);
288
+ taskbar.taskBorderColor = new PdfColor(this.ganttStyle.taskbar.taskBorderColor);
289
+ taskbar.progressColor = new PdfColor(this.ganttStyle.taskbar.progressColor);
290
+ }
291
+ taskbar.gridLineColor = new PdfColor(this.ganttStyle.chartGridLineColor);
292
+ this.gantt.taskbarCollection.push(taskbar);
293
+ const taskStyle: ITaskbarStyle = {};
294
+ taskStyle.progressFontColor = taskbar.progressFontColor;
295
+ taskStyle.taskColor = taskbar.taskColor;
296
+ taskStyle.taskBorderColor = taskbar.taskBorderColor;
297
+ taskStyle.progressColor = taskbar.progressColor;
298
+ taskStyle.milestoneColor = taskbar.milestoneColor;
299
+ const args: PdfQueryTaskbarInfoEventArgs = {
300
+ taskbar: taskStyle,
301
+ data: data
302
+ };
303
+ if (this.parent.pdfQueryTaskbarInfo) {
304
+ this.parent.trigger('pdfQueryTaskbarInfo', args);
305
+ taskbar.progressFontColor = args.taskbar.progressFontColor;
306
+ taskbar.taskColor = args.taskbar.taskColor;
307
+ taskbar.taskBorderColor = args.taskbar.taskBorderColor;
308
+ taskbar.progressColor = args.taskbar.progressColor;
309
+ taskbar.milestoneColor = args.taskbar.milestoneColor;
310
+ }
311
+ });
312
+ }
313
+ /**
314
+ * set text alignment of each columns in exporting grid
315
+ *
316
+ * @param {string} textAlign .
317
+ * @param {PdfStringFormat} format .
318
+ * @returns {PdfStringFormat} .
319
+ * @private
320
+ */
321
+ private getHorizontalAlignment(textAlign: string, format?: PdfStringFormat): PdfStringFormat {
322
+ if (format === undefined) {
323
+ format = new PdfStringFormat();
324
+ }
325
+ switch (textAlign) {
326
+ case 'Right':
327
+ format.alignment = PdfTextAlignment.Right;
328
+ break;
329
+ case 'Center':
330
+ format.alignment = PdfTextAlignment.Center;
331
+ break;
332
+ case 'Justify':
333
+ format.alignment = PdfTextAlignment.Justify;
334
+ break;
335
+ case 'Left':
336
+ format.alignment = PdfTextAlignment.Left;
337
+ break;
338
+ }
339
+ return format;
340
+ }
341
+ /**
342
+ * set vertical alignment of each columns in exporting grid
343
+ *
344
+ * @param {string} verticalAlign .
345
+ * @param {PdfStringFormat} format .
346
+ * @param {string} textAlign .
347
+ * @returns {PdfStringFormat} .
348
+ * @private
349
+ */
350
+ private getVerticalAlignment(verticalAlign: string, format?: PdfStringFormat, textAlign?: string): PdfStringFormat {
351
+ if (format === undefined) {
352
+ format = new PdfStringFormat();
353
+ format = this.getHorizontalAlignment(textAlign, format);
354
+ }
355
+ switch (verticalAlign) {
356
+ case 'Bottom':
357
+ format.lineAlignment = PdfVerticalAlignment.Bottom;
358
+ break;
359
+ case 'Middle':
360
+ format.lineAlignment = PdfVerticalAlignment.Middle;
361
+ break;
362
+ case 'Top':
363
+ format.lineAlignment = PdfVerticalAlignment.Top;
364
+ break;
365
+ }
366
+ return format;
367
+ }
368
+
369
+ private getFontFamily(fontFamily: string): number {
370
+ switch (fontFamily) {
371
+ case 'TimesRoman':
372
+ return 2;
373
+ case 'Courier':
374
+ return 1;
375
+ case 'Symbol':
376
+ return 3;
377
+ case 'ZapfDingbats':
378
+ return 4;
379
+ default:
380
+ return 0;
381
+ }
382
+ }
383
+
384
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
385
+ private getFont(content: any): PdfFont {
386
+ if (content.font) {
387
+ return content.font;
388
+ }
389
+ const fontSize: number = (!isNullOrUndefined(content.style.fontSize)) ? (content.style.fontSize * 0.75) : 9.75;
390
+
391
+ const fontFamily: number = (!isNullOrUndefined(content.style.fontFamily)) ?
392
+ (this.getFontFamily(content.style.fontFamily)) : PdfFontFamily.TimesRoman;
393
+
394
+ let fontStyle: PdfFontStyle = PdfFontStyle.Regular;
395
+ if (!isNullOrUndefined(content.style.bold) && content.style.bold) {
396
+ fontStyle |= PdfFontStyle.Bold;
397
+ }
398
+
399
+ if (!isNullOrUndefined(content.style.italic) && content.style.italic) {
400
+ fontStyle |= PdfFontStyle.Italic;
401
+ }
402
+
403
+ if (!isNullOrUndefined(content.style.underline) && content.style.underline) {
404
+ fontStyle |= PdfFontStyle.Underline;
405
+ }
406
+
407
+ if (!isNullOrUndefined(content.style.strikeout) && content.style.strikeout) {
408
+ fontStyle |= PdfFontStyle.Strikeout;
409
+ }
410
+
411
+ return new PdfStandardFont(fontFamily, fontSize, fontStyle);
412
+ }
413
+ private renderEmptyGantt(): void {
414
+ const row: PdfTreeGridRow = this.gantt.rows.addRow();
415
+ row.cells.getCell(0).isHeaderCell = false;
416
+ row.height = pixelToPoint(this.parent.rowHeight);
417
+ this.copyStyles(this.ganttStyle.columnHeader, row.cells.getCell(0), row.isParentRow);
418
+ const count: number = this.columns.length;
419
+ this.mergeCells(0, 0, count);
420
+ }
421
+ private mergeCells(rowIndex: number, colIndex: number, lastColIndex: number): void {
422
+ this.gantt.rows.getRow(rowIndex).cells.getCell(colIndex).columnSpan = lastColIndex;
423
+ }
424
+ /* eslint-disable-next-line */
425
+ private copyStyles(style: PdfGanttCellStyle, cell: PdfTreeGridCell, isParentRow: boolean): void {
426
+ cell.style.fontColor = new PdfColor(style.fontColor);
427
+ cell.style.backgroundColor = new PdfColor(style.backgroundColor);
428
+ cell.style.borderColor = new PdfColor(style.borderColor);
429
+ cell.style.fontSize = style.fontSize;
430
+ cell.style.fontStyle = style.fontStyle;
431
+ /* eslint-disable-next-line */
432
+ cell.style.format = (<any>Object).assign(new PdfStringFormat(), style.format);
433
+ cell.style.borders = new PdfBorders();
434
+ cell.style.borders.all = new PdfPen(cell.style.borderColor);
435
+ cell.style.padding = new PdfPaddings();
436
+ let padding: number = 0;
437
+ if (cell.isHeaderCell) {
438
+ padding = this.parent.timelineModule.isSingleTier ? 45 / 2 : 60 / 2;
439
+ } else {
440
+ padding = this.parent.rowHeight / 2;
441
+ }
442
+ cell.style.padding.top = padding - style.fontSize;
443
+ cell.style.padding.bottom = padding - style.fontSize;
444
+ cell.style.padding.left = 10;
445
+ cell.style.padding.right = 10;
446
+ }
447
+
448
+ /**
449
+ * @param {PdfDocument} pdfDoc .
450
+ * @returns {void} .
451
+ * @private
452
+ */
453
+ public initializePdf(pdfDoc: PdfDocument): void {
454
+ this.pdfDoc = pdfDoc;
455
+ const widths: number[] = [];
456
+ const treeColumnIndex: number = 0;
457
+ const tWidth: number = (this.pdfDoc.pageSettings.width - 82);
458
+ if (this.totalColumnWidth > (this.pdfDoc.pageSettings.width - 82)) {
459
+ this.gantt.style.allowHorizontalOverflow = true;
460
+ } else if ((tWidth / this.columns.length) < widths[treeColumnIndex]) {
461
+ this.gantt.columns.getColumn(treeColumnIndex).width = widths[treeColumnIndex];
462
+ }
463
+ if (this.exportProps.enableFooter || isNullOrUndefined(this.exportProps.enableFooter)) {
464
+ //code for draw the footer content
465
+ const bounds: RectangleF = new RectangleF(0, 0, pdfDoc.pageSettings.width, 35);
466
+ const pen: PdfPen = new PdfPen(this.ganttStyle.chartGridLineColor);
467
+ const footer: PdfPageTemplateElement = new PdfPageTemplateElement(bounds);
468
+ const footerBrush: PdfBrush = new PdfSolidBrush(this.ganttStyle.footer.backgroundColor);
469
+ footer.graphics.drawRectangle(pen, footerBrush, 0, 0, pdfDoc.pageSettings.width, 35);
470
+ /* eslint-disable-next-line */
471
+ const font: PdfFont = new PdfStandardFont(this.ganttStyle.fontFamily, this.ganttStyle.footer.fontSize, this.ganttStyle.footer.fontStyle);
472
+ const brush: PdfBrush = new PdfSolidBrush(this.ganttStyle.footer.fontColor);
473
+ const pageNumber: PdfPageNumberField = new PdfPageNumberField(font);
474
+ const count: PdfPageCountField = new PdfPageCountField(font, brush);
475
+ const compositeField: PdfCompositeField = new PdfCompositeField(font, brush, 'Page {0}', pageNumber, count);
476
+ compositeField.stringFormat = this.ganttStyle.footer.format;
477
+ compositeField.bounds = bounds;
478
+ compositeField.draw(footer.graphics, new PointF(0, 0));
479
+ pdfDoc.template.bottom = footer;
480
+ }
481
+ }
482
+ }
483
+ /**
484
+ * @hidden
485
+ * `ExportValueFormatter` for `PdfExport` & `ExcelExport`
486
+ */
487
+ export class ExportValueFormatter {
488
+ private internationalization: Internationalization;
489
+ private valueFormatter: ValueFormatter;
490
+ public constructor(culture: string) {
491
+ this.valueFormatter = new ValueFormatter(culture);
492
+ this.internationalization = new Internationalization(culture);
493
+ }
494
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
495
+ private returnFormattedValue(args: any, customFormat: DateFormatOptions): string {
496
+ if (!isNullOrUndefined(args.value) && args.value) {
497
+ return this.valueFormatter.getFormatFunction(customFormat)(args.value);
498
+ } else {
499
+ return '';
500
+ }
501
+ }
502
+ /**
503
+ * @private
504
+ */
505
+ /* eslint-disable-next-line */
506
+ public formatCellValue(args: any): string {
507
+ if (args.isForeignKey) {
508
+ args.value = getValue(args.column.foreignKeyValue, getForeignData(args.column, {}, args.value)[0]);
509
+ }
510
+ if (args.column.type === 'number' && args.column.format !== undefined && args.column.format !== '') {
511
+ return args.value ? this.internationalization.getNumberFormat({ format: args.column.format })(args.value) : '';
512
+ } else if (args.column.type === 'boolean') {
513
+ return args.value ? 'true' : 'false';
514
+ } else if ((args.column.type === 'date' || args.column.type === 'datetime' || args.column.type === 'time') && args.column.format !== undefined) {
515
+ if (typeof args.value === 'string') {
516
+ args.value = new Date(args.value);
517
+ }
518
+ if (typeof args.column.format === 'string') {
519
+ let format: DateFormatOptions;
520
+ if (args.column.type === 'date') {
521
+ format = { type: 'date', skeleton: args.column.format };
522
+ } else if (args.column.type === 'time') {
523
+ format = { type: 'time', skeleton: args.column.format };
524
+ } else {
525
+ format = { type: 'dateTime', skeleton: args.column.format };
526
+ }
527
+ return this.returnFormattedValue(args, format);
528
+ } else {
529
+ if (args.column.format instanceof Object && args.column.format.type === undefined) {
530
+ return (args.value.toString());
531
+ } else {
532
+ let customFormat: DateFormatOptions;
533
+ if (args.column.type === 'date') {
534
+ /* eslint-disable-next-line max-len */
535
+ customFormat = { type: args.column.format.type, format: args.column.format.format, skeleton: args.column.format.skeleton };
536
+ } else if (args.column.type === 'time') {
537
+ customFormat = { type: 'time', format: args.column.format.format, skeleton: args.column.format.skeleton };
538
+ } else {
539
+ customFormat = { type: 'dateTime', format: args.column.format.format, skeleton: args.column.format.skeleton };
540
+ }
541
+ return this.returnFormattedValue(args, customFormat);
542
+ }
543
+ }
544
+ } else {
545
+ if ((!isNullOrUndefined(args.column.type) && !isNullOrUndefined(args.value)) || !isNullOrUndefined(args.value)) {
546
+ return (args.value).toString();
547
+ } else {
548
+ return '';
549
+ }
550
+ }
551
+ }
552
+ }