gantt-task-react-powern 0.6.0 → 0.6.2
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 +4 -0
- package/dist/components/grid/grid-body.d.ts +4 -0
- package/dist/components/task-list/task-list-table.d.ts +2 -0
- package/dist/components/task-list/task-list.d.ts +2 -0
- package/dist/index.js +234 -114
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +234 -114
- package/dist/index.modern.js.map +1 -1
- package/package.json +2 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { VirtualItem } from "@tanstack/react-virtual";
|
|
2
3
|
import { EventOption } from "../../types/public-types";
|
|
3
4
|
import { BarTask } from "../../types/bar-task";
|
|
4
5
|
import { GanttEvent } from "../../types/gantt-task-actions";
|
|
@@ -18,6 +19,9 @@ export declare type TaskGanttContentProps = {
|
|
|
18
19
|
fontSize: string;
|
|
19
20
|
fontFamily: string;
|
|
20
21
|
rtl: boolean;
|
|
22
|
+
virtualItems?: VirtualItem[];
|
|
23
|
+
ganttHeight: number;
|
|
24
|
+
scrollY: number;
|
|
21
25
|
setGanttEvent: (value: GanttEvent) => void;
|
|
22
26
|
setFailedTask: (value: BarTask | null) => void;
|
|
23
27
|
setSelectedTask: (taskId: string) => void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { VirtualItem } from "@tanstack/react-virtual";
|
|
2
3
|
import { Task } from "../../types/public-types";
|
|
3
4
|
export declare type GridBodyProps = {
|
|
4
5
|
tasks: Task[];
|
|
@@ -10,5 +11,8 @@ export declare type GridBodyProps = {
|
|
|
10
11
|
todayColor: string;
|
|
11
12
|
weekendColor: string;
|
|
12
13
|
rtl: boolean;
|
|
14
|
+
virtualItems?: VirtualItem[];
|
|
15
|
+
visibleStartY: number;
|
|
16
|
+
visibleEndY: number;
|
|
13
17
|
};
|
|
14
18
|
export declare const GridBody: React.FC<GridBodyProps>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { VirtualItem } from "@tanstack/react-virtual";
|
|
2
3
|
import { Task } from "../../types/public-types";
|
|
3
4
|
export declare const TaskListTableDefault: React.FC<{
|
|
4
5
|
rowHeight: number;
|
|
@@ -15,4 +16,5 @@ export declare const TaskListTableDefault: React.FC<{
|
|
|
15
16
|
selectedTasks?: string[];
|
|
16
17
|
onTaskSelect?: (taskId: string, selected: boolean) => void;
|
|
17
18
|
taskLabelRenderer?: (Task: Task) => React.ReactNode;
|
|
19
|
+
virtualItems?: VirtualItem[];
|
|
18
20
|
}>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { VirtualItem } from "@tanstack/react-virtual";
|
|
2
3
|
import { EventOption } from "../../types/public-types";
|
|
3
4
|
import { BarTask } from "../../types/bar-task";
|
|
4
5
|
import { Task } from "../../types/public-types";
|
|
@@ -44,6 +45,7 @@ export declare type TaskListProps = {
|
|
|
44
45
|
selectedTasks?: string[];
|
|
45
46
|
onTaskSelect?: (taskId: string, selected: boolean) => void;
|
|
46
47
|
taskLabelRenderer?: (Task: Task) => React.ReactNode;
|
|
48
|
+
virtualItems?: VirtualItem[];
|
|
47
49
|
}>;
|
|
48
50
|
} & EventOption;
|
|
49
51
|
export declare const TaskList: React.FC<TaskListProps>;
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
|
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var React__default = _interopDefault(React);
|
|
5
|
+
var reactVirtual = require('@tanstack/react-virtual');
|
|
5
6
|
|
|
6
7
|
function _extends() {
|
|
7
8
|
_extends = Object.assign || function (target) {
|
|
@@ -424,7 +425,8 @@ var TaskListTableDefault = function TaskListTableDefault(_ref) {
|
|
|
424
425
|
_ref$taskLabelRendere = _ref.taskLabelRenderer,
|
|
425
426
|
taskLabelRenderer = _ref$taskLabelRendere === void 0 ? function (t) {
|
|
426
427
|
return " " + t.name;
|
|
427
|
-
} : _ref$taskLabelRendere
|
|
428
|
+
} : _ref$taskLabelRendere,
|
|
429
|
+
virtualItems = _ref.virtualItems;
|
|
428
430
|
var toLocaleDateString = React.useMemo(function () {
|
|
429
431
|
return toLocaleDateStringFactory(locale);
|
|
430
432
|
}, [locale]);
|
|
@@ -445,13 +447,25 @@ var TaskListTableDefault = function TaskListTableDefault(_ref) {
|
|
|
445
447
|
return hasSelectedAncestor(parentWbs, selectedSet, allTasks);
|
|
446
448
|
};
|
|
447
449
|
|
|
450
|
+
var itemsToRender = virtualItems || tasks.map(function (_, index) {
|
|
451
|
+
return {
|
|
452
|
+
index: index,
|
|
453
|
+
start: index * rowHeight,
|
|
454
|
+
size: rowHeight,
|
|
455
|
+
key: index,
|
|
456
|
+
end: (index + 1) * rowHeight,
|
|
457
|
+
lane: 0,
|
|
458
|
+
measureElement: function measureElement() {}
|
|
459
|
+
};
|
|
460
|
+
});
|
|
448
461
|
return React__default.createElement("div", {
|
|
449
462
|
className: styles$1.taskListWrapper,
|
|
450
463
|
style: {
|
|
451
464
|
fontFamily: fontFamily,
|
|
452
465
|
fontSize: fontSize
|
|
453
466
|
}
|
|
454
|
-
},
|
|
467
|
+
}, itemsToRender.map(function (vi) {
|
|
468
|
+
var t = tasks[vi.index];
|
|
455
469
|
var expanderSymbol = "";
|
|
456
470
|
|
|
457
471
|
if (!(leafTaskIds.has(t.id) || t.type === "milestone")) {
|
|
@@ -465,6 +479,17 @@ var TaskListTableDefault = function TaskListTableDefault(_ref) {
|
|
|
465
479
|
var isSelected = selectedTasks.includes(t.id);
|
|
466
480
|
var isAncestorSelected = hasSelectedAncestor(t.id, new Set(selectedTasks), tasks);
|
|
467
481
|
return React__default.createElement("div", {
|
|
482
|
+
key: "" + vi.key,
|
|
483
|
+
"data-index": vi.index,
|
|
484
|
+
style: {
|
|
485
|
+
position: "absolute",
|
|
486
|
+
top: 0,
|
|
487
|
+
left: 0,
|
|
488
|
+
width: "100%",
|
|
489
|
+
height: vi.size + "px",
|
|
490
|
+
transform: "translateY(" + vi.start + "px)"
|
|
491
|
+
}
|
|
492
|
+
}, React__default.createElement("div", {
|
|
468
493
|
className: t.type === "milestone" ? styles$1.taskListMilestoneRow : scheduleType === "lookAhead" ? styles$1.taskListLookAheadRow : styles$1.taskListTableRow,
|
|
469
494
|
style: {
|
|
470
495
|
height: rowHeight
|
|
@@ -568,7 +593,7 @@ var TaskListTableDefault = function TaskListTableDefault(_ref) {
|
|
|
568
593
|
}
|
|
569
594
|
}, React__default.createElement("div", {
|
|
570
595
|
className: styles$1.taskListText
|
|
571
|
-
}, "\xA0", toLocaleDateString(t.actualEnd, dateTimeOptions))));
|
|
596
|
+
}, "\xA0", toLocaleDateString(t.actualEnd, dateTimeOptions)))));
|
|
572
597
|
}));
|
|
573
598
|
};
|
|
574
599
|
|
|
@@ -760,6 +785,16 @@ var TaskList = function TaskList(_ref) {
|
|
|
760
785
|
|
|
761
786
|
var prevSelectedTasksRef = React.useRef([]);
|
|
762
787
|
var expandedTasks = React.useRef([]);
|
|
788
|
+
var virtualizer = reactVirtual.useVirtualizer({
|
|
789
|
+
count: tasks.length,
|
|
790
|
+
getScrollElement: function getScrollElement() {
|
|
791
|
+
return horizontalContainerRef.current;
|
|
792
|
+
},
|
|
793
|
+
estimateSize: function estimateSize() {
|
|
794
|
+
return rowHeight;
|
|
795
|
+
},
|
|
796
|
+
overscan: 5
|
|
797
|
+
});
|
|
763
798
|
React.useEffect(function () {
|
|
764
799
|
if (horizontalContainerRef.current) {
|
|
765
800
|
horizontalContainerRef.current.scrollTop = scrollY;
|
|
@@ -911,8 +946,10 @@ var TaskList = function TaskList(_ref) {
|
|
|
911
946
|
onExpanderClick: onExpanderClick,
|
|
912
947
|
selectedTasks: onMultiSelect ? selectedTasks : undefined,
|
|
913
948
|
onTaskSelect: onMultiSelect ? handleTaskSelect : undefined,
|
|
914
|
-
taskLabelRenderer: taskLabelRenderer
|
|
949
|
+
taskLabelRenderer: taskLabelRenderer,
|
|
950
|
+
virtualItems: virtualizer.getVirtualItems()
|
|
915
951
|
};
|
|
952
|
+
console.debug(virtualizer.getTotalSize());
|
|
916
953
|
return React__default.createElement("div", {
|
|
917
954
|
ref: taskListRef
|
|
918
955
|
}, React__default.createElement(TaskListHeader, Object.assign({}, headerProps)), React__default.createElement("div", {
|
|
@@ -921,7 +958,13 @@ var TaskList = function TaskList(_ref) {
|
|
|
921
958
|
style: ganttHeight ? {
|
|
922
959
|
height: ganttHeight
|
|
923
960
|
} : {}
|
|
924
|
-
}, React__default.createElement(
|
|
961
|
+
}, React__default.createElement("div", {
|
|
962
|
+
style: {
|
|
963
|
+
height: virtualizer.getTotalSize() + "px",
|
|
964
|
+
width: "100%",
|
|
965
|
+
position: "relative"
|
|
966
|
+
}
|
|
967
|
+
}, React__default.createElement(TaskListTable, Object.assign({}, tableProps)))));
|
|
925
968
|
};
|
|
926
969
|
|
|
927
970
|
var styles$4 = {"gridRow":"_2dZTy","gridRowLookAhead":"_2RRca","gridRowLine":"_3rUKi","gridTick":"_RuwuK","darkerGridRow":"_2M-tt"};
|
|
@@ -935,103 +978,123 @@ var GridBody = function GridBody(_ref) {
|
|
|
935
978
|
columnWidth = _ref.columnWidth,
|
|
936
979
|
todayColor = _ref.todayColor,
|
|
937
980
|
weekendColor = _ref.weekendColor,
|
|
938
|
-
rtl = _ref.rtl
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
gridRows.push(React__default.createElement("rect", {
|
|
954
|
-
key: "Row" + task.id,
|
|
955
|
-
x: "0",
|
|
956
|
-
y: y,
|
|
957
|
-
width: svgWidth,
|
|
958
|
-
height: rowHeight,
|
|
959
|
-
className: isDarkerRow ? styles$4.darkerGridRow : scheduleType === "lookAhead" ? styles$4.gridRowLookAhead : styles$4.gridRow
|
|
960
|
-
}));
|
|
961
|
-
rowLines.push(React__default.createElement("line", {
|
|
962
|
-
key: "RowLine" + task.id,
|
|
963
|
-
x: "0",
|
|
964
|
-
y1: y + rowHeight,
|
|
965
|
-
x2: svgWidth,
|
|
966
|
-
y2: y + rowHeight,
|
|
967
|
-
className: styles$4.gridRowLine
|
|
968
|
-
}));
|
|
969
|
-
y += rowHeight;
|
|
970
|
-
}
|
|
971
|
-
|
|
981
|
+
rtl = _ref.rtl,
|
|
982
|
+
_ref$virtualItems = _ref.virtualItems,
|
|
983
|
+
virtualItems = _ref$virtualItems === void 0 ? [] : _ref$virtualItems,
|
|
984
|
+
visibleStartY = _ref.visibleStartY,
|
|
985
|
+
visibleEndY = _ref.visibleEndY;
|
|
986
|
+
var visibleHeight = visibleEndY - visibleStartY;
|
|
987
|
+
var items = virtualItems.length > 0 ? virtualItems : tasks.map(function (_, i) {
|
|
988
|
+
return {
|
|
989
|
+
index: i,
|
|
990
|
+
start: i * rowHeight,
|
|
991
|
+
end: (i + 1) * rowHeight,
|
|
992
|
+
size: rowHeight,
|
|
993
|
+
key: i
|
|
994
|
+
};
|
|
995
|
+
});
|
|
972
996
|
var now = new Date();
|
|
973
|
-
var
|
|
974
|
-
var
|
|
975
|
-
var
|
|
976
|
-
var weekend = [];
|
|
997
|
+
var x = 0;
|
|
998
|
+
var todayRects = [];
|
|
999
|
+
var weekendRects = [];
|
|
977
1000
|
|
|
978
1001
|
for (var i = 0; i < dates.length; i++) {
|
|
979
1002
|
var date = dates[i];
|
|
980
|
-
|
|
981
|
-
key: date.getTime(),
|
|
982
|
-
x1: tickX,
|
|
983
|
-
y1: 0,
|
|
984
|
-
x2: tickX,
|
|
985
|
-
y2: y,
|
|
986
|
-
className: styles$4.gridTick
|
|
987
|
-
}));
|
|
1003
|
+
var isTodayColumn = i + 1 < dates.length && date.getTime() < now.getTime() && dates[i + 1].getTime() >= now.getTime() || i + 1 === dates.length && date.getTime() <= now.getTime() && addToDate(date, date.getTime() - dates[i - 1].getTime(), "millisecond").getTime() > now.getTime();
|
|
988
1004
|
|
|
989
|
-
if (
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
1005
|
+
if (isTodayColumn) {
|
|
1006
|
+
todayRects.push(React__default.createElement("rect", {
|
|
1007
|
+
key: "today-" + i,
|
|
1008
|
+
x: rtl ? x + columnWidth : x,
|
|
1009
|
+
y: visibleStartY,
|
|
993
1010
|
width: columnWidth,
|
|
994
|
-
height:
|
|
1011
|
+
height: visibleHeight,
|
|
995
1012
|
fill: todayColor
|
|
996
|
-
});
|
|
1013
|
+
}));
|
|
997
1014
|
}
|
|
998
1015
|
|
|
999
|
-
if (date.
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1016
|
+
if (rtl && i + 1 < dates.length && date.getTime() >= now.getTime() && dates[i + 1].getTime() < now.getTime()) {
|
|
1017
|
+
todayRects.push(React__default.createElement("rect", {
|
|
1018
|
+
key: "today-rtl-" + i,
|
|
1019
|
+
x: x,
|
|
1020
|
+
y: visibleStartY,
|
|
1003
1021
|
width: columnWidth,
|
|
1004
|
-
height:
|
|
1005
|
-
fill:
|
|
1022
|
+
height: visibleHeight,
|
|
1023
|
+
fill: todayColor
|
|
1006
1024
|
}));
|
|
1007
1025
|
}
|
|
1008
1026
|
|
|
1009
|
-
if (
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1027
|
+
if (date.getDay() === 0 || date.getDay() === 6) {
|
|
1028
|
+
weekendRects.push(React__default.createElement("rect", {
|
|
1029
|
+
key: "weekend-" + i,
|
|
1030
|
+
x: x,
|
|
1031
|
+
y: visibleStartY,
|
|
1013
1032
|
width: columnWidth,
|
|
1014
|
-
height:
|
|
1015
|
-
fill:
|
|
1016
|
-
});
|
|
1033
|
+
height: visibleHeight,
|
|
1034
|
+
fill: weekendColor
|
|
1035
|
+
}));
|
|
1017
1036
|
}
|
|
1018
1037
|
|
|
1019
|
-
|
|
1038
|
+
x += columnWidth;
|
|
1020
1039
|
}
|
|
1021
1040
|
|
|
1041
|
+
x = 0;
|
|
1042
|
+
var tickLines = dates.map(function (_, i) {
|
|
1043
|
+
var line = React__default.createElement("line", {
|
|
1044
|
+
key: "tick-" + i,
|
|
1045
|
+
x1: x,
|
|
1046
|
+
y1: visibleStartY,
|
|
1047
|
+
x2: x,
|
|
1048
|
+
y2: visibleEndY,
|
|
1049
|
+
className: styles$4.gridTick
|
|
1050
|
+
});
|
|
1051
|
+
x += columnWidth;
|
|
1052
|
+
return line;
|
|
1053
|
+
});
|
|
1054
|
+
var rowBackgrounds = [];
|
|
1055
|
+
var rowLines = [];
|
|
1056
|
+
rowLines.push(React__default.createElement("line", {
|
|
1057
|
+
key: "top",
|
|
1058
|
+
x1: 0,
|
|
1059
|
+
y1: visibleStartY,
|
|
1060
|
+
x2: svgWidth,
|
|
1061
|
+
y2: visibleStartY,
|
|
1062
|
+
className: styles$4.gridRowLine
|
|
1063
|
+
}));
|
|
1064
|
+
items.forEach(function (vi) {
|
|
1065
|
+
var task = tasks[vi.index];
|
|
1066
|
+
var y = vi.start;
|
|
1067
|
+
var isMilestone = task.type === "milestone";
|
|
1068
|
+
rowBackgrounds.push(React__default.createElement("rect", {
|
|
1069
|
+
key: "bg-" + vi.key,
|
|
1070
|
+
x: 0,
|
|
1071
|
+
y: y,
|
|
1072
|
+
width: svgWidth,
|
|
1073
|
+
height: rowHeight,
|
|
1074
|
+
className: isMilestone ? styles$4.darkerGridRow : scheduleType === "lookAhead" ? styles$4.gridRowLookAhead : styles$4.gridRow
|
|
1075
|
+
}));
|
|
1076
|
+
rowLines.push(React__default.createElement("line", {
|
|
1077
|
+
key: "line-" + vi.key,
|
|
1078
|
+
x1: 0,
|
|
1079
|
+
y1: y + rowHeight,
|
|
1080
|
+
x2: svgWidth,
|
|
1081
|
+
y2: y + rowHeight,
|
|
1082
|
+
className: styles$4.gridRowLine
|
|
1083
|
+
}));
|
|
1084
|
+
});
|
|
1022
1085
|
return React__default.createElement("g", {
|
|
1023
1086
|
className: "gridBody"
|
|
1024
1087
|
}, React__default.createElement("g", {
|
|
1025
1088
|
className: "rows"
|
|
1026
|
-
},
|
|
1089
|
+
}, rowBackgrounds), React__default.createElement("g", {
|
|
1027
1090
|
className: "rowLines"
|
|
1028
1091
|
}, rowLines), React__default.createElement("g", {
|
|
1029
1092
|
className: "ticks"
|
|
1030
|
-
},
|
|
1093
|
+
}, tickLines), scheduleType === "lookAhead" && React__default.createElement("g", {
|
|
1031
1094
|
className: "weekend"
|
|
1032
|
-
},
|
|
1095
|
+
}, weekendRects), React__default.createElement("g", {
|
|
1033
1096
|
className: "today"
|
|
1034
|
-
},
|
|
1097
|
+
}, todayRects));
|
|
1035
1098
|
};
|
|
1036
1099
|
|
|
1037
1100
|
var Grid = function Grid(props) {
|
|
@@ -2464,6 +2527,10 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
|
2464
2527
|
fontFamily = _ref.fontFamily,
|
|
2465
2528
|
fontSize = _ref.fontSize,
|
|
2466
2529
|
rtl = _ref.rtl,
|
|
2530
|
+
_ref$virtualItems = _ref.virtualItems,
|
|
2531
|
+
virtualItems = _ref$virtualItems === void 0 ? [] : _ref$virtualItems,
|
|
2532
|
+
ganttHeight = _ref.ganttHeight,
|
|
2533
|
+
scrollY = _ref.scrollY,
|
|
2467
2534
|
setGanttEvent = _ref.setGanttEvent,
|
|
2468
2535
|
setFailedTask = _ref.setFailedTask,
|
|
2469
2536
|
setSelectedTask = _ref.setSelectedTask,
|
|
@@ -2679,16 +2746,13 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
|
2679
2746
|
};
|
|
2680
2747
|
|
|
2681
2748
|
var getArrows = function getArrows(isCritical, criticalPathType) {
|
|
2749
|
+
var visibleMinY = scrollY - rowHeight * 5;
|
|
2750
|
+
var visibleMaxY = scrollY + ganttHeight + rowHeight * 5;
|
|
2682
2751
|
return tasks.flatMap(function (_task) {
|
|
2683
2752
|
var task = _task.start.getTime() > 0 && _task.end.getTime() > 0 ? _task : undefined;
|
|
2684
2753
|
|
|
2685
2754
|
if (!task) {
|
|
2686
|
-
return [
|
|
2687
|
-
key: _task.id + (isCritical ? "-critical" : "-normal"),
|
|
2688
|
-
style: {
|
|
2689
|
-
height: taskHeight
|
|
2690
|
-
}
|
|
2691
|
-
})];
|
|
2755
|
+
return [];
|
|
2692
2756
|
}
|
|
2693
2757
|
|
|
2694
2758
|
return task.barChildren.map(function (child) {
|
|
@@ -2698,6 +2762,15 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
|
2698
2762
|
var criticalTask = (_task$criticalPathArr = task.criticalPathArrows) === null || _task$criticalPathArr === void 0 ? void 0 : _task$criticalPathArr.find(function (arrow) {
|
|
2699
2763
|
return arrow.taskId === tasks[child.index].id && (!!arrow.criticalPathType ? arrow.criticalPathType === criticalPathType : !criticalPathType);
|
|
2700
2764
|
});
|
|
2765
|
+
var taskTo = tasks[child.index];
|
|
2766
|
+
var yFrom = task.y + taskHeight / 2;
|
|
2767
|
+
var yTo = taskTo.y + taskHeight / 2;
|
|
2768
|
+
var minY = Math.min(yFrom, yTo);
|
|
2769
|
+
var maxY = Math.max(yFrom, yTo);
|
|
2770
|
+
|
|
2771
|
+
if (maxY < visibleMinY || minY > visibleMaxY) {
|
|
2772
|
+
return null;
|
|
2773
|
+
}
|
|
2701
2774
|
|
|
2702
2775
|
if (!!criticalTask === isCritical) {
|
|
2703
2776
|
return React__default.createElement(Arrow, {
|
|
@@ -2726,34 +2799,44 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
|
2726
2799
|
className: "bar",
|
|
2727
2800
|
fontFamily: fontFamily,
|
|
2728
2801
|
fontSize: fontSize
|
|
2729
|
-
},
|
|
2730
|
-
var
|
|
2802
|
+
}, virtualItems.map(function (vi) {
|
|
2803
|
+
var _task = tasks[vi.index];
|
|
2804
|
+
|
|
2805
|
+
var task = _extends({}, _task, {
|
|
2806
|
+
y: 0
|
|
2807
|
+
});
|
|
2731
2808
|
|
|
2732
2809
|
if (!task && _task.typeInternal === "milestone") {
|
|
2733
|
-
return React__default.createElement(
|
|
2734
|
-
|
|
2810
|
+
return React__default.createElement("g", {
|
|
2811
|
+
key: _task.id,
|
|
2812
|
+
transform: "translate(0, " + vi.start + ")"
|
|
2813
|
+
}, React__default.createElement(Milestone, {
|
|
2814
|
+
task: task,
|
|
2735
2815
|
arrowIndent: arrowIndent,
|
|
2736
2816
|
taskHeight: taskHeight,
|
|
2737
2817
|
isProgressChangeable: false,
|
|
2738
2818
|
isDateChangeable: false,
|
|
2739
2819
|
isDelete: !_task.isDisabled,
|
|
2740
2820
|
onEventStart: handleBarEventStart,
|
|
2741
|
-
key: _task.id,
|
|
2742
2821
|
isSelected: !!selectedTask && _task.id === selectedTask.id,
|
|
2743
2822
|
rtl: rtl
|
|
2744
|
-
});
|
|
2823
|
+
}));
|
|
2745
2824
|
}
|
|
2746
2825
|
|
|
2747
2826
|
if (!task) {
|
|
2748
2827
|
return React__default.createElement("g", {
|
|
2749
2828
|
key: _task.id,
|
|
2829
|
+
transform: "translate(0, " + vi.start + ")",
|
|
2750
2830
|
style: {
|
|
2751
2831
|
height: taskHeight
|
|
2752
2832
|
}
|
|
2753
2833
|
});
|
|
2754
2834
|
}
|
|
2755
2835
|
|
|
2756
|
-
return React__default.createElement(
|
|
2836
|
+
return React__default.createElement("g", {
|
|
2837
|
+
key: task.id,
|
|
2838
|
+
transform: "translate(0, " + vi.start + ")"
|
|
2839
|
+
}, React__default.createElement(TaskItem, {
|
|
2757
2840
|
task: task,
|
|
2758
2841
|
arrowIndent: arrowIndent,
|
|
2759
2842
|
taskHeight: taskHeight,
|
|
@@ -2761,10 +2844,9 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
|
|
|
2761
2844
|
isDateChangeable: !!onDateChange && !task.isDisabled,
|
|
2762
2845
|
isDelete: !task.isDisabled,
|
|
2763
2846
|
onEventStart: handleBarEventStart,
|
|
2764
|
-
key: task.id,
|
|
2765
2847
|
isSelected: !!selectedTask && task.id === selectedTask.id,
|
|
2766
2848
|
rtl: rtl
|
|
2767
|
-
});
|
|
2849
|
+
}));
|
|
2768
2850
|
})));
|
|
2769
2851
|
};
|
|
2770
2852
|
|
|
@@ -2782,9 +2864,24 @@ var TaskGantt = function TaskGantt(_ref) {
|
|
|
2782
2864
|
var verticalGanttContainerRef = React.useRef(null);
|
|
2783
2865
|
|
|
2784
2866
|
var newBarProps = _extends({}, barProps, {
|
|
2785
|
-
svg: ganttSVGRef
|
|
2867
|
+
svg: ganttSVGRef,
|
|
2868
|
+
ganttHeight: ganttHeight,
|
|
2869
|
+
scrollY: scrollY
|
|
2786
2870
|
});
|
|
2787
2871
|
|
|
2872
|
+
var buffer = barProps.rowHeight * 10;
|
|
2873
|
+
var visibleStartY = scrollY - buffer;
|
|
2874
|
+
var visibleEndY = scrollY + ganttHeight + buffer;
|
|
2875
|
+
var virtualizer = reactVirtual.useVirtualizer({
|
|
2876
|
+
count: barProps.tasks.length,
|
|
2877
|
+
getScrollElement: function getScrollElement() {
|
|
2878
|
+
return horizontalContainerRef.current;
|
|
2879
|
+
},
|
|
2880
|
+
estimateSize: function estimateSize() {
|
|
2881
|
+
return barProps.rowHeight;
|
|
2882
|
+
},
|
|
2883
|
+
overscan: 20
|
|
2884
|
+
});
|
|
2788
2885
|
React.useEffect(function () {
|
|
2789
2886
|
if (horizontalContainerRef.current) {
|
|
2790
2887
|
horizontalContainerRef.current.scrollTop = scrollY;
|
|
@@ -2816,10 +2913,16 @@ var TaskGantt = function TaskGantt(_ref) {
|
|
|
2816
2913
|
}, React__default.createElement("svg", {
|
|
2817
2914
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2818
2915
|
width: gridProps.svgWidth,
|
|
2819
|
-
height:
|
|
2916
|
+
height: virtualizer.getTotalSize(),
|
|
2820
2917
|
fontFamily: barProps.fontFamily,
|
|
2821
2918
|
ref: ganttSVGRef
|
|
2822
|
-
}, React__default.createElement(Grid, Object.assign({}, gridProps
|
|
2919
|
+
}, React__default.createElement(Grid, Object.assign({}, gridProps, {
|
|
2920
|
+
virtualItems: virtualizer.getVirtualItems(),
|
|
2921
|
+
visibleStartY: visibleStartY,
|
|
2922
|
+
visibleEndY: visibleEndY
|
|
2923
|
+
})), React__default.createElement(TaskGanttContent, Object.assign({}, newBarProps, {
|
|
2924
|
+
virtualItems: virtualizer.getVirtualItems()
|
|
2925
|
+
})))));
|
|
2823
2926
|
};
|
|
2824
2927
|
|
|
2825
2928
|
var styles$a = {"scrollWrapper":"_2k9Ys","scroll":"_19jgW"};
|
|
@@ -3020,6 +3123,9 @@ var Gantt = function Gantt(_ref) {
|
|
|
3020
3123
|
lastTouchY = _useState14[0],
|
|
3021
3124
|
setLastTouchY = _useState14[1];
|
|
3022
3125
|
|
|
3126
|
+
var buffer = rowHeight * 10;
|
|
3127
|
+
var visibleStartY = scrollY - buffer;
|
|
3128
|
+
var visibleEndY = scrollY + ganttHeight + buffer;
|
|
3023
3129
|
React.useEffect(function () {
|
|
3024
3130
|
if (scheduleType === "lookAhead" && startDate && endDate) {
|
|
3025
3131
|
setDateSetup({
|
|
@@ -3076,7 +3182,7 @@ var Gantt = function Gantt(_ref) {
|
|
|
3076
3182
|
}
|
|
3077
3183
|
|
|
3078
3184
|
setBarTasks(convertToBarTasks(filteredTasks, newDates, columnWidth, rowHeight, taskHeight, barCornerRadius, handleWidth, rtl, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, milestoneBackgroundColor, milestoneBackgroundSelectedColor));
|
|
3079
|
-
}, [tasks, viewMode, preStepsCount, rowHeight, barCornerRadius, columnWidth, taskHeight, handleWidth, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, milestoneBackgroundColor, milestoneBackgroundSelectedColor, rtl,
|
|
3185
|
+
}, [tasks, viewMode, preStepsCount, rowHeight, barCornerRadius, columnWidth, taskHeight, handleWidth, barProgressColor, barProgressSelectedColor, barBackgroundColor, barBackgroundSelectedColor, projectProgressColor, projectProgressSelectedColor, projectBackgroundColor, projectBackgroundSelectedColor, milestoneBackgroundColor, milestoneBackgroundSelectedColor, rtl, onExpanderClick]);
|
|
3080
3186
|
React.useEffect(function () {
|
|
3081
3187
|
if (viewMode === dateSetup.viewMode && (viewDate && !currentViewDate || viewDate && (currentViewDate === null || currentViewDate === void 0 ? void 0 : currentViewDate.valueOf()) !== viewDate.valueOf())) {
|
|
3082
3188
|
var dates = dateSetup.dates;
|
|
@@ -3351,7 +3457,9 @@ var Gantt = function Gantt(_ref) {
|
|
|
3351
3457
|
dates: dateSetup.dates,
|
|
3352
3458
|
todayColor: todayColor,
|
|
3353
3459
|
weekendColor: weekendColor,
|
|
3354
|
-
rtl: rtl
|
|
3460
|
+
rtl: rtl,
|
|
3461
|
+
visibleStartY: visibleStartY,
|
|
3462
|
+
visibleEndY: visibleEndY
|
|
3355
3463
|
};
|
|
3356
3464
|
var calendarProps = {
|
|
3357
3465
|
dateSetup: dateSetup,
|
|
@@ -3385,7 +3493,9 @@ var Gantt = function Gantt(_ref) {
|
|
|
3385
3493
|
onProgressChange: onProgressChange,
|
|
3386
3494
|
onDoubleClick: onDoubleClick,
|
|
3387
3495
|
onClick: onClick,
|
|
3388
|
-
onDelete: onDelete
|
|
3496
|
+
onDelete: onDelete,
|
|
3497
|
+
ganttHeight: ganttHeight,
|
|
3498
|
+
scrollY: scrollY
|
|
3389
3499
|
};
|
|
3390
3500
|
var tableProps = {
|
|
3391
3501
|
rowHeight: rowHeight,
|
|
@@ -3513,6 +3623,14 @@ function getCriticalPaths(leafTasks) {
|
|
|
3513
3623
|
}
|
|
3514
3624
|
}
|
|
3515
3625
|
|
|
3626
|
+
var printedList = taskChainList.map(function (elem) {
|
|
3627
|
+
var newElem = _extends({}, elem);
|
|
3628
|
+
|
|
3629
|
+
newElem.duration = Math.round(elem.duration / 86400000);
|
|
3630
|
+
return newElem;
|
|
3631
|
+
});
|
|
3632
|
+
console.debug(printedList);
|
|
3633
|
+
|
|
3516
3634
|
if (taskChainList.length > 0) {
|
|
3517
3635
|
taskChainList.sort(function (a, b) {
|
|
3518
3636
|
return b.duration - a.duration;
|
|
@@ -3624,25 +3742,27 @@ function computeCriticalPath(taskID, taskMap) {
|
|
|
3624
3742
|
}
|
|
3625
3743
|
}
|
|
3626
3744
|
|
|
3627
|
-
|
|
3745
|
+
if (paths.length === 0) {
|
|
3746
|
+
var immediateChildDuration = taskMap[taskID].end - taskMap[taskID].start + depDuration - overlap;
|
|
3628
3747
|
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3748
|
+
if (taskMap[taskID].paths.length < 2) {
|
|
3749
|
+
taskMap[taskID].paths.push({
|
|
3750
|
+
duration: immediateChildDuration,
|
|
3751
|
+
task: dependents[j],
|
|
3752
|
+
parent: taskID,
|
|
3753
|
+
visited: false
|
|
3754
|
+
});
|
|
3755
|
+
} else if (immediateChildDuration > taskMap[taskID].paths[0].duration) {
|
|
3756
|
+
taskMap[taskID].paths[0].duration = immediateChildDuration;
|
|
3757
|
+
taskMap[taskID].paths[0].task = dependents[j];
|
|
3758
|
+
taskMap[taskID].paths[0].parent = taskID;
|
|
3759
|
+
taskMap[taskID].paths[0].visited = false;
|
|
3760
|
+
} else if (immediateChildDuration > taskMap[taskID].paths[1].duration) {
|
|
3761
|
+
taskMap[taskID].paths[1].duration = immediateChildDuration;
|
|
3762
|
+
taskMap[taskID].paths[1].task = dependents[j];
|
|
3763
|
+
taskMap[taskID].paths[1].parent = taskID;
|
|
3764
|
+
taskMap[taskID].paths[1].visited = false;
|
|
3765
|
+
}
|
|
3646
3766
|
}
|
|
3647
3767
|
}
|
|
3648
3768
|
}
|