New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-lineage-dag

Package Overview
Dependencies
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-lineage-dag

> 用于表示表与表之间,表和其他关联实体之间关系的图

  • 1.0.0
  • npm
  • Socket score

Version published
Weekly downloads
61
increased by27.08%
Maintainers
1
Weekly downloads
 
Created
Source

血缘图

用于表示表与表之间,表和其他关联实体之间关系的图

demo preview

✨ 特性

  • 开箱即用的关系图表
  • 支持自定义操作、自定义节点事件
  • 优雅、自然的交互设计

使用

$ npm install lineage-dag # or (yarn add lineage-dag)
import {LineageTable} from 'lineage-dag';

const data = {
  tables: [
    {
      id: '1',
      name: 'table-1',
      columns: [
        {
          name: 'id',
          title: 'id'
        },
        {
          name: 'age',
          title: 'age'
        }
      ]
    },
    {
      id: '2',
      name: 'table-2',
      columns: [
        {
          name: 'id',
          title: 'id'
        },
        {
          name: 'age',
          title: 'age'
        }
      ]      
    },
    {
      id: '3',
      name: 'table-3',
      columns: [
        {
          name: 'id',
          title: 'id'
        },
        {
          name: 'age',
          title: 'age'
        }
      ]      
    }    
  ],
  relations: [
    {
      srcTableId: '1',
      tgtTableId: '2',
      srcTableColName: 'id',
      tgtTableColName: 'age'
    },
    {
      srcTableId: '1',
      tgtTableId: '3',
      srcTableColName: 'id',
      tgtTableColName: 'age'
    }
  ]
}

const App = () => {
  return (
    <LineageTable {...data} />
  )
}

Props

属性名属性类型默认值说明
tablesITable[][]具体描述位于表格下方
relationsIRelation[][]具体描述位于表格下方
onTableDoubleClickFunctionnoop表格双击事件
onLoadedFunctionnoopbutterfly加载完毕时
onEachFrameFunctionnoopbutterfly每一次数据绘制完毕时重绘
  interface ITable {
    id: string;                 // 表ID
    icon: JSX.Element;          // 表头icon
    name: string;               // 表名(显示名)
    isHide: boolean;            // 是否折叠所有列
    columns: {
      name: string;             // 列英文名(唯一标识)
      icon: string;             // 列icon
      title: string;            // 列显示名
      onClick: () => void;      // 点击回调函数
    }[],
    operators: {
      compent: JSX.Element      // 操作项渲染
    }[]
  }

  interface IRelation {
    id?: string;                 // 关系ID,非必填,建议填写
    srcTableId: string;          // 源表格ID
    tgtTableId: string;          // 目标表格ID
    srcTableColName: string;     // 源表字段名
    tgtTableColName: string;     // 目标表字段名
  }

Dev

# clone 本项目后
$ make install && npm start

FAQs

Package last updated on 17 Jun 2021

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc