import { MutableRefObject } from 'react'; import { TyFlowAttrServer } from './src/config'; import { TyFlowIconServer } from './src/icon'; import * as d3 from 'd3'; export type TyAttrType = { [key: string]: any; }; export type iconMapType = { [key: string]: string; }; export type TyCustomeField = { level: number; name?: string; children?: TyCustomeField[]; parents?: TyCustomeField[]; y: number; x: number; nodeKey: string; parentNodeKey: string | null; nodeType: TyNodeType; active?: boolean; otherChildren?: TyCustomeField[]; initOthersInfo?: TyCustomeField[]; isCurrent?: boolean; _children?: TyCustomeField[]; [key: string]: any; } & T; export type D3SvgInstType = d3.Selection; export type D3SvgNodeType = d3.HierarchyPointNode>; export type D3SvgLineType = d3.HierarchyPointLink>; export type D3SvgLineGroupType = d3.Selection; export type D3SvgNodeGroupType = d3.Selection; export type TYFoldInfoType = { show: boolean; data: TyCustomeField[]; record: TyCustomeField | null; position: [number, number]; }; export type TYPopoverInfoType = { show: boolean; isRootNode: boolean; rootPositionY: number; position: [number, number]; }; export type TYTooltipInfoType = { show: boolean; position: [number, number]; row: TyCustomeField | null; }; export type TyOperatePopverOptions = { label: string; click?: (d: D3SvgNodeType) => void; type?: string; disable?: boolean; isShow?: boolean; }; export type TyOperatePopverType = { show?: boolean; left?: number; top?: number; title?: string; selectNode?: D3SvgNodeType | null; options?: TyOperatePopverOptions[] | ((data: D3SvgNodeType) => TyOperatePopverOptions[]); attrs?: TyFlowAttrType; }; export type TyChildField = 'parents' | 'children'; export type TyNodeType = 'left' | 'root' | 'right'; export type TyEdgeTextType = { text: string | ((d: D3SvgLineType) => string); dx?: number | ((d: D3SvgLineType) => number); visibility?: ('visible' | 'hidden') | ((d: D3SvgLineType) => 'visible' | 'hidden'); }; export type TyCusomeEdgeTextCfg = { top?: TyEdgeTextType; bottom?: TyEdgeTextType; }; export type TyCusomeNodeCfg = { dashedRule?: { visible: boolean | ((d: D3SvgNodeType) => boolean); render?: (nodeGroup: D3SvgNodeGroupType, flowInstDs: TyFlowInstDsType) => void; }; popupRule?: { visible: boolean | ((d: D3SvgNodeType) => boolean); render?: (popupWrap: D3SvgNodeGroupType, flowInstDs: TyFlowInstDsType) => void; leftLabel?: (string | number) | ((d: D3SvgNodeType) => string | number); leftValue?: (string | number) | ((d: D3SvgNodeType) => string | number); leftRectRender?: (popupLeft: D3SvgNodeGroupType, flowInstDs: TyFlowInstDsType) => void; rightLabel?: (string | number) | ((d: D3SvgNodeType) => string | number); rightValue?: (string | number) | ((d: D3SvgNodeType) => string | number); rightRectRender?: (popupRight: D3SvgNodeGroupType, flowInstDs: TyFlowInstDsType) => void; }; nodeInnerRule?: { visible: boolean; render?: (nodeGroup: D3SvgNodeGroupType, flowInstDs: TyFlowInstDsType) => void; }; iconRenderRule?: (d: D3SvgNodeType) => 'img' | 'svg'; }; type GetStateAction = () => S; export type TyFlowInstDsType = { $d3: any; props: TYFlowProps; attrs: TyFlowAttrInitType; getSelectionByCurrent: (selectors: string) => d3.Selection; getSelectionAllByCurrent: (selectors: string) => d3.Selection; getAttrServer: () => TyFlowAttrServer; getIconServer: () => TyFlowIconServer; getSvgInstRef: () => undefined | D3SvgInstType; getLinks: GetStateAction[]>; getNodes: GetStateAction[]>; getSelectNode: GetStateAction | null>; setTooltipInfo: React.Dispatch>>; refresh: () => void; }; export interface TYFlowProps { treeSourceData: T | null; flowRef?: MutableRefObject; rootIsCenter?: boolean; foldNameRule?: (string | number) | ((otherChildren: TyCustomeField[]) => string | number); popoverCfg?: TyOperatePopverType; style?: React.CSSProperties; loading?: boolean; nodeSortRule?: ((a: T, b: T) => number) | null; edgeTextCfg?: TyCusomeEdgeTextCfg; nodeCfg?: TyCusomeNodeCfg; attrCfg?: TyFlowAttrType; onNodeClick?: (d: D3SvgNodeType) => void; onNodeBlur?: (d: D3SvgNodeType) => void; iconMapCfg?: iconMapType; [key: string]: any; } export type TyRewordTreeArg = { rootTree: TyCustomeField; canvasWidth: number; canvasHeight: number; getFlowInstDs: () => TyFlowInstDsType; }; export type TyFoldChildReworkArg = { nodeData: TyCustomeField; canvasWidth: number; canvasHeight: number; getFlowInstDs: () => TyFlowInstDsType; }; export type TyRewordTreeRes = { reworkTreeData: TyCustomeField; svgWidth: number; svgHieght: number; maxRow: number; }; export type TyFlowAttrType = { margin?: { left?: number; top?: number; }; showSizeMin?: number; rowGap?: number; dasharrayWidth?: number; dashColor?: string; dashOffsetX?: number; dashOffsetY?: number; nodeWidth?: number; nodeHeight?: number; iconBoxR?: number; nodeChildWidth?: number; nodeChildHeight?: number; iconChildBoxR?: number; iconBoxMaginLeft?: number; edgeWidth?: number; edgeStrokeWidth?: number; actionWidth?: number; dropIconWidth?: number; dropIconHeight?: number; moreWidth?: number; moreHeight?: number; iconWidth?: number; iconHeight?: number; innerTextMarignLeft?: number; innerTextFontSize?: number; innerTextFontSizeSm?: number; popupInnerRectX?: number; popupInnerRectY?: number; popupChildInnerRectY?: number; popupInnerRectGap?: number; popupTextFontSize?: number; popupTextMarignLeft?: number; popupTextFontSizeSm?: number; nodeInitBgColor?: string; nodePassBgColor?: string; nodeActiveBgColor?: string; popupBgColor?: string; actionBoxInitBgColor?: string; actionBoxPassBgColor?: string; actionBoxActiveBgColor?: string; iconBoxInitBgColor?: string; iconBoxPassBgColor?: string; iconBoxActiveBgColor?: string; iconBoxInitStrokeColor?: string; iconBoxPassStrokeColor?: string; iconBoxActiveStrokeColor?: string; iconInitBgColor?: string; iconPassBgColor?: string; iconActiveBgColor?: string; edgeInitColor?: string; edgeActiveColor?: string; edgeTextColor?: string; metricBoxBgColor?: string; color100?: string; color85?: string; color65?: string; color45?: string; color25?: string; color15?: string; color333?: string; colorFFF?: string; colorCritical?: string; colorhigh?: string; fontSize10?: number; fontSize12?: number; fontSize14?: number; problemNodeColor?: string; problemNodeActiveColor?: string; progressW?: number; [key: string]: any; }; export type TyFlowAttrInitType = { margin: { left: number; top: number; }; showSizeMin: number; rowGap: number; dasharrayWidth: number; dashColor: string; dashOffsetX: number; dashOffsetY: number; nodeWidth: number; nodeHeight: number; iconBoxR: number; nodeChildWidth: number; nodeChildHeight: number; iconChildBoxR: number; iconBoxMaginLeft: number; edgeWidth: number; edgeStrokeWidth: number; actionWidth: number; dropIconWidth: number; dropIconHeight: number; moreWidth: number; moreHeight: number; iconWidth: number; iconHeight: number; innerTextMarignLeft: number; innerTextFontSize: number; innerTextFontSizeSm: number; popupInnerRectX: number; popupInnerRectY: number; popupChildInnerRectY: number; popupInnerRectGap: number; popupTextFontSize: number; popupTextMarignLeft: number; popupTextFontSizeSm: number; nodeInitBgColor: string; nodePassBgColor: string; nodeActiveBgColor: string; popupBgColor: string; actionBoxInitBgColor: string; actionBoxPassBgColor: string; actionBoxActiveBgColor: string; iconBoxInitBgColor: string; iconBoxPassBgColor: string; iconBoxActiveBgColor: string; iconBoxInitStrokeColor: string; iconBoxPassStrokeColor: string; iconBoxActiveStrokeColor: string; iconInitBgColor: string; iconPassBgColor: string; iconActiveBgColor: string; edgeInitColor: string; edgeActiveColor: string; edgeTextColor: string; metricBoxBgColor: string; color100: string; color85: string; color65: string; color45: string; color25: string; color15: string; color333: string; colorFFF: string; colorCritical: string; colorhigh: string; fontSize10: number; fontSize12: number; fontSize14: number; problemNodeColor: string; problemNodeActiveColor: string; progressW: number; }; export {};