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

mxgraph-editor

v1.0.3

Published

mxgraph editor

Downloads

18

Readme

mxgraph-editor

A mxGraph editor support 3 types of shapes, svg/image/card.

development

npm install

npm start

install

npm install --save mxgraph-editor

demo

See the detail in ./demo .

start the demo

// start the demo
npm start

code

import Sidebar from './sidebar';
import Toolbar from './toolbar';

import IMAGE_SHAPES from './shape-config/image-shape';
import CARD_SHAPES from './shape-config/card-shape';
import SVG_SHAPES from './shape-config/svg-shape.xml';

import Editor from 'mxgraph-editor';

const editor = new Editor({
    container: '.graph-content',
    clickFunc: this.clickFunc,
    doubleClickFunc: this.doubleClickFunc,
    autoSaveFunc: this.autoSaveFunc,
    cellCreatedFunc: this.cellCreatedFunc,
    deleteFunc: this.deleteFunc,
    valueChangeFunc: this.valueChangeFunc,
    IMAGE_SHAPES,
    CARD_SHAPES,
    SVG_SHAPES
  });

 render() {
    return (
      <div className="editor-container">
        <Layout>
          <Sider width="235" theme="light">
            <Sidebar key="sidebar" graph={this.editor} />
          </Sider>
          <Content>
            <div className="graph-inner-container">
              <Toolbar
                graph={this.editor}
                updateDiagramData={this.updateDiagramData}
              />
              <div className="graph-content" key="graphcontent" />
            </div>
          </Content>
        </Layout>
      </div>
    );
  }

api

|property| description| type| default| |---|---|---|---| |SVG_SHAPES|SVG shapes config|Array|[]| |CARD_SHAPES|card shapes config|Array|[]| |IMAGE_SHAPES|image shapes config|Array|[]| |container|container dom selector|selector| |clickFunc|click event callback|function(cell)| |doubleClickFunc|double click event callback|function(cell)|| |autoSaveFunc|auto save callback|function(xml)| |cellCreatedFunc|cell created callback|function(cell)|| |deleteFunc|cell delete callback|function(e)|| |valueChangeFunc|cell value change callback|function(value)|| |initSidebar|init the sidebar|function(elements)|| |initCustomPort|the custom port, 10x10px|function((picture))|| |zoom|zoom|function(type),input params:in(zoom in)、out(zoom out)、actual(zoom actual)|| |updateStyle|update style|function(cell, key, value),input params:cell,key (the key of style),value (the value of style)|| |groupCells|group cells|function(groupId, labelName),input params:groupId(group id),name (group label)|| |ungroupCells|ungroup cells|function(cells)| |getCellsSelected|get all cells selected|function()|| |getGraphXml|get the xml of graph|function()|| |createVertex|create vertex|function(shapeLabel, x, y, width, height, shapeStyle)| |insertEdge|insert edge|function(vertex1, vertex2)|| |getCellById|get cell by id|function(id)|| |getAllCells|get all cells|function()| |refresh|refresh the graph|function()|| |clearSelection|clear the selection in the graph|function()|| |startPanning|start panning|function()|| |stopPanning|stop panning|function()||