progress & list table hotfix

This commit is contained in:
unknown 2020-09-01 23:08:15 +03:00
parent 75e929f77a
commit b555e8a3c6
6 changed files with 23 additions and 19 deletions

View File

@ -379,9 +379,9 @@
"integrity": "sha512-KfRL3PuHmqQLOG+2tGpRO26Ctg+Cq1E01D2DMriKEATHgWLfeNDmq9e29Q9WIky0dQ3NPkd1mzYH8Lm936Z9qw=="
},
"@types/react": {
"version": "16.9.48",
"resolved": "https://registry.npmjs.org/@types/react/-/react-16.9.48.tgz",
"integrity": "sha512-4ykBVswgYitPGMXFRxJCHkxJDU2rjfU3/zw67f8+dB7sNdVJXsrwqoYxz/stkAucymnEEbRPFmX7Ce5Mc/kJCw==",
"version": "16.9.49",
"resolved": "https://registry.npmjs.org/@types/react/-/react-16.9.49.tgz",
"integrity": "sha512-DtLFjSj0OYAdVLBbyjhuV9CdGVHCkHn2R+xr3XkBvK2rS1Y1tkc14XSGjYgm5Fjjr90AxH9tiSzc1pCFMGO06g==",
"requires": {
"@types/prop-types": "*",
"csstype": "^3.0.2"
@ -799,9 +799,9 @@
"integrity": "sha512-KfRL3PuHmqQLOG+2tGpRO26Ctg+Cq1E01D2DMriKEATHgWLfeNDmq9e29Q9WIky0dQ3NPkd1mzYH8Lm936Z9qw=="
},
"@types/react": {
"version": "16.9.48",
"resolved": "https://registry.npmjs.org/@types/react/-/react-16.9.48.tgz",
"integrity": "sha512-4ykBVswgYitPGMXFRxJCHkxJDU2rjfU3/zw67f8+dB7sNdVJXsrwqoYxz/stkAucymnEEbRPFmX7Ce5Mc/kJCw==",
"version": "16.9.49",
"resolved": "https://registry.npmjs.org/@types/react/-/react-16.9.49.tgz",
"integrity": "sha512-DtLFjSj0OYAdVLBbyjhuV9CdGVHCkHn2R+xr3XkBvK2rS1Y1tkc14XSGjYgm5Fjjr90AxH9tiSzc1pCFMGO06g==",
"requires": {
"@types/prop-types": "*",
"csstype": "^3.0.2"

View File

@ -111,7 +111,7 @@ const App = () => {
onTaskDelete={onTaskDelete}
onProgressChange={onProgressChange}
onDoubleClick={onDblClick}
listCellWidth={isChecked ? "150px" : ""}
listCellWidth={isChecked ? "155px" : ""}
columnWidth={columnWidth}
/>
<h3>Gantt With Limited Height</h3>
@ -122,7 +122,7 @@ const App = () => {
onTaskDelete={onTaskDelete}
onProgressChange={onProgressChange}
onDoubleClick={onDblClick}
listCellWidth={isChecked ? "150px" : ""}
listCellWidth={isChecked ? "155px" : ""}
ganttHeight={300}
columnWidth={columnWidth}
/>

View File

@ -1,6 +1,6 @@
{
"name": "gantt-task-react",
"version": "0.1.7",
"version": "0.1.8",
"description": "Interactive Gantt Chart for React with TypeScript.",
"author": "MaTeMaTuK <maksym.vikarii@gmail.com>",
"homepage": "https://github.com/MaTeMaTuK/gantt-task-react",

View File

@ -16,7 +16,7 @@ export const Gantt: React.SFC<GanttProps> = ({
tasks,
headerHeight = 50,
columnWidth = 60,
listCellWidth = "150px",
listCellWidth = "155px",
rowHeight = 50,
ganttHeight = 0,
viewMode = ViewMode.Day,
@ -151,7 +151,7 @@ export const Gantt: React.SFC<GanttProps> = ({
};
// task change event
const onTasksDateChange = (tasks: Task[]) => {
const handleTasksChange = (tasks: Task[]) => {
setGanttTasks(tasks);
};
@ -190,7 +190,7 @@ export const Gantt: React.SFC<GanttProps> = ({
fontSize,
arrowIndent,
svgHeight,
onTasksDateChange: onTasksDateChange,
onTasksChange: handleTasksChange,
onDateChange,
onProgressChange,
onDoubleClick,

View File

@ -46,7 +46,7 @@ export type TaskGanttContentProps = {
fontSize: string;
fontFamily: string;
}>;
onTasksDateChange: (tasks: Task[]) => void;
onTasksChange: (tasks: Task[]) => void;
} & EventOption;
export const TaskGanttContent: React.FC<TaskGanttContentProps> = ({
@ -68,7 +68,7 @@ export const TaskGanttContent: React.FC<TaskGanttContentProps> = ({
arrowIndent,
fontFamily,
fontSize,
onTasksDateChange,
onTasksChange,
onDateChange,
onProgressChange,
onDoubleClick,
@ -139,7 +139,7 @@ export const TaskGanttContent: React.FC<TaskGanttContentProps> = ({
if (onTaskDelete) {
await onTaskDelete(selectedTask);
const newTasks = barTasks.filter(t => t.id !== selectedTask.id);
onTasksDateChange(newTasks);
onTasksChange(newTasks);
}
}
} else if (action === "mouseenter") {
@ -226,13 +226,15 @@ export const TaskGanttContent: React.FC<TaskGanttContentProps> = ({
isNotLikeOriginal
) {
await onDateChange(changedTask);
const newTasks = barTasks.map(t =>
t.id === changedTask.id ? changedTask : t
);
onTasksDateChange(newTasks);
} else if (onProgressChange && isNotLikeOriginal) {
await onProgressChange(changedTask);
}
const newTasks = barTasks.map(t =>
t.id === changedTask.id ? changedTask : t
);
onTasksChange(newTasks);
svg.current.removeEventListener("mousemove", handleMouseMove);
svg.current.removeEventListener("mouseup", handleMouseUp);
setBarEvent({ action: "" });

View File

@ -45,6 +45,7 @@ export const TaskListTableDefault: React.FC<{
className={styles.taskListCell}
style={{
minWidth: rowWidth,
maxWidth: rowWidth,
}}
>
&nbsp;{t.start.toLocaleDateString(locale, dateTimeOptions)}
@ -53,6 +54,7 @@ export const TaskListTableDefault: React.FC<{
className={styles.taskListCell}
style={{
minWidth: rowWidth,
maxWidth: rowWidth,
}}
>
&nbsp;{t.end.toLocaleDateString(locale, dateTimeOptions)}