@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,228 @@
1
+ import { Gantt } from '../base/gantt';
2
+ import { getValue, Internationalization, isNullOrUndefined } from '@syncfusion/ej2-base';
3
+ import { Tooltip, TooltipEventArgs } from '@syncfusion/ej2-popups';
4
+ import { BeforeTooltipRenderEventArgs, ITaskData } from '../base/interface';
5
+ import { TaskbarEdit } from '../actions/taskbar-edit';
6
+ import * as cls from '../base/css-constants';
7
+ /**
8
+ * File for handling taskbar editing tooltip in Gantt.
9
+ */
10
+ export class EditTooltip {
11
+ public parent: Gantt;
12
+ public toolTipObj: Tooltip;
13
+ public taskbarTooltipContainer: HTMLElement;
14
+ public taskbarTooltipDiv: HTMLElement;
15
+ private taskbarEdit: TaskbarEdit;
16
+ constructor(gantt: Gantt, taskbarEdit: TaskbarEdit) {
17
+ this.parent = gantt;
18
+ this.taskbarEdit = taskbarEdit;
19
+ }
20
+
21
+ /**
22
+ * To create tooltip.
23
+ *
24
+ * @param {string} opensOn .
25
+ * @param {boolean} mouseTrail .
26
+ * @param {string} target .
27
+ * @returns {void}
28
+ * @private
29
+ */
30
+ public createTooltip(opensOn: string, mouseTrail: boolean, target?: string): void {
31
+ this.toolTipObj = new Tooltip(
32
+ {
33
+ opensOn: opensOn,
34
+ position: 'TopRight',
35
+ mouseTrail: mouseTrail,
36
+ cssClass: cls.ganttTooltip,
37
+ target: target ? target : null,
38
+ animation: { open: { effect: 'None' }, close: { effect: 'None' } }
39
+ }
40
+ );
41
+ this.toolTipObj.beforeRender = (args: TooltipEventArgs) => {
42
+ const argsData: BeforeTooltipRenderEventArgs = {
43
+ data: this.taskbarEdit.taskBarEditRecord,
44
+ args: args,
45
+ content: this.toolTipObj.content
46
+ };
47
+ this.parent.trigger('beforeTooltipRender', argsData);
48
+ };
49
+ this.toolTipObj.afterOpen = (args: TooltipEventArgs) => {
50
+ this.updateTooltipPosition(args);
51
+ };
52
+ this.toolTipObj.isStringTemplate = true;
53
+ this.toolTipObj.appendTo(this.parent.chartPane);
54
+ }
55
+
56
+ /**
57
+ * Method to update tooltip position
58
+ *
59
+ * @param {TooltipEventArgs} args .
60
+ * @returns {void} .
61
+ */
62
+ private updateTooltipPosition(args: TooltipEventArgs): void {
63
+ const containerPosition: { top: number, left: number } = this.parent.getOffsetRect(this.parent.chartPane);
64
+ const leftEnd: number = containerPosition.left + this.parent.chartPane.offsetWidth;
65
+ let tooltipPositionX: number = args.element.offsetLeft;
66
+ if (leftEnd < (tooltipPositionX + args.element.offsetWidth)) {
67
+ tooltipPositionX += leftEnd - (tooltipPositionX + args.element.offsetWidth);
68
+ }
69
+ args.element.style.left = tooltipPositionX + 'px';
70
+ args.element.style.visibility = 'visible';
71
+ }
72
+ /**
73
+ * To show/hide taskbar edit tooltip.
74
+ *
75
+ * @param {boolean} bool .
76
+ * @param {number} segmentIndex .
77
+ * @returns {void}
78
+ * @private
79
+ */
80
+ public showHideTaskbarEditTooltip(bool: boolean, segmentIndex: number): void {
81
+ if (bool && this.parent.tooltipSettings.showTooltip) {
82
+ this.createTooltip('Custom', false);
83
+ this.parent.tooltipModule.toolTipObj.close();
84
+ this.updateTooltip(segmentIndex);
85
+ if (this.taskbarEdit.connectorSecondAction === 'ConnectorPointLeftDrag') {
86
+ this.toolTipObj.open(
87
+ this.taskbarEdit.connectorSecondElement.querySelector('.' + cls.connectorPointLeft));
88
+ } else if (this.taskbarEdit.connectorSecondAction === 'ConnectorPointRightDrag') {
89
+ this.toolTipObj.open(
90
+ this.taskbarEdit.connectorSecondElement.querySelector('.' + cls.connectorPointRight));
91
+ } else {
92
+ this.toolTipObj.open(this.taskbarEdit.taskBarEditElement);
93
+ }
94
+ } else if (!isNullOrUndefined(this.toolTipObj)) {
95
+ this.toolTipObj.destroy();
96
+ this.toolTipObj = null;
97
+ }
98
+ }
99
+
100
+ /**
101
+ * To update tooltip content and position.
102
+ *
103
+ * @param {number} segmentIndex .
104
+ * @returns {void} .
105
+ * @private
106
+ */
107
+ public updateTooltip(segmentIndex: number): void {
108
+ const ganttProp: ITaskData = this.taskbarEdit.taskBarEditRecord.ganttProperties;
109
+ const taskWidth: number = segmentIndex === -1 ? ganttProp.width :
110
+ ganttProp.segments[segmentIndex].width;
111
+
112
+ const progressWidth: number = segmentIndex === -1 ? ganttProp.progressWidth :
113
+ ganttProp.segments[segmentIndex].progressWidth;
114
+
115
+ const left: number = segmentIndex === -1 ? ganttProp.left : ganttProp.left + ganttProp.segments[segmentIndex].left;
116
+
117
+ if (!isNullOrUndefined(this.toolTipObj)) {
118
+ if (this.taskbarEdit.taskBarEditAction === 'ConnectorPointLeftDrag' ||
119
+ this.taskbarEdit.taskBarEditAction === 'ConnectorPointRightDrag') {
120
+ this.toolTipObj.content = this.getTooltipText(segmentIndex);
121
+ this.toolTipObj.offsetY = -3;
122
+ } else {
123
+ this.toolTipObj.content = this.getTooltipText(segmentIndex);
124
+ this.toolTipObj.refresh(this.taskbarEdit.taskBarEditElement);
125
+ if (this.taskbarEdit.taskBarEditAction === 'LeftResizing') {
126
+ this.toolTipObj.offsetX = -taskWidth;
127
+ } else if (this.taskbarEdit.taskBarEditAction === 'RightResizing' ||
128
+ this.taskbarEdit.taskBarEditAction === 'ParentResizing') {
129
+ this.toolTipObj.offsetX = 0;
130
+ } else if (this.taskbarEdit.taskBarEditAction === 'ProgressResizing') {
131
+ this.toolTipObj.offsetX = -(taskWidth - progressWidth);
132
+ } else if (this.taskbarEdit.taskBarEditAction === 'MilestoneDrag') {
133
+ this.toolTipObj.offsetX = -(this.parent.chartRowsModule.milestoneHeight / 2);
134
+ } else if (taskWidth > 5) {
135
+ this.toolTipObj.offsetX = -(taskWidth + left - this.taskbarEdit.tooltipPositionX);
136
+ }
137
+ }
138
+ }
139
+ }
140
+
141
+ /**
142
+ * To get updated tooltip text.
143
+ *
144
+ * @param {number} segmentIndex .
145
+ * @returns {void} .
146
+ * @private
147
+ */
148
+ private getTooltipText(segmentIndex: number): string | HTMLElement {
149
+ let tooltipString: string | HTMLElement = '';
150
+ const instance: Internationalization = this.parent.globalize;
151
+ let editRecord: ITaskData = this.taskbarEdit.taskBarEditRecord.ganttProperties as ITaskData;
152
+ if (!isNullOrUndefined(editRecord.segments) && editRecord.segments.length > 0 && segmentIndex !== -1
153
+ && this.taskbarEdit.taskBarEditAction !== 'ProgressResizing') {
154
+ editRecord = editRecord.segments[segmentIndex];
155
+ }
156
+ if (this.parent.tooltipSettings.editing) {
157
+ const templateNode: NodeList = this.parent.tooltipModule.templateCompiler(
158
+ this.parent.tooltipSettings.editing, this.parent, this.taskbarEdit.taskBarEditRecord, 'TooltipEditingTemplate');
159
+ if (getValue('tooltipEle', this.toolTipObj)) {
160
+ this.parent.renderTemplates();
161
+ }
162
+ tooltipString = (templateNode[0] as HTMLElement);
163
+ } else {
164
+ let startDate: string;
165
+ let endDate: string;
166
+ let duration: string;
167
+ if (!isNullOrUndefined(editRecord.startDate)) {
168
+ startDate = '<tr><td class = "e-gantt-tooltip-label">' + this.parent.localeObj.getConstant('startDate') +
169
+ '</td><td>:</td><td class = "e-gantt-tooltip-value">' +
170
+ instance.formatDate(editRecord.startDate, { format: this.parent.getDateFormat() }) + '</td></tr>';
171
+ }
172
+ if (!isNullOrUndefined(editRecord.endDate)) {
173
+ endDate = '<tr><td class = "e-gantt-tooltip-label">' + this.parent.localeObj.getConstant('endDate') +
174
+ '</td><td>:</td><td class = "e-gantt-tooltip-value">' +
175
+ instance.formatDate(editRecord.endDate, { format: this.parent.getDateFormat() }) + '</td></tr>';
176
+ }
177
+ if (!isNullOrUndefined(editRecord.duration)) {
178
+ duration = '<tr><td class = "e-gantt-tooltip-label">' + this.parent.localeObj.getConstant('duration') +
179
+ '</td><td>:</td><td class = "e-gantt-tooltip-value">' +
180
+ this.parent.getDurationString(editRecord.duration, (editRecord as ITaskData).durationUnit) + '</td></tr>';
181
+ }
182
+ switch (this.taskbarEdit.taskBarEditAction) {
183
+ case 'ProgressResizing':
184
+ const progress: string = '<tr><td class = "e-gantt-tooltip-label">' + this.parent.localeObj.getConstant('progress') +
185
+ '</td><td>:</td><td class = "e-gantt-tooltip-value">' + (editRecord as ITaskData).progress + '</td></tr>';
186
+ tooltipString = '<table class = "e-gantt-tooltiptable"><tbody>' +
187
+ progress + '</tbody></table>';
188
+
189
+ break;
190
+ case 'LeftResizing':
191
+ tooltipString = '<table class = "e-gantt-tooltiptable"><tbody>' +
192
+ startDate + duration + '</tbody></table>';
193
+ break;
194
+ case 'RightResizing':
195
+ case 'ParentResizing':
196
+ tooltipString = '<table class = "e-gantt-tooltiptable"><tbody>' +
197
+ endDate + duration + '</tbody></table>';
198
+ break;
199
+ case 'ChildDrag':
200
+ case 'ParentDrag':
201
+ case 'MilestoneDrag':
202
+ case 'ManualParentDrag':
203
+ let sDate: string = ''; let eDate: string = '';
204
+ if (!isNullOrUndefined(this.taskbarEdit.taskBarEditRecord.ganttProperties.startDate)) {
205
+ sDate = startDate;
206
+ }
207
+ if (!isNullOrUndefined(this.taskbarEdit.taskBarEditRecord.ganttProperties.endDate)) {
208
+ eDate = endDate;
209
+ }
210
+ tooltipString = '<table class = "e-gantt-tooltiptable"><tbody>' + sDate + eDate + '</tbody></table>';
211
+ break;
212
+ case 'ConnectorPointLeftDrag':
213
+ case 'ConnectorPointRightDrag':
214
+ tooltipString = this.parent.connectorLineModule.tooltipTable;
215
+ if (isNullOrUndefined(this.toolTipObj)) {
216
+ this.parent.connectorLineModule.tooltipTable.innerHTML =
217
+ this.parent.connectorLineModule.getConnectorLineTooltipInnerTd(
218
+ this.parent.editModule.taskbarEditModule.taskBarEditRecord.ganttProperties.taskName,
219
+ this.parent.editModule.taskbarEditModule.fromPredecessorText, '', ''
220
+ );
221
+ }
222
+ break;
223
+ }
224
+ }
225
+ return tooltipString;
226
+ }
227
+
228
+ }
@@ -0,0 +1,96 @@
1
+ /**
2
+ * To render and update event markers in Gantt
3
+ */
4
+ import { Gantt } from '../base/gantt';
5
+ import { createElement, formatUnit, remove, isNullOrUndefined } from '@syncfusion/ej2-base';
6
+ import * as cls from '../base/css-constants';
7
+ export class EventMarker {
8
+ public parent: Gantt;
9
+ public eventMarkersContainer: HTMLElement;
10
+ constructor(gantt: Gantt) {
11
+ this.parent = gantt;
12
+ this.eventMarkersContainer = null;
13
+ }
14
+ /**
15
+ * @returns {void} .
16
+ * @private
17
+ */
18
+ public renderEventMarkers(): void {
19
+ if (this.parent.eventMarkers && this.parent.eventMarkers.length > 0) {
20
+ if (!this.parent.ganttChartModule.chartBodyContent.contains(this.eventMarkersContainer)) {
21
+ this.eventMarkersContainer = createElement('div', {
22
+ className: cls.eventMarkersContainer
23
+ });
24
+ this.eventMarkersContainer.setAttribute("role", "EventMarker");
25
+ this.parent.ganttChartModule.chartBodyContent.appendChild(this.eventMarkersContainer);
26
+ }
27
+ this.eventMarkersContainer.innerHTML = '';
28
+ this.getEventMarkersElements(this.eventMarkersContainer);
29
+ } else {
30
+ this.removeContainer();
31
+ }
32
+ }
33
+ /**
34
+ * @returns {void} .
35
+ * @private
36
+ */
37
+ public removeContainer(): void {
38
+ if (this.eventMarkersContainer) {
39
+ remove(this.eventMarkersContainer);
40
+ this.eventMarkersContainer = null;
41
+ }
42
+ }
43
+ /**
44
+ * Method to get event markers as html string
45
+ *
46
+ * @param {HTMLElement} container .
47
+ * @returns {void} .
48
+ */
49
+ private getEventMarkersElements(container: HTMLElement): void {
50
+ let left: number;
51
+ let eventMarkerElement: HTMLElement;
52
+ let spanElement: HTMLElement;
53
+ let rightArrow: HTMLElement;
54
+
55
+ for (let i: number = 0; i < this.parent.eventMarkers.length; i++) {
56
+ left = this.parent.dataOperation.getTaskLeft(
57
+ this.parent.dateValidationModule.getDateFromFormat(this.parent.eventMarkers[i].day, true), false);
58
+ eventMarkerElement = createElement('div', {
59
+ className: cls.eventMarkersChild, styles: `left:${left}px; height:100%;`,
60
+ id: 'stripline' + i
61
+ });
62
+ if (this.parent.eventMarkers[i].label) {
63
+ spanElement = createElement('div', {
64
+ className: cls.eventMarkersSpan
65
+ });
66
+ const property: string = this.parent.disableHtmlEncode ? 'textContent' : 'innerHTML';
67
+ spanElement[property] = this.parent.eventMarkers[i].label;
68
+ eventMarkerElement.appendChild(spanElement);
69
+ rightArrow = createElement('div', {
70
+ className: 'e-gantt-right-arrow'
71
+ });
72
+ eventMarkerElement.appendChild(rightArrow);
73
+ }
74
+ if (this.parent.eventMarkers[i].cssClass) {
75
+ eventMarkerElement.classList.add(this.parent.eventMarkers[i].cssClass);
76
+ }
77
+ eventMarkerElement.setAttribute('tabindex', '-1');
78
+ if (!isNullOrUndefined(this.parent.eventMarkers[i].day)) {
79
+ eventMarkerElement.setAttribute('aria-label', this.parent.localeObj.getConstant('eventMarkers') + ' '
80
+ + (typeof this.parent.eventMarkers[i].day === 'string' ?
81
+ this.parent.eventMarkers[i].day : this.parent.getFormatedDate(this.parent.eventMarkers[i].day as Date))
82
+ + ' ' + this.parent.eventMarkers[i].label);
83
+ }
84
+ container.appendChild(eventMarkerElement);
85
+ }
86
+ }
87
+ /**
88
+ * @returns {void} .
89
+ * @private
90
+ */
91
+ public updateContainerHeight(): void {
92
+ if (this.eventMarkersContainer) {
93
+ this.eventMarkersContainer.style.height = formatUnit(this.parent.getContentHeight());
94
+ }
95
+ }
96
+ }
@@ -0,0 +1,205 @@
1
+ /**
2
+ * To render holidays and weekends in Gantt
3
+ */
4
+ import { Gantt } from '../base/gantt';
5
+ import { createElement, formatUnit, remove, isNullOrUndefined } from '@syncfusion/ej2-base';
6
+ import * as cls from '../base/css-constants';
7
+
8
+ export class NonWorkingDay {
9
+ private parent: Gantt;
10
+ public nonworkingContainer: HTMLElement;
11
+ private holidayContainer: HTMLElement;
12
+ private weekendContainer: HTMLElement;
13
+ constructor(gantt: Gantt) {
14
+ this.parent = gantt;
15
+ this.nonworkingContainer = null;
16
+ this.holidayContainer = null;
17
+ this.weekendContainer = null;
18
+ }
19
+ /**
20
+ * Method append nonworking container
21
+ *
22
+ * @returns {void} .
23
+ */
24
+ private createNonworkingContainer(): void {
25
+ if (!this.parent.ganttChartModule.chartBodyContent.contains(this.nonworkingContainer)) {
26
+ this.nonworkingContainer = createElement('div', {
27
+ className: cls.nonworkingContainer
28
+ });
29
+ this.nonworkingContainer.setAttribute("role","NonWorkingDays")
30
+ this.parent.ganttChartModule.chartBodyContent.appendChild(this.nonworkingContainer);
31
+ }
32
+ }
33
+ /**
34
+ * calculation for holidays rendering.
35
+ *
36
+ * @returns {void} .
37
+ * @private
38
+ */
39
+ public renderHolidays(): void {
40
+ if (this.parent.holidays && this.parent.holidays.length > 0) {
41
+ this.createNonworkingContainer();
42
+ if (!this.nonworkingContainer.contains(this.holidayContainer)) {
43
+ this.holidayContainer = createElement('div', {
44
+ className: cls.holidayContainer
45
+ });
46
+ this.nonworkingContainer.appendChild(this.holidayContainer);
47
+ }
48
+ this.holidayContainer.innerHTML = this.getHolidaysElement().innerHTML;
49
+ } else if (this.holidayContainer && this.holidayContainer.parentNode) {
50
+ remove(this.holidayContainer);
51
+ if (this.nonworkingContainer && this.nonworkingContainer.childNodes.length === 0) {
52
+ remove(this.nonworkingContainer);
53
+ }
54
+ }
55
+ }
56
+ /**
57
+ * Method to return holidays as html string
58
+ *
59
+ * @returns {HTMLElement} .
60
+ */
61
+ private getHolidaysElement(): HTMLElement {
62
+ let fromDate: Date;
63
+ let toDate: Date;
64
+ const container: HTMLElement = createElement('div');
65
+ const height: number = this.parent.contentHeight;
66
+ let toolbarHeight: number = 0;
67
+ if(!isNullOrUndefined(this.parent.toolbarModule)) {
68
+ toolbarHeight = this.parent.toolbarModule.element.offsetHeight
69
+ }
70
+ const viewportHeight: number = this.parent.ganttHeight- toolbarHeight-this.parent.ganttChartModule.chartTimelineContainer.offsetHeight;
71
+ for (let i: number = 0; i < this.parent.holidays.length; i++) {
72
+ if (this.parent.holidays[i].from && this.parent.holidays[i].to) {
73
+ fromDate = this.parent.dateValidationModule.getDateFromFormat(this.parent.holidays[i].from);
74
+ toDate = this.parent.dateValidationModule.getDateFromFormat(this.parent.holidays[i].to);
75
+ toDate.setDate(toDate.getDate() + 1);
76
+ fromDate.setHours(0, 0, 0, 0);
77
+ toDate.setHours(0, 0, 0, 0);
78
+ } else if (this.parent.holidays[i].from) {
79
+ fromDate = this.parent.dateValidationModule.getDateFromFormat(this.parent.holidays[i].from);
80
+ fromDate.setHours(0, 0, 0, 0);
81
+ } else if (this.parent.holidays[i].to) {
82
+ fromDate = this.parent.dateValidationModule.getDateFromFormat(this.parent.holidays[i].to);
83
+ fromDate.setHours(0, 0, 0, 0);
84
+ }
85
+ const width: number = (this.parent.holidays[i].from && this.parent.holidays[i].to) ?
86
+ this.parent.dataOperation.getTaskWidth(fromDate, toDate) : this.parent.perDayWidth;
87
+ const left: number = this.parent.dataOperation.getTaskLeft(fromDate, false);
88
+ const holidayDiv: HTMLElement = createElement('div', {
89
+ className: cls.holidayElement, styles: `left:${left}px; width:${width}px; height:100%;`
90
+ });
91
+ const spanTop: number = (viewportHeight < height) ? viewportHeight / 2 : height / 2;
92
+ const spanElement: HTMLElement = createElement('span', {
93
+ className: cls.holidayLabel, styles: `top:${spanTop}px;left:${(width / 2)}px;`
94
+ });
95
+ const property: string = this.parent.disableHtmlEncode ? 'textContent' : 'innerHTML';
96
+ spanElement[property] = this.parent.holidays[i].label ? this.parent.holidays[i].label : '';
97
+ holidayDiv.appendChild(spanElement);
98
+ if (this.parent.holidays[i].cssClass) {
99
+ holidayDiv.classList.add(this.parent.holidays[i].cssClass);
100
+ }
101
+ container.appendChild(holidayDiv);
102
+ }
103
+ return container;
104
+ }
105
+ /**
106
+ * @returns {void} .
107
+ * @private
108
+ */
109
+ public renderWeekends(): void {
110
+ if (this.parent.highlightWeekends) {
111
+ this.createNonworkingContainer();
112
+ if (!this.nonworkingContainer.contains(this.weekendContainer)) {
113
+ this.weekendContainer = createElement('div', {
114
+ className: cls.weekendContainer
115
+ });
116
+ this.nonworkingContainer.appendChild(this.weekendContainer);
117
+ }
118
+ this.weekendContainer.innerHTML = this.getWeekendElements().innerHTML;
119
+ } else if (this.weekendContainer) {
120
+ remove(this.weekendContainer);
121
+ if (this.nonworkingContainer && this.nonworkingContainer.childNodes.length === 0) {
122
+ remove(this.nonworkingContainer);
123
+ }
124
+ }
125
+ }
126
+ /**
127
+ * Method to get weekend html string
128
+ *
129
+ * @returns {HTMLElement} .
130
+ */
131
+ private getWeekendElements(): HTMLElement {
132
+ const container: HTMLElement = createElement('div');
133
+ const startDate: Date = new Date(this.parent.timelineModule.timelineStartDate.getTime());
134
+ const endDate: Date = new Date(this.parent.timelineModule.timelineEndDate.getTime());
135
+ const nonWorkingIndex: number[] = this.parent.nonWorkingDayIndex;
136
+ let isFirstCell: boolean = true;
137
+ do {
138
+ if (nonWorkingIndex.indexOf(startDate.getDay()) !== -1) {
139
+ const left: number = this.parent.dataOperation.getTaskLeft(startDate, false);
140
+ let width: number = this.parent.perDayWidth;
141
+ if (isFirstCell) {
142
+ const start: Date = new Date(startDate.getTime());
143
+ const tempEnd: Date = new Date(start.getTime());
144
+ tempEnd.setDate(tempEnd.getDate() + 1);
145
+ tempEnd.setHours(0, 0, 0, 0);
146
+ width = this.parent.dataOperation.getTaskWidth(start, tempEnd);
147
+ isFirstCell = false;
148
+ }
149
+ const weekendDiv: HTMLElement = createElement('div', {
150
+ className: cls.weekend, styles: `left:${left}px;width:${width}px;height:100%;`
151
+ });
152
+ container.appendChild(weekendDiv);
153
+ }
154
+ startDate.setDate(startDate.getDate() + 1);
155
+ startDate.setHours(0, 0, 0, 0);
156
+ } while (startDate < endDate);
157
+ return container;
158
+ }
159
+
160
+ private updateHolidayLabelHeight(): void {
161
+ const height: number = this.parent.getContentHeight();
162
+ let toolbarHeight: number = 0;
163
+ if (!isNullOrUndefined(this.parent.toolbarModule) && !isNullOrUndefined(this.parent.toolbarModule.element)) {
164
+ toolbarHeight = this.parent.toolbarModule.element.offsetHeight
165
+ }
166
+ const viewportHeight: number = this.parent.ganttHeight - toolbarHeight - this.parent.ganttChartModule.chartTimelineContainer.offsetHeight;
167
+ const top: number = (viewportHeight < height) ? viewportHeight / 2 : height / 2;
168
+ const labels: NodeList = this.holidayContainer.querySelectorAll('.' + cls.holidayLabel);
169
+ for (let i: number = 0; i < labels.length; i++) {
170
+ (labels[i] as HTMLElement).style.top = formatUnit(top);
171
+ }
172
+ }
173
+ /**
174
+ * Method to update height for all internal containers
175
+ *
176
+ * @returns {void} .
177
+ * @private
178
+ */
179
+ public updateContainerHeight(): void {
180
+ const height: number = this.parent.getContentHeight();
181
+ if (this.holidayContainer) {
182
+ this.holidayContainer.style.height = formatUnit(height);
183
+ this.updateHolidayLabelHeight();
184
+ }
185
+ if (this.weekendContainer) {
186
+ this.weekendContainer.style.height = formatUnit(height);
187
+ }
188
+ }
189
+ /**
190
+ * Method to remove containers of holiday and weekend
191
+ *
192
+ * @returns {void} .
193
+ */
194
+ public removeContainers(): void {
195
+ if (this.holidayContainer) {
196
+ remove(this.holidayContainer);
197
+ }
198
+ if (this.weekendContainer) {
199
+ remove(this.weekendContainer);
200
+ }
201
+ if (this.nonworkingContainer) {
202
+ remove(this.nonworkingContainer);
203
+ }
204
+ }
205
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Add renderer for all individual elements
3
+ */
4
+
5
+ //export * from DayMarkers;