@ssfm/gantt-task-react 0.6.18 → 0.6.19

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.
@@ -6,6 +6,7 @@ type BarDisplayProps = {
6
6
  isSelected: boolean;
7
7
  hasChildren: boolean;
8
8
  height: number;
9
+ showProgress: boolean;
9
10
  progressWidth: number;
10
11
  progressX: number;
11
12
  startMoveFullTask: (clientX: number) => void;
@@ -8,6 +8,7 @@ type ProjectDisplayProps = {
8
8
  taskHeight: number;
9
9
  taskHalfHeight: number;
10
10
  taskYOffset: number;
11
+ showProgress: boolean;
11
12
  progressWidth: number;
12
13
  progressX: number;
13
14
  startMoveFullTask: (clientX: number) => void;
@@ -20,6 +20,7 @@ export type TaskItemProps = {
20
20
  taskHeight: number;
21
21
  taskHalfHeight: number;
22
22
  isProgressChangeable: boolean;
23
+ showProgress: boolean;
23
24
  isDateChangeable: boolean;
24
25
  authorizedRelations: RelationKind[];
25
26
  isRelationChangeable: boolean;
@@ -4627,6 +4627,7 @@ const BarDisplay = ({
4627
4627
  hasChildren,
4628
4628
  height,
4629
4629
  progressWidth,
4630
+ showProgress,
4630
4631
  progressX,
4631
4632
  startMoveFullTask,
4632
4633
  styles: styles2,
@@ -4709,7 +4710,7 @@ const BarDisplay = ({
4709
4710
  className: styles$6.barBackground
4710
4711
  }
4711
4712
  ),
4712
- /* @__PURE__ */ jsx(
4713
+ showProgress && /* @__PURE__ */ jsx(
4713
4714
  "rect",
4714
4715
  {
4715
4716
  x: progressX,
@@ -4804,12 +4805,13 @@ const ProjectDisplay = ({
4804
4805
  isSelected,
4805
4806
  isCritical,
4806
4807
  colorStyles,
4808
+ showProgress,
4807
4809
  progressWidth,
4808
4810
  progressX,
4809
4811
  taskYOffset,
4810
4812
  width,
4811
4813
  x1,
4812
- x2: x22,
4814
+ //x2,
4813
4815
  startMoveFullTask
4814
4816
  }) => {
4815
4817
  const barColor = useMemo(() => {
@@ -4836,22 +4838,6 @@ const ProjectDisplay = ({
4836
4838
  }
4837
4839
  return colorStyles.projectProgressColor;
4838
4840
  }, [isSelected, isCritical, colorStyles]);
4839
- const projectLeftTriangle = [
4840
- x1,
4841
- taskYOffset + taskHeight / 2 - 1,
4842
- x1,
4843
- taskYOffset + taskHeight,
4844
- x1 + 15,
4845
- taskYOffset + taskHeight / 2 - 1
4846
- ].join(",");
4847
- const projectRightTriangle = [
4848
- x22,
4849
- taskYOffset + taskHeight / 2 - 1,
4850
- x22,
4851
- taskYOffset + taskHeight,
4852
- x22 - 15,
4853
- taskYOffset + taskHeight / 2 - 1
4854
- ].join(",");
4855
4841
  return /* @__PURE__ */ jsxs(
4856
4842
  "g",
4857
4843
  {
@@ -4881,7 +4867,7 @@ const ProjectDisplay = ({
4881
4867
  className: styles$4.projectBackground
4882
4868
  }
4883
4869
  ),
4884
- /* @__PURE__ */ jsx(
4870
+ showProgress && /* @__PURE__ */ jsx(
4885
4871
  "rect",
4886
4872
  {
4887
4873
  x: progressX,
@@ -4893,7 +4879,7 @@ const ProjectDisplay = ({
4893
4879
  fill: processColor
4894
4880
  }
4895
4881
  ),
4896
- /* @__PURE__ */ jsx(
4882
+ showProgress && /* @__PURE__ */ jsx(
4897
4883
  "rect",
4898
4884
  {
4899
4885
  fill: barColor,
@@ -4906,20 +4892,26 @@ const ProjectDisplay = ({
4906
4892
  className: styles$4.projectTop
4907
4893
  }
4908
4894
  ),
4909
- /* @__PURE__ */ jsx(
4910
- "polygon",
4895
+ showProgress && /* @__PURE__ */ jsx(
4896
+ "rect",
4911
4897
  {
4912
- className: styles$4.projectTop,
4913
- points: projectLeftTriangle,
4914
- fill: barColor
4898
+ fill: barColor,
4899
+ x: x1,
4900
+ y: taskYOffset + taskHalfHeight - barCornerRadius,
4901
+ width: barCornerRadius,
4902
+ height: barCornerRadius,
4903
+ className: styles$4.projectTop
4915
4904
  }
4916
4905
  ),
4917
- /* @__PURE__ */ jsx(
4918
- "polygon",
4906
+ showProgress && /* @__PURE__ */ jsx(
4907
+ "rect",
4919
4908
  {
4920
- className: styles$4.projectTop,
4921
- points: projectRightTriangle,
4922
- fill: barColor
4909
+ fill: barColor,
4910
+ x: x1 + width - barCornerRadius,
4911
+ y: taskYOffset + taskHalfHeight - barCornerRadius,
4912
+ width: barCornerRadius,
4913
+ height: barCornerRadius,
4914
+ className: styles$4.projectTop
4923
4915
  }
4924
4916
  )
4925
4917
  ]
@@ -4934,6 +4926,7 @@ const Bar = ({
4934
4926
  isCritical,
4935
4927
  isDateChangeable,
4936
4928
  isProgressChangeable,
4929
+ showProgress,
4937
4930
  isSelected,
4938
4931
  onTaskEventStart,
4939
4932
  progressWidth,
@@ -4989,6 +4982,7 @@ const Bar = ({
4989
4982
  width,
4990
4983
  taskHeight,
4991
4984
  taskHalfHeight,
4985
+ showProgress,
4992
4986
  progressX,
4993
4987
  progressWidth,
4994
4988
  barCornerRadius,
@@ -5008,6 +5002,7 @@ const Bar = ({
5008
5002
  y: taskYOffset,
5009
5003
  width,
5010
5004
  height: taskHeight,
5005
+ showProgress,
5011
5006
  progressX,
5012
5007
  progressWidth,
5013
5008
  barCornerRadius,
@@ -5034,7 +5029,7 @@ const Bar = ({
5034
5029
  height: handleHeight,
5035
5030
  startMove: startMoveStartOfTask,
5036
5031
  width: handleWidth,
5037
- x: x1 + 1,
5032
+ x: x1 - handleWidth,
5038
5033
  y: taskYOffset + 1
5039
5034
  }
5040
5035
  ),
@@ -5046,12 +5041,12 @@ const Bar = ({
5046
5041
  height: handleHeight,
5047
5042
  startMove: startMoveEndOfTask,
5048
5043
  width: handleWidth,
5049
- x: x22 - handleWidth - 1,
5044
+ x: x1 + width,
5050
5045
  y: taskYOffset + 1
5051
5046
  }
5052
5047
  ),
5053
5048
  relationhandles,
5054
- isProgressChangeable && /* @__PURE__ */ jsx(
5049
+ isProgressChangeable && showProgress && /* @__PURE__ */ jsx(
5055
5050
  BarProgressHandle,
5056
5051
  {
5057
5052
  taskName: task.name,
@@ -5063,75 +5058,6 @@ const Bar = ({
5063
5058
  }
5064
5059
  );
5065
5060
  };
5066
- const BarSmall = ({
5067
- children: relationhandles,
5068
- colorStyles,
5069
- distances: { barCornerRadius, handleWidth },
5070
- hasChildren,
5071
- isSelected,
5072
- isCritical,
5073
- isDateChangeable,
5074
- onTaskEventStart,
5075
- progressWidth,
5076
- progressX,
5077
- taskYOffset,
5078
- task,
5079
- taskHeight,
5080
- x1
5081
- }) => {
5082
- const startMoveFullTask = useCallback(
5083
- (clientX) => {
5084
- onTaskEventStart("move", clientX);
5085
- },
5086
- [onTaskEventStart]
5087
- );
5088
- const startMoveEndOfTask = useCallback(
5089
- (clientX) => {
5090
- onTaskEventStart("end", clientX);
5091
- },
5092
- [onTaskEventStart]
5093
- );
5094
- return /* @__PURE__ */ jsxs(
5095
- "g",
5096
- {
5097
- className: `${styles$6.barWrapper} ${styles$5.barRelationHandleWrapper}`,
5098
- tabIndex: 0,
5099
- children: [
5100
- /* @__PURE__ */ jsx(
5101
- BarDisplay,
5102
- {
5103
- taskName: task.name,
5104
- barCornerRadius,
5105
- hasChildren,
5106
- height: taskHeight,
5107
- isCritical,
5108
- isSelected,
5109
- progressWidth,
5110
- progressX,
5111
- startMoveFullTask,
5112
- styles: colorStyles,
5113
- width: handleWidth * 2,
5114
- x: x1,
5115
- y: taskYOffset
5116
- }
5117
- ),
5118
- isDateChangeable && /* @__PURE__ */ jsx(
5119
- BarDateHandle,
5120
- {
5121
- dataTestid: `task-date-handle-right-${task.name}`,
5122
- barCornerRadius,
5123
- height: taskHeight - 2,
5124
- startMove: startMoveEndOfTask,
5125
- width: handleWidth,
5126
- x: x1 + handleWidth,
5127
- y: taskYOffset + 1
5128
- }
5129
- ),
5130
- relationhandles
5131
- ]
5132
- }
5133
- );
5134
- };
5135
5061
  const milestoneWrapper = "_milestoneWrapper_xr9to_1";
5136
5062
  const milestoneBackground = "_milestoneBackground_xr9to_6";
5137
5063
  const styles$3 = {
@@ -5271,8 +5197,8 @@ const TaskWarningInner = ({
5271
5197
  ] });
5272
5198
  };
5273
5199
  const TaskWarning = memo(TaskWarningInner);
5274
- const barLabel = "_barLabel_pu5db_1";
5275
- const barLabelOutside = "_barLabelOutside_pu5db_13";
5200
+ const barLabel = "_barLabel_5gth7_1";
5201
+ const barLabelOutside = "_barLabelOutside_5gth7_13";
5276
5202
  const style = {
5277
5203
  barLabel,
5278
5204
  barLabelOutside
@@ -5392,7 +5318,8 @@ const TaskItemInner = (props) => {
5392
5318
  handleWidth,
5393
5319
  taskWarningOffset,
5394
5320
  relationCircleOffset,
5395
- relationCircleRadius
5321
+ relationCircleRadius,
5322
+ minimalBarWidth
5396
5323
  },
5397
5324
  fixEndPosition = void 0,
5398
5325
  fixStartPosition = void 0,
@@ -5412,6 +5339,7 @@ const TaskItemInner = (props) => {
5412
5339
  rtl,
5413
5340
  selectTaskOnMouseDown,
5414
5341
  setTooltipTask,
5342
+ showProgress,
5415
5343
  task,
5416
5344
  task: { styles: taskStyles },
5417
5345
  taskHalfHeight,
@@ -5514,14 +5442,14 @@ const TaskItemInner = (props) => {
5514
5442
  } else {
5515
5443
  displayRightRelationHandle = rtl ? isFromStartRelationAuthorized : isFromEndRelationAuthorized;
5516
5444
  }
5517
- const isSmallBar = width < handleWidth * 2;
5445
+ const isSmallBar = width < minimalBarWidth;
5518
5446
  const relationhandles = /* @__PURE__ */ jsxs(Fragment$1, { children: [
5519
5447
  isRelationChangeable && displayLeftRelationHandle && /* @__PURE__ */ jsx(
5520
5448
  BarRelationHandle,
5521
5449
  {
5522
5450
  dataTestid: `task-relation-handle-left-${task.name}`,
5523
5451
  isRelationDrawMode: !!ganttRelationEvent,
5524
- x: x1 - relationCircleOffset,
5452
+ x: x1 - relationCircleOffset - handleWidth,
5525
5453
  y: taskYOffset + taskHalfHeight,
5526
5454
  radius: relationCircleRadius,
5527
5455
  startDrawRelation: onLeftRelationTriggerMouseDown
@@ -5532,7 +5460,7 @@ const TaskItemInner = (props) => {
5532
5460
  {
5533
5461
  dataTestid: `task-relation-handle-right-${task.name}`,
5534
5462
  isRelationDrawMode: !!ganttRelationEvent,
5535
- x: !isSmallBar ? x22 + relationCircleOffset : x1 + 2 * handleWidth + relationCircleOffset,
5463
+ x: isSmallBar ? x1 + minimalBarWidth + relationCircleOffset + handleWidth : x22 + relationCircleOffset + handleWidth,
5536
5464
  y: taskYOffset + taskHalfHeight,
5537
5465
  radius: relationCircleRadius,
5538
5466
  startDrawRelation: onRightRelationTriggerMouseDown
@@ -5549,26 +5477,19 @@ const TaskItemInner = (props) => {
5549
5477
  children: relationhandles
5550
5478
  }
5551
5479
  );
5552
- } else if (isSmallBar) {
5553
- return /* @__PURE__ */ jsx(
5554
- BarSmall,
5555
- {
5556
- ...props,
5557
- colorStyles: styles2,
5558
- onTaskEventStart,
5559
- children: relationhandles
5560
- }
5561
- );
5562
- } else
5480
+ } else {
5563
5481
  return /* @__PURE__ */ jsx(
5564
5482
  Bar,
5565
5483
  {
5566
5484
  ...props,
5567
- onTaskEventStart,
5568
5485
  colorStyles: styles2,
5486
+ width: isSmallBar ? minimalBarWidth : width,
5487
+ showProgress: isSmallBar ? false : showProgress,
5488
+ onTaskEventStart,
5569
5489
  children: relationhandles
5570
5490
  }
5571
5491
  );
5492
+ }
5572
5493
  }, [
5573
5494
  handleWidth,
5574
5495
  isSelected,
@@ -5607,7 +5528,7 @@ const TaskItemInner = (props) => {
5607
5528
  const onMouseLeave = useCallback(() => {
5608
5529
  setTooltipTask(null, null);
5609
5530
  }, [setTooltipTask]);
5610
- let barLabelFill = isTextInside || task.type == "milestone" ? styles2.barLabelColor : styles2.barLabelWhenOutsideColor;
5531
+ let barLabelFill = isTextInside || task.type === "milestone" ? styles2.barLabelColor : styles2.barLabelWhenOutsideColor;
5611
5532
  return /* @__PURE__ */ jsxs(
5612
5533
  "g",
5613
5534
  {
@@ -5776,6 +5697,7 @@ const TaskGanttContent = ({
5776
5697
  if (task.type === "empty") {
5777
5698
  continue;
5778
5699
  }
5700
+ const { isDisabled, showProgress = true } = task;
5779
5701
  const key = `${comparisonLevel}_${task.id}`;
5780
5702
  const criticalPathOnLevel = criticalPaths ? criticalPaths.get(comparisonLevel) : void 0;
5781
5703
  const isCritical = criticalPathOnLevel ? criticalPathOnLevel.tasks.has(task.id) : false;
@@ -5821,12 +5743,13 @@ const TaskGanttContent = ({
5821
5743
  distances,
5822
5744
  taskHeight,
5823
5745
  taskHalfHeight,
5824
- isProgressChangeable: !task.isDisabled,
5825
- isDateChangeable: !task.isDisabled,
5746
+ isProgressChangeable: !isDisabled,
5747
+ showProgress,
5748
+ isDateChangeable: !isDisabled,
5826
5749
  isRelationChangeable: !task.isRelationDisabled,
5827
5750
  authorizedRelations,
5828
5751
  ganttRelationEvent,
5829
- isDelete: !task.isDisabled,
5752
+ isDelete: !isDisabled,
5830
5753
  onDoubleClick,
5831
5754
  onClick,
5832
5755
  onEventStart: handleTaskDragStart,
@@ -11391,7 +11314,8 @@ const defaultDistances = {
11391
11314
  relationCircleRadius: 5,
11392
11315
  rowHeight: 50,
11393
11316
  taskWarningOffset: 35,
11394
- titleCellWidth: 220
11317
+ titleCellWidth: 220,
11318
+ minimalBarWidth: 8
11395
11319
  };
11396
11320
  const MINIMUM_DISPLAYED_TIME_UNIT = 30;
11397
11321
  const Gantt = ({
@@ -4640,6 +4640,7 @@
4640
4640
  hasChildren,
4641
4641
  height,
4642
4642
  progressWidth,
4643
+ showProgress,
4643
4644
  progressX,
4644
4645
  startMoveFullTask,
4645
4646
  styles: styles2,
@@ -4722,7 +4723,7 @@
4722
4723
  className: styles$6.barBackground
4723
4724
  }
4724
4725
  ),
4725
- /* @__PURE__ */ jsxRuntime.jsx(
4726
+ showProgress && /* @__PURE__ */ jsxRuntime.jsx(
4726
4727
  "rect",
4727
4728
  {
4728
4729
  x: progressX,
@@ -4817,12 +4818,13 @@
4817
4818
  isSelected,
4818
4819
  isCritical,
4819
4820
  colorStyles,
4821
+ showProgress,
4820
4822
  progressWidth,
4821
4823
  progressX,
4822
4824
  taskYOffset,
4823
4825
  width,
4824
4826
  x1,
4825
- x2,
4827
+ //x2,
4826
4828
  startMoveFullTask
4827
4829
  }) => {
4828
4830
  const barColor = React.useMemo(() => {
@@ -4849,22 +4851,6 @@
4849
4851
  }
4850
4852
  return colorStyles.projectProgressColor;
4851
4853
  }, [isSelected, isCritical, colorStyles]);
4852
- const projectLeftTriangle = [
4853
- x1,
4854
- taskYOffset + taskHeight / 2 - 1,
4855
- x1,
4856
- taskYOffset + taskHeight,
4857
- x1 + 15,
4858
- taskYOffset + taskHeight / 2 - 1
4859
- ].join(",");
4860
- const projectRightTriangle = [
4861
- x2,
4862
- taskYOffset + taskHeight / 2 - 1,
4863
- x2,
4864
- taskYOffset + taskHeight,
4865
- x2 - 15,
4866
- taskYOffset + taskHeight / 2 - 1
4867
- ].join(",");
4868
4854
  return /* @__PURE__ */ jsxRuntime.jsxs(
4869
4855
  "g",
4870
4856
  {
@@ -4894,7 +4880,7 @@
4894
4880
  className: styles$4.projectBackground
4895
4881
  }
4896
4882
  ),
4897
- /* @__PURE__ */ jsxRuntime.jsx(
4883
+ showProgress && /* @__PURE__ */ jsxRuntime.jsx(
4898
4884
  "rect",
4899
4885
  {
4900
4886
  x: progressX,
@@ -4906,7 +4892,7 @@
4906
4892
  fill: processColor
4907
4893
  }
4908
4894
  ),
4909
- /* @__PURE__ */ jsxRuntime.jsx(
4895
+ showProgress && /* @__PURE__ */ jsxRuntime.jsx(
4910
4896
  "rect",
4911
4897
  {
4912
4898
  fill: barColor,
@@ -4919,20 +4905,26 @@
4919
4905
  className: styles$4.projectTop
4920
4906
  }
4921
4907
  ),
4922
- /* @__PURE__ */ jsxRuntime.jsx(
4923
- "polygon",
4908
+ showProgress && /* @__PURE__ */ jsxRuntime.jsx(
4909
+ "rect",
4924
4910
  {
4925
- className: styles$4.projectTop,
4926
- points: projectLeftTriangle,
4927
- fill: barColor
4911
+ fill: barColor,
4912
+ x: x1,
4913
+ y: taskYOffset + taskHalfHeight - barCornerRadius,
4914
+ width: barCornerRadius,
4915
+ height: barCornerRadius,
4916
+ className: styles$4.projectTop
4928
4917
  }
4929
4918
  ),
4930
- /* @__PURE__ */ jsxRuntime.jsx(
4931
- "polygon",
4919
+ showProgress && /* @__PURE__ */ jsxRuntime.jsx(
4920
+ "rect",
4932
4921
  {
4933
- className: styles$4.projectTop,
4934
- points: projectRightTriangle,
4935
- fill: barColor
4922
+ fill: barColor,
4923
+ x: x1 + width - barCornerRadius,
4924
+ y: taskYOffset + taskHalfHeight - barCornerRadius,
4925
+ width: barCornerRadius,
4926
+ height: barCornerRadius,
4927
+ className: styles$4.projectTop
4936
4928
  }
4937
4929
  )
4938
4930
  ]
@@ -4947,6 +4939,7 @@
4947
4939
  isCritical,
4948
4940
  isDateChangeable,
4949
4941
  isProgressChangeable,
4942
+ showProgress,
4950
4943
  isSelected,
4951
4944
  onTaskEventStart,
4952
4945
  progressWidth,
@@ -5002,6 +4995,7 @@
5002
4995
  width,
5003
4996
  taskHeight,
5004
4997
  taskHalfHeight,
4998
+ showProgress,
5005
4999
  progressX,
5006
5000
  progressWidth,
5007
5001
  barCornerRadius,
@@ -5021,6 +5015,7 @@
5021
5015
  y: taskYOffset,
5022
5016
  width,
5023
5017
  height: taskHeight,
5018
+ showProgress,
5024
5019
  progressX,
5025
5020
  progressWidth,
5026
5021
  barCornerRadius,
@@ -5047,7 +5042,7 @@
5047
5042
  height: handleHeight,
5048
5043
  startMove: startMoveStartOfTask,
5049
5044
  width: handleWidth,
5050
- x: x1 + 1,
5045
+ x: x1 - handleWidth,
5051
5046
  y: taskYOffset + 1
5052
5047
  }
5053
5048
  ),
@@ -5059,12 +5054,12 @@
5059
5054
  height: handleHeight,
5060
5055
  startMove: startMoveEndOfTask,
5061
5056
  width: handleWidth,
5062
- x: x2 - handleWidth - 1,
5057
+ x: x1 + width,
5063
5058
  y: taskYOffset + 1
5064
5059
  }
5065
5060
  ),
5066
5061
  relationhandles,
5067
- isProgressChangeable && /* @__PURE__ */ jsxRuntime.jsx(
5062
+ isProgressChangeable && showProgress && /* @__PURE__ */ jsxRuntime.jsx(
5068
5063
  BarProgressHandle,
5069
5064
  {
5070
5065
  taskName: task.name,
@@ -5076,75 +5071,6 @@
5076
5071
  }
5077
5072
  );
5078
5073
  };
5079
- const BarSmall = ({
5080
- children: relationhandles,
5081
- colorStyles,
5082
- distances: { barCornerRadius, handleWidth },
5083
- hasChildren,
5084
- isSelected,
5085
- isCritical,
5086
- isDateChangeable,
5087
- onTaskEventStart,
5088
- progressWidth,
5089
- progressX,
5090
- taskYOffset,
5091
- task,
5092
- taskHeight,
5093
- x1
5094
- }) => {
5095
- const startMoveFullTask = React.useCallback(
5096
- (clientX) => {
5097
- onTaskEventStart("move", clientX);
5098
- },
5099
- [onTaskEventStart]
5100
- );
5101
- const startMoveEndOfTask = React.useCallback(
5102
- (clientX) => {
5103
- onTaskEventStart("end", clientX);
5104
- },
5105
- [onTaskEventStart]
5106
- );
5107
- return /* @__PURE__ */ jsxRuntime.jsxs(
5108
- "g",
5109
- {
5110
- className: `${styles$6.barWrapper} ${styles$5.barRelationHandleWrapper}`,
5111
- tabIndex: 0,
5112
- children: [
5113
- /* @__PURE__ */ jsxRuntime.jsx(
5114
- BarDisplay,
5115
- {
5116
- taskName: task.name,
5117
- barCornerRadius,
5118
- hasChildren,
5119
- height: taskHeight,
5120
- isCritical,
5121
- isSelected,
5122
- progressWidth,
5123
- progressX,
5124
- startMoveFullTask,
5125
- styles: colorStyles,
5126
- width: handleWidth * 2,
5127
- x: x1,
5128
- y: taskYOffset
5129
- }
5130
- ),
5131
- isDateChangeable && /* @__PURE__ */ jsxRuntime.jsx(
5132
- BarDateHandle,
5133
- {
5134
- dataTestid: `task-date-handle-right-${task.name}`,
5135
- barCornerRadius,
5136
- height: taskHeight - 2,
5137
- startMove: startMoveEndOfTask,
5138
- width: handleWidth,
5139
- x: x1 + handleWidth,
5140
- y: taskYOffset + 1
5141
- }
5142
- ),
5143
- relationhandles
5144
- ]
5145
- }
5146
- );
5147
- };
5148
5074
  const milestoneWrapper = "_milestoneWrapper_xr9to_1";
5149
5075
  const milestoneBackground = "_milestoneBackground_xr9to_6";
5150
5076
  const styles$3 = {
@@ -5284,8 +5210,8 @@
5284
5210
  ] });
5285
5211
  };
5286
5212
  const TaskWarning = React.memo(TaskWarningInner);
5287
- const barLabel = "_barLabel_pu5db_1";
5288
- const barLabelOutside = "_barLabelOutside_pu5db_13";
5213
+ const barLabel = "_barLabel_5gth7_1";
5214
+ const barLabelOutside = "_barLabelOutside_5gth7_13";
5289
5215
  const style = {
5290
5216
  barLabel,
5291
5217
  barLabelOutside
@@ -5405,7 +5331,8 @@
5405
5331
  handleWidth,
5406
5332
  taskWarningOffset,
5407
5333
  relationCircleOffset,
5408
- relationCircleRadius
5334
+ relationCircleRadius,
5335
+ minimalBarWidth
5409
5336
  },
5410
5337
  fixEndPosition = void 0,
5411
5338
  fixStartPosition = void 0,
@@ -5425,6 +5352,7 @@
5425
5352
  rtl,
5426
5353
  selectTaskOnMouseDown,
5427
5354
  setTooltipTask,
5355
+ showProgress,
5428
5356
  task,
5429
5357
  task: { styles: taskStyles },
5430
5358
  taskHalfHeight,
@@ -5527,14 +5455,14 @@
5527
5455
  } else {
5528
5456
  displayRightRelationHandle = rtl ? isFromStartRelationAuthorized : isFromEndRelationAuthorized;
5529
5457
  }
5530
- const isSmallBar = width < handleWidth * 2;
5458
+ const isSmallBar = width < minimalBarWidth;
5531
5459
  const relationhandles = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5532
5460
  isRelationChangeable && displayLeftRelationHandle && /* @__PURE__ */ jsxRuntime.jsx(
5533
5461
  BarRelationHandle,
5534
5462
  {
5535
5463
  dataTestid: `task-relation-handle-left-${task.name}`,
5536
5464
  isRelationDrawMode: !!ganttRelationEvent,
5537
- x: x1 - relationCircleOffset,
5465
+ x: x1 - relationCircleOffset - handleWidth,
5538
5466
  y: taskYOffset + taskHalfHeight,
5539
5467
  radius: relationCircleRadius,
5540
5468
  startDrawRelation: onLeftRelationTriggerMouseDown
@@ -5545,7 +5473,7 @@
5545
5473
  {
5546
5474
  dataTestid: `task-relation-handle-right-${task.name}`,
5547
5475
  isRelationDrawMode: !!ganttRelationEvent,
5548
- x: !isSmallBar ? x2 + relationCircleOffset : x1 + 2 * handleWidth + relationCircleOffset,
5476
+ x: isSmallBar ? x1 + minimalBarWidth + relationCircleOffset + handleWidth : x2 + relationCircleOffset + handleWidth,
5549
5477
  y: taskYOffset + taskHalfHeight,
5550
5478
  radius: relationCircleRadius,
5551
5479
  startDrawRelation: onRightRelationTriggerMouseDown
@@ -5562,26 +5490,19 @@
5562
5490
  children: relationhandles
5563
5491
  }
5564
5492
  );
5565
- } else if (isSmallBar) {
5566
- return /* @__PURE__ */ jsxRuntime.jsx(
5567
- BarSmall,
5568
- {
5569
- ...props,
5570
- colorStyles: styles2,
5571
- onTaskEventStart,
5572
- children: relationhandles
5573
- }
5574
- );
5575
- } else
5493
+ } else {
5576
5494
  return /* @__PURE__ */ jsxRuntime.jsx(
5577
5495
  Bar,
5578
5496
  {
5579
5497
  ...props,
5580
- onTaskEventStart,
5581
5498
  colorStyles: styles2,
5499
+ width: isSmallBar ? minimalBarWidth : width,
5500
+ showProgress: isSmallBar ? false : showProgress,
5501
+ onTaskEventStart,
5582
5502
  children: relationhandles
5583
5503
  }
5584
5504
  );
5505
+ }
5585
5506
  }, [
5586
5507
  handleWidth,
5587
5508
  isSelected,
@@ -5620,7 +5541,7 @@
5620
5541
  const onMouseLeave = React.useCallback(() => {
5621
5542
  setTooltipTask(null, null);
5622
5543
  }, [setTooltipTask]);
5623
- let barLabelFill = isTextInside || task.type == "milestone" ? styles2.barLabelColor : styles2.barLabelWhenOutsideColor;
5544
+ let barLabelFill = isTextInside || task.type === "milestone" ? styles2.barLabelColor : styles2.barLabelWhenOutsideColor;
5624
5545
  return /* @__PURE__ */ jsxRuntime.jsxs(
5625
5546
  "g",
5626
5547
  {
@@ -5789,6 +5710,7 @@
5789
5710
  if (task.type === "empty") {
5790
5711
  continue;
5791
5712
  }
5713
+ const { isDisabled, showProgress = true } = task;
5792
5714
  const key = `${comparisonLevel}_${task.id}`;
5793
5715
  const criticalPathOnLevel = criticalPaths ? criticalPaths.get(comparisonLevel) : void 0;
5794
5716
  const isCritical = criticalPathOnLevel ? criticalPathOnLevel.tasks.has(task.id) : false;
@@ -5834,12 +5756,13 @@
5834
5756
  distances,
5835
5757
  taskHeight,
5836
5758
  taskHalfHeight,
5837
- isProgressChangeable: !task.isDisabled,
5838
- isDateChangeable: !task.isDisabled,
5759
+ isProgressChangeable: !isDisabled,
5760
+ showProgress,
5761
+ isDateChangeable: !isDisabled,
5839
5762
  isRelationChangeable: !task.isRelationDisabled,
5840
5763
  authorizedRelations,
5841
5764
  ganttRelationEvent,
5842
- isDelete: !task.isDisabled,
5765
+ isDelete: !isDisabled,
5843
5766
  onDoubleClick,
5844
5767
  onClick,
5845
5768
  onEventStart: handleTaskDragStart,
@@ -11404,7 +11327,8 @@
11404
11327
  relationCircleRadius: 5,
11405
11328
  rowHeight: 50,
11406
11329
  taskWarningOffset: 35,
11407
- titleCellWidth: 220
11330
+ titleCellWidth: 220,
11331
+ minimalBarWidth: 8
11408
11332
  };
11409
11333
  const MINIMUM_DISPLAYED_TIME_UNIT = 30;
11410
11334
  const Gantt = ({
package/dist/style.css CHANGED
@@ -436,7 +436,7 @@
436
436
  ._milestoneBackground_xr9to_6 {
437
437
  user-select: none;
438
438
  }
439
- ._barLabel_pu5db_1 {
439
+ ._barLabel_5gth7_1 {
440
440
  text-anchor: middle;
441
441
  font-weight: lighter;
442
442
  dominant-baseline: central;
@@ -448,8 +448,9 @@
448
448
  pointer-events: none;
449
449
  }
450
450
 
451
- ._barLabelOutside_pu5db_13 {
451
+ ._barLabelOutside_5gth7_13 {
452
452
  text-anchor: start;
453
+ dominant-baseline: central;
453
454
  -webkit-touch-callout: none;
454
455
  -webkit-user-select: none;
455
456
  -moz-user-select: none;
@@ -125,6 +125,7 @@ export interface Distances {
125
125
  handleWidth: number;
126
126
  headerHeight: number;
127
127
  minimumRowDisplayed: number;
128
+ minimalBarWidth: number;
128
129
  nestedTaskNameOffset: number;
129
130
  relationCircleOffset: number;
130
131
  relationCircleRadius: number;
@@ -147,6 +148,7 @@ export interface Task {
147
148
  assignees?: string[];
148
149
  styles?: Partial<ColorStyles>;
149
150
  isDisabled?: boolean;
151
+ showProgress?: boolean;
150
152
  isRelationDisabled?: boolean;
151
153
  /**
152
154
  * Project or task
@@ -165,6 +167,7 @@ export interface EmptyTask {
165
167
  comparisonLevel?: number;
166
168
  displayOrder?: number;
167
169
  isDisabled?: boolean;
170
+ showProgress?: boolean;
168
171
  styles?: Partial<ColorStyles>;
169
172
  }
170
173
  export type TaskOrEmpty = Task | EmptyTask;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ssfm/gantt-task-react",
3
- "version": "0.6.18",
3
+ "version": "0.6.19",
4
4
  "description": "Interactive Gantt Chart for React with TypeScript",
5
5
  "author": "Dmitry Kostochko <dkostochko@users.noreply.github.com>",
6
6
  "homepage": "https://github.com/dkostochko/gantt-task-react/blob/main/README.md#gantt-task-react",
@@ -43,6 +43,7 @@
43
43
  ],
44
44
  "scripts": {
45
45
  "storybook": "storybook dev",
46
+ "storybook:clean": "rm -rf node_modules/.cache/storybook node_modules/.cache/sb-*",
46
47
  "build": "vite build && tsc",
47
48
  "start": "vite --host",
48
49
  "prepare": "run-s build",