gantt-task-react-v 1.7.7 → 1.7.9

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.
@@ -5693,35 +5693,26 @@ const TaskListTableHeadersDefaultInner = ({
5693
5693
  }) => {
5694
5694
  const pinnedStyles = useMemo(() => {
5695
5695
  const result = {};
5696
- let leftOffset = 0;
5697
- if (canMoveTasks) {
5698
- leftOffset = 24;
5699
- }
5696
+ const base = {
5697
+ position: "relative",
5698
+ zIndex: 3,
5699
+ backgroundColor: "var(--gantt-table-header-background-color, #fff)"
5700
+ };
5700
5701
  for (let i = 0; i < columns.length; i++) {
5701
5702
  if (columns[i].pinned === "left") {
5702
5703
  result[i] = {
5703
- position: "sticky",
5704
- left: leftOffset,
5705
- zIndex: 3,
5706
- backgroundColor: "var(--gantt-table-header-background-color, #fff)"
5704
+ ...base,
5705
+ transform: "translateX(var(--pinned-translate-left, 0px))"
5707
5706
  };
5708
- leftOffset += columns[i].width;
5709
- }
5710
- }
5711
- let rightOffset = 0;
5712
- for (let i = columns.length - 1; i >= 0; i--) {
5713
- if (columns[i].pinned === "right") {
5707
+ } else if (columns[i].pinned === "right") {
5714
5708
  result[i] = {
5715
- position: "sticky",
5716
- right: rightOffset,
5717
- zIndex: 3,
5718
- backgroundColor: "var(--gantt-table-header-background-color, #fff)"
5709
+ ...base,
5710
+ transform: "translateX(var(--pinned-translate-right, 0px))"
5719
5711
  };
5720
- rightOffset += columns[i].width;
5721
5712
  }
5722
5713
  }
5723
5714
  return result;
5724
- }, [columns, canMoveTasks]);
5715
+ }, [columns]);
5725
5716
  return /* @__PURE__ */ jsx(
5726
5717
  "div",
5727
5718
  {
@@ -10457,6 +10448,16 @@ const TaskListTableRowInner = forwardRef(
10457
10448
  }
10458
10449
  return isSelected ? "var(--gantt-table-selected-task-background-color)" : isEven ? "var(--gantt-table-even-background-color)" : "var(--gantt-background-color, #fff)";
10459
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)";
10460
+ }, [isEven, isOverlay2, isSelected]);
10460
10461
  const rowClassName = useMemo(() => {
10461
10462
  const classNames = [styles$h.taskListTableRow];
10462
10463
  if (moveOverPosition === "after") {
@@ -10478,7 +10479,7 @@ const TaskListTableRowInner = forwardRef(
10478
10479
  const pinnedBase = {
10479
10480
  position: "relative",
10480
10481
  zIndex: 3,
10481
- backgroundColor: backgroundColor || "var(--gantt-background-color, #fff)"
10482
+ background: pinnedBgColor
10482
10483
  };
10483
10484
  for (let i = 0; i < columns.length; i++) {
10484
10485
  if (columns[i].pinned === "left") {
@@ -10486,10 +10487,7 @@ const TaskListTableRowInner = forwardRef(
10486
10487
  ...pinnedBase,
10487
10488
  transform: "translateX(var(--pinned-translate-left, 0px))"
10488
10489
  };
10489
- }
10490
- }
10491
- for (let i = columns.length - 1; i >= 0; i--) {
10492
- if (columns[i].pinned === "right") {
10490
+ } else if (columns[i].pinned === "right") {
10493
10491
  result[i] = {
10494
10492
  ...pinnedBase,
10495
10493
  transform: "translateX(var(--pinned-translate-right, 0px))"
@@ -10497,7 +10495,7 @@ const TaskListTableRowInner = forwardRef(
10497
10495
  }
10498
10496
  }
10499
10497
  return result;
10500
- }, [columns, backgroundColor]);
10498
+ }, [columns, pinnedBgColor]);
10501
10499
  return /* @__PURE__ */ jsxs(
10502
10500
  "div",
10503
10501
  {
@@ -11185,10 +11183,13 @@ const TaskListInner = ({
11185
11183
  },
11186
11184
  [internalColumnVisibilityChange, onColumnVisibilityChange]
11187
11185
  );
11188
- const columns = useMemo(
11189
- () => allColumns.filter((col) => !col.hidden),
11190
- [allColumns]
11191
- );
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]);
11192
11193
  const horizontalScrollRef = useRef(null);
11193
11194
  const setHorizontalScrollRef = useCallback(
11194
11195
  (el) => {
@@ -11207,11 +11208,12 @@ const TaskListInner = ({
11207
11208
  const update = () => {
11208
11209
  const sl = scrollEl.scrollLeft;
11209
11210
  const maxSl = scrollEl.scrollWidth - scrollEl.clientWidth;
11210
- containerEl.style.setProperty("--pinned-translate-left", `${sl}px`);
11211
- containerEl.style.setProperty(
11212
- "--pinned-translate-right",
11213
- `${sl - maxSl}px`
11214
- );
11211
+ const leftVal = `${sl}px`;
11212
+ const rightVal = `${sl - maxSl}px`;
11213
+ scrollEl.style.setProperty("--pinned-translate-left", leftVal);
11214
+ scrollEl.style.setProperty("--pinned-translate-right", rightVal);
11215
+ containerEl.style.setProperty("--pinned-translate-left", leftVal);
11216
+ containerEl.style.setProperty("--pinned-translate-right", rightVal);
11215
11217
  };
11216
11218
  update();
11217
11219
  scrollEl.addEventListener("scroll", update, { passive: true });
@@ -11334,7 +11336,7 @@ const TaskListInner = ({
11334
11336
  distances.minimumRowDisplayed * distances.rowHeight
11335
11337
  ),
11336
11338
  backgroundSize: `100% ${fullRowHeight * 2}px`,
11337
- backgroundImage: `linear-gradient(to bottom, transparent ${fullRowHeight}px, #f5f5f5 ${fullRowHeight}px)`
11339
+ backgroundImage: `linear-gradient(to bottom, transparent ${fullRowHeight}px, var(--gantt-table-even-background-color, #f5f5f5) ${fullRowHeight}px)`
11338
11340
  },
11339
11341
  children: /* @__PURE__ */ jsx(
11340
11342
  RenderTaskListTable,
@@ -14449,7 +14451,7 @@ const TaskGanttInner = (props) => {
14449
14451
  backgroundPositionX: additionalLeftSpace || void 0,
14450
14452
  backgroundImage: [
14451
14453
  `linear-gradient(to right, #ebeff2 1px, transparent 2px)`,
14452
- `linear-gradient(to bottom, transparent ${fullRowHeight}px, #f5f5f5 ${fullRowHeight}px)`
14454
+ `linear-gradient(to bottom, transparent ${fullRowHeight}px, var(--gantt-table-even-background-color, #f5f5f5) ${fullRowHeight}px)`
14453
14455
  ].join(", ")
14454
14456
  }),
14455
14457
  [
@@ -5710,35 +5710,26 @@
5710
5710
  }) => {
5711
5711
  const pinnedStyles = React.useMemo(() => {
5712
5712
  const result = {};
5713
- let leftOffset = 0;
5714
- if (canMoveTasks) {
5715
- leftOffset = 24;
5716
- }
5713
+ const base = {
5714
+ position: "relative",
5715
+ zIndex: 3,
5716
+ backgroundColor: "var(--gantt-table-header-background-color, #fff)"
5717
+ };
5717
5718
  for (let i = 0; i < columns.length; i++) {
5718
5719
  if (columns[i].pinned === "left") {
5719
5720
  result[i] = {
5720
- position: "sticky",
5721
- left: leftOffset,
5722
- zIndex: 3,
5723
- backgroundColor: "var(--gantt-table-header-background-color, #fff)"
5721
+ ...base,
5722
+ transform: "translateX(var(--pinned-translate-left, 0px))"
5724
5723
  };
5725
- leftOffset += columns[i].width;
5726
- }
5727
- }
5728
- let rightOffset = 0;
5729
- for (let i = columns.length - 1; i >= 0; i--) {
5730
- if (columns[i].pinned === "right") {
5724
+ } else if (columns[i].pinned === "right") {
5731
5725
  result[i] = {
5732
- position: "sticky",
5733
- right: rightOffset,
5734
- zIndex: 3,
5735
- backgroundColor: "var(--gantt-table-header-background-color, #fff)"
5726
+ ...base,
5727
+ transform: "translateX(var(--pinned-translate-right, 0px))"
5736
5728
  };
5737
- rightOffset += columns[i].width;
5738
5729
  }
5739
5730
  }
5740
5731
  return result;
5741
- }, [columns, canMoveTasks]);
5732
+ }, [columns]);
5742
5733
  return /* @__PURE__ */ jsxRuntime.jsx(
5743
5734
  "div",
5744
5735
  {
@@ -10474,6 +10465,16 @@
10474
10465
  }
10475
10466
  return isSelected ? "var(--gantt-table-selected-task-background-color)" : isEven ? "var(--gantt-table-even-background-color)" : "var(--gantt-background-color, #fff)";
10476
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)";
10477
+ }, [isEven, isOverlay2, isSelected]);
10477
10478
  const rowClassName = React.useMemo(() => {
10478
10479
  const classNames = [styles$h.taskListTableRow];
10479
10480
  if (moveOverPosition === "after") {
@@ -10495,7 +10496,7 @@
10495
10496
  const pinnedBase = {
10496
10497
  position: "relative",
10497
10498
  zIndex: 3,
10498
- backgroundColor: backgroundColor || "var(--gantt-background-color, #fff)"
10499
+ background: pinnedBgColor
10499
10500
  };
10500
10501
  for (let i = 0; i < columns.length; i++) {
10501
10502
  if (columns[i].pinned === "left") {
@@ -10503,10 +10504,7 @@
10503
10504
  ...pinnedBase,
10504
10505
  transform: "translateX(var(--pinned-translate-left, 0px))"
10505
10506
  };
10506
- }
10507
- }
10508
- for (let i = columns.length - 1; i >= 0; i--) {
10509
- if (columns[i].pinned === "right") {
10507
+ } else if (columns[i].pinned === "right") {
10510
10508
  result[i] = {
10511
10509
  ...pinnedBase,
10512
10510
  transform: "translateX(var(--pinned-translate-right, 0px))"
@@ -10514,7 +10512,7 @@
10514
10512
  }
10515
10513
  }
10516
10514
  return result;
10517
- }, [columns, backgroundColor]);
10515
+ }, [columns, pinnedBgColor]);
10518
10516
  return /* @__PURE__ */ jsxRuntime.jsxs(
10519
10517
  "div",
10520
10518
  {
@@ -11202,10 +11200,13 @@
11202
11200
  },
11203
11201
  [internalColumnVisibilityChange, onColumnVisibilityChange]
11204
11202
  );
11205
- const columns = React.useMemo(
11206
- () => allColumns.filter((col) => !col.hidden),
11207
- [allColumns]
11208
- );
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]);
11209
11210
  const horizontalScrollRef = React.useRef(null);
