zy-react-library 1.4.30 → 1.4.31
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.
|
@@ -3,6 +3,14 @@ import type { Gutter } from "antd/es/grid/row";
|
|
|
3
3
|
import type { ReactElement, ReactNode } from "react";
|
|
4
4
|
import type { FormOption } from "./FormItemsRenderer";
|
|
5
5
|
|
|
6
|
+
/** FormBuilder 支持的布局 */
|
|
7
|
+
export type FormBuilderLayout = "horizontal" | "vertical";
|
|
8
|
+
|
|
9
|
+
/** FormBuilder 内的 label、wrapper 栅格配置,仅允许数值 span */
|
|
10
|
+
export interface FormColProps {
|
|
11
|
+
span: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
6
14
|
/**
|
|
7
15
|
* 深度部分类型,将所有嵌套属性都变为可选
|
|
8
16
|
*/
|
|
@@ -22,8 +30,12 @@ export interface FormBuilderProps<Values = any> extends Omit<FormProps, "form" |
|
|
|
22
30
|
gutter?: Gutter | [Gutter, Gutter];
|
|
23
31
|
/** 占据栅格列数,默认 12 */
|
|
24
32
|
span?: number;
|
|
25
|
-
/** 表单布局,默认
|
|
26
|
-
layout?:
|
|
33
|
+
/** 表单布局,默认 horizontal */
|
|
34
|
+
layout?: FormBuilderLayout;
|
|
35
|
+
/** label 栅格配置,仅允许数值 span,默认 4 */
|
|
36
|
+
labelCol?: FormColProps;
|
|
37
|
+
/** wrapper 栅格配置,仅允许数值 span,默认 24 - labelCol.span */
|
|
38
|
+
wrapperCol?: FormColProps;
|
|
27
39
|
/** 自动生成必填规则,默认 true */
|
|
28
40
|
useAutoGenerateRequired?: boolean;
|
|
29
41
|
/** 是否显示操作按钮区域,默认 true */
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { FormItemProps, FormProps, Rule } from "antd/es/form";
|
|
1
|
+
import type { FormItemProps, Rule } from "antd/es/form";
|
|
3
2
|
import type { FormListFieldData } from "antd/es/form/FormList";
|
|
4
3
|
import type { Gutter } from "antd/es/grid/row";
|
|
5
4
|
import type { NamePath } from "rc-field-form/lib/interface";
|
|
6
5
|
import type { CSSProperties, Key, ReactElement, ReactNode } from "react";
|
|
7
6
|
import type { FORM_ITEM_RENDER_TYPE_MAP } from "../../enum/formItemRender";
|
|
8
|
-
import type { DeepPartial } from "./FormBuilder";
|
|
7
|
+
import type { DeepPartial, FormBuilderLayout, FormColProps } from "./FormBuilder";
|
|
9
8
|
|
|
10
9
|
/**
|
|
11
10
|
* Form.List name 类型
|
|
@@ -127,10 +126,10 @@ export interface FormOptionBase<
|
|
|
127
126
|
customizeRender?: IsCustomizeRender;
|
|
128
127
|
/** 传递给 Form.Item 的属性,支持函数动态计算 */
|
|
129
128
|
formItemProps?: FormOptionProperty<IsOnlyForLabel, IsCustomizeRender, FormItemProps | ((formValues: AllValues) => FormItemProps)>;
|
|
130
|
-
/** label 栅格配置,默认直接使用外层的 labelCol
|
|
131
|
-
labelCol?: FormOptionProperty<IsOnlyForLabel, IsCustomizeRender,
|
|
129
|
+
/** label 栅格配置,默认直接使用外层的 labelCol;表单项独占一行(span 为 24)时取外层 labelCol.span 的一半 */
|
|
130
|
+
labelCol?: FormOptionProperty<IsOnlyForLabel, IsCustomizeRender, FormColProps>;
|
|
132
131
|
/** wrapper 栅格配置,默认 24 - labelCol.span */
|
|
133
|
-
wrapperCol?: FormOptionProperty<IsOnlyForLabel, IsCustomizeRender,
|
|
132
|
+
wrapperCol?: FormOptionProperty<IsOnlyForLabel, IsCustomizeRender, FormColProps>;
|
|
134
133
|
/** 是否应该更新(用于表单联动) */
|
|
135
134
|
shouldUpdate?: FormOptionProperty<IsOnlyForLabel, IsCustomizeRender, boolean | ((prevValues: AllValues, nextValues: AllValues, info: { source?: string }) => boolean)>;
|
|
136
135
|
/** 依赖字段(用于表单联动) */
|
|
@@ -268,8 +267,8 @@ export interface FormItemsRendererProps<Values = any> {
|
|
|
268
267
|
options: FormOption<Values>[];
|
|
269
268
|
/** 默认栅格占据列数,默认 12 */
|
|
270
269
|
span?: number;
|
|
271
|
-
/** 表单布局,默认
|
|
272
|
-
layout?:
|
|
270
|
+
/** 表单布局,默认 horizontal */
|
|
271
|
+
layout?: FormBuilderLayout;
|
|
273
272
|
/** 是否折叠(仅显示前3项),默认 false */
|
|
274
273
|
collapse?: boolean;
|
|
275
274
|
/** 自动生成必填规则,默认 true */
|
|
@@ -279,7 +278,7 @@ export interface FormItemsRendererProps<Values = any> {
|
|
|
279
278
|
/** 栅格间距,继承自 FormBuilder */
|
|
280
279
|
gutter?: Gutter | [Gutter, Gutter];
|
|
281
280
|
/** label 栅格配置,继承自 FormBuilder */
|
|
282
|
-
labelCol?:
|
|
281
|
+
labelCol?: FormColProps;
|
|
283
282
|
}
|
|
284
283
|
|
|
285
284
|
/**
|