@rxflow/group-bloodline 0.0.1-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.
Files changed (106) hide show
  1. package/README.md +41 -0
  2. package/cjs/components/Connector.d.ts +16 -0
  3. package/cjs/components/Connector.d.ts.map +1 -0
  4. package/cjs/components/Connector.js +152 -0
  5. package/cjs/components/Version.d.ts +11 -0
  6. package/cjs/components/Version.d.ts.map +1 -0
  7. package/cjs/components/Version.js +44 -0
  8. package/cjs/constants.d.ts +22 -0
  9. package/cjs/constants.d.ts.map +1 -0
  10. package/cjs/constants.js +30 -0
  11. package/cjs/index.d.ts +7 -0
  12. package/cjs/index.d.ts.map +1 -0
  13. package/cjs/index.js +71 -0
  14. package/cjs/nodes/DepthToolNode/index.d.ts +7 -0
  15. package/cjs/nodes/DepthToolNode/index.d.ts.map +1 -0
  16. package/cjs/nodes/DepthToolNode/index.js +152 -0
  17. package/cjs/nodes/DepthToolNode/index.less +19 -0
  18. package/cjs/nodes/Service/MultipleVersionService.d.ts +6 -0
  19. package/cjs/nodes/Service/MultipleVersionService.d.ts.map +1 -0
  20. package/cjs/nodes/Service/MultipleVersionService.js +84 -0
  21. package/cjs/nodes/Service/SingleVersionService.d.ts +6 -0
  22. package/cjs/nodes/Service/SingleVersionService.d.ts.map +1 -0
  23. package/cjs/nodes/Service/SingleVersionService.js +76 -0
  24. package/cjs/nodes/Service/index.d.ts +17 -0
  25. package/cjs/nodes/Service/index.d.ts.map +1 -0
  26. package/cjs/nodes/Service/index.js +71 -0
  27. package/cjs/nodes/ServiceGroup/index.d.ts +6 -0
  28. package/cjs/nodes/ServiceGroup/index.d.ts.map +1 -0
  29. package/cjs/nodes/ServiceGroup/index.js +192 -0
  30. package/cjs/nodes/index.d.ts +10 -0
  31. package/cjs/nodes/index.d.ts.map +1 -0
  32. package/cjs/nodes/index.js +43 -0
  33. package/cjs/style/index.less +220 -0
  34. package/cjs/style/index.module.less +212 -0
  35. package/cjs/style/theme.less +16 -0
  36. package/cjs/types.d.ts +102 -0
  37. package/cjs/types.d.ts.map +1 -0
  38. package/cjs/types.js +5 -0
  39. package/cjs/utils/bloodLayout.d.ts +15 -0
  40. package/cjs/utils/bloodLayout.d.ts.map +1 -0
  41. package/cjs/utils/bloodLayout.js +316 -0
  42. package/cjs/utils/countSiblings.d.ts +10 -0
  43. package/cjs/utils/countSiblings.d.ts.map +1 -0
  44. package/cjs/utils/countSiblings.js +32 -0
  45. package/cjs/utils/getVersion.d.ts +3 -0
  46. package/cjs/utils/getVersion.d.ts.map +1 -0
  47. package/cjs/utils/getVersion.js +24 -0
  48. package/cjs/utils/keys.d.ts +3 -0
  49. package/cjs/utils/keys.d.ts.map +1 -0
  50. package/cjs/utils/keys.js +18 -0
  51. package/cjs/utils/shadowNodeData.d.ts +10 -0
  52. package/cjs/utils/shadowNodeData.d.ts.map +1 -0
  53. package/cjs/utils/shadowNodeData.js +18 -0
  54. package/esm/components/Connector.d.ts +16 -0
  55. package/esm/components/Connector.d.ts.map +1 -0
  56. package/esm/components/Connector.js +168 -0
  57. package/esm/components/Version.d.ts +11 -0
  58. package/esm/components/Version.d.ts.map +1 -0
  59. package/esm/components/Version.js +36 -0
  60. package/esm/constants.d.ts +22 -0
  61. package/esm/constants.d.ts.map +1 -0
  62. package/esm/constants.js +25 -0
  63. package/esm/index.d.ts +7 -0
  64. package/esm/index.d.ts.map +1 -0
  65. package/esm/index.js +45 -0
  66. package/esm/nodes/DepthToolNode/index.d.ts +7 -0
  67. package/esm/nodes/DepthToolNode/index.d.ts.map +1 -0
  68. package/esm/nodes/DepthToolNode/index.js +220 -0
  69. package/esm/nodes/DepthToolNode/index.less +19 -0
  70. package/esm/nodes/Service/MultipleVersionService.d.ts +6 -0
  71. package/esm/nodes/Service/MultipleVersionService.d.ts.map +1 -0
  72. package/esm/nodes/Service/MultipleVersionService.js +74 -0
  73. package/esm/nodes/Service/SingleVersionService.d.ts +6 -0
  74. package/esm/nodes/Service/SingleVersionService.d.ts.map +1 -0
  75. package/esm/nodes/Service/SingleVersionService.js +67 -0
  76. package/esm/nodes/Service/index.d.ts +17 -0
  77. package/esm/nodes/Service/index.d.ts.map +1 -0
  78. package/esm/nodes/Service/index.js +57 -0
  79. package/esm/nodes/ServiceGroup/index.d.ts +6 -0
  80. package/esm/nodes/ServiceGroup/index.d.ts.map +1 -0
  81. package/esm/nodes/ServiceGroup/index.js +201 -0
  82. package/esm/nodes/index.d.ts +10 -0
  83. package/esm/nodes/index.d.ts.map +1 -0
  84. package/esm/nodes/index.js +36 -0
  85. package/esm/style/index.less +220 -0
  86. package/esm/style/index.module.less +212 -0
  87. package/esm/style/theme.less +16 -0
  88. package/esm/types.d.ts +102 -0
  89. package/esm/types.d.ts.map +1 -0
  90. package/esm/types.js +1 -0
  91. package/esm/utils/bloodLayout.d.ts +15 -0
  92. package/esm/utils/bloodLayout.d.ts.map +1 -0
  93. package/esm/utils/bloodLayout.js +304 -0
  94. package/esm/utils/countSiblings.d.ts +10 -0
  95. package/esm/utils/countSiblings.d.ts.map +1 -0
  96. package/esm/utils/countSiblings.js +23 -0
  97. package/esm/utils/getVersion.d.ts +3 -0
  98. package/esm/utils/getVersion.d.ts.map +1 -0
  99. package/esm/utils/getVersion.js +17 -0
  100. package/esm/utils/keys.d.ts +3 -0
  101. package/esm/utils/keys.d.ts.map +1 -0
  102. package/esm/utils/keys.js +11 -0
  103. package/esm/utils/shadowNodeData.d.ts +10 -0
  104. package/esm/utils/shadowNodeData.d.ts.map +1 -0
  105. package/esm/utils/shadowNodeData.js +11 -0
  106. package/package.json +50 -0
