gantt-task-react-powern 0.6.31 → 0.6.33
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.
- package/README.md +109 -63
- package/dist/components/calendar/calendar.d.ts +1 -0
- package/dist/components/task-list/task-list-columns.d.ts +15 -0
- package/dist/components/task-list/task-list-header.d.ts +2 -0
- package/dist/components/task-list/task-list-table.d.ts +1 -0
- package/dist/components/task-list/task-list.d.ts +5 -0
- package/dist/index.css +22 -0
- package/dist/index.js +451 -282
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +451 -282
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -269,7 +269,7 @@ var getMonday = function getMonday(date) {
|
|
|
269
269
|
return new Date(date.setDate(diff));
|
|
270
270
|
};
|
|
271
271
|
|
|
272
|
-
var styles = {"ganttTable":"_3_ygE","ganttTable_Header":"_1nBOt","ganttTable_HeaderSeparator":"_2eZzQ","ganttTable_HeaderItem":"_WuQ0f"};
|
|
272
|
+
var styles = {"ganttTable":"_3_ygE","ganttTable_Header":"_1nBOt","ganttTable_HeaderSeparator":"_2eZzQ","ganttTable_HeaderResizeHandle":"_ddPJg","ganttTable_HeaderItem":"_WuQ0f"};
|
|
273
273
|
|
|
274
274
|
var TaskListHeaderDefault = function TaskListHeaderDefault(_ref) {
|
|
275
275
|
var headerHeight = _ref.headerHeight,
|
|
@@ -278,7 +278,64 @@ var TaskListHeaderDefault = function TaskListHeaderDefault(_ref) {
|
|
|
278
278
|
rowWidth = _ref.rowWidth,
|
|
279
279
|
scheduleType = _ref.scheduleType,
|
|
280
280
|
allSelected = _ref.allSelected,
|
|
281
|
-
onSelectAll = _ref.onSelectAll
|
|
281
|
+
onSelectAll = _ref.onSelectAll,
|
|
282
|
+
columnWidths = _ref.columnWidths,
|
|
283
|
+
onColumnResize = _ref.onColumnResize;
|
|
284
|
+
|
|
285
|
+
var widthOf = function widthOf(colId, factor) {
|
|
286
|
+
var _columnWidths$colId;
|
|
287
|
+
|
|
288
|
+
return (_columnWidths$colId = columnWidths === null || columnWidths === void 0 ? void 0 : columnWidths[colId]) != null ? _columnWidths$colId : parseInt(rowWidth) * factor;
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
var startResize = function startResize(colId, startWidth) {
|
|
292
|
+
return function (e) {
|
|
293
|
+
if (!onColumnResize) return;
|
|
294
|
+
e.preventDefault();
|
|
295
|
+
e.stopPropagation();
|
|
296
|
+
var startX = e.clientX;
|
|
297
|
+
|
|
298
|
+
var onMove = function onMove(ev) {
|
|
299
|
+
onColumnResize(colId, startWidth + (ev.clientX - startX));
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
var onUp = function onUp() {
|
|
303
|
+
document.removeEventListener("mousemove", onMove);
|
|
304
|
+
document.removeEventListener("mouseup", onUp);
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
document.addEventListener("mousemove", onMove);
|
|
308
|
+
document.addEventListener("mouseup", onUp);
|
|
309
|
+
};
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
var cell = function cell(colId, factor, content, opts) {
|
|
313
|
+
if (opts === void 0) {
|
|
314
|
+
opts = {};
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
var _opts = opts,
|
|
318
|
+
title = _opts.title,
|
|
319
|
+
_opts$resizable = _opts.resizable,
|
|
320
|
+
resizable = _opts$resizable === void 0 ? true : _opts$resizable;
|
|
321
|
+
var width = widthOf(colId, factor);
|
|
322
|
+
return React.createElement("div", {
|
|
323
|
+
className: styles.ganttTable_HeaderItem,
|
|
324
|
+
style: {
|
|
325
|
+
minWidth: width,
|
|
326
|
+
maxWidth: width,
|
|
327
|
+
position: "relative"
|
|
328
|
+
},
|
|
329
|
+
title: title
|
|
330
|
+
}, content, resizable && onColumnResize && React.createElement("div", {
|
|
331
|
+
className: styles.ganttTable_HeaderResizeHandle,
|
|
332
|
+
style: {
|
|
333
|
+
height: headerHeight - 2
|
|
334
|
+
},
|
|
335
|
+
onMouseDown: startResize(colId, width)
|
|
336
|
+
}));
|
|
337
|
+
};
|
|
338
|
+
|
|
282
339
|
return React.createElement("div", {
|
|
283
340
|
className: styles.ganttTable,
|
|
284
341
|
style: {
|
|
@@ -290,156 +347,33 @@ var TaskListHeaderDefault = function TaskListHeaderDefault(_ref) {
|
|
|
290
347
|
style: {
|
|
291
348
|
height: headerHeight - 2
|
|
292
349
|
}
|
|
293
|
-
}, onSelectAll &&
|
|
294
|
-
className: styles.ganttTable_HeaderItem,
|
|
295
|
-
style: {
|
|
296
|
-
minWidth: parseInt(rowWidth) * 0.3,
|
|
297
|
-
maxWidth: parseInt(rowWidth) * 0.3
|
|
298
|
-
}
|
|
299
|
-
}, React.createElement("input", {
|
|
350
|
+
}, onSelectAll && cell("select", 0.3, React.createElement("input", {
|
|
300
351
|
type: "checkbox",
|
|
301
352
|
checked: allSelected,
|
|
302
353
|
onChange: function onChange(e) {
|
|
303
354
|
return onSelectAll(e.target.checked);
|
|
304
355
|
}
|
|
305
|
-
})
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
minWidth: parseInt(rowWidth) * 0.8,
|
|
309
|
-
maxWidth: parseInt(rowWidth) * 0.8
|
|
310
|
-
}
|
|
311
|
-
}, "ID"), React.createElement("div", {
|
|
312
|
-
className: styles.ganttTable_HeaderSeparator,
|
|
313
|
-
style: {
|
|
314
|
-
height: headerHeight * 0.5,
|
|
315
|
-
marginTop: headerHeight * 0.2
|
|
316
|
-
}
|
|
317
|
-
}), React.createElement("div", {
|
|
318
|
-
className: styles.ganttTable_HeaderItem,
|
|
319
|
-
style: {
|
|
320
|
-
minWidth: parseInt(rowWidth) * 0.8,
|
|
321
|
-
maxWidth: parseInt(rowWidth) * 0.8
|
|
322
|
-
}
|
|
323
|
-
}, "WBS Code / Activity ID"), React.createElement("div", {
|
|
324
|
-
className: styles.ganttTable_HeaderSeparator,
|
|
325
|
-
style: {
|
|
326
|
-
height: headerHeight * 0.5,
|
|
327
|
-
marginTop: headerHeight * 0.2
|
|
328
|
-
}
|
|
329
|
-
}), React.createElement("div", {
|
|
330
|
-
className: styles.ganttTable_HeaderItem,
|
|
331
|
-
style: {
|
|
332
|
-
minWidth: parseInt(rowWidth) * 1.8,
|
|
333
|
-
maxWidth: parseInt(rowWidth) * 1.8
|
|
334
|
-
}
|
|
335
|
-
}, "Task"), React.createElement("div", {
|
|
336
|
-
className: styles.ganttTable_HeaderSeparator,
|
|
337
|
-
style: {
|
|
338
|
-
height: headerHeight * 0.5,
|
|
339
|
-
marginTop: headerHeight * 0.2
|
|
340
|
-
}
|
|
341
|
-
}), React.createElement("div", {
|
|
342
|
-
className: styles.ganttTable_HeaderItem,
|
|
343
|
-
style: {
|
|
344
|
-
minWidth: parseInt(rowWidth) * 0.6
|
|
345
|
-
},
|
|
356
|
+
}), {
|
|
357
|
+
resizable: false
|
|
358
|
+
}), cell("id", 0.8, "ID"), cell("wbs", 0.8, "WBS Code / Activity ID"), cell("name", 1.8, "Task"), cell("plannedStart", 0.6, "Planned Start", {
|
|
346
359
|
title: "Planned Start"
|
|
347
|
-
}, "
|
|
348
|
-
className: styles.ganttTable_HeaderSeparator,
|
|
349
|
-
style: {
|
|
350
|
-
height: headerHeight * 0.5,
|
|
351
|
-
marginTop: headerHeight * 0.25
|
|
352
|
-
}
|
|
353
|
-
}), React.createElement("div", {
|
|
354
|
-
className: styles.ganttTable_HeaderItem,
|
|
355
|
-
style: {
|
|
356
|
-
minWidth: parseInt(rowWidth) * 0.6
|
|
357
|
-
},
|
|
360
|
+
}), cell("plannedEnd", 0.6, "Planned End", {
|
|
358
361
|
title: "Planned End"
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
title: "Planned Start"
|
|
365
|
-
}, "Actual Start"), scheduleType === "lookAhead" && React.createElement("div", {
|
|
366
|
-
className: styles.ganttTable_HeaderSeparator,
|
|
367
|
-
style: {
|
|
368
|
-
height: headerHeight * 0.5,
|
|
369
|
-
marginTop: headerHeight * 0.25
|
|
370
|
-
}
|
|
371
|
-
}), scheduleType === "lookAhead" && React.createElement("div", {
|
|
372
|
-
className: styles.ganttTable_HeaderItem,
|
|
373
|
-
style: {
|
|
374
|
-
minWidth: parseInt(rowWidth) * 0.6
|
|
375
|
-
},
|
|
376
|
-
title: "Planned End"
|
|
377
|
-
}, "Actual End"), scheduleType === "main" && React.createElement(React.Fragment, null, React.createElement("div", {
|
|
378
|
-
className: styles.ganttTable_HeaderSeparator,
|
|
379
|
-
style: {
|
|
380
|
-
height: headerHeight * 0.5,
|
|
381
|
-
marginTop: headerHeight * 0.25
|
|
382
|
-
}
|
|
383
|
-
}), React.createElement("div", {
|
|
384
|
-
className: styles.ganttTable_HeaderItem,
|
|
385
|
-
style: {
|
|
386
|
-
minWidth: parseInt(rowWidth) * 0.6,
|
|
387
|
-
maxWidth: parseInt(rowWidth) * 0.6
|
|
388
|
-
},
|
|
362
|
+
}), scheduleType === "lookAhead" && React.createElement(React.Fragment, null, cell("actualStart", 0.6, "Actual Start", {
|
|
363
|
+
title: "Actual Start"
|
|
364
|
+
}), cell("actualEnd", 0.6, "Actual End", {
|
|
365
|
+
title: "Actual End"
|
|
366
|
+
})), scheduleType === "main" && React.createElement(React.Fragment, null, cell("percentComplete", 0.6, "% Complete", {
|
|
389
367
|
title: "% Complete"
|
|
390
|
-
}, "
|
|
391
|
-
className: styles.ganttTable_HeaderSeparator,
|
|
392
|
-
style: {
|
|
393
|
-
height: headerHeight * 0.5,
|
|
394
|
-
marginTop: headerHeight * 0.25
|
|
395
|
-
}
|
|
396
|
-
}), React.createElement("div", {
|
|
397
|
-
className: styles.ganttTable_HeaderItem,
|
|
398
|
-
style: {
|
|
399
|
-
minWidth: parseInt(rowWidth) * 0.6,
|
|
400
|
-
maxWidth: parseInt(rowWidth) * 0.6
|
|
401
|
-
},
|
|
368
|
+
}), cell("plannedDuration", 0.6, "Planned Duration", {
|
|
402
369
|
title: "Planned Duration"
|
|
403
|
-
}, "
|
|
404
|
-
className: styles.ganttTable_HeaderSeparator,
|
|
405
|
-
style: {
|
|
406
|
-
height: headerHeight * 0.5,
|
|
407
|
-
marginTop: headerHeight * 0.25
|
|
408
|
-
}
|
|
409
|
-
}), React.createElement("div", {
|
|
410
|
-
className: styles.ganttTable_HeaderItem,
|
|
411
|
-
style: {
|
|
412
|
-
minWidth: parseInt(rowWidth) * 0.7,
|
|
413
|
-
maxWidth: parseInt(rowWidth) * 0.7
|
|
414
|
-
},
|
|
370
|
+
}), cell("remainingDuration", 0.7, "Remaining Duration", {
|
|
415
371
|
title: "Remaining Duration"
|
|
416
|
-
}, "
|
|
417
|
-
className: styles.ganttTable_HeaderSeparator,
|
|
418
|
-
style: {
|
|
419
|
-
height: headerHeight * 0.5,
|
|
420
|
-
marginTop: headerHeight * 0.25
|
|
421
|
-
}
|
|
422
|
-
}), React.createElement("div", {
|
|
423
|
-
className: styles.ganttTable_HeaderItem,
|
|
424
|
-
style: {
|
|
425
|
-
minWidth: parseInt(rowWidth) * 0.6,
|
|
426
|
-
maxWidth: parseInt(rowWidth) * 0.6
|
|
427
|
-
},
|
|
372
|
+
}), cell("actualDuration", 0.6, "Actual Duration", {
|
|
428
373
|
title: "Actual Duration"
|
|
429
|
-
}, "
|
|
430
|
-
className: styles.ganttTable_HeaderSeparator,
|
|
431
|
-
style: {
|
|
432
|
-
height: headerHeight * 0.5,
|
|
433
|
-
marginTop: headerHeight * 0.25
|
|
434
|
-
}
|
|
435
|
-
}), React.createElement("div", {
|
|
436
|
-
className: styles.ganttTable_HeaderItem,
|
|
437
|
-
style: {
|
|
438
|
-
minWidth: parseInt(rowWidth) * 0.8,
|
|
439
|
-
maxWidth: parseInt(rowWidth) * 0.8
|
|
440
|
-
},
|
|
374
|
+
}), cell("durationType", 0.8, "Duration Type", {
|
|
441
375
|
title: "Duration Type"
|
|
442
|
-
}
|
|
376
|
+
}))));
|
|
443
377
|
};
|
|
444
378
|
|
|
445
379
|
var styles$1 = {"taskListWrapper":"_3ZbQT","taskListTableRow":"_34SS0","taskListLookAheadRow":"_GzvG4","taskListMilestoneRow":"_3Ykml","taskListCell":"_3lLk3","taskListNameWrapper":"_nI1Xw","taskListExpander":"_2QjE6","taskListExpanderPlaceholder":"_1fnLB","taskListEmptyExpander":"_2TfEi","taskListText":"_2ZvXU"};
|
|
@@ -483,7 +417,15 @@ var TaskListTableDefault = function TaskListTableDefault(_ref) {
|
|
|
483
417
|
taskLabelRenderer = _ref$taskLabelRendere === void 0 ? function (t) {
|
|
484
418
|
return " " + t.name;
|
|
485
419
|
} : _ref$taskLabelRendere,
|
|
486
|
-
virtualItems = _ref.virtualItems
|
|
420
|
+
virtualItems = _ref.virtualItems,
|
|
421
|
+
columnWidths = _ref.columnWidths;
|
|
422
|
+
|
|
423
|
+
var widthOf = function widthOf(colId, factor) {
|
|
424
|
+
var _columnWidths$colId;
|
|
425
|
+
|
|
426
|
+
return (_columnWidths$colId = columnWidths === null || columnWidths === void 0 ? void 0 : columnWidths[colId]) != null ? _columnWidths$colId : parseInt(rowWidth) * factor;
|
|
427
|
+
};
|
|
428
|
+
|
|
487
429
|
var toLocaleDateString = useMemo(function () {
|
|
488
430
|
return toLocaleDateStringFactory(locale);
|
|
489
431
|
}, [locale]);
|
|
@@ -555,8 +497,8 @@ var TaskListTableDefault = function TaskListTableDefault(_ref) {
|
|
|
555
497
|
}, onTaskSelect && React.createElement("div", {
|
|
556
498
|
className: styles$1.taskListCell,
|
|
557
499
|
style: {
|
|
558
|
-
minWidth:
|
|
559
|
-
maxWidth:
|
|
500
|
+
minWidth: widthOf("select", 0.3),
|
|
501
|
+
maxWidth: widthOf("select", 0.3)
|
|
560
502
|
}
|
|
561
503
|
}, React.createElement("div", {
|
|
562
504
|
className: styles$1.taskListText,
|
|
@@ -578,8 +520,8 @@ var TaskListTableDefault = function TaskListTableDefault(_ref) {
|
|
|
578
520
|
}))), React.createElement("div", {
|
|
579
521
|
className: styles$1.taskListCell,
|
|
580
522
|
style: {
|
|
581
|
-
minWidth:
|
|
582
|
-
maxWidth:
|
|
523
|
+
minWidth: widthOf("id", 0.8),
|
|
524
|
+
maxWidth: widthOf("id", 0.8)
|
|
583
525
|
},
|
|
584
526
|
title: t.id
|
|
585
527
|
}, React.createElement("div", {
|
|
@@ -605,15 +547,15 @@ var TaskListTableDefault = function TaskListTableDefault(_ref) {
|
|
|
605
547
|
}, "\u2714") : ""))), React.createElement("div", {
|
|
606
548
|
className: styles$1.taskListCell,
|
|
607
549
|
style: {
|
|
608
|
-
minWidth:
|
|
609
|
-
maxWidth:
|
|
550
|
+
minWidth: widthOf("wbs", 0.8),
|
|
551
|
+
maxWidth: widthOf("wbs", 0.8)
|
|
610
552
|
},
|
|
611
553
|
title: t.optionalId ? t.optionalId : ""
|
|
612
554
|
}, t.optionalId), React.createElement("div", {
|
|
613
555
|
className: styles$1.taskListCell,
|
|
614
556
|
style: {
|
|
615
|
-
minWidth:
|
|
616
|
-
maxWidth:
|
|
557
|
+
minWidth: widthOf("name", 1.8),
|
|
558
|
+
maxWidth: widthOf("name", 1.8)
|
|
617
559
|
},
|
|
618
560
|
title: t.name
|
|
619
561
|
}, React.createElement("div", {
|
|
@@ -621,32 +563,32 @@ var TaskListTableDefault = function TaskListTableDefault(_ref) {
|
|
|
621
563
|
}, taskLabelRenderer(t))), React.createElement("div", {
|
|
622
564
|
className: styles$1.taskListCell,
|
|
623
565
|
style: {
|
|
624
|
-
minWidth:
|
|
625
|
-
maxWidth:
|
|
566
|
+
minWidth: widthOf("plannedStart", 0.6),
|
|
567
|
+
maxWidth: widthOf("plannedStart", 0.6)
|
|
626
568
|
}
|
|
627
569
|
}, React.createElement("div", {
|
|
628
570
|
className: styles$1.taskListText
|
|
629
571
|
}, "\xA0", toLocaleDateString(t.start, dateTimeOptions))), React.createElement("div", {
|
|
630
572
|
className: styles$1.taskListCell,
|
|
631
573
|
style: {
|
|
632
|
-
minWidth:
|
|
633
|
-
maxWidth:
|
|
574
|
+
minWidth: widthOf("plannedEnd", 0.6),
|
|
575
|
+
maxWidth: widthOf("plannedEnd", 0.6)
|
|
634
576
|
}
|
|
635
577
|
}, React.createElement("div", {
|
|
636
578
|
className: styles$1.taskListText
|
|
637
579
|
}, "\xA0", toLocaleDateString(t.end, dateTimeOptions))), scheduleType === "lookAhead" && React.createElement("div", {
|
|
638
580
|
className: styles$1.taskListCell,
|
|
639
581
|
style: {
|
|
640
|
-
minWidth:
|
|
641
|
-
maxWidth:
|
|
582
|
+
minWidth: widthOf("actualStart", 0.6),
|
|
583
|
+
maxWidth: widthOf("actualStart", 0.6)
|
|
642
584
|
}
|
|
643
585
|
}, React.createElement("div", {
|
|
644
586
|
className: styles$1.taskListText
|
|
645
587
|
}, "\xA0", toLocaleDateString(t.actualStart, dateTimeOptions))), scheduleType === "lookAhead" && React.createElement("div", {
|
|
646
588
|
className: styles$1.taskListCell,
|
|
647
589
|
style: {
|
|
648
|
-
minWidth:
|
|
649
|
-
maxWidth:
|
|
590
|
+
minWidth: widthOf("actualEnd", 0.6),
|
|
591
|
+
maxWidth: widthOf("actualEnd", 0.6)
|
|
650
592
|
}
|
|
651
593
|
}, React.createElement("div", {
|
|
652
594
|
className: styles$1.taskListText
|
|
@@ -666,40 +608,40 @@ var TaskListTableDefault = function TaskListTableDefault(_ref) {
|
|
|
666
608
|
return React.createElement(React.Fragment, null, React.createElement("div", {
|
|
667
609
|
className: styles$1.taskListCell,
|
|
668
610
|
style: {
|
|
669
|
-
minWidth:
|
|
670
|
-
maxWidth:
|
|
611
|
+
minWidth: widthOf("percentComplete", 0.6),
|
|
612
|
+
maxWidth: widthOf("percentComplete", 0.6)
|
|
671
613
|
}
|
|
672
614
|
}, React.createElement("div", {
|
|
673
615
|
className: styles$1.taskListText
|
|
674
616
|
}, "\xA0", percentComplete != null ? percentComplete + "%" : "")), React.createElement("div", {
|
|
675
617
|
className: styles$1.taskListCell,
|
|
676
618
|
style: {
|
|
677
|
-
minWidth:
|
|
678
|
-
maxWidth:
|
|
619
|
+
minWidth: widthOf("plannedDuration", 0.6),
|
|
620
|
+
maxWidth: widthOf("plannedDuration", 0.6)
|
|
679
621
|
}
|
|
680
622
|
}, React.createElement("div", {
|
|
681
623
|
className: styles$1.taskListText
|
|
682
624
|
}, "\xA0", plannedDuration != null ? plannedDuration : "")), React.createElement("div", {
|
|
683
625
|
className: styles$1.taskListCell,
|
|
684
626
|
style: {
|
|
685
|
-
minWidth:
|
|
686
|
-
maxWidth:
|
|
627
|
+
minWidth: widthOf("remainingDuration", 0.7),
|
|
628
|
+
maxWidth: widthOf("remainingDuration", 0.7)
|
|
687
629
|
}
|
|
688
630
|
}, React.createElement("div", {
|
|
689
631
|
className: styles$1.taskListText
|
|
690
632
|
}, "\xA0", remainingDuration != null ? remainingDuration : "")), React.createElement("div", {
|
|
691
633
|
className: styles$1.taskListCell,
|
|
692
634
|
style: {
|
|
693
|
-
minWidth:
|
|
694
|
-
maxWidth:
|
|
635
|
+
minWidth: widthOf("actualDuration", 0.6),
|
|
636
|
+
maxWidth: widthOf("actualDuration", 0.6)
|
|
695
637
|
}
|
|
696
638
|
}, React.createElement("div", {
|
|
697
639
|
className: styles$1.taskListText
|
|
698
640
|
}, "\xA0", actualDuration != null ? actualDuration : "")), React.createElement("div", {
|
|
699
641
|
className: styles$1.taskListCell,
|
|
700
642
|
style: {
|
|
701
|
-
minWidth:
|
|
702
|
-
maxWidth:
|
|
643
|
+
minWidth: widthOf("durationType", 0.8),
|
|
644
|
+
maxWidth: widthOf("durationType", 0.8)
|
|
703
645
|
}
|
|
704
646
|
}, React.createElement("div", {
|
|
705
647
|
className: styles$1.taskListText
|
|
@@ -876,6 +818,73 @@ var VerticalScroll = function VerticalScroll(_ref) {
|
|
|
876
818
|
}));
|
|
877
819
|
};
|
|
878
820
|
|
|
821
|
+
function getTaskListColumns(scheduleType, hasCheckbox) {
|
|
822
|
+
var columns = [];
|
|
823
|
+
if (hasCheckbox) columns.push({
|
|
824
|
+
id: "select",
|
|
825
|
+
factor: 0.3
|
|
826
|
+
});
|
|
827
|
+
columns.push({
|
|
828
|
+
id: "id",
|
|
829
|
+
factor: 0.8
|
|
830
|
+
}, {
|
|
831
|
+
id: "wbs",
|
|
832
|
+
factor: 0.8
|
|
833
|
+
}, {
|
|
834
|
+
id: "name",
|
|
835
|
+
factor: 1.8
|
|
836
|
+
}, {
|
|
837
|
+
id: "plannedStart",
|
|
838
|
+
factor: 0.6
|
|
839
|
+
}, {
|
|
840
|
+
id: "plannedEnd",
|
|
841
|
+
factor: 0.6
|
|
842
|
+
});
|
|
843
|
+
|
|
844
|
+
if (scheduleType === "lookAhead") {
|
|
845
|
+
columns.push({
|
|
846
|
+
id: "actualStart",
|
|
847
|
+
factor: 0.6
|
|
848
|
+
}, {
|
|
849
|
+
id: "actualEnd",
|
|
850
|
+
factor: 0.6
|
|
851
|
+
});
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
if (scheduleType === "main") {
|
|
855
|
+
columns.push({
|
|
856
|
+
id: "percentComplete",
|
|
857
|
+
factor: 0.6
|
|
858
|
+
}, {
|
|
859
|
+
id: "plannedDuration",
|
|
860
|
+
factor: 0.6
|
|
861
|
+
}, {
|
|
862
|
+
id: "remainingDuration",
|
|
863
|
+
factor: 0.7
|
|
864
|
+
}, {
|
|
865
|
+
id: "actualDuration",
|
|
866
|
+
factor: 0.6
|
|
867
|
+
}, {
|
|
868
|
+
id: "durationType",
|
|
869
|
+
factor: 0.8
|
|
870
|
+
});
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
return columns;
|
|
874
|
+
}
|
|
875
|
+
var MIN_COLUMN_WIDTH = 40;
|
|
876
|
+
function buildDefaultColumnWidths(scheduleType, hasCheckbox, rowWidth) {
|
|
877
|
+
var base = parseInt(rowWidth) || 0;
|
|
878
|
+
var widths = {};
|
|
879
|
+
|
|
880
|
+
for (var _iterator = _createForOfIteratorHelperLoose(getTaskListColumns(scheduleType, hasCheckbox)), _step; !(_step = _iterator()).done;) {
|
|
881
|
+
var col = _step.value;
|
|
882
|
+
widths[col.id] = base * col.factor;
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
return widths;
|
|
886
|
+
}
|
|
887
|
+
|
|
879
888
|
var styles$4 = {"hideScrollbar":"_38emS"};
|
|
880
889
|
|
|
881
890
|
var TaskList = function TaskList(_ref) {
|
|
@@ -900,6 +909,8 @@ var TaskList = function TaskList(_ref) {
|
|
|
900
909
|
taskLabelRenderer = _ref.taskLabelRenderer,
|
|
901
910
|
onMultiSelect = _ref.onMultiSelect,
|
|
902
911
|
containerWidth = _ref.containerWidth,
|
|
912
|
+
containerMaxWidth = _ref.containerMaxWidth,
|
|
913
|
+
onContentWidthChange = _ref.onContentWidthChange,
|
|
903
914
|
innerScrollRef = _ref.innerScrollRef,
|
|
904
915
|
externalHorizontalContainerRef = _ref.horizontalContainerRef;
|
|
905
916
|
var internalHorizontalContainerRef = useRef(null);
|
|
@@ -925,9 +936,55 @@ var TaskList = function TaskList(_ref) {
|
|
|
925
936
|
selectedTasks = _useState[0],
|
|
926
937
|
setSelectedTasks = _useState[1];
|
|
927
938
|
|
|
928
|
-
var
|
|
929
|
-
|
|
930
|
-
|
|
939
|
+
var hasCheckbox = !!onMultiSelect;
|
|
940
|
+
|
|
941
|
+
var _useState2 = useState(function () {
|
|
942
|
+
return buildDefaultColumnWidths(scheduleType, hasCheckbox, rowWidth);
|
|
943
|
+
}),
|
|
944
|
+
columnWidths = _useState2[0],
|
|
945
|
+
setColumnWidths = _useState2[1];
|
|
946
|
+
|
|
947
|
+
useEffect(function () {
|
|
948
|
+
var defaults = buildDefaultColumnWidths(scheduleType, hasCheckbox, rowWidth);
|
|
949
|
+
setColumnWidths(function (prev) {
|
|
950
|
+
var ids = Object.keys(defaults);
|
|
951
|
+
var sameSet = ids.length === Object.keys(prev).length && ids.every(function (id) {
|
|
952
|
+
return id in prev;
|
|
953
|
+
});
|
|
954
|
+
if (sameSet) return prev;
|
|
955
|
+
var next = {};
|
|
956
|
+
|
|
957
|
+
for (var _i = 0, _ids = ids; _i < _ids.length; _i++) {
|
|
958
|
+
var _prev$id;
|
|
959
|
+
|
|
960
|
+
var id = _ids[_i];
|
|
961
|
+
next[id] = (_prev$id = prev[id]) != null ? _prev$id : defaults[id];
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
return next;
|
|
965
|
+
});
|
|
966
|
+
}, [scheduleType, hasCheckbox, rowWidth]);
|
|
967
|
+
|
|
968
|
+
var handleColumnResize = function handleColumnResize(colId, width) {
|
|
969
|
+
setColumnWidths(function (prev) {
|
|
970
|
+
var _extends2;
|
|
971
|
+
|
|
972
|
+
return _extends({}, prev, (_extends2 = {}, _extends2[colId] = Math.max(MIN_COLUMN_WIDTH, width), _extends2));
|
|
973
|
+
});
|
|
974
|
+
};
|
|
975
|
+
|
|
976
|
+
var contentWidth = useMemo(function () {
|
|
977
|
+
return Object.values(columnWidths).reduce(function (sum, w) {
|
|
978
|
+
return sum + w;
|
|
979
|
+
}, 0);
|
|
980
|
+
}, [columnWidths]);
|
|
981
|
+
useEffect(function () {
|
|
982
|
+
onContentWidthChange === null || onContentWidthChange === void 0 ? void 0 : onContentWidthChange(contentWidth);
|
|
983
|
+
}, [contentWidth, onContentWidthChange]);
|
|
984
|
+
|
|
985
|
+
var _useState3 = useState([]),
|
|
986
|
+
pendingTaskSelect = _useState3[0],
|
|
987
|
+
setPendingTaskSelect = _useState3[1];
|
|
931
988
|
|
|
932
989
|
var prevSelectedTasksRef = useRef([]);
|
|
933
990
|
var expandedTasks = useRef([]);
|
|
@@ -1075,7 +1132,9 @@ var TaskList = function TaskList(_ref) {
|
|
|
1075
1132
|
rowWidth: rowWidth,
|
|
1076
1133
|
scheduleType: scheduleType,
|
|
1077
1134
|
allSelected: tasks.length > 0 && selectedTasks.length === tasks.length,
|
|
1078
|
-
onSelectAll: onMultiSelect ? handleSelectAll : undefined
|
|
1135
|
+
onSelectAll: onMultiSelect ? handleSelectAll : undefined,
|
|
1136
|
+
columnWidths: columnWidths,
|
|
1137
|
+
onColumnResize: handleColumnResize
|
|
1079
1138
|
};
|
|
1080
1139
|
var selectedTaskId = selectedTask ? selectedTask.id : "";
|
|
1081
1140
|
var tableProps = {
|
|
@@ -1093,15 +1152,19 @@ var TaskList = function TaskList(_ref) {
|
|
|
1093
1152
|
selectedTasks: onMultiSelect ? selectedTasks : undefined,
|
|
1094
1153
|
onTaskSelect: onMultiSelect ? handleTaskSelect : undefined,
|
|
1095
1154
|
taskLabelRenderer: taskLabelRenderer,
|
|
1096
|
-
virtualItems: virtualizer.getVirtualItems()
|
|
1155
|
+
virtualItems: virtualizer.getVirtualItems(),
|
|
1156
|
+
columnWidths: columnWidths
|
|
1097
1157
|
};
|
|
1098
1158
|
return React.createElement("div", {
|
|
1099
1159
|
ref: taskListRef,
|
|
1100
|
-
style: containerWidth != null ? {
|
|
1101
|
-
width: containerWidth
|
|
1160
|
+
style: containerWidth != null || containerMaxWidth != null ? _extends({}, containerWidth != null ? {
|
|
1161
|
+
width: containerWidth
|
|
1162
|
+
} : {}, containerMaxWidth != null ? {
|
|
1163
|
+
maxWidth: containerMaxWidth
|
|
1164
|
+
} : {}, {
|
|
1102
1165
|
overflow: "hidden",
|
|
1103
1166
|
flexShrink: 0
|
|
1104
|
-
} : {}
|
|
1167
|
+
}) : {}
|
|
1105
1168
|
}, React.createElement("div", {
|
|
1106
1169
|
ref: innerScrollRef,
|
|
1107
1170
|
className: styles$4.hideScrollbar,
|
|
@@ -1258,7 +1321,7 @@ function getQuarterNumber(date, quarterStart) {
|
|
|
1258
1321
|
return Math.floor(offset / 3) + 1;
|
|
1259
1322
|
}
|
|
1260
1323
|
|
|
1261
|
-
var styles$5 = {"gridRow":"_2dZTy","gridRowLookAhead":"_2RRca","gridRowLine":"_3rUKi","gridTick":"_RuwuK","gridTickDashed":"_Zh9jh","darkerGridRow":"_2M-tt"};
|
|
1324
|
+
var styles$5 = {"gridRow":"_2dZTy","gridRowLookAhead":"_2RRca","gridRowLine":"_3rUKi","gridTick":"_RuwuK","gridTickWeekStart":"_1q0EV","gridTickDashed":"_Zh9jh","darkerGridRow":"_2M-tt"};
|
|
1262
1325
|
|
|
1263
1326
|
var GridBody = function GridBody(_ref) {
|
|
1264
1327
|
var _projectCalendar$week;
|
|
@@ -1302,7 +1365,8 @@ var GridBody = function GridBody(_ref) {
|
|
|
1302
1365
|
if (next && date <= now && next > now) return true;
|
|
1303
1366
|
|
|
1304
1367
|
if (!next && date <= now) {
|
|
1305
|
-
var
|
|
1368
|
+
var prev = dates[i - 1];
|
|
1369
|
+
var step = prev ? date.getTime() - prev.getTime() : 86400000;
|
|
1306
1370
|
var end = addToDate(date, step, "millisecond");
|
|
1307
1371
|
return end > now;
|
|
1308
1372
|
}
|
|
@@ -1363,11 +1427,14 @@ var GridBody = function GridBody(_ref) {
|
|
|
1363
1427
|
}
|
|
1364
1428
|
|
|
1365
1429
|
var isDayView = viewMode === ViewMode.Day;
|
|
1430
|
+
var isWeekView = viewMode === ViewMode.Week;
|
|
1366
1431
|
var tickLines = dates.map(function (date, i) {
|
|
1367
1432
|
var tickClass = styles$5.gridTick;
|
|
1368
1433
|
|
|
1369
1434
|
if (isDayView) {
|
|
1370
|
-
tickClass = date.getDay() === weekStartDay ? styles$5.
|
|
1435
|
+
tickClass = date.getDay() === weekStartDay ? styles$5.gridTickWeekStart : styles$5.gridTickDashed;
|
|
1436
|
+
} else if (isWeekView) {
|
|
1437
|
+
tickClass = styles$5.gridTickWeekStart;
|
|
1371
1438
|
}
|
|
1372
1439
|
|
|
1373
1440
|
return React.createElement("line", {
|
|
@@ -1535,7 +1602,13 @@ var Calendar = function Calendar(_ref) {
|
|
|
1535
1602
|
columnWidth = _ref.columnWidth,
|
|
1536
1603
|
fontFamily = _ref.fontFamily,
|
|
1537
1604
|
fontSize = _ref.fontSize,
|
|
1538
|
-
projectCalendar = _ref.projectCalendar
|
|
1605
|
+
projectCalendar = _ref.projectCalendar,
|
|
1606
|
+
weekendColor = _ref.weekendColor;
|
|
1607
|
+
|
|
1608
|
+
var isDayOff = function isDayOff(date) {
|
|
1609
|
+
if (projectCalendar) return isOffDay(date, projectCalendar);
|
|
1610
|
+
return false;
|
|
1611
|
+
};
|
|
1539
1612
|
|
|
1540
1613
|
var shortMonth = function shortMonth(date) {
|
|
1541
1614
|
return date.toLocaleString(locale, {
|
|
@@ -1784,6 +1857,18 @@ var Calendar = function Calendar(_ref) {
|
|
|
1784
1857
|
|
|
1785
1858
|
for (var i = 0; i < dates.length; i++) {
|
|
1786
1859
|
var date = dates[i];
|
|
1860
|
+
|
|
1861
|
+
if (isDayOff(date)) {
|
|
1862
|
+
offDayRects.push(React.createElement("rect", {
|
|
1863
|
+
key: "offday-header-" + i,
|
|
1864
|
+
x: columnWidth * i,
|
|
1865
|
+
y: topDefaultHeight,
|
|
1866
|
+
width: columnWidth,
|
|
1867
|
+
height: headerHeight - topDefaultHeight,
|
|
1868
|
+
fill: weekendColor
|
|
1869
|
+
}));
|
|
1870
|
+
}
|
|
1871
|
+
|
|
1787
1872
|
var isWeekStart = date.getDay() === weekStartDay;
|
|
1788
1873
|
tickLines.push(React.createElement("line", {
|
|
1789
1874
|
key: "tick-day-" + i,
|
|
@@ -2047,8 +2132,8 @@ var drawPathAndTriangle = function drawPathAndTriangle(taskFrom, taskTo, rowHeig
|
|
|
2047
2132
|
|
|
2048
2133
|
if (t.actualSegments && t.actualSegments.length > 0) return t.actualSegments[0].x1;
|
|
2049
2134
|
var candidates = [];
|
|
2050
|
-
if (t.
|
|
2051
|
-
if (t.
|
|
2135
|
+
if (t.x2 > t.x1) candidates.push(t.x1);
|
|
2136
|
+
if (t.actualx2 > t.actualx1) candidates.push(t.actualx1);
|
|
2052
2137
|
return candidates.length > 0 ? Math.min.apply(Math, candidates) : 0;
|
|
2053
2138
|
};
|
|
2054
2139
|
|
|
@@ -2061,8 +2146,8 @@ var drawPathAndTriangle = function drawPathAndTriangle(taskFrom, taskTo, rowHeig
|
|
|
2061
2146
|
|
|
2062
2147
|
if (t.actualSegments && t.actualSegments.length > 0) return t.actualSegments[t.actualSegments.length - 1].x2;
|
|
2063
2148
|
var candidates = [];
|
|
2064
|
-
if (t.x2
|
|
2065
|
-
if (t.actualx2
|
|
2149
|
+
if (t.x2 > t.x1) candidates.push(t.x2);
|
|
2150
|
+
if (t.actualx2 > t.actualx1) candidates.push(t.actualx2);
|
|
2066
2151
|
return candidates.length > 0 ? Math.max.apply(Math, candidates) : 0;
|
|
2067
2152
|
};
|
|
2068
2153
|
|
|
@@ -3187,6 +3272,11 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
|
3187
3272
|
setIsMoving = _useState3[1];
|
|
3188
3273
|
|
|
3189
3274
|
useEffect(function () {
|
|
3275
|
+
if (dates.length < 2) {
|
|
3276
|
+
setXStep(timeStep * columnWidth / 86400000);
|
|
3277
|
+
return;
|
|
3278
|
+
}
|
|
3279
|
+
|
|
3190
3280
|
var dateDelta = dates[1].getTime() - dates[0].getTime() - dates[1].getTimezoneOffset() * 60 * 1000 + dates[0].getTimezoneOffset() * 60 * 1000;
|
|
3191
3281
|
var newXStep = timeStep * columnWidth / dateDelta;
|
|
3192
3282
|
setXStep(newXStep);
|
|
@@ -3584,7 +3674,12 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
|
3584
3674
|
|
|
3585
3675
|
var getArrows = function getArrows(isCritical, criticalPathType) {
|
|
3586
3676
|
return tasks.flatMap(function (_task) {
|
|
3587
|
-
var
|
|
3677
|
+
var a = ganttEvent.action;
|
|
3678
|
+
var isDraggingThis = (a === "move" || a === "start" || a === "end" || a === "progress") && !!ganttEvent.changedTask && ganttEvent.changedTask.id === _task.id;
|
|
3679
|
+
|
|
3680
|
+
var _live = isDraggingThis ? _extends({}, ganttEvent.changedTask, {
|
|
3681
|
+
y: _task.y
|
|
3682
|
+
}) : _task;
|
|
3588
3683
|
|
|
3589
3684
|
var task = _live.start.getTime() > 0 && _live.end.getTime() > 0 ? _live : undefined;
|
|
3590
3685
|
|
|
@@ -3593,13 +3688,16 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
|
3593
3688
|
}
|
|
3594
3689
|
|
|
3595
3690
|
return task.barChildren.map(function (child) {
|
|
3596
|
-
|
|
3691
|
+
var taskTo = tasks[child.index];
|
|
3692
|
+
var fromDrawable = task.x2 > task.x1 || task.actualx2 > task.actualx1;
|
|
3693
|
+
var toDrawable = !!taskTo && (taskTo.x2 > taskTo.x1 || taskTo.actualx2 > taskTo.actualx1);
|
|
3694
|
+
|
|
3695
|
+
if (fromDrawable && toDrawable) {
|
|
3597
3696
|
var _task$criticalPathArr;
|
|
3598
3697
|
|
|
3599
3698
|
var criticalTask = (_task$criticalPathArr = task.criticalPathArrows) === null || _task$criticalPathArr === void 0 ? void 0 : _task$criticalPathArr.find(function (arrow) {
|
|
3600
|
-
return arrow.taskId ===
|
|
3699
|
+
return arrow.taskId === taskTo.id && (!!arrow.criticalPathType ? arrow.criticalPathType === criticalPathType : !criticalPathType);
|
|
3601
3700
|
});
|
|
3602
|
-
var taskTo = tasks[child.index];
|
|
3603
3701
|
var yFrom = task.y + taskHeight / 2;
|
|
3604
3702
|
var yTo = taskTo.y + taskHeight / 2;
|
|
3605
3703
|
var minY = Math.min(yFrom, yTo);
|
|
@@ -3611,9 +3709,9 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
|
3611
3709
|
|
|
3612
3710
|
if (!!criticalTask === isCritical) {
|
|
3613
3711
|
return React.createElement(Arrow, {
|
|
3614
|
-
key: "Arrow from " + task.id + " to " +
|
|
3712
|
+
key: "Arrow from " + task.id + " to " + taskTo.id + (isCritical ? "-critical" : ""),
|
|
3615
3713
|
taskFrom: task,
|
|
3616
|
-
taskTo:
|
|
3714
|
+
taskTo: taskTo,
|
|
3617
3715
|
rowHeight: rowHeight,
|
|
3618
3716
|
dependencyType: child.dependencyType,
|
|
3619
3717
|
taskHeight: taskHeight,
|
|
@@ -3806,8 +3904,10 @@ var HorizontalScroll = function HorizontalScroll(_ref) {
|
|
|
3806
3904
|
}));
|
|
3807
3905
|
};
|
|
3808
3906
|
|
|
3907
|
+
var GANTT_MIN_WIDTH_RATIO = 0.4;
|
|
3908
|
+
var TABLE_GANTT_DIVIDER_WIDTH = 20;
|
|
3809
3909
|
var Gantt = function Gantt(_ref) {
|
|
3810
|
-
var
|
|
3910
|
+
var _ref2;
|
|
3811
3911
|
|
|
3812
3912
|
var tasks = _ref.tasks,
|
|
3813
3913
|
_ref$leafTasks = _ref.leafTasks,
|
|
@@ -3915,8 +4015,8 @@ var Gantt = function Gantt(_ref) {
|
|
|
3915
4015
|
var tableHScrollRef = useRef(null);
|
|
3916
4016
|
|
|
3917
4017
|
var _useState2 = useState(0),
|
|
3918
|
-
|
|
3919
|
-
|
|
4018
|
+
tableContentWidth = _useState2[0],
|
|
4019
|
+
setTableContentWidth = _useState2[1];
|
|
3920
4020
|
|
|
3921
4021
|
var _useState3 = useState(function () {
|
|
3922
4022
|
var _ganttDateRange = ganttDateRange(tasks, viewMode, preStepsCount),
|
|
@@ -3946,22 +4046,21 @@ var Gantt = function Gantt(_ref) {
|
|
|
3946
4046
|
taskListWidth = _useState5[0],
|
|
3947
4047
|
setTaskListWidth = _useState5[1];
|
|
3948
4048
|
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
}, [taskListWidth, listCellWidth]);
|
|
4049
|
+
var _useState6 = useState(0),
|
|
4050
|
+
wrapperWidth = _useState6[0],
|
|
4051
|
+
setWrapperWidth = _useState6[1];
|
|
4052
|
+
|
|
4053
|
+
var maxTableWidth = wrapperWidth > 0 ? Math.max(100, wrapperWidth * (1 - GANTT_MIN_WIDTH_RATIO) - TABLE_GANTT_DIVIDER_WIDTH) : Infinity;
|
|
4054
|
+
var tableCap = Math.min(maxTableWidth, tableContentWidth > 0 ? tableContentWidth : Infinity);
|
|
3956
4055
|
|
|
3957
4056
|
var handleTableResizeMouseDown = function handleTableResizeMouseDown(e) {
|
|
3958
|
-
var _taskListRef$current$, _taskListRef$current
|
|
4057
|
+
var _taskListRef$current$, _taskListRef$current;
|
|
3959
4058
|
|
|
3960
4059
|
isDraggingTable.current = true;
|
|
3961
4060
|
userResizedRef.current = true;
|
|
3962
4061
|
dragStartX.current = e.clientX;
|
|
3963
4062
|
dragStartWidth.current = tableContainerWidth != null ? tableContainerWidth : (_taskListRef$current$ = (_taskListRef$current = taskListRef.current) === null || _taskListRef$current === void 0 ? void 0 : _taskListRef$current.offsetWidth) != null ? _taskListRef$current$ : 0;
|
|
3964
|
-
dragMaxWidth.current =
|
|
4063
|
+
dragMaxWidth.current = tableCap;
|
|
3965
4064
|
e.preventDefault();
|
|
3966
4065
|
};
|
|
3967
4066
|
|
|
@@ -3985,25 +4084,25 @@ var Gantt = function Gantt(_ref) {
|
|
|
3985
4084
|
};
|
|
3986
4085
|
}, []);
|
|
3987
4086
|
|
|
3988
|
-
var
|
|
3989
|
-
svgContainerWidth =
|
|
3990
|
-
setSvgContainerWidth =
|
|
4087
|
+
var _useState7 = useState(0),
|
|
4088
|
+
svgContainerWidth = _useState7[0],
|
|
4089
|
+
setSvgContainerWidth = _useState7[1];
|
|
3991
4090
|
|
|
3992
|
-
var
|
|
3993
|
-
svgContainerHeight =
|
|
3994
|
-
setSvgContainerHeight =
|
|
4091
|
+
var _useState8 = useState(ganttHeight),
|
|
4092
|
+
svgContainerHeight = _useState8[0],
|
|
4093
|
+
setSvgContainerHeight = _useState8[1];
|
|
3995
4094
|
|
|
3996
|
-
var
|
|
3997
|
-
barTasks =
|
|
3998
|
-
setBarTasks =
|
|
4095
|
+
var _useState9 = useState([]),
|
|
4096
|
+
barTasks = _useState9[0],
|
|
4097
|
+
setBarTasks = _useState9[1];
|
|
3999
4098
|
|
|
4000
4099
|
var debounceRef = useRef(null);
|
|
4001
4100
|
|
|
4002
|
-
var
|
|
4101
|
+
var _useState10 = useState({
|
|
4003
4102
|
action: ""
|
|
4004
4103
|
}),
|
|
4005
|
-
ganttEvent =
|
|
4006
|
-
setGanttEvent =
|
|
4104
|
+
ganttEvent = _useState10[0],
|
|
4105
|
+
setGanttEvent = _useState10[1];
|
|
4007
4106
|
|
|
4008
4107
|
var handleBarTasksUpdate = function handleBarTasksUpdate(task) {
|
|
4009
4108
|
setBarTasks(function (prev) {
|
|
@@ -4017,35 +4116,64 @@ var Gantt = function Gantt(_ref) {
|
|
|
4017
4116
|
return rowHeight * barFill / 100;
|
|
4018
4117
|
}, [rowHeight, barFill]);
|
|
4019
4118
|
|
|
4020
|
-
var
|
|
4021
|
-
selectedTask =
|
|
4022
|
-
setSelectedTask =
|
|
4023
|
-
|
|
4024
|
-
var _useState11 = useState(null),
|
|
4025
|
-
failedTask = _useState11[0],
|
|
4026
|
-
setFailedTask = _useState11[1];
|
|
4119
|
+
var _useState11 = useState(),
|
|
4120
|
+
selectedTask = _useState11[0],
|
|
4121
|
+
setSelectedTask = _useState11[1];
|
|
4027
4122
|
|
|
4028
4123
|
var _useState12 = useState(null),
|
|
4029
|
-
|
|
4030
|
-
|
|
4124
|
+
failedTask = _useState12[0],
|
|
4125
|
+
setFailedTask = _useState12[1];
|
|
4126
|
+
|
|
4127
|
+
var _useState13 = useState(null),
|
|
4128
|
+
computedColumnWidth = _useState13[0],
|
|
4129
|
+
setComputedColumnWidth = _useState13[1];
|
|
4031
4130
|
|
|
4032
4131
|
var computedForViewModeRef = useRef(null);
|
|
4033
4132
|
useEffect(function () {
|
|
4034
4133
|
if (columnWidthProp != null) return;
|
|
4035
4134
|
if (svgContainerWidth <= 0) return;
|
|
4135
|
+
var minVisible = VIEW_MODE_DEFAULT_VISIBLE_COUNT[viewMode];
|
|
4136
|
+
if (!minVisible) return;
|
|
4137
|
+
var maxVisible = VIEW_MODE_MAX_VISIBLE_COUNT[viewMode];
|
|
4138
|
+
var prevViewMode = computedForViewModeRef.current;
|
|
4139
|
+
|
|
4140
|
+
if (prevViewMode != null && prevViewMode !== viewMode && computedColumnWidth != null) {
|
|
4141
|
+
var visible = svgContainerWidth / computedColumnWidth;
|
|
4142
|
+
var oldMin = VIEW_MODE_DEFAULT_VISIBLE_COUNT[prevViewMode];
|
|
4143
|
+
var oldMax = VIEW_MODE_MAX_VISIBLE_COUNT[prevViewMode];
|
|
4144
|
+
var _next = computedColumnWidth;
|
|
4145
|
+
|
|
4146
|
+
if (maxVisible && oldMin != null && oldMax != null && oldMax > oldMin) {
|
|
4147
|
+
var t = Math.min(1, Math.max(0, (visible - oldMin) / (oldMax - oldMin)));
|
|
4148
|
+
var targetVisible = minVisible + t * (maxVisible - minVisible);
|
|
4149
|
+
_next = Math.floor(svgContainerWidth / targetVisible);
|
|
4150
|
+
} else if (visible < minVisible) {
|
|
4151
|
+
_next = Math.floor(svgContainerWidth / minVisible);
|
|
4152
|
+
} else if (maxVisible && visible > maxVisible) {
|
|
4153
|
+
_next = Math.ceil(svgContainerWidth / maxVisible);
|
|
4154
|
+
}
|
|
4155
|
+
|
|
4156
|
+
_next = Math.max(20, _next);
|
|
4157
|
+
computedForViewModeRef.current = viewMode;
|
|
4158
|
+
userResizedRef.current = true;
|
|
4159
|
+
|
|
4160
|
+
if (_next !== computedColumnWidth) {
|
|
4161
|
+
setComputedColumnWidth(_next);
|
|
4162
|
+
}
|
|
4163
|
+
|
|
4164
|
+
return;
|
|
4165
|
+
}
|
|
4166
|
+
|
|
4036
4167
|
var alreadySnappedForView = computedForViewModeRef.current === viewMode && computedColumnWidth != null;
|
|
4037
4168
|
if (userResizedRef.current && alreadySnappedForView) return;
|
|
4038
|
-
var
|
|
4039
|
-
|
|
4040
|
-
var next = Math.max(20, Math.floor(svgContainerWidth / target));
|
|
4169
|
+
var next = Math.max(20, Math.floor(svgContainerWidth / minVisible));
|
|
4170
|
+
computedForViewModeRef.current = viewMode;
|
|
4041
4171
|
|
|
4042
4172
|
if (next !== computedColumnWidth) {
|
|
4043
4173
|
setComputedColumnWidth(next);
|
|
4044
4174
|
}
|
|
4045
|
-
|
|
4046
|
-
computedForViewModeRef.current = viewMode;
|
|
4047
4175
|
}, [viewMode, svgContainerWidth, columnWidthProp, computedColumnWidth]);
|
|
4048
|
-
var columnWidth = (
|
|
4176
|
+
var columnWidth = (_ref2 = columnWidthProp != null ? columnWidthProp : computedColumnWidth) != null ? _ref2 : 60;
|
|
4049
4177
|
var effectiveColumnWidth = useMemo(function () {
|
|
4050
4178
|
if (svgContainerWidth <= 0 || dateSetup.dates.length <= 0) return columnWidth;
|
|
4051
4179
|
|
|
@@ -4066,29 +4194,29 @@ var Gantt = function Gantt(_ref) {
|
|
|
4066
4194
|
return barTasks.length * rowHeight;
|
|
4067
4195
|
}, [barTasks.length, rowHeight]);
|
|
4068
4196
|
|
|
4069
|
-
var
|
|
4070
|
-
scrollY =
|
|
4071
|
-
setScrollY =
|
|
4072
|
-
|
|
4073
|
-
var _useState14 = useState(-1),
|
|
4074
|
-
scrollX = _useState14[0],
|
|
4075
|
-
setScrollX = _useState14[1];
|
|
4197
|
+
var _useState14 = useState(0),
|
|
4198
|
+
scrollY = _useState14[0],
|
|
4199
|
+
setScrollY = _useState14[1];
|
|
4076
4200
|
|
|
4077
|
-
var _useState15 = useState(
|
|
4078
|
-
|
|
4079
|
-
|
|
4201
|
+
var _useState15 = useState(-1),
|
|
4202
|
+
scrollX = _useState15[0],
|
|
4203
|
+
setScrollX = _useState15[1];
|
|
4080
4204
|
|
|
4081
|
-
var _useState16 = useState(
|
|
4082
|
-
|
|
4083
|
-
|
|
4205
|
+
var _useState16 = useState(false),
|
|
4206
|
+
ignoreScrollEvent = _useState16[0],
|
|
4207
|
+
setIgnoreScrollEvent = _useState16[1];
|
|
4084
4208
|
|
|
4085
4209
|
var _useState17 = useState(0),
|
|
4086
|
-
|
|
4087
|
-
|
|
4210
|
+
lastTouchX = _useState17[0],
|
|
4211
|
+
setLastTouchX = _useState17[1];
|
|
4212
|
+
|
|
4213
|
+
var _useState18 = useState(0),
|
|
4214
|
+
lastTouchY = _useState18[0],
|
|
4215
|
+
setLastTouchY = _useState18[1];
|
|
4088
4216
|
|
|
4089
|
-
var
|
|
4090
|
-
isProcessing =
|
|
4091
|
-
setIsProcessing =
|
|
4217
|
+
var _useState19 = useState(false),
|
|
4218
|
+
isProcessing = _useState19[0],
|
|
4219
|
+
setIsProcessing = _useState19[1];
|
|
4092
4220
|
|
|
4093
4221
|
var buffer = rowHeight * 10;
|
|
4094
4222
|
var visibleStartY = scrollY - buffer;
|
|
@@ -4209,11 +4337,48 @@ var Gantt = function Gantt(_ref) {
|
|
|
4209
4337
|
setTaskListWidth(taskListRef.current.offsetWidth);
|
|
4210
4338
|
}
|
|
4211
4339
|
}, [taskListRef, listCellWidth]);
|
|
4340
|
+
useEffect(function () {
|
|
4341
|
+
if (!listCellWidth || !taskListRef.current) return;
|
|
4342
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
4343
|
+
|
|
4344
|
+
var measure = function measure() {
|
|
4345
|
+
if (taskListRef.current) {
|
|
4346
|
+
setTaskListWidth(taskListRef.current.offsetWidth);
|
|
4347
|
+
}
|
|
4348
|
+
};
|
|
4349
|
+
|
|
4350
|
+
var observer = new ResizeObserver(measure);
|
|
4351
|
+
observer.observe(taskListRef.current);
|
|
4352
|
+
measure();
|
|
4353
|
+
return function () {
|
|
4354
|
+
return observer.disconnect();
|
|
4355
|
+
};
|
|
4356
|
+
}, [listCellWidth, scheduleType]);
|
|
4212
4357
|
useEffect(function () {
|
|
4213
4358
|
if (wrapperRef.current) {
|
|
4214
4359
|
setSvgContainerWidth(wrapperRef.current.offsetWidth - taskListWidth - 20);
|
|
4215
4360
|
}
|
|
4216
|
-
}, [wrapperRef, taskListWidth]);
|
|
4361
|
+
}, [wrapperRef, taskListWidth, wrapperWidth]);
|
|
4362
|
+
useEffect(function () {
|
|
4363
|
+
var node = wrapperRef.current;
|
|
4364
|
+
if (!node) return;
|
|
4365
|
+
|
|
4366
|
+
if (typeof ResizeObserver === "undefined") {
|
|
4367
|
+
setWrapperWidth(node.offsetWidth);
|
|
4368
|
+
return;
|
|
4369
|
+
}
|
|
4370
|
+
|
|
4371
|
+
var measure = function measure() {
|
|
4372
|
+
return setWrapperWidth(node.offsetWidth);
|
|
4373
|
+
};
|
|
4374
|
+
|
|
4375
|
+
var observer = new ResizeObserver(measure);
|
|
4376
|
+
observer.observe(node);
|
|
4377
|
+
measure();
|
|
4378
|
+
return function () {
|
|
4379
|
+
return observer.disconnect();
|
|
4380
|
+
};
|
|
4381
|
+
}, []);
|
|
4217
4382
|
useEffect(function () {
|
|
4218
4383
|
if (ganttHeight) {
|
|
4219
4384
|
setSvgContainerHeight(ganttHeight + headerHeight);
|
|
@@ -4222,7 +4387,7 @@ var Gantt = function Gantt(_ref) {
|
|
|
4222
4387
|
}
|
|
4223
4388
|
}, [ganttHeight, tasks, headerHeight, rowHeight]);
|
|
4224
4389
|
useEffect(function () {
|
|
4225
|
-
var _wrapperRef$
|
|
4390
|
+
var _wrapperRef$current, _wrapperRef$current2, _wrapperRef$current3, _wrapperRef$current4;
|
|
4226
4391
|
|
|
4227
4392
|
var handleWheel = function handleWheel(event) {
|
|
4228
4393
|
if (event.shiftKey || event.deltaX) {
|
|
@@ -4296,25 +4461,25 @@ var Gantt = function Gantt(_ref) {
|
|
|
4296
4461
|
setIgnoreScrollEvent(true);
|
|
4297
4462
|
};
|
|
4298
4463
|
|
|
4299
|
-
(_wrapperRef$
|
|
4464
|
+
(_wrapperRef$current = wrapperRef.current) === null || _wrapperRef$current === void 0 ? void 0 : _wrapperRef$current.addEventListener("wheel", handleWheel, {
|
|
4300
4465
|
passive: false
|
|
4301
4466
|
});
|
|
4302
|
-
(_wrapperRef$
|
|
4467
|
+
(_wrapperRef$current2 = wrapperRef.current) === null || _wrapperRef$current2 === void 0 ? void 0 : _wrapperRef$current2.addEventListener("touchmove", handleTouch, {
|
|
4303
4468
|
passive: false
|
|
4304
4469
|
});
|
|
4305
|
-
(_wrapperRef$
|
|
4470
|
+
(_wrapperRef$current3 = wrapperRef.current) === null || _wrapperRef$current3 === void 0 ? void 0 : _wrapperRef$current3.addEventListener("touchstart", handleLogTouch, {
|
|
4306
4471
|
passive: false
|
|
4307
4472
|
});
|
|
4308
|
-
(_wrapperRef$
|
|
4473
|
+
(_wrapperRef$current4 = wrapperRef.current) === null || _wrapperRef$current4 === void 0 ? void 0 : _wrapperRef$current4.addEventListener("touchend", handleLogTouch, {
|
|
4309
4474
|
passive: false
|
|
4310
4475
|
});
|
|
4311
4476
|
return function () {
|
|
4312
|
-
var _wrapperRef$
|
|
4477
|
+
var _wrapperRef$current5, _wrapperRef$current6, _wrapperRef$current7, _wrapperRef$current8;
|
|
4313
4478
|
|
|
4314
|
-
(_wrapperRef$
|
|
4315
|
-
(_wrapperRef$
|
|
4479
|
+
(_wrapperRef$current5 = wrapperRef.current) === null || _wrapperRef$current5 === void 0 ? void 0 : _wrapperRef$current5.removeEventListener("wheel", handleWheel);
|
|
4480
|
+
(_wrapperRef$current6 = wrapperRef.current) === null || _wrapperRef$current6 === void 0 ? void 0 : _wrapperRef$current6.removeEventListener("touchmove", handleTouch);
|
|
4481
|
+
(_wrapperRef$current7 = wrapperRef.current) === null || _wrapperRef$current7 === void 0 ? void 0 : _wrapperRef$current7.removeEventListener("touchend", handleLogTouch);
|
|
4316
4482
|
(_wrapperRef$current8 = wrapperRef.current) === null || _wrapperRef$current8 === void 0 ? void 0 : _wrapperRef$current8.removeEventListener("touchend", handleLogTouch);
|
|
4317
|
-
(_wrapperRef$current9 = wrapperRef.current) === null || _wrapperRef$current9 === void 0 ? void 0 : _wrapperRef$current9.removeEventListener("touchend", handleLogTouch);
|
|
4318
4483
|
};
|
|
4319
4484
|
}, [wrapperRef, scrollY, scrollX, ganttHeight, svgWidth, rtl, ganttFullHeight]);
|
|
4320
4485
|
|
|
@@ -4328,7 +4493,7 @@ var Gantt = function Gantt(_ref) {
|
|
|
4328
4493
|
};
|
|
4329
4494
|
|
|
4330
4495
|
var handleScrollX = function handleScrollX(event) {
|
|
4331
|
-
if (scrollX !== event.currentTarget.scrollLeft) {
|
|
4496
|
+
if (scrollX !== event.currentTarget.scrollLeft && !ignoreScrollEvent) {
|
|
4332
4497
|
setScrollX(event.currentTarget.scrollLeft);
|
|
4333
4498
|
setIgnoreScrollEvent(true);
|
|
4334
4499
|
} else {
|
|
@@ -4440,7 +4605,8 @@ var Gantt = function Gantt(_ref) {
|
|
|
4440
4605
|
fontFamily: fontFamily,
|
|
4441
4606
|
fontSize: fontSize,
|
|
4442
4607
|
rtl: rtl,
|
|
4443
|
-
projectCalendar: projectCalendar
|
|
4608
|
+
projectCalendar: projectCalendar,
|
|
4609
|
+
weekendColor: weekendColor
|
|
4444
4610
|
};
|
|
4445
4611
|
var barProps = {
|
|
4446
4612
|
tasks: barTasks,
|
|
@@ -4499,7 +4665,9 @@ var Gantt = function Gantt(_ref) {
|
|
|
4499
4665
|
TaskListTable: TaskListTable,
|
|
4500
4666
|
taskLabelRenderer: taskLabelRenderer,
|
|
4501
4667
|
onMultiSelect: onMultiSelect,
|
|
4502
|
-
containerWidth: tableContainerWidth != null ? tableContainerWidth : undefined,
|
|
4668
|
+
containerWidth: userResizedRef.current && tableContainerWidth != null ? Math.min(tableContainerWidth, tableCap) : undefined,
|
|
4669
|
+
containerMaxWidth: tableCap === Infinity ? undefined : tableCap,
|
|
4670
|
+
onContentWidthChange: setTableContentWidth,
|
|
4503
4671
|
innerScrollRef: tableInnerScrollRef,
|
|
4504
4672
|
horizontalContainerRef: tableHorizontalContainerRef
|
|
4505
4673
|
};
|
|
@@ -4603,7 +4771,7 @@ var Gantt = function Gantt(_ref) {
|
|
|
4603
4771
|
}
|
|
4604
4772
|
}, React.createElement("div", {
|
|
4605
4773
|
style: {
|
|
4606
|
-
width:
|
|
4774
|
+
width: tableContentWidth
|
|
4607
4775
|
}
|
|
4608
4776
|
})), React.createElement("div", {
|
|
4609
4777
|
style: {
|
|
@@ -4638,6 +4806,9 @@ function topologicalOrderingHelper(taskID, taskMap, sortedTaskList) {
|
|
|
4638
4806
|
return true;
|
|
4639
4807
|
}
|
|
4640
4808
|
function getCriticalPaths(leafTasks) {
|
|
4809
|
+
leafTasks = leafTasks.filter(function (t) {
|
|
4810
|
+
return t.type !== "milestone" && (t.start.getTime() !== 0 || t.end.getTime() !== 0);
|
|
4811
|
+
});
|
|
4641
4812
|
var taskMap = {};
|
|
4642
4813
|
|
|
4643
4814
|
for (var i = 0; i < leafTasks.length; i++) {
|
|
@@ -4820,28 +4991,26 @@ function computeCriticalPath(taskID, taskMap) {
|
|
|
4820
4991
|
taskMap[taskID].paths[1].visited = false;
|
|
4821
4992
|
}
|
|
4822
4993
|
}
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
taskMap[taskID].paths[1].visited = false;
|
|
4844
|
-
}
|
|
4994
|
+
} else {
|
|
4995
|
+
var immediateChildDuration = taskMap[taskID].end - taskMap[taskID].start + depDuration - overlap - offTime;
|
|
4996
|
+
|
|
4997
|
+
if (taskMap[taskID].paths.length < 2) {
|
|
4998
|
+
taskMap[taskID].paths.push({
|
|
4999
|
+
duration: immediateChildDuration,
|
|
5000
|
+
task: dependents[j],
|
|
5001
|
+
parent: taskID,
|
|
5002
|
+
visited: false
|
|
5003
|
+
});
|
|
5004
|
+
} else if (immediateChildDuration > taskMap[taskID].paths[0].duration) {
|
|
5005
|
+
taskMap[taskID].paths[0].duration = immediateChildDuration;
|
|
5006
|
+
taskMap[taskID].paths[0].task = dependents[j];
|
|
5007
|
+
taskMap[taskID].paths[0].parent = taskID;
|
|
5008
|
+
taskMap[taskID].paths[0].visited = false;
|
|
5009
|
+
} else if (immediateChildDuration > taskMap[taskID].paths[1].duration) {
|
|
5010
|
+
taskMap[taskID].paths[1].duration = immediateChildDuration;
|
|
5011
|
+
taskMap[taskID].paths[1].task = dependents[j];
|
|
5012
|
+
taskMap[taskID].paths[1].parent = taskID;
|
|
5013
|
+
taskMap[taskID].paths[1].visited = false;
|
|
4845
5014
|
}
|
|
4846
5015
|
}
|
|
4847
5016
|
}
|