gantt-task-react-v 1.0.19 → 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.
@@ -10657,14 +10657,14 @@ const TaskListTableDefaultInner = ({
10657
10657
  );
10658
10658
  };
10659
10659
  const TaskListTable = memo(TaskListTableDefaultInner);
10660
- const taskListRoot = "_taskListRoot_1jqtj_1";
10661
- const taskListHorizontalScroll = "_taskListHorizontalScroll_1jqtj_21";
10662
- const taskListResizer = "_taskListResizer_1jqtj_85";
10663
- const horizontalContainer$1 = "_horizontalContainer_1jqtj_149";
10664
- const tableWrapper = "_tableWrapper_1jqtj_215";
10665
- const scrollToTop = "_scrollToTop_1jqtj_227";
10666
- const scrollToBottom = "_scrollToBottom_1jqtj_243";
10667
- const hidden = "_hidden_1jqtj_259";
10660
+ const taskListRoot = "_taskListRoot_xeaio_1";
10661
+ const taskListHorizontalScroll = "_taskListHorizontalScroll_xeaio_21";
10662
+ const taskListResizer = "_taskListResizer_xeaio_85";
10663
+ const horizontalContainer$1 = "_horizontalContainer_xeaio_149";
10664
+ const tableWrapper = "_tableWrapper_xeaio_167";
10665
+ const scrollToTop = "_scrollToTop_xeaio_179";
10666
+ const scrollToBottom = "_scrollToBottom_xeaio_195";
10667
+ const hidden = "_hidden_xeaio_211";
10668
10668
  const styles$d = {
10669
10669
  taskListRoot,
10670
10670
  taskListHorizontalScroll,
@@ -13147,12 +13147,12 @@ const TaskGanttContentInner = (props) => {
13147
13147
  ] });
13148
13148
  };
13149
13149
  const TaskGanttContent = memo(TaskGanttContentInner);
13150
- const ganttVerticalContainer = "_ganttVerticalContainer_1benq_1";
13151
- const horizontalContainer = "_horizontalContainer_1benq_79";
13152
- const ganttHeader = "_ganttHeader_1benq_95";
13153
- const ganttBodyScroll = "_ganttBodyScroll_1benq_105";
13154
- const wrapper = "_wrapper_1benq_169";
13155
- const calendarDragging = "_calendarDragging_1benq_195";
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
  {
@@ -10674,14 +10674,14 @@
10674
10674
  );
10675
10675
  };
10676
10676
  const TaskListTable = React.memo(TaskListTableDefaultInner);
10677
- const taskListRoot = "_taskListRoot_1jqtj_1";
10678
- const taskListHorizontalScroll = "_taskListHorizontalScroll_1jqtj_21";
10679
- const taskListResizer = "_taskListResizer_1jqtj_85";
10680
- const horizontalContainer$1 = "_horizontalContainer_1jqtj_149";
10681
- const tableWrapper = "_tableWrapper_1jqtj_215";
10682
- const scrollToTop = "_scrollToTop_1jqtj_227";
10683
- const scrollToBottom = "_scrollToBottom_1jqtj_243";
10684
- const hidden = "_hidden_1jqtj_259";
10677
+ const taskListRoot = "_taskListRoot_xeaio_1";
10678
+ const taskListHorizontalScroll = "_taskListHorizontalScroll_xeaio_21";
10679
+ const taskListResizer = "_taskListResizer_xeaio_85";
10680
+ const horizontalContainer$1 = "_horizontalContainer_xeaio_149";
10681
+ const tableWrapper = "_tableWrapper_xeaio_167";
10682
+ const scrollToTop = "_scrollToTop_xeaio_179";
10683
+ const scrollToBottom = "_scrollToBottom_xeaio_195";
10684
+ const hidden = "_hidden_xeaio_211";
10685
10685
  const styles$d = {
10686
10686
  taskListRoot,
10687
10687
  taskListHorizontalScroll,
@@ -13164,12 +13164,12 @@
13164
13164
  ] });
13165
13165
  };
13166
13166
  const TaskGanttContent = React.memo(TaskGanttContentInner);
13167
- const ganttVerticalContainer = "_ganttVerticalContainer_1benq_1";
13168
- const horizontalContainer = "_horizontalContainer_1benq_79";
13169
- const ganttHeader = "_ganttHeader_1benq_95";
13170
- const ganttBodyScroll = "_ganttBodyScroll_1benq_105";
13171
- const wrapper = "_wrapper_1benq_169";
13172
- const calendarDragging = "_calendarDragging_1benq_195";
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
@@ -282,7 +282,7 @@
282
282
  border-bottom: 1px solid var(--gantt-divider-color);
