Browse Source
chore: auto merge branchs (#34306)
chore: sync feature into master
pull/34302/head
github-actions[bot]
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with
40 additions and
3 deletions
-
components/auto-complete/index.en-US.md
-
components/auto-complete/index.zh-CN.md
-
components/input/Input.tsx
-
components/table/__tests__/Table.filter.test.js
-
components/table/hooks/useFilter/FilterDropdown.tsx
-
package.json
|
|
@ -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", |
|
|
|