@rxflow/bloodline 0.0.4-alpha.2 → 0.0.4-alpha.4
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/cjs/index.d.ts.map +1 -1
- package/cjs/index.js +22 -5
- package/cjs/types.d.ts +7 -2
- package/cjs/types.d.ts.map +1 -1
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +22 -5
- package/esm/types.d.ts +7 -2
- package/esm/types.d.ts.map +1 -1
- package/package.json +2 -2
package/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAwB,mBAAmB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAwB,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAqDpE,QAAA,MAAM,aAAa,4GAGlB,CAAC;AAEF,eAAe,aAAa,CAAC;AAG7B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAG5B,cAAc,SAAS,CAAC"}
|
package/cjs/index.js
CHANGED
|
@@ -55,7 +55,7 @@ Object.keys(_hooks).forEach(function (key) {
|
|
|
55
55
|
* Copyright (c) 2025 by yanxianliang, All Rights Reserved.
|
|
56
56
|
*/
|
|
57
57
|
|
|
58
|
-
const
|
|
58
|
+
const defaultFitViewOptions = {
|
|
59
59
|
padding: 2,
|
|
60
60
|
minZoom: 1,
|
|
61
61
|
maxZoom: 1
|
|
@@ -67,7 +67,9 @@ const fitViewOptions = {
|
|
|
67
67
|
const useBloodlinePropsTransform = props => {
|
|
68
68
|
const {
|
|
69
69
|
root,
|
|
70
|
-
nodeTypes
|
|
70
|
+
nodeTypes,
|
|
71
|
+
fitViewOptions: userFitViewOptions,
|
|
72
|
+
flowProps: userFlowProps
|
|
71
73
|
} = props;
|
|
72
74
|
|
|
73
75
|
// 将 root 转换为 nodes
|
|
@@ -83,16 +85,31 @@ const useBloodlinePropsTransform = props => {
|
|
|
83
85
|
component: nodeType.type === 'fields' ? _GroupNodeWrapper.GroupWrapper : _BaseNodeWrapper.BaseNodeWrapper
|
|
84
86
|
}));
|
|
85
87
|
}, [nodeTypes]);
|
|
88
|
+
|
|
89
|
+
// fitViewOptions 合并(外层属性)
|
|
90
|
+
const fitViewOptions = (0, _react.useMemo)(() => ({
|
|
91
|
+
...defaultFitViewOptions,
|
|
92
|
+
...userFitViewOptions
|
|
93
|
+
}), [userFitViewOptions]);
|
|
94
|
+
|
|
95
|
+
// 合并 flowProps(不常用的配置)
|
|
96
|
+
const flowProps = (0, _react.useMemo)(() => ({
|
|
97
|
+
edgesFocusable: false,
|
|
98
|
+
...userFlowProps
|
|
99
|
+
}), [userFlowProps]);
|
|
86
100
|
return {
|
|
87
101
|
...props,
|
|
88
|
-
edgesFocusable: false,
|
|
89
|
-
fitViewOptions,
|
|
90
102
|
autoCenter: true,
|
|
91
103
|
nodes,
|
|
92
104
|
layout: _layoutCells.layoutCells,
|
|
93
105
|
nodeTypes: wrappedNodeTypes,
|
|
106
|
+
// 外层属性(带默认值)
|
|
107
|
+
nodesDraggable: false,
|
|
94
108
|
selectionOnDrag: false,
|
|
95
|
-
|
|
109
|
+
minZoom: 1,
|
|
110
|
+
maxZoom: 1,
|
|
111
|
+
fitViewOptions,
|
|
112
|
+
flowProps
|
|
96
113
|
};
|
|
97
114
|
};
|
|
98
115
|
const BloodlineFlow = (0, _base.createFlow)(_base.Flow, useBloodlinePropsTransform);
|
package/cjs/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { BaseThemeConfig, IBaseFlowProps } from "@rxflow/base";
|
|
1
|
+
import { BaseThemeConfig, IBaseFlowProps, FlowProps } from "@rxflow/base";
|
|
2
2
|
import { Align, BloodlineDirection, parentIdSymbol, sideSymbol, SplitSide } from "./constants";
|
|
3
|
+
import { Node, Edge } from "@xyflow/react";
|
|
3
4
|
export interface IBloodlineTheme extends BaseThemeConfig {
|
|
4
5
|
/**
|
|
5
6
|
* @description 对齐方式
|
|
@@ -26,8 +27,12 @@ export type BloodlineExtendProps = {
|
|
|
26
27
|
* @default 'manhattan'
|
|
27
28
|
*/
|
|
28
29
|
edgeType?: string;
|
|
30
|
+
/**
|
|
31
|
+
* @description ReactFlow 原生属性(不包含 nodes, edges, nodeTypes 等已在外层定义的属性)
|
|
32
|
+
*/
|
|
33
|
+
flowProps?: FlowProps<Node, Edge>;
|
|
29
34
|
};
|
|
30
|
-
export type IBloodlineFlowProps = Omit<IBaseFlowProps, 'nodes' | 'edges' | 'theme' | '
|
|
35
|
+
export type IBloodlineFlowProps = Omit<IBaseFlowProps, 'nodes' | 'edges' | 'theme' | 'flowProps'> & BloodlineExtendProps;
|
|
31
36
|
export type BaseBloodNode = {
|
|
32
37
|
relationLabel?: string;
|
|
33
38
|
id: string;
|
package/cjs/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AASA,OAAO,EAAC,eAAe,EAAE,cAAc,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AASA,OAAO,EAAC,eAAe,EAAE,cAAc,EAAE,SAAS,EAAC,MAAM,cAAc,CAAC;AACxE,OAAO,EAAC,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAAC,MAAM,aAAa,CAAC;AAC7F,OAAO,EAAC,IAAI,EAAE,IAAI,EAAC,MAAM,eAAe,CAAC;AAGzC,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IAEd;;;OAGG;IACH,MAAM,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC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AC7B,CAAA;AAID,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf,CAAA"}
|
package/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAwB,mBAAmB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":";AAcA,OAAO,EAAwB,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAqDpE,QAAA,MAAM,aAAa,4GAGlB,CAAC;AAEF,eAAe,aAAa,CAAC;AAG7B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAG5B,cAAc,SAAS,CAAC"}
|
package/esm/index.js
CHANGED
|
@@ -18,7 +18,7 @@ import { useMemo } from "react";
|
|
|
18
18
|
import { BaseNodeWrapper } from "./BaseNodeWrapper";
|
|
19
19
|
import { GroupWrapper } from "./GroupNodeWrapper";
|
|
20
20
|
import { layoutCells } from "./utils/layoutCells";
|
|
21
|
-
var
|
|
21
|
+
var defaultFitViewOptions = {
|
|
22
22
|
padding: 2,
|
|
23
23
|
minZoom: 1,
|
|
24
24
|
maxZoom: 1
|
|
@@ -29,7 +29,9 @@ var fitViewOptions = {
|
|
|
29
29
|
*/
|
|
30
30
|
var useBloodlinePropsTransform = function useBloodlinePropsTransform(props) {
|
|
31
31
|
var root = props.root,
|
|
32
|
-
nodeTypes = props.nodeTypes
|
|
32
|
+
nodeTypes = props.nodeTypes,
|
|
33
|
+
userFitViewOptions = props.fitViewOptions,
|
|
34
|
+
userFlowProps = props.flowProps;
|
|
33
35
|
|
|
34
36
|
// 将 root 转换为 nodes
|
|
35
37
|
var nodes = useMemo(function () {
|
|
@@ -45,15 +47,30 @@ var useBloodlinePropsTransform = function useBloodlinePropsTransform(props) {
|
|
|
45
47
|
});
|
|
46
48
|
});
|
|
47
49
|
}, [nodeTypes]);
|
|
50
|
+
|
|
51
|
+
// fitViewOptions 合并(外层属性)
|
|
52
|
+
var fitViewOptions = useMemo(function () {
|
|
53
|
+
return _objectSpread(_objectSpread({}, defaultFitViewOptions), userFitViewOptions);
|
|
54
|
+
}, [userFitViewOptions]);
|
|
55
|
+
|
|
56
|
+
// 合并 flowProps(不常用的配置)
|
|
57
|
+
var flowProps = useMemo(function () {
|
|
58
|
+
return _objectSpread({
|
|
59
|
+
edgesFocusable: false
|
|
60
|
+
}, userFlowProps);
|
|
61
|
+
}, [userFlowProps]);
|
|
48
62
|
return _objectSpread(_objectSpread({}, props), {}, {
|
|
49
|
-
edgesFocusable: false,
|
|
50
|
-
fitViewOptions: fitViewOptions,
|
|
51
63
|
autoCenter: true,
|
|
52
64
|
nodes: nodes,
|
|
53
65
|
layout: layoutCells,
|
|
54
66
|
nodeTypes: wrappedNodeTypes,
|
|
67
|
+
// 外层属性(带默认值)
|
|
68
|
+
nodesDraggable: false,
|
|
55
69
|
selectionOnDrag: false,
|
|
56
|
-
|
|
70
|
+
minZoom: 1,
|
|
71
|
+
maxZoom: 1,
|
|
72
|
+
fitViewOptions: fitViewOptions,
|
|
73
|
+
flowProps: flowProps
|
|
57
74
|
});
|
|
58
75
|
};
|
|
59
76
|
var BloodlineFlow = createFlow(Flow, useBloodlinePropsTransform);
|
package/esm/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { BaseThemeConfig, IBaseFlowProps } from "@rxflow/base";
|
|
1
|
+
import { BaseThemeConfig, IBaseFlowProps, FlowProps } from "@rxflow/base";
|
|
2
2
|
import { Align, BloodlineDirection, parentIdSymbol, sideSymbol, SplitSide } from "./constants";
|
|
3
|
+
import { Node, Edge } from "@xyflow/react";
|
|
3
4
|
export interface IBloodlineTheme extends BaseThemeConfig {
|
|
4
5
|
/**
|
|
5
6
|
* @description 对齐方式
|
|
@@ -26,8 +27,12 @@ export type BloodlineExtendProps = {
|
|
|
26
27
|
* @default 'manhattan'
|
|
27
28
|
*/
|
|
28
29
|
edgeType?: string;
|
|
30
|
+
/**
|
|
31
|
+
* @description ReactFlow 原生属性(不包含 nodes, edges, nodeTypes 等已在外层定义的属性)
|
|
32
|
+
*/
|
|
33
|
+
flowProps?: FlowProps<Node, Edge>;
|
|
29
34
|
};
|
|
30
|
-
export type IBloodlineFlowProps = Omit<IBaseFlowProps, 'nodes' | 'edges' | 'theme' | '
|
|
35
|
+
export type IBloodlineFlowProps = Omit<IBaseFlowProps, 'nodes' | 'edges' | 'theme' | 'flowProps'> & BloodlineExtendProps;
|
|
31
36
|
export type BaseBloodNode = {
|
|
32
37
|
relationLabel?: string;
|
|
33
38
|
id: string;
|
package/esm/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AASA,OAAO,EAAC,eAAe,EAAE,cAAc,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AASA,OAAO,EAAC,eAAe,EAAE,cAAc,EAAE,SAAS,EAAC,MAAM,cAAc,CAAC;AACxE,OAAO,EAAC,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAAC,MAAM,aAAa,CAAC;AAC7F,OAAO,EAAC,IAAI,EAAE,IAAI,EAAC,MAAM,eAAe,CAAC;AAGzC,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IAEd;;;OAGG;IACH,MAAM,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;CAEnC;AAGD,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB;;;;OAIG;IACH,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
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rxflow/bloodline",
|
|
3
|
-
"version": "0.0.4-alpha.
|
|
3
|
+
"version": "0.0.4-alpha.4",
|
|
4
4
|
"description": "通用血缘关系图",
|
|
5
5
|
"homepage": "https://tree-graph.publib.cn/packages/bloodline",
|
|
6
6
|
"repository": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"build": "father build"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@rxflow/base": "^0.0.4-alpha.
|
|
34
|
+
"@rxflow/base": "^0.0.4-alpha.4"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@antv/hierarchy": ">=0.6.14",
|