mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-28 05:05:48 +08:00
docs: format api input/inputnumber/mentions (#25339)
This commit is contained in:
parent
7b9231afc0
commit
382b8a78be
@ -15,28 +15,27 @@ When a numeric value needs to be provided.
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
| --- | --- | --- | --- |
|
||||
| autoFocus | get focus when component mounted | boolean | false |
|
||||
| defaultValue | initial value | number | |
|
||||
| disabled | disable the input | boolean | false |
|
||||
| formatter | Specifies the format of the value presented | function(value: number \| string): string | |
|
||||
| max | max value | number | [Number.MAX_SAFE_INTEGER](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER) |
|
||||
| min | min value | number | [Number.MIN_SAFE_INTEGER](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MIN_SAFE_INTEGER) |
|
||||
| parser | Specifies the value extracted from formatter | function(string): number | |
|
||||
| precision | precision of input value | number | |
|
||||
| decimalSeparator | decimal separator | string | |
|
||||
| size | height of input box | `large` \| `middle` \| `small` | |
|
||||
| step | The number to which the current value is increased or decreased. It can be an integer or decimal. | number\|string | 1 |
|
||||
| type | HTML inputs can have a type of `number`, and this can be added to aid mobile broswer keyboards to show the number keybaord, as well as limit inputs to numbers only `0-9` and `e`, but will not guaruntee client and server side validation. | string - ie 'number' | |
|
||||
| value | current value | number | |
|
||||
| onChange | The callback triggered when the value is changed. | function(value: number \| string) | |
|
||||
| onPressEnter | The callback function that is triggered when Enter key is pressed. | function(e) | |
|
||||
| autoFocus | If get focus when component mounted | boolean | false |
|
||||
| defaultValue | The initial value | number | - |
|
||||
| disabled | If disable the input | boolean | false |
|
||||
| formatter | Specifies the format of the value presented | function(value: number \| string): string | - |
|
||||
| max | The max value | number | [Number.MAX_SAFE_INTEGER](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER) |
|
||||
| min | The min value | number | [Number.MIN_SAFE_INTEGER](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MIN_SAFE_INTEGER) |
|
||||
| parser | Specifies the value extracted from formatter | function(string): number | - |
|
||||
| precision | The precision of input value | number | - |
|
||||
| decimalSeparator | Decimal separator | string | - |
|
||||
| size | The height of input box | `large` \| `middle` \| `small` | - |
|
||||
| step | The number to which the current value is increased or decreased. It can be an integer or decimal | number \| string | 1 |
|
||||
| value | The current value | number | - |
|
||||
| onChange | The callback triggered when the value is changed | function(value: number \| string) | - |
|
||||
| onPressEnter | The callback function that is triggered when Enter key is pressed | function(e) | - |
|
||||
|
||||
## Methods
|
||||
|
||||
| Name | Description |
|
||||
| ------- | ------------ |
|
||||
| blur() | remove focus |
|
||||
| focus() | get focus |
|
||||
| blur() | Remove focus |
|
||||
| focus() | Get focus |
|
||||
|
||||
## Notes
|
||||
|
||||
|
@ -19,19 +19,19 @@ cover: https://gw.alipayobjects.com/zos/alicdn/XOS8qZ0kU/InputNumber.svg
|
||||
| 成员 | 说明 | 类型 | 默认值 |
|
||||
| --- | --- | --- | --- |
|
||||
| autoFocus | 自动获取焦点 | boolean | false |
|
||||
| defaultValue | 初始值 | number | |
|
||||
| defaultValue | 初始值 | number | - |
|
||||
| disabled | 禁用 | boolean | false |
|
||||
| formatter | 指定输入框展示值的格式 | function(value: number \| string): string | |
|
||||
| formatter | 指定输入框展示值的格式 | function(value: number \| string): string | - |
|
||||
| max | 最大值 | number | [Number.MAX_SAFE_INTEGER](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER) |
|
||||
| min | 最小值 | number | [Number.MIN_SAFE_INTEGER](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Number/MIN_SAFE_INTEGER) |
|
||||
| parser | 指定从 `formatter` 里转换回数字的方式,和 `formatter` 搭配使用 | function(string): number | |
|
||||
| precision | 数值精度 | number | |
|
||||
| decimalSeparator | 小数点 | string | |
|
||||
| parser | 指定从 `formatter` 里转换回数字的方式,和 `formatter` 搭配使用 | function(string): number | - |
|
||||
| precision | 数值精度 | number | - |
|
||||
| decimalSeparator | 小数点 | string | - |
|
||||
| size | 输入框大小 | `large` \| `middle` \| `small` | - |
|
||||
| step | 每次改变步数,可以为小数 | number\|string | 1 |
|
||||
| value | 当前值 | number | |
|
||||
| onChange | 变化回调 | Function(value: number \| string) | |
|
||||
| onPressEnter | 按下回车的回调 | function(e) | |
|
||||
| step | 每次改变步数,可以为小数 | number \| string | 1 |
|
||||
| value | 当前值 | number | - |
|
||||
| onChange | 变化回调 | Function(value: number \| string) | - |
|
||||
| onPressEnter | 按下回车的回调 | function(e) | - |
|
||||
|
||||
## 方法
|
||||
|
||||
|
@ -18,20 +18,20 @@ A basic widget for getting the user input is a text field. Keyboard and mouse ca
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
| --- | --- | --- | --- |
|
||||
| addonAfter | The label text displayed after (on the right side of) the input field. | string\|ReactNode | |
|
||||
| addonBefore | The label text displayed before (on the left side of) the input field. | string\|ReactNode | |
|
||||
| defaultValue | The initial input content | string | |
|
||||
| disabled | Whether the input is disabled. | boolean | false |
|
||||
| id | The ID for input | string | |
|
||||
| maxLength | max length | number | |
|
||||
| prefix | The prefix icon for the Input. | string\|ReactNode | |
|
||||
| size | The size of the input box. Note: in the context of a form, the `large` size is used. | `large` \| `middle` \| `small` | |
|
||||
| suffix | The suffix icon for the Input. | string\|ReactNode | |
|
||||
| type | The type of input, see: [MDN](https://developer.mozilla.org/docs/Web/HTML/Element/input#Form_%3Cinput%3E_types)(use `Input.TextArea` instead of `type="textarea"`) | string | `text` |
|
||||
| value | The input content value | string | |
|
||||
| onChange | callback when user input | function(e) | |
|
||||
| onPressEnter | The callback function that is triggered when Enter key is pressed. | function(e) | |
|
||||
| allowClear | allow to remove input content with clear icon | boolean | |
|
||||
| addonAfter | The label text displayed after (on the right side of) the input field | string \| ReactNode | - |
|
||||
| addonBefore | The label text displayed before (on the left side of) the input field | string \| ReactNode | - |
|
||||
| defaultValue | The initial input content | string | - |
|
||||
| disabled | Whether the input is disabled | boolean | false |
|
||||
| id | The ID for input | string | - |
|
||||
| maxLength | The max length | number | - |
|
||||
| prefix | The prefix icon for the Input | string \| ReactNode | - |
|
||||
| size | The size of the input box. Note: in the context of a form, the `large` size is used | `large` \| `middle` \| `small` | - |
|
||||
| suffix | The suffix icon for the Input | string \| ReactNode | - |
|
||||
| type | The type of input, see: [MDN](https://developer.mozilla.org/docs/Web/HTML/Element/input#Form_%3Cinput%3E_types)( use `Input.TextArea` instead of `type="textarea"`) | string | `text` |
|
||||
| value | The input content value | string | - |
|
||||
| onChange | Callback when user input | function(e) | - |
|
||||
| onPressEnter | The callback function that is triggered when Enter key is pressed | function(e) | - |
|
||||
| allowClear | If allow to remove input content with clear icon | boolean | false |
|
||||
|
||||
> When `Input` is used in a `Form.Item` context, if the `Form.Item` has the `id` and `options` props defined then `value`, `defaultValue`, and `id` props of `Input` are automatically set.
|
||||
|
||||
@ -41,12 +41,12 @@ The rest of the props of Input are exactly the same as the original [input](http
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
| --- | --- | --- | --- |
|
||||
| autoSize | Height autosize feature, can be set to `true|false` or an object `{ minRows: 2, maxRows: 6 }`. | boolean\|object | false |
|
||||
| defaultValue | The initial input content | string | |
|
||||
| value | The input content value | string | |
|
||||
| onPressEnter | The callback function that is triggered when Enter key is pressed. | function(e) | |
|
||||
| allowClear | allow to remove input content with clear icon | boolean | |
|
||||
| onResize | The callback function that is triggered when resize | function({ width, height }) | |
|
||||
| autoSize | Height autosize feature, can be set to true \| false or an object { minRows: 2, maxRows: 6 } | boolean \| object | false |
|
||||
| defaultValue | The initial input content | string | - |
|
||||
| value | The input content value | string | - |
|
||||
| onPressEnter | The callback function that is triggered when Enter key is pressed | function(e) | - |
|
||||
| allowClear | If allow to remove input content with clear icon | boolean | false |
|
||||
| onResize | The callback function that is triggered when resize | function({ width, height }) | - |
|
||||
|
||||
The rest of the props of `Input.TextArea` are the same as the original [textarea](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea).
|
||||
|
||||
@ -54,9 +54,9 @@ The rest of the props of `Input.TextArea` are the same as the original [textarea
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
| --- | --- | --- | --- |
|
||||
| enterButton | to show an enter button after input. This property conflicts with the `addonAfter` property. | boolean\|ReactNode | false |
|
||||
| onSearch | The callback function triggered when you click on the search-icon, the clear-icon or press the Enter key. | function(value, event) | |
|
||||
| loading | Search box with loading. | boolean | |
|
||||
| enterButton | Whether to show an enter button after input. This property conflicts with the `addonAfter` property | boolean \| ReactNode | false |
|
||||
| onSearch | The callback function triggered when you click on the search-icon, the clear-icon or press the Enter key | function(value, event) | - |
|
||||
| loading | Search box with loading | boolean | false |
|
||||
|
||||
Supports all props of `Input`.
|
||||
|
||||
|
@ -19,20 +19,20 @@ cover: https://gw.alipayobjects.com/zos/alicdn/xS9YEJhfe/Input.svg
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
| --- | --- | --- | --- |
|
||||
| addonAfter | 带标签的 input,设置后置标签 | string\|ReactNode | |
|
||||
| addonBefore | 带标签的 input,设置前置标签 | string\|ReactNode | |
|
||||
| defaultValue | 输入框默认内容 | string | |
|
||||
| addonAfter | 带标签的 input,设置后置标签 | string \| ReactNode | - |
|
||||
| addonBefore | 带标签的 input,设置前置标签 | string \| ReactNode | - |
|
||||
| defaultValue | 输入框默认内容 | string | - |
|
||||
| disabled | 是否禁用状态,默认为 false | boolean | false |
|
||||
| id | 输入框的 id | string | |
|
||||
| maxLength | 最大长度 | number | |
|
||||
| prefix | 带有前缀图标的 input | string\|ReactNode | |
|
||||
| size | 控件大小。注:标准表单内的输入框大小限制为 `large`。 | `large` \| `middle` \| `small` | - |
|
||||
| suffix | 带有后缀图标的 input | string\|ReactNode | |
|
||||
| type | 声明 input 类型,同原生 input 标签的 type 属性,见:[MDN](https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/input#属性)(请直接使用 `Input.TextArea` 代替 `type="textarea"`)。 | string | `text` |
|
||||
| value | 输入框内容 | string | |
|
||||
| onChange | 输入框内容变化时的回调 | function(e) | |
|
||||
| onPressEnter | 按下回车的回调 | function(e) | |
|
||||
| allowClear | 可以点击清除图标删除内容 | boolean | |
|
||||
| id | 输入框的 id | string | - |
|
||||
| maxLength | 最大长度 | number | - |
|
||||
| prefix | 带有前缀图标的 input | string \| ReactNode | - |
|
||||
| size | 控件大小。注:标准表单内的输入框大小限制为 `large` | `large` \| `middle` \| `small` | - |
|
||||
| suffix | 带有后缀图标的 input | string \| ReactNode | - |
|
||||
| type | 声明 input 类型,同原生 input 标签的 type 属性,见:[MDN](https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/input#属性)(请直接使用 `Input.TextArea` 代替 `type="textarea"`) | string | `text` |
|
||||
| value | 输入框内容 | string | - |
|
||||
| onChange | 输入框内容变化时的回调 | function(e) | - |
|
||||
| onPressEnter | 按下回车的回调 | function(e) | - |
|
||||
| allowClear | 可以点击清除图标删除内容 | boolean | - |
|
||||
|
||||
> 如果 `Input` 在 `Form.Item` 内,并且 `Form.Item` 设置了 `id` 和 `options` 属性,则 `value` `defaultValue` 和 `id` 属性会被自动设置。
|
||||
|
||||
@ -42,12 +42,12 @@ Input 的其他属性和 React 自带的 [input](https://facebook.github.io/reac
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
| --- | --- | --- | --- |
|
||||
| autoSize | 自适应内容高度,可设置为 `true|false` 或对象:`{ minRows: 2, maxRows: 6 }`。 | boolean\|object | false |
|
||||
| defaultValue | 输入框默认内容 | string | |
|
||||
| value | 输入框内容 | string | |
|
||||
| onPressEnter | 按下回车的回调 | function(e) | |
|
||||
| allowClear | 可以点击清除图标删除内容 | boolean | |
|
||||
| onResize | resize 回调 | function({ width, height }) | |
|
||||
| autoSize | 自适应内容高度,可设置为 true \| false 或对象:{ minRows: 2, maxRows: 6 } | boolean \| object | false |
|
||||
| defaultValue | 输入框默认内容 | string | - |
|
||||
| value | 输入框内容 | string | - |
|
||||
| onPressEnter | 按下回车的回调 | function(e) | - |
|
||||
| allowClear | 可以点击清除图标删除内容 | boolean | false |
|
||||
| onResize | resize 回调 | function({ width, height }) | - |
|
||||
|
||||
`Input.TextArea` 的其他属性和浏览器自带的 [textarea](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea) 一致。
|
||||
|
||||
@ -55,9 +55,9 @@ Input 的其他属性和 React 自带的 [input](https://facebook.github.io/reac
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
| --- | --- | --- | --- |
|
||||
| enterButton | 是否有确认按钮,可设为按钮文字。该属性会与 `addonAfter` 冲突。 | boolean\|ReactNode | false |
|
||||
| onSearch | 点击搜索或按下回车键时的回调 | function(value, event) | |
|
||||
| loading | 搜索 loading | boolean | |
|
||||
| enterButton | 是否有确认按钮,可设为按钮文字。该属性会与 `addonAfter` 冲突。 | boolean \| ReactNode | false |
|
||||
| onSearch | 点击搜索或按下回车键时的回调 | function(value, event) | - |
|
||||
| loading | 搜索 loading | boolean | false |
|
||||
|
||||
其余属性和 Input 一致。
|
||||
|
||||
|
@ -24,33 +24,33 @@ When need to mention someone or something.
|
||||
| Property | Description | Type | Default |
|
||||
| --- | --- | --- | --- |
|
||||
| autoFocus | Auto get focus when component mounted | boolean | false |
|
||||
| defaultValue | Default value | string | |
|
||||
| filterOption | Customize filter option logic | false \| (input: string, option: OptionProps) => boolean | |
|
||||
| notFoundContent | Set mentions content when not match | ReactNode | 'Not Found' |
|
||||
| defaultValue | Default value | string | - |
|
||||
| filterOption | Customize filter option logic | false \| (input: string, option: OptionProps) => boolean | - |
|
||||
| notFoundContent | Set mentions content when not match | ReactNode | `Not Found` |
|
||||
| placement | Set popup placement | `top` \| `bottom` | `bottom` |
|
||||
| prefix | Set trigger prefix keyword | string \| string[] | `@` |
|
||||
| split | Set split string before and after selected mention | string | `` |
|
||||
| validateSearch | Customize trigger search logic | (text: string, props: MentionsProps) => void | |
|
||||
| value | Set value of mentions | string | |
|
||||
| onChange | Trigger when value changed | (text: string) => void | |
|
||||
| onSelect | Trigger when user select the option | (option: OptionProps, prefix: string) => void | |
|
||||
| onSearch | Trigger when prefix hit | (text: string, prefix: string) => void | |
|
||||
| onFocus | Trigger when mentions get focus | () => void | |
|
||||
| onBlur | Trigger when mentions lose focus | () => void | |
|
||||
| getPopupContainer | Set the mount HTML node for suggestions | () => HTMLElement | |
|
||||
| autoSize | Textarea height autosize feature, can be set to `true\|false` or an object `{ minRows: 2, maxRows: 6 }` | boolean \| object | false |
|
||||
| onResize | The callback function that is triggered when textarea resize | function({ width, height }) | |
|
||||
| validateSearch | Customize trigger search logic | (text: string, props: MentionsProps) => void | - |
|
||||
| value | Set value of mentions | string | - |
|
||||
| onChange | Trigger when value changed | (text: string) => void | - |
|
||||
| onSelect | Trigger when user select the option | (option: OptionProps, prefix: string) => void | - |
|
||||
| onSearch | Trigger when prefix hit | (text: string, prefix: string) => void | - |
|
||||
| onFocus | Trigger when mentions get focus | () => void | - |
|
||||
| onBlur | Trigger when mentions lose focus | () => void | - |
|
||||
| getPopupContainer | Set the mount HTML node for suggestions | () => HTMLElement | - |
|
||||
| autoSize | Textarea height autosize feature, can be set to true \| false or an object { minRows: 2, maxRows: 6 } | boolean \| object | false |
|
||||
| onResize | The callback function that is triggered when textarea resize | function({ width, height }) | - |
|
||||
|
||||
### Mention methods
|
||||
|
||||
| Name | Description |
|
||||
| ------- | ------------ |
|
||||
| blur() | remove focus |
|
||||
| focus() | get focus |
|
||||
| blur() | Remove focus |
|
||||
| focus() | Get focus |
|
||||
|
||||
### Option
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
| --- | --- | --- | --- |
|
||||
| children | suggestion content | ReactNode | |
|
||||
| value | value of suggestion, the value will insert into input filed while selected | string | |
|
||||
| children | Suggestion content | ReactNode | - |
|
||||
| value | The value of suggestion, the value will insert into input filed while selected | string | - |
|
||||
|
@ -25,22 +25,22 @@ cover: https://gw.alipayobjects.com/zos/alicdn/jPE-itMFM/Mentions.svg
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
| --- | --- | --- | --- |
|
||||
| autoFocus | 自动获得焦点 | boolean | false |
|
||||
| defaultValue | 默认值 | string | |
|
||||
| filterOption | 自定义过滤逻辑 | false \| (input: string, option: OptionProps) => boolean | |
|
||||
| notFoundContent | 当下拉列表为空时显示的内容 | ReactNode | 'Not Found' |
|
||||
| defaultValue | 默认值 | string | - |
|
||||
| filterOption | 自定义过滤逻辑 | false \| (input: string, option: OptionProps) => boolean | - |
|
||||
| notFoundContent | 当下拉列表为空时显示的内容 | ReactNode | `Not Found` |
|
||||
| placement | 弹出层展示位置 | `top` \| `bottom` | `bottom` |
|
||||
| prefix | 设置触发关键字 | string \| string[] | `@` |
|
||||
| split | 设置选中项前后分隔符 | string | `` |
|
||||
| validateSearch | 自定义触发验证逻辑 | (text: string, props: MentionsProps) => void | |
|
||||
| value | 设置值 | string | |
|
||||
| onChange | 值改变时触发 | (text: string) => void | |
|
||||
| onSelect | 选择选项时触发 | (option: OptionProps, prefix: string) => void | |
|
||||
| onSearch | 搜索时触发 | (text: string, prefix: string) => void | |
|
||||
| onFocus | 获得焦点时触发 | () => void | |
|
||||
| onBlur | 失去焦点时触发 | () => void | |
|
||||
| getPopupContainer | 指定建议框挂载的 HTML 节点 | () => HTMLElement | |
|
||||
| autoSize | 自适应内容高度,可设置为 `true|false` 或对象:`{ minRows: 2, maxRows: 6 }`。 | boolean\|object | false |
|
||||
| onResize | resize 回调 | function({ width, height }) | |
|
||||
| validateSearch | 自定义触发验证逻辑 | (text: string, props: MentionsProps) => void | - |
|
||||
| value | 设置值 | string | - |
|
||||
| onChange | 值改变时触发 | (text: string) => void | - |
|
||||
| onSelect | 选择选项时触发 | (option: OptionProps, prefix: string) => void | - |
|
||||
| onSearch | 搜索时触发 | (text: string, prefix: string) => void | - |
|
||||
| onFocus | 获得焦点时触发 | () => void | - |
|
||||
| onBlur | 失去焦点时触发 | () => void | - |
|
||||
| getPopupContainer | 指定建议框挂载的 HTML 节点 | () => HTMLElement | - |
|
||||
| autoSize | 自适应内容高度,可设置为 true \| false 或对象:{ minRows: 2, maxRows: 6 } | boolean \| object | false |
|
||||
| onResize | resize 回调 | function({ width, height }) | - |
|
||||
|
||||
### Mentions 方法
|
||||
|
||||
@ -53,5 +53,5 @@ cover: https://gw.alipayobjects.com/zos/alicdn/jPE-itMFM/Mentions.svg
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
| -------- | -------------- | --------- | ------ |
|
||||
| children | 选项内容 | ReactNode | |
|
||||
| value | 选择时填充的值 | string | |
|
||||
| children | 选项内容 | ReactNode | - |
|
||||
| value | 选择时填充的值 | string | - |
|
||||
|
Loading…
Reference in New Issue
Block a user