@rxflow/mind-map 0.0.3 → 0.0.4-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @author: yanxianliang
3
+ * @date: 2025-01-17
4
+ * @desc: MindMap hooks 导出
5
+ *
6
+ * Copyright (c) 2025 by yanxianliang, All Rights Reserved.
7
+ */
8
+ export * from './useMindMapProps';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _useMindMapProps = require("./useMindMapProps");
7
+ Object.keys(_useMindMapProps).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _useMindMapProps[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _useMindMapProps[key];
14
+ }
15
+ });
16
+ });
@@ -0,0 +1,60 @@
1
+ /**
2
+ * @author: yanxianliang
3
+ * @date: 2025-01-17
4
+ * @desc: MindMap Props hooks - 类型化的 props 访问
5
+ *
6
+ * Copyright (c) 2025 by yanxianliang, All Rights Reserved.
7
+ */
8
+ import { IBaseFlowProps } from '@rxflow/base';
9
+ import { MindMapFlowProps, MindMapExtendProps } from '../types';
10
+ type MindMapFullFlowProps = IBaseFlowProps & MindMapExtendProps;
11
+ /**
12
+ * 获取原始输入 props
13
+ *
14
+ * @example
15
+ * const inputProps = useMindMapInputProps();
16
+ * const root = useMindMapInputProps(state => state.root);
17
+ */
18
+ export declare function useMindMapInputProps(): MindMapFlowProps;
19
+ export declare function useMindMapInputProps<U>(selector: (state: MindMapFlowProps) => U): U;
20
+ /**
21
+ * 获取转换后的 Flow props
22
+ *
23
+ * @example
24
+ * const flowProps = useMindMapFlowProps();
25
+ * const nodes = useMindMapFlowProps(state => state.nodes);
26
+ */
27
+ export declare function useMindMapFlowProps(): MindMapFullFlowProps;
28
+ export declare function useMindMapFlowProps<U>(selector: (state: MindMapFullFlowProps) => U): U;
29
+ /**
30
+ * 获取原始输入 props 的 getter(非响应式)
31
+ */
32
+ export declare const useGetMindMapInputProps: () => {
33
+ (): MindMapFlowProps;
34
+ <U>(selector: (state: MindMapFlowProps) => U): U;
35
+ };
36
+ /**
37
+ * 获取转换后 Flow props 的 getter(非响应式)
38
+ */
39
+ export declare const useGetMindMapFlowProps: () => {
40
+ (): MindMapFullFlowProps;
41
+ <U>(selector: (state: MindMapFullFlowProps) => U): U;
42
+ };
43
+ /**
44
+ * 获取 root 节点数据
45
+ */
46
+ export declare const useMindMapRoot: () => import("../types").TopicNodeType | import("../types").CustomNodeType | undefined;
47
+ /**
48
+ * 获取主题配置
49
+ */
50
+ export declare const useMindMapTheme: () => (import("@rxflow/base").BaseThemeConfig & import("../types").MiniMapThemeConfig) | undefined;
51
+ /**
52
+ * 获取是否显示 tooltip
53
+ */
54
+ export declare const useShowTooltip: () => false | "always" | "ellipsis" | undefined;
55
+ /**
56
+ * 获取布局类型
57
+ */
58
+ export declare const useLayoutType: () => import("../types").LayoutType | undefined;
59
+ export {};
60
+ //# sourceMappingURL=useMindMapProps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMindMapProps.d.ts","sourceRoot":"","sources":["useMindMapProps.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAkE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9G,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAiB,MAAM,UAAU,CAAC;AAE/E,KAAK,oBAAoB,GAAG,cAAc,GAAG,kBAAkB,CAAC;AAEhE;;;;;;GAMG;AACH,wBAAgB,oBAAoB,IAAI,gBAAgB,CAAC;AACzD,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,CAAC,GAAG,CAAC,CAAC;AAKrF;;;;;;GAMG;AACH,wBAAgB,mBAAmB,IAAI,oBAAoB,CAAC;AAC5D,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,CAAC,GAAG,CAAC,CAAC;AAKxF;;GAEG;AACH,eAAO,MAAM,uBAAuB;;;CAEnC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;CAElC,CAAC;AAGF;;GAEG;AACH,eAAO,MAAM,cAAc,wFAAkD,CAAC;AAE9E;;GAEG;AACH,eAAO,MAAM,eAAe,oGAAmD,CAAC;AAEhF;;GAEG;AACH,eAAO,MAAM,cAAc,iDAAyD,CAAC;AAErF;;GAEG;AACH,eAAO,MAAM,aAAa,iDAAwD,CAAC"}
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useLayoutType = exports.useGetMindMapInputProps = exports.useGetMindMapFlowProps = void 0;
7
+ exports.useMindMapFlowProps = useMindMapFlowProps;
8
+ exports.useMindMapInputProps = useMindMapInputProps;
9
+ exports.useShowTooltip = exports.useMindMapTheme = exports.useMindMapRoot = void 0;
10
+ var _base = require("@rxflow/base");
11
+ /**
12
+ * @author: yanxianliang
13
+ * @date: 2025-01-17
14
+ * @desc: MindMap Props hooks - 类型化的 props 访问
15
+ *
16
+ * Copyright (c) 2025 by yanxianliang, All Rights Reserved.
17
+ */
18
+
19
+ /**
20
+ * 获取原始输入 props
21
+ *
22
+ * @example
23
+ * const inputProps = useMindMapInputProps();
24
+ * const root = useMindMapInputProps(state => state.root);
25
+ */
26
+
27
+ function useMindMapInputProps(selector) {
28
+ return (0, _base.useInputProps)(selector);
29
+ }
30
+
31
+ /**
32
+ * 获取转换后的 Flow props
33
+ *
34
+ * @example
35
+ * const flowProps = useMindMapFlowProps();
36
+ * const nodes = useMindMapFlowProps(state => state.nodes);
37
+ */
38
+
39
+ function useMindMapFlowProps(selector) {
40
+ return (0, _base.useFlowProps)(selector);
41
+ }
42
+
43
+ /**
44
+ * 获取原始输入 props 的 getter(非响应式)
45
+ */
46
+ const useGetMindMapInputProps = () => {
47
+ return (0, _base.useGetInputProps)();
48
+ };
49
+
50
+ /**
51
+ * 获取转换后 Flow props 的 getter(非响应式)
52
+ */
53
+ exports.useGetMindMapInputProps = useGetMindMapInputProps;
54
+ const useGetMindMapFlowProps = () => {
55
+ return (0, _base.useGetFlowProps)();
56
+ };
57
+
58
+ // 便捷 hooks
59
+ /**
60
+ * 获取 root 节点数据
61
+ */
62
+ exports.useGetMindMapFlowProps = useGetMindMapFlowProps;
63
+ const useMindMapRoot = () => useMindMapInputProps(state => state.root);
64
+
65
+ /**
66
+ * 获取主题配置
67
+ */
68
+ exports.useMindMapRoot = useMindMapRoot;
69
+ const useMindMapTheme = () => useMindMapInputProps(state => state.theme);
70
+
71
+ /**
72
+ * 获取是否显示 tooltip
73
+ */
74
+ exports.useMindMapTheme = useMindMapTheme;
75
+ const useShowTooltip = () => useMindMapInputProps(state => state.showTooltip);
76
+
77
+ /**
78
+ * 获取布局类型
79
+ */
80
+ exports.useShowTooltip = useShowTooltip;
81
+ const useLayoutType = () => useMindMapInputProps(state => state.layoutType);
82
+ exports.useLayoutType = useLayoutType;
package/cjs/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  /// <reference types="react" />
2
- import { MindMapFlowProps } from "./";
2
+ import { MindMapFlowProps } from "./types";
3
3
  declare const MindMapFlow: (props: import("react").PropsWithChildren<MindMapFlowProps>) => import("react/jsx-runtime").JSX.Element;
