gantt-task-react
Advanced tools
Comparing version 0.1.9 to 0.2.0
@@ -10,4 +10,5 @@ import React from "react"; | ||
isDelete: boolean; | ||
onEventStart: (event: React.MouseEvent | React.KeyboardEvent | React.FocusEvent, action: GanttContentMoveAction, selectedTask: BarTask) => any; | ||
isSelected: boolean; | ||
onEventStart: (action: GanttContentMoveAction, selectedTask: BarTask, event?: React.MouseEvent | React.KeyboardEvent) => any; | ||
}; | ||
export declare const Bar: React.FC<BarProps>; |
@@ -5,5 +5,5 @@ import React from "react"; | ||
import { BarMoveAction } from "../../helpers/bar-helper"; | ||
export declare type GanttContentMoveAction = "mouseenter" | "mouseleave" | "delete" | "dblclick" | "select" | "unselect" | BarMoveAction; | ||
export declare type GanttContentMoveAction = "mouseenter" | "mouseleave" | "delete" | "dblclick" | "select" | BarMoveAction; | ||
export declare type BarEvent = { | ||
selectedTask?: BarTask; | ||
changedTask?: BarTask; | ||
originalTask?: BarTask; | ||
@@ -10,0 +10,0 @@ action: GanttContentMoveAction; |
@@ -1037,8 +1037,4 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
onEventStart = _ref.onEventStart, | ||
isDelete = _ref.isDelete; | ||
var _useState = React.useState(false), | ||
isSelected = _useState[0], | ||
setIsSelected = _useState[1]; | ||
isDelete = _ref.isDelete, | ||
isSelected = _ref.isSelected; | ||
var progressWidth = progressWithByParams(task.x1, task.x2, task.progress); | ||
@@ -1053,3 +1049,3 @@ var progressPoint = getProgressPoint(progressWidth + task.x1, task.y, task.height); | ||
{ | ||
if (isDelete) onEventStart(e, "delete", task); | ||
if (isDelete) onEventStart("delete", task, e); | ||
break; | ||
@@ -1062,17 +1058,12 @@ } | ||
onMouseEnter: function onMouseEnter(e) { | ||
onEventStart(e, "mouseenter", task); | ||
onEventStart("mouseenter", task, e); | ||
}, | ||
onMouseLeave: function onMouseLeave(e) { | ||
onEventStart(e, "mouseleave", task); | ||
onEventStart("mouseleave", task, e); | ||
}, | ||
onDoubleClick: function onDoubleClick(e) { | ||
onEventStart(e, "dblclick", task); | ||
onEventStart("dblclick", task, e); | ||
}, | ||
onFocus: function onFocus(e) { | ||
setIsSelected(true); | ||
onEventStart(e, "select", task); | ||
}, | ||
onBlur: function onBlur(e) { | ||
setIsSelected(false); | ||
onEventStart(e, "unselect", task); | ||
onFocus: function onFocus() { | ||
onEventStart("select", task); | ||
} | ||
@@ -1092,3 +1083,3 @@ }, React__default.createElement(BarDisplay, { | ||
onMouseDown: function onMouseDown(e) { | ||
isDateChangeable && onEventStart(e, "move", task); | ||
isDateChangeable && onEventStart("move", task, e); | ||
} | ||
@@ -1104,3 +1095,3 @@ }), React__default.createElement("g", { | ||
onMouseDown: function onMouseDown(e) { | ||
onEventStart(e, "start", task); | ||
onEventStart("start", task, e); | ||
} | ||
@@ -1114,3 +1105,3 @@ }), React__default.createElement(BarDateHandle, { | ||
onMouseDown: function onMouseDown(e) { | ||
onEventStart(e, "end", task); | ||
onEventStart("end", task, e); | ||
} | ||
@@ -1120,3 +1111,3 @@ })), isProgressChangeable && React__default.createElement(BarProgressHandle, { | ||
onMouseDown: function onMouseDown(e) { | ||
onEventStart(e, "progress", task); | ||
onEventStart("progress", task, e); | ||
} | ||
@@ -1149,5 +1140,2 @@ }))); | ||
} | ||
function isMouseEvent(event) { | ||
return event.clientX !== undefined; | ||
} | ||
@@ -1195,17 +1183,21 @@ var TaskGanttContent = function TaskGanttContent(_ref) { | ||
var _useState3 = React.useState(null), | ||
failedTask = _useState3[0], | ||
setFailedTask = _useState3[1]; | ||
selectedTask = _useState3[0], | ||
setSelectedTask = _useState3[1]; | ||
var _useState4 = React.useState(0), | ||
xStep = _useState4[0], | ||
setXStep = _useState4[1]; | ||
var _useState4 = React.useState(null), | ||
failedTask = _useState4[0], | ||
setFailedTask = _useState4[1]; | ||
var _useState5 = React.useState(0), | ||
initEventX1Delta = _useState5[0], | ||
setInitEventX1Delta = _useState5[1]; | ||
xStep = _useState5[0], | ||
setXStep = _useState5[1]; | ||
var _useState6 = React.useState(false), | ||
isMoving = _useState6[0], | ||
setIsMoving = _useState6[1]; | ||
var _useState6 = React.useState(0), | ||
initEventX1Delta = _useState6[0], | ||
setInitEventX1Delta = _useState6[1]; | ||
var _useState7 = React.useState(false), | ||
isMoving = _useState7[0], | ||
setIsMoving = _useState7[1]; | ||
React.useEffect(function () { | ||
@@ -1233,3 +1225,3 @@ var dateDelta = dates[1].getTime() - dates[0].getTime() - dates[1].getTimezoneOffset() * 60 * 1000 + dates[0].getTimezoneOffset() * 60 * 1000; | ||
if (!barEvent.selectedTask || !point || !(svg === null || svg === void 0 ? void 0 : svg.current)) return Promise.resolve(); | ||
if (!barEvent.changedTask || !point || !(svg === null || svg === void 0 ? void 0 : svg.current)) return Promise.resolve(); | ||
event.preventDefault(); | ||
@@ -1239,3 +1231,3 @@ point.x = event.clientX; | ||
var _handleTaskBySVGMouse = handleTaskBySVGMouseEvent(cursor.x, barEvent.action, barEvent.selectedTask, xStep, timeStep, initEventX1Delta), | ||
var _handleTaskBySVGMouse = handleTaskBySVGMouseEvent(cursor.x, barEvent.action, barEvent.changedTask, xStep, timeStep, initEventX1Delta), | ||
isChanged = _handleTaskBySVGMouse.isChanged, | ||
@@ -1249,3 +1241,3 @@ changedTask = _handleTaskBySVGMouse.changedTask; | ||
setBarEvent(_extends({}, barEvent, { | ||
selectedTask: changedTask | ||
changedTask: changedTask | ||
})); | ||
@@ -1270,6 +1262,6 @@ } | ||
var selectedTask = barEvent.selectedTask, | ||
var _selectedTask = barEvent.changedTask, | ||
action = barEvent.action, | ||
originalTask = barEvent.originalTask; | ||
if (!selectedTask || !point || !(svg === null || svg === void 0 ? void 0 : svg.current) || !originalTask) return Promise.resolve(); | ||
if (!_selectedTask || !point || !(svg === null || svg === void 0 ? void 0 : svg.current) || !originalTask) return Promise.resolve(); | ||
event.preventDefault(); | ||
@@ -1279,3 +1271,3 @@ point.x = event.clientX; | ||
var _handleTaskBySVGMouse2 = handleTaskBySVGMouseEvent(cursor.x, action, selectedTask, xStep, timeStep, initEventX1Delta), | ||
var _handleTaskBySVGMouse2 = handleTaskBySVGMouseEvent(cursor.x, action, _selectedTask, xStep, timeStep, initEventX1Delta), | ||
changedTask = _handleTaskBySVGMouse2.changedTask; | ||
@@ -1343,74 +1335,82 @@ | ||
var handleBarEventStart = function handleBarEventStart(event, action, selectedTask) { | ||
var handleBarEventStart = function handleBarEventStart(action, task, event) { | ||
try { | ||
return Promise.resolve(function () { | ||
if (isKeyboardEvent(event)) { | ||
var _temp14 = function () { | ||
if (action === "delete") { | ||
var _temp15 = function () { | ||
if (onTaskDelete) { | ||
var _temp16 = _catch(function () { | ||
return Promise.resolve(onTaskDelete(selectedTask)).then(function (result) { | ||
if (result !== undefined && result) { | ||
var newTasks = barTasks.filter(function (t) { | ||
return t.id !== selectedTask.id; | ||
if (!event) { | ||
if (action === "select") { | ||
if (selectedTask && onSelect) { | ||
onSelect(selectedTask, false); | ||
} | ||
setSelectedTask(task); | ||
if (onSelect) { | ||
onSelect(task, true); | ||
} | ||
} | ||
} else return function () { | ||
if (isKeyboardEvent(event)) { | ||
var _temp14 = function () { | ||
if (action === "delete") { | ||
var _temp15 = function () { | ||
if (onTaskDelete) { | ||
var _temp16 = _catch(function () { | ||
return Promise.resolve(onTaskDelete(task)).then(function (result) { | ||
if (result !== undefined && result) { | ||
var newTasks = barTasks.filter(function (t) { | ||
return t.id !== task.id; | ||
}); | ||
onTasksChange(newTasks); | ||
!!onSelect && onSelect(task, false); | ||
} | ||
}); | ||
onTasksChange(newTasks); | ||
!!onSelect && onSelect(selectedTask, false); | ||
} | ||
}); | ||
}, function (error) { | ||
console.error("Error on Delete. " + error); | ||
}); | ||
}, function (error) { | ||
console.error("Error on Delete. " + error); | ||
}); | ||
if (_temp16 && _temp16.then) return _temp16.then(function () {}); | ||
if (_temp16 && _temp16.then) return _temp16.then(function () {}); | ||
} | ||
}(); | ||
if (_temp15 && _temp15.then) return _temp15.then(function () {}); | ||
} | ||
}(); | ||
if (_temp15 && _temp15.then) return _temp15.then(function () {}); | ||
} | ||
if (_temp14 && _temp14.then) return _temp14.then(function () {}); | ||
} else if (action === "mouseenter") { | ||
if (!barEvent.action) { | ||
setBarEvent({ | ||
action: action, | ||
changedTask: task, | ||
originalTask: task | ||
}); | ||
} | ||
} else if (action === "mouseleave") { | ||
if (barEvent.action === "mouseenter") { | ||
setBarEvent({ | ||
action: "" | ||
}); | ||
} | ||
} else if (action === "dblclick") { | ||
!!onDoubleClick && onDoubleClick(task); | ||
} else if (action === "move") { | ||
var _svg$current$getScree3; | ||
if (!(svg === null || svg === void 0 ? void 0 : svg.current) || !point) return; | ||
point.x = event.clientX; | ||
var cursor = point.matrixTransform((_svg$current$getScree3 = svg.current.getScreenCTM()) === null || _svg$current$getScree3 === void 0 ? void 0 : _svg$current$getScree3.inverse()); | ||
setInitEventX1Delta(cursor.x - task.x1); | ||
setBarEvent({ | ||
action: action, | ||
changedTask: task, | ||
originalTask: task | ||
}); | ||
} else { | ||
setBarEvent({ | ||
action: action, | ||
changedTask: task, | ||
originalTask: task | ||
}); | ||
} | ||
}(); | ||
if (_temp14 && _temp14.then) return _temp14.then(function () {}); | ||
} else if (!isMouseEvent(event)) { | ||
if (action === "select") { | ||
!!onSelect && onSelect(selectedTask, true); | ||
} else if (action === "unselect") { | ||
!!onSelect && onSelect(selectedTask, false); | ||
} | ||
} else if (action === "mouseenter") { | ||
if (!barEvent.action) { | ||
setBarEvent({ | ||
action: action, | ||
selectedTask: selectedTask, | ||
originalTask: selectedTask | ||
}); | ||
} | ||
} else if (action === "mouseleave") { | ||
if (barEvent.action === "mouseenter") { | ||
setBarEvent({ | ||
action: "" | ||
}); | ||
} | ||
} else if (action === "dblclick") { | ||
!!onDoubleClick && onDoubleClick(selectedTask); | ||
} else if (action === "move") { | ||
var _svg$current$getScree3; | ||
if (!(svg === null || svg === void 0 ? void 0 : svg.current) || !point) return; | ||
point.x = event.clientX; | ||
var cursor = point.matrixTransform((_svg$current$getScree3 = svg.current.getScreenCTM()) === null || _svg$current$getScree3 === void 0 ? void 0 : _svg$current$getScree3.inverse()); | ||
setInitEventX1Delta(cursor.x - selectedTask.x1); | ||
setBarEvent({ | ||
action: action, | ||
selectedTask: selectedTask, | ||
originalTask: selectedTask | ||
}); | ||
} else { | ||
setBarEvent({ | ||
action: action, | ||
selectedTask: selectedTask, | ||
originalTask: selectedTask | ||
}); | ||
} | ||
}()); | ||
@@ -1450,11 +1450,12 @@ } catch (e) { | ||
onEventStart: handleBarEventStart, | ||
key: task.id | ||
key: task.id, | ||
isSelected: task.id === (selectedTask === null || selectedTask === void 0 ? void 0 : selectedTask.id) | ||
}); | ||
})), React__default.createElement("g", { | ||
className: "toolTip" | ||
}, barEvent.selectedTask && React__default.createElement(Tooltip, { | ||
x: barEvent.selectedTask.x2 + arrowIndent + arrowIndent * 0.5, | ||
}, barEvent.changedTask && React__default.createElement(Tooltip, { | ||
x: barEvent.changedTask.x2 + arrowIndent + arrowIndent * 0.5, | ||
rowHeight: rowHeight, | ||
svgHeight: svgHeight, | ||
task: barEvent.selectedTask, | ||
task: barEvent.changedTask, | ||
fontFamily: fontFamily, | ||
@@ -1461,0 +1462,0 @@ fontSize: fontSize, |
@@ -1036,8 +1036,4 @@ import React, { useRef, useState, useEffect } from 'react'; | ||
onEventStart = _ref.onEventStart, | ||
isDelete = _ref.isDelete; | ||
var _useState = useState(false), | ||
isSelected = _useState[0], | ||
setIsSelected = _useState[1]; | ||
isDelete = _ref.isDelete, | ||
isSelected = _ref.isSelected; | ||
var progressWidth = progressWithByParams(task.x1, task.x2, task.progress); | ||
@@ -1052,3 +1048,3 @@ var progressPoint = getProgressPoint(progressWidth + task.x1, task.y, task.height); | ||
{ | ||
if (isDelete) onEventStart(e, "delete", task); | ||
if (isDelete) onEventStart("delete", task, e); | ||
break; | ||
@@ -1061,17 +1057,12 @@ } | ||
onMouseEnter: function onMouseEnter(e) { | ||
onEventStart(e, "mouseenter", task); | ||
onEventStart("mouseenter", task, e); | ||
}, | ||
onMouseLeave: function onMouseLeave(e) { | ||
onEventStart(e, "mouseleave", task); | ||
onEventStart("mouseleave", task, e); | ||
}, | ||
onDoubleClick: function onDoubleClick(e) { | ||
onEventStart(e, "dblclick", task); | ||
onEventStart("dblclick", task, e); | ||
}, | ||
onFocus: function onFocus(e) { | ||
setIsSelected(true); | ||
onEventStart(e, "select", task); | ||
}, | ||
onBlur: function onBlur(e) { | ||
setIsSelected(false); | ||
onEventStart(e, "unselect", task); | ||
onFocus: function onFocus() { | ||
onEventStart("select", task); | ||
} | ||
@@ -1091,3 +1082,3 @@ }, React.createElement(BarDisplay, { | ||
onMouseDown: function onMouseDown(e) { | ||
isDateChangeable && onEventStart(e, "move", task); | ||
isDateChangeable && onEventStart("move", task, e); | ||
} | ||
@@ -1103,3 +1094,3 @@ }), React.createElement("g", { | ||
onMouseDown: function onMouseDown(e) { | ||
onEventStart(e, "start", task); | ||
onEventStart("start", task, e); | ||
} | ||
@@ -1113,3 +1104,3 @@ }), React.createElement(BarDateHandle, { | ||
onMouseDown: function onMouseDown(e) { | ||
onEventStart(e, "end", task); | ||
onEventStart("end", task, e); | ||
} | ||
@@ -1119,3 +1110,3 @@ })), isProgressChangeable && React.createElement(BarProgressHandle, { | ||
onMouseDown: function onMouseDown(e) { | ||
onEventStart(e, "progress", task); | ||
onEventStart("progress", task, e); | ||
} | ||
@@ -1148,5 +1139,2 @@ }))); | ||
} | ||
function isMouseEvent(event) { | ||
return event.clientX !== undefined; | ||
} | ||
@@ -1194,17 +1182,21 @@ var TaskGanttContent = function TaskGanttContent(_ref) { | ||
var _useState3 = useState(null), | ||
failedTask = _useState3[0], | ||
setFailedTask = _useState3[1]; | ||
selectedTask = _useState3[0], | ||
setSelectedTask = _useState3[1]; | ||
var _useState4 = useState(0), | ||
xStep = _useState4[0], | ||
setXStep = _useState4[1]; | ||
var _useState4 = useState(null), | ||
failedTask = _useState4[0], | ||
setFailedTask = _useState4[1]; | ||
var _useState5 = useState(0), | ||
initEventX1Delta = _useState5[0], | ||
setInitEventX1Delta = _useState5[1]; | ||
xStep = _useState5[0], | ||
setXStep = _useState5[1]; | ||
var _useState6 = useState(false), | ||
isMoving = _useState6[0], | ||
setIsMoving = _useState6[1]; | ||
var _useState6 = useState(0), | ||
initEventX1Delta = _useState6[0], | ||
setInitEventX1Delta = _useState6[1]; | ||
var _useState7 = useState(false), | ||
isMoving = _useState7[0], | ||
setIsMoving = _useState7[1]; | ||
useEffect(function () { | ||
@@ -1232,3 +1224,3 @@ var dateDelta = dates[1].getTime() - dates[0].getTime() - dates[1].getTimezoneOffset() * 60 * 1000 + dates[0].getTimezoneOffset() * 60 * 1000; | ||
if (!barEvent.selectedTask || !point || !(svg === null || svg === void 0 ? void 0 : svg.current)) return Promise.resolve(); | ||
if (!barEvent.changedTask || !point || !(svg === null || svg === void 0 ? void 0 : svg.current)) return Promise.resolve(); | ||
event.preventDefault(); | ||
@@ -1238,3 +1230,3 @@ point.x = event.clientX; | ||
var _handleTaskBySVGMouse = handleTaskBySVGMouseEvent(cursor.x, barEvent.action, barEvent.selectedTask, xStep, timeStep, initEventX1Delta), | ||
var _handleTaskBySVGMouse = handleTaskBySVGMouseEvent(cursor.x, barEvent.action, barEvent.changedTask, xStep, timeStep, initEventX1Delta), | ||
isChanged = _handleTaskBySVGMouse.isChanged, | ||
@@ -1248,3 +1240,3 @@ changedTask = _handleTaskBySVGMouse.changedTask; | ||
setBarEvent(_extends({}, barEvent, { | ||
selectedTask: changedTask | ||
changedTask: changedTask | ||
})); | ||
@@ -1269,6 +1261,6 @@ } | ||
var selectedTask = barEvent.selectedTask, | ||
var _selectedTask = barEvent.changedTask, | ||
action = barEvent.action, | ||
originalTask = barEvent.originalTask; | ||
if (!selectedTask || !point || !(svg === null || svg === void 0 ? void 0 : svg.current) || !originalTask) return Promise.resolve(); | ||
if (!_selectedTask || !point || !(svg === null || svg === void 0 ? void 0 : svg.current) || !originalTask) return Promise.resolve(); | ||
event.preventDefault(); | ||
@@ -1278,3 +1270,3 @@ point.x = event.clientX; | ||
var _handleTaskBySVGMouse2 = handleTaskBySVGMouseEvent(cursor.x, action, selectedTask, xStep, timeStep, initEventX1Delta), | ||
var _handleTaskBySVGMouse2 = handleTaskBySVGMouseEvent(cursor.x, action, _selectedTask, xStep, timeStep, initEventX1Delta), | ||
changedTask = _handleTaskBySVGMouse2.changedTask; | ||
@@ -1342,74 +1334,82 @@ | ||
var handleBarEventStart = function handleBarEventStart(event, action, selectedTask) { | ||
var handleBarEventStart = function handleBarEventStart(action, task, event) { | ||
try { | ||
return Promise.resolve(function () { | ||
if (isKeyboardEvent(event)) { | ||
var _temp14 = function () { | ||
if (action === "delete") { | ||
var _temp15 = function () { | ||
if (onTaskDelete) { | ||
var _temp16 = _catch(function () { | ||
return Promise.resolve(onTaskDelete(selectedTask)).then(function (result) { | ||
if (result !== undefined && result) { | ||
var newTasks = barTasks.filter(function (t) { | ||
return t.id !== selectedTask.id; | ||
if (!event) { | ||
if (action === "select") { | ||
if (selectedTask && onSelect) { | ||
onSelect(selectedTask, false); | ||
} | ||
setSelectedTask(task); | ||
if (onSelect) { | ||
onSelect(task, true); | ||
} | ||
} | ||
} else return function () { | ||
if (isKeyboardEvent(event)) { | ||
var _temp14 = function () { | ||
if (action === "delete") { | ||
var _temp15 = function () { | ||
if (onTaskDelete) { | ||
var _temp16 = _catch(function () { | ||
return Promise.resolve(onTaskDelete(task)).then(function (result) { | ||
if (result !== undefined && result) { | ||
var newTasks = barTasks.filter(function (t) { | ||
return t.id !== task.id; | ||
}); | ||
onTasksChange(newTasks); | ||
!!onSelect && onSelect(task, false); | ||
} | ||
}); | ||
onTasksChange(newTasks); | ||
!!onSelect && onSelect(selectedTask, false); | ||
} | ||
}); | ||
}, function (error) { | ||
console.error("Error on Delete. " + error); | ||
}); | ||
}, function (error) { | ||
console.error("Error on Delete. " + error); | ||
}); | ||
if (_temp16 && _temp16.then) return _temp16.then(function () {}); | ||
if (_temp16 && _temp16.then) return _temp16.then(function () {}); | ||
} | ||
}(); | ||
if (_temp15 && _temp15.then) return _temp15.then(function () {}); | ||
} | ||
}(); | ||
if (_temp15 && _temp15.then) return _temp15.then(function () {}); | ||
} | ||
if (_temp14 && _temp14.then) return _temp14.then(function () {}); | ||
} else if (action === "mouseenter") { | ||
if (!barEvent.action) { | ||
setBarEvent({ | ||
action: action, | ||
changedTask: task, | ||
originalTask: task | ||
}); | ||
} | ||
} else if (action === "mouseleave") { | ||
if (barEvent.action === "mouseenter") { | ||
setBarEvent({ | ||
action: "" | ||
}); | ||
} | ||
} else if (action === "dblclick") { | ||
!!onDoubleClick && onDoubleClick(task); | ||
} else if (action === "move") { | ||
var _svg$current$getScree3; | ||
if (!(svg === null || svg === void 0 ? void 0 : svg.current) || !point) return; | ||
point.x = event.clientX; | ||
var cursor = point.matrixTransform((_svg$current$getScree3 = svg.current.getScreenCTM()) === null || _svg$current$getScree3 === void 0 ? void 0 : _svg$current$getScree3.inverse()); | ||
setInitEventX1Delta(cursor.x - task.x1); | ||
setBarEvent({ | ||
action: action, | ||
changedTask: task, | ||
originalTask: task | ||
}); | ||
} else { | ||
setBarEvent({ | ||
action: action, | ||
changedTask: task, | ||
originalTask: task | ||
}); | ||
} | ||
}(); | ||
if (_temp14 && _temp14.then) return _temp14.then(function () {}); | ||
} else if (!isMouseEvent(event)) { | ||
if (action === "select") { | ||
!!onSelect && onSelect(selectedTask, true); | ||
} else if (action === "unselect") { | ||
!!onSelect && onSelect(selectedTask, false); | ||
} | ||
} else if (action === "mouseenter") { | ||
if (!barEvent.action) { | ||
setBarEvent({ | ||
action: action, | ||
selectedTask: selectedTask, | ||
originalTask: selectedTask | ||
}); | ||
} | ||
} else if (action === "mouseleave") { | ||
if (barEvent.action === "mouseenter") { | ||
setBarEvent({ | ||
action: "" | ||
}); | ||
} | ||
} else if (action === "dblclick") { | ||
!!onDoubleClick && onDoubleClick(selectedTask); | ||
} else if (action === "move") { | ||
var _svg$current$getScree3; | ||
if (!(svg === null || svg === void 0 ? void 0 : svg.current) || !point) return; | ||
point.x = event.clientX; | ||
var cursor = point.matrixTransform((_svg$current$getScree3 = svg.current.getScreenCTM()) === null || _svg$current$getScree3 === void 0 ? void 0 : _svg$current$getScree3.inverse()); | ||
setInitEventX1Delta(cursor.x - selectedTask.x1); | ||
setBarEvent({ | ||
action: action, | ||
selectedTask: selectedTask, | ||
originalTask: selectedTask | ||
}); | ||
} else { | ||
setBarEvent({ | ||
action: action, | ||
selectedTask: selectedTask, | ||
originalTask: selectedTask | ||
}); | ||
} | ||
}()); | ||
@@ -1449,11 +1449,12 @@ } catch (e) { | ||
onEventStart: handleBarEventStart, | ||
key: task.id | ||
key: task.id, | ||
isSelected: task.id === (selectedTask === null || selectedTask === void 0 ? void 0 : selectedTask.id) | ||
}); | ||
})), React.createElement("g", { | ||
className: "toolTip" | ||
}, barEvent.selectedTask && React.createElement(Tooltip, { | ||
x: barEvent.selectedTask.x2 + arrowIndent + arrowIndent * 0.5, | ||
}, barEvent.changedTask && React.createElement(Tooltip, { | ||
x: barEvent.changedTask.x2 + arrowIndent + arrowIndent * 0.5, | ||
rowHeight: rowHeight, | ||
svgHeight: svgHeight, | ||
task: barEvent.selectedTask, | ||
task: barEvent.changedTask, | ||
fontFamily: fontFamily, | ||
@@ -1460,0 +1461,0 @@ fontSize: fontSize, |
{ | ||
"name": "gantt-task-react", | ||
"version": "0.1.9", | ||
"version": "0.2.0", | ||
"description": "Interactive Gantt Chart for React with TypeScript.", | ||
@@ -5,0 +5,0 @@ "author": "MaTeMaTuK <maksym.vikarii@gmail.com>", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
3707
428951