gantt-task-react-v 1.7.0 → 1.7.1

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.
@@ -2,6 +2,7 @@ import React from "react";
2
2
  import { TaskLabelProps } from "./types";
3
3
  interface Props extends TaskLabelProps {
4
4
  alwaysOutline?: boolean;
5
+ forceOutside?: boolean;
5
6
  }
6
7
  export declare const TaskResponsiveLabel: React.NamedExoticComponent<Props>;
7
8
  export {};
@@ -11556,17 +11556,19 @@ const GanttTodayInner = ({
11556
11556
  ] });
11557
11557
  };
11558
11558
  const GanttToday = memo(GanttTodayInner);
11559
- const calendarBottomText = "_calendarBottomText_15t8b_1";
11560
- const calendarTopTick = "_calendarTopTick_15t8b_25";
11561
- const calendarTopText = "_calendarTopText_15t8b_35";
11562
- const calendarHeader = "_calendarHeader_15t8b_61";
11563
- const calendar = "_calendar_15t8b_1";
11564
- const calendarDragging$1 = "_calendarDragging_15t8b_85";
11559
+ const calendarBottomText = "_calendarBottomText_1mt8w_1";
11560
+ const calendarTopTick = "_calendarTopTick_1mt8w_31";
11561
+ const calendarTopText = "_calendarTopText_1mt8w_41";
11562
+ const calendarHeader = "_calendarHeader_1mt8w_67";
11563
+ const calendarBottomSeparator = "_calendarBottomSeparator_1mt8w_81";
11564
+ const calendar = "_calendar_1mt8w_1";
11565
+ const calendarDragging$1 = "_calendarDragging_1mt8w_103";
11565
11566
  const styles$c = {
11566
11567
  calendarBottomText,
11567
11568
  calendarTopTick,
11568
11569
  calendarTopText,
11569
11570
  calendarHeader,
11571
+ calendarBottomSeparator,
11570
11572
  calendar,
11571
11573
  calendarDragging: calendarDragging$1
11572
11574
  };
@@ -11850,6 +11852,19 @@ const Calendar = ({
11850
11852
  const bottomValues2 = [];
11851
11853
  let weeksCount = 1;
11852
11854
  const topDefaultHeight = headerHeight * 0.5;
11855
+ bottomValues2.push(
11856
+ /* @__PURE__ */ jsx(
11857
+ "line",
11858
+ {
11859
+ x1: 0,
11860
+ y1: topDefaultHeight,
11861
+ x2: fullSvgWidth,
11862
+ y2: topDefaultHeight,
11863
+ className: styles$c.calendarBottomSeparator
11864
+ },
11865
+ "week-top-border"
11866
+ )
11867
+ );
11853
11868
  for (let i = endColumnIndex; i >= startColumnIndex; i--) {
11854
11869
  const date = getDate(i);
11855
11870
  const month = date.getMonth();
@@ -11859,6 +11874,19 @@ const Calendar = ({
11859
11874
  topValue = renderTopHeaderByDate(date);
11860
11875
  }
11861
11876
  const bottomValue = renderBottomHeaderByDate(date, i);
11877
+ bottomValues2.push(
11878
+ /* @__PURE__ */ jsx(
11879
+ "line",
11880
+ {
11881
+ x1: additionalLeftSpace + columnWidth * i,
11882
+ y1: topDefaultHeight,
11883
+ x2: additionalLeftSpace + columnWidth * i,
11884
+ y2: headerHeight,
11885
+ className: styles$c.calendarBottomSeparator
11886
+ },
11887
+ `week-sep-${i}`
11888
+ )
11889
+ );
11862
11890
  bottomValues2.push(
11863
11891
  renderBottomText(
11864
11892
  additionalLeftSpace + columnWidth * (i + +rtl),
@@ -11894,11 +11922,37 @@ const Calendar = ({
11894
11922
  const bottomValues2 = [];
11895
11923
  const topDefaultHeight = headerHeight * 0.5;
11896
11924
  const renderedMonths = /* @__PURE__ */ new Set();
11925
+ bottomValues2.push(
11926
+ /* @__PURE__ */ jsx(
11927
+ "line",
11928
+ {
11929
+ x1: 0,
11930
+ y1: topDefaultHeight,
11931
+ x2: fullSvgWidth,
11932
+ y2: topDefaultHeight,
11933
+ className: styles$c.calendarBottomSeparator
11934
+ },
11935
+ "day-top-border"
11936
+ )
11937
+ );
11897
11938
  for (let i = startColumnIndex; i <= endColumnIndex; i++) {
11898
11939
  const date = getDate(i);
11899
11940
  const bottomValue = renderBottomHeaderByDate(date, i);
11900
11941
  const month = date.getMonth();
11901
11942
  const fullYear = date.getFullYear();
11943
+ bottomValues2.push(
11944
+ /* @__PURE__ */ jsx(
11945
+ "line",
11946
+ {
11947
+ x1: additionalLeftSpace + columnWidth * i,
11948
+ y1: topDefaultHeight,
11949
+ x2: additionalLeftSpace + columnWidth * i,
11950
+ y2: headerHeight,
11951
+ className: styles$c.calendarBottomSeparator
11952
+ },
11953
+ `day-sep-${i}`
11954
+ )
11955
+ );
11902
11956
  bottomValues2.push(
11903
11957
  renderBottomText(
11904
11958
  additionalLeftSpace + columnWidth * i + columnWidth * 0.5,
@@ -13197,9 +13251,9 @@ const Milestone = ({
13197
13251
  relationHandles
13198
13252
  ] });
13199
13253
  };
13200
- const barLabel = "_barLabel_81831_1";
13201
- const barLabelHidden = "_barLabelHidden_81831_27";
13202
- const barLabelOutside = "_barLabelOutside_81831_37";
13254
+ const barLabel = "_barLabel_5nsbb_1";
13255
+ const barLabelHidden = "_barLabelHidden_5nsbb_27";
13256
+ const barLabelOutside = "_barLabelOutside_5nsbb_37";
13203
13257
  const style = {
13204
13258
  barLabel,
13205
13259
  barLabelHidden,
@@ -13209,6 +13263,7 @@ const TaskResponsiveLabelInner = (props) => {
13209
13263
  const {
13210
13264
  alwaysOutline,
13211
13265
  arrowIndent,
13266
+ forceOutside,
13212
13267
  rtl,
13213
13268
  label: label2,
13214
13269
  taskHeight,
@@ -13224,21 +13279,22 @@ const TaskResponsiveLabelInner = (props) => {
13224
13279
  setIsTextInside(textRef.current.getBBox().width < width);
13225
13280
  }
13226
13281
  }, [textRef, width, viewMode]);
13282
+ const shouldBeOutside = alwaysOutline || forceOutside;
13227
13283
  const calculatedX = useMemo(() => {
13228
- if (isTextInside && !alwaysOutline) {
13284
+ if (isTextInside && !shouldBeOutside) {
13229
13285
  return x1 + width * 0.5;
13230
13286
  }
13231
13287
  if (rtl && textRef.current) {
13232
13288
  return x1 - textRef.current.getBBox().width - arrowIndent * 0.8;
13233
13289
  }
13234
13290
  return x1 + width + arrowIndent * 1.2;
13235
- }, [alwaysOutline, x1, width, isTextInside, rtl, arrowIndent]);
13291
+ }, [shouldBeOutside, x1, width, isTextInside, rtl, arrowIndent]);
13236
13292
  return /* @__PURE__ */ jsx(
13237
13293
  "text",
13238
13294
  {
13239
13295
  x: calculatedX,
13240
13296
  y: taskYOffset + taskHeight * 0.5,
13241
- className: isTextInside && !alwaysOutline ? style.barLabel : style.barLabelOutside,
13297
+ className: isTextInside && !shouldBeOutside ? style.barLabel : style.barLabelOutside,
13242
13298
  ref: textRef,
13243
13299
  children: label2
13244
13300
  }
@@ -13502,7 +13558,8 @@ const TaskItemInner = (props) => {
13502
13558
  label: task.name,
13503
13559
  taskYOffset,
13504
13560
  viewMode,
13505
- alwaysOutline: task.type === "project"
13561
+ alwaysOutline: task.type === "project",
13562
+ forceOutside: props.showProgress && width > 40
13506
13563
  }
13507
13564
  )
13508
13565
  ]
@@ -13827,6 +13884,10 @@ const TaskGanttContentInner = (props) => {
13827
13884
  const safeComparisonY = isNaN(comparisonDates.y) || !isFinite(comparisonDates.y) ? safeLevelY : comparisonDates.y;
13828
13885
  const safeComparisonWidth = isNaN(comparisonDates.width) || !isFinite(comparisonDates.width) ? 0 : Math.max(comparisonDates.width, 0);
13829
13886
  const safeComparisonHeight = isNaN(comparisonDates.height) || !isFinite(comparisonDates.height) ? 0 : Math.max(comparisonDates.height, 0);
13887
+ const maxComparisonSvgHeight = Math.max(
13888
+ distances.rowHeight - taskYOffset - taskHeight,
13889
+ safeComparisonHeight
13890
+ );
13830
13891
  tasksRes.push(
13831
13892
  /* @__PURE__ */ jsx(
13832
13893
  "svg",
@@ -13836,7 +13897,7 @@ const TaskGanttContentInner = (props) => {
13836
13897
  x: Math.max(safeComparisonX + (additionalLeftSpace || 0), 0),
13837
13898
  y: safeComparisonY,
13838
13899
  width: safeComparisonWidth,
13839
- height: safeComparisonHeight * 2,
13900
+ height: Math.min(safeComparisonHeight * 2, maxComparisonSvgHeight),
13840
13901
  children: /* @__PURE__ */ jsx(
13841
13902
  BarComparison,
13842
13903
  {
@@ -14642,11 +14703,16 @@ const countTaskCoordinates = (task, taskToRowIndexMap, startDate, viewMode, rtl,
14642
14703
  );
14643
14704
  cx1 = isNaN(cx1) || !isFinite(cx1) ? x1 : cx1;
14644
14705
  cx2 = isNaN(cx2) || !isFinite(cx2) ? x2 : cx2;
14706
+ const remainingRowSpace = distances.rowHeight - taskYOffset - taskHeight;
14707
+ const clampedHeight = Math.min(
14708
+ barComparisonTaskHeight,
14709
+ Math.max(remainingRowSpace - 2, 2)
14710
+ );
14645
14711
  comparisonDates = {
14646
14712
  x: cx1,
14647
14713
  y: y + taskHeight,
14648
14714
  width: Math.max(cx2 - cx1, 0),
14649
- height: barComparisonTaskHeight
14715
+ height: clampedHeight
14650
14716
  };
14651
14717
  }
14652
14718
  return {
@@ -11573,17 +11573,19 @@
11573
11573
  ] });
11574
11574
  };
11575
11575
  const GanttToday = React.memo(GanttTodayInner);
11576
- const calendarBottomText = "_calendarBottomText_15t8b_1";
11577
- const calendarTopTick = "_calendarTopTick_15t8b_25";
11578
- const calendarTopText = "_calendarTopText_15t8b_35";
11579
- const calendarHeader = "_calendarHeader_15t8b_61";
11580
- const calendar = "_calendar_15t8b_1";
11581
- const calendarDragging$1 = "_calendarDragging_15t8b_85";
11576
+ const calendarBottomText = "_calendarBottomText_1mt8w_1";
11577
+ const calendarTopTick = "_calendarTopTick_1mt8w_31";
11578
+ const calendarTopText = "_calendarTopText_1mt8w_41";
11579
+ const calendarHeader = "_calendarHeader_1mt8w_67";
11580
+ const calendarBottomSeparator = "_calendarBottomSeparator_1mt8w_81";
11581
+ const calendar = "_calendar_1mt8w_1";
11582
+ const calendarDragging$1 = "_calendarDragging_1mt8w_103";
11582
11583
  const styles$c = {
11583
11584
  calendarBottomText,
11584
11585
  calendarTopTick,
11585
11586
  calendarTopText,
11586
11587
  calendarHeader,
11588
+ calendarBottomSeparator,
11587
11589
  calendar,
11588
11590
  calendarDragging: calendarDragging$1
11589
11591
  };
@@ -11867,6 +11869,19 @@
11867
11869
  const bottomValues2 = [];
11868
11870
  let weeksCount = 1;
11869
11871
  const topDefaultHeight = headerHeight * 0.5;
11872
+ bottomValues2.push(
11873
+ /* @__PURE__ */ jsxRuntime.jsx(
11874
+ "line",
11875
+ {
11876
+ x1: 0,
11877
+ y1: topDefaultHeight,
11878
+ x2: fullSvgWidth,
11879
+ y2: topDefaultHeight,
11880
+ className: styles$c.calendarBottomSeparator
11881
+ },
11882
+ "week-top-border"
11883
+ )
11884
+ );
11870
11885
  for (let i = endColumnIndex; i >= startColumnIndex; i--) {
11871
11886
  const date = getDate(i);
11872
11887
  const month = date.getMonth();
@@ -11876,6 +11891,19 @@
11876
11891
  topValue = renderTopHeaderByDate(date);
11877
11892
  }
11878
11893
  const bottomValue = renderBottomHeaderByDate(date, i);
11894
+ bottomValues2.push(
11895
+ /* @__PURE__ */ jsxRuntime.jsx(
11896
+ "line",
11897
+ {
11898
+ x1: additionalLeftSpace + columnWidth * i,
11899
+ y1: topDefaultHeight,
11900
+ x2: additionalLeftSpace + columnWidth * i,
11901
+ y2: headerHeight,
11902
+ className: styles$c.calendarBottomSeparator
11903
+ },
11904
+ `week-sep-${i}`
11905
+ )
11906
+ );
11879
11907
  bottomValues2.push(
11880
11908
  renderBottomText(
11881
11909
  additionalLeftSpace + columnWidth * (i + +rtl),
@@ -11911,11 +11939,37 @@
11911
11939
  const bottomValues2 = [];
11912
11940
  const topDefaultHeight = headerHeight * 0.5;
11913
11941
  const renderedMonths = /* @__PURE__ */ new Set();
11942
+ bottomValues2.push(
11943
+ /* @__PURE__ */ jsxRuntime.jsx(
11944
+ "line",
11945
+ {
11946
+ x1: 0,
11947
+ y1: topDefaultHeight,
11948
+ x2: fullSvgWidth,
11949
+ y2: topDefaultHeight,
11950
+ className: styles$c.calendarBottomSeparator
11951
+ },
11952
+ "day-top-border"
11953
+ )
11954
+ );
11914
11955
  for (let i = startColumnIndex; i <= endColumnIndex; i++) {
11915
11956
  const date = getDate(i);
11916
11957
  const bottomValue = renderBottomHeaderByDate(date, i);
11917
11958
  const month = date.getMonth();
11918
11959
  const fullYear = date.getFullYear();
11960
+ bottomValues2.push(
11961
+ /* @__PURE__ */ jsxRuntime.jsx(
11962
+ "line",
11963
+ {
11964
+ x1: additionalLeftSpace + columnWidth * i,
11965
+ y1: topDefaultHeight,
11966
+ x2: additionalLeftSpace + columnWidth * i,
11967
+ y2: headerHeight,
11968
+ className: styles$c.calendarBottomSeparator
11969
+ },
11970
+ `day-sep-${i}`
11971
+ )
11972
+ );
11919
11973
  bottomValues2.push(
11920
11974
  renderBottomText(
11921
11975
  additionalLeftSpace + columnWidth * i + columnWidth * 0.5,
@@ -13214,9 +13268,9 @@
13214
13268
  relationHandles
13215
13269
  ] });
13216
13270
  };
13217
- const barLabel = "_barLabel_81831_1";
13218
- const barLabelHidden = "_barLabelHidden_81831_27";
13219
- const barLabelOutside = "_barLabelOutside_81831_37";
13271
+ const barLabel = "_barLabel_5nsbb_1";
13272
+ const barLabelHidden = "_barLabelHidden_5nsbb_27";
13273
+ const barLabelOutside = "_barLabelOutside_5nsbb_37";
13220
13274
  const style = {
13221
13275
  barLabel,
13222
13276
  barLabelHidden,
@@ -13226,6 +13280,7 @@
13226
13280
  const {
13227
13281
  alwaysOutline,
13228
13282
  arrowIndent,
13283
+ forceOutside,
13229
13284
  rtl,
13230
13285
  label: label2,
13231
13286
  taskHeight,
@@ -13241,21 +13296,22 @@
13241
13296
  setIsTextInside(textRef.current.getBBox().width < width);
13242
13297
  }
13243
13298
  }, [textRef, width, viewMode]);
13299
+ const shouldBeOutside = alwaysOutline || forceOutside;
13244
13300
  const calculatedX = React.useMemo(() => {
13245
- if (isTextInside && !alwaysOutline) {
13301
+ if (isTextInside && !shouldBeOutside) {
13246
13302
  return x1 + width * 0.5;
13247
13303
  }
13248
13304
  if (rtl && textRef.current) {
13249
13305
  return x1 - textRef.current.getBBox().width - arrowIndent * 0.8;
13250
13306
  }
13251
13307
  return x1 + width + arrowIndent * 1.2;
13252
- }, [alwaysOutline, x1, width, isTextInside, rtl, arrowIndent]);
13308
+ }, [shouldBeOutside, x1, width, isTextInside, rtl, arrowIndent]);
13253
13309
  return /* @__PURE__ */ jsxRuntime.jsx(
13254
13310
  "text",
13255
13311
  {
13256
13312
  x: calculatedX,
13257
13313
  y: taskYOffset + taskHeight * 0.5,
13258
- className: isTextInside && !alwaysOutline ? style.barLabel : style.barLabelOutside,
13314
+ className: isTextInside && !shouldBeOutside ? style.barLabel : style.barLabelOutside,
13259
13315
  ref: textRef,
13260
13316
  children: label2
13261
13317
  }
@@ -13519,7 +13575,8 @@
13519
13575
  label: task.name,
13520
13576
  taskYOffset,
13521
13577
  viewMode,
13522
- alwaysOutline: task.type === "project"
13578
+ alwaysOutline: task.type === "project",
13579
+ forceOutside: props.showProgress && width > 40
13523
13580
  }
13524
13581
  )
13525
13582
  ]
@@ -13844,6 +13901,10 @@
13844
13901
  const safeComparisonY = isNaN(comparisonDates.y) || !isFinite(comparisonDates.y) ? safeLevelY : comparisonDates.y;
13845
13902
  const safeComparisonWidth = isNaN(comparisonDates.width) || !isFinite(comparisonDates.width) ? 0 : Math.max(comparisonDates.width, 0);
13846
13903
  const safeComparisonHeight = isNaN(comparisonDates.height) || !isFinite(comparisonDates.height) ? 0 : Math.max(comparisonDates.height, 0);
13904
+ const maxComparisonSvgHeight = Math.max(
13905
+ distances.rowHeight - taskYOffset - taskHeight,
13906
+ safeComparisonHeight
13907
+ );
13847
13908
  tasksRes.push(
13848
13909
  /* @__PURE__ */ jsxRuntime.jsx(
13849
13910
  "svg",
@@ -13853,7 +13914,7 @@
13853
13914
  x: Math.max(safeComparisonX + (additionalLeftSpace || 0), 0),
13854
13915
  y: safeComparisonY,
13855
13916
  width: safeComparisonWidth,
13856
- height: safeComparisonHeight * 2,
13917
+ height: Math.min(safeComparisonHeight * 2, maxComparisonSvgHeight),
13857
13918
  children: /* @__PURE__ */ jsxRuntime.jsx(
13858
13919
  BarComparison,
13859
13920
  {
@@ -14659,11 +14720,16 @@
14659
14720
  );
14660
14721
  cx1 = isNaN(cx1) || !isFinite(cx1) ? x1 : cx1;
14661
14722
  cx2 = isNaN(cx2) || !isFinite(cx2) ? x2 : cx2;
14723
+ const remainingRowSpace = distances.rowHeight - taskYOffset - taskHeight;
14724
+ const clampedHeight = Math.min(
14725
+ barComparisonTaskHeight,
14726
+ Math.max(remainingRowSpace - 2, 2)
14727
+ );
14662
14728
  comparisonDates = {
14663
14729
  x: cx1,
14664
14730
  y: y + taskHeight,
14665
14731
  width: Math.max(cx2 - cx1, 0),
14666
- height: barComparisonTaskHeight
14732
+ height: clampedHeight
14667
14733
  };
14668
14734
  }
14669
14735
  return {
package/dist/style.css CHANGED
@@ -534,10 +534,13 @@
534
534
  ._ganttTodayCircle_1oyhk_9 {
535
535
 
536
536
  }
537
- ._calendarBottomText_15t8b_1 {
537
+ ._calendarBottomText_1mt8w_1 {
538
538
  text-anchor: middle;
539
539
  /*noinspection CssUnresolvedCustomProperty*/
540
- fill: var(--gantt-calendar-bottom-text-color, var(--gantt-secondary-text-color));
540
+ fill: var(
541
+ --gantt-calendar-bottom-text-color,
542
+ var(--gantt-secondary-text-color)
543
+ );
541
544
  -webkit-touch-callout: none;
542
545
  -webkit-user-select: none;
543
546
  -moz-user-select: none;
@@ -546,12 +549,12 @@
546
549
  pointer-events: none;
547
550
  }
548
551
 
549
- ._calendarTopTick_15t8b_25 {
552
+ ._calendarTopTick_1mt8w_31 {
550
553
  /*noinspection CssUnresolvedCustomProperty*/
551
554
  stroke: var(--gantt-calendar-top-divider-color, var(--gantt-divider-color));
552
555
  }
553
556
 
554
- ._calendarTopText_15t8b_35 {
557
+ ._calendarTopText_1mt8w_41 {
555
558
  text-anchor: middle;
556
559
  /*noinspection CssUnresolvedCustomProperty*/
557
560
  fill: var(--gantt-calendar-top-text-color, var(--gantt-primary-text-color));
@@ -564,19 +567,25 @@
564
567
  font-weight: bold;
565
568
  }
566
569
 
567
- ._calendarHeader_15t8b_61 {
570
+ ._calendarHeader_1mt8w_67 {
568
571
  fill: transparent;
569
572
  /*noinspection CssUnresolvedCustomProperty*/
570
573
  stroke: var(--gantt-calendar-stroke-color);
571
574
  stroke-width: 1.4;
572
575
  }
573
576
 
574
- ._calendar_15t8b_1 {
577
+ ._calendarBottomSeparator_1mt8w_81 {
578
+ /*noinspection CssUnresolvedCustomProperty*/
579
+ stroke: var(--gantt-calendar-stroke-color, #e0e0e0);
580
+ stroke-width: 1;
581
+ }
582
+
583
+ ._calendar_1mt8w_1 {
575
584
  cursor: auto;
576
585
  user-select: none;
577
586
  }
578
587
 
579
- ._calendarDragging_15t8b_85 {
588
+ ._calendarDragging_1mt8w_103 {
580
589
  cursor: ew-resize;
581
590
  }
582
591
  ._arrow_clickable_3u3q2_1 {
@@ -700,7 +709,7 @@
700
709
  ._milestoneBackground_vcirf_11 {
701
710
  user-select: none;
702
711
  }
703
- ._barLabel_81831_1 {
712
+ ._barLabel_5nsbb_1 {
704
713
  fill: #fff;
705
714
  text-anchor: middle;
706
715
  font-weight: lighter;
@@ -713,14 +722,15 @@
713
722
  pointer-events: none;
714
723
  }
715
724
 
716
- ._barLabelHidden_81831_27 {
725
+ ._barLabelHidden_5nsbb_27 {
717
726
  display: none;
718
727
  }
719
728
 
720
729
  /*noinspection CssUnresolvedCustomProperty*/
721
- ._barLabelOutside_81831_37 {
730
+ ._barLabelOutside_5nsbb_37 {
722
731
  fill: var(--gantt-secondary-text-color);
723
732
  text-anchor: start;
733
+ dominant-baseline: central;
724
734
  stroke: white;
725
735
  stroke-width: 4px;
726
736
  stroke-linejoin: round;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gantt-task-react-v",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
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",