gantt-task-react-v 1.0.36 → 1.0.37

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.
package/README.md CHANGED
@@ -7,14 +7,14 @@
7
7
  ## Install
8
8
 
9
9
  ```
10
- npm install gantt-task-react-v
10
+ npm install webagility-gantt-task-react
11
11
  ```
12
12
 
13
13
  ## How to use it
14
14
 
15
15
  ```ts
16
- import { Gantt, Task, EventOption, StylingOption, ViewMode, DisplayOption } from 'gantt-task-react-v';
17
- import "gantt-task-react-v/dist/index.css";
16
+ import { Gantt, Task, EventOption, StylingOption, ViewMode, DisplayOption } from 'gantt-task-react';
17
+ import "gantt-task-react/dist/index.css";
18
18
 
19
19
  let tasks: Task[] = [
20
20
  {
@@ -10,6 +10,7 @@ export interface TaskGanttProps extends GanttTaskBarActions {
10
10
  fullRowHeight: number;
11
11
  fullSvgWidth: number;
12
12
  ganttFullHeight: number;
13
+ ganttHeight: number;
13
14
  ganttSVGRef: RefObject<SVGSVGElement>;
14
15
  ganttTodayProps: GanttTodayProps;
15
16
  horizontalContainerRef: RefObject<HTMLDivElement>;
@@ -8,4 +8,5 @@ export declare const VerticalScroll: React.FC<{
8
8
  onScroll: (event: SyntheticEvent<HTMLDivElement>) => void;
9
9
  rtl: boolean;
10
10
  verticalScrollbarRef: RefObject<HTMLDivElement>;
11
+ containerHeight?: number | null;
11
12
  }>;
@@ -4655,18 +4655,21 @@ const styles$k = {
4655
4655
  scroll
4656
4656
  };
4657
4657
  const VerticalScroll = ({
4658
+ ganttHeight,
4658
4659
  ganttFullHeight,
4659
4660
  headerHeight,
4660
4661
  isChangeInProgress,
4661
4662
  onScroll,
4662
4663
  rtl,
4663
- verticalScrollbarRef
4664
+ verticalScrollbarRef,
4665
+ containerHeight
4664
4666
  }) => {
4667
+ const scrollHeight = containerHeight !== null && containerHeight !== void 0 ? Math.max(containerHeight - headerHeight, 100) : ganttHeight;
4665
4668
  return /* @__PURE__ */ jsx(
4666
4669
  "div",
4667
4670
  {
4668
4671
  style: {
4669
- height: `calc(100% - ${headerHeight}px)`,
4672
+ height: scrollHeight,
4670
4673
  marginTop: headerHeight,
4671
4674
  marginLeft: rtl ? void 0 : "-1rem",
4672
4675
  pointerEvents: isChangeInProgress ? "none" : void 0
@@ -10637,14 +10640,14 @@ const TaskListTableDefaultInner = ({
10637
10640
  );
10638
10641
  };
10639
10642
  const TaskListTable = memo(TaskListTableDefaultInner);
10640
- const taskListRoot = "_taskListRoot_1x5nq_1";
10641
- const taskListHorizontalScroll = "_taskListHorizontalScroll_1x5nq_25";
10642
- const taskListResizer = "_taskListResizer_1x5nq_89";
10643
- const horizontalContainer$1 = "_horizontalContainer_1x5nq_153";
10644
- const tableWrapper = "_tableWrapper_1x5nq_171";
10645
- const scrollToTop = "_scrollToTop_1x5nq_183";
10646
- const scrollToBottom = "_scrollToBottom_1x5nq_199";
10647
- const hidden = "_hidden_1x5nq_215";
10643
+ const taskListRoot = "_taskListRoot_apbmu_1";
10644
+ const taskListHorizontalScroll = "_taskListHorizontalScroll_apbmu_19";
10645
+ const taskListResizer = "_taskListResizer_apbmu_83";
10646
+ const horizontalContainer$1 = "_horizontalContainer_apbmu_147";
10647
+ const tableWrapper = "_tableWrapper_apbmu_163";
10648
+ const scrollToTop = "_scrollToTop_apbmu_177";
10649
+ const scrollToBottom = "_scrollToBottom_apbmu_193";
10650
+ const hidden = "_hidden_apbmu_209";
10648
10651
  const styles$d = {
10649
10652
  taskListRoot,
10650
10653
  taskListHorizontalScroll,
@@ -10808,15 +10811,21 @@ const TaskListInner = ({
10808
10811
  ref: taskListContainerRef,
10809
10812
  className: styles$d.horizontalContainer,
10810
10813
  style: {
10814
+ height: "100%",
10815
+ minHeight: distances.minimumRowDisplayed * distances.rowHeight,
10811
10816
  width: taskListWidth
10812
10817
  },
10813
10818
  children: /* @__PURE__ */ jsx(
10814
10819
  "div",
10815
10820
  {
10816
10821
  style: {
10822
+ height: "100%",
10823
+ minHeight: Math.max(
10824
+ ganttFullHeight,
10825
+ distances.minimumRowDisplayed * distances.rowHeight
10826
+ ),
10817
10827
  backgroundSize: `100% ${fullRowHeight * 2}px`,
10818
- backgroundImage: `linear-gradient(to bottom, transparent ${fullRowHeight}px, #f5f5f5 ${fullRowHeight}px)`,
10819
- height: "100%"
10828
+ backgroundImage: `linear-gradient(to bottom, transparent ${fullRowHeight}px, #f5f5f5 ${fullRowHeight}px)`
10820
10829
  },
