gantt-lib 0.25.0 → 0.26.0
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.
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +47 -24
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +47 -24
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1891,11 +1891,13 @@ var useTaskDrag = (options) => {
|
|
|
1891
1891
|
disableConstraints = false,
|
|
1892
1892
|
onCascadeProgress,
|
|
1893
1893
|
onCascade,
|
|
1894
|
+
locked = false,
|
|
1895
|
+
disableTaskDrag = false,
|
|
1894
1896
|
businessDays = true,
|
|
1895
1897
|
weekendPredicate
|
|
1896
1898
|
} = options;
|
|
1897
1899
|
const isOwnerRef = useRef(false);
|
|
1898
|
-
const
|
|
1900
|
+
const effectiveLocked = locked || disableTaskDrag;
|
|
1899
1901
|
const [isDragging, setIsDragging] = useState(false);
|
|
1900
1902
|
const [dragMode, setDragMode] = useState(null);
|
|
1901
1903
|
const [currentLeft, setCurrentLeft] = useState(0);
|
|
@@ -2060,7 +2062,7 @@ var useTaskDrag = (options) => {
|
|
|
2060
2062
|
};
|
|
2061
2063
|
}, []);
|
|
2062
2064
|
const handleMouseDown = useCallback((e) => {
|
|
2063
|
-
if (
|
|
2065
|
+
if (effectiveLocked) return;
|
|
2064
2066
|
const target = e.currentTarget;
|
|
2065
2067
|
const edgeZone = detectEdgeZone(e.clientX, target, edgeZoneWidth);
|
|
2066
2068
|
let mode = null;
|
|
@@ -2138,14 +2140,15 @@ var useTaskDrag = (options) => {
|
|
|
2138
2140
|
businessDays,
|
|
2139
2141
|
weekendPredicate
|
|
2140
2142
|
};
|
|
2141
|
-
}, [edgeZoneWidth, currentLeft, currentWidth, dayWidth, monthStart, taskId, onDragStateChange, handleProgress, handleComplete, handleCancel, allTasks, disableConstraints, onCascadeProgress, onCascade,
|
|
2143
|
+
}, [edgeZoneWidth, currentLeft, currentWidth, dayWidth, monthStart, taskId, onDragStateChange, handleProgress, handleComplete, handleCancel, allTasks, disableConstraints, onCascadeProgress, onCascade, effectiveLocked]);
|
|
2142
2144
|
const getCursorStyle = useCallback(() => {
|
|
2145
|
+
if (disableTaskDrag) return "grab";
|
|
2143
2146
|
if (locked) return "not-allowed";
|
|
2144
2147
|
if (isDragging) {
|
|
2145
2148
|
return "grabbing";
|
|
2146
2149
|
}
|
|
2147
2150
|
return "grab";
|
|
2148
|
-
}, [locked, isDragging]);
|
|
2151
|
+
}, [disableTaskDrag, locked, isDragging]);
|
|
2149
2152
|
return {
|
|
2150
2153
|
isDragging,
|
|
2151
2154
|
dragMode,
|
|
@@ -2164,10 +2167,10 @@ var useTaskDrag = (options) => {
|
|
|
2164
2167
|
// src/components/TaskRow/TaskRow.tsx
|
|
2165
2168
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
2166
2169
|
var arePropsEqual = (prevProps, nextProps) => {
|
|
2167
|
-
return prevProps.task.id === nextProps.task.id && prevProps.task.name === nextProps.task.name && prevProps.task.startDate === nextProps.task.startDate && prevProps.task.endDate === nextProps.task.endDate && prevProps.task.color === nextProps.task.color && prevProps.task.progress === nextProps.task.progress && prevProps.task.accepted === nextProps.task.accepted && prevProps.monthStart.getTime() === nextProps.monthStart.getTime() && prevProps.dayWidth === nextProps.dayWidth && prevProps.rowHeight === nextProps.rowHeight && prevProps.overridePosition?.left === nextProps.overridePosition?.left && prevProps.overridePosition?.width === nextProps.overridePosition?.width && prevProps.allTasks === nextProps.allTasks && prevProps.disableConstraints === nextProps.disableConstraints && prevProps.task.locked === nextProps.task.locked && prevProps.task.divider === nextProps.task.divider && prevProps.highlightExpiredTasks === nextProps.highlightExpiredTasks && prevProps.isFilterMatch === nextProps.isFilterMatch && prevProps.businessDays === nextProps.businessDays && prevProps.customDays === nextProps.customDays && prevProps.isWeekend === nextProps.isWeekend;
|
|
2170
|
+
return prevProps.task.id === nextProps.task.id && prevProps.task.name === nextProps.task.name && prevProps.task.startDate === nextProps.task.startDate && prevProps.task.endDate === nextProps.task.endDate && prevProps.task.color === nextProps.task.color && prevProps.task.progress === nextProps.task.progress && prevProps.task.accepted === nextProps.task.accepted && prevProps.monthStart.getTime() === nextProps.monthStart.getTime() && prevProps.dayWidth === nextProps.dayWidth && prevProps.rowHeight === nextProps.rowHeight && prevProps.overridePosition?.left === nextProps.overridePosition?.left && prevProps.overridePosition?.width === nextProps.overridePosition?.width && prevProps.allTasks === nextProps.allTasks && prevProps.disableConstraints === nextProps.disableConstraints && prevProps.task.locked === nextProps.task.locked && prevProps.task.divider === nextProps.task.divider && prevProps.highlightExpiredTasks === nextProps.highlightExpiredTasks && prevProps.isFilterMatch === nextProps.isFilterMatch && prevProps.businessDays === nextProps.businessDays && prevProps.customDays === nextProps.customDays && prevProps.isWeekend === nextProps.isWeekend && prevProps.disableTaskDrag === nextProps.disableTaskDrag;
|
|
2168
2171
|
};
|
|
2169
2172
|
var TaskRow = React2.memo(
|
|
2170
|
-
({ task, monthStart, dayWidth, rowHeight, onTasksChange, onDragStateChange, rowIndex, allTasks, enableAutoSchedule, disableConstraints, overridePosition, onCascadeProgress, onCascade, divider, highlightExpiredTasks, isFilterMatch = false, businessDays, customDays, isWeekend: isWeekend3 }) => {
|
|
2173
|
+
({ task, monthStart, dayWidth, rowHeight, onTasksChange, onDragStateChange, rowIndex, allTasks, enableAutoSchedule, disableConstraints, overridePosition, onCascadeProgress, onCascade, divider, highlightExpiredTasks, isFilterMatch = false, businessDays, customDays, isWeekend: isWeekend3, disableTaskDrag = false }) => {
|
|
2171
2174
|
const { divider: taskDivider } = task;
|
|
2172
2175
|
const taskStartDate = useMemo2(() => parseUTCDate(task.startDate), [task.startDate]);
|
|
2173
2176
|
const taskEndDate = useMemo2(() => parseUTCDate(task.endDate), [task.endDate]);
|
|
@@ -2247,6 +2250,7 @@ var TaskRow = React2.memo(
|
|
|
2247
2250
|
enableAutoSchedule,
|
|
2248
2251
|
disableConstraints,
|
|
2249
2252
|
locked: task.locked,
|
|
2253
|
+
disableTaskDrag,
|
|
2250
2254
|
onCascadeProgress,
|
|
2251
2255
|
onCascade,
|
|
2252
2256
|
businessDays,
|
|
@@ -4643,7 +4647,7 @@ var TaskListRow = React9.memo(
|
|
|
4643
4647
|
top: 0,
|
|
4644
4648
|
height: `${rowHeight}px`,
|
|
4645
4649
|
width: "1.5px",
|
|
4646
|
-
background: "
|
|
4650
|
+
background: "var(--gantt-hierarchy-line-color)",
|
|
4647
4651
|
borderRadius: "1px",
|
|
4648
4652
|
pointerEvents: "none"
|
|
4649
4653
|
}
|
|
@@ -4660,7 +4664,7 @@ var TaskListRow = React9.memo(
|
|
|
4660
4664
|
top: 0,
|
|
4661
4665
|
height: isLastChild ? `${rowHeight / 2}px` : `${rowHeight}px`,
|
|
4662
4666
|
width: "1.5px",
|
|
4663
|
-
background: "
|
|
4667
|
+
background: "var(--gantt-hierarchy-line-color)",
|
|
4664
4668
|
borderRadius: "1px",
|
|
4665
4669
|
pointerEvents: "none"
|
|
4666
4670
|
}
|
|
@@ -4675,7 +4679,7 @@ var TaskListRow = React9.memo(
|
|
|
4675
4679
|
top: `${rowHeight / 2 - 0.75}px`,
|
|
4676
4680
|
width: "8px",
|
|
4677
4681
|
height: "1.5px",
|
|
4678
|
-
background: "
|
|
4682
|
+
background: "var(--gantt-hierarchy-line-color)",
|
|
4679
4683
|
borderRadius: "1px",
|
|
4680
4684
|
pointerEvents: "none"
|
|
4681
4685
|
}
|
|
@@ -4691,23 +4695,40 @@ var TaskListRow = React9.memo(
|
|
|
4691
4695
|
width: "4px",
|
|
4692
4696
|
height: "4px",
|
|
4693
4697
|
borderRadius: "50%",
|
|
4694
|
-
background: "
|
|
4698
|
+
background: "var(--gantt-hierarchy-line-color)",
|
|
4695
4699
|
pointerEvents: "none"
|
|
4696
4700
|
}
|
|
4697
4701
|
}
|
|
4698
4702
|
)
|
|
4699
4703
|
] }),
|
|
4700
|
-
isParent && !editingName && /* @__PURE__ */
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4704
|
+
isParent && !editingName && /* @__PURE__ */ jsxs9(Fragment2, { children: [
|
|
4705
|
+
!isCollapsed && /* @__PURE__ */ jsx12(
|
|
4706
|
+
"span",
|
|
4707
|
+
{
|
|
4708
|
+
style: {
|
|
4709
|
+
position: "absolute",
|
|
4710
|
+
left: `${nestingDepth * 20 + 9}px`,
|
|
4711
|
+
top: `${rowHeight / 2 + 7}px`,
|
|
4712
|
+
height: `${rowHeight / 2 - 7}px`,
|
|
4713
|
+
width: "1.5px",
|
|
4714
|
+
background: "var(--gantt-hierarchy-line-color)",
|
|
4715
|
+
borderRadius: "1px",
|
|
4716
|
+
pointerEvents: "none"
|
|
4717
|
+
}
|
|
4718
|
+
}
|
|
4719
|
+
),
|
|
4720
|
+
/* @__PURE__ */ jsx12(
|
|
4721
|
+
"button",
|
|
4722
|
+
{
|
|
4723
|
+
type: "button",
|
|
4724
|
+
className: `gantt-tl-collapse-btn ${isCollapsed ? "gantt-tl-collapse-btn-collapsed" : ""}`,
|
|
4725
|
+
onClick: handleToggleCollapse,
|
|
4726
|
+
style: { left: `${nestingDepth * 20 + 1}px` },
|
|
4727
|
+
"aria-label": isCollapsed ? "Expand children" : "Collapse children",
|
|
4728
|
+
children: /* @__PURE__ */ jsx12(ChevronRightIcon, {})
|
|
4729
|
+
}
|
|
4730
|
+
)
|
|
4731
|
+
] }),
|
|
4711
4732
|
editingName && /* @__PURE__ */ jsx12(
|
|
4712
4733
|
Input,
|
|
4713
4734
|
{
|
|
@@ -4736,7 +4757,7 @@ var TaskListRow = React9.memo(
|
|
|
4736
4757
|
onClick: handleNameClick,
|
|
4737
4758
|
onDoubleClick: handleNameDoubleClick,
|
|
4738
4759
|
style: {
|
|
4739
|
-
paddingLeft: nestingDepth > 0 ? `${nestingDepth * 20 + (isParent ?
|
|
4760
|
+
paddingLeft: nestingDepth > 0 ? `${nestingDepth * 20 + (isParent ? 24 : 8)}px` : isParent ? "24px" : void 0,
|
|
4740
4761
|
...editingName ? { visibility: "hidden", pointerEvents: "none" } : void 0
|
|
4741
4762
|
},
|
|
4742
4763
|
children: task.name
|
|
@@ -5870,7 +5891,8 @@ var GanttChart = forwardRef(({
|
|
|
5870
5891
|
taskFilter,
|
|
5871
5892
|
collapsedParentIds: externalCollapsedParentIds,
|
|
5872
5893
|
onToggleCollapse: externalOnToggleCollapse,
|
|
5873
|
-
highlightedTaskIds
|
|
5894
|
+
highlightedTaskIds,
|
|
5895
|
+
disableTaskDrag = false
|
|
5874
5896
|
}, ref) => {
|
|
5875
5897
|
const scrollContainerRef = useRef7(null);
|
|
5876
5898
|
const [selectedTaskId, setSelectedTaskId] = useState7(null);
|
|
@@ -6418,7 +6440,8 @@ var GanttChart = forwardRef(({
|
|
|
6418
6440
|
isFilterMatch: matchedTaskIds.has(task.id),
|
|
6419
6441
|
businessDays,
|
|
6420
6442
|
customDays,
|
|
6421
|
-
isWeekend: isWeekend3
|
|
6443
|
+
isWeekend: isWeekend3,
|
|
6444
|
+
disableTaskDrag
|
|
6422
6445
|
},
|
|
6423
6446
|
task.id
|
|
6424
6447
|
))
|