gantt-task-react-powern 0.6.32 → 0.6.33

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.
@@ -269,7 +269,7 @@ var getMonday = function getMonday(date) {
269
269
  return new Date(date.setDate(diff));
270
270
  };
271
271
 
272
- var styles = {"ganttTable":"_3_ygE","ganttTable_Header":"_1nBOt","ganttTable_HeaderSeparator":"_2eZzQ","ganttTable_HeaderItem":"_WuQ0f"};
272
+ var styles = {"ganttTable":"_3_ygE","ganttTable_Header":"_1nBOt","ganttTable_HeaderSeparator":"_2eZzQ","ganttTable_HeaderResizeHandle":"_ddPJg","ganttTable_HeaderItem":"_WuQ0f"};
273
273
 
274
274
  var TaskListHeaderDefault = function TaskListHeaderDefault(_ref) {
275
275
  var headerHeight = _ref.headerHeight,
@@ -278,7 +278,64 @@ var TaskListHeaderDefault = function TaskListHeaderDefault(_ref) {
278
278
  rowWidth = _ref.rowWidth,
279
279
  scheduleType = _ref.scheduleType,
280
280
  allSelected = _ref.allSelected,
281
- onSelectAll = _ref.onSelectAll;
281
+ onSelectAll = _ref.onSelectAll,
282
+ columnWidths = _ref.columnWidths,
283
+ onColumnResize = _ref.onColumnResize;
284
+
285
+ var widthOf = function widthOf(colId, factor) {
286
+ var _columnWidths$colId;
287
+
288
+ return (_columnWidths$colId = columnWidths === null || columnWidths === void 0 ? void 0 : columnWidths[colId]) != null ? _columnWidths$colId : parseInt(rowWidth) * factor;
289
+ };
290
+
291
+ var startResize = function startResize(colId, startWidth) {
292
+ return function (e) {
293
+ if (!onColumnResize) return;
294
+ e.preventDefault();
295
+ e.stopPropagation();
296
+ var startX = e.clientX;
297
+
298
+ var onMove = function onMove(ev) {
299
+ onColumnResize(colId, startWidth + (ev.clientX - startX));
300
+ };
301
+
302
+ var onUp = function onUp() {
303
+ document.removeEventListener("mousemove", onMove);
304
+ document.removeEventListener("mouseup", onUp);
305
+ };
306
+
307
+ document.addEventListener("mousemove", onMove);
308
+ document.addEventListener("mouseup", onUp);
309
+ };
310
+ };
311
+
312
+ var cell = function cell(colId, factor, content, opts) {
313
+ if (opts === void 0) {
314
+ opts = {};
315
+ }
316
+
317
+ var _opts = opts,
318
+ title = _opts.title,
319
+ _opts$resizable = _opts.resizable,
320
+ resizable = _opts$resizable === void 0 ? true : _opts$resizable;
321
+ var width = widthOf(colId, factor);
322
+ return React.createElement("div", {
323
+ className: styles.ganttTable_HeaderItem,
324
+ style: {
325
+ minWidth: width,
326
+ maxWidth: width,
327
+ position: "relative"
328
+ },
329
+ title: title
330
+ }, content, resizable && onColumnResize && React.createElement("div", {
331
+ className: styles.ganttTable_HeaderResizeHandle,
332
+ style: {
333
+ height: headerHeight - 2
334
+ },
335
+ onMouseDown: startResize(colId, width)
336
+ }));
337
+ };
338
+
282
339
  return React.createElement("div", {
283
340
  className: styles.ganttTable,
284
341
  style: {
@@ -290,156 +347,33 @@ var TaskListHeaderDefault = function TaskListHeaderDefault(_ref) {
290
347
  style: {
291
348
  height: headerHeight - 2
292
349
  }
293
- }, onSelectAll && React.createElement("div", null, React.createElement("div", {
294
- className: styles.ganttTable_HeaderItem,
295
- style: {
296
- minWidth: parseInt(rowWidth) * 0.3,
297
- maxWidth: parseInt(rowWidth) * 0.3
298
- }
299
- }, React.createElement("input", {
350
+ }, onSelectAll && cell("select", 0.3, React.createElement("input", {
300
351
  type: "checkbox",
301
352
  checked: allSelected,
302
353
  onChange: function onChange(e) {
303
354
  return onSelectAll(e.target.checked);
304
355
  }
305
- }))), React.createElement("div", {
306
- className: styles.ganttTable_HeaderItem,
307
- style: {
308
- minWidth: parseInt(rowWidth) * 0.8,
309
- maxWidth: parseInt(rowWidth) * 0.8
310
- }
311
- }, "ID"), React.createElement("div", {
312
- className: styles.ganttTable_HeaderSeparator,
313
- style: {
314
- height: headerHeight * 0.5,
315
- marginTop: headerHeight * 0.2
316
- }
317
- }), React.createElement("div", {
318
- className: styles.ganttTable_HeaderItem,
319
- style: {
320
- minWidth: parseInt(rowWidth) * 0.8,
321
- maxWidth: parseInt(rowWidth) * 0.8
322
- }
323
- }, "WBS Code / Activity ID"), React.createElement("div", {
324
- className: styles.ganttTable_HeaderSeparator,
325
- style: {
326
- height: headerHeight * 0.5,
327
- marginTop: headerHeight * 0.2
328
- }
329
- }), React.createElement("div", {
330
- className: styles.ganttTable_HeaderItem,
331
- style: {
332
- minWidth: parseInt(rowWidth) * 1.8,
333
- maxWidth: parseInt(rowWidth) * 1.8
334
- }
335
- }, "Task"), React.createElement("div", {
336
- className: styles.ganttTable_HeaderSeparator,
337
- style: {
338
- height: headerHeight * 0.5,
339
- marginTop: headerHeight * 0.2
340
- }
341
- }), React.createElement("div", {
342
- className: styles.ganttTable_HeaderItem,
343
- style: {
344
- minWidth: parseInt(rowWidth) * 0.6
345
- },
356
+ }), {
357
+ resizable: false
358
+ }), cell("id", 0.8, "ID"), cell("wbs", 0.8, "WBS Code / Activity ID"), cell("name", 1.8, "Task"), cell("plannedStart", 0.6, "Planned Start", {
346
359
  title: "Planned Start"
347
- }, "Planned Start"), React.createElement("div", {
348
- className: styles.ganttTable_HeaderSeparator,
349
- style: {
350
- height: headerHeight * 0.5,
351
- marginTop: headerHeight * 0.25
352
- }
353
- }), React.createElement("div", {
354
- className: styles.ganttTable_HeaderItem,
355
- style: {
356
- minWidth: parseInt(rowWidth) * 0.6
357
- },
360
+ }), cell("plannedEnd", 0.6, "Planned End", {
358
361
  title: "Planned End"
359
- }, "Planned End"), scheduleType === "lookAhead" && React.createElement("div", {
360
- className: styles.ganttTable_HeaderItem,
361
- style: {
362
- minWidth: parseInt(rowWidth) * 0.6
363
- },
364
- title: "Planned Start"
365
- }, "Actual Start"), scheduleType === "lookAhead" && React.createElement("div", {
366
- className: styles.ganttTable_HeaderSeparator,
367
- style: {
368
- height: headerHeight * 0.5,
369
- marginTop: headerHeight * 0.25
370
- }
371
- }), scheduleType === "lookAhead" && React.createElement("div", {
372
- className: styles.ganttTable_HeaderItem,
373
- style: {
374
- minWidth: parseInt(rowWidth) * 0.6
375
- },
376
- title: "Planned End"
377
- }, "Actual End"), scheduleType === "main" && React.createElement(React.Fragment, null, React.createElement("div", {
378
- className: styles.ganttTable_HeaderSeparator,
379
- style: {
380
- height: headerHeight * 0.5,
381
- marginTop: headerHeight * 0.25
382
- }
383
- }), React.createElement("div", {
384
- className: styles.ganttTable_HeaderItem,
385
- style: {
386
- minWidth: parseInt(rowWidth) * 0.6,
387
- maxWidth: parseInt(rowWidth) * 0.6
388
- },
362
+ }), scheduleType === "lookAhead" && React.createElement(React.Fragment, null, cell("actualStart", 0.6, "Actual Start", {
363
+ title: "Actual Start"
364
+ }), cell("actualEnd", 0.6, "Actual End", {
365
+ title: "Actual End"
366
+ })), scheduleType === "main" && React.createElement(React.Fragment, null, cell("percentComplete", 0.6, "% Complete", {
389
367
  title: "% Complete"
390
- }, "% Complete"), React.createElement("div", {
391
- className: styles.ganttTable_HeaderSeparator,
392
- style: {
393
- height: headerHeight * 0.5,
394
- marginTop: headerHeight * 0.25
395
- }
396
- }), React.createElement("div", {
397
- className: styles.ganttTable_HeaderItem,
398
- style: {
399
- minWidth: parseInt(rowWidth) * 0.6,
400
- maxWidth: parseInt(rowWidth) * 0.6
401
- },
368
+ }), cell("plannedDuration", 0.6, "Planned Duration", {
402
369
  title: "Planned Duration"
403
- }, "Planned Duration"), React.createElement("div", {
404
- className: styles.ganttTable_HeaderSeparator,
405
- style: {
406
- height: headerHeight * 0.5,
407
- marginTop: headerHeight * 0.25
408
- }
409
- }), React.createElement("div", {
410
- className: styles.ganttTable_HeaderItem,
411
- style: {
412
- minWidth: parseInt(rowWidth) * 0.7,
413
- maxWidth: parseInt(rowWidth) * 0.7
414
- },
370
+ }), cell("remainingDuration", 0.7, "Remaining Duration", {
415
371
  title: "Remaining Duration"
416
- }, "Remaining Duration"), React.createElement("div", {
417
- className: styles.ganttTable_HeaderSeparator,
418
- style: {
419
- height: headerHeight * 0.5,
420
- marginTop: headerHeight * 0.25
421
- }
422
- }), React.createElement("div", {
423
- className: styles.ganttTable_HeaderItem,
424
- style: {
425
- minWidth: parseInt(rowWidth) * 0.6,
426
- maxWidth: parseInt(rowWidth) * 0.6
427
- },
372
+ }), cell("actualDuration", 0.6, "Actual Duration", {
428
373
  title: "Actual Duration"
429
- }, "Actual Duration"), React.createElement("div", {
430
- className: styles.ganttTable_HeaderSeparator,
431
- style: {
432
- height: headerHeight * 0.5,
433
- marginTop: headerHeight * 0.25
434
- }
435
- }), React.createElement("div", {
436
- className: styles.ganttTable_HeaderItem,
437
- style: {
438
- minWidth: parseInt(rowWidth) * 0.8,
439
- maxWidth: parseInt(rowWidth) * 0.8
440
- },
374
+ }), cell("durationType", 0.8, "Duration Type", {
441
375
  title: "Duration Type"
442
- }, "Duration Type"))));
376
+ }))));
443
377
  };