10821
10830
  children: /* @__PURE__ */ jsx(
10822
10831
  RenderTaskListTable,
@@ -13127,17 +13136,13 @@ const TaskGanttContentInner = (props) => {
13127
13136
  ] });
13128
13137
  };
13129
13138
  const TaskGanttContent = memo(TaskGanttContentInner);
13130
- const ganttVerticalContainer = "_ganttVerticalContainer_1xboz_1";
13131
- const horizontalContainer = "_horizontalContainer_1xboz_81";
13132
- const ganttHeader = "_ganttHeader_1xboz_97";
13133
- const ganttBodyScroll = "_ganttBodyScroll_1xboz_107";
13134
- const wrapper = "_wrapper_1xboz_123";
13135
- const calendarDragging = "_calendarDragging_1xboz_153";
13139
+ const ganttVerticalContainer = "_ganttVerticalContainer_i4cef_1";
13140
+ const horizontalContainer = "_horizontalContainer_i4cef_79";
13141
+ const wrapper = "_wrapper_i4cef_95";
13142
+ const calendarDragging = "_calendarDragging_i4cef_125";
13136
13143
  const styles$2 = {
13137
13144
  ganttVerticalContainer,
13138
13145
  horizontalContainer,
13139
- ganttHeader,
13140
- ganttBodyScroll,
13141
13146
  wrapper,
13142
13147
  calendarDragging
13143
13148
  };
