gantt-task-react-v 1.4.7 → 1.4.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.
- package/dist/components/gantt/task-gantt-content.d.ts +1 -0
- package/dist/components/other/gantt-drawer.d.ts +1 -0
- package/dist/components/task-list/column-visibility-toggle/index.d.ts +8 -0
- package/dist/components/task-list/index.d.ts +3 -1
- package/dist/gantt-task-react.es.js +316 -30
- package/dist/gantt-task-react.umd.js +316 -30
- package/dist/index.d.ts +2 -1
- package/dist/style.css +151 -8
- package/dist/types/internal-types.d.ts +3 -0
- package/dist/types/public-types.d.ts +13 -0
- package/package.json +1 -1
|
@@ -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>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Column } from "../../../types";
|
|
3
|
+
interface ColumnVisibilityToggleProps {
|
|
4
|
+
allColumns: readonly Column[];
|
|
5
|
+
onColumnVisibilityChange?: (columnId: string, hidden: boolean) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const ColumnVisibilityToggle: React.NamedExoticComponent<ColumnVisibilityToggleProps>;
|
|
8
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { MouseEvent, RefObject } from "react";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import { AllowReorderTask, ChildByLevelMap, Column, DateSetup, DependencyMap, Distances, GanttRenderIconsProps, MapTaskToNestedIndex, OnResizeColumn, Task, RenderTask, TableRenderBottomProps } from "../../types";
|
|
3
|
+
import { AllowReorderTask, ChildByLevelMap, Column, DateSetup, DependencyMap, Distances, GanttRenderIconsProps, MapTaskToNestedIndex, OnColumnVisibilityChange, OnResizeColumn, Task, RenderTask, TableRenderBottomProps } from "../../types";
|
|
4
4
|
export type TaskListProps = {
|
|
5
5
|
ganttRef: RefObject<HTMLDivElement>;
|
|
6
6
|
/** Ref to the horizontal scroll wrapper (used for containing popups) */
|
|
@@ -39,6 +39,8 @@ export type TaskListProps = {
|
|
|
39
39
|
taskListRef: RefObject<HTMLDivElement>;
|
|
40
40
|
tasks: readonly RenderTask[];
|
|
41
41
|
onResizeColumn?: OnResizeColumn;
|
|
42
|
+
canToggleColumns?: boolean;
|
|
43
|
+
onColumnVisibilityChange?: OnColumnVisibilityChange;
|
|
42
44
|
tableBottom?: TableRenderBottomProps;
|
|
43
45
|
};
|
|
44
46
|
export declare const TaskList: React.NamedExoticComponent<TaskListProps>;
|
|
@@ -4589,7 +4589,7 @@ const tooltipDefaultContainerTexts = "_tooltipDefaultContainerTexts_16o9s_17";
|
|
|
4589
4589
|
const tooltipDefaultContainerParagraph = "_tooltipDefaultContainerParagraph_16o9s_31";
|
|
4590
4590
|
const tooltipDetailsContainer = "_tooltipDetailsContainer_16o9s_47";
|
|
4591
4591
|
const tooltipDetailsContainerHidden = "_tooltipDetailsContainerHidden_16o9s_71";
|
|
4592
|
-
const styles$
|
|
4592
|
+
const styles$n = {
|
|
4593
4593
|
tooltipDefaultContainer,
|
|
4594
4594
|
tooltipDefaultContainerTexts,
|
|
4595
4595
|
tooltipDefaultContainerParagraph,
|
|
@@ -4632,26 +4632,26 @@ const StandardTooltipContent = ({ task }) => {
|
|
|
4632
4632
|
return /* @__PURE__ */ jsxs(
|
|
4633
4633
|
"div",
|
|
4634
4634
|
{
|
|
4635
|
-
className: styles$
|
|
4635
|
+
className: styles$n.tooltipDefaultContainer,
|
|
4636
4636
|
style: { fontSize: "var(--gantt-font-size)" },
|
|
4637
4637
|
children: [
|
|
4638
4638
|
/* @__PURE__ */ jsx("b", { style: { fontSize: "var(--gantt-font-size)" }, children: `${task.name}: ${task.start.getDate()}-${task.start.getMonth() + 1}-${task.start.getFullYear()} - ${task.end.getDate()}-${task.end.getMonth() + 1}-${task.end.getFullYear()}` }),
|
|
4639
|
-
/* @__PURE__ */ jsxs("div", { className: styles$
|
|
4639
|
+
/* @__PURE__ */ jsxs("div", { className: styles$n.tooltipDefaultContainerTexts, children: [
|
|
4640
4640
|
task.end.getTime() - task.start.getTime() !== 0 && /* @__PURE__ */ jsx(
|
|
4641
4641
|
"p",
|
|
4642
4642
|
{
|
|
4643
|
-
className: styles$
|
|
4643
|
+
className: styles$n.tooltipDefaultContainerParagraph,
|
|
4644
4644
|
children: `${locale.tooltip.duration},: ${~~((task.end.getTime() - task.start.getTime()) / (1e3 * 60 * 60 * 24))} ${locale.suffix.days}`
|
|
4645
4645
|
}
|
|
4646
4646
|
),
|
|
4647
|
-
!!locale.tooltip.progress && /* @__PURE__ */ jsx("p", { className: styles$
|
|
4647
|
+
!!locale.tooltip.progress && /* @__PURE__ */ jsx("p", { className: styles$n.tooltipDefaultContainerParagraph, children: !!task.progress && `${locale.tooltip.progress}: ${task.progress} %` })
|
|
4648
4648
|
] })
|
|
4649
4649
|
]
|
|
4650
4650
|
}
|
|
4651
4651
|
);
|
|
4652
4652
|
};
|
|
4653
4653
|
const scroll = "_scroll_hp3qb_1";
|
|
4654
|
-
const styles$
|
|
4654
|
+
const styles$m = {
|
|
4655
4655
|
scroll
|
|
4656
4656
|
};
|
|
4657
4657
|
const VerticalScroll = ({
|
|
@@ -4672,7 +4672,7 @@ const VerticalScroll = ({
|
|
|
4672
4672
|
marginLeft: rtl ? void 0 : "-1rem",
|
|
4673
4673
|
pointerEvents: isChangeInProgress ? "none" : void 0
|
|
4674
4674
|
},
|
|
4675
|
-
className: styles$
|
|
4675
|
+
className: styles$m.scroll,
|
|
4676
4676
|
onScroll,
|
|
4677
4677
|
ref: verticalScrollbarRef,
|
|
4678
4678
|
children: /* @__PURE__ */ jsx("div", { style: { height: ganttFullHeight, width: 1 } })
|
|
@@ -4750,7 +4750,7 @@ const dragging = "_dragging_16z6n_15";
|
|
|
4750
4750
|
const taskListExpander = "_taskListExpander_16z6n_23";
|
|
4751
4751
|
const taskListEmptyExpander = "_taskListEmptyExpander_16z6n_45";
|
|
4752
4752
|
const taskName = "_taskName_16z6n_55";
|
|
4753
|
-
const styles$
|
|
4753
|
+
const styles$l = {
|
|
4754
4754
|
taskListNameWrapper,
|
|
4755
4755
|
dragging,
|
|
4756
4756
|
taskListExpander,
|
|
@@ -4827,7 +4827,7 @@ const TitleColumn = ({
|
|
|
4827
4827
|
"div",
|
|
4828
4828
|
{
|
|
4829
4829
|
"data-testid": `title-table-cell-${name}`,
|
|
4830
|
-
className: `${styles$
|
|
4830
|
+
className: `${styles$l.taskListNameWrapper}`,
|
|
4831
4831
|
style: {
|
|
4832
4832
|
paddingLeft: depth * nestedTaskNameOffset
|
|
4833
4833
|
},
|
|
@@ -4836,7 +4836,7 @@ const TitleColumn = ({
|
|
|
4836
4836
|
/* @__PURE__ */ jsx(
|
|
4837
4837
|
"div",
|
|
4838
4838
|
{
|
|
4839
|
-
className: `gantt-expander ${styles$
|
|
4839
|
+
className: `gantt-expander ${styles$l.taskListExpander} ${!hasChildren ? styles$l.taskListEmptyExpander : ""}`,
|
|
4840
4840
|
style: {
|
|
4841
4841
|
left: depth * nestedTaskNameOffset
|
|
4842
4842
|
},
|
|
@@ -4847,7 +4847,7 @@ const TitleColumn = ({
|
|
|
4847
4847
|
/* @__PURE__ */ jsxs(
|
|
4848
4848
|
"div",
|
|
4849
4849
|
{
|
|
4850
|
-
className: styles$
|
|
4850
|
+
className: styles$l.taskName,
|
|
4851
4851
|
style: { fontWeight: isProject ? "bold" : "regular" },
|
|
4852
4852
|
children: [
|
|
4853
4853
|
isShowTaskNumbers && /* @__PURE__ */ jsxs("b", { children: [
|
|
@@ -4902,7 +4902,7 @@ const DependenciesColumn = ({
|
|
|
4902
4902
|
return /* @__PURE__ */ jsx(Fragment, { children: dependencies.map(({ name }) => name).join(", ") });
|
|
4903
4903
|
};
|
|
4904
4904
|
const button = "_button_l55x0_1";
|
|
4905
|
-
const styles$
|
|
4905
|
+
const styles$k = {
|
|
4906
4906
|
button
|
|
4907
4907
|
};
|
|
4908
4908
|
const DeleteIcon = (props) => /* @__PURE__ */ jsxs(
|
|
@@ -4936,7 +4936,7 @@ const DeleteColumn = ({
|
|
|
4936
4936
|
e.stopPropagation();
|
|
4937
4937
|
},
|
|
4938
4938
|
onClick,
|
|
4939
|
-
className: styles$
|
|
4939
|
+
className: styles$k.button,
|
|
4940
4940
|
children: (icons == null ? void 0 : icons.renderDeleteIcon) ? icons.renderDeleteIcon() : /* @__PURE__ */ jsx(DeleteIcon, {})
|
|
4941
4941
|
}
|
|
4942
4942
|
);
|
|
@@ -4971,7 +4971,7 @@ const EditColumn = ({
|
|
|
4971
4971
|
e.stopPropagation();
|
|
4972
4972
|
},
|
|
4973
4973
|
onClick,
|
|
4974
|
-
className: styles$
|
|
4974
|
+
className: styles$k.button,
|
|
4975
4975
|
children: (icons == null ? void 0 : icons.renderEditIcon) ? icons.renderEditIcon() : /* @__PURE__ */ jsx(EditIcon, {})
|
|
4976
4976
|
}
|
|
4977
4977
|
);
|
|
@@ -5012,7 +5012,7 @@ const AddColumn = ({
|
|
|
5012
5012
|
e.stopPropagation();
|
|
5013
5013
|
},
|
|
5014
5014
|
onClick,
|
|
5015
|
-
className: styles$
|
|
5015
|
+
className: styles$k.button,
|
|
5016
5016
|
children: (icons == null ? void 0 : icons.renderAddIcon) ? icons.renderAddIcon() : /* @__PURE__ */ jsx(AddIcon, {})
|
|
5017
5017
|
}
|
|
5018
5018
|
);
|
|
@@ -5515,6 +5515,131 @@ const useTableListResize = (clientColumns, canMoveTasks, onResizeColumn, ganttRe
|
|
|
5515
5515
|
onColumnResizeStart
|
|
5516
5516
|
];
|
|
5517
5517
|
};
|
|
5518
|
+
const toggleWrapper = "_toggleWrapper_rjfhl_1";
|
|
5519
|
+
const toggleButton = "_toggleButton_rjfhl_15";
|
|
5520
|
+
const dropdown = "_dropdown_rjfhl_51";
|
|
5521
|
+
const dropdownItem = "_dropdownItem_rjfhl_85";
|
|
5522
|
+
const checkbox = "_checkbox_rjfhl_141";
|
|
5523
|
+
const columnLabel = "_columnLabel_rjfhl_157";
|
|
5524
|
+
const dropdownTitle = "_dropdownTitle_rjfhl_169";
|
|
5525
|
+
const divider = "_divider_rjfhl_211";
|
|
5526
|
+
const styles$j = {
|
|
5527
|
+
toggleWrapper,
|
|
5528
|
+
toggleButton,
|
|
5529
|
+
dropdown,
|
|
5530
|
+
dropdownItem,
|
|
5531
|
+
checkbox,
|
|
5532
|
+
columnLabel,
|
|
5533
|
+
dropdownTitle,
|
|
5534
|
+
divider
|
|
5535
|
+
};
|
|
5536
|
+
const ColumnsIcon = ({ className }) => /* @__PURE__ */ jsxs(
|
|
5537
|
+
"svg",
|
|
5538
|
+
{
|
|
5539
|
+
className,
|
|
5540
|
+
width: "16",
|
|
5541
|
+
height: "16",
|
|
5542
|
+
viewBox: "0 0 16 16",
|
|
5543
|
+
fill: "none",
|
|
5544
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5545
|
+
children: [
|
|
5546
|
+
/* @__PURE__ */ jsx(
|
|
5547
|
+
"path",
|
|
5548
|
+
{
|
|
5549
|
+
d: "M2 3.5h12M2 8h12M2 12.5h12",
|
|
5550
|
+
stroke: "currentColor",
|
|
5551
|
+
strokeWidth: "1.5",
|
|
5552
|
+
strokeLinecap: "round"
|
|
5553
|
+
}
|
|
5554
|
+
),
|
|
5555
|
+
/* @__PURE__ */ jsx(
|
|
5556
|
+
"path",
|
|
5557
|
+
{
|
|
5558
|
+
d: "M5 3.5v9M11 3.5v9",
|
|
5559
|
+
stroke: "currentColor",
|
|
5560
|
+
strokeWidth: "1.5",
|
|
5561
|
+
strokeLinecap: "round",
|
|
5562
|
+
strokeDasharray: "1 2"
|
|
5563
|
+
}
|
|
5564
|
+
)
|
|
5565
|
+
]
|
|
5566
|
+
}
|
|
5567
|
+
);
|
|
5568
|
+
const ColumnVisibilityToggleInner = ({
|
|
5569
|
+
allColumns,
|
|
5570
|
+
onColumnVisibilityChange
|
|
5571
|
+
}) => {
|
|
5572
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
5573
|
+
const wrapperRef = useRef(null);
|
|
5574
|
+
const toggleDropdown = useCallback(() => {
|
|
5575
|
+
setIsOpen((prev) => !prev);
|
|
5576
|
+
}, []);
|
|
5577
|
+
const handleToggle = useCallback(
|
|
5578
|
+
(columnId, currentlyHidden) => {
|
|
5579
|
+
if (onColumnVisibilityChange) {
|
|
5580
|
+
onColumnVisibilityChange(columnId, !currentlyHidden);
|
|
5581
|
+
}
|
|
5582
|
+
},
|
|
5583
|
+
[onColumnVisibilityChange]
|
|
5584
|
+
);
|
|
5585
|
+
useEffect(() => {
|
|
5586
|
+
if (!isOpen)
|
|
5587
|
+
return void 0;
|
|
5588
|
+
const handleClickOutside = (event) => {
|
|
5589
|
+
if (wrapperRef.current && !wrapperRef.current.contains(event.target)) {
|
|
5590
|
+
setIsOpen(false);
|
|
5591
|
+
}
|
|
5592
|
+
};
|
|
5593
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
5594
|
+
return () => {
|
|
5595
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
5596
|
+
};
|
|
5597
|
+
}, [isOpen]);
|
|
5598
|
+
const toggleableColumns = allColumns.filter((col) => col.title);
|
|
5599
|
+
if (toggleableColumns.length === 0) {
|
|
5600
|
+
return null;
|
|
5601
|
+
}
|
|
5602
|
+
return /* @__PURE__ */ jsxs("div", { className: styles$j.toggleWrapper, ref: wrapperRef, children: [
|
|
5603
|
+
/* @__PURE__ */ jsx(
|
|
5604
|
+
"button",
|
|
5605
|
+
{
|
|
5606
|
+
className: styles$j.toggleButton,
|
|
5607
|
+
onClick: toggleDropdown,
|
|
5608
|
+
title: "Toggle column visibility",
|
|
5609
|
+
type: "button",
|
|
5610
|
+
children: /* @__PURE__ */ jsx(ColumnsIcon, {})
|
|
5611
|
+
}
|
|
5612
|
+
),
|
|
5613
|
+
isOpen && /* @__PURE__ */ jsxs("div", { className: styles$j.dropdown, children: [
|
|
5614
|
+
/* @__PURE__ */ jsx("div", { className: styles$j.dropdownTitle, children: "Columns" }),
|
|
5615
|
+
/* @__PURE__ */ jsx("div", { className: styles$j.divider }),
|
|
5616
|
+
toggleableColumns.map((column) => {
|
|
5617
|
+
const isVisible = !column.hidden;
|
|
5618
|
+
return /* @__PURE__ */ jsxs(
|
|
5619
|
+
"label",
|
|
5620
|
+
{
|
|
5621
|
+
className: styles$j.dropdownItem,
|
|
5622
|
+
onClick: (e) => e.stopPropagation(),
|
|
5623
|
+
children: [
|
|
5624
|
+
/* @__PURE__ */ jsx(
|
|
5625
|
+
"input",
|
|
5626
|
+
{
|
|
5627
|
+
type: "checkbox",
|
|
5628
|
+
className: styles$j.checkbox,
|
|
5629
|
+
checked: isVisible,
|
|
5630
|
+
onChange: () => handleToggle(column.id, !!column.hidden)
|
|
5631
|
+
}
|
|
5632
|
+
),
|
|
5633
|
+
/* @__PURE__ */ jsx("span", { className: styles$j.columnLabel, children: column.title || column.id })
|
|
5634
|
+
]
|
|
5635
|
+
},
|
|
5636
|
+
column.id
|
|
5637
|
+
);
|
|
5638
|
+
})
|
|
5639
|
+
] })
|
|
5640
|
+
] });
|
|
5641
|
+
};
|
|
5642
|
+
const ColumnVisibilityToggle = memo(ColumnVisibilityToggleInner);
|
|
5518
5643
|
const ganttTable = "_ganttTable_5goa0_3";
|
|
5519
5644
|
const ganttTable_Header = "_ganttTable_Header_5goa0_15";
|
|
5520
5645
|
const ganttTable_HeaderMoveTask = "_ganttTable_HeaderMoveTask_5goa0_27";
|
|
@@ -5532,9 +5657,12 @@ const styles$i = {
|
|
|
5532
5657
|
const TaskListTableHeadersDefaultInner = ({
|
|
5533
5658
|
headerHeight,
|
|
5534
5659
|
columns,
|
|
5660
|
+
allColumns,
|
|
5535
5661
|
canResizeColumns,
|
|
5536
5662
|
canMoveTasks,
|
|
5537
|
-
|
|
5663
|
+
canToggleColumns,
|
|
5664
|
+
onColumnResizeStart,
|
|
5665
|
+
onColumnVisibilityChange
|
|
5538
5666
|
}) => {
|
|
5539
5667
|
const pinnedStyles = useMemo(() => {
|
|
5540
5668
|
const result = {};
|
|
@@ -5628,7 +5756,21 @@ const TaskListTableHeadersDefaultInner = ({
|
|
|
5628
5756
|
}
|
|
5629
5757
|
)
|
|
5630
5758
|
] }, index2);
|
|
5631
|
-
})
|
|
5759
|
+
}),
|
|
5760
|
+
canToggleColumns && /* @__PURE__ */ jsx(
|
|
5761
|
+
"div",
|
|
5762
|
+
{
|
|
5763
|
+
className: styles$i.ganttTable_HeaderItem,
|
|
5764
|
+
style: { minWidth: 28, maxWidth: 28 },
|
|
5765
|
+
children: /* @__PURE__ */ jsx(
|
|
5766
|
+
ColumnVisibilityToggle,
|
|
5767
|
+
{
|
|
5768
|
+
allColumns,
|
|
5769
|
+
onColumnVisibilityChange
|
|
5770
|
+
}
|
|
5771
|
+
)
|
|
5772
|
+
}
|
|
5773
|
+
)
|
|
5632
5774
|
]
|
|
5633
5775
|
}
|
|
5634
5776
|
)
|
|
@@ -10787,10 +10929,12 @@ const TaskListInner = ({
|
|
|
10787
10929
|
tasks,
|
|
10788
10930
|
onResizeColumn,
|
|
10789
10931
|
canReorderTasks,
|
|
10932
|
+
canToggleColumns,
|
|
10933
|
+
onColumnVisibilityChange,
|
|
10790
10934
|
tableBottom
|
|
10791
10935
|
}) => {
|
|
10792
10936
|
const [
|
|
10793
|
-
|
|
10937
|
+
allColumns,
|
|
10794
10938
|
taskListWidth,
|
|
10795
10939
|
tableWidth,
|
|
10796
10940
|
onTableResizeStart,
|
|
@@ -10801,6 +10945,10 @@ const TaskListInner = ({
|
|
|
10801
10945
|
onResizeColumn,
|
|
10802
10946
|
ganttRef
|
|
10803
10947
|
);
|
|
10948
|
+
const columns = useMemo(
|
|
10949
|
+
() => allColumns.filter((col) => !col.hidden),
|
|
10950
|
+
[allColumns]
|
|
10951
|
+
);
|
|
10804
10952
|
const renderedIndexes = useOptimizedList(
|
|
10805
10953
|
taskListContainerRef,
|
|
10806
10954
|
"scrollTop",
|
|
@@ -10885,7 +11033,10 @@ const TaskListInner = ({
|
|
|
10885
11033
|
canMoveTasks: canReorderTasks,
|
|
10886
11034
|
headerHeight: distances.headerHeight,
|
|
10887
11035
|
columns,
|
|
11036
|
+
allColumns,
|
|
11037
|
+
canToggleColumns: !!canToggleColumns,
|
|
10888
11038
|
onColumnResizeStart,
|
|
11039
|
+
onColumnVisibilityChange,
|
|
10889
11040
|
canResizeColumns
|
|
10890
11041
|
}
|
|
10891
11042
|
),
|
|
@@ -13161,6 +13312,7 @@ const TaskGanttContentInner = (props) => {
|
|
|
13161
13312
|
onArrowDoubleClick,
|
|
13162
13313
|
onArrowClick,
|
|
13163
13314
|
activeArrowKey,
|
|
13315
|
+
activeTaskId,
|
|
13164
13316
|
onDoubleClick,
|
|
13165
13317
|
onClick,
|
|
13166
13318
|
renderedRowIndexes,
|
|
@@ -13465,7 +13617,7 @@ const TaskGanttContentInner = (props) => {
|
|
|
13465
13617
|
rtl,
|
|
13466
13618
|
onArrowDoubleClick,
|
|
13467
13619
|
onArrowClick,
|
|
13468
|
-
isActive: activeArrowKey === `${source.id}|${taskId}
|
|
13620
|
+
isActive: activeArrowKey === `${source.id}|${taskId}` || activeTaskId === source.id || activeTaskId === taskId,
|
|
13469
13621
|
fromConnectionIndex: getConnectionIndex(
|
|
13470
13622
|
`${source.id}|${sourceTarget}|out`
|
|
13471
13623
|
),
|
|
@@ -13551,7 +13703,7 @@ const TaskGanttContentInner = (props) => {
|
|
|
13551
13703
|
rtl,
|
|
13552
13704
|
onArrowDoubleClick,
|
|
13553
13705
|
onArrowClick,
|
|
13554
|
-
isActive: activeArrowKey === `${taskId}|${dependent.id}
|
|
13706
|
+
isActive: activeArrowKey === `${taskId}|${dependent.id}` || activeTaskId === taskId || activeTaskId === dependent.id,
|
|
13555
13707
|
fromConnectionIndex: getConnectionIndex(
|
|
13556
13708
|
`${taskId}|${ownTarget}|out`
|
|
13557
13709
|
),
|
|
@@ -13650,7 +13802,7 @@ const TaskGanttContentInner = (props) => {
|
|
|
13650
13802
|
rtl,
|
|
13651
13803
|
onArrowDoubleClick,
|
|
13652
13804
|
onArrowClick,
|
|
13653
|
-
isActive: activeArrowKey === `${source.id}|${taskId}
|
|
13805
|
+
isActive: activeArrowKey === `${source.id}|${taskId}` || activeTaskId === source.id || activeTaskId === taskId,
|
|
13654
13806
|
fromConnectionIndex: getConnectionIndex(
|
|
13655
13807
|
`${source.id}|${sourceTarget}|out`
|
|
13656
13808
|
),
|
|
@@ -13710,6 +13862,7 @@ const TaskGanttContentInner = (props) => {
|
|
|
13710
13862
|
onArrowDoubleClick,
|
|
13711
13863
|
onArrowClick,
|
|
13712
13864
|
activeArrowKey,
|
|
13865
|
+
activeTaskId,
|
|
13713
13866
|
showProgress,
|
|
13714
13867
|
progressColor
|
|
13715
13868
|
]);
|
|
@@ -19330,13 +19483,15 @@ const GanttLoaderInner = ({ loading }) => {
|
|
|
19330
19483
|
return /* @__PURE__ */ jsx("div", { className: `${styles$1.loader} ${loading ? "" : styles$1.loaderHidden}` });
|
|
19331
19484
|
};
|
|
19332
19485
|
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 = "
|
|
19486
|
+
const overlay = "_overlay_hyem8_1";
|
|
19487
|
+
const drawer = "_drawer_hyem8_19";
|
|
19488
|
+
const drawer_open = "_drawer_open_hyem8_51";
|
|
19489
|
+
const header = "_header_hyem8_59";
|
|
19490
|
+
const title = "_title_hyem8_77";
|
|
19491
|
+
const closeButton = "_closeButton_hyem8_97";
|
|
19492
|
+
const body = "_body_hyem8_131";
|
|
19493
|
+
const goToTaskBar = "_goToTaskBar_hyem8_145";
|
|
19494
|
+
const goToTaskButton = "_goToTaskButton_hyem8_159";
|
|
19340
19495
|
const styles = {
|
|
19341
19496
|
overlay,
|
|
19342
19497
|
drawer,
|
|
@@ -19344,12 +19499,15 @@ const styles = {
|
|
|
19344
19499
|
header,
|
|
19345
19500
|
title,
|
|
19346
19501
|
closeButton,
|
|
19347
|
-
body
|
|
19502
|
+
body,
|
|
19503
|
+
goToTaskBar,
|
|
19504
|
+
goToTaskButton
|
|
19348
19505
|
};
|
|
19349
19506
|
const GanttDrawerInner = ({
|
|
19350
19507
|
data,
|
|
19351
19508
|
width,
|
|
19352
19509
|
onClose,
|
|
19510
|
+
onGoToTask,
|
|
19353
19511
|
renderContent
|
|
19354
19512
|
}) => {
|
|
19355
19513
|
const handleOverlayClick = useCallback(
|
|
@@ -19360,6 +19518,12 @@ const GanttDrawerInner = ({
|
|
|
19360
19518
|
[onClose]
|
|
19361
19519
|
);
|
|
19362
19520
|
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}` : "";
|
|
19521
|
+
const goToTaskIds = [];
|
|
19522
|
+
if ((data == null ? void 0 : data.type) === "task") {
|
|
19523
|
+
goToTaskIds.push(data.task.id);
|
|
19524
|
+
} else if ((data == null ? void 0 : data.type) === "arrow") {
|
|
19525
|
+
goToTaskIds.push(data.taskFrom.id, data.taskTo.id);
|
|
19526
|
+
}
|
|
19363
19527
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
19364
19528
|
data && /* @__PURE__ */ jsx("div", { className: styles.overlay, onClick: handleOverlayClick }),
|
|
19365
19529
|
/* @__PURE__ */ jsxs(
|
|
@@ -19389,7 +19553,78 @@ const GanttDrawerInner = ({
|
|
|
19389
19553
|
}
|
|
19390
19554
|
)
|
|
19391
19555
|
] }),
|
|
19392
|
-
/* @__PURE__ */
|
|
19556
|
+
/* @__PURE__ */ jsxs("div", { className: styles.body, children: [
|
|
19557
|
+
data && onGoToTask && /* @__PURE__ */ jsxs("div", { className: styles.goToTaskBar, children: [
|
|
19558
|
+
data.type === "task" && /* @__PURE__ */ jsxs(
|
|
19559
|
+
"button",
|
|
19560
|
+
{
|
|
19561
|
+
className: styles.goToTaskButton,
|
|
19562
|
+
onClick: () => onGoToTask(data.task.id),
|
|
19563
|
+
type: "button",
|
|
19564
|
+
children: [
|
|
19565
|
+
/* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", children: /* @__PURE__ */ jsx(
|
|
19566
|
+
"path",
|
|
19567
|
+
{
|
|
19568
|
+
d: "M2 7h10M8 3l4 4-4 4",
|
|
19569
|
+
stroke: "currentColor",
|
|
19570
|
+
strokeWidth: "1.5",
|
|
19571
|
+
strokeLinecap: "round",
|
|
19572
|
+
strokeLinejoin: "round"
|
|
19573
|
+
}
|
|
19574
|
+
) }),
|
|
19575
|
+
"Go to Task"
|
|
19576
|
+
]
|
|
19577
|
+
}
|
|
19578
|
+
),
|
|
19579
|
+
data.type === "arrow" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
19580
|
+
/* @__PURE__ */ jsxs(
|
|
19581
|
+
"button",
|
|
19582
|
+
{
|
|
19583
|
+
className: styles.goToTaskButton,
|
|
19584
|
+
onClick: () => onGoToTask(data.taskFrom.id),
|
|
19585
|
+
type: "button",
|
|
19586
|
+
children: [
|
|
19587
|
+
/* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", children: /* @__PURE__ */ jsx(
|
|
19588
|
+
"path",
|
|
19589
|
+
{
|
|
19590
|
+
d: "M2 7h10M8 3l4 4-4 4",
|
|
19591
|
+
stroke: "currentColor",
|
|
19592
|
+
strokeWidth: "1.5",
|
|
19593
|
+
strokeLinecap: "round",
|
|
19594
|
+
strokeLinejoin: "round"
|
|
19595
|
+
}
|
|
19596
|
+
) }),
|
|
19597
|
+
"Go to ",
|
|
19598
|
+
data.taskFrom.name
|
|
19599
|
+
]
|
|
19600
|
+
}
|
|
19601
|
+
),
|
|
19602
|
+
/* @__PURE__ */ jsxs(
|
|
19603
|
+
"button",
|
|
19604
|
+
{
|
|
19605
|
+
className: styles.goToTaskButton,
|
|
19606
|
+
onClick: () => onGoToTask(data.taskTo.id),
|
|
19607
|
+
type: "button",
|
|
19608
|
+
children: [
|
|
19609
|
+
/* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", children: /* @__PURE__ */ jsx(
|
|
19610
|
+
"path",
|
|
19611
|
+
{
|
|
19612
|
+
d: "M2 7h10M8 3l4 4-4 4",
|
|
19613
|
+
stroke: "currentColor",
|
|
19614
|
+
strokeWidth: "1.5",
|
|
19615
|
+
strokeLinecap: "round",
|
|
19616
|
+
strokeLinejoin: "round"
|
|
19617
|
+
}
|
|
19618
|
+
) }),
|
|
19619
|
+
"Go to ",
|
|
19620
|
+
data.taskTo.name
|
|
19621
|
+
]
|
|
19622
|
+
}
|
|
19623
|
+
)
|
|
19624
|
+
] })
|
|
19625
|
+
] }),
|
|
19626
|
+
data && renderContent ? renderContent(data) : null
|
|
19627
|
+
] })
|
|
19393
19628
|
]
|
|
19394
19629
|
}
|
|
19395
19630
|
)
|
|
@@ -19464,6 +19699,7 @@ const Gantt = (props) => {
|
|
|
19464
19699
|
const renderDrawerContent = drawerProps == null ? void 0 : drawerProps.renderDrawerContent;
|
|
19465
19700
|
const [drawerData, setDrawerData] = useState(null);
|
|
19466
19701
|
const [activeArrowKey, setActiveArrowKey] = useState(null);
|
|
19702
|
+
const [activeTaskId, setActiveTaskId] = useState(null);
|
|
19467
19703
|
const taskBar = useMemo(() => {
|
|
19468
19704
|
return mergeDeepObj(
|
|
19469
19705
|
{},
|
|
@@ -20557,6 +20793,7 @@ const Gantt = (props) => {
|
|
|
20557
20793
|
(taskFrom, taskTo) => {
|
|
20558
20794
|
if (enableDrawer) {
|
|
20559
20795
|
setActiveArrowKey(`${taskFrom.id}|${taskTo.id}`);
|
|
20796
|
+
setActiveTaskId(null);
|
|
20560
20797
|
setDrawerData({ type: "arrow", taskFrom, taskTo });
|
|
20561
20798
|
}
|
|
20562
20799
|
if (taskBar.onArrowClick) {
|
|
@@ -20569,6 +20806,7 @@ const Gantt = (props) => {
|
|
|
20569
20806
|
(task, _event) => {
|
|
20570
20807
|
if (enableDrawer) {
|
|
20571
20808
|
setActiveArrowKey(null);
|
|
20809
|
+
setActiveTaskId(task.id);
|
|
20572
20810
|
setDrawerData({ type: "task", task });
|
|
20573
20811
|
}
|
|
20574
20812
|
if (taskBar.onClick) {
|
|
@@ -20580,7 +20818,51 @@ const Gantt = (props) => {
|
|
|
20580
20818
|
const handleDrawerClose = useCallback(() => {
|
|
20581
20819
|
setDrawerData(null);
|
|
20582
20820
|
setActiveArrowKey(null);
|
|
20821
|
+
setActiveTaskId(null);
|
|
20583
20822
|
}, []);
|
|
20823
|
+
const handleGoToTask = useCallback(
|
|
20824
|
+
(taskId) => {
|
|
20825
|
+
for (const [comparisonLevel, levelMap] of tasksMap) {
|
|
20826
|
+
const task = levelMap.get(taskId);
|
|
20827
|
+
if (!task || task.type === "empty")
|
|
20828
|
+
continue;
|
|
20829
|
+
const { x1 } = getTaskCoordinates(task, mapTaskToCoordinates);
|
|
20830
|
+
setScrollXProgrammatically(Math.max(0, x1 - 100));
|
|
20831
|
+
const rowIndexMap = taskToRowIndexMap.get(comparisonLevel);
|
|
20832
|
+
if (rowIndexMap) {
|
|
20833
|
+
const rowIndex = rowIndexMap.get(taskId);
|
|
20834
|
+
if (typeof rowIndex === "number") {
|
|
20835
|
+
const targetScrollY = rowIndex * fullRowHeight - ganttHeight / 2 + fullRowHeight / 2;
|
|
20836
|
+
setScrollYProgrammatically(
|
|
20837
|
+
Math.max(
|
|
20838
|
+
0,
|
|
20839
|
+
Math.min(targetScrollY, ganttFullHeight - ganttHeight)
|
|
20840
|
+
)
|
|
20841
|
+
);
|
|
20842
|
+
}
|
|
20843
|
+
}
|
|
20844
|
+
selectTask(taskId);
|
|
20845
|
+
if (onSelectTaskIds) {
|
|
20846
|
+
onSelectTaskIds([taskId]);
|
|
20847
|
+
}
|
|
20848
|
+
break;
|
|
20849
|
+
}
|
|
20850
|
+
handleDrawerClose();
|
|
20851
|
+
},
|
|
20852
|
+
[
|
|
20853
|
+
tasksMap,
|
|
20854
|
+
mapTaskToCoordinates,
|
|
20855
|
+
taskToRowIndexMap,
|
|
20856
|
+
fullRowHeight,
|
|
20857
|
+
ganttHeight,
|
|
20858
|
+
ganttFullHeight,
|
|
20859
|
+
setScrollXProgrammatically,
|
|
20860
|
+
setScrollYProgrammatically,
|
|
20861
|
+
selectTask,
|
|
20862
|
+
onSelectTaskIds,
|
|
20863
|
+
handleDrawerClose
|
|
20864
|
+
]
|
|
20865
|
+
);
|
|
20584
20866
|
const handleAction = useHandleAction({
|
|
20585
20867
|
checkTaskIdExists,
|
|
20586
20868
|
childTasksMap,
|
|
@@ -20796,6 +21078,7 @@ const Gantt = (props) => {
|
|
|
20796
21078
|
onArrowDoubleClick,
|
|
20797
21079
|
onArrowClick: enableDrawer ? onArrowClick : taskBar.onArrowClick,
|
|
20798
21080
|
activeArrowKey,
|
|
21081
|
+
activeTaskId,
|
|
20799
21082
|
renderedRowIndexes,
|
|
20800
21083
|
rtl,
|
|
20801
21084
|
selectTaskOnMouseDown,
|
|
@@ -20835,6 +21118,7 @@ const Gantt = (props) => {
|
|
|
20835
21118
|
onArrowDoubleClick,
|
|
20836
21119
|
onArrowClick,
|
|
20837
21120
|
activeArrowKey,
|
|
21121
|
+
activeTaskId,
|
|
20838
21122
|
enableDrawer,
|
|
20839
21123
|
handleTaskClick,
|
|
20840
21124
|
renderedRowIndexes,
|
|
@@ -21010,6 +21294,7 @@ const Gantt = (props) => {
|
|
|
21010
21294
|
data: drawerData,
|
|
21011
21295
|
width: drawerWidth,
|
|
21012
21296
|
onClose: handleDrawerClose,
|
|
21297
|
+
onGoToTask: handleGoToTask,
|
|
21013
21298
|
renderContent: renderDrawerContent
|
|
21014
21299
|
}
|
|
21015
21300
|
)
|
|
@@ -21019,6 +21304,7 @@ const Gantt = (props) => {
|
|
|
21019
21304
|
};
|
|
21020
21305
|
export {
|
|
21021
21306
|
AddColumn,
|
|
21307
|
+
ColumnVisibilityToggle,
|
|
21022
21308
|
DateEndColumn,
|
|
21023
21309
|
DateStartColumn,
|
|
21024
21310
|
DeleteColumn,
|