gantt-task-react-v 1.0.45 → 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 { yOffset, borderHeight, barCornerRadius, isWarning, isPlan, isCritical, width, height, inProgress } = props;
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("g", { children: [
12689
- /* @__PURE__ */ jsx(
12690
- "rect",
12691
- {
12692
- x: 0,
12693
- width,
12694
- y: borderHeight + yOffset,
12695
- height: lineHeight,
12696
- ry: barCornerRadius,
12697
- rx: barCornerRadius,
12698
- fill: barColor,
12699
- className: styles$3.barComparison
12700
- }
12701
- ),
12702
- /* @__PURE__ */ jsx(
12703
- "rect",
12704
- {
12705
- x: 0,
12706
- fill: barColor,
12707
- y: yOffset,
12708
- width: height,
12709
- height: borderHeight + lineHeight - yOffset
12710
- }
12711
- ),
12712
- !inProgress && /* @__PURE__ */ jsx(
12713
- "rect",
12714
- {
12715
- x: width - height,
12716
- fill: barColor,
12717
- y: yOffset,
12718
- width: height,
12719
- height: borderHeight + lineHeight - yOffset
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() && (!!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()),
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
  },
@@ -12685,7 +12685,19 @@
12685
12685
  barComparison
12686
12686
  };
12687
12687
  const BarComparison = (props) => {
12688
- const { yOffset, borderHeight, barCornerRadius, isWarning, isPlan, isCritical, width, height, inProgress } = props;
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("g", { children: [
12706
- /* @__PURE__ */ jsxRuntime.jsx(
12707
- "rect",
12708
- {
12709
- x: 0,
12710
- width,
12711
- y: borderHeight + yOffset,
12712
- height: lineHeight,
12713
- ry: barCornerRadius,
12714
- rx: barCornerRadius,
12715
- fill: barColor,
12716
- className: styles$3.barComparison
12717
- }
12718
- ),
12719
- /* @__PURE__ */ jsxRuntime.jsx(
12720
- "rect",
12721
- {
12722
- x: 0,
12723
- fill: barColor,
12724
- y: yOffset,
12725
- width: height,
12726
- height: borderHeight + lineHeight - yOffset
12727
- }
12728
- ),
12729
- !inProgress && /* @__PURE__ */ jsxRuntime.jsx(
12730
- "rect",
12731
- {
12732
- x: width - height,
12733
- fill: barColor,
12734
- y: yOffset,
12735
- width: height,
12736
- height: borderHeight + lineHeight - yOffset
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() && (!!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()),
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
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gantt-task-react-v",
3
- "version": "1.0.45",
3
+ "version": "1.0.46",
4
4
  "description": "Interactive Gantt Chart for React with TypeScript.",
5
5
  "author": "aguilanbon",
6
6
  "homepage": "https://github.com/aguilanbon/gantt-task-react-v",