gantt-task-react-v 1.8.0 → 1.8.1

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,6 +5,5 @@ 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,
9
- handleColumnVisibilityChange: (columnId: string, hidden: boolean) => void
8
+ onColumnResizeStart: (columnIndex: number, clientX: number) => void
10
9
  ];
@@ -5378,16 +5378,22 @@ const useTableListResize = (clientColumns, canMoveTasks, onResizeColumn, ganttRe
5378
5378
  useEffect(() => {
5379
5379
  if (clientColumns) {
5380
5380
  setColumns([...clientColumns]);
5381
- const visibleColumns = clientColumns.filter((col) => !col.hidden);
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);
5382
5385
  setTableWidth(
5383
- visibleColumns.reduce((res, { width }) => res + width, 0) + extraWidth
5386
+ (prev) => Math.min(
5387
+ prev + widthOfAddedColumns - widthOfRemovedColumns,
5388
+ clientColumns.reduce((res, { width }) => res + width, 0) + extraWidth
5389
+ )
5384
5390
  );
5385
5391
  }
5386
5392
  }, [clientColumns, extraWidth]);
5387
5393
  const [tableResizeEvent, setTableResizeEvent] = useState(null);
5388
5394
  const [columnResizeEvent, setColumnResizeEvent] = useState(null);
5389
5395
  const [tableWidthState, setTableWidth] = useState(
5390
- () => columnsState.filter((c) => !c.hidden).reduce((res, { width }) => res + width, 0) + extraWidth
5396
+ () => columnsState.reduce((res, { width }) => res + width, 0) + extraWidth
5391
5397
  );
5392
5398
  const onTableResizeStart = (clientX) => {
5393
5399
  const newTableResizeEvent = {
@@ -5405,19 +5411,9 @@ const useTableListResize = (clientColumns, canMoveTasks, onResizeColumn, ganttRe
5405
5411
  initialTableWidth: tableWidthState
5406
5412
  });
5407
5413
  };
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
- };
5418
5414
  const isResizeTableInProgress = Boolean(tableResizeEvent);
5419
5415
  const isResizeColumnInProgress = Boolean(columnResizeEvent);
