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

react-visual-modeling

v1.1.5

Published

一个基于React的数据可视化建模的DAG图,适用于UML,数据库建模,数据仓库建设等业务

Downloads

108

Readme

English | 简体中文

✨ Feature

  • support custom field properties
  • support custom title, title Icon
  • support the shrinking / expanding state of nodes, and show the mapping relationship after shrinking
  • support custom edge attributes and custom edge label
  • support the node, field's status of hover, focus, linked and full chain highlight
  • support the right-click menu of node and edge
  • support minimap and highlight state of minimap
  • support custom empty field content

📦 Install

npm install react-visual-modeling

API

VisualModeling properties

| Property | Description | Type | Default | |:-------------:|:-------------------------------------------------------------------:|:----------------------------------------------------------------:|:-------:| | data | data | any | - | | width | component width | number | string | - | | height | component height | number | string  | - | | className | component className | string | - | | columns | property settings for each column of fieldscolumns Prop | Array< columns> | - | | nodeMenu | Node Right-click Menu Configuration | Array< menu> | [ ] | | edgeMenu | Edge Right-click Menu Configuration | Array< menu> | [ ] | | config | As configured aboveconfig Prop | any | - | | emptyContent | show content when table field is empty | string | JSX. Element | - | | emptyWidth | table container width when table field is empty | number | string | - | | onLoaded | canvas loaded event | (canvas) => void | - | | onChange | canvas data change event | (data) => void | - | | onFocusNode | focus node events | (node) => void | - | | onFocusEdge | focus edge events | (edge) => void | - | | onFocusCanvas | focus canvas blank events | () => void | - | | onDblClickNode| double click node events | () => void | - |

columns

property settings for each column of fields

| Property | Description | Type | Default | |:----------:|:----------------------------------------------------------------------------------:|:-----------------------------------------:|:-------:| | title | name of each column | string | - | | key | the unique mark of each column, corresponding to the key value on the data | string | - | | width | width of each column | number | - | | primaryKey | whether the value corresponding to the key in this column is used as a unique sign | boolean | - | | render | Customize the style of each column | (key) => void | - |

menu

right-click menu configuration for'Node/Edge'

| Property | Description | Type | Default | |:--------:|:---------------------------------------:|:-----------------------------------------------:|:-------:| | title | name of each column | string | - | | key | unique flag for each column menu | string | - | | render | Customize the style of each column menu | (key) => void | - | | onClick | Click Callback for Each Column | (key, data) => void | - |

config

the configuration of canvas

| Property | Description | Type | Default | |:------------------:|:------------------------------------------------------------------------------:|:---------------------------------------------------------------:|:-------:| | showActionIcon | whether show operation icon: zoom in, zoom out, focus | boolean | - | | allowKeyboard | allow keyboard to delete events. Todo: supports shift multiple selection later | boolean | - | | collapse | whether to allow node shrinkage | collapse Prop { } | - | | titleRender | rendering methods for node's title | (title) => void | - | | titleExtIconRender | rendering method of buttons on right side of node | (node) => void | - | | labelRender | rendering method of edge's label | (label) => void | - | | minimap | whether to show minimap | minimap Prop { } | - |

collapse

the configuration of node contraction

| Property | Description | Type | Default | |:-----------:|:-------------------------------:|:-----------------------------------:|:------------------------------------:| | enable | whether to allow node shrinkage | boolean | - | | defaultMode | default presentation form | string | show as 'expand/collapse' by default |

minimap

the configuration of minimap

| Property | Description | Type | Default | |:--------:|:-----------------------:|:---------------------------------------------------------------------------:|:-------:| | enable | whether to show minimap | boolean | - | | config | the config of minimap | minimap Config Prop { } | - |

minimap Config

the config of minimap

| Property | Description | Type | Default | |:---------------:|:-----------------:|:-------------------------------:|:-------:| | nodeColor | node color | any | - | | activeNodeColor | node active color | any | - |

🔗API

import VisualModeling from 'react-visual-modeling';
import 'react-visual-modeling/dist/index.css';
<VisualModeling
  data={data}
  column={column}
  nodeMenu={menu}
  edgeMenu={menu}
  config={config}
  onLoaded={() => {}}
  onChange={() => {}}
  onFocusNode={() => {}}
  onFocusEdge={() => {}}
  onFocusCanvas={() => {}}
  onDblClickNode={() => {}}
>
</VisualModeling>

🔗API

interface columns { // property settings for each column of fields
  title ? : string, // name of each column
  key: string, // the unique mark of each column, corresponding to the key value on the data
  width ? : number, // width of each column
  primaryKey: boolean, // whether the value corresponding to the key in this column is used as a unique sign
  render ? (value: any, rowData: any) : void // Customize the style of each column
}

interface config { // 
  showActionIcon ? : boolean, // whether show operation icon: zoom in, zoom out, focus
  allowKeyboard ? : boolean, // allow keyboard to delete events. Todo: supports shift multiple selection later
  collapse: {
    enable: boolean, // allow node shrinkage
    defaultMode: string // show as 'expand/collapse' by default
  },
  titleRender ? (title: JSX.Element) : void, // rendering methods for node's title
  titleExtIconRender ? (node: JSX.Element) : void, // rendering method of buttons on right side of node
  labelRender ? (label: JSX.Element) : void, // rendering method of edge's label
  minimap: { // whether to show minimap
    enable: boolean,
    config: {
      nodeColor: any, // node color
      activeNodeColor: any // active node color
    }
  }
}

interface menu { // right-click menu configuration for'Node/Edge'
  title ? : string, // name of each column
  key: string, // unique flag for each column menu
  render ? (key: string) : void, // Customize the style of each column menu
  onClick ? (key: string, data: any) : void, // Click Callback for Each Column
}

interface props {
  width ? : number | string, // component width
  height ? : number | string, // component height
  className ? : string, // component className
  columns: Array < columns > , // similar to antd's table column concept
  nodeMenu: Array < menu > , // Node Right-click Menu Configuration
  edgeMenu: Array < menu > , // Edge Right-click Menu Configuration
  config: config, // As configured above
  data: any, // data
  emptyContent ? : string | JSX.Element; // show content when table field is empty
  emptyWidth ? : number | string; // table container width when table field is empty
  onLoaded(canvas: any): void, // canvas loaded event
  onChange(data: any): void, // canvas data change event
  onFocusNode(node: any): void, // focus node events
  onFocusEdge(edge: any): void, // focus edge events
  onFocusCanvas(): void, // focus canvas blank events
};

If you need more customized requirements, you can refer to issue or butterfly to customize your needs