npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@wamra/gantt-task-react

v0.6.17

Published

Interactive Gantt Chart for React with TypeScript

Downloads

867

Readme

gantt-task-react

Interactive Gantt Chart for React with TypeScript.

A highly customizable and interactive Gantt chart component for React with TypeScript support. This repository integrates features and enhancements from the original MaTeMaTuK/gantt-task-react , the ObeoNetwork/gantt-task-react fork, and our current development, creating a comprehensive solution for managing Gantt charts.

multi-hierarchy.png

Key Features

  • Performance Improvements: Optimized rendering to handle large datasets efficiently, ensuring smooth user interactions.
  • Enhanced Customization: Allows for more extensive task styling options to match brand-specific requirements.
  • TypeScript Integration: Improved type definitions for safer and more efficient development workflows.
  • Responsive Design: Improved mobile and tablet support for better usability across different devices.
  • Dependency Management: Enhanced task dependency features, allowing for more complex project planning scenarios.
  • Advanced Timeline Navigation: Features smooth navigation across different timeframes like months and weeks.
  • Localization Support: Offers localization for various languages and date formats.
  • Event Handling: Supports comprehensive event handling for interactive features.
  • QuarterYear View Mode: Supports viewing tasks in quarterly segments, providing a flexible timeline view.

Enhancement Summary

This repository combines the foundational work of MaTeMaTuK/gantt-task-react with enhancements from ObeoNetwork, including better integration with TypeScript, improved rendering performance for large datasets, and new customization options for task styling. The project is further developed in this fork, focusing on additional usability improvements and feature expansions.

Installation

Install the package using npm:

npm install @wamra/gantt-task-react

How to use it

import { Gantt, Task, EventOption, StylingOption, ViewMode, DisplayOption } from '@wamra/gantt-task-react';
import "@wamra/gantt-task-react/dist/style.css";

let tasks: Task[] = [
  {
    start: new Date(2020, 1, 1),
    end: new Date(2020, 1, 2),
    name: 'Idea',
    id: 'Task 0',
    type: 'task',
    progress: 45,
    isDisabled: true,
    styles: { progressColor: '#ffbb54', progressSelectedColor: '#ff9e0d' },
  },
  ...
];
<Gantt tasks={tasks}/>

You may handle actions

<Gantt
  tasks={tasks}
  viewMode={view}
  onDateChange={onTaskChange}
  onTaskDelete={onTaskDelete}
  onProgressChange={onProgressChange}
  onDoubleClick={onDblClick}
  onClick={onClick}
/>

How to run example

cd ./example
npm install
npm start

Gantt Configuration

GanttProps

| Parameter Name | Type | Description | | :------------------------------ | :------------ | :------------------------------------------------- | | tasks* | Task | An array of tasks to display in the Gantt chart. | | viewMode | ViewMode | Specifies the time scale for the chart. | | onDateChange | function | Callback when a task's start or end date changes. | | onProgressChange | function | Callback when a task's progress changes. | | onDoubleClick | function | Callback when a task is double-clicked. | | onClick | function | Callback when a task is clicked. | | rtl | boolean | Right-to-left display mode. | | locale | Locale | Localization for date and time formatting. | | barBackgroundColor | string | Background color of task bars. | | barProgressColor | string | Color of the task bar's progress indicator. | | projectBackgroundColor | string | Background color for project tasks. | | milestoneBackgroundColor | string | Background color for milestone tasks. | | todayColor | string | Color of the "today" indicator line. | | arrowColor | string | Color of dependency arrows. | | fontFamily | string | Font family for the chart. | | fontSize | string | Font size for text within the chart. | | rowHeight | number | Height of each row. | | columnWidth | number | Width of each time unit column. | | ganttHeight | number | Total height of the Gantt chart. | | ganttWidth | number | Total width of the Gantt chart. | | taskHeight | number | Height of task bars within each row. | | dependencies | boolean | Display task dependencies as arrows. | | taskListCellWidth | string | Width of the task list cell. Empty to hide. | | dragStep | number | Time step for dragging actions, in milliseconds. |

EventOption

