New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@figsify/react-new-orgchart

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@figsify/react-new-orgchart

An OrgChart fork with a focus on readability and compatibility with bulky diagrams.

latest
Source
npmnpm
Version
1.0.10
Version published
Maintainers
1
Created
Source

OrgChart

Why the fork on top of a fanstastic fork job?

  • Simply I need to have pdf export enabled to existing library; I do recommend to use original fork if there's no requirement for pdf export

Why use this fork?

  • Panning is now drag-to-scroll based, deprecating the transform CSS property logic. This avoids scrolling and visualization issues when rendering a large OrgChart.

  • Zooming is now scale() based. The main benefit of this change is that the ChartContainer module is simpler and easier to read when compared to the transformation-matrix splitting shenanigans. Using zoom() was a good enough alternative, but it is non-standard.

  • Orgchart downloading is now handled by the dom-to-image library. Dom-to-image has better predictability when dealing with large images, doesn't screw up your snapshot when scrolling, and is 70x faster.

  • Canvas maximum size limits are taken into account. Due to browser limitations, rendering a canvas with dimensions greater than 16384x16384 will result in a faulty, cropped snapshot. Thus, exporting a bulky OrgChart wasn't really possible. I solved this by scaling down any drawn images larger than the limit.

Props

NameTypeDefaultDescription
chartClassstringA css class to apply to the chart DOM node.
containerClassstringAdd an optional extra class name to .orgchart-container It could end up looking like class="orgchart-container xxx yyy".
collapsiblebooleantrueAllows expanding/collapsing the nodes.
datasourceobjectdatasource usded to build out structure of orgchart.
draggablebooleanfalseAllows dragging/dropping the nodes to the hierarchy of chart.
multipleSelectbooleanfalseIf true, user can select multiple nodes by mouse clicking.
NodeTemplateelementTypeA Component that provides the node content Markup. This is a useful prop when you want to use your own styles and markup to create a custom orgchart node.
onClickChartfunctionA callback fired when the orgchart is clicking.
onClickNodefunctionA callback fired when the node is clicking.
panbooleanfalseIf true, the chart can be panned.
zoombooleanfalseIf true, the chart can be zoomed.
maxZoomnumber7Represents the maximum possible zoom of the orgchart.
minZoomnumber0.5Represents the minimum possible zoom of the orgchart.
toggleableSiblingsbooleantrueWhether or not siblings should be toggleable. If false, also hides horizontal arrows.
loadingbooleanfalseUse this prop to trigger OrgChart's spinner on-demand.
loadingComponentReact Element<i className="oci oci-spinner"></i>Use your app's existing loading component to maintain design.
defaultZoomnumber0.5Set the initial zoom.

Methods

NameDescription
expandAllNodesUser can use this method to expand all the nodes. Sample code: orgchartRef.current.expandAllNodes()
exportToUser can use this method to export orgchart to png orge. Sample code: orgchartRef.current.exportTo(filename, filetype, options). supported file types are image/jpeg and application/pdf. options is an object, currently supports an option for switching between pdf drivers jspdf and dom-to-pdf
zoomIn(amount) User can use this method to zoom-in on the orgchart div. Default zoom amount is 0.05.
zoomIn(amount) User can use this method to zoom-out on the orgchart div. Default zoom amount is 0.05.
resetZoom() Resets zoom to defaultZoom.
setExporting() Sets exporting state. Useful if you need any transformations before actually exporting.

Install

npm install @figsify/react-new-orgchart

Keywords

react

FAQs

Package last updated on 07 Sep 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