@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,422 @@
1
+ import { PointF, PdfPage, PdfGraphics, PdfPen, PdfBrush, PdfSolidBrush, RectangleF, PdfColor, SizeF } from '@syncfusion/ej2-pdf-export';
2
+ import { IGanttStyle, PageDetail } from './../base/interface';
3
+ import { Gantt } from './../base/gantt';
4
+ import { pixelToPoint } from '../base/utils';
5
+ import { PdfGantt } from './pdf-gantt';
6
+ import { PdfGanttTaskbarCollection } from './pdf-taskbar';
7
+ import { isNullOrUndefined } from '@syncfusion/ej2-base';
8
+
9
+ /**
10
+ * @hidden
11
+ */
12
+ export class PdfGanttPredecessor {
13
+ public parentLeft?: number;
14
+ public childLeft?: number;
15
+ public parentWidth?: number;
16
+ public childWidth?: number;
17
+ public parentIndex?: number;
18
+ public childIndex?: number;
19
+ public rowHeight?: number;
20
+ public type?: string;
21
+ public milestoneParent?: boolean;
22
+ public milestoneChild?: boolean;
23
+ public lineWidth?: number;
24
+ public connectorLineColor?: PdfColor;
25
+ public pdfGantt?: PdfGantt;
26
+ public parent?: Gantt;
27
+ public ganttStyle: IGanttStyle;
28
+ /**
29
+ * @returns {PdfGanttPredecessor} .
30
+ * @hidden
31
+ */
32
+ public add(): PdfGanttPredecessor {
33
+ return new PdfGanttPredecessor(this.parent);
34
+ }
35
+ constructor(parent?: Gantt, pdfGantt?: PdfGantt) {
36
+ this.parent = parent;
37
+ this.pdfGantt = pdfGantt;
38
+ }
39
+ /**
40
+ * Calculate the predecesor line point and draw the predecessor
41
+ *
42
+ * @param {PdfGantt} pdfGantt .
43
+ * @returns {void}
44
+ * @private
45
+ */
46
+ public drawPredecessor(pdfGantt: PdfGantt): void {
47
+ this.pdfGantt = pdfGantt;
48
+ const pages: PdfPage[] = pdfGantt.result.page.section.getPages() as PdfPage[];
49
+ const parentTask: PdfGanttTaskbarCollection = pdfGantt.taskbarCollection[this.parentIndex];
50
+ const childTask: PdfGanttTaskbarCollection = pdfGantt.taskbarCollection[this.childIndex];
51
+ let startPage: PdfPage = new PdfPage();
52
+ let endPage: PdfPage = new PdfPage();
53
+ let predecessorType: string = '';
54
+ let parentPageData: PageDetail;
55
+ let childPageData: PageDetail;
56
+ let parentY: number = 0;
57
+ let childY: number = 0;
58
+ switch (this.type) {
59
+ case 'FS':
60
+ if (childTask.startPage > -1 && parentTask.endPage > -1) {
61
+ startPage = pages[parentTask.endPage];
62
+ endPage = pages[childTask.startPage];
63
+ parentPageData = pdfGantt.pdfPageDetail[parentTask.endPage - pdfGantt.chartPageIndex];
64
+ childPageData = pdfGantt.pdfPageDetail[childTask.startPage - pdfGantt.chartPageIndex];
65
+ if (this.parentIndex < this.childIndex) {
66
+ if (this.parentLeft < this.childLeft && this.childLeft > (this.parentLeft + this.parentWidth + 25)) {
67
+ predecessorType = 'FSType1';
68
+ } else {
69
+ predecessorType = 'FSType2';
70
+ }
71
+ } else {
72
+ if (this.parentLeft < this.childLeft && this.childLeft > (this.parentLeft + this.parentWidth + 25)) {
73
+ predecessorType = 'FSType3';
74
+ } else {
75
+ predecessorType = 'FSType4';
76
+ }
77
+ }
78
+ } else {
79
+ return;
80
+ }
81
+ break;
82
+ case 'SF':
83
+ if (childTask.endPage > -1 && parentTask.startPage > -1) {
84
+ startPage = pages[parentTask.startPage];
85
+ endPage = pages[childTask.endPage];
86
+ parentPageData = pdfGantt.pdfPageDetail[parentTask.endPage - pdfGantt.chartPageIndex];
87
+ childPageData = pdfGantt.pdfPageDetail[childTask.startPage - pdfGantt.chartPageIndex];
88
+ if (this.parentIndex < this.childIndex) {
89
+ if (this.parentLeft > this.childLeft + this.childWidth) {
90
+ predecessorType = 'SFType1';
91
+ } else {
92
+ predecessorType = 'SFType2';
93
+ }
94
+ } else {
95
+ if (this.parentLeft > this.childLeft + this.childWidth) {
96
+ predecessorType = 'SFType3';
97
+ } else {
98
+ predecessorType = 'SFType4';
99
+ }
100
+ }
101
+ } else {
102
+ return;
103
+ }
104
+ break;
105
+ case 'FF':
106
+ if (childTask.endPage > -1 && parentTask.endPage > -1) {
107
+ startPage = pages[parentTask.endPage];
108
+ endPage = pages[childTask.endPage];
109
+ parentPageData = pdfGantt.pdfPageDetail[parentTask.endPage - pdfGantt.chartPageIndex];
110
+ childPageData = pdfGantt.pdfPageDetail[childTask.endPage - pdfGantt.chartPageIndex];
111
+ if (this.parentIndex < this.childIndex) {
112
+ if ((this.childLeft + this.childWidth) >= (this.parentLeft + this.parentWidth)) {
113
+ predecessorType = 'FFType1';
114
+ } else {
115
+ predecessorType = 'FFType2';
116
+ }
117
+ } else {
118
+ if ((this.childLeft + this.childWidth) >= (this.parentLeft + this.parentWidth)) {
119
+ predecessorType = 'FFType3';
120
+ } else {
121
+ predecessorType = 'FFType4';
122
+ }
123
+ }
124
+ } else {
125
+ return;
126
+ }
127
+ break;
128
+ case 'SS':
129
+ if (childTask.startPage > -1 && parentTask.startPage > -1) {
130
+ startPage = pages[parentTask.startPage];
131
+ endPage = pages[childTask.startPage];
132
+ parentPageData = pdfGantt.pdfPageDetail[parentTask.startPage - pdfGantt.chartPageIndex];
133
+ childPageData = pdfGantt.pdfPageDetail[childTask.startPage - pdfGantt.chartPageIndex];
134
+ if (this.parentIndex < this.childIndex) {
135
+ if (this.parentLeft >= this.childLeft) {
136
+ predecessorType = 'SSType1';
137
+ } else {
138
+ predecessorType = 'SSType2';
139
+ }
140
+ } else {
141
+ if (this.parentLeft >= this.childLeft) {
142
+ predecessorType = 'SSType3';
143
+ } else {
144
+ predecessorType = 'SSType4';
145
+ }
146
+ }
147
+ } else {
148
+ return;
149
+ }
150
+ break;
151
+ }
152
+ let midPoint: number = Math.round((this.parent.rowHeight - 1) / 2.0);
153
+ midPoint = pixelToPoint(midPoint);
154
+ /* eslint-disable-next-line */
155
+ let point1, point2, point3, point4, point5, point6: PointF;
156
+ point1 = point2 = point3 = point4 = point5 = point6 = new PointF();
157
+ const parentTaskpoint: PointF = { ...parentTask.taskStartPoint };
158
+ const childTaskpoint: PointF = { ...childTask.taskStartPoint };
159
+ parentY = parentTaskpoint.y + parentPageData.startPoint.y;
160
+ childY = childTaskpoint.y + childPageData.startPoint.y;
161
+ const ffpoint1: PointF = new PointF(pixelToPoint(this.parentLeft + this.parentWidth), parentY + midPoint);
162
+ const sspoint1: PointF = new PointF(pixelToPoint(this.parentLeft) - 1, parentY + midPoint);
163
+ const ffpoint3: PointF = new PointF(pixelToPoint(this.childLeft - 20), childY + midPoint);
164
+ const ffpoint4: PointF = new PointF(pixelToPoint(this.childLeft - 6 - this.lineWidth) - 1, childY + midPoint);
165
+ const sspoint4: PointF = new PointF(pixelToPoint(this.childLeft + this.childWidth + 6 + this.lineWidth) + 1, childY + midPoint);
166
+ switch (predecessorType) {
167
+ case 'FSType1':
168
+ case 'FSType3':
169
+ point1 = ffpoint1;
170
+ point2 = new PointF(pixelToPoint(this.childLeft - 20), parentY + midPoint);
171
+ point3 = ffpoint3;
172
+ point4 = ffpoint4;
173
+ this.connectLines(startPage, endPage, point1, point2, point3, point4, childTask, midPoint); break;
174
+ case 'FSType2':
175
+ point1 = ffpoint1;
176
+ point2 = new PointF(point1.x + 10, parentY + midPoint);
177
+ point3 = new PointF(point1.x + 10, childY + 2);
178
+ point4 = new PointF(pixelToPoint(this.childLeft - 20), childY + 2);
179
+ point5 = ffpoint3;
180
+ point6 = ffpoint4;
181
+ this.connectLines(startPage, endPage, point1, point2, point3, point4, childTask, midPoint, point5, point6);
182
+ break;
183
+ case 'FSType4':
184
+ point1 = ffpoint1;
185
+ point2 = new PointF(point1.x + 10, parentY + midPoint);
186
+ point3 = new PointF(point1.x + 10, parentY + 2);
187
+ point4 = new PointF(pixelToPoint(this.childLeft - 20), parentY + 2);
188
+ point5 = ffpoint3;
189
+ point6 = ffpoint4;
190
+ this.connectLines(startPage, endPage, point1, point2, point3, point4, childTask, midPoint, point5, point6);
191
+ break;
192
+ case 'FFType1':
193
+ case 'FFType3':
194
+ point1 = new PointF(pixelToPoint(this.parentLeft + this.parentWidth) + 1, parentY + midPoint);
195
+ point2 = new PointF(pixelToPoint(this.childLeft + this.childWidth + 20), parentY + midPoint);
196
+ point3 = new PointF(point2.x, childY + midPoint);
197
+ point4 = sspoint4;
198
+ this.connectLines(startPage, endPage, point1, point2, point3, point4, childTask, midPoint);
199
+ break;
200
+ case 'FFType2':
201
+ case 'FFType4':
202
+ point1 = new PointF(pixelToPoint(this.parentLeft + this.parentWidth) + 1, parentY + midPoint);
203
+ point2 = new PointF(pixelToPoint(this.parentLeft + this.parentWidth + 20), parentY + midPoint);
204
+ point3 = new PointF(point2.x, childY + midPoint);
205
+ point4 = sspoint4;
206
+ this.connectLines(startPage, endPage, point1, point2, point3, point4, childTask, midPoint);
207
+ break;
208
+ case 'SSType1':
209
+ case 'SSType3':
210
+ point1 = sspoint1;
211
+ point2 = new PointF(pixelToPoint(this.childLeft - 20), parentY + midPoint);
212
+ point3 = new PointF(point2.x, childY + midPoint);
213
+ point4 = ffpoint4;
214
+ this.connectLines(startPage, endPage, point1, point2, point3, point4, childTask, midPoint);
215
+ break;
216
+ case 'SSType2':
217
+ case 'SSType4':
218
+ point1 = sspoint1;
219
+ point2 = new PointF(pixelToPoint(this.parentLeft - 20), parentY + midPoint);
220
+ point3 = new PointF(point2.x, childY + midPoint);
221
+ point4 = ffpoint4;
222
+ this.connectLines(startPage, endPage, point1, point2, point3, point4, childTask, midPoint);
223
+ break;
224
+ case 'SFType1':
225
+ case 'SFType3':
226
+ point1 = sspoint1;
227
+ point2 = new PointF(pixelToPoint(this.childLeft + this.childWidth + 20), parentY + midPoint);
228
+ point3 = new PointF(point2.x, childY + midPoint);
229
+ point4 = sspoint4;
230
+ this.connectLines(startPage, endPage, point1, point2, point3, point4, childTask, midPoint);
231
+ break;
232
+ case 'SFType2':
233
+ point1 = sspoint1;
234
+ point2 = new PointF(pixelToPoint(this.parentLeft - 20), parentY + midPoint);
235
+ point3 = new PointF(point2.x, childY + 2);
236
+ point4 = new PointF(pixelToPoint(this.childLeft + this.childWidth + 20), childY + 2);
237
+ point5 = new PointF(point4.x, childY + midPoint);
238
+ point6 = sspoint4;
239
+ this.connectLines(startPage, endPage, point1, point2, point3, point4, childTask, midPoint, point5, point6);
240
+ break;
241
+ case 'SFType4':
242
+ point1 = sspoint1;
243
+ point2 = new PointF(pixelToPoint(this.parentLeft - 20), parentY + midPoint);
244
+ point3 = new PointF(point2.x, parentY + 2);
245
+ point4 = new PointF(pixelToPoint(this.childLeft + this.childWidth + 20), parentY + 2);
246
+ point5 = new PointF(point4.x, childY + midPoint);
247
+ point6 = sspoint4;
248
+ this.connectLines(startPage, endPage, point1, point2, point3, point4, childTask, midPoint, point5, point6);
249
+ break;
250
+ }
251
+ }
252
+ /**
253
+ * Method to draw the predecessor lines with calculated connector points
254
+ *
255
+ * @private
256
+ */
257
+ /* eslint-disable-next-line */
258
+ private connectLines(startPage: PdfPage, endPage: PdfPage, point1: PointF, point2: PointF, point3: PointF, point4: PointF, childTask: PdfGanttTaskbarCollection, midPoint: number, point5?: PointF, point6?: PointF): void {
259
+ this.drawLine(startPage, point1, point2);
260
+ this.drawLine(startPage, point2, point3);
261
+ this.drawLine(startPage, point3, point4);
262
+ if (!isNullOrUndefined(point5) && !isNullOrUndefined(point6)) {
263
+ this.drawLine(startPage, point4, point5);
264
+ this.drawLine(startPage, point5, point6);
265
+ }
266
+ this.drawArrow(endPage, childTask, midPoint);
267
+ }
268
+ /**
269
+ * Method to check the predecessor line occurs within the page
270
+ *
271
+ * @param {RectangleF} rect .
272
+ * @param {number} x .
273
+ * @param {number} y .
274
+ * @returns {boolean} .
275
+ * @private
276
+ */
277
+ private contains(rect: RectangleF, x: number, y: number): boolean {
278
+ return rect.x <= x &&
279
+ x < rect.x + rect.width &&
280
+ rect.y <= y &&
281
+ y < rect.y + rect.height;
282
+ }
283
+ /**
284
+ * Find the PDF page index of given point
285
+ *
286
+ * @param {PointF} point .
287
+ * @returns {number} .
288
+ * @private
289
+ */
290
+ private findPageIndex(point: PointF): number {
291
+ let pageIndex: number = -1;
292
+ for (let index: number = 0; index < this.pdfGantt.pdfPageDetail.length; index++) {
293
+ const pageData: PageDetail = this.pdfGantt.pdfPageDetail[index];
294
+ const pageRect: RectangleF = new RectangleF(pageData.startPoint.x, pageData.startPoint.y, pageData.width, pageData.height);
295
+ if (this.contains(pageRect, point.x, point.y)) {
296
+ pageIndex = index;
297
+ break;
298
+ }
299
+ }
300
+ return pageIndex;
301
+ }
302
+ /**
303
+ * Draw predecessor line
304
+ *
305
+ * @param {PdfPage} page .
306
+ * @param {PointF} startPoint .
307
+ * @param {PointF} endPoint .
308
+ * @returns {void} .
309
+ * @private
310
+ */
311
+ private drawLine(page: PdfPage, startPoint: PointF, endPoint: PointF): void {
312
+ const pdfPages: PdfPage[] = this.pdfGantt.result.page.section.getPages() as PdfPage[];
313
+ const graphics: PdfGraphics = page.graphics;
314
+ let newEndPoint: PointF = { ...endPoint };
315
+ let newStartPoint: PointF = { ...endPoint };
316
+ const checkStartPoint: PointF = { ...endPoint };
317
+ let pageData: PageDetail = this.pdfGantt.pdfPageDetail[page.section.indexOf(page) - this.pdfGantt.chartPageIndex];
318
+ const pageRect: RectangleF = new RectangleF(pageData.startPoint.x, pageData.startPoint.y, pageData.width, pageData.height);
319
+ const startPointCheck: boolean = this.contains(pageRect, startPoint.x, startPoint.y);
320
+ const endPointCheck: boolean = this.contains(pageRect, endPoint.x, endPoint.y);
321
+ let pageIndex: number = -1;
322
+ startPoint = new PointF(startPoint.x, startPoint.y);
323
+ endPoint = new PointF(endPoint.x, endPoint.y);
324
+ if (!startPointCheck && !endPointCheck || endPointCheck && !startPointCheck) {
325
+ pageIndex = this.findPageIndex(startPoint);
326
+ if (pageIndex > -1) {
327
+ pageData = this.pdfGantt.pdfPageDetail[pageIndex];
328
+ newStartPoint = startPoint;
329
+ newEndPoint = endPoint;
330
+ this.drawLine(pdfPages[pageIndex + this.pdfGantt.chartPageIndex], newStartPoint, newEndPoint);
331
+ }
332
+ } else if (!endPointCheck && startPointCheck) {
333
+ const pageRectLeft: number = pageRect.x;
334
+ const pageRectRight: number = pageRect.x + pageRect.width;
335
+ const pageRectBottom: number = pageRect.y + pageRect.height;
336
+ const pageRectTop: number = pageRect.y;
337
+ if (pageRectLeft > endPoint.x) {
338
+ checkStartPoint.x = endPoint.x = pageRectLeft - 1;
339
+ newStartPoint.x = pageRectLeft - 1;
340
+ } else if (pageRectRight < endPoint.x) {
341
+ checkStartPoint.x = endPoint.x = pageRectRight;
342
+ newStartPoint.x = pageRectRight;
343
+ checkStartPoint.x += 1;
344
+ } else if (pageRectBottom < endPoint.y) {
345
+ checkStartPoint.y = endPoint.y = pageRectBottom;
346
+ newStartPoint.y = pageRectBottom;
347
+ checkStartPoint.y += 1;
348
+ if (this.pdfGantt.enableHeader) {
349
+ newStartPoint.y += this.parent.timelineModule.isSingleTier ? pixelToPoint(45) : pixelToPoint(62);
350
+ }
351
+ } else if (pageRectTop > endPoint.y) {
352
+ newStartPoint.y = checkStartPoint.y = pageRectTop - 1;
353
+ endPoint.y = pageRectTop;
354
+ if (this.pdfGantt.enableHeader) {
355
+ checkStartPoint.y += this.parent.timelineModule.isSingleTier ? pixelToPoint(45) : pixelToPoint(62);
356
+ endPoint.y += this.parent.timelineModule.isSingleTier ? pixelToPoint(45) : pixelToPoint(62);
357
+ }
358
+ }
359
+ pageIndex = this.findPageIndex(checkStartPoint);
360
+ if (pageIndex !== -1) {
361
+ this.drawLine(pdfPages[pageIndex + this.pdfGantt.chartPageIndex], newStartPoint, newEndPoint);
362
+ }
363
+ }
364
+ if (startPointCheck) {
365
+ startPoint = new PointF(startPoint.x, startPoint.y);
366
+ endPoint = new PointF(endPoint.x, endPoint.y);
367
+ startPoint.x = startPoint.x + pageData.pageStartX - pageData.startPoint.x;
368
+ startPoint.y = startPoint.y - pageData.startPoint.y;
369
+ endPoint.x = endPoint.x + pageData.pageStartX - pageData.startPoint.x;
370
+ endPoint.y = endPoint.y - pageData.startPoint.y;
371
+ const brush: PdfBrush = new PdfSolidBrush(this.connectorLineColor);
372
+ const predecessorPen: PdfPen = new PdfPen(brush, pixelToPoint(this.lineWidth));
373
+ graphics.drawLine(predecessorPen, startPoint, endPoint);
374
+ }
375
+ }
376
+ /**
377
+ * Draw predecessor arrow
378
+ *
379
+ * @param {PdfPage} page .
380
+ * @param {PdfGanttTaskbarCollection} childTask .
381
+ * @param {number} midPoint .
382
+ * @returns {void} .
383
+ * @private
384
+ */
385
+ private drawArrow(page: PdfPage, childTask: PdfGanttTaskbarCollection, midPoint: number): void {
386
+ let pageData: PageDetail = this.pdfGantt.pdfPageDetail[page.section.indexOf(page) - this.pdfGantt.chartPageIndex];
387
+ /* eslint-disable-next-line */
388
+ const pageRect: RectangleF = new RectangleF(new PointF(pageData.startPoint.x, pageData.startPoint.y), new SizeF(pageData.width, pageData.height));
389
+ let startPoint: PointF = new PointF();
390
+ const pdfPages: PdfPage[] = page.section.getPages() as PdfPage[];
391
+ const width: number = 6 + this.lineWidth;
392
+ let point2: PointF;
393
+ if (this.type === 'FS' || this.type === 'SS') {
394
+ startPoint = new PointF(pixelToPoint(this.childLeft) - 1, childTask.taskStartPoint.y + pageData.startPoint.y);
395
+ } else {
396
+ startPoint = new PointF(pixelToPoint(this.childLeft + this.childWidth) + 1, childTask.taskStartPoint.y + pageData.startPoint.y);
397
+ }
398
+ const startPointCheck: boolean = this.contains(pageRect, startPoint.x, startPoint.y);
399
+ if (!startPointCheck) {
400
+ const pageIndex: number = this.findPageIndex(startPoint);
401
+ if (pageIndex > -1) {
402
+ pageData = this.pdfGantt.pdfPageDetail[pageIndex];
403
+ page = pdfPages[pageIndex + this.pdfGantt.chartPageIndex];
404
+ }
405
+ }
406
+ const graphics: PdfGraphics = page.graphics;
407
+ startPoint.x = startPoint.x - pageData.startPoint.x + pageData.pageStartX;
408
+ startPoint.y = startPoint.y - pageData.startPoint.y;
409
+ const point1: PointF = new PointF(startPoint.x, startPoint.y + midPoint);
410
+ if (this.type === 'FS' || this.type === 'SS') {
411
+ point2 = new PointF(point1.x - pixelToPoint(width), point1.y - pixelToPoint(width));
412
+ } else {
413
+ point2 = new PointF(point1.x + pixelToPoint(width), point1.y - pixelToPoint(width));
414
+ }
415
+ const point3: PointF = new PointF(point2.x, point2.y + pixelToPoint(2 * width));
416
+ const brush: PdfBrush = new PdfSolidBrush(this.connectorLineColor);
417
+ const predecessorPen: PdfPen = new PdfPen(brush, pixelToPoint(this.lineWidth));
418
+ graphics.drawLine(predecessorPen, point1, point2);
419
+ graphics.drawLine(predecessorPen, point2, point3);
420
+ graphics.drawLine(predecessorPen, point3, point1);
421
+ }
422
+ }