Skip to content

Commit

Permalink
chore: bump rc-table to v7.45.0 (ant-design#48190)
Browse files Browse the repository at this point in the history
* chore: bump rc-table to v7.45.0

* feat: 补充类型

* feat: 补充类型

---------

Co-authored-by: 叶枫 <[email protected]>
  • Loading branch information
MadCcc and crazyair authored Mar 31, 2024
1 parent 7258fa8 commit 7b280d3
Show file tree
Hide file tree
Showing 15 changed files with 38 additions and 26 deletions.
10 changes: 8 additions & 2 deletions components/config-provider/demo/locale.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import React, { useState } from 'react';
import { EllipsisOutlined } from '@ant-design/icons';
import type { ConfigProviderProps, RadioChangeEvent, TourProps, UploadFile } from 'antd';
import type {
ConfigProviderProps,
RadioChangeEvent,
TableProps,
TourProps,
UploadFile,
} from 'antd';
import {
Button,
Calendar,
Expand Down Expand Up @@ -38,7 +44,7 @@ dayjs.locale('en');
const { Option } = Select;
const { RangePicker } = DatePicker;

const columns = [
const columns: TableProps['columns'] = [
{
title: 'Name',
dataIndex: 'name',
Expand Down
4 changes: 2 additions & 2 deletions components/descriptions/demo/text.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Badge, Descriptions, Table } from 'antd';
import type { DescriptionsProps } from 'antd';
import type { DescriptionsProps, TableProps } from 'antd';

const dataSource = [
{
Expand All @@ -17,7 +17,7 @@ const dataSource = [
},
];

const columns = [
const columns: TableProps['columns'] = [
{
title: '姓名',
dataIndex: 'name',
Expand Down
16 changes: 10 additions & 6 deletions components/locale/__tests__/index.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable react/no-multi-comp */
import dayjs from 'dayjs';

import 'dayjs/locale/ar';
import 'dayjs/locale/az';
import 'dayjs/locale/be';
Expand Down Expand Up @@ -65,10 +66,11 @@ import 'dayjs/locale/uz-latn';
import 'dayjs/locale/zh-cn';
import 'dayjs/locale/zh-hk';
import 'dayjs/locale/zh-tw';

import React from 'react';
import preParsePostFormat from 'dayjs/plugin/preParsePostFormat';
import MockDate from 'mockdate';
import React from 'react';
import { render } from '../../../tests/utils';

import type { Locale } from '..';
import LocaleProvider from '..';
import {
Expand All @@ -79,10 +81,12 @@ import {
Popconfirm,
Select,
Table,
TableProps,
TimePicker,
Transfer,
} from '../..';
import mountTest from '../../../tests/shared/mountTest';
import { render } from '../../../tests/utils';
import arEG from '../../locale/ar_EG';
import azAZ from '../../locale/az_AZ';
import bgBG from '../../locale/bg_BG';
Expand Down Expand Up @@ -116,8 +120,8 @@ import itIT from '../../locale/it_IT';
import jaJP from '../../locale/ja_JP';
import kaGE from '../../locale/ka_GE';
import kkKZ from '../../locale/kk_KZ';
import kmrIQ from '../../locale/kmr_IQ';
import kmKH from '../../locale/km_KH';
import kmrIQ from '../../locale/kmr_IQ';
import knIN from '../../locale/kn_IN';
import koKR from '../../locale/ko_KR';
import kuIQ from '../../locale/ku_IQ';
Expand All @@ -127,6 +131,7 @@ import mkMK from '../../locale/mk_MK';
import mlIN from '../../locale/ml_IN';
import mnMN from '../../locale/mn_MN';
import msMY from '../../locale/ms_MY';
import myMM from '../../locale/my_MM';
import nbNO from '../../locale/nb_NO';
import neNP from '../../locale/ne_NP';
import nlBE from '../../locale/nl_BE';
Expand All @@ -147,12 +152,11 @@ import tkTK from '../../locale/tk_TK';
import trTR from '../../locale/tr_TR';
import ukUA from '../../locale/uk_UA';
import urPK from '../../locale/ur_PK';
import uzUZ from '../../locale/uz_UZ';
import viVN from '../../locale/vi_VN';
import zhCN from '../../locale/zh_CN';
import zhHK from '../../locale/zh_HK';
import zhTW from '../../locale/zh_TW';
import myMM from '../../locale/my_MM';
import uzUZ from '../../locale/uz_UZ';

dayjs.extend(preParsePostFormat);

Expand Down Expand Up @@ -232,7 +236,7 @@ const locales = [
const { Option } = Select;
const { RangePicker } = DatePicker;

const columns = [
const columns: TableProps['columns'] = [
{
title: 'Name',
dataIndex: 'name',
Expand Down
4 changes: 3 additions & 1 deletion components/table/__tests__/Table.expand.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
/* eslint-disable react/no-multi-comp */
import React from 'react';

import type { TableProps } from '..';
import Table from '..';
import { fireEvent, render } from '../../../tests/utils';

const columns = [
const columns: TableProps['columns'] = [
{
title: 'Name',
key: 'name',
Expand Down
4 changes: 2 additions & 2 deletions components/table/__tests__/Table.filter.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1392,7 +1392,7 @@ describe('Table.filter', () => {
const onChange = jest.fn();

const { container } = render(
<Table
<Table<{ name?: string; gender?: string }>
columns={[
{
title: 'Name',
Expand Down Expand Up @@ -1506,7 +1506,7 @@ describe('Table.filter', () => {
it('filtered should work after change', () => {
const App: React.FC = () => {
const [filtered, setFiltered] = React.useState(true);
const columns = [
const columns: TableProps['columns'] = [
{
title: 'Name',
dataIndex: 'name',
Expand Down
2 changes: 1 addition & 1 deletion components/table/__tests__/Table.rowSelection.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('Table.rowSelection', () => {
errorSpy.mockRestore();
});

const columns = [
const columns: TableProps['columns'] = [
{
title: 'Name',
dataIndex: 'name',
Expand Down
2 changes: 1 addition & 1 deletion components/table/__tests__/Table.sorter.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ describe('Table.sorter', () => {

// https://github.com/ant-design/ant-design/pull/12264#discussion_r218053034
it('should sort from beginning state when toggle from different columns', () => {
const columns = [
const columns: TableProps['columns'] = [
{ title: 'name', dataIndex: 'name', sorter: true },
{ title: 'age', dataIndex: 'age', sorter: true },
];
Expand Down
6 changes: 3 additions & 3 deletions components/table/__tests__/Table.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ describe('Table', () => {

it('should not crash when column children is empty', () => {
render(
<Table
<Table<{ name?: string }>
columns={[
{
dataIndex: 'name',
Expand All @@ -163,7 +163,7 @@ describe('Table', () => {
// prevent touch event, 原来的用例感觉是少了 touchmove 调用判断
const touchmove = jest.fn();
const { container } = render(
<Table
<Table<{ name?: string }>
columns={[
{
dataIndex: 'name',
Expand Down Expand Up @@ -332,7 +332,7 @@ describe('Table', () => {

it('title should support ReactNode', () => {
const { container } = render(
<Table
<Table<{ name?: string }>
columns={[
{
title: (
Expand Down
3 changes: 2 additions & 1 deletion components/table/demo/edit-row.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useState } from 'react';
import type { TableProps } from 'antd';
import { Form, Input, InputNumber, Popconfirm, Table, Typography } from 'antd';

interface Item {
Expand Down Expand Up @@ -143,7 +144,7 @@ const App: React.FC = () => {
},
];

const mergedColumns = columns.map((col) => {
const mergedColumns: TableProps['columns'] = columns.map((col) => {
if (!col.editable) {
return col;
}
Expand Down
4 changes: 2 additions & 2 deletions components/table/demo/nest-table-border-debug.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState } from 'react';
import { DownOutlined } from '@ant-design/icons';
import type { TableColumnsType } from 'antd';
import type { TableColumnsType, TableProps } from 'antd';
import { Badge, Dropdown, Form, Space, Switch, Table } from 'antd';

interface DataType {
Expand All @@ -27,7 +27,7 @@ const items = [

const App: React.FC = () => {
const createExpandedRowRender = (bordered: boolean) => () => {
const columns = [
const columns: TableProps['columns'] = [
{ title: 'Date', dataIndex: 'date', key: 'date' },
{ title: 'Name', dataIndex: 'name', key: 'name' },
{
Expand Down
1 change: 0 additions & 1 deletion components/table/demo/nested-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ const App: React.FC = () => {
{ title: 'Upgrade Status', dataIndex: 'upgradeNum', key: 'upgradeNum' },
{
title: 'Action',
dataIndex: 'operation',
key: 'operation',
render: () => (
<Space size="middle">
Expand Down
2 changes: 1 addition & 1 deletion components/table/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export interface ColumnGroupType<RecordType> extends Omit<ColumnType<RecordType>
children: ColumnsType<RecordType>;
}

export type ColumnsType<RecordType = unknown> = (
export type ColumnsType<RecordType = any> = (
| ColumnGroupType<RecordType>
| ColumnType<RecordType>
)[];
Expand Down
2 changes: 1 addition & 1 deletion components/transfer/demo/component-token.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const leftTableColumns: TableColumnsType<DataType> = [
},
];

const rightTableColumns: TableColumnsType<Pick<DataType, 'title'>> = [
const rightTableColumns: TableColumnsType<DataType> = [
{
dataIndex: 'title',
title: 'Name',
Expand Down
2 changes: 1 addition & 1 deletion components/transfer/demo/table-transfer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const leftTableColumns: TableColumnsType<DataType> = [
},
];

const rightTableColumns: TableColumnsType<Pick<DataType, 'title'>> = [
const rightTableColumns: TableColumnsType<DataType> = [
{
dataIndex: 'title',
title: 'Name',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
"rc-slider": "~10.5.0",
"rc-steps": "~6.0.1",
"rc-switch": "~4.1.0",
"rc-table": "~7.44.0",
"rc-table": "~7.45.0",
"rc-tabs": "~14.1.1",
"rc-textarea": "~1.6.3",
"rc-tooltip": "~6.2.0",
Expand Down

0 comments on commit 7b280d3

Please sign in to comment.