gantt-task-react-v 1.0.48 → 1.0.50

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,26 +14,6 @@ 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;
37
17
  ganttRelationEvent: GanttRelationEvent | null;
38
18
  getDate: (index: number) => Date;
39
19
  getTaskCoordinates: (task: Task) => TaskCoordinates;
@@ -61,5 +41,7 @@ export interface TaskGanttContentProps extends GanttTaskBarActions {
61
41
  isRelationChangeable?: (task: Task) => boolean;
62
42
  taskBarMovingAction: (task: RenderTask) => TaskBarMoveAction | null;
63
43
  viewMode: ViewMode;
44
+ showProgress?: boolean;
45
+ progressColor?: string;
64
46
  }
65
47
  export declare const TaskGanttContent: React.NamedExoticComponent<TaskGanttContentProps>;
@@ -14,23 +14,8 @@ 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
+ showProgress?: boolean;
18
+ progressColor?: string;
34
19
  };
35
20
  export declare const BarDisplay: React.FC<BarDisplayProps>;
36
21
  export {};
@@ -15,23 +15,8 @@ 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
+ showProgress?: boolean;
19
+ progressColor?: string;
35
20
  };
36
21
  export declare const ProjectDisplay: React.FC<ProjectDisplayProps>;
37
22
  export {};
@@ -13,23 +13,6 @@ 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;
33
16
  authorizedRelations: RelationKind[];
34
17
  ganttRelationEvent: GanttRelationEvent;
35
18
  canDelete: boolean;
@@ -49,5 +32,7 @@ export interface TaskItemProps extends Omit<GanttTaskBarActions, "taskBarMovingA
49
32
  onTooltipTask: (task: Task | null, element: Element | null) => void;
50
33
  renderCustomLabel?: RenderCustomLabel;
51
34
  viewMode: ViewMode;
35
+ showProgress?: boolean;
36
+ progressColor?: string;
52
37
  }
53
38
  export declare const TaskItem: React.NamedExoticComponent<TaskItemProps>;
