@rxflow/base 0.0.4-alpha.1 → 0.0.4-alpha.2

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/esm/Flow.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Flow.d.ts","sourceRoot":"","sources":["Flow.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,8BAA8B,CAAC;AACtC,OAAO,EAAC,cAAc,EAAC,MAAM,SAAS,CAAC;AAQvC,OAAO,EAGL,IAAI,EAGJ,IAAI,EAOL,MAAM,eAAe,CAAC;AAavB,OAAO,cAAc,CAAC;AA0HtB,wBAAgB,IAAI,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,KAAK,EAAE,cAAc,CAAC,QAAQ,EAAE,QAAQ,CAAC,2CAwNzH"}
1
+ {"version":3,"file":"Flow.d.ts","sourceRoot":"","sources":["Flow.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,8BAA8B,CAAC;AACtC,OAAO,EAAC,cAAc,EAAC,MAAM,SAAS,CAAC;AAQvC,OAAO,EAGL,IAAI,EAGJ,IAAI,EAOL,MAAM,eAAe,CAAC;AAavB,OAAO,cAAc,CAAC;AA0HtB,wBAAgB,IAAI,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,KAAK,EAAE,cAAc,CAAC,QAAQ,EAAE,QAAQ,CAAC,2CA0NzH"}
package/esm/Flow.js CHANGED
@@ -105,6 +105,7 @@ export function Flow(props) {
105
105
  onEdgesChange = props.onEdgesChange,
106
106
  children = props.children,
107
107
  forceFitView = props.forceFitView;
108
+ console.log('render', '------');
108
109
  useListenRender(); // 性能监听 hook
109
110
 
110
111
  var _useState = useState(!!(showMiniMap && !showControls)),
@@ -1 +1 @@
1
- {"version":3,"file":"PropsStore.d.ts","sourceRoot":"","sources":["PropsStore.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,cAAc,EAAmB,MAAM,UAAU,CAAC;AAG3D,OAAO,EAAE,SAAS,EAA8B,MAAM,OAAO,CAAC;AAK9D,MAAM,WAAW,eAAe,CAC9B,WAAW,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC7D,UAAU,SAAS,cAAc,GAAG,cAAc;IAElD,wBAAwB;IACxB,UAAU,EAAE,WAAW,CAAC;IACxB,mCAAmC;IACnC,SAAS,EAAE,UAAU,CAAC;IACtB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAiCD,eAAO,MAAM,UAAU,mRAOpB,gBAAgB,WAAW,EAAE,UAAU,CAAC,4CAyC1C,CAAC"}
1
+ {"version":3,"file":"PropsStore.d.ts","sourceRoot":"","sources":["PropsStore.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,cAAc,EAAmB,MAAM,UAAU,CAAC;AAG3D,OAAO,EAAE,SAAS,EAA8B,MAAM,OAAO,CAAC;AAmB9D,MAAM,WAAW,eAAe,CAC9B,WAAW,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC7D,UAAU,SAAS,cAAc,GAAG,cAAc;IAElD,wBAAwB;IACxB,UAAU,EAAE,WAAW,CAAC;IACxB,mCAAmC;IACnC,SAAS,EAAE,UAAU,CAAC;IACtB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAiCD,eAAO,MAAM,UAAU,mRAOpB,gBAAgB,WAAW,EAAE,UAAU,CAAC,4CA8C1C,CAAC"}
@@ -18,9 +18,23 @@ import { useEffect, useMemo, useRef } from "react";
18
18
  import { v4 as uuid } from "uuid";
19
19
  import { useGetState } from "../hooks/state/useGetState";
20
20
  import { useSetState } from "../hooks/state/useSetState";
21
+
22
+ /**
23
+ * 提取非函数属性用于深比较
24
+ * 避免函数每次渲染生成新引用导致循环更新
25
+ */
21
26
  import { jsx as _jsx } from "react/jsx-runtime";
22
27
  import { Fragment as _Fragment } from "react/jsx-runtime";
23
28
  import { jsxs as _jsxs } from "react/jsx-runtime";
29
+ var extractDataProps = function extractDataProps(props) {
30
+ var result = {};
31
+ for (var key in props) {
32
+ if (typeof props[key] !== 'function') {
33
+ result[key] = props[key];
34
+ }
35
+ }
36
+ return result;
37
+ };
24
38
  /**
25
39
  * 构建 nodeTypeMap
26
40
  */
@@ -85,17 +99,26 @@ export var PropsStore = function PropsStore(_ref) {
85
99
  return buildNodeTypeMap(nodeTypes);
86
100
  }, [nodeTypes]);
87
101
 
102
+ // 提取数据属性用于深比较(排除函数,避免循环更新)
103
+ var inputDataProps = useMemo(function () {
104
+ return extractDataProps(inputProps);
105
+ }, [inputProps]);
106
+ var flowDataProps = useMemo(function () {
107
+ return extractDataProps(flowProps);
108
+ }, [flowProps]);
109
+
88
110
  // 更新状态 - 同时存储 inputProps 和 flowProps
111
+ // 只对数据属性做深比较,函数属性不参与比较
89
112
  useDeepCompareEffect(function () {
90
113
  setState({
91
- // 分别存储原始和转换后的 props
114
+ // 分别存储原始和转换后的 props(包含函数)
92
115
  inputProps: inputProps,
93
116
  flowProps: flowProps,
94
117
  // 其他状态
95
118
  id: flowProps.id || defaultId,
96
119
  nodeTypeMap: nodeTypeMap
97
120
  });
98
- }, [inputProps, flowProps]);
121
+ }, [inputDataProps, flowDataProps]);
99
122
 
100
123
  // nodes 变化时清除初始化记录
101
124
  useEffect(function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rxflow/base",
3
- "version": "0.0.4-alpha.1",
3
+ "version": "0.0.4-alpha.2",
4
4
  "description": "BaseFlow - 核心 Flow 组件库",
5
5
  "keywords": [
6
6
  "reactflow",
@@ -43,7 +43,7 @@
43
43
  "dependencies": {
44
44
  "@ant-design/icons": "^6.0.0",
45
45
  "@antv/hierarchy": "0.6.14",
46
- "@rxflow/manhattan": "^0.0.4-alpha.1",
46
+ "@rxflow/manhattan": "^0.0.4-alpha.2",
47
47
  "@xyflow/react": "^12.8.6",
48
48
  "@xyflow/system": "^0.0.70",
49
49
  "@zumer/snapdom": "^1.9.9",