@@ -13166,13 +13171,15 @@ const TaskGanttInner = (props) => {
13166
13171
  const containerStyle = useMemo(
13167
13172
  () => ({
13168
13173
  height: "100%",
13169
- width: "100%"
13174
+ width: fullSvgWidth,
13175
+ minHeight: minimumRowDisplayed * rowHeight
13170
13176
  }),
13171
- []
13177
+ [minimumRowDisplayed, rowHeight, fullSvgWidth]
13172
13178
  );
13173
13179
  const gridStyle = useMemo(
13174
13180
  () => ({
13175
- height: Math.max(ganttFullHeight, minimumRowDisplayed * rowHeight),
13181
+ height: "100%",
13182
+ minHeight: Math.max(ganttFullHeight, minimumRowDisplayed * rowHeight),
13176
13183
  width: fullSvgWidth,
13177
13184
  backgroundSize: `${columnWidth}px ${fullRowHeight * 2}px`,
13178
13185
  backgroundPositionX: additionalLeftSpace || void 0,
@@ -13272,7 +13279,7 @@ const TaskGanttInner = (props) => {
13272
13279
  onScroll: onVerticalScrollbarScrollX,
13273
13280
  dir: "ltr",
13274
13281
  children: [
13275
- /* @__PURE__ */ jsx("div", { className: styles$2.ganttHeader, children: /* @__PURE__ */ jsx(
13282
+ /* @__PURE__ */ jsx(
13276
13283
  "svg",
13277
13284
  {
13278
13285
  xmlns: "http://www.w3.org/2000/svg",
@@ -13281,8 +13288,8 @@ const TaskGanttInner = (props) => {
13281
13288
  fontFamily: "var(--gantt-font-family)",
13282
13289
  children: /* @__PURE__ */ jsx(Calendar, { scrollRef: verticalGanttContainerRef, ...calendarProps })
13283
13290
  }
13284
- ) }),
13285
- /* @__PURE__ */ jsx("div", { className: styles$2.ganttBodyScroll, children: /* @__PURE__ */ jsx(
13291
+ ),
13292
+ /* @__PURE__ */ jsx(
13286
13293
  "div",
13287
13294
  {
13288
13295
  ref: horizontalContainerRef,
@@ -13312,7 +13319,7 @@ const TaskGanttInner = (props) => {
13312
13319
  }
13313
13320
  ) })
13314
13321
  }
13315
- ) })
13322
+ )
13316
13323
  ]
13317
13324
  }
13318
13325
  );
@@ -18525,8 +18532,7 @@ const Gantt = (props) => {
18525
18532
  viewDate,
18526
18533
  viewMode = ViewMode.Day,
18527
18534
  locale: clientLocale,
18528
- language,
18529
- height: clientHeight
18535
+ language
18530
18536
  } = props;
18531
18537
  const ganttSVGRef = useRef(null);
18532
18538
  const wrapperRef = useRef(null);
@@ -18535,7 +18541,6 @@ const Gantt = (props) => {
18535
18541
  const theme = useMemo(() => buildGanttTheme(clientTheme), [clientTheme]);
18536
18542
  const { distances, dateFormats: dateFormats2, rtl } = theme;
18537
18543
  const [waitCommitTasks, setWaitCommitTasks] = useState(false);
18538
- const [measuredHeight, setMeasuredHeight] = useState();
18539
18544
  const taskBar = useMemo(() => {
18540
18545
  return mergeDeepObj(
18541
18546
  {},
@@ -18673,27 +18678,34 @@ const Gantt = (props) => {
18673
18678
  },
18674
18679
  [maxLevelLength, fullRowHeight, (_a = taskList == null ? void 0 : taskList.tableBottom) == null ? void 0 : _a.height]
18675
18680
  );
18681
+ const [containerHeight, setContainerHeight] = useState(null);
18682
+ useEffect(() => {
18683
+ const wrapperElement = wrapperRef.current;
18684
+ if (!wrapperElement) {
18685
+ return void 0;
18686
+ }
18687
+ const resizeObserver = new ResizeObserver((entries) => {
18688
+ for (const entry of entries) {
18689
+ const { height } = entry.contentRect;
18690
+ if (height > 0) {
18691
+ setContainerHeight(height);
18692
+ }
18693
+ }
18694
+ });
18695
+ resizeObserver.observe(wrapperElement);
18696
+ return () => {
18697
+ resizeObserver.disconnect();
18698
+ };
18699
+ }, []);
18676
18700
  const ganttHeight = useMemo(() => {
18677
- const minRowsHeight = distances.minimumRowDisplayed * distances.rowHeight;
18678
- const resolvedHeightFromProp = typeof clientHeight === "number" ? clientHeight : void 0;
18679
- const resolvedHeightFromMeasured = measuredHeight;
18680
- const resolvedThemeHeight = typeof distances.ganttHeight === "number" ? distances.ganttHeight : void 0;
18681
- const candidateHeights = [
18682
- resolvedHeightFromProp,
18683
- resolvedHeightFromMeasured,
18684
- resolvedThemeHeight,
18685
- ganttFullHeight
18686
- ].filter((v) => typeof v === "number");
18687
- if (candidateHeights.length === 0) {
18688
- return Math.min(ganttFullHeight, minRowsHeight);
18689
- }
18690
- const chosen = Math.min(
18691
- ...candidateHeights,
18692
- ganttFullHeight,
18693
- minRowsHeight
18694
- );
18695
- return chosen;
18696
- }, [distances, ganttFullHeight, clientHeight, measuredHeight]);
18701
+ if (containerHeight !== null) {
18702
+ return Math.min(
18703
+ containerHeight - distances.headerHeight,
18704
+ ganttFullHeight
18705
+ );
18706
+ }
18707
+ return distances.ganttHeight ? Math.min(distances.ganttHeight, ganttFullHeight) : ganttFullHeight;
18708
+ }, [distances, ganttFullHeight, containerHeight]);
18697
18709
  const [taskToRowIndexMap, rowIndexToTaskMap, mapGlobalRowIndexToTask] = useMemo(
18698
18710
  () => getMapTaskToRowIndex(visibleTasks, comparisonLevels),
18699
18711
  [visibleTasks, comparisonLevels]
@@ -18750,8 +18762,8 @@ const Gantt = (props) => {
18750
18762
  [renderedColumnIndexes]
18751
18763
  );
18752
18764
  const svgWidth = useMemo(
18753
- () => datesLength * distances.columnWidth,
18754
- [datesLength, distances]
18765
+ () => Math.max(datesLength * distances.columnWidth, svgClientWidth),
18766
+ [datesLength, distances, svgClientWidth]
18755
18767
  );
18756
18768
  const countTaskCoordinates$1 = useCallback(
18757
18769
  (task) => countTaskCoordinates(
@@ -18876,37 +18888,6 @@ const Gantt = (props) => {
18876
18888
  setScrollXProgrammatically(datesLength * distances.columnWidth);
18877
18889
  }
18878
18890
  }, [datesLength, distances, rtl, setScrollXProgrammatically, scrollX]);
18879
- useEffect(() => {
18880
- if (typeof clientHeight === "number") {
18881
- setMeasuredHeight(clientHeight);
18882
- return () => {
18883
- };
18884
- }
18885
- const node = wrapperRef.current;
18886
- if (!node) {
18887
- return () => {
18888
- };
18889
- }
18890
- setMeasuredHeight(node.getBoundingClientRect().height);
18891
- const ResizeObserverCtor = window.ResizeObserver;
18892
- let ro;
18893
- if (typeof ResizeObserverCtor === "function") {
18894
- const ctor = ResizeObserverCtor;
18895
- ro = new ctor(() => {
18896
- const rect = node.getBoundingClientRect();
18897
- setMeasuredHeight(rect.height);
18898
- });
18899
- ro.observe(node);
18900
- }
18901
- return () => {
18902
- if (ro) {
18903
- try {
18904
- ro.disconnect();
18905
- } catch (e) {
18906
- }
18907
- }
18908
- };
18909
- }, [clientHeight, wrapperRef]);
18910
18891
  useEffect(() => {
18911
18892
  if (viewDate && !currentViewDate || viewDate && (currentViewDate == null ? void 0 : currentViewDate.valueOf()) !== viewDate.valueOf()) {
18912
18893
  const index2 = getDatesDiff(viewDate, startDate, viewMode);
@@ -19875,6 +19856,7 @@ const Gantt = (props) => {
19875
19856
  fullRowHeight,
19876
19857
  fullSvgWidth,
19877
19858
  ganttFullHeight,
19859
+ ganttHeight,
19878
19860
  ganttSVGRef,
19879
19861
  ganttTodayProps: gridProps,
19880
19862
  horizontalContainerRef,
@@ -19904,7 +19886,8 @@ const Gantt = (props) => {
19904
19886
  isChangeInProgress: Boolean(changeInProgress),
19905
19887
  onScroll: onVerticalScrollbarScrollY,
19906
19888
  rtl,
19907
- verticalScrollbarRef
19889
+ verticalScrollbarRef,
19890
+ containerHeight
19908
19891
  }
19909
19892
  ),
19910
19893
  taskList.enableTableListContextMenu && !waitCommitTasks && /* @__PURE__ */ jsx(
@@ -4672,18 +4672,21 @@
4672
4672
  scroll
4673
4673
  };
4674
4674
  const VerticalScroll = ({
4675
+ ganttHeight,
4675
4676
  ganttFullHeight,
4676
4677
  headerHeight,
4677
4678
  isChangeInProgress,
4678
4679
  onScroll,
4679
4680
  rtl,
4680
- verticalScrollbarRef
4681
+ verticalScrollbarRef,
4682
+ containerHeight
4681
4683
  }) => {
4684
+ const scrollHeight = containerHeight !== null && containerHeight !== void 0 ? Math.max(containerHeight - headerHeight, 100) : ganttHeight;
4682
4685
  return /* @__PURE__ */ jsxRuntime.jsx(
4683
4686
  "div",
4684
4687
  {
4685
4688
  style: {
4686
- height: `calc(100% - ${headerHeight}px)`,
4689
+ height: scrollHeight,
4687
4690
  marginTop: headerHeight,
4688
4691
  marginLeft: rtl ? void 0 : "-1rem",
4689
4692
  pointerEvents: isChangeInProgress ? "none" : void 0
@@ -10654,14 +10657,14 @@
10654
10657
  );
10655
10658
  };
10656
10659
  const TaskListTable = React.memo(TaskListTableDefaultInner);
10657
- const taskListRoot = "_taskListRoot_1x5nq_1";
10658
- const taskListHorizontalScroll = "_taskListHorizontalScroll_1x5nq_25";
10659
- const taskListResizer = "_taskListResizer_1x5nq_89";
10660
- const horizontalContainer$1 = "_horizontalContainer_1x5nq_153";
10661
- const tableWrapper = "_tableWrapper_1x5nq_171";
10662
- const scrollToTop = "_scrollToTop_1x5nq_183";
10663
- const scrollToBottom = "_scrollToBottom_1x5nq_199";
10664
- const hidden = "_hidden_1x5nq_215";
10660
+ const taskListRoot = "_taskListRoot_apbmu_1";
10661
+ const taskListHorizontalScroll = "_taskListHorizontalScroll_apbmu_19";
10662
+ const taskListResizer = "_taskListResizer_apbmu_83";
10663
+ const horizontalContainer$1 = "_horizontalContainer_apbmu_147";
10664
+ const tableWrapper = "_tableWrapper_apbmu_163";
10665
+ const scrollToTop = "_scrollToTop_apbmu_177";
10666
+ const scrollToBottom = "_scrollToBottom_apbmu_193";
10667
+ const hidden = "_hidden_apbmu_209";
10665
10668
  const styles$d = {
10666
10669
  taskListRoot,
10667
10670
  taskListHorizontalScroll,
@@ -10825,15 +10828,21 @@
10825
10828
  ref: taskListContainerRef,
10826
10829
  className: styles$d.horizontalContainer,
10827
10830
  style: {
10831
+ height: "100%",
10832
+ minHeight: distances.minimumRowDisplayed * distances.rowHeight,
10828
10833
  width: taskListWidth
10829
10834
  },
10830
10835
  children: /* @__PURE__ */ jsxRuntime.jsx(
10831
10836
  "div",
10832
10837
  {
10833
10838
  style: {
10839
+ height: "100%",
10840
+ minHeight: Math.max(
10841
+ ganttFullHeight,
10842
+ distances.minimumRowDisplayed * distances.rowHeight
10843
+ ),
10834
10844
  backgroundSize: `100% ${fullRowHeight * 2}px`,
10835
- backgroundImage: `linear-gradient(to bottom, transparent ${fullRowHeight}px, #f5f5f5 ${fullRowHeight}px)`,
10836
- height: "100%"
10845
+ backgroundImage: `linear-gradient(to bottom, transparent ${fullRowHeight}px, #f5f5f5 ${fullRowHeight}px)`
10837
10846
  },
10838
10847
  children: /* @__PURE__ */ jsxRuntime.jsx(
10839
10848
  RenderTaskListTable,
@@ -13144,17 +13153,13 @@
13144
13153
  ] });
13145
13154
  };
13146
13155
  const TaskGanttContent = React.memo(TaskGanttContentInner);
13147
- const ganttVerticalContainer = "_ganttVerticalContainer_1xboz_1";
13148
- const horizontalContainer = "_horizontalContainer_1xboz_81";
13149
- const ganttHeader = "_ganttHeader_1xboz_97";
13150
- const ganttBodyScroll = "_ganttBodyScroll_1xboz_107";
13151
- const wrapper = "_wrapper_1xboz_123";
13152
- const calendarDragging = "_calendarDragging_1xboz_153";
13156
+ const ganttVerticalContainer = "_ganttVerticalContainer_i4cef_1";
13157
+ const horizontalContainer = "_horizontalContainer_i4cef_79";
13158
+ const wrapper = "_wrapper_i4cef_95";
13159
+ const calendarDragging = "_calendarDragging_i4cef_125";
13153
13160
  const styles$2 = {
13154
13161
  ganttVerticalContainer,
13155
13162
  horizontalContainer,
13156
- ganttHeader,
13157
- ganttBodyScroll,
13158
13163
  wrapper,
13159
13164
  calendarDragging
13160
13165
  };
@@ -13183,13 +13188,15 @@
13183
13188
  const containerStyle = React.useMemo(
13184
13189
  () => ({
13185
13190
  height: "100%",
13186
- width: "100%"
13191
+ width: fullSvgWidth,
13192
+ minHeight: minimumRowDisplayed * rowHeight
13187
13193
  }),
13188
- []
13194
+ [minimumRowDisplayed, rowHeight, fullSvgWidth]
13189
13195
  );
13190
13196
  const gridStyle = React.useMemo(
13191
13197
  () => ({
13192
- height: Math.max(ganttFullHeight, minimumRowDisplayed * rowHeight),
13198
+ height: "100%",
13199
+ minHeight: Math.max(ganttFullHeight, minimumRowDisplayed * rowHeight),
13193
13200
  width: fullSvgWidth,
13194
13201
  backgroundSize: `${columnWidth}px ${fullRowHeight * 2}px`,
13195
13202
  backgroundPositionX: additionalLeftSpace || void 0,
@@ -13289,7 +13296,7 @@
13289
13296
  onScroll: onVerticalScrollbarScrollX,
13290
13297
  dir: "ltr",
13291
13298
  children: [
13292
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles$2.ganttHeader, children: /* @__PURE__ */ jsxRuntime.jsx(
13299
+ /* @__PURE__ */ jsxRuntime.jsx(
13293
13300
  "svg",
13294
13301
  {
13295
13302
  xmlns: "http://www.w3.org/2000/svg",
@@ -13298,8 +13305,8 @@
13298
13305
  fontFamily: "var(--gantt-font-family)",
13299
13306
  children: /* @__PURE__ */ jsxRuntime.jsx(Calendar, { scrollRef: verticalGanttContainerRef, ...calendarProps })
13300
13307
  }
13301
- ) }),
13302
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles$2.ganttBodyScroll, children: /* @__PURE__ */ jsxRuntime.jsx(
13308
+ ),
13309
+ /* @__PURE__ */ jsxRuntime.jsx(
13303
13310
  "div",
13304
13311
  {
13305
13312
  ref: horizontalContainerRef,
@@ -13329,7 +13336,7 @@
13329
13336
  }
13330
13337
  ) })
13331
13338
  }
13332
- ) })
13339
+ )
13333
13340
  ]
13334
13341
  }
13335
13342
  );
@@ -18542,8 +18549,7 @@
18542
18549
  viewDate,
18543
18550
  viewMode = ViewMode.Day,
18544
18551
  locale: clientLocale,
18545
- language,
18546
- height: clientHeight
18552
+ language
18547
18553
  } = props;
