gantt-task-react-powern 0.4.62 → 0.4.64
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/dist/components/grid/grid-body.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 +2 -0
- package/dist/index.css +27 -1
- package/dist/index.js +77 -22
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +77 -22
- package/dist/index.modern.js.map +1 -1
- package/dist/types/public-types.d.ts +4 -0
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -341,7 +341,7 @@ var TaskListHeaderDefault = function TaskListHeaderDefault(_ref) {
|
|
|
341
341
|
}, "Planned End")));
|
|
342
342
|
};
|
|
343
343
|
|
|
344
|
-
var styles$1 = {"taskListWrapper":"_3ZbQT","taskListTableRow":"_34SS0","taskListCell":"_3lLk3","taskListNameWrapper":"_nI1Xw","taskListExpander":"_2QjE6","taskListExpanderPlaceholder":"_1fnLB","taskListEmptyExpander":"_2TfEi","taskListText":"_2ZvXU"};
|
|
344
|
+
var styles$1 = {"taskListWrapper":"_3ZbQT","taskListTableRow":"_34SS0","taskListLookAheadRow":"_GzvG4","taskListMilestoneRow":"_3Ykml","taskListCell":"_3lLk3","taskListNameWrapper":"_nI1Xw","taskListExpander":"_2QjE6","taskListExpanderPlaceholder":"_1fnLB","taskListEmptyExpander":"_2TfEi","taskListText":"_2ZvXU"};
|
|
345
345
|
|
|
346
346
|
var localeDateStringCache = {};
|
|
347
347
|
|
|
@@ -369,6 +369,7 @@ var TaskListTableDefault = function TaskListTableDefault(_ref) {
|
|
|
369
369
|
var rowHeight = _ref.rowHeight,
|
|
370
370
|
rowWidth = _ref.rowWidth,
|
|
371
371
|
tasks = _ref.tasks,
|
|
372
|
+
scheduleType = _ref.scheduleType,
|
|
372
373
|
leafTasks = _ref.leafTasks,
|
|
373
374
|
fontFamily = _ref.fontFamily,
|
|
374
375
|
fontSize = _ref.fontSize,
|
|
@@ -404,7 +405,7 @@ var TaskListTableDefault = function TaskListTableDefault(_ref) {
|
|
|
404
405
|
}
|
|
405
406
|
|
|
406
407
|
return React.createElement("div", {
|
|
407
|
-
className: styles$1.taskListTableRow,
|
|
408
|
+
className: t.type === "milestone" ? styles$1.taskListMilestoneRow : scheduleType === "lookAhead" ? styles$1.taskListLookAheadRow : styles$1.taskListTableRow,
|
|
408
409
|
style: {
|
|
409
410
|
height: rowHeight
|
|
410
411
|
},
|
|
@@ -628,6 +629,7 @@ var TaskList = function TaskList(_ref) {
|
|
|
628
629
|
rowHeight = _ref.rowHeight,
|
|
629
630
|
scrollY = _ref.scrollY,
|
|
630
631
|
tasks = _ref.tasks,
|
|
632
|
+
scheduleType = _ref.scheduleType,
|
|
631
633
|
leafTasks = _ref.leafTasks,
|
|
632
634
|
selectedTask = _ref.selectedTask,
|
|
633
635
|
setSelectedTask = _ref.setSelectedTask,
|
|
@@ -659,6 +661,7 @@ var TaskList = function TaskList(_ref) {
|
|
|
659
661
|
fontSize: fontSize,
|
|
660
662
|
tasks: tasks,
|
|
661
663
|
leafTasks: leafTasks,
|
|
664
|
+
scheduleType: scheduleType,
|
|
662
665
|
locale: locale,
|
|
663
666
|
selectedTaskId: selectedTaskId,
|
|
664
667
|
setSelectedTask: setSelectedTask,
|
|
@@ -676,15 +679,17 @@ var TaskList = function TaskList(_ref) {
|
|
|
676
679
|
}, React.createElement(TaskListTable, Object.assign({}, tableProps))));
|
|
677
680
|
};
|
|
678
681
|
|
|
679
|
-
var styles$4 = {"gridRow":"_2dZTy","gridRowLine":"_3rUKi","gridTick":"_RuwuK","darkerGridRow":"_2M-tt"};
|
|
682
|
+
var styles$4 = {"gridRow":"_2dZTy","gridRowLookAhead":"_2RRca","gridRowLine":"_3rUKi","gridTick":"_RuwuK","darkerGridRow":"_2M-tt"};
|
|
680
683
|
|
|
681
684
|
var GridBody = function GridBody(_ref) {
|
|
682
685
|
var tasks = _ref.tasks,
|
|
686
|
+
scheduleType = _ref.scheduleType,
|
|
683
687
|
dates = _ref.dates,
|
|
684
688
|
rowHeight = _ref.rowHeight,
|
|
685
689
|
svgWidth = _ref.svgWidth,
|
|
686
690
|
columnWidth = _ref.columnWidth,
|
|
687
691
|
todayColor = _ref.todayColor,
|
|
692
|
+
weekendColor = _ref.weekendColor,
|
|
688
693
|
rtl = _ref.rtl;
|
|
689
694
|
var y = 0;
|
|
690
695
|
var gridRows = [];
|
|
@@ -706,7 +711,7 @@ var GridBody = function GridBody(_ref) {
|
|
|
706
711
|
y: y,
|
|
707
712
|
width: svgWidth,
|
|
708
713
|
height: rowHeight,
|
|
709
|
-
className: isDarkerRow ? styles$4.darkerGridRow : styles$4.gridRow
|
|
714
|
+
className: isDarkerRow ? styles$4.darkerGridRow : scheduleType === "lookAhead" ? styles$4.gridRowLookAhead : styles$4.gridRow
|
|
710
715
|
}));
|
|
711
716
|
rowLines.push(React.createElement("line", {
|
|
712
717
|
key: "RowLine" + task.id,
|
|
@@ -723,6 +728,7 @@ var GridBody = function GridBody(_ref) {
|
|
|
723
728
|
var tickX = 0;
|
|
724
729
|
var ticks = [];
|
|
725
730
|
var today = React.createElement("rect", null);
|
|
731
|
+
var weekend = [];
|
|
726
732
|
|
|
727
733
|
for (var i = 0; i < dates.length; i++) {
|
|
728
734
|
var date = dates[i];
|
|
@@ -745,6 +751,16 @@ var GridBody = function GridBody(_ref) {
|
|
|
745
751
|
});
|
|
746
752
|
}
|
|
747
753
|
|
|
754
|
+
if (date.getDay() === 6 || date.getDay() === 0) {
|
|
755
|
+
weekend.push(React.createElement("rect", {
|
|
756
|
+
x: tickX,
|
|
757
|
+
y: 0,
|
|
758
|
+
width: columnWidth,
|
|
759
|
+
height: y,
|
|
760
|
+
fill: weekendColor
|
|
761
|
+
}));
|
|
762
|
+
}
|
|
763
|
+
|
|
748
764
|
if (rtl && i + 1 !== dates.length && date.getTime() >= now.getTime() && dates[i + 1].getTime() < now.getTime()) {
|
|
749
765
|
today = React.createElement("rect", {
|
|
750
766
|
x: tickX + columnWidth,
|
|
@@ -766,7 +782,9 @@ var GridBody = function GridBody(_ref) {
|
|
|
766
782
|
className: "rowLines"
|
|
767
783
|
}, rowLines), React.createElement("g", {
|
|
768
784
|
className: "ticks"
|
|
769
|
-
}, ticks), React.createElement("g", {
|
|
785
|
+
}, ticks), scheduleType === "lookAhead" && React.createElement("g", {
|
|
786
|
+
className: "weekend"
|
|
787
|
+
}, weekend), React.createElement("g", {
|
|
770
788
|
className: "today"
|
|
771
789
|
}, today));
|
|
772
790
|
};
|
|
@@ -1797,7 +1815,7 @@ var Bar = function Bar(_ref) {
|
|
|
1797
1815
|
var handleHeight = task.height / 2 - 1;
|
|
1798
1816
|
|
|
1799
1817
|
if (type == "planned") {
|
|
1800
|
-
if (task.x1 && task.x2) return React.createElement("g", {
|
|
1818
|
+
if ((task === null || task === void 0 ? void 0 : task.x1) >= 0 && (task === null || task === void 0 ? void 0 : task.x2) >= 0) return React.createElement("g", {
|
|
1801
1819
|
className: styles$6.barWrapper,
|
|
1802
1820
|
tabIndex: 0
|
|
1803
1821
|
}, React.createElement(BarDisplay, {
|
|
@@ -1845,7 +1863,7 @@ var Bar = function Bar(_ref) {
|
|
|
1845
1863
|
className: styles$6.barWrapper,
|
|
1846
1864
|
tabIndex: 0
|
|
1847
1865
|
});
|
|
1848
|
-
} else if (task.actualx1 && task.actualx2) {
|
|
1866
|
+
} else if ((task === null || task === void 0 ? void 0 : task.actualx1) >= 0 && (task === null || task === void 0 ? void 0 : task.actualx2) >= 0) {
|
|
1849
1867
|
return React.createElement("g", {
|
|
1850
1868
|
className: styles$6.barWrapper,
|
|
1851
1869
|
tabIndex: 0
|
|
@@ -2032,11 +2050,11 @@ var TaskItem = function TaskItem(props) {
|
|
|
2032
2050
|
useEffect(function () {
|
|
2033
2051
|
switch (task.typeInternal) {
|
|
2034
2052
|
case "milestone":
|
|
2035
|
-
setTaskItem([React.createElement(Milestone, Object.assign({}, props))]);
|
|
2053
|
+
if (task.x1 >= 0 && task.actualx1 >= 0) setTaskItem([React.createElement(Milestone, Object.assign({}, props))]);else setTaskItem([]);
|
|
2036
2054
|
break;
|
|
2037
2055
|
|
|
2038
2056
|
case "project":
|
|
2039
|
-
setTaskItem([React.createElement(Project, Object.assign({}, props))]);
|
|
2057
|
+
if ((task === null || task === void 0 ? void 0 : task.x1) >= 0 && (task === null || task === void 0 ? void 0 : task.x2) >= 0 && task.x2 > task.x1 && (task === null || task === void 0 ? void 0 : task.actualx1) >= 0 && (task === null || task === void 0 ? void 0 : task.actualx2) >= 0 && task.actualx2 > task.actualx1) setTaskItem([React.createElement(Project, Object.assign({}, props))]);else setTaskItem([]);
|
|
2040
2058
|
break;
|
|
2041
2059
|
|
|
2042
2060
|
case "smalltask":
|
|
@@ -2047,13 +2065,13 @@ var TaskItem = function TaskItem(props) {
|
|
|
2047
2065
|
{
|
|
2048
2066
|
var _taskItem = [];
|
|
2049
2067
|
|
|
2050
|
-
if (task.x1 && task.x2) {
|
|
2068
|
+
if ((task === null || task === void 0 ? void 0 : task.x1) >= 0 && (task === null || task === void 0 ? void 0 : task.x2) >= 0) {
|
|
2051
2069
|
_taskItem.push(React.createElement(Bar, Object.assign({}, props, {
|
|
2052
2070
|
type: "planned"
|
|
2053
2071
|
})));
|
|
2054
2072
|
}
|
|
2055
2073
|
|
|
2056
|
-
if (task.actualx1 && task.actualx2) {
|
|
2074
|
+
if ((task === null || task === void 0 ? void 0 : task.actualx1) >= 0 && (task === null || task === void 0 ? void 0 : task.actualx2) >= 0) {
|
|
2057
2075
|
_taskItem.push(React.createElement(Bar, Object.assign({}, props, {
|
|
2058
2076
|
type: "actual"
|
|
2059
2077
|
})));
|
|
@@ -2364,7 +2382,7 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
|
2364
2382
|
return task.barChildren.map(function (child) {
|
|
2365
2383
|
var _task$criticalPathArr, _task$criticalPathArr2;
|
|
2366
2384
|
|
|
2367
|
-
return React.createElement(Arrow, {
|
|
2385
|
+
if (task.x2 > task.x1 || task.actualx2 > task.actualx1) return React.createElement(Arrow, {
|
|
2368
2386
|
key: "Arrow from " + task.id + " to " + tasks[child.index].id,
|
|
2369
2387
|
taskFrom: task,
|
|
2370
2388
|
taskTo: tasks[child.index],
|
|
@@ -2375,6 +2393,11 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
|
2375
2393
|
arrowColor: ((_task$criticalPathArr = task.criticalPathArrows) === null || _task$criticalPathArr === void 0 ? void 0 : (_task$criticalPathArr2 = _task$criticalPathArr.find(function (arrow) {
|
|
2376
2394
|
return arrow.taskId == tasks[child.index].id;
|
|
2377
2395
|
})) === null || _task$criticalPathArr2 === void 0 ? void 0 : _task$criticalPathArr2.arrowColor) || "#808080"
|
|
2396
|
+
});else return React.createElement("g", {
|
|
2397
|
+
key: _task.id,
|
|
2398
|
+
style: {
|
|
2399
|
+
height: taskHeight
|
|
2400
|
+
}
|
|
2378
2401
|
});
|
|
2379
2402
|
});
|
|
2380
2403
|
})), React.createElement("g", {
|
|
@@ -2496,6 +2519,12 @@ var Gantt = function Gantt(_ref) {
|
|
|
2496
2519
|
var tasks = _ref.tasks,
|
|
2497
2520
|
_ref$leafTasks = _ref.leafTasks,
|
|
2498
2521
|
leafTasks = _ref$leafTasks === void 0 ? [] : _ref$leafTasks,
|
|
2522
|
+
_ref$scheduleType = _ref.scheduleType,
|
|
2523
|
+
scheduleType = _ref$scheduleType === void 0 ? "main" : _ref$scheduleType,
|
|
2524
|
+
_ref$startDate = _ref.startDate,
|
|
2525
|
+
startDate = _ref$startDate === void 0 ? new Date() : _ref$startDate,
|
|
2526
|
+
_ref$endDate = _ref.endDate,
|
|
2527
|
+
endDate = _ref$endDate === void 0 ? new Date() : _ref$endDate,
|
|
2499
2528
|
_ref$headerHeight = _ref.headerHeight,
|
|
2500
2529
|
headerHeight = _ref$headerHeight === void 0 ? 50 : _ref$headerHeight,
|
|
2501
2530
|
_ref$columnWidth = _ref.columnWidth,
|
|
@@ -2552,6 +2581,8 @@ var Gantt = function Gantt(_ref) {
|
|
|
2552
2581
|
arrowIndent = _ref$arrowIndent === void 0 ? 20 : _ref$arrowIndent,
|
|
2553
2582
|
_ref$todayColor = _ref.todayColor,
|
|
2554
2583
|
todayColor = _ref$todayColor === void 0 ? "rgba(252, 248, 227, 0.5)" : _ref$todayColor,
|
|
2584
|
+
_ref$weekendColor = _ref.weekendColor,
|
|
2585
|
+
weekendColor = _ref$weekendColor === void 0 ? "#f5f5f5" : _ref$weekendColor,
|
|
2555
2586
|
viewDate = _ref.viewDate,
|
|
2556
2587
|
_ref$TooltipContent = _ref.TooltipContent,
|
|
2557
2588
|
TooltipContent = _ref$TooltipContent === void 0 ? StandardTooltipContent : _ref$TooltipContent,
|
|
@@ -2572,12 +2603,19 @@ var Gantt = function Gantt(_ref) {
|
|
|
2572
2603
|
|
|
2573
2604
|
var _useState = useState(function () {
|
|
2574
2605
|
var _ganttDateRange = ganttDateRange(tasks, viewMode, preStepsCount),
|
|
2575
|
-
|
|
2576
|
-
|
|
2606
|
+
startDateRange = _ganttDateRange[0],
|
|
2607
|
+
endDateRange = _ganttDateRange[1];
|
|
2608
|
+
|
|
2609
|
+
if (scheduleType === "lookAhead") {
|
|
2610
|
+
return {
|
|
2611
|
+
viewMode: viewMode,
|
|
2612
|
+
dates: seedDates(startDate, endDate, viewMode)
|
|
2613
|
+
};
|
|
2614
|
+
}
|
|
2577
2615
|
|
|
2578
2616
|
return {
|
|
2579
2617
|
viewMode: viewMode,
|
|
2580
|
-
dates: seedDates(
|
|
2618
|
+
dates: seedDates(startDateRange, endDateRange, viewMode)
|
|
2581
2619
|
};
|
|
2582
2620
|
}),
|
|
2583
2621
|
dateSetup = _useState[0],
|
|
@@ -2636,6 +2674,14 @@ var Gantt = function Gantt(_ref) {
|
|
|
2636
2674
|
ignoreScrollEvent = _useState12[0],
|
|
2637
2675
|
setIgnoreScrollEvent = _useState12[1];
|
|
2638
2676
|
|
|
2677
|
+
useEffect(function () {
|
|
2678
|
+
if (scheduleType === "lookAhead" && startDate && endDate) {
|
|
2679
|
+
setDateSetup({
|
|
2680
|
+
viewMode: viewMode,
|
|
2681
|
+
dates: seedDates(startDate, endDate, viewMode)
|
|
2682
|
+
});
|
|
2683
|
+
}
|
|
2684
|
+
}, [startDate, endDate]);
|
|
2639
2685
|
useEffect(function () {
|
|
2640
2686
|
var filteredTasks;
|
|
2641
2687
|
|
|
@@ -2648,10 +2694,14 @@ var Gantt = function Gantt(_ref) {
|
|
|
2648
2694
|
filteredTasks = filteredTasks.sort(sortTasks);
|
|
2649
2695
|
|
|
2650
2696
|
var _ganttDateRange2 = ganttDateRange(filteredTasks, viewMode, preStepsCount),
|
|
2651
|
-
|
|
2652
|
-
|
|
2697
|
+
startDateRange = _ganttDateRange2[0],
|
|
2698
|
+
endDateRange = _ganttDateRange2[1];
|
|
2653
2699
|
|
|
2654
|
-
var newDates = seedDates(
|
|
2700
|
+
var newDates = seedDates(startDateRange, endDateRange, viewMode);
|
|
2701
|
+
|
|
2702
|
+
if (scheduleType === "lookAhead") {
|
|
2703
|
+
newDates = seedDates(startDate, endDate, viewMode);
|
|
2704
|
+
}
|
|
2655
2705
|
|
|
2656
2706
|
if (rtl) {
|
|
2657
2707
|
newDates = newDates.reverse();
|
|
@@ -2661,10 +2711,12 @@ var Gantt = function Gantt(_ref) {
|
|
|
2661
2711
|
}
|
|
2662
2712
|
}
|
|
2663
2713
|
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2714
|
+
if (scheduleType !== "lookAhead") {
|
|
2715
|
+
setDateSetup({
|
|
2716
|
+
dates: seedDates(startDateRange, endDateRange, viewMode),
|
|
2717
|
+
viewMode: viewMode
|
|
2718
|
+
});
|
|
2719
|
+
}
|
|
2668
2720
|
|
|
2669
2721
|
var _getCriticalPaths = getCriticalPaths(leafTasks),
|
|
2670
2722
|
primaryPath = _getCriticalPaths[0],
|
|
@@ -2891,9 +2943,11 @@ var Gantt = function Gantt(_ref) {
|
|
|
2891
2943
|
columnWidth: columnWidth,
|
|
2892
2944
|
svgWidth: svgWidth,
|
|
2893
2945
|
tasks: tasks,
|
|
2946
|
+
scheduleType: scheduleType,
|
|
2894
2947
|
rowHeight: rowHeight,
|
|
2895
2948
|
dates: dateSetup.dates,
|
|
2896
2949
|
todayColor: todayColor,
|
|
2950
|
+
weekendColor: weekendColor,
|
|
2897
2951
|
rtl: rtl
|
|
2898
2952
|
};
|
|
2899
2953
|
var calendarProps = {
|
|
@@ -2937,6 +2991,7 @@ var Gantt = function Gantt(_ref) {
|
|
|
2937
2991
|
fontSize: fontSize,
|
|
2938
2992
|
tasks: barTasks,
|
|
2939
2993
|
leafTasks: leafTasks,
|
|
2994
|
+
scheduleType: scheduleType,
|
|
2940
2995
|
locale: locale,
|
|
2941
2996
|
headerHeight: headerHeight,
|
|
2942
2997
|
scrollY: scrollY,
|