gantt-task-react-v 1.7.2 → 1.7.4

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.
@@ -5,5 +5,6 @@ export declare const useTableListResize: (clientColumns: readonly Column[] | und
5
5
  taskListWidth: number,
6
6
  tableWidth: number,
7
7
  onTableResizeStart: (clientX: number) => void,
8
- onColumnResizeStart: (columnIndex: number, clientX: number) => void
8
+ onColumnResizeStart: (columnIndex: number, clientX: number) => void,
9
+ handleColumnVisibilityChange: (columnId: string, hidden: boolean) => void
9
10
  ];
@@ -5378,22 +5378,16 @@ const useTableListResize = (clientColumns, canMoveTasks, onResizeColumn, ganttRe
5378
5378
  useEffect(() => {
5379
5379
  if (clientColumns) {
5380
5380
  setColumns([...clientColumns]);
5381
- const currentColumnIds = clientColumns.map((col) => col.id);
5382
- const newColumnIds = clientColumns.map((col) => col.id);
5383
- const widthOfAddedColumns = clientColumns.filter((col) => !currentColumnIds.includes(col.id)).reduce((res, { width }) => res + width, 0);
5384
- const widthOfRemovedColumns = clientColumns.filter((col) => !newColumnIds.includes(col.id)).reduce((res, { width }) => res + width, 0);
5381
+ const visibleColumns = clientColumns.filter((col) => !col.hidden);
5385
5382
  setTableWidth(
5386
- (prev) => Math.min(
5387
- prev + widthOfAddedColumns - widthOfRemovedColumns,
5388
- clientColumns.reduce((res, { width }) => res + width, 0) + extraWidth
5389
- )
5383
+ visibleColumns.reduce((res, { width }) => res + width, 0) + extraWidth
5390
5384
  );
5391
5385
  }
5392
5386
  }, [clientColumns, extraWidth]);
5393
5387
  const [tableResizeEvent, setTableResizeEvent] = useState(null);
5394
5388
  const [columnResizeEvent, setColumnResizeEvent] = useState(null);
5395
5389
  const [tableWidthState, setTableWidth] = useState(
5396
- () => columnsState.reduce((res, { width }) => res + width, 0) + extraWidth
5390
+ () => columnsState.filter((c) => !c.hidden).reduce((res, { width }) => res + width, 0) + extraWidth
5397
5391
  );
5398
5392
  const onTableResizeStart = (clientX) => {
5399
5393
  const newTableResizeEvent = {
@@ -5411,9 +5405,19 @@ const useTableListResize = (clientColumns, canMoveTasks, onResizeColumn, ganttRe
5411
5405
  initialTableWidth: tableWidthState
5412
5406
  });
5413
5407
  };
5408
+ const handleColumnVisibilityChange = (columnId, hidden2) => {
5409
+ setColumns((prev) => {
5410
+ const next = prev.map(
5411
+ (col) => col.id === columnId ? { ...col, hidden: hidden2 } : col
5412
+ );
5413
+ const visibleWidth = next.filter((c) => !c.hidden).reduce((s, { width }) => s + width, 0) + extraWidth;
5414
+ setTableWidth(visibleWidth);
5415
+ return next;
5416
+ });
5417
+ };
5414
5418
  const isResizeTableInProgress = Boolean(tableResizeEvent);
5415
5419
  const isResizeColumnInProgress = Boolean(columnResizeEvent);
5416
- const taskListWidth = columnsState.reduce((res, { width }) => res + width, 0) + extraWidth;
5420
+ const taskListWidth = columnsState.filter((c) => !c.hidden).reduce((res, { width }) => res + width, 0) + extraWidth;
5417
5421
  useEffect(() => {
5418
5422
  if (!isResizeTableInProgress) {
5419
5423
  return void 0;
@@ -5534,7 +5538,8 @@ const useTableListResize = (clientColumns, canMoveTasks, onResizeColumn, ganttRe
5534
5538
  taskListWidth,
5535
5539
  tableWidthState,
5536
5540
  onTableResizeStart,
5537
- onColumnResizeStart
5541
+ onColumnResizeStart,
5542
+ handleColumnVisibilityChange
5538
5543
  ];
5539
5544
  };
5540
5545
  const toggleWrapper = "_toggleWrapper_rjfhl_1";
@@ -10450,7 +10455,7 @@ const TaskListTableRowInner = forwardRef(
10450
10455
  if (isOverlay2) {
10451
10456
  return "var(--gantt-table-drag-task-background-color)";
10452
10457
  }
10453
- return isSelected ? "var(--gantt-table-selected-task-background-color)" : isEven ? "var(--gantt-table-even-background-color)" : void 0;
10458
+ return isSelected ? "var(--gantt-table-selected-task-background-color)" : isEven ? "var(--gantt-table-even-background-color)" : "var(--gantt-background-color, #fff)";
10454
10459
  }, [isEven, isOverlay2, isSelected]);
10455
10460
  const rowClassName = useMemo(() => {
10456
10461
  const classNames = [styles$h.taskListTableRow];
@@ -10470,35 +10475,28 @@ const TaskListTableRowInner = forwardRef(
10470
10475
  }, [isCut2, moveOverPosition, isOverlay2, isDragging]);
10471
10476
  const pinnedStyles = useMemo(() => {
10472
10477
  const result = {};
10473
- let leftOffset = 0;
10474
- if (moveHandleProps || !isOverlay2 && task.type !== "project" && task.id !== "no-project-asigned") {
10475
- leftOffset = 24;
10476
- }
10477
10478
  for (let i = 0; i < columns.length; i++) {
10478
10479
  if (columns[i].pinned === "left") {
10479
10480
  result[i] = {
10480
- position: "sticky",
10481
- left: leftOffset,
10482
- zIndex: 1,
10481
+ position: "relative",
10482
+ transform: "translateX(var(--pinned-translate-left, 0px))",
10483
+ zIndex: 2,
10483
10484
  backgroundColor: "inherit"
10484
10485
  };
10485
- leftOffset += columns[i].width;
10486
10486
  }
10487
10487
  }
10488
- let rightOffset = 0;
10489
10488
  for (let i = columns.length - 1; i >= 0; i--) {
10490
10489
  if (columns[i].pinned === "right") {
10491
10490
  result[i] = {
10492
- position: "sticky",
10493
- right: rightOffset,
10494
- zIndex: 1,
10491
+ position: "relative",
10492
+ transform: "translateX(var(--pinned-translate-right, 0px))",
10493
+ zIndex: 2,
10495
10494
  backgroundColor: "inherit"
10496
10495
  };
10497
- rightOffset += columns[i].width;
10498
10496
  }
10499
10497
  }
10500
10498
  return result;
10501
- }, [columns, moveHandleProps, isOverlay2, task.type, task.id]);
10499
+ }, [columns]);
10502
10500
  return /* @__PURE__ */ jsxs(
10503
10501
  "div",
10504
10502
  {
@@ -11169,17 +11167,55 @@ const TaskListInner = ({
11169
11167
  taskListWidth,
11170
11168
  tableWidth,
11171
11169
  onTableResizeStart,
11172
- onColumnResizeStart
11170
+ onColumnResizeStart,
11171
+ internalColumnVisibilityChange
11173
11172
  ] = useTableListResize(
11174
11173
  columnsProp,
11175
11174
  canReorderTasks,
11176
11175
  onResizeColumn,
11177
11176
  ganttRef
11178
11177
  );
11178
+ const handleColumnVisibilityChange = useCallback(
11179
+ (columnId, hidden2) => {
11180
+ internalColumnVisibilityChange(columnId, hidden2);
11181
+ if (onColumnVisibilityChange) {
11182
+ onColumnVisibilityChange(columnId, hidden2);
11183
+ }
11184
+ },
11185
+ [internalColumnVisibilityChange, onColumnVisibilityChange]
11186
+ );
11179
11187
  const columns = useMemo(
11180
11188
  () => allColumns.filter((col) => !col.hidden),
11181
11189
  [allColumns]
11182
11190
  );
11191
+ const horizontalScrollRef = useRef(null);
11192
+ const setHorizontalScrollRef = useCallback(
11193
+ (el) => {
11194
+ horizontalScrollRef.current = el;
11195
+ if (taskListHorizontalScrollRef) {
11196
+ taskListHorizontalScrollRef.current = el;
11197
+ }
11198
+ },
11199
+ [taskListHorizontalScrollRef]
11200
+ );
11201
+ useEffect(() => {
11202
+ const scrollEl = horizontalScrollRef.current;
11203
+ const containerEl = taskListContainerRef.current;
11204
+ if (!scrollEl || !containerEl)
11205
+ return void 0;
11206
+ const update = () => {
11207
+ const sl = scrollEl.scrollLeft;
11208
+ const maxSl = scrollEl.scrollWidth - scrollEl.clientWidth;
11209
+ containerEl.style.setProperty("--pinned-translate-left", `${sl}px`);
11210
+ containerEl.style.setProperty(
11211
+ "--pinned-translate-right",
11212
+ `${sl - maxSl}px`
11213
+ );
11214
+ };
11215
+ update();
11216
+ scrollEl.addEventListener("scroll", update, { passive: true });
11217
+ return () => scrollEl.removeEventListener("scroll", update);
11218
+ }, [taskListContainerRef, taskListWidth, tableWidth]);
11183
11219
  const renderedIndexes = useOptimizedList(
11184
11220
  taskListContainerRef,
11185
11221
  "scrollTop",
@@ -11256,7 +11292,7 @@ const TaskListInner = ({
11256
11292
  /* @__PURE__ */ jsxs(
11257
11293
  "div",
11258
11294
  {
11259
- ref: taskListHorizontalScrollRef,
11295
+ ref: setHorizontalScrollRef,
11260
11296
  className: styles$e.taskListHorizontalScroll,
11261
11297
  style: {
11262
11298
  width: tableWidth
@@ -11271,7 +11307,7 @@ const TaskListInner = ({
11271
11307
  allColumns,
11272
11308
  canToggleColumns: !!canToggleColumns,
11273
11309
  onColumnResizeStart,
11274
- onColumnVisibilityChange,
11310
+ onColumnVisibilityChange: handleColumnVisibilityChange,
11275
11311
  canResizeColumns
11276
11312
  }
11277
11313
  ),
@@ -11556,17 +11592,19 @@ const GanttTodayInner = ({
11556
11592
  ] });
11557
11593
  };
11558
11594
  const GanttToday = memo(GanttTodayInner);
11559
- const calendarBottomText = "_calendarBottomText_15t8b_1";
11560
- const calendarTopTick = "_calendarTopTick_15t8b_25";
11561
- const calendarTopText = "_calendarTopText_15t8b_35";
11562
- const calendarHeader = "_calendarHeader_15t8b_61";
11563
- const calendar = "_calendar_15t8b_1";
11564
- const calendarDragging$1 = "_calendarDragging_15t8b_85";
11595
+ const calendarBottomText = "_calendarBottomText_1mt8w_1";
11596
+ const calendarTopTick = "_calendarTopTick_1mt8w_31";
11597
+ const calendarTopText = "_calendarTopText_1mt8w_41";
11598
+ const calendarHeader = "_calendarHeader_1mt8w_67";
11599
+ const calendarBottomSeparator = "_calendarBottomSeparator_1mt8w_81";
11600
+ const calendar = "_calendar_1mt8w_1";
11601
+ const calendarDragging$1 = "_calendarDragging_1mt8w_103";
11565
11602
  const styles$c = {
11566
11603
  calendarBottomText,
11567
11604
  calendarTopTick,
11568
11605
  calendarTopText,
11569
11606
  calendarHeader,
11607
+ calendarBottomSeparator,
11570
11608
  calendar,
11571
11609
  calendarDragging: calendarDragging$1
11572
11610
  };
@@ -11773,6 +11811,19 @@ const Calendar = ({
11773
11811
  for (let i = startColumnIndex; i <= endColumnIndex; i++) {
11774
11812
  const date = getDate(i);
11775
11813
  const bottomValue = renderBottomHeaderByDate(date, i);
11814
+ bottomValues2.push(
11815
+ /* @__PURE__ */ jsx(
11816
+ "line",
11817
+ {
11818
+ x1: additionalLeftSpace + columnWidth * i,
11819
+ y1: 0,
11820
+ x2: additionalLeftSpace + columnWidth * i,
11821
+ y2: headerHeight,
11822
+ className: styles$c.calendarBottomSeparator
11823
+ },
11824
+ `year-sep-${i}`
11825
+ )
11826
+ );
11776
11827
  bottomValues2.push(
11777
11828
  renderBottomText(
11778
11829
  columnWidth * i + columnWidth * 0.5,
@@ -11806,9 +11857,35 @@ const Calendar = ({
11806
11857
  const topValues2 = [];
11807
11858
  const bottomValues2 = [];
11808
11859
  const topDefaultHeight = headerHeight * 0.5;
11860
+ bottomValues2.push(
11861
+ /* @__PURE__ */ jsx(
11862
+ "line",
11863
+ {
11864
+ x1: 0,
11865
+ y1: topDefaultHeight,
11866
+ x2: fullSvgWidth,
11867
+ y2: topDefaultHeight,
11868
+ className: styles$c.calendarBottomSeparator
11869
+ },
11870
+ "month-top-border"
11871
+ )
11872
+ );
11809
11873
  for (let i = startColumnIndex; i <= endColumnIndex; i++) {
11810
11874
  const date = getDate(i);
11811
11875
  const bottomValue = renderBottomHeaderByDate(date, i);
11876
+ bottomValues2.push(
11877
+ /* @__PURE__ */ jsx(
11878
+ "line",
11879
+ {
11880
+ x1: additionalLeftSpace + columnWidth * i,
11881
+ y1: topDefaultHeight,
11882
+ x2: additionalLeftSpace + columnWidth * i,
11883
+ y2: headerHeight,
11884
+ className: styles$c.calendarBottomSeparator
11885
+ },
11886
+ `month-sep-${i}`
11887
+ )
11888
+ );
11812
11889
  bottomValues2.push(
11813
11890
  renderBottomText(
11814
11891
  additionalLeftSpace + columnWidth * i + columnWidth * 0.5,
@@ -11850,6 +11927,19 @@ const Calendar = ({
11850
11927
  const bottomValues2 = [];
11851
11928
  let weeksCount = 1;
11852
11929
  const topDefaultHeight = headerHeight * 0.5;
11930
+ bottomValues2.push(
11931
+ /* @__PURE__ */ jsx(
11932
+ "line",
11933
+ {
11934
+ x1: 0,
11935
+ y1: topDefaultHeight,
11936
+ x2: fullSvgWidth,
11937
+ y2: topDefaultHeight,
11938
+ className: styles$c.calendarBottomSeparator
11939
+ },
11940
+ "week-top-border"
11941
+ )
11942
+ );
11853
11943
  for (let i = endColumnIndex; i >= startColumnIndex; i--) {
11854
11944
  const date = getDate(i);
11855
11945
  const month = date.getMonth();
@@ -11859,6 +11949,19 @@ const Calendar = ({
11859
11949
  topValue = renderTopHeaderByDate(date);
11860
11950
  }
11861
11951
  const bottomValue = renderBottomHeaderByDate(date, i);
11952
+ bottomValues2.push(
11953
+ /* @__PURE__ */ jsx(
11954
+ "line",
11955
+ {
11956
+ x1: additionalLeftSpace + columnWidth * i,
11957
+ y1: topDefaultHeight,
11958
+ x2: additionalLeftSpace + columnWidth * i,
11959
+ y2: headerHeight,
11960
+ className: styles$c.calendarBottomSeparator
11961
+ },
11962
+ `week-sep-${i}`
11963
+ )
11964
+ );
11862
11965
  bottomValues2.push(
11863
11966
  renderBottomText(
11864
11967
  additionalLeftSpace + columnWidth * (i + +rtl),
@@ -11894,11 +11997,37 @@ const Calendar = ({
11894
11997
  const bottomValues2 = [];
11895
11998
  const topDefaultHeight = headerHeight * 0.5;
11896
11999
  const renderedMonths = /* @__PURE__ */ new Set();
12000
+ bottomValues2.push(
12001
+ /* @__PURE__ */ jsx(
12002
+ "line",
12003
+ {
12004
+ x1: 0,
12005
+ y1: topDefaultHeight,
12006
+ x2: fullSvgWidth,
12007
+ y2: topDefaultHeight,
12008
+ className: styles$c.calendarBottomSeparator
12009
+ },
12010
+ "day-top-border"
12011
+ )
12012
+ );
11897
12013
  for (let i = startColumnIndex; i <= endColumnIndex; i++) {
11898
12014
  const date = getDate(i);
11899
12015
  const bottomValue = renderBottomHeaderByDate(date, i);
11900
12016
  const month = date.getMonth();
11901
12017
  const fullYear = date.getFullYear();
12018
+ bottomValues2.push(
12019
+ /* @__PURE__ */ jsx(
12020
+ "line",
12021
+ {
12022
+ x1: additionalLeftSpace + columnWidth * i,
12023
+ y1: topDefaultHeight,
12024
+ x2: additionalLeftSpace + columnWidth * i,
12025
+ y2: headerHeight,
12026
+ className: styles$c.calendarBottomSeparator
12027
+ },
12028
+ `day-sep-${i}`
12029
+ )
12030
+ );
11902
12031
  bottomValues2.push(
11903
12032
  renderBottomText(
11904
12033
  additionalLeftSpace + columnWidth * i + columnWidth * 0.5,
@@ -11938,9 +12067,35 @@ const Calendar = ({
11938
12067
  const bottomValues2 = [];
11939
12068
  const ticks = dateSetup.viewMode === ViewMode.HalfDay ? 2 : 4;
11940
12069
  const topDefaultHeight = headerHeight * 0.5;
12070
+ bottomValues2.push(
12071
+ /* @__PURE__ */ jsx(
12072
+ "line",
12073
+ {
12074
+ x1: 0,
12075
+ y1: topDefaultHeight,
12076
+ x2: fullSvgWidth,
12077
+ y2: topDefaultHeight,
12078
+ className: styles$c.calendarBottomSeparator
12079
+ },
12080
+ "partday-top-border"
12081
+ )
12082
+ );
11941
12083
  for (let i = startColumnIndex; i <= endColumnIndex; i++) {
11942
12084
  const date = getDate(i);
11943
12085
  const bottomValue = renderBottomHeaderByDate(date, i);
12086
+ bottomValues2.push(
12087
+ /* @__PURE__ */ jsx(
12088
+ "line",
12089
+ {
12090
+ x1: additionalLeftSpace + columnWidth * i,
12091
+ y1: topDefaultHeight,
12092
+ x2: additionalLeftSpace + columnWidth * i,
12093
+ y2: headerHeight,
12094
+ className: styles$c.calendarBottomSeparator
12095
+ },
12096
+ `partday-sep-${i}`
12097
+ )
12098
+ );
11944
12099
  bottomValues2.push(
11945
12100
  renderBottomText(
11946
12101
  additionalLeftSpace + columnWidth * (i + +rtl),
@@ -11978,9 +12133,35 @@ const Calendar = ({
11978
12133
  const bottomValues2 = [];
11979
12134
  const topDefaultHeight = headerHeight * 0.5;
11980
12135
  const renderedDates = /* @__PURE__ */ new Set();
12136
+ bottomValues2.push(
12137
+ /* @__PURE__ */ jsx(
12138
+ "line",
12139
+ {
12140
+ x1: 0,
12141
+ y1: topDefaultHeight,
12142
+ x2: fullSvgWidth,
12143
+ y2: topDefaultHeight,
12144
+ className: styles$c.calendarBottomSeparator
12145
+ },
12146
+ "hour-top-border"
12147
+ )
12148
+ );
11981
12149
  for (let i = startColumnIndex; i <= endColumnIndex; i++) {
11982
12150
  const date = getDate(i);
11983
12151
  const bottomValue = renderBottomHeaderByDate(date, i);
12152
+ bottomValues2.push(
12153
+ /* @__PURE__ */ jsx(
12154
+ "line",
12155
+ {
12156
+ x1: additionalLeftSpace + columnWidth * i,
12157
+ y1: topDefaultHeight,
12158
+ x2: additionalLeftSpace + columnWidth * i,
12159
+ y2: headerHeight,
12160
+ className: styles$c.calendarBottomSeparator
12161
+ },
12162
+ `hour-sep-${i}`
12163
+ )
12164
+ );
11984
12165
  bottomValues2.push(
11985
12166
  renderBottomText(
11986
12167
  additionalLeftSpace + columnWidth * (i + +rtl),
@@ -5395,22 +5395,16 @@
5395
5395
  React.useEffect(() => {
5396
5396
  if (clientColumns) {
5397
5397
  setColumns([...clientColumns]);
5398
- const currentColumnIds = clientColumns.map((col) => col.id);
5399
- const newColumnIds = clientColumns.map((col) => col.id);
5400
- const widthOfAddedColumns = clientColumns.filter((col) => !currentColumnIds.includes(col.id)).reduce((res, { width }) => res + width, 0);
5401
- const widthOfRemovedColumns = clientColumns.filter((col) => !newColumnIds.includes(col.id)).reduce((res, { width }) => res + width, 0);
5398
+ const visibleColumns = clientColumns.filter((col) => !col.hidden);
5402
5399
  setTableWidth(
5403
- (prev) => Math.min(
5404
- prev + widthOfAddedColumns - widthOfRemovedColumns,
5405
- clientColumns.reduce((res, { width }) => res + width, 0) + extraWidth
5406
- )
5400
+ visibleColumns.reduce((res, { width }) => res + width, 0) + extraWidth
5407
5401
  );
5408
5402
  }
5409
5403
  }, [clientColumns, extraWidth]);
5410
5404
  const [tableResizeEvent, setTableResizeEvent] = React.useState(null);
5411
5405
  const [columnResizeEvent, setColumnResizeEvent] = React.useState(null);
5412
5406
  const [tableWidthState, setTableWidth] = React.useState(
5413
- () => columnsState.reduce((res, { width }) => res + width, 0) + extraWidth
5407
+ () => columnsState.filter((c) => !c.hidden).reduce((res, { width }) => res + width, 0) + extraWidth
5414
5408
  );
5415
5409
  const onTableResizeStart = (clientX) => {
5416
5410
  const newTableResizeEvent = {
@@ -5428,9 +5422,19 @@
5428
5422
  initialTableWidth: tableWidthState
5429
5423
  });
5430
5424
  };
5425
+ const handleColumnVisibilityChange = (columnId, hidden2) => {
5426
+ setColumns((prev) => {
5427
+ const next = prev.map(
5428
+ (col) => col.id === columnId ? { ...col, hidden: hidden2 } : col
5429
+ );
5430
+ const visibleWidth = next.filter((c) => !c.hidden).reduce((s, { width }) => s + width, 0) + extraWidth;
5431
+ setTableWidth(visibleWidth);
5432
+ return next;
5433
+ });
5434
+ };
5431
5435
  const isResizeTableInProgress = Boolean(tableResizeEvent);
5432
5436
  const isResizeColumnInProgress = Boolean(columnResizeEvent);
5433
- const taskListWidth = columnsState.reduce((res, { width }) => res + width, 0) + extraWidth;
5437
+ const taskListWidth = columnsState.filter((c) => !c.hidden).reduce((res, { width }) => res + width, 0) + extraWidth;
5434
5438
  React.useEffect(() => {
5435
5439
  if (!isResizeTableInProgress) {
5436
5440
  return void 0;
@@ -5551,7 +5555,8 @@
5551
5555
  taskListWidth,
5552
5556
  tableWidthState,
5553
5557
  onTableResizeStart,
5554
- onColumnResizeStart
5558
+ onColumnResizeStart,
5559
+ handleColumnVisibilityChange
5555
5560
  ];
5556
5561
  };
5557
5562
  const toggleWrapper = "_toggleWrapper_rjfhl_1";
@@ -10467,7 +10472,7 @@
10467
10472
  if (isOverlay2) {
10468
10473
  return "var(--gantt-table-drag-task-background-color)";
10469
10474
  }
10470
- return isSelected ? "var(--gantt-table-selected-task-background-color)" : isEven ? "var(--gantt-table-even-background-color)" : void 0;
10475
+ return isSelected ? "var(--gantt-table-selected-task-background-color)" : isEven ? "var(--gantt-table-even-background-color)" : "var(--gantt-background-color, #fff)";
10471
10476
  }, [isEven, isOverlay2, isSelected]);
10472
10477
  const rowClassName = React.useMemo(() => {
10473
10478
  const classNames = [styles$h.taskListTableRow];
@@ -10487,35 +10492,28 @@
10487
10492
  }, [isCut2, moveOverPosition, isOverlay2, isDragging]);
10488
10493
  const pinnedStyles = React.useMemo(() => {
10489
10494
  const result = {};
10490
- let leftOffset = 0;
10491
- if (moveHandleProps || !isOverlay2 && task.type !== "project" && task.id !== "no-project-asigned") {
10492
- leftOffset = 24;
10493
- }
10494
10495
  for (let i = 0; i < columns.length; i++) {
10495
10496
  if (columns[i].pinned === "left") {
10496
10497
  result[i] = {
10497
- position: "sticky",
10498
- left: leftOffset,
10499
- zIndex: 1,
10498
+ position: "relative",
10499
+ transform: "translateX(var(--pinned-translate-left, 0px))",
10500
+ zIndex: 2,
10500
10501
  backgroundColor: "inherit"
10501
10502
  };
10502
- leftOffset += columns[i].width;
10503
10503
  }
10504
10504
  }
10505
- let rightOffset = 0;
10506
10505
  for (let i = columns.length - 1; i >= 0; i--) {
10507
10506
  if (columns[i].pinned === "right") {
10508
10507
  result[i] = {
10509
- position: "sticky",
10510
- right: rightOffset,
10511
- zIndex: 1,
10508
+ position: "relative",
10509
+ transform: "translateX(var(--pinned-translate-right, 0px))",
10510
+ zIndex: 2,
10512
10511
  backgroundColor: "inherit"
10513
10512
  };
10514
- rightOffset += columns[i].width;
10515
10513
  }
10516
10514
  }
10517
10515
  return result;
10518
- }, [columns, moveHandleProps, isOverlay2, task.type, task.id]);
10516
+ }, [columns]);
10519
10517
  return /* @__PURE__ */ jsxRuntime.jsxs(
10520
10518
  "div",
10521
10519
  {
@@ -11186,17 +11184,55 @@
11186
11184
  taskListWidth,
11187
11185
  tableWidth,
11188
11186
  onTableResizeStart,
11189
- onColumnResizeStart
11187
+ onColumnResizeStart,
11188
+ internalColumnVisibilityChange
11190
11189
  ] = useTableListResize(
11191
11190
  columnsProp,
11192
11191
  canReorderTasks,
11193
11192
  onResizeColumn,
11194
11193
  ganttRef
11195
11194
  );
11195
+ const handleColumnVisibilityChange = React.useCallback(
11196
+ (columnId, hidden2) => {
11197
+ internalColumnVisibilityChange(columnId, hidden2);
11198
+ if (onColumnVisibilityChange) {
11199
+ onColumnVisibilityChange(columnId, hidden2);
11200
+ }
11201
+ },
11202
+ [internalColumnVisibilityChange, onColumnVisibilityChange]
11203
+ );
11196
11204
  const columns = React.useMemo(
11197
11205
  () => allColumns.filter((col) => !col.hidden),
11198
11206
  [allColumns]
11199
11207
  );
11208
+ const horizontalScrollRef = React.useRef(null);
11209
+ const setHorizontalScrollRef = React.useCallback(
11210
+ (el) => {
11211
+ horizontalScrollRef.current = el;
11212
+ if (taskListHorizontalScrollRef) {
11213
+ taskListHorizontalScrollRef.current = el;
11214
+ }
11215
+ },
11216
+ [taskListHorizontalScrollRef]
11217
+ );
11218
+ React.useEffect(() => {
11219
+ const scrollEl = horizontalScrollRef.current;
11220
+ const containerEl = taskListContainerRef.current;
11221
+ if (!scrollEl || !containerEl)
11222
+ return void 0;
11223
+ const update = () => {
11224
+ const sl = scrollEl.scrollLeft;
11225
+ const maxSl = scrollEl.scrollWidth - scrollEl.clientWidth;
11226
+ containerEl.style.setProperty("--pinned-translate-left", `${sl}px`);
11227
+ containerEl.style.setProperty(
11228
+ "--pinned-translate-right",
11229
+ `${sl - maxSl}px`
11230
+ );
11231
+ };
11232
+ update();
11233
+ scrollEl.addEventListener("scroll", update, { passive: true });
11234
+ return () => scrollEl.removeEventListener("scroll", update);
11235
+ }, [taskListContainerRef, taskListWidth, tableWidth]);
11200
11236
  const renderedIndexes = useOptimizedList(
11201
11237
  taskListContainerRef,
11202
11238
  "scrollTop",
@@ -11273,7 +11309,7 @@
11273
11309
  /* @__PURE__ */ jsxRuntime.jsxs(
11274
11310
  "div",
11275
11311
  {
11276
- ref: taskListHorizontalScrollRef,
11312
+ ref: setHorizontalScrollRef,
11277
11313
  className: styles$e.taskListHorizontalScroll,
11278
11314
  style: {
11279
11315
  width: tableWidth
@@ -11288,7 +11324,7 @@
11288
11324
  allColumns,
11289
11325
  canToggleColumns: !!canToggleColumns,
11290
11326
  onColumnResizeStart,
11291
- onColumnVisibilityChange,
11327
+ onColumnVisibilityChange: handleColumnVisibilityChange,
11292
11328
  canResizeColumns
11293
11329
  }
11294
11330
  ),
@@ -11573,17 +11609,19 @@
11573
11609
  ] });
11574
11610
  };
11575
11611
  const GanttToday = React.memo(GanttTodayInner);
11576
- const calendarBottomText = "_calendarBottomText_15t8b_1";
11577
- const calendarTopTick = "_calendarTopTick_15t8b_25";
11578
- const calendarTopText = "_calendarTopText_15t8b_35";
11579
- const calendarHeader = "_calendarHeader_15t8b_61";
11580
- const calendar = "_calendar_15t8b_1";
11581
- const calendarDragging$1 = "_calendarDragging_15t8b_85";
11612
+ const calendarBottomText = "_calendarBottomText_1mt8w_1";
11613
+ const calendarTopTick = "_calendarTopTick_1mt8w_31";
11614
+ const calendarTopText = "_calendarTopText_1mt8w_41";
11615
+ const calendarHeader = "_calendarHeader_1mt8w_67";
11616
+ const calendarBottomSeparator = "_calendarBottomSeparator_1mt8w_81";
11617
+ const calendar = "_calendar_1mt8w_1";
11618
+ const calendarDragging$1 = "_calendarDragging_1mt8w_103";
11582
11619
  const styles$c = {
11583
11620
  calendarBottomText,
11584
11621
  calendarTopTick,
11585
11622
  calendarTopText,
11586
11623
  calendarHeader,
11624
+ calendarBottomSeparator,
11587
11625
  calendar,
11588
11626
  calendarDragging: calendarDragging$1
11589
11627
  };
@@ -11790,6 +11828,19 @@
11790
11828
  for (let i = startColumnIndex; i <= endColumnIndex; i++) {
11791
11829
  const date = getDate(i);
11792
11830
  const bottomValue = renderBottomHeaderByDate(date, i);
11831
+ bottomValues2.push(
11832
+ /* @__PURE__ */ jsxRuntime.jsx(
11833
+ "line",
11834
+ {
11835
+ x1: additionalLeftSpace + columnWidth * i,
11836
+ y1: 0,
11837
+ x2: additionalLeftSpace + columnWidth * i,
11838
+ y2: headerHeight,
11839
+ className: styles$c.calendarBottomSeparator
11840
+ },
11841
+ `year-sep-${i}`
11842
+ )
11843
+ );
11793
11844
  bottomValues2.push(
11794
11845
  renderBottomText(
11795
11846
  columnWidth * i + columnWidth * 0.5,
@@ -11823,9 +11874,35 @@
11823
11874
  const topValues2 = [];
11824
11875
  const bottomValues2 = [];
11825
11876
  const topDefaultHeight = headerHeight * 0.5;
11877
+ bottomValues2.push(
11878
+ /* @__PURE__ */ jsxRuntime.jsx(
11879
+ "line",
11880
+ {
11881
+ x1: 0,
11882
+ y1: topDefaultHeight,
11883
+ x2: fullSvgWidth,
11884
+ y2: topDefaultHeight,
11885
+ className: styles$c.calendarBottomSeparator
11886
+ },
11887
+ "month-top-border"
11888
+ )
11889
+ );
11826
11890
  for (let i = startColumnIndex; i <= endColumnIndex; i++) {
11827
11891
  const date = getDate(i);
11828
11892
  const bottomValue = renderBottomHeaderByDate(date, i);
11893
+ bottomValues2.push(
11894
+ /* @__PURE__ */ jsxRuntime.jsx(
11895
+ "line",
11896
+ {
11897
+ x1: additionalLeftSpace + columnWidth * i,
11898
+ y1: topDefaultHeight,
11899
+ x2: additionalLeftSpace + columnWidth * i,
11900
+ y2: headerHeight,
11901
+ className: styles$c.calendarBottomSeparator
11902
+ },
11903
+ `month-sep-${i}`
11904
+ )
11905
+ );
11829
11906
  bottomValues2.push(
11830
11907
  renderBottomText(
11831
11908
  additionalLeftSpace + columnWidth * i + columnWidth * 0.5,
@@ -11867,6 +11944,19 @@
11867
11944
  const bottomValues2 = [];
11868
11945
  let weeksCount = 1;
11869
11946
  const topDefaultHeight = headerHeight * 0.5;
11947
+ bottomValues2.push(
11948
+ /* @__PURE__ */ jsxRuntime.jsx(
11949
+ "line",
11950
+ {
11951
+ x1: 0,
11952
+ y1: topDefaultHeight,
11953
+ x2: fullSvgWidth,
11954
+ y2: topDefaultHeight,
11955
+ className: styles$c.calendarBottomSeparator
11956
+ },
11957
+ "week-top-border"
11958
+ )
11959
+ );
11870
11960
  for (let i = endColumnIndex; i >= startColumnIndex; i--) {
11871
11961
  const date = getDate(i);
11872
11962
  const month = date.getMonth();
@@ -11876,6 +11966,19 @@
11876
11966
  topValue = renderTopHeaderByDate(date);
11877
11967
  }
11878
11968
  const bottomValue = renderBottomHeaderByDate(date, i);
11969
+ bottomValues2.push(
11970
+ /* @__PURE__ */ jsxRuntime.jsx(
11971
+ "line",
11972
+ {
11973
+ x1: additionalLeftSpace + columnWidth * i,
11974
+ y1: topDefaultHeight,
11975
+ x2: additionalLeftSpace + columnWidth * i,
11976
+ y2: headerHeight,
11977
+ className: styles$c.calendarBottomSeparator
11978
+ },
11979
+ `week-sep-${i}`
11980
+ )
11981
+ );
11879
11982
  bottomValues2.push(
11880
11983
  renderBottomText(
11881
11984
  additionalLeftSpace + columnWidth * (i + +rtl),
@@ -11911,11 +12014,37 @@
11911
12014
  const bottomValues2 = [];
11912
12015
  const topDefaultHeight = headerHeight * 0.5;
11913
12016
  const renderedMonths = /* @__PURE__ */ new Set();
12017
+ bottomValues2.push(
12018
+ /* @__PURE__ */ jsxRuntime.jsx(
12019
+ "line",
12020
+ {
12021
+ x1: 0,
12022
+ y1: topDefaultHeight,
12023
+ x2: fullSvgWidth,
12024
+ y2: topDefaultHeight,
12025
+ className: styles$c.calendarBottomSeparator
12026
+ },
12027
+ "day-top-border"
12028
+ )
12029
+ );
11914
12030
  for (let i = startColumnIndex; i <= endColumnIndex; i++) {
11915
12031
  const date = getDate(i);
11916
12032
  const bottomValue = renderBottomHeaderByDate(date, i);
11917
12033
  const month = date.getMonth();
11918
12034
  const fullYear = date.getFullYear();
12035
+ bottomValues2.push(
12036
+ /* @__PURE__ */ jsxRuntime.jsx(
12037
+ "line",
12038
+ {
12039
+ x1: additionalLeftSpace + columnWidth * i,
12040
+ y1: topDefaultHeight,
12041
+ x2: additionalLeftSpace + columnWidth * i,
12042
+ y2: headerHeight,
12043
+ className: styles$c.calendarBottomSeparator
12044
+ },
12045
+ `day-sep-${i}`
12046
+ )
12047
+ );
11919
12048
  bottomValues2.push(
11920
12049
  renderBottomText(
11921
12050
  additionalLeftSpace + columnWidth * i + columnWidth * 0.5,
@@ -11955,9 +12084,35 @@
11955
12084
  const bottomValues2 = [];
11956
12085
  const ticks = dateSetup.viewMode === ViewMode.HalfDay ? 2 : 4;
11957
12086
  const topDefaultHeight = headerHeight * 0.5;
12087
+ bottomValues2.push(
12088
+ /* @__PURE__ */ jsxRuntime.jsx(
12089
+ "line",
12090
+ {
12091
+ x1: 0,
12092
+ y1: topDefaultHeight,
12093
+ x2: fullSvgWidth,
12094
+ y2: topDefaultHeight,
12095
+ className: styles$c.calendarBottomSeparator
12096
+ },
12097
+ "partday-top-border"
12098
+ )
12099
+ );
11958
12100
  for (let i = startColumnIndex; i <= endColumnIndex; i++) {
11959
12101
  const date = getDate(i);
11960
12102
  const bottomValue = renderBottomHeaderByDate(date, i);
12103
+ bottomValues2.push(
12104
+ /* @__PURE__ */ jsxRuntime.jsx(
12105
+ "line",
12106
+ {
12107
+ x1: additionalLeftSpace + columnWidth * i,
12108
+ y1: topDefaultHeight,
12109
+ x2: additionalLeftSpace + columnWidth * i,
12110
+ y2: headerHeight,
12111
+ className: styles$c.calendarBottomSeparator
12112
+ },
12113
+ `partday-sep-${i}`
12114
+ )
12115
+ );
11961
12116
  bottomValues2.push(
11962
12117
  renderBottomText(
11963
12118
  additionalLeftSpace + columnWidth * (i + +rtl),
@@ -11995,9 +12150,35 @@
11995
12150
  const bottomValues2 = [];
11996
12151
  const topDefaultHeight = headerHeight * 0.5;
11997
12152
  const renderedDates = /* @__PURE__ */ new Set();
12153
+ bottomValues2.push(
12154
+ /* @__PURE__ */ jsxRuntime.jsx(
12155
+ "line",
12156
+ {
12157
+ x1: 0,
12158
+ y1: topDefaultHeight,
12159
+ x2: fullSvgWidth,
12160
+ y2: topDefaultHeight,
12161
+ className: styles$c.calendarBottomSeparator
12162
+ },
12163
+ "hour-top-border"
12164
+ )
12165
+ );
11998
12166
  for (let i = startColumnIndex; i <= endColumnIndex; i++) {
11999
12167
  const date = getDate(i);
12000
12168
  const bottomValue = renderBottomHeaderByDate(date, i);
12169
+ bottomValues2.push(
12170
+ /* @__PURE__ */ jsxRuntime.jsx(
12171
+ "line",
12172
+ {
12173
+ x1: additionalLeftSpace + columnWidth * i,
12174
+ y1: topDefaultHeight,
12175
+ x2: additionalLeftSpace + columnWidth * i,
12176
+ y2: headerHeight,
12177
+ className: styles$c.calendarBottomSeparator
12178
+ },
12179
+ `hour-sep-${i}`
12180
+ )
12181
+ );
12001
12182
  bottomValues2.push(
12002
12183
  renderBottomText(
12003
12184
  additionalLeftSpace + columnWidth * (i + +rtl),
package/dist/style.css CHANGED
@@ -534,10 +534,13 @@
534
534
  ._ganttTodayCircle_1oyhk_9 {
535
535
 
536
536
  }
537
- ._calendarBottomText_15t8b_1 {
537
+ ._calendarBottomText_1mt8w_1 {
538
538
  text-anchor: middle;
539
539
  /*noinspection CssUnresolvedCustomProperty*/
540
- fill: var(--gantt-calendar-bottom-text-color, var(--gantt-secondary-text-color));
540
+ fill: var(
541
+ --gantt-calendar-bottom-text-color,
542
+ var(--gantt-secondary-text-color)
543
+ );
541
544
  -webkit-touch-callout: none;
542
545
  -webkit-user-select: none;
543
546
  -moz-user-select: none;
@@ -546,12 +549,12 @@
546
549
  pointer-events: none;
547
550
  }
548
551
 
549
- ._calendarTopTick_15t8b_25 {
552
+ ._calendarTopTick_1mt8w_31 {
550
553
  /*noinspection CssUnresolvedCustomProperty*/
551
554
  stroke: var(--gantt-calendar-top-divider-color, var(--gantt-divider-color));
552
555
  }
553
556
 
554
- ._calendarTopText_15t8b_35 {
557
+ ._calendarTopText_1mt8w_41 {
555
558
  text-anchor: middle;
556
559
  /*noinspection CssUnresolvedCustomProperty*/
557
560
  fill: var(--gantt-calendar-top-text-color, var(--gantt-primary-text-color));
@@ -564,19 +567,25 @@
564
567
  font-weight: bold;
565
568
  }
566
569
 
567
- ._calendarHeader_15t8b_61 {
570
+ ._calendarHeader_1mt8w_67 {
568
571
  fill: transparent;
569
572
  /*noinspection CssUnresolvedCustomProperty*/
570
573
  stroke: var(--gantt-calendar-stroke-color);
571
574
  stroke-width: 1.4;
572
575
  }
573
576
 
574
- ._calendar_15t8b_1 {
577
+ ._calendarBottomSeparator_1mt8w_81 {
578
+ /*noinspection CssUnresolvedCustomProperty*/
579
+ stroke: var(--gantt-calendar-stroke-color, #e0e0e0);
580
+ stroke-width: 1;
581
+ }
582
+
583
+ ._calendar_1mt8w_1 {
575
584
  cursor: auto;
576
585
  user-select: none;
577
586
  }
578
587
 
579
- ._calendarDragging_15t8b_85 {
588
+ ._calendarDragging_1mt8w_103 {
580
589
  cursor: ew-resize;
581
590
  }
582
591
  ._arrow_clickable_3u3q2_1 {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gantt-task-react-v",
3
- "version": "1.7.2",
3
+ "version": "1.7.4",
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",