18548
18554
  const ganttSVGRef = React.useRef(null);
18549
18555
  const wrapperRef = React.useRef(null);
@@ -18552,7 +18558,6 @@
18552
18558
  const theme = React.useMemo(() => buildGanttTheme(clientTheme), [clientTheme]);
18553
18559
  const { distances, dateFormats: dateFormats2, rtl } = theme;
18554
18560
  const [waitCommitTasks, setWaitCommitTasks] = React.useState(false);
18555
- const [measuredHeight, setMeasuredHeight] = React.useState();
18556
18561
  const taskBar = React.useMemo(() => {
18557
18562
  return mergeDeepObj(
18558
18563
  {},
@@ -18690,27 +18695,34 @@
18690
18695
  },
18691
18696
  [maxLevelLength, fullRowHeight, (_a = taskList == null ? void 0 : taskList.tableBottom) == null ? void 0 : _a.height]
18692
18697
  );
18698
+ const [containerHeight, setContainerHeight] = React.useState(null);
18699
+ React.useEffect(() => {
18700
+ const wrapperElement = wrapperRef.current;
18701
+ if (!wrapperElement) {
18702
+ return void 0;
18703
+ }
18704
+ const resizeObserver = new ResizeObserver((entries) => {
18705
+ for (const entry of entries) {
18706
+ const { height } = entry.contentRect;
18707
+ if (height > 0) {
18708
+ setContainerHeight(height);
18709
+ }
18710
+ }
18711
+ });
18712
+ resizeObserver.observe(wrapperElement);
18713
+ return () => {
18714
+ resizeObserver.disconnect();
18715
+ };
18716
+ }, []);
18693
18717
  const ganttHeight = React.useMemo(() => {
18694
- const minRowsHeight = distances.minimumRowDisplayed * distances.rowHeight;
18695
- const resolvedHeightFromProp = typeof clientHeight === "number" ? clientHeight : void 0;
18696
- const resolvedHeightFromMeasured = measuredHeight;
18697
- const resolvedThemeHeight = typeof distances.ganttHeight === "number" ? distances.ganttHeight : void 0;
18698
- const candidateHeights = [
18699
- resolvedHeightFromProp,
18700
- resolvedHeightFromMeasured,
18701
- resolvedThemeHeight,
18702
- ganttFullHeight
18703
- ].filter((v) => typeof v === "number");
18704
- if (candidateHeights.length === 0) {
18705
- return Math.min(ganttFullHeight, minRowsHeight);
18706
- }
18707
- const chosen = Math.min(
18708
- ...candidateHeights,
18709
- ganttFullHeight,
18710
- minRowsHeight
18711
- );
18712
- return chosen;
18713
- }, [distances, ganttFullHeight, clientHeight, measuredHeight]);
18718
+ if (containerHeight !== null) {
18719
+ return Math.min(
18720
+ containerHeight - distances.headerHeight,
18721
+ ganttFullHeight
18722
+ );
18723
+ }
18724
+ return distances.ganttHeight ? Math.min(distances.ganttHeight, ganttFullHeight) : ganttFullHeight;
18725
+ }, [distances, ganttFullHeight, containerHeight]);
18714
18726
  const [taskToRowIndexMap, rowIndexToTaskMap, mapGlobalRowIndexToTask] = React.useMemo(
18715
18727
  () => getMapTaskToRowIndex(visibleTasks, comparisonLevels),
18716
18728
  [visibleTasks, comparisonLevels]
@@ -18767,8 +18779,8 @@
18767
18779
  [renderedColumnIndexes]
18768
18780
  );
