gantt-task-react-v 1.0.11 → 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.
@@ -18937,14 +18937,30 @@ const Gantt = (props) => {
18937
18937
  return () => {
18938
18938
  };
18939
18939
  }
18940
- 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));
18941
18958
  const ResizeObserverCtor = window.ResizeObserver;
18942
18959
  let ro;
18943
18960
  if (typeof ResizeObserverCtor === "function") {
18944
18961
  const ctor = ResizeObserverCtor;
18945
18962
  ro = new ctor(() => {
18946
- const rect = node.getBoundingClientRect();
18947
- setMeasuredHeight(rect.height);
18963
+ setMeasuredHeight(measureWithAncestorFallback(node));
18948
18964
  });
18949
18965
  ro.observe(node);
18950
18966
  }
@@ -18954,14 +18954,30 @@
18954
18954
  return () => {
18955
18955
  };
18956
18956
  }
18957
- 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));
18958
18975
  const ResizeObserverCtor = window.ResizeObserver;
18959
18976
  let ro;
18960
18977
  if (typeof ResizeObserverCtor === "function") {
18961
18978
  const ctor = ResizeObserverCtor;
18962
18979
  ro = new ctor(() => {
18963
- const rect = node.getBoundingClientRect();
18964
- setMeasuredHeight(rect.height);
18980
+ setMeasuredHeight(measureWithAncestorFallback(node));
18965
18981
  });
18966
18982
  ro.observe(node);
18967
18983
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gantt-task-react-v",
3
- "version": "1.0.11",
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",