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

gantter-g

v1.0.13

Published

基于[g](https://github.com/antvis/g)引擎的甘特图组件

Downloads

5

Readme

Gantter-g with react

基于g引擎的甘特图组件

Install

npm install gantter-g
yarn add gantter-g

Usage

export default () => {
  return (
    <Gantter
      columns={[
        { key: 'name', name: '姓名', width: 200 },
        { key: 'gender', name: '性别', width: 100 },
        { key: 'age', name: '年龄', width: 200 }
      ]}
      dataSource={[
        {
          name: '张三',
          gender: '男',
          age: 20,
          distribution: [
            { name: '任务一', start: '2020-01-01', end: '2020-03-01', content: '任务介绍' },
            { name: '任务二', start: '2020-03-01', end: '2020-06-01', color: '#0000ff' },
            { name: '任务三', start: '2020-06-01', end: '2020-09-01' },
          ]
        },
        {
          name: '李四',
          gender: '男',
          age: 30,
          distribution: [
            { name: '任务一', start: '2020-01-01', end: '2020-03-01' },
            { name: '任务二', start: '2020-03-01', end: '2020-06-01' },
            { name: '任务三', start: '2020-06-01', end: '2020-09-01' },
          ]
        },
        {
          name: '赵五',
          gender: '男',
          age: 25,
          distribution: [
            { name: '任务一', start: '2020-01-01', end: '2020-03-01' },
            { name: '任务二', start: '2020-03-01', end: '2020-06-01' },
            { name: '任务三', start: '2020-06-01', end: '2020-09-01' },
          ]
        }
      ]}
      gantterReplaceKeys={{
        list: 'distribution',
        title: 'name'
      }}
      tooltip={{
        formatter: value => ([
          {
            text: value.name,
            style: {
              fontSize: 14,
              fontWeight: 'bold'
            }
          },
          {
            text: `${value.start} - ${value.end}`,
            style: {
              fontSize: 14
            }
          },
          {
            text: `周期:${(new Date(value.end).getTime() - new Date(value.start).getTime()) / (1000 * 3600 * 24)}天`,
            style: {
              fontSize: 14
            }
          }
        ])
      }}
      gantterBarText={{
        show: true,
        formatter: value =>({
          text: value.name
        })
      }}
      theme={{
        gantterStopColor: '#ececec',
        gantterProgressColor: '#64e25e',
        gantterUnbeginColor: '#4eacfd'
      }}
    />
  )
}

API

参数|说明|类型|默认值 --|:--:|--:|--: columns|表头|object[]|- dataSource|数据数组|object[]|- showOrder|是否显示序号|Boolean|true gantterReplaceKeys|进度替换字段|object|如下 tooltip|提示框|object|如下 gantterBarText|进度条上文字|object|如下 theme|主题设置|object|如下

columns

参数|说明|类型|默认值 --|:--:|--:|--: key|唯一标识|string|必填 name|名称|string|必填 width|列宽|number|100 tooltip|是否显示提示|boolean|false

gantterReplaceKeys

参数|说明|类型|默认值 --|:--:|--:|--: list|数组键名|string|list start|开始日期|string|start end|结束日期|string|end title|标题|string|title content|说明|string|content color|进度条颜色|string|color

tooltip

参数|说明|类型|默认值 --|:--:|--:|--: show|是否显示|boolean|true formatter|提示框显示内容|(value: gantterReplaceKey) => object[]|-

formatter返回格式

[
  {
    text: item[replaceKeys.title],
    style: {
      fontSize: 14,
      fontWeight: 'bold',
    }
  },
  {
    text: `${item[replaceKeys.start]} - ${item[replaceKeys.end]}`,
    style: {
      fontSize: 14
    }
  }
]

gantterBarText

参数|说明|类型|默认值 --|:--:|--:|--: show|是否显示|boolean|true formatter|进度条显示文字内容|(value: gantterReplaceKey) => string|-

theme

参数|说明|默认值 --|:--:|--: backgroundColor|通用背景色| borderColor|通用边框色| fontColor|通用文字颜色| dragDividerColor|拖动条颜色| dragDividerBorderColor|拖动条边框颜色| scrollBarSlideColor|滚动条滑道颜色| scrollBarThumbColor|滚动条滑块颜色| scrollBarThumbHoverColor|鼠标移入滑块颜色| scrollBarThumbDownColor|鼠标按下滑块颜色| tableHeaderDividerColor|表头分割线| tableHeaderBottomBorderColor|表头下边线| tableHeaderBackgroundColor|表头背景色| tableHeaderFontColor|表头文字颜色| tableRowDividerColor|表格横向分割线| tableColDividerColor|表格纵向分割线| tableOddBackgroundColor|表格奇数行背景| tableEvenBackgroundColor|表格偶数行背景| tableCellFontColor|表格文字背景| gantterStopColor|已结束进度条颜色| gantterProgressColor|进行中进度条颜色| gantterUnbeginColor|未开始进度条颜色| gantterDividerColor|甘特图分割线颜色| gantterBarShadowColor|鼠标移入进度条阴影颜色| gantterbarLineColor|进度条描边颜色| popoverBackground|气泡卡片背景色| popoverShadowColor|气泡卡片阴影颜色|

组件调试

yarn dev
yarn dev story

运行测试用例

yarn test

按照社区规范和最佳实践,生成构建产物

yarn build

继续创建更多项目要素

yarn new

其他

yarn lint         # 检查和修复所有代码
yarn change       # 添加 changeset,用于发版时生成 changelog
yarn bump         # 生成发版相关的修改,比如更新版本号、生成 changelog
yarn release      # 根据 bump 自动修改和人工修改的发版要求,发布项目