18769
18781
  const svgWidth = React.useMemo(
18770
- () => datesLength * distances.columnWidth,
18771
- [datesLength, distances]
18782
+ () => Math.max(datesLength * distances.columnWidth, svgClientWidth),
18783
+ [datesLength, distances, svgClientWidth]
18772
18784
  );
18773
18785
  const countTaskCoordinates$1 = React.useCallback(
18774
18786
  (task) => countTaskCoordinates(
@@ -18893,37 +18905,6 @@
18893
18905
  setScrollXProgrammatically(datesLength * distances.columnWidth);
18894
18906
  }
18895
18907
  }, [datesLength, distances, rtl, setScrollXProgrammatically, scrollX]);
18896
- React.useEffect(() => {
18897
- if (typeof clientHeight === "number") {
18898
- setMeasuredHeight(clientHeight);
18899
- return () => {
18900
- };
18901
- }
18902
- const node = wrapperRef.current;
18903
- if (!node) {
18904
- return () => {
18905
- };
18906
- }
18907
- setMeasuredHeight(node.getBoundingClientRect().height);
18908
- const ResizeObserverCtor = window.ResizeObserver;
18909
- let ro;
18910
- if (typeof ResizeObserverCtor === "function") {
18911
- const ctor = ResizeObserverCtor;
18912
- ro = new ctor(() => {
18913
- const rect = node.getBoundingClientRect();
18914
- setMeasuredHeight(rect.height);
18915
- });
18916
- ro.observe(node);
18917
- }
18918
- return () => {
18919
- if (ro) {
18920
- try {
18921
- ro.disconnect();
18922
- } catch (e) {
18923
- }
18924
- }
18925
- };
18926
- }, [clientHeight, wrapperRef]);
18927
18908
  React.useEffect(() => {
18928
18909
  if (viewDate && !currentViewDate || viewDate && (currentViewDate == null ? void 0 : currentViewDate.valueOf()) !== viewDate.valueOf()) {
18929
18910
  const index2 = getDatesDiff(viewDate, startDate, viewMode);
@@ -19892,6 +19873,7 @@
19892
19873
  fullRowHeight,
19893
19874
  fullSvgWidth,
19894
19875
  ganttFullHeight,
19876
+ ganttHeight,
19895
19877
  ganttSVGRef,
19896
19878
  ganttTodayProps: gridProps,
19897
19879
  horizontalContainerRef,
@@ -19921,7 +19903,8 @@
19921
19903
  isChangeInProgress: Boolean(changeInProgress),
19922
19904
  onScroll: onVerticalScrollbarScrollY,
19923
19905
  rtl,
19924
- verticalScrollbarRef
19906
+ verticalScrollbarRef,
19907
+ containerHeight
19925
19908
  }
19926
19909
  ),
19927
19910
  taskList.enableTableListContextMenu && !waitCommitTasks && /* @__PURE__ */ jsxRuntime.jsx(
package/dist/style.css CHANGED
@@ -282,36 +282,33 @@
282
282
  border-bottom: 1px solid var(--gantt-divider-color);
283
283
  table-layout: fixed;
284
284
  }
285
- ._taskListRoot_1x5nq_1 {
285
+ ._taskListRoot_apbmu_1 {
286
286
  position: relative;
287
287
  /*noinspection CssUnresolvedCustomProperty*/
288
288
  border-left: 1px solid var(--gantt-table-divider-color, var(--gantt-divider-color));
289
289
  height: 100%;
290
290
  display: flex;
291
291
  flex-direction: column;
292
- overflow: hidden;
293
- max-width: 100%;
294
- flex-shrink: 0;
295
292
  }
296
293
 
297
- ._taskListHorizontalScroll_1x5nq_25 {
298
- overflow-x: auto;
299
- overflow-y: hidden;
294
+ ._taskListHorizontalScroll_apbmu_19 {
295
+ overflow-x: scroll;
300
296
  flex: 1;
297
+ min-height: 0;
301
298
  display: flex;
302
299
  flex-direction: column;
303
300
  }
304
301
 
305
- ._taskListHorizontalScroll_1x5nq_25::-webkit-scrollbar {
302
+ ._taskListHorizontalScroll_apbmu_19::-webkit-scrollbar {
306
303
  width: 1rem;
307
304
  height: 1rem;
308
305
  }
309
306
 
310
- ._taskListHorizontalScroll_1x5nq_25::-webkit-scrollbar-corner {
307
+ ._taskListHorizontalScroll_apbmu_19::-webkit-scrollbar-corner {
311
308
  background: transparent;
312
309
  }
313
310
 
314
- ._taskListHorizontalScroll_1x5nq_25::-webkit-scrollbar-thumb {
311
+ ._taskListHorizontalScroll_apbmu_19::-webkit-scrollbar-thumb {
315
312
  border: 4px solid transparent;
316
313
  /*noinspection CssUnresolvedCustomProperty*/
317
314
  background: var(--gantt-scrollbar-thumb-color);
@@ -319,14 +316,14 @@
319
316
  background-clip: padding-box;
320
317
  }
321
318
 
322
- ._taskListHorizontalScroll_1x5nq_25::-webkit-scrollbar-thumb:hover {
319
+ ._taskListHorizontalScroll_apbmu_19::-webkit-scrollbar-thumb:hover {
323
320
  border: 2px solid transparent;
324
321
  /*noinspection CssUnresolvedCustomProperty*/
325
322
  background: var(--gantt-scrollbar-thumb-color);
326
323
  background-clip: padding-box;
327
324
  }
328
325
 
329
- ._taskListResizer_1x5nq_89 {
326
+ ._taskListResizer_apbmu_83 {
330
327
  position: absolute;
331
328
  top: 0;
332
329
  right: -3px;
@@ -338,16 +335,16 @@
338
335
  }
339
336
 
340
337
  /*noinspection CssUnresolvedCustomProperty*/
341
- ._taskListResizer_1x5nq_89:hover {
338
+ ._taskListResizer_apbmu_83:hover {
342
339
  background-color: var(--gantt-table-hover-action-color);
343
340
  filter: var(--gantt-hover-filter);
344
341
  }
345
342
 
346
- ._taskListResizer_1x5nq_89:hover::before {
343
+ ._taskListResizer_apbmu_83:hover::before {
347
344
  display: none;
348
345
  }
349
346
 
350
- ._taskListResizer_1x5nq_89::before {
347
+ ._taskListResizer_apbmu_83::before {
351
348
  content: "";
352
349
  position: absolute;
353
350
  top: 0;
@@ -358,22 +355,22 @@
358
355
  background-color: var(--gantt-table-resize-color, var(--gantt-divider-color));
359
356
  }
360
357
 
361
- ._horizontalContainer_1x5nq_153 {
358
+ ._horizontalContainer_apbmu_147 {
362
359
  margin: 0;
363
360
  padding: 0;
364
- overflow-y: auto;
365
- overflow-x: hidden;
366
- height: 100%;
361
+ overflow: hidden;
362
+ flex: 1;
367
363
  min-height: 0;
368
364
  }
369
365
 
370
- ._tableWrapper_1x5nq_171 {
366
+ ._tableWrapper_apbmu_163 {
371
367
  position: relative;
372
368
  flex: 1;
373
369
  min-height: 0;
370
+ overflow: hidden;
374
371
  }
375
372
 
376
- ._scrollToTop_1x5nq_183 {
373
+ ._scrollToTop_apbmu_177 {
377
374
  position: absolute;
378
375
  top: 0;
379
376
  left: 0;
@@ -381,7 +378,7 @@
381
378
  height: 20px;
382
379
  }
383
380
 
384
- ._scrollToBottom_1x5nq_199 {
381
+ ._scrollToBottom_apbmu_193 {
385
382
  position: absolute;
386
383
  bottom: 0;
387
384
  left: 0;
@@ -389,7 +386,7 @@
389
386
  height: 20px;
390
387
  }
391
388
 
392
- ._hidden_1x5nq_215 {
389
+ ._hidden_apbmu_209 {
393
390
  display: none;
394
391
  }
395
392
  ._ganttToday_1oyhk_1 {
@@ -583,10 +580,8 @@
583
580
  user-select: none;
584
581
  stroke-width: 0;
585
582
  }
586
- ._ganttVerticalContainer_1xboz_1 {
587
- display: flex;
588
- flex-direction: column;
589
- overflow-x: auto;
583
+ ._ganttVerticalContainer_i4cef_1 {
584
+ overflow-x: scroll;
590
585
  overflow-y: hidden;
591
586
  font-size: 0;
592
587
  margin: 0;
@@ -594,21 +589,22 @@
594
589
  /*noinspection CssUnresolvedCustomProperty*/
595
590
  border-right: 1px solid var(--gantt-calendar-divider-color, var(--gantt-divider-color));
596
591
  flex-grow: 1;
592
+ min-width: 0;
597
593
  height: 100%;
598
- min-height: 0;
599
- max-width: 100%;
594
+ display: flex;
595
+ flex-direction: column;
600
596
  }
601
597
 
602
- ._ganttVerticalContainer_1xboz_1::-webkit-scrollbar {
598
+ ._ganttVerticalContainer_i4cef_1::-webkit-scrollbar {
603
599
  width: 1rem;
604
600
  height: 1rem;
605
601
  }
606
602
 
607
- ._ganttVerticalContainer_1xboz_1::-webkit-scrollbar-corner {
603
+ ._ganttVerticalContainer_i4cef_1::-webkit-scrollbar-corner {
608
604
  background: transparent;
609
605
  }
610
606
 
611
- ._ganttVerticalContainer_1xboz_1::-webkit-scrollbar-thumb {
607
+ ._ganttVerticalContainer_i4cef_1::-webkit-scrollbar-thumb {
612
608
  border: 4px solid transparent;
613
609
  /*noinspection CssUnresolvedCustomProperty*/
614
610
  background: var(--gantt-scrollbar-thumb-color);
@@ -616,35 +612,22 @@
616
612
  background-clip: padding-box;
617
613
  }
618
614
 
619
- ._ganttVerticalContainer_1xboz_1::-webkit-scrollbar-thumb:hover {
615
+ ._ganttVerticalContainer_i4cef_1::-webkit-scrollbar-thumb:hover {
620
616
  border: 2px solid transparent;
621
617
  /*noinspection CssUnresolvedCustomProperty*/
622
618
  background: var(--gantt-scrollbar-thumb-color);
623
619
  background-clip: padding-box;
624
620
  }
625
621
 
626
- ._horizontalContainer_1xboz_81 {
622
+ ._horizontalContainer_i4cef_79 {
627
623
  margin: 0;
628
624
  padding: 0;
629
625
  overflow: hidden;
630
- height: 100%;
631
- min-height: 0;
632
- }
633
-
634
- ._ganttHeader_1xboz_97 {
635
- flex: 0 0 auto;
636
- z-index: 3;
637
- }
638
-
639
- ._ganttBodyScroll_1xboz_107 {
640
- flex: 1 1 auto;
641
- overflow-y: auto;
642
- overflow-x: hidden;
626
+ flex: 1;
643
627
  min-height: 0;
644
- height: 100%;
645
628
  }
646
629
 
647
- ._wrapper_1xboz_123 {
630
+ ._wrapper_i4cef_95 {
648
631
  display: flex;
649
632
  padding: 0;
650
633
  margin: 0;
@@ -655,11 +638,11 @@
655
638
  border-bottom: 1px solid var(--gantt-divider-color);
656
639
  height: 100%;
657
640
  min-height: 0;
658
- max-width: 100%;
641
+ flex: 1;
659
642
  overflow: hidden;
660
643
  }
661
644
 
662
- ._calendarDragging_1xboz_153 {
645
+ ._calendarDragging_i4cef_125 {
663
646
  cursor: grabbing;
664
647
  }
665
648
  /*noinspection CssUnresolvedCustomProperty*/
@@ -320,13 +320,6 @@ export interface GanttProps {
320
320
  * Move dates of tasks to working days during change
321
321
  */
322
322
  isAdjustToWorkingDates?: boolean;
323
- /**
324
- * Height of the Gantt component. Can be a number (pixels) or a CSS height string
325
- * (for example "100%" to fill a parent container). When a CSS string is
326
- * provided the component will measure its rendered height and use it for
327
- * internal scroll calculations.
328
- */
329
- height?: number | string;
330
323
  }
331
324
  export interface GanttTaskBarActions {
332
325
  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.36",
3
+ "version": "1.0.37",
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",
@@ -23,7 +23,7 @@
23
23
  ],
24
24
  "scripts": {
25
25
  "storybook": "start-storybook -p 6006",
26
- "build": "vite build && node -e \"require('child_process').execSync('tsc', {stdio:'inherit'})\"",
26
+ "build": "vite build && tsc",
27
27
  "start": "vite --host",
28
28
  "prepare": "npm run build",
29
29
  "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
@@ -42,10 +42,9 @@
42
42
  "@dnd-kit/sortable": "^8.0.0",
43
43
  "@floating-ui/dom": "1.6.3",
44
44
  "@floating-ui/react": "0.26.11",
45
- "@rollup/rollup-win32-x64-msvc": "^4.48.1",
46
45
  "date-fns": "3.6.0",
47
- "i18next": "^25.4.1",
48
- "react-i18next": "^15.7.2"
46
+ "i18next": "^24.0.5",
47
+ "react-i18next": "^15.1.3"
49
48
  },
50
49
  "peerDependencies": {
51
50
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
@@ -57,14 +56,14 @@
57
56
  "@chromatic-com/storybook": "^1.3.1",
58
57
  "@rollup/plugin-image": "3.0.3",
59
58
  "@storybook/addon-essentials": "^8.0.6",
60
- "@storybook/addon-interactions": "^8.6.14",
59
+ "@storybook/addon-interactions": "^8.0.6",
61
60
  "@storybook/addon-links": "^8.0.6",
62
61
  "@storybook/addon-onboarding": "^8.0.6",
63
62
  "@storybook/blocks": "^8.0.6",
64
63
  "@storybook/cli": "^8.4.4",
65
- "@storybook/react": "^8.6.14",
64
+ "@storybook/react": "^8.4.4",
66
65
  "@storybook/react-vite": "^8.0.6",
67
- "@storybook/test": "^8.6.14",
66
+ "@storybook/test": "^8.0.6",
68
67
  "@testing-library/jest-dom": "^6.4.2",
69
68
  "@testing-library/react": "^14.2.2",
70
69
  "@testing-library/user-event": "^14.2.1",
@@ -1 +0,0 @@
1
- export {};