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