2020-07-30 00:06:39 +03:00
|
|
|
# gantt-task-react
|
|
|
|
|
|
|
|
|
|
## Interactive Gantt Chart for React with TypeScript.
|
|
|
|
|
|
2020-07-30 00:05:59 +03:00
|
|
|

|
2020-07-22 23:33:13 +03:00
|
|
|
|
2020-08-05 08:30:38 +03:00
|
|
|
## [Live Demo](https://matematuk.github.io/gantt-task-react/)
|
|
|
|
|
|
2020-07-24 10:47:31 +03:00
|
|
|
## Install
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
npm install gantt-task-react
|
|
|
|
|
```
|
|
|
|
|
|
2020-07-22 23:33:13 +03:00
|
|
|
## How to use it
|
|
|
|
|
|
|
|
|
|
```javascript
|
2020-08-05 08:14:22 +03:00
|
|
|
import { Gantt, Task, EventOption, StylingOption, ViewMode, DisplayOption } from 'gantt-task-react';
|
2020-07-22 23:33:13 +03:00
|
|
|
let tasks: Task[] = [
|
|
|
|
|
{
|
|
|
|
|
start: new Date(2020, 1, 1),
|
|
|
|
|
end: new Date(2020, 1, 2),
|
|
|
|
|
name: 'Idea',
|
|
|
|
|
id: 'Task 0',
|
|
|
|
|
progress: 45,
|
|
|
|
|
isDisabled: true,
|
|
|
|
|
styles: { progressColor: '#ffbb54', progressSelectedColor: '#ff9e0d' },
|
|
|
|
|
},
|
|
|
|
|
...
|
|
|
|
|
];
|
|
|
|
|
<Gantt tasks={tasks} />
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
You may handle actions
|
|
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
|
<Gantt
|
|
|
|
|
tasks={tasks}
|
|
|
|
|
viewMode={view}
|
|
|
|
|
onDateChange={onTaskChange}
|
|
|
|
|
onTaskDelete={onTaskDelete}
|
|
|
|
|
onProgressChange={onProgressChange}
|
|
|
|
|
onDoubleClick={onDblClick}
|
|
|
|
|
/>
|
|
|
|
|
```
|
|
|
|
|
|
2020-07-24 10:47:31 +03:00
|
|
|
## How to run example
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
cd ./example
|
|
|
|
|
npm install
|
|
|
|
|
npm start
|
|
|
|
|
```
|
|
|
|
|
|
2020-07-22 23:33:13 +03:00
|
|
|
## Gantt Configuration
|
|
|
|
|
|
2020-07-24 10:34:35 +03:00
|
|
|
### GanttProps
|
2020-07-24 10:26:44 +03:00
|
|
|
|
2020-07-30 00:01:51 +03:00
|
|
|
| Parameter Name | Type | Required | Description |
|
|
|
|
|
| :------------------------------ | :-------- | :------- | :------------------------------------------------- |
|
|
|
|
|
| tasks | Task | Yes | Tasks array. |
|
|
|
|
|
| [EventOption](#EventOption) | interface | No | Specifies gantt events. |
|
|
|
|
|
| [DisplayOption](#DisplayOption) | interface | No | Specifies view type and display timeline language. |
|
|
|
|
|
| StylingOption | interface | No | Specifies chart and global tasks styles |
|
2020-07-24 10:26:44 +03:00
|
|
|
|
2020-07-24 10:34:35 +03:00
|
|
|
### EventOption
|
2020-07-24 10:14:18 +03:00
|
|
|
|
|
|
|
|
| Parameter Name | Type | Required | Description |
|
2020-07-30 00:01:51 +03:00
|
|
|
| :--------------- | :-------------------------------- | :------- | :------------------------------------------------------------------------------------ |
|
2020-07-24 10:14:18 +03:00
|
|
|
| onDoubleClick | (task: Task) => any | No | Specifies the function to be executed on the bar`s onDoubleClick event. |
|
|
|
|
|
| onTaskDelete | (task: Task) => void/Promise<any> | No | Specifies the function to be executed on the bar`s on Delete button press event. |
|
|
|
|
|
| onDateChange | (task: Task) => void/Promise<any> | No | Specifies the function to be executed when drag bar`s event on timeline has finished. |
|
2020-07-30 00:01:51 +03:00
|
|
|
| onProgressChange | (task: Task) => void/Promise<any> | No | Specifies the function to be executed when drag bar`s progress event has finished. |
|
|
|
|
|
| timeStep | number | No | A time step value for onDateChange. Specify in milliseconds. |
|
2020-07-24 10:14:18 +03:00
|
|
|
|
2020-07-24 10:34:35 +03:00
|
|
|
### DisplayOption
|
2020-07-24 10:14:18 +03:00
|
|
|
|
2020-07-30 00:01:51 +03:00
|
|
|
| Parameter Name | Type | Required | Description |
|
|
|
|
|
| :------------- | :----- | :------- | :---------------------------------------------------------------------------------------------- |
|
|
|
|
|
| viewMode | enum | No | Specifies the time scale. Quarter Day, Half Day, Day, Week(ISO-8601, 1st day is Monday), Month. |
|
|
|
|
|
| locale | string | No | Specifies the month name language. Able formats: ISO 639-2, Java Locale. |
|
2020-07-23 10:05:42 +03:00
|
|
|
|
|
|
|
|
Work in progress
|