@flatbiz/antd
Version:
38 lines (35 loc) • 936 B
TypeScript
import { TPlainObject } from '@flatbiz/utils';
import { FC } from 'react';
export type TXMindTreeItem = {
data: {
/** 节点文本 */
text: string;
/** 全局唯一id */
uid: string;
/** 额外的数据,用于使用时自定义渲染 */
extraData?: TPlainObject;
};
/** 子节点 */
children: TXMindTreeItem[];
};
export interface IXMindPreviewProps {
data?: TXMindTreeItem;
className?: string;
style?: React.CSSProperties;
/**
* 自定义节点渲染内容:
* 默认情况 xmind 会自动计算节点的宽高,
* 自定义渲染react组件,因为初始拿不到宽高,所以要返回一个节点宽高
* - 默认宽高 200 22
* - 返回值为空则使用默认渲染
* @param node
* @returns
*/
renderNode?: (node: TXMindTreeItem) => {
width?: number;
height?: number;
reactNode: React.ReactNode;
} | void;
}
export declare const XMindPreview: FC<IXMindPreviewProps>;
export {};