gantt-task-react-v 1.0.47 → 1.0.48

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.
@@ -14,6 +14,26 @@ export interface TaskGanttContentProps extends GanttTaskBarActions {
14
14
  distances: Distances;
15
15
  endColumnIndex: number;
16
16
  fullRowHeight: number;
17
+ /**
18
+ * Absolute X coordinate of data date in the main SVG (including additionalLeftSpace), or undefined
19
+ */
20
+ dataDateX?: number | null;
21
+ splitbarColors?: {
22
+ task?: {
23
+ onTime?: string;
24
+ delayed?: string;
25
+ };
26
+ project?: {
27
+ onTime?: string;
28
+ delayed?: string;
29
+ };
30
+ comparison?: {
31
+ onTime?: string;
32
+ delayed?: string;
33
+ };
34
+ } | null;
35
+ showProgressBar?: boolean;
36
+ progressBarColor?: string;
17
37
  ganttRelationEvent: GanttRelationEvent | null;
18
38
  getDate: (index: number) => Date;
19
39
  getTaskCoordinates: (task: Task) => TaskCoordinates;
@@ -11,5 +11,9 @@ export type GanttTodayProps = {
11
11
  showTodayLine?: boolean;
12
12
  showDataDateLine?: boolean;
13
13
  dataDate?: Date | null;
14
+ todayColor?: string | null;
15
+ dataDateColor?: string | null;
16
+ todayLabel?: string;
17
+ dataDateLabel?: string;
14
18
  };
15
19
  export declare const GanttToday: React.NamedExoticComponent<GanttTodayProps>;
@@ -14,6 +14,23 @@ type BarDisplayProps = {
14
14
  x: number;
15
15
  y: number;
16
16
  customStyle?: CSSProperties;
17
+ dataDateX?: number | null;
18
+ splitbarColors?: {
19
+ task?: {
20
+ onTime?: string;
21
+ delayed?: string;
22
+ };
23
+ project?: {
24
+ onTime?: string;
25
+ delayed?: string;
26
+ };
27
+ comparison?: {
28
+ onTime?: string;
29
+ delayed?: string;
30
+ };
31
+ } | null;
32
+ showProgressBar?: boolean;
33
+ progressBarColor?: string;
17
34
  };
18
35
  export declare const BarDisplay: React.FC<BarDisplayProps>;
19
36
  export {};
@@ -15,6 +15,23 @@ type ProjectDisplayProps = {
15
15
  x1: number;
16
16
  x2: number;
17
17
  customStyle?: CSSProperties;
18
+ dataDateX?: number | null;
19
+ splitbarColors?: {
20
+ task?: {
21
+ onTime?: string;
22
+ delayed?: string;
23
+ };
24
+ project?: {
25
+ onTime?: string;
26
+ delayed?: string;
27
+ };
28
+ comparison?: {
29
+ onTime?: string;
30
+ delayed?: string;
31
+ };
32
+ } | null;
33
+ showProgressBar?: boolean;
34
+ progressBarColor?: string;
18
35
  };
19
36
  export declare const ProjectDisplay: React.FC<ProjectDisplayProps>;
20
37
  export {};
@@ -13,6 +13,23 @@ export interface TaskItemProps extends Omit<GanttTaskBarActions, "taskBarMovingA
13
13
  distances: Distances;
14
14
  taskHeight: number;
15
15
  taskHalfHeight: number;
16
+ dataDateX?: number | null;
17
+ splitbarColors?: {
18
+ task?: {
19
+ onTime?: string;
20
+ delayed?: string;
21
+ };
22
+ project?: {
23
+ onTime?: string;
24
+ delayed?: string;
25
+ };
26
+ comparison?: {
27
+ onTime?: string;
28
+ delayed?: string;
29
+ };
30
+ } | null;
31
+ showProgressBar?: boolean;
32
+ progressBarColor?: string;
16
33
  authorizedRelations: RelationKind[];
17
34
  ganttRelationEvent: GanttRelationEvent;
18
35
  canDelete: boolean;
@@ -10917,7 +10917,11 @@ const GanttTodayInner = ({
10917
10917
  viewMode,
10918
10918
  showTodayLine = true,
10919
10919
  showDataDateLine = false,
10920
- dataDate = null
10920
+ dataDate = null,
10921
+ todayColor = null,
10922
+ dataDateColor = null,
10923
+ todayLabel = "Today",
10924
+ dataDateLabel = "Data Date"
10921
10925
  }) => {
10922
10926
  const todayElement = useMemo(() => {
10923
10927
  if (isUnknownDates || !showTodayLine) {
@@ -10950,6 +10954,7 @@ const GanttTodayInner = ({
10950
10954
  };
10951
10955
  const tickX = todayIndex * columnWidth * extraMultiplier();
10952
10956
  const x = rtl ? tickX + columnWidth : tickX;
10957
+ const color = todayColor || "var(--gantt-calendar-today-color)";
10953
10958
  return /* @__PURE__ */ jsxs(Fragment, { children: [
10954
10959
  /* @__PURE__ */ jsx(
10955
10960
  "rect",
@@ -10958,7 +10963,7 @@ const GanttTodayInner = ({
10958
10963
  y: 0,
10959
10964
  width: 2,
10960
10965
  height: ganttFullHeight,
10961
- fill: "var(--gantt-calendar-today-color)"
10966
+ fill: color
10962
10967
  }
10963
10968
  ),
10964
10969
  /* @__PURE__ */ jsx(
@@ -10968,7 +10973,18 @@ const GanttTodayInner = ({
10968
10973
  cx: x + 1,
10969
10974
  cy: 6,
10970
10975
  r: 6,
10971
- fill: "var(--gantt-calendar-today-color)"
10976
+ fill: color
10977
+ }
10978
+ ),
10979
+ /* @__PURE__ */ jsx(
10980
+ "text",
10981
+ {
10982
+ x: additionalLeftSpace + x + 8,
10983
+ y: 10,
10984
+ fill: color,
10985
+ fontSize: 12,
10986
+ fontWeight: 600,
10987
+ children: todayLabel
10972
10988
  }
10973
10989
  )
10974
10990
  ] });
@@ -10980,7 +10996,9 @@ const GanttTodayInner = ({
10980
10996
  rtl,
10981
10997
  startDate,
10982
10998
  viewMode,
10983
- showTodayLine
10999
+ showTodayLine,
11000
+ todayColor,
11001
+ todayLabel
10984
11002
  ]);
10985
11003
  const dataDateElement = useMemo(() => {
10986
11004
  if (!showDataDateLine || !dataDate) {
@@ -11012,6 +11030,7 @@ const GanttTodayInner = ({
11012
11030
  };
11013
11031
  const tickX = dataIndex * columnWidth * extraMultiplier();
11014
11032
  const x = rtl ? tickX + columnWidth : tickX;
11033
+ const color = dataDateColor || "var(--gantt-calendar-today-color)";
11015
11034
  return /* @__PURE__ */ jsxs(Fragment, { children: [
11016
11035
  /* @__PURE__ */ jsx(
11017
11036
  "rect",
@@ -11020,7 +11039,7 @@ const GanttTodayInner = ({
11020
11039
  y: 0,
11021
11040
  width: 2,
11022
11041
  height: ganttFullHeight,
11023
- fill: "var(--gantt-calendar-today-color)",
11042
+ fill: color,
11024
11043
  opacity: 0.9
11025
11044
  }
11026
11045
  ),
@@ -11031,19 +11050,18 @@ const GanttTodayInner = ({
11031
11050
  cx: x + 1,
11032
11051
  cy: 6,
11033
11052
  r: 6,
11034
- fill: "var(--gantt-calendar-today-color)"
11053
+ fill: color
11035
11054
  }
11036
11055
  ),
11037
11056
  /* @__PURE__ */ jsx(
11038
11057
  "text",
11039
11058
  {
11040
11059
  x: additionalLeftSpace + x + 8,
11041
- y: 6,
11042
- dy: 2,
11043
- fill: "var(--gantt-calendar-today-color)",
11060
+ y: 10,
11061
+ fill: color,
11044
11062
  fontSize: 12,
11045
11063
  fontWeight: 600,
11046
- children: "Data Date"
11064
+ children: dataDateLabel || "Data Date"
11047
11065
  }
11048
11066
  )
11049
11067
  ] });
@@ -11055,7 +11073,9 @@ const GanttTodayInner = ({
11055
11073
  startDate,
11056
11074
  viewMode,
11057
11075
  showDataDateLine,
11058
- dataDate
11076
+ dataDate,
11077
+ dataDateColor,
11078
+ dataDateLabel
11059
11079
  ]);
11060
11080
  return /* @__PURE__ */ jsxs("g", { className: "today", children: [
11061
11081
  dataDateElement,
@@ -11973,7 +11993,11 @@ const BarDisplay = ({
11973
11993
  width,
11974
11994
  x,
11975
11995
  y,
11976
- customStyle
11996
+ customStyle,
11997
+ dataDateX,
11998
+ splitbarColors,
11999
+ showProgressBar = true,
12000
+ progressBarColor
11977
12001
  }) => {
11978
12002
  return /* @__PURE__ */ jsxs(
11979
12003
  "g",
@@ -11992,7 +12016,40 @@ const BarDisplay = ({
11992
12016
  }
11993
12017
  },
11994
12018
  children: [
11995
- /* @__PURE__ */ jsx(
12019
+ typeof dataDateX === "number" ? (() => {
12020
+ var _a, _b;
12021
+ const localSplit = Math.max(0, Math.min(width, dataDateX - x));
12022
+ const leftFill = ((_a = splitbarColors == null ? void 0 : splitbarColors.task) == null ? void 0 : _a.onTime) || "var(--gantt-bar-background-color)";
12023
+ const rightFill = ((_b = splitbarColors == null ? void 0 : splitbarColors.task) == null ? void 0 : _b.delayed) || "var(--gantt-bar-background-color)";
12024
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
12025
+ /* @__PURE__ */ jsx(
12026
+ "rect",
12027
+ {
12028
+ x,
12029
+ width: localSplit,
12030
+ y,
12031
+ height,
12032
+ ry: barCornerRadius,
12033
+ rx: barCornerRadius,
12034
+ fill: leftFill,
12035
+ className: styles$8.barBackground
12036
+ }
12037
+ ),
12038
+ /* @__PURE__ */ jsx(
12039
+ "rect",
12040
+ {
12041
+ x: x + localSplit,
12042
+ width: Math.max(0, width - localSplit),
12043
+ y,
12044
+ height,
12045
+ ry: barCornerRadius,
12046
+ rx: barCornerRadius,
12047
+ fill: rightFill,
12048
+ className: styles$8.barBackground
12049
+ }
12050
+ )
12051
+ ] });
12052
+ })() : /* @__PURE__ */ jsx(
11996
12053
  "rect",
11997
12054
  {
11998
12055
  x,
@@ -12005,7 +12062,7 @@ const BarDisplay = ({
12005
12062
  className: styles$8.barBackground
12006
12063
  }
12007
12064
  ),
12008
- /* @__PURE__ */ jsx(
12065
+ showProgressBar && /* @__PURE__ */ jsx(
12009
12066
  "rect",
12010
12067
  {
12011
12068
  x: progressX,
@@ -12014,7 +12071,7 @@ const BarDisplay = ({
12014
12071
  height,
12015
12072
  ry: barCornerRadius,
12016
12073
  rx: barCornerRadius,
12017
- fill: "unset"
12074
+ fill: progressBarColor || "var(--gantt-bar-progress-color)"
12018
12075
  }
12019
12076
  )
12020
12077
  ]
@@ -12078,7 +12135,11 @@ const ProjectDisplay = ({
12078
12135
  x1,
12079
12136
  x2,
12080
12137
  startMoveFullTask,
12081
- customStyle
12138
+ customStyle,
12139
+ dataDateX,
12140
+ splitbarColors,
12141
+ showProgressBar = true,
12142
+ progressBarColor
12082
12143
  }) => {
12083
12144
  const projectLeftTriangle = [
12084
12145
  x1,
@@ -12113,7 +12174,40 @@ const ProjectDisplay = ({
12113
12174
  },
12114
12175
  className: styles$7.projectWrapper,
12115
12176
  children: [
12116
- /* @__PURE__ */ jsx(
12177
+ typeof dataDateX === "number" ? (() => {
12178
+ var _a, _b;
12179
+ const localSplit = Math.max(0, Math.min(width, dataDateX - x1));
12180
+ const leftFill = ((_a = splitbarColors == null ? void 0 : splitbarColors.project) == null ? void 0 : _a.onTime) || "var(--gantt-project-background-color)";
12181
+ const rightFill = ((_b = splitbarColors == null ? void 0 : splitbarColors.project) == null ? void 0 : _b.delayed) || "var(--gantt-project-background-color)";
12182
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
12183
+ /* @__PURE__ */ jsx(
12184
+ "rect",
12185
+ {
12186
+ x: x1,
12187
+ width: localSplit,
12188
+ y: taskYOffset,
12189
+ height: taskHeight,
12190
+ rx: barCornerRadius,
12191
+ ry: barCornerRadius,
12192
+ className: styles$7.projectBackground,
12193
+ fill: leftFill
12194
+ }
12195
+ ),
12196
+ /* @__PURE__ */ jsx(
12197
+ "rect",
12198
+ {
12199
+ x: x1 + localSplit,
12200
+ width: Math.max(0, width - localSplit),
12201
+ y: taskYOffset,
12202
+ height: taskHeight,
12203
+ rx: barCornerRadius,
12204
+ ry: barCornerRadius,
12205
+ className: styles$7.projectBackground,
12206
+ fill: rightFill
12207
+ }
12208
+ )
12209
+ ] });
12210
+ })() : /* @__PURE__ */ jsx(
12117
12211
  "rect",
12118
12212
  {
12119
12213
  x: x1,
@@ -12126,7 +12220,7 @@ const ProjectDisplay = ({
12126
12220
  fill: "unset"
12127
12221
  }
12128
12222
  ),
12129
- /* @__PURE__ */ jsx(
12223
+ showProgressBar && /* @__PURE__ */ jsx(
12130
12224
  "rect",
12131
12225
  {
12132
12226
  x: progressX,
@@ -12135,7 +12229,7 @@ const ProjectDisplay = ({
12135
12229
  height: taskHeight,
12136
12230
  ry: barCornerRadius,
12137
12231
  rx: barCornerRadius,
12138
- fill: "unset"
12232
+ fill: progressBarColor || "var(--gantt-bar-progress-color)"
12139
12233
  }
12140
12234
  ),
12141
12235
  /* @__PURE__ */ jsx(
@@ -12234,7 +12328,11 @@ const Bar = (props) => {
12234
12328
  x1,
12235
12329
  x2,
12236
12330
  movingAction,
12237
- ganttRelationEvent
12331
+ ganttRelationEvent,
12332
+ dataDateX,
12333
+ splitbarColors,
12334
+ showProgressBar,
12335
+ progressBarColor
12238
12336
  } = props;
12239
12337
  useMemo(() => width < 30, [width]);
12240
12338
  const handleHeight = useMemo(() => taskHeight - 2, [taskHeight]);
@@ -12295,7 +12393,11 @@ const Bar = (props) => {
12295
12393
  isSelected,
12296
12394
  isCritical,
12297
12395
  hasChildren,
12298
- startMoveFullTask
12396
+ startMoveFullTask,
12397
+ dataDateX,
12398
+ splitbarColors,
12399
+ showProgressBar,
12400
+ progressBarColor
12299
12401
  }
12300
12402
  );
12301
12403
  } else {
@@ -12314,7 +12416,11 @@ const Bar = (props) => {
12314
12416
  isSelected,
12315
12417
  isCritical,
12316
12418
  hasChildren,
12317
- startMoveFullTask
12419
+ startMoveFullTask,
12420
+ dataDateX,
12421
+ splitbarColors,
12422
+ showProgressBar,
12423
+ progressBarColor
12318
12424
  }
12319
12425
  );
12320
12426
  }
@@ -12687,10 +12793,13 @@ const TaskItemInner = (props) => {
12687
12793
  },
12688
12794
  [onTooltipTask, task]
12689
12795
  );
12690
- const onMouseLeave = useCallback((event) => {
12691
- event.stopPropagation();
12692
- onTooltipTask(null, null);
12693
- }, [onTooltipTask]);
12796
+ const onMouseLeave = useCallback(
12797
+ (event) => {
12798
+ event.stopPropagation();
12799
+ onTooltipTask(null, null);
12800
+ },
12801
+ [onTooltipTask]
12802
+ );
12694
12803
  return /* @__PURE__ */ jsxs(
12695
12804
  "g",
12696
12805
  {
@@ -12869,7 +12978,11 @@ const TaskGanttContentInner = (props) => {
12869
12978
  renderCustomLabel,
12870
12979
  taskBarMovingAction,
12871
12980
  waitCommitTasks,
12872
- viewMode
12981
+ viewMode,
12982
+ dataDateX,
12983
+ splitbarColors,
12984
+ showProgressBar,
12985
+ progressBarColor
12873
12986
  } = props;
12874
12987
  const renderedHolidays = useMemo(() => {
12875
12988
  const { columnWidth } = distances;
@@ -12956,6 +13069,11 @@ const TaskGanttContentInner = (props) => {
12956
13069
  x2: taskX2,
12957
13070
  comparisonDates
12958
13071
  } = getTaskCoordinates2(task);
13072
+ const containerXAbs = Math.max(
13073
+ containerX + (additionalLeftSpace || 0),
13074
+ 0
13075
+ );
13076
+ const dataDateXLocal = typeof dataDateX === "number" ? dataDateX - containerXAbs : void 0;
12959
13077
  tasksRes.push(
12960
13078
  /* @__PURE__ */ jsx(
12961
13079
  "svg",
@@ -12999,7 +13117,11 @@ const TaskGanttContentInner = (props) => {
12999
13117
  rtl,
13000
13118
  onDeleteTask,
13001
13119
  renderCustomLabel,
13002
- viewMode
13120
+ viewMode,
13121
+ dataDateX: dataDateXLocal,
13122
+ splitbarColors,
13123
+ showProgressBar,
13124
+ progressBarColor
13003
13125
  }
13004
13126
  )
13005
13127
  },
@@ -13209,6 +13331,10 @@ const TaskGanttContentInner = (props) => {
13209
13331
  isDateChangeable,
13210
13332
  isRelationChangeable,
13211
13333
  visibleTasksMirror,
13334
+ dataDateX,
13335
+ splitbarColors,
13336
+ showProgressBar,
13337
+ progressBarColor,
13212
13338
  onArrowDoubleClick
13213
13339
  ]);
13214
13340
  return /* @__PURE__ */ jsxs("g", { className: "content", children: [
@@ -18649,7 +18775,14 @@ const Gantt = (props) => {
18649
18775
  rowHeight,
18650
18776
  showTodayLine = true,
18651
18777
  showDataDateLine = false,
18652
- dataDate = null
18778
+ dataDate = null,
18779
+ todayColor,
18780
+ dataDateColor,
18781
+ todayLabel = "Today",
18782
+ dataDateLabel = "Data Date",
18783
+ splitbarColors,
18784
+ showProgressBar = true,
18785
+ progressBarColor
18653
18786
  } = props;
18654
18787
  const ganttSVGRef = useRef(null);
18655
18788
  const wrapperRef = useRef(null);
@@ -19789,7 +19922,11 @@ const Gantt = (props) => {
19789
19922
  viewMode,
19790
19923
  showTodayLine,
19791
19924
  showDataDateLine,
19792
- dataDate
19925
+ dataDate,
19926
+ todayColor,
19927
+ dataDateColor,
19928
+ todayLabel,
19929
+ dataDateLabel
19793
19930
  }),
19794
19931
  [
19795
19932
  additionalLeftSpace,
@@ -19801,9 +19938,28 @@ const Gantt = (props) => {
19801
19938
  viewMode,
19802
19939
  showTodayLine,
19803
19940
  showDataDateLine,
19804
- dataDate
19941
+ dataDate,
19942
+ todayColor,
19943
+ dataDateColor,
19944
+ todayLabel,
19945
+ dataDateLabel
19805
19946
  ]
19806
19947
  );
19948
+ const dataDateX = useMemo(() => {
19949
+ if (!dataDate)
19950
+ return void 0;
19951
+ try {
19952
+ const x = taskXCoordinate(
19953
+ dataDate,
19954
+ startDate,
19955
+ viewMode,
19956
+ distances.columnWidth
19957
+ );
19958
+ return additionalLeftSpace + x;
19959
+ } catch {
19960
+ return void 0;
19961
+ }
19962
+ }, [dataDate, startDate, viewMode, distances, additionalLeftSpace]);
19807
19963
  const calendarProps = useMemo(
19808
19964
  () => ({
19809
19965
  additionalLeftSpace,
@@ -19837,6 +19993,11 @@ const Gantt = (props) => {
19837
19993
  const renderTaskBarProps = useMemo(
19838
19994
  () => ({
19839
19995
  ...taskBar,
19996
+ splitbarColors,
19997
+ dataDate,
19998
+ dataDateX,
19999
+ showProgressBar,
20000
+ progressBarColor,
19840
20001
  taskBarMovingAction: (task) => {
19841
20002
  var _a2;
19842
20003
  return task.id === ((_a2 = changeInProgress == null ? void 0 : changeInProgress.changedTask) == null ? void 0 : _a2.id) ? changeInProgress.action : null;
@@ -19877,6 +20038,11 @@ const Gantt = (props) => {
19877
20038
  [
19878
20039
  viewMode,
19879
20040
  taskBar,
20041
+ splitbarColors,
20042
+ dataDate,
20043
+ dataDateX,
20044
+ showProgressBar,
20045
+ progressBarColor,
19880
20046
  authorizedRelations,
19881
20047
  additionalLeftSpace,
19882
20048
  additionalRightSpace,
@@ -10934,7 +10934,11 @@
10934
10934
  viewMode,
10935
10935
  showTodayLine = true,
10936
10936
  showDataDateLine = false,
10937
- dataDate = null
10937
+ dataDate = null,
10938
+ todayColor = null,
10939
+ dataDateColor = null,
10940
+ todayLabel = "Today",
10941
+ dataDateLabel = "Data Date"
10938
10942
  }) => {
10939
10943
  const todayElement = React.useMemo(() => {
10940
10944
  if (isUnknownDates || !showTodayLine) {
@@ -10967,6 +10971,7 @@
10967
10971
  };
10968
10972
  const tickX = todayIndex * columnWidth * extraMultiplier();
10969
10973
  const x = rtl ? tickX + columnWidth : tickX;
10974
+ const color = todayColor || "var(--gantt-calendar-today-color)";
10970
10975
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10971
10976
  /* @__PURE__ */ jsxRuntime.jsx(
10972
10977
  "rect",
@@ -10975,7 +10980,7 @@
10975
10980
  y: 0,
10976
10981
  width: 2,
10977
10982
  height: ganttFullHeight,
10978
- fill: "var(--gantt-calendar-today-color)"
10983
+ fill: color
10979
10984
  }
10980
10985
  ),
10981
10986
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -10985,7 +10990,18 @@
10985
10990
  cx: x + 1,
10986
10991
  cy: 6,
10987
10992
  r: 6,
10988
- fill: "var(--gantt-calendar-today-color)"
10993
+ fill: color
10994
+ }
10995
+ ),
10996
+ /* @__PURE__ */ jsxRuntime.jsx(
10997
+ "text",
10998
+ {
10999
+ x: additionalLeftSpace + x + 8,
11000
+ y: 10,
11001
+ fill: color,
11002
+ fontSize: 12,
11003
+ fontWeight: 600,
11004
+ children: todayLabel
10989
11005
  }
10990
11006
  )
10991
11007
  ] });
@@ -10997,7 +11013,9 @@
10997
11013
  rtl,
10998
11014
  startDate,
10999
11015
  viewMode,
11000
- showTodayLine
11016
+ showTodayLine,
11017
+ todayColor,
11018
+ todayLabel
11001
11019
  ]);
11002
11020
  const dataDateElement = React.useMemo(() => {
11003
11021
  if (!showDataDateLine || !dataDate) {
@@ -11029,6 +11047,7 @@
11029
11047
  };
11030
11048
  const tickX = dataIndex * columnWidth * extraMultiplier();
11031
11049
  const x = rtl ? tickX + columnWidth : tickX;
11050
+ const color = dataDateColor || "var(--gantt-calendar-today-color)";
11032
11051
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11033
11052
  /* @__PURE__ */ jsxRuntime.jsx(
11034
11053
  "rect",
@@ -11037,7 +11056,7 @@
11037
11056
  y: 0,
11038
11057
  width: 2,
11039
11058
  height: ganttFullHeight,
11040
- fill: "var(--gantt-calendar-today-color)",
11059
+ fill: color,
11041
11060
  opacity: 0.9
11042
11061
  }
11043
11062
  ),
@@ -11048,19 +11067,18 @@
11048
11067
  cx: x + 1,
11049
11068
  cy: 6,
11050
11069
  r: 6,
11051
- fill: "var(--gantt-calendar-today-color)"
11070
+ fill: color
11052
11071
  }
11053
11072
  ),
11054
11073
  /* @__PURE__ */ jsxRuntime.jsx(
11055
11074
  "text",
11056
11075
  {
11057
11076
  x: additionalLeftSpace + x + 8,
11058
- y: 6,
11059
- dy: 2,
11060
- fill: "var(--gantt-calendar-today-color)",
11077
+ y: 10,
11078
+ fill: color,
11061
11079
  fontSize: 12,
11062
11080
  fontWeight: 600,
11063
- children: "Data Date"
11081
+ children: dataDateLabel || "Data Date"
11064
11082
  }
11065
11083
  )
11066
11084
  ] });
@@ -11072,7 +11090,9 @@
11072
11090
  startDate,
11073
11091
  viewMode,
11074
11092
  showDataDateLine,
11075
- dataDate
11093
+ dataDate,
11094
+ dataDateColor,
11095
+ dataDateLabel
11076
11096
  ]);
11077
11097
  return /* @__PURE__ */ jsxRuntime.jsxs("g", { className: "today", children: [
11078
11098
  dataDateElement,
@@ -11990,7 +12010,11 @@
11990
12010
  width,
11991
12011
  x,
11992
12012
  y,
11993
- customStyle
12013
+ customStyle,
12014
+ dataDateX,
12015
+ splitbarColors,
12016
+ showProgressBar = true,
12017
+ progressBarColor
11994
12018
  }) => {
11995
12019
  return /* @__PURE__ */ jsxRuntime.jsxs(
11996
12020
  "g",
@@ -12009,7 +12033,40 @@
12009
12033
  }
12010
12034
  },
12011
12035
  children: [
12012
- /* @__PURE__ */ jsxRuntime.jsx(
12036
+ typeof dataDateX === "number" ? (() => {
12037
+ var _a, _b;
12038
+ const localSplit = Math.max(0, Math.min(width, dataDateX - x));
12039
+ const leftFill = ((_a = splitbarColors == null ? void 0 : splitbarColors.task) == null ? void 0 : _a.onTime) || "var(--gantt-bar-background-color)";
12040
+ const rightFill = ((_b = splitbarColors == null ? void 0 : splitbarColors.task) == null ? void 0 : _b.delayed) || "var(--gantt-bar-background-color)";
12041
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
12042
+ /* @__PURE__ */ jsxRuntime.jsx(
12043
+ "rect",
12044
+ {
12045
+ x,
12046
+ width: localSplit,
12047
+ y,
12048
+ height,
12049
+ ry: barCornerRadius,
12050
+ rx: barCornerRadius,
12051
+ fill: leftFill,
12052
+ className: styles$8.barBackground
12053
+ }
12054
+ ),
12055
+ /* @__PURE__ */ jsxRuntime.jsx(
12056
+ "rect",
12057
+ {
12058
+ x: x + localSplit,
12059
+ width: Math.max(0, width - localSplit),
12060
+ y,
12061
+ height,
12062
+ ry: barCornerRadius,
12063
+ rx: barCornerRadius,
12064
+ fill: rightFill,
12065
+ className: styles$8.barBackground
12066
+ }
12067
+ )
12068
+ ] });
12069
+ })() : /* @__PURE__ */ jsxRuntime.jsx(
12013
12070
  "rect",
12014
12071
  {
12015
12072
  x,
@@ -12022,7 +12079,7 @@
12022
12079
  className: styles$8.barBackground
12023
12080
  }
12024
12081
  ),
12025
- /* @__PURE__ */ jsxRuntime.jsx(
12082
+ showProgressBar && /* @__PURE__ */ jsxRuntime.jsx(
12026
12083
  "rect",
12027
12084
  {
12028
12085
  x: progressX,
@@ -12031,7 +12088,7 @@
12031
12088
  height,
12032
12089
  ry: barCornerRadius,
12033
12090
  rx: barCornerRadius,
12034
- fill: "unset"
12091
+ fill: progressBarColor || "var(--gantt-bar-progress-color)"
12035
12092
  }
12036
12093
  )
12037
12094
  ]
@@ -12095,7 +12152,11 @@
12095
12152
  x1,
12096
12153
  x2,
12097
12154
  startMoveFullTask,
12098
- customStyle
12155
+ customStyle,
12156
+ dataDateX,
12157
+ splitbarColors,
12158
+ showProgressBar = true,
12159
+ progressBarColor
12099
12160
  }) => {
12100
12161
  const projectLeftTriangle = [
12101
12162
  x1,
@@ -12130,7 +12191,40 @@
12130
12191
  },
12131
12192
  className: styles$7.projectWrapper,
12132
12193
  children: [
12133
- /* @__PURE__ */ jsxRuntime.jsx(
12194
+ typeof dataDateX === "number" ? (() => {
12195
+ var _a, _b;
12196
+ const localSplit = Math.max(0, Math.min(width, dataDateX - x1));
12197
+ const leftFill = ((_a = splitbarColors == null ? void 0 : splitbarColors.project) == null ? void 0 : _a.onTime) || "var(--gantt-project-background-color)";
12198
+ const rightFill = ((_b = splitbarColors == null ? void 0 : splitbarColors.project) == null ? void 0 : _b.delayed) || "var(--gantt-project-background-color)";
12199
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
12200
+ /* @__PURE__ */ jsxRuntime.jsx(
12201
+ "rect",
12202
+ {
12203
+ x: x1,
12204
+ width: localSplit,
12205
+ y: taskYOffset,
12206
+ height: taskHeight,
12207
+ rx: barCornerRadius,
12208
+ ry: barCornerRadius,
12209
+ className: styles$7.projectBackground,
12210
+ fill: leftFill
12211
+ }
12212
+ ),
12213
+ /* @__PURE__ */ jsxRuntime.jsx(
12214
+ "rect",
12215
+ {
12216
+ x: x1 + localSplit,
12217
+ width: Math.max(0, width - localSplit),
12218
+ y: taskYOffset,
12219
+ height: taskHeight,
12220
+ rx: barCornerRadius,
12221
+ ry: barCornerRadius,
12222
+ className: styles$7.projectBackground,
12223
+ fill: rightFill
12224
+ }
12225
+ )
12226
+ ] });
12227
+ })() : /* @__PURE__ */ jsxRuntime.jsx(
12134
12228
  "rect",
12135
12229
  {
12136
12230
  x: x1,
@@ -12143,7 +12237,7 @@
12143
12237
  fill: "unset"
12144
12238
  }
12145
12239
  ),
12146
- /* @__PURE__ */ jsxRuntime.jsx(
12240
+ showProgressBar && /* @__PURE__ */ jsxRuntime.jsx(
12147
12241
  "rect",
12148
12242
  {
12149
12243
  x: progressX,
@@ -12152,7 +12246,7 @@
12152
12246
  height: taskHeight,
12153
12247
  ry: barCornerRadius,
12154
12248
  rx: barCornerRadius,
12155
- fill: "unset"
12249
+ fill: progressBarColor || "var(--gantt-bar-progress-color)"
12156
12250
  }
12157
12251
  ),
12158
12252
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -12251,7 +12345,11 @@
12251
12345
  x1,
12252
12346
  x2,
12253
12347
  movingAction,
12254
- ganttRelationEvent
12348
+ ganttRelationEvent,
12349
+ dataDateX,
12350
+ splitbarColors,
12351
+ showProgressBar,
12352
+ progressBarColor
12255
12353
  } = props;
12256
12354
  React.useMemo(() => width < 30, [width]);
12257
12355
  const handleHeight = React.useMemo(() => taskHeight - 2, [taskHeight]);
@@ -12312,7 +12410,11 @@
12312
12410
  isSelected,
12313
12411
  isCritical,
12314
12412
  hasChildren,
12315
- startMoveFullTask
12413
+ startMoveFullTask,
12414
+ dataDateX,
12415
+ splitbarColors,
12416
+ showProgressBar,
12417
+ progressBarColor
12316
12418
  }
12317
12419
  );
12318
12420
  } else {
@@ -12331,7 +12433,11 @@
12331
12433
  isSelected,
12332
12434
  isCritical,
12333
12435
  hasChildren,
12334
- startMoveFullTask
12436
+ startMoveFullTask,
12437
+ dataDateX,
12438
+ splitbarColors,
12439
+ showProgressBar,
12440
+ progressBarColor
12335
12441
  }
12336
12442
  );
12337
12443
  }
@@ -12704,10 +12810,13 @@
12704
12810
  },
12705
12811
  [onTooltipTask, task]
12706
12812
  );
12707
- const onMouseLeave = React.useCallback((event) => {
12708
- event.stopPropagation();
12709
- onTooltipTask(null, null);
12710
- }, [onTooltipTask]);
12813
+ const onMouseLeave = React.useCallback(
12814
+ (event) => {
12815
+ event.stopPropagation();
12816
+ onTooltipTask(null, null);
12817
+ },
12818
+ [onTooltipTask]
12819
+ );
12711
12820
  return /* @__PURE__ */ jsxRuntime.jsxs(
12712
12821
  "g",
12713
12822
  {
@@ -12886,7 +12995,11 @@
12886
12995
  renderCustomLabel,
12887
12996
  taskBarMovingAction,
12888
12997
  waitCommitTasks,
12889
- viewMode
12998
+ viewMode,
12999
+ dataDateX,
13000
+ splitbarColors,
13001
+ showProgressBar,
13002
+ progressBarColor
12890
13003
  } = props;
12891
13004
  const renderedHolidays = React.useMemo(() => {
12892
13005
  const { columnWidth } = distances;
@@ -12973,6 +13086,11 @@
12973
13086
  x2: taskX2,
12974
13087
  comparisonDates
12975
13088
  } = getTaskCoordinates2(task);
13089
+ const containerXAbs = Math.max(
13090
+ containerX + (additionalLeftSpace || 0),
13091
+ 0
13092
+ );
13093
+ const dataDateXLocal = typeof dataDateX === "number" ? dataDateX - containerXAbs : void 0;
12976
13094
  tasksRes.push(
12977
13095
  /* @__PURE__ */ jsxRuntime.jsx(
12978
13096
  "svg",
@@ -13016,7 +13134,11 @@
13016
13134
  rtl,
13017
13135
  onDeleteTask,
13018
13136
  renderCustomLabel,
13019
- viewMode
13137
+ viewMode,
13138
+ dataDateX: dataDateXLocal,
13139
+ splitbarColors,
13140
+ showProgressBar,
13141
+ progressBarColor
13020
13142
  }
13021
13143
  )
13022
13144
  },
@@ -13226,6 +13348,10 @@
13226
13348
  isDateChangeable,
13227
13349
  isRelationChangeable,
13228
13350
  visibleTasksMirror,
13351
+ dataDateX,
13352
+ splitbarColors,
13353
+ showProgressBar,
13354
+ progressBarColor,
13229
13355
  onArrowDoubleClick
13230
13356
  ]);
13231
13357
  return /* @__PURE__ */ jsxRuntime.jsxs("g", { className: "content", children: [
@@ -18666,7 +18792,14 @@
18666
18792
  rowHeight,
18667
18793
  showTodayLine = true,
18668
18794
  showDataDateLine = false,
18669
- dataDate = null
18795
+ dataDate = null,
18796
+ todayColor,
18797
+ dataDateColor,
18798
+ todayLabel = "Today",
18799
+ dataDateLabel = "Data Date",
18800
+ splitbarColors,
18801
+ showProgressBar = true,
18802
+ progressBarColor
18670
18803
  } = props;
18671
18804
  const ganttSVGRef = React.useRef(null);
18672
18805
  const wrapperRef = React.useRef(null);
@@ -19806,7 +19939,11 @@
19806
19939
  viewMode,
19807
19940
  showTodayLine,
19808
19941
  showDataDateLine,
19809
- dataDate
19942
+ dataDate,
19943
+ todayColor,
19944
+ dataDateColor,
19945
+ todayLabel,
19946
+ dataDateLabel
19810
19947
  }),
19811
19948
  [
19812
19949
  additionalLeftSpace,
@@ -19818,9 +19955,28 @@
19818
19955
  viewMode,
19819
19956
  showTodayLine,
19820
19957
  showDataDateLine,
19821
- dataDate
19958
+ dataDate,
19959
+ todayColor,
19960
+ dataDateColor,
19961
+ todayLabel,
19962
+ dataDateLabel
19822
19963
  ]
19823
19964
  );
19965
+ const dataDateX = React.useMemo(() => {
19966
+ if (!dataDate)
19967
+ return void 0;
19968
+ try {
19969
+ const x = taskXCoordinate(
19970
+ dataDate,
19971
+ startDate,
19972
+ viewMode,
19973
+ distances.columnWidth
19974
+ );
19975
+ return additionalLeftSpace + x;
19976
+ } catch {
19977
+ return void 0;
19978
+ }
19979
+ }, [dataDate, startDate, viewMode, distances, additionalLeftSpace]);
19824
19980
  const calendarProps = React.useMemo(
19825
19981
  () => ({
19826
19982
  additionalLeftSpace,
@@ -19854,6 +20010,11 @@
19854
20010
  const renderTaskBarProps = React.useMemo(
19855
20011
  () => ({
19856
20012
  ...taskBar,
20013
+ splitbarColors,
20014
+ dataDate,
20015
+ dataDateX,
20016
+ showProgressBar,
20017
+ progressBarColor,
19857
20018
  taskBarMovingAction: (task) => {
19858
20019
  var _a2;
19859
20020
  return task.id === ((_a2 = changeInProgress == null ? void 0 : changeInProgress.changedTask) == null ? void 0 : _a2.id) ? changeInProgress.action : null;
@@ -19894,6 +20055,11 @@
19894
20055
  [
19895
20056
  viewMode,
19896
20057
  taskBar,
20058
+ splitbarColors,
20059
+ dataDate,
20060
+ dataDateX,
20061
+ showProgressBar,
20062
+ progressBarColor,
19897
20063
  authorizedRelations,
19898
20064
  additionalLeftSpace,
19899
20065
  additionalRightSpace,
@@ -336,6 +336,48 @@ export interface GanttProps {
336
336
  * Custom date to render as data date line when `showDataDateLine` is true
337
337
  */
338
338
  dataDate?: Date | null;
339
+ /**
340
+ * Color used for the today line, pin and label. If not provided, theme calendarTodayColor is used.
341
+ */
342
+ todayColor?: string;
343
+ /**
344
+ * Color used for the data date line, pin and label. If not provided, theme calendarTodayColor is used.
345
+ */
346
+ dataDateColor?: string;
347
+ /**
348
+ * Label text for the today marker. Defaults to "Today".
349
+ */
350
+ todayLabel?: string;
351
+ /**
352
+ * Label text for the data date marker. Defaults to "Data Date".
353
+ */
354
+ dataDateLabel?: string;
355
+ /**
356
+ * Colors to use when splitting bars at the data date line.
357
+ * Structure: { task?: { onTime?: string; delayed?: string }, project?: { onTime?: string; delayed?: string }, comparison?: { onTime?: string; delayed?: string } }
358
+ */
359
+ splitbarColors?: {
360
+ task?: {
361
+ onTime?: string;
362
+ delayed?: string;
363
+ };
364
+ project?: {
365
+ onTime?: string;
366
+ delayed?: string;
367
+ };
368
+ comparison?: {
369
+ onTime?: string;
370
+ delayed?: string;
371
+ };
372
+ };
373
+ /**
374
+ * Show or hide the progress bar overlay on tasks. Defaults to true.
375
+ */
376
+ showProgressBar?: boolean;
377
+ /**
378
+ * Color for the progress bar overlay. If not provided, theme progress color is used.
379
+ */
380
+ progressBarColor?: string;
339
381
  }
340
382
  export interface GanttTaskBarActions {
341
383
  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.47",
3
+ "version": "1.0.48",
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",