Socket
Socket
Sign inDemoInstall

nice-react-gantt

Package Overview
Dependencies
8
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    nice-react-gantt

A beautiful react gantt component with antd style. This is a fork of [JSainsburyPLC/react-timelines](https://github.com/JSainsburyPLC/react-timelines)


Version published
Weekly downloads
12
Maintainers
1
Created
Weekly downloads
 

Readme

Source

React-gantt-antd

A beautiful react gantt component with antd style.
This is a fork of JSainsburyPLC/react-timelines

snapshot

Install

yarn add react-gantt-antd

Example

import React from 'react'
import Gantt from 'react-gantt-antd'
import 'react-gantt-antd/lib/css/style.css'

export default function App() {
  const tasks_a = [
    {
      id: "title1",
      title: "任务名称",
      start: new Date('2020-06-01'),
      end: new Date('2020-08-02'),
    }
  ]

  const tasks_b = [
    {
      id: "title1",
      title: "任务名称",
      start: new Date('2020-07-01'),
      end: new Date('2020-09-02'),
    }
  ]

  const sub_projects = [
    {
      id: "sub_project1",
      title: "子项目",
      tasks: tasks_b,
    }
  ]

  const projects = [
    {
      id: "project1",
      title: "项目1",
      tasks: tasks_a,
      projects: sub_projects,
      isOpen: false,
    }
  ]
  return (
    <Gantt
      start={new Date('2020-06-01')}
      end={new Date('2020-10-01')}
      now={new Date('2020-7-01')}
      zoom={1}
      projects={projects}
      enableSticky
      scrollToNow
    />
  )
}

export default App

API

Gantt

PropertyvaluedefaultDescriptions
startDateThe start date of the timeline
endDateThe start date of the timeline
nowDatenew Date()'now' marker position
zoomNumber1The scale of the timeline width
projectsList[]The project list
minWidthNumber120The min width of the timeline when resizing the window
sideWidthNumber400The width of the sidebar
clickTaskfunctionwhen click task element
enableStickyBooltrueDetermine whether the header is sticky or not
scrollToNowBooltrueDetermine whether to scroll to the now marker at first or not

Project

PropertyvaluedefaultDescriptions
idString/NumberThe id of the Project
titleString/ElementThe title of the Project
tasksListAll the tasks of the Project
projectsListAll the sub projects of the Project
isOpenBoolfalseDetermine whether the project is folded not

Task

PropertyvaluedefaultDescriptions
idString/NumberThe id of the Task
titleString/ElementThe title of the Task
startDateThe start date of the Task
endDateThe start date of the Task

Development

yarn install
yarn watch
yarn build
npm config set registry=http://registry.npmjs.org
npm config set registry=https://registry.npm.taobao.org/

Keywords

FAQs

Last updated on 17 Mar 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc