diff --git a/example/package-lock.json b/example/package-lock.json index b5de707..edf9387 100644 --- a/example/package-lock.json +++ b/example/package-lock.json @@ -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" diff --git a/example/src/App.tsx b/example/src/App.tsx index e2c9ea4..9d8788e 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -111,7 +111,7 @@ const App = () => { onTaskDelete={onTaskDelete} onProgressChange={onProgressChange} onDoubleClick={onDblClick} - listCellWidth={isChecked ? "150px" : ""} + listCellWidth={isChecked ? "155px" : ""} columnWidth={columnWidth} />

Gantt With Limited Height

@@ -122,7 +122,7 @@ const App = () => { onTaskDelete={onTaskDelete} onProgressChange={onProgressChange} onDoubleClick={onDblClick} - listCellWidth={isChecked ? "150px" : ""} + listCellWidth={isChecked ? "155px" : ""} ganttHeight={300} columnWidth={columnWidth} /> diff --git a/package.json b/package.json index e93fbe6..ce43c2f 100644 --- a/package.json +++ b/package.json @@ -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 ", "homepage": "https://github.com/MaTeMaTuK/gantt-task-react", diff --git a/src/components/gantt/gantt.tsx b/src/components/gantt/gantt.tsx index 23d4cd8..f7e41fc 100644 --- a/src/components/gantt/gantt.tsx +++ b/src/components/gantt/gantt.tsx @@ -16,7 +16,7 @@ export const Gantt: React.SFC = ({ 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 = ({ }; // task change event - const onTasksDateChange = (tasks: Task[]) => { + const handleTasksChange = (tasks: Task[]) => { setGanttTasks(tasks); }; @@ -190,7 +190,7 @@ export const Gantt: React.SFC = ({ fontSize, arrowIndent, svgHeight, - onTasksDateChange: onTasksDateChange, + onTasksChange: handleTasksChange, onDateChange, onProgressChange, onDoubleClick, diff --git a/src/components/gantt/task-gantt-content.tsx b/src/components/gantt/task-gantt-content.tsx index b00c018..84a6ff1 100644 --- a/src/components/gantt/task-gantt-content.tsx +++ b/src/components/gantt/task-gantt-content.tsx @@ -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 = ({ @@ -68,7 +68,7 @@ export const TaskGanttContent: React.FC = ({ arrowIndent, fontFamily, fontSize, - onTasksDateChange, + onTasksChange, onDateChange, onProgressChange, onDoubleClick, @@ -139,7 +139,7 @@ export const TaskGanttContent: React.FC = ({ 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 = ({ 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: "" }); diff --git a/src/components/task-list/task-list-table.tsx b/src/components/task-list/task-list-table.tsx index 24e0be6..2903051 100644 --- a/src/components/task-list/task-list-table.tsx +++ b/src/components/task-list/task-list-table.tsx @@ -45,6 +45,7 @@ export const TaskListTableDefault: React.FC<{ className={styles.taskListCell} style={{ minWidth: rowWidth, + maxWidth: rowWidth, }} >  {t.start.toLocaleDateString(locale, dateTimeOptions)} @@ -53,6 +54,7 @@ export const TaskListTableDefault: React.FC<{ className={styles.taskListCell} style={{ minWidth: rowWidth, + maxWidth: rowWidth, }} >  {t.end.toLocaleDateString(locale, dateTimeOptions)}