4
4
  export default MindMapFlow;
5
5
  export * from './types';
6
6
  export * from './constants';
7
+ export * from './hooks/useMindMapProps';
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":";AAWA,OAAO,EAAqB,gBAAgB,EAAC,WAAyB;AAoCtE,QAAA,MAAM,WAAW,yGAmBM,CAAA;AAEvB,eAAe,WAAW,CAAC;AAE3B,cAAc,SAAS,CAAC;AAExB,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":";AAWA,OAAO,EAAsB,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAkC/D,QAAA,MAAM,WAAW,yGAmBW,CAAC;AAE7B,eAAe,WAAW,CAAC;AAG3B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAG5B,cAAc,yBAAyB,CAAC"}
package/cjs/index.js CHANGED
@@ -33,9 +33,22 @@ Object.keys(_constants).forEach(function (key) {
33
33
  }
34
34
  });
35
35
  });
36
+ var _useMindMapProps = require("./hooks/useMindMapProps");
37
+ Object.keys(_useMindMapProps).forEach(function (key) {
38
+ if (key === "default" || key === "__esModule") return;
39
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
40
+ if (key in exports && exports[key] === _useMindMapProps[key]) return;
41
+ Object.defineProperty(exports, key, {
42
+ enumerable: true,
43
+ get: function () {
44
+ return _useMindMapProps[key];
45
+ }
46
+ });
47
+ });
36
48
  /*
37
49
  * @author: yanxianliang
38
50
  * @date: 2025-06-01 18:36
51
+ * @modified:2025/1/17 by yanxianliang
39
52
  * @desc: 资产树 / 脑图
40
53
  *
41
54
  * Copyright (c) 2025 by yanxianliang, All Rights Reserved.
@@ -45,9 +58,12 @@ const fitViewOptions = {
45
58
  minZoom: 1,
46
59
  maxZoom: 1
47
60
  };
48
- const omitProps = ['root', 'layoutType', 'showTooltip'];
49
61
  const fn = () => {};
50
- const usePropsTransformer = props => {
62
+
63
+ /**
64
+ * Props 转换 hook
65
+ */
66
+ const useMindMapPropsTransform = props => {
51
67
  const {
52
68
  nodeTypes: customNodeTypes = [],
53
69
  root
@@ -61,10 +77,9 @@ const usePropsTransformer = props => {
61
77
  onNodeClick: fn,
62
78
  ...props,
63
79
  autoCenter: false,
64
- fitViewOptions: fitViewOptions,
80
+ fitViewOptions,
65
81
  forceLayout: false,
66
82
  nodes,
67
- omitProps,
68
83
  readOnly: true,
69
84
  nodeTypes: [..._nodes.nodeTypes, ...customNodeTypes]
70
85
  };
@@ -80,11 +95,12 @@ const MindMapFlow = (0, _base.createFlow)(props => {
80
95
  vGap: theme?.vGap,
81
96
  markerType: theme?.markerType
82
97
  });
83
- }, []);
98
+ }, [theme?.hGap, theme?.vGap, theme?.markerType]);
84
99
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_base.Flow, {
85
100
  ...props,
86
101
  layout: layout,
87
102
  children: children
88
103
  });
