jsgantt-improved 2.8.2 → 2.8.5

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 (75) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  2. package/.github/ISSUE_TEMPLATE/custom.md +0 -0
  3. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  4. package/.travis.yml +0 -0
  5. package/.vscode/launch.json +0 -0
  6. package/CONTRIBUTING.md +0 -0
  7. package/Documentation.md +589 -587
  8. package/LICENSE +0 -0
  9. package/README.md +27 -2
  10. package/dist/e2e/app.e2e-spec.js +0 -0
  11. package/dist/e2e/app.e2e-spec.js.map +0 -0
  12. package/dist/e2e/app.po.js +0 -0
  13. package/dist/e2e/app.po.js.map +0 -0
  14. package/dist/index.js +0 -0
  15. package/dist/index.js.map +0 -0
  16. package/dist/jsgantt.css +1016 -1012
  17. package/dist/jsgantt.js +1126 -887
  18. package/dist/src/draw.js +226 -227
  19. package/dist/src/draw.js.map +1 -1
  20. package/dist/src/draw_columns.js +0 -0
  21. package/dist/src/draw_columns.js.map +0 -0
  22. package/dist/src/draw_dependencies.js +0 -0
  23. package/dist/src/draw_dependencies.js.map +0 -0
  24. package/dist/src/events.js +0 -0
  25. package/dist/src/events.js.map +0 -0
  26. package/dist/src/jsgantt.js +0 -0
  27. package/dist/src/jsgantt.js.map +0 -0
  28. package/dist/src/json.js +6 -1
  29. package/dist/src/json.js.map +1 -1
  30. package/dist/src/lang.js +877 -652
  31. package/dist/src/lang.js.map +1 -1
  32. package/dist/src/options.js +0 -0
  33. package/dist/src/options.js.map +0 -0
  34. package/dist/src/task.js +8 -3
  35. package/dist/src/task.js.map +1 -1
  36. package/dist/src/utils/date_utils.js +0 -0
  37. package/dist/src/utils/date_utils.js.map +0 -0
  38. package/dist/src/utils/draw_utils.js +0 -0
  39. package/dist/src/utils/draw_utils.js.map +0 -0
  40. package/dist/src/utils/general_utils.js +3 -2
  41. package/dist/src/utils/general_utils.js.map +1 -1
  42. package/dist/src/xml.js +6 -2
  43. package/dist/src/xml.js.map +1 -1
  44. package/dist/test/index.js +0 -0
  45. package/dist/test/index.js.map +0 -0
  46. package/docs/DotNet.md +0 -0
  47. package/docs/demo-plan-color.html +282 -0
  48. package/docs/demo.gif +0 -0
  49. package/docs/demo.html +273 -275
  50. package/docs/demo.png +0 -0
  51. package/docs/demobigdata.html +0 -0
  52. package/docs/fixes/bigdata.json +0 -0
  53. package/docs/fixes/bug141.json +0 -0
  54. package/docs/fixes/bug277.json +0 -0
  55. package/docs/fixes/bug318.json +0 -0
  56. package/docs/fixes/data-plan-color.json +177 -0
  57. package/docs/fixes/data.json +0 -0
  58. package/docs/fixes/data255.json +0 -0
  59. package/docs/fixes/general.html +0 -0
  60. package/docs/fixes/lang.html +0 -0
  61. package/docs/fixes/planend.json +0 -0
  62. package/docs/fixes/two-weaksafter.html +0 -0
  63. package/docs/home-bg.jpg +0 -0
  64. package/docs/index.html +0 -0
  65. package/docs/index.js +266 -278
  66. package/docs/main.css +0 -0
  67. package/docs/main.js +0 -0
  68. package/docs/project.xml +132 -131
  69. package/e2e/tsconfig.e2e.json +0 -0
  70. package/package.json +49 -49
  71. package/protractor.conf.js +0 -0
  72. package/src/jsgantt.css +1016 -1012
  73. package/test/index.html +0 -0
  74. package/tsconfig.json +0 -0
  75. package/tslint.json +0 -0
