zy-react-library 1.0.3 → 1.0.4
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.
|
@@ -90,7 +90,7 @@ const FormItemsRenderer = ({
|
|
|
90
90
|
// 支持动态计算 required
|
|
91
91
|
const required = typeof option.required === "function"
|
|
92
92
|
? option.required(form.getFieldsValue())
|
|
93
|
-
: (option.required
|
|
93
|
+
: (option.required ?? true);
|
|
94
94
|
|
|
95
95
|
if (required) {
|
|
96
96
|
const isBlurTrigger = !option.render || [
|
|
@@ -274,7 +274,7 @@ const FormItemsRenderer = ({
|
|
|
274
274
|
}
|
|
275
275
|
|
|
276
276
|
// 如果配置了 shouldUpdate 或 dependencies,使用 Form.Item 的联动机制
|
|
277
|
-
if (option.shouldUpdate
|
|
277
|
+
if ((option.shouldUpdate ?? option.dependencies) || (option?.componentProps?.shouldUpdate ?? option?.componentProps?.dependencies)) {
|
|
278
278
|
return (
|
|
279
279
|
option.customizeRender
|
|
280
280
|
? (renderFormControl(option))
|
|
@@ -282,14 +282,14 @@ const FormItemsRenderer = ({
|
|
|
282
282
|
<Col key={option.name || index} span={itemSpan} style={style}>
|
|
283
283
|
<Form.Item
|
|
284
284
|
noStyle
|
|
285
|
-
shouldUpdate={option.shouldUpdate
|
|
285
|
+
shouldUpdate={option.shouldUpdate ?? option?.componentProps?.shouldUpdate}
|
|
286
286
|
dependencies={option.dependencies || option?.componentProps?.dependencies}
|
|
287
287
|
>
|
|
288
288
|
{(form) => {
|
|
289
289
|
// 支持动态计算 hidden
|
|
290
290
|
const hidden = typeof option.hidden === "function"
|
|
291
291
|
? option.hidden(form.getFieldsValue())
|
|
292
|
-
: (option.hidden
|
|
292
|
+
: (option.hidden ?? false);
|
|
293
293
|
|
|
294
294
|
if (hidden)
|
|
295
295
|
return null;
|