@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,450 @@
1
+ import { Gantt } from '../base/gantt';
2
+ import { Tooltip as TooltipComponent, TooltipEventArgs } from '@syncfusion/ej2-popups';
3
+ import { parentsUntil } from '../base/utils';
4
+ import * as cls from '../base/css-constants';
5
+ import { extend, isNullOrUndefined, getValue, EventHandler, closest } from '@syncfusion/ej2-base';
6
+ import { ITaskData, IGanttData, BeforeTooltipRenderEventArgs, PredecessorTooltip, IPredecessor } from '../base/interface';
7
+ import { EventMarkerModel } from '../models/models';
8
+ import { Deferred } from '@syncfusion/ej2-data';
9
+
10
+ /**
11
+ * File for handling tooltip in Gantt.
12
+ */
13
+ export class Tooltip {
14
+ public parent: Gantt;
15
+ public toolTipObj: TooltipComponent;
16
+ private predecessorTooltipData: PredecessorTooltip;
17
+ private currentTarget: HTMLElement;
18
+ private tooltipMouseEvent: PointerEvent;
19
+ constructor(gantt: Gantt) {
20
+ this.parent = gantt;
21
+ this.createTooltip();
22
+ this.parent.on('destroy', this.destroy, this);
23
+ }
24
+
25
+ /**
26
+ * To create tooltip.
27
+ *
28
+ * @returns {void} .
29
+ * @private
30
+ */
31
+ public createTooltip(): void {
32
+ this.toolTipObj = new TooltipComponent();
33
+ this.toolTipObj.target = '.e-header-cell-label, .e-gantt-child-taskbar,' +
34
+ '.e-gantt-parent-taskbar, .e-gantt-milestone, .e-gantt-unscheduled-taskbar' +
35
+ '.e-event-markers, .e-baseline-bar, .e-event-markers,' +
36
+ '.e-connector-line-container, .e-indicator-span, .e-notes-info, .e-gantt-manualparent-milestone,' +
37
+ '.e-taskbar-left-resizer, .e-taskbar-right-resizer, .e-baseline-gantt-milestone, .e-gantt-manualparenttaskbar';
38
+ this.toolTipObj.position = 'BottomCenter';
39
+ this.toolTipObj.openDelay = 700;
40
+ this.toolTipObj.enableHtmlSanitizer = false;
41
+ this.toolTipObj.cssClass = cls.ganttTooltip;
42
+ this.toolTipObj.animation = { open: { effect: 'None', delay: 0 }, close: { effect: 'None', delay: 0 } };
43
+ this.toolTipObj.afterOpen = this.updateTooltipPosition.bind(this);
44
+ this.toolTipObj.showTipPointer = false;
45
+ this.toolTipObj.beforeRender = this.tooltipBeforeRender.bind(this);
46
+ this.toolTipObj.afterClose = this.tooltipCloseHandler.bind(this);
47
+ this.toolTipObj.isStringTemplate = true;
48
+ this.toolTipObj.appendTo(this.parent.element);
49
+ }
50
+
51
+ private tooltipBeforeRender(args: TooltipEventArgs): void | Deferred {
52
+ const parent: Gantt = this.parent;
53
+ if (parent.isOnEdit) {
54
+ args.cancel = true;
55
+ return;
56
+ }
57
+ let element: Element;
58
+ const row: Element = closest(args.target, 'div.' + cls.taskBarMainContainer);
59
+ if (!isNullOrUndefined(row)) {
60
+ element = args.target;
61
+ } else {
62
+ element = parentsUntil(args.target as Element, cls.chartRowCell);
63
+ }
64
+ let data: IGanttData;
65
+ const argsData: BeforeTooltipRenderEventArgs = {
66
+ data: {},
67
+ args: args,
68
+ cancel: false,
69
+ content: ''
70
+ };
71
+
72
+ if (args.target.classList.contains('e-header-cell-label')) {
73
+ if (parent.timelineSettings.showTooltip) {
74
+ argsData.content = this.toolTipObj.content = parent.tooltipModule.getTooltipContent('timeline', data, parent, args);
75
+ } else {
76
+ args.cancel = true;
77
+ }
78
+ } else {
79
+ if (parent.tooltipSettings.showTooltip) {
80
+ if (element) {
81
+ argsData.data = parent.ganttChartModule.getRecordByTaskBar(element);
82
+ data = argsData.data;
83
+ }
84
+ if (args.target.classList.contains('e-gantt-child-taskbar') ||
85
+ args.target.classList.contains('e-gantt-parent-taskbar') ||
86
+ args.target.classList.contains('e-gantt-milestone') ||
87
+ args.target.classList.contains('e-gantt-unscheduled-taskbar') ||
88
+ args.target.classList.contains('e-taskbar-left-resizer') ||
89
+ args.target.classList.contains('e-taskbar-right-resizer') ||
90
+ (args.target.classList.contains('e-gantt-manualparenttaskbar') && parent.tooltipSettings.taskbar)) {
91
+ let taskbarTemplateNode: NodeList;
92
+ if (parent.tooltipSettings.taskbar) {
93
+ taskbarTemplateNode = parent.tooltipModule.templateCompiler(
94
+ parent.tooltipSettings.taskbar, parent, data, 'TooltipTaskbarTemplate');
95
+ }
96
+ argsData.content = this.toolTipObj.content = taskbarTemplateNode ? (taskbarTemplateNode[0] as HTMLElement) :
97
+ parent.tooltipModule.getTooltipContent(
98
+ (data.ganttProperties.isMilestone ? 'milestone' : 'taskbar'), data, parent, args);
99
+ } else if (args.target.classList.contains('e-baseline-bar') ||
100
+ args.target.classList.contains('e-baseline-gantt-milestone')) {
101
+ let baseLineTemplateNode: NodeList;
102
+ if ((parent.tooltipSettings.baseline)) {
103
+ baseLineTemplateNode = parent.tooltipModule.templateCompiler(
104
+ parent.tooltipSettings.baseline, parent, data, 'TooltipBaselineTemplate');
105
+ }
106
+ argsData.content = this.toolTipObj.content = baseLineTemplateNode ? (baseLineTemplateNode[0] as HTMLElement) :
107
+ parent.tooltipModule.getTooltipContent(
108
+ (data.ganttProperties.isMilestone ? 'milestone' : 'baseline'), data, parent, args);
109
+ } else if (args.target.classList.contains('e-event-markers')) {
110
+ argsData.content = this.toolTipObj.content = parent.tooltipModule.getTooltipContent('marker', data, parent, args);
111
+ } else if (args.target.classList.contains('e-connector-line-container')) {
112
+ let dependencyLineTemplateNode: NodeList;
113
+ parent.tooltipModule.predecessorTooltipData = parent.tooltipModule.getPredecessorTooltipData(args);
114
+ argsData.data = this.predecessorTooltipData;
115
+ if ((parent.tooltipSettings.connectorLine)) {
116
+ dependencyLineTemplateNode = parent.tooltipModule.templateCompiler(
117
+ parent.tooltipSettings.connectorLine, parent, parent.tooltipModule.predecessorTooltipData,
118
+ 'TooltipConnectorLineTemplate');
119
+ }
120
+ argsData.content = this.toolTipObj.content = dependencyLineTemplateNode ?
121
+ (dependencyLineTemplateNode[0] as HTMLElement) :
122
+ parent.tooltipModule.getTooltipContent('connectorLine', data, parent, args);
123
+ } else if (args.target.classList.contains('e-indicator-span')) {
124
+ argsData.content = this.toolTipObj.content =
125
+ parent.tooltipModule.getTooltipContent('indicator', data, parent, args);
126
+ if (isNullOrUndefined(argsData.content)) {
127
+ args.cancel = true;
128
+ }
129
+ } else if (args.target.classList.contains('e-notes-info')) {
130
+ const ganttData: IGanttData = this.parent.ganttChartModule.getRecordByTarget(args.event as PointerEvent);
131
+ argsData.content = this.toolTipObj.content = ganttData.ganttProperties.notes;
132
+ if (isNullOrUndefined(argsData.content)) {
133
+ args.cancel = true;
134
+ }
135
+ } else if (args.target.classList.contains('e-gantt-manualparenttaskbar')) {
136
+ argsData.content = this.toolTipObj.content = parent.tooltipModule.getTooltipContent(
137
+ 'manualtaskbar', data, parent, args);
138
+ if (isNullOrUndefined(argsData.content)) {
139
+ args.cancel = true;
140
+ }
141
+ } else if (args.target.classList.contains('e-gantt-manualparent-milestone')) {
142
+ argsData.content = this.toolTipObj.content = parent.tooltipModule.getTooltipContent(
143
+ 'manualmilestone', data, parent, args);
144
+ if (isNullOrUndefined(argsData.content)) {
145
+ args.cancel = true;
146
+ }
147
+ }
148
+ } else {
149
+ args.cancel = true;
150
+ }
151
+ }
152
+ if (args.cancel === false) {
153
+ const callBackPromise: Deferred = new Deferred();
154
+ parent.trigger('beforeTooltipRender', argsData, (argData: BeforeTooltipRenderEventArgs) => {
155
+ callBackPromise.resolve(argData);
156
+ if (argData.cancel) {
157
+ args.cancel = true;
158
+ }
159
+ });
160
+ this.toolTipObj.content = argsData.content as string;
161
+ if (!this.parent.isAdaptive && args.event.type === 'mouseover') {
162
+ this.currentTarget = args.target;
163
+ EventHandler.add(this.currentTarget, 'mousemove', this.mouseMoveHandler.bind(this));
164
+ }
165
+ this.parent.renderTemplates();
166
+ return callBackPromise;
167
+ }
168
+ }
169
+
170
+ // eslint-disable-next-line
171
+ private tooltipCloseHandler(args: TooltipEventArgs): void {
172
+ this.tooltipMouseEvent = null;
173
+ if (!this.parent.isAdaptive) {
174
+ EventHandler.remove(this.currentTarget, 'mousemove', this.mouseMoveHandler);
175
+ }
176
+ this.currentTarget = null;
177
+ }
178
+
179
+ private mouseMoveHandler(e: PointerEvent): void {
180
+ this.tooltipMouseEvent = e;
181
+ }
182
+ /**
183
+ * Method to update tooltip position
184
+ *
185
+ * @param {TooltipEventArgs} args .
186
+ * @returns {void} .
187
+ */
188
+ private updateTooltipPosition(args: TooltipEventArgs): void {
189
+ args.element.style.visibility = 'visible';
190
+ if (isNullOrUndefined(this.tooltipMouseEvent) || args.target.classList.contains('e-notes-info')) {
191
+ return;
192
+ }
193
+ const postion: { x: number, y: number } = this.getPointorPosition(this.tooltipMouseEvent);
194
+ const containerPosition: { top: number, left: number, width?: number, height?: number } =
195
+ this.parent.getOffsetRect(this.parent.chartPane);
196
+ const topEnd: number = containerPosition.top + this.parent.chartPane.offsetHeight;
197
+ const leftEnd: number = containerPosition.left + this.parent.chartPane.offsetWidth;
198
+ let tooltipPositionX: number = postion.x;
199
+ let tooltipPositionY: number = postion.y;
200
+ if (leftEnd < (tooltipPositionX + args.element.offsetWidth + 10)) {
201
+ while (leftEnd < (tooltipPositionX + args.element.offsetWidth + 10)) {
202
+ tooltipPositionX = leftEnd - args.element.offsetWidth - 10;
203
+ args.element.style.left = tooltipPositionX + 'px';
204
+ }
205
+ } else {
206
+ tooltipPositionX = tooltipPositionX + 10;
207
+ args.element.style.left = tooltipPositionX + 'px';
208
+ }
209
+ if (window.innerHeight < args.element.offsetHeight + tooltipPositionY) {
210
+ tooltipPositionY = tooltipPositionY - args.element.offsetHeight - 10;
211
+ }
212
+ if ((topEnd < (tooltipPositionY + args.element.offsetHeight + 20))) {
213
+ tooltipPositionY = tooltipPositionY - args.element.offsetHeight - 10;
214
+ } else {
215
+ tooltipPositionY = tooltipPositionY + 10;
216
+ }
217
+ args.element.style.top = tooltipPositionY + 'px';
218
+ }
219
+ /**
220
+ * Method to get mouse pointor position
221
+ *
222
+ * @param {Event} e .
223
+ * @returns {number} .
224
+ */
225
+ private getPointorPosition(e: Event): { x: number, y: number } {
226
+ let posX: number;
227
+ let posY: number;
228
+ if (!isNullOrUndefined(getValue('pageX', e)) || !isNullOrUndefined(getValue('pageY', e))) {
229
+ posX = getValue('pageX', e);
230
+ posY = getValue('pageY', e);
231
+ } else if (!isNullOrUndefined(getValue('clientX', e)) || !isNullOrUndefined(getValue('clientY', e))) {
232
+ posX = getValue('clientX', e) + document.body.scrollLeft + document.documentElement.scrollLeft;
233
+ posY = getValue('clientY', e) + document.body.scrollTop + document.documentElement.scrollTop;
234
+ }
235
+ return { x: posX, y: posY };
236
+ }
237
+
238
+ /**
239
+ * Getting tooltip content for different elements
240
+ *
241
+ * @param {string} elementType .
242
+ * @param {IGanttData} ganttData .
243
+ * @param {Gantt} parent .
244
+ * @param {TooltipEventArgs} args .
245
+ * @returns {string} .
246
+ */
247
+ private getTooltipContent(elementType: string, ganttData: IGanttData, parent: Gantt, args: TooltipEventArgs): string {
248
+ let content: string;
249
+ let data: ITaskData;
250
+ let taskName: string;
251
+ if (ganttData) {
252
+ data = ganttData.ganttProperties;
253
+ taskName = !isNullOrUndefined(data.taskName) ? '<tr class = "e-gantt-tooltip-rowcell"><td colspan="3">' +
254
+ data.taskName + '</td></tr>' : '';
255
+ }
256
+ switch (elementType) {
257
+ case 'milestone':
258
+ {
259
+ let milestoneStartDate: Date;
260
+ if (args.target.className.includes('e-baseline-gantt-milestone') && !isNullOrUndefined(data.baselineStartDate)) {
261
+ milestoneStartDate = data.baselineStartDate;
262
+ } else if (!isNullOrUndefined(data.startDate)) {
263
+ milestoneStartDate = data.startDate;
264
+ }
265
+ const sDate: string = !isNullOrUndefined(milestoneStartDate) ? '<tr><td class = "e-gantt-tooltip-label"> Date</td><td>:</td>' +
266
+ '<td class = "e-gantt-tooltip-value">' +
267
+ this.parent.getFormatedDate(milestoneStartDate, this.parent.getDateFormat()) + '</td></tr>' : '';
268
+ content = '<table class = "e-gantt-tooltiptable"><tbody>' +
269
+ taskName + sDate + '</tbody></table>';
270
+ break;
271
+ }
272
+ case 'taskbar':
273
+ {
274
+ const scheduledTask: boolean = !ganttData.hasChildRecords || data.isAutoSchedule ? true : false;
275
+ const startDate: string = data.startDate ? '<tr><td class = "e-gantt-tooltip-label">' +
276
+ this.parent.localeObj.getConstant(scheduledTask ? 'startDate' : 'subTasksStartDate') +
277
+ '</td><td>:</td>' + '<td class = "e-gantt-tooltip-value"> ' +
278
+ this.parent.getFormatedDate(scheduledTask ? data.startDate : data.autoStartDate, this.parent.getDateFormat()) +
279
+ '</td></tr>' : '';
280
+ const endDate: string = data.endDate ? '<tr><td class = "e-gantt-tooltip-label">' +
281
+ this.parent.localeObj.getConstant(scheduledTask ? 'endDate' : 'subTasksEndDate') +
282
+ '</td><td>:</td><td class = "e-gantt-tooltip-value">' + this.parent.getFormatedDate(
283
+ scheduledTask ? data.endDate : data.autoEndDate, this.parent.getDateFormat()) + '</td></tr>' : '';
284
+ const duration: string = !isNullOrUndefined(data.duration) ? '<tr><td class = "e-gantt-tooltip-label">' +
285
+ this.parent.localeObj.getConstant('duration') + '</td><td>:</td>' +
286
+ '<td class = "e-gantt-tooltip-value"> ' + this.parent.getDurationString(
287
+ (scheduledTask ? data.duration : data.autoDuration), data.durationUnit) +
288
+ '</td></tr>' : '';
289
+ const progress: string = !isNullOrUndefined(data.progress) ? '<tr><td class = "e-gantt-tooltip-label">' +
290
+ this.parent.localeObj.getConstant('progress') + '</td><td>:</td><td>' + data.progress +
291
+ '</td></tr>' : '';
292
+ content = '<table class = "e-gantt-tooltiptable"><tbody>' +
293
+ taskName + startDate + endDate + duration + progress + '</tbody></table>';
294
+ break;
295
+ }
296
+ case 'baseline':
297
+ {
298
+ content = '<table class = "e-gantt-tooltiptable"><tbody>' +
299
+ taskName + '<tr><td class = "e-gantt-tooltip-label">' +
300
+ this.parent.localeObj.getConstant('baselineStartDate') + '</td><td>:</td>' + '<td class = "e-gantt-tooltip-value">' +
301
+ this.parent.getFormatedDate(data.baselineStartDate, this.parent.getDateFormat()) + '</td></tr><tr>' +
302
+ '<td class = "e-gantt-tooltip-label">' + this.parent.localeObj.getConstant('baselineEndDate') +
303
+ '</td><td>:</td><td class = "e-gantt-tooltip-value">' +
304
+ this.parent.getFormatedDate(data.baselineEndDate, this.parent.getDateFormat()) + '</td></tr></tbody></table>';
305
+ break;
306
+ }
307
+ case 'marker':
308
+ {
309
+ const markerTooltipElement: EventMarkerModel = parent.tooltipModule.getMarkerTooltipData(args);
310
+ const markerLabel: string = markerTooltipElement.label ? markerTooltipElement.label : '';
311
+ content = '<table class = "e-gantt-tooltiptable"><tbody><tr><td>' +
312
+ this.parent.getFormatedDate(
313
+ this.parent.dateValidationModule.getDateFromFormat(markerTooltipElement.day), this.parent.getDateFormat()) +
314
+ '</td></tr><tr><td>' +
315
+ markerLabel + '</td></tr></tbody></table>';
316
+ break;
317
+ }
318
+ case 'connectorLine':
319
+ {
320
+ content = '<table class = "e-gantt-tooltiptable"><tbody><tr><td class = "e-gantt-tooltip-label">' +
321
+ this.parent.localeObj.getConstant('from') + '</td><td>:</td>' +
322
+ '<td class = "e-gantt-tooltip-value">' + parent.tooltipModule.predecessorTooltipData.fromName + ' (' +
323
+ parent.tooltipModule.predecessorTooltipData.fromId + ')' + '</td></tr><tr><td class = "e-gantt-tooltip-label">' +
324
+ this.parent.localeObj.getConstant('to') + '</td><td>:</td>' + '<td class = "e-gantt-tooltip-value">' +
325
+ parent.tooltipModule.predecessorTooltipData.toName +
326
+ ' (' + parent.tooltipModule.predecessorTooltipData.toId + ')' +
327
+ '</td></tr><tr><td class = "e-gantt-tooltip-label">' + this.parent.localeObj.getConstant('taskLink') +
328
+ '</td><td>:</td><td class = "e-gantt-tooltip-value"> ' + parent.tooltipModule.predecessorTooltipData.linkText +
329
+ '</td></tr><tr><td class = "e-gantt-tooltip-label">' + this.parent.localeObj.getConstant('lag') +
330
+ '</td><td>:</td><td class = "e-gantt-tooltip-value">' +
331
+ parent.tooltipModule.predecessorTooltipData.offsetString + '</td></tr></tbody></table>';
332
+ break;
333
+ }
334
+ case 'indicator':
335
+ if (args.target.title.length) {
336
+ content = '<table class = "e-gantt-tooltiptable"><tbody><tr>' + args.target.title + '</tr></tbody></table>';
337
+ }
338
+ break;
339
+ case 'timeline':
340
+ content = '<table class = "e-gantt-tooltiptable"><tbody><tr>' + args.target.title + '</tr></tbody></table>';
341
+ break;
342
+ case 'manualtaskbar':
343
+ {
344
+ const autoStartDate: string = data.autoStartDate ? '<tr><td class = "e-gantt-tooltip-label">' +
345
+ this.parent.localeObj.getConstant('subTasksStartDate') + '</td><td>:</td>' + '<td class = "e-gantt-tooltip-value"> ' +
346
+ this.parent.getFormatedDate(data.autoStartDate, this.parent.getDateFormat()) + '</td></tr>' : '';
347
+ const autoEndDate: string = data.autoEndDate ? '<tr><td class = "e-gantt-tooltip-label">' +
348
+ this.parent.localeObj.getConstant('subTasksEndDate') + '</td><td>:</td>' + '<td class = "e-gantt-tooltip-value">' +
349
+ this.parent.getFormatedDate(data.autoEndDate, this.parent.getDateFormat()) + '</td></tr>' : '';
350
+ const durationValue: string = !isNullOrUndefined(data.duration) ? '<tr><td class = "e-gantt-tooltip-label">' +
351
+ this.parent.localeObj.getConstant('duration') + '</td><td>:</td>' +
352
+ '<td class = "e-gantt-tooltip-value"> ' + this.parent.getDurationString(data.duration, data.durationUnit) +
353
+ '</td></tr>' : '';
354
+ const manualStartDate: string = data.startDate ? '<tr><td class = "e-gantt-tooltip-label">' +
355
+ this.parent.localeObj.getConstant('startDate') + '</td><td>:</td>' + '<td class = "e-gantt-tooltip-value"> ' +
356
+ this.parent.getFormatedDate(data.startDate, this.parent.getDateFormat()) + '</td></tr>' : '';
357
+ const manualEndDate: string = data.endDate ? '<tr><td class = "e-gantt-tooltip-label">' +
358
+ this.parent.localeObj.getConstant('endDate') + '</td><td>:</td>' + '<td class = "e-gantt-tooltip-value">' +
359
+ this.parent.getFormatedDate(data.endDate, this.parent.getDateFormat()) + '</td></tr>' : '';
360
+ content = '<table class = "e-gantt-tooltiptable"><tbody>' +
361
+ taskName + manualStartDate + autoStartDate + manualEndDate + autoEndDate + durationValue + '</tbody></table>';
362
+ break;
363
+ }
364
+ case 'manualmilestone':
365
+ {
366
+ const autoStart: string = data.autoStartDate ? '<tr><td class = "e-gantt-tooltip-label">' +
367
+ this.parent.localeObj.getConstant('subTasksStartDate') + '</td><td>:</td>' + '<td class = "e-gantt-tooltip-value"> ' +
368
+ this.parent.getFormatedDate(data.autoStartDate, this.parent.getDateFormat()) + '</td></tr>' : '';
369
+ const autoEnd: string = data.autoEndDate ? '<tr><td class = "e-gantt-tooltip-label">' +
370
+ this.parent.localeObj.getConstant('subTasksEndDate') + '</td><td>:</td>' + '<td class = "e-gantt-tooltip-value">' +
371
+ this.parent.getFormatedDate(data.autoEndDate, this.parent.getDateFormat()) + '</td></tr>' : '';
372
+ const date: string = '<tr><td class = "e-gantt-tooltip-label"> Date</td><td>:</td>' +
373
+ '<td class = "e-gantt-tooltip-value">' +
374
+ this.parent.getFormatedDate(data.startDate, this.parent.getDateFormat()) + '</tr>';
375
+ content = '<table class = "e-gantt-tooltiptable"><tbody>' +
376
+ taskName + date + autoStart + autoEnd + '</tbody></table>';
377
+ break;
378
+ }
379
+ }
380
+ return content;
381
+ }
382
+
383
+ /**
384
+ * To get the details of an event marker.
385
+ *
386
+ * @param {TooltipEventArgs} args .
387
+ * @returns {EventMarkerModel} .
388
+ * @private
389
+ */
390
+ public getMarkerTooltipData(args: TooltipEventArgs): EventMarkerModel {
391
+ const markerTooltipId: string[] = (args.target.id).match(/\d+/g);
392
+ const markerTooltipElement: EventMarkerModel = this.parent.eventMarkers[Number(markerTooltipId)];
393
+ return markerTooltipElement;
394
+ }
395
+
396
+ /**
397
+ * To get the details of a connector line.
398
+ *
399
+ * @param {TooltipEventArgs} args .
400
+ * @returns {PredecessorTooltip} .
401
+ * @private
402
+ */
403
+ public getPredecessorTooltipData(args: TooltipEventArgs): PredecessorTooltip {
404
+ const predeceesorParent: string = args.target.parentElement.id;
405
+ const taskIds: string[] = predeceesorParent.match(/\d+/g);
406
+ let fromTask: IGanttData;
407
+ let toTask: IGanttData;
408
+ if (this.parent.viewType === 'ResourceView') {
409
+ fromTask = this.parent.flatData[this.parent.getTaskIds().indexOf('T' + taskIds[0])];
410
+ toTask = this.parent.flatData[this.parent.getTaskIds().indexOf('T' + taskIds[1])];
411
+ } else {
412
+ fromTask = this.parent.flatData[this.parent.ids.indexOf(taskIds[0])];
413
+ toTask = this.parent.flatData[this.parent.ids.indexOf(taskIds[1])];
414
+ }
415
+ const predecessor: IPredecessor[] = (fromTask.ganttProperties.predecessor).filter(
416
+ (pdc: IPredecessor) => { return pdc.to === taskIds[1]; });
417
+ const predecessorTooltipData: PredecessorTooltip = {
418
+ fromId: this.parent.viewType === 'ResourceView' ? fromTask.ganttProperties.taskId : fromTask.ganttProperties.rowUniqueID,
419
+ toId: this.parent.viewType === 'ResourceView' ? toTask.ganttProperties.taskId : toTask.ganttProperties.rowUniqueID,
420
+ fromName: fromTask.ganttProperties.taskName,
421
+ toName: toTask.ganttProperties.taskName,
422
+ linkType: predecessor[0].type,
423
+ linkText: this.parent.getPredecessorTextValue(predecessor[0].type),
424
+ offset: predecessor[0].offset,
425
+ offsetUnit: predecessor[0].offsetUnit,
426
+ offsetString: this.parent.getDurationString(predecessor[0].offset, predecessor[0].offsetUnit)
427
+ };
428
+ return predecessorTooltipData;
429
+ }
430
+
431
+ /**
432
+ * To compile template string.
433
+ *
434
+ * @param {string} template .
435
+ * @param {Gantt} parent .
436
+ * @param {IGanttData|PredecessorTooltip} data .
437
+ * @param {string} propName .
438
+ * @returns {NodeList} .
439
+ * @private
440
+ */
441
+ public templateCompiler(template: string, parent: Gantt, data: IGanttData | PredecessorTooltip, propName: string): NodeList {
442
+ const tooltipFunction: Function = parent.chartRowsModule.templateCompiler(template);
443
+ const templateID: string = parent.chartRowsModule.getTemplateID(propName);
444
+ const templateNode: NodeList = tooltipFunction(extend({ index: 0 }, data), parent, propName, templateID, true);
445
+ return templateNode;
446
+ }
447
+ private destroy(): void {
448
+ this.toolTipObj.destroy();
449
+ }
450
+ }
@@ -0,0 +1,50 @@
1
+ import { formatUnit, createElement } from '@syncfusion/ej2-base';
2
+ import { Gantt } from '../base/gantt';
3
+
4
+ /**
5
+ * virtual Content renderer for Gantt
6
+ */
7
+ export class VirtualContentRenderer {
8
+ private parent: Gantt;
9
+ private wrapper: HTMLElement;
10
+ private virtualTrack: HTMLElement;
11
+ constructor(parent: Gantt) {
12
+ this.parent = parent;
13
+ }
14
+
15
+ /**
16
+ * To render a wrapper for chart body content when virtualization is enabled.
17
+ *
18
+ * @returns {void} .
19
+ * @hidden
20
+ */
21
+ public renderWrapper(): void {
22
+ this.wrapper = createElement('div', { className: 'e-virtualtable', styles: 'position: absolute; transform: translate(0px, 0px);' });
23
+ this.parent.ganttChartModule.scrollElement.appendChild(this.wrapper);
24
+ this.virtualTrack = createElement('div', { className: 'e-virtualtrack', styles: 'position: relative; pointer-events: none; width: 100%;' });
25
+ this.parent.ganttChartModule.scrollElement.appendChild(this.virtualTrack);
26
+ this.wrapper.appendChild(this.parent.ganttChartModule.chartBodyContent);
27
+ }
28
+
29
+ /**
30
+ * To append child elements for wrappered element when virtualization is enabled.
31
+ *
32
+ * @param {HTMLElement} element .
33
+ * @returns {void} .
34
+ * @hidden
35
+ */
36
+ public appendChildElements(element: HTMLElement): void {
37
+ this.wrapper.appendChild(element);
38
+ }
39
+
40
+ /**
41
+ * To adjust gantt content table's style when virtualization is enabled
42
+ *
43
+ * @returns {void} .
44
+ * @hidden
45
+ */
46
+ public adjustTable(): void {
47
+ const content: HTMLElement = this.parent.treeGrid.getContent().querySelector('.e-content').querySelector('.e-virtualtable');
48
+ this.parent.ganttChartModule.virtualRender.wrapper.style.transform = content.style.transform;
49
+ }
50
+ }
package/license CHANGED
@@ -1,10 +1,10 @@
1
- Essential JS 2 library is available under the Syncfusion Essential Studio program, and can be licensed either under the Syncfusion Community License Program or the Syncfusion commercial license.
2
-
3
- To be qualified for the Syncfusion Community License Program you must have a gross revenue of less than one (1) million U.S. dollars ($1,000,000.00 USD) per year and have less than five (5) developers in your organization, and agree to be bound by Syncfusion’s terms and conditions.
4
-
5
- Customers who do not qualify for the community license can contact sales@syncfusion.com for commercial licensing options.
6
-
7
- Under no circumstances can you use this product without (1) either a Community License or a commercial license and (2) without agreeing and abiding by Syncfusion’s license containing all terms and conditions.
8
-
9
- The Syncfusion license that contains the terms and conditions can be found at
1
+ Essential JS 2 library is available under the Syncfusion Essential Studio program, and can be licensed either under the Syncfusion Community License Program or the Syncfusion commercial license.
2
+
3
+ To be qualified for the Syncfusion Community License Program you must have a gross revenue of less than one (1) million U.S. dollars ($1,000,000.00 USD) per year and have less than five (5) developers in your organization, and agree to be bound by Syncfusion’s terms and conditions.
4
+
5
+ Customers who do not qualify for the community license can contact sales@syncfusion.com for commercial licensing options.
6
+
7
+ Under no circumstances can you use this product without (1) either a Community License or a commercial license and (2) without agreeing and abiding by Syncfusion’s license containing all terms and conditions.
8
+
9
+ The Syncfusion license that contains the terms and conditions can be found at
10
10
  https://www.syncfusion.com/content/downloads/syncfusion_license.pdf