pro-components icon indicating copy to clipboard operation
pro-components copied to clipboard

🐛[BUG] [antd: Select] `bordered` is deprecated. Please use `variant` instead.

Open baiwusanyu-c opened this issue 1 year ago • 16 comments

提问前先看看: https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md

🐛 bug 描述

I created a react project using Vite and copied the demo code from the official website into the project, but the browser got an error image

📷 复现步骤

I created a react project using Vite and copied the demo code from the official website into the project, but the browser got an error

🏞 期望结果

No error reported

💻 复现代码

import { EllipsisOutlined, SearchOutlined } from '@ant-design/icons';
import type { ProColumns } from '@ant-design/pro-components';
import { ProTable, TableDropdown } from '@ant-design/pro-components';
import { Button, Dropdown, Input } from 'antd';

const valueEnum = {
  0: 'close',
  1: 'running',
  2: 'online',
  3: 'error',
};

export type TableListItem = {
  key: number;
  name: string;
  containers: number;
  creator: string;
  status: string;
  createdAt: number;
  progress: number;
  money: number;
  memo: string;
};
const tableListDataSource: TableListItem[] = [];

const creators = ['付小小', '曲丽丽', '林东东', '陈帅帅', '兼某某'];

for (let i = 0; i < 5; i += 1) {
  tableListDataSource.push({
    key: i,
    name: 'AppName',
    containers: Math.floor(Math.random() * 20),
    creator: creators[Math.floor(Math.random() * creators.length)],
    status: valueEnum[((Math.floor(Math.random() * 10) % 4) + '') as '0'],
    createdAt: Date.now() - Math.floor(Math.random() * 2000),
    money: Math.floor(Math.random() * 2000) * i,
    progress: Math.ceil(Math.random() * 100) + 1,
    memo:
      i % 2 === 1
        ? '很长很长很长很长很长很长很长的文字要展示但是要留下尾巴'
        : '简短备注文案',
  });
}

const columns: ProColumns<TableListItem>[] = [
  {
    title: '排序',
    dataIndex: 'index',
    valueType: 'indexBorder',
    width: 48,
  },
  {
    title: '应用名称',
    dataIndex: 'name',
    render: (_) => <a>{_}</a>,
    // 自定义筛选项功能具体实现请参考 https://ant.design/components/table-cn/#components-table-demo-custom-filter-panel
    filterDropdown: () => (
      <div style={{ padding: 8 }}>
        <Input style={{ width: 188, marginBlockEnd: 8, display: 'block' }} />
      </div>
    ),
    filterIcon: (filtered) => (
      <SearchOutlined style={{ color: filtered ? '#1890ff' : undefined }} />
    ),
  },
  {
    title: '创建者',
    dataIndex: 'creator',
    valueEnum: {
      all: { text: '全部' },
      付小小: { text: '付小小' },
      曲丽丽: { text: '曲丽丽' },
      林东东: { text: '林东东' },
      陈帅帅: { text: '陈帅帅' },
      兼某某: { text: '兼某某' },
    },
  },
  {
    title: '状态',
    dataIndex: 'status',
    initialValue: 'all',
    filters: true,
    onFilter: true,
    valueEnum: {
      all: { text: '全部', status: 'Default' },
      close: { text: '关闭', status: 'Default' },
      running: { text: '运行中', status: 'Processing' },
      online: { text: '已上线', status: 'Success' },
      error: { text: '异常', status: 'Error' },
    },
  },
  {
    title: '备注',
    dataIndex: 'memo',
    ellipsis: true,
    copyable: true,
  },
  {
    title: '操作',
    width: 180,
    key: 'option',
    valueType: 'option',
    render: () => [
      <a key="link">链路</a>,
      <a key="link2">报警</a>,
      <a key="link3">监控</a>,
      <TableDropdown
        key="actionGroup"
        menus={[
          { key: 'copy', name: '复制' },
          { key: 'delete', name: '删除' },
        ]}
      />,
    ],
  },
];

export default () => {
  return (
    <ProTable<TableListItem>
      columns={columns}
      request={(params, sorter, filter) => {
        // 表单搜索项会从 params 传入,传递给后端接口。
        console.log(params, sorter, filter);
        return Promise.resolve({
          data: tableListDataSource,
          success: true,
        });
      }}
      rowKey="key"
      pagination={{
        showQuickJumper: true,
      }}
      search={{
        layout: 'vertical',
        defaultCollapsed: false,
      }}
      dateFormatter="string"
      toolbar={{
        title: '高级表格',
        tooltip: '这是一个标题提示',
      }}
      toolBarRender={() => [
        <Button key="danger" danger>
          危险按钮
        </Button>,
        <Button key="show">查看日志</Button>,
        <Button type="primary" key="primary">
          创建应用
        </Button>,

        <Dropdown
          key="menu"
          menu={{
            items: [
              {
                label: '1st item',
                key: '1',
              },
              {
                label: '2nd item',
                key: '2',
              },
              {
                label: '3rd item',
                key: '3',
              },
            ],
          }}
        >
          <Button>
            <EllipsisOutlined />
          </Button>
        </Dropdown>,
      ]}
    />
  );
};

© 版本信息

  • ProComponents 版本: [latest]
  • umi 版本
  • 浏览器环境 122.0.6238.2
  • 开发环境 [win10]

🚑 其他信息

baiwusanyu-c avatar Jan 16 '24 04:01 baiwusanyu-c

this API should be retained for compatibility with antd 4, so ignore it for now hahah

ONLY-yours avatar Jan 18 '24 08:01 ONLY-yours

I also have this problem,but I am using ProForm

yq756530939 avatar Jan 18 '24 08:01 yq756530939

+1

leshalv avatar Jan 24 '24 00:01 leshalv

应该可以通过 compareVersions(version, '4.23.0') < 0 判断来做兼容吧。 @ONLY-yours

leshalv avatar Jan 25 '24 01:01 leshalv

+1

lyt8384 avatar Jan 25 '24 04:01 lyt8384

应该可以通过 compareVersions(version, '4.23.0') < 0 判断来做兼容吧。 @ONLY-yours

抱歉说错了,看起来是 antd 5 的某个版本升上去了额,确实可以通过这个版本进行兼容 :) image

ONLY-yours avatar Jan 25 '24 08:01 ONLY-yours

@ONLY-yours 5x版本还需要做兼容判断吗?

leshalv avatar Jan 28 '24 15:01 leshalv

++++1 ProFormSelect

donknap avatar Jan 31 '24 07:01 donknap

要低于antD 5.13.0 image

WuYiZhan avatar Feb 01 '24 08:02 WuYiZhan

什么时候修复

hggq avatar Feb 17 '24 05:02 hggq

已经修复了,等待发版 https://github.com/ant-design/pro-components/issues/8089 https://github.com/ant-design/pro-components/commit/ddf0c82b5a9e55546c1b864e76972621b501769b

leshalv avatar Feb 18 '24 03:02 leshalv

variant={'borderless or filled or outline'}

Imuhammadtaha avatar Feb 20 '24 20:02 Imuhammadtaha

目前已是最新版本,依然报这个错误

codedart2018 avatar Mar 26 '24 09:03 codedart2018

已经修复了,等待发版 #8089 ddf0c82

现在3.26最新版本依然有问题,是否有发版!

codedart2018 avatar Mar 26 '24 09:03 codedart2018

目前已是最新版本,依然报这个错误

    "@ant-design/pro-components": "^2.7.10",
    "antd": "^5.18.3",

wesleywu avatar Jun 20 '24 11:06 wesleywu