zy-react-library 1.0.27 → 1.0.28
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.
|
@@ -21,13 +21,13 @@ const { RangePicker } = DatePicker;
|
|
|
21
21
|
* 表单项渲染器组件
|
|
22
22
|
*/
|
|
23
23
|
const FormItemsRenderer = ({
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}) => {
|
|
24
|
+
options,
|
|
25
|
+
labelCol,
|
|
26
|
+
span = 12,
|
|
27
|
+
collapse = false,
|
|
28
|
+
useAutoGenerateRequired = true,
|
|
29
|
+
initialValues,
|
|
30
|
+
}) => {
|
|
31
31
|
const form = Form.useFormInstance();
|
|
32
32
|
|
|
33
33
|
// 获取表单值,优先使用 initialValues
|
|
@@ -297,40 +297,39 @@ const FormItemsRenderer = ({
|
|
|
297
297
|
return (
|
|
298
298
|
option.customizeRender
|
|
299
299
|
? (renderFormControl(option))
|
|
300
|
-
: (
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
})()
|
|
300
|
+
: (
|
|
301
|
+
<Form.Item
|
|
302
|
+
key={option.name || index}
|
|
303
|
+
noStyle
|
|
304
|
+
shouldUpdate={option.shouldUpdate ?? option?.componentProps?.shouldUpdate}
|
|
305
|
+
dependencies={option.dependencies || option?.componentProps?.dependencies}
|
|
306
|
+
>
|
|
307
|
+
{() => {
|
|
308
|
+
// 支持动态计算 hidden
|
|
309
|
+
const hidden = typeof option.hidden === "function"
|
|
310
|
+
? option.hidden(getFormValues())
|
|
311
|
+
: (option.hidden ?? false);
|
|
312
|
+
|
|
313
|
+
if (hidden)
|
|
314
|
+
return null;
|
|
315
|
+
|
|
316
|
+
return (
|
|
317
|
+
<Col key={option.name || index} span={itemSpan} style={style}>
|
|
318
|
+
<Form.Item
|
|
319
|
+
name={option.name}
|
|
320
|
+
label={renderLabel(option)}
|
|
321
|
+
rules={getRules(option)}
|
|
322
|
+
labelCol={itemLabelCol}
|
|
323
|
+
wrapperCol={itemWrapperCol}
|
|
324
|
+
{...getFormItemProps(option)}
|
|
325
|
+
>
|
|
326
|
+
{renderFormControl(option)}
|
|
327
|
+
</Form.Item>
|
|
328
|
+
</Col>
|
|
329
|
+
);
|
|
330
|
+
}}
|
|
331
|
+
</Form.Item>
|
|
332
|
+
)
|
|
334
333
|
);
|
|
335
334
|
}
|
|
336
335
|
|
|
@@ -349,17 +348,17 @@ const FormItemsRenderer = ({
|
|
|
349
348
|
option.customizeRender
|
|
350
349
|
? (renderFormControl(option))
|
|
351
350
|
: (
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
351
|
+
<Form.Item
|
|
352
|
+
name={option.name}
|
|
353
|
+
label={renderLabel(option)}
|
|
354
|
+
rules={getRules(option)}
|
|
355
|
+
labelCol={itemLabelCol}
|
|
356
|
+
wrapperCol={itemWrapperCol}
|
|
357
|
+
{...getFormItemProps(option)}
|
|
358
|
+
>
|
|
359
|
+
{renderFormControl(option)}
|
|
360
|
+
</Form.Item>
|
|
361
|
+
)
|
|
363
362
|
}
|
|
364
363
|
</Col>
|
|
365
364
|
);
|