5420
- const taskListWidth = columnsState.filter((c) => !c.hidden).reduce((res, { width }) => res + width, 0) + extraWidth;
5416
+ const taskListWidth = columnsState.reduce((res, { width }) => res + width, 0) + extraWidth;
5421
5417
  useEffect(() => {
5422
5418
  if (!isResizeTableInProgress) {
5423
5419
  return void 0;
@@ -5538,8 +5534,7 @@ const useTableListResize = (clientColumns, canMoveTasks, onResizeColumn, ganttRe
5538
5534
  taskListWidth,
5539
5535
  tableWidthState,
5540
5536
  onTableResizeStart,
5541
- onColumnResizeStart,
5542
- handleColumnVisibilityChange
5537
+ onColumnResizeStart
5543
5538
  ];
5544
5539
  };
5545
5540
  const toggleWrapper = "_toggleWrapper_rjfhl_1";
@@ -5693,26 +5688,35 @@ const TaskListTableHeadersDefaultInner = ({
5693
5688
  }) => {
5694
5689
  const pinnedStyles = useMemo(() => {
5695
5690
  const result = {};
5696
- const base = {
5697
- position: "relative",
5698
- zIndex: 3,
5699
- backgroundColor: "var(--gantt-table-header-background-color, #fff)"
5700
- };
5691
+ let leftOffset = 0;
5692
+ if (canMoveTasks) {
5693
+ leftOffset = 24;
5694
+ }
5701
5695
  for (let i = 0; i < columns.length; i++) {
5702
5696
  if (columns[i].pinned === "left") {
5703
5697
  result[i] = {
5704
- ...base,
5705
- transform: "translateX(var(--pinned-translate-left, 0px))"
5698
+ position: "sticky",
5699
+ left: leftOffset,
5700
+ zIndex: 2,
5701
+ backgroundColor: "var(--gantt-table-header-background-color, #fff)"
5706
5702
  };
5707
- } else if (columns[i].pinned === "right") {
5703
+ leftOffset += columns[i].width;
5704
+ }
5705
+ }
5706
+ let rightOffset = 0;
5707
+ for (let i = columns.length - 1; i >= 0; i--) {
5708
+ if (columns[i].pinned === "right") {
5708
5709
  result[i] = {
5709
- ...base,
5710
- transform: "translateX(var(--pinned-translate-right, 0px))"
5710
+ position: "sticky",
5711
+ right: rightOffset,
5712
+ zIndex: 2,
5713
+ backgroundColor: "var(--gantt-table-header-background-color, #fff)"
5711
5714
  };
5715
+ rightOffset += columns[i].width;
5712
5716
  }
5713
5717
  }
5714
5718
  return result;
5715
- }, [columns]);
5719
+ }, [columns, canMoveTasks]);
5716
5720
  return /* @__PURE__ */ jsx(
5717
5721
  "div",
5718
5722
  {
@@ -10446,17 +10450,7 @@ const TaskListTableRowInner = forwardRef(
10446
10450
  if (isOverlay2) {
10447
10451
  return "var(--gantt-table-drag-task-background-color)";
10448
10452
  }
10449
- return isSelected ? "var(--gantt-table-selected-task-background-color)" : isEven ? "var(--gantt-table-even-background-color)" : "var(--gantt-background-color, #fff)";
10450
- }, [isEven, isOverlay2, isSelected]);
10451
- const pinnedBgColor = useMemo(() => {
10452
- if (isOverlay2) {
10453
- return "var(--gantt-table-drag-task-background-color)";
10454
- }
10455
- if (isSelected) {
10456
- const base = isEven ? "var(--gantt-table-even-background-color, #f5f5f5)" : "var(--gantt-background-color, #fff)";
10457
- return `linear-gradient(var(--gantt-table-selected-task-background-color), var(--gantt-table-selected-task-background-color)), linear-gradient(${base}, ${base})`;
10458
- }
10459
- return isEven ? "var(--gantt-table-even-background-color)" : "var(--gantt-background-color, #fff)";
10453
+ return isSelected ? "var(--gantt-table-selected-task-background-color)" : isEven ? "var(--gantt-table-even-background-color)" : void 0;
10460
10454
  }, [isEven, isOverlay2, isSelected]);
10461
10455
  const rowClassName = useMemo(() => {
10462
10456
  const classNames = [styles$h.taskListTableRow];
@@ -10476,26 +10470,35 @@ const TaskListTableRowInner = forwardRef(
10476
10470
  }, [isCut2, moveOverPosition, isOverlay2, isDragging]);
10477
10471
  const pinnedStyles = useMemo(() => {
10478
10472
  const result = {};
10479
- const pinnedBase = {
10480
- position: "relative",
10481
- zIndex: 3,
10482
- background: pinnedBgColor
10483
- };
10473
+ let leftOffset = 0;
10474
+ if (moveHandleProps || !isOverlay2 && task.type !== "project" && task.id !== "no-project-asigned") {
10475
+ leftOffset = 24;
10476
+ }
10484
10477
  for (let i = 0; i < columns.length; i++) {
10485
10478
  if (columns[i].pinned === "left") {
10486
10479
  result[i] = {
10487
- ...pinnedBase,
10488
- transform: "translateX(var(--pinned-translate-left, 0px))"
10480
+ position: "sticky",
10481
+ left: leftOffset,
10482
+ zIndex: 1,
10483
+ backgroundColor: "inherit"
10489
10484
  };
10490
- } else if (columns[i].pinned === "right") {
10485
+ leftOffset += columns[i].width;
10486
+ }
10487
+ }
10488
+ let rightOffset = 0;
10489
+ for (let i = columns.length - 1; i >= 0; i--) {
10490
+ if (columns[i].pinned === "right") {
10491
10491
  result[i] = {
10492
- ...pinnedBase,
10493
- transform: "translateX(var(--pinned-translate-right, 0px))"
10492
+ position: "sticky",
10493
+ right: rightOffset,
10494
+ zIndex: 1,
10495
+ backgroundColor: "inherit"
10494
10496
  };
10497
+ rightOffset += columns[i].width;
10495
10498
  }
10496
10499
  }
10497
10500
  return result;
10498
- }, [columns, pinnedBgColor]);
10501
+ }, [columns, moveHandleProps, isOverlay2, task.type, task.id]);
10499
10502
  return /* @__PURE__ */ jsxs(
10500
10503
  "div",
10501
10504
  {
@@ -11166,60 +11169,17 @@ const TaskListInner = ({
11166
11169
  taskListWidth,
11167
11170
  tableWidth,
11168
11171
  onTableResizeStart,
11169
- onColumnResizeStart,
11170
- internalColumnVisibilityChange
11172
+ onColumnResizeStart
11171
11173
  ] = useTableListResize(
11172
11174
  columnsProp,
11173
11175
  canReorderTasks,
11174
11176
  onResizeColumn,
11175
11177
  ganttRef
11176
11178
  );
11177
- const handleColumnVisibilityChange = useCallback(
11178
- (columnId, hidden2) => {
11179
- internalColumnVisibilityChange(columnId, hidden2);
11180
- if (onColumnVisibilityChange) {
11181
- onColumnVisibilityChange(columnId, hidden2);
11182
- }
11183
- },
11184
- [internalColumnVisibilityChange, onColumnVisibilityChange]
11185
- );
11186
- const columns = useMemo(() => {
11187
- const visible = allColumns.filter((col) => !col.hidden);
11188
- const left = visible.filter((col) => col.pinned === "left");
11189
- const middle = visible.filter((col) => !col.pinned);
11190
- const right = visible.filter((col) => col.pinned === "right");
11191
- return [...left, ...middle, ...right];
11192
- }, [allColumns]);
11193
- const horizontalScrollRef = useRef(null);
11194
- const setHorizontalScrollRef = useCallback(
11195
- (el) => {
11196
- horizontalScrollRef.current = el;
11197
- if (taskListHorizontalScrollRef) {
11198
- taskListHorizontalScrollRef.current = el;
11199
- }
11200
- },
11201
- [taskListHorizontalScrollRef]
11179
+ const columns = useMemo(
11180
+ () => allColumns.filter((col) => !col.hidden),
11181
+ [allColumns]
11202
11182
  );
11203
- useEffect(() => {
11204
- const scrollEl = horizontalScrollRef.current;
11205
- const containerEl = taskListContainerRef.current;
11206
- if (!scrollEl || !containerEl)
11207
- return void 0;
11208
- const update = () => {
11209
- const sl = scrollEl.scrollLeft;
11210
- const visibleWidth = scrollEl.clientWidth;
11211
- const maxSl = Math.max(0, taskListWidth - visibleWidth);
11212
- const leftVal = `${sl}px`;
11213
- const rightVal = `${sl - maxSl}px`;
11214
- scrollEl.style.setProperty("--pinned-translate-left", leftVal);
11215
- scrollEl.style.setProperty("--pinned-translate-right", rightVal);
11216
- containerEl.style.setProperty("--pinned-translate-left", leftVal);
11217
- containerEl.style.setProperty("--pinned-translate-right", rightVal);
11218
- };
11219
- update();
11220
- scrollEl.addEventListener("scroll", update, { passive: true });
11221
- return () => scrollEl.removeEventListener("scroll", update);
11222
- }, [taskListContainerRef, taskListWidth, tableWidth]);
11223
11183
  const renderedIndexes = useOptimizedList(
11224
11184
  taskListContainerRef,
11225
11185
  "scrollTop",
@@ -11296,7 +11256,7 @@ const TaskListInner = ({
11296
11256
  /* @__PURE__ */ jsxs(
11297
11257
  "div",
11298
11258
  {
11299
- ref: setHorizontalScrollRef,
11259
+ ref: taskListHorizontalScrollRef,
11300
11260
  className: styles$e.taskListHorizontalScroll,
11301
11261
  style: {
11302
11262
  width: tableWidth
@@ -11311,7 +11271,7 @@ const TaskListInner = ({
11311
11271
  allColumns,
11312
11272
  canToggleColumns: !!canToggleColumns,
11313
11273
  onColumnResizeStart,
11314
- onColumnVisibilityChange: handleColumnVisibilityChange,
11274
+ onColumnVisibilityChange,
11315
11275
  canResizeColumns
11316
11276
  }
11317
11277
  ),
@@ -11337,7 +11297,7 @@ const TaskListInner = ({
11337
11297
  distances.minimumRowDisplayed * distances.rowHeight
11338
11298
  ),
11339
11299
  backgroundSize: `100% ${fullRowHeight * 2}px`,
11340
- backgroundImage: `linear-gradient(to bottom, transparent ${fullRowHeight}px, var(--gantt-table-even-background-color, #f5f5f5) ${fullRowHeight}px)`
11300
+ backgroundImage: `linear-gradient(to bottom, transparent ${fullRowHeight}px, #f5f5f5 ${fullRowHeight}px)`
11341
11301
  },
11342
11302
  children: /* @__PURE__ */ jsx(
11343
11303
  RenderTaskListTable,
@@ -14452,7 +14412,7 @@ const TaskGanttInner = (props) => {
14452
14412
  backgroundPositionX: additionalLeftSpace || void 0,
14453
14413
  backgroundImage: [
14454
14414
  `linear-gradient(to right, #ebeff2 1px, transparent 2px)`,
14455
- `linear-gradient(to bottom, transparent ${fullRowHeight}px, var(--gantt-table-even-background-color, #f5f5f5) ${fullRowHeight}px)`
14415
+ `linear-gradient(to bottom, transparent ${fullRowHeight}px, #f5f5f5 ${fullRowHeight}px)`
14456
14416
  ].join(", ")
14457
14417
  }),
14458
14418
  [
@@ -5395,16 +5395,22 @@
5395
5395
  React.useEffect(() => {
5396
5396
  if (clientColumns) {
5397
5397
  setColumns([...clientColumns]);
5398
- const visibleColumns = clientColumns.filter((col) => !col.hidden);
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);
5399
5402
  setTableWidth(
5400
- visibleColumns.reduce((res, { width }) => res + width, 0) + extraWidth
5403
+ (prev) => Math.min(
5404
+ prev + widthOfAddedColumns - widthOfRemovedColumns,
5405
+ clientColumns.reduce((res, { width }) => res + width, 0) + extraWidth
5406
+ )
5401
5407
  );
5402
5408
  }
5403
5409
  }, [clientColumns, extraWidth]);
5404
5410
  const [tableResizeEvent, setTableResizeEvent] = React.useState(null);
5405
5411
  const [columnResizeEvent, setColumnResizeEvent] = React.useState(null);
5406
5412
  const [tableWidthState, setTableWidth] = React.useState(
5407
- () => columnsState.filter((c) => !c.hidden).reduce((res, { width }) => res + width, 0) + extraWidth
5413
+ () => columnsState.reduce((res, { width }) => res + width, 0) + extraWidth
5408
5414
  );
5409
5415
  const onTableResizeStart = (clientX) => {
5410
5416
  const newTableResizeEvent = {
@@ -5422,19 +5428,9 @@
5422
5428
  initialTableWidth: tableWidthState
5423
5429
  });
5424
5430
  };
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
- };
5435
5431
  const isResizeTableInProgress = Boolean(tableResizeEvent);
5436
5432
  const isResizeColumnInProgress = Boolean(columnResizeEvent);
5437
- const taskListWidth = columnsState.filter((c) => !c.hidden).reduce((res, { width }) => res + width, 0) + extraWidth;
5433
+ const taskListWidth = columnsState.reduce((res, { width }) => res + width, 0) + extraWidth;
5438
5434
  React.useEffect(() => {
5439
5435
  if (!isResizeTableInProgress) {
5440
5436
  return void 0;
@@ -5555,8 +5551,7 @@
5555
5551
  taskListWidth,
5556
5552
  tableWidthState,
5557
5553
  onTableResizeStart,
5558
- onColumnResizeStart,
5559
- handleColumnVisibilityChange
5554
+ onColumnResizeStart
5560
5555
  ];
5561
5556
  };
5562
5557
  const toggleWrapper = "_toggleWrapper_rjfhl_1";
@@ -5710,26 +5705,35 @@
5710
5705
  }) => {
5711
5706
  const pinnedStyles = React.useMemo(() => {
5712
5707
  const result = {};
5713
- const base = {
5714
- position: "relative",
5715
- zIndex: 3,
5716
- backgroundColor: "var(--gantt-table-header-background-color, #fff)"
5717
- };
5708
+ let leftOffset = 0;
5709
+ if (canMoveTasks) {
5710
+ leftOffset = 24;
5711
+ }
5718
5712
  for (let i = 0; i < columns.length; i++) {
5719
5713
  if (columns[i].pinned === "left") {
5720
5714
  result[i] = {
5721
- ...base,
5722
- transform: "translateX(var(--pinned-translate-left, 0px))"
5715
+ position: "sticky",
5716
+ left: leftOffset,
5717
+ zIndex: 2,
5718
+ backgroundColor: "var(--gantt-table-header-background-color, #fff)"
5723
5719
  };
5724
- } else if (columns[i].pinned === "right") {
5720
+ leftOffset += columns[i].width;
5721
+ }
5722
+ }
5723
+ let rightOffset = 0;
5724
+ for (let i = columns.length - 1; i >= 0; i--) {
5725
+ if (columns[i].pinned === "right") {
5725
5726
  result[i] = {
5726
- ...base,
5727
- transform: "translateX(var(--pinned-translate-right, 0px))"
5727
+ position: "sticky",
5728
+ right: rightOffset,
5729
+ zIndex: 2,
5730
+ backgroundColor: "var(--gantt-table-header-background-color, #fff)"
5728
5731
  };
5732
+ rightOffset += columns[i].width;
5729
5733
  }
5730
5734
  }
5731
5735
  return result;
5732
- }, [columns]);
5736
+ }, [columns, canMoveTasks]);
5733
5737
  return /* @__PURE__ */ jsxRuntime.jsx(
5734
5738
  "div",
5735
5739
  {
@@ -10463,17 +10467,7 @@
10463
10467
  if (isOverlay2) {
10464
10468
  return "var(--gantt-table-drag-task-background-color)";
10465
10469
  }
10466
- return isSelected ? "var(--gantt-table-selected-task-background-color)" : isEven ? "var(--gantt-table-even-background-color)" : "var(--gantt-background-color, #fff)";
10467
- }, [isEven, isOverlay2, isSelected]);
10468
- const pinnedBgColor = React.useMemo(() => {
10469
- if (isOverlay2) {
10470
- return "var(--gantt-table-drag-task-background-color)";
10471
- }
10472
- if (isSelected) {
10473
- const base = isEven ? "var(--gantt-table-even-background-color, #f5f5f5)" : "var(--gantt-background-color, #fff)";
10474
- return `linear-gradient(var(--gantt-table-selected-task-background-color), var(--gantt-table-selected-task-background-color)), linear-gradient(${base}, ${base})`;
10475
- }
10476
- return isEven ? "var(--gantt-table-even-background-color)" : "var(--gantt-background-color, #fff)";
10470
+ return isSelected ? "var(--gantt-table-selected-task-background-color)" : isEven ? "var(--gantt-table-even-background-color)" : void 0;
10477
10471
  }, [isEven, isOverlay2, isSelected]);
10478
10472
  const rowClassName = React.useMemo(() => {
10479
10473
  const classNames = [styles$h.taskListTableRow];
@@ -10493,26 +10487,35 @@
10493
10487
  }, [isCut2, moveOverPosition, isOverlay2, isDragging]);
10494
10488
  const pinnedStyles = React.useMemo(() => {
10495
10489
  const result = {};
10496
- const pinnedBase = {
10497
- position: "relative",
10498
- zIndex: 3,
10499
- background: pinnedBgColor
10500
- };
10490
+ let leftOffset = 0;
10491
+ if (moveHandleProps || !isOverlay2 && task.type !== "project" && task.id !== "no-project-asigned") {
10492
+ leftOffset = 24;
10493
+ }
10501
10494
  for (let i = 0; i < columns.length; i++) {
10502
10495
  if (columns[i].pinned === "left") {
10503
10496
  result[i] = {
10504
- ...pinnedBase,
10505
- transform: "translateX(var(--pinned-translate-left, 0px))"
10497
+ position: "sticky",
10498
+ left: leftOffset,
10499
+ zIndex: 1,
10500
+ backgroundColor: "inherit"
10506
10501
  };
10507
- } else if (columns[i].pinned === "right") {
10502
+ leftOffset += columns[i].width;
10503
+ }
10504
+ }
10505
+ let rightOffset = 0;
10506
+ for (let i = columns.length - 1; i >= 0; i--) {
10507
+ if (columns[i].pinned === "right") {
10508
10508
  result[i] = {
10509
- ...pinnedBase,
10510
- transform: "translateX(var(--pinned-translate-right, 0px))"
10509
+ position: "sticky",
10510
+ right: rightOffset,
10511
+ zIndex: 1,
10512
+ backgroundColor: "inherit"
10511
10513
  };
10514
+ rightOffset += columns[i].width;
10512
10515
  }
10513
10516
  }
10514
10517
  return result;
10515
- }, [columns, pinnedBgColor]);
10518
+ }, [columns, moveHandleProps, isOverlay2, task.type, task.id]);
10516
10519
  return /* @__PURE__ */ jsxRuntime.jsxs(
10517
10520
  "div",
10518
10521
  {
@@ -11183,60 +11186,17 @@
11183
11186
  taskListWidth,
11184
11187
  tableWidth,
11185
11188
  onTableResizeStart,
11186
- onColumnResizeStart,
11187
- internalColumnVisibilityChange
11189
+ onColumnResizeStart
11188
11190
  ] = useTableListResize(
11189
11191
  columnsProp,
11190
11192
  canReorderTasks,
11191
11193
  onResizeColumn,
11192
11194
  ganttRef
11193
11195
  );
11194
- const handleColumnVisibilityChange = React.useCallback(
11195
- (columnId, hidden2) => {
11196
- internalColumnVisibilityChange(columnId, hidden2);
11197
- if (onColumnVisibilityChange) {
11198
- onColumnVisibilityChange(columnId, hidden2);
11199
- }
11200
- },
11201
- [internalColumnVisibilityChange, onColumnVisibilityChange]
11202
- );
11203
- const columns = React.useMemo(() => {
11204
- const visible = allColumns.filter((col) => !col.hidden);
11205
- const left = visible.filter((col) => col.pinned === "left");
11206
- const middle = visible.filter((col) => !col.pinned);
11207
- const right = visible.filter((col) => col.pinned === "right");
11208
- return [...left, ...middle, ...right];
11209
- }, [allColumns]);
11210
- const horizontalScrollRef = React.useRef(null);
11211
- const setHorizontalScrollRef = React.useCallback(
11212
- (el) => {
11213
- horizontalScrollRef.current = el;
11214
- if (taskListHorizontalScrollRef) {
11215
- taskListHorizontalScrollRef.current = el;
11216
- }
11217
- },
11218
- [taskListHorizontalScrollRef]
11196
+ const columns = React.useMemo(
11197
+ () => allColumns.filter((col) => !col.hidden),
11198
+ [allColumns]
11219
11199
  );
11220
- React.useEffect(() => {
11221
- const scrollEl = horizontalScrollRef.current;
11222
- const containerEl = taskListContainerRef.current;
11223
- if (!scrollEl || !containerEl)
11224
- return void 0;
11225
- const update = () => {
11226
- const sl = scrollEl.scrollLeft;
11227
- const visibleWidth = scrollEl.clientWidth;
11228
- const maxSl = Math.max(0, taskListWidth - visibleWidth);
11229
- const leftVal = `${sl}px`;
11230
- const rightVal = `${sl - maxSl}px`;
11231
- scrollEl.style.setProperty("--pinned-translate-left", leftVal);
11232
- scrollEl.style.setProperty("--pinned-translate-right", rightVal);
11233
- containerEl.style.setProperty("--pinned-translate-left", leftVal);
11234
- containerEl.style.setProperty("--pinned-translate-right", rightVal);
11235
- };
11236
- update();
11237
- scrollEl.addEventListener("scroll", update, { passive: true });
11238
- return () => scrollEl.removeEventListener("scroll", update);
11239
- }, [taskListContainerRef, taskListWidth, tableWidth]);
11240
11200
  const renderedIndexes = useOptimizedList(
11241
11201
  taskListContainerRef,
11242
11202
  "scrollTop",
@@ -11313,7 +11273,7 @@
11313
11273
  /* @__PURE__ */ jsxRuntime.jsxs(
11314
11274
  "div",
11315
11275
  {
11316
- ref: setHorizontalScrollRef,
11276
+ ref: taskListHorizontalScrollRef,
11317
11277
  className: styles$e.taskListHorizontalScroll,
11318
11278
  style: {
11319
11279
  width: tableWidth
@@ -11328,7 +11288,7 @@
11328
11288
  allColumns,
11329
11289
  canToggleColumns: !!canToggleColumns,
11330
11290
  onColumnResizeStart,
11331
- onColumnVisibilityChange: handleColumnVisibilityChange,
11291
+ onColumnVisibilityChange,
11332
11292
  canResizeColumns
11333
11293
  }
11334
11294
  ),
@@ -11354,7 +11314,7 @@
11354
11314
  distances.minimumRowDisplayed * distances.rowHeight
11355
11315
  ),
11356
11316
  backgroundSize: `100% ${fullRowHeight * 2}px`,
11357
- backgroundImage: `linear-gradient(to bottom, transparent ${fullRowHeight}px, var(--gantt-table-even-background-color, #f5f5f5) ${fullRowHeight}px)`
11317
+ backgroundImage: `linear-gradient(to bottom, transparent ${fullRowHeight}px, #f5f5f5 ${fullRowHeight}px)`
11358
11318
  },
11359
11319
  children: /* @__PURE__ */ jsxRuntime.jsx(
11360
11320
  RenderTaskListTable,
@@ -14469,7 +14429,7 @@
14469
14429
  backgroundPositionX: additionalLeftSpace || void 0,
14470
14430
  backgroundImage: [
14471
14431
  `linear-gradient(to right, #ebeff2 1px, transparent 2px)`,
14472
- `linear-gradient(to bottom, transparent ${fullRowHeight}px, var(--gantt-table-even-background-color, #f5f5f5) ${fullRowHeight}px)`
14432
+ `linear-gradient(to bottom, transparent ${fullRowHeight}px, #f5f5f5 ${fullRowHeight}px)`
14473
14433
  ].join(", ")
14474
14434
  }),
14475
14435
  [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gantt-task-react-v",
3
- "version": "1.8.0",
3
+ "version": "1.8.1",
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",