89
- }, usePropsTransformer);
90
- var _default = exports.default = MindMapFlow;
104
+ }, useMindMapPropsTransform);
105
+ var _default = exports.default = MindMapFlow; // 类型导出
106
+ // Hooks 导出
@@ -0,0 +1,9 @@
1
+ import { MindMapExtendProps, TopicBranchNodeType } from "../..";
2
+ export declare const TooltipLabel: ({ type, label, level, ellipsisRow, showTooltip }: {
3
+ label: TopicBranchNodeType['label'];
4
+ level: TopicBranchNodeType['level'];
5
+ type: string;
6
+ ellipsisRow?: number | undefined;
7
+ showTooltip: MindMapExtendProps['showTooltip'];
8
+ }) => import("react/jsx-runtime").JSX.Element;
9
+ //# sourceMappingURL=TooltipLabel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TooltipLabel.d.ts","sourceRoot":"","sources":["TooltipLabel.tsx"],"names":[],"mappings":"AASA,OAAO,EAAC,kBAAkB,EAAE,mBAAmB,EAAC,cAAyB;AAIzE,eAAO,MAAM,YAAY;WAChB,mBAAmB,CAAC,OAAO,CAAC;WAC5B,mBAAmB,CAAC,OAAO,CAAC;UAC7B,MAAM;;iBAEC,kBAAkB,CAAC,aAAa,CAAC;6CAgC/C,CAAA"}
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.TooltipLabel = void 0;
7
+ var _base = require("@rxflow/base");
8
+ var _classcat = _interopRequireDefault(require("classcat"));
9
+ var _react = _interopRequireWildcard(require("react"));
10
+ var _jsxRuntime = require("react/jsx-runtime");
11
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
12
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+ /**
15
+ * @author: yanxianliang
16
+ * @date: 2026-01-19 13:57
17
+ * @modified:2026/1/19 13:57 by yanxianliang
18
+ * @desc: 支持溢出的文本显示
19
+ *
20
+ * Copyright (c) 2026 by yanxianliang, All Rights Reserved.
21
+ */
22
+
23
+ const TooltipLabel = ({
24
+ type,
25
+ label,
26
+ level,
27
+ ellipsisRow,
28
+ showTooltip
29
+ }) => {
30
+ const [ellipse, setEllipse] = (0, _react.useState)(false);
31
+ const rootRef = (0, _react.useRef)(null);
32
+ (0, _react.useLayoutEffect)(() => {
33
+ if (showTooltip === 'ellipsis') {
34
+ const target = rootRef.current;
35
+ const textElement = target.firstElementChild;
36
+ const canTooltip = textElement && textElement.scrollHeight > textElement.clientHeight;
37
+ setEllipse(canTooltip);
38
+ }
39
+ }, [label]);
40
+ const child = /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
41
+ className: (0, _classcat.default)(['rxflow-topic-container', `rxflow-${type}`]),
42
+ ref: rootRef,
43
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
44
+ className: (0, _classcat.default)(['rxflow-topic-text', {
45
+ ['rxflow-topic-text-link']: level === 'link'
46
+ }]),
47
+ style: {
48
+ WebkitLineClamp: ellipsisRow
49
+ },
50
+ children: label
51
+ })
52
+ });
53
+ if (showTooltip === 'ellipsis' && ellipse || showTooltip === 'always') {
54
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_base.Tooltip, {
55
+ title: label,
56
+ children: child
57
+ });
58
+ }
59
+ return child;
60
+ };
61
+ exports.TooltipLabel = TooltipLabel;
@@ -1,5 +1,5 @@
1
- import { InnerNodeType } from "../../types";
2
- import './index.less';
3
1
  import { NodeTypeComponent } from "@rxflow/base";
2
+ import './index.less';
3
+ import { InnerNodeType } from "../../types";
4
4
  export declare const TopicChildNode: NodeTypeComponent<InnerNodeType>;
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAC,aAAa,EAAwC,MAAM,aAAa,CAAC;AAEjF,OAAO,cAAc,CAAC;AAItB,OAAO,EAAoC,iBAAiB,EAAiD,MAAM,cAAc,CAAC;AAGlI,eAAO,MAAM,cAAc,kCAmEyF,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":"AAQA,OAAO,EAA+B,iBAAiB,EAAyC,MAAM,cAAc,CAAC;AAMrH,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAC,aAAa,EAAwC,MAAM,aAAa,CAAC;AAGjF,eAAO,MAAM,cAAc,kCAkDyF,CAAC"}
@@ -4,16 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.TopicChildNode = void 0;
7
- var _react = _interopRequireWildcard(require("react"));
8
- var _react2 = require("@xyflow/react");
7
+ var _base = require("@rxflow/base");
8
+ var _react = require("@xyflow/react");
9
+ var _ahooks = require("ahooks");
10
+ var _internal = require("antd/es/theme/internal");
9
11
  var _lodash = require("lodash");
10
12
  require("./index.less");
11
- var _classcat = _interopRequireDefault(require("classcat"));
12
- var _internal = require("antd/es/theme/internal");
13
- var _ahooks = require("ahooks");
14
- var _base = require("@rxflow/base");
13
+ var _react2 = _interopRequireWildcard(require("react"));
14
+ var _TooltipLabel = require("./TooltipLabel");
15
15
  var _jsxRuntime = require("react/jsx-runtime");
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
16
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
18
17
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
19
18
  /*
@@ -24,7 +23,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
24
23
  * Copyright (c) 2025 by yanxianliang, All Rights Reserved.
25
24
  */
26
25
 
27
- const TopicChildNode = exports.TopicChildNode = /*#__PURE__*/_react.default.memo(props => {
26
+ const TopicChildNode = exports.TopicChildNode = /*#__PURE__*/_react2.default.memo(props => {
28
27
  const {
29
28
  data,
30
29
  height,
@@ -41,11 +40,11 @@ const TopicChildNode = exports.TopicChildNode = /*#__PURE__*/_react.default.memo
41
40
  } = data; // 主题配置
42
41
 
43
42
  const theme = (0, _base.useTheme)();
44
- const showTooltip = (0, _base.usePropsSelector)(state => state.showTooltip) ?? 'ellipsis';
43
+ const showTooltip = (0, _base.useFlowProps)(state => state.showTooltip) ?? 'ellipsis';
45
44
  const [_, token] = (0, _internal.useToken)();
46
45
  const triggerLayout = (0, _base.useForceUpdate)();
47
- const internalNode = (0, _react2.useInternalNode)(id);
48
- const ellipsisRow = (0, _react.useMemo)(() => {
46
+ const internalNode = (0, _react.useInternalNode)(id);
47
+ const ellipsisRow = (0, _react2.useMemo)(() => {
49
48
  if (typeof height === 'number' && token.lineHeight && ellipsis === 'multiLine' && theme.fontSize) {
50
49
  return Math.floor(height / (theme.fontSize * token.lineHeight));
51
50
  }
@@ -58,15 +57,7 @@ const TopicChildNode = exports.TopicChildNode = /*#__PURE__*/_react.default.memo
58
57
  // 触发relayout
59
58
  triggerLayout();
60
59
  });
61
- const canTooltipShow = (0, _ahooks.useMemoizedFn)(event => {
62
- const target = event.currentTarget;
63
- if (showTooltip) {
64
- const textElement = target.firstElementChild;
65
- return showTooltip === 'ellipsis' ? textElement && textElement.scrollHeight > textElement.clientHeight : true;
66
- }
67
- return false;
68
- });
69
- const handles = (0, _react.useMemo)(() => {
60
+ const handles = (0, _react2.useMemo)(() => {
70
61
  const {
71
62
  source = [],
72
63
  target
@@ -81,21 +72,12 @@ const TopicChildNode = exports.TopicChildNode = /*#__PURE__*/_react.default.memo
81
72
  left: handle.x,
82
73
  top: handle.y
83
74
  }
84
- }, `${handle.id}_${handle.type}`)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_base.Tooltip, {
85
- title: label,
86
- canTooltipShow: canTooltipShow,
87
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
88
- className: (0, _classcat.default)(['rxflow-topic-container', `rxflow-${type}`]),
89
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
90
- className: (0, _classcat.default)(['rxflow-topic-text', {
91
- ['rxflow-topic-text-link']: level === 'link'
92
- }]),
93
- style: {
94
- WebkitLineClamp: ellipsisRow
95
- },
96
- children: label
97
- })
98
- })
75
+ }, `${handle.id}_${handle.type}`)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_TooltipLabel.TooltipLabel, {
76
+ label: label,
77
+ level: level,
78
+ type: type,
79
+ showTooltip: showTooltip,
80
+ ellipsisRow: ellipsisRow
99
81
  }), childrenCounts ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_base.CollapseButton, {
100
82
  count: childrenCounts,
101
83
  collapsed: collapsed,
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @author: yanxianliang
3
+ * @date: 2025-01-17
4
+ * @desc: MindMap hooks 导出
5
+ *
6
+ * Copyright (c) 2025 by yanxianliang, All Rights Reserved.
7
+ */
8
+ export * from './useMindMapProps';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @author: yanxianliang
3
+ * @date: 2025-01-17
4
+ * @desc: MindMap hooks 导出
5
+ *
6
+ * Copyright (c) 2025 by yanxianliang, All Rights Reserved.
7
+ */
8
+
9
+ export * from "./useMindMapProps";
@@ -0,0 +1,60 @@
1
+ /**
2
+ * @author: yanxianliang
3
+ * @date: 2025-01-17
4
+ * @desc: MindMap Props hooks - 类型化的 props 访问
5
+ *
6
+ * Copyright (c) 2025 by yanxianliang, All Rights Reserved.
7
+ */
8
+ import { IBaseFlowProps } from '@rxflow/base';
9
+ import { MindMapFlowProps, MindMapExtendProps } from '../types';
10
+ type MindMapFullFlowProps = IBaseFlowProps & MindMapExtendProps;
11
+ /**
12
+ * 获取原始输入 props
13
+ *
14
+ * @example
15
+ * const inputProps = useMindMapInputProps();
16
+ * const root = useMindMapInputProps(state => state.root);
17
+ */
18
+ export declare function useMindMapInputProps(): MindMapFlowProps;
19
+ export declare function useMindMapInputProps<U>(selector: (state: MindMapFlowProps) => U): U;
20
+ /**
21
+ * 获取转换后的 Flow props
22
+ *
23
+ * @example
24
+ * const flowProps = useMindMapFlowProps();
25
+ * const nodes = useMindMapFlowProps(state => state.nodes);
26
+ */
27
+ export declare function useMindMapFlowProps(): MindMapFullFlowProps;
28
+ export declare function useMindMapFlowProps<U>(selector: (state: MindMapFullFlowProps) => U): U;
29
+ /**
30
+ * 获取原始输入 props 的 getter(非响应式)
31
+ */
32
+ export declare const useGetMindMapInputProps: () => {
33
+ (): MindMapFlowProps;
34
+ <U>(selector: (state: MindMapFlowProps) => U): U;
35
+ };
36
+ /**
37
+ * 获取转换后 Flow props 的 getter(非响应式)
38
+ */
39
+ export declare const useGetMindMapFlowProps: () => {
40
+ (): MindMapFullFlowProps;
41
+ <U>(selector: (state: MindMapFullFlowProps) => U): U;
42
+ };
43
+ /**
44
+ * 获取 root 节点数据
45
+ */
46
+ export declare const useMindMapRoot: () => import("../types").TopicNodeType | import("../types").CustomNodeType | undefined;
47
+ /**
48
+ * 获取主题配置
49
+ */
50
+ export declare const useMindMapTheme: () => (import("@rxflow/base").BaseThemeConfig & import("../types").MiniMapThemeConfig) | undefined;
51
+ /**
52
+ * 获取是否显示 tooltip
53
+ */
54
+ export declare const useShowTooltip: () => false | "always" | "ellipsis" | undefined;
55
+ /**
56
+ * 获取布局类型
57
+ */
58
+ export declare const useLayoutType: () => import("../types").LayoutType | undefined;
59
+ export {};
60
+ //# sourceMappingURL=useMindMapProps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMindMapProps.d.ts","sourceRoot":"","sources":["useMindMapProps.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAkE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9G,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAiB,MAAM,UAAU,CAAC;AAE/E,KAAK,oBAAoB,GAAG,cAAc,GAAG,kBAAkB,CAAC;AAEhE;;;;;;GAMG;AACH,wBAAgB,oBAAoB,IAAI,gBAAgB,CAAC;AACzD,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,CAAC,GAAG,CAAC,CAAC;AAKrF;;;;;;GAMG;AACH,wBAAgB,mBAAmB,IAAI,oBAAoB,CAAC;AAC5D,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,CAAC,GAAG,CAAC,CAAC;AAKxF;;GAEG;AACH,eAAO,MAAM,uBAAuB;;;CAEnC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;CAElC,CAAC;AAGF;;GAEG;AACH,eAAO,MAAM,cAAc,wFAAkD,CAAC;AAE9E;;GAEG;AACH,eAAO,MAAM,eAAe,oGAAmD,CAAC;AAEhF;;GAEG;AACH,eAAO,MAAM,cAAc,iDAAyD,CAAC;AAErF;;GAEG;AACH,eAAO,MAAM,aAAa,iDAAwD,CAAC"}
@@ -0,0 +1,83 @@
1
+ /**
2
+ * @author: yanxianliang
3
+ * @date: 2025-01-17
4
+ * @desc: MindMap Props hooks - 类型化的 props 访问
5
+ *
6
+ * Copyright (c) 2025 by yanxianliang, All Rights Reserved.
7
+ */
8
+ import { useInputProps, useFlowProps, useGetInputProps, useGetFlowProps } from '@rxflow/base';
9
+
10
+ /**
11
+ * 获取原始输入 props
12
+ *
13
+ * @example
14
+ * const inputProps = useMindMapInputProps();
15
+ * const root = useMindMapInputProps(state => state.root);
16
+ */
17
+
18
+ export function useMindMapInputProps(selector) {
19
+ return useInputProps(selector);
20
+ }
21
+
22
+ /**
23
+ * 获取转换后的 Flow props
24
+ *
25
+ * @example
26
+ * const flowProps = useMindMapFlowProps();
27
+ * const nodes = useMindMapFlowProps(state => state.nodes);
28
+ */
29
+
30
+ export function useMindMapFlowProps(selector) {
31
+ return useFlowProps(selector);
32
+ }
33
+
34
+ /**
35
+ * 获取原始输入 props 的 getter(非响应式)
36
+ */
37
+ export var useGetMindMapInputProps = function useGetMindMapInputProps() {
38
+ return useGetInputProps();
39
+ };
40
+
41
+ /**
42
+ * 获取转换后 Flow props 的 getter(非响应式)
43
+ */
44
+ export var useGetMindMapFlowProps = function useGetMindMapFlowProps() {
45
+ return useGetFlowProps();
46
+ };
47
+
48
+ // 便捷 hooks
49
+ /**
50
+ * 获取 root 节点数据
51
+ */
52
+ export var useMindMapRoot = function useMindMapRoot() {
53
+ return useMindMapInputProps(function (state) {
54
+ return state.root;
55
+ });
56
+ };
57
+
58
+ /**
59
+ * 获取主题配置
60
+ */
61
+ export var useMindMapTheme = function useMindMapTheme() {
62
+ return useMindMapInputProps(function (state) {
63
+ return state.theme;
64
+ });
65
+ };
66
+
67
+ /**
68
+ * 获取是否显示 tooltip
69
+ */
70
+ export var useShowTooltip = function useShowTooltip() {
71
+ return useMindMapInputProps(function (state) {
72
+ return state.showTooltip;
73
+ });
74
+ };
75
+
76
+ /**
77
+ * 获取布局类型
78
+ */
79
+ export var useLayoutType = function useLayoutType() {
80
+ return useMindMapInputProps(function (state) {
81
+ return state.layoutType;
82
+ });
83
+ };
package/esm/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  /// <reference types="react" />
2
- import { MindMapFlowProps } from "./";
2
+ import { MindMapFlowProps } from "./types";
3
3
  declare const MindMapFlow: (props: import("react").PropsWithChildren<MindMapFlowProps>) => import("react/jsx-runtime").JSX.Element;
4
4
  export default MindMapFlow;
5
5
  export * from './types';
6
6
  export * from './constants';
7
+ export * from './hooks/useMindMapProps';
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":";AAWA,OAAO,EAAqB,gBAAgB,EAAC,WAAyB;AAoCtE,QAAA,MAAM,WAAW,yGAmBM,CAAA;AAEvB,eAAe,WAAW,CAAC;AAE3B,cAAc,SAAS,CAAC;AAExB,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":";AAWA,OAAO,EAAsB,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAkC/D,QAAA,MAAM,WAAW,yGAmBW,CAAC;AAE7B,eAAe,WAAW,CAAC;AAG3B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAG5B,cAAc,yBAAyB,CAAC"}
package/esm/index.js CHANGED
@@ -13,6 +13,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
13
13
  /*
14
14
  * @author: yanxianliang
15
15
  * @date: 2025-06-01 18:36
16
+ * @modified:2025/1/17 by yanxianliang
16
17
  * @desc: 资产树 / 脑图
17
18
  *
18
19
  * Copyright (c) 2025 by yanxianliang, All Rights Reserved.
@@ -25,9 +26,12 @@ var fitViewOptions = {
25
26
  minZoom: 1,
26
27
  maxZoom: 1
27
28
  };
28
- var omitProps = ['root', 'layoutType', 'showTooltip'];
29
29
  var fn = function fn() {};
30
- var usePropsTransformer = function usePropsTransformer(props) {
30
+
31
+ /**
32
+ * Props 转换 hook
33
+ */
34
+ var useMindMapPropsTransform = function useMindMapPropsTransform(props) {
31
35
  var _props$nodeTypes = props.nodeTypes,
32
36
  customNodeTypes = _props$nodeTypes === void 0 ? [] : _props$nodeTypes,
33
37
  root = props.root;
@@ -43,7 +47,6 @@ var usePropsTransformer = function usePropsTransformer(props) {
43
47
  fitViewOptions: fitViewOptions,
44
48
  forceLayout: false,
45
49
  nodes: nodes,
46
- omitProps: omitProps,
47
50
  readOnly: true,
48
51
  nodeTypes: [].concat(_toConsumableArray(nodeTypes), _toConsumableArray(customNodeTypes))
49
52
  });
@@ -57,12 +60,17 @@ var MindMapFlow = createFlow(function (props) {
57
60
  vGap: theme === null || theme === void 0 ? void 0 : theme.vGap,
58
61
  markerType: theme === null || theme === void 0 ? void 0 : theme.markerType
59
62
  });
60
- }, []);
63
+ }, [theme === null || theme === void 0 ? void 0 : theme.hGap, theme === null || theme === void 0 ? void 0 : theme.vGap, theme === null || theme === void 0 ? void 0 : theme.markerType]);
61
64
  return /*#__PURE__*/_jsx(Flow, _objectSpread(_objectSpread({}, props), {}, {
62
65
  layout: layout,
63
66
  children: children
64
67
  }));
65
- }, usePropsTransformer);
68
+ }, useMindMapPropsTransform);
66
69
  export default MindMapFlow;
70
+
71
+ // 类型导出
67
72
  export * from "./types";
68
- export * from "./constants";
73
+ export * from "./constants";
74
+
75
+ // Hooks 导出
76
+ export * from "./hooks/useMindMapProps";
@@ -0,0 +1,9 @@
1
+ import { MindMapExtendProps, TopicBranchNodeType } from "../..";
2
+ export declare const TooltipLabel: ({ type, label, level, ellipsisRow, showTooltip }: {
3
+ label: TopicBranchNodeType['label'];
4
+ level: TopicBranchNodeType['level'];
5
+ type: string;
6
+ ellipsisRow?: number | undefined;
7
+ showTooltip: MindMapExtendProps['showTooltip'];
8
+ }) => import("react/jsx-runtime").JSX.Element;
9
+ //# sourceMappingURL=TooltipLabel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TooltipLabel.d.ts","sourceRoot":"","sources":["TooltipLabel.tsx"],"names":[],"mappings":"AASA,OAAO,EAAC,kBAAkB,EAAE,mBAAmB,EAAC,cAAyB;AAIzE,eAAO,MAAM,YAAY;WAChB,mBAAmB,CAAC,OAAO,CAAC;WAC5B,mBAAmB,CAAC,OAAO,CAAC;UAC7B,MAAM;;iBAEC,kBAAkB,CAAC,aAAa,CAAC;6CAgC/C,CAAA"}
@@ -0,0 +1,60 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
4
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
5
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
6
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
9
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
10
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
+ /**
12
+ * @author: yanxianliang
13
+ * @date: 2026-01-19 13:57
14
+ * @modified:2026/1/19 13:57 by yanxianliang
15
+ * @desc: 支持溢出的文本显示
16
+ *
17
+ * Copyright (c) 2026 by yanxianliang, All Rights Reserved.
18
+ */
19
+ import { Tooltip } from "@rxflow/base";
20
+ import cc from "classcat";
21
+ import React, { useLayoutEffect, useRef, useState } from "react";
22
+ import { jsx as _jsx } from "react/jsx-runtime";
23
+ export var TooltipLabel = function TooltipLabel(_ref) {
24
+ var type = _ref.type,
25
+ label = _ref.label,
26
+ level = _ref.level,
27
+ ellipsisRow = _ref.ellipsisRow,
28
+ showTooltip = _ref.showTooltip;
29
+ var _useState = useState(false),
30
+ _useState2 = _slicedToArray(_useState, 2),
31
+ ellipse = _useState2[0],
32
+ setEllipse = _useState2[1];
33
+ var rootRef = useRef(null);
34
+ useLayoutEffect(function () {
35
+ if (showTooltip === 'ellipsis') {
36
+ var target = rootRef.current;
37
+ var textElement = target.firstElementChild;
38
+ var canTooltip = textElement && textElement.scrollHeight > textElement.clientHeight;
39
+ setEllipse(canTooltip);
40
+ }
41
+ }, [label]);
42
+ var child = /*#__PURE__*/_jsx("div", {
43
+ className: cc(['rxflow-topic-container', "rxflow-".concat(type)]),
44
+ ref: rootRef,
45
+ children: /*#__PURE__*/_jsx("span", {
46
+ className: cc(['rxflow-topic-text', _defineProperty({}, 'rxflow-topic-text-link', level === 'link')]),
47
+ style: {
48
+ WebkitLineClamp: ellipsisRow
49
+ },
50
+ children: label
51
+ })
52
+ });
53
+ if (showTooltip === 'ellipsis' && ellipse || showTooltip === 'always') {
54
+ return /*#__PURE__*/_jsx(Tooltip, {
55
+ title: label,
56
+ children: child
57
+ });
58
+ }
59
+ return child;
60
+ };
@@ -1,5 +1,5 @@
1
- import { InnerNodeType } from "../../types";
2
- import './index.less';
3
1
  import { NodeTypeComponent } from "@rxflow/base";
