import './styles/Treant.css'; import 'perfect-scrollbar/css/perfect-scrollbar.css'; import { JSONconfig } from './JSONConfig'; import { TreeStore } from './TreeStore'; import 'reflect-metadata'; import { Tree } from './Tree'; import { NodeDB } from './NodeDB'; import { RaphaelAttributes } from 'raphael'; import { TreeNode } from './TreeNode'; export type ElementWithSupportIE = Element & { currentStyle?: Record; attachEvent: (eventType: string, handler: (event: Event) => void) => void; }; export type Coordinate = { x: number; y: number; }; export type CallbackFunction = { onCreateNode: (treeNode: TreeNode, treeNodeDom: HTMLAnchorElement | HTMLDivElement) => void; onCreateNodeCollapseSwitch: (treeNode: TreeNode, treeNodeDom: HTMLAnchorElement | HTMLDivElement) => void; onAfterAddNode: (newTreeNode: TreeNode, parentTreeNode: TreeNode, nodeStructure: Partial) => void; onBeforeAddNode: (parentTreeNode: TreeNode, nodeStructure: Partial) => void; onAfterPositionNode: (treeNode: TreeNode, nodeDbIndex: number, containerCenter: Coordinate, treeCenter: Coordinate) => void; onBeforePositionNode: (treeNode: TreeNode, nodeDbIndex: number, containerCenter: Coordinate, treeCenter: Coordinate) => void; onToggleCollapseFinished: (treeNode: TreeNode, bIsCollapsed: boolean) => void; onAfterClickCollapseSwitch: (nodeSwitch: Element | JQuery, event: Event) => void; onBeforeClickCollapseSwitch: (nodeSwitch: Element | JQuery, event: Event) => void | boolean; onClickNode: (node: Element | JQuery, event: Event) => void | boolean; onMouseoverNode: (node: Element | JQuery, event: Event) => void; onMouseoutNode: (node: Element | JQuery, event: Event) => void; onTreeLoaded: (rootTreeNode: TreeNode) => void; }; export type RootOrientationType = 'NORTH' | 'EAST' | 'WEST' | 'SOUTH'; export type NodeAlignType = 'CENTER' | 'TOP' | 'BOTTOM'; export type ScrollbarType = 'resize' | 'native' | 'fancy' | 'None'; export type RaphaelAttributesExtended = Partial & { 'arrow-start'?: string; }; export type ConnectorTypeValues = 'curve' | 'bCurve' | 'step' | 'straight'; export type ConnectorType = { type: ConnectorTypeValues; style: RaphaelAttributesExtended; stackIndent: number; }; export type NodeType = { HTMLclass: string; drawLineThrough: boolean; collapsable: boolean; link: { target: '_self'; }; }; export type AnimationType = { nodeSpeed: number; nodeAnimation: string; connectorsSpeed: number; connectorsAnimation: string; }; export interface ChartInterface { container: string; callback: Partial; rootOrientation: RootOrientationType; nodeAlign: NodeAlignType; levelSeparation: number; siblingSeparation: number; subTeeSeparation: number; hideRootNode: boolean; animateOnInit: boolean; animateOnInitDelay: number; scrollbar: ScrollbarType; padding: number; connectors: Partial; node: Partial; animation: AnimationType; maxDepth: number; actionsId: string; autoFocusForToggleCollapse: boolean; } export type NodeText = { name: string | Record; title: string | Record; desc: string | Record; contact: string | Record; data: string; href: string | Record; }; export type NodeLink = { href: string; target: string; }; export interface NodeInterface { text: Partial; link: Partial; image: string; innerHTML: string; childrenDropLevel: number; pseudo: boolean; connectors: ConnectorType; collapsable: boolean; collapsed: boolean; HTMLclass: string; HTMLid: string; stackChildren: boolean; drawLineThrough: boolean; children: Partial[]; meta: object; position: string; idInNodeDB: number; parent: Partial; tooltip: string; clickEvent: () => void; } export type ChartStructure = { chart: Partial; nodeStructure: Partial; }; export type ChartConfigType = Array | Partial> | ChartStructure; export declare class Treant { private jsonConfigService; private treeStore; private nodeDB; private jsonConfig; private tree; constructor(jsonConfigService: JSONconfig, treeStore: TreeStore, nodeDB: NodeDB); destroy(): void; init(jsonConfig: ChartConfigType, callback?: (tree: Tree) => void, jQuery?: JQueryStatic): Promise; getNodeDb(): Promise; exportTreeToJSON(): ChartStructure; getJsonConfig(): ChartStructure; }