| Parameter Name | Type | Description | | :----------------- | :---------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------- | | onSelect | (task: Task, isSelected: boolean) => void | Function to execute on taskbar select/unselect event. | | onDoubleClick | (task: Task) => void | Function to execute on taskbar double-click event. | | onClick | (task: Task) => void | Function to execute on taskbar click event. | | onDelete* | (task: Task) => void/boolean/Promise/Promise | Function to execute on taskbar delete button press event. | | onDateChange* | (task: Task, children: Task[]) => void/boolean/Promise/Promise | Function to execute when dragging taskbar event on timeline finishes. | | onProgressChange* | (task: Task, children: Task[]) => void/boolean/Promise/Promise | Function to execute when dragging taskbar progress event finishes. | | onExpanderClick* | onExpanderClick: (task: Task) => void; | Function to execute on the table expander click. | | onWheel* | onWheel: (wheelEvent: WheelEvent) => void; | Function to execute when the mouse wheel is used. | | timeStep | number | Time step value for onDateChange. Specify in milliseconds. |

Chart undoes operation if method returns false or error. Parameter children returns one-level deep records.

DisplayOption

| Parameter Name | Type | Description | | :------------------ | :------ | :---------------------------------------------------------------------------------------------------------------------------------------| | viewMode | enum | Specifies the time scale. Options: Hour, Quarter Day, Half Day, Day, Week(ISO-8601, 1st day is Monday), Month, QuarterYear, Year. | | viewDate | date | Specifies display date and time for display. | | preStepsCount | number | Specifies empty space before the first task. | | locale | string | Specifies the month name language. Able formats: ISO 639-2, Java Locale. | | monthCalendarFormat | string | Specifies the month display on the calendar. | | monthTaskListFormat | string | Specifies the month display on the list. | | rtl | boolean | Sets rtl mode. | | roundDate | | Allows customizing the way the date start/end are rounded. | | checkIsHoliday | | Tells if a date is a holiday. Impacts the style of the day and the way the date is adjusted to working days. | | dateMoveStep | | An object corresponding to a duration. Gives the step to adjust to the working day when moving the date allowing smooth feedback. |

StylingOption

| Parameter Name | Type | Description | |----------------------------|--------|----------------------------------------------------------------------------------------------------------| | headerHeight | number | Specifies the header height. | | columnWidth | number | Specifies the time period width. | | listCellWidth | string | Specifies the task list cell width. Empty string means "no display". | | rowHeight | number | Specifies the task row height. | | barCornerRadius | number | Specifies the taskbar corner rounding. | | barFill | number | Specifies the taskbar occupation, in percent from 0 to 100. | | handleWidth | number | Specifies the width of the taskbar drag control for start and end dates. | | fontFamily | string | Specifies the font family for the application. | | fontSize | string | Specifies the font size for the application. | | barProgressColor | string | Specifies the taskbar progress fill color globally. | | barProgressSelectedColor | string | Specifies the taskbar progress fill color globally when selected. | | barBackgroundColor | string | Specifies the taskbar background fill color globally. | | barBackgroundSelectedColor | string | Specifies the taskbar background fill color globally when selected. | | arrowColor | string | Specifies the relationship arrow fill color. | | arrowIndent | number | Specifies the relationship arrow right indent, in px. | | todayColor | string | Specifies the current period column fill color. | | TooltipContent | React.FC<{ task: Task; fontSize: string; fontFamily: string; }>; | Specifies the Tooltip view for selected taskbar. | | TaskListHeader | React.FC<{ headerHeight: number; rowWidth: string; fontFamily: string; fontSize: string;}>; | Specifies the task list Header view | | TaskListTable | React.FC<{ rowHeight: number; rowWidth: string; fontFamily: string; fontSize: string; locale: string; tasks: Task[]; selectedTaskId: string; setSelectedTask: (taskId: string) => void; }>; | Specifies the task list Table view |

Task

| Parameter Name | Type | Description | | :------------- | :------- | :---------------------------------------------------------------------------------------------------- | | id* | string | Task id. | | name* | string | Task display name. | | type* | string | Task display type: task, milestone, project | | start* | Date | Task start date. | | end* | Date | Task end date. | | progress* | number | Task progress. Sets in percent from 0 to 100. | | assignees* | string[] | List of people assigned to the task | | dependencies | string[] | Specifies the parent dependencies ids. | | styles | object | Specifies the taskbar styling settings locally. Object is passed with the following attributes: | | | | - backgroundColor: String. Specifies the taskbar background fill color locally. | | | | - backgroundSelectedColor: String. Specifies the taskbar background fill color locally on select. | | | | - progressColor: String. Specifies the taskbar progress fill color locally. | | | | - progressSelectedColor: String. Specifies the taskbar progress fill color globally on select. | | isDisabled | bool | Disables all action for current task. | | fontSize | string | Specifies the taskbar font size locally. | | project | string | Task project name | | hideChildren | bool | Hide children items. Parameter works with project type only |

*Required

License

MIT