gantt-task-react-v 1.7.8 → 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
  {
@@ -10496,10 +10487,7 @@ const TaskListTableRowInner = forwardRef(
10496
10487
  ...pinnedBase,
10497
10488
  transform: "translateX(var(--pinned-translate-left, 0px))"
10498
10489
  };
10499
- }
10500
- }
10501
- for (let i = columns.length - 1; i >= 0; i--) {
10502
- if (columns[i].pinned === "right") {
10490
+ } else if (columns[i].pinned === "right") {
10503
10491
  result[i] = {
10504
10492
  ...pinnedBase,
10505
10493
  transform: "translateX(var(--pinned-translate-right, 0px))"
@@ -11195,10 +11183,13 @@ const TaskListInner = ({
11195
11183
  },
11196
11184
  [internalColumnVisibilityChange, onColumnVisibilityChange]
11197
11185
  );
11198
- const columns = useMemo(
11199
- () => allColumns.filter((col) => !col.hidden),
11200
- [allColumns]
11201
- );
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]);
11202
11193
  const horizontalScrollRef = useRef(null);
11203
11194
  const setHorizontalScrollRef = useCallback(
11204
11195
  (el) => {
@@ -11217,11 +11208,12 @@ const TaskListInner = ({
11217
11208
  const update = () => {
11218
11209
  const sl = scrollEl.scrollLeft;
11219
11210
  const maxSl = scrollEl.scrollWidth - scrollEl.clientWidth;
11220
- containerEl.style.setProperty("--pinned-translate-left", `${sl}px`);
11221
- containerEl.style.setProperty(
11222
- "--pinned-translate-right",
11223
- `${sl - maxSl}px`
11224
- );
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);
11225
11217
  };
11226
11218
  update();
11227
11219
  scrollEl.addEventListener("scroll", update, { passive: true });
@@ -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
  {
@@ -10513,10 +10504,7 @@
10513
10504
  ...pinnedBase,
10514
10505
  transform: "translateX(var(--pinned-translate-left, 0px))"
10515
10506
  };
10516
- }
10517
- }
10518
- for (let i = columns.length - 1; i >= 0; i--) {
10519
- if (columns[i].pinned === "right") {
10507
+ } else if (columns[i].pinned === "right") {
10520
10508
  result[i] = {
10521
10509
  ...pinnedBase,
10522
10510
  transform: "translateX(var(--pinned-translate-right, 0px))"
@@ -11212,10 +11200,13 @@
11212
11200
  },
11213
11201
  [internalColumnVisibilityChange, onColumnVisibilityChange]
11214
11202
  );
11215
- const columns = React.useMemo(
11216
- () => allColumns.filter((col) => !col.hidden),
11217
- [allColumns]
11218
- );
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]);
11219
11210
  const horizontalScrollRef = React.useRef(null);
11220
11211
  const setHorizontalScrollRef = React.useCallback(
11221
11212
  (el) => {
@@ -11234,11 +11225,12 @@
11234
11225
  const update = () => {
11235
11226
  const sl = scrollEl.scrollLeft;
11236
11227
  const maxSl = scrollEl.scrollWidth - scrollEl.clientWidth;
11237
- containerEl.style.setProperty("--pinned-translate-left", `${sl}px`);
11238
- containerEl.style.setProperty(
11239
- "--pinned-translate-right",
11240
- `${sl - maxSl}px`
11241
- );
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);
11242
11234
  };
11243
11235
  update();
11244
11236
  scrollEl.addEventListener("scroll", update, { passive: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gantt-task-react-v",
3
- "version": "1.7.8",
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",