11210
11211
  const setHorizontalScrollRef = React.useCallback(
11211
11212
  (el) => {
@@ -11224,11 +11225,12 @@
11224
11225
  const update = () => {
11225
11226
  const sl = scrollEl.scrollLeft;
11226
11227
  const maxSl = scrollEl.scrollWidth - scrollEl.clientWidth;
11227
- containerEl.style.setProperty("--pinned-translate-left", `${sl}px`);
11228
- containerEl.style.setProperty(
11229
- "--pinned-translate-right",
11230
- `${sl - maxSl}px`
11231
- );
11228
+ const leftVal = `${sl}px`;
11229
+ const rightVal = `${sl - maxSl}px`;
11230
+ scrollEl.style.setProperty("--pinned-translate-left", leftVal);
11231
+ scrollEl.style.setProperty("--pinned-translate-right", rightVal);
11232
+ containerEl.style.setProperty("--pinned-translate-left", leftVal);
11233
+ containerEl.style.setProperty("--pinned-translate-right", rightVal);
11232
11234
  };
11233
11235
  update();
11234
11236
  scrollEl.addEventListener("scroll", update, { passive: true });
@@ -11351,7 +11353,7 @@
11351
11353
  distances.minimumRowDisplayed * distances.rowHeight
11352
11354
  ),
11353
11355
  backgroundSize: `100% ${fullRowHeight * 2}px`,
11354
- backgroundImage: `linear-gradient(to bottom, transparent ${fullRowHeight}px, #f5f5f5 ${fullRowHeight}px)`
11356
+ backgroundImage: `linear-gradient(to bottom, transparent ${fullRowHeight}px, var(--gantt-table-even-background-color, #f5f5f5) ${fullRowHeight}px)`
11355
11357
  },
11356
11358
  children: /* @__PURE__ */ jsxRuntime.jsx(
11357
11359
  RenderTaskListTable,
@@ -14466,7 +14468,7 @@
14466
14468
  backgroundPositionX: additionalLeftSpace || void 0,
14467
14469
  backgroundImage: [
14468
14470
  `linear-gradient(to right, #ebeff2 1px, transparent 2px)`,
14469
- `linear-gradient(to bottom, transparent ${fullRowHeight}px, #f5f5f5 ${fullRowHeight}px)`
14471
+ `linear-gradient(to bottom, transparent ${fullRowHeight}px, var(--gantt-table-even-background-color, #f5f5f5) ${fullRowHeight}px)`
14470
14472
  ].join(", ")
14471
14473
  }),
14472
14474
  [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gantt-task-react-v",
3
- "version": "1.7.7",
3
+ "version": "1.7.9",
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",