gantt-task-react-v 1.0.18 → 1.0.20

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.
@@ -13147,12 +13147,12 @@ const TaskGanttContentInner = (props) => {
13147
13147
  ] });
13148
13148
  };
13149
13149
  const TaskGanttContent = memo(TaskGanttContentInner);
13150
- const ganttVerticalContainer = "_ganttVerticalContainer_15txg_1";
13151
- const horizontalContainer = "_horizontalContainer_15txg_79";
13152
- const ganttHeader = "_ganttHeader_15txg_143";
13153
- const ganttBodyScroll = "_ganttBodyScroll_15txg_153";
13154
- const wrapper = "_wrapper_15txg_217";
13155
- const calendarDragging = "_calendarDragging_15txg_243";
13150
+ const ganttVerticalContainer = "_ganttVerticalContainer_fjhll_1";
13151
+ const horizontalContainer = "_horizontalContainer_fjhll_81";
13152
+ const ganttHeader = "_ganttHeader_fjhll_99";
13153
+ const ganttBodyScroll = "_ganttBodyScroll_fjhll_109";
13154
+ const wrapper = "_wrapper_fjhll_127";
13155
+ const calendarDragging = "_calendarDragging_fjhll_153";
13156
13156
  const styles$2 = {
13157
13157
  ganttVerticalContainer,
13158
13158
  horizontalContainer,
@@ -13186,10 +13186,35 @@ const TaskGanttInner = (props) => {
13186
13186
  const containerStyle = useMemo(
13187
13187
  () => ({
13188
13188
  height: "100%",
13189
+ // width will be set dynamically below based on measured container width
13189
13190
  width: fullSvgWidth
13190
13191
  }),
13191
13192
  [fullSvgWidth]
13192
13193
  );
13194
+ const [parentClientWidth, setParentClientWidth] = useState(
13195
+ null
13196
+ );
13197
+ useEffect(() => {
13198
+ const el = verticalGanttContainerRef.current;
13199
+ if (!el) {
13200
+ return () => {
13201
+ };
13202
+ }
13203
+ const update = () => setParentClientWidth(el.clientWidth);
13204
+ update();
13205
+ let ro = null;
13206
+ if (typeof ResizeObserver !== "undefined") {
13207
+ ro = new ResizeObserver(() => update());
13208
+ ro.observe(el);
13209
+ }
13210
+ window.addEventListener("resize", update);
13211
+ return () => {
13212
+ if (ro) {
13213
+ ro.disconnect();
13214
+ }
13215
+ window.removeEventListener("resize", update);
13216
+ };
13217
+ }, [verticalGanttContainerRef]);
13193
13218
  const gridStyle = useMemo(
13194
13219
  () => ({
13195
13220
  height: Math.max(ganttFullHeight, minimumRowDisplayed * rowHeight),
@@ -13273,15 +13298,33 @@ const TaskGanttInner = (props) => {
13273
13298
  moveStateHorRef.current = null;
13274
13299
  contentContainer.classList.remove(styles$2.calendarDragging);
13275
13300
  };
13276
- contentContainer.addEventListener("mousemove", onScrollMove);
13277
- contentContainer.addEventListener("mousedown", onScrollStart);
13301
+ contentContainer.addEventListener(
13302
+ "mousemove",
13303
+ onScrollMove
13304
+ );
13305
+ contentContainer.addEventListener(
13306
+ "mousedown",
13307
+ onScrollStart
13308
+ );
13278
13309
  contentContainer.addEventListener("mouseup", onScrollEnd);
13279
13310
  contentContainer.addEventListener("mouseout", onScrollEnd);
13280
13311
  return () => {
13281
- contentContainer.removeEventListener("mousemove", onScrollMove);
13282
- contentContainer.removeEventListener("mousedown", onScrollStart);
13283
- contentContainer.removeEventListener("mouseup", onScrollEnd);
13284
- contentContainer.removeEventListener("mouseout", onScrollEnd);
13312
+ contentContainer.removeEventListener(
13313
+ "mousemove",
13314
+ onScrollMove
13315
+ );
13316
+ contentContainer.removeEventListener(
13317
+ "mousedown",
13318
+ onScrollStart
13319
+ );
13320
+ contentContainer.removeEventListener(
13321
+ "mouseup",
13322
+ onScrollEnd
13323
+ );
13324
+ contentContainer.removeEventListener(
13325
+ "mouseout",
13326
+ onScrollEnd
13327
+ );
13285
13328
  };
13286
13329
  }, [verticalScrollbarRef, horizontalContainerRef, verticalGanttContainerRef]);
13287
13330
  return /* @__PURE__ */ jsxs(
@@ -13307,7 +13350,13 @@ const TaskGanttInner = (props) => {
13307
13350
  {
13308
13351
  ref: horizontalContainerRef,
13309
13352
  className: styles$2.horizontalContainer,
13310
- style: containerStyle,
13353
+ style: {
13354
+ ...containerStyle,
13355
+ // ensure the horizontal container occupies at least the parent view width
13356
+ // so it's flexible when fullSvgWidth is smaller than the current viewport,
13357
+ // and it overflows when fullSvgWidth is larger.
13358
+ width: parentClientWidth && parentClientWidth > fullSvgWidth ? parentClientWidth : fullSvgWidth
13359
+ },
13311
13360
  children: /* @__PURE__ */ jsx("div", { style: gridStyle, children: /* @__PURE__ */ jsxs(
13312
13361
  "svg",
13313
13362
  {
@@ -13164,12 +13164,12 @@
13164
13164
  ] });
13165
13165
  };
13166
13166
  const TaskGanttContent = React.memo(TaskGanttContentInner);
13167
- const ganttVerticalContainer = "_ganttVerticalContainer_15txg_1";
13168
- const horizontalContainer = "_horizontalContainer_15txg_79";
13169
- const ganttHeader = "_ganttHeader_15txg_143";
13170
- const ganttBodyScroll = "_ganttBodyScroll_15txg_153";
13171
- const wrapper = "_wrapper_15txg_217";
13172
- const calendarDragging = "_calendarDragging_15txg_243";
13167
+ const ganttVerticalContainer = "_ganttVerticalContainer_fjhll_1";
13168
+ const horizontalContainer = "_horizontalContainer_fjhll_81";
13169
+ const ganttHeader = "_ganttHeader_fjhll_99";
13170
+ const ganttBodyScroll = "_ganttBodyScroll_fjhll_109";
13171
+ const wrapper = "_wrapper_fjhll_127";
13172
+ const calendarDragging = "_calendarDragging_fjhll_153";
13173
13173
  const styles$2 = {
13174
13174
  ganttVerticalContainer,
13175
13175
  horizontalContainer,
@@ -13203,10 +13203,35 @@
13203
13203
  const containerStyle = React.useMemo(
13204
13204
  () => ({
13205
13205
  height: "100%",
13206
+ // width will be set dynamically below based on measured container width
13206
13207
  width: fullSvgWidth
13207
13208
  }),
13208
13209
  [fullSvgWidth]
13209
13210
  );
13211
+ const [parentClientWidth, setParentClientWidth] = React.useState(
13212
+ null
13213
+ );
13214
+ React.useEffect(() => {
13215
+ const el = verticalGanttContainerRef.current;
13216
+ if (!el) {
13217
+ return () => {
13218
+ };
13219
+ }
13220
+ const update = () => setParentClientWidth(el.clientWidth);
13221
+ update();
13222
+ let ro = null;
13223
+ if (typeof ResizeObserver !== "undefined") {
13224
+ ro = new ResizeObserver(() => update());
13225
+ ro.observe(el);
13226
+ }
13227
+ window.addEventListener("resize", update);
13228
+ return () => {
13229
+ if (ro) {
13230
+ ro.disconnect();
13231
+ }
13232
+ window.removeEventListener("resize", update);
13233
+ };
13234
+ }, [verticalGanttContainerRef]);
13210
13235
  const gridStyle = React.useMemo(
13211
13236
  () => ({
13212
13237
  height: Math.max(ganttFullHeight, minimumRowDisplayed * rowHeight),
@@ -13290,15 +13315,33 @@
13290
13315
  moveStateHorRef.current = null;
13291
13316
  contentContainer.classList.remove(styles$2.calendarDragging);
13292
13317
  };
13293
- contentContainer.addEventListener("mousemove", onScrollMove);
13294
- contentContainer.addEventListener("mousedown", onScrollStart);
13318
+ contentContainer.addEventListener(
13319
+ "mousemove",
13320
+ onScrollMove
13321
+ );
13322
+ contentContainer.addEventListener(
13323
+ "mousedown",
13324
+ onScrollStart
13325
+ );
13295
13326
  contentContainer.addEventListener("mouseup", onScrollEnd);
13296
13327
  contentContainer.addEventListener("mouseout", onScrollEnd);
13297
13328
  return () => {
13298
- contentContainer.removeEventListener("mousemove", onScrollMove);
13299
- contentContainer.removeEventListener("mousedown", onScrollStart);
13300
- contentContainer.removeEventListener("mouseup", onScrollEnd);
13301
- contentContainer.removeEventListener("mouseout", onScrollEnd);
13329
+ contentContainer.removeEventListener(
13330
+ "mousemove",
13331
+ onScrollMove
13332
+ );
13333
+ contentContainer.removeEventListener(
13334
+ "mousedown",
13335
+ onScrollStart
13336
+ );
13337
+ contentContainer.removeEventListener(
13338
+ "mouseup",
13339
+ onScrollEnd
13340
+ );
13341
+ contentContainer.removeEventListener(
13342
+ "mouseout",
13343
+ onScrollEnd
13344
+ );
13302
13345
  };
13303
13346
  }, [verticalScrollbarRef, horizontalContainerRef, verticalGanttContainerRef]);
13304
13347
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -13324,7 +13367,13 @@
13324
13367
  {
13325
13368
  ref: horizontalContainerRef,
13326
13369
  className: styles$2.horizontalContainer,
13327
- style: containerStyle,
13370
+ style: {
13371
+ ...containerStyle,
13372
+ // ensure the horizontal container occupies at least the parent view width
13373
+ // so it's flexible when fullSvgWidth is smaller than the current viewport,
13374
+ // and it overflows when fullSvgWidth is larger.
13375
+ width: parentClientWidth && parentClientWidth > fullSvgWidth ? parentClientWidth : fullSvgWidth
13376
+ },
13328
13377
  children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: gridStyle, children: /* @__PURE__ */ jsxRuntime.jsxs(
13329
13378
  "svg",
13330
13379
  {
package/dist/style.css CHANGED
@@ -581,9 +581,10 @@
581
581
  user-select: none;
582
582
  stroke-width: 0;
583
583
  }
584
- ._ganttVerticalContainer_15txg_1 {
584
+ ._ganttVerticalContainer_fjhll_1 {
585
585
  display: flex;
586
586
  flex-direction: column;
587
+ /* allow horizontal scrolling so the gantt SVG can overflow and be scrolled */
587
588
  overflow-x: auto;
588
589
  overflow-y: hidden;
589
590
  font-size: 0;
@@ -596,16 +597,16 @@
596
597
  min-height: 0;
597
598
  }
598
599
 
599
- ._ganttVerticalContainer_15txg_1::-webkit-scrollbar {
600
+ ._ganttVerticalContainer_fjhll_1::-webkit-scrollbar {
600
601
  width: 1rem;
601
602
  height: 1rem;
602
603
  }
603
604
 
604
- ._ganttVerticalContainer_15txg_1::-webkit-scrollbar-corner {
605
+ ._ganttVerticalContainer_fjhll_1::-webkit-scrollbar-corner {
605
606
  background: transparent;
606
607
  }
607
608
 
608
- ._ganttVerticalContainer_15txg_1::-webkit-scrollbar-thumb {
609
+ ._ganttVerticalContainer_fjhll_1::-webkit-scrollbar-thumb {
609
610
  border: 4px solid transparent;
610
611
  /*noinspection CssUnresolvedCustomProperty*/
611
612
  background: var(--gantt-scrollbar-thumb-color);
@@ -613,83 +614,37 @@
613
614
  background-clip: padding-box;
614
615
  }
615
616
 
616
- ._ganttVerticalContainer_15txg_1::-webkit-scrollbar-thumb:hover {
617
+ ._ganttVerticalContainer_fjhll_1::-webkit-scrollbar-thumb:hover {
617
618
  border: 2px solid transparent;
618
619
  /*noinspection CssUnresolvedCustomProperty*/
619
620
  background: var(--gantt-scrollbar-thumb-color);
620
621
  background-clip: padding-box;
621
622
  }
622
623
 
623
- ._horizontalContainer_15txg_79 {
624
+ ._horizontalContainer_fjhll_81 {
624
625
  margin: 0;
625
626
  padding: 0;
626
- overflow: auto;
627
+ /* keep inner container hidden overflow so content width is controlled by outer container */
628
+ overflow: hidden;
627
629
  height: 100%;
628
630
  min-height: 0;
629
631
  }
630
632
 
631
- ._horizontalContainer_15txg_79::-webkit-scrollbar {
632
- width: 1rem;
633
- height: 1rem;
634
- }
635
-
636
- ._horizontalContainer_15txg_79::-webkit-scrollbar-corner {
637
- background: transparent;
638
- }
639
-
640
- ._horizontalContainer_15txg_79::-webkit-scrollbar-thumb {
641
- border: 4px solid transparent;
642
- /*noinspection CssUnresolvedCustomProperty*/
643
- background: var(--gantt-scrollbar-thumb-color);
644
- border-radius: 12px;
645
- background-clip: padding-box;
646
- }
647
-
648
- ._horizontalContainer_15txg_79::-webkit-scrollbar-thumb:hover {
649
- border: 2px solid transparent;
650
- /*noinspection CssUnresolvedCustomProperty*/
651
- background: var(--gantt-scrollbar-thumb-color);
652
- background-clip: padding-box;
653
- }
654
-
655
- ._ganttHeader_15txg_143 {
633
+ ._ganttHeader_fjhll_99 {
656
634
  flex: 0 0 auto;
657
635
  z-index: 3;
658
636
  }
659
637
 
660
- ._ganttBodyScroll_15txg_153 {
638
+ ._ganttBodyScroll_fjhll_109 {
661
639
  flex: 1 1 auto;
640
+ /* vertical scrolling only here; horizontal controlled by the parent container */
662
641
  overflow-y: auto;
663
642
  overflow-x: hidden;
664
643
  min-height: 0;
665
644
  height: 100%;
666
645
  }
667
646
 
668
- ._ganttBodyScroll_15txg_153::-webkit-scrollbar {
669
- width: 1rem;
670
- height: 1rem;
671
- }
672
-
673
- ._ganttBodyScroll_15txg_153::-webkit-scrollbar-corner {
674
- background: transparent;
675
- }
676
-
677
- ._ganttBodyScroll_15txg_153::-webkit-scrollbar-thumb {
678
- border: 4px solid transparent;
679
- /*noinspection CssUnresolvedCustomProperty*/
680
- background: var(--gantt-scrollbar-thumb-color);
681
- border-radius: 12px;
682
- background-clip: padding-box;
683
- }
684
-
685
- ._ganttBodyScroll_15txg_153::-webkit-scrollbar-thumb:hover {
686
- border: 2px solid transparent;
687
- /*noinspection CssUnresolvedCustomProperty*/
688
- background: var(--gantt-scrollbar-thumb-color);
689
- background-clip: padding-box;
690
- }
691
-
692
- ._wrapper_15txg_217 {
647
+ ._wrapper_fjhll_127 {
693
648
  display: flex;
694
649
  padding: 0;
695
650
  margin: 0;
@@ -702,7 +657,7 @@
702
657
  min-height: 0;
703
658
  }
704
659
 
705
- ._calendarDragging_15txg_243 {
660
+ ._calendarDragging_fjhll_153 {
706
661
  cursor: grabbing;
707
662
  }
708
663
  /*noinspection CssUnresolvedCustomProperty*/
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gantt-task-react-v",
3
- "version": "1.0.18",
3
+ "version": "1.0.20",
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",