283
283
  table-layout: fixed;
284
284
  }
285
- ._taskListRoot_1jqtj_1 {
285
+ ._taskListRoot_xeaio_1 {
286
286
  position: relative;
287
287
  /*noinspection CssUnresolvedCustomProperty*/
288
288
  border-left: 1px solid var(--gantt-table-divider-color, var(--gantt-divider-color));
@@ -292,7 +292,7 @@
292
292
  overflow: hidden;
293
293
  }
294
294
 
295
- ._taskListHorizontalScroll_1jqtj_21 {
295
+ ._taskListHorizontalScroll_xeaio_21 {
296
296
  overflow-x: auto;
297
297
  overflow-y: hidden;
298
298
  flex: 1;
@@ -300,16 +300,16 @@
300
300
  flex-direction: column;
301
301
  }
302
302
 
303
- ._taskListHorizontalScroll_1jqtj_21::-webkit-scrollbar {
304
- width: 0;
303
+ ._taskListHorizontalScroll_xeaio_21::-webkit-scrollbar {
304
+ width: 1rem;
305
305
  height: 1rem;
306
306
  }
307
307
 
308
- ._taskListHorizontalScroll_1jqtj_21::-webkit-scrollbar-corner {
308
+ ._taskListHorizontalScroll_xeaio_21::-webkit-scrollbar-corner {
309
309
  background: transparent;
310
310
  }
311
311
 
312
- ._taskListHorizontalScroll_1jqtj_21::-webkit-scrollbar-thumb {
312
+ ._taskListHorizontalScroll_xeaio_21::-webkit-scrollbar-thumb {
313
313
  border: 4px solid transparent;
314
314
  /*noinspection CssUnresolvedCustomProperty*/
315
315
  background: var(--gantt-scrollbar-thumb-color);
@@ -317,14 +317,14 @@
317
317
  background-clip: padding-box;
318
318
  }
319
319
 
320
- ._taskListHorizontalScroll_1jqtj_21::-webkit-scrollbar-thumb:hover {
320
+ ._taskListHorizontalScroll_xeaio_21::-webkit-scrollbar-thumb:hover {
321
321
  border: 2px solid transparent;
322
322
  /*noinspection CssUnresolvedCustomProperty*/
323
323
  background: var(--gantt-scrollbar-thumb-color);
324
324
  background-clip: padding-box;
325
325
  }
326
326
 
327
- ._taskListResizer_1jqtj_85 {
327
+ ._taskListResizer_xeaio_85 {
328
328
  position: absolute;
329
329
  top: 0;
330
330
  right: -3px;
@@ -336,16 +336,16 @@
336
336
  }
337
337
 
338
338
  /*noinspection CssUnresolvedCustomProperty*/
339
- ._taskListResizer_1jqtj_85:hover {
339
+ ._taskListResizer_xeaio_85:hover {
340
340
  background-color: var(--gantt-table-hover-action-color);
341
341
  filter: var(--gantt-hover-filter);
342
342
  }
343
343
 
344
- ._taskListResizer_1jqtj_85:hover::before {
344
+ ._taskListResizer_xeaio_85:hover::before {
345
345
  display: none;
346
346
  }
347
347
 
348
- ._taskListResizer_1jqtj_85::before {
348
+ ._taskListResizer_xeaio_85::before {
349
349
  content: "";
350
350
  position: absolute;
351
351
  top: 0;
@@ -356,7 +356,7 @@
356
356
  background-color: var(--gantt-table-resize-color, var(--gantt-divider-color));
357
357
  }
358
358
 
359
- ._horizontalContainer_1jqtj_149 {
359
+ ._horizontalContainer_xeaio_149 {
360
360
  margin: 0;
361
361
  padding: 0;
362
362
  overflow-y: auto;
@@ -365,37 +365,13 @@
365
365
  min-height: 0;
366
366
  }
367
367
 
368
- ._horizontalContainer_1jqtj_149::-webkit-scrollbar {
369
- width: 1rem;
370
- height: 1rem;
371
- }
372
-
373
- ._horizontalContainer_1jqtj_149::-webkit-scrollbar-corner {
374
- background: transparent;
375
- }
376
-
377
- ._horizontalContainer_1jqtj_149::-webkit-scrollbar-thumb {
378
- border: 4px solid transparent;
379
- /*noinspection CssUnresolvedCustomProperty*/
380
- background: var(--gantt-scrollbar-thumb-color);
381
- border-radius: 12px;
382
- background-clip: padding-box;
383
- }
384
-
385
- ._horizontalContainer_1jqtj_149::-webkit-scrollbar-thumb:hover {
386
- border: 2px solid transparent;
387
- /*noinspection CssUnresolvedCustomProperty*/
388
- background: var(--gantt-scrollbar-thumb-color);
389
- background-clip: padding-box;
390
- }
391
-
392
- ._tableWrapper_1jqtj_215 {
368
+ ._tableWrapper_xeaio_167 {
393
369
  position: relative;
394
370
  flex: 1;
395
371
  min-height: 0;
396
372
  }
397
373
 
398
- ._scrollToTop_1jqtj_227 {
374
+ ._scrollToTop_xeaio_179 {
399
375
  position: absolute;
400
376
  top: 0;
401
377
  left: 0;
@@ -403,7 +379,7 @@
403
379
  height: 20px;
404
380
  }
405
381
 
406
- ._scrollToBottom_1jqtj_243 {
382
+ ._scrollToBottom_xeaio_195 {
407
383
  position: absolute;
408
384
  bottom: 0;
409
385
  left: 0;
@@ -411,7 +387,7 @@
411
387
  height: 20px;
412
388
  }
413
389
 
414
- ._hidden_1jqtj_259 {
390
+ ._hidden_xeaio_211 {
415
391
  display: none;
416
392
  }
417
393
  ._ganttToday_1oyhk_1 {
@@ -605,9 +581,10 @@
605
581
  user-select: none;
606
582
  stroke-width: 0;
607
583
  }
608
- ._ganttVerticalContainer_1benq_1 {
584
+ ._ganttVerticalContainer_fjhll_1 {
609
585
  display: flex;
610
586
  flex-direction: column;
587
+ /* allow horizontal scrolling so the gantt SVG can overflow and be scrolled */
611
588
  overflow-x: auto;
612
589
  overflow-y: hidden;
613
590
  font-size: 0;
@@ -620,16 +597,16 @@
620
597
  min-height: 0;
621
598
  }
622
599
 
623
- ._ganttVerticalContainer_1benq_1::-webkit-scrollbar {
600
+ ._ganttVerticalContainer_fjhll_1::-webkit-scrollbar {
624
601
  width: 1rem;
625
602
  height: 1rem;
626
603
  }
627
604
 
628
- ._ganttVerticalContainer_1benq_1::-webkit-scrollbar-corner {
605
+ ._ganttVerticalContainer_fjhll_1::-webkit-scrollbar-corner {
629
606
  background: transparent;
630
607
  }
631
608
 
632
- ._ganttVerticalContainer_1benq_1::-webkit-scrollbar-thumb {
609
+ ._ganttVerticalContainer_fjhll_1::-webkit-scrollbar-thumb {
633
610
  border: 4px solid transparent;
634
611
  /*noinspection CssUnresolvedCustomProperty*/
635
612
  background: var(--gantt-scrollbar-thumb-color);
@@ -637,59 +614,37 @@
637
614
  background-clip: padding-box;
638
615
  }
639
616
 
640
- ._ganttVerticalContainer_1benq_1::-webkit-scrollbar-thumb:hover {
617
+ ._ganttVerticalContainer_fjhll_1::-webkit-scrollbar-thumb:hover {
641
618
  border: 2px solid transparent;
642
619
  /*noinspection CssUnresolvedCustomProperty*/
643
620
  background: var(--gantt-scrollbar-thumb-color);
644
621
  background-clip: padding-box;
645
622
  }
646
623
 
647
- ._horizontalContainer_1benq_79 {
624
+ ._horizontalContainer_fjhll_81 {
648
625
  margin: 0;
649
626
  padding: 0;
650
- overflow: visible;
627
+ /* keep inner container hidden overflow so content width is controlled by outer container */
628
+ overflow: hidden;
651
629
  height: 100%;
652
630
  min-height: 0;
653
631
  }
654
632
 
655
- ._ganttHeader_1benq_95 {
633
+ ._ganttHeader_fjhll_99 {
656
634
  flex: 0 0 auto;
657
635
  z-index: 3;
658
636
  }
659
637
 
660
- ._ganttBodyScroll_1benq_105 {
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_1benq_105::-webkit-scrollbar {
669
- width: 1rem;
670
- height: 1rem;
671
- }
672
-
673
- ._ganttBodyScroll_1benq_105::-webkit-scrollbar-corner {
674
- background: transparent;
675
- }
676
-
677
- ._ganttBodyScroll_1benq_105::-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_1benq_105::-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_1benq_169 {
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_1benq_195 {
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.19",
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",