gantt-task-react-v 1.4.7 → 1.4.8
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.
|
@@ -24,6 +24,7 @@ export interface TaskGanttContentProps extends GanttTaskBarActions {
|
|
|
24
24
|
onArrowDoubleClick: (taskFrom: Task, taskTo: Task) => void;
|
|
25
25
|
onArrowClick?: (taskFrom: Task, taskTo: Task) => void;
|
|
26
26
|
activeArrowKey?: string | null;
|
|
27
|
+
activeTaskId?: string | null;
|
|
27
28
|
onClick?: (task: Task, event: React.MouseEvent<SVGElement>) => void;
|
|
28
29
|
onDoubleClick?: (task: Task) => void;
|
|
29
30
|
renderedRowIndexes: OptimizedListParams | null;
|
|
@@ -4,6 +4,7 @@ interface GanttDrawerInternalProps {
|
|
|
4
4
|
data: GanttDrawerData | null;
|
|
5
5
|
width: number;
|
|
6
6
|
onClose: () => void;
|
|
7
|
+
onGoToTask?: (taskId: string) => void;
|
|
7
8
|
renderContent?: RenderDrawerContent;
|
|
8
9
|
}
|
|
9
10
|
export declare const GanttDrawer: React.NamedExoticComponent<GanttDrawerInternalProps>;
|
|
@@ -13161,6 +13161,7 @@ const TaskGanttContentInner = (props) => {
|
|
|
13161
13161
|
onArrowDoubleClick,
|
|
13162
13162
|
onArrowClick,
|
|
13163
13163
|
activeArrowKey,
|
|
13164
|
+
activeTaskId,
|
|
13164
13165
|
onDoubleClick,
|
|
13165
13166
|
onClick,
|
|
13166
13167
|
renderedRowIndexes,
|
|
@@ -13465,7 +13466,7 @@ const TaskGanttContentInner = (props) => {
|
|
|
13465
13466
|
rtl,
|
|
13466
13467
|
onArrowDoubleClick,
|
|
13467
13468
|
onArrowClick,
|
|
13468
|
-
isActive: activeArrowKey === `${source.id}|${taskId}
|
|
13469
|
+
isActive: activeArrowKey === `${source.id}|${taskId}` || activeTaskId === source.id || activeTaskId === taskId,
|
|
13469
13470
|
fromConnectionIndex: getConnectionIndex(
|
|
13470
13471
|
`${source.id}|${sourceTarget}|out`
|
|
13471
13472
|
),
|
|
@@ -13551,7 +13552,7 @@ const TaskGanttContentInner = (props) => {
|
|
|
13551
13552
|
rtl,
|
|
13552
13553
|
onArrowDoubleClick,
|
|
13553
13554
|
onArrowClick,
|
|
13554
|
-
isActive: activeArrowKey === `${taskId}|${dependent.id}
|
|
13555
|
+
isActive: activeArrowKey === `${taskId}|${dependent.id}` || activeTaskId === taskId || activeTaskId === dependent.id,
|
|
13555
13556
|
fromConnectionIndex: getConnectionIndex(
|
|
13556
13557
|
`${taskId}|${ownTarget}|out`
|
|
13557
13558
|
),
|
|
@@ -13650,7 +13651,7 @@ const TaskGanttContentInner = (props) => {
|
|
|
13650
13651
|
rtl,
|
|
13651
13652
|
onArrowDoubleClick,
|
|
13652
13653
|
onArrowClick,
|
|
13653
|
-
isActive: activeArrowKey === `${source.id}|${taskId}
|
|
13654
|
+
isActive: activeArrowKey === `${source.id}|${taskId}` || activeTaskId === source.id || activeTaskId === taskId,
|
|
13654
13655
|
fromConnectionIndex: getConnectionIndex(
|
|
13655
13656
|
`${source.id}|${sourceTarget}|out`
|
|
13656
13657
|
),
|
|
@@ -13710,6 +13711,7 @@ const TaskGanttContentInner = (props) => {
|
|
|
13710
13711
|
onArrowDoubleClick,
|
|
13711
13712
|
onArrowClick,
|
|
13712
13713
|
activeArrowKey,
|
|
13714
|
+
activeTaskId,
|
|
13713
13715
|
showProgress,
|
|
13714
13716
|
progressColor
|
|
13715
13717
|
]);
|
|
@@ -19330,13 +19332,15 @@ const GanttLoaderInner = ({ loading }) => {
|
|
|
19330
19332
|
return /* @__PURE__ */ jsx("div", { className: `${styles$1.loader} ${loading ? "" : styles$1.loaderHidden}` });
|
|
19331
19333
|
};
|
|
19332
19334
|
const GanttLoader = memo(GanttLoaderInner);
|
|
19333
|
-
const overlay = "
|
|
19334
|
-
const drawer = "
|
|
19335
|
-
const drawer_open = "
|
|
19336
|
-
const header = "
|
|
19337
|
-
const title = "
|
|
19338
|
-
const closeButton = "
|
|
19339
|
-
const body = "
|
|
19335
|
+
const overlay = "_overlay_hyem8_1";
|
|
19336
|
+
const drawer = "_drawer_hyem8_19";
|
|
19337
|
+
const drawer_open = "_drawer_open_hyem8_51";
|
|
19338
|
+
const header = "_header_hyem8_59";
|
|
19339
|
+
const title = "_title_hyem8_77";
|
|
19340
|
+
const closeButton = "_closeButton_hyem8_97";
|
|
19341
|
+
const body = "_body_hyem8_131";
|
|
19342
|
+
const goToTaskBar = "_goToTaskBar_hyem8_145";
|
|
19343
|
+
const goToTaskButton = "_goToTaskButton_hyem8_159";
|
|
19340
19344
|
const styles = {
|
|
19341
19345
|
overlay,
|
|
19342
19346
|
drawer,
|
|
@@ -19344,12 +19348,15 @@ const styles = {
|
|
|
19344
19348
|
header,
|
|
19345
19349
|
title,
|
|
19346
19350
|
closeButton,
|
|
19347
|
-
body
|
|
19351
|
+
body,
|
|
19352
|
+
goToTaskBar,
|
|
19353
|
+
goToTaskButton
|
|
19348
19354
|
};
|
|
19349
19355
|
const GanttDrawerInner = ({
|
|
19350
19356
|
data,
|
|
19351
19357
|
width,
|
|
19352
19358
|
onClose,
|
|
19359
|
+
onGoToTask,
|
|
19353
19360
|
renderContent
|
|
19354
19361
|
}) => {
|
|
19355
19362
|
const handleOverlayClick = useCallback(
|
|
@@ -19360,6 +19367,12 @@ const GanttDrawerInner = ({
|
|
|
19360
19367
|
[onClose]
|
|
19361
19368
|
);
|
|
19362
19369
|
const title2 = (data == null ? void 0 : data.type) === "task" ? data.task.name : (data == null ? void 0 : data.type) === "arrow" ? `${data.taskFrom.name} → ${data.taskTo.name}` : "";
|
|
19370
|
+
const goToTaskIds = [];
|
|
19371
|
+
if ((data == null ? void 0 : data.type) === "task") {
|
|
19372
|
+
goToTaskIds.push(data.task.id);
|
|
19373
|
+
} else if ((data == null ? void 0 : data.type) === "arrow") {
|
|
19374
|
+
goToTaskIds.push(data.taskFrom.id, data.taskTo.id);
|
|
19375
|
+
}
|
|
19363
19376
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
19364
19377
|
data && /* @__PURE__ */ jsx("div", { className: styles.overlay, onClick: handleOverlayClick }),
|
|
19365
19378
|
/* @__PURE__ */ jsxs(
|
|
@@ -19389,7 +19402,78 @@ const GanttDrawerInner = ({
|
|
|
19389
19402
|
}
|
|
19390
19403
|
)
|
|
19391
19404
|
] }),
|
|
19392
|
-
/* @__PURE__ */
|
|
19405
|
+
/* @__PURE__ */ jsxs("div", { className: styles.body, children: [
|
|
19406
|
+
data && onGoToTask && /* @__PURE__ */ jsxs("div", { className: styles.goToTaskBar, children: [
|
|
19407
|
+
data.type === "task" && /* @__PURE__ */ jsxs(
|
|
19408
|
+
"button",
|
|
19409
|
+
{
|
|
19410
|
+
className: styles.goToTaskButton,
|
|
19411
|
+
onClick: () => onGoToTask(data.task.id),
|
|
19412
|
+
type: "button",
|
|
19413
|
+
children: [
|
|
19414
|
+
/* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", children: /* @__PURE__ */ jsx(
|
|
19415
|
+
"path",
|
|
19416
|
+
{
|
|
19417
|
+
d: "M2 7h10M8 3l4 4-4 4",
|
|
19418
|
+
stroke: "currentColor",
|
|
19419
|
+
strokeWidth: "1.5",
|
|
19420
|
+
strokeLinecap: "round",
|
|
19421
|
+
strokeLinejoin: "round"
|
|
19422
|
+
}
|
|
19423
|
+
) }),
|
|
19424
|
+
"Go to Task"
|
|
19425
|
+
]
|
|
19426
|
+
}
|
|
19427
|
+
),
|
|
19428
|
+
data.type === "arrow" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
19429
|
+
/* @__PURE__ */ jsxs(
|
|
19430
|
+
"button",
|
|
19431
|
+
{
|
|
19432
|
+
className: styles.goToTaskButton,
|
|
19433
|
+
onClick: () => onGoToTask(data.taskFrom.id),
|
|
19434
|
+
type: "button",
|
|
19435
|
+
children: [
|
|
19436
|
+
/* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", children: /* @__PURE__ */ jsx(
|
|
19437
|
+
"path",
|
|
19438
|
+
{
|
|
19439
|
+
d: "M2 7h10M8 3l4 4-4 4",
|
|
19440
|
+
stroke: "currentColor",
|
|
19441
|
+
strokeWidth: "1.5",
|
|
19442
|
+
strokeLinecap: "round",
|
|
19443
|
+
strokeLinejoin: "round"
|
|
19444
|
+
}
|
|
19445
|
+
) }),
|
|
19446
|
+
"Go to ",
|
|
19447
|
+
data.taskFrom.name
|
|
19448
|
+
]
|
|
19449
|
+
}
|
|
19450
|
+
),
|
|
19451
|
+
/* @__PURE__ */ jsxs(
|
|
19452
|
+
"button",
|
|
19453
|
+
{
|
|
19454
|
+
className: styles.goToTaskButton,
|
|
19455
|
+
onClick: () => onGoToTask(data.taskTo.id),
|
|
19456
|
+
type: "button",
|
|
19457
|
+
children: [
|
|
19458
|
+
/* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", children: /* @__PURE__ */ jsx(
|
|
19459
|
+
"path",
|
|
19460
|
+
{
|
|
19461
|
+
d: "M2 7h10M8 3l4 4-4 4",
|
|
19462
|
+
stroke: "currentColor",
|
|
19463
|
+
strokeWidth: "1.5",
|
|
19464
|
+
strokeLinecap: "round",
|
|
19465
|
+
strokeLinejoin: "round"
|
|
19466
|
+
}
|
|
19467
|
+
) }),
|
|
19468
|
+
"Go to ",
|
|
19469
|
+
data.taskTo.name
|
|
19470
|
+
]
|
|
19471
|
+
}
|
|
19472
|
+
)
|
|
19473
|
+
] })
|
|
19474
|
+
] }),
|
|
19475
|
+
data && renderContent ? renderContent(data) : null
|
|
19476
|
+
] })
|
|
19393
19477
|
]
|
|
19394
19478
|
}
|
|
19395
19479
|
)
|
|
@@ -19464,6 +19548,7 @@ const Gantt = (props) => {
|
|
|
19464
19548
|
const renderDrawerContent = drawerProps == null ? void 0 : drawerProps.renderDrawerContent;
|
|
19465
19549
|
const [drawerData, setDrawerData] = useState(null);
|
|
19466
19550
|
const [activeArrowKey, setActiveArrowKey] = useState(null);
|
|
19551
|
+
const [activeTaskId, setActiveTaskId] = useState(null);
|
|
19467
19552
|
const taskBar = useMemo(() => {
|
|
19468
19553
|
return mergeDeepObj(
|
|
19469
19554
|
{},
|
|
@@ -20557,6 +20642,7 @@ const Gantt = (props) => {
|
|
|
20557
20642
|
(taskFrom, taskTo) => {
|
|
20558
20643
|
if (enableDrawer) {
|
|
20559
20644
|
setActiveArrowKey(`${taskFrom.id}|${taskTo.id}`);
|
|
20645
|
+
setActiveTaskId(null);
|
|
20560
20646
|
setDrawerData({ type: "arrow", taskFrom, taskTo });
|
|
20561
20647
|
}
|
|
20562
20648
|
if (taskBar.onArrowClick) {
|
|
@@ -20569,6 +20655,7 @@ const Gantt = (props) => {
|
|
|
20569
20655
|
(task, _event) => {
|
|
20570
20656
|
if (enableDrawer) {
|
|
20571
20657
|
setActiveArrowKey(null);
|
|
20658
|
+
setActiveTaskId(task.id);
|
|
20572
20659
|
setDrawerData({ type: "task", task });
|
|
20573
20660
|
}
|
|
20574
20661
|
if (taskBar.onClick) {
|
|
@@ -20580,7 +20667,51 @@ const Gantt = (props) => {
|
|
|
20580
20667
|
const handleDrawerClose = useCallback(() => {
|
|
20581
20668
|
setDrawerData(null);
|
|
20582
20669
|
setActiveArrowKey(null);
|
|
20670
|
+
setActiveTaskId(null);
|
|
20583
20671
|
}, []);
|
|
20672
|
+
const handleGoToTask = useCallback(
|
|
20673
|
+
(taskId) => {
|
|
20674
|
+
for (const [comparisonLevel, levelMap] of tasksMap) {
|
|
20675
|
+
const task = levelMap.get(taskId);
|
|
20676
|
+
if (!task || task.type === "empty")
|
|
20677
|
+
continue;
|
|
20678
|
+
const { x1 } = getTaskCoordinates(task, mapTaskToCoordinates);
|
|
20679
|
+
setScrollXProgrammatically(Math.max(0, x1 - 100));
|
|
20680
|
+
const rowIndexMap = taskToRowIndexMap.get(comparisonLevel);
|
|
20681
|
+
if (rowIndexMap) {
|
|
20682
|
+
const rowIndex = rowIndexMap.get(taskId);
|
|
20683
|
+
if (typeof rowIndex === "number") {
|
|
20684
|
+
const targetScrollY = rowIndex * fullRowHeight - ganttHeight / 2 + fullRowHeight / 2;
|
|
20685
|
+
setScrollYProgrammatically(
|
|
20686
|
+
Math.max(
|
|
20687
|
+
0,
|
|
20688
|
+
Math.min(targetScrollY, ganttFullHeight - ganttHeight)
|
|
20689
|
+
)
|
|
20690
|
+
);
|
|
20691
|
+
}
|
|
20692
|
+
}
|
|
20693
|
+
selectTask(taskId);
|
|
20694
|
+
if (onSelectTaskIds) {
|
|
20695
|
+
onSelectTaskIds([taskId]);
|
|
20696
|
+
}
|
|
20697
|
+
break;
|
|
20698
|
+
}
|
|
20699
|
+
handleDrawerClose();
|
|
20700
|
+
},
|
|
20701
|
+
[
|
|
20702
|
+
tasksMap,
|
|
20703
|
+
mapTaskToCoordinates,
|
|
20704
|
+
taskToRowIndexMap,
|
|
20705
|
+
fullRowHeight,
|
|
20706
|
+
ganttHeight,
|
|
20707
|
+
ganttFullHeight,
|
|
20708
|
+
setScrollXProgrammatically,
|
|
20709
|
+
setScrollYProgrammatically,
|
|
20710
|
+
selectTask,
|
|
20711
|
+
onSelectTaskIds,
|
|
20712
|
+
handleDrawerClose
|
|
20713
|
+
]
|
|
20714
|
+
);
|
|
20584
20715
|
const handleAction = useHandleAction({
|
|
20585
20716
|
checkTaskIdExists,
|
|
20586
20717
|
childTasksMap,
|
|
@@ -20796,6 +20927,7 @@ const Gantt = (props) => {
|
|
|
20796
20927
|
onArrowDoubleClick,
|
|
20797
20928
|
onArrowClick: enableDrawer ? onArrowClick : taskBar.onArrowClick,
|
|
20798
20929
|
activeArrowKey,
|
|
20930
|
+
activeTaskId,
|
|
20799
20931
|
renderedRowIndexes,
|
|
20800
20932
|
rtl,
|
|
20801
20933
|
selectTaskOnMouseDown,
|
|
@@ -20835,6 +20967,7 @@ const Gantt = (props) => {
|
|
|
20835
20967
|
onArrowDoubleClick,
|
|
20836
20968
|
onArrowClick,
|
|
20837
20969
|
activeArrowKey,
|
|
20970
|
+
activeTaskId,
|
|
20838
20971
|
enableDrawer,
|
|
20839
20972
|
handleTaskClick,
|
|
20840
20973
|
renderedRowIndexes,
|
|
@@ -21010,6 +21143,7 @@ const Gantt = (props) => {
|
|
|
21010
21143
|
data: drawerData,
|
|
21011
21144
|
width: drawerWidth,
|
|
21012
21145
|
onClose: handleDrawerClose,
|
|
21146
|
+
onGoToTask: handleGoToTask,
|
|
21013
21147
|
renderContent: renderDrawerContent
|
|
21014
21148
|
}
|
|
21015
21149
|
)
|
|
@@ -13178,6 +13178,7 @@
|
|
|
13178
13178
|
onArrowDoubleClick,
|
|
13179
13179
|
onArrowClick,
|
|
13180
13180
|
activeArrowKey,
|
|
13181
|
+
activeTaskId,
|
|
13181
13182
|
onDoubleClick,
|
|
13182
13183
|
onClick,
|
|
13183
13184
|
renderedRowIndexes,
|
|
@@ -13482,7 +13483,7 @@
|
|
|
13482
13483
|
rtl,
|
|
13483
13484
|
onArrowDoubleClick,
|
|
13484
13485
|
onArrowClick,
|
|
13485
|
-
isActive: activeArrowKey === `${source.id}|${taskId}
|
|
13486
|
+
isActive: activeArrowKey === `${source.id}|${taskId}` || activeTaskId === source.id || activeTaskId === taskId,
|
|
13486
13487
|
fromConnectionIndex: getConnectionIndex(
|
|
13487
13488
|
`${source.id}|${sourceTarget}|out`
|
|
13488
13489
|
),
|
|
@@ -13568,7 +13569,7 @@
|
|
|
13568
13569
|
rtl,
|
|
13569
13570
|
onArrowDoubleClick,
|
|
13570
13571
|
onArrowClick,
|
|
13571
|
-
isActive: activeArrowKey === `${taskId}|${dependent.id}
|
|
13572
|
+
isActive: activeArrowKey === `${taskId}|${dependent.id}` || activeTaskId === taskId || activeTaskId === dependent.id,
|
|
13572
13573
|
fromConnectionIndex: getConnectionIndex(
|
|
13573
13574
|
`${taskId}|${ownTarget}|out`
|
|
13574
13575
|
),
|
|
@@ -13667,7 +13668,7 @@
|
|
|
13667
13668
|
rtl,
|
|
13668
13669
|
onArrowDoubleClick,
|
|
13669
13670
|
onArrowClick,
|
|
13670
|
-
isActive: activeArrowKey === `${source.id}|${taskId}
|
|
13671
|
+
isActive: activeArrowKey === `${source.id}|${taskId}` || activeTaskId === source.id || activeTaskId === taskId,
|
|
13671
13672
|
fromConnectionIndex: getConnectionIndex(
|
|
13672
13673
|
`${source.id}|${sourceTarget}|out`
|
|
13673
13674
|
),
|
|
@@ -13727,6 +13728,7 @@
|
|
|
13727
13728
|
onArrowDoubleClick,
|
|
13728
13729
|
onArrowClick,
|
|
13729
13730
|
activeArrowKey,
|
|
13731
|
+
activeTaskId,
|
|
13730
13732
|
showProgress,
|
|
13731
13733
|
progressColor
|
|
13732
13734
|
]);
|
|
@@ -19347,13 +19349,15 @@
|
|
|
19347
19349
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${styles$1.loader} ${loading ? "" : styles$1.loaderHidden}` });
|
|
19348
19350
|
};
|
|
19349
19351
|
const GanttLoader = React.memo(GanttLoaderInner);
|
|
19350
|
-
const overlay = "
|
|
19351
|
-
const drawer = "
|
|
19352
|
-
const drawer_open = "
|
|
19353
|
-
const header = "
|
|
19354
|
-
const title = "
|
|
19355
|
-
const closeButton = "
|
|
19356
|
-
const body = "
|
|
19352
|
+
const overlay = "_overlay_hyem8_1";
|
|
19353
|
+
const drawer = "_drawer_hyem8_19";
|
|
19354
|
+
const drawer_open = "_drawer_open_hyem8_51";
|
|
19355
|
+
const header = "_header_hyem8_59";
|
|
19356
|
+
const title = "_title_hyem8_77";
|
|
19357
|
+
const closeButton = "_closeButton_hyem8_97";
|
|
19358
|
+
const body = "_body_hyem8_131";
|
|
19359
|
+
const goToTaskBar = "_goToTaskBar_hyem8_145";
|
|
19360
|
+
const goToTaskButton = "_goToTaskButton_hyem8_159";
|
|
19357
19361
|
const styles = {
|
|
19358
19362
|
overlay,
|
|
19359
19363
|
drawer,
|
|
@@ -19361,12 +19365,15 @@
|
|
|
19361
19365
|
header,
|
|
19362
19366
|
title,
|
|
19363
19367
|
closeButton,
|
|
19364
|
-
body
|
|
19368
|
+
body,
|
|
19369
|
+
goToTaskBar,
|
|
19370
|
+
goToTaskButton
|
|
19365
19371
|
};
|
|
19366
19372
|
const GanttDrawerInner = ({
|
|
19367
19373
|
data,
|
|
19368
19374
|
width,
|
|
19369
19375
|
onClose,
|
|
19376
|
+
onGoToTask,
|
|
19370
19377
|
renderContent
|
|
19371
19378
|
}) => {
|
|
19372
19379
|
const handleOverlayClick = React.useCallback(
|
|
@@ -19377,6 +19384,12 @@
|
|
|
19377
19384
|
[onClose]
|
|
19378
19385
|
);
|
|
19379
19386
|
const title2 = (data == null ? void 0 : data.type) === "task" ? data.task.name : (data == null ? void 0 : data.type) === "arrow" ? `${data.taskFrom.name} → ${data.taskTo.name}` : "";
|
|
19387
|
+
const goToTaskIds = [];
|
|
19388
|
+
if ((data == null ? void 0 : data.type) === "task") {
|
|
19389
|
+
goToTaskIds.push(data.task.id);
|
|
19390
|
+
} else if ((data == null ? void 0 : data.type) === "arrow") {
|
|
19391
|
+
goToTaskIds.push(data.taskFrom.id, data.taskTo.id);
|
|
19392
|
+
}
|
|
19380
19393
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
19381
19394
|
data && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.overlay, onClick: handleOverlayClick }),
|
|
19382
19395
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -19406,7 +19419,78 @@
|
|
|
19406
19419
|
}
|
|
19407
19420
|
)
|
|
19408
19421
|
] }),
|
|
19409
|
-
/* @__PURE__ */ jsxRuntime.
|
|
19422
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.body, children: [
|
|
19423
|
+
data && onGoToTask && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.goToTaskBar, children: [
|
|
19424
|
+
data.type === "task" && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
19425
|
+
"button",
|
|
19426
|
+
{
|
|
19427
|
+
className: styles.goToTaskButton,
|
|
19428
|
+
onClick: () => onGoToTask(data.task.id),
|
|
19429
|
+
type: "button",
|
|
19430
|
+
children: [
|
|
19431
|
+
/* @__PURE__ */ jsxRuntime.jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
19432
|
+
"path",
|
|
19433
|
+
{
|
|
19434
|
+
d: "M2 7h10M8 3l4 4-4 4",
|
|
19435
|
+
stroke: "currentColor",
|
|
19436
|
+
strokeWidth: "1.5",
|
|
19437
|
+
strokeLinecap: "round",
|
|
19438
|
+
strokeLinejoin: "round"
|
|
19439
|
+
}
|
|
19440
|
+
) }),
|
|
19441
|
+
"Go to Task"
|
|
19442
|
+
]
|
|
19443
|
+
}
|
|
19444
|
+
),
|
|
19445
|
+
data.type === "arrow" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
19446
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
19447
|
+
"button",
|
|
19448
|
+
{
|
|
19449
|
+
className: styles.goToTaskButton,
|
|
19450
|
+
onClick: () => onGoToTask(data.taskFrom.id),
|
|
19451
|
+
type: "button",
|
|
19452
|
+
children: [
|
|
19453
|
+
/* @__PURE__ */ jsxRuntime.jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
19454
|
+
"path",
|
|
19455
|
+
{
|
|
19456
|
+
d: "M2 7h10M8 3l4 4-4 4",
|
|
19457
|
+
stroke: "currentColor",
|
|
19458
|
+
strokeWidth: "1.5",
|
|
19459
|
+
strokeLinecap: "round",
|
|
19460
|
+
strokeLinejoin: "round"
|
|
19461
|
+
}
|
|
19462
|
+
) }),
|
|
19463
|
+
"Go to ",
|
|
19464
|
+
data.taskFrom.name
|
|
19465
|
+
]
|
|
19466
|
+
}
|
|
19467
|
+
),
|
|
19468
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
19469
|
+
"button",
|
|
19470
|
+
{
|
|
19471
|
+
className: styles.goToTaskButton,
|
|
19472
|
+
onClick: () => onGoToTask(data.taskTo.id),
|
|
19473
|
+
type: "button",
|
|
19474
|
+
children: [
|
|
19475
|
+
/* @__PURE__ */ jsxRuntime.jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
19476
|
+
"path",
|
|
19477
|
+
{
|
|
19478
|
+
d: "M2 7h10M8 3l4 4-4 4",
|
|
19479
|
+
stroke: "currentColor",
|
|
19480
|
+
strokeWidth: "1.5",
|
|
19481
|
+
strokeLinecap: "round",
|
|
19482
|
+
strokeLinejoin: "round"
|
|
19483
|
+
}
|
|
19484
|
+
) }),
|
|
19485
|
+
"Go to ",
|
|
19486
|
+
data.taskTo.name
|
|
19487
|
+
]
|
|
19488
|
+
}
|
|
19489
|
+
)
|
|
19490
|
+
] })
|
|
19491
|
+
] }),
|
|
19492
|
+
data && renderContent ? renderContent(data) : null
|
|
19493
|
+
] })
|
|
19410
19494
|
]
|
|
19411
19495
|
}
|
|
19412
19496
|
)
|
|
@@ -19481,6 +19565,7 @@
|
|
|
19481
19565
|
const renderDrawerContent = drawerProps == null ? void 0 : drawerProps.renderDrawerContent;
|
|
19482
19566
|
const [drawerData, setDrawerData] = React.useState(null);
|
|
19483
19567
|
const [activeArrowKey, setActiveArrowKey] = React.useState(null);
|
|
19568
|
+
const [activeTaskId, setActiveTaskId] = React.useState(null);
|
|
19484
19569
|
const taskBar = React.useMemo(() => {
|
|
19485
19570
|
return mergeDeepObj(
|
|
19486
19571
|
{},
|
|
@@ -20574,6 +20659,7 @@
|
|
|
20574
20659
|
(taskFrom, taskTo) => {
|
|
20575
20660
|
if (enableDrawer) {
|
|
20576
20661
|
setActiveArrowKey(`${taskFrom.id}|${taskTo.id}`);
|
|
20662
|
+
setActiveTaskId(null);
|
|
20577
20663
|
setDrawerData({ type: "arrow", taskFrom, taskTo });
|
|
20578
20664
|
}
|
|
20579
20665
|
if (taskBar.onArrowClick) {
|
|
@@ -20586,6 +20672,7 @@
|
|
|
20586
20672
|
(task, _event) => {
|
|
20587
20673
|
if (enableDrawer) {
|
|
20588
20674
|
setActiveArrowKey(null);
|
|
20675
|
+
setActiveTaskId(task.id);
|
|
20589
20676
|
setDrawerData({ type: "task", task });
|
|
20590
20677
|
}
|
|
20591
20678
|
if (taskBar.onClick) {
|
|
@@ -20597,7 +20684,51 @@
|
|
|
20597
20684
|
const handleDrawerClose = React.useCallback(() => {
|
|
20598
20685
|
setDrawerData(null);
|
|
20599
20686
|
setActiveArrowKey(null);
|
|
20687
|
+
setActiveTaskId(null);
|
|
20600
20688
|
}, []);
|
|
20689
|
+
const handleGoToTask = React.useCallback(
|
|
20690
|
+
(taskId) => {
|
|
20691
|
+
for (const [comparisonLevel, levelMap] of tasksMap) {
|
|
20692
|
+
const task = levelMap.get(taskId);
|
|
20693
|
+
if (!task || task.type === "empty")
|
|
20694
|
+
continue;
|
|
20695
|
+
const { x1 } = getTaskCoordinates(task, mapTaskToCoordinates);
|
|
20696
|
+
setScrollXProgrammatically(Math.max(0, x1 - 100));
|
|
20697
|
+
const rowIndexMap = taskToRowIndexMap.get(comparisonLevel);
|
|
20698
|
+
if (rowIndexMap) {
|
|
20699
|
+
const rowIndex = rowIndexMap.get(taskId);
|
|
20700
|
+
if (typeof rowIndex === "number") {
|
|
20701
|
+
const targetScrollY = rowIndex * fullRowHeight - ganttHeight / 2 + fullRowHeight / 2;
|
|
20702
|
+
setScrollYProgrammatically(
|
|
20703
|
+
Math.max(
|
|
20704
|
+
0,
|
|
20705
|
+
Math.min(targetScrollY, ganttFullHeight - ganttHeight)
|
|
20706
|
+
)
|
|
20707
|
+
);
|
|
20708
|
+
}
|
|
20709
|
+
}
|
|
20710
|
+
selectTask(taskId);
|
|
20711
|
+
if (onSelectTaskIds) {
|
|
20712
|
+
onSelectTaskIds([taskId]);
|
|
20713
|
+
}
|
|
20714
|
+
break;
|
|
20715
|
+
}
|
|
20716
|
+
handleDrawerClose();
|
|
20717
|
+
},
|
|
20718
|
+
[
|
|
20719
|
+
tasksMap,
|
|
20720
|
+
mapTaskToCoordinates,
|
|
20721
|
+
taskToRowIndexMap,
|
|
20722
|
+
fullRowHeight,
|
|
20723
|
+
ganttHeight,
|
|
20724
|
+
ganttFullHeight,
|
|
20725
|
+
setScrollXProgrammatically,
|
|
20726
|
+
setScrollYProgrammatically,
|
|
20727
|
+
selectTask,
|
|
20728
|
+
onSelectTaskIds,
|
|
20729
|
+
handleDrawerClose
|
|
20730
|
+
]
|
|
20731
|
+
);
|
|
20601
20732
|
const handleAction = useHandleAction({
|
|
20602
20733
|
checkTaskIdExists,
|
|
20603
20734
|
childTasksMap,
|
|
@@ -20813,6 +20944,7 @@
|
|
|
20813
20944
|
onArrowDoubleClick,
|
|
20814
20945
|
onArrowClick: enableDrawer ? onArrowClick : taskBar.onArrowClick,
|
|
20815
20946
|
activeArrowKey,
|
|
20947
|
+
activeTaskId,
|
|
20816
20948
|
renderedRowIndexes,
|
|
20817
20949
|
rtl,
|
|
20818
20950
|
selectTaskOnMouseDown,
|
|
@@ -20852,6 +20984,7 @@
|
|
|
20852
20984
|
onArrowDoubleClick,
|
|
20853
20985
|
onArrowClick,
|
|
20854
20986
|
activeArrowKey,
|
|
20987
|
+
activeTaskId,
|
|
20855
20988
|
enableDrawer,
|
|
20856
20989
|
handleTaskClick,
|
|
20857
20990
|
renderedRowIndexes,
|
|
@@ -21027,6 +21160,7 @@
|
|
|
21027
21160
|
data: drawerData,
|
|
21028
21161
|
width: drawerWidth,
|
|
21029
21162
|
onClose: handleDrawerClose,
|
|
21163
|
+
onGoToTask: handleGoToTask,
|
|
21030
21164
|
renderContent: renderDrawerContent
|
|
21031
21165
|
}
|
|
21032
21166
|
)
|
package/dist/style.css
CHANGED
|
@@ -728,7 +728,7 @@
|
|
|
728
728
|
._loaderHidden_covn4_49 {
|
|
729
729
|
display: none;
|
|
730
730
|
}
|
|
731
|
-
.
|
|
731
|
+
._overlay_hyem8_1 {
|
|
732
732
|
position: absolute;
|
|
733
733
|
top: 0;
|
|
734
734
|
left: 0;
|
|
@@ -737,7 +737,7 @@
|
|
|
737
737
|
z-index: 998;
|
|
738
738
|
}
|
|
739
739
|
|
|
740
|
-
.
|
|
740
|
+
._drawer_hyem8_19 {
|
|
741
741
|
position: absolute;
|
|
742
742
|
top: 0;
|
|
743
743
|
right: 0;
|
|
@@ -753,11 +753,11 @@
|
|
|
753
753
|
transition: transform 0.25s ease;
|
|
754
754
|
}
|
|
755
755
|
|
|
756
|
-
.
|
|
756
|
+
._drawer_open_hyem8_51 {
|
|
757
757
|
transform: translateX(0);
|
|
758
758
|
}
|
|
759
759
|
|
|
760
|
-
.
|
|
760
|
+
._header_hyem8_59 {
|
|
761
761
|
display: flex;
|
|
762
762
|
align-items: center;
|
|
763
763
|
justify-content: space-between;
|
|
@@ -766,7 +766,7 @@
|
|
|
766
766
|
flex-shrink: 0;
|
|
767
767
|
}
|
|
768
768
|
|
|
769
|
-
.
|
|
769
|
+
._title_hyem8_77 {
|
|
770
770
|
font-weight: 600;
|
|
771
771
|
font-size: 14px;
|
|
772
772
|
color: var(--gantt-drawer-title-color, #333);
|
|
@@ -776,7 +776,7 @@
|
|
|
776
776
|
white-space: nowrap;
|
|
777
777
|
}
|
|
778
778
|
|
|
779
|
-
.
|
|
779
|
+
._closeButton_hyem8_97 {
|
|
780
780
|
background: none;
|
|
781
781
|
border: none;
|
|
782
782
|
cursor: pointer;
|
|
@@ -789,13 +789,43 @@
|
|
|
789
789
|
transition: background 0.15s ease;
|
|
790
790
|
}
|
|
791
791
|
|
|
792
|
-
.
|
|
792
|
+
._closeButton_hyem8_97:hover {
|
|
793
793
|
background: var(--gantt-drawer-close-hover-bg, #f0f0f0);
|
|
794
794
|
}
|
|
795
795
|
|
|
796
|
-
.
|
|
796
|
+
._body_hyem8_131 {
|
|
797
797
|
flex: 1;
|
|
798
798
|
overflow-y: auto;
|
|
799
799
|
overflow-x: hidden;
|
|
800
800
|
padding: 16px;
|
|
801
801
|
}
|
|
802
|
+
|
|
803
|
+
._goToTaskBar_hyem8_145 {
|
|
804
|
+
display: flex;
|
|
805
|
+
flex-wrap: wrap;
|
|
806
|
+
gap: 8px;
|
|
807
|
+
margin-bottom: 12px;
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
._goToTaskButton_hyem8_159 {
|
|
811
|
+
display: inline-flex;
|
|
812
|
+
align-items: center;
|
|
813
|
+
gap: 6px;
|
|
814
|
+
padding: 6px 12px;
|
|
815
|
+
font-size: 12px;
|
|
816
|
+
font-weight: 500;
|
|
817
|
+
color: var(--gantt-drawer-go-to-color, #1976d2);
|
|
818
|
+
background: var(--gantt-drawer-go-to-bg, #e3f2fd);
|
|
819
|
+
border: 1px solid var(--gantt-drawer-go-to-border, #90caf9);
|
|
820
|
+
border-radius: 4px;
|
|
821
|
+
cursor: pointer;
|
|
822
|
+
white-space: nowrap;
|
|
823
|
+
overflow: hidden;
|
|
824
|
+
text-overflow: ellipsis;
|
|
825
|
+
max-width: 100%;
|
|
826
|
+
transition: background 0.15s ease;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
._goToTaskButton_hyem8_159:hover {
|
|
830
|
+
background: var(--gantt-drawer-go-to-hover-bg, #bbdefb);
|
|
831
|
+
}
|
package/package.json
CHANGED