gantt-task-react-v 1.0.45 → 1.0.47

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
 
@@ -8,5 +8,8 @@ export type GanttTodayProps = {
8
8
  startDate: Date;
9
9
  rtl: boolean;
10
10
  viewMode: ViewMode;
11
+ showTodayLine?: boolean;
12
+ showDataDateLine?: boolean;
13
+ dataDate?: Date | null;
11
14
  };
12
15
  export declare const GanttToday: React.NamedExoticComponent<GanttTodayProps>;
@@ -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 {};
@@ -10914,31 +10914,34 @@ const GanttTodayInner = ({
10914
10914
  isUnknownDates,
10915
10915
  rtl,
10916
10916
  startDate,
10917
- viewMode
10917
+ viewMode,
10918
+ showTodayLine = true,
10919
+ showDataDateLine = false,
10920
+ dataDate = null
10918
10921
  }) => {
10919
- const today = useMemo(() => {
10920
- if (isUnknownDates) {
10922
+ const todayElement = useMemo(() => {
10923
+ if (isUnknownDates || !showTodayLine) {
10921
10924
  return null;
10922
10925
  }
10923
- const today2 = /* @__PURE__ */ new Date();
10924
- const todayIndex = getDatesDiff(today2, startDate, viewMode);
10926
+ const today = /* @__PURE__ */ new Date();
10927
+ const todayIndex = getDatesDiff(today, startDate, viewMode);
10925
10928
  const extraMultiplier = () => {
10926
10929
  switch (viewMode) {
10927
10930
  case ViewMode.Week: {
10928
- const percent = today2.getDay() / 7;
10931
+ const percent = today.getDay() / 7;
10929
10932
  return 1 + percent * 0.2;
10930
10933
  }
10931
10934
  case ViewMode.Month: {
10932
- const dayInMonth = today2.getDate();
10935
+ const dayInMonth = today.getDate();
10933
10936
  const maxDaysInMonth = getDaysInMonth(
10934
- today2.getMonth(),
10935
- today2.getFullYear()
10937
+ today.getMonth(),
10938
+ today.getFullYear()
10936
10939
  );
10937
10940
  const percent = dayInMonth / maxDaysInMonth;
10938
10941
  return 1 + percent * 0.5;
10939
10942
  }
10940
10943
  case ViewMode.Year: {
10941
- const percent = today2.getMonth() / 12;
10944
+ const percent = today.getMonth() / 12;
10942
10945
  return 1 + percent * 0.5;
10943
10946
  }
10944
10947
  default:
@@ -10976,9 +10979,88 @@ const GanttTodayInner = ({
10976
10979
  isUnknownDates,
10977
10980
  rtl,
10978
10981
  startDate,
10979
- viewMode
10982
+ viewMode,
10983
+ showTodayLine
10984
+ ]);
10985
+ const dataDateElement = useMemo(() => {
10986
+ if (!showDataDateLine || !dataDate) {
10987
+ return null;
10988
+ }
10989
+ const dataIndex = getDatesDiff(dataDate, startDate, viewMode);
10990
+ const extraMultiplier = () => {
10991
+ switch (viewMode) {
10992
+ case ViewMode.Week: {
10993
+ const percent = dataDate.getDay() / 7;
10994
+ return 1 + percent * 0.2;
10995
+ }
10996
+ case ViewMode.Month: {
10997
+ const dayInMonth = dataDate.getDate();
10998
+ const maxDaysInMonth = getDaysInMonth(
10999
+ dataDate.getMonth(),
11000
+ dataDate.getFullYear()
11001
+ );
11002
+ const percent = dayInMonth / maxDaysInMonth;
11003
+ return 1 + percent * 0.5;
11004
+ }
11005
+ case ViewMode.Year: {
11006
+ const percent = dataDate.getMonth() / 12;
11007
+ return 1 + percent * 0.5;
11008
+ }
11009
+ default:
11010
+ return 1;
11011
+ }
11012
+ };
11013
+ const tickX = dataIndex * columnWidth * extraMultiplier();
11014
+ const x = rtl ? tickX + columnWidth : tickX;
11015
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
11016
+ /* @__PURE__ */ jsx(
11017
+ "rect",
11018
+ {
11019
+ x: additionalLeftSpace + x,
11020
+ y: 0,
11021
+ width: 2,
11022
+ height: ganttFullHeight,
11023
+ fill: "var(--gantt-calendar-today-color)",
11024
+ opacity: 0.9
11025
+ }
11026
+ ),
11027
+ /* @__PURE__ */ jsx(
11028
+ "circle",
11029
+ {
11030
+ className: styles$c.ganttTodayCircle,
11031
+ cx: x + 1,
11032
+ cy: 6,
11033
+ r: 6,
11034
+ fill: "var(--gantt-calendar-today-color)"
11035
+ }
11036
+ ),
11037
+ /* @__PURE__ */ jsx(
11038
+ "text",
11039
+ {
11040
+ x: additionalLeftSpace + x + 8,
11041
+ y: 6,
11042
+ dy: 2,
11043
+ fill: "var(--gantt-calendar-today-color)",
11044
+ fontSize: 12,
11045
+ fontWeight: 600,
11046
+ children: "Data Date"
11047
+ }
11048
+ )
11049
+ ] });
11050
+ }, [
11051
+ additionalLeftSpace,
11052
+ columnWidth,
11053
+ ganttFullHeight,
11054
+ rtl,
11055
+ startDate,
11056
+ viewMode,
11057
+ showDataDateLine,
11058
+ dataDate
10980
11059
  ]);
10981
- return /* @__PURE__ */ jsx("g", { className: "today", children: today });
11060
+ return /* @__PURE__ */ jsxs("g", { className: "today", children: [
11061
+ dataDateElement,
11062
+ todayElement
11063
+ ] });
10982
11064
  };
10983
11065
  const GanttToday = memo(GanttTodayInner);
10984
11066
  const calendarBottomText = "_calendarBottomText_15t8b_1";
@@ -12668,7 +12750,19 @@ const styles$3 = {
12668
12750
  barComparison
12669
12751
  };
12670
12752
  const BarComparison = (props) => {
12671
- const { yOffset, borderHeight, barCornerRadius, isWarning, isPlan, isCritical, width, height, inProgress } = props;
12753
+ const {
12754
+ yOffset,
12755
+ borderHeight,
12756
+ barCornerRadius,
12757
+ isWarning,
12758
+ isPlan,
12759
+ isCritical,
12760
+ width,
12761
+ height,
12762
+ inProgress,
12763
+ task,
12764
+ onTooltipTask
12765
+ } = props;
12672
12766
  const lineHeight = useMemo(() => Math.max(height, 4), [height]);
12673
12767
  const barColor = useMemo(() => {
12674
12768
  if (inProgress) {
@@ -12685,41 +12779,54 @@ const BarComparison = (props) => {
12685
12779
  }
12686
12780
  return "var(--gantt-bar-comparison-default-color)";
12687
12781
  }, [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
- ] });
12782
+ return /* @__PURE__ */ jsxs(
12783
+ "g",
12784
+ {
12785
+ onMouseEnter: (e) => {
12786
+ e.stopPropagation();
12787
+ onTooltipTask && onTooltipTask(task || null, e.currentTarget);
12788
+ },
12789
+ onMouseLeave: (e) => {
12790
+ e.stopPropagation();
12791
+ onTooltipTask && onTooltipTask(null, null);
12792
+ },
12793
+ children: [
12794
+ /* @__PURE__ */ jsx(
12795
+ "rect",
12796
+ {
12797
+ x: 0,
12798
+ width,
12799
+ y: borderHeight + yOffset,
12800
+ height: lineHeight,
12801
+ ry: barCornerRadius,
12802
+ rx: barCornerRadius,
12803
+ fill: barColor,
12804
+ className: styles$3.barComparison
12805
+ }
12806
+ ),
12807
+ /* @__PURE__ */ jsx(
12808
+ "rect",
12809
+ {
12810
+ x: 0,
12811
+ fill: barColor,
12812
+ y: yOffset,
12813
+ width: height,
12814
+ height: borderHeight + lineHeight - yOffset
12815
+ }
12816
+ ),
12817
+ !inProgress && /* @__PURE__ */ jsx(
12818
+ "rect",
12819
+ {
12820
+ x: width - height,
12821
+ fill: barColor,
12822
+ y: yOffset,
12823
+ width: height,
12824
+ height: borderHeight + lineHeight - yOffset
12825
+ }
12826
+ )
12827
+ ]
12828
+ }
12829
+ );
12723
12830
  };
12724
12831
  const DELTA_RELATION_WIDTH = 100;
12725
12832
  const TaskGanttContentInner = (props) => {
@@ -12914,14 +13021,16 @@ const TaskGanttContentInner = (props) => {
12914
13021
  BarComparison,
12915
13022
  {
12916
13023
  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()),
13024
+ 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
13025
  isWarning: !!task.comparisonDates.end && task.comparisonDates.end.getTime() >= task.end.getTime(),
12919
13026
  isCritical: task.comparisonDates.start.getTime() > task.start.getTime(),
12920
13027
  barCornerRadius: distances.barCornerRadius,
12921
13028
  height: comparisonDates.height,
12922
13029
  width: comparisonDates.width,
12923
13030
  borderHeight: distances.barComparisonTaskBorderHeight,
12924
- yOffset: distances.barComparisonTaskYOffset
13031
+ yOffset: distances.barComparisonTaskYOffset,
13032
+ task,
13033
+ onTooltipTask
12925
13034
  }
12926
13035
  )
12927
13036
  },
@@ -18536,14 +18645,25 @@ const Gantt = (props) => {
18536
18645
  viewDate,
18537
18646
  viewMode = ViewMode.Day,
18538
18647
  locale: clientLocale,
18539
- language
18648
+ language,
18649
+ rowHeight,
18650
+ showTodayLine = true,
18651
+ showDataDateLine = false,
18652
+ dataDate = null
18540
18653
  } = props;
18541
18654
  const ganttSVGRef = useRef(null);
18542
18655
  const wrapperRef = useRef(null);
18543
18656
  const taskListRef = useRef(null);
18544
18657
  const locale = useMemo(() => clientLocale ?? GANTT_EN_LOCALE, [clientLocale]);
18545
18658
  const theme = useMemo(() => buildGanttTheme(clientTheme), [clientTheme]);
18546
- const { distances, dateFormats: dateFormats2, rtl } = theme;
18659
+ const { dateFormats: dateFormats2, rtl } = theme;
18660
+ const distances = useMemo(
18661
+ () => ({
18662
+ ...theme.distances,
18663
+ rowHeight: rowHeight ?? theme.distances.rowHeight
18664
+ }),
18665
+ [theme, rowHeight]
18666
+ );
18547
18667
  const [waitCommitTasks, setWaitCommitTasks] = useState(false);
18548
18668
  const taskBar = useMemo(() => {
18549
18669
  return mergeDeepObj(
@@ -18961,20 +19081,20 @@ const Gantt = (props) => {
18961
19081
  horizontalContainerRef
18962
19082
  ]);
18963
19083
  const handleKeyDown = (event) => {
18964
- const { columnWidth, rowHeight } = distances;
19084
+ const { columnWidth, rowHeight: rowHeight2 } = distances;
18965
19085
  let newScrollY = scrollY;
18966
19086
  let newScrollX = scrollX;
18967
19087
  let isX = true;
18968
19088
  switch (event.key) {
18969
19089
  case "Down":
18970
19090
  case "ArrowDown":
18971
- newScrollY += rowHeight;
19091
+ newScrollY += rowHeight2;
18972
19092
  isX = false;
18973
19093
  event.preventDefault();
18974
19094
  break;
18975
19095
  case "Up":
18976
19096
  case "ArrowUp":
18977
- newScrollY -= rowHeight;
19097
+ newScrollY -= rowHeight2;
18978
19098
  isX = false;
18979
19099
  event.preventDefault();
18980
19100
  break;
@@ -19666,7 +19786,10 @@ const Gantt = (props) => {
19666
19786
  isUnknownDates,
19667
19787
  rtl,
19668
19788
  startDate,
19669
- viewMode
19789
+ viewMode,
19790
+ showTodayLine,
19791
+ showDataDateLine,
19792
+ dataDate
19670
19793
  }),
19671
19794
  [
19672
19795
  additionalLeftSpace,
@@ -19675,7 +19798,10 @@ const Gantt = (props) => {
19675
19798
  isUnknownDates,
19676
19799
  rtl,
19677
19800
  startDate,
19678
- viewMode
19801
+ viewMode,
19802
+ showTodayLine,
19803
+ showDataDateLine,
19804
+ dataDate
19679
19805
  ]
19680
19806
  );
19681
19807
  const calendarProps = useMemo(
@@ -10931,31 +10931,34 @@
10931
10931
  isUnknownDates,
10932
10932
  rtl,
10933
10933
  startDate,
10934
- viewMode
10934
+ viewMode,
10935
+ showTodayLine = true,
10936
+ showDataDateLine = false,
10937
+ dataDate = null
10935
10938
  }) => {
10936
- const today = React.useMemo(() => {
10937
- if (isUnknownDates) {
10939
+ const todayElement = React.useMemo(() => {
10940
+ if (isUnknownDates || !showTodayLine) {
10938
10941
  return null;
10939
10942
  }
10940
- const today2 = /* @__PURE__ */ new Date();
10941
- const todayIndex = getDatesDiff(today2, startDate, viewMode);
10943
+ const today = /* @__PURE__ */ new Date();
10944
+ const todayIndex = getDatesDiff(today, startDate, viewMode);
10942
10945
  const extraMultiplier = () => {
10943
10946
  switch (viewMode) {
10944
10947
  case ViewMode.Week: {
10945
- const percent = today2.getDay() / 7;
10948
+ const percent = today.getDay() / 7;
10946
10949
  return 1 + percent * 0.2;
10947
10950
  }
10948
10951
  case ViewMode.Month: {
10949
- const dayInMonth = today2.getDate();
10952
+ const dayInMonth = today.getDate();
10950
10953
  const maxDaysInMonth = getDaysInMonth(
10951
- today2.getMonth(),
10952
- today2.getFullYear()
10954
+ today.getMonth(),
10955
+ today.getFullYear()
10953
10956
  );
10954
10957
  const percent = dayInMonth / maxDaysInMonth;
10955
10958
  return 1 + percent * 0.5;
10956
10959
  }
10957
10960
  case ViewMode.Year: {
10958
- const percent = today2.getMonth() / 12;
10961
+ const percent = today.getMonth() / 12;
10959
10962
  return 1 + percent * 0.5;
10960
10963
  }
10961
10964
  default:
@@ -10993,9 +10996,88 @@
10993
10996
  isUnknownDates,
10994
10997
  rtl,
10995
10998
  startDate,
10996
- viewMode
10999
+ viewMode,
11000
+ showTodayLine
11001
+ ]);
11002
+ const dataDateElement = React.useMemo(() => {
11003
+ if (!showDataDateLine || !dataDate) {
11004
+ return null;
11005
+ }
11006
+ const dataIndex = getDatesDiff(dataDate, startDate, viewMode);
11007
+ const extraMultiplier = () => {
11008
+ switch (viewMode) {
11009
+ case ViewMode.Week: {
11010
+ const percent = dataDate.getDay() / 7;
11011
+ return 1 + percent * 0.2;
11012
+ }
11013
+ case ViewMode.Month: {
11014
+ const dayInMonth = dataDate.getDate();
11015
+ const maxDaysInMonth = getDaysInMonth(
11016
+ dataDate.getMonth(),
11017
+ dataDate.getFullYear()
11018
+ );
11019
+ const percent = dayInMonth / maxDaysInMonth;
11020
+ return 1 + percent * 0.5;
11021
+ }
11022
+ case ViewMode.Year: {
11023
+ const percent = dataDate.getMonth() / 12;
11024
+ return 1 + percent * 0.5;
11025
+ }
11026
+ default:
11027
+ return 1;
11028
+ }
11029
+ };
11030
+ const tickX = dataIndex * columnWidth * extraMultiplier();
11031
+ const x = rtl ? tickX + columnWidth : tickX;
11032
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11033
+ /* @__PURE__ */ jsxRuntime.jsx(
11034
+ "rect",
11035
+ {
11036
+ x: additionalLeftSpace + x,
11037
+ y: 0,
11038
+ width: 2,
11039
+ height: ganttFullHeight,
11040
+ fill: "var(--gantt-calendar-today-color)",
11041
+ opacity: 0.9
11042
+ }
11043
+ ),
11044
+ /* @__PURE__ */ jsxRuntime.jsx(
11045
+ "circle",
11046
+ {
11047
+ className: styles$c.ganttTodayCircle,
11048
+ cx: x + 1,
11049
+ cy: 6,
11050
+ r: 6,
11051
+ fill: "var(--gantt-calendar-today-color)"
11052
+ }
11053
+ ),
11054
+ /* @__PURE__ */ jsxRuntime.jsx(
11055
+ "text",
11056
+ {
11057
+ x: additionalLeftSpace + x + 8,
11058
+ y: 6,
11059
+ dy: 2,
11060
+ fill: "var(--gantt-calendar-today-color)",
11061
+ fontSize: 12,
11062
+ fontWeight: 600,
11063
+ children: "Data Date"
11064
+ }
11065
+ )
11066
+ ] });
11067
+ }, [
11068
+ additionalLeftSpace,
11069
+ columnWidth,
11070
+ ganttFullHeight,
11071
+ rtl,
11072
+ startDate,
11073
+ viewMode,
11074
+ showDataDateLine,
11075
+ dataDate
10997
11076
  ]);
10998
- return /* @__PURE__ */ jsxRuntime.jsx("g", { className: "today", children: today });
11077
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { className: "today", children: [
11078
+ dataDateElement,
11079
+ todayElement
11080
+ ] });
10999
11081
  };
11000
11082
  const GanttToday = React.memo(GanttTodayInner);
11001
11083
  const calendarBottomText = "_calendarBottomText_15t8b_1";
@@ -12685,7 +12767,19 @@
12685
12767
  barComparison
12686
12768
  };
12687
12769
  const BarComparison = (props) => {
12688
- const { yOffset, borderHeight, barCornerRadius, isWarning, isPlan, isCritical, width, height, inProgress } = props;
12770
+ const {
12771
+ yOffset,
12772
+ borderHeight,
12773
+ barCornerRadius,
12774
+ isWarning,
12775
+ isPlan,
12776
+ isCritical,
12777
+ width,
12778
+ height,
12779
+ inProgress,
12780
+ task,
12781
+ onTooltipTask
12782
+ } = props;
12689
12783
  const lineHeight = React.useMemo(() => Math.max(height, 4), [height]);
12690
12784
  const barColor = React.useMemo(() => {
12691
12785
  if (inProgress) {
@@ -12702,41 +12796,54 @@
12702
12796
  }
12703
12797
  return "var(--gantt-bar-comparison-default-color)";
12704
12798
  }, [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
- ] });
12799
+ return /* @__PURE__ */ jsxRuntime.jsxs(
12800
+ "g",
12801
+ {
12802
+ onMouseEnter: (e) => {
12803
+ e.stopPropagation();
12804
+ onTooltipTask && onTooltipTask(task || null, e.currentTarget);
12805
+ },
12806
+ onMouseLeave: (e) => {
12807
+ e.stopPropagation();
12808
+ onTooltipTask && onTooltipTask(null, null);
12809
+ },
12810
+ children: [
12811
+ /* @__PURE__ */ jsxRuntime.jsx(
12812
+ "rect",
12813
+ {
12814
+ x: 0,
12815
+ width,
12816
+ y: borderHeight + yOffset,
12817
+ height: lineHeight,
12818
+ ry: barCornerRadius,
12819
+ rx: barCornerRadius,
12820
+ fill: barColor,
12821
+ className: styles$3.barComparison
12822
+ }
12823
+ ),
12824
+ /* @__PURE__ */ jsxRuntime.jsx(
12825
+ "rect",
12826
+ {
12827
+ x: 0,
12828
+ fill: barColor,
12829
+ y: yOffset,
12830
+ width: height,
12831
+ height: borderHeight + lineHeight - yOffset
12832
+ }
12833
+ ),
12834
+ !inProgress && /* @__PURE__ */ jsxRuntime.jsx(
12835
+ "rect",
12836
+ {
12837
+ x: width - height,
12838
+ fill: barColor,
12839
+ y: yOffset,
12840
+ width: height,
12841
+ height: borderHeight + lineHeight - yOffset
12842
+ }
12843
+ )
12844
+ ]
12845
+ }
12846
+ );
12740
12847
  };
12741
12848
  const DELTA_RELATION_WIDTH = 100;
12742
12849
  const TaskGanttContentInner = (props) => {
@@ -12931,14 +13038,16 @@
12931
13038
  BarComparison,
12932
13039
  {
12933
13040
  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()),
13041
+ 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
13042
  isWarning: !!task.comparisonDates.end && task.comparisonDates.end.getTime() >= task.end.getTime(),
12936
13043
  isCritical: task.comparisonDates.start.getTime() > task.start.getTime(),
12937
13044
  barCornerRadius: distances.barCornerRadius,
12938
13045
  height: comparisonDates.height,
12939
13046
  width: comparisonDates.width,
12940
13047
  borderHeight: distances.barComparisonTaskBorderHeight,
12941
- yOffset: distances.barComparisonTaskYOffset
13048
+ yOffset: distances.barComparisonTaskYOffset,
13049
+ task,
13050
+ onTooltipTask
12942
13051
  }
12943
13052
  )
12944
13053
  },
@@ -18553,14 +18662,25 @@
18553
18662
  viewDate,
18554
18663
  viewMode = ViewMode.Day,
18555
18664
  locale: clientLocale,
18556
- language
18665
+ language,
18666
+ rowHeight,
18667
+ showTodayLine = true,
18668
+ showDataDateLine = false,
18669
+ dataDate = null
18557
18670
  } = props;
18558
18671
  const ganttSVGRef = React.useRef(null);
18559
18672
  const wrapperRef = React.useRef(null);
18560
18673
  const taskListRef = React.useRef(null);
18561
18674
  const locale = React.useMemo(() => clientLocale ?? GANTT_EN_LOCALE, [clientLocale]);
18562
18675
  const theme = React.useMemo(() => buildGanttTheme(clientTheme), [clientTheme]);
18563
- const { distances, dateFormats: dateFormats2, rtl } = theme;
18676
+ const { dateFormats: dateFormats2, rtl } = theme;
18677
+ const distances = React.useMemo(
18678
+ () => ({
18679
+ ...theme.distances,
18680
+ rowHeight: rowHeight ?? theme.distances.rowHeight
18681
+ }),
18682
+ [theme, rowHeight]
18683
+ );
18564
18684
  const [waitCommitTasks, setWaitCommitTasks] = React.useState(false);
18565
18685
  const taskBar = React.useMemo(() => {
18566
18686
  return mergeDeepObj(
@@ -18978,20 +19098,20 @@
18978
19098
  horizontalContainerRef
18979
19099
  ]);
18980
19100
  const handleKeyDown = (event) => {
18981
- const { columnWidth, rowHeight } = distances;
19101
+ const { columnWidth, rowHeight: rowHeight2 } = distances;
18982
19102
  let newScrollY = scrollY;
18983
19103
  let newScrollX = scrollX;
18984
19104
  let isX = true;
18985
19105
  switch (event.key) {
18986
19106
  case "Down":
18987
19107
  case "ArrowDown":
18988
- newScrollY += rowHeight;
19108
+ newScrollY += rowHeight2;
18989
19109
  isX = false;
18990
19110
  event.preventDefault();
18991
19111
  break;
18992
19112
  case "Up":
18993
19113
  case "ArrowUp":
18994
- newScrollY -= rowHeight;
19114
+ newScrollY -= rowHeight2;
18995
19115
  isX = false;
18996
19116
  event.preventDefault();
18997
19117
  break;
@@ -19683,7 +19803,10 @@
19683
19803
  isUnknownDates,
19684
19804
  rtl,
19685
19805
  startDate,
19686
- viewMode
19806
+ viewMode,
19807
+ showTodayLine,
19808
+ showDataDateLine,
19809
+ dataDate
19687
19810
  }),
19688
19811
  [
19689
19812
  additionalLeftSpace,
@@ -19692,7 +19815,10 @@
19692
19815
  isUnknownDates,
19693
19816
  rtl,
19694
19817
  startDate,
19695
- viewMode
19818
+ viewMode,
19819
+ showTodayLine,
19820
+ showDataDateLine,
19821
+ dataDate
19696
19822
  ]
19697
19823
  );
19698
19824
  const calendarProps = React.useMemo(
@@ -320,6 +320,22 @@ export interface GanttProps {
320
320
  * Move dates of tasks to working days during change
321
321
  */
322
322
  isAdjustToWorkingDates?: boolean;
323
+ /**
324
+ * Force row height (in pixels) for each single row. If not provided theme distances.rowHeight is used.
325
+ */
326
+ rowHeight?: number;
327
+ /**
328
+ * Show vertical line for current day on the chart
329
+ */
330
+ showTodayLine?: boolean;
331
+ /**
332
+ * Show vertical line for a custom 'data date' on the chart
333
+ */
334
+ showDataDateLine?: boolean;
335
+ /**
336
+ * Custom date to render as data date line when `showDataDateLine` is true
337
+ */
338
+ dataDate?: Date | null;
323
339
  }
324
340
  export interface GanttTaskBarActions {
325
341
  allowMoveTaskBar?: (action: TaskBarMoveAction, task: RenderTask) => boolean;
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.47",
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",