@@ -11983,9 +11983,9 @@ const styles$8 = {
11983
11983
  const BarDisplay = ({
11984
11984
  taskId,
11985
11985
  barCornerRadius,
11986
- // isCritical,
11987
- // isSelected,
11988
- // hasChildren,
11986
+ isCritical,
11987
+ isSelected,
11988
+ hasChildren,
11989
11989
  height,
11990
11990
  progressWidth,
11991
11991
  progressX,
@@ -11994,11 +11994,60 @@ const BarDisplay = ({
11994
11994
  x,
11995
11995
  y,
11996
11996
  customStyle,
11997
- dataDateX,
11998
- splitbarColors,
11999
- showProgressBar = true,
12000
- progressBarColor
11997
+ showProgress = true,
11998
+ progressColor
12001
11999
  }) => {
12000
+ const processColor = useMemo(() => {
12001
+ if (progressColor) {
12002
+ return progressColor;
12003
+ }
12004
+ if (isCritical) {
12005
+ if (hasChildren) {
12006
+ if (isSelected) {
12007
+ return "var(--gantt-group-progress-selected-critical-color)";
12008
+ }
12009
+ return "var(--gantt-group-progress-critical-color)";
12010
+ }
12011
+ if (isSelected) {
12012
+ return "var(--gantt-bar-progress-selected-critical-color)";
12013
+ }
12014
+ return "var(--gantt-bar-progress-critical-color)";
12015
+ }
12016
+ if (hasChildren) {
12017
+ if (isSelected) {
12018
+ return "var(--gantt-group-progress-selected-color)";
12019
+ }
12020
+ return "var(--gantt-group-progress-color)";
12021
+ }
12022
+ if (isSelected) {
12023
+ return "var(--gantt-bar-progress-selected-color)";
12024
+ }
12025
+ return "var(--gantt-bar-progress-color)";
12026
+ }, [isSelected, isCritical, hasChildren, progressColor]);
12027
+ const barColor = useMemo(() => {
12028
+ if (isCritical) {
12029
+ if (hasChildren) {
12030
+ if (isSelected) {
12031
+ return "var(--gantt-group-background-selected-critical-color)";
12032
+ }
12033
+ return "var(--gantt-group-background-critical-color)";
12034
+ }
12035
+ if (isSelected) {
12036
+ return "var(--gantt-bar-background-selected-critical-color)";
12037
+ }
12038
+ return "var(--gantt-bar-background-critical-color)";
12039
+ }
12040
+ if (hasChildren) {
12041
+ if (isSelected) {
12042
+ return "var(--gantt-group-background-selected-color)";
12043
+ }
12044
+ return "var(--gantt-group-background-color)";
12045
+ }
12046
+ if (isSelected) {
12047
+ return "var(--gantt-bar-background-selected-color)";
12048
+ }
12049
+ return "var(--gantt-bar-background-color)";
12050
+ }, [isSelected, isCritical, hasChildren]);
12002
12051
  return /* @__PURE__ */ jsxs(
12003
12052
  "g",
12004
12053
  {
@@ -12016,40 +12065,7 @@ const BarDisplay = ({
12016
12065
  }
12017
12066
  },
12018
12067
  children: [
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(
12068
+ /* @__PURE__ */ jsx(
12053
12069
  "rect",
12054
12070
  {
12055
12071
  x,
@@ -12058,11 +12074,11 @@ const BarDisplay = ({
12058
12074
  height,
12059
12075
  ry: barCornerRadius,
12060
12076
  rx: barCornerRadius,
12061
- fill: "unset",
12077
+ fill: barColor,
12062
12078
  className: styles$8.barBackground
12063
12079
  }
12064
12080
  ),
12065
- showProgressBar && /* @__PURE__ */ jsx(
12081
+ showProgress && /* @__PURE__ */ jsx(
12066
12082
  "rect",
12067
12083
  {
12068
12084
  x: progressX,
@@ -12071,7 +12087,7 @@ const BarDisplay = ({
12071
12087
  height,
12072
12088
  ry: barCornerRadius,
12073
12089
  rx: barCornerRadius,
12074
- fill: progressBarColor || "var(--gantt-bar-progress-color)"
12090
+ fill: processColor
12075
12091
  }
12076
12092
  )
12077
12093
  ]
@@ -12126,8 +12142,8 @@ const ProjectDisplay = ({
12126
12142
  taskName: taskName2,
12127
12143
  taskHalfHeight,
12128
12144
  taskHeight,
12129
- // isSelected,
12130
- // isCritical,
12145
+ isSelected,
12146
+ isCritical,
12131
12147
  progressWidth,
12132
12148
  progressX,
12133
12149
  taskYOffset,
@@ -12136,11 +12152,36 @@ const ProjectDisplay = ({
12136
12152
  x2,
12137
12153
  startMoveFullTask,
12138
12154
  customStyle,
12139
- dataDateX,
12140
- splitbarColors,
12141
- showProgressBar = true,
12142
- progressBarColor
12155
+ showProgress = true,
12156
+ progressColor
12143
12157
  }) => {
12158
+ const barColor = useMemo(() => {
12159
+ if (isCritical) {
12160
+ if (isSelected) {
12161
+ return "var(--gantt-project-background-selected-critical-color)";
12162
+ }
12163
+ return "var(--gantt-project-background-critical-color)";
12164
+ }
12165
+ if (isSelected) {
12166
+ return "var(--gantt-project-background-selected-color)";
12167
+ }
12168
+ return "var(--gantt-project-background-color)";
12169
+ }, [isSelected, isCritical]);
12170
+ const processColor = useMemo(() => {
12171
+ if (progressColor) {
12172
+ return progressColor;
12173
+ }
12174
+ if (isCritical) {
12175
+ if (isSelected) {
12176
+ return "var(--gantt-project-progress-selected-critical-color)";
12177
+ }
12178
+ return "var(--gantt-project-progress-critical-color)";
12179
+ }
12180
+ if (isSelected) {
12181
+ return "var(--gantt-project-progress-selected-color)";
12182
+ }
12183
+ return "var(--gantt-project-progress-color)";
12184
+ }, [isSelected, isCritical, progressColor]);
12144
12185
  const projectLeftTriangle = [
12145
12186
  x1,
12146
12187
  taskYOffset + taskHeight / 2 - 1,
@@ -12174,53 +12215,20 @@ const ProjectDisplay = ({
12174
12215
  },
12175
12216
  className: styles$7.projectWrapper,
12176
12217
  children: [
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(
12218
+ /* @__PURE__ */ jsx(
12211
12219
  "rect",
12212
12220
  {
12221
+ fill: barColor,
12213
12222
  x: x1,
12214
12223
  width,
12215
12224
  y: taskYOffset,
12216
12225
  height: taskHeight,
12217
12226
  rx: barCornerRadius,
12218
12227
  ry: barCornerRadius,
12219
- className: styles$7.projectBackground,
12220
- fill: "unset"
12228
+ className: styles$7.projectBackground
12221
12229
  }
12222
12230
  ),
12223
- showProgressBar && /* @__PURE__ */ jsx(
12231
+ showProgress && /* @__PURE__ */ jsx(
12224
12232
  "rect",
12225
12233
  {
12226
12234
  x: progressX,
@@ -12229,13 +12237,13 @@ const ProjectDisplay = ({
12229
12237
  height: taskHeight,
12230
12238
  ry: barCornerRadius,
12231
12239
  rx: barCornerRadius,
12232
- fill: progressBarColor || "var(--gantt-bar-progress-color)"
12240
+ fill: processColor
12233
12241
  }
12234
12242
  ),
12235
12243
  /* @__PURE__ */ jsx(
12236
12244
  "rect",
12237
12245
  {
12238
- fill: "unset",
12246
+ fill: barColor,
12239
12247
  x: x1,
12240
12248
  width,
12241
12249
  y: taskYOffset,
@@ -12250,7 +12258,7 @@ const ProjectDisplay = ({
12250
12258
  {
12251
12259
  className: styles$7.projectTop,
12252
12260
  points: projectLeftTriangle,
12253
- fill: "unset"
12261
+ fill: barColor
12254
12262
  }
12255
12263
  ),
12256
12264
  /* @__PURE__ */ jsx(
@@ -12258,7 +12266,7 @@ const ProjectDisplay = ({
12258
12266
  {
12259
12267
  className: styles$7.projectTop,
12260
12268
  points: projectRightTriangle,
12261
- fill: "unset"
12269
+ fill: barColor
12262
12270
  }
12263
12271
  )
12264
12272
  ]
@@ -12329,10 +12337,8 @@ const Bar = (props) => {
12329
12337
  x2,
12330
12338
  movingAction,
12331
12339
  ganttRelationEvent,
12332
- dataDateX,
12333
- splitbarColors,
12334
- showProgressBar,
12335
- progressBarColor
12340
+ showProgress = true,
12341
+ progressColor
12336
12342
  } = props;
12337
12343
  useMemo(() => width < 30, [width]);
12338
12344
  const handleHeight = useMemo(() => taskHeight - 2, [taskHeight]);
@@ -12394,10 +12400,8 @@ const Bar = (props) => {
12394
12400
  isCritical,
12395
12401
  hasChildren,
12396
12402
  startMoveFullTask,
12397
- dataDateX,
12398
- splitbarColors,
12399
- showProgressBar,
12400
- progressBarColor
12403
+ showProgress,
12404
+ progressColor
12401
12405
  }
12402
12406
  );
12403
12407
  } else {
@@ -12417,10 +12421,8 @@ const Bar = (props) => {
12417
12421
  isCritical,
12418
12422
  hasChildren,
12419
12423
  startMoveFullTask,
12420
- dataDateX,
12421
- splitbarColors,
12422
- showProgressBar,
12423
- progressBarColor
12424
+ showProgress,
12425
+ progressColor
12424
12426
  }
12425
12427
  );
12426
12428
  }
@@ -12979,10 +12981,8 @@ const TaskGanttContentInner = (props) => {
12979
12981
  taskBarMovingAction,
12980
12982
  waitCommitTasks,
12981
12983
  viewMode,
12982
- dataDateX,
12983
- splitbarColors,
12984
- showProgressBar,
12985
- progressBarColor
12984
+ showProgress = true,
12985
+ progressColor
12986
12986
  } = props;
12987
12987
  const renderedHolidays = useMemo(() => {
12988
12988
  const { columnWidth } = distances;
@@ -13069,11 +13069,6 @@ const TaskGanttContentInner = (props) => {
13069
13069
  x2: taskX2,
13070
13070
  comparisonDates
13071
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;
13077
13072
  tasksRes.push(
13078
13073
  /* @__PURE__ */ jsx(
13079
13074
  "svg",
@@ -13118,10 +13113,8 @@ const TaskGanttContentInner = (props) => {
13118
13113
  onDeleteTask,
13119
13114
  renderCustomLabel,
13120
13115
  viewMode,
13121
- dataDateX: dataDateXLocal,
13122
- splitbarColors,
13123
- showProgressBar,
13124
- progressBarColor
13116
+ showProgress,
13117
+ progressColor
13125
13118
  }
13126
13119
  )
13127
13120
  },
@@ -13331,10 +13324,6 @@ const TaskGanttContentInner = (props) => {
13331
13324
  isDateChangeable,
13332
13325
  isRelationChangeable,
13333
13326
  visibleTasksMirror,
13334
- dataDateX,
13335
- splitbarColors,
13336
- showProgressBar,
13337
- progressBarColor,
13338
13327
  onArrowDoubleClick
13339
13328
  ]);
13340
13329
  return /* @__PURE__ */ jsxs("g", { className: "content", children: [
@@ -18780,9 +18769,8 @@ const Gantt = (props) => {
18780
18769
  dataDateColor,
18781
18770
  todayLabel = "Today",
18782
18771
  dataDateLabel = "Data Date",
18783
- splitbarColors,
18784
- showProgressBar = true,
18785
- progressBarColor
18772
+ showProgress = true,
18773
+ progressColor
18786
18774
  } = props;
18787
18775
  const ganttSVGRef = useRef(null);
18788
18776
  const wrapperRef = useRef(null);
@@ -19945,21 +19933,6 @@ const Gantt = (props) => {
19945
19933
  dataDateLabel
19946
19934
  ]
19947
19935
  );
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]);
19963
19936
  const calendarProps = useMemo(
19964
19937
  () => ({
19965
19938
  additionalLeftSpace,
@@ -19993,11 +19966,6 @@ const Gantt = (props) => {
19993
19966
  const renderTaskBarProps = useMemo(
19994
19967
  () => ({
19995
19968
  ...taskBar,
19996
- splitbarColors,
19997
- dataDate,
19998
- dataDateX,
19999
- showProgressBar,
20000
- progressBarColor,
20001
19969
  taskBarMovingAction: (task) => {
20002
19970
  var _a2;
20003
19971
  return task.id === ((_a2 = changeInProgress == null ? void 0 : changeInProgress.changedTask) == null ? void 0 : _a2.id) ? changeInProgress.action : null;
@@ -20033,16 +20001,13 @@ const Gantt = (props) => {
20033
20001
  taskHeight,
20034
20002
  taskYOffset,
20035
20003
  visibleTasksMirror,
20036
- viewMode
20004
+ viewMode,
20005
+ showProgress,
20006
+ progressColor
20037
20007
  }),
20038
20008
  [
20039
20009
  viewMode,
20040
20010
  taskBar,
20041
- splitbarColors,
20042
- dataDate,
20043
- dataDateX,
20044
- showProgressBar,
20045
- progressBarColor,
20046
20011
  authorizedRelations,
20047
20012
  additionalLeftSpace,
20048
20013
  additionalRightSpace,
@@ -20075,7 +20040,9 @@ const Gantt = (props) => {
20075
20040
  visibleTasksMirror,
20076
20041
  (_b = changeInProgress == null ? void 0 : changeInProgress.changedTask) == null ? void 0 : _b.id,
20077
20042
  changeInProgress == null ? void 0 : changeInProgress.action,
20078
- handleDeleteTasks
20043
+ handleDeleteTasks,
20044
+ showProgress,
20045
+ progressColor
20079
20046
  ]
20080
20047
  );
20081
20048
  const renderTaskListProps = useMemo(
@@ -12000,9 +12000,9 @@
12000
12000
  const BarDisplay = ({
12001
12001
  taskId,
12002
12002
  barCornerRadius,
12003
- // isCritical,
12004
- // isSelected,
12005
- // hasChildren,
12003
+ isCritical,
12004
+ isSelected,
12005
+ hasChildren,
12006
12006
  height,
12007
12007
  progressWidth,
12008
12008
  progressX,
@@ -12011,11 +12011,60 @@
12011
12011
  x,
12012
12012
  y,
12013
12013
  customStyle,
12014
- dataDateX,
12015
- splitbarColors,
12016
- showProgressBar = true,
12017
- progressBarColor
12014
+ showProgress = true,
12015
+ progressColor
12018
12016
  }) => {
12017
+ const processColor = React.useMemo(() => {
12018
+ if (progressColor) {
12019
+ return progressColor;
12020
+ }
12021
+ if (isCritical) {
12022
+ if (hasChildren) {
12023
+ if (isSelected) {
12024
+ return "var(--gantt-group-progress-selected-critical-color)";
12025
+ }
12026
+ return "var(--gantt-group-progress-critical-color)";
12027
+ }
12028
+ if (isSelected) {
12029
+ return "var(--gantt-bar-progress-selected-critical-color)";
12030
+ }
12031
+ return "var(--gantt-bar-progress-critical-color)";
12032
+ }
12033
+ if (hasChildren) {
12034
+ if (isSelected) {
12035
+ return "var(--gantt-group-progress-selected-color)";
12036
+ }
12037
+ return "var(--gantt-group-progress-color)";
12038
+ }
12039
+ if (isSelected) {
12040
+ return "var(--gantt-bar-progress-selected-color)";
12041
+ }
12042
+ return "var(--gantt-bar-progress-color)";
12043
+ }, [isSelected, isCritical, hasChildren, progressColor]);
12044
+ const barColor = React.useMemo(() => {
12045
+ if (isCritical) {
12046
+ if (hasChildren) {
12047
+ if (isSelected) {
12048
+ return "var(--gantt-group-background-selected-critical-color)";
12049
+ }
12050
+ return "var(--gantt-group-background-critical-color)";
12051
+ }
12052
+ if (isSelected) {
12053
+ return "var(--gantt-bar-background-selected-critical-color)";
12054
+ }
12055
+ return "var(--gantt-bar-background-critical-color)";
12056
+ }
12057
+ if (hasChildren) {
12058
+ if (isSelected) {
12059
+ return "var(--gantt-group-background-selected-color)";
12060
+ }
12061
+ return "var(--gantt-group-background-color)";
12062
+ }
12063
+ if (isSelected) {
12064
+ return "var(--gantt-bar-background-selected-color)";
12065
+ }
12066
+ return "var(--gantt-bar-background-color)";
12067
+ }, [isSelected, isCritical, hasChildren]);
12019
12068
  return /* @__PURE__ */ jsxRuntime.jsxs(
12020
12069
  "g",
12021
12070
  {
@@ -12033,40 +12082,7 @@
12033
12082
  }
12034
12083
  },
12035
12084
  children: [
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(
12085
+ /* @__PURE__ */ jsxRuntime.jsx(
12070
12086
  "rect",
12071
12087
  {
12072
12088
  x,
@@ -12075,11 +12091,11 @@
12075
12091
  height,
12076
12092
  ry: barCornerRadius,
12077
12093
  rx: barCornerRadius,
12078
- fill: "unset",
12094
+ fill: barColor,
12079
12095
  className: styles$8.barBackground
12080
12096
  }
12081
12097
  ),
12082
- showProgressBar && /* @__PURE__ */ jsxRuntime.jsx(
12098
+ showProgress && /* @__PURE__ */ jsxRuntime.jsx(
12083
12099
  "rect",
12084
12100
  {
12085
12101
  x: progressX,
@@ -12088,7 +12104,7 @@
12088
12104
  height,
12089
12105
  ry: barCornerRadius,
12090
12106
  rx: barCornerRadius,
12091
- fill: progressBarColor || "var(--gantt-bar-progress-color)"
12107
+ fill: processColor
12092
12108
  }
12093
12109
  )
12094
12110
  ]
@@ -12143,8 +12159,8 @@
12143
12159
  taskName: taskName2,
12144
12160
  taskHalfHeight,
12145
12161
  taskHeight,
12146
- // isSelected,
12147
- // isCritical,
12162
+ isSelected,
12163
+ isCritical,
12148
12164
  progressWidth,
12149
12165
  progressX,
12150
12166
  taskYOffset,
@@ -12153,11 +12169,36 @@
12153
12169
  x2,
12154
12170
  startMoveFullTask,
12155
12171
  customStyle,
12156
- dataDateX,
12157
- splitbarColors,
12158
- showProgressBar = true,
12159
- progressBarColor
12172
+ showProgress = true,
12173
+ progressColor
12160
12174
  }) => {
12175
+ const barColor = React.useMemo(() => {
12176
+ if (isCritical) {
12177
+ if (isSelected) {
12178
+ return "var(--gantt-project-background-selected-critical-color)";
12179
+ }
12180
+ return "var(--gantt-project-background-critical-color)";
12181
+ }
12182
+ if (isSelected) {
12183
+ return "var(--gantt-project-background-selected-color)";
12184
+ }
12185
+ return "var(--gantt-project-background-color)";
12186
+ }, [isSelected, isCritical]);
12187
+ const processColor = React.useMemo(() => {
12188
+ if (progressColor) {
12189
+ return progressColor;
12190
+ }
12191
+ if (isCritical) {
12192
+ if (isSelected) {
12193
+ return "var(--gantt-project-progress-selected-critical-color)";
12194
+ }
12195
+ return "var(--gantt-project-progress-critical-color)";
12196
+ }
12197
+ if (isSelected) {
12198
+ return "var(--gantt-project-progress-selected-color)";
12199
+ }
12200
+ return "var(--gantt-project-progress-color)";
12201
+ }, [isSelected, isCritical, progressColor]);
12161
12202
  const projectLeftTriangle = [
12162
12203
  x1,
12163
12204
  taskYOffset + taskHeight / 2 - 1,
@@ -12191,53 +12232,20 @@
12191
12232
  },
12192
12233
  className: styles$7.projectWrapper,
12193
12234
  children: [
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(
12235
+ /* @__PURE__ */ jsxRuntime.jsx(
12228
12236
  "rect",
12229
12237
  {
12238
+ fill: barColor,
12230
12239
  x: x1,
12231
12240
  width,
12232
12241
  y: taskYOffset,
12233
12242
  height: taskHeight,
12234
12243
  rx: barCornerRadius,
12235
12244
  ry: barCornerRadius,
12236
- className: styles$7.projectBackground,
12237
- fill: "unset"
12245
+ className: styles$7.projectBackground
12238
12246
  }
12239
12247
  ),
12240
- showProgressBar && /* @__PURE__ */ jsxRuntime.jsx(
12248
+ showProgress && /* @__PURE__ */ jsxRuntime.jsx(
12241
12249
  "rect",
12242
12250
  {
12243
12251
  x: progressX,
@@ -12246,13 +12254,13 @@
12246
12254
  height: taskHeight,
12247
12255
  ry: barCornerRadius,
12248
12256
  rx: barCornerRadius,
12249
- fill: progressBarColor || "var(--gantt-bar-progress-color)"
12257
+ fill: processColor
12250
12258
  }
12251
12259
  ),
12252
12260
  /* @__PURE__ */ jsxRuntime.jsx(
12253
12261
  "rect",
12254
12262
  {
12255
- fill: "unset",
12263
+ fill: barColor,
12256
12264
  x: x1,
12257
12265
  width,
12258
12266
  y: taskYOffset,
@@ -12267,7 +12275,7 @@
12267
12275
  {
12268
12276
  className: styles$7.projectTop,
12269
12277
  points: projectLeftTriangle,
12270
- fill: "unset"
12278
+ fill: barColor
12271
12279
  }
12272
12280
  ),
12273
12281
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -12275,7 +12283,7 @@
12275
12283
  {
12276
12284
  className: styles$7.projectTop,
12277
12285
  points: projectRightTriangle,
12278
- fill: "unset"
12286
+ fill: barColor
12279
12287
  }
12280
12288
  )
12281
12289
  ]
@@ -12346,10 +12354,8 @@
12346
12354
  x2,
12347
12355
  movingAction,
12348
12356
  ganttRelationEvent,
12349
- dataDateX,
12350
- splitbarColors,
12351
- showProgressBar,
12352
- progressBarColor
12357
+ showProgress = true,
12358
+ progressColor
12353
12359
  } = props;
12354
12360
  React.useMemo(() => width < 30, [width]);
12355
12361
  const handleHeight = React.useMemo(() => taskHeight - 2, [taskHeight]);
@@ -12411,10 +12417,8 @@
12411
12417
  isCritical,
12412
12418
  hasChildren,
12413
12419
  startMoveFullTask,
12414
- dataDateX,
12415
- splitbarColors,
12416
- showProgressBar,
12417
- progressBarColor
12420
+ showProgress,
12421
+ progressColor
12418
12422
  }
12419
12423
  );
12420
12424
  } else {
@@ -12434,10 +12438,8 @@
12434
12438
  isCritical,
12435
12439
  hasChildren,
12436
12440
  startMoveFullTask,
12437
- dataDateX,
12438
- splitbarColors,
12439
- showProgressBar,
12440
- progressBarColor
12441
+ showProgress,
12442
+ progressColor
12441
12443
  }
12442
12444
  );
12443
12445
  }
@@ -12996,10 +12998,8 @@
12996
12998
  taskBarMovingAction,
12997
12999
  waitCommitTasks,
12998
13000
  viewMode,
12999
- dataDateX,
13000
- splitbarColors,
13001
- showProgressBar,
13002
- progressBarColor
13001
+ showProgress = true,
13002
+ progressColor
13003
13003
  } = props;
13004
13004
  const renderedHolidays = React.useMemo(() => {
13005
13005
  const { columnWidth } = distances;
@@ -13086,11 +13086,6 @@
13086
13086
  x2: taskX2,
13087
13087
  comparisonDates
13088
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;
13094
13089
  tasksRes.push(
13095
13090
  /* @__PURE__ */ jsxRuntime.jsx(
13096
13091
  "svg",
@@ -13135,10 +13130,8 @@
13135
13130
  onDeleteTask,
13136
13131
  renderCustomLabel,
13137
13132
  viewMode,
13138
- dataDateX: dataDateXLocal,
13139
- splitbarColors,
13140
- showProgressBar,
13141
- progressBarColor
13133
+ showProgress,
13134
+ progressColor
13142
13135
  }
13143
13136
  )
13144
13137
  },
@@ -13348,10 +13341,6 @@
13348
13341
  isDateChangeable,
13349
13342
  isRelationChangeable,
13350
13343
  visibleTasksMirror,
13351
- dataDateX,
13352
- splitbarColors,
13353
- showProgressBar,
13354
- progressBarColor,
13355
13344
  onArrowDoubleClick
13356
13345
  ]);
13357
13346
  return /* @__PURE__ */ jsxRuntime.jsxs("g", { className: "content", children: [
@@ -18797,9 +18786,8 @@
18797
18786
  dataDateColor,
18798
18787
  todayLabel = "Today",
18799
18788
  dataDateLabel = "Data Date",
18800
- splitbarColors,
18801
- showProgressBar = true,
18802
- progressBarColor
18789
+ showProgress = true,
18790
+ progressColor
18803
18791
  } = props;
18804
18792
  const ganttSVGRef = React.useRef(null);
18805
18793
  const wrapperRef = React.useRef(null);
@@ -19962,21 +19950,6 @@
19962
19950
  dataDateLabel
19963
19951
  ]
19964
19952
  );
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]);
19980
19953
  const calendarProps = React.useMemo(
19981
19954
  () => ({
19982
19955
  additionalLeftSpace,
@@ -20010,11 +19983,6 @@
20010
19983
  const renderTaskBarProps = React.useMemo(
20011
19984
  () => ({
20012
19985
  ...taskBar,
20013
- splitbarColors,
20014
- dataDate,
20015
- dataDateX,
20016
- showProgressBar,
20017
- progressBarColor,
20018
19986
  taskBarMovingAction: (task) => {
20019
19987
  var _a2;
20020
19988
  return task.id === ((_a2 = changeInProgress == null ? void 0 : changeInProgress.changedTask) == null ? void 0 : _a2.id) ? changeInProgress.action : null;
@@ -20050,16 +20018,13 @@
20050
20018
  taskHeight,
20051
20019
  taskYOffset,
20052
20020
  visibleTasksMirror,
20053
- viewMode
20021
+ viewMode,
20022
+ showProgress,
20023
+ progressColor
20054
20024
  }),
20055
20025
  [
20056
20026
  viewMode,
20057
20027
  taskBar,
20058
- splitbarColors,
20059
- dataDate,
20060
- dataDateX,
20061
- showProgressBar,
20062
- progressBarColor,
20063
20028
  authorizedRelations,
20064
20029
  additionalLeftSpace,
20065
20030
  additionalRightSpace,
@@ -20092,7 +20057,9 @@
20092
20057
  visibleTasksMirror,
20093
20058
  (_b = changeInProgress == null ? void 0 : changeInProgress.changedTask) == null ? void 0 : _b.id,
20094
20059
  changeInProgress == null ? void 0 : changeInProgress.action,
20095
- handleDeleteTasks
20060
+ handleDeleteTasks,
20061
+ showProgress,
20062
+ progressColor
20096
20063
  ]
20097
20064
  );
20098
20065
  const renderTaskListProps = React.useMemo(
@@ -353,31 +353,13 @@ export interface GanttProps {
353
353
  */
354
354
  dataDateLabel?: string;
355
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.
356
+ * Show/hide progress bar on task bars. Defaults to true.
375
357
  */
376
- showProgressBar?: boolean;
358
+ showProgress?: boolean;
377
359
  /**
378
- * Color for the progress bar overlay. If not provided, theme progress color is used.
360
+ * Custom color for progress bars. If not provided, theme progress colors are used.
379
361
  */
380
- progressBarColor?: string;
362
+ progressColor?: string;
381
363
  }
382
364
  export interface GanttTaskBarActions {
383
365
  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.48",
3
+ "version": "1.0.50",
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",