1.0.3 • Published 1 year ago

@code4bones/react-tree-menu-property-grid v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

TreeMenu / PropertyGrid

npm npm

System default / Custom theme

sample

featuresample
capcap
capcap

clone, samples available via yarn storybook

Brief

yarn add @code4bones/react-tree-menu-property-grid

import  {TreeMenu, TreeMenuActions,TreeMenuItem }  from "@code4bones/react-tree-menu-property-grid";
import "@code4bones/react-tree-menu-property-grid/build/styles.css";

const ITEMS : TreeMenuItem[] = [{
  id:"item1",
  title:"Item 1",
  // other TreeMenuItem's props
    childs:[{
     id:"sub",
     title:"Subitem 1",
   }]
}];

// if your need to use exponsed actions
const ref = createRef<TreeMenuActions>();

<TreeMenu
  ref={ref}
  items={ITEMS}
  onClick={onClick} 
/>

Properties

type RenderFn = (item:MenuItem) => React.ReactElement | undefined | null; type RenderType = RenderFn | React.ReactElement;

Propery nameDescriptionSignature
treeIDtree idstring
propertyGridproperty grid modeboolean
items[]tree menu items arrayTreeMenuItem[]
refhandle to TreeMenu methodsTreeMenuActions
initialCollapsedinitial tree stateboolean
initialSelectedinitial selected itemitem's id : string
themetheme override class namedark, light, custom name
classPrefixcontainer global prefixstring
enableRotateRotate collapse / expand iconboolean
infoStyleglobal custom styleboolean
titleStyleglobal custom styleboolean
infoRevealglobal info display modes"always""vertical""horizontal"
badgeVisibledisplay badgeboolean
groupIconLeftgroup icon positionboolean
onClickitem click handleronClick?:(item:TreeMenuItem) => void
onTogglecollapse / expandonToggle?:(id?:string,collapsed?:boolean) => void;
renderBadgeitem click handlerRenderType
renderIconLeft side element of itemRenderType
renderGroupStateGroup indicatorRenderType

TreeMenuItem

    id:string;
    title:string | React.ReactElement;
    info?:string | React.ReactElement;
    badge?:string | React.ReactElement;
    control?:string | JSX.Element;
    infoReveal?:InfoReveal;
    icon?:React.ReactElement;
    badge?:string | React.ReactElement;
    disabled?:boolean;
    unselectable?:boolean;
    titleClass?:string;
    infoClass?:string;
    style?:React.CSSProperties;
    titleStyle?:React.CSSProperties;
    infoStyle?:React.CSSProperties;

TreeMenuActions ( use ref )

    enable:(id:string,disable?:boolean) => void;
    getItem:(id:string) => TreeMenuItem | null;
    collapse:(id:string,collapsed?:boolean) => void;
    select:(id:string) => void;
	  invalidate:() => void;
	  rebuild:(items:TreeMenuItem[]) => void;

Sample

Sample available via storybook yarn storybook