@openli1115/lowcode-edit-pro-table 1.0.68 → 1.0.69
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.72fde1b7.js → umi.b2f7e56e.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/preview.js +3 -3
- package/build/lowcode/render/default/view.js +8 -8
- package/build/lowcode/view.js +4 -4
- package/dist/BizComps.js +6 -6
- package/dist/BizComps.js.map +1 -1
- package/es/context/FormProvider.d.ts +0 -4
- package/es/context/FormProvider.js +9 -41
- package/lib/context/FormProvider.d.ts +0 -4
- package/lib/context/FormProvider.js +9 -41
- package/lowcode_es/meta.js +1 -1
- package/lowcode_lib/meta.js +1 -1
- package/package.json +3 -3
|
@@ -4,9 +4,5 @@ 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
|
-
};
|
|
11
7
|
children: React.ReactNode;
|
|
12
8
|
}>;
|
|
@@ -33,7 +33,6 @@ 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,
|
|
37
36
|
children = _ref.children;
|
|
38
37
|
var FormContext = getFormContext();
|
|
39
38
|
|
|
@@ -43,35 +42,12 @@ export var FormProvider = function FormProvider(_ref) {
|
|
|
43
42
|
values = _useState[0],
|
|
44
43
|
setValues = _useState[1];
|
|
45
44
|
|
|
46
|
-
/** 每次渲染同步,供 initialValues effect 判断「store 是否只是回灌了当前表单已有数据」 */
|
|
47
|
-
var valuesRef = useRef(values);
|
|
48
|
-
valuesRef.current = values;
|
|
49
|
-
|
|
50
45
|
/**
|
|
51
|
-
* store 每次 dispatch 都会给新的 screenStructures
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* 另:setFieldValue 会在微任务里 onChange,回灌前 lastOutbound 已同步为深拷贝对象;若 store 又克隆导致引用不一致,需用深比较兜底。
|
|
46
|
+
* store 每次 dispatch 都会给新的 screenStructures 引用;若内容与表单 state 实际一致仍 setValues,
|
|
47
|
+
* 会整页重渲染(含 EditProTable 几十行),Fusion Overlay/Select 在 componentDidUpdate 里反复 setPosition,
|
|
48
|
+
* 易触发 React #185(Maximum update depth exceeded),Windows 上更明显。
|
|
55
49
|
*/
|
|
56
50
|
useEffect(function () {
|
|
57
|
-
if (lastOutboundStructuresRef && initialValues === lastOutboundStructuresRef.current) {
|
|
58
|
-
initialValuesRef.current = initialValues;
|
|
59
|
-
if (typeof console !== 'undefined' && console.debug) {
|
|
60
|
-
console.debug('[FormProvider] skip merge (store ref === last outbound from form)');
|
|
61
|
-
}
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
if (lastOutboundStructuresRef !== null && lastOutboundStructuresRef !== void 0 && lastOutboundStructuresRef.current && isEqual(initialValues, lastOutboundStructuresRef.current)) {
|
|
65
|
-
initialValuesRef.current = initialValues;
|
|
66
|
-
if (typeof console !== 'undefined' && console.debug) {
|
|
67
|
-
console.debug('[FormProvider] skip merge (deep-equal to last outbound / store echo)');
|
|
68
|
-
}
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
if (isEqual(initialValues, valuesRef.current)) {
|
|
72
|
-
initialValuesRef.current = initialValues;
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
51
|
if (isEqual(initialValues, initialValuesRef.current)) {
|
|
76
52
|
initialValuesRef.current = initialValues;
|
|
77
53
|
return;
|
|
@@ -87,7 +63,7 @@ export var FormProvider = function FormProvider(_ref) {
|
|
|
87
63
|
});
|
|
88
64
|
}, [initialValues]);
|
|
89
65
|
|
|
90
|
-
// 优化 setFieldValue
|
|
66
|
+
// 优化 setFieldValue
|
|
91
67
|
var setFieldValue = useCallback(function (path, value) {
|
|
92
68
|
setValues(function (prev) {
|
|
93
69
|
// 使用浅比较检查值是否实际变化
|
|
@@ -97,25 +73,17 @@ export var FormProvider = function FormProvider(_ref) {
|
|
|
97
73
|
var newValues = cloneDeep(prev);
|
|
98
74
|
set(newValues, path, value);
|
|
99
75
|
console.log("[FormProvider] \uD83D\uDCDD Set field '" + path + "' to:", value);
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
76
|
+
|
|
77
|
+
// 触发 onChange 回调,把新值通知给外部
|
|
103
78
|
if (onChange) {
|
|
79
|
+
// 使用微任务避免阻塞渲染
|
|
104
80
|
Promise.resolve().then(function () {
|
|
105
|
-
|
|
106
|
-
var run = function run() {
|
|
107
|
-
return onChange(newValues);
|
|
108
|
-
};
|
|
109
|
-
if (rd && typeof rd.unstable_batchedUpdates === 'function') {
|
|
110
|
-
rd.unstable_batchedUpdates(run);
|
|
111
|
-
} else {
|
|
112
|
-
run();
|
|
113
|
-
}
|
|
81
|
+
onChange(newValues);
|
|
114
82
|
});
|
|
115
83
|
}
|
|
116
84
|
return newValues;
|
|
117
85
|
});
|
|
118
|
-
}, [
|
|
86
|
+
}, []);
|
|
119
87
|
|
|
120
88
|
// 使用 useMemo 缓存 context 值
|
|
121
89
|
var contextValue = useMemo(function () {
|
|
@@ -4,9 +4,5 @@ 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
|
-
};
|
|
11
7
|
children: React.ReactNode;
|
|
12
8
|
}>;
|
|
@@ -39,7 +39,6 @@ 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,
|
|
43
42
|
children = _ref.children;
|
|
44
43
|
var FormContext = getFormContext();
|
|
45
44
|
|
|
@@ -49,35 +48,12 @@ var FormProvider = exports.FormProvider = function FormProvider(_ref) {
|
|
|
49
48
|
values = _useState[0],
|
|
50
49
|
setValues = _useState[1];
|
|
51
50
|
|
|
52
|
-
/** 每次渲染同步,供 initialValues effect 判断「store 是否只是回灌了当前表单已有数据」 */
|
|
53
|
-
var valuesRef = useRef(values);
|
|
54
|
-
valuesRef.current = values;
|
|
55
|
-
|
|
56
51
|
/**
|
|
57
|
-
* store 每次 dispatch 都会给新的 screenStructures
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* 另:setFieldValue 会在微任务里 onChange,回灌前 lastOutbound 已同步为深拷贝对象;若 store 又克隆导致引用不一致,需用深比较兜底。
|
|
52
|
+
* store 每次 dispatch 都会给新的 screenStructures 引用;若内容与表单 state 实际一致仍 setValues,
|
|
53
|
+
* 会整页重渲染(含 EditProTable 几十行),Fusion Overlay/Select 在 componentDidUpdate 里反复 setPosition,
|
|
54
|
+
* 易触发 React #185(Maximum update depth exceeded),Windows 上更明显。
|
|
61
55
|
*/
|
|
62
56
|
useEffect(function () {
|
|
63
|
-
if (lastOutboundStructuresRef && initialValues === lastOutboundStructuresRef.current) {
|
|
64
|
-
initialValuesRef.current = initialValues;
|
|
65
|
-
if (typeof console !== 'undefined' && console.debug) {
|
|
66
|
-
console.debug('[FormProvider] skip merge (store ref === last outbound from form)');
|
|
67
|
-
}
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
if (lastOutboundStructuresRef !== null && lastOutboundStructuresRef !== void 0 && lastOutboundStructuresRef.current && (0, _lodash.isEqual)(initialValues, lastOutboundStructuresRef.current)) {
|
|
71
|
-
initialValuesRef.current = initialValues;
|
|
72
|
-
if (typeof console !== 'undefined' && console.debug) {
|
|
73
|
-
console.debug('[FormProvider] skip merge (deep-equal to last outbound / store echo)');
|
|
74
|
-
}
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
if ((0, _lodash.isEqual)(initialValues, valuesRef.current)) {
|
|
78
|
-
initialValuesRef.current = initialValues;
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
57
|
if ((0, _lodash.isEqual)(initialValues, initialValuesRef.current)) {
|
|
82
58
|
initialValuesRef.current = initialValues;
|
|
83
59
|
return;
|
|
@@ -93,7 +69,7 @@ var FormProvider = exports.FormProvider = function FormProvider(_ref) {
|
|
|
93
69
|
});
|
|
94
70
|
}, [initialValues]);
|
|
95
71
|
|
|
96
|
-
// 优化 setFieldValue
|
|
72
|
+
// 优化 setFieldValue
|
|
97
73
|
var setFieldValue = useCallback(function (path, value) {
|
|
98
74
|
setValues(function (prev) {
|
|
99
75
|
// 使用浅比较检查值是否实际变化
|
|
@@ -103,25 +79,17 @@ var FormProvider = exports.FormProvider = function FormProvider(_ref) {
|
|
|
103
79
|
var newValues = (0, _lodash.cloneDeep)(prev);
|
|
104
80
|
(0, _lodash.set)(newValues, path, value);
|
|
105
81
|
console.log("[FormProvider] \uD83D\uDCDD Set field '" + path + "' to:", value);
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
82
|
+
|
|
83
|
+
// 触发 onChange 回调,把新值通知给外部
|
|
109
84
|
if (onChange) {
|
|
85
|
+
// 使用微任务避免阻塞渲染
|
|
110
86
|
Promise.resolve().then(function () {
|
|
111
|
-
|
|
112
|
-
var run = function run() {
|
|
113
|
-
return onChange(newValues);
|
|
114
|
-
};
|
|
115
|
-
if (rd && typeof rd.unstable_batchedUpdates === 'function') {
|
|
116
|
-
rd.unstable_batchedUpdates(run);
|
|
117
|
-
} else {
|
|
118
|
-
run();
|
|
119
|
-
}
|
|
87
|
+
onChange(newValues);
|
|
120
88
|
});
|
|
121
89
|
}
|
|
122
90
|
return newValues;
|
|
123
91
|
});
|
|
124
|
-
}, [
|
|
92
|
+
}, []);
|
|
125
93
|
|
|
126
94
|
// 使用 useMemo 缓存 context 值
|
|
127
95
|
var contextValue = useMemo(function () {
|
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.69';
|
|
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.69';
|
|
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.69",
|
|
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.69/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.69/build/index.html"
|
|
110
110
|
}
|