修复FormBuilder的部分判断 || 改成 ??
parent
96fe1443b2
commit
2ee481d817
|
|
@ -90,7 +90,7 @@ const FormItemsRenderer = ({
|
||||||
// 支持动态计算 required
|
// 支持动态计算 required
|
||||||
const required = typeof option.required === "function"
|
const required = typeof option.required === "function"
|
||||||
? option.required(form.getFieldsValue())
|
? option.required(form.getFieldsValue())
|
||||||
: (option.required || true);
|
: (option.required ?? true);
|
||||||
|
|
||||||
if (required) {
|
if (required) {
|
||||||
const isBlurTrigger = !option.render || [
|
const isBlurTrigger = !option.render || [
|
||||||
|
|
@ -274,7 +274,7 @@ const FormItemsRenderer = ({
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果配置了 shouldUpdate 或 dependencies,使用 Form.Item 的联动机制
|
// 如果配置了 shouldUpdate 或 dependencies,使用 Form.Item 的联动机制
|
||||||
if (option.shouldUpdate || option.dependencies || option?.componentProps?.shouldUpdate || option?.componentProps?.dependencies) {
|
if ((option.shouldUpdate ?? option.dependencies) || (option?.componentProps?.shouldUpdate ?? option?.componentProps?.dependencies)) {
|
||||||
return (
|
return (
|
||||||
option.customizeRender
|
option.customizeRender
|
||||||
? (renderFormControl(option))
|
? (renderFormControl(option))
|
||||||
|
|
@ -282,14 +282,14 @@ const FormItemsRenderer = ({
|
||||||
<Col key={option.name || index} span={itemSpan} style={style}>
|
<Col key={option.name || index} span={itemSpan} style={style}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
noStyle
|
noStyle
|
||||||
shouldUpdate={option.shouldUpdate || option?.componentProps?.shouldUpdate}
|
shouldUpdate={option.shouldUpdate ?? option?.componentProps?.shouldUpdate}
|
||||||
dependencies={option.dependencies || option?.componentProps?.dependencies}
|
dependencies={option.dependencies || option?.componentProps?.dependencies}
|
||||||
>
|
>
|
||||||
{(form) => {
|
{(form) => {
|
||||||
// 支持动态计算 hidden
|
// 支持动态计算 hidden
|
||||||
const hidden = typeof option.hidden === "function"
|
const hidden = typeof option.hidden === "function"
|
||||||
? option.hidden(form.getFieldsValue())
|
? option.hidden(form.getFieldsValue())
|
||||||
: (option.hidden || false);
|
: (option.hidden ?? false);
|
||||||
|
|
||||||
if (hidden)
|
if (hidden)
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue