From a29054923a0efe0945f02011ad32e1819a58283b Mon Sep 17 00:00:00 2001 From: thinkasany <480968828@qq.com> Date: Thu, 6 Jun 2024 12:27:09 +0800 Subject: [PATCH] docs(form): Modify the interface title level (#49273) --- components/form/index.en-US.md | 18 +++++++++--------- components/form/index.zh-CN.md | 18 +++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/components/form/index.en-US.md b/components/form/index.en-US.md index 6f80536809..f71ede971a 100644 --- a/components/form/index.en-US.md +++ b/components/form/index.en-US.md @@ -472,17 +472,17 @@ export default () => ( Form only update the Field which changed to avoid full refresh perf issue. Thus you can not get real time value with `getFieldsValue` in render. And `useWatch` will rerender current component to sync with latest value. You can also use Field renderProps to get better performance if only want to do conditional render. If component no need care field value change, you can use `onValuesChange` to give to parent component to avoid current one rerender. -### Interface +## Interface -#### NamePath +### NamePath `string | number | (string | number)[]` -#### GetFieldsValue +### GetFieldsValue `getFieldsValue` provides overloaded methods: -##### getFieldsValue(nameList?: true | [NamePath](#namepath)\[], filterFunc?: FilterFunc) +#### getFieldsValue(nameList?: true | [NamePath](#namepath)\[], filterFunc?: FilterFunc) When `nameList` is empty, return all registered fields, including values of List (even if List has no Item children). @@ -501,11 +501,11 @@ form.getFieldsValue([ ]); ``` -##### getFieldsValue({ strict?: boolean, filter?: FilterFunc }) +#### getFieldsValue({ strict?: boolean, filter?: FilterFunc }) New in `5.8.0`. Accept configuration parameters. When `strict` is `true`, only the value of Item will be matched. For example, in `{ list: [{ bamboo: 1, little: 2 }] }`, if List is only bound to the `bamboo` field, then `getFieldsValue({ strict: true })` will only get `{ list: [{ bamboo: 1 }] }`. -#### FilterFunc +### FilterFunc To filter certain field values, `meta` will provide information related to the fields. For example, it can be used to retrieve values that have only been modified by the user, and so on. @@ -513,7 +513,7 @@ To filter certain field values, `meta` will provide information related to the f type FilterFunc = (meta: { touched: boolean; validating: boolean }) => boolean; ``` -#### FieldData +### FieldData | Name | Description | Type | | ---------- | ------------------------ | ------------------------ | @@ -524,7 +524,7 @@ type FilterFunc = (meta: { touched: boolean; validating: boolean }) => boolean; | validating | Whether is in validating | boolean | | value | Field value | any | -#### Rule +### Rule Rule supports a config object, or a function returning config object: @@ -550,7 +550,7 @@ type Rule = RuleConfig | ((form: FormInstance) => RuleConfig); | warningOnly | Warning only. Not block form submit | boolean | 4.17.0 | | whitespace | Failed if only has whitespace, only work with `type: 'string'` rule | boolean | | -#### WatchOptions +### WatchOptions | Name | Description | Type | Default | Version | | --- | --- | --- | --- | --- | diff --git a/components/form/index.zh-CN.md b/components/form/index.zh-CN.md index ca3abc3ace..b91ea6ebb0 100644 --- a/components/form/index.zh-CN.md +++ b/components/form/index.zh-CN.md @@ -471,17 +471,17 @@ export default () => ( Form 仅会对变更的 Field 进行刷新,从而避免完整的组件刷新可能引发的性能问题。因而你无法在 render 阶段通过 `form.getFieldsValue` 来实时获取字段值,而 `useWatch` 提供了一种特定字段访问的方式,从而使得在当前组件中可以直接消费字段的值。同时,如果为了更好的渲染性能,你可以通过 Field 的 renderProps 仅更新需要更新的部分。而当当前组件更新或者 effect 都不需要消费字段值时,则可以通过 `onValuesChange` 将数据抛出,从而避免组件更新。 -### Interface +## Interface -#### NamePath +### NamePath `string | number | (string | number)[]` -#### GetFieldsValue +### GetFieldsValue `getFieldsValue` 提供了多种重载方法: -##### getFieldsValue(nameList?: true | [NamePath](#namepath)\[], filterFunc?: FilterFunc) +#### getFieldsValue(nameList?: true | [NamePath](#namepath)\[], filterFunc?: FilterFunc) 当不提供 `nameList` 时,返回所有注册字段,这也包含 List 下所有的值(即便 List 下没有绑定 Item)。 @@ -500,11 +500,11 @@ form.getFieldsValue([ ]); ``` -##### getFieldsValue({ strict?: boolean, filter?: FilterFunc }) +#### getFieldsValue({ strict?: boolean, filter?: FilterFunc }) `5.8.0` 新增接受配置参数。当 `strict` 为 `true` 时会仅匹配 Item 的值。例如 `{ list: [{ bamboo: 1, little: 2 }] }` 中,如果 List 仅绑定了 `bamboo` 字段,那么 `getFieldsValue({ strict: true })` 会只获得 `{ list: [{ bamboo: 1 }] }`。 -#### FilterFunc +### FilterFunc 用于过滤一些字段值,`meta` 会返回字段相关信息。例如可以用来获取仅被用户修改过的值等等。 @@ -512,7 +512,7 @@ form.getFieldsValue([ type FilterFunc = (meta: { touched: boolean; validating: boolean }) => boolean; ``` -#### FieldData +### FieldData | 名称 | 说明 | 类型 | | ---------- | ---------------- | ------------------------ | @@ -523,7 +523,7 @@ type FilterFunc = (meta: { touched: boolean; validating: boolean }) => boolean; | validating | 是否正在校验 | boolean | | value | 字段对应值 | any | -#### Rule +### Rule Rule 支持接收 object 进行配置,也支持 function 来动态获取 form 的数据: @@ -549,7 +549,7 @@ type Rule = RuleConfig | ((form: FormInstance) => RuleConfig); | warningOnly | 仅警告,不阻塞表单提交 | boolean | 4.17.0 | | whitespace | 如果字段仅包含空格则校验不通过,只在 `type: 'string'` 时生效 | boolean | | -#### WatchOptions +### WatchOptions | 名称 | 说明 | 类型 | 默认值 | 版本 | | -------- | ------------------------------------- | ------------ | ---------------------- | ----- |