package/docs/index.js CHANGED
@@ -1,278 +1,266 @@
1
- let dataurl;
2
- let jsonObj;
3
- let g;
4
-
5
- function start(e) {
6
-
7
- g = new JSGantt.GanttChart(document.getElementById('embedded-Gantt'), 'week');
8
- if (g.getDivId() != null) {
9
-
10
- const newDataurl = document.getElementById('dataurl').value ? document.getElementById('dataurl').value : './fixes/data.json';
11
- const vDebug = document.querySelector('#debug:checked') ? true : false;
12
- //vDebug = true;
13
- const vEditable = document.querySelector('#editable:checked') ? true : false;
14
- const vUseSort = document.querySelector('#sort:checked') ? true : false;
15
- const newtooltiptemplate = document.getElementById('tooltiptemplate').value ? document.getElementById('tooltiptemplate').value : null;
16
- let vColumnOrder;
17
- if (document.querySelector('#vColumnOrder').value) {
18
- vColumnOrder = document.querySelector('#vColumnOrder').value.split(',')
19
- }
20
-
21
- const vScrollTo = 'today'; // or new Date() or a Date object with a specific date
22
-
23
-
24
- // SET LANG FROM INPUT
25
- lang = e && e.target ? e.target.value : 'en';
26
- delay = document.getElementById('delay').value;
27
-
28
-
29
- vUseSingleCell = document.getElementById('useSingleCell').value;
30
- vShowRes = document.querySelector('#vShowRes:checked') ? 1 : 0;
31
- vShowCost = document.querySelector('#vShowCost:checked') ? 1 : 0;
32
- vShowAddEntries = document.querySelector('#vShowAddEntries:checked') ? 1 : 0;
33
- vShowComp = document.querySelector('#vShowComp:checked') ? 1 : 0;
34
- vShowDur = document.querySelector('#vShowDur:checked') ? 1 : 0;
35
- vShowStartDate = document.querySelector('#vShowStartDate:checked') ? 1 : 0;
36
- vShowEndDate = document.querySelector('#vShowEndDate:checked') ? 1 : 0;
37
- vShowPlanStartDate = document.querySelector('#vShowPlanStartDate:checked') ? 1 : 0;
38
- vShowPlanEndDate = document.querySelector('#vShowPlanEndDate:checked') ? 1 : 0;
39
- vShowTaskInfoLink = document.querySelector('#vShowTaskInfoLink:checked') ? 1 : 0;
40
- vShowEndWeekDate = document.querySelector('#vShowEndWeekDate:checked') ? 1 : 0;
41
- vTotalHeight = document.querySelector('#vTotalHeight').value || undefined;
42
-
43
- vShowWeekends = document.querySelector('#vShowWeekends:checked') ? 1 : 0;
44
-
45
- vMinDate = document.querySelector('#vMinDate').value;
46
- vMaxDate = document.querySelector('#vMaxDate').value;
47
-
48
- vAdditionalHeaders = {
49
- category: {
50
- title: 'Category'
51
- },
52
- sector: {
53
- title: 'Sector'
54
- }
55
- }
56
-
57
- g.setOptions({
58
- vCaptionType: 'Complete', // Set to Show Caption : None,Caption,Resource,Duration,Complete,
59
- vQuarterColWidth: 36,
60
- vDateTaskDisplayFormat: 'day dd month yyyy', // Shown in tool tip box
61
- vDayMajorDateDisplayFormat: 'mon yyyy - Week ww',// Set format to display dates in the "Major" header of the "Day" view
62
- vWeekMinorDateDisplayFormat: 'dd mon', // Set format to display dates in the "Minor" header of the "Week" view
63
- vLang: lang,
64
- vUseSingleCell, // Set the threshold at which we will only use one cell per table row (0 disables). Helps with rendering performance for large charts.
65
- vShowRes,
66
- vShowCost,
67
- vShowAddEntries,
68
- vShowComp,
69
- vShowDur,
70
- vShowStartDate,
71
- vShowEndDate,
72
- vShowPlanStartDate,
73
- vShowPlanEndDate,
74
- vAdditionalHeaders,
75
- vTotalHeight,
76
- vMinDate,
77
- vMaxDate,
78
- // EVENTs
79
- vEvents: {
80
- taskname: console.log,
81
- res: console.log,
82
- dur: console.log,
83
- comp: console.log,
84
- start: console.log,
85
- end: console.log,
86
- planstart: console.log,
87
- planend: console.log,
88
- cost: console.log,
89
- additional_category: console.log,
90
- beforeDraw: () => console.log('before draw listener'),
91
- afterDraw: () => {
92
- console.log('after draw listener');
93
- if (document.querySelector("#customElements:checked")) {
94
- drawCustomElements(g);
95
- }
96
- }
97
- },
98
- vEventsChange: {
99
- taskname: editValue, // if you need to use the this scope, do: editValue.bind(this)
100
- res: editValue,
101
- dur: editValue,
102
- comp: editValue,
103
- start: editValue,
104
- end: editValue,
105
- planstart: editValue,
106
- planend: editValue,
107
- cost: editValue
108
- },
109
- vEventClickRow: console.log,
110
- vEventClickCollapse: console.log,
111
-
112
- vResources: [
113
- { id: 0, name: 'Anybody' },
114
- { id: 1, name: 'Mario' },
115
- { id: 2, name: 'Henrique' },
116
- { id: 3, name: 'Pedro' }
117
- ],
118
-
119
- vShowTaskInfoLink, // Show link in tool tip (0/1)
120
- vShowEndWeekDate, // Show/Hide the date for the last day of the week in header for daily view (1/0)
121
- vShowWeekends, // Show weekends days in the vFormat day
122
- vTooltipDelay: delay,
123
- vTooltipTemplate:
124
- document.querySelector("#dynamicTooltip:checked") ?
125
- generateTooltip :
126
- newtooltiptemplate,
127
- vDebug,
128
- vEditable,
129
- vColumnOrder,
130
- vScrollTo,
131
- vUseSort,
132
- vFormat: 'week',
133
- vFormatArr: ['Day', 'Week', 'Month', 'Quarter'], // Even with setUseSingleCell using Hour format on such a large chart can cause issues in some browsers
134
- });
135
- //DELAY FROM INPUT
136
-
137
- // Teste manual add task
138
- // g.AddTaskItemObject({
139
- // pID: 100,
140
- // pName: "Task 1",
141
- // pStart: "2018-09-05",
142
- // pEnd: "2018-09-11",
143
- // pLink: "",
144
- // pClass: "gtaskgreen",
145
- // pMile: 0,
146
- // pComp: 100,
147
- // pGroup: 0,
148
- // pParent: 0,
149
- // pOpen: 1,
150
- // pNotes: "",
151
- // category: 'test'
152
- // });
153
-
154
- // Parameters (pID, pName, pStart, pEnd, pStyle, pLink (unused) pLink: pMilpMile: e, pRes, pComp, pGroup, pParent, pOpen, pDepend, pCaption, pNotes, pGantt)
155
- if (dataurl !== newDataurl) {
156
- dataurl = newDataurl;
157
- JSGantt.parseJSON(dataurl, g, vDebug)
158
- .then(j => jsonObj = j);
159
- } else {
160
- JSGantt.addJSONTask(g, jsonObj)
161
- }
162
- /*
163
- // Add Custom tasks programatically
164
- g.AddTaskItem(new JSGantt.TaskItem(1, 'Task Objects', '', '', 'ggroupblack', '', 0, 'Shlomy', 40, 1, 0, '', '', '', '', g));
165
- g.AddTaskItem(new JSGantt.TaskItem(121, 'Constructor Proc', '2019-08-20', '2020-03-06', 'gtaskblue', '', 0, 'Brian T.', 60, 0, 1, 1, '', '', '', g));
166
- g.AddTaskItem(new JSGantt.TaskItem(122, 'Task Variables', '2019-08-20', '2020-03-06', 'gtaskred', '', 0, 'Brian', 60, 0, 1, 1, 121, '', '', g));
167
- g.AddTaskItem(new JSGantt.TaskItem(123, 'Task by Minute/Hour', '2019-08-20', '2020-03-06 12:00', 'gtaskyellow', '', 0, 'Ilan', 60, 0, 1, 1, '', '', '', g));
168
- g.AddTaskItem(new JSGantt.TaskItem(124, 'Task Functions', '2019-08-20', '2020-03-06', 'gtaskred', '', 0, 'Anyone', 60, 0, 1, 1, '123', 'This is a caption', null, g));
169
- */
170
-
171
- if (vDebug) {
172
- bd = new Date();
173
- console.log('before reloading', bd);
174
- }
175
- g.Draw();
176
- //JSGantt.criticalPath(jsonObj)
177
- if (vDebug) {
178
- const ad = new Date();
179
- console.log('after reloading: total time', ad, (ad.getTime() - bd.getTime()));
180
- }
181
-
182
- } else {
183
- alert("Error, unable to create Gantt Chart");
184
- }
185
-
186
- // document.getElementById("idMainLeft").onscroll = () => {
187
- // scrollingTwoMains('idMainLeft', 'idMainRight');
188
- // };
189
-
190
- // document.getElementById('idMainRight').onscroll = () => {
191
- // scrollingTwoMains('idMainRight', 'idMainLeft');
192
- // };
193
- }
194
-
195
- function scrollingTwoMains(mainMoving, mainMoved) {
196
- document.getElementById(mainMoved).scrollTop = document.getElementById(mainMoving).scrollTop;
197
- }
198
-
199
- function clearTasks() {
200
- g.ClearTasks();
201
- g.Draw()
202
- }
203
-
204
- function printTasksInConsole() {
205
- const tasks = g.vTaskList.map(e => ({ ...e.getAllData(), ...e.getDataObject() }));
206
- console.log(tasks);
207
- }
208
-
209
- function printChart(){
210
- let width, height;
211
- [ width, height ] = document.querySelector('#print_page_size').value.split(',');
212
- g.printChart( width, height );
213
- }
214
-
215
-
216
- function editValue(list, task, event, cell, column) {
217
- console.log(list, task, event, cell, column)
218
- const found = list.find(item => item.pID == task.getOriginalID());
219
- if (!found) {
220
- return;
221
- }
222
- else {
223
- found[column] = event ? event.target.value : '';
224
- }
225
- }
226
-
227
- function drawCustomElements(g) {
228
- for (const item of g.getList()) {
229
- const dataObj = item.getDataObject();
230
- if (dataObj && dataObj.deadline) {
231
- const x = g.chartRowDateToX(new Date(dataObj.deadline));
232
- const td = item.getChildRow().querySelector('td');
233
- td.style.position = 'relative';
234
- const div = document.createElement('div');
235
- div.style.left = `${x}px`;
236
- div.classList.add('deadline-line');
237
- td.appendChild(div);
238
- }
239
- }
240
- }
241
-
242
- function generateTooltip(task) {
243
- // default tooltip for level 1
244
- if (task.getLevel() === 1) return;
245
-
246
- // string tooltip for level 2. Show completed/total child count and current timestamp
247
- if (task.getLevel() === 2) {
248
- let childCount = 0;
249
- let complete = 0;
250
- for (const item of g.getList()) {
251
- if (item.getParent() == task.getID()) {
252
- if (item.getCompVal() === 100) {
253
- complete++;
254
- }
255
- childCount++;
256
- }
257
- }
258
- console.log(`Generated dynamic sync template for '${task.getName()}'`);
259
- return `
260
- <dl>
261
- <dt>Name:</dt><dd>{{pName}}</dd>
262
- <dt>Complete child tasks:</dt><dd style="color:${complete === childCount ? 'green' : 'red'}">${complete}/${childCount}</dd>
263
- <dt>Tooltip generated at:</dt><dd>${new Date()}</dd>
264
- </dl>
265
- `;
266
- }
267
-
268
- // async tooltip for level 3 and below
269
- return new Promise((resolve, reject) => {
270
- const delay = Math.random() * 3000;
271
- setTimeout(() => {
272
- console.log(`Generated dynamic async template for '${task.getName()}'`);
273
- resolve(`Tooltip content from the promise after ${Math.round(delay)}ms`);
274
- }, delay);
275
- });
276
- }
277
-
278
- start('pt')
1
+ let dataurl;
2
+ let jsonObj;
3
+ let g;
4
+
5
+ function start(e) {
6
+ g = new JSGantt.GanttChart(document.getElementById("embedded-Gantt"), "week");
7
+ if (g.getDivId() != null) {
8
+ const newDataurl = document.getElementById("dataurl").value ? document.getElementById("dataurl").value : "./fixes/data.json";
9
+ const vDebug = document.querySelector("#debug:checked") ? true : false;
10
+ //vDebug = true;
11
+ const vEditable = document.querySelector("#editable:checked") ? true : false;
12
+ const vUseSort = document.querySelector("#sort:checked") ? true : false;
13
+ const newtooltiptemplate = document.getElementById("tooltiptemplate").value ? document.getElementById("tooltiptemplate").value : null;
14
+ let vColumnOrder;
15
+ if (document.querySelector("#vColumnOrder").value) {
16
+ vColumnOrder = document.querySelector("#vColumnOrder").value.split(",");
17
+ }
18
+
19
+ const vScrollTo = "today"; // or new Date() or a Date object with a specific date
20
+
21
+ // SET LANG FROM INPUT
22
+ lang = e && e.target ? e.target.value : "en";
23
+ delay = document.getElementById("delay").value;
24
+
25
+ vUseSingleCell = document.getElementById("useSingleCell").value;
26
+ vShowRes = document.querySelector("#vShowRes:checked") ? 1 : 0;
27
+ vShowCost = document.querySelector("#vShowCost:checked") ? 1 : 0;
28
+ vShowAddEntries = document.querySelector("#vShowAddEntries:checked") ? 1 : 0;
29
+ vShowComp = document.querySelector("#vShowComp:checked") ? 1 : 0;
30
+ vShowDur = document.querySelector("#vShowDur:checked") ? 1 : 0;
31
+ vShowStartDate = document.querySelector("#vShowStartDate:checked") ? 1 : 0;
32
+ vShowEndDate = document.querySelector("#vShowEndDate:checked") ? 1 : 0;
33
+ vShowPlanStartDate = document.querySelector("#vShowPlanStartDate:checked") ? 1 : 0;
34
+ vShowPlanEndDate = document.querySelector("#vShowPlanEndDate:checked") ? 1 : 0;
35
+ vShowTaskInfoLink = document.querySelector("#vShowTaskInfoLink:checked") ? 1 : 0;
36
+ vShowEndWeekDate = document.querySelector("#vShowEndWeekDate:checked") ? 1 : 0;
37
+ vTotalHeight = document.querySelector("#vTotalHeight").value || undefined;
38
+
39
+ vShowWeekends = document.querySelector("#vShowWeekends:checked") ? 1 : 0;
40
+
41
+ vMinDate = document.querySelector("#vMinDate").value;
42
+ vMaxDate = document.querySelector("#vMaxDate").value;
43
+
44
+ vAdditionalHeaders = {
45
+ category: {
46
+ title: "Category",
47
+ },
48
+ sector: {
49
+ title: "Sector",
50
+ },
51
+ };
52
+
53
+ g.setOptions({
54
+ vCaptionType: "Complete", // Set to Show Caption : None,Caption,Resource,Duration,Complete,
55
+ vQuarterColWidth: 36,
56
+ vDateTaskDisplayFormat: "day dd month yyyy", // Shown in tool tip box
57
+ vDayMajorDateDisplayFormat: "mon yyyy - Week ww", // Set format to display dates in the "Major" header of the "Day" view
58
+ vWeekMinorDateDisplayFormat: "dd mon", // Set format to display dates in the "Minor" header of the "Week" view
59
+ vLang: lang,
60
+ vUseSingleCell, // Set the threshold at which we will only use one cell per table row (0 disables). Helps with rendering performance for large charts.
61
+ vShowRes,
62
+ vShowCost,
63
+ vShowAddEntries,
64
+ vShowComp,
65
+ vShowDur,
66
+ vShowStartDate,
67
+ vShowEndDate,
68
+ vShowPlanStartDate,
69
+ vShowPlanEndDate,
70
+ vTotalHeight,
71
+ vMinDate,
72
+ vMaxDate,
73
+ // EVENTs
74
+ vEvents: {
75
+ taskname: console.log,
76
+ res: console.log,
77
+ dur: console.log,
78
+ comp: console.log,
79
+ start: console.log,
80
+ end: console.log,
81
+ planstart: console.log,
82
+ planend: console.log,
83
+ cost: console.log,
84
+ additional_category: console.log,
85
+ beforeDraw: () => console.log("before draw listener"),
86
+ afterDraw: () => {
87
+ console.log("after draw listener");
88
+ if (document.querySelector("#customElements:checked")) {
89
+ drawCustomElements(g);
90
+ }
91
+ },
92
+ },
93
+ vEventsChange: {
94
+ taskname: editValue, // if you need to use the this scope, do: editValue.bind(this)
95
+ res: editValue,
96
+ dur: editValue,
97
+ comp: editValue,
98
+ start: editValue,
99
+ end: editValue,
100
+ planstart: editValue,
101
+ planend: editValue,
102
+ cost: editValue,
103
+ },
104
+ vEventClickRow: console.log,
105
+ vEventClickCollapse: console.log,
106
+
107
+ vResources: [
108
+ { id: 0, name: "Anybody" },
109
+ { id: 1, name: "Mario" },
110
+ { id: 2, name: "Henrique" },
111
+ { id: 3, name: "Pedro" },
112
+ ],
113
+
114
+ vShowTaskInfoLink, // Show link in tool tip (0/1)
115
+ vShowEndWeekDate, // Show/Hide the date for the last day of the week in header for daily view (1/0)
116
+ vShowWeekends, // Show weekends days in the vFormat day
117
+ vTooltipDelay: delay,
118
+ vTooltipTemplate: document.querySelector("#dynamicTooltip:checked") ? generateTooltip : newtooltiptemplate,
119
+ vDebug,
120
+ vEditable,
121
+ vColumnOrder,
122
+ vScrollTo,
123
+ vUseSort,
124
+ vFormat: "week",
125
+ vFormatArr: ["Day", "Week", "Month", "Quarter"], // Even with setUseSingleCell using Hour format on such a large chart can cause issues in some browsers
126
+ });
127
+ //DELAY FROM INPUT
128
+
129
+ // Teste manual add task
130
+ // g.AddTaskItemObject({
131
+ // pID: 100,
132
+ // pName: "Task 1",
133
+ // pStart: "2018-09-05",
134
+ // pEnd: "2018-09-11",
135
+ // pLink: "",
136
+ // pClass: "gtaskgreen",
137
+ // pMile: 0,
138
+ // pComp: 100,
139
+ // pGroup: 0,
140
+ // pParent: 0,
141
+ // pOpen: 1,
142
+ // pNotes: "",
143
+ // category: 'test'
144
+ // });
145
+
146
+ // Parameters (pID, pName, pStart, pEnd, pStyle, pLink (unused) pLink: pMilpMile: e, pRes, pComp, pGroup, pParent, pOpen, pDepend, pCaption, pNotes, pGantt)
147
+ if (dataurl !== newDataurl) {
148
+ dataurl = newDataurl;
149
+ JSGantt.parseJSON(dataurl, g, vDebug).then((j) => (jsonObj = j));
150
+ } else {
151
+ JSGantt.addJSONTask(g, jsonObj);
152
+ }
153
+ /*
154
+ // Add Custom tasks programatically
155
+ g.AddTaskItem(new JSGantt.TaskItem(1, 'Task Objects', '', '', 'ggroupblack', '', 0, 'Shlomy', 40, 1, 0, '', '', '', '', g));
156
+ g.AddTaskItem(new JSGantt.TaskItem(121, 'Constructor Proc', '2019-08-20', '2020-03-06', 'gtaskblue', '', 0, 'Brian T.', 60, 0, 1, 1, '', '', '', g));
157
+ g.AddTaskItem(new JSGantt.TaskItem(122, 'Task Variables', '2019-08-20', '2020-03-06', 'gtaskred', '', 0, 'Brian', 60, 0, 1, 1, 121, '', '', g));
158
+ g.AddTaskItem(new JSGantt.TaskItem(123, 'Task by Minute/Hour', '2019-08-20', '2020-03-06 12:00', 'gtaskyellow', '', 0, 'Ilan', 60, 0, 1, 1, '', '', '', g));
159
+ g.AddTaskItem(new JSGantt.TaskItem(124, 'Task Functions', '2019-08-20', '2020-03-06', 'gtaskred', '', 0, 'Anyone', 60, 0, 1, 1, '123', 'This is a caption', null, g));
160
+ */
161
+
162
+ if (vDebug) {
163
+ bd = new Date();
164
+ console.log("before reloading", bd);
165
+ }
166
+ g.Draw();
167
+ //JSGantt.criticalPath(jsonObj)
168
+ if (vDebug) {
169
+ const ad = new Date();
170
+ console.log("after reloading: total time", ad, ad.getTime() - bd.getTime());
171
+ }
172
+ } else {
173
+ alert("Error, unable to create Gantt Chart");
174
+ }
175
+
176
+ // document.getElementById("idMainLeft").onscroll = () => {
177
+ // scrollingTwoMains('idMainLeft', 'idMainRight');
178
+ // };
179
+
180
+ // document.getElementById('idMainRight').onscroll = () => {
181
+ // scrollingTwoMains('idMainRight', 'idMainLeft');
182
+ // };
183
+ }
184
+
185
+ function scrollingTwoMains(mainMoving, mainMoved) {
186
+ document.getElementById(mainMoved).scrollTop = document.getElementById(mainMoving).scrollTop;
187
+ }
188
+
189
+ function clearTasks() {
190
+ g.ClearTasks();
191
+ g.Draw();
192
+ }
193
+
194
+ function printTasksInConsole() {
195
+ const tasks = g.vTaskList.map((e) => ({ ...e.getAllData(), ...e.getDataObject() }));
196
+ console.log(tasks);
197
+ }
198
+
199
+ function printChart() {
200
+ let width, height;
201
+ [width, height] = document.querySelector("#print_page_size").value.split(",");
202
+ g.printChart(width, height);
203
+ }
204
+
205
+ function editValue(list, task, event, cell, column) {
206
+ console.log(list, task, event, cell, column);
207
+ const found = list.find((item) => item.pID == task.getOriginalID());
208
+ if (!found) {
209
+ return;
210
+ } else {
211
+ found[column] = event ? event.target.value : "";
212
+ }
213
+ }
214
+
215
+ function drawCustomElements(g) {
216
+ for (const item of g.getList()) {
217
+ const dataObj = item.getDataObject();
218
+ if (dataObj && dataObj.deadline) {
219
+ const x = g.chartRowDateToX(new Date(dataObj.deadline));
220
+ const td = item.getChildRow().querySelector("td");
221
+ td.style.position = "relative";
222
+ const div = document.createElement("div");
223
+ div.style.left = `${x}px`;
224
+ div.classList.add("deadline-line");
225
+ td.appendChild(div);
226
+ }
227
+ }
228
+ }
229
+
230
+ function generateTooltip(task) {
231
+ // default tooltip for level 1
232
+ if (task.getLevel() === 1) return;
233
+
234
+ // string tooltip for level 2. Show completed/total child count and current timestamp
235
+ if (task.getLevel() === 2) {
236
+ let childCount = 0;
237
+ let complete = 0;
238
+ for (const item of g.getList()) {
239
+ if (item.getParent() == task.getID()) {
240
+ if (item.getCompVal() === 100) {
241
+ complete++;
242
+ }
243
+ childCount++;
244
+ }
245
+ }
246
+ console.log(`Generated dynamic sync template for '${task.getName()}'`);
247
+ return `
248
+ <dl>
249
+ <dt>Name:</dt><dd>{{pName}}</dd>
250
+ <dt>Complete child tasks:</dt><dd style="color:${complete === childCount ? "green" : "red"}">${complete}/${childCount}</dd>
251
+ <dt>Tooltip generated at:</dt><dd>${new Date()}</dd>
252
+ </dl>
253
+ `;
254
+ }
255
+
256
+ // async tooltip for level 3 and below
257
+ return new Promise((resolve, reject) => {
258
+ const delay = Math.random() * 3000;
259
+ setTimeout(() => {
260
+ console.log(`Generated dynamic async template for '${task.getName()}'`);
261
+ resolve(`Tooltip content from the promise after ${Math.round(delay)}ms`);
262
+ }, delay);
263
+ });
264
+ }
265
+
266
+ start("pt");
package/docs/main.css CHANGED
File without changes
package/docs/main.js CHANGED
File without changes