yarn update
This commit is contained in:
parent
b284ed6808
commit
260bbac368
@ -1,9 +1,9 @@
|
|||||||
import React from "react";
|
import React from 'react';
|
||||||
import { GridBody, GridBodyProps } from "./grid-body";
|
import { GridBody, GridBodyProps } from './grid-body';
|
||||||
import { GridHeader, GridHeaderProps } from "./grid-header";
|
import { GridHeader, GridHeaderProps } from './grid-header';
|
||||||
|
|
||||||
export type GridProps = GridBodyProps & GridHeaderProps;
|
export type GridProps = GridBodyProps & GridHeaderProps;
|
||||||
export const Grid: React.FC<GridProps> = (props) => {
|
export const Grid: React.FC<GridProps> = props => {
|
||||||
return (
|
return (
|
||||||
<g className="grid">
|
<g className="grid">
|
||||||
<GridHeader {...props} />
|
<GridHeader {...props} />
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import React from "react";
|
import React from 'react';
|
||||||
import { BarTask } from "../../types/bar-task";
|
import { BarTask } from '../../types/bar-task';
|
||||||
|
|
||||||
type ArrowProps = {
|
type ArrowProps = {
|
||||||
taskFrom: BarTask;
|
taskFrom: BarTask;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { Task } from "../types/public-types";
|
import { Task } from '../types/public-types';
|
||||||
import { BarTask } from "../types/bar-task";
|
import { BarTask } from '../types/bar-task';
|
||||||
|
|
||||||
export const convertToBarTasks = (
|
export const convertToBarTasks = (
|
||||||
tasks: Task[],
|
tasks: Task[],
|
||||||
@ -31,7 +31,7 @@ export const convertToBarTasks = (
|
|||||||
const dependencies = task.dependencies || [];
|
const dependencies = task.dependencies || [];
|
||||||
for (let j = 0; j < dependencies.length; j++) {
|
for (let j = 0; j < dependencies.length; j++) {
|
||||||
const dependence = barTasks.findIndex(
|
const dependence = barTasks.findIndex(
|
||||||
(value) => value.id === dependencies[j]
|
value => value.id === dependencies[j]
|
||||||
);
|
);
|
||||||
if (dependence !== -1) barTasks[dependence].barChildren.push(i);
|
if (dependence !== -1) barTasks[dependence].barChildren.push(i);
|
||||||
}
|
}
|
||||||
@ -148,7 +148,7 @@ export const getProgressPoint = (
|
|||||||
progressX,
|
progressX,
|
||||||
taskY + taskHeight - 8.66,
|
taskY + taskHeight - 8.66,
|
||||||
];
|
];
|
||||||
return point.join(",");
|
return point.join(',');
|
||||||
};
|
};
|
||||||
|
|
||||||
export const startByX = (x: number, xStep: number, task: BarTask) => {
|
export const startByX = (x: number, xStep: number, task: BarTask) => {
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
import { Task } from "../types/public-types";
|
import { Task } from '../types/public-types';
|
||||||
|
|
||||||
type GanttReduceState = {
|
type GanttReduceState = {
|
||||||
ganttTasks: Task[];
|
ganttTasks: Task[];
|
||||||
};
|
};
|
||||||
|
|
||||||
export type GanttReduceAction = {
|
export type GanttReduceAction = {
|
||||||
type: "update" | "delete";
|
type: 'update' | 'delete';
|
||||||
changedTask?: Task;
|
changedTask?: Task;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -14,17 +14,17 @@ export function ganttReducer(
|
|||||||
action: GanttReduceAction
|
action: GanttReduceAction
|
||||||
): GanttReduceState {
|
): GanttReduceState {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case "update": {
|
case 'update': {
|
||||||
return {
|
return {
|
||||||
ganttTasks: state.ganttTasks.map((t) =>
|
ganttTasks: state.ganttTasks.map(t =>
|
||||||
t.id === action.changedTask?.id ? action.changedTask : t
|
t.id === action.changedTask?.id ? action.changedTask : t
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
case "delete": {
|
case 'delete': {
|
||||||
return {
|
return {
|
||||||
ganttTasks: state.ganttTasks.filter(
|
ganttTasks: state.ganttTasks.filter(
|
||||||
(t) => t.id !== action.changedTask?.id
|
t => t.id !== action.changedTask?.id
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { Task } from "./public-types";
|
import { Task } from './public-types';
|
||||||
|
|
||||||
export interface BarTask extends Task {
|
export interface BarTask extends Task {
|
||||||
index: number;
|
index: number;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user