1.1.5 • Published 3 years ago

react-visual-modeling v1.1.5

Weekly downloads
45
License
MIT
Repository
gitlab
Last release
3 years ago

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

PropertyDescriptionTypeDefault
datadataany-
widthcomponent widthnumber | string-
heightcomponent heightnumber | string -
classNamecomponent classNamestring-
columnsproperty settings for each column of fieldscolumns PropArray< columns> -
nodeMenuNode Right-click Menu ConfigurationArray< menu>
edgeMenuEdge Right-click Menu ConfigurationArray< menu>
configAs configured aboveconfig Propany -
emptyContentshow content when table field is emptystring | JSX. Element-
emptyWidthtable container width when table field is emptynumber | string-
onLoadedcanvas loaded event(canvas) => void-
onChangecanvas data change event(data) => void-
onFocusNodefocus node events(node) => void-
onFocusEdgefocus edge events(edge) => void-
onFocusCanvasfocus canvas blank events() => void-
onDblClickNodedouble click node events() => void-

columns

property settings for each column of fields

PropertyDescriptionTypeDefault
titlename of each columnstring-
keythe unique mark of each column, corresponding to the key value on the datastring-
widthwidth of each columnnumber-
primaryKeywhether the value corresponding to the key in this column is used as a unique signboolean-
renderCustomize the style of each column(key) => void-

menu

right-click menu configuration for'Node/Edge'

PropertyDescriptionTypeDefault
titlename of each columnstring-
keyunique flag for each column menustring-
renderCustomize the style of each column menu(key) => void-
onClickClick Callback for Each Column(key, data) => void-

config

the configuration of canvas

PropertyDescriptionTypeDefault
showActionIconwhether show operation icon: zoom in, zoom out, focusboolean-
allowKeyboardallow keyboard to delete events. Todo: supports shift multiple selection laterboolean-
collapsewhether to allow node shrinkagecollapse Prop { }-
titleRenderrendering methods for node's title(title) => void-
titleExtIconRenderrendering method of buttons on right side of node(node) => void-
labelRenderrendering method of edge's label(label) => void-
minimapwhether to show minimapminimap Prop { }-

collapse

the configuration of node contraction

PropertyDescriptionTypeDefault
enablewhether to allow node shrinkageboolean-
defaultModedefault presentation form stringshow as 'expand/collapse' by default

minimap

the configuration of minimap

PropertyDescriptionTypeDefault
enablewhether to show minimapboolean-
configthe config of minimapminimap Config Prop { }-

minimap Config

the config of minimap

PropertyDescriptionTypeDefault
nodeColornode colorany-
activeNodeColornode active colorany-

🔗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

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.46

3 years ago

1.0.45

3 years ago

1.0.40

3 years ago

1.0.44

3 years ago

1.0.43

3 years ago

1.0.42

3 years ago

1.0.41

3 years ago

1.0.38

3 years ago

1.0.37

3 years ago

1.0.36

3 years ago

1.0.19

3 years ago

1.0.22

3 years ago

1.0.21

3 years ago

1.0.20

3 years ago

1.0.26

3 years ago

1.0.25

3 years ago

1.0.24

3 years ago

1.0.23

3 years ago

1.0.29

3 years ago

1.0.28

3 years ago

1.0.27

3 years ago

1.0.33

3 years ago

1.0.32

3 years ago

1.0.31

3 years ago

1.0.30

3 years ago

1.0.35

3 years ago

1.0.34

3 years ago

1.0.18

3 years ago

1.0.16

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago