gantt-task-react-v 1.0.12 → 1.0.13

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 @@ import { TaskGanttContentProps } from "./task-gantt-content";
6
6
  import { GanttTaskBarActions } from "../../types";
7
7
  export interface TaskGanttProps extends GanttTaskBarActions {
8
8
  ganttHeight?: number;
9
+ useCssHeight?: boolean;
9
10
  barProps: TaskGanttContentProps;
10
11
  calendarProps: Omit<CalendarProps, "scrollRef">;
11
12
  fullRowHeight: number;
@@ -15,6 +15,7 @@ export type TaskListProps = {
15
15
  fullRowHeight: number;
16
16
  ganttFullHeight: number;
17
17
  ganttHeight?: number;
18
+ useCssHeight?: boolean;
18
19
  getTaskCurrentState: (task: Task) => Task;
19
20
  handleAddTask: (task: Task | null) => void;
20
21
  handleDeleteTasks: (task: RenderTask[]) => void;
@@ -10721,7 +10721,8 @@ const TaskListInner = ({
10721
10721
  onResizeColumn,
10722
10722
  canReorderTasks,
10723
10723
  tableBottom,
10724
- ganttHeight
10724
+ ganttHeight,
10725
+ useCssHeight
10725
10726
  }) => {
10726
10727
  const [
10727
10728
  columns,
@@ -10829,9 +10830,9 @@ const TaskListInner = ({
10829
10830
  ref: taskListContainerRef,
10830
10831
  className: styles$d.horizontalContainer,
10831
10832
  style: {
10832
- // visible height: clamp between minimum rows height and ganttFullHeight,
10833
- // prefer explicit numeric ganttHeight when provided
10834
- height: (() => {
10833
+ // If consumer asked for CSS height (e.g. "100%"), let the
10834
+ // container fill its parent. Otherwise compute pixel height.
10835
+ height: ganttHeight == null && ganttHeight !== 0 && (typeof ganttHeight === "undefined" || useCssHeight) ? "100%" : (() => {
10835
10836
  const minRowsHeight = distances.minimumRowDisplayed * distances.rowHeight;
10836
10837
  const resolved = typeof ganttHeight === "number" ? ganttHeight : void 0;
10837
10838
  const visible = Math.max(
@@ -13207,7 +13208,7 @@ const TaskGanttInner = (props) => {
13207
13208
  Math.min(ganttFullHeight, resolved ?? ganttFullHeight)
13208
13209
  );
13209
13210
  return {
13210
- height: visible,
13211
+ height: props.useCssHeight ? "100%" : visible,
13211
13212
  width: fullSvgWidth
13212
13213
  };
13213
13214
  }, [
@@ -13215,7 +13216,8 @@ const TaskGanttInner = (props) => {
13215
13216
  minimumRowDisplayed,
13216
13217
  rowHeight,
13217
13218
  fullSvgWidth,
13218
- ganttHeight
13219
+ ganttHeight,
13220
+ props.useCssHeight
13219
13221
  ]);
13220
13222
  const gridStyle = useMemo(
13221
13223
  () => ({
@@ -18744,6 +18746,7 @@ const Gantt = (props) => {
18744
18746
  );
18745
18747
  return chosen;
18746
18748
  }, [distances, ganttFullHeight, clientHeight, measuredHeight]);
18749
+ const isCssHeight = typeof clientHeight === "string";
18747
18750
  const [taskToRowIndexMap, rowIndexToTaskMap, mapGlobalRowIndexToTask] = useMemo(
18748
18751
  () => getMapTaskToRowIndex(visibleTasks, comparisonLevels),
18749
18752
  [visibleTasks, comparisonLevels]
@@ -19873,6 +19876,7 @@ const Gantt = (props) => {
19873
19876
  fullRowHeight,
19874
19877
  ganttFullHeight,
19875
19878
  ganttHeight,
19879
+ useCssHeight: isCssHeight,
19876
19880
  getTaskCurrentState,
19877
19881
  handleAddTask,
19878
19882
  handleDeleteTasks,
@@ -19903,6 +19907,7 @@ const Gantt = (props) => {
19903
19907
  fullRowHeight,
19904
19908
  ganttFullHeight,
19905
19909
  ganttHeight,
19910
+ isCssHeight,
19906
19911
  getTaskCurrentState,
19907
19912
  handleAddTask,
19908
19913
  handleDeleteTasks,
@@ -19944,6 +19949,7 @@ const Gantt = (props) => {
19944
19949
  fullSvgWidth,
19945
19950
  ganttFullHeight,
19946
19951
  ganttHeight,
19952
+ useCssHeight: typeof clientHeight === "string",
19947
19953
  ganttSVGRef,
19948
19954
  ganttTodayProps: gridProps,
19949
19955
  horizontalContainerRef,
@@ -10738,7 +10738,8 @@
10738
10738
  onResizeColumn,
10739
10739
  canReorderTasks,
10740
10740
  tableBottom,
10741
- ganttHeight
10741
+ ganttHeight,
10742
+ useCssHeight
10742
10743
  }) => {
10743
10744
  const [
10744
10745
  columns,
@@ -10846,9 +10847,9 @@
10846
10847
  ref: taskListContainerRef,
10847
10848
  className: styles$d.horizontalContainer,
10848
10849
  style: {
10849
- // visible height: clamp between minimum rows height and ganttFullHeight,
10850
- // prefer explicit numeric ganttHeight when provided
10851
- height: (() => {
10850
+ // If consumer asked for CSS height (e.g. "100%"), let the
10851
+ // container fill its parent. Otherwise compute pixel height.
10852
+ height: ganttHeight == null && ganttHeight !== 0 && (typeof ganttHeight === "undefined" || useCssHeight) ? "100%" : (() => {
10852
10853
  const minRowsHeight = distances.minimumRowDisplayed * distances.rowHeight;
10853
10854
  const resolved = typeof ganttHeight === "number" ? ganttHeight : void 0;
10854
10855
  const visible = Math.max(
@@ -13224,7 +13225,7 @@
13224
13225
  Math.min(ganttFullHeight, resolved ?? ganttFullHeight)
13225
13226
  );
13226
13227
  return {
13227
- height: visible,
13228
+ height: props.useCssHeight ? "100%" : visible,
13228
13229
  width: fullSvgWidth
13229
13230
  };
13230
13231
  }, [
@@ -13232,7 +13233,8 @@
13232
13233
  minimumRowDisplayed,
13233
13234
  rowHeight,
13234
13235
  fullSvgWidth,
13235
- ganttHeight
13236
+ ganttHeight,
13237
+ props.useCssHeight
13236
13238
  ]);
13237
13239
  const gridStyle = React.useMemo(
13238
13240
  () => ({
@@ -18761,6 +18763,7 @@
18761
18763
  );
18762
18764
  return chosen;
18763
18765
  }, [distances, ganttFullHeight, clientHeight, measuredHeight]);
18766
+ const isCssHeight = typeof clientHeight === "string";
18764
18767
  const [taskToRowIndexMap, rowIndexToTaskMap, mapGlobalRowIndexToTask] = React.useMemo(
18765
18768
  () => getMapTaskToRowIndex(visibleTasks, comparisonLevels),
18766
18769
  [visibleTasks, comparisonLevels]
@@ -19890,6 +19893,7 @@
19890
19893
  fullRowHeight,
19891
19894
  ganttFullHeight,
19892
19895
  ganttHeight,
19896
+ useCssHeight: isCssHeight,
19893
19897
  getTaskCurrentState,
19894
19898
  handleAddTask,
19895
19899
  handleDeleteTasks,
@@ -19920,6 +19924,7 @@
19920
19924
  fullRowHeight,
19921
19925
  ganttFullHeight,
19922
19926
  ganttHeight,
19927
+ isCssHeight,
19923
19928
  getTaskCurrentState,
19924
19929
  handleAddTask,
19925
19930
  handleDeleteTasks,
@@ -19961,6 +19966,7 @@
19961
19966
  fullSvgWidth,
19962
19967
  ganttFullHeight,
19963
19968
  ganttHeight,
19969
+ useCssHeight: typeof clientHeight === "string",
19964
19970
  ganttSVGRef,
19965
19971
  ganttTodayProps: gridProps,
19966
19972
  horizontalContainerRef,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gantt-task-react-v",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
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",