@levelcaptech/gantt-task-react-custom 0.1.0

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 (40) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +159 -0
  3. package/dist/components/calendar/calendar.d.ts +14 -0
  4. package/dist/components/calendar/top-part-of-calendar.d.ts +11 -0
  5. package/dist/components/gantt/gantt.d.ts +3 -0
  6. package/dist/components/gantt/task-gantt-content.d.ts +25 -0
  7. package/dist/components/gantt/task-gantt.d.ts +13 -0
  8. package/dist/components/grid/grid-body.d.ts +12 -0
  9. package/dist/components/grid/grid.d.ts +4 -0
  10. package/dist/components/other/arrow.d.ts +12 -0
  11. package/dist/components/other/horizontal-scroll.d.ts +8 -0
  12. package/dist/components/other/tooltip.d.ts +29 -0
  13. package/dist/components/other/vertical-scroll.d.ts +9 -0
  14. package/dist/components/task-item/bar/bar-date-handle.d.ts +11 -0
  15. package/dist/components/task-item/bar/bar-display.d.ts +20 -0
  16. package/dist/components/task-item/bar/bar-progress-handle.d.ts +7 -0
  17. package/dist/components/task-item/bar/bar-small.d.ts +3 -0
  18. package/dist/components/task-item/bar/bar.d.ts +3 -0
  19. package/dist/components/task-item/milestone/milestone.d.ts +3 -0
  20. package/dist/components/task-item/project/project.d.ts +3 -0
  21. package/dist/components/task-item/task-item.d.ts +15 -0
  22. package/dist/components/task-list/task-list-header.d.ts +7 -0
  23. package/dist/components/task-list/task-list-table.d.ts +13 -0
  24. package/dist/components/task-list/task-list.d.ts +37 -0
  25. package/dist/helpers/bar-helper.d.ts +14 -0
  26. package/dist/helpers/date-helper.d.ts +14 -0
  27. package/dist/helpers/other-helper.d.ts +8 -0
  28. package/dist/index.css +312 -0
  29. package/dist/index.d.ts +3 -0
  30. package/dist/index.js +2749 -0
  31. package/dist/index.js.map +1 -0
  32. package/dist/index.modern.js +2748 -0
  33. package/dist/index.modern.js.map +1 -0
  34. package/dist/test/date-helper.test.d.ts +1 -0
  35. package/dist/test/gant.test.d.ts +1 -0
  36. package/dist/types/bar-task.d.ts +21 -0
  37. package/dist/types/date-setup.d.ts +5 -0
  38. package/dist/types/gantt-task-actions.d.ts +8 -0
  39. package/dist/types/public-types.d.ts +136 -0
  40. package/package.json +70 -0
