@rxflow/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.
- package/README.md +41 -0
- package/cjs/BaseNodeWrapper/index.d.ts +18 -0
- package/cjs/BaseNodeWrapper/index.d.ts.map +1 -0
- package/cjs/BaseNodeWrapper/index.js +51 -0
- package/cjs/GroupNodeWrapper/index.d.ts +15 -0
- package/cjs/GroupNodeWrapper/index.d.ts.map +1 -0
- package/cjs/GroupNodeWrapper/index.js +64 -0
- package/cjs/components/Connector.d.ts +8 -0
- package/cjs/components/Connector.d.ts.map +1 -0
- package/cjs/components/Connector.js +147 -0
- package/cjs/constants.d.ts +26 -0
- package/cjs/constants.d.ts.map +1 -0
- package/cjs/constants.js +35 -0
- package/cjs/index.d.ts +7 -0
- package/cjs/index.d.ts.map +1 -0
- package/cjs/index.js +82 -0
- package/cjs/style/index.less +1 -0
- package/cjs/style/theme.less +16 -0
- package/cjs/types.d.ts +49 -0
- package/cjs/types.d.ts.map +1 -0
- package/cjs/types.js +3 -0
- package/cjs/utils/_layoutCells.d.ts +14 -0
- package/cjs/utils/_layoutCells.d.ts.map +1 -0
- package/cjs/utils/_layoutCells.js +483 -0
- package/cjs/utils/keys.d.ts +3 -0
- package/cjs/utils/keys.d.ts.map +1 -0
- package/cjs/utils/keys.js +18 -0
- package/cjs/utils/layoutCells.d.ts +14 -0
- package/cjs/utils/layoutCells.d.ts.map +1 -0
- package/cjs/utils/layoutCells.js +308 -0
- package/esm/BaseNodeWrapper/index.d.ts +18 -0
- package/esm/BaseNodeWrapper/index.d.ts.map +1 -0
- package/esm/BaseNodeWrapper/index.js +44 -0
- package/esm/GroupNodeWrapper/index.d.ts +15 -0
- package/esm/GroupNodeWrapper/index.d.ts.map +1 -0
- package/esm/GroupNodeWrapper/index.js +56 -0
- package/esm/components/Connector.d.ts +8 -0
- package/esm/components/Connector.d.ts.map +1 -0
- package/esm/components/Connector.js +162 -0
- package/esm/constants.d.ts +26 -0
- package/esm/constants.d.ts.map +1 -0
- package/esm/constants.js +30 -0
- package/esm/index.d.ts +7 -0
- package/esm/index.d.ts.map +1 -0
- package/esm/index.js +55 -0
- package/esm/style/index.less +1 -0
- package/esm/style/theme.less +16 -0
- package/esm/types.d.ts +49 -0
- package/esm/types.d.ts.map +1 -0
- package/esm/types.js +13 -0
- package/esm/utils/_layoutCells.d.ts +14 -0
- package/esm/utils/_layoutCells.d.ts.map +1 -0
- package/esm/utils/_layoutCells.js +477 -0
- package/esm/utils/keys.d.ts +3 -0
- package/esm/utils/keys.d.ts.map +1 -0
- package/esm/utils/keys.js +11 -0
- package/esm/utils/layoutCells.d.ts +14 -0
- package/esm/utils/layoutCells.d.ts.map +1 -0
- package/esm/utils/layoutCells.js +305 -0
- package/package.json +47 -0
package/esm/constants.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
|
|
9
|
+
export var BloodlineDirection = /*#__PURE__*/function (BloodlineDirection) {
|
|
10
|
+
BloodlineDirection["upstream"] = "upstream";
|
|
11
|
+
BloodlineDirection["downstream"] = "downstream";
|
|
12
|
+
return BloodlineDirection;
|
|
13
|
+
}({});
|
|
14
|
+
export var BloodlineNodeType = /*#__PURE__*/function (BloodlineNodeType) {
|
|
15
|
+
BloodlineNodeType["Service"] = "service";
|
|
16
|
+
BloodlineNodeType["ServiceGroup"] = "service-group";
|
|
17
|
+
return BloodlineNodeType;
|
|
18
|
+
}({});
|
|
19
|
+
export var Align = /*#__PURE__*/function (Align) {
|
|
20
|
+
Align["center"] = "center";
|
|
21
|
+
Align["top"] = "top";
|
|
22
|
+
return Align;
|
|
23
|
+
}({});
|
|
24
|
+
export var sideSymbol = Symbol.for('__node_side__');
|
|
25
|
+
export var parentIdSymbol = Symbol.for('__parent_id__');
|
|
26
|
+
export var SplitSide = /*#__PURE__*/function (SplitSide) {
|
|
27
|
+
SplitSide["left"] = "left";
|
|
28
|
+
SplitSide["right"] = "right";
|
|
29
|
+
return SplitSide;
|
|
30
|
+
}({});
|
package/esm/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IBloodlineFlowProps } from "./types";
|
|
3
|
+
declare const BloodlineFlow: (props: import("react").PropsWithChildren<IBloodlineFlowProps>) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export default BloodlineFlow;
|
|
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":";AAaA,OAAO,EAAuB,mBAAmB,EAAC,MAAM,SAAS,CAAC;AAYlE,QAAA,MAAM,aAAa,4GA6BjB,CAAA;AAGF,eAAe,aAAa,CAAC;AAG7B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC"}
|
package/esm/index.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
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 ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
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); }
|
|
7
|
+
/*
|
|
8
|
+
* @author: yanxianliang
|
|
9
|
+
* @date: 2025-06-01 18:36
|
|
10
|
+
* @desc: 血缘视图
|
|
11
|
+
*
|
|
12
|
+
* Copyright (c) 2025 by yanxianliang, All Rights Reserved.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { createFlow, Flow } from '@rxflow/base';
|
|
16
|
+
import { useMemo } from "react";
|
|
17
|
+
import { BaseNodeWrapper } from "./BaseNodeWrapper";
|
|
18
|
+
import { GroupWrapper } from "./GroupNodeWrapper";
|
|
19
|
+
import { layoutCells } from "./utils/layoutCells";
|
|
20
|
+
var fitViewOptions = {
|
|
21
|
+
padding: 2,
|
|
22
|
+
minZoom: 1,
|
|
23
|
+
maxZoom: 1
|
|
24
|
+
};
|
|
25
|
+
var omitProps = ['root', 'getRelation', 'mode'];
|
|
26
|
+
var BloodlineFlow = createFlow(Flow, function (props) {
|
|
27
|
+
var root = props.root,
|
|
28
|
+
nodeTypes = props.nodeTypes;
|
|
29
|
+
var nodes = useMemo(function () {
|
|
30
|
+
return root ? [root] : [];
|
|
31
|
+
}, [root]);
|
|
32
|
+
var _nodeTypes = useMemo(function () {
|
|
33
|
+
return nodeTypes === null || nodeTypes === void 0 ? void 0 : nodeTypes.map(function (nodeType) {
|
|
34
|
+
return _objectSpread(_objectSpread({}, nodeType), {}, {
|
|
35
|
+
_component: nodeType.component,
|
|
36
|
+
// 真实的节点组件
|
|
37
|
+
component: nodeType.type === 'fields' ? GroupWrapper : BaseNodeWrapper
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
}, [nodeTypes]);
|
|
41
|
+
return _objectSpread(_objectSpread({}, props), {}, {
|
|
42
|
+
edgesFocusable: false,
|
|
43
|
+
fitViewOptions: fitViewOptions,
|
|
44
|
+
autoCenter: true,
|
|
45
|
+
nodes: nodes,
|
|
46
|
+
layout: layoutCells,
|
|
47
|
+
nodeTypes: _nodeTypes,
|
|
48
|
+
omitProps: omitProps,
|
|
49
|
+
selectionOnDrag: false,
|
|
50
|
+
nodesDraggable: false
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
export default BloodlineFlow;
|
|
54
|
+
export * from "./types";
|
|
55
|
+
export * from "./constants";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import "theme";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
@padding-left: 18px;
|
|
2
|
+
@main-color: #69b1ff;
|
|
3
|
+
@border-color: #E8E8E8;
|
|
4
|
+
@hit-border-color: #69b1ff;
|
|
5
|
+
|
|
6
|
+
@second-border-color: #BBBBBB;
|
|
7
|
+
|
|
8
|
+
@changed-color: #ff4d4f;
|
|
9
|
+
|
|
10
|
+
@txt-color: rgba(0,0,0,0.88);
|
|
11
|
+
|
|
12
|
+
@text-second-color: rgba(0, 0, 0, 0.45);
|
|
13
|
+
|
|
14
|
+
@root-node-ng: #E8F0FD;
|
|
15
|
+
|
|
16
|
+
@text-space: 12px;
|
package/esm/types.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { BaseThemeConfig, IBaseFlowProps } from "@rxflow/base";
|
|
2
|
+
import { Align, BloodlineDirection, parentIdSymbol, sideSymbol, SplitSide } from "./constants";
|
|
3
|
+
export interface IBloodlineTheme extends BaseThemeConfig {
|
|
4
|
+
/**
|
|
5
|
+
* @description 对齐方式
|
|
6
|
+
* @default 'top'
|
|
7
|
+
*/
|
|
8
|
+
align?: Align;
|
|
9
|
+
/**
|
|
10
|
+
* @description 布局方式
|
|
11
|
+
* @default 'compactBox'
|
|
12
|
+
*/
|
|
13
|
+
layout?: 'compactBox' | 'mindmap';
|
|
14
|
+
}
|
|
15
|
+
export type BloodlineExtendProps = {
|
|
16
|
+
root?: BaseBloodNode;
|
|
17
|
+
theme?: IBloodlineTheme;
|
|
18
|
+
/**
|
|
19
|
+
* 异步加载关联节点
|
|
20
|
+
* @param direction
|
|
21
|
+
* @param source
|
|
22
|
+
*/
|
|
23
|
+
getRelation?: (direction: BloodlineDirection, source: BaseBloodNode) => Promise<Omit<ConnectorState, 'state'>>;
|
|
24
|
+
};
|
|
25
|
+
export type IBloodlineFlowProps = Omit<IBaseFlowProps, 'nodes' | 'edges' | 'theme' | 'defaultNodes' | 'defaultEdges'> & BloodlineExtendProps;
|
|
26
|
+
export type BaseBloodNode = {
|
|
27
|
+
relationLabel?: string;
|
|
28
|
+
id: string;
|
|
29
|
+
type: string;
|
|
30
|
+
width?: number;
|
|
31
|
+
height?: number;
|
|
32
|
+
upstream?: ConnectorState;
|
|
33
|
+
downstream?: ConnectorState;
|
|
34
|
+
innerNodes?: BaseBloodNode[];
|
|
35
|
+
[sideSymbol]?: SplitSide;
|
|
36
|
+
[parentIdSymbol]?: string;
|
|
37
|
+
[key: string]: any;
|
|
38
|
+
};
|
|
39
|
+
export type ConnectorState = {
|
|
40
|
+
state?: 'expanded' | 'loading' | 'collapsed';
|
|
41
|
+
count?: number;
|
|
42
|
+
disableCollapse?: boolean;
|
|
43
|
+
list?: Array<BaseBloodNode>;
|
|
44
|
+
};
|
|
45
|
+
export type InnerNodeData = {
|
|
46
|
+
isRoot: boolean;
|
|
47
|
+
depth: number;
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AASA,OAAO,EAAC,eAAe,EAAE,cAAc,EAAC,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAC,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAAC,MAAM,aAAa,CAAC;AAI7F,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IAEd;;;OAGG;IACH,MAAM,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;CACnC;AAGD,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE,kBAAkB,EAAE,MAAM,EAAE,aAAa,KAAK,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC,CAAC;CAChH,CAAA;AAGD,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,cAAc,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,cAAc,GAAG,cAAc,CAAC,GAAG,oBAAoB,CAAC;AAE7I,MAAM,MAAM,aAAa,GAAG;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,QAAQ,CAAC,EAAE,cAAc,CAAC;IAE1B,UAAU,CAAC,EAAE,cAAc,CAAC;IAE5B,UAAU,CAAC,EAAE,aAAa,EAAE,CAAC;IAE7B,CAAC,UAAU,CAAC,CAAC,EAAE,SAAS,CAAC;IAEzB,CAAC,cAAc,CAAC,CAAC,EAAE,MAAM,CAAC;IAE1B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAA;AAGD,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,CAAC,EAAE,UAAU,GAAG,SAAS,GAAG,WAAW,CAAC;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,IAAI,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;CAC7B,CAAA;AAID,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf,CAAA"}
|
package/esm/types.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @author: yanxianliang
|
|
3
|
+
* @date: 2025-06-01 19:22
|
|
4
|
+
* @desc: 类型定义
|
|
5
|
+
*
|
|
6
|
+
* data ==> 具体引用数据,自动添加属性到。数据结构
|
|
7
|
+
*
|
|
8
|
+
* Copyright (c) 2025 by yanxianliang, All Rights Reserved.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { parentIdSymbol, sideSymbol } from "./constants";
|
|
12
|
+
|
|
13
|
+
// 默认支持循环依赖,循环依赖会自动进行检索。
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author: yanxianliang
|
|
3
|
+
* @date: 2025-07-03 13:20
|
|
4
|
+
* @desc: 血缘布局
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2025 by yanxianliang, All Rights Reserved.
|
|
7
|
+
*/
|
|
8
|
+
import { LayoutConfig } from "@rxflow/base";
|
|
9
|
+
import { Edge, Node } from "@xyflow/react";
|
|
10
|
+
export declare const layoutCells: <NodeType extends Node = Node, EdgeType extends Edge = Edge>(config: LayoutConfig<NodeType, EdgeType>) => {
|
|
11
|
+
nodes: NodeType[];
|
|
12
|
+
edges: EdgeType[];
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=_layoutCells.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_layoutCells.d.ts","sourceRoot":"","sources":["_layoutCells.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAA8B,YAAY,EAAe,MAAM,cAAc,CAAC;AAErF,OAAO,EAAC,IAAI,EAAE,IAAI,EAAC,MAAM,eAAe,CAAC;AAoGzC,eAAO,MAAM,WAAW,uEACd,aAAa,QAAQ,EAAE,QAAQ,CAAC;;;CA6WzC,CAAA"}
|