@rxflow/bloodline 0.0.4-alpha.6 → 0.0.4-alpha.7
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/components/Connector.js +2 -2
- package/cjs/hooks/useBloodlineProps.d.ts +11 -28
- package/cjs/hooks/useBloodlineProps.d.ts.map +1 -1
- package/cjs/hooks/useBloodlineProps.js +13 -34
- package/cjs/index.d.ts.map +1 -1
- package/cjs/index.js +3 -10
- package/esm/components/Connector.js +4 -4
- package/esm/hooks/useBloodlineProps.d.ts +11 -28
- package/esm/hooks/useBloodlineProps.d.ts.map +1 -1
- package/esm/hooks/useBloodlineProps.js +11 -30
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +3 -11
- package/package.json +2 -2
|
@@ -66,7 +66,7 @@ const Connector = ({
|
|
|
66
66
|
}) => {
|
|
67
67
|
const update = (0, _ahooks.useUpdate)();
|
|
68
68
|
const triggerLayout = (0, _base.useForceUpdate)();
|
|
69
|
-
const
|
|
69
|
+
const getProps = (0, _base.useGetFlowProps)();
|
|
70
70
|
const config = source[direction];
|
|
71
71
|
const connectorState = (0, _react2.useMemo)(() => {
|
|
72
72
|
return getStateWithDefault(config);
|
|
@@ -85,7 +85,7 @@ const Connector = ({
|
|
|
85
85
|
} = connectorState;
|
|
86
86
|
const {
|
|
87
87
|
getRelation
|
|
88
|
-
} =
|
|
88
|
+
} = getProps();
|
|
89
89
|
if (state === 'loading') {
|
|
90
90
|
return;
|
|
91
91
|
}
|
|
@@ -6,53 +6,36 @@
|
|
|
6
6
|
* Copyright (c) 2025 by yanxianliang, All Rights Reserved.
|
|
7
7
|
*/
|
|
8
8
|
import { IBaseFlowProps } from '@rxflow/base';
|
|
9
|
-
import {
|
|
10
|
-
import { BloodlineDirection } from '../constants';
|
|
9
|
+
import { BloodlineExtendProps } from '../types';
|
|
11
10
|
type BloodlineFlowProps = IBaseFlowProps & BloodlineExtendProps;
|
|
12
11
|
/**
|
|
13
|
-
*
|
|
12
|
+
* 获取 Flow props
|
|
14
13
|
*
|
|
15
14
|
* @example
|
|
16
|
-
* const
|
|
17
|
-
* const root =
|
|
15
|
+
* const props = useBloodlineProps();
|
|
16
|
+
* const root = useBloodlineProps(state => state.root);
|
|
18
17
|
*/
|
|
19
|
-
export declare function
|
|
20
|
-
export declare function
|
|
18
|
+
export declare function useBloodlineProps(): BloodlineFlowProps;
|
|
19
|
+
export declare function useBloodlineProps<U>(selector: (state: BloodlineFlowProps) => U): U;
|
|
21
20
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* const flowProps = useBloodlineFlowProps();
|
|
26
|
-
* const nodes = useBloodlineFlowProps(state => state.nodes);
|
|
27
|
-
*/
|
|
28
|
-
export declare function useBloodlineFlowProps(): BloodlineFlowProps;
|
|
29
|
-
export declare function useBloodlineFlowProps<U>(selector: (state: BloodlineFlowProps) => U): U;
|
|
30
|
-
/**
|
|
31
|
-
* 获取原始输入 props 的 getter(非响应式)
|
|
32
|
-
*/
|
|
33
|
-
export declare const useGetBloodlineInputProps: () => {
|
|
34
|
-
(): IBloodlineFlowProps;
|
|
35
|
-
<U>(selector: (state: IBloodlineFlowProps) => U): U;
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* 获取转换后 Flow props 的 getter(非响应式)
|
|
21
|
+
* 获取 Flow props 的 getter(非响应式)
|
|
39
22
|
*/
|
|
40
|
-
export declare const
|
|
23
|
+
export declare const useGetBloodlineProps: () => {
|
|
41
24
|
(): BloodlineFlowProps;
|
|
42
25
|
<U>(selector: (state: BloodlineFlowProps) => U): U;
|
|
43
26
|
};
|
|
44
27
|
/**
|
|
45
28
|
* 获取 root 节点数据
|
|
46
29
|
*/
|
|
47
|
-
export declare const useRoot: () => BaseBloodNode | undefined;
|
|
30
|
+
export declare const useRoot: () => import("../types").BaseBloodNode | undefined;
|
|
48
31
|
/**
|
|
49
32
|
* 获取异步加载关联节点的函数
|
|
50
33
|
*/
|
|
51
|
-
export declare const useGetRelation: () => ((direction: BloodlineDirection, source: BaseBloodNode) => Promise<Omit<ConnectorState, "state">>) | undefined;
|
|
34
|
+
export declare const useGetRelation: () => ((direction: import("..").BloodlineDirection, source: import("../types").BaseBloodNode) => Promise<Omit<import("../types").ConnectorState, "state">>) | undefined;
|
|
52
35
|
/**
|
|
53
36
|
* 获取 Bloodline 主题配置
|
|
54
37
|
*/
|
|
55
|
-
export declare const useBloodlineTheme: () => import("../types").IBloodlineTheme | undefined;
|
|
38
|
+
export declare const useBloodlineTheme: () => (import("@rxflow/base").BaseThemeConfig & import("../types").IBloodlineTheme) | undefined;
|
|
56
39
|
/**
|
|
57
40
|
* 获取连线类型
|
|
58
41
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBloodlineProps.d.ts","sourceRoot":"","sources":["useBloodlineProps.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,
|
|
1
|
+
{"version":3,"file":"useBloodlineProps.d.ts","sourceRoot":"","sources":["useBloodlineProps.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAiC,cAAc,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAuB,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAErE,KAAK,kBAAkB,GAAG,cAAc,GAAG,oBAAoB,CAAC;AAEhE;;;;;;GAMG;AACH,wBAAgB,iBAAiB,IAAI,kBAAkB,CAAC;AACxD,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,CAAC,GAAG,CAAC,CAAC;AAKpF;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;CAEhC,CAAC;AAGF;;GAEG;AACH,eAAO,MAAM,OAAO,oDAA+C,CAAC;AAEpE;;GAEG;AACH,eAAO,MAAM,cAAc,yKAAsD,CAAC;AAElF;;GAEG;AACH,eAAO,MAAM,iBAAiB,iGAAgD,CAAC;AAE/E;;GAEG;AACH,eAAO,MAAM,WAAW,0BAAmD,CAAC"}
|
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
exports.
|
|
8
|
-
exports.useRoot = exports.useGetRelation = exports.useGetBloodlineInputProps = exports.useGetBloodlineFlowProps = exports.useEdgeType = exports.useBloodlineTheme = void 0;
|
|
6
|
+
exports.useBloodlineProps = useBloodlineProps;
|
|
7
|
+
exports.useRoot = exports.useGetRelation = exports.useGetBloodlineProps = exports.useEdgeType = exports.useBloodlineTheme = void 0;
|
|
9
8
|
var _base = require("@rxflow/base");
|
|
10
9
|
/**
|
|
11
10
|
* @author: yanxianliang
|
|
@@ -16,41 +15,21 @@ var _base = require("@rxflow/base");
|
|
|
16
15
|
*/
|
|
17
16
|
|
|
18
17
|
/**
|
|
19
|
-
*
|
|
18
|
+
* 获取 Flow props
|
|
20
19
|
*
|
|
21
20
|
* @example
|
|
22
|
-
* const
|
|
23
|
-
* const root =
|
|
21
|
+
* const props = useBloodlineProps();
|
|
22
|
+
* const root = useBloodlineProps(state => state.root);
|
|
24
23
|
*/
|
|
25
24
|
|
|
26
|
-
function
|
|
27
|
-
return (0, _base.useInputProps)(selector);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* 获取转换后的 Flow props
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* const flowProps = useBloodlineFlowProps();
|
|
35
|
-
* const nodes = useBloodlineFlowProps(state => state.nodes);
|
|
36
|
-
*/
|
|
37
|
-
|
|
38
|
-
function useBloodlineFlowProps(selector) {
|
|
25
|
+
function useBloodlineProps(selector) {
|
|
39
26
|
return (0, _base.useFlowProps)(selector);
|
|
40
27
|
}
|
|
41
28
|
|
|
42
29
|
/**
|
|
43
|
-
*
|
|
44
|
-
*/
|
|
45
|
-
const useGetBloodlineInputProps = () => {
|
|
46
|
-
return (0, _base.useGetInputProps)();
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* 获取转换后 Flow props 的 getter(非响应式)
|
|
30
|
+
* 获取 Flow props 的 getter(非响应式)
|
|
51
31
|
*/
|
|
52
|
-
|
|
53
|
-
const useGetBloodlineFlowProps = () => {
|
|
32
|
+
const useGetBloodlineProps = () => {
|
|
54
33
|
return (0, _base.useGetFlowProps)();
|
|
55
34
|
};
|
|
56
35
|
|
|
@@ -58,24 +37,24 @@ const useGetBloodlineFlowProps = () => {
|
|
|
58
37
|
/**
|
|
59
38
|
* 获取 root 节点数据
|
|
60
39
|
*/
|
|
61
|
-
exports.
|
|
62
|
-
const useRoot = () =>
|
|
40
|
+
exports.useGetBloodlineProps = useGetBloodlineProps;
|
|
41
|
+
const useRoot = () => useBloodlineProps(state => state.root);
|
|
63
42
|
|
|
64
43
|
/**
|
|
65
44
|
* 获取异步加载关联节点的函数
|
|
66
45
|
*/
|
|
67
46
|
exports.useRoot = useRoot;
|
|
68
|
-
const useGetRelation = () =>
|
|
47
|
+
const useGetRelation = () => useBloodlineProps(state => state.getRelation);
|
|
69
48
|
|
|
70
49
|
/**
|
|
71
50
|
* 获取 Bloodline 主题配置
|
|
72
51
|
*/
|
|
73
52
|
exports.useGetRelation = useGetRelation;
|
|
74
|
-
const useBloodlineTheme = () =>
|
|
53
|
+
const useBloodlineTheme = () => useBloodlineProps(state => state.theme);
|
|
75
54
|
|
|
76
55
|
/**
|
|
77
56
|
* 获取连线类型
|
|
78
57
|
*/
|
|
79
58
|
exports.useBloodlineTheme = useBloodlineTheme;
|
|
80
|
-
const useEdgeType = () =>
|
|
59
|
+
const useEdgeType = () => useBloodlineProps(state => state.edgeType);
|
|
81
60
|
exports.useEdgeType = useEdgeType;
|
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;AA+CpE,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
|
@@ -68,8 +68,7 @@ const useBloodlinePropsTransform = props => {
|
|
|
68
68
|
const {
|
|
69
69
|
root,
|
|
70
70
|
nodeTypes,
|
|
71
|
-
fitViewOptions: userFitViewOptions
|
|
72
|
-
flowProps: userFlowProps
|
|
71
|
+
fitViewOptions: userFitViewOptions
|
|
73
72
|
} = props;
|
|
74
73
|
|
|
75
74
|
// 将 root 转换为 nodes
|
|
@@ -91,12 +90,6 @@ const useBloodlinePropsTransform = props => {
|
|
|
91
90
|
...defaultFitViewOptions,
|
|
92
91
|
...userFitViewOptions
|
|
93
92
|
}), [userFitViewOptions]);
|
|
94
|
-
|
|
95
|
-
// 合并 flowProps(不常用的配置)
|
|
96
|
-
const flowProps = (0, _react.useMemo)(() => ({
|
|
97
|
-
edgesFocusable: false,
|
|
98
|
-
...userFlowProps
|
|
99
|
-
}), [userFlowProps]);
|
|
100
93
|
return {
|
|
101
94
|
...props,
|
|
102
95
|
autoCenter: true,
|
|
@@ -108,8 +101,8 @@ const useBloodlinePropsTransform = props => {
|
|
|
108
101
|
selectionOnDrag: false,
|
|
109
102
|
minZoom: 1,
|
|
110
103
|
maxZoom: 1,
|
|
111
|
-
|
|
112
|
-
|
|
104
|
+
edgesFocusable: false,
|
|
105
|
+
fitViewOptions
|
|
113
106
|
};
|
|
114
107
|
};
|
|
115
108
|
const BloodlineFlow = (0, _base.createFlow)(_base.Flow, useBloodlinePropsTransform);
|
|
@@ -17,7 +17,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
17
17
|
*
|
|
18
18
|
* Copyright (c) 2025 by yanxianliang, All Rights Reserved.
|
|
19
19
|
*/
|
|
20
|
-
import { CollapseButton, HiddenHandle, useForceUpdate,
|
|
20
|
+
import { CollapseButton, HiddenHandle, useForceUpdate, useGetFlowProps } from "@rxflow/base";
|
|
21
21
|
import { Position } from "@xyflow/react";
|
|
22
22
|
import { useMemoizedFn, useUpdate } from "ahooks";
|
|
23
23
|
import React, { useMemo } from "react";
|
|
@@ -87,7 +87,7 @@ export var Connector = function Connector(_ref2) {
|
|
|
87
87
|
disabled = _ref2$disabled === void 0 ? false : _ref2$disabled;
|
|
88
88
|
var update = useUpdate();
|
|
89
89
|
var triggerLayout = useForceUpdate();
|
|
90
|
-
var
|
|
90
|
+
var getProps = useGetFlowProps();
|
|
91
91
|
var config = source[direction];
|
|
92
92
|
var connectorState = useMemo(function () {
|
|
93
93
|
return getStateWithDefault(config);
|
|
@@ -101,8 +101,8 @@ export var Connector = function Connector(_ref2) {
|
|
|
101
101
|
var onClick = useMemoizedFn(function () {
|
|
102
102
|
var state = connectorState.state,
|
|
103
103
|
list = connectorState.list;
|
|
104
|
-
var
|
|
105
|
-
getRelation =
|
|
104
|
+
var _getProps = getProps(),
|
|
105
|
+
getRelation = _getProps.getRelation;
|
|
106
106
|
if (state === 'loading') {
|
|
107
107
|
return;
|
|
108
108
|
}
|
|
@@ -6,53 +6,36 @@
|
|
|
6
6
|
* Copyright (c) 2025 by yanxianliang, All Rights Reserved.
|
|
7
7
|
*/
|
|
8
8
|
import { IBaseFlowProps } from '@rxflow/base';
|
|
9
|
-
import {
|
|
10
|
-
import { BloodlineDirection } from '../constants';
|
|
9
|
+
import { BloodlineExtendProps } from '../types';
|
|
11
10
|
type BloodlineFlowProps = IBaseFlowProps & BloodlineExtendProps;
|
|
12
11
|
/**
|
|
13
|
-
*
|
|
12
|
+
* 获取 Flow props
|
|
14
13
|
*
|
|
15
14
|
* @example
|
|
16
|
-
* const
|
|
17
|
-
* const root =
|
|
15
|
+
* const props = useBloodlineProps();
|
|
16
|
+
* const root = useBloodlineProps(state => state.root);
|
|
18
17
|
*/
|
|
19
|
-
export declare function
|
|
20
|
-
export declare function
|
|
18
|
+
export declare function useBloodlineProps(): BloodlineFlowProps;
|
|
19
|
+
export declare function useBloodlineProps<U>(selector: (state: BloodlineFlowProps) => U): U;
|
|
21
20
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* const flowProps = useBloodlineFlowProps();
|
|
26
|
-
* const nodes = useBloodlineFlowProps(state => state.nodes);
|
|
27
|
-
*/
|
|
28
|
-
export declare function useBloodlineFlowProps(): BloodlineFlowProps;
|
|
29
|
-
export declare function useBloodlineFlowProps<U>(selector: (state: BloodlineFlowProps) => U): U;
|
|
30
|
-
/**
|
|
31
|
-
* 获取原始输入 props 的 getter(非响应式)
|
|
32
|
-
*/
|
|
33
|
-
export declare const useGetBloodlineInputProps: () => {
|
|
34
|
-
(): IBloodlineFlowProps;
|
|
35
|
-
<U>(selector: (state: IBloodlineFlowProps) => U): U;
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* 获取转换后 Flow props 的 getter(非响应式)
|
|
21
|
+
* 获取 Flow props 的 getter(非响应式)
|
|
39
22
|
*/
|
|
40
|
-
export declare const
|
|
23
|
+
export declare const useGetBloodlineProps: () => {
|
|
41
24
|
(): BloodlineFlowProps;
|
|
42
25
|
<U>(selector: (state: BloodlineFlowProps) => U): U;
|
|
43
26
|
};
|
|
44
27
|
/**
|
|
45
28
|
* 获取 root 节点数据
|
|
46
29
|
*/
|
|
47
|
-
export declare const useRoot: () => BaseBloodNode | undefined;
|
|
30
|
+
export declare const useRoot: () => import("../types").BaseBloodNode | undefined;
|
|
48
31
|
/**
|
|
49
32
|
* 获取异步加载关联节点的函数
|
|
50
33
|
*/
|
|
51
|
-
export declare const useGetRelation: () => ((direction: BloodlineDirection, source: BaseBloodNode) => Promise<Omit<ConnectorState, "state">>) | undefined;
|
|
34
|
+
export declare const useGetRelation: () => ((direction: import("..").BloodlineDirection, source: import("../types").BaseBloodNode) => Promise<Omit<import("../types").ConnectorState, "state">>) | undefined;
|
|
52
35
|
/**
|
|
53
36
|
* 获取 Bloodline 主题配置
|
|
54
37
|
*/
|
|
55
|
-
export declare const useBloodlineTheme: () => import("../types").IBloodlineTheme | undefined;
|
|
38
|
+
export declare const useBloodlineTheme: () => (import("@rxflow/base").BaseThemeConfig & import("../types").IBloodlineTheme) | undefined;
|
|
56
39
|
/**
|
|
57
40
|
* 获取连线类型
|
|
58
41
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBloodlineProps.d.ts","sourceRoot":"","sources":["useBloodlineProps.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,
|
|
1
|
+
{"version":3,"file":"useBloodlineProps.d.ts","sourceRoot":"","sources":["useBloodlineProps.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAiC,cAAc,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAuB,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAErE,KAAK,kBAAkB,GAAG,cAAc,GAAG,oBAAoB,CAAC;AAEhE;;;;;;GAMG;AACH,wBAAgB,iBAAiB,IAAI,kBAAkB,CAAC;AACxD,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,CAAC,GAAG,CAAC,CAAC;AAKpF;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;CAEhC,CAAC;AAGF;;GAEG;AACH,eAAO,MAAM,OAAO,oDAA+C,CAAC;AAEpE;;GAEG;AACH,eAAO,MAAM,cAAc,yKAAsD,CAAC;AAElF;;GAEG;AACH,eAAO,MAAM,iBAAiB,iGAAgD,CAAC;AAE/E;;GAEG;AACH,eAAO,MAAM,WAAW,0BAAmD,CAAC"}
|
|
@@ -5,43 +5,24 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Copyright (c) 2025 by yanxianliang, All Rights Reserved.
|
|
7
7
|
*/
|
|
8
|
-
import {
|
|
8
|
+
import { useFlowProps, useGetFlowProps } from '@rxflow/base';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* 获取 Flow props
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
|
-
* const
|
|
15
|
-
* const root =
|
|
14
|
+
* const props = useBloodlineProps();
|
|
15
|
+
* const root = useBloodlineProps(state => state.root);
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
export function
|
|
19
|
-
return useInputProps(selector);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* 获取转换后的 Flow props
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* const flowProps = useBloodlineFlowProps();
|
|
27
|
-
* const nodes = useBloodlineFlowProps(state => state.nodes);
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
export function useBloodlineFlowProps(selector) {
|
|
18
|
+
export function useBloodlineProps(selector) {
|
|
31
19
|
return useFlowProps(selector);
|
|
32
20
|
}
|
|
33
21
|
|
|
34
22
|
/**
|
|
35
|
-
*
|
|
36
|
-
*/
|
|
37
|
-
export var useGetBloodlineInputProps = function useGetBloodlineInputProps() {
|
|
38
|
-
return useGetInputProps();
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* 获取转换后 Flow props 的 getter(非响应式)
|
|
23
|
+
* 获取 Flow props 的 getter(非响应式)
|
|
43
24
|
*/
|
|
44
|
-
export var
|
|
25
|
+
export var useGetBloodlineProps = function useGetBloodlineProps() {
|
|
45
26
|
return useGetFlowProps();
|
|
46
27
|
};
|
|
47
28
|
|
|
@@ -50,7 +31,7 @@ export var useGetBloodlineFlowProps = function useGetBloodlineFlowProps() {
|
|
|
50
31
|
* 获取 root 节点数据
|
|
51
32
|
*/
|
|
52
33
|
export var useRoot = function useRoot() {
|
|
53
|
-
return
|
|
34
|
+
return useBloodlineProps(function (state) {
|
|
54
35
|
return state.root;
|
|
55
36
|
});
|
|
56
37
|
};
|
|
@@ -59,7 +40,7 @@ export var useRoot = function useRoot() {
|
|
|
59
40
|
* 获取异步加载关联节点的函数
|
|
60
41
|
*/
|
|
61
42
|
export var useGetRelation = function useGetRelation() {
|
|
62
|
-
return
|
|
43
|
+
return useBloodlineProps(function (state) {
|
|
63
44
|
return state.getRelation;
|
|
64
45
|
});
|
|
65
46
|
};
|
|
@@ -68,7 +49,7 @@ export var useGetRelation = function useGetRelation() {
|
|
|
68
49
|
* 获取 Bloodline 主题配置
|
|
69
50
|
*/
|
|
70
51
|
export var useBloodlineTheme = function useBloodlineTheme() {
|
|
71
|
-
return
|
|
52
|
+
return useBloodlineProps(function (state) {
|
|
72
53
|
return state.theme;
|
|
73
54
|
});
|
|
74
55
|
};
|
|
@@ -77,7 +58,7 @@ export var useBloodlineTheme = function useBloodlineTheme() {
|
|
|
77
58
|
* 获取连线类型
|
|
78
59
|
*/
|
|
79
60
|
export var useEdgeType = function useEdgeType() {
|
|
80
|
-
return
|
|
61
|
+
return useBloodlineProps(function (state) {
|
|
81
62
|
return state.edgeType;
|
|
82
63
|
});
|
|
83
64
|
};
|
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;AA+CpE,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
|
@@ -30,8 +30,7 @@ var defaultFitViewOptions = {
|
|
|
30
30
|
var useBloodlinePropsTransform = function useBloodlinePropsTransform(props) {
|
|
31
31
|
var root = props.root,
|
|
32
32
|
nodeTypes = props.nodeTypes,
|
|
33
|
-
userFitViewOptions = props.fitViewOptions
|
|
34
|
-
userFlowProps = props.flowProps;
|
|
33
|
+
userFitViewOptions = props.fitViewOptions;
|
|
35
34
|
|
|
36
35
|
// 将 root 转换为 nodes
|
|
37
36
|
var nodes = useMemo(function () {
|
|
@@ -52,13 +51,6 @@ var useBloodlinePropsTransform = function useBloodlinePropsTransform(props) {
|
|
|
52
51
|
var fitViewOptions = useMemo(function () {
|
|
53
52
|
return _objectSpread(_objectSpread({}, defaultFitViewOptions), userFitViewOptions);
|
|
54
53
|
}, [userFitViewOptions]);
|
|
55
|
-
|
|
56
|
-
// 合并 flowProps(不常用的配置)
|
|
57
|
-
var flowProps = useMemo(function () {
|
|
58
|
-
return _objectSpread({
|
|
59
|
-
edgesFocusable: false
|
|
60
|
-
}, userFlowProps);
|
|
61
|
-
}, [userFlowProps]);
|
|
62
54
|
return _objectSpread(_objectSpread({}, props), {}, {
|
|
63
55
|
autoCenter: true,
|
|
64
56
|
nodes: nodes,
|
|
@@ -69,8 +61,8 @@ var useBloodlinePropsTransform = function useBloodlinePropsTransform(props) {
|
|
|
69
61
|
selectionOnDrag: false,
|
|
70
62
|
minZoom: 1,
|
|
71
63
|
maxZoom: 1,
|
|
72
|
-
|
|
73
|
-
|
|
64
|
+
edgesFocusable: false,
|
|
65
|
+
fitViewOptions: fitViewOptions
|
|
74
66
|
});
|
|
75
67
|
};
|
|
76
68
|
var BloodlineFlow = createFlow(Flow, useBloodlinePropsTransform);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rxflow/bloodline",
|
|
3
|
-
"version": "0.0.4-alpha.
|
|
3
|
+
"version": "0.0.4-alpha.7",
|
|
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.7"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@antv/hierarchy": ">=0.6.14",
|