mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-11-29 18:50:00 +08:00
feat: Input
、TextArea
、Mentions
support onClear prop (#49905)
* feat: Input support onClear * chore: lint * chore: lint * Update package.json Signed-off-by: lijianan <574980606@qq.com> * docs: update docs * fix: fix * Update package.json Signed-off-by: lijianan <574980606@qq.com> * Update package.json Signed-off-by: lijianan <574980606@qq.com> * chore: fix * chore: fix * chore: fix * feat: test * feat: 1.6.2 --------- Signed-off-by: lijianan <574980606@qq.com> Co-authored-by: 叶枫 <645381995@qq.com>
This commit is contained in:
parent
21194da96a
commit
a134dbb07c
@ -124,10 +124,12 @@ describe('Input.Search', () => {
|
||||
const { container } = render(<Search defaultValue="search text" onSearch={onSearch} />);
|
||||
fireEvent.compositionStart(container.querySelector('input')!);
|
||||
fireEvent.keyDown(container.querySelector('input')!, { key: 'Enter', keyCode: 13 });
|
||||
fireEvent.keyUp(container.querySelector('input')!, { key: 'Enter', keyCode: 13 });
|
||||
expect(onSearch).not.toHaveBeenCalled();
|
||||
|
||||
fireEvent.compositionEnd(container.querySelector('input')!);
|
||||
fireEvent.keyDown(container.querySelector('input')!, { key: 'Enter', keyCode: 13 });
|
||||
fireEvent.keyUp(container.querySelector('input')!, { key: 'Enter', keyCode: 13 });
|
||||
expect(onSearch).toHaveBeenCalledTimes(1);
|
||||
expect(onSearch).toHaveBeenCalledWith('search text', expect.anything(), { source: 'input' });
|
||||
});
|
||||
|
@ -71,6 +71,7 @@ Common props ref:[Common props](/docs/react/common-props)
|
||||
| variant | Variants of Input | `outlined` \| `borderless` \| `filled` | `outlined` | 5.13.0 |
|
||||
| onChange | Callback when user input | function(e) | - | |
|
||||
| onPressEnter | The callback function that is triggered when Enter key is pressed | function(e) | - | |
|
||||
| onClear | Callback when click the clear button | () => void | - | 5.20.0 |
|
||||
|
||||
> When `Input` is used in a `Form.Item` context, if the `Form.Item` has the `id` props defined then `value`, `defaultValue`, and `id` props of `Input` are automatically set.
|
||||
|
||||
|
@ -72,6 +72,7 @@ demo:
|
||||
| variant | 形态变体 | `outlined` \| `borderless` \| `filled` | `outlined` | 5.13.0 |
|
||||
| onChange | 输入框内容变化时的回调 | function(e) | - | |
|
||||
| onPressEnter | 按下回车的回调 | function(e) | - | |
|
||||
| onClear | 按下清除按钮的回调 | () => void | - | 5.20.0 |
|
||||
|
||||
> 如果 `Input` 在 `Form.Item` 内,并且 `Form.Item` 设置了 `id` 属性,则 `value` `defaultValue` 和 `id` 属性会被自动设置。
|
||||
|
||||
|
@ -74,6 +74,7 @@ Common props ref:[Common props](/docs/react/common-props)
|
||||
| variant | Variants of Input | `outlined` \| `borderless` \| `filled` | `outlined` | 5.13.0 |
|
||||
| onBlur | Trigger when mentions lose focus | () => void | - | |
|
||||
| onChange | Trigger when value changed | (text: string) => void | - | |
|
||||
| onClear | Callback when click the clear button | () => void | - | 5.20.0 |
|
||||
| onFocus | Trigger when mentions get focus | () => void | - | |
|
||||
| onResize | The callback function that is triggered when textarea resize | function({ width, height }) | - | |
|
||||
| onSearch | Trigger when prefix hit | (text: string, prefix: string) => void | - | |
|
||||
|
@ -75,6 +75,7 @@ return (
|
||||
| variant | 形态变体 | `outlined` \| `borderless` \| `filled` | `outlined` | 5.13.0 |
|
||||
| onBlur | 失去焦点时触发 | () => void | - | |
|
||||
| onChange | 值改变时触发 | (text: string) => void | - | |
|
||||
| onClear | 按下清除按钮的回调 | () => void | - | 5.20.0 |
|
||||
| onFocus | 获得焦点时触发 | () => void | - | |
|
||||
| onResize | resize 回调 | function({ width, height }) | - | |
|
||||
| onSearch | 搜索时触发 | (text: string, prefix: string) => void | - | |
|
||||
|
@ -121,9 +121,9 @@
|
||||
"rc-dropdown": "~4.2.0",
|
||||
"rc-field-form": "~2.2.1",
|
||||
"rc-image": "~7.9.0",
|
||||
"rc-input": "~1.5.1",
|
||||
"rc-input-number": "~9.1.0",
|
||||
"rc-mentions": "~2.14.0",
|
||||
"rc-input": "~1.6.2",
|
||||
"rc-input-number": "~9.2.0",
|
||||
"rc-mentions": "~2.15.0",
|
||||
"rc-menu": "~9.14.1",
|
||||
"rc-motion": "^2.9.2",
|
||||
"rc-notification": "~5.6.0",
|
||||
@ -139,7 +139,7 @@
|
||||
"rc-switch": "~4.1.0",
|
||||
"rc-table": "~7.45.7",
|
||||
"rc-tabs": "~15.1.1",
|
||||
"rc-textarea": "~1.7.0",
|
||||
"rc-textarea": "~1.8.1",
|
||||
"rc-tooltip": "~6.2.0",
|
||||
"rc-tree": "~5.8.8",
|
||||
"rc-tree-select": "~5.22.1",
|
||||
|
Loading…
Reference in New Issue
Block a user