gantt-task-react-v 1.0.44 → 1.0.46
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
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
- Flexible Gantt height now adapts to its parent container, now we always see the horizontal scrolls for both task list and gantt.
|
|
8
8
|
- Fixed sticky gantt header on drag
|
|
9
|
+
- Fixed Tooltip should show only on gantt section current view boundaries
|
|
10
|
+
- Added Tooltip for comparison bars
|
|
9
11
|
|
|
10
12
|
## [Live Demo In Storybook](https://661071b076b50cb537c16c19-yrsukdfefs.chromatic.com/)
|
|
11
13
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { TaskComparisonDatesCoordinates } from "../../../types";
|
|
2
|
+
import { TaskComparisonDatesCoordinates, Task } from "../../../types";
|
|
3
3
|
interface Props extends Omit<TaskComparisonDatesCoordinates, "x" | "y"> {
|
|
4
4
|
barCornerRadius: number;
|
|
5
5
|
borderHeight: number;
|
|
@@ -8,6 +8,8 @@ interface Props extends Omit<TaskComparisonDatesCoordinates, "x" | "y"> {
|
|
|
8
8
|
isPlan?: boolean;
|
|
9
9
|
isCritical?: boolean;
|
|
10
10
|
inProgress?: boolean;
|
|
11
|
+
task?: Task;
|
|
12
|
+
onTooltipTask?: (task: Task | null, element: Element | null) => void;
|
|
11
13
|
}
|
|
12
14
|
export declare const BarComparison: React.FC<Props>;
|
|
13
15
|
export {};
|
|
@@ -12668,7 +12668,19 @@ const styles$3 = {
|
|
|
12668
12668
|
barComparison
|
|
12669
12669
|
};
|
|
12670
12670
|
const BarComparison = (props) => {
|
|
12671
|
-
const {
|
|
12671
|
+
const {
|
|
12672
|
+
yOffset,
|
|
12673
|
+
borderHeight,
|
|
12674
|
+
barCornerRadius,
|
|
12675
|
+
isWarning,
|
|
12676
|
+
isPlan,
|
|
12677
|
+
isCritical,
|
|
12678
|
+
width,
|
|
12679
|
+
height,
|
|
12680
|
+
inProgress,
|
|
12681
|
+
task,
|
|
12682
|
+
onTooltipTask
|
|
12683
|
+
} = props;
|
|
12672
12684
|
const lineHeight = useMemo(() => Math.max(height, 4), [height]);
|
|
12673
12685
|
const barColor = useMemo(() => {
|
|
12674
12686
|
if (inProgress) {
|
|
@@ -12685,41 +12697,54 @@ const BarComparison = (props) => {
|
|
|
12685
12697
|
}
|
|
12686
12698
|
return "var(--gantt-bar-comparison-default-color)";
|
|
12687
12699
|
}, [inProgress, isCritical, isPlan, isWarning]);
|
|
12688
|
-
return /* @__PURE__ */ jsxs(
|
|
12689
|
-
|
|
12690
|
-
|
|
12691
|
-
{
|
|
12692
|
-
|
|
12693
|
-
|
|
12694
|
-
|
|
12695
|
-
|
|
12696
|
-
|
|
12697
|
-
|
|
12698
|
-
|
|
12699
|
-
|
|
12700
|
-
|
|
12701
|
-
|
|
12702
|
-
|
|
12703
|
-
|
|
12704
|
-
|
|
12705
|
-
|
|
12706
|
-
|
|
12707
|
-
|
|
12708
|
-
|
|
12709
|
-
|
|
12710
|
-
|
|
12711
|
-
|
|
12712
|
-
|
|
12713
|
-
|
|
12714
|
-
|
|
12715
|
-
|
|
12716
|
-
|
|
12717
|
-
|
|
12718
|
-
|
|
12719
|
-
|
|
12720
|
-
|
|
12721
|
-
|
|
12722
|
-
|
|
12700
|
+
return /* @__PURE__ */ jsxs(
|
|
12701
|
+
"g",
|
|
12702
|
+
{
|
|
12703
|
+
onMouseEnter: (e) => {
|
|
12704
|
+
e.stopPropagation();
|
|
12705
|
+
onTooltipTask && onTooltipTask(task || null, e.currentTarget);
|
|
12706
|
+
},
|
|
12707
|
+
onMouseLeave: (e) => {
|
|
12708
|
+
e.stopPropagation();
|
|
12709
|
+
onTooltipTask && onTooltipTask(null, null);
|
|
12710
|
+
},
|
|
12711
|
+
children: [
|
|
12712
|
+
/* @__PURE__ */ jsx(
|
|
12713
|
+
"rect",
|
|
12714
|
+
{
|
|
12715
|
+
x: 0,
|
|
12716
|
+
width,
|
|
12717
|
+
y: borderHeight + yOffset,
|
|
12718
|
+
height: lineHeight,
|
|
12719
|
+
ry: barCornerRadius,
|
|
12720
|
+
rx: barCornerRadius,
|
|
12721
|
+
fill: barColor,
|
|
12722
|
+
className: styles$3.barComparison
|
|
12723
|
+
}
|
|
12724
|
+
),
|
|
12725
|
+
/* @__PURE__ */ jsx(
|
|
12726
|
+
"rect",
|
|
12727
|
+
{
|
|
12728
|
+
x: 0,
|
|
12729
|
+
fill: barColor,
|
|
12730
|
+
y: yOffset,
|
|
12731
|
+
width: height,
|
|
12732
|
+
height: borderHeight + lineHeight - yOffset
|
|
12733
|
+
}
|
|
12734
|
+
),
|
|
12735
|
+
!inProgress && /* @__PURE__ */ jsx(
|
|
12736
|
+
"rect",
|
|
12737
|
+
{
|
|
12738
|
+
x: width - height,
|
|
12739
|
+
fill: barColor,
|
|
12740
|
+
y: yOffset,
|
|
12741
|
+
width: height,
|
|
12742
|
+
height: borderHeight + lineHeight - yOffset
|
|
12743
|
+
}
|
|
12744
|
+
)
|
|
12745
|
+
]
|
|
12746
|
+
}
|
|
12747
|
+
);
|
|
12723
12748
|
};
|
|
12724
12749
|
const DELTA_RELATION_WIDTH = 100;
|
|
12725
12750
|
const TaskGanttContentInner = (props) => {
|
|
@@ -12914,14 +12939,16 @@ const TaskGanttContentInner = (props) => {
|
|
|
12914
12939
|
BarComparison,
|
|
12915
12940
|
{
|
|
12916
12941
|
inProgress: !task.comparisonDates.end,
|
|
12917
|
-
isPlan: task.comparisonDates.start.getTime() >= task.start.getTime() &&
|
|
12942
|
+
isPlan: task.comparisonDates.start.getTime() >= task.start.getTime() && !!task.comparisonDates.end && task.comparisonDates.end.getTime() <= task.end.getTime() || task.comparisonDates.start.getTime() <= task.start.getTime() && !!task.comparisonDates.end && task.comparisonDates.end.getTime() <= task.start.getTime(),
|
|
12918
12943
|
isWarning: !!task.comparisonDates.end && task.comparisonDates.end.getTime() >= task.end.getTime(),
|
|
12919
12944
|
isCritical: task.comparisonDates.start.getTime() > task.start.getTime(),
|
|
12920
12945
|
barCornerRadius: distances.barCornerRadius,
|
|
12921
12946
|
height: comparisonDates.height,
|
|
12922
12947
|
width: comparisonDates.width,
|
|
12923
12948
|
borderHeight: distances.barComparisonTaskBorderHeight,
|
|
12924
|
-
yOffset: distances.barComparisonTaskYOffset
|
|
12949
|
+
yOffset: distances.barComparisonTaskYOffset,
|
|
12950
|
+
task,
|
|
12951
|
+
onTooltipTask
|
|
12925
12952
|
}
|
|
12926
12953
|
)
|
|
12927
12954
|
},
|
|
@@ -17050,7 +17077,7 @@ function useRole(context, props) {
|
|
|
17050
17077
|
};
|
|
17051
17078
|
}, [enabled, role, ariaRole, open, floatingId, referenceId, isNested]);
|
|
17052
17079
|
}
|
|
17053
|
-
const useTaskTooltip = (changeInProgress) => {
|
|
17080
|
+
const useTaskTooltip = (changeInProgress, boundaryElement) => {
|
|
17054
17081
|
const [hoverTooltipTask, setHoverTooltipTask] = useState(null);
|
|
17055
17082
|
const [hoverTooltipEl, setHoverTooltipEl] = useState(null);
|
|
17056
17083
|
const tooltipTask = useMemo(() => {
|
|
@@ -17073,7 +17100,14 @@ const useTaskTooltip = (changeInProgress) => {
|
|
|
17073
17100
|
context
|
|
17074
17101
|
} = useFloating({
|
|
17075
17102
|
open: Boolean(tooltipTask),
|
|
17076
|
-
middleware: [
|
|
17103
|
+
middleware: [
|
|
17104
|
+
offset(10),
|
|
17105
|
+
flip(),
|
|
17106
|
+
shift({
|
|
17107
|
+
boundary: (boundaryElement == null ? void 0 : boundaryElement.current) || void 0,
|
|
17108
|
+
padding: 8
|
|
17109
|
+
})
|
|
17110
|
+
],
|
|
17077
17111
|
whileElementsMounted: autoUpdate,
|
|
17078
17112
|
strategy: "absolute"
|
|
17079
17113
|
});
|
|
@@ -19256,7 +19290,7 @@ const Gantt = (props) => {
|
|
|
19256
19290
|
setFloatingRef,
|
|
19257
19291
|
getFloatingProps,
|
|
19258
19292
|
onChangeTooltipTask
|
|
19259
|
-
} = useTaskTooltip(changeInProgress);
|
|
19293
|
+
} = useTaskTooltip(changeInProgress, verticalGanttContainerRef);
|
|
19260
19294
|
const handleDeleteTasks = useCallback(
|
|
19261
19295
|
(tasksForDelete) => {
|
|
19262
19296
|
onChangeTooltipTask(null, null);
|
|
@@ -12685,7 +12685,19 @@
|
|
|
12685
12685
|
barComparison
|
|
12686
12686
|
};
|
|
12687
12687
|
const BarComparison = (props) => {
|
|
12688
|
-
const {
|
|
12688
|
+
const {
|
|
12689
|
+
yOffset,
|
|
12690
|
+
borderHeight,
|
|
12691
|
+
barCornerRadius,
|
|
12692
|
+
isWarning,
|
|
12693
|
+
isPlan,
|
|
12694
|
+
isCritical,
|
|
12695
|
+
width,
|
|
12696
|
+
height,
|
|
12697
|
+
inProgress,
|
|
12698
|
+
task,
|
|
12699
|
+
onTooltipTask
|
|
12700
|
+
} = props;
|
|
12689
12701
|
const lineHeight = React.useMemo(() => Math.max(height, 4), [height]);
|
|
12690
12702
|
const barColor = React.useMemo(() => {
|
|
12691
12703
|
if (inProgress) {
|
|
@@ -12702,41 +12714,54 @@
|
|
|
12702
12714
|
}
|
|
12703
12715
|
return "var(--gantt-bar-comparison-default-color)";
|
|
12704
12716
|
}, [inProgress, isCritical, isPlan, isWarning]);
|
|
12705
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12706
|
-
|
|
12707
|
-
|
|
12708
|
-
{
|
|
12709
|
-
|
|
12710
|
-
|
|
12711
|
-
|
|
12712
|
-
|
|
12713
|
-
|
|
12714
|
-
|
|
12715
|
-
|
|
12716
|
-
|
|
12717
|
-
|
|
12718
|
-
|
|
12719
|
-
|
|
12720
|
-
|
|
12721
|
-
|
|
12722
|
-
|
|
12723
|
-
|
|
12724
|
-
|
|
12725
|
-
|
|
12726
|
-
|
|
12727
|
-
|
|
12728
|
-
|
|
12729
|
-
|
|
12730
|
-
|
|
12731
|
-
|
|
12732
|
-
|
|
12733
|
-
|
|
12734
|
-
|
|
12735
|
-
|
|
12736
|
-
|
|
12737
|
-
|
|
12738
|
-
|
|
12739
|
-
|
|
12717
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12718
|
+
"g",
|
|
12719
|
+
{
|
|
12720
|
+
onMouseEnter: (e) => {
|
|
12721
|
+
e.stopPropagation();
|
|
12722
|
+
onTooltipTask && onTooltipTask(task || null, e.currentTarget);
|
|
12723
|
+
},
|
|
12724
|
+
onMouseLeave: (e) => {
|
|
12725
|
+
e.stopPropagation();
|
|
12726
|
+
onTooltipTask && onTooltipTask(null, null);
|
|
12727
|
+
},
|
|
12728
|
+
children: [
|
|
12729
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12730
|
+
"rect",
|
|
12731
|
+
{
|
|
12732
|
+
x: 0,
|
|
12733
|
+
width,
|
|
12734
|
+
y: borderHeight + yOffset,
|
|
12735
|
+
height: lineHeight,
|
|
12736
|
+
ry: barCornerRadius,
|
|
12737
|
+
rx: barCornerRadius,
|
|
12738
|
+
fill: barColor,
|
|
12739
|
+
className: styles$3.barComparison
|
|
12740
|
+
}
|
|
12741
|
+
),
|
|
12742
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12743
|
+
"rect",
|
|
12744
|
+
{
|
|
12745
|
+
x: 0,
|
|
12746
|
+
fill: barColor,
|
|
12747
|
+
y: yOffset,
|
|
12748
|
+
width: height,
|
|
12749
|
+
height: borderHeight + lineHeight - yOffset
|
|
12750
|
+
}
|
|
12751
|
+
),
|
|
12752
|
+
!inProgress && /* @__PURE__ */ jsxRuntime.jsx(
|
|
12753
|
+
"rect",
|
|
12754
|
+
{
|
|
12755
|
+
x: width - height,
|
|
12756
|
+
fill: barColor,
|
|
12757
|
+
y: yOffset,
|
|
12758
|
+
width: height,
|
|
12759
|
+
height: borderHeight + lineHeight - yOffset
|
|
12760
|
+
}
|
|
12761
|
+
)
|
|
12762
|
+
]
|
|
12763
|
+
}
|
|
12764
|
+
);
|
|
12740
12765
|
};
|
|
12741
12766
|
const DELTA_RELATION_WIDTH = 100;
|
|
12742
12767
|
const TaskGanttContentInner = (props) => {
|
|
@@ -12931,14 +12956,16 @@
|
|
|
12931
12956
|
BarComparison,
|
|
12932
12957
|
{
|
|
12933
12958
|
inProgress: !task.comparisonDates.end,
|
|
12934
|
-
isPlan: task.comparisonDates.start.getTime() >= task.start.getTime() &&
|
|
12959
|
+
isPlan: task.comparisonDates.start.getTime() >= task.start.getTime() && !!task.comparisonDates.end && task.comparisonDates.end.getTime() <= task.end.getTime() || task.comparisonDates.start.getTime() <= task.start.getTime() && !!task.comparisonDates.end && task.comparisonDates.end.getTime() <= task.start.getTime(),
|
|
12935
12960
|
isWarning: !!task.comparisonDates.end && task.comparisonDates.end.getTime() >= task.end.getTime(),
|
|
12936
12961
|
isCritical: task.comparisonDates.start.getTime() > task.start.getTime(),
|
|
12937
12962
|
barCornerRadius: distances.barCornerRadius,
|
|
12938
12963
|
height: comparisonDates.height,
|
|
12939
12964
|
width: comparisonDates.width,
|
|
12940
12965
|
borderHeight: distances.barComparisonTaskBorderHeight,
|
|
12941
|
-
yOffset: distances.barComparisonTaskYOffset
|
|
12966
|
+
yOffset: distances.barComparisonTaskYOffset,
|
|
12967
|
+
task,
|
|
12968
|
+
onTooltipTask
|
|
12942
12969
|
}
|
|
12943
12970
|
)
|
|
12944
12971
|
},
|
|
@@ -17067,7 +17094,7 @@
|
|
|
17067
17094
|
};
|
|
17068
17095
|
}, [enabled, role, ariaRole, open, floatingId, referenceId, isNested]);
|
|
17069
17096
|
}
|
|
17070
|
-
const useTaskTooltip = (changeInProgress) => {
|
|
17097
|
+
const useTaskTooltip = (changeInProgress, boundaryElement) => {
|
|
17071
17098
|
const [hoverTooltipTask, setHoverTooltipTask] = React.useState(null);
|
|
17072
17099
|
const [hoverTooltipEl, setHoverTooltipEl] = React.useState(null);
|
|
17073
17100
|
const tooltipTask = React.useMemo(() => {
|
|
@@ -17090,7 +17117,14 @@
|
|
|
17090
17117
|
context
|
|
17091
17118
|
} = useFloating({
|
|
17092
17119
|
open: Boolean(tooltipTask),
|
|
17093
|
-
middleware: [
|
|
17120
|
+
middleware: [
|
|
17121
|
+
offset(10),
|
|
17122
|
+
flip(),
|
|
17123
|
+
shift({
|
|
17124
|
+
boundary: (boundaryElement == null ? void 0 : boundaryElement.current) || void 0,
|
|
17125
|
+
padding: 8
|
|
17126
|
+
})
|
|
17127
|
+
],
|
|
17094
17128
|
whileElementsMounted: autoUpdate,
|
|
17095
17129
|
strategy: "absolute"
|
|
17096
17130
|
});
|
|
@@ -19273,7 +19307,7 @@
|
|
|
19273
19307
|
setFloatingRef,
|
|
19274
19308
|
getFloatingProps,
|
|
19275
19309
|
onChangeTooltipTask
|
|
19276
|
-
} = useTaskTooltip(changeInProgress);
|
|
19310
|
+
} = useTaskTooltip(changeInProgress, verticalGanttContainerRef);
|
|
19277
19311
|
const handleDeleteTasks = React.useCallback(
|
|
19278
19312
|
(tasksForDelete) => {
|
|
19279
19313
|
onChangeTooltipTask(null, null);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { RefObject } from "react";
|
|
2
2
|
import type { ChangeInProgress, Task } from "../types";
|
|
3
|
-
export declare const useTaskTooltip: (changeInProgress: ChangeInProgress | null) => {
|
|
3
|
+
export declare const useTaskTooltip: (changeInProgress: ChangeInProgress | null, boundaryElement?: RefObject<HTMLElement>) => {
|
|
4
4
|
tooltipTask: Task;
|
|
5
5
|
tooltipX: number;
|
|
6
6
|
tooltipY: number;
|
package/package.json
CHANGED