Skip to content

Commit

Permalink
progress & list table hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
MaTeMaTuK committed Sep 1, 2020
1 parent 75e929f commit b555e8a
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 19 deletions.
12 changes: 6 additions & 6 deletions example/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -122,7 +122,7 @@ const App = () => {
onTaskDelete={onTaskDelete}
onProgressChange={onProgressChange}
onDoubleClick={onDblClick}
listCellWidth={isChecked ? "150px" : ""}
listCellWidth={isChecked ? "155px" : ""}
ganttHeight={300}
columnWidth={columnWidth}
/>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>",
"homepage": "https://github.com/MaTeMaTuK/gantt-task-react",
Expand Down
6 changes: 3 additions & 3 deletions src/components/gantt/gantt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -151,7 +151,7 @@ export const Gantt: React.SFC<GanttProps> = ({
};

// task change event
const onTasksDateChange = (tasks: Task[]) => {
const handleTasksChange = (tasks: Task[]) => {
setGanttTasks(tasks);
};

Expand Down Expand Up @@ -190,7 +190,7 @@ export const Gantt: React.SFC<GanttProps> = ({
fontSize,
arrowIndent,
svgHeight,
onTasksDateChange: onTasksDateChange,
onTasksChange: handleTasksChange,
onDateChange,
onProgressChange,
onDoubleClick,
Expand Down
16 changes: 9 additions & 7 deletions src/components/gantt/task-gantt-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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> = ({
Expand All @@ -68,7 +68,7 @@ export const TaskGanttContent: React.FC<TaskGanttContentProps> = ({
arrowIndent,
fontFamily,
fontSize,
onTasksDateChange,
onTasksChange,
onDateChange,
onProgressChange,
onDoubleClick,
Expand Down Expand Up @@ -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") {
Expand Down Expand Up @@ -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: "" });
Expand Down
2 changes: 2 additions & 0 deletions src/components/task-list/task-list-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const TaskListTableDefault: React.FC<{
className={styles.taskListCell}
style={{
minWidth: rowWidth,
maxWidth: rowWidth,
}}
>
&nbsp;{t.start.toLocaleDateString(locale, dateTimeOptions)}
Expand All @@ -53,6 +54,7 @@ export const TaskListTableDefault: React.FC<{
className={styles.taskListCell}
style={{
minWidth: rowWidth,
maxWidth: rowWidth,
}}
>
&nbsp;{t.end.toLocaleDateString(locale, dateTimeOptions)}
Expand Down

0 comments on commit b555e8a

Please sign in to comment.