@rxflow/workflow 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.
@@ -12,7 +12,7 @@ var _base = require("@rxflow/base");
12
12
  var _classcat = _interopRequireDefault(require("classcat"));
13
13
  var _react2 = require("react");
14
14
  require("./index.less");
15
- var _useWorkFlow = require("../../hooks/useWorkFlow");
15
+ var _hooks = require("../../hooks");
16
16
  var _events = require("../../utils/events");
17
17
  var _NodePopover = require("./NodePopover");
18
18
  var _ExclamationOutlined = _interopRequireDefault(require("@ant-design/icons/lib/icons/ExclamationOutlined"));
@@ -58,7 +58,7 @@ const Handle = props => {
58
58
  const {
59
59
  getNode,
60
60
  connect
61
- } = (0, _useWorkFlow.useWorkFlow)();
61
+ } = (0, _hooks.useWorkFlow)();
62
62
  const {
63
63
  getState
64
64
  } = (0, _react.useStoreApi)();
@@ -1 +1 @@
1
- {"version":3,"file":"useWorkFlow.d.ts","sourceRoot":"","sources":["useWorkFlow.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,UAAU,EACV,KAAK,IAAI,EACT,KAAK,IAAI,EACT,iBAAiB,EAGlB,MAAM,eAAe,CAAC;AAIvB;;GAEG;AACH,eAAO,MAAM,WAAW;;;0BAIA,UAAU,KAAK,IAAI;2BAClB,MAAM,iBAAiB,OAAO,KAAK,QAAQ,EAAE;0BAC9C,MAAM,KAAK,QAAQ,EAAE;CA4F5C,CAAA"}
1
+ {"version":3,"file":"useWorkFlow.d.ts","sourceRoot":"","sources":["useWorkFlow.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,UAAU,EACV,KAAK,IAAI,EACT,KAAK,IAAI,EACT,iBAAiB,EAGlB,MAAM,eAAe,CAAC;AAIvB;;GAEG;AACH,eAAO,MAAM,WAAW;;;0BAIA,UAAU,KAAK,IAAI;2BAClB,MAAM,iBAAiB,OAAO,KAAK,QAAQ,EAAE;0BAC9C,MAAM,KAAK,QAAQ,EAAE;CA2F5C,CAAA"}
@@ -35,9 +35,8 @@ const useWorkFlow = () => {
35
35
  * @param connection
36
36
  */
37
37
  const connect = connection => {
38
- const flowProps = getFlowProps(state => state.flowProps);
39
- const onConnect = flowProps?.onConnect;
40
- onConnect?.(connection); // 直接回调内置的onConnect 逻辑
38
+ const props = getFlowProps();
39
+ props?.onConnect?.(connection); // 直接回调内置的onConnect 逻辑
41
40
  };
42
41
  const getChildren = (nodeId, allowSubFlow = true) => {
43
42
  if (!nodeId) {
@@ -40,8 +40,10 @@ export declare const useWorkFlowProps: <NodeType extends WorkflowNode = Workflow
40
40
  onNodeDragStop: (event: import("react").MouseEvent<Element, MouseEvent>, node: NodeType, nodes: NodeType[]) => void;
41
41
  layout: LayoutFunction;
42
42
  flowProps: import("@rxflow/base").FlowProps<NodeType, Edge> | undefined;
43
+ loading?: boolean | undefined;
43
44
  width?: string | number | undefined;
44
45
  height?: string | number | undefined;
46
+ id?: string | undefined;
45
47
  edgeTypes?: import("@xyflow/react").EdgeTypes | undefined;
46
48
  nodes?: NodeType[] | undefined;
47
49
  edges?: EdgeType[] | undefined;
@@ -86,13 +88,13 @@ export declare const useWorkFlowProps: <NodeType extends WorkflowNode = Workflow
86
88
  onMoveStart?: import("@xyflow/react").OnMove | undefined;
87
89
  onMoveEnd?: import("@xyflow/react").OnMove | undefined;
88
90
  onlyRenderVisibleElements?: boolean | undefined;
91
+ edgesFocusable?: boolean | undefined;
89
92
  debug?: boolean | undefined;
90
- loading?: boolean | undefined;
91
93
  readOnly?: boolean | undefined;
92
94
  background?: string | undefined;
93
95
  theme?: import("@rxflow/base").BaseThemeConfig | undefined;
94
96
  showControls?: boolean | undefined;
95
- controlsOrientation?: "horizontal" | "vertical" | undefined;
97
+ controlsOrientation?: "vertical" | "horizontal" | undefined;
96
98
  customControls?: import("react").ReactNode;
97
99
  showMiniMap: boolean;
98
100
  getMiniMapNodeColor?: ((node: import("@xyflow/react").Node) => string) | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"useWorkFlowProps.d.ts","sourceRoot":"","sources":["useWorkFlowProps.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,cAAc,EAAqC,MAAM,cAAc,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAgBrC,eAAO,MAAM,gBAAgB,sFAGpB,eAAe,QAAQ,EAAE,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuG1C,CAAC"}
1
+ {"version":3,"file":"useWorkFlowProps.d.ts","sourceRoot":"","sources":["useWorkFlowProps.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,cAAc,EAAqC,MAAM,cAAc,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAgBrC,eAAO,MAAM,gBAAgB,sFAGpB,eAAe,QAAQ,EAAE,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuG1C,CAAC"}
@@ -7,40 +7,24 @@
7
7
  * Copyright (c) 2025 by yanxianliang, All Rights Reserved.
8
8
  */
9
9
  import { IBaseFlowProps } from '@rxflow/base';
10
- import { IWorkflowProps, WorkflowExtendProps, WorkflowNode } from '../types';
10
+ import { WorkflowExtendProps, WorkflowNode } from '../types';
11
11
  import { Edge } from '@xyflow/react';
12
- type WorkflowFullFlowProps<NodeType extends WorkflowNode = WorkflowNode, EdgeType extends Edge = Edge> = IBaseFlowProps<NodeType, EdgeType> & WorkflowExtendProps<NodeType>;
12
+ type WorkflowFullProps<NodeType extends WorkflowNode = WorkflowNode, EdgeType extends Edge = Edge> = IBaseFlowProps<NodeType, EdgeType> & WorkflowExtendProps<NodeType>;
13
13
  /**
14
- * 获取原始输入 props
14
+ * 获取 Flow props
15
15
  *
16
16
  * @example
17
- * const inputProps = useWorkflowInputProps();
18
- * const nodeTypes = useWorkflowInputProps(state => state.nodeTypes);
17
+ * const props = useWorkflowProps();
18
+ * const nodes = useWorkflowProps(state => state.nodes);
19
19
  */
20
- export declare function useWorkflowInputProps<NodeType extends WorkflowNode = WorkflowNode, EdgeType extends Edge = Edge>(): IWorkflowProps<NodeType, EdgeType>;
21
- export declare function useWorkflowInputProps<NodeType extends WorkflowNode = WorkflowNode, EdgeType extends Edge = Edge, U = unknown>(selector: (state: IWorkflowProps<NodeType, EdgeType>) => U): U;
20
+ export declare function useWorkflowProps<NodeType extends WorkflowNode = WorkflowNode, EdgeType extends Edge = Edge>(): WorkflowFullProps<NodeType, EdgeType>;
21
+ export declare function useWorkflowProps<NodeType extends WorkflowNode = WorkflowNode, EdgeType extends Edge = Edge, U = unknown>(selector: (state: WorkflowFullProps<NodeType, EdgeType>) => U): U;
22
22
  /**
23
- * 获取转换后的 Flow props
24
- *
25
- * @example
26
- * const flowProps = useWorkflowFlowProps();
27
- * const nodes = useWorkflowFlowProps(state => state.nodes);
28
- */
29
- export declare function useWorkflowFlowProps<NodeType extends WorkflowNode = WorkflowNode, EdgeType extends Edge = Edge>(): WorkflowFullFlowProps<NodeType, EdgeType>;
30
- export declare function useWorkflowFlowProps<NodeType extends WorkflowNode = WorkflowNode, EdgeType extends Edge = Edge, U = unknown>(selector: (state: WorkflowFullFlowProps<NodeType, EdgeType>) => U): U;
31
- /**
32
- * 获取原始输入 props 的 getter(非响应式)
33
- */
34
- export declare const useGetWorkflowInputProps: <NodeType extends WorkflowNode = WorkflowNode, EdgeType extends Edge = Edge>() => {
35
- (): IWorkflowProps<NodeType, EdgeType>;
36
- <U>(selector: (state: IWorkflowProps<NodeType, EdgeType>) => U): U;
37
- };
38
- /**
39
- * 获取转换后 Flow props 的 getter(非响应式)
23
+ * 获取 Flow props 的 getter(非响应式)
40
24
  */
41
- export declare const useGetWorkflowFlowProps: <NodeType extends WorkflowNode = WorkflowNode, EdgeType extends Edge = Edge>() => {
42
- (): WorkflowFullFlowProps<NodeType, EdgeType>;
43
- <U>(selector: (state: WorkflowFullFlowProps<NodeType, EdgeType>) => U): U;
25
+ export declare const useGetWorkflowProps: <NodeType extends WorkflowNode = WorkflowNode, EdgeType extends Edge = Edge>() => {
26
+ (): WorkflowFullProps<NodeType, EdgeType>;
27
+ <U>(selector: (state: WorkflowFullProps<NodeType, EdgeType>) => U): U;
44
28
  };
45
29
  /**
46
30
  * 获取连接限制配置
@@ -59,9 +43,6 @@ export declare const useQuickAdd: () => boolean | undefined;
59
43
  */
60
44
  export declare const useOnNodeTypeDrop: () => ((parentFlow: import("@xyflow/react").InternalNode<WorkflowNode> | undefined, positionInParent: import("@xyflow/react").XYPosition, nodeType: string) => Promise<{
61
45
  id: string;
62
- /**
63
- * 获取节点类型拖放回调
64
- */
65
46
  connectSourceHandle: string;
66
47
  connectTargetHandle: string;
67
48
  } | undefined>) | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"useWorkflowPropsHooks.d.ts","sourceRoot":"","sources":["useWorkflowPropsHooks.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;AACH,OAAO,EAAkE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9G,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC,KAAK,qBAAqB,CACxB,QAAQ,SAAS,YAAY,GAAG,YAAY,EAC5C,QAAQ,SAAS,IAAI,GAAG,IAAI,IAC1B,cAA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H,eAAO,MAAM,iBAAiB,uIAAwD,CAAC;AAEvF;;GAEG;AACH,eAAO,MAAM,oBAAoB,4DAA2D,CAAC;AAE7F;;GAEG;AACH,eAAO,MAAM,mBAAmB,2BAAkD,CAAC;AAEnF;;GAEG;AACH,eAAO,MAAM,kBAAkB,2BAAiD,CAAC"}
@@ -3,10 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.useSelectionStrategy = exports.useRenderNodeIcon = exports.useQuickAdd = exports.useOnNodeTypeDrop = exports.useGetWorkflowInputProps = exports.useGetWorkflowFlowProps = exports.useConnectionLimit = void 0;
7
- exports.useWorkflowFlowProps = useWorkflowFlowProps;
8
- exports.useWorkflowInputProps = useWorkflowInputProps;
9
- exports.useWorkflowReadOnly = exports.useWorkflowLoading = void 0;
6
+ exports.useWorkflowLoading = exports.useSelectionStrategy = exports.useRenderNodeIcon = exports.useQuickAdd = exports.useOnNodeTypeDrop = exports.useGetWorkflowProps = exports.useConnectionLimit = void 0;
7
+ exports.useWorkflowProps = useWorkflowProps;
8
+ exports.useWorkflowReadOnly = void 0;
10
9
  var _base = require("@rxflow/base");
11
10
  /**
12
11
  * @author: yanxianliang
@@ -17,41 +16,21 @@ var _base = require("@rxflow/base");
17
16
  */
18
17
 
19
18
  /**
20
- * 获取原始输入 props
19
+ * 获取 Flow props
21
20
  *
22
21
  * @example
23
- * const inputProps = useWorkflowInputProps();
24
- * const nodeTypes = useWorkflowInputProps(state => state.nodeTypes);
22
+ * const props = useWorkflowProps();
23
+ * const nodes = useWorkflowProps(state => state.nodes);
25
24
  */
26
25
 
27
- function useWorkflowInputProps(selector) {
28
- return (0, _base.useInputProps)(selector);
29
- }
30
-
31
- /**
32
- * 获取转换后的 Flow props
33
- *
34
- * @example
35
- * const flowProps = useWorkflowFlowProps();
36
- * const nodes = useWorkflowFlowProps(state => state.nodes);
37
- */
38
-
39
- function useWorkflowFlowProps(selector) {
26
+ function useWorkflowProps(selector) {
40
27
  return (0, _base.useFlowProps)(selector);
41
28
  }
42
29
 
43
30
  /**
44
- * 获取原始输入 props 的 getter(非响应式)
45
- */
46
- const useGetWorkflowInputProps = () => {
47
- return (0, _base.useGetInputProps)();
48
- };
49
-
50
- /**
51
- * 获取转换后 Flow props 的 getter(非响应式)
31
+ * 获取 Flow props 的 getter(非响应式)
52
32
  */
53
- exports.useGetWorkflowInputProps = useGetWorkflowInputProps;
54
- const useGetWorkflowFlowProps = () => {
33
+ const useGetWorkflowProps = () => {
55
34
  return (0, _base.useGetFlowProps)();
56
35
  };
57
36
 
@@ -59,42 +38,42 @@ const useGetWorkflowFlowProps = () => {
59
38
  /**
60
39
  * 获取连接限制配置
61
40
  */
62
- exports.useGetWorkflowFlowProps = useGetWorkflowFlowProps;
63
- const useConnectionLimit = () => useWorkflowInputProps(state => state.connectionLimit);
41
+ exports.useGetWorkflowProps = useGetWorkflowProps;
42
+ const useConnectionLimit = () => useWorkflowProps(state => state.connectionLimit);
64
43
 
65
44
  /**
66
45
  * 获取是否启用快速添加
67
46
  */
68
47
  exports.useConnectionLimit = useConnectionLimit;
69
- const useQuickAdd = () => useWorkflowInputProps(state => state.quickAdd);
48
+ const useQuickAdd = () => useWorkflowProps(state => state.quickAdd);
70
49
 
71
50
  /**
72
51
  * 获取节点类型拖放回调
73
52
  */
74
53
  exports.useQuickAdd = useQuickAdd;
75
- const useOnNodeTypeDrop = () => useWorkflowInputProps(state => state.onNodeTypeDrop);
54
+ const useOnNodeTypeDrop = () => useWorkflowProps(state => state.onNodeTypeDrop);
76
55
 
77
56
  /**
78
57
  * 获取渲染节点图标函数
79
58
  */
80
59
  exports.useOnNodeTypeDrop = useOnNodeTypeDrop;
81
- const useRenderNodeIcon = () => useWorkflowInputProps(state => state.renderNodeIcon);
60
+ const useRenderNodeIcon = () => useWorkflowProps(state => state.renderNodeIcon);
82
61
 
83
62
  /**
84
63
  * 获取选择策略
85
64
  */
86
65
  exports.useRenderNodeIcon = useRenderNodeIcon;
87
- const useSelectionStrategy = () => useWorkflowInputProps(state => state.selectionStrategy);
66
+ const useSelectionStrategy = () => useWorkflowProps(state => state.selectionStrategy);
88
67
 
89
68
  /**
90
69
  * 获取是否只读
91
70
  */
92
71
  exports.useSelectionStrategy = useSelectionStrategy;
93
- const useWorkflowReadOnly = () => useWorkflowInputProps(state => state.readOnly);
72
+ const useWorkflowReadOnly = () => useWorkflowProps(state => state.readOnly);
94
73
 
95
74
  /**
96
75
  * 获取加载状态
97
76
  */
98
77
  exports.useWorkflowReadOnly = useWorkflowReadOnly;
99
- const useWorkflowLoading = () => useWorkflowInputProps(state => state.loading);
78
+ const useWorkflowLoading = () => useWorkflowProps(state => state.loading);
100
79
  exports.useWorkflowLoading = useWorkflowLoading;
@@ -30,7 +30,7 @@ import { Popover, Tooltip, getNodeWidth, useFlowProps, useNodeTypeMap } from '@r
30
30
  import cat from 'classcat';
31
31
  import { useState } from 'react';
32
32
  import "./index.less";
33
- import { useWorkFlow } from "../../hooks/useWorkFlow";
33
+ import { useWorkFlow } from "../../hooks";
34
34
  import { stopPropagation } from "../../utils/events";
35
35
  import { NodePopover } from "./NodePopover";
36
36
  import ExclamationOutlined from "@ant-design/icons/lib/icons/ExclamationOutlined";
@@ -1 +1 @@
1
- {"version":3,"file":"useWorkFlow.d.ts","sourceRoot":"","sources":["useWorkFlow.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,UAAU,EACV,KAAK,IAAI,EACT,KAAK,IAAI,EACT,iBAAiB,EAGlB,MAAM,eAAe,CAAC;AAIvB;;GAEG;AACH,eAAO,MAAM,WAAW;;;0BAIA,UAAU,KAAK,IAAI;2BAClB,MAAM,iBAAiB,OAAO,KAAK,QAAQ,EAAE;0BAC9C,MAAM,KAAK,QAAQ,EAAE;CA4F5C,CAAA"}
1
+ {"version":3,"file":"useWorkFlow.d.ts","sourceRoot":"","sources":["useWorkFlow.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,UAAU,EACV,KAAK,IAAI,EACT,KAAK,IAAI,EACT,iBAAiB,EAGlB,MAAM,eAAe,CAAC;AAIvB;;GAEG;AACH,eAAO,MAAM,WAAW;;;0BAIA,UAAU,KAAK,IAAI;2BAClB,MAAM,iBAAiB,OAAO,KAAK,QAAQ,EAAE;0BAC9C,MAAM,KAAK,QAAQ,EAAE;CA2F5C,CAAA"}
@@ -35,11 +35,9 @@ export var useWorkFlow = function useWorkFlow() {
35
35
  * @param connection
36
36
  */
37
37
  var connect = function connect(connection) {
38
- var flowProps = getFlowProps(function (state) {
39
- return state.flowProps;
40
- });
41
- var onConnect = flowProps === null || flowProps === void 0 ? void 0 : flowProps.onConnect;
42
- onConnect === null || onConnect === void 0 || onConnect(connection); // 直接回调内置的onConnect 逻辑
38
+ var _props$onConnect;
39
+ var props = getFlowProps();
40
+ props === null || props === void 0 || (_props$onConnect = props.onConnect) === null || _props$onConnect === void 0 || _props$onConnect.call(props, connection); // 直接回调内置的onConnect 逻辑
43
41
  };
44
42
  var getChildren = function getChildren(nodeId) {
45
43
  var allowSubFlow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
@@ -42,6 +42,7 @@ export declare const useWorkFlowProps: <NodeType extends WorkflowNode = Workflow
42
42
  flowProps: import("@rxflow/base").FlowProps<NodeType, Edge> | undefined;
43
43
  width?: string | number | undefined;
44
44
  height?: string | number | undefined;
45
+ id?: string | undefined;
45
46
  edgeTypes?: import("@xyflow/react").EdgeTypes | undefined;
46
47
  nodes?: NodeType[] | undefined;
47
48
  edges?: EdgeType[] | undefined;
@@ -86,6 +87,7 @@ export declare const useWorkFlowProps: <NodeType extends WorkflowNode = Workflow
86
87
  onMoveStart?: import("@xyflow/react").OnMove | undefined;
87
88
  onMoveEnd?: import("@xyflow/react").OnMove | undefined;
88
89
  onlyRenderVisibleElements?: boolean | undefined;
90
+ edgesFocusable?: boolean | undefined;
89
91
  debug?: boolean | undefined;
90
92
  loading?: boolean | undefined;
91
93
  readOnly?: boolean | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"useWorkFlowProps.d.ts","sourceRoot":"","sources":["useWorkFlowProps.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,cAAc,EAAqC,MAAM,cAAc,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAgBrC,eAAO,MAAM,gBAAgB,sFAGpB,eAAe,QAAQ,EAAE,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuG1C,CAAC"}
1
+ {"version":3,"file":"useWorkFlowProps.d.ts","sourceRoot":"","sources":["useWorkFlowProps.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,cAAc,EAAqC,MAAM,cAAc,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAgBrC,eAAO,MAAM,gBAAgB,sFAGpB,eAAe,QAAQ,EAAE,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuG1C,CAAC"}
@@ -7,40 +7,24 @@
7
7
  * Copyright (c) 2025 by yanxianliang, All Rights Reserved.
8
8
  */
9
9
  import { IBaseFlowProps } from '@rxflow/base';
10
- import { IWorkflowProps, WorkflowExtendProps, WorkflowNode } from '../types';
10
+ import { WorkflowExtendProps, WorkflowNode } from '../types';
11
11
  import { Edge } from '@xyflow/react';
12
- type WorkflowFullFlowProps<NodeType extends WorkflowNode = WorkflowNode, EdgeType extends Edge = Edge> = IBaseFlowProps<NodeType, EdgeType> & WorkflowExtendProps<NodeType>;
12
+ type WorkflowFullProps<NodeType extends WorkflowNode = WorkflowNode, EdgeType extends Edge = Edge> = IBaseFlowProps<NodeType, EdgeType> & WorkflowExtendProps<NodeType>;
13
13
  /**
14
- * 获取原始输入 props
14
+ * 获取 Flow props
15
15
  *
16
16
  * @example
17
- * const inputProps = useWorkflowInputProps();
18
- * const nodeTypes = useWorkflowInputProps(state => state.nodeTypes);
17
+ * const props = useWorkflowProps();
18
+ * const nodes = useWorkflowProps(state => state.nodes);
19
19
  */
20
- export declare function useWorkflowInputProps<NodeType extends WorkflowNode = WorkflowNode, EdgeType extends Edge = Edge>(): IWorkflowProps<NodeType, EdgeType>;
21
- export declare function useWorkflowInputProps<NodeType extends WorkflowNode = WorkflowNode, EdgeType extends Edge = Edge, U = unknown>(selector: (state: IWorkflowProps<NodeType, EdgeType>) => U): U;
20
+ export declare function useWorkflowProps<NodeType extends WorkflowNode = WorkflowNode, EdgeType extends Edge = Edge>(): WorkflowFullProps<NodeType, EdgeType>;
21
+ export declare function useWorkflowProps<NodeType extends WorkflowNode = WorkflowNode, EdgeType extends Edge = Edge, U = unknown>(selector: (state: WorkflowFullProps<NodeType, EdgeType>) => U): U;
22
22
  /**
23
- * 获取转换后的 Flow props
24
- *
25
- * @example
26
- * const flowProps = useWorkflowFlowProps();
27
- * const nodes = useWorkflowFlowProps(state => state.nodes);
28
- */
29
- export declare function useWorkflowFlowProps<NodeType extends WorkflowNode = WorkflowNode, EdgeType extends Edge = Edge>(): WorkflowFullFlowProps<NodeType, EdgeType>;
30
- export declare function useWorkflowFlowProps<NodeType extends WorkflowNode = WorkflowNode, EdgeType extends Edge = Edge, U = unknown>(selector: (state: WorkflowFullFlowProps<NodeType, EdgeType>) => U): U;
31
- /**
32
- * 获取原始输入 props 的 getter(非响应式)
33
- */
34
- export declare const useGetWorkflowInputProps: <NodeType extends WorkflowNode = WorkflowNode, EdgeType extends Edge = Edge>() => {
35
- (): IWorkflowProps<NodeType, EdgeType>;
36
- <U>(selector: (state: IWorkflowProps<NodeType, EdgeType>) => U): U;
37
- };
38
- /**
39
- * 获取转换后 Flow props 的 getter(非响应式)
23
+ * 获取 Flow props 的 getter(非响应式)
40
24
  */
41
- export declare const useGetWorkflowFlowProps: <NodeType extends WorkflowNode = WorkflowNode, EdgeType extends Edge = Edge>() => {
42
- (): WorkflowFullFlowProps<NodeType, EdgeType>;
43
- <U>(selector: (state: WorkflowFullFlowProps<NodeType, EdgeType>) => U): U;
25
+ export declare const useGetWorkflowProps: <NodeType extends WorkflowNode = WorkflowNode, EdgeType extends Edge = Edge>() => {
26
+ (): WorkflowFullProps<NodeType, EdgeType>;
27
+ <U>(selector: (state: WorkflowFullProps<NodeType, EdgeType>) => U): U;
44
28
  };
45
29
  /**
46
30
  * 获取连接限制配置
@@ -59,9 +43,6 @@ export declare const useQuickAdd: () => boolean | undefined;
59
43
  */
60
44
  export declare const useOnNodeTypeDrop: () => ((parentFlow: import("@xyflow/react").InternalNode<WorkflowNode> | undefined, positionInParent: import("@xyflow/react").XYPosition, nodeType: string) => Promise<{
61
45
  id: string;
62
- /**
63
- * 获取节点类型拖放回调
64
- */
65
46
  connectSourceHandle: string;
66
47
  connectTargetHandle: string;
67
48
  } | undefined>) | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"useWorkflowPropsHooks.d.ts","sourceRoot":"","sources":["useWorkflowPropsHooks.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;AACH,OAAO,EAAkE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9G,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC,KAAK,qBAAqB,CACxB,QAAQ,SAAS,YAAY,GAAG,YAAY,EAC5C,QAAQ,SAAS,IAAI,GAAG,IAAI,IAC1B,cAAc,CAAC,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MAAM,iBAAiB,uIAAwD,CAAC;AAEvF;;GAEG;AACH,eAAO,MAAM,oBAAoB,4DAA2D,CAAC;AAE7F;;GAEG;AACH,eAAO,MAAM,mBAAmB,2BAAkD,CAAC;AAEnF;;GAEG;AACH,eAAO,MAAM,kBAAkB,2BAAiD,CAAC"}
@@ -5,43 +5,24 @@
5
5
  *
6
6
  * Copyright (c) 2025 by yanxianliang, All Rights Reserved.
7
7
  */
8
- import { useInputProps, useFlowProps, useGetInputProps, useGetFlowProps } from '@rxflow/base';
8
+ import { useFlowProps, useGetFlowProps } from '@rxflow/base';
9
9
 
10
10
  /**
11
- * 获取原始输入 props
11
+ * 获取 Flow props
12
12
  *
13
13
  * @example
14
- * const inputProps = useWorkflowInputProps();
15
- * const nodeTypes = useWorkflowInputProps(state => state.nodeTypes);
14
+ * const props = useWorkflowProps();
15
+ * const nodes = useWorkflowProps(state => state.nodes);
16
16
  */
17
17
 
18
- export function useWorkflowInputProps(selector) {
19
- return useInputProps(selector);
20
- }
21
-
22
- /**
23
- * 获取转换后的 Flow props
24
- *
25
- * @example
26
- * const flowProps = useWorkflowFlowProps();
27
- * const nodes = useWorkflowFlowProps(state => state.nodes);
28
- */
29
-
30
- export function useWorkflowFlowProps(selector) {
18
+ export function useWorkflowProps(selector) {
31
19
  return useFlowProps(selector);
32
20
  }
33
21
 
34
22
  /**
35
- * 获取原始输入 props 的 getter(非响应式)
36
- */
37
- export var useGetWorkflowInputProps = function useGetWorkflowInputProps() {
38
- return useGetInputProps();
39
- };
40
-
41
- /**
42
- * 获取转换后 Flow props 的 getter(非响应式)
23
+ * 获取 Flow props 的 getter(非响应式)
43
24
  */
44
- export var useGetWorkflowFlowProps = function useGetWorkflowFlowProps() {
25
+ export var useGetWorkflowProps = function useGetWorkflowProps() {
45
26
  return useGetFlowProps();
46
27
  };
47
28
 
@@ -50,7 +31,7 @@ export var useGetWorkflowFlowProps = function useGetWorkflowFlowProps() {
50
31
  * 获取连接限制配置
51
32
  */
52
33
  export var useConnectionLimit = function useConnectionLimit() {
53
- return useWorkflowInputProps(function (state) {
34
+ return useWorkflowProps(function (state) {
54
35
  return state.connectionLimit;
55
36
  });
56
37
  };
@@ -59,7 +40,7 @@ export var useConnectionLimit = function useConnectionLimit() {
59
40
  * 获取是否启用快速添加
60
41
  */
61
42
  export var useQuickAdd = function useQuickAdd() {
62
- return useWorkflowInputProps(function (state) {
43
+ return useWorkflowProps(function (state) {
63
44
  return state.quickAdd;
64
45
  });
65
46
  };
@@ -68,7 +49,7 @@ export var useQuickAdd = function useQuickAdd() {
68
49
  * 获取节点类型拖放回调
69
50
  */
70
51
  export var useOnNodeTypeDrop = function useOnNodeTypeDrop() {
71
- return useWorkflowInputProps(function (state) {
52
+ return useWorkflowProps(function (state) {
72
53
  return state.onNodeTypeDrop;
73
54
  });
74
55
  };
@@ -77,7 +58,7 @@ export var useOnNodeTypeDrop = function useOnNodeTypeDrop() {
77
58
  * 获取渲染节点图标函数
78
59
  */
79
60
  export var useRenderNodeIcon = function useRenderNodeIcon() {
80
- return useWorkflowInputProps(function (state) {
61
+ return useWorkflowProps(function (state) {
81
62
  return state.renderNodeIcon;
82
63
  });
83
64
  };
@@ -86,7 +67,7 @@ export var useRenderNodeIcon = function useRenderNodeIcon() {
86
67
  * 获取选择策略
87
68
  */
88
69
  export var useSelectionStrategy = function useSelectionStrategy() {
89
- return useWorkflowInputProps(function (state) {
70
+ return useWorkflowProps(function (state) {
90
71
  return state.selectionStrategy;
91
72
  });
92
73
  };
@@ -95,7 +76,7 @@ export var useSelectionStrategy = function useSelectionStrategy() {
95
76
  * 获取是否只读
96
77
  */
97
78
  export var useWorkflowReadOnly = function useWorkflowReadOnly() {
98
- return useWorkflowInputProps(function (state) {
79
+ return useWorkflowProps(function (state) {
99
80
  return state.readOnly;
100
81
  });
101
82
  };
@@ -104,7 +85,7 @@ export var useWorkflowReadOnly = function useWorkflowReadOnly() {
104
85
  * 获取加载状态
105
86
  */
106
87
  export var useWorkflowLoading = function useWorkflowLoading() {
107
- return useWorkflowInputProps(function (state) {
88
+ return useWorkflowProps(function (state) {
108
89
  return state.loading;
109
90
  });
110
91
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rxflow/workflow",
3
- "version": "0.0.4-alpha.6",
3
+ "version": "0.0.4-alpha.7",
4
4
  "description": "工作流",
5
5
  "homepage": "https://tree-graph.publib.cn/packages/workflow",
6
6
  "repository": {
@@ -41,7 +41,7 @@
41
41
  "@codemirror/theme-one-dark": "^6.1.3",
42
42
  "@fsegurai/codemirror-theme-github-dark": "^6.2.0",
43
43
  "@fsegurai/codemirror-theme-github-light": "^6.2.0",
44
- "@rxflow/base": "^0.0.4-alpha.6",
44
+ "@rxflow/base": "^0.0.4-alpha.7",
45
45
  "@uiw/react-codemirror": "^4.24.1",
46
46
  "@xterm/addon-fit": "^0.10.0",
47
47
  "@xterm/xterm": "^5.5.0",