2
+ import './index.less';
3
+ import { InnerNodeType } from "../../types";
4
4
  export declare const TopicChildNode: NodeTypeComponent<InnerNodeType>;
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAC,aAAa,EAAwC,MAAM,aAAa,CAAC;AAEjF,OAAO,cAAc,CAAC;AAItB,OAAO,EAAoC,iBAAiB,EAAiD,MAAM,cAAc,CAAC;AAGlI,eAAO,MAAM,cAAc,kCAmEyF,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":"AAQA,OAAO,EAA+B,iBAAiB,EAAyC,MAAM,cAAc,CAAC;AAMrH,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAC,aAAa,EAAwC,MAAM,aAAa,CAAC;AAGjF,eAAO,MAAM,cAAc,kCAkDyF,CAAC"}
@@ -1,7 +1,3 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
4
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
5
1
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
6
2
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7
3
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
@@ -20,19 +16,19 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
16
  * Copyright (c) 2025 by yanxianliang, All Rights Reserved.
21
17
  */
22
18
 
23
- import React, { useMemo } from "react";
19
+ import { CollapseButton, HiddenHandle, useFlowProps, useForceUpdate, useTheme } from "@rxflow/base";
24
20
  import { useInternalNode } from "@xyflow/react";
21
+ import { useMemoizedFn } from "ahooks";
22
+ import { useToken } from "antd/es/theme/internal";
25
23
  import { isEqual } from "lodash";
