zy-react-library 1.0.157 → 1.0.158
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.
|
@@ -71,8 +71,8 @@ export interface FormOption {
|
|
|
71
71
|
label?: ReactNode;
|
|
72
72
|
/** 渲染类型 */
|
|
73
73
|
render?: FormItemRenderType;
|
|
74
|
-
/** 占据栅格列数,默认 12
|
|
75
|
-
span?: number | string
|
|
74
|
+
/** 占据栅格列数,默认 12 */
|
|
75
|
+
span?: number | string;
|
|
76
76
|
/** 是否必填,默认 true,支持函数动态计算 */
|
|
77
77
|
required?: boolean | ((formValues: FormValues) => boolean);
|
|
78
78
|
/** 验证规则 */
|
|
@@ -206,17 +206,9 @@ const FormItemsRenderer = ({
|
|
|
206
206
|
return collapse && index >= 3 ? { display: "none" } : undefined;
|
|
207
207
|
};
|
|
208
208
|
|
|
209
|
-
// 获取 span
|
|
210
|
-
const getSpan = (span) => {
|
|
211
|
-
// 支持动态计算 span
|
|
212
|
-
return typeof span === "function"
|
|
213
|
-
? span(getFormValues())
|
|
214
|
-
: span;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
209
|
// 列数
|
|
218
210
|
const getCol = (option) => {
|
|
219
|
-
const itemSpan = option.render === FORM_ITEM_RENDER_ENUM.DIVIDER ? 24 : (
|
|
211
|
+
const itemSpan = option.render === FORM_ITEM_RENDER_ENUM.DIVIDER ? 24 : (option.span ?? span);
|
|
220
212
|
const itemLabelCol = option.labelCol ?? (itemSpan === 24 ? { span: labelCol.span / 2 } : labelCol);
|
|
221
213
|
const itemWrapperCol = option.wrapperCol ?? { span: 24 - itemLabelCol.span };
|
|
222
214
|
return { span: itemSpan, labelCol: itemLabelCol, wrapperCol: itemWrapperCol };
|