@ssfm/gantt-task-react 0.6.17 → 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;
@@ -3770,34 +3770,39 @@ const Calendar = ({
3770
3770
  const topValues2 = [];
3771
3771
  const bottomValues2 = [];
3772
3772
  const topDefaultHeight = headerHeight * 0.5;
3773
+ const quarterTextOffset = columnWidth * 0.5;
3773
3774
  for (let i2 = startColumnIndex; i2 <= endColumnIndex; i2++) {
3774
3775
  const date = getDate(i2);
3775
- const quarter = "Q" + Math.ceil((date.getMonth() + 1) / 3);
3776
+ const quarterIndex = Math.ceil((date.getMonth() + 1) / 3);
3777
+ const quarterText = "Q" + quarterIndex;
3778
+ const quarterXPosition = additionalLeftSpace + columnWidth * i2;
3776
3779
  bottomValues2.push(
3777
3780
  /* @__PURE__ */ jsx(
3778
3781
  "text",
3779
3782
  {
3780
3783
  y: headerHeight * 0.8,
3781
- x: additionalLeftSpace + columnWidth * i2 + columnWidth * 0.5,
3784
+ x: quarterXPosition + quarterTextOffset,
3782
3785
  className: styles$a.calendarBottomText,
3783
3786
  style: { fill: colors.barLabelColor },
3784
- children: quarter
3787
+ children: quarterText
3785
3788
  },
3786
- `${quarter}-${date.getFullYear()}`
3789
+ `${quarterText}-${date.getFullYear()}`
3787
3790
  )
3788
3791
  );
3792
+ if (quarterIndex > 1) {
3793
+ continue;
3794
+ }
3789
3795
  if (!isUnknownDates && (i2 === startColumnIndex || date.getFullYear() !== getDate(i2 - 1).getFullYear())) {
3790
3796
  const topValue = date.getFullYear().toString();
3791
- const startQuarter = Math.floor(i2 / 3) * 3;
3792
3797
  topValues2.push(
3793
3798
  /* @__PURE__ */ jsx(
3794
3799
  TopPartOfCalendar,
3795
3800
  {
3796
3801
  value: topValue,
3797
- x1Line: additionalLeftSpace + columnWidth * startQuarter,
3802
+ x1Line: quarterXPosition,
3798
3803
  y1Line: 0,
3799
3804
  y2Line: topDefaultHeight,
3800
- xText: additionalLeftSpace + columnWidth * (startQuarter + 1.5),
3805
+ xText: quarterXPosition + columnWidth * 2,
3801
3806
  yText: topDefaultHeight * 0.9,
3802
3807
  colors
3803
3808
  },
@@ -4622,6 +4627,7 @@ const BarDisplay = ({
4622
4627
  hasChildren,
4623
4628
  height,
4624
4629
  progressWidth,
4630
+ showProgress,
4625
4631
  progressX,
4626
4632
  startMoveFullTask,
4627
4633
  styles: styles2,
@@ -4704,7 +4710,7 @@ const BarDisplay = ({
4704
4710
  className: styles$6.barBackground
4705
4711
  }
4706
4712
  ),
4707
- /* @__PURE__ */ jsx(
4713
+ showProgress && /* @__PURE__ */ jsx(
4708
4714
  "rect",
4709
4715
  {
4710
4716
  x: progressX,
@@ -4799,12 +4805,13 @@ const ProjectDisplay = ({
4799
4805
  isSelected,
4800
4806
  isCritical,
4801
4807
  colorStyles,
4808
+ showProgress,
4802
4809
  progressWidth,
4803
4810
  progressX,
4804
4811
  taskYOffset,
4805
4812
  width,
4806
4813
  x1,
4807
- x2: x22,
4814
+ //x2,
4808
4815
  startMoveFullTask
4809
4816
  }) => {
4810
4817
  const barColor = useMemo(() => {
@@ -4831,22 +4838,6 @@ const ProjectDisplay = ({
4831
4838
  }
4832
4839
  return colorStyles.projectProgressColor;
4833
4840
  }, [isSelected, isCritical, colorStyles]);
4834
- const projectLeftTriangle = [
4835
- x1,
4836
- taskYOffset + taskHeight / 2 - 1,
4837
- x1,
4838
- taskYOffset + taskHeight,
4839
- x1 + 15,
4840
- taskYOffset + taskHeight / 2 - 1
4841
- ].join(",");
4842
- const projectRightTriangle = [
4843
- x22,
4844
- taskYOffset + taskHeight / 2 - 1,
4845
- x22,
4846
- taskYOffset + taskHeight,
4847
- x22 - 15,
4848
- taskYOffset + taskHeight / 2 - 1
4849
- ].join(",");
4850
4841
  return /* @__PURE__ */ jsxs(
4851
4842
  "g",
4852
4843
  {
@@ -4876,7 +4867,7 @@ const ProjectDisplay = ({
4876
4867
  className: styles$4.projectBackground
4877
4868
  }
4878
4869
  ),
4879
- /* @__PURE__ */ jsx(
4870
+ showProgress && /* @__PURE__ */ jsx(
4880
4871
  "rect",
4881
4872
  {
4882
4873
  x: progressX,
@@ -4888,7 +4879,7 @@ const ProjectDisplay = ({
4888
4879
  fill: processColor
4889
4880
  }
4890
4881
  ),
4891
- /* @__PURE__ */ jsx(
4882
+ showProgress && /* @__PURE__ */ jsx(
4892
4883
  "rect",
4893
4884
  {
4894
4885
  fill: barColor,
@@ -4901,20 +4892,26 @@ const ProjectDisplay = ({
4901
4892
  className: styles$4.projectTop
4902
4893
  }
4903
4894
  ),
4904
- /* @__PURE__ */ jsx(
4905
- "polygon",
4895
+ showProgress && /* @__PURE__ */ jsx(
4896
+ "rect",
4906
4897
  {
4907
- className: styles$4.projectTop,
4908
- points: projectLeftTriangle,
4909
- fill: barColor
4898
+ fill: barColor,
4899
+ x: x1,
4900
+ y: taskYOffset + taskHalfHeight - barCornerRadius,
4901
+ width: barCornerRadius,
4902
+ height: barCornerRadius,
4903
+ className: styles$4.projectTop
4910
4904
  }
4911
4905
  ),
4912
- /* @__PURE__ */ jsx(
4913
- "polygon",
4906
+ showProgress && /* @__PURE__ */ jsx(
4907
+ "rect",
4914
4908
  {
4915
- className: styles$4.projectTop,
4916
- points: projectRightTriangle,
4917
- 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
4918
4915
  }
4919
4916
  )
4920
4917
  ]
@@ -4929,6 +4926,7 @@ const Bar = ({
4929
4926
  isCritical,
4930
4927
  isDateChangeable,
4931
4928
  isProgressChangeable,
4929
+ showProgress,
4932
4930
  isSelected,
4933
4931
  onTaskEventStart,
4934
4932
  progressWidth,
@@ -4984,6 +4982,7 @@ const Bar = ({
4984
4982
  width,
4985
4983
  taskHeight,
4986
4984
  taskHalfHeight,
4985
+ showProgress,
4987
4986
  progressX,
4988
4987
  progressWidth,
4989
4988
  barCornerRadius,
@@ -5003,6 +5002,7 @@ const Bar = ({
5003
5002
  y: taskYOffset,
5004
5003
  width,
5005
5004
  height: taskHeight,
5005
+ showProgress,
5006
5006
  progressX,
5007
5007
  progressWidth,
5008
5008
  barCornerRadius,
@@ -5029,7 +5029,7 @@ const Bar = ({
5029
5029
  height: handleHeight,
5030
5030
  startMove: startMoveStartOfTask,
5031
5031
  width: handleWidth,
5032
- x: x1 + 1,
5032
+ x: x1 - handleWidth,
5033
5033
  y: taskYOffset + 1
5034
5034
  }
5035
5035
  ),
@@ -5041,12 +5041,12 @@ const Bar = ({
5041
5041
  height: handleHeight,
5042
5042
  startMove: startMoveEndOfTask,
5043
5043
  width: handleWidth,
5044
- x: x22 - handleWidth - 1,
5044
+ x: x1 + width,
5045
5045
  y: taskYOffset + 1
5046
5046
  }
5047
5047
  ),
5048
5048
  relationhandles,
5049
- isProgressChangeable && /* @__PURE__ */ jsx(
5049
+ isProgressChangeable && showProgress && /* @__PURE__ */ jsx(
5050
5050
  BarProgressHandle,
5051
5051
  {
5052
5052
  taskName: task.name,
@@ -5058,75 +5058,6 @@ const Bar = ({
5058
5058
  }
5059
5059
  );
5060
5060
  };
5061
- const BarSmall = ({
5062
- children: relationhandles,
5063
- colorStyles,
5064
- distances: { barCornerRadius, handleWidth },
5065
- hasChildren,
5066
- isSelected,
5067
- isCritical,
5068
- isDateChangeable,
5069
- onTaskEventStart,
5070
- progressWidth,
5071
- progressX,
5072
- taskYOffset,
5073
- task,
5074
- taskHeight,
5075
- x1
5076
- }) => {
5077
- const startMoveFullTask = useCallback(
5078
- (clientX) => {
5079
- onTaskEventStart("move", clientX);
5080
- },
5081
- [onTaskEventStart]
5082
- );
5083
- const startMoveEndOfTask = useCallback(
5084
- (clientX) => {
5085
- onTaskEventStart("end", clientX);
5086
- },
5087
- [onTaskEventStart]
5088
- );
5089
- return /* @__PURE__ */ jsxs(
5090
- "g",
5091
- {
5092
- className: `${styles$6.barWrapper} ${styles$5.barRelationHandleWrapper}`,
5093
- tabIndex: 0,
5094
- children: [
5095
- /* @__PURE__ */ jsx(
5096
- BarDisplay,
5097
- {
5098
- taskName: task.name,
5099
- barCornerRadius,
5100
- hasChildren,
5101
- height: taskHeight,
5102
- isCritical,
5103
- isSelected,
5104
- progressWidth,
5105
- progressX,
5106
- startMoveFullTask,
5107
- styles: colorStyles,
5108
- width: handleWidth * 2,
5109
- x: x1,
5110
- y: taskYOffset
5111
- }
5112
- ),
5113
- isDateChangeable && /* @__PURE__ */ jsx(
5114
- BarDateHandle,
5115
- {
5116
- dataTestid: `task-date-handle-right-${task.name}`,
5117
- barCornerRadius,
5118
- height: taskHeight - 2,
5119
- startMove: startMoveEndOfTask,
5120
- width: handleWidth,
5121
- x: x1 + handleWidth,
5122
- y: taskYOffset + 1
5123
- }
5124
- ),
5125
- relationhandles
5126
- ]
5127
- }
5128
- );
5129
- };
5130
5061
  const milestoneWrapper = "_milestoneWrapper_xr9to_1";
5131
5062
  const milestoneBackground = "_milestoneBackground_xr9to_6";
5132
5063
  const styles$3 = {
@@ -5266,8 +5197,8 @@ const TaskWarningInner = ({
5266
5197
  ] });
5267
5198
  };
5268
5199
  const TaskWarning = memo(TaskWarningInner);
5269
- const barLabel = "_barLabel_pu5db_1";
5270
- const barLabelOutside = "_barLabelOutside_pu5db_13";
5200
+ const barLabel = "_barLabel_5gth7_1";
5201
+ const barLabelOutside = "_barLabelOutside_5gth7_13";
5271
5202
  const style = {
5272
5203
  barLabel,
5273
5204
  barLabelOutside
@@ -5387,7 +5318,8 @@ const TaskItemInner = (props) => {
5387
5318
  handleWidth,
5388
5319
  taskWarningOffset,
5389
5320
  relationCircleOffset,
5390
- relationCircleRadius
5321
+ relationCircleRadius,
5322
+ minimalBarWidth
5391
5323
  },
5392
5324
  fixEndPosition = void 0,
5393
5325
  fixStartPosition = void 0,
@@ -5407,6 +5339,7 @@ const TaskItemInner = (props) => {
5407
5339
  rtl,
5408
5340
  selectTaskOnMouseDown,
5409
5341
  setTooltipTask,
5342
+ showProgress,
5410
5343
  task,
5411
5344
  task: { styles: taskStyles },
5412
5345
  taskHalfHeight,
@@ -5509,14 +5442,14 @@ const TaskItemInner = (props) => {
5509
5442
  } else {
5510
5443
  displayRightRelationHandle = rtl ? isFromStartRelationAuthorized : isFromEndRelationAuthorized;
5511
5444
  }
5512
- const isSmallBar = width < handleWidth * 2;
5445
+ const isSmallBar = width < minimalBarWidth;
5513
5446
  const relationhandles = /* @__PURE__ */ jsxs(Fragment$1, { children: [
5514
5447
  isRelationChangeable && displayLeftRelationHandle && /* @__PURE__ */ jsx(
5515
5448
  BarRelationHandle,
5516
5449
  {
5517
5450
  dataTestid: `task-relation-handle-left-${task.name}`,
5518
5451
  isRelationDrawMode: !!ganttRelationEvent,
5519
- x: x1 - relationCircleOffset,
5452
+ x: x1 - relationCircleOffset - handleWidth,
5520
5453
  y: taskYOffset + taskHalfHeight,
5521
5454
  radius: relationCircleRadius,
5522
5455
  startDrawRelation: onLeftRelationTriggerMouseDown
@@ -5527,7 +5460,7 @@ const TaskItemInner = (props) => {
5527
5460
  {
5528
5461
  dataTestid: `task-relation-handle-right-${task.name}`,
5529
5462
  isRelationDrawMode: !!ganttRelationEvent,
5530
- x: !isSmallBar ? x22 + relationCircleOffset : x1 + 2 * handleWidth + relationCircleOffset,
5463
+ x: isSmallBar ? x1 + minimalBarWidth + relationCircleOffset + handleWidth : x22 + relationCircleOffset + handleWidth,
5531
5464
  y: taskYOffset + taskHalfHeight,
5532
5465
  radius: relationCircleRadius,
5533
5466
  startDrawRelation: onRightRelationTriggerMouseDown
@@ -5544,26 +5477,19 @@ const TaskItemInner = (props) => {
5544
5477
  children: relationhandles
5545
5478
  }
5546
5479
  );
5547
- } else if (isSmallBar) {
5548
- return /* @__PURE__ */ jsx(
5549
- BarSmall,
5550
- {
5551
- ...props,
5552
- colorStyles: styles2,
5553
- onTaskEventStart,
5554
- children: relationhandles
5555
- }
5556
- );
5557
- } else
5480
+ } else {
5558
5481
  return /* @__PURE__ */ jsx(
5559
5482
  Bar,
5560
5483
  {
5561
5484
  ...props,
5562
- onTaskEventStart,
5563
5485
  colorStyles: styles2,
5486
+ width: isSmallBar ? minimalBarWidth : width,
5487
+ showProgress: isSmallBar ? false : showProgress,
5488
+ onTaskEventStart,
5564
5489
  children: relationhandles
5565
5490
  }
5566
5491
  );
5492
+ }
5567
5493
  }, [
5568
5494
  handleWidth,
5569
5495
  isSelected,
@@ -5602,7 +5528,7 @@ const TaskItemInner = (props) => {
5602
5528
  const onMouseLeave = useCallback(() => {
5603
5529
  setTooltipTask(null, null);
5604
5530
  }, [setTooltipTask]);
5605
- let barLabelFill = isTextInside || task.type == "milestone" ? styles2.barLabelColor : styles2.barLabelWhenOutsideColor;
5531
+ let barLabelFill = isTextInside || task.type === "milestone" ? styles2.barLabelColor : styles2.barLabelWhenOutsideColor;
5606
5532
  return /* @__PURE__ */ jsxs(
5607
5533
  "g",
5608
5534
  {
@@ -5771,6 +5697,7 @@ const TaskGanttContent = ({
5771
5697
  if (task.type === "empty") {
5772
5698
  continue;
5773
5699
  }
5700
+ const { isDisabled, showProgress = true } = task;
5774
5701
  const key = `${comparisonLevel}_${task.id}`;
5775
5702
  const criticalPathOnLevel = criticalPaths ? criticalPaths.get(comparisonLevel) : void 0;
5776
5703
  const isCritical = criticalPathOnLevel ? criticalPathOnLevel.tasks.has(task.id) : false;
@@ -5816,12 +5743,13 @@ const TaskGanttContent = ({
5816
5743
  distances,
5817
5744
  taskHeight,
5818
5745
  taskHalfHeight,
5819
- isProgressChangeable: !task.isDisabled,
5820
- isDateChangeable: !task.isDisabled,
5746
+ isProgressChangeable: !isDisabled,
5747
+ showProgress,
5748
+ isDateChangeable: !isDisabled,
5821
5749
  isRelationChangeable: !task.isRelationDisabled,
5822
5750
  authorizedRelations,
5823
5751
  ganttRelationEvent,
5824
- isDelete: !task.isDisabled,
5752
+ isDelete: !isDisabled,
5825
5753
  onDoubleClick,
5826
5754
  onClick,
5827
5755
  onEventStart: handleTaskDragStart,
@@ -11386,7 +11314,8 @@ const defaultDistances = {
11386
11314
  relationCircleRadius: 5,
11387
11315
  rowHeight: 50,
11388
11316
  taskWarningOffset: 35,
11389
- titleCellWidth: 220
11317
+ titleCellWidth: 220,
11318
+ minimalBarWidth: 8
11390
11319
  };
11391
11320
  const MINIMUM_DISPLAYED_TIME_UNIT = 30;
11392
11321
  const Gantt = ({
@@ -3783,34 +3783,39 @@
3783
3783
  const topValues2 = [];
3784
3784
  const bottomValues2 = [];
3785
3785
  const topDefaultHeight = headerHeight * 0.5;
3786
+ const quarterTextOffset = columnWidth * 0.5;
3786
3787
  for (let i = startColumnIndex; i <= endColumnIndex; i++) {
3787
3788
  const date = getDate(i);
3788
- const quarter = "Q" + Math.ceil((date.getMonth() + 1) / 3);
3789
+ const quarterIndex = Math.ceil((date.getMonth() + 1) / 3);
3790
+ const quarterText = "Q" + quarterIndex;
3791
+ const quarterXPosition = additionalLeftSpace + columnWidth * i;
3789
3792
  bottomValues2.push(
3790
3793
  /* @__PURE__ */ jsxRuntime.jsx(
3791
3794
  "text",
3792
3795
  {
3793
3796
  y: headerHeight * 0.8,
3794
- x: additionalLeftSpace + columnWidth * i + columnWidth * 0.5,
3797
+ x: quarterXPosition + quarterTextOffset,
3795
3798
  className: styles$a.calendarBottomText,
3796
3799
  style: { fill: colors.barLabelColor },
3797
- children: quarter
3800
+ children: quarterText
3798
3801
  },
3799
- `${quarter}-${date.getFullYear()}`
3802
+ `${quarterText}-${date.getFullYear()}`
3800
3803
  )
3801
3804
  );
3805
+ if (quarterIndex > 1) {
3806
+ continue;
3807
+ }
3802
3808
  if (!isUnknownDates && (i === startColumnIndex || date.getFullYear() !== getDate(i - 1).getFullYear())) {
3803
3809
  const topValue = date.getFullYear().toString();
3804
- const startQuarter = Math.floor(i / 3) * 3;
3805
3810
  topValues2.push(
3806
3811
  /* @__PURE__ */ jsxRuntime.jsx(
3807
3812
  TopPartOfCalendar,
3808
3813
  {
3809
3814
  value: topValue,
3810
- x1Line: additionalLeftSpace + columnWidth * startQuarter,
3815
+ x1Line: quarterXPosition,
3811
3816
  y1Line: 0,
3812
3817
  y2Line: topDefaultHeight,
3813
- xText: additionalLeftSpace + columnWidth * (startQuarter + 1.5),
3818
+ xText: quarterXPosition + columnWidth * 2,
3814
3819
  yText: topDefaultHeight * 0.9,
3815
3820
  colors
3816
3821
  },
@@ -4635,6 +4640,7 @@
4635
4640
  hasChildren,
4636
4641
  height,
4637
4642
  progressWidth,
4643
+ showProgress,
4638
4644
  progressX,
4639
4645
  startMoveFullTask,
4640
4646
  styles: styles2,
@@ -4717,7 +4723,7 @@
4717
4723
  className: styles$6.barBackground
4718
4724
  }
4719
4725
  ),
4720
- /* @__PURE__ */ jsxRuntime.jsx(
4726
+ showProgress && /* @__PURE__ */ jsxRuntime.jsx(
4721
4727
  "rect",
4722
4728
  {
4723
4729
  x: progressX,
@@ -4812,12 +4818,13 @@
4812
4818
  isSelected,
4813
4819
  isCritical,
4814
4820
  colorStyles,
4821
+ showProgress,
4815
4822
  progressWidth,
4816
4823
  progressX,
4817
4824
  taskYOffset,
4818
4825
  width,
4819
4826
  x1,
4820
- x2,
4827
+ //x2,
4821
4828
  startMoveFullTask
4822
4829
  }) => {
4823
4830
  const barColor = React.useMemo(() => {
@@ -4844,22 +4851,6 @@
4844
4851
  }
4845
4852
  return colorStyles.projectProgressColor;
4846
4853
  }, [isSelected, isCritical, colorStyles]);
4847
- const projectLeftTriangle = [
4848
- x1,
4849
- taskYOffset + taskHeight / 2 - 1,
4850
- x1,
4851
- taskYOffset + taskHeight,
4852
- x1 + 15,
4853
- taskYOffset + taskHeight / 2 - 1
4854
- ].join(",");
4855
- const projectRightTriangle = [
4856
- x2,
4857
- taskYOffset + taskHeight / 2 - 1,
4858
- x2,
4859
- taskYOffset + taskHeight,
4860
- x2 - 15,
4861
- taskYOffset + taskHeight / 2 - 1
4862
- ].join(",");
4863
4854
  return /* @__PURE__ */ jsxRuntime.jsxs(
4864
4855
  "g",
4865
4856
  {
@@ -4889,7 +4880,7 @@
4889
4880
  className: styles$4.projectBackground
4890
4881
  }
4891
4882
  ),
4892
- /* @__PURE__ */ jsxRuntime.jsx(
4883
+ showProgress && /* @__PURE__ */ jsxRuntime.jsx(
4893
4884
  "rect",
4894
4885
  {
4895
4886
  x: progressX,
@@ -4901,7 +4892,7 @@
4901
4892
  fill: processColor
4902
4893
  }
4903
4894
  ),
4904
- /* @__PURE__ */ jsxRuntime.jsx(
4895
+ showProgress && /* @__PURE__ */ jsxRuntime.jsx(
4905
4896
  "rect",
4906
4897
  {
4907
4898
  fill: barColor,
@@ -4914,20 +4905,26 @@
4914
4905
  className: styles$4.projectTop
4915
4906
  }
4916
4907
  ),
4917
- /* @__PURE__ */ jsxRuntime.jsx(
4918
- "polygon",
4908
+ showProgress && /* @__PURE__ */ jsxRuntime.jsx(
4909
+ "rect",
4919
4910
  {
4920
- className: styles$4.projectTop,
4921
- points: projectLeftTriangle,
4922
- fill: barColor
4911
+ fill: barColor,
4912
+ x: x1,
4913
+ y: taskYOffset + taskHalfHeight - barCornerRadius,
4914
+ width: barCornerRadius,
4915
+ height: barCornerRadius,
4916
+ className: styles$4.projectTop
4923
4917
  }
4924
4918
  ),
4925
- /* @__PURE__ */ jsxRuntime.jsx(
4926
- "polygon",
4919
+ showProgress && /* @__PURE__ */ jsxRuntime.jsx(
4920
+ "rect",
4927
4921
  {
4928
- className: styles$4.projectTop,
4929
- points: projectRightTriangle,
4930
- 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
4931
4928
  }
4932
4929
  )
4933
4930
  ]
@@ -4942,6 +4939,7 @@
4942
4939
  isCritical,
4943
4940
  isDateChangeable,
4944
4941
  isProgressChangeable,
4942
+ showProgress,
4945
4943
  isSelected,
4946
4944
  onTaskEventStart,
4947
4945
  progressWidth,
@@ -4997,6 +4995,7 @@
4997
4995
  width,
4998
4996
  taskHeight,
4999
4997
  taskHalfHeight,
4998
+ showProgress,
5000
4999
  progressX,
5001
5000
  progressWidth,
5002
5001
  barCornerRadius,
@@ -5016,6 +5015,7 @@
5016
5015
  y: taskYOffset,
5017
5016
  width,
5018
5017
  height: taskHeight,
5018
+ showProgress,
5019
5019
  progressX,
5020
5020
  progressWidth,
5021
5021
  barCornerRadius,
@@ -5042,7 +5042,7 @@
5042
5042
  height: handleHeight,
5043
5043
  startMove: startMoveStartOfTask,
5044
5044
  width: handleWidth,
5045
- x: x1 + 1,
5045
+ x: x1 - handleWidth,
5046
5046
  y: taskYOffset + 1
5047
5047
  }
5048
5048
  ),
@@ -5054,12 +5054,12 @@
5054
5054
  height: handleHeight,
5055
5055
  startMove: startMoveEndOfTask,
5056
5056
  width: handleWidth,
5057
- x: x2 - handleWidth - 1,
5057
+ x: x1 + width,
5058
5058
  y: taskYOffset + 1
5059
5059
  }
5060
5060
  ),
5061
5061
  relationhandles,
5062
- isProgressChangeable && /* @__PURE__ */ jsxRuntime.jsx(
5062
+ isProgressChangeable && showProgress && /* @__PURE__ */ jsxRuntime.jsx(
5063
5063
  BarProgressHandle,
5064
5064
  {
5065
5065
  taskName: task.name,
@@ -5071,75 +5071,6 @@
5071
5071
  }
5072
5072
  );
5073
5073
  };
5074
- const BarSmall = ({
5075
- children: relationhandles,
5076
- colorStyles,
5077
- distances: { barCornerRadius, handleWidth },
5078
- hasChildren,
5079
- isSelected,
5080
- isCritical,
5081
- isDateChangeable,
5082
- onTaskEventStart,
5083
- progressWidth,
5084
- progressX,
5085
- taskYOffset,
5086
- task,
5087
- taskHeight,
5088
- x1
5089
- }) => {
5090
- const startMoveFullTask = React.useCallback(
5091
- (clientX) => {
5092
- onTaskEventStart("move", clientX);
5093
- },
5094
- [onTaskEventStart]
5095
- );
5096
- const startMoveEndOfTask = React.useCallback(
5097
- (clientX) => {
5098
- onTaskEventStart("end", clientX);
5099
- },
5100
- [onTaskEventStart]
5101
- );
5102
- return /* @__PURE__ */ jsxRuntime.jsxs(
5103
- "g",
5104
- {
5105
- className: `${styles$6.barWrapper} ${styles$5.barRelationHandleWrapper}`,
5106
- tabIndex: 0,
5107
- children: [
5108
- /* @__PURE__ */ jsxRuntime.jsx(
5109
- BarDisplay,
5110
- {
5111
- taskName: task.name,
5112
- barCornerRadius,
5113
- hasChildren,
5114
- height: taskHeight,
5115
- isCritical,
5116
- isSelected,
5117
- progressWidth,
5118
- progressX,
5119
- startMoveFullTask,
5120
- styles: colorStyles,
5121
- width: handleWidth * 2,
5122
- x: x1,
5123
- y: taskYOffset
5124
- }
5125
- ),
5126
- isDateChangeable && /* @__PURE__ */ jsxRuntime.jsx(
5127
- BarDateHandle,
5128
- {
5129
- dataTestid: `task-date-handle-right-${task.name}`,
5130
- barCornerRadius,
5131
- height: taskHeight - 2,
5132
- startMove: startMoveEndOfTask,
5133
- width: handleWidth,
5134
- x: x1 + handleWidth,
5135
- y: taskYOffset + 1
5136
- }
5137
- ),
5138
- relationhandles
5139
- ]
5140
- }
5141
- );
5142
- };
5143
5074
  const milestoneWrapper = "_milestoneWrapper_xr9to_1";
5144
5075
  const milestoneBackground = "_milestoneBackground_xr9to_6";
5145
5076
  const styles$3 = {
@@ -5279,8 +5210,8 @@
5279
5210
  ] });
5280
5211
  };
5281
5212
  const TaskWarning = React.memo(TaskWarningInner);
5282
- const barLabel = "_barLabel_pu5db_1";
5283
- const barLabelOutside = "_barLabelOutside_pu5db_13";
5213
+ const barLabel = "_barLabel_5gth7_1";
5214
+ const barLabelOutside = "_barLabelOutside_5gth7_13";
5284
5215
  const style = {
5285
5216
  barLabel,
5286
5217
  barLabelOutside
@@ -5400,7 +5331,8 @@
5400
5331
  handleWidth,
5401
5332
  taskWarningOffset,
5402
5333
  relationCircleOffset,
5403
- relationCircleRadius
5334
+ relationCircleRadius,
5335
+ minimalBarWidth
5404
5336
  },
5405
5337
  fixEndPosition = void 0,
5406
5338
  fixStartPosition = void 0,
@@ -5420,6 +5352,7 @@
5420
5352
  rtl,
5421
5353
  selectTaskOnMouseDown,
5422
5354
  setTooltipTask,
5355
+ showProgress,
5423
5356
  task,
5424
5357
  task: { styles: taskStyles },
5425
5358
  taskHalfHeight,
@@ -5522,14 +5455,14 @@
5522
5455
  } else {
5523
5456
  displayRightRelationHandle = rtl ? isFromStartRelationAuthorized : isFromEndRelationAuthorized;
5524
5457
  }
5525
- const isSmallBar = width < handleWidth * 2;
5458
+ const isSmallBar = width < minimalBarWidth;
5526
5459
  const relationhandles = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5527
5460
  isRelationChangeable && displayLeftRelationHandle && /* @__PURE__ */ jsxRuntime.jsx(
5528
5461
  BarRelationHandle,
5529
5462
  {
5530
5463
  dataTestid: `task-relation-handle-left-${task.name}`,
5531
5464
  isRelationDrawMode: !!ganttRelationEvent,
5532
- x: x1 - relationCircleOffset,
5465
+ x: x1 - relationCircleOffset - handleWidth,
5533
5466
  y: taskYOffset + taskHalfHeight,
5534
5467
  radius: relationCircleRadius,
5535
5468
  startDrawRelation: onLeftRelationTriggerMouseDown
@@ -5540,7 +5473,7 @@
5540
5473
  {
5541
5474
  dataTestid: `task-relation-handle-right-${task.name}`,
5542
5475
  isRelationDrawMode: !!ganttRelationEvent,
5543
- x: !isSmallBar ? x2 + relationCircleOffset : x1 + 2 * handleWidth + relationCircleOffset,
5476
+ x: isSmallBar ? x1 + minimalBarWidth + relationCircleOffset + handleWidth : x2 + relationCircleOffset + handleWidth,
5544
5477
  y: taskYOffset + taskHalfHeight,
5545
5478
  radius: relationCircleRadius,
5546
5479
  startDrawRelation: onRightRelationTriggerMouseDown
@@ -5557,26 +5490,19 @@
5557
5490
  children: relationhandles
5558
5491
  }
5559
5492
  );
5560
- } else if (isSmallBar) {
5561
- return /* @__PURE__ */ jsxRuntime.jsx(
5562
- BarSmall,
5563
- {
5564
- ...props,
5565
- colorStyles: styles2,
5566
- onTaskEventStart,
5567
- children: relationhandles
5568
- }
5569
- );
5570
- } else
5493
+ } else {
5571
5494
  return /* @__PURE__ */ jsxRuntime.jsx(
5572
5495
  Bar,
5573
5496
  {
5574
5497
  ...props,
5575
- onTaskEventStart,
5576
5498
  colorStyles: styles2,
5499
+ width: isSmallBar ? minimalBarWidth : width,
5500
+ showProgress: isSmallBar ? false : showProgress,
5501
+ onTaskEventStart,
5577
5502
  children: relationhandles
5578
5503
  }
5579
5504
  );
5505
+ }
5580
5506
  }, [
5581
5507
  handleWidth,
5582
5508
  isSelected,
@@ -5615,7 +5541,7 @@
5615
5541
  const onMouseLeave = React.useCallback(() => {
5616
5542
  setTooltipTask(null, null);
5617
5543
  }, [setTooltipTask]);
5618
- let barLabelFill = isTextInside || task.type == "milestone" ? styles2.barLabelColor : styles2.barLabelWhenOutsideColor;
5544
+ let barLabelFill = isTextInside || task.type === "milestone" ? styles2.barLabelColor : styles2.barLabelWhenOutsideColor;
5619
5545
  return /* @__PURE__ */ jsxRuntime.jsxs(
5620
5546
  "g",
5621
5547
  {
@@ -5784,6 +5710,7 @@
5784
5710
  if (task.type === "empty") {
5785
5711
  continue;
5786
5712
  }
5713
+ const { isDisabled, showProgress = true } = task;
5787
5714
  const key = `${comparisonLevel}_${task.id}`;
5788
5715
  const criticalPathOnLevel = criticalPaths ? criticalPaths.get(comparisonLevel) : void 0;
5789
5716
  const isCritical = criticalPathOnLevel ? criticalPathOnLevel.tasks.has(task.id) : false;
@@ -5829,12 +5756,13 @@
5829
5756
  distances,
5830
5757
  taskHeight,
5831
5758
  taskHalfHeight,
5832
- isProgressChangeable: !task.isDisabled,
5833
- isDateChangeable: !task.isDisabled,
5759
+ isProgressChangeable: !isDisabled,
5760
+ showProgress,
5761
+ isDateChangeable: !isDisabled,
5834
5762
  isRelationChangeable: !task.isRelationDisabled,
5835
5763
  authorizedRelations,
5836
5764
  ganttRelationEvent,
5837
- isDelete: !task.isDisabled,
5765
+ isDelete: !isDisabled,
5838
5766
  onDoubleClick,
5839
5767
  onClick,
5840
5768
  onEventStart: handleTaskDragStart,
@@ -11399,7 +11327,8 @@
11399
11327
  relationCircleRadius: 5,
11400
11328
  rowHeight: 50,
11401
11329
  taskWarningOffset: 35,
11402
- titleCellWidth: 220
11330
+ titleCellWidth: 220,
11331
+ minimalBarWidth: 8
11403
11332
  };
11404
11333
  const MINIMUM_DISPLAYED_TIME_UNIT = 30;
11405
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.17",
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",