mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 06:03:38 +08:00
commit
d595229d6b
@ -46,6 +46,7 @@ The differences with Select are:
|
||||
| onFocus | Called when entering the component | function() | - | |
|
||||
| onSearch | Called when searching items | function(value) | - | |
|
||||
| onSelect | Called when a option is selected. param is option's value and option instance | function(value, option) | - | |
|
||||
| onClear | Called when clear | function | - | 4.6.0 |
|
||||
|
||||
## Methods
|
||||
|
||||
|
@ -48,6 +48,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/qtJm4yt45/AutoComplete.svg
|
||||
| onFocus | 获得焦点时的回调 | function() | - | |
|
||||
| onSearch | 搜索补全项的时候调用 | function(value) | - | |
|
||||
| onSelect | 被选中时调用,参数为选中项的 value 值 | function(value, option) | - | |
|
||||
| onClear | 清除内容时回调 | function | - | 4.6.0 |
|
||||
|
||||
## 方法
|
||||
|
||||
|
@ -196,6 +196,8 @@ const Input = forwardRef<InputRef, InputProps>((props, ref) => {
|
||||
</>
|
||||
);
|
||||
|
||||
const withPrefixSuffix = hasPrefixSuffix(props) || hasFeedback;
|
||||
|
||||
return (
|
||||
<RcInput
|
||||
ref={composeRef(ref, inputRef)}
|
||||
@ -207,13 +209,13 @@ const Input = forwardRef<InputRef, InputProps>((props, ref) => {
|
||||
suffix={suffixNode}
|
||||
clearIcon={<CloseCircleFilled />}
|
||||
inputClassName={classNames(
|
||||
{
|
||||
!withPrefixSuffix && {
|
||||
[`${prefixCls}-sm`]: mergedSize === 'small',
|
||||
[`${prefixCls}-lg`]: mergedSize === 'large',
|
||||
[`${prefixCls}-rtl`]: direction === 'rtl',
|
||||
[`${prefixCls}-borderless`]: !bordered,
|
||||
},
|
||||
getStatusClassNames(prefixCls, mergedStatus),
|
||||
!withPrefixSuffix && getStatusClassNames(prefixCls, mergedStatus),
|
||||
)}
|
||||
affixWrapperClassName={classNames(
|
||||
{
|
||||
|
@ -1964,6 +1964,34 @@ describe('Table.filter', () => {
|
||||
expect(wrapper.find('.ant-tree-checkbox').at(0).hasClass('ant-tree-checkbox-checked')).toBe(
|
||||
true,
|
||||
);
|
||||
expect(wrapper.find('.ant-table-filter-dropdown-checkall .ant-checkbox').hasClass('ant-checkbox-indeterminate')).toBe(true);
|
||||
});
|
||||
|
||||
it('select-all checkbox should change when all items are selected', () => {
|
||||
jest.useFakeTimers();
|
||||
jest.spyOn(console, 'error').mockImplementation(() => undefined);
|
||||
const wrapper = mount(
|
||||
createTable({
|
||||
columns: [
|
||||
{
|
||||
...column,
|
||||
filterMode: 'tree',
|
||||
filters: [
|
||||
{ text: 'Boy', value: 'boy' },
|
||||
{ text: 'Girl', value: 'girl' },
|
||||
],
|
||||
},
|
||||
],
|
||||
}),
|
||||
);
|
||||
wrapper.find('span.ant-dropdown-trigger').simulate('click', nativeEvent);
|
||||
act(() => {
|
||||
jest.runAllTimers();
|
||||
wrapper.update();
|
||||
});
|
||||
wrapper.find('.ant-tree-node-content-wrapper').at(0).simulate('click');
|
||||
wrapper.find('.ant-tree-node-content-wrapper').at(1).simulate('click');
|
||||
expect(wrapper.find('.ant-table-filter-dropdown-checkall .ant-checkbox').hasClass('ant-checkbox-checked')).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -326,6 +326,11 @@ function FilterDropdown<RecordType>(props: FilterDropdownProps<RecordType>) {
|
||||
<div className={`${tablePrefixCls}-filter-dropdown-tree`}>
|
||||
{filterMultiple ? (
|
||||
<Checkbox
|
||||
checked={selectedKeys.length === flattenKeys(column.filters).length}
|
||||
indeterminate={
|
||||
selectedKeys.length > 0 &&
|
||||
selectedKeys.length < flattenKeys(column.filters).length
|
||||
}
|
||||
className={`${tablePrefixCls}-filter-dropdown-checkall`}
|
||||
onChange={onCheckAll}
|
||||
>
|
||||
|
@ -129,7 +129,7 @@
|
||||
"rc-dropdown": "~3.3.2",
|
||||
"rc-field-form": "~1.23.0",
|
||||
"rc-image": "~5.2.5",
|
||||
"rc-input": "^0.0.1-alpha.3",
|
||||
"rc-input": "^0.0.1-alpha.4",
|
||||
"rc-input-number": "~7.3.0",
|
||||
"rc-mentions": "~1.6.1",
|
||||
"rc-menu": "~9.2.1",
|
||||
|
Loading…
Reference in New Issue
Block a user