26
24
  import "./index.less";
27
- import cc from 'classcat';
28
- import { useToken } from "antd/es/theme/internal";
29
- import { useMemoizedFn } from "ahooks";
30
- import { Tooltip, useTheme, CollapseButton, usePropsSelector, HiddenHandle, useForceUpdate } from "@rxflow/base";
25
+ import React, { useMemo } from "react";
26
+ import { TooltipLabel } from "./TooltipLabel";
31
27
  import { jsx as _jsx } from "react/jsx-runtime";
32
28
  import { Fragment as _Fragment } from "react/jsx-runtime";
33
29
  import { jsxs as _jsxs } from "react/jsx-runtime";
34
30
  export var TopicChildNode = /*#__PURE__*/React.memo(function (props) {
35
- var _usePropsSelector, _internalNode$interna2;
31
+ var _useFlowProps, _internalNode$interna2;
36
32
  var data = props.data,
37
33
  height = props.height,
38
34
  type = props.type,
@@ -46,9 +42,9 @@ export var TopicChildNode = /*#__PURE__*/React.memo(function (props) {
46
42
  ellipsis = _ref.ellipsis; // 主题配置
47
43
 
48
44
  var theme = useTheme();
49
- var showTooltip = (_usePropsSelector = usePropsSelector(function (state) {
45
+ var showTooltip = (_useFlowProps = useFlowProps(function (state) {
50
46
  return state.showTooltip;
51
- })) !== null && _usePropsSelector !== void 0 ? _usePropsSelector : 'ellipsis';
47
+ })) !== null && _useFlowProps !== void 0 ? _useFlowProps : 'ellipsis';
52
48
  var _useToken = useToken(),
53
49
  _useToken2 = _slicedToArray(_useToken, 2),
54
50
  _ = _useToken2[0],
@@ -68,14 +64,6 @@ export var TopicChildNode = /*#__PURE__*/React.memo(function (props) {
68
64
  // 触发relayout
69
65
  triggerLayout();
70
66
  });
71
- var canTooltipShow = useMemoizedFn(function (event) {
72
- var target = event.currentTarget;
73
- if (showTooltip) {
74
- var textElement = target.firstElementChild;
75
- return showTooltip === 'ellipsis' ? textElement && textElement.scrollHeight > textElement.clientHeight : true;
76
- }
77
- return false;
78
- });
79
67
  var handles = useMemo(function () {
80
68
  var _internalNode$interna;
81
69
  var _ref2 = (internalNode === null || internalNode === void 0 || (_internalNode$interna = internalNode.internals) === null || _internalNode$interna === void 0 ? void 0 : _internalNode$interna.handleBounds) || {},
@@ -94,19 +82,12 @@ export var TopicChildNode = /*#__PURE__*/React.memo(function (props) {
94
82
  top: handle.y
95
83
  }
96
84
  }, "".concat(handle.id, "_").concat(handle.type));
97
- }), /*#__PURE__*/_jsx(Tooltip, {
98
- title: label,
99
- canTooltipShow: canTooltipShow,
100
- children: /*#__PURE__*/_jsx("div", {
101
- className: cc(['rxflow-topic-container', "rxflow-".concat(type)]),
102
- children: /*#__PURE__*/_jsx("span", {
103
- className: cc(['rxflow-topic-text', _defineProperty({}, 'rxflow-topic-text-link', level === 'link')]),
104
- style: {
105
- WebkitLineClamp: ellipsisRow
106
- },
107
- children: label
108
- })
109
- })
85
+ }), /*#__PURE__*/_jsx(TooltipLabel, {
86
+ label: label,
87
+ level: level,
88
+ type: type,
89
+ showTooltip: showTooltip,
90
+ ellipsisRow: ellipsisRow
110
91
  }), childrenCounts ? /*#__PURE__*/_jsx(CollapseButton, {
111
92
  count: childrenCounts,
112
93
  collapsed: collapsed,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rxflow/mind-map",
3
- "version": "0.0.3",
3
+ "version": "0.0.4-alpha.0",
4
4
  "description": "资产树/思维导图",
5
5
  "homepage": "https://tree-graph.publib.cn/packages/mind-map",
6
6
  "repository": {
@@ -31,7 +31,7 @@
31
31
  "build": "father build"
32
32
  },
33
33
  "dependencies": {
34
- "@rxflow/base": "^0.0.3"
34
+ "@rxflow/base": "^0.0.4-alpha.0"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "@types/lodash": ">=4.17.16",