@@ -0,0 +1,2748 @@
1
+ import React, { useMemo, useRef, useState, useEffect } from 'react';
2
+
3
+ function _extends() {
4
+ _extends = Object.assign || function (target) {
5
+ for (var i = 1; i < arguments.length; i++) {
6
+ var source = arguments[i];
7
+
8
+ for (var key in source) {
9
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
10
+ target[key] = source[key];
11
+ }
12
+ }
13
+ }
14
+
15
+ return target;
16
+ };
17
+
18
+ return _extends.apply(this, arguments);
19
+ }
20
+
21
+ function _unsupportedIterableToArray(o, minLen) {
22
+ if (!o) return;
23
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
24
+ var n = Object.prototype.toString.call(o).slice(8, -1);
25
+ if (n === "Object" && o.constructor) n = o.constructor.name;
26
+ if (n === "Map" || n === "Set") return Array.from(o);
27
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
28
+ }
29
+
30
+ function _arrayLikeToArray(arr, len) {
31
+ if (len == null || len > arr.length) len = arr.length;
32
+
33
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
34
+
35
+ return arr2;
36
+ }
37
+
38
+ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
39
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
40
+ if (it) return (it = it.call(o)).next.bind(it);
41
+
42
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
43
+ if (it) o = it;
44
+ var i = 0;
45
+ return function () {
46
+ if (i >= o.length) return {
47
+ done: true
48
+ };
49
+ return {
50
+ done: false,
51
+ value: o[i++]
52
+ };
53
+ };
54
+ }
55
+
56
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
57
+ }
58
+
59
+ var ViewMode;
60
+
61
+ (function (ViewMode) {
62
+ ViewMode["Hour"] = "Hour";
63
+ ViewMode["QuarterDay"] = "Quarter Day";
64
+ ViewMode["HalfDay"] = "Half Day";
65
+ ViewMode["Day"] = "Day";
66
+ ViewMode["Week"] = "Week";
67
+ ViewMode["Month"] = "Month";
68
+ ViewMode["QuarterYear"] = "QuarterYear";
69
+ ViewMode["Year"] = "Year";
70
+ })(ViewMode || (ViewMode = {}));
71
+
72
+ var intlDTCache = {};
73
+ var getCachedDateTimeFormat = function getCachedDateTimeFormat(locString, opts) {
74
+ if (opts === void 0) {
75
+ opts = {};
76
+ }
77
+
78
+ var key = JSON.stringify([locString, opts]);
79
+ var dtf = intlDTCache[key];
80
+
81
+ if (!dtf) {
82
+ dtf = new Intl.DateTimeFormat(locString, opts);
83
+ intlDTCache[key] = dtf;
84
+ }
85
+
86
+ return dtf;
87
+ };
88
+ var addToDate = function addToDate(date, quantity, scale) {
89
+ var newDate = new Date(date.getFullYear() + (scale === "year" ? quantity : 0), date.getMonth() + (scale === "month" ? quantity : 0), date.getDate() + (scale === "day" ? quantity : 0), date.getHours() + (scale === "hour" ? quantity : 0), date.getMinutes() + (scale === "minute" ? quantity : 0), date.getSeconds() + (scale === "second" ? quantity : 0), date.getMilliseconds() + (scale === "millisecond" ? quantity : 0));
90
+ return newDate;
91
+ };
92
+ var startOfDate = function startOfDate(date, scale) {
93
+ var scores = ["millisecond", "second", "minute", "hour", "day", "month", "year"];
94
+
95
+ var shouldReset = function shouldReset(_scale) {
96
+ var maxScore = scores.indexOf(scale);
97
+ return scores.indexOf(_scale) <= maxScore;
98
+ };
99
+
100
+ var newDate = new Date(date.getFullYear(), shouldReset("year") ? 0 : date.getMonth(), shouldReset("month") ? 1 : date.getDate(), shouldReset("day") ? 0 : date.getHours(), shouldReset("hour") ? 0 : date.getMinutes(), shouldReset("minute") ? 0 : date.getSeconds(), shouldReset("second") ? 0 : date.getMilliseconds());
101
+ return newDate;
102
+ };
103
+ var ganttDateRange = function ganttDateRange(tasks, viewMode, preStepsCount) {
104
+ var newStartDate = tasks[0].start;
105
+ var newEndDate = tasks[0].start;
106
+
107
+ for (var _iterator = _createForOfIteratorHelperLoose(tasks), _step; !(_step = _iterator()).done;) {
108
+ var task = _step.value;
109
+
110
+ if (task.start < newStartDate) {
111
+ newStartDate = task.start;
112
+ }
113
+
114
+ if (task.end > newEndDate) {
115
+ newEndDate = task.end;
116
+ }
117
+ }
118
+
119
+ switch (viewMode) {
120
+ case ViewMode.Year:
121
+ newStartDate = addToDate(newStartDate, -1, "year");
122
+ newStartDate = startOfDate(newStartDate, "year");
123
+ newEndDate = addToDate(newEndDate, 1, "year");
124
+ newEndDate = startOfDate(newEndDate, "year");
125
+ break;
126
+
127
+ case ViewMode.QuarterYear:
128
+ newStartDate = addToDate(newStartDate, -3, "month");
129
+ newStartDate = startOfDate(newStartDate, "month");
130
+ newEndDate = addToDate(newEndDate, 3, "year");
131
+ newEndDate = startOfDate(newEndDate, "year");
132
+ break;
133
+
134
+ case ViewMode.Month:
135
+ newStartDate = addToDate(newStartDate, -1 * preStepsCount, "month");
136
+ newStartDate = startOfDate(newStartDate, "month");
137
+ newEndDate = addToDate(newEndDate, 1, "year");
138
+ newEndDate = startOfDate(newEndDate, "year");
139
+ break;
140
+
141
+ case ViewMode.Week:
142
+ newStartDate = startOfDate(newStartDate, "day");
143
+ newStartDate = addToDate(getMonday(newStartDate), -7 * preStepsCount, "day");
144
+ newEndDate = startOfDate(newEndDate, "day");
145
+ newEndDate = addToDate(newEndDate, 1.5, "month");
146
+ break;
147
+
148
+ case ViewMode.Day:
149
+ newStartDate = startOfDate(newStartDate, "day");
150
+ newStartDate = addToDate(newStartDate, -1 * preStepsCount, "day");
151
+ newEndDate = startOfDate(newEndDate, "day");
152
+ newEndDate = addToDate(newEndDate, 19, "day");
153
+ break;
154
+
155
+ case ViewMode.QuarterDay:
156
+ newStartDate = startOfDate(newStartDate, "day");
157
+ newStartDate = addToDate(newStartDate, -1 * preStepsCount, "day");
158
+ newEndDate = startOfDate(newEndDate, "day");
159
+ newEndDate = addToDate(newEndDate, 66, "hour");
160
+ break;
161
+
162
+ case ViewMode.HalfDay:
163
+ newStartDate = startOfDate(newStartDate, "day");
164
+ newStartDate = addToDate(newStartDate, -1 * preStepsCount, "day");
165
+ newEndDate = startOfDate(newEndDate, "day");
166
+ newEndDate = addToDate(newEndDate, 108, "hour");
167
+ break;
168
+
169
+ case ViewMode.Hour:
170
+ newStartDate = startOfDate(newStartDate, "hour");
171
+ newStartDate = addToDate(newStartDate, -1 * preStepsCount, "hour");
172
+ newEndDate = startOfDate(newEndDate, "day");
173
+ newEndDate = addToDate(newEndDate, 1, "day");
174
+ break;
175
+ }
176
+
177
+ return [newStartDate, newEndDate];
178
+ };
179
+ var seedDates = function seedDates(startDate, endDate, viewMode) {
180
+ var currentDate = new Date(startDate);
181
+ var dates = [currentDate];
182
+
183
+ while (currentDate < endDate) {
184
+ switch (viewMode) {
185
+ case ViewMode.Year:
186
+ currentDate = addToDate(currentDate, 1, "year");
187
+ break;
188
+
189
+ case ViewMode.QuarterYear:
190
+ currentDate = addToDate(currentDate, 3, "month");
191
+ break;
192
+
193
+ case ViewMode.Month:
194
+ currentDate = addToDate(currentDate, 1, "month");
195
+ break;
196
+
197
+ case ViewMode.Week:
198
+ currentDate = addToDate(currentDate, 7, "day");
199
+ break;
200
+
201
+ case ViewMode.Day:
202
+ currentDate = addToDate(currentDate, 1, "day");
203
+ break;
204
+
205
+ case ViewMode.HalfDay:
206
+ currentDate = addToDate(currentDate, 12, "hour");
207
+ break;
208
+
209
+ case ViewMode.QuarterDay:
210
+ currentDate = addToDate(currentDate, 6, "hour");
211
+ break;
212
+
213
+ case ViewMode.Hour:
214
+ currentDate = addToDate(currentDate, 1, "hour");
215
+ break;
216
+ }
217
+
218
+ dates.push(currentDate);
219
+ }
220
+
221
+ return dates;
222
+ };
223
+ var getLocaleMonth = function getLocaleMonth(date, locale) {
224
+ var bottomValue = getCachedDateTimeFormat(locale, {
225
+ month: "long"
226
+ }).format(date);
227
+ bottomValue = bottomValue.replace(bottomValue[0], bottomValue[0].toLocaleUpperCase());
228
+ return bottomValue;
229
+ };
230
+ var getLocalDayOfWeek = function getLocalDayOfWeek(date, locale, format) {
231
+ var bottomValue = getCachedDateTimeFormat(locale, {
232
+ weekday: format
233
+ }).format(date);
234
+ bottomValue = bottomValue.replace(bottomValue[0], bottomValue[0].toLocaleUpperCase());
235
+ return bottomValue;
236
+ };
237
+
238
+ var getMonday = function getMonday(date) {
239
+ var day = date.getDay();
240
+ var diff = date.getDate() - day + (day === 0 ? -6 : 1);
241
+ return new Date(date.setDate(diff));
242
+ };
243
+
244
+ var getWeekNumberISO8601 = function getWeekNumberISO8601(date) {
245
+ var tmpDate = new Date(date.valueOf());
246
+ var dayNumber = (tmpDate.getDay() + 6) % 7;
247
+ tmpDate.setDate(tmpDate.getDate() - dayNumber + 3);
248
+ var firstThursday = tmpDate.valueOf();
249
+ tmpDate.setMonth(0, 1);
250
+
251
+ if (tmpDate.getDay() !== 4) {
252
+ tmpDate.setMonth(0, 1 + (4 - tmpDate.getDay() + 7) % 7);
253
+ }
254
+
255
+ var weekNumber = (1 + Math.ceil((firstThursday - tmpDate.valueOf()) / 604800000)).toString();
256
+
257
+ if (weekNumber.length === 1) {
258
+ return "0" + weekNumber;
259
+ } else {
260
+ return weekNumber;
261
+ }
262
+ };
263
+ var getDaysInMonth = function getDaysInMonth(month, year) {
264
+ return new Date(year, month + 1, 0).getDate();
265
+ };
266
+
267
+ var styles = {"ganttTable":"_3_ygE","ganttTable_Header":"_1nBOt","ganttTable_HeaderSeparator":"_2eZzQ","ganttTable_HeaderItem":"_WuQ0f"};
268
+
269
+ var TaskListHeaderDefault = function TaskListHeaderDefault(_ref) {
270
+ var headerHeight = _ref.headerHeight,
271
+ fontFamily = _ref.fontFamily,
272
+ fontSize = _ref.fontSize,
273
+ rowWidth = _ref.rowWidth;
274
+ return React.createElement("div", {
275
+ className: styles.ganttTable,
276
+ style: {
277
+ fontFamily: fontFamily,
278
+ fontSize: fontSize
279
+ }
280
+ }, React.createElement("div", {
281
+ className: styles.ganttTable_Header,
282
+ style: {
283
+ height: headerHeight - 2
284
+ }
285
+ }, React.createElement("div", {
286
+ className: styles.ganttTable_HeaderItem,
287
+ style: {
288
+ minWidth: rowWidth
289
+ }
290
+ }, "\xA0Name"), React.createElement("div", {
291
+ className: styles.ganttTable_HeaderSeparator,
292
+ style: {
293
+ height: headerHeight * 0.5,
294
+ marginTop: headerHeight * 0.2
295
+ }
296
+ }), React.createElement("div", {
297
+ className: styles.ganttTable_HeaderItem,
298
+ style: {
299
+ minWidth: rowWidth
300
+ }
301
+ }, "\xA0From"), React.createElement("div", {
302
+ className: styles.ganttTable_HeaderSeparator,
303
+ style: {
304
+ height: headerHeight * 0.5,
305
+ marginTop: headerHeight * 0.25
306
+ }
307
+ }), React.createElement("div", {
308
+ className: styles.ganttTable_HeaderItem,
309
+ style: {
310
+ minWidth: rowWidth
311
+ }
312
+ }, "\xA0To")));
313
+ };
314
+
315
+ var styles$1 = {"taskListWrapper":"_3ZbQT","taskListTableRow":"_34SS0","taskListCell":"_3lLk3","taskListNameWrapper":"_nI1Xw","taskListExpander":"_2QjE6","taskListEmptyExpander":"_2TfEi"};
316
+
317
+ var localeDateStringCache = {};
318
+
319
+ var toLocaleDateStringFactory = function toLocaleDateStringFactory(locale) {
320
+ return function (date, dateTimeOptions) {
321
+ var key = date.toString();
322
+ var lds = localeDateStringCache[key];
323
+
324
+ if (!lds) {
325
+ lds = date.toLocaleDateString(locale, dateTimeOptions);
326
+ localeDateStringCache[key] = lds;
327
+ }
328
+
329
+ return lds;
330
+ };
331
+ };
332
+
333
+ var dateTimeOptions = {
334
+ weekday: "short",
335
+ year: "numeric",
336
+ month: "long",
337
+ day: "numeric"
338
+ };
339
+ var TaskListTableDefault = function TaskListTableDefault(_ref) {
340
+ var rowHeight = _ref.rowHeight,
341
+ rowWidth = _ref.rowWidth,
342
+ tasks = _ref.tasks,
343
+ fontFamily = _ref.fontFamily,
344
+ fontSize = _ref.fontSize,
345
+ locale = _ref.locale,
346
+ onExpanderClick = _ref.onExpanderClick;
347
+ var toLocaleDateString = useMemo(function () {
348
+ return toLocaleDateStringFactory(locale);
349
+ }, [locale]);
350
+ return React.createElement("div", {
351
+ className: styles$1.taskListWrapper,
352
+ style: {
353
+ fontFamily: fontFamily,
354
+ fontSize: fontSize
355
+ }
356
+ }, tasks.map(function (t) {
357
+ var expanderSymbol = "";
358
+
359
+ if (t.hideChildren === false) {
360
+ expanderSymbol = "▼";
361
+ } else if (t.hideChildren === true) {
362
+ expanderSymbol = "▶";
363
+ }
364
+
365
+ return React.createElement("div", {
366
+ className: styles$1.taskListTableRow,
367
+ style: {
368
+ height: rowHeight
369
+ },
370
+ key: t.id + "row"
371
+ }, React.createElement("div", {
372
+ className: styles$1.taskListCell,
373
+ style: {
374
+ minWidth: rowWidth,
375
+ maxWidth: rowWidth
376
+ },
377
+ title: t.name
378
+ }, React.createElement("div", {
379
+ className: styles$1.taskListNameWrapper
380
+ }, React.createElement("div", {
381
+ className: expanderSymbol ? styles$1.taskListExpander : styles$1.taskListEmptyExpander,
382
+ onClick: function onClick() {
383
+ return onExpanderClick(t);
384
+ }
385
+ }, expanderSymbol), React.createElement("div", null, t.name))), React.createElement("div", {
386
+ className: styles$1.taskListCell,
387
+ style: {
388
+ minWidth: rowWidth,
389
+ maxWidth: rowWidth
390
+ }
391
+ }, "\xA0", toLocaleDateString(t.start, dateTimeOptions)), React.createElement("div", {
392
+ className: styles$1.taskListCell,
393
+ style: {
394
+ minWidth: rowWidth,
395
+ maxWidth: rowWidth
396
+ }
397
+ }, "\xA0", toLocaleDateString(t.end, dateTimeOptions)));
398
+ }));
399
+ };
400
+
401
+ var styles$2 = {"tooltipDefaultContainer":"_3T42e","tooltipDefaultContainerParagraph":"_29NTg","tooltipDetailsContainer":"_25P-K","tooltipDetailsContainerHidden":"_3gVAq"};
402
+
403
+ var Tooltip = function Tooltip(_ref) {
404
+ var task = _ref.task,
405
+ rowHeight = _ref.rowHeight,
406
+ rtl = _ref.rtl,
407
+ svgContainerHeight = _ref.svgContainerHeight,
408
+ svgContainerWidth = _ref.svgContainerWidth,
409
+ scrollX = _ref.scrollX,
410
+ scrollY = _ref.scrollY,
411
+ arrowIndent = _ref.arrowIndent,
412
+ fontSize = _ref.fontSize,
413
+ fontFamily = _ref.fontFamily,
414
+ headerHeight = _ref.headerHeight,
415
+ taskListWidth = _ref.taskListWidth,
416
+ TooltipContent = _ref.TooltipContent;
417
+ var tooltipRef = useRef(null);
418
+
419
+ var _useState = useState(0),
420
+ relatedY = _useState[0],
421
+ setRelatedY = _useState[1];
422
+
423
+ var _useState2 = useState(0),
424
+ relatedX = _useState2[0],
425
+ setRelatedX = _useState2[1];
426
+
427
+ useEffect(function () {
428
+ if (tooltipRef.current) {
429
+ var tooltipHeight = tooltipRef.current.offsetHeight * 1.1;
430
+ var tooltipWidth = tooltipRef.current.offsetWidth * 1.1;
431
+ var newRelatedY = task.index * rowHeight - scrollY + headerHeight;
432
+ var newRelatedX;
433
+
434
+ if (rtl) {
435
+ newRelatedX = task.x1 - arrowIndent * 1.5 - tooltipWidth - scrollX;
436
+
437
+ if (newRelatedX < 0) {
438
+ newRelatedX = task.x2 + arrowIndent * 1.5 - scrollX;
439
+ }
440
+
441
+ var tooltipLeftmostPoint = tooltipWidth + newRelatedX;
442
+
443
+ if (tooltipLeftmostPoint > svgContainerWidth) {
444
+ newRelatedX = svgContainerWidth - tooltipWidth;
445
+ newRelatedY += rowHeight;
446
+ }
447
+ } else {
448
+ newRelatedX = task.x2 + arrowIndent * 1.5 + taskListWidth - scrollX;
449
+
450
+ var _tooltipLeftmostPoint = tooltipWidth + newRelatedX;
451
+
452
+ var fullChartWidth = taskListWidth + svgContainerWidth;
453
+
454
+ if (_tooltipLeftmostPoint > fullChartWidth) {
455
+ newRelatedX = task.x1 + taskListWidth - arrowIndent * 1.5 - scrollX - tooltipWidth;
456
+ }
457
+
458
+ if (newRelatedX < taskListWidth) {
459
+ newRelatedX = svgContainerWidth + taskListWidth - tooltipWidth;
460
+ newRelatedY += rowHeight;
461
+ }
462
+ }
463
+
464
+ var tooltipLowerPoint = tooltipHeight + newRelatedY - scrollY;
465
+
466
+ if (tooltipLowerPoint > svgContainerHeight - scrollY) {
467
+ newRelatedY = svgContainerHeight - tooltipHeight;
468
+ }
469
+
470
+ setRelatedY(newRelatedY);
471
+ setRelatedX(newRelatedX);
472
+ }
473
+ }, [tooltipRef, task, arrowIndent, scrollX, scrollY, headerHeight, taskListWidth, rowHeight, svgContainerHeight, svgContainerWidth, rtl]);
474
+ return React.createElement("div", {
475
+ ref: tooltipRef,
476
+ className: relatedX ? styles$2.tooltipDetailsContainer : styles$2.tooltipDetailsContainerHidden,
477
+ style: {
478
+ left: relatedX,
479
+ top: relatedY
480
+ }
481
+ }, React.createElement(TooltipContent, {
482
+ task: task,
483
+ fontSize: fontSize,
484
+ fontFamily: fontFamily
485
+ }));
486
+ };
487
+ var StandardTooltipContent = function StandardTooltipContent(_ref2) {
488
+ var task = _ref2.task,
489
+ fontSize = _ref2.fontSize,
490
+ fontFamily = _ref2.fontFamily;
491
+ var style = {
492
+ fontSize: fontSize,
493
+ fontFamily: fontFamily
494
+ };
495
+ return React.createElement("div", {
496
+ className: styles$2.tooltipDefaultContainer,
497
+ style: style
498
+ }, React.createElement("b", {
499
+ style: {
500
+ fontSize: fontSize + 6
501
+ }
502
+ }, task.name + ": " + task.start.getDate() + "-" + (task.start.getMonth() + 1) + "-" + task.start.getFullYear() + " - " + task.end.getDate() + "-" + (task.end.getMonth() + 1) + "-" + task.end.getFullYear()), task.end.getTime() - task.start.getTime() !== 0 && React.createElement("p", {
503
+ className: styles$2.tooltipDefaultContainerParagraph
504
+ }, "Duration: " + ~~((task.end.getTime() - task.start.getTime()) / (1000 * 60 * 60 * 24)) + " day(s)"), React.createElement("p", {
505
+ className: styles$2.tooltipDefaultContainerParagraph
506
+ }, !!task.progress && "Progress: " + task.progress + " %"));
507
+ };
508
+
509
+ var styles$3 = {"scroll":"_1eT-t"};
510
+
511
+ var VerticalScroll = function VerticalScroll(_ref) {
512
+ var scroll = _ref.scroll,
513
+ ganttHeight = _ref.ganttHeight,
514
+ ganttFullHeight = _ref.ganttFullHeight,
515
+ headerHeight = _ref.headerHeight,
516
+ rtl = _ref.rtl,
517
+ onScroll = _ref.onScroll;
518
+ var scrollRef = useRef(null);
519
+ useEffect(function () {
520
+ if (scrollRef.current) {
521
+ scrollRef.current.scrollTop = scroll;
522
+ }
523
+ }, [scroll]);
524
+ return React.createElement("div", {
525
+ style: {
526
+ height: ganttHeight,
527
+ marginTop: headerHeight,
528
+ marginLeft: rtl ? "" : "-1rem"
529
+ },
530
+ className: styles$3.scroll,
531
+ onScroll: onScroll,
532
+ ref: scrollRef
533
+ }, React.createElement("div", {
534
+ style: {
535
+ height: ganttFullHeight,
536
+ width: 1
537
+ }
538
+ }));
539
+ };
540
+
541
+ var TaskList = function TaskList(_ref) {
542
+ var headerHeight = _ref.headerHeight,
543
+ fontFamily = _ref.fontFamily,
544
+ fontSize = _ref.fontSize,
545
+ rowWidth = _ref.rowWidth,
546
+ rowHeight = _ref.rowHeight,
547
+ scrollY = _ref.scrollY,
548
+ tasks = _ref.tasks,
549
+ selectedTask = _ref.selectedTask,
550
+ setSelectedTask = _ref.setSelectedTask,
551
+ onExpanderClick = _ref.onExpanderClick,
552
+ locale = _ref.locale,
553
+ ganttHeight = _ref.ganttHeight,
554
+ taskListRef = _ref.taskListRef,
555
+ horizontalContainerClass = _ref.horizontalContainerClass,
556
+ TaskListHeader = _ref.TaskListHeader,
557
+ TaskListTable = _ref.TaskListTable;
558
+ var horizontalContainerRef = useRef(null);
559
+ useEffect(function () {
560
+ if (horizontalContainerRef.current) {
561
+ horizontalContainerRef.current.scrollTop = scrollY;
562
+ }
563
+ }, [scrollY]);
564
+ var headerProps = {
565
+ headerHeight: headerHeight,
566
+ fontFamily: fontFamily,
567
+ fontSize: fontSize,
568
+ rowWidth: rowWidth
569
+ };
570
+ var selectedTaskId = selectedTask ? selectedTask.id : "";
571
+ var tableProps = {
572
+ rowHeight: rowHeight,
573
+ rowWidth: rowWidth,
574
+ fontFamily: fontFamily,
575
+ fontSize: fontSize,
576
+ tasks: tasks,
577
+ locale: locale,
578
+ selectedTaskId: selectedTaskId,
579
+ setSelectedTask: setSelectedTask,
580
+ onExpanderClick: onExpanderClick
581
+ };
582
+ return React.createElement("div", {
583
+ ref: taskListRef
584
+ }, React.createElement(TaskListHeader, Object.assign({}, headerProps)), React.createElement("div", {
585
+ ref: horizontalContainerRef,
586
+ className: horizontalContainerClass,
587
+ style: ganttHeight ? {
588
+ height: ganttHeight
589
+ } : {}
590
+ }, React.createElement(TaskListTable, Object.assign({}, tableProps))));
591
+ };
592
+
593
+ var styles$4 = {"gridRow":"_2dZTy","gridRowLine":"_3rUKi","gridTick":"_RuwuK"};
594
+
595
+ var GridBody = function GridBody(_ref) {
596
+ var tasks = _ref.tasks,
597
+ dates = _ref.dates,
598
+ rowHeight = _ref.rowHeight,
599
+ svgWidth = _ref.svgWidth,
600
+ columnWidth = _ref.columnWidth,
601
+ todayColor = _ref.todayColor,
602
+ rtl = _ref.rtl;
603
+ var y = 0;
604
+ var gridRows = [];
605
+ var rowLines = [React.createElement("line", {
606
+ key: "RowLineFirst",
607
+ x: "0",
608
+ y1: 0,
609
+ x2: svgWidth,
610
+ y2: 0,
611
+ className: styles$4.gridRowLine
612
+ })];
613
+
614
+ for (var _iterator = _createForOfIteratorHelperLoose(tasks), _step; !(_step = _iterator()).done;) {
615
+ var task = _step.value;
616
+ gridRows.push(React.createElement("rect", {
617
+ key: "Row" + task.id,
618
+ x: "0",
619
+ y: y,
620
+ width: svgWidth,
621
+ height: rowHeight,
622
+ className: styles$4.gridRow
623
+ }));
624
+ rowLines.push(React.createElement("line", {
625
+ key: "RowLine" + task.id,
626
+ x: "0",
627
+ y1: y + rowHeight,
628
+ x2: svgWidth,
629
+ y2: y + rowHeight,
630
+ className: styles$4.gridRowLine
631
+ }));
632
+ y += rowHeight;
633
+ }
634
+
635
+ var now = new Date();
636
+ var tickX = 0;
637
+ var ticks = [];
638
+ var today = React.createElement("rect", null);
639
+
640
+ for (var i = 0; i < dates.length; i++) {
641
+ var date = dates[i];
642
+ ticks.push(React.createElement("line", {
643
+ key: date.getTime(),
644
+ x1: tickX,
645
+ y1: 0,
646
+ x2: tickX,
647
+ y2: y,
648
+ className: styles$4.gridTick
649
+ }));
650
+
651
+ if (i + 1 !== dates.length && date.getTime() < now.getTime() && dates[i + 1].getTime() >= now.getTime() || i !== 0 && i + 1 === dates.length && date.getTime() < now.getTime() && addToDate(date, date.getTime() - dates[i - 1].getTime(), "millisecond").getTime() >= now.getTime()) {
652
+ today = React.createElement("rect", {
653
+ x: tickX,
654
+ y: 0,
655
+ width: columnWidth,
656
+ height: y,
657
+ fill: todayColor
658
+ });
659
+ }
660
+
661
+ if (rtl && i + 1 !== dates.length && date.getTime() >= now.getTime() && dates[i + 1].getTime() < now.getTime()) {
662
+ today = React.createElement("rect", {
663
+ x: tickX + columnWidth,
664
+ y: 0,
665
+ width: columnWidth,
666
+ height: y,
667
+ fill: todayColor
668
+ });
669
+ }
670
+
671
+ tickX += columnWidth;
672
+ }
673
+
674
+ return React.createElement("g", {
675
+ className: "gridBody"
676
+ }, React.createElement("g", {
677
+ className: "rows"
678
+ }, gridRows), React.createElement("g", {
679
+ className: "rowLines"
680
+ }, rowLines), React.createElement("g", {
681
+ className: "ticks"
682
+ }, ticks), React.createElement("g", {
683
+ className: "today"
684
+ }, today));
685
+ };
686
+
687
+ var Grid = function Grid(props) {
688
+ return React.createElement("g", {
689
+ className: "grid"
690
+ }, React.createElement(GridBody, Object.assign({}, props)));
691
+ };
692
+
693
+ var styles$5 = {"calendarBottomText":"_9w8d5","calendarTopTick":"_1rLuZ","calendarTopText":"_2q1Kt","calendarHeader":"_35nLX"};
694
+
695
+ var TopPartOfCalendar = function TopPartOfCalendar(_ref) {
696
+ var value = _ref.value,
697
+ x1Line = _ref.x1Line,
698
+ y1Line = _ref.y1Line,
699
+ y2Line = _ref.y2Line,
700
+ xText = _ref.xText,
701
+ yText = _ref.yText;
702
+ return React.createElement("g", {
703
+ className: "calendarTop"
704
+ }, React.createElement("line", {
705
+ x1: x1Line,
706
+ y1: y1Line,
707
+ x2: x1Line,
708
+ y2: y2Line,
709
+ className: styles$5.calendarTopTick,
710
+ key: value + "line"
711
+ }), React.createElement("text", {
712
+ key: value + "text",
713
+ y: yText,
714
+ x: xText,
715
+ className: styles$5.calendarTopText
716
+ }, value));
717
+ };
718
+
719
+ var Calendar = function Calendar(_ref) {
720
+ var dateSetup = _ref.dateSetup,
721
+ locale = _ref.locale,
722
+ viewMode = _ref.viewMode,
723
+ rtl = _ref.rtl,
724
+ headerHeight = _ref.headerHeight,
725
+ columnWidth = _ref.columnWidth,
726
+ fontFamily = _ref.fontFamily,
727
+ fontSize = _ref.fontSize;
728
+
729
+ var getCalendarValuesForYear = function getCalendarValuesForYear() {
730
+ var topValues = [];
731
+ var bottomValues = [];
732
+ var topDefaultHeight = headerHeight * 0.5;
733
+
734
+ for (var i = 0; i < dateSetup.dates.length; i++) {
735
+ var date = dateSetup.dates[i];
736
+ var bottomValue = date.getFullYear();
737
+ bottomValues.push(React.createElement("text", {
738
+ key: date.getTime(),
739
+ y: headerHeight * 0.8,
740
+ x: columnWidth * i + columnWidth * 0.5,
741
+ className: styles$5.calendarBottomText
742
+ }, bottomValue));
743
+
744
+ if (i === 0 || date.getFullYear() !== dateSetup.dates[i - 1].getFullYear()) {
745
+ var topValue = date.getFullYear().toString();
746
+ var xText = void 0;
747
+
748
+ if (rtl) {
749
+ xText = (6 + i + date.getFullYear() + 1) * columnWidth;
750
+ } else {
751
+ xText = (6 + i - date.getFullYear()) * columnWidth;
752
+ }
753
+
754
+ topValues.push(React.createElement(TopPartOfCalendar, {
755
+ key: topValue,
756
+ value: topValue,
757
+ x1Line: columnWidth * i,
758
+ y1Line: 0,
759
+ y2Line: headerHeight,
760
+ xText: xText,
761
+ yText: topDefaultHeight * 0.9
762
+ }));
763
+ }
764
+ }
765
+
766
+ return [topValues, bottomValues];
767
+ };
768
+
769
+ var getCalendarValuesForQuarterYear = function getCalendarValuesForQuarterYear() {
770
+ var topValues = [];
771
+ var bottomValues = [];
772
+ var topDefaultHeight = headerHeight * 0.5;
773
+
774
+ for (var i = 0; i < dateSetup.dates.length; i++) {
775
+ var date = dateSetup.dates[i];
776
+ var quarter = "Q" + Math.floor((date.getMonth() + 3) / 3);
777
+ bottomValues.push(React.createElement("text", {
778
+ key: date.getTime(),
779
+ y: headerHeight * 0.8,
780
+ x: columnWidth * i + columnWidth * 0.5,
781
+ className: styles$5.calendarBottomText
782
+ }, quarter));
783
+
784
+ if (i === 0 || date.getFullYear() !== dateSetup.dates[i - 1].getFullYear()) {
785
+ var topValue = date.getFullYear().toString();
786
+ var xText = void 0;
787
+
788
+ if (rtl) {
789
+ xText = (6 + i + date.getMonth() + 1) * columnWidth;
790
+ } else {
791
+ xText = (6 + i - date.getMonth()) * columnWidth;
792
+ }
793
+
794
+ topValues.push(React.createElement(TopPartOfCalendar, {
795
+ key: topValue,
796
+ value: topValue,
797
+ x1Line: columnWidth * i,
798
+ y1Line: 0,
799
+ y2Line: topDefaultHeight,
800
+ xText: Math.abs(xText),
801
+ yText: topDefaultHeight * 0.9
802
+ }));
803
+ }
804
+ }
805
+
806
+ return [topValues, bottomValues];
807
+ };
808
+
809
+ var getCalendarValuesForMonth = function getCalendarValuesForMonth() {
810
+ var topValues = [];
811
+ var bottomValues = [];
812
+ var topDefaultHeight = headerHeight * 0.5;
813
+
814
+ for (var i = 0; i < dateSetup.dates.length; i++) {
815
+ var date = dateSetup.dates[i];
816
+ var bottomValue = getLocaleMonth(date, locale);
817
+ bottomValues.push(React.createElement("text", {
818
+ key: bottomValue + date.getFullYear(),
819
+ y: headerHeight * 0.8,
820
+ x: columnWidth * i + columnWidth * 0.5,
821
+ className: styles$5.calendarBottomText
822
+ }, bottomValue));
823
+
824
+ if (i === 0 || date.getFullYear() !== dateSetup.dates[i - 1].getFullYear()) {
825
+ var topValue = date.getFullYear().toString();
826
+ var xText = void 0;
827
+
828
+ if (rtl) {
829
+ xText = (6 + i + date.getMonth() + 1) * columnWidth;
830
+ } else {
831
+ xText = (6 + i - date.getMonth()) * columnWidth;
832
+ }
833
+
834
+ topValues.push(React.createElement(TopPartOfCalendar, {
835
+ key: topValue,
836
+ value: topValue,
837
+ x1Line: columnWidth * i,
838
+ y1Line: 0,
839
+ y2Line: topDefaultHeight,
840
+ xText: xText,
841
+ yText: topDefaultHeight * 0.9
842
+ }));
843
+ }
844
+ }
845
+
846
+ return [topValues, bottomValues];
847
+ };
848
+
849
+ var getCalendarValuesForWeek = function getCalendarValuesForWeek() {
850
+ var topValues = [];
851
+ var bottomValues = [];
852
+ var weeksCount = 1;
853
+ var topDefaultHeight = headerHeight * 0.5;
854
+ var dates = dateSetup.dates;
855
+
856
+ for (var i = dates.length - 1; i >= 0; i--) {
857
+ var date = dates[i];
858
+ var topValue = "";
859
+
860
+ if (i === 0 || date.getMonth() !== dates[i - 1].getMonth()) {
861
+ topValue = getLocaleMonth(date, locale) + ", " + date.getFullYear();
862
+ }
863
+
864
+ var bottomValue = "W" + getWeekNumberISO8601(date);
865
+ bottomValues.push(React.createElement("text", {
866
+ key: date.getTime(),
867
+ y: headerHeight * 0.8,
868
+ x: columnWidth * (i + +rtl),
869
+ className: styles$5.calendarBottomText
870
+ }, bottomValue));
871
+
872
+ if (topValue) {
873
+ if (i !== dates.length - 1) {
874
+ topValues.push(React.createElement(TopPartOfCalendar, {
875
+ key: topValue,
876
+ value: topValue,
877
+ x1Line: columnWidth * i + weeksCount * columnWidth,
878
+ y1Line: 0,
879
+ y2Line: topDefaultHeight,
880
+ xText: columnWidth * i + columnWidth * weeksCount * 0.5,
881
+ yText: topDefaultHeight * 0.9
882
+ }));
883
+ }
884
+
885
+ weeksCount = 0;
886
+ }
887
+
888
+ weeksCount++;
889
+ }
890
+
891
+ return [topValues, bottomValues];
892
+ };
893
+
894
+ var getCalendarValuesForDay = function getCalendarValuesForDay() {
895
+ var topValues = [];
896
+ var bottomValues = [];
897
+ var topDefaultHeight = headerHeight * 0.5;
898
+ var dates = dateSetup.dates;
899
+
900
+ for (var i = 0; i < dates.length; i++) {
901
+ var date = dates[i];
902
+ var bottomValue = getLocalDayOfWeek(date, locale, "short") + ", " + date.getDate().toString();
903
+ bottomValues.push(React.createElement("text", {
904
+ key: date.getTime(),
905
+ y: headerHeight * 0.8,
906
+ x: columnWidth * i + columnWidth * 0.5,
907
+ className: styles$5.calendarBottomText
908
+ }, bottomValue));
909
+
910
+ if (i + 1 !== dates.length && date.getMonth() !== dates[i + 1].getMonth()) {
911
+ var topValue = getLocaleMonth(date, locale);
912
+ topValues.push(React.createElement(TopPartOfCalendar, {
913
+ key: topValue + date.getFullYear(),
914
+ value: topValue,
915
+ x1Line: columnWidth * (i + 1),
916
+ y1Line: 0,
917
+ y2Line: topDefaultHeight,
918
+ xText: columnWidth * (i + 1) - getDaysInMonth(date.getMonth(), date.getFullYear()) * columnWidth * 0.5,
919
+ yText: topDefaultHeight * 0.9
920
+ }));
921
+ }
922
+ }
923
+
924
+ return [topValues, bottomValues];
925
+ };
926
+
927
+ var getCalendarValuesForPartOfDay = function getCalendarValuesForPartOfDay() {
928
+ var topValues = [];
929
+ var bottomValues = [];
930
+ var ticks = viewMode === ViewMode.HalfDay ? 2 : 4;
931
+ var topDefaultHeight = headerHeight * 0.5;
932
+ var dates = dateSetup.dates;
933
+
934
+ for (var i = 0; i < dates.length; i++) {
935
+ var date = dates[i];
936
+ var bottomValue = getCachedDateTimeFormat(locale, {
937
+ hour: "numeric"
938
+ }).format(date);
939
+ bottomValues.push(React.createElement("text", {
940
+ key: date.getTime(),
941
+ y: headerHeight * 0.8,
942
+ x: columnWidth * (i + +rtl),
943
+ className: styles$5.calendarBottomText,
944
+ fontFamily: fontFamily
945
+ }, bottomValue));
946
+
947
+ if (i === 0 || date.getDate() !== dates[i - 1].getDate()) {
948
+ var topValue = getLocalDayOfWeek(date, locale, "short") + ", " + date.getDate() + " " + getLocaleMonth(date, locale);
949
+ topValues.push(React.createElement(TopPartOfCalendar, {
950
+ key: topValue + date.getFullYear(),
951
+ value: topValue,
952
+ x1Line: columnWidth * i + ticks * columnWidth,
953
+ y1Line: 0,
954
+ y2Line: topDefaultHeight,
955
+ xText: columnWidth * i + ticks * columnWidth * 0.5,
956
+ yText: topDefaultHeight * 0.9
957
+ }));
958
+ }
959
+ }
960
+
961
+ return [topValues, bottomValues];
962
+ };
963
+
964
+ var getCalendarValuesForHour = function getCalendarValuesForHour() {
965
+ var topValues = [];
966
+ var bottomValues = [];
967
+ var topDefaultHeight = headerHeight * 0.5;
968
+ var dates = dateSetup.dates;
969
+
970
+ for (var i = 0; i < dates.length; i++) {
971
+ var date = dates[i];
972
+ var bottomValue = getCachedDateTimeFormat(locale, {
973
+ hour: "numeric"
974
+ }).format(date);
975
+ bottomValues.push(React.createElement("text", {
976
+ key: date.getTime(),
977
+ y: headerHeight * 0.8,
978
+ x: columnWidth * (i + +rtl),
979
+ className: styles$5.calendarBottomText,
980
+ fontFamily: fontFamily
981
+ }, bottomValue));
982
+
983
+ if (i !== 0 && date.getDate() !== dates[i - 1].getDate()) {
984
+ var displayDate = dates[i - 1];
985
+ var topValue = getLocalDayOfWeek(displayDate, locale, "long") + ", " + displayDate.getDate() + " " + getLocaleMonth(displayDate, locale);
986
+ var topPosition = (date.getHours() - 24) / 2;
987
+ topValues.push(React.createElement(TopPartOfCalendar, {
988
+ key: topValue + displayDate.getFullYear(),
989
+ value: topValue,
990
+ x1Line: columnWidth * i,
991
+ y1Line: 0,
992
+ y2Line: topDefaultHeight,
993
+ xText: columnWidth * (i + topPosition),
994
+ yText: topDefaultHeight * 0.9
995
+ }));
996
+ }
997
+ }
998
+
999
+ return [topValues, bottomValues];
1000
+ };
1001
+
1002
+ var topValues = [];
1003
+ var bottomValues = [];
1004
+
1005
+ switch (dateSetup.viewMode) {
1006
+ case ViewMode.Year:
1007
+ var _getCalendarValuesFor = getCalendarValuesForYear();
1008
+
1009
+ topValues = _getCalendarValuesFor[0];
1010
+ bottomValues = _getCalendarValuesFor[1];
1011
+ break;
1012
+
1013
+ case ViewMode.QuarterYear:
1014
+ var _getCalendarValuesFor2 = getCalendarValuesForQuarterYear();
1015
+
1016
+ topValues = _getCalendarValuesFor2[0];
1017
+ bottomValues = _getCalendarValuesFor2[1];
1018
+ break;
1019
+
1020
+ case ViewMode.Month:
1021
+ var _getCalendarValuesFor3 = getCalendarValuesForMonth();
1022
+
1023
+ topValues = _getCalendarValuesFor3[0];
1024
+ bottomValues = _getCalendarValuesFor3[1];
1025
+ break;
1026
+
1027
+ case ViewMode.Week:
1028
+ var _getCalendarValuesFor4 = getCalendarValuesForWeek();
1029
+
1030
+ topValues = _getCalendarValuesFor4[0];
1031
+ bottomValues = _getCalendarValuesFor4[1];
1032
+ break;
1033
+
1034
+ case ViewMode.Day:
1035
+ var _getCalendarValuesFor5 = getCalendarValuesForDay();
1036
+
1037
+ topValues = _getCalendarValuesFor5[0];
1038
+ bottomValues = _getCalendarValuesFor5[1];
1039
+ break;
1040
+
1041
+ case ViewMode.QuarterDay:
1042
+ case ViewMode.HalfDay:
1043
+ var _getCalendarValuesFor6 = getCalendarValuesForPartOfDay();
1044
+
1045
+ topValues = _getCalendarValuesFor6[0];
1046
+ bottomValues = _getCalendarValuesFor6[1];
1047
+ break;
1048
+
1049
+ case ViewMode.Hour:
1050
+ var _getCalendarValuesFor7 = getCalendarValuesForHour();
1051
+
1052
+ topValues = _getCalendarValuesFor7[0];
1053
+ bottomValues = _getCalendarValuesFor7[1];
1054
+ }
1055
+
1056
+ return React.createElement("g", {
1057
+ className: "calendar",
1058
+ fontSize: fontSize,
1059
+ fontFamily: fontFamily
1060
+ }, React.createElement("rect", {
1061
+ x: 0,
1062
+ y: 0,
1063
+ width: columnWidth * dateSetup.dates.length,
1064
+ height: headerHeight,
1065
+ className: styles$5.calendarHeader
1066
+ }), bottomValues, " ", topValues);
1067
+ };
1068
+
1069
+ // A type of promise-like that resolves synchronously and supports only one observer
1070
+
1071
+ const _iteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.iterator || (Symbol.iterator = Symbol("Symbol.iterator"))) : "@@iterator";
1072
+
1073
+ const _asyncIteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.asyncIterator || (Symbol.asyncIterator = Symbol("Symbol.asyncIterator"))) : "@@asyncIterator";
1074
+
1075
+ // Asynchronously call a function and send errors to recovery continuation
1076
+ function _catch(body, recover) {
1077
+ try {
1078
+ var result = body();
1079
+ } catch(e) {
1080
+ return recover(e);
1081
+ }
1082
+ if (result && result.then) {
1083
+ return result.then(void 0, recover);
1084
+ }
1085
+ return result;
1086
+ }
1087
+
1088
+ var Arrow = function Arrow(_ref) {
1089
+ var taskFrom = _ref.taskFrom,
1090
+ taskTo = _ref.taskTo,
1091
+ rowHeight = _ref.rowHeight,
1092
+ taskHeight = _ref.taskHeight,
1093
+ arrowIndent = _ref.arrowIndent,
1094
+ rtl = _ref.rtl;
1095
+ var path;
1096
+ var trianglePoints;
1097
+
1098
+ if (rtl) {
1099
+ var _drownPathAndTriangle = drownPathAndTriangleRTL(taskFrom, taskTo, rowHeight, taskHeight, arrowIndent);
1100
+
1101
+ path = _drownPathAndTriangle[0];
1102
+ trianglePoints = _drownPathAndTriangle[1];
1103
+ } else {
1104
+ var _drownPathAndTriangle2 = drownPathAndTriangle(taskFrom, taskTo, rowHeight, taskHeight, arrowIndent);
1105
+
1106
+ path = _drownPathAndTriangle2[0];
1107
+ trianglePoints = _drownPathAndTriangle2[1];
1108
+ }
1109
+
1110
+ return React.createElement("g", {
1111
+ className: "arrow"
1112
+ }, React.createElement("path", {
1113
+ strokeWidth: "1.5",
1114
+ d: path,
1115
+ fill: "none"
1116
+ }), React.createElement("polygon", {
1117
+ points: trianglePoints
1118
+ }));
1119
+ };
1120
+
1121
+ var drownPathAndTriangle = function drownPathAndTriangle(taskFrom, taskTo, rowHeight, taskHeight, arrowIndent) {
1122
+ var indexCompare = taskFrom.index > taskTo.index ? -1 : 1;
1123
+ var taskToEndPosition = taskTo.y + taskHeight / 2;
1124
+ var taskFromEndPosition = taskFrom.x2 + arrowIndent * 2;
1125
+ var taskFromHorizontalOffsetValue = taskFromEndPosition < taskTo.x1 ? "" : "H " + (taskTo.x1 - arrowIndent);
1126
+ var taskToHorizontalOffsetValue = taskFromEndPosition > taskTo.x1 ? arrowIndent : taskTo.x1 - taskFrom.x2 - arrowIndent;
1127
+ var path = "M " + taskFrom.x2 + " " + (taskFrom.y + taskHeight / 2) + " \n h " + arrowIndent + " \n v " + indexCompare * rowHeight / 2 + " \n " + taskFromHorizontalOffsetValue + "\n V " + taskToEndPosition + " \n h " + taskToHorizontalOffsetValue;
1128
+ var trianglePoints = taskTo.x1 + "," + taskToEndPosition + " \n " + (taskTo.x1 - 5) + "," + (taskToEndPosition - 5) + " \n " + (taskTo.x1 - 5) + "," + (taskToEndPosition + 5);
1129
+ return [path, trianglePoints];
1130
+ };
1131
+
1132
+ var drownPathAndTriangleRTL = function drownPathAndTriangleRTL(taskFrom, taskTo, rowHeight, taskHeight, arrowIndent) {
1133
+ var indexCompare = taskFrom.index > taskTo.index ? -1 : 1;
1134
+ var taskToEndPosition = taskTo.y + taskHeight / 2;
1135
+ var taskFromEndPosition = taskFrom.x1 - arrowIndent * 2;
1136
+ var taskFromHorizontalOffsetValue = taskFromEndPosition > taskTo.x2 ? "" : "H " + (taskTo.x2 + arrowIndent);
1137
+ var taskToHorizontalOffsetValue = taskFromEndPosition < taskTo.x2 ? -arrowIndent : taskTo.x2 - taskFrom.x1 + arrowIndent;
1138
+ var path = "M " + taskFrom.x1 + " " + (taskFrom.y + taskHeight / 2) + " \n h " + -arrowIndent + " \n v " + indexCompare * rowHeight / 2 + " \n " + taskFromHorizontalOffsetValue + "\n V " + taskToEndPosition + " \n h " + taskToHorizontalOffsetValue;
1139
+ var trianglePoints = taskTo.x2 + "," + taskToEndPosition + " \n " + (taskTo.x2 + 5) + "," + (taskToEndPosition + 5) + " \n " + (taskTo.x2 + 5) + "," + (taskToEndPosition - 5);
1140
+ return [path, trianglePoints];
1141
+ };
1142
+
1143
+ var convertToBarTasks = function convertToBarTasks(tasks, dates, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, milestoneBackgroundColor, milestoneBackgroundSelectedColor) {
1144
+ var barTasks = tasks.map(function (t, i) {
1145
+ return convertToBarTask(t, i, dates, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, milestoneBackgroundColor, milestoneBackgroundSelectedColor);
1146
+ });
1147
+ barTasks = barTasks.map(function (task) {
1148
+ var dependencies = task.dependencies || [];
1149
+
1150
+ var _loop = function _loop(j) {
1151
+ var dependence = barTasks.findIndex(function (value) {
1152
+ return value.id === dependencies[j];
1153
+ });
1154
+ if (dependence !== -1) barTasks[dependence].barChildren.push(task);
1155
+ };
1156
+
1157
+ for (var j = 0; j < dependencies.length; j++) {
1158
+ _loop(j);
1159
+ }
1160
+
1161
+ return task;
1162
+ });
1163
+ return barTasks;
1164
+ };
1165
+
1166
+ var convertToBarTask = function convertToBarTask(task, index, dates, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, milestoneBackgroundColor, milestoneBackgroundSelectedColor) {
1167
+ var barTask;
1168
+
1169
+ switch (task.type) {
1170
+ case "milestone":
1171
+ barTask = convertToMilestone(task, index, dates, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, milestoneBackgroundColor, milestoneBackgroundSelectedColor);
1172
+ break;
1173
+
1174
+ case "project":
1175
+ barTask = convertToBar(task, index, dates, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor);
1176
+ break;
1177
+
1178
+ default:
1179
+ barTask = convertToBar(task, index, dates, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor);
1180
+ break;
1181
+ }
1182
+
1183
+ return barTask;
1184
+ };
1185
+
1186
+ var convertToBar = function convertToBar(task, index, dates, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor) {
1187
+ var x1;
1188
+ var x2;
1189
+
1190
+ if (rtl) {
1191
+ x2 = taskXCoordinateRTL(task.start, dates, columnWidth);
1192
+ x1 = taskXCoordinateRTL(task.end, dates, columnWidth);
1193
+ } else {
1194
+ x1 = taskXCoordinate(task.start, dates, columnWidth);
1195
+ x2 = taskXCoordinate(task.end, dates, columnWidth);
1196
+ }
1197
+
1198
+ var typeInternal = task.type;
1199
+
1200
+ if (typeInternal === "task" && x2 - x1 < handleWidth * 2) {
1201
+ typeInternal = "smalltask";
1202
+ x2 = x1 + handleWidth * 2;
1203
+ }
1204
+
1205
+ var _progressWithByParams = progressWithByParams(x1, x2, task.progress, rtl),
1206
+ progressWidth = _progressWithByParams[0],
1207
+ progressX = _progressWithByParams[1];
1208
+
1209
+ var y = taskYCoordinate(index, rowHeight, taskHeight);
1210
+ var hideChildren = task.type === "project" ? task.hideChildren : undefined;
1211
+
1212
+ var styles = _extends({
1213
+ backgroundColor: barBackgroundColor,
1214
+ backgroundSelectedColor: barBackgroundSelectedColor,
1215
+ progressColor: barProgressColor,
1216
+ progressSelectedColor: barProgressSelectedColor
1217
+ }, task.styles);
1218
+
1219
+ return _extends({}, task, {
1220
+ typeInternal: typeInternal,
1221
+ x1: x1,
1222
+ x2: x2,
1223
+ y: y,
1224
+ index: index,
1225
+ progressX: progressX,
1226
+ progressWidth: progressWidth,
1227
+ barCornerRadius: barCornerRadius,
1228
+ handleWidth: handleWidth,
1229
+ hideChildren: hideChildren,
1230
+ height: taskHeight,
1231
+ barChildren: [],
1232
+ styles: styles
1233
+ });
1234
+ };
1235
+
1236
+ var convertToMilestone = function convertToMilestone(task, index, dates, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, milestoneBackgroundColor, milestoneBackgroundSelectedColor) {
1237
+ var x = taskXCoordinate(task.start, dates, columnWidth);
1238
+ var y = taskYCoordinate(index, rowHeight, taskHeight);
1239
+ var x1 = x - taskHeight * 0.5;
1240
+ var x2 = x + taskHeight * 0.5;
1241
+ var rotatedHeight = taskHeight / 1.414;
1242
+
1243
+ var styles = _extends({
1244
+ backgroundColor: milestoneBackgroundColor,
1245
+ backgroundSelectedColor: milestoneBackgroundSelectedColor,
1246
+ progressColor: "",
1247
+ progressSelectedColor: ""
1248
+ }, task.styles);
1249
+
1250
+ return _extends({}, task, {
1251
+ end: task.start,
1252
+ x1: x1,
1253
+ x2: x2,
1254
+ y: y,
1255
+ index: index,
1256
+ progressX: 0,
1257
+ progressWidth: 0,
1258
+ barCornerRadius: barCornerRadius,
1259
+ handleWidth: handleWidth,
1260
+ typeInternal: task.type,
1261
+ progress: 0,
1262
+ height: rotatedHeight,
1263
+ hideChildren: undefined,
1264
+ barChildren: [],
1265
+ styles: styles
1266
+ });
1267
+ };
1268
+
1269
+ var taskXCoordinate = function taskXCoordinate(xDate, dates, columnWidth) {
1270
+ var index = dates.findIndex(function (d) {
1271
+ return d.getTime() >= xDate.getTime();
1272
+ }) - 1;
1273
+ var remainderMillis = xDate.getTime() - dates[index].getTime();
1274
+ var percentOfInterval = remainderMillis / (dates[index + 1].getTime() - dates[index].getTime());
1275
+ var x = index * columnWidth + percentOfInterval * columnWidth;
1276
+ return x;
1277
+ };
1278
+
1279
+ var taskXCoordinateRTL = function taskXCoordinateRTL(xDate, dates, columnWidth) {
1280
+ var x = taskXCoordinate(xDate, dates, columnWidth);
1281
+ x += columnWidth;
1282
+ return x;
1283
+ };
1284
+
1285
+ var taskYCoordinate = function taskYCoordinate(index, rowHeight, taskHeight) {
1286
+ var y = index * rowHeight + (rowHeight - taskHeight) / 2;
1287
+ return y;
1288
+ };
1289
+
1290
+ var progressWithByParams = function progressWithByParams(taskX1, taskX2, progress, rtl) {
1291
+ var progressWidth = (taskX2 - taskX1) * progress * 0.01;
1292
+ var progressX;
1293
+
1294
+ if (rtl) {
1295
+ progressX = taskX2 - progressWidth;
1296
+ } else {
1297
+ progressX = taskX1;
1298
+ }
1299
+
1300
+ return [progressWidth, progressX];
1301
+ };
1302
+
1303
+ var progressByX = function progressByX(x, task) {
1304
+ if (x >= task.x2) return 100;else if (x <= task.x1) return 0;else {
1305
+ var barWidth = task.x2 - task.x1;
1306
+ var progressPercent = Math.round((x - task.x1) * 100 / barWidth);
1307
+ return progressPercent;
1308
+ }
1309
+ };
1310
+
1311
+ var progressByXRTL = function progressByXRTL(x, task) {
1312
+ if (x >= task.x2) return 0;else if (x <= task.x1) return 100;else {
1313
+ var barWidth = task.x2 - task.x1;
1314
+ var progressPercent = Math.round((task.x2 - x) * 100 / barWidth);
1315
+ return progressPercent;
1316
+ }
1317
+ };
1318
+
1319
+ var getProgressPoint = function getProgressPoint(progressX, taskY, taskHeight) {
1320
+ var point = [progressX - 5, taskY + taskHeight, progressX + 5, taskY + taskHeight, progressX, taskY + taskHeight - 8.66];
1321
+ return point.join(",");
1322
+ };
1323
+
1324
+ var startByX = function startByX(x, xStep, task) {
1325
+ if (x >= task.x2 - task.handleWidth * 2) {
1326
+ x = task.x2 - task.handleWidth * 2;
1327
+ }
1328
+
1329
+ var steps = Math.round((x - task.x1) / xStep);
1330
+ var additionalXValue = steps * xStep;
1331
+ var newX = task.x1 + additionalXValue;
1332
+ return newX;
1333
+ };
1334
+
1335
+ var endByX = function endByX(x, xStep, task) {
1336
+ if (x <= task.x1 + task.handleWidth * 2) {
1337
+ x = task.x1 + task.handleWidth * 2;
1338
+ }
1339
+
1340
+ var steps = Math.round((x - task.x2) / xStep);
1341
+ var additionalXValue = steps * xStep;
1342
+ var newX = task.x2 + additionalXValue;
1343
+ return newX;
1344
+ };
1345
+
1346
+ var moveByX = function moveByX(x, xStep, task) {
1347
+ var steps = Math.round((x - task.x1) / xStep);
1348
+ var additionalXValue = steps * xStep;
1349
+ var newX1 = task.x1 + additionalXValue;
1350
+ var newX2 = newX1 + task.x2 - task.x1;
1351
+ return [newX1, newX2];
1352
+ };
1353
+
1354
+ var dateByX = function dateByX(x, taskX, taskDate, xStep, timeStep) {
1355
+ var newDate = new Date((x - taskX) / xStep * timeStep + taskDate.getTime());
1356
+ newDate = new Date(newDate.getTime() + (newDate.getTimezoneOffset() - taskDate.getTimezoneOffset()) * 60000);
1357
+ return newDate;
1358
+ };
1359
+
1360
+ var handleTaskBySVGMouseEvent = function handleTaskBySVGMouseEvent(svgX, action, selectedTask, xStep, timeStep, initEventX1Delta, rtl) {
1361
+ var result;
1362
+
1363
+ switch (selectedTask.type) {
1364
+ case "milestone":
1365
+ result = handleTaskBySVGMouseEventForMilestone(svgX, action, selectedTask, xStep, timeStep, initEventX1Delta);
1366
+ break;
1367
+
1368
+ default:
1369
+ result = handleTaskBySVGMouseEventForBar(svgX, action, selectedTask, xStep, timeStep, initEventX1Delta, rtl);
1370
+ break;
1371
+ }
1372
+
1373
+ return result;
1374
+ };
1375
+
1376
+ var handleTaskBySVGMouseEventForBar = function handleTaskBySVGMouseEventForBar(svgX, action, selectedTask, xStep, timeStep, initEventX1Delta, rtl) {
1377
+ var changedTask = _extends({}, selectedTask);
1378
+
1379
+ var isChanged = false;
1380
+
1381
+ switch (action) {
1382
+ case "progress":
1383
+ if (rtl) {
1384
+ changedTask.progress = progressByXRTL(svgX, selectedTask);
1385
+ } else {
1386
+ changedTask.progress = progressByX(svgX, selectedTask);
1387
+ }
1388
+
1389
+ isChanged = changedTask.progress !== selectedTask.progress;
1390
+
1391
+ if (isChanged) {
1392
+ var _progressWithByParams2 = progressWithByParams(changedTask.x1, changedTask.x2, changedTask.progress, rtl),
1393
+ progressWidth = _progressWithByParams2[0],
1394
+ progressX = _progressWithByParams2[1];
1395
+
1396
+ changedTask.progressWidth = progressWidth;
1397
+ changedTask.progressX = progressX;
1398
+ }
1399
+
1400
+ break;
1401
+
1402
+ case "start":
1403
+ {
1404
+ var newX1 = startByX(svgX, xStep, selectedTask);
1405
+ changedTask.x1 = newX1;
1406
+ isChanged = changedTask.x1 !== selectedTask.x1;
1407
+
1408
+ if (isChanged) {
1409
+ if (rtl) {
1410
+ changedTask.end = dateByX(newX1, selectedTask.x1, selectedTask.end, xStep, timeStep);
1411
+ } else {
1412
+ changedTask.start = dateByX(newX1, selectedTask.x1, selectedTask.start, xStep, timeStep);
1413
+ }
1414
+
1415
+ var _progressWithByParams3 = progressWithByParams(changedTask.x1, changedTask.x2, changedTask.progress, rtl),
1416
+ _progressWidth = _progressWithByParams3[0],
1417
+ _progressX = _progressWithByParams3[1];
1418
+
1419
+ changedTask.progressWidth = _progressWidth;
1420
+ changedTask.progressX = _progressX;
1421
+ }
1422
+
1423
+ break;
1424
+ }
1425
+
1426
+ case "end":
1427
+ {
1428
+ var newX2 = endByX(svgX, xStep, selectedTask);
1429
+ changedTask.x2 = newX2;
1430
+ isChanged = changedTask.x2 !== selectedTask.x2;
1431
+
1432
+ if (isChanged) {
1433
+ if (rtl) {
1434
+ changedTask.start = dateByX(newX2, selectedTask.x2, selectedTask.start, xStep, timeStep);
1435
+ } else {
1436
+ changedTask.end = dateByX(newX2, selectedTask.x2, selectedTask.end, xStep, timeStep);
1437
+ }
1438
+
1439
+ var _progressWithByParams4 = progressWithByParams(changedTask.x1, changedTask.x2, changedTask.progress, rtl),
1440
+ _progressWidth2 = _progressWithByParams4[0],
1441
+ _progressX2 = _progressWithByParams4[1];
1442
+
1443
+ changedTask.progressWidth = _progressWidth2;
1444
+ changedTask.progressX = _progressX2;
1445
+ }
1446
+
1447
+ break;
1448
+ }
1449
+
1450
+ case "move":
1451
+ {
1452
+ var _moveByX = moveByX(svgX - initEventX1Delta, xStep, selectedTask),
1453
+ newMoveX1 = _moveByX[0],
1454
+ newMoveX2 = _moveByX[1];
1455
+
1456
+ isChanged = newMoveX1 !== selectedTask.x1;
1457
+
1458
+ if (isChanged) {
1459
+ changedTask.start = dateByX(newMoveX1, selectedTask.x1, selectedTask.start, xStep, timeStep);
1460
+ changedTask.end = dateByX(newMoveX2, selectedTask.x2, selectedTask.end, xStep, timeStep);
1461
+ changedTask.x1 = newMoveX1;
1462
+ changedTask.x2 = newMoveX2;
1463
+
1464
+ var _progressWithByParams5 = progressWithByParams(changedTask.x1, changedTask.x2, changedTask.progress, rtl),
1465
+ _progressWidth3 = _progressWithByParams5[0],
1466
+ _progressX3 = _progressWithByParams5[1];
1467
+
1468
+ changedTask.progressWidth = _progressWidth3;
1469
+ changedTask.progressX = _progressX3;
1470
+ }
1471
+
1472
+ break;
1473
+ }
1474
+ }
1475
+
1476
+ return {
1477
+ isChanged: isChanged,
1478
+ changedTask: changedTask
1479
+ };
1480
+ };
1481
+
1482
+ var handleTaskBySVGMouseEventForMilestone = function handleTaskBySVGMouseEventForMilestone(svgX, action, selectedTask, xStep, timeStep, initEventX1Delta) {
1483
+ var changedTask = _extends({}, selectedTask);
1484
+
1485
+ var isChanged = false;
1486
+
1487
+ switch (action) {
1488
+ case "move":
1489
+ {
1490
+ var _moveByX2 = moveByX(svgX - initEventX1Delta, xStep, selectedTask),
1491
+ newMoveX1 = _moveByX2[0],
1492
+ newMoveX2 = _moveByX2[1];
1493
+
1494
+ isChanged = newMoveX1 !== selectedTask.x1;
1495
+
1496
+ if (isChanged) {
1497
+ changedTask.start = dateByX(newMoveX1, selectedTask.x1, selectedTask.start, xStep, timeStep);
1498
+ changedTask.end = changedTask.start;
1499
+ changedTask.x1 = newMoveX1;
1500
+ changedTask.x2 = newMoveX2;
1501
+ }
1502
+
1503
+ break;
1504
+ }
1505
+ }
1506
+
1507
+ return {
1508
+ isChanged: isChanged,
1509
+ changedTask: changedTask
1510
+ };
1511
+ };
1512
+
1513
+ function isKeyboardEvent(event) {
1514
+ return event.key !== undefined;
1515
+ }
1516
+ function removeHiddenTasks(tasks) {
1517
+ var groupedTasks = tasks.filter(function (t) {
1518
+ return t.hideChildren && t.type === "project";
1519
+ });
1520
+
1521
+ if (groupedTasks.length > 0) {
1522
+ var _loop = function _loop(i) {
1523
+ var groupedTask = groupedTasks[i];
1524
+ var children = getChildren(tasks, groupedTask);
1525
+ tasks = tasks.filter(function (t) {
1526
+ return children.indexOf(t) === -1;
1527
+ });
1528
+ };
1529
+
1530
+ for (var i = 0; groupedTasks.length > i; i++) {
1531
+ _loop(i);
1532
+ }
1533
+ }
1534
+
1535
+ return tasks;
1536
+ }
1537
+
1538
+ function getChildren(taskList, task) {
1539
+ var tasks = [];
1540
+
1541
+ if (task.type !== "project") {
1542
+ tasks = taskList.filter(function (t) {
1543
+ return t.dependencies && t.dependencies.indexOf(task.id) !== -1;
1544
+ });
1545
+ } else {
1546
+ tasks = taskList.filter(function (t) {
1547
+ return t.project && t.project === task.id;
1548
+ });
1549
+ }
1550
+
1551
+ var taskChildren = [];
1552
+ tasks.forEach(function (t) {
1553
+ taskChildren.push.apply(taskChildren, getChildren(taskList, t));
1554
+ });
1555
+ tasks = tasks.concat(tasks, taskChildren);
1556
+ return tasks;
1557
+ }
1558
+
1559
+ var sortTasks = function sortTasks(taskA, taskB) {
1560
+ var orderA = taskA.displayOrder || Number.MAX_VALUE;
1561
+ var orderB = taskB.displayOrder || Number.MAX_VALUE;
1562
+
1563
+ if (orderA > orderB) {
1564
+ return 1;
1565
+ } else if (orderA < orderB) {
1566
+ return -1;
1567
+ } else {
1568
+ return 0;
1569
+ }
1570
+ };
1571
+
1572
+ var styles$6 = {"barWrapper":"_KxSXS","barHandle":"_3w_5u","barBackground":"_31ERP"};
1573
+
1574
+ var BarDisplay = function BarDisplay(_ref) {
1575
+ var x = _ref.x,
1576
+ y = _ref.y,
1577
+ width = _ref.width,
1578
+ height = _ref.height,
1579
+ isSelected = _ref.isSelected,
1580
+ progressX = _ref.progressX,
1581
+ progressWidth = _ref.progressWidth,
1582
+ barCornerRadius = _ref.barCornerRadius,
1583
+ styles = _ref.styles,
1584
+ onMouseDown = _ref.onMouseDown;
1585
+
1586
+ var getProcessColor = function getProcessColor() {
1587
+ return isSelected ? styles.progressSelectedColor : styles.progressColor;
1588
+ };
1589
+
1590
+ var getBarColor = function getBarColor() {
1591
+ return isSelected ? styles.backgroundSelectedColor : styles.backgroundColor;
1592
+ };
1593
+
1594
+ return React.createElement("g", {
1595
+ onMouseDown: onMouseDown
1596
+ }, React.createElement("rect", {
1597
+ x: x,
1598
+ width: width,
1599
+ y: y,
1600
+ height: height,
1601
+ ry: barCornerRadius,
1602
+ rx: barCornerRadius,
1603
+ fill: getBarColor(),
1604
+ className: styles$6.barBackground
1605
+ }), React.createElement("rect", {
1606
+ x: progressX,
1607
+ width: progressWidth,
1608
+ y: y,
1609
+ height: height,
1610
+ ry: barCornerRadius,
1611
+ rx: barCornerRadius,
1612
+ fill: getProcessColor()
1613
+ }));
1614
+ };
1615
+
1616
+ var BarDateHandle = function BarDateHandle(_ref) {
1617
+ var x = _ref.x,
1618
+ y = _ref.y,
1619
+ width = _ref.width,
1620
+ height = _ref.height,
1621
+ barCornerRadius = _ref.barCornerRadius,
1622
+ onMouseDown = _ref.onMouseDown;
1623
+ return React.createElement("rect", {
1624
+ x: x,
1625
+ y: y,
1626
+ width: width,
1627
+ height: height,
1628
+ className: styles$6.barHandle,
1629
+ ry: barCornerRadius,
1630
+ rx: barCornerRadius,
1631
+ onMouseDown: onMouseDown
1632
+ });
1633
+ };
1634
+
1635
+ var BarProgressHandle = function BarProgressHandle(_ref) {
1636
+ var progressPoint = _ref.progressPoint,
1637
+ onMouseDown = _ref.onMouseDown;
1638
+ return React.createElement("polygon", {
1639
+ className: styles$6.barHandle,
1640
+ points: progressPoint,
1641
+ onMouseDown: onMouseDown
1642
+ });
1643
+ };
1644
+
1645
+ var Bar = function Bar(_ref) {
1646
+ var task = _ref.task,
1647
+ isProgressChangeable = _ref.isProgressChangeable,
1648
+ isDateChangeable = _ref.isDateChangeable,
1649
+ rtl = _ref.rtl,
1650
+ onEventStart = _ref.onEventStart,
1651
+ isSelected = _ref.isSelected;
1652
+ var progressPoint = getProgressPoint(+!rtl * task.progressWidth + task.progressX, task.y, task.height);
1653
+ var handleHeight = task.height - 2;
1654
+ return React.createElement("g", {
1655
+ className: styles$6.barWrapper,
1656
+ tabIndex: 0
1657
+ }, React.createElement(BarDisplay, {
1658
+ x: task.x1,
1659
+ y: task.y,
1660
+ width: task.x2 - task.x1,
1661
+ height: task.height,
1662
+ progressX: task.progressX,
1663
+ progressWidth: task.progressWidth,
1664
+ barCornerRadius: task.barCornerRadius,
1665
+ styles: task.styles,
1666
+ isSelected: isSelected,
1667
+ onMouseDown: function onMouseDown(e) {
1668
+ isDateChangeable && onEventStart("move", task, e);
1669
+ }
1670
+ }), React.createElement("g", {
1671
+ className: "handleGroup"
1672
+ }, isDateChangeable && React.createElement("g", null, React.createElement(BarDateHandle, {
1673
+ x: task.x1 + 1,
1674
+ y: task.y + 1,
1675
+ width: task.handleWidth,
1676
+ height: handleHeight,
1677
+ barCornerRadius: task.barCornerRadius,
1678
+ onMouseDown: function onMouseDown(e) {
1679
+ onEventStart("start", task, e);
1680
+ }
1681
+ }), React.createElement(BarDateHandle, {
1682
+ x: task.x2 - task.handleWidth - 1,
1683
+ y: task.y + 1,
1684
+ width: task.handleWidth,
1685
+ height: handleHeight,
1686
+ barCornerRadius: task.barCornerRadius,
1687
+ onMouseDown: function onMouseDown(e) {
1688
+ onEventStart("end", task, e);
1689
+ }
1690
+ })), isProgressChangeable && React.createElement(BarProgressHandle, {
1691
+ progressPoint: progressPoint,
1692
+ onMouseDown: function onMouseDown(e) {
1693
+ onEventStart("progress", task, e);
1694
+ }
1695
+ })));
1696
+ };
1697
+
1698
+ var BarSmall = function BarSmall(_ref) {
1699
+ var task = _ref.task,
1700
+ isProgressChangeable = _ref.isProgressChangeable,
1701
+ isDateChangeable = _ref.isDateChangeable,
1702
+ onEventStart = _ref.onEventStart,
1703
+ isSelected = _ref.isSelected;
1704
+ var progressPoint = getProgressPoint(task.progressWidth + task.x1, task.y, task.height);
1705
+ return React.createElement("g", {
1706
+ className: styles$6.barWrapper,
1707
+ tabIndex: 0
1708
+ }, React.createElement(BarDisplay, {
1709
+ x: task.x1,
1710
+ y: task.y,
1711
+ width: task.x2 - task.x1,
1712
+ height: task.height,
1713
+ progressX: task.progressX,
1714
+ progressWidth: task.progressWidth,
1715
+ barCornerRadius: task.barCornerRadius,
1716
+ styles: task.styles,
1717
+ isSelected: isSelected,
1718
+ onMouseDown: function onMouseDown(e) {
1719
+ isDateChangeable && onEventStart("move", task, e);
1720
+ }
1721
+ }), React.createElement("g", {
1722
+ className: "handleGroup"
1723
+ }, isProgressChangeable && React.createElement(BarProgressHandle, {
1724
+ progressPoint: progressPoint,
1725
+ onMouseDown: function onMouseDown(e) {
1726
+ onEventStart("progress", task, e);
1727
+ }
1728
+ })));
1729
+ };
1730
+
1731
+ var styles$7 = {"milestoneWrapper":"_RRr13","milestoneBackground":"_2P2B1"};
1732
+
1733
+ var Milestone = function Milestone(_ref) {
1734
+ var task = _ref.task,
1735
+ isDateChangeable = _ref.isDateChangeable,
1736
+ onEventStart = _ref.onEventStart,
1737
+ isSelected = _ref.isSelected;
1738
+ var transform = "rotate(45 " + (task.x1 + task.height * 0.356) + " \n " + (task.y + task.height * 0.85) + ")";
1739
+
1740
+ var getBarColor = function getBarColor() {
1741
+ return isSelected ? task.styles.backgroundSelectedColor : task.styles.backgroundColor;
1742
+ };
1743
+
1744
+ return React.createElement("g", {
1745
+ tabIndex: 0,
1746
+ className: styles$7.milestoneWrapper
1747
+ }, React.createElement("rect", {
1748
+ fill: getBarColor(),
1749
+ x: task.x1,
1750
+ width: task.height,
1751
+ y: task.y,
1752
+ height: task.height,
1753
+ rx: task.barCornerRadius,
1754
+ ry: task.barCornerRadius,
1755
+ transform: transform,
1756
+ className: styles$7.milestoneBackground,
1757
+ onMouseDown: function onMouseDown(e) {
1758
+ isDateChangeable && onEventStart("move", task, e);
1759
+ }
1760
+ }));
1761
+ };
1762
+
1763
+ var styles$8 = {"projectWrapper":"_1KJ6x","projectBackground":"_2RbVy","projectTop":"_2pZMF"};
1764
+
1765
+ var Project = function Project(_ref) {
1766
+ var task = _ref.task,
1767
+ isSelected = _ref.isSelected;
1768
+ var barColor = isSelected ? task.styles.backgroundSelectedColor : task.styles.backgroundColor;
1769
+ var processColor = isSelected ? task.styles.progressSelectedColor : task.styles.progressColor;
1770
+ var projectWith = task.x2 - task.x1;
1771
+ var projectLeftTriangle = [task.x1, task.y + task.height / 2 - 1, task.x1, task.y + task.height, task.x1 + 15, task.y + task.height / 2 - 1].join(",");
1772
+ var projectRightTriangle = [task.x2, task.y + task.height / 2 - 1, task.x2, task.y + task.height, task.x2 - 15, task.y + task.height / 2 - 1].join(",");
1773
+ return React.createElement("g", {
1774
+ tabIndex: 0,
1775
+ className: styles$8.projectWrapper
1776
+ }, React.createElement("rect", {
1777
+ fill: barColor,
1778
+ x: task.x1,
1779
+ width: projectWith,
1780
+ y: task.y,
1781
+ height: task.height,
1782
+ rx: task.barCornerRadius,
1783
+ ry: task.barCornerRadius,
1784
+ className: styles$8.projectBackground
1785
+ }), React.createElement("rect", {
1786
+ x: task.progressX,
1787
+ width: task.progressWidth,
1788
+ y: task.y,
1789
+ height: task.height,
1790
+ ry: task.barCornerRadius,
1791
+ rx: task.barCornerRadius,
1792
+ fill: processColor
1793
+ }), React.createElement("rect", {
1794
+ fill: barColor,
1795
+ x: task.x1,
1796
+ width: projectWith,
1797
+ y: task.y,
1798
+ height: task.height / 2,
1799
+ rx: task.barCornerRadius,
1800
+ ry: task.barCornerRadius,
1801
+ className: styles$8.projectTop
1802
+ }), React.createElement("polygon", {
1803
+ className: styles$8.projectTop,
1804
+ points: projectLeftTriangle,
1805
+ fill: barColor
1806
+ }), React.createElement("polygon", {
1807
+ className: styles$8.projectTop,
1808
+ points: projectRightTriangle,
1809
+ fill: barColor
1810
+ }));
1811
+ };
1812
+
1813
+ var style = {"barLabel":"_3zRJQ","barLabelOutside":"_3KcaM"};
1814
+
1815
+ var TaskItem = function TaskItem(props) {
1816
+ var _props = _extends({}, props),
1817
+ task = _props.task,
1818
+ arrowIndent = _props.arrowIndent,
1819
+ isDelete = _props.isDelete,
1820
+ taskHeight = _props.taskHeight,
1821
+ isSelected = _props.isSelected,
1822
+ rtl = _props.rtl,
1823
+ onEventStart = _props.onEventStart;
1824
+
1825
+ var textRef = useRef(null);
1826
+
1827
+ var _useState = useState(React.createElement("div", null)),
1828
+ taskItem = _useState[0],
1829
+ setTaskItem = _useState[1];
1830
+
1831
+ var _useState2 = useState(true),
1832
+ isTextInside = _useState2[0],
1833
+ setIsTextInside = _useState2[1];
1834
+
1835
+ useEffect(function () {
1836
+ switch (task.typeInternal) {
1837
+ case "milestone":
1838
+ setTaskItem(React.createElement(Milestone, Object.assign({}, props)));
1839
+ break;
1840
+
1841
+ case "project":
1842
+ setTaskItem(React.createElement(Project, Object.assign({}, props)));
1843
+ break;
1844
+
1845
+ case "smalltask":
1846
+ setTaskItem(React.createElement(BarSmall, Object.assign({}, props)));
1847
+ break;
1848
+
1849
+ default:
1850
+ setTaskItem(React.createElement(Bar, Object.assign({}, props)));
1851
+ break;
1852
+ }
1853
+ }, [task, isSelected]);
1854
+ useEffect(function () {
1855
+ if (textRef.current) {
1856
+ setIsTextInside(textRef.current.getBBox().width < task.x2 - task.x1);
1857
+ }
1858
+ }, [textRef, task]);
1859
+
1860
+ var getX = function getX() {
1861
+ var width = task.x2 - task.x1;
1862
+ var hasChild = task.barChildren.length > 0;
1863
+
1864
+ if (isTextInside) {
1865
+ return task.x1 + width * 0.5;
1866
+ }
1867
+
1868
+ if (rtl && textRef.current) {
1869
+ return task.x1 - textRef.current.getBBox().width - arrowIndent * +hasChild - arrowIndent * 0.2;
1870
+ } else {
1871
+ return task.x1 + width + arrowIndent * +hasChild + arrowIndent * 0.2;
1872
+ }
1873
+ };
1874
+
1875
+ return React.createElement("g", {
1876
+ onKeyDown: function onKeyDown(e) {
1877
+ switch (e.key) {
1878
+ case "Delete":
1879
+ {
1880
+ if (isDelete) onEventStart("delete", task, e);
1881
+ break;
1882
+ }
1883
+ }
1884
+
1885
+ e.stopPropagation();
1886
+ },
1887
+ onMouseEnter: function onMouseEnter(e) {
1888
+ onEventStart("mouseenter", task, e);
1889
+ },
1890
+ onMouseLeave: function onMouseLeave(e) {
1891
+ onEventStart("mouseleave", task, e);
1892
+ },
1893
+ onDoubleClick: function onDoubleClick(e) {
1894
+ onEventStart("dblclick", task, e);
1895
+ },
1896
+ onClick: function onClick(e) {
1897
+ onEventStart("click", task, e);
1898
+ },
1899
+ onFocus: function onFocus() {
1900
+ onEventStart("select", task);
1901
+ }
1902
+ }, taskItem, React.createElement("text", {
1903
+ x: getX(),
1904
+ y: task.y + taskHeight * 0.5,
1905
+ className: isTextInside ? style.barLabel : style.barLabelOutside,
1906
+ ref: textRef
1907
+ }, task.name));
1908
+ };
1909
+
1910
+ var TaskGanttContent = function TaskGanttContent(_ref) {
1911
+ var _svg$current;
1912
+
1913
+ var tasks = _ref.tasks,
1914
+ dates = _ref.dates,
1915
+ ganttEvent = _ref.ganttEvent,
1916
+ selectedTask = _ref.selectedTask,
1917
+ rowHeight = _ref.rowHeight,
1918
+ columnWidth = _ref.columnWidth,
1919
+ timeStep = _ref.timeStep,
1920
+ svg = _ref.svg,
1921
+ taskHeight = _ref.taskHeight,
1922
+ arrowColor = _ref.arrowColor,
1923
+ arrowIndent = _ref.arrowIndent,
1924
+ fontFamily = _ref.fontFamily,
1925
+ fontSize = _ref.fontSize,
1926
+ rtl = _ref.rtl,
1927
+ setGanttEvent = _ref.setGanttEvent,
1928
+ setFailedTask = _ref.setFailedTask,
1929
+ setSelectedTask = _ref.setSelectedTask,
1930
+ onDateChange = _ref.onDateChange,
1931
+ onProgressChange = _ref.onProgressChange,
1932
+ onDoubleClick = _ref.onDoubleClick,
1933
+ onClick = _ref.onClick,
1934
+ onDelete = _ref.onDelete;
1935
+ var point = svg === null || svg === void 0 ? void 0 : (_svg$current = svg.current) === null || _svg$current === void 0 ? void 0 : _svg$current.createSVGPoint();
1936
+
1937
+ var _useState = useState(0),
1938
+ xStep = _useState[0],
1939
+ setXStep = _useState[1];
1940
+
1941
+ var _useState2 = useState(0),
1942
+ initEventX1Delta = _useState2[0],
1943
+ setInitEventX1Delta = _useState2[1];
1944
+
1945
+ var _useState3 = useState(false),
1946
+ isMoving = _useState3[0],
1947
+ setIsMoving = _useState3[1];
1948
+
1949
+ useEffect(function () {
1950
+ var dateDelta = dates[1].getTime() - dates[0].getTime() - dates[1].getTimezoneOffset() * 60 * 1000 + dates[0].getTimezoneOffset() * 60 * 1000;
1951
+ var newXStep = timeStep * columnWidth / dateDelta;
1952
+ setXStep(newXStep);
1953
+ }, [columnWidth, dates, timeStep]);
1954
+ useEffect(function () {
1955
+ var handleMouseMove = function handleMouseMove(event) {
1956
+ try {
1957
+ var _svg$current$getScree;
1958
+
1959
+ if (!ganttEvent.changedTask || !point || !(svg !== null && svg !== void 0 && svg.current)) return Promise.resolve();
1960
+ event.preventDefault();
1961
+ point.x = event.clientX;
1962
+ var cursor = point.matrixTransform(svg === null || svg === void 0 ? void 0 : (_svg$current$getScree = svg.current.getScreenCTM()) === null || _svg$current$getScree === void 0 ? void 0 : _svg$current$getScree.inverse());
1963
+
1964
+ var _handleTaskBySVGMouse = handleTaskBySVGMouseEvent(cursor.x, ganttEvent.action, ganttEvent.changedTask, xStep, timeStep, initEventX1Delta, rtl),
1965
+ isChanged = _handleTaskBySVGMouse.isChanged,
1966
+ changedTask = _handleTaskBySVGMouse.changedTask;
1967
+
1968
+ if (isChanged) {
1969
+ setGanttEvent({
1970
+ action: ganttEvent.action,
1971
+ changedTask: changedTask
1972
+ });
1973
+ }
1974
+
1975
+ return Promise.resolve();
1976
+ } catch (e) {
1977
+ return Promise.reject(e);
1978
+ }
1979
+ };
1980
+
1981
+ var handleMouseUp = function handleMouseUp(event) {
1982
+ try {
1983
+ var _svg$current$getScree2;
1984
+
1985
+ var _temp6 = function _temp6() {
1986
+ if (!operationSuccess) {
1987
+ setFailedTask(originalSelectedTask);
1988
+ }
1989
+ };
1990
+
1991
+ var action = ganttEvent.action,
1992
+ originalSelectedTask = ganttEvent.originalSelectedTask,
1993
+ changedTask = ganttEvent.changedTask;
1994
+ if (!changedTask || !point || !(svg !== null && svg !== void 0 && svg.current) || !originalSelectedTask) return Promise.resolve();
1995
+ event.preventDefault();
1996
+ point.x = event.clientX;
1997
+ var cursor = point.matrixTransform(svg === null || svg === void 0 ? void 0 : (_svg$current$getScree2 = svg.current.getScreenCTM()) === null || _svg$current$getScree2 === void 0 ? void 0 : _svg$current$getScree2.inverse());
1998
+
1999
+ var _handleTaskBySVGMouse2 = handleTaskBySVGMouseEvent(cursor.x, action, changedTask, xStep, timeStep, initEventX1Delta, rtl),
2000
+ newChangedTask = _handleTaskBySVGMouse2.changedTask;
2001
+
2002
+ var isNotLikeOriginal = originalSelectedTask.start !== newChangedTask.start || originalSelectedTask.end !== newChangedTask.end || originalSelectedTask.progress !== newChangedTask.progress;
2003
+ svg.current.removeEventListener("mousemove", handleMouseMove);
2004
+ svg.current.removeEventListener("mouseup", handleMouseUp);
2005
+ setGanttEvent({
2006
+ action: ""
2007
+ });
2008
+ setIsMoving(false);
2009
+ var operationSuccess = true;
2010
+
2011
+ var _temp7 = function () {
2012
+ if ((action === "move" || action === "end" || action === "start") && onDateChange && isNotLikeOriginal) {
2013
+ var _temp8 = _catch(function () {
2014
+ return Promise.resolve(onDateChange(newChangedTask, newChangedTask.barChildren)).then(function (result) {
2015
+ if (result !== undefined) {
2016
+ operationSuccess = result;
2017
+ }
2018
+ });
2019
+ }, function () {
2020
+ operationSuccess = false;
2021
+ });
2022
+
2023
+ if (_temp8 && _temp8.then) return _temp8.then(function () {});
2024
+ } else {
2025
+ var _temp9 = function () {
2026
+ if (onProgressChange && isNotLikeOriginal) {
2027
+ var _temp10 = _catch(function () {
2028
+ return Promise.resolve(onProgressChange(newChangedTask, newChangedTask.barChildren)).then(function (result) {
2029
+ if (result !== undefined) {
2030
+ operationSuccess = result;
2031
+ }
2032
+ });
2033
+ }, function () {
2034
+ operationSuccess = false;
2035
+ });
2036
+
2037
+ if (_temp10 && _temp10.then) return _temp10.then(function () {});
2038
+ }
2039
+ }();
2040
+
2041
+ if (_temp9 && _temp9.then) return _temp9.then(function () {});
2042
+ }
2043
+ }();
2044
+
2045
+ return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(_temp6) : _temp6(_temp7));
2046
+ } catch (e) {
2047
+ return Promise.reject(e);
2048
+ }
2049
+ };
2050
+
2051
+ if (!isMoving && (ganttEvent.action === "move" || ganttEvent.action === "end" || ganttEvent.action === "start" || ganttEvent.action === "progress") && svg !== null && svg !== void 0 && svg.current) {
2052
+ svg.current.addEventListener("mousemove", handleMouseMove);
2053
+ svg.current.addEventListener("mouseup", handleMouseUp);
2054
+ setIsMoving(true);
2055
+ }
2056
+ }, [ganttEvent, xStep, initEventX1Delta, onProgressChange, timeStep, onDateChange, svg, isMoving, point, rtl, setFailedTask, setGanttEvent]);
2057
+
2058
+ var handleBarEventStart = function handleBarEventStart(action, task, event) {
2059
+ try {
2060
+ return Promise.resolve(function () {
2061
+ if (!event) {
2062
+ if (action === "select") {
2063
+ setSelectedTask(task.id);
2064
+ }
2065
+ } else return function () {
2066
+ if (isKeyboardEvent(event)) {
2067
+ var _temp14 = function () {
2068
+ if (action === "delete") {
2069
+ var _temp15 = function () {
2070
+ if (onDelete) {
2071
+ var _temp16 = _catch(function () {
2072
+ return Promise.resolve(onDelete(task)).then(function (result) {
2073
+ if (result !== undefined && result) {
2074
+ setGanttEvent({
2075
+ action: action,
2076
+ changedTask: task
2077
+ });
2078
+ }
2079
+ });
2080
+ }, function (error) {
2081
+ console.error("Error on Delete. " + error);
2082
+ });
2083
+
2084
+ if (_temp16 && _temp16.then) return _temp16.then(function () {});
2085
+ }
2086
+ }();
2087
+
2088
+ if (_temp15 && _temp15.then) return _temp15.then(function () {});
2089
+ }
2090
+ }();
2091
+
2092
+ if (_temp14 && _temp14.then) return _temp14.then(function () {});
2093
+ } else if (action === "mouseenter") {
2094
+ if (!ganttEvent.action) {
2095
+ setGanttEvent({
2096
+ action: action,
2097
+ changedTask: task,
2098
+ originalSelectedTask: task
2099
+ });
2100
+ }
2101
+ } else if (action === "mouseleave") {
2102
+ if (ganttEvent.action === "mouseenter") {
2103
+ setGanttEvent({
2104
+ action: ""
2105
+ });
2106
+ }
2107
+ } else if (action === "dblclick") {
2108
+ !!onDoubleClick && onDoubleClick(task);
2109
+ } else if (action === "click") {
2110
+ !!onClick && onClick(task);
2111
+ } else if (action === "move") {
2112
+ var _svg$current$getScree3;
2113
+
2114
+ if (!(svg !== null && svg !== void 0 && svg.current) || !point) return;
2115
+ point.x = event.clientX;
2116
+ var cursor = point.matrixTransform((_svg$current$getScree3 = svg.current.getScreenCTM()) === null || _svg$current$getScree3 === void 0 ? void 0 : _svg$current$getScree3.inverse());
2117
+ setInitEventX1Delta(cursor.x - task.x1);
2118
+ setGanttEvent({
2119
+ action: action,
2120
+ changedTask: task,
2121
+ originalSelectedTask: task
2122
+ });
2123
+ } else {
2124
+ setGanttEvent({
2125
+ action: action,
2126
+ changedTask: task,
2127
+ originalSelectedTask: task
2128
+ });
2129
+ }
2130
+ }();
2131
+ }());
2132
+ } catch (e) {
2133
+ return Promise.reject(e);
2134
+ }
2135
+ };
2136
+
2137
+ return React.createElement("g", {
2138
+ className: "content"
2139
+ }, React.createElement("g", {
2140
+ className: "arrows",
2141
+ fill: arrowColor,
2142
+ stroke: arrowColor
2143
+ }, tasks.map(function (task) {
2144
+ return task.barChildren.map(function (child) {
2145
+ return React.createElement(Arrow, {
2146
+ key: "Arrow from " + task.id + " to " + tasks[child.index].id,
2147
+ taskFrom: task,
2148
+ taskTo: tasks[child.index],
2149
+ rowHeight: rowHeight,
2150
+ taskHeight: taskHeight,
2151
+ arrowIndent: arrowIndent,
2152
+ rtl: rtl
2153
+ });
2154
+ });
2155
+ })), React.createElement("g", {
2156
+ className: "bar",
2157
+ fontFamily: fontFamily,
2158
+ fontSize: fontSize
2159
+ }, tasks.map(function (task) {
2160
+ return React.createElement(TaskItem, {
2161
+ task: task,
2162
+ arrowIndent: arrowIndent,
2163
+ taskHeight: taskHeight,
2164
+ isProgressChangeable: !!onProgressChange && !task.isDisabled,
2165
+ isDateChangeable: !!onDateChange && !task.isDisabled,
2166
+ isDelete: !task.isDisabled,
2167
+ onEventStart: handleBarEventStart,
2168
+ key: task.id,
2169
+ isSelected: !!selectedTask && task.id === selectedTask.id,
2170
+ rtl: rtl
2171
+ });
2172
+ })));
2173
+ };
2174
+
2175
+ var styles$9 = {"ganttVerticalContainer":"_CZjuD","horizontalContainer":"_2B2zv","wrapper":"_3eULf"};
2176
+
2177
+ var TaskGantt = function TaskGantt(_ref) {
2178
+ var gridProps = _ref.gridProps,
2179
+ calendarProps = _ref.calendarProps,
2180
+ barProps = _ref.barProps,
2181
+ ganttHeight = _ref.ganttHeight,
2182
+ scrollY = _ref.scrollY,
2183
+ scrollX = _ref.scrollX;
2184
+ var ganttSVGRef = useRef(null);
2185
+ var horizontalContainerRef = useRef(null);
2186
+ var verticalGanttContainerRef = useRef(null);
2187
+
2188
+ var newBarProps = _extends({}, barProps, {
2189
+ svg: ganttSVGRef
2190
+ });
2191
+
2192
+ useEffect(function () {
2193
+ if (horizontalContainerRef.current) {
2194
+ horizontalContainerRef.current.scrollTop = scrollY;
2195
+ }
2196
+ }, [scrollY]);
2197
+ useEffect(function () {
2198
+ if (verticalGanttContainerRef.current) {
2199
+ verticalGanttContainerRef.current.scrollLeft = scrollX;
2200
+ }
2201
+ }, [scrollX]);
2202
+ return React.createElement("div", {
2203
+ className: styles$9.ganttVerticalContainer,
2204
+ ref: verticalGanttContainerRef,
2205
+ dir: "ltr"
2206
+ }, React.createElement("svg", {
2207
+ xmlns: "http://www.w3.org/2000/svg",
2208
+ width: gridProps.svgWidth,
2209
+ height: calendarProps.headerHeight,
2210
+ fontFamily: barProps.fontFamily
2211
+ }, React.createElement(Calendar, Object.assign({}, calendarProps))), React.createElement("div", {
2212
+ ref: horizontalContainerRef,
2213
+ className: styles$9.horizontalContainer,
2214
+ style: ganttHeight ? {
2215
+ height: ganttHeight,
2216
+ width: gridProps.svgWidth
2217
+ } : {
2218
+ width: gridProps.svgWidth
2219
+ }
2220
+ }, React.createElement("svg", {
2221
+ xmlns: "http://www.w3.org/2000/svg",
2222
+ width: gridProps.svgWidth,
2223
+ height: barProps.rowHeight * barProps.tasks.length,
2224
+ fontFamily: barProps.fontFamily,
2225
+ ref: ganttSVGRef
2226
+ }, React.createElement(Grid, Object.assign({}, gridProps)), React.createElement(TaskGanttContent, Object.assign({}, newBarProps)))));
2227
+ };
2228
+
2229
+ var styles$a = {"scrollWrapper":"_2k9Ys","scroll":"_19jgW"};
2230
+
2231
+ var HorizontalScroll = function HorizontalScroll(_ref) {
2232
+ var scroll = _ref.scroll,
2233
+ svgWidth = _ref.svgWidth,
2234
+ taskListWidth = _ref.taskListWidth,
2235
+ rtl = _ref.rtl,
2236
+ onScroll = _ref.onScroll;
2237
+ var scrollRef = useRef(null);
2238
+ useEffect(function () {
2239
+ if (scrollRef.current) {
2240
+ scrollRef.current.scrollLeft = scroll;
2241
+ }
2242
+ }, [scroll]);
2243
+ return React.createElement("div", {
2244
+ dir: "ltr",
2245
+ style: {
2246
+ margin: rtl ? "0px " + taskListWidth + "px 0px 0px" : "0px 0px 0px " + taskListWidth + "px"
2247
+ },
2248
+ className: styles$a.scrollWrapper,
2249
+ onScroll: onScroll,
2250
+ ref: scrollRef
2251
+ }, React.createElement("div", {
2252
+ style: {
2253
+ width: svgWidth
2254
+ },
2255
+ className: styles$a.scroll
2256
+ }));
2257
+ };
2258
+
2259
+ var Gantt = function Gantt(_ref) {
2260
+ var tasks = _ref.tasks,
2261
+ _ref$headerHeight = _ref.headerHeight,
2262
+ headerHeight = _ref$headerHeight === void 0 ? 50 : _ref$headerHeight,
2263
+ _ref$columnWidth = _ref.columnWidth,
2264
+ columnWidth = _ref$columnWidth === void 0 ? 60 : _ref$columnWidth,
2265
+ _ref$listCellWidth = _ref.listCellWidth,
2266
+ listCellWidth = _ref$listCellWidth === void 0 ? "155px" : _ref$listCellWidth,
2267
+ _ref$rowHeight = _ref.rowHeight,
2268
+ rowHeight = _ref$rowHeight === void 0 ? 50 : _ref$rowHeight,
2269
+ _ref$ganttHeight = _ref.ganttHeight,
2270
+ ganttHeight = _ref$ganttHeight === void 0 ? 0 : _ref$ganttHeight,
2271
+ _ref$viewMode = _ref.viewMode,
2272
+ viewMode = _ref$viewMode === void 0 ? ViewMode.Day : _ref$viewMode,
2273
+ _ref$preStepsCount = _ref.preStepsCount,
2274
+ preStepsCount = _ref$preStepsCount === void 0 ? 1 : _ref$preStepsCount,
2275
+ _ref$locale = _ref.locale,
2276
+ locale = _ref$locale === void 0 ? "en-GB" : _ref$locale,
2277
+ _ref$barFill = _ref.barFill,
2278
+ barFill = _ref$barFill === void 0 ? 60 : _ref$barFill,
2279
+ _ref$barCornerRadius = _ref.barCornerRadius,
2280
+ barCornerRadius = _ref$barCornerRadius === void 0 ? 3 : _ref$barCornerRadius,
2281
+ _ref$barProgressColor = _ref.barProgressColor,
2282
+ barProgressColor = _ref$barProgressColor === void 0 ? "#a3a3ff" : _ref$barProgressColor,
2283
+ _ref$barProgressSelec = _ref.barProgressSelectedColor,
2284
+ barProgressSelectedColor = _ref$barProgressSelec === void 0 ? "#8282f5" : _ref$barProgressSelec,
2285
+ _ref$barBackgroundCol = _ref.barBackgroundColor,
2286
+ barBackgroundColor = _ref$barBackgroundCol === void 0 ? "#b8c2cc" : _ref$barBackgroundCol,
2287
+ _ref$barBackgroundSel = _ref.barBackgroundSelectedColor,
2288
+ barBackgroundSelectedColor = _ref$barBackgroundSel === void 0 ? "#aeb8c2" : _ref$barBackgroundSel,
2289
+ _ref$projectProgressC = _ref.projectProgressColor,
2290
+ projectProgressColor = _ref$projectProgressC === void 0 ? "#7db59a" : _ref$projectProgressC,
2291
+ _ref$projectProgressS = _ref.projectProgressSelectedColor,
2292
+ projectProgressSelectedColor = _ref$projectProgressS === void 0 ? "#59a985" : _ref$projectProgressS,
2293
+ _ref$projectBackgroun = _ref.projectBackgroundColor,
2294
+ projectBackgroundColor = _ref$projectBackgroun === void 0 ? "#fac465" : _ref$projectBackgroun,
2295
+ _ref$projectBackgroun2 = _ref.projectBackgroundSelectedColor,
2296
+ projectBackgroundSelectedColor = _ref$projectBackgroun2 === void 0 ? "#f7bb53" : _ref$projectBackgroun2,
2297
+ _ref$milestoneBackgro = _ref.milestoneBackgroundColor,
2298
+ milestoneBackgroundColor = _ref$milestoneBackgro === void 0 ? "#f1c453" : _ref$milestoneBackgro,
2299
+ _ref$milestoneBackgro2 = _ref.milestoneBackgroundSelectedColor,
2300
+ milestoneBackgroundSelectedColor = _ref$milestoneBackgro2 === void 0 ? "#f29e4c" : _ref$milestoneBackgro2,
2301
+ _ref$rtl = _ref.rtl,
2302
+ rtl = _ref$rtl === void 0 ? false : _ref$rtl,
2303
+ _ref$handleWidth = _ref.handleWidth,
2304
+ handleWidth = _ref$handleWidth === void 0 ? 8 : _ref$handleWidth,
2305
+ _ref$timeStep = _ref.timeStep,
2306
+ timeStep = _ref$timeStep === void 0 ? 300000 : _ref$timeStep,
2307
+ _ref$arrowColor = _ref.arrowColor,
2308
+ arrowColor = _ref$arrowColor === void 0 ? "grey" : _ref$arrowColor,
2309
+ _ref$fontFamily = _ref.fontFamily,
2310
+ fontFamily = _ref$fontFamily === void 0 ? "Arial, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue" : _ref$fontFamily,
2311
+ _ref$fontSize = _ref.fontSize,
2312
+ fontSize = _ref$fontSize === void 0 ? "14px" : _ref$fontSize,
2313
+ _ref$arrowIndent = _ref.arrowIndent,
2314
+ arrowIndent = _ref$arrowIndent === void 0 ? 20 : _ref$arrowIndent,
2315
+ _ref$todayColor = _ref.todayColor,
2316
+ todayColor = _ref$todayColor === void 0 ? "rgba(252, 248, 227, 0.5)" : _ref$todayColor,
2317
+ viewDate = _ref.viewDate,
2318
+ _ref$TooltipContent = _ref.TooltipContent,
2319
+ TooltipContent = _ref$TooltipContent === void 0 ? StandardTooltipContent : _ref$TooltipContent,
2320
+ _ref$TaskListHeader = _ref.TaskListHeader,
2321
+ TaskListHeader = _ref$TaskListHeader === void 0 ? TaskListHeaderDefault : _ref$TaskListHeader,
2322
+ _ref$TaskListTable = _ref.TaskListTable,
2323
+ TaskListTable = _ref$TaskListTable === void 0 ? TaskListTableDefault : _ref$TaskListTable,
2324
+ onDateChange = _ref.onDateChange,
2325
+ onProgressChange = _ref.onProgressChange,
2326
+ onDoubleClick = _ref.onDoubleClick,
2327
+ onClick = _ref.onClick,
2328
+ onDelete = _ref.onDelete,
2329
+ onSelect = _ref.onSelect,
2330
+ onExpanderClick = _ref.onExpanderClick;
2331
+ var wrapperRef = useRef(null);
2332
+ var taskListRef = useRef(null);
2333
+
2334
+ var _useState = useState(function () {
2335
+ var _ganttDateRange = ganttDateRange(tasks, viewMode, preStepsCount),
2336
+ startDate = _ganttDateRange[0],
2337
+ endDate = _ganttDateRange[1];
2338
+
2339
+ return {
2340
+ viewMode: viewMode,
2341
+ dates: seedDates(startDate, endDate, viewMode)
2342
+ };
2343
+ }),
2344
+ dateSetup = _useState[0],
2345
+ setDateSetup = _useState[1];
2346
+
2347
+ var _useState2 = useState(undefined),
2348
+ currentViewDate = _useState2[0],
2349
+ setCurrentViewDate = _useState2[1];
2350
+
2351
+ var _useState3 = useState(0),
2352
+ taskListWidth = _useState3[0],
2353
+ setTaskListWidth = _useState3[1];
2354
+
2355
+ var _useState4 = useState(0),
2356
+ svgContainerWidth = _useState4[0],
2357
+ setSvgContainerWidth = _useState4[1];
2358
+
2359
+ var _useState5 = useState(ganttHeight),
2360
+ svgContainerHeight = _useState5[0],
2361
+ setSvgContainerHeight = _useState5[1];
2362
+
2363
+ var _useState6 = useState([]),
2364
+ barTasks = _useState6[0],
2365
+ setBarTasks = _useState6[1];
2366
+
2367
+ var _useState7 = useState({
2368
+ action: ""
2369
+ }),
2370
+ ganttEvent = _useState7[0],
2371
+ setGanttEvent = _useState7[1];
2372
+
2373
+ var taskHeight = useMemo(function () {
2374
+ return rowHeight * barFill / 100;
2375
+ }, [rowHeight, barFill]);
2376
+
2377
+ var _useState8 = useState(),
2378
+ selectedTask = _useState8[0],
2379
+ setSelectedTask = _useState8[1];
2380
+
2381
+ var _useState9 = useState(null),
2382
+ failedTask = _useState9[0],
2383
+ setFailedTask = _useState9[1];
2384
+
2385
+ var svgWidth = dateSetup.dates.length * columnWidth;
2386
+ var ganttFullHeight = barTasks.length * rowHeight;
2387
+
2388
+ var _useState10 = useState(0),
2389
+ scrollY = _useState10[0],
2390
+ setScrollY = _useState10[1];
2391
+
2392
+ var _useState11 = useState(-1),
2393
+ scrollX = _useState11[0],
2394
+ setScrollX = _useState11[1];
2395
+
2396
+ var _useState12 = useState(false),
2397
+ ignoreScrollEvent = _useState12[0],
2398
+ setIgnoreScrollEvent = _useState12[1];
2399
+
2400
+ useEffect(function () {
2401
+ var filteredTasks;
2402
+
2403
+ if (onExpanderClick) {
2404
+ filteredTasks = removeHiddenTasks(tasks);
2405
+ } else {
2406
+ filteredTasks = tasks;
2407
+ }
2408
+
2409
+ filteredTasks = filteredTasks.sort(sortTasks);
2410
+
2411
+ var _ganttDateRange2 = ganttDateRange(filteredTasks, viewMode, preStepsCount),
2412
+ startDate = _ganttDateRange2[0],
2413
+ endDate = _ganttDateRange2[1];
2414
+
2415
+ var newDates = seedDates(startDate, endDate, viewMode);
2416
+
2417
+ if (rtl) {
2418
+ newDates = newDates.reverse();
2419
+
2420
+ if (scrollX === -1) {
2421
+ setScrollX(newDates.length * columnWidth);
2422
+ }
2423
+ }
2424
+
2425
+ setDateSetup({
2426
+ dates: newDates,
2427
+ viewMode: viewMode
2428
+ });
2429
+ setBarTasks(convertToBarTasks(filteredTasks, newDates, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, milestoneBackgroundColor, milestoneBackgroundSelectedColor));
2430
+ }, [tasks, viewMode, preStepsCount, rowHeight, barCornerRadius, columnWidth, taskHeight, handleWidth, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, milestoneBackgroundColor, milestoneBackgroundSelectedColor, rtl, scrollX, onExpanderClick]);
2431
+ useEffect(function () {
2432
+ if (viewMode === dateSetup.viewMode && (viewDate && !currentViewDate || viewDate && (currentViewDate === null || currentViewDate === void 0 ? void 0 : currentViewDate.valueOf()) !== viewDate.valueOf())) {
2433
+ var dates = dateSetup.dates;
2434
+ var index = dates.findIndex(function (d, i) {
2435
+ return viewDate.valueOf() >= d.valueOf() && i + 1 !== dates.length && viewDate.valueOf() < dates[i + 1].valueOf();
2436
+ });
2437
+
2438
+ if (index === -1) {
2439
+ return;
2440
+ }
2441
+
2442
+ setCurrentViewDate(viewDate);
2443
+ setScrollX(columnWidth * index);
2444
+ }
2445
+ }, [viewDate, columnWidth, dateSetup.dates, dateSetup.viewMode, viewMode, currentViewDate, setCurrentViewDate]);
2446
+ useEffect(function () {
2447
+ var changedTask = ganttEvent.changedTask,
2448
+ action = ganttEvent.action;
2449
+
2450
+ if (changedTask) {
2451
+ if (action === "delete") {
2452
+ setGanttEvent({
2453
+ action: ""
2454
+ });
2455
+ setBarTasks(barTasks.filter(function (t) {
2456
+ return t.id !== changedTask.id;
2457
+ }));
2458
+ } else if (action === "move" || action === "end" || action === "start" || action === "progress") {
2459
+ var prevStateTask = barTasks.find(function (t) {
2460
+ return t.id === changedTask.id;
2461
+ });
2462
+
2463
+ if (prevStateTask && (prevStateTask.start.getTime() !== changedTask.start.getTime() || prevStateTask.end.getTime() !== changedTask.end.getTime() || prevStateTask.progress !== changedTask.progress)) {
2464
+ var newTaskList = barTasks.map(function (t) {
2465
+ return t.id === changedTask.id ? changedTask : t;
2466
+ });
2467
+ setBarTasks(newTaskList);
2468
+ }
2469
+ }
2470
+ }
2471
+ }, [ganttEvent, barTasks]);
2472
+ useEffect(function () {
2473
+ if (failedTask) {
2474
+ setBarTasks(barTasks.map(function (t) {
2475
+ return t.id !== failedTask.id ? t : failedTask;
2476
+ }));
2477
+ setFailedTask(null);
2478
+ }
2479
+ }, [failedTask, barTasks]);
2480
+ useEffect(function () {
2481
+ if (!listCellWidth) {
2482
+ setTaskListWidth(0);
2483
+ }
2484
+
2485
+ if (taskListRef.current) {
2486
+ setTaskListWidth(taskListRef.current.offsetWidth);
2487
+ }
2488
+ }, [taskListRef, listCellWidth]);
2489
+ useEffect(function () {
2490
+ if (wrapperRef.current) {
2491
+ setSvgContainerWidth(wrapperRef.current.offsetWidth - taskListWidth);
2492
+ }
2493
+ }, [wrapperRef, taskListWidth]);
2494
+ useEffect(function () {
2495
+ if (ganttHeight) {
2496
+ setSvgContainerHeight(ganttHeight + headerHeight);
2497
+ } else {
2498
+ setSvgContainerHeight(tasks.length * rowHeight + headerHeight);
2499
+ }
2500
+ }, [ganttHeight, tasks, headerHeight, rowHeight]);
2501
+ useEffect(function () {
2502
+ var _wrapperRef$current;
2503
+
2504
+ var handleWheel = function handleWheel(event) {
2505
+ if (event.shiftKey || event.deltaX) {
2506
+ var scrollMove = event.deltaX ? event.deltaX : event.deltaY;
2507
+ var newScrollX = scrollX + scrollMove;
2508
+
2509
+ if (newScrollX < 0) {
2510
+ newScrollX = 0;
2511
+ } else if (newScrollX > svgWidth) {
2512
+ newScrollX = svgWidth;
2513
+ }
2514
+
2515
+ setScrollX(newScrollX);
2516
+ event.preventDefault();
2517
+ } else if (ganttHeight) {
2518
+ var newScrollY = scrollY + event.deltaY;
2519
+
2520
+ if (newScrollY < 0) {
2521
+ newScrollY = 0;
2522
+ } else if (newScrollY > ganttFullHeight - ganttHeight) {
2523
+ newScrollY = ganttFullHeight - ganttHeight;
2524
+ }
2525
+
2526
+ if (newScrollY !== scrollY) {
2527
+ setScrollY(newScrollY);
2528
+ event.preventDefault();
2529
+ }
2530
+ }
2531
+
2532
+ setIgnoreScrollEvent(true);
2533
+ };
2534
+
2535
+ (_wrapperRef$current = wrapperRef.current) === null || _wrapperRef$current === void 0 ? void 0 : _wrapperRef$current.addEventListener("wheel", handleWheel, {
2536
+ passive: false
2537
+ });
2538
+ return function () {
2539
+ var _wrapperRef$current2;
2540
+
2541
+ (_wrapperRef$current2 = wrapperRef.current) === null || _wrapperRef$current2 === void 0 ? void 0 : _wrapperRef$current2.removeEventListener("wheel", handleWheel);
2542
+ };
2543
+ }, [wrapperRef, scrollY, scrollX, ganttHeight, svgWidth, rtl, ganttFullHeight]);
2544
+
2545
+ var handleScrollY = function handleScrollY(event) {
2546
+ if (scrollY !== event.currentTarget.scrollTop && !ignoreScrollEvent) {
2547
+ setScrollY(event.currentTarget.scrollTop);
2548
+ setIgnoreScrollEvent(true);
2549
+ } else {
2550
+ setIgnoreScrollEvent(false);
2551
+ }
2552
+ };
2553
+
2554
+ var handleScrollX = function handleScrollX(event) {
2555
+ if (scrollX !== event.currentTarget.scrollLeft && !ignoreScrollEvent) {
2556
+ setScrollX(event.currentTarget.scrollLeft);
2557
+ setIgnoreScrollEvent(true);
2558
+ } else {
2559
+ setIgnoreScrollEvent(false);
2560
+ }
2561
+ };
2562
+
2563
+ var handleKeyDown = function handleKeyDown(event) {
2564
+ event.preventDefault();
2565
+ var newScrollY = scrollY;
2566
+ var newScrollX = scrollX;
2567
+ var isX = true;
2568
+
2569
+ switch (event.key) {
2570
+ case "Down":
2571
+ case "ArrowDown":
2572
+ newScrollY += rowHeight;
2573
+ isX = false;
2574
+ break;
2575
+
2576
+ case "Up":
2577
+ case "ArrowUp":
2578
+ newScrollY -= rowHeight;
2579
+ isX = false;
2580
+ break;
2581
+
2582
+ case "Left":
2583
+ case "ArrowLeft":
2584
+ newScrollX -= columnWidth;
2585
+ break;
2586
+
2587
+ case "Right":
2588
+ case "ArrowRight":
2589
+ newScrollX += columnWidth;
2590
+ break;
2591
+ }
2592
+
2593
+ if (isX) {
2594
+ if (newScrollX < 0) {
2595
+ newScrollX = 0;
2596
+ } else if (newScrollX > svgWidth) {
2597
+ newScrollX = svgWidth;
2598
+ }
2599
+
2600
+ setScrollX(newScrollX);
2601
+ } else {
2602
+ if (newScrollY < 0) {
2603
+ newScrollY = 0;
2604
+ } else if (newScrollY > ganttFullHeight - ganttHeight) {
2605
+ newScrollY = ganttFullHeight - ganttHeight;
2606
+ }
2607
+
2608
+ setScrollY(newScrollY);
2609
+ }
2610
+
2611
+ setIgnoreScrollEvent(true);
2612
+ };
2613
+
2614
+ var handleSelectedTask = function handleSelectedTask(taskId) {
2615
+ var newSelectedTask = barTasks.find(function (t) {
2616
+ return t.id === taskId;
2617
+ });
2618
+ var oldSelectedTask = barTasks.find(function (t) {
2619
+ return !!selectedTask && t.id === selectedTask.id;
2620
+ });
2621
+
2622
+ if (onSelect) {
2623
+ if (oldSelectedTask) {
2624
+ onSelect(oldSelectedTask, false);
2625
+ }
2626
+
2627
+ if (newSelectedTask) {
2628
+ onSelect(newSelectedTask, true);
2629
+ }
2630
+ }
2631
+
2632
+ setSelectedTask(newSelectedTask);
2633
+ };
2634
+
2635
+ var handleExpanderClick = function handleExpanderClick(task) {
2636
+ if (onExpanderClick && task.hideChildren !== undefined) {
2637
+ onExpanderClick(_extends({}, task, {
2638
+ hideChildren: !task.hideChildren
2639
+ }));
2640
+ }
2641
+ };
2642
+
2643
+ var gridProps = {
2644
+ columnWidth: columnWidth,
2645
+ svgWidth: svgWidth,
2646
+ tasks: tasks,
2647
+ rowHeight: rowHeight,
2648
+ dates: dateSetup.dates,
2649
+ todayColor: todayColor,
2650
+ rtl: rtl
2651
+ };
2652
+ var calendarProps = {
2653
+ dateSetup: dateSetup,
2654
+ locale: locale,
2655
+ viewMode: viewMode,
2656
+ headerHeight: headerHeight,
2657
+ columnWidth: columnWidth,
2658
+ fontFamily: fontFamily,
2659
+ fontSize: fontSize,
2660
+ rtl: rtl
2661
+ };
2662
+ var barProps = {
2663
+ tasks: barTasks,
2664
+ dates: dateSetup.dates,
2665
+ ganttEvent: ganttEvent,
2666
+ selectedTask: selectedTask,
2667
+ rowHeight: rowHeight,
2668
+ taskHeight: taskHeight,
2669
+ columnWidth: columnWidth,
2670
+ arrowColor: arrowColor,
2671
+ timeStep: timeStep,
2672
+ fontFamily: fontFamily,
2673
+ fontSize: fontSize,
2674
+ arrowIndent: arrowIndent,
2675
+ svgWidth: svgWidth,
2676
+ rtl: rtl,
2677
+ setGanttEvent: setGanttEvent,
2678
+ setFailedTask: setFailedTask,
2679
+ setSelectedTask: handleSelectedTask,
2680
+ onDateChange: onDateChange,
2681
+ onProgressChange: onProgressChange,
2682
+ onDoubleClick: onDoubleClick,
2683
+ onClick: onClick,
2684
+ onDelete: onDelete
2685
+ };
2686
+ var tableProps = {
2687
+ rowHeight: rowHeight,
2688
+ rowWidth: listCellWidth,
2689
+ fontFamily: fontFamily,
2690
+ fontSize: fontSize,
2691
+ tasks: barTasks,
2692
+ locale: locale,
2693
+ headerHeight: headerHeight,
2694
+ scrollY: scrollY,
2695
+ ganttHeight: ganttHeight,
2696
+ horizontalContainerClass: styles$9.horizontalContainer,
2697
+ selectedTask: selectedTask,
2698
+ taskListRef: taskListRef,
2699
+ setSelectedTask: handleSelectedTask,
2700
+ onExpanderClick: handleExpanderClick,
2701
+ TaskListHeader: TaskListHeader,
2702
+ TaskListTable: TaskListTable
2703
+ };
2704
+ return React.createElement("div", null, React.createElement("div", {
2705
+ className: styles$9.wrapper,
2706
+ onKeyDown: handleKeyDown,
2707
+ tabIndex: 0,
2708
+ ref: wrapperRef
2709
+ }, listCellWidth && React.createElement(TaskList, Object.assign({}, tableProps)), React.createElement(TaskGantt, {
2710
+ gridProps: gridProps,
2711
+ calendarProps: calendarProps,
2712
+ barProps: barProps,
2713
+ ganttHeight: ganttHeight,
2714
+ scrollY: scrollY,
2715
+ scrollX: scrollX
2716
+ }), ganttEvent.changedTask && React.createElement(Tooltip, {
2717
+ arrowIndent: arrowIndent,
2718
+ rowHeight: rowHeight,
2719
+ svgContainerHeight: svgContainerHeight,
2720
+ svgContainerWidth: svgContainerWidth,
2721
+ fontFamily: fontFamily,
2722
+ fontSize: fontSize,
2723
+ scrollX: scrollX,
2724
+ scrollY: scrollY,
2725
+ task: ganttEvent.changedTask,
2726
+ headerHeight: headerHeight,
2727
+ taskListWidth: taskListWidth,
2728
+ TooltipContent: TooltipContent,
2729
+ rtl: rtl,
2730
+ svgWidth: svgWidth
2731
+ }), React.createElement(VerticalScroll, {
2732
+ ganttFullHeight: ganttFullHeight,
2733
+ ganttHeight: ganttHeight,
2734
+ headerHeight: headerHeight,
2735
+ scroll: scrollY,
2736
+ onScroll: handleScrollY,
2737
+ rtl: rtl
2738
+ })), React.createElement(HorizontalScroll, {
2739
+ svgWidth: svgWidth,
2740
+ taskListWidth: taskListWidth,
2741
+ scroll: scrollX,
2742
+ rtl: rtl,
2743
+ onScroll: handleScrollX
2744
+ }));
2745
+ };
2746
+
2747
+ export { Gantt, ViewMode };
2748
+ //# sourceMappingURL=index.modern.js.map