gantt-task-react-v 1.0.10 → 1.0.12

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.
@@ -10829,10 +10829,17 @@ const TaskListInner = ({
10829
10829
  ref: taskListContainerRef,
10830
10830
  className: styles$d.horizontalContainer,
10831
10831
  style: {
10832
- height: Math.min(
10833
- ganttHeight || ganttFullHeight,
10834
- distances.minimumRowDisplayed * distances.rowHeight
10835
- ),
10832
+ // visible height: clamp between minimum rows height and ganttFullHeight,
10833
+ // prefer explicit numeric ganttHeight when provided
10834
+ height: (() => {
10835
+ const minRowsHeight = distances.minimumRowDisplayed * distances.rowHeight;
10836
+ const resolved = typeof ganttHeight === "number" ? ganttHeight : void 0;
10837
+ const visible = Math.max(
10838
+ minRowsHeight,
10839
+ Math.min(ganttFullHeight, resolved ?? ganttFullHeight)
10840
+ );
10841
+ return visible;
10842
+ })(),
10836
10843
  width: taskListWidth
10837
10844
  },
10838
10845
  children: /* @__PURE__ */ jsx(
@@ -18930,14 +18937,30 @@ const Gantt = (props) => {
18930
18937
  return () => {
18931
18938
  };
18932
18939
  }
18933
- setMeasuredHeight(node.getBoundingClientRect().height);
18940
+ const measureWithAncestorFallback = (el) => {
18941
+ const rect = el.getBoundingClientRect();
18942
+ let height = rect.height;
18943
+ try {
18944
+ let p = el.parentElement;
18945
+ while (p) {
18946
+ const pRect = p.getBoundingClientRect();
18947
+ if (pRect.height > height + 1) {
18948
+ height = pRect.height;
18949
+ break;
18950
+ }
18951
+ p = p.parentElement;
18952
+ }
18953
+ } catch (e) {
18954
+ }
18955
+ return height;
18956
+ };
18957
+ setMeasuredHeight(measureWithAncestorFallback(node));
18934
18958
  const ResizeObserverCtor = window.ResizeObserver;
18935
18959
  let ro;
18936
18960
  if (typeof ResizeObserverCtor === "function") {
18937
18961
  const ctor = ResizeObserverCtor;
18938
18962
  ro = new ctor(() => {
18939
- const rect = node.getBoundingClientRect();
18940
- setMeasuredHeight(rect.height);
18963
+ setMeasuredHeight(measureWithAncestorFallback(node));
18941
18964
  });
18942
18965
  ro.observe(node);
18943
18966
  }
@@ -10846,10 +10846,17 @@
10846
10846
  ref: taskListContainerRef,
10847
10847
  className: styles$d.horizontalContainer,
10848
10848
  style: {
10849
- height: Math.min(
10850
- ganttHeight || ganttFullHeight,
10851
- distances.minimumRowDisplayed * distances.rowHeight
10852
- ),
10849
+ // visible height: clamp between minimum rows height and ganttFullHeight,
10850
+ // prefer explicit numeric ganttHeight when provided
10851
+ height: (() => {
10852
+ const minRowsHeight = distances.minimumRowDisplayed * distances.rowHeight;
10853
+ const resolved = typeof ganttHeight === "number" ? ganttHeight : void 0;
10854
+ const visible = Math.max(
10855
+ minRowsHeight,
10856
+ Math.min(ganttFullHeight, resolved ?? ganttFullHeight)
10857
+ );
10858
+ return visible;
10859
+ })(),
10853
10860
  width: taskListWidth
10854
10861
  },
10855
10862
  children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -18947,14 +18954,30 @@
18947
18954
  return () => {
18948
18955
  };
18949
18956
  }
18950
- setMeasuredHeight(node.getBoundingClientRect().height);
18957
+ const measureWithAncestorFallback = (el) => {
18958
+ const rect = el.getBoundingClientRect();
18959
+ let height = rect.height;
18960
+ try {
18961
+ let p = el.parentElement;
18962
+ while (p) {
18963
+ const pRect = p.getBoundingClientRect();
18964
+ if (pRect.height > height + 1) {
18965
+ height = pRect.height;
18966
+ break;
18967
+ }
18968
+ p = p.parentElement;
18969
+ }
18970
+ } catch (e) {
18971
+ }
18972
+ return height;
18973
+ };
18974
+ setMeasuredHeight(measureWithAncestorFallback(node));
18951
18975
  const ResizeObserverCtor = window.ResizeObserver;
18952
18976
  let ro;
18953
18977
  if (typeof ResizeObserverCtor === "function") {
18954
18978
  const ctor = ResizeObserverCtor;
18955
18979
  ro = new ctor(() => {
18956
- const rect = node.getBoundingClientRect();
18957
- setMeasuredHeight(rect.height);
18980
+ setMeasuredHeight(measureWithAncestorFallback(node));
18958
18981
  });
18959
18982
  ro.observe(node);
18960
18983
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gantt-task-react-v",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
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",