package/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # @rxflow/group-bloodline
2
+
3
+ 分组血缘关系图组件,支持节点分组展示。
4
+
5
+ ## 安装
6
+
7
+ ```bash
8
+ npm install @rxflow/group-bloodline @rxflow/base
9
+ # or
10
+ pnpm add @rxflow/group-bloodline @rxflow/base
11
+ ```
12
+
13
+ ## 使用
14
+
15
+ ```tsx
16
+ import GroupBloodlineFlow from '@rxflow/group-bloodline';
17
+
18
+ function App() {
19
+ return (
20
+ <GroupBloodlineFlow
21
+ data={groupData}
22
+ // ... other props
23
+ />
24
+ );
25
+ }
26
+ ```
27
+
28
+ ## 特性
29
+
30
+ - 节点分组
31
+ - 版本管理
32
+ - 自动布局
33
+ - 主题定制
34
+
35
+ ## API 文档
36
+
37
+ 访问 [完整文档](https://tree-graph.publib.cn/group-bloodline/examples) 查看详细 API。
38
+
39
+ ## License
40
+
41
+ MIT
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @author: yanxianliang
3
+ * @date: 2025-07-05 15:19
4
+ * @desc: 连接器
5
+ *
6
+ * Copyright (c) 2025 by yanxianliang, All Rights Reserved.
7
+ */
8
+ import { BaseGroupBloodNode, SiblingNodes, VersionProps, InnerNodeData } from "..";
9
+ import { BloodlineDirection } from "../constants";
10
+ export declare const Connector: ({ direction, version, source, siblings, }: {
11
+ direction: BloodlineDirection;
12
+ version: VersionProps;
13
+ source: BaseGroupBloodNode;
14
+ siblings?: SiblingNodes | undefined;
15
+ } & InnerNodeData) => import("react/jsx-runtime").JSX.Element | null;
16
+ //# sourceMappingURL=Connector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Connector.d.ts","sourceRoot":"","sources":["Connector.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,kBAAkB,EAKlB,YAAY,EACZ,YAAY,EACZ,aAAa,EACd,WAAgC;AAUjC,OAAO,EAAC,kBAAkB,EAAoB,MAAM,cAAc,CAAC;AAyCnE,eAAO,MAAM,SAAS;eAOP,kBAAkB;aACpB,YAAY;YACb,kBAAkB;;oEA2F7B,CAAA"}
@@ -0,0 +1,152 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Connector = void 0;
7
+ var _base = require("@rxflow/base");
8
+ var _react = require("@xyflow/react");
9
+ var _react2 = _interopRequireWildcard(require("react"));
10
+ var _ahooks = require("ahooks");
11
+ var _constants = require("../constants");
12
+ var _keys = require("../utils/keys");
13
+ var _jsxRuntime = require("react/jsx-runtime");
14
+ 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); }
15
+ 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; }
16
+ /**
17
+ * @author: yanxianliang
18
+ * @date: 2025-07-05 15:19
19
+ * @desc: 连接器
20
+ *
21
+ * Copyright (c) 2025 by yanxianliang, All Rights Reserved.
22
+ */
23
+
24
+ function collapseVersionsNode(direction, node) {
25
+ for (const version of node.versions) {
26
+ version[direction] && (version[direction].state = 'collapsed');
27
+ }
28
+ }
29
+ function collapseGroup(direction, node) {
30
+ const list = node.state?.list;
31
+ if (list) {
32
+ collapseSiblings(direction, list);
33
+ }
34
+ }
35
+ function collapseSiblings(direction, siblings) {
36
+ for (const sibling of siblings) {
37
+ const {
38
+ type
39
+ } = sibling;
40
+ switch (type) {
41
+ case _constants.BloodlineNodeType.Service:
42
+ collapseVersionsNode(direction, sibling);
43
+ break;
44
+ case _constants.BloodlineNodeType.ServiceGroup:
45
+ collapseGroup(direction, sibling);
46
+ break;
47
+ }
48
+ }
49
+ }
50
+ function getStateWithDefault(config) {
51
+ const {
52
+ state = 'collapsed',
53
+ count,
54
+ list,
55
+ ...extra
56
+ } = config || {};
57
+ return {
58
+ ...extra,
59
+ state,
60
+ count,
61
+ list
62
+ };
63
+ }
64
+ const Connector = ({
65
+ direction,
66
+ version,
67
+ source,
68
+ siblings
69
+ }) => {
70
+ const update = (0, _ahooks.useUpdate)();
71
+ const triggerLayout = (0, _base.useForceUpdate)();
72
+ const getProps = (0, _base.useGetProps)();
73
+ const config = version[direction];
74
+ const connectorState = (0, _react2.useMemo)(() => {
75
+ return getStateWithDefault(config);
76
+ }, [config?.state]);
77
+ const {
78
+ count,
79
+ state
80
+ } = connectorState;
81
+ const notShow = !config || config.count === 0;
82
+ const position = direction === _constants.BloodlineDirection.upstream ? _react.Position.Left : _react.Position.Right;
83
+ const collapseOthers = (0, _ahooks.useMemoizedFn)(() => {
84
+ if (siblings) {
85
+ collapseSiblings(direction, siblings);
86
+ }
87
+ });
88
+ const onClick = (0, _ahooks.useMemoizedFn)(() => {
89
+ const {
90
+ state,
91
+ list
92
+ } = connectorState;
93
+ if (state === 'loading') {
94
+ return;
95
+ }
96
+ if (state === 'collapsed') {
97
+ if (list) {
98
+ // 数据已经缓存了,不需要再次加载
99
+ collapseOthers();
100
+ config.state = 'expanded'; // 展开状态,关联的节点需要显示,在布局函数中处理
101
+ triggerLayout();
102
+ } else {
103
+ config.state = 'loading';
104
+ update(); // 变成加载状态
105
+ getProps().getRelation?.(direction, source, version).then(({
106
+ count,
107
+ list
108
+ }) => {
109
+ // 执行互斥逻辑,将同级所有节点展开项全部关闭
110
+ if (config.state === 'loading') {
111
+ // 可能已经被收起来了
112
+ collapseOthers();
113
+ config.state = 'expanded';
114
+ config.count = count;
115
+ config.list = list;
116
+ triggerLayout();
117
+ } else {
118
+ config.count = count;
119
+ config.list = list;
120
+ update();
121
+ }
122
+ }).catch(() => {
123
+ // 异常兜底,
124
+ config.state = 'collapsed'; // 支持重试
125
+ update();
126
+ });
127
+ }
128
+ } else {
129
+ config.state = 'collapsed';
130
+ triggerLayout();
131
+ }
132
+ });
133
+ const handleType = direction === _constants.BloodlineDirection.upstream ? 'target' : 'source';
134
+ if (notShow) {
135
+ return null;
136
+ }
137
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
138
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_base.HiddenHandle, {
139
+ type: handleType,
140
+ position: position,
141
+ id: (0, _keys.getConnectorId)(direction, version.id)
142
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_base.CollapseButton, {
143
+ direction: 'vertical',
144
+ collapsed: state === 'collapsed',
145
+ position: position,
146
+ loading: state === 'loading',
147
+ onCollapse: onClick,
148
+ count: count
149
+ })]
150
+ });
151
+ };
152
+ exports.Connector = Connector;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @author: yanxianliang
3
+ * @date: 2025-07-05 15:18
4
+ * @desc: 版本 Item
5
+ *
6
+ * Copyright (c) 2025 by yanxianliang, All Rights Reserved.
7
+ */
8
+ import { VersionProps } from "..";
9
+ import "../style/index.less";
10
+ export declare const Version: (props: VersionProps) => import("react/jsx-runtime").JSX.Element;
11
+ //# sourceMappingURL=Version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Version.d.ts","sourceRoot":"","sources":["Version.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAC,YAAY,EAAC,WAAgC;AAErD,OAAO,qBAAqB,CAAC;AAM7B,eAAO,MAAM,OAAO,UAAW,YAAY,4CAe1C,CAAA"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Version = void 0;
7
+ var _classcat = _interopRequireDefault(require("classcat"));
8
+ require("../style/index.less");
9
+ var _getVersion = require("../utils/getVersion");
10
+ var _react = _interopRequireDefault(require("react"));
11
+ var _jsxRuntime = require("react/jsx-runtime");
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+ /**
14
+ * @author: yanxianliang
15
+ * @date: 2025-07-05 15:18
16
+ * @desc: 版本 Item
17
+ *
18
+ * Copyright (c) 2025 by yanxianliang, All Rights Reserved.
19
+ */
20
+
21
+ const prefixCls = 'rxflow-group-bloodline';
22
+ const Version = props => {
23
+ const {
24
+ version,
25
+ bloodlineVersion,
26
+ status = '-',
27
+ hasChanged,
28
+ hit
29
+ } = props;
30
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
31
+ className: (0, _classcat.default)([`${prefixCls}-version`, {
32
+ [`${prefixCls}-hit`]: hit,
33
+ [`${prefixCls}-changed-version`]: hasChanged
34
+ }]),
35
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
36
+ className: `${prefixCls}-node-sub_title`,
37
+ children: ["\u7248\u672C\u53F7\uFF1A", (0, _getVersion.getVersion)(version), "(", status, ")"]
38
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
39
+ className: `${prefixCls}-node-desc`,
40
+ children: ["\u8840\u7F18\u7248\u672C\u53F7\uFF1A", (0, _getVersion.isEmpty)(bloodlineVersion) ? '-' : bloodlineVersion]
41
+ })]
42
+ });
43
+ };
44
+ exports.Version = Version;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @author: yanxianliang
3
+ * @date: 2025-07-05 15:48
4
+ * @desc: 常量
5
+ *
6
+ * Copyright (c) 2025 by yanxianliang, All Rights Reserved.
7
+ */
8
+ export declare enum BloodlineDirection {
9
+ upstream = "upstream",
10
+ downstream = "downstream"
11
+ }
12
+ export declare enum BloodlineNodeType {
13
+ Service = "service",// 服务节点,支持单版本和多版本。
14
+ ServiceGroup = "service-group",
15
+ Toolbar = "toolbar"
16
+ }
17
+ export declare const groupPageSize = 5;
18
+ export declare enum Align {
19
+ center = "center",
20
+ top = "top"
21
+ }
22
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["constants.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,oBAAY,kBAAkB;IAC5B,QAAQ,aAAa;IACrB,UAAU,eAAe;CAC1B;AAGD,oBAAY,iBAAiB;IAC3B,OAAO,YAAY,CAAE,kBAAkB;IACvC,YAAY,kBAAkB;IAC9B,OAAO,YAAY;CACpB;AAGD,eAAO,MAAM,aAAa,IAAI,CAAC;AAG/B,oBAAY,KAAK;IACf,MAAM,WAAW;IACjB,GAAG,QAAQ;CACZ"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.groupPageSize = exports.BloodlineNodeType = exports.BloodlineDirection = exports.Align = void 0;
7
+ /**
8
+ * @author: yanxianliang
9
+ * @date: 2025-07-05 15:48
10
+ * @desc: 常量
11
+ *
12
+ * Copyright (c) 2025 by yanxianliang, All Rights Reserved.
13
+ */
14
+ let BloodlineDirection = exports.BloodlineDirection = /*#__PURE__*/function (BloodlineDirection) {
15
+ BloodlineDirection["upstream"] = "upstream";
16
+ BloodlineDirection["downstream"] = "downstream";
17
+ return BloodlineDirection;
18
+ }({});
19
+ let BloodlineNodeType = exports.BloodlineNodeType = /*#__PURE__*/function (BloodlineNodeType) {
20
+ BloodlineNodeType["Service"] = "service";
21
+ BloodlineNodeType["ServiceGroup"] = "service-group";
22
+ BloodlineNodeType["Toolbar"] = "toolbar";
23
+ return BloodlineNodeType;
24
+ }({});
25
+ const groupPageSize = exports.groupPageSize = 5;
26
+ let Align = exports.Align = /*#__PURE__*/function (Align) {
27
+ Align["center"] = "center";
28
+ Align["top"] = "top";
29
+ return Align;
30
+ }({});
package/cjs/index.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import { PropsWithChildren } from "react";
2
+ import { IGroupBloodlineFlowProps } from "./types";
3
+ declare const GroupBloodlineFlow: (props: PropsWithChildren<IGroupBloodlineFlowProps>) => import("react/jsx-runtime").JSX.Element;
4
+ export default GroupBloodlineFlow;
5
+ export * from "./types";
6
+ export * from "./constants";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":"AASA,OAAO,EAAC,iBAAiB,EAAU,MAAM,OAAO,CAAC;AAGjD,OAAO,EAA4B,wBAAwB,EAAC,MAAM,SAAS,CAAC;AAkC5E,QAAA,MAAM,kBAAkB,iGAA6F,CAAC;AAEtH,eAAe,kBAAkB,CAAC;AAElC,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC"}
package/cjs/index.js ADDED
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _exportNames = {};
7
+ exports.default = void 0;
8
+ var _react = require("react");
9
+ var _base = require("@rxflow/base");
10
+ var _nodes = require("./nodes");
11
+ var _bloodLayout = require("./utils/bloodLayout");
12
+ var _types = require("./types");
13
+ Object.keys(_types).forEach(function (key) {
14
+ if (key === "default" || key === "__esModule") return;
15
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
16
+ if (key in exports && exports[key] === _types[key]) return;
17
+ Object.defineProperty(exports, key, {
18
+ enumerable: true,
19
+ get: function () {
20
+ return _types[key];
21
+ }
22
+ });
23
+ });
24
+ var _constants = require("./constants");
25
+ Object.keys(_constants).forEach(function (key) {
26
+ if (key === "default" || key === "__esModule") return;
27
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
28
+ if (key in exports && exports[key] === _constants[key]) return;
29
+ Object.defineProperty(exports, key, {
30
+ enumerable: true,
31
+ get: function () {
32
+ return _constants[key];
33
+ }
34
+ });
35
+ });
36
+ /*
37
+ * @author: yanxianliang
38
+ * @date: 2025-06-01 18:36
39
+ * @desc: 血缘视图
40
+ *
41
+ * Copyright (c) 2025 by yanxianliang, All Rights Reserved.
42
+ */
43
+
44
+ const fitViewOptions = {
45
+ padding: 2,
46
+ minZoom: 1,
47
+ maxZoom: 1
48
+ };
49
+ const omitProps = ['root', 'PropertyPopover', 'getRelation', 'getChildren'];
50
+ const usePropsTransformer = props => {
51
+ const {
52
+ root
53
+ } = props;
54
+ const nodes = (0, _react.useMemo)(() => {
55
+ return root ? [root] : [];
56
+ }, [root]);
57
+ return {
58
+ ...props,
59
+ nodes,
60
+ nodeTypes: _nodes.nodeTypes,
61
+ edgesFocusable: false,
62
+ fitViewOptions,
63
+ autoCenter: true,
64
+ layout: _bloodLayout.bloodLayout,
65
+ omitProps,
66
+ selectionOnDrag: false,
67
+ nodesDraggable: false
68
+ };
69
+ };
70
+ const GroupBloodlineFlow = (0, _base.createFlow)(_base.Flow, usePropsTransformer);
71
+ var _default = exports.default = GroupBloodlineFlow;
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { NodeProps, Node } from "@xyflow/react";
3
+ import { DepthToolbarData } from "../../types";
4
+ import "./index.less";
5
+ declare const ToolbarNode: import("react").MemoExoticComponent<(props: NodeProps<Node<DepthToolbarData>>) => import("react/jsx-runtime").JSX.Element | null>;
6
+ export default ToolbarNode;
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAC,SAAS,EAAE,IAAI,EAAC,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAC,gBAAgB,EAA2B,MAAM,aAAa,CAAC;AAGvE,OAAO,cAAc,CAAC;AAuBtB,QAAA,MAAM,WAAW,8CAAgB,UAAU,KAAK,gBAAgB,CAAC,CAAC,oDA+FG,CAAC;AAEtE,eAAe,WAAW,CAAC"}
@@ -0,0 +1,152 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _QuestionCircleOutlined = _interopRequireDefault(require("@ant-design/icons/QuestionCircleOutlined"));
8
+ var _antd = require("antd");
9
+ require("./index.less");
10
+ var _react = require("react");
11
+ var _lodash = require("lodash");
12
+ var _ = require("../..");
13
+ var _base = require("@rxflow/base");
14
+ var _ahooks = require("ahooks");
15
+ var _jsxRuntime = require("react/jsx-runtime");
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+ /*
18
+ * @author: yanxianliang
19
+ * @date: 2025-06-04 13:10
20
+ * @desc: DepthToolNode
21
+ *
22
+ * Copyright (c) 2025 by yanxianliang, All Rights Reserved.
23
+ */
24
+
25
+ function numberToChinese(num) {
26
+ const chars = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九'];
27
+ const absNum = Math.abs(num);
28
+ if (absNum === 0) return chars[0];
29
+ if (absNum < 10) return chars[absNum];
30
+ if (absNum < 20) return '十' + (absNum % 10 === 0 ? '' : chars[absNum % 10]);
31
+ if (absNum < 100) {
32
+ const ten = Math.floor(absNum / 10);
33
+ const unit = absNum % 10;
34
+ return chars[ten] + '十' + (unit === 0 ? '' : chars[unit]);
35
+ }
36
+ // 超过99可自行扩展
37
+ return String(num);
38
+ }
39
+ const ToolbarNode = /*#__PURE__*/(0, _react.memo)(props => {
40
+ const {
41
+ data
42
+ } = props;
43
+ const {
44
+ depth,
45
+ count,
46
+ direction,
47
+ siblings = []
48
+ } = data || {};
49
+ const triggerLayout = (0, _base.useForceUpdate)();
50
+ const getProps = (0, _base.useGetProps)();
51
+ const {
52
+ run: doLayout
53
+ } = (0, _ahooks.useDebounceFn)(() => {
54
+ triggerLayout();
55
+ }, {
56
+ wait: 200
57
+ });
58
+ const onExpandAll = (0, _ahooks.useMemoizedFn)(async () => {
59
+ // 隐藏的节点怎么处理
60
+ let waitRelayout = false;
61
+ let syncTasks = [];
62
+ for (const sibling of siblings) {
63
+ if (sibling.type === _.BloodlineNodeType.ServiceGroup) {
64
+ const expanded = (0, _lodash.get)(sibling, ['state', 'expanded'], false);
65
+ if (!expanded) {
66
+ if (sibling.state?.list) {
67
+ (0, _lodash.set)(sibling, ['state', 'expanded'], true);
68
+ waitRelayout = true;
69
+ } else {
70
+ // 发起请求
71
+ (0, _lodash.set)(sibling, ['state', 'expanded'], true);
72
+ (0, _lodash.set)(sibling, ['state', 'loading'], true);
73
+ waitRelayout = true;
74
+ syncTasks.push((async () => {
75
+ try {
76
+ const getChildren = getProps().getChildren;
77
+ const {
78
+ total,
79
+ list
80
+ } = await getChildren?.(sibling, _.groupPageSize, 1, direction);
81
+ (0, _lodash.set)(sibling, ['state', 'loading'], false);
82
+ (0, _lodash.set)(sibling, ['state', 'current'], 1);
83
+ (0, _lodash.set)(sibling, ['state', 'total'], total);
84
+ (0, _lodash.set)(sibling, ['state', 'list'], list);
85
+ doLayout();
86
+ } catch (e) {
87
+ (0, _lodash.set)(sibling, ['state', 'loading'], false);
88
+ doLayout();
89
+ }
90
+ })());
91
+ }
92
+ }
93
+ }
94
+ }
95
+ waitRelayout && doLayout();
96
+ await Promise.all(syncTasks);
97
+ });
98
+ const onCollapseAll = (0, _ahooks.useMemoizedFn)(() => {
99
+ let waitRelayout = false;
100
+ for (const sibling of siblings) {
101
+ if (sibling.type === _.BloodlineNodeType.ServiceGroup) {
102
+ const expanded = (0, _lodash.get)(sibling, ['state', 'expanded'], false);
103
+ if (expanded) {
104
+ (0, _lodash.set)(sibling, ['state', 'expanded'], false);
105
+ waitRelayout = true;
106
+ }
107
+ }
108
+ }
109
+ if (waitRelayout) {
110
+ triggerLayout();
111
+ }
112
+ });
113
+ if (!count || !depth) {
114
+ return null;
115
+ }
116
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
117
+ className: 'rxflow-dt-toolbar',
118
+ children: [direction === _.BloodlineDirection.upstream ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
119
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
120
+ className: 'rxflow-dt-label',
121
+ children: "\u4F9D\u8D56\u4E0A\u6E38"
122
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Tooltip, {
123
+ title: '表示 查询对象的产出或执行依赖这些上游业务对象',
124
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_QuestionCircleOutlined.default, {})
125
+ })]
126
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
127
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
128
+ className: 'rxflow-dt-label',
129
+ children: "\u5F71\u54CD\u4E0B\u6E38"
130
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Tooltip, {
131
+ title: '表示 查询对象如果下线或修改逻辑,将影响这些下游业务对象的产出或执行',
132
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_QuestionCircleOutlined.default, {})
133
+ })]
134
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
135
+ className: 'rxflow-dt-depth',
136
+ children: [numberToChinese(depth), "\u7EA7 \uFF08", count, "\uFF09"]
137
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_base.LoadingButton, {
138
+ className: 'rxflow-dt-action',
139
+ type: 'link',
140
+ size: 'small',
141
+ onClick: onExpandAll,
142
+ children: "\u5168\u90E8\u5C55\u5F00"
143
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Button, {
144
+ className: 'rxflow-dt-action',
145
+ type: 'link',
146
+ size: 'small',
147
+ onClick: onCollapseAll,
148
+ children: "\u5168\u90E8\u6536\u8D77"
149
+ })]
150
+ });
151
+ }, (prevProps, nextProps) => (0, _lodash.isEqual)(prevProps.data, nextProps.data));
152
+ var _default = exports.default = ToolbarNode;
@@ -0,0 +1,19 @@
1
+ .rxflow-dt{
2
+ &-toolbar {
3
+ font-size: 12px;
4
+ }
5
+
6
+ &-label {
7
+ margin-right: 4px;
8
+ }
9
+
10
+ &-depth {
11
+ margin-left: 4px;
12
+ }
13
+
14
+ &-action {
15
+ font-size: 12px;
16
+ padding-left: 2px;
17
+ padding-right: 2px;
18
+ }
19
+ }
@@ -0,0 +1,6 @@
1
+ import { InnerNodeData, MultipleVersionsNodeData } from "../..";
2
+ import '../../style/index.less';
3
+ export declare const MultipleVersionRender: (props: MultipleVersionsNodeData & InnerNodeData & {
4
+ measure?: boolean;
5
+ }) => import("react/jsx-runtime").JSX.Element;
6
+ //# sourceMappingURL=MultipleVersionService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MultipleVersionService.d.ts","sourceRoot":"","sources":["MultipleVersionService.tsx"],"names":[],"mappings":"AAQA,OAAO,EAGL,aAAa,EACb,wBAAwB,EACzB,cAAgC;AACjC,OAAO,wBAAwB,CAAC;AAQhC,eAAO,MAAM,qBAAqB,UAAW,wBAAwB,GAAG,aAAa,GAAG;IACtF,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,4CAqDA,CAAA"}