444
378
 
445
379
  var styles$1 = {"taskListWrapper":"_3ZbQT","taskListTableRow":"_34SS0","taskListLookAheadRow":"_GzvG4","taskListMilestoneRow":"_3Ykml","taskListCell":"_3lLk3","taskListNameWrapper":"_nI1Xw","taskListExpander":"_2QjE6","taskListExpanderPlaceholder":"_1fnLB","taskListEmptyExpander":"_2TfEi","taskListText":"_2ZvXU"};
@@ -483,7 +417,15 @@ var TaskListTableDefault = function TaskListTableDefault(_ref) {
483
417
  taskLabelRenderer = _ref$taskLabelRendere === void 0 ? function (t) {
484
418
  return " " + t.name;
485
419
  } : _ref$taskLabelRendere,
486
- virtualItems = _ref.virtualItems;
420
+ virtualItems = _ref.virtualItems,
421
+ columnWidths = _ref.columnWidths;
422
+
423
+ var widthOf = function widthOf(colId, factor) {
424
+ var _columnWidths$colId;
425
+
426
+ return (_columnWidths$colId = columnWidths === null || columnWidths === void 0 ? void 0 : columnWidths[colId]) != null ? _columnWidths$colId : parseInt(rowWidth) * factor;
427
+ };
428
+
487
429
  var toLocaleDateString = useMemo(function () {
488
430
  return toLocaleDateStringFactory(locale);
489
431
  }, [locale]);
@@ -555,8 +497,8 @@ var TaskListTableDefault = function TaskListTableDefault(_ref) {
555
497
  }, onTaskSelect && React.createElement("div", {
556
498
  className: styles$1.taskListCell,
557
499
  style: {
558
- minWidth: parseInt(rowWidth) * 0.3,
559
- maxWidth: parseInt(rowWidth) * 0.3
500
+ minWidth: widthOf("select", 0.3),
501
+ maxWidth: widthOf("select", 0.3)
560
502
  }
561
503
  }, React.createElement("div", {
562
504
  className: styles$1.taskListText,
@@ -578,8 +520,8 @@ var TaskListTableDefault = function TaskListTableDefault(_ref) {
578
520
  }))), React.createElement("div", {
579
521
  className: styles$1.taskListCell,
580
522
  style: {
581
- minWidth: parseInt(rowWidth) * 0.8,
582
- maxWidth: parseInt(rowWidth) * 0.8
523
+ minWidth: widthOf("id", 0.8),
524
+ maxWidth: widthOf("id", 0.8)
583
525
  },
584
526
  title: t.id
585
527
  }, React.createElement("div", {
@@ -605,15 +547,15 @@ var TaskListTableDefault = function TaskListTableDefault(_ref) {
605
547
  }, "\u2714") : ""))), React.createElement("div", {
606
548
  className: styles$1.taskListCell,
607
549
  style: {
608
- minWidth: parseInt(rowWidth) * 0.8,
609
- maxWidth: parseInt(rowWidth) * 0.8
550
+ minWidth: widthOf("wbs", 0.8),
551
+ maxWidth: widthOf("wbs", 0.8)
610
552
  },
611
553
  title: t.optionalId ? t.optionalId : ""
612
554
  }, t.optionalId), React.createElement("div", {
613
555
  className: styles$1.taskListCell,
614
556
  style: {
615
- minWidth: parseInt(rowWidth) * 1.8,
616
- maxWidth: parseInt(rowWidth) * 1.8
557
+ minWidth: widthOf("name", 1.8),
558
+ maxWidth: widthOf("name", 1.8)
617
559
  },
618
560
  title: t.name
619
561
  }, React.createElement("div", {
@@ -621,32 +563,32 @@ var TaskListTableDefault = function TaskListTableDefault(_ref) {
621
563
  }, taskLabelRenderer(t))), React.createElement("div", {
622
564
  className: styles$1.taskListCell,
623
565
  style: {
624
- minWidth: parseInt(rowWidth) * 0.6,
625
- maxWidth: parseInt(rowWidth) * 0.6
566
+ minWidth: widthOf("plannedStart", 0.6),
567
+ maxWidth: widthOf("plannedStart", 0.6)
626
568
  }
627
569
  }, React.createElement("div", {
628
570
  className: styles$1.taskListText
629
571
  }, "\xA0", toLocaleDateString(t.start, dateTimeOptions))), React.createElement("div", {
630
572
  className: styles$1.taskListCell,
631
573
  style: {
632
- minWidth: parseInt(rowWidth) * 0.6,
633
- maxWidth: parseInt(rowWidth) * 0.6
574
+ minWidth: widthOf("plannedEnd", 0.6),
575
+ maxWidth: widthOf("plannedEnd", 0.6)
634
576
  }
635
577
  }, React.createElement("div", {
636
578
  className: styles$1.taskListText
637
579
  }, "\xA0", toLocaleDateString(t.end, dateTimeOptions))), scheduleType === "lookAhead" && React.createElement("div", {
638
580
  className: styles$1.taskListCell,
639
581
  style: {
640
- minWidth: parseInt(rowWidth) * 0.6,
641
- maxWidth: parseInt(rowWidth) * 0.6
582
+ minWidth: widthOf("actualStart", 0.6),
583
+ maxWidth: widthOf("actualStart", 0.6)
642
584
  }
643
585
  }, React.createElement("div", {
644
586
  className: styles$1.taskListText
645
587
  }, "\xA0", toLocaleDateString(t.actualStart, dateTimeOptions))), scheduleType === "lookAhead" && React.createElement("div", {
646
588
  className: styles$1.taskListCell,
647
589
  style: {
648
- minWidth: parseInt(rowWidth) * 0.6,
649
- maxWidth: parseInt(rowWidth) * 0.6
590
+ minWidth: widthOf("actualEnd", 0.6),
591
+ maxWidth: widthOf("actualEnd", 0.6)
650
592
  }
651
593
  }, React.createElement("div", {
652
594
  className: styles$1.taskListText
@@ -666,40 +608,40 @@ var TaskListTableDefault = function TaskListTableDefault(_ref) {
666
608
  return React.createElement(React.Fragment, null, React.createElement("div", {
667
609
  className: styles$1.taskListCell,
668
610
  style: {
669
- minWidth: parseInt(rowWidth) * 0.6,
670
- maxWidth: parseInt(rowWidth) * 0.6
611
+ minWidth: widthOf("percentComplete", 0.6),
612
+ maxWidth: widthOf("percentComplete", 0.6)
671
613
  }
672
614
  }, React.createElement("div", {
673
615
  className: styles$1.taskListText
674
616
  }, "\xA0", percentComplete != null ? percentComplete + "%" : "")), React.createElement("div", {
675
617
  className: styles$1.taskListCell,
676
618
  style: {
677
- minWidth: parseInt(rowWidth) * 0.6,
678
- maxWidth: parseInt(rowWidth) * 0.6
619
+ minWidth: widthOf("plannedDuration", 0.6),
620
+ maxWidth: widthOf("plannedDuration", 0.6)
679
621
  }
680
622
  }, React.createElement("div", {
681
623
  className: styles$1.taskListText
682
624
  }, "\xA0", plannedDuration != null ? plannedDuration : "")), React.createElement("div", {
683
625
  className: styles$1.taskListCell,
684
626
  style: {
685
- minWidth: parseInt(rowWidth) * 0.7,
686
- maxWidth: parseInt(rowWidth) * 0.7
627
+ minWidth: widthOf("remainingDuration", 0.7),
628
+ maxWidth: widthOf("remainingDuration", 0.7)
687
629
  }
688
630
  }, React.createElement("div", {
689
631
  className: styles$1.taskListText
690
632
  }, "\xA0", remainingDuration != null ? remainingDuration : "")), React.createElement("div", {
691
633
  className: styles$1.taskListCell,
692
634
  style: {
693
- minWidth: parseInt(rowWidth) * 0.6,
694
- maxWidth: parseInt(rowWidth) * 0.6
635
+ minWidth: widthOf("actualDuration", 0.6),
636
+ maxWidth: widthOf("actualDuration", 0.6)
695
637
  }
696
638
  }, React.createElement("div", {
697
639
  className: styles$1.taskListText
698
640
  }, "\xA0", actualDuration != null ? actualDuration : "")), React.createElement("div", {
699
641
  className: styles$1.taskListCell,
700
642
  style: {
701
- minWidth: parseInt(rowWidth) * 0.8,
702
- maxWidth: parseInt(rowWidth) * 0.8
643
+ minWidth: widthOf("durationType", 0.8),
644
+ maxWidth: widthOf("durationType", 0.8)
703
645
  }
704
646
  }, React.createElement("div", {
705
647
  className: styles$1.taskListText
@@ -876,6 +818,73 @@ var VerticalScroll = function VerticalScroll(_ref) {
876
818
  }));
877
819
  };
878
820
 
821
+ function getTaskListColumns(scheduleType, hasCheckbox) {
822
+ var columns = [];
823
+ if (hasCheckbox) columns.push({
824
+ id: "select",
825
+ factor: 0.3
826
+ });
827
+ columns.push({
828
+ id: "id",
829
+ factor: 0.8
830
+ }, {
831
+ id: "wbs",
832
+ factor: 0.8
833
+ }, {
834
+ id: "name",
835
+ factor: 1.8
836
+ }, {
837
+ id: "plannedStart",
838
+ factor: 0.6
839
+ }, {
840
+ id: "plannedEnd",
841
+ factor: 0.6
842
+ });
843
+
844
+ if (scheduleType === "lookAhead") {
845
+ columns.push({
846
+ id: "actualStart",
847
+ factor: 0.6
848
+ }, {
849
+ id: "actualEnd",
850
+ factor: 0.6
851
+ });
852
+ }
853
+
854
+ if (scheduleType === "main") {
855
+ columns.push({
856
+ id: "percentComplete",
857
+ factor: 0.6
858
+ }, {
859
+ id: "plannedDuration",
860
+ factor: 0.6
861
+ }, {
862
+ id: "remainingDuration",
863
+ factor: 0.7
864
+ }, {
865
+ id: "actualDuration",
866
+ factor: 0.6
867
+ }, {
868
+ id: "durationType",
869
+ factor: 0.8
870
+ });
871
+ }
872
+
873
+ return columns;
874
+ }
875
+ var MIN_COLUMN_WIDTH = 40;
876
+ function buildDefaultColumnWidths(scheduleType, hasCheckbox, rowWidth) {
877
+ var base = parseInt(rowWidth) || 0;
878
+ var widths = {};
879
+
880
+ for (var _iterator = _createForOfIteratorHelperLoose(getTaskListColumns(scheduleType, hasCheckbox)), _step; !(_step = _iterator()).done;) {
881
+ var col = _step.value;
882
+ widths[col.id] = base * col.factor;
883
+ }
884
+
885
+ return widths;
886
+ }
887
+
879
888
  var styles$4 = {"hideScrollbar":"_38emS"};
880
889
 
881
890
  var TaskList = function TaskList(_ref) {
@@ -900,6 +909,8 @@ var TaskList = function TaskList(_ref) {
900
909
  taskLabelRenderer = _ref.taskLabelRenderer,
901
910
  onMultiSelect = _ref.onMultiSelect,
902
911
  containerWidth = _ref.containerWidth,
912
+ containerMaxWidth = _ref.containerMaxWidth,
913
+ onContentWidthChange = _ref.onContentWidthChange,
903
914
  innerScrollRef = _ref.innerScrollRef,
904
915
  externalHorizontalContainerRef = _ref.horizontalContainerRef;
905
916
  var internalHorizontalContainerRef = useRef(null);
@@ -925,9 +936,55 @@ var TaskList = function TaskList(_ref) {
925
936
  selectedTasks = _useState[0],
926
937
  setSelectedTasks = _useState[1];
927
938
 
928
- var _useState2 = useState([]),
929
- pendingTaskSelect = _useState2[0],
930
- setPendingTaskSelect = _useState2[1];
939
+ var hasCheckbox = !!onMultiSelect;
940
+
941
+ var _useState2 = useState(function () {
942
+ return buildDefaultColumnWidths(scheduleType, hasCheckbox, rowWidth);
943
+ }),
944
+ columnWidths = _useState2[0],
945
+ setColumnWidths = _useState2[1];
946
+
947
+ useEffect(function () {
948
+ var defaults = buildDefaultColumnWidths(scheduleType, hasCheckbox, rowWidth);
949
+ setColumnWidths(function (prev) {
950
+ var ids = Object.keys(defaults);
951
+ var sameSet = ids.length === Object.keys(prev).length && ids.every(function (id) {
952
+ return id in prev;
953
+ });
954
+ if (sameSet) return prev;
955
+ var next = {};
956
+
957
+ for (var _i = 0, _ids = ids; _i < _ids.length; _i++) {
958
+ var _prev$id;
959
+
960
+ var id = _ids[_i];
961
+ next[id] = (_prev$id = prev[id]) != null ? _prev$id : defaults[id];
962
+ }
963
+
964
+ return next;
965
+ });
966
+ }, [scheduleType, hasCheckbox, rowWidth]);
967
+
968
+ var handleColumnResize = function handleColumnResize(colId, width) {
969
+ setColumnWidths(function (prev) {
970
+ var _extends2;
971
+
972
+ return _extends({}, prev, (_extends2 = {}, _extends2[colId] = Math.max(MIN_COLUMN_WIDTH, width), _extends2));
973
+ });
974
+ };
975
+
976
+ var contentWidth = useMemo(function () {
977
+ return Object.values(columnWidths).reduce(function (sum, w) {
978
+ return sum + w;
979
+ }, 0);
980
+ }, [columnWidths]);
981
+ useEffect(function () {
982
+ onContentWidthChange === null || onContentWidthChange === void 0 ? void 0 : onContentWidthChange(contentWidth);
983
+ }, [contentWidth, onContentWidthChange]);
984
+
985
+ var _useState3 = useState([]),
986
+ pendingTaskSelect = _useState3[0],
987
+ setPendingTaskSelect = _useState3[1];
931
988
 
932
989
  var prevSelectedTasksRef = useRef([]);
933
990
  var expandedTasks = useRef([]);
@@ -1075,7 +1132,9 @@ var TaskList = function TaskList(_ref) {
1075
1132
  rowWidth: rowWidth,
1076
1133
  scheduleType: scheduleType,
1077
1134
  allSelected: tasks.length > 0 && selectedTasks.length === tasks.length,
1078
- onSelectAll: onMultiSelect ? handleSelectAll : undefined
1135
+ onSelectAll: onMultiSelect ? handleSelectAll : undefined,
1136
+ columnWidths: columnWidths,
1137
+ onColumnResize: handleColumnResize
1079
1138
  };
1080
1139
  var selectedTaskId = selectedTask ? selectedTask.id : "";
1081
1140
  var tableProps = {
@@ -1093,15 +1152,19 @@ var TaskList = function TaskList(_ref) {
1093
1152
  selectedTasks: onMultiSelect ? selectedTasks : undefined,
1094
1153
  onTaskSelect: onMultiSelect ? handleTaskSelect : undefined,
1095
1154
  taskLabelRenderer: taskLabelRenderer,
1096
- virtualItems: virtualizer.getVirtualItems()
1155
+ virtualItems: virtualizer.getVirtualItems(),
1156
+ columnWidths: columnWidths
1097
1157
  };
1098
1158
  return React.createElement("div", {
1099
1159
  ref: taskListRef,
1100
- style: containerWidth != null ? {
1101
- width: containerWidth,
1160
+ style: containerWidth != null || containerMaxWidth != null ? _extends({}, containerWidth != null ? {
1161
+ width: containerWidth
1162
+ } : {}, containerMaxWidth != null ? {
1163
+ maxWidth: containerMaxWidth
1164
+ } : {}, {
1102
1165
  overflow: "hidden",
1103
1166
  flexShrink: 0
1104
- } : {}
1167
+ }) : {}
1105
1168
  }, React.createElement("div", {
1106
1169
  ref: innerScrollRef,
1107
1170
  className: styles$4.hideScrollbar,
@@ -1258,7 +1321,7 @@ function getQuarterNumber(date, quarterStart) {
1258
1321
  return Math.floor(offset / 3) + 1;
1259
1322
  }
1260
1323
 
1261
- var styles$5 = {"gridRow":"_2dZTy","gridRowLookAhead":"_2RRca","gridRowLine":"_3rUKi","gridTick":"_RuwuK","gridTickDashed":"_Zh9jh","darkerGridRow":"_2M-tt"};
1324
+ var styles$5 = {"gridRow":"_2dZTy","gridRowLookAhead":"_2RRca","gridRowLine":"_3rUKi","gridTick":"_RuwuK","gridTickWeekStart":"_1q0EV","gridTickDashed":"_Zh9jh","darkerGridRow":"_2M-tt"};
1262
1325
 
1263
1326
  var GridBody = function GridBody(_ref) {
1264
1327
  var _projectCalendar$week;
@@ -1302,7 +1365,8 @@ var GridBody = function GridBody(_ref) {
1302
1365
  if (next && date <= now && next > now) return true;
1303
1366
 
1304
1367
  if (!next && date <= now) {
1305
- var step = date.getTime() - dates[i - 1].getTime();
1368
+ var prev = dates[i - 1];
1369
+ var step = prev ? date.getTime() - prev.getTime() : 86400000;
1306
1370
  var end = addToDate(date, step, "millisecond");
1307
1371
  return end > now;
1308
1372
  }
@@ -1363,11 +1427,14 @@ var GridBody = function GridBody(_ref) {
1363
1427
  }
1364
1428
 
1365
1429
  var isDayView = viewMode === ViewMode.Day;
1430
+ var isWeekView = viewMode === ViewMode.Week;
1366
1431
  var tickLines = dates.map(function (date, i) {
1367
1432
  var tickClass = styles$5.gridTick;
1368
1433
 
1369
1434
  if (isDayView) {
1370
- tickClass = date.getDay() === weekStartDay ? styles$5.gridTick : styles$5.gridTickDashed;
1435
+ tickClass = date.getDay() === weekStartDay ? styles$5.gridTickWeekStart : styles$5.gridTickDashed;
1436
+ } else if (isWeekView) {
1437
+ tickClass = styles$5.gridTickWeekStart;
1371
1438
  }
1372
1439
 
1373
1440
  return React.createElement("line", {
@@ -1535,7 +1602,13 @@ var Calendar = function Calendar(_ref) {
1535
1602
  columnWidth = _ref.columnWidth,
1536
1603
  fontFamily = _ref.fontFamily,
1537
1604
  fontSize = _ref.fontSize,
1538
- projectCalendar = _ref.projectCalendar;
1605
+ projectCalendar = _ref.projectCalendar,
1606
+ weekendColor = _ref.weekendColor;
1607
+
1608
+ var isDayOff = function isDayOff(date) {
1609
+ if (projectCalendar) return isOffDay(date, projectCalendar);
1610
+ return false;
1611
+ };
1539
1612
 
1540
1613
  var shortMonth = function shortMonth(date) {
1541
1614
  return date.toLocaleString(locale, {
@@ -1784,6 +1857,18 @@ var Calendar = function Calendar(_ref) {
1784
1857
 
1785
1858
  for (var i = 0; i < dates.length; i++) {
1786
1859
  var date = dates[i];
1860
+
1861
+ if (isDayOff(date)) {
1862
+ offDayRects.push(React.createElement("rect", {
1863
+ key: "offday-header-" + i,
1864
+ x: columnWidth * i,
1865
+ y: topDefaultHeight,
1866
+ width: columnWidth,
1867
+ height: headerHeight - topDefaultHeight,
1868
+ fill: weekendColor
1869
+ }));
1870
+ }
1871
+
1787
1872
  var isWeekStart = date.getDay() === weekStartDay;
1788
1873
  tickLines.push(React.createElement("line", {
1789
1874
  key: "tick-day-" + i,
@@ -3187,6 +3272,11 @@ var TaskGanttContent = function TaskGanttContent(_ref) {
3187
3272
  setIsMoving = _useState3[1];
3188
3273
 
3189
3274
  useEffect(function () {
3275
+ if (dates.length < 2) {
3276
+ setXStep(timeStep * columnWidth / 86400000);
3277
+ return;
3278
+ }
3279
+
3190
3280
  var dateDelta = dates[1].getTime() - dates[0].getTime() - dates[1].getTimezoneOffset() * 60 * 1000 + dates[0].getTimezoneOffset() * 60 * 1000;
3191
3281
  var newXStep = timeStep * columnWidth / dateDelta;
3192
3282
  setXStep(newXStep);
@@ -3814,8 +3904,10 @@ var HorizontalScroll = function HorizontalScroll(_ref) {
3814
3904
  }));
3815
3905
  };
3816
3906
 
3907
+ var GANTT_MIN_WIDTH_RATIO = 0.4;
3908
+ var TABLE_GANTT_DIVIDER_WIDTH = 20;
3817
3909
  var Gantt = function Gantt(_ref) {
3818
- var _ref3;
3910
+ var _ref2;
3819
3911
 
3820
3912
  var tasks = _ref.tasks,
3821
3913
  _ref$leafTasks = _ref.leafTasks,
@@ -3923,8 +4015,8 @@ var Gantt = function Gantt(_ref) {
3923
4015
  var tableHScrollRef = useRef(null);
3924
4016
 
3925
4017
  var _useState2 = useState(0),
3926
- tableScrollableWidth = _useState2[0],
3927
- setTableScrollableWidth = _useState2[1];
4018
+ tableContentWidth = _useState2[0],
4019
+ setTableContentWidth = _useState2[1];
3928
4020
 
3929
4021
  var _useState3 = useState(function () {
3930
4022
  var _ganttDateRange = ganttDateRange(tasks, viewMode, preStepsCount),
@@ -3954,22 +4046,21 @@ var Gantt = function Gantt(_ref) {
3954
4046
  taskListWidth = _useState5[0],
3955
4047
  setTaskListWidth = _useState5[1];
3956
4048
 
3957
- useEffect(function () {
3958
- if (tableHorizontalContainerRef.current) {
3959
- setTableScrollableWidth(tableHorizontalContainerRef.current.scrollWidth);
3960
- } else if (tableInnerScrollRef.current) {
3961
- setTableScrollableWidth(tableInnerScrollRef.current.scrollWidth);
3962
- }
3963
- }, [taskListWidth, listCellWidth]);
4049
+ var _useState6 = useState(0),
4050
+ wrapperWidth = _useState6[0],
4051
+ setWrapperWidth = _useState6[1];
4052
+
4053
+ var maxTableWidth = wrapperWidth > 0 ? Math.max(100, wrapperWidth * (1 - GANTT_MIN_WIDTH_RATIO) - TABLE_GANTT_DIVIDER_WIDTH) : Infinity;
4054
+ var tableCap = Math.min(maxTableWidth, tableContentWidth > 0 ? tableContentWidth : Infinity);
3964
4055
 
3965
4056
  var handleTableResizeMouseDown = function handleTableResizeMouseDown(e) {
3966
- var _taskListRef$current$, _taskListRef$current, _ref2, _tableHorizontalConta, _tableHorizontalConta2, _tableInnerScrollRef$, _wrapperRef$current$o, _wrapperRef$current;
4057
+ var _taskListRef$current$, _taskListRef$current;
3967
4058
 
3968
4059
  isDraggingTable.current = true;
3969
4060
  userResizedRef.current = true;
3970
4061
  dragStartX.current = e.clientX;
3971
4062
  dragStartWidth.current = tableContainerWidth != null ? tableContainerWidth : (_taskListRef$current$ = (_taskListRef$current = taskListRef.current) === null || _taskListRef$current === void 0 ? void 0 : _taskListRef$current.offsetWidth) != null ? _taskListRef$current$ : 0;
3972
- dragMaxWidth.current = (_ref2 = (_tableHorizontalConta = (_tableHorizontalConta2 = tableHorizontalContainerRef.current) === null || _tableHorizontalConta2 === void 0 ? void 0 : _tableHorizontalConta2.scrollWidth) != null ? _tableHorizontalConta : (_tableInnerScrollRef$ = tableInnerScrollRef.current) === null || _tableInnerScrollRef$ === void 0 ? void 0 : _tableInnerScrollRef$.scrollWidth) != null ? _ref2 : Math.max(100, ((_wrapperRef$current$o = (_wrapperRef$current = wrapperRef.current) === null || _wrapperRef$current === void 0 ? void 0 : _wrapperRef$current.offsetWidth) != null ? _wrapperRef$current$o : Infinity) - 200);
4063
+ dragMaxWidth.current = tableCap;
3973
4064
  e.preventDefault();
3974
4065
  };
3975
4066
 
@@ -3993,25 +4084,25 @@ var Gantt = function Gantt(_ref) {
3993
4084
  };
3994
4085
  }, []);
3995
4086
 
3996
- var _useState6 = useState(0),
3997
- svgContainerWidth = _useState6[0],
3998
- setSvgContainerWidth = _useState6[1];
4087
+ var _useState7 = useState(0),
4088
+ svgContainerWidth = _useState7[0],
4089
+ setSvgContainerWidth = _useState7[1];
3999
4090
 
4000
- var _useState7 = useState(ganttHeight),
4001
- svgContainerHeight = _useState7[0],
4002
- setSvgContainerHeight = _useState7[1];
4091
+ var _useState8 = useState(ganttHeight),
4092
+ svgContainerHeight = _useState8[0],
4093
+ setSvgContainerHeight = _useState8[1];
4003
4094
 
4004
- var _useState8 = useState([]),
4005
- barTasks = _useState8[0],
4006
- setBarTasks = _useState8[1];
4095
+ var _useState9 = useState([]),
4096
+ barTasks = _useState9[0],
4097
+ setBarTasks = _useState9[1];
4007
4098
 
4008
4099
  var debounceRef = useRef(null);
4009
4100
 
4010
- var _useState9 = useState({
4101
+ var _useState10 = useState({
4011
4102
  action: ""
4012
4103
  }),
4013
- ganttEvent = _useState9[0],
4014
- setGanttEvent = _useState9[1];
4104
+ ganttEvent = _useState10[0],
4105
+ setGanttEvent = _useState10[1];
4015
4106
 
4016
4107
  var handleBarTasksUpdate = function handleBarTasksUpdate(task) {
4017
4108
  setBarTasks(function (prev) {
@@ -4025,17 +4116,17 @@ var Gantt = function Gantt(_ref) {
4025
4116
  return rowHeight * barFill / 100;
4026
4117
  }, [rowHeight, barFill]);
4027
4118
 
4028
- var _useState10 = useState(),
4029
- selectedTask = _useState10[0],
4030
- setSelectedTask = _useState10[1];
4031
-
4032
- var _useState11 = useState(null),
4033
- failedTask = _useState11[0],
4034
- setFailedTask = _useState11[1];
4119
+ var _useState11 = useState(),
4120
+ selectedTask = _useState11[0],
4121
+ setSelectedTask = _useState11[1];
4035
4122
 
4036
4123
  var _useState12 = useState(null),
4037
- computedColumnWidth = _useState12[0],
4038
- setComputedColumnWidth = _useState12[1];
4124
+ failedTask = _useState12[0],
4125
+ setFailedTask = _useState12[1];
4126
+
4127
+ var _useState13 = useState(null),
4128
+ computedColumnWidth = _useState13[0],
4129
+ setComputedColumnWidth = _useState13[1];
4039
4130
 
4040
4131
  var computedForViewModeRef = useRef(null);
4041
4132
  useEffect(function () {
@@ -4082,7 +4173,7 @@ var Gantt = function Gantt(_ref) {
4082
4173
  setComputedColumnWidth(next);
4083
4174
  }
4084
4175
  }, [viewMode, svgContainerWidth, columnWidthProp, computedColumnWidth]);
4085
- var columnWidth = (_ref3 = columnWidthProp != null ? columnWidthProp : computedColumnWidth) != null ? _ref3 : 60;
4176
+ var columnWidth = (_ref2 = columnWidthProp != null ? columnWidthProp : computedColumnWidth) != null ? _ref2 : 60;
4086
4177
  var effectiveColumnWidth = useMemo(function () {
4087
4178
  if (svgContainerWidth <= 0 || dateSetup.dates.length <= 0) return columnWidth;
4088
4179
 
@@ -4103,29 +4194,29 @@ var Gantt = function Gantt(_ref) {
4103
4194
  return barTasks.length * rowHeight;
4104
4195
  }, [barTasks.length, rowHeight]);
4105
4196
 
4106
- var _useState13 = useState(0),
4107
- scrollY = _useState13[0],
4108
- setScrollY = _useState13[1];
4197
+ var _useState14 = useState(0),
4198
+ scrollY = _useState14[0],
4199
+ setScrollY = _useState14[1];
4109
4200
 
4110
- var _useState14 = useState(-1),
4111
- scrollX = _useState14[0],
4112
- setScrollX = _useState14[1];
4201
+ var _useState15 = useState(-1),
4202
+ scrollX = _useState15[0],
4203
+ setScrollX = _useState15[1];
4113
4204
 
4114
- var _useState15 = useState(false),
4115
- ignoreScrollEvent = _useState15[0],
4116
- setIgnoreScrollEvent = _useState15[1];
4117
-
4118
- var _useState16 = useState(0),
4119
- lastTouchX = _useState16[0],
4120
- setLastTouchX = _useState16[1];
4205
+ var _useState16 = useState(false),
4206
+ ignoreScrollEvent = _useState16[0],
4207
+ setIgnoreScrollEvent = _useState16[1];
4121
4208
 
4122
4209
  var _useState17 = useState(0),
4123
- lastTouchY = _useState17[0],
4124
- setLastTouchY = _useState17[1];
4210
+ lastTouchX = _useState17[0],
4211
+ setLastTouchX = _useState17[1];
4212
+
4213
+ var _useState18 = useState(0),
4214
+ lastTouchY = _useState18[0],
4215
+ setLastTouchY = _useState18[1];
4125
4216
 
4126
- var _useState18 = useState(false),
4127
- isProcessing = _useState18[0],
4128
- setIsProcessing = _useState18[1];
4217
+ var _useState19 = useState(false),
4218
+ isProcessing = _useState19[0],
4219
+ setIsProcessing = _useState19[1];
4129
4220
 
4130
4221
  var buffer = rowHeight * 10;
4131
4222
  var visibleStartY = scrollY - buffer;
@@ -4246,11 +4337,48 @@ var Gantt = function Gantt(_ref) {
4246
4337
  setTaskListWidth(taskListRef.current.offsetWidth);
4247
4338
  }
4248
4339
  }, [taskListRef, listCellWidth]);
4340
+ useEffect(function () {
4341
+ if (!listCellWidth || !taskListRef.current) return;
4342
+ if (typeof ResizeObserver === "undefined") return;
4343
+
4344
+ var measure = function measure() {
4345
+ if (taskListRef.current) {
4346
+ setTaskListWidth(taskListRef.current.offsetWidth);
4347
+ }
4348
+ };
4349
+
4350
+ var observer = new ResizeObserver(measure);
4351
+ observer.observe(taskListRef.current);
4352
+ measure();
4353
+ return function () {
4354
+ return observer.disconnect();
4355
+ };
4356
+ }, [listCellWidth, scheduleType]);
4249
4357
  useEffect(function () {
4250
4358
  if (wrapperRef.current) {
4251
4359
  setSvgContainerWidth(wrapperRef.current.offsetWidth - taskListWidth - 20);
4252
4360
  }
4253
- }, [wrapperRef, taskListWidth]);
4361
+ }, [wrapperRef, taskListWidth, wrapperWidth]);
4362
+ useEffect(function () {
4363
+ var node = wrapperRef.current;
4364
+ if (!node) return;
4365
+
4366
+ if (typeof ResizeObserver === "undefined") {
4367
+ setWrapperWidth(node.offsetWidth);
4368
+ return;
4369
+ }
4370
+
4371
+ var measure = function measure() {
4372
+ return setWrapperWidth(node.offsetWidth);
4373
+ };
4374
+
4375
+ var observer = new ResizeObserver(measure);
4376
+ observer.observe(node);
4377
+ measure();
4378
+ return function () {
4379
+ return observer.disconnect();
4380
+ };
4381
+ }, []);
4254
4382
  useEffect(function () {
4255
4383
  if (ganttHeight) {
4256
4384
  setSvgContainerHeight(ganttHeight + headerHeight);
@@ -4259,7 +4387,7 @@ var Gantt = function Gantt(_ref) {
4259
4387
  }
4260
4388
  }, [ganttHeight, tasks, headerHeight, rowHeight]);
4261
4389
  useEffect(function () {
4262
- var _wrapperRef$current2, _wrapperRef$current3, _wrapperRef$current4, _wrapperRef$current5;
4390
+ var _wrapperRef$current, _wrapperRef$current2, _wrapperRef$current3, _wrapperRef$current4;
4263
4391
 
4264
4392
  var handleWheel = function handleWheel(event) {
4265
4393
  if (event.shiftKey || event.deltaX) {
@@ -4333,25 +4461,25 @@ var Gantt = function Gantt(_ref) {
4333
4461
  setIgnoreScrollEvent(true);
4334
4462
  };
4335
4463
 
4336
- (_wrapperRef$current2 = wrapperRef.current) === null || _wrapperRef$current2 === void 0 ? void 0 : _wrapperRef$current2.addEventListener("wheel", handleWheel, {
4464
+ (_wrapperRef$current = wrapperRef.current) === null || _wrapperRef$current === void 0 ? void 0 : _wrapperRef$current.addEventListener("wheel", handleWheel, {
4337
4465
  passive: false
4338
4466
  });
4339
- (_wrapperRef$current3 = wrapperRef.current) === null || _wrapperRef$current3 === void 0 ? void 0 : _wrapperRef$current3.addEventListener("touchmove", handleTouch, {
4467
+ (_wrapperRef$current2 = wrapperRef.current) === null || _wrapperRef$current2 === void 0 ? void 0 : _wrapperRef$current2.addEventListener("touchmove", handleTouch, {
4340
4468
  passive: false
4341
4469
  });
4342
- (_wrapperRef$current4 = wrapperRef.current) === null || _wrapperRef$current4 === void 0 ? void 0 : _wrapperRef$current4.addEventListener("touchstart", handleLogTouch, {
4470
+ (_wrapperRef$current3 = wrapperRef.current) === null || _wrapperRef$current3 === void 0 ? void 0 : _wrapperRef$current3.addEventListener("touchstart", handleLogTouch, {
4343
4471
  passive: false
4344
4472
  });
4345
- (_wrapperRef$current5 = wrapperRef.current) === null || _wrapperRef$current5 === void 0 ? void 0 : _wrapperRef$current5.addEventListener("touchend", handleLogTouch, {
4473
+ (_wrapperRef$current4 = wrapperRef.current) === null || _wrapperRef$current4 === void 0 ? void 0 : _wrapperRef$current4.addEventListener("touchend", handleLogTouch, {
4346
4474
  passive: false
4347
4475
  });
4348
4476
  return function () {
4349
- var _wrapperRef$current6, _wrapperRef$current7, _wrapperRef$current8, _wrapperRef$current9;
4477
+ var _wrapperRef$current5, _wrapperRef$current6, _wrapperRef$current7, _wrapperRef$current8;
4350
4478
 
4351
- (_wrapperRef$current6 = wrapperRef.current) === null || _wrapperRef$current6 === void 0 ? void 0 : _wrapperRef$current6.removeEventListener("wheel", handleWheel);
4352
- (_wrapperRef$current7 = wrapperRef.current) === null || _wrapperRef$current7 === void 0 ? void 0 : _wrapperRef$current7.removeEventListener("touchmove", handleTouch);
4479
+ (_wrapperRef$current5 = wrapperRef.current) === null || _wrapperRef$current5 === void 0 ? void 0 : _wrapperRef$current5.removeEventListener("wheel", handleWheel);
4480
+ (_wrapperRef$current6 = wrapperRef.current) === null || _wrapperRef$current6 === void 0 ? void 0 : _wrapperRef$current6.removeEventListener("touchmove", handleTouch);
4481
+ (_wrapperRef$current7 = wrapperRef.current) === null || _wrapperRef$current7 === void 0 ? void 0 : _wrapperRef$current7.removeEventListener("touchend", handleLogTouch);
4353
4482
  (_wrapperRef$current8 = wrapperRef.current) === null || _wrapperRef$current8 === void 0 ? void 0 : _wrapperRef$current8.removeEventListener("touchend", handleLogTouch);
4354
- (_wrapperRef$current9 = wrapperRef.current) === null || _wrapperRef$current9 === void 0 ? void 0 : _wrapperRef$current9.removeEventListener("touchend", handleLogTouch);
4355
4483
  };
4356
4484
  }, [wrapperRef, scrollY, scrollX, ganttHeight, svgWidth, rtl, ganttFullHeight]);
4357
4485
 
@@ -4477,7 +4605,8 @@ var Gantt = function Gantt(_ref) {
4477
4605
  fontFamily: fontFamily,
4478
4606
  fontSize: fontSize,
4479
4607
  rtl: rtl,
4480
- projectCalendar: projectCalendar
4608
+ projectCalendar: projectCalendar,
4609
+ weekendColor: weekendColor
4481
4610
  };
4482
4611
  var barProps = {
4483
4612
  tasks: barTasks,
@@ -4536,7 +4665,9 @@ var Gantt = function Gantt(_ref) {
4536
4665
  TaskListTable: TaskListTable,
4537
4666
  taskLabelRenderer: taskLabelRenderer,
4538
4667
  onMultiSelect: onMultiSelect,
4539
- containerWidth: tableContainerWidth != null ? tableContainerWidth : undefined,
4668
+ containerWidth: userResizedRef.current && tableContainerWidth != null ? Math.min(tableContainerWidth, tableCap) : undefined,
4669
+ containerMaxWidth: tableCap === Infinity ? undefined : tableCap,
4670
+ onContentWidthChange: setTableContentWidth,
4540
4671
  innerScrollRef: tableInnerScrollRef,
4541
4672
  horizontalContainerRef: tableHorizontalContainerRef
4542
4673
  };
@@ -4640,7 +4771,7 @@ var Gantt = function Gantt(_ref) {
4640
4771
  }
4641
4772
  }, React.createElement("div", {
4642
4773
  style: {
4643
- width: tableScrollableWidth
4774
+ width: tableContentWidth
4644
4775
  }
4645
4776
  })), React.createElement("div", {
4646
4777
  style: {