✨ Introduce on click event on task
This commit is contained in:
1 parent
016fbd2257
commit
e38fc8f37e
7 files changed
+21
No files matched your search
@@ -60,6 +60,7 @@ export const Gantt: React.FunctionComponent<GanttProps> = ({
|
||||
onDateChange,
|
||||
onProgressChange,
|
||||
onDoubleClick,
|
||||
onClick,
|
||||
onDelete,
|
||||
onSelect,
|
||||
onExpanderClick,
|
||||
@@ -411,6 +412,7 @@ export const Gantt: React.FunctionComponent<GanttProps> = ({
|
||||
onDateChange,
|
||||
onProgressChange,
|
||||
onDoubleClick,
|
||||
onClick,
|
||||
onDelete,
|
||||
};
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ export const TaskGanttContent: React.FC<TaskGanttContentProps> = ({
|
||||
onDateChange,
|
||||
onProgressChange,
|
||||
onDoubleClick,
|
||||
onClick,
|
||||
onDelete,
|
||||
}) => {
|
||||
const point = svg?.current?.createSVGPoint();
|
||||
@@ -230,6 +231,8 @@ export const TaskGanttContent: React.FC<TaskGanttContentProps> = ({
|
||||
}
|
||||
} else if (action === "dblclick") {
|
||||
!!onDoubleClick && onDoubleClick(task);
|
||||
} else if (action === "click") {
|
||||
!!onClick && onClick(task);
|
||||
}
|
||||
// Change task event start
|
||||
else if (action === "move") {
|
||||
|
||||
@@ -100,6 +100,9 @@ export const TaskItem: React.FC<TaskItemProps> = props => {
|
||||
onDoubleClick={e => {
|
||||
onEventStart("dblclick", task, e);
|
||||
}}
|
||||
onClick={e => {
|
||||
onEventStart("click", task, e);
|
||||
}}
|
||||
onFocus={() => {
|
||||
onEventStart("select", task);
|
||||
}}
|
||||
|
||||
@@ -6,6 +6,7 @@ export type GanttContentMoveAction =
|
||||
| "mouseleave"
|
||||
| "delete"
|
||||
| "dblclick"
|
||||
| "click"
|
||||
| "select"
|
||||
| ""
|
||||
| BarMoveAction;
|
||||
|
||||
@@ -44,6 +44,10 @@ export interface EventOption {
|
||||
* Invokes on bar double click.
|
||||
*/
|
||||
onDoubleClick?: (task: Task) => void;
|
||||
/**
|
||||
* Invokes on bar click.
|
||||
*/
|
||||
onClick?: (task: Task) => void;
|
||||
/**
|
||||
* Invokes on end and start time change. Chart undoes operation if method return false or error.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user