@openli1115/lowcode-edit-pro-table 1.0.64 → 1.0.66
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/build/docs/404.html +3 -3
- package/build/docs/_demos/:uuid +3 -3
- package/build/docs/colorful-button.html +3 -3
- package/build/docs/colorful-input.html +3 -3
- package/build/docs/index.html +3 -3
- package/build/docs/{umi.d88fc779.js → umi.b73239e9.js} +1 -1
- package/build/docs/~demos/:uuid.html +3 -3
- package/build/docs/~demos/colorful-button-demo.html +3 -3
- package/build/docs/~demos/colorful-input-demo.html +3 -3
- package/build/lowcode/assets-daily.json +13 -13
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +13 -13
- package/build/lowcode/meta.design.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.js +1 -1
- package/build/lowcode/view.js +1 -1
- package/dist/BizComps.js +1 -1
- package/dist/BizComps.js.map +1 -1
- package/es/context/FormProvider.d.ts +4 -0
- package/es/context/FormProvider.js +8 -19
- package/lib/context/FormProvider.d.ts +4 -0
- package/lib/context/FormProvider.js +8 -19
- package/lowcode_es/meta.js +1 -1
- package/lowcode_lib/meta.js +1 -1
- package/package.json +3 -3
|
@@ -4,5 +4,9 @@ export declare function getFormContext(): any;
|
|
|
4
4
|
export declare const FormProvider: React.FC<{
|
|
5
5
|
initialValues?: Record<string, any>;
|
|
6
6
|
onChange?: (values: Record<string, any>) => void;
|
|
7
|
+
/** 由 preview 传入:最后一次 onChange(newStructures) 的引用;若与 initialValues 全等则本次为 store 回灌,勿再 merge(根治 #185) */
|
|
8
|
+
lastOutboundStructuresRef?: {
|
|
9
|
+
current: any;
|
|
10
|
+
};
|
|
7
11
|
children: React.ReactNode;
|
|
8
12
|
}>;
|
|
@@ -33,6 +33,7 @@ export var FormProvider = function FormProvider(_ref) {
|
|
|
33
33
|
var _ref$initialValues = _ref.initialValues,
|
|
34
34
|
initialValues = _ref$initialValues === void 0 ? {} : _ref$initialValues,
|
|
35
35
|
onChange = _ref.onChange,
|
|
36
|
+
lastOutboundStructuresRef = _ref.lastOutboundStructuresRef,
|
|
36
37
|
children = _ref.children;
|
|
37
38
|
var FormContext = getFormContext();
|
|
38
39
|
|
|
@@ -47,25 +48,16 @@ export var FormProvider = function FormProvider(_ref) {
|
|
|
47
48
|
valuesRef.current = values;
|
|
48
49
|
|
|
49
50
|
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*/
|
|
54
|
-
var pendingSkipStoreResyncRef = useRef(0);
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* store 每次 dispatch 都会给新的 screenStructures 引用;若内容与表单 state 实际一致仍 setValues,
|
|
58
|
-
* 会整页重渲染(含 EditProTable、ss_xxx_tab 等大表),Fusion Overlay/Select 反复 setPosition,
|
|
59
|
-
* 易触发 React #185(Maximum update depth exceeded)。
|
|
60
|
-
*
|
|
61
|
-
* 仅与 initialValuesRef 比较不够:用户改字段后 onChange 已把同一份数据写回 store,若此时再 merge,
|
|
62
|
-
* 或与内表 mutate 的 window.screenStructures 产生细微差异,会反复 setValues 形成环。
|
|
63
|
-
* 因此:initialValues 与当前表单 values 深度相等时,一律不再 setValues。
|
|
51
|
+
* store 每次 dispatch 都会给新的 screenStructures 引用;previewStore 直接把 onChange 的 payload 设为 state(同引用)。
|
|
52
|
+
* 若 initialValues === 上次 handleFormChange 推出去的对象,说明只是「表单 → store → props」回灌,禁止再 merge,否则大表 + Fusion #185。
|
|
53
|
+
* 逻辑流 / 接口改数会换对象引用,不会与 lastOutbound 全等。
|
|
64
54
|
*/
|
|
65
55
|
useEffect(function () {
|
|
66
|
-
if (
|
|
67
|
-
pendingSkipStoreResyncRef.current = 0;
|
|
56
|
+
if (lastOutboundStructuresRef && initialValues === lastOutboundStructuresRef.current) {
|
|
68
57
|
initialValuesRef.current = initialValues;
|
|
58
|
+
if (typeof console !== 'undefined' && console.debug) {
|
|
59
|
+
console.debug('[FormProvider] skip merge (store ref === last outbound from form)');
|
|
60
|
+
}
|
|
69
61
|
return;
|
|
70
62
|
}
|
|
71
63
|
if (isEqual(initialValues, valuesRef.current)) {
|
|
@@ -97,11 +89,8 @@ export var FormProvider = function FormProvider(_ref) {
|
|
|
97
89
|
var newValues = cloneDeep(prev);
|
|
98
90
|
set(newValues, path, value);
|
|
99
91
|
console.log("[FormProvider] \uD83D\uDCDD Set field '" + path + "' to:", value);
|
|
100
|
-
|
|
101
|
-
// 触发 onChange 回调,把新值通知到外部 store;计数放在微任务首行,避免早于「store 回灌」的 effect 误消费
|
|
102
92
|
if (onChange) {
|
|
103
93
|
Promise.resolve().then(function () {
|
|
104
|
-
pendingSkipStoreResyncRef.current += 1;
|
|
105
94
|
onChange(newValues);
|
|
106
95
|
});
|
|
107
96
|
}
|
|
@@ -4,5 +4,9 @@ export declare function getFormContext(): any;
|
|
|
4
4
|
export declare const FormProvider: React.FC<{
|
|
5
5
|
initialValues?: Record<string, any>;
|
|
6
6
|
onChange?: (values: Record<string, any>) => void;
|
|
7
|
+
/** 由 preview 传入:最后一次 onChange(newStructures) 的引用;若与 initialValues 全等则本次为 store 回灌,勿再 merge(根治 #185) */
|
|
8
|
+
lastOutboundStructuresRef?: {
|
|
9
|
+
current: any;
|
|
10
|
+
};
|
|
7
11
|
children: React.ReactNode;
|
|
8
12
|
}>;
|
|
@@ -39,6 +39,7 @@ var FormProvider = exports.FormProvider = function FormProvider(_ref) {
|
|
|
39
39
|
var _ref$initialValues = _ref.initialValues,
|
|
40
40
|
initialValues = _ref$initialValues === void 0 ? {} : _ref$initialValues,
|
|
41
41
|
onChange = _ref.onChange,
|
|
42
|
+
lastOutboundStructuresRef = _ref.lastOutboundStructuresRef,
|
|
42
43
|
children = _ref.children;
|
|
43
44
|
var FormContext = getFormContext();
|
|
44
45
|
|
|
@@ -53,25 +54,16 @@ var FormProvider = exports.FormProvider = function FormProvider(_ref) {
|
|
|
53
54
|
valuesRef.current = values;
|
|
54
55
|
|
|
55
56
|
/**
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*/
|
|
60
|
-
var pendingSkipStoreResyncRef = useRef(0);
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* store 每次 dispatch 都会给新的 screenStructures 引用;若内容与表单 state 实际一致仍 setValues,
|
|
64
|
-
* 会整页重渲染(含 EditProTable、ss_xxx_tab 等大表),Fusion Overlay/Select 反复 setPosition,
|
|
65
|
-
* 易触发 React #185(Maximum update depth exceeded)。
|
|
66
|
-
*
|
|
67
|
-
* 仅与 initialValuesRef 比较不够:用户改字段后 onChange 已把同一份数据写回 store,若此时再 merge,
|
|
68
|
-
* 或与内表 mutate 的 window.screenStructures 产生细微差异,会反复 setValues 形成环。
|
|
69
|
-
* 因此:initialValues 与当前表单 values 深度相等时,一律不再 setValues。
|
|
57
|
+
* store 每次 dispatch 都会给新的 screenStructures 引用;previewStore 直接把 onChange 的 payload 设为 state(同引用)。
|
|
58
|
+
* 若 initialValues === 上次 handleFormChange 推出去的对象,说明只是「表单 → store → props」回灌,禁止再 merge,否则大表 + Fusion #185。
|
|
59
|
+
* 逻辑流 / 接口改数会换对象引用,不会与 lastOutbound 全等。
|
|
70
60
|
*/
|
|
71
61
|
useEffect(function () {
|
|
72
|
-
if (
|
|
73
|
-
pendingSkipStoreResyncRef.current = 0;
|
|
62
|
+
if (lastOutboundStructuresRef && initialValues === lastOutboundStructuresRef.current) {
|
|
74
63
|
initialValuesRef.current = initialValues;
|
|
64
|
+
if (typeof console !== 'undefined' && console.debug) {
|
|
65
|
+
console.debug('[FormProvider] skip merge (store ref === last outbound from form)');
|
|
66
|
+
}
|
|
75
67
|
return;
|
|
76
68
|
}
|
|
77
69
|
if ((0, _lodash.isEqual)(initialValues, valuesRef.current)) {
|
|
@@ -103,11 +95,8 @@ var FormProvider = exports.FormProvider = function FormProvider(_ref) {
|
|
|
103
95
|
var newValues = (0, _lodash.cloneDeep)(prev);
|
|
104
96
|
(0, _lodash.set)(newValues, path, value);
|
|
105
97
|
console.log("[FormProvider] \uD83D\uDCDD Set field '" + path + "' to:", value);
|
|
106
|
-
|
|
107
|
-
// 触发 onChange 回调,把新值通知到外部 store;计数放在微任务首行,避免早于「store 回灌」的 effect 误消费
|
|
108
98
|
if (onChange) {
|
|
109
99
|
Promise.resolve().then(function () {
|
|
110
|
-
pendingSkipStoreResyncRef.current += 1;
|
|
111
100
|
onChange(newValues);
|
|
112
101
|
});
|
|
113
102
|
}
|
package/lowcode_es/meta.js
CHANGED
|
@@ -101,7 +101,7 @@ function fillRealVersion(meta, packageName, version, basicLibraryVersion) {
|
|
|
101
101
|
packageName = '@openli1115/lowcode-edit-pro-table';
|
|
102
102
|
}
|
|
103
103
|
if (version === void 0) {
|
|
104
|
-
version = '1.0.
|
|
104
|
+
version = '1.0.66';
|
|
105
105
|
}
|
|
106
106
|
if (basicLibraryVersion === void 0) {
|
|
107
107
|
basicLibraryVersion = {
|
package/lowcode_lib/meta.js
CHANGED
|
@@ -106,7 +106,7 @@ function fillRealVersion(meta, packageName, version, basicLibraryVersion) {
|
|
|
106
106
|
packageName = '@openli1115/lowcode-edit-pro-table';
|
|
107
107
|
}
|
|
108
108
|
if (version === void 0) {
|
|
109
|
-
version = '1.0.
|
|
109
|
+
version = '1.0.66';
|
|
110
110
|
}
|
|
111
111
|
if (basicLibraryVersion === void 0) {
|
|
112
112
|
basicLibraryVersion = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openli1115/lowcode-edit-pro-table",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.66",
|
|
4
4
|
"description": "@openli1115/lowcode-edit-pro-table",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -101,10 +101,10 @@
|
|
|
101
101
|
},
|
|
102
102
|
"componentConfig": {
|
|
103
103
|
"isComponentLibrary": true,
|
|
104
|
-
"materialSchema": "https://unpkg.com/@openli1115/lowcode-edit-pro-table@1.0.
|
|
104
|
+
"materialSchema": "https://unpkg.com/@openli1115/lowcode-edit-pro-table@1.0.66/build/lowcode/assets-prod.json"
|
|
105
105
|
},
|
|
106
106
|
"lcMeta": {
|
|
107
107
|
"type": "component"
|
|
108
108
|
},
|
|
109
|
-
"homepage": "https://unpkg.com/@openli1115/lowcode-edit-pro-table@1.0.
|
|
109
|
+
"homepage": "https://unpkg.com/@openli1115/lowcode-edit-pro-table@1.0.66/build/index.html"
|
|
110
110
|
}
|