mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 14:13:37 +08:00
Revert "bug: fix-table-bug ref filters" (#49600)
This reverts commit 7790934b0b
.
This commit is contained in:
parent
a15fcfa1dc
commit
ff7fea18f3
@ -5,7 +5,7 @@ import React, { useEffect, useState } from 'react';
|
||||
import type { ColumnGroupType, ColumnType, TableProps } from '..';
|
||||
import Table from '..';
|
||||
import { resetWarned } from '../../_util/warning';
|
||||
import { act, fireEvent, render, waitFakeTimer, waitFor } from '../../../tests/utils';
|
||||
import { act, fireEvent, render, waitFor } from '../../../tests/utils';
|
||||
import Button from '../../button';
|
||||
import ConfigProvider from '../../config-provider';
|
||||
import Input from '../../input';
|
||||
@ -2947,43 +2947,4 @@ describe('Table.filter', () => {
|
||||
fireEvent.click(container.querySelector('.ant-dropdown-trigger')!);
|
||||
expect(handleChange).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('Fixed the problem that the custom global component did not take effect in the filter', async () => {
|
||||
const customizeRenderEmpty = jest.fn<string, any, any>(() => 'Data Not Found');
|
||||
const { container } = render(
|
||||
<ConfigProvider renderEmpty={customizeRenderEmpty}>
|
||||
<Table
|
||||
columns={[
|
||||
{
|
||||
title: 'Name',
|
||||
dataIndex: 'name',
|
||||
key: 'name',
|
||||
filters: [], // empty filters
|
||||
onFilter: filterFn,
|
||||
},
|
||||
{
|
||||
title: 'Age',
|
||||
dataIndex: 'age',
|
||||
key: 'age',
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</ConfigProvider>,
|
||||
);
|
||||
|
||||
// Open Filter
|
||||
fireEvent.click(container.querySelector('span.ant-dropdown-trigger')!);
|
||||
act(() => {
|
||||
jest.runAllTimers();
|
||||
});
|
||||
|
||||
await waitFakeTimer();
|
||||
|
||||
expect(container.querySelector('.ant-table-filter-dropdown')).toHaveTextContent(
|
||||
'Data Not Found',
|
||||
);
|
||||
|
||||
expect(customizeRenderEmpty).toHaveBeenCalled();
|
||||
expect(customizeRenderEmpty.mock.calls[0][0]).toEqual('Table');
|
||||
});
|
||||
});
|
||||
|
@ -350,8 +350,6 @@ function FilterDropdown<RecordType>(props: FilterDropdownProps<RecordType>) {
|
||||
|
||||
let dropdownContent: React.ReactNode;
|
||||
|
||||
const { direction, renderEmpty } = React.useContext(ConfigContext);
|
||||
|
||||
if (typeof column.filterDropdown === 'function') {
|
||||
dropdownContent = column.filterDropdown({
|
||||
prefixCls: `${dropdownPrefixCls}-custom`,
|
||||
@ -370,7 +368,7 @@ function FilterDropdown<RecordType>(props: FilterDropdownProps<RecordType>) {
|
||||
} else {
|
||||
const selectedKeys = getFilteredKeysSync() || [];
|
||||
const getFilterComponent = () => {
|
||||
const empty = renderEmpty?.('Table') || (
|
||||
const empty = (
|
||||
<Empty
|
||||
image={Empty.PRESENTED_IMAGE_SIMPLE}
|
||||
description={locale.filterEmptyText}
|
||||
@ -526,6 +524,8 @@ function FilterDropdown<RecordType>(props: FilterDropdownProps<RecordType>) {
|
||||
filterIcon = <FilterFilled />;
|
||||
}
|
||||
|
||||
const { direction } = React.useContext(ConfigContext);
|
||||
|
||||
return (
|
||||
<div className={`${prefixCls}-column`}>
|
||||
<span className={`${tablePrefixCls}-column-title`}>{children}</span>
|
||||
|
Loading…
Reference in New Issue
Block a user