gantt-task-react-powern 0.6.2 → 0.6.3
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/gantt/task-gantt-content.d.ts +2 -2
- package/dist/index.js +46 -41
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +46 -41
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
|
@@ -20,8 +20,8 @@ export declare type TaskGanttContentProps = {
|
|
|
20
20
|
fontFamily: string;
|
|
21
21
|
rtl: boolean;
|
|
22
22
|
virtualItems?: VirtualItem[];
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
visibleStartY: number;
|
|
24
|
+
visibleEndY: number;
|
|
25
25
|
setGanttEvent: (value: GanttEvent) => void;
|
|
26
26
|
setFailedTask: (value: BarTask | null) => void;
|
|
27
27
|
setSelectedTask: (taskId: string) => void;
|
package/dist/index.js
CHANGED
|
@@ -793,7 +793,7 @@ var TaskList = function TaskList(_ref) {
|
|
|
793
793
|
estimateSize: function estimateSize() {
|
|
794
794
|
return rowHeight;
|
|
795
795
|
},
|
|
796
|
-
overscan:
|
|
796
|
+
overscan: 10
|
|
797
797
|
});
|
|
798
798
|
React.useEffect(function () {
|
|
799
799
|
if (horizontalContainerRef.current) {
|
|
@@ -984,6 +984,7 @@ var GridBody = function GridBody(_ref) {
|
|
|
984
984
|
visibleStartY = _ref.visibleStartY,
|
|
985
985
|
visibleEndY = _ref.visibleEndY;
|
|
986
986
|
var visibleHeight = visibleEndY - visibleStartY;
|
|
987
|
+
var now = new Date();
|
|
987
988
|
var items = virtualItems.length > 0 ? virtualItems : tasks.map(function (_, i) {
|
|
988
989
|
return {
|
|
989
990
|
index: i,
|
|
@@ -993,30 +994,34 @@ var GridBody = function GridBody(_ref) {
|
|
|
993
994
|
key: i
|
|
994
995
|
};
|
|
995
996
|
});
|
|
996
|
-
var now = new Date();
|
|
997
|
-
var x = 0;
|
|
998
|
-
var todayRects = [];
|
|
999
|
-
var weekendRects = [];
|
|
1000
997
|
|
|
1001
|
-
|
|
998
|
+
var isWeekend = function isWeekend(date) {
|
|
999
|
+
var d = date.getDay();
|
|
1000
|
+
return d === 0 || d === 6;
|
|
1001
|
+
};
|
|
1002
|
+
|
|
1003
|
+
var isTodayColumn = function isTodayColumn(i) {
|
|
1002
1004
|
var date = dates[i];
|
|
1003
|
-
var
|
|
1005
|
+
var next = dates[i + 1];
|
|
1006
|
+
if (next && date <= now && next > now) return true;
|
|
1004
1007
|
|
|
1005
|
-
if (
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
y: visibleStartY,
|
|
1010
|
-
width: columnWidth,
|
|
1011
|
-
height: visibleHeight,
|
|
1012
|
-
fill: todayColor
|
|
1013
|
-
}));
|
|
1008
|
+
if (!next && date <= now) {
|
|
1009
|
+
var step = date.getTime() - dates[i - 1].getTime();
|
|
1010
|
+
var end = addToDate(date, step, "millisecond");
|
|
1011
|
+
return end > now;
|
|
1014
1012
|
}
|
|
1015
1013
|
|
|
1016
|
-
|
|
1014
|
+
return false;
|
|
1015
|
+
};
|
|
1016
|
+
|
|
1017
|
+
var todayRects = [];
|
|
1018
|
+
var weekendRects = [];
|
|
1019
|
+
|
|
1020
|
+
for (var i = 0, x = 0; i < dates.length; i++, x += columnWidth) {
|
|
1021
|
+
if (isTodayColumn(i)) {
|
|
1017
1022
|
todayRects.push(React__default.createElement("rect", {
|
|
1018
|
-
key: "today-
|
|
1019
|
-
x: x,
|
|
1023
|
+
key: "today-" + i,
|
|
1024
|
+
x: rtl ? x + columnWidth : x,
|
|
1020
1025
|
y: visibleStartY,
|
|
1021
1026
|
width: columnWidth,
|
|
1022
1027
|
height: visibleHeight,
|
|
@@ -1024,7 +1029,7 @@ var GridBody = function GridBody(_ref) {
|
|
|
1024
1029
|
}));
|
|
1025
1030
|
}
|
|
1026
1031
|
|
|
1027
|
-
if (
|
|
1032
|
+
if (isWeekend(dates[i])) {
|
|
1028
1033
|
weekendRects.push(React__default.createElement("rect", {
|
|
1029
1034
|
key: "weekend-" + i,
|
|
1030
1035
|
x: x,
|
|
@@ -1034,44 +1039,43 @@ var GridBody = function GridBody(_ref) {
|
|
|
1034
1039
|
fill: weekendColor
|
|
1035
1040
|
}));
|
|
1036
1041
|
}
|
|
1037
|
-
|
|
1038
|
-
x += columnWidth;
|
|
1039
1042
|
}
|
|
1040
1043
|
|
|
1041
|
-
x = 0;
|
|
1042
1044
|
var tickLines = dates.map(function (_, i) {
|
|
1043
|
-
|
|
1045
|
+
return React__default.createElement("line", {
|
|
1044
1046
|
key: "tick-" + i,
|
|
1045
|
-
x1:
|
|
1047
|
+
x1: i * columnWidth,
|
|
1046
1048
|
y1: visibleStartY,
|
|
1047
|
-
x2:
|
|
1049
|
+
x2: i * columnWidth,
|
|
1048
1050
|
y2: visibleEndY,
|
|
1049
1051
|
className: styles$4.gridTick
|
|
1050
1052
|
});
|
|
1051
|
-
x += columnWidth;
|
|
1052
|
-
return line;
|
|
1053
1053
|
});
|
|
1054
1054
|
var rowBackgrounds = [];
|
|
1055
1055
|
var rowLines = [];
|
|
1056
1056
|
rowLines.push(React__default.createElement("line", {
|
|
1057
|
-
key: "top",
|
|
1057
|
+
key: "top-line",
|
|
1058
1058
|
x1: 0,
|
|
1059
1059
|
y1: visibleStartY,
|
|
1060
1060
|
x2: svgWidth,
|
|
1061
1061
|
y2: visibleStartY,
|
|
1062
1062
|
className: styles$4.gridRowLine
|
|
1063
1063
|
}));
|
|
1064
|
-
|
|
1064
|
+
|
|
1065
|
+
for (var _iterator = _createForOfIteratorHelperLoose(items), _step; !(_step = _iterator()).done;) {
|
|
1066
|
+
var vi = _step.value;
|
|
1065
1067
|
var task = tasks[vi.index];
|
|
1068
|
+
if (!task) break;
|
|
1066
1069
|
var y = vi.start;
|
|
1067
1070
|
var isMilestone = task.type === "milestone";
|
|
1071
|
+
var rowClass = isMilestone ? styles$4.darkerGridRow : scheduleType === "lookAhead" ? styles$4.gridRowLookAhead : styles$4.gridRow;
|
|
1068
1072
|
rowBackgrounds.push(React__default.createElement("rect", {
|
|
1069
1073
|
key: "bg-" + vi.key,
|
|
1070
1074
|
x: 0,
|
|
1071
1075
|
y: y,
|
|
1072
1076
|
width: svgWidth,
|
|
1073
1077
|
height: rowHeight,
|
|
1074
|
-
className:
|
|
1078
|
+
className: rowClass
|
|
1075
1079
|
}));
|
|
1076
1080
|
rowLines.push(React__default.createElement("line", {
|
|
1077
1081
|
key: "line-" + vi.key,
|
|
@@ -1081,7 +1085,8 @@ var GridBody = function GridBody(_ref) {
|
|
|
1081
1085
|
y2: y + rowHeight,
|
|
1082
1086
|
className: styles$4.gridRowLine
|
|
1083
1087
|
}));
|
|
1084
|
-
}
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1085
1090
|
return React__default.createElement("g", {
|
|
1086
1091
|
className: "gridBody"
|
|
1087
1092
|
}, React__default.createElement("g", {
|
|
@@ -2529,8 +2534,6 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
|
2529
2534
|
rtl = _ref.rtl,
|
|
2530
2535
|
_ref$virtualItems = _ref.virtualItems,
|
|
2531
2536
|
virtualItems = _ref$virtualItems === void 0 ? [] : _ref$virtualItems,
|
|
2532
|
-
ganttHeight = _ref.ganttHeight,
|
|
2533
|
-
scrollY = _ref.scrollY,
|
|
2534
2537
|
setGanttEvent = _ref.setGanttEvent,
|
|
2535
2538
|
setFailedTask = _ref.setFailedTask,
|
|
2536
2539
|
setSelectedTask = _ref.setSelectedTask,
|
|
@@ -2538,7 +2541,9 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
|
2538
2541
|
onProgressChange = _ref.onProgressChange,
|
|
2539
2542
|
onDoubleClick = _ref.onDoubleClick,
|
|
2540
2543
|
onClick = _ref.onClick,
|
|
2541
|
-
onDelete = _ref.onDelete
|
|
2544
|
+
onDelete = _ref.onDelete,
|
|
2545
|
+
visibleStartY = _ref.visibleStartY,
|
|
2546
|
+
visibleEndY = _ref.visibleEndY;
|
|
2542
2547
|
var point = svg === null || svg === void 0 ? void 0 : (_svg$current = svg.current) === null || _svg$current === void 0 ? void 0 : _svg$current.createSVGPoint();
|
|
2543
2548
|
|
|
2544
2549
|
var _useState = React.useState(0),
|
|
@@ -2746,8 +2751,6 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
|
2746
2751
|
};
|
|
2747
2752
|
|
|
2748
2753
|
var getArrows = function getArrows(isCritical, criticalPathType) {
|
|
2749
|
-
var visibleMinY = scrollY - rowHeight * 5;
|
|
2750
|
-
var visibleMaxY = scrollY + ganttHeight + rowHeight * 5;
|
|
2751
2754
|
return tasks.flatMap(function (_task) {
|
|
2752
2755
|
var task = _task.start.getTime() > 0 && _task.end.getTime() > 0 ? _task : undefined;
|
|
2753
2756
|
|
|
@@ -2768,7 +2771,7 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
|
2768
2771
|
var minY = Math.min(yFrom, yTo);
|
|
2769
2772
|
var maxY = Math.max(yFrom, yTo);
|
|
2770
2773
|
|
|
2771
|
-
if (maxY <
|
|
2774
|
+
if (maxY < visibleStartY || minY > visibleEndY) {
|
|
2772
2775
|
return null;
|
|
2773
2776
|
}
|
|
2774
2777
|
|
|
@@ -2880,7 +2883,7 @@ var TaskGantt = function TaskGantt(_ref) {
|
|
|
2880
2883
|
estimateSize: function estimateSize() {
|
|
2881
2884
|
return barProps.rowHeight;
|
|
2882
2885
|
},
|
|
2883
|
-
overscan:
|
|
2886
|
+
overscan: 10
|
|
2884
2887
|
});
|
|
2885
2888
|
React.useEffect(function () {
|
|
2886
2889
|
if (horizontalContainerRef.current) {
|
|
@@ -2921,6 +2924,8 @@ var TaskGantt = function TaskGantt(_ref) {
|
|
|
2921
2924
|
visibleStartY: visibleStartY,
|
|
2922
2925
|
visibleEndY: visibleEndY
|
|
2923
2926
|
})), React__default.createElement(TaskGanttContent, Object.assign({}, newBarProps, {
|
|
2927
|
+
visibleStartY: visibleStartY,
|
|
2928
|
+
visibleEndY: visibleEndY,
|
|
2924
2929
|
virtualItems: virtualizer.getVirtualItems()
|
|
2925
2930
|
})))));
|
|
2926
2931
|
};
|
|
@@ -3494,8 +3499,8 @@ var Gantt = function Gantt(_ref) {
|
|
|
3494
3499
|
onDoubleClick: onDoubleClick,
|
|
3495
3500
|
onClick: onClick,
|
|
3496
3501
|
onDelete: onDelete,
|
|
3497
|
-
|
|
3498
|
-
|
|
3502
|
+
visibleStartY: visibleStartY,
|
|
3503
|
+
visibleEndY: visibleEndY
|
|
3499
3504
|
};
|
|
3500
3505
|
var tableProps = {
|
|
3501
3506
|
rowHeight: rowHeight,
|