Giter VIP home page Giter VIP logo

pro-components's Introduction

ProComponents

Designed for Enterprise-Level Application, Use Ant Design like a Pro!



English · 简体中文 · Report Bug · Request Feature

Table of contents

TOC

📦 Installation

To install @ant-design/pro-components, run the following command:

$ pnpm install @ant-design/pro-components

✨ Features

Pro Series components are meticulously engineered to bolster the robust architecture of enterprise-grade applications.


Empowering Features of ProComponents

Note

ProComponents stands as a beacon for React-based enterprise application development. Here’s what makes it exceptional:

  • 💡 Extensive Component Suite: ProComponents boasts a comprehensive array of UI elements—ranging from tables and forms to charts and tree views. It caters to the diverse needs of enterprise applications with finesse.
  • 🚀 Advanced Functionality: Beyond basic UI elements, ProComponents is equipped with sophisticated data handling and business logic capabilities, enabling developers to swiftly construct powerful enterprise solutions.
  • 🎯 Intuitive Usage: With its straightforward API and detailed documentation, ProComponents ensures a smooth onboarding experience for developers, fostering quick adoption and deployment.
  • 🎨 Visual Configuration Tools: Certain components within ProComponents benefit from visual configuration aids, streamlining the design process for developers by simplifying component setup.
  • 🛠️ Unmatched Customizability: The library accommodates a plethora of configurations and styling options, ensuring that ProComponents can be tailored to the unique demands of any project.

In essence, ProComponents is a robust, user-friendly, and versatile UI component library, architected to empower applications across various scales and domains.


Considerations and Limitations

Warning

While ProComponents offers a wealth of benefits, it’s important to weigh certain considerations:

  • Limited customization: Despite its rich component repository, ProComponents may pose challenges when it comes to deeply personalized customizations, potentially hindering the realization of certain project visions.
  • Learning curve: The library’s comprehensive API and extensive documentation, while thorough, may initially overwhelm newcomers. Mastery of ProComponents might require a dedicated learning investment.
  • Browser compatibility: ProComponents leverages cutting-edge browser technologies, which may not be supported by older browsers, potentially restricting application accessibility and necessitating additional development efforts for broader compatibility.
  • Codebase size: The substantial size of ProComponents’ codebase could impact the agility of the development process and complicate long-term maintenance.

Tip

To summarize, ProComponents is a formidable contender in the realm of enterprise application UI libraries, yet it comes with its own set of trade-offs, including customization constraints, a considerable learning curve, browser compatibility considerations, and a sizable codebase. Developers are advised to thoroughly assess their project needs and limitations prior to integrating ProComponents into their workflow.


🖥 Browser compatibility

Note

edge Edge chrome safari electron_48x48
Edge last 2 versions last 2 versions last 2 versions last 2 versions

⌨️ Local Development

You can use Github Codespaces for online development:

Or clone it for local development:

$ git clone https://github.com/ant-design/pro-components.git
$ cd pro-components
$ pnpm install
$ pnpm dev

🤝 Contributing

Important

Join our collaborative ecosystem. Your contributions are the heartbeat of our project. Here's how you can be an integral part of our vibrant community:

  • Integrate and Innovate: Incorporate Ant Design Pro, umi, and ProComponents into your projects. Your real-world usage and feedback are invaluable to us.
  • Voice Your Insights: Encounter a glitch? Have a query? Your perspectives matter. Share them by submitting issues and help us enhance the user experience.
  • Shape the Future: Have code enhancements or feature ideas? We invite you to propose pull requests and contribute directly to the evolution of our codebase.

Every contribution, big or small, is celebrated. Join us in our mission to refine and elevate the world of open-source enterprise UI components. 😃




🛣️ Ecosystem

  • ProComponents - Designed for Enterprise-Level Application, Use Ant Design like a Pro!.
  • ProEditor - The Ultimate Editor UI Framework and Components.
  • ProFlow - A Flow Editor Framework base on React-Flow.
  • ProChat - Components Library for Quickly Building LLM Chat Interfaces.


📝 License

Copyright © 2023 - present AFX & Ant Digital.
This project is MIT licensed.

Star History

Star History Chart

pro-components's People

Contributors

afc163 avatar chenshuai2144 avatar ddcat1115 avatar dependabot-preview[bot] avatar depfu[bot] avatar derricktel avatar dingtianxiu avatar drizzlesconsin avatar dunqing avatar hengkx avatar imhele avatar jiyingzhi avatar kaoding avatar kiner-tang avatar kungege avatar leshalv avatar lzm0x219 avatar nikogu avatar only-yours avatar rayronvictor avatar rdmclin2 avatar rojer95 avatar sorrycc avatar wangmeijian avatar whatakitty avatar wynterding avatar xiaohuoni avatar xliez avatar yoyo837 avatar yutingzhao1991 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pro-components's Issues

request获取数据由props传入

async (params = {}) => new Promise<{ data: IStoreNodeRows[] }>((resolve, reject) => {
              resolve({
                 data: dataSource
               })
             })
}```
这里的dataSource 由props传入,  如果dataSource 写成死数据可以显示,但是换成props.dataSource后不显示

👑 [需求]pro-table 需求重置表单的initialValues

🥰 需求描述

页面A 内使用pro-table显示数据,当使用查询表单筛选了数据之后,点击table里的数据跳转到页面B,当返回页面A后需要显示原先的数据。这时先将页面A的筛选条件filter,页码current,长度pageSize储存起来,返回页面A时,将filter放入form的initialValues中,current和pageSize设置为pagination的初始参数,可以达到显示原先数据的目的。问题在于,当点击表单的reset按钮时,无法重置到空状态,这是设置了初始值得原因,但不符合使用的场景。

我尝试在onReset方法中使用setState(维护一个initialValues,初始值为储存的filter)重置initialValues为{},这种办法需要点击两次reset按钮才能达到置空的目的,第一次设置initialValues为{},第二次将表单置为{}状态(置空)

🧐 解决方案

能否提供一个api,强制将表单置空并刷新table

🚑 其他信息

image
页面A筛选数据
image
页面B
image
返回页面A
image
点击两次重置按钮后

一下部分代码:
image
image

或者是不是有其它的方法解决这个问题

🐛[BUG] v5 菜单mix模式,请求不存在的地址导致左侧菜单被刷新成和顶栏一样

🐛 bug 描述

5.0版本,在菜单mix模式,地址栏随便请求一个不存在的菜单地址,会导致左侧菜单被刷新显示和顶栏的一样

📷 复现步骤

地址栏请求: http://localhost:8000/aaa

🏞 期望结果

期望左侧菜单不被刷新

💻 复现代码

直接官网demo就能复现

© 版本信息

  • Ant Design Pro 版本: [e.g. 5.0.0]
  • umi 版本
  • 浏览器环境
  • 开发环境 [e.g. mac OS]

🚑 其他信息

image

🐛[BUG] Navbar white on overflow and mobile

🐛 bug 描述 [详细地描述 bug,让大家都能理解]

Sorry, I don't speak Chinese.

When the nav overflows it looks like this (on @ant-design/pro-layout 6.3.0 and 5.0.5):

image

And on mobile it looks like this (on @ant-design/pro-layout 6.3.0. It was fine on 5.0.5):

image

📷 复现步骤 [清晰描述复现步骤,让别人也能看到问题]

🏞 期望结果 [描述你原本期望看到的结果]

💻 复现代码 [提供可复现的代码,仓库,或线上示例]

© 版本信息

  • Ant Design Pro 版本: [e.g. 4.0.0]
  • umi 版本
  • 浏览器环境
  • 开发环境 [e.g. mac OS]

🚑 其他信息 [如截图等其他信息可以贴在这里]

🐛[BUG] ProTable search optionRender->false 时,ant-pro-table-search-option 依然存在Dom中,未移除掉。

🐛 bug 描述

type="form" 时 已经设置optionRender->false,只是隐藏了按钮,但是Dom中还存在search-option 。

image

📷 复现步骤

<ProTable
search={{
optionRender: false,
}}

🏞 期望结果

希望optionRender->false ,按钮消失,ant-pro-table-search-option 也消失掉。

💻 复现代码

<ProTable
search={{
optionRender: false,
}}

© 版本信息

  • Ant Design Pro Table 版本: 2.4.0
  • umi 版本 3.2.0
  • 浏览器环境 Chrome
  • 开发环境 mac OS

🚑 其他信息

image

🐛[BUG]ProTable search optionRender->false 时,ant-pro-table-search-option 依然存在Dom中,未移除掉。

🐛 bug 描述

type="form" 时 已经设置optionRender->false,只是隐藏了按钮,但是Dom中还存在search-option 。

image

📷 复现步骤

<ProTable
search={{
optionRender: false,
}}

🏞 期望结果

希望optionRender->false ,按钮消失,ant-pro-table-search-option 也消失掉。

💻 复现代码

<ProTable
search={{
optionRender: false,
}}

© 版本信息

  • Ant Design Pro Table 版本: 2.4.0
  • umi 版本 3.2.0
  • 浏览器环境 Chrome
  • 开发环境 mac OS

🚑 其他信息

image

pro-table缓存,请求参数不变,重新getList后数据不更新

🥰 需求描述

如题,需求是在table的某一个行有个操作,操作完成后需要重新加载list数据,此时查询条件是没有变动的,所以导致即便重新请求了,但table的list没有更新:
如果调用onSubmit方法模拟点击查询按钮,但因为已经有了 request={(params) => getList(params)}
就会相当于重复请求数据

暂时的猜测是组件内部做了memo,使得table数据不更新?
如果是这样,建议增加个参数falg,是否需要memo。

如果不是,希望可以给个解决方案解决缓存的问题。

代码

<ProTable<TableListItem>
        actionRef={tableRef}
        rowKey="id"
        scroll={{ x: 1300 }}
        request={(params) => getList(params)}
        // scroll={{ x: "max-content", y: 560 }}
        columns={reinforceColumns(columns)}
        rowSelection={{
          columnWidth: 60,
          fixed: true,
        }}
        columnsStateMap={columnsStateMap}
        onColumnsStateChange={handleColumnsStateChange}
        toolBarRender={toolBarRender}
        options={{
          fullScreen: false, // fullScreen 全屏,
          reload: true, // ,reload 刷新
          setting: true, // setting table 设置
          density: true, // density 密度调整,
        }}
        pagination={{
          defaultPageSize: initPageParams.pageSize,
          pageSizeOptions: ["10", "20", "50", "100", "500"],
        }}
        beforeSearchSubmit={beforeSearchSubmit}
        onLoad={handleLoad}
        // onSubmit={() => onTableSubmit()}
        onChange={handleChangeTable}
      />

👑 [需求]api文档里没有tableAlertOptionRender属性

🥰 需求描述 [详细地描述需求,让大家都能理解]

我在阅读示例代码的时候看到tableAlertOptionRender属性,可是找了api文档没有找到该属性,去看源码的时候,又是有该属性的

🧐 解决方案 [如果你有解决方案,在这里清晰地阐述]

能够补充完善文档

🚑 其他信息 [如截图等其他信息可以贴在这里]

image
image

🧐怎么解决表格样式不统一的问题

🧐 问题描述

在没有加任何自定义样式的前提下,不同页面的表格样式不同,主要表现在行高,怎么可以解决这个问题?

💻 示例代码

所有的表格我都是这样写的:

    <ProTable<RewardListItem>
        actionRef={actionRef}
        rowKey="id"
        options={false}
        request={(params: any) =>
          queryRules({
            page_size: params.pageSize || 10,
            current_page: params.current || 1,
          })
        }
        search={false}
        pagination={{
          total: pageCount,
          defaultPageSize: 10,
        }}
        columns={thirdColumns}
      />

🚑 其他信息

正常情况下:
image

比较独特的表格:
image

🐛[BUG]columns的width无效

columns添加了width无效,本想横向滚动的

// 列配置
  let columns: ProColumns<TableListItem>[] = [
    {
      title: "序号",
      dataIndex: "id",
      width: 5 * 10,
      hideInSearch: true,
      valueType: "index",
      // render: (text) => <Badge count={"新"}>{text}</Badge>,
      render: (text, row: any) =>
        row.newDeal === "Y" ? <Badge count={"新"}>{text}</Badge> : text,
    },
    {
      title: "线路号",
      dataIndex: "routeNo",
      width: 78,
      sorter: true,
    },
    ...searchSelectColumns,
    {
      title: "订单编号",
      hideInSearch: true,
      dataIndex: "dealId",
      width: 145,
      render: (_, row) => (
        <span
          style={
            Array.isArray(row.changeField) && row.changeField.includes(3)
              ? orangeText
              : {}
          }
        >
          {_}
        </span>
      ),
    },
    {
      title: "配送单号",
      dataIndex: "deliveryNo",
      width: 4 * 20,
      hideInSearch: true,
      render: (text) => `#${text}`,
      rules: [
        () => ({
          validator(rule, value) {
            if (value) {
              if (isNaN(Number(value))) {
                return Promise.reject("请输入数字");
              } else if (Number(value) > 2147483647) {
                // 不能超过2147483647 否则接口报错
                return Promise.reject("请输入正确的配送单号");
              }
            }
            return Promise.resolve();
          },
        }),
      ],
    },
    {
      title: "批次",
      dataIndex: "batch",
      width: "60px",
      sorter: true,
      renderFormItem: (_) => {
        return (
          <Select placeholder="批次">
            {batchList.map((item: any) => (
              <Option key={item.batchNo} value={item.batchNo}>
                {item.batchNo}
              </Option>
            ))}
          </Select>
        );
      },
    },]

上面只是clumns的部分列,由于列比较多,想通过添加width达到横向滚动,结果完全没作用,列的内容完全挤在一起了

© 版本信息

 "@amap/amap-jsapi-types": "^0.0.4",
    "@ant-design/pro-layout": "^5.0.9",
    "@ant-design/pro-table": "^2.2.7",
    "@types/jest": "^25.2.1",
    "@types/react": "^16.9.34",
    "@umijs/hooks": "^1.9.2",
    "@umijs/preset-react": "1.x",
    "@umijs/test": "^3.1.1",
    "antd-dayjs-webpack-plugin": "^1.0.0",
    "cross-env": "^7.0.2",
    "html2canvas": "^1.0.0-rc.5",
    "lint-staged": "^10.0.7",
    "postcss-px-to-viewport": "^1.1.1",
    "prettier": "^2.0.5",
    "react": "^16.12.0",
    "react-amap": "^1.2.8",
    "react-dom": "^16.12.0",
    "stylus": "^0.54.7",
    "stylus-loader": "^3.0.2",
    "ts-md5": "^1.2.7",
    "typescript": "^3.8.3",
    "umi": "^3.1.1",
    "yorkie": "^2.0.0"

🚑 其他信息

🐛[BUG] pro-table的columns的title不支持()=>ReactNode

pro-table的columns的title不支持()=>ReactNode,开发环境是正常的,打包编译之后线上不行,根本不进入函数

💻 复现代码

原函数

      // 送达/取货/下单时间  history:实际送达时间
      // title: (_) => {
      //   console.log(_);

      //   let arrTimes: any[] = [];
      //   deliveryTimes.map((time) => arrTimes.push(time));
      //   // console.log("送达/取货/下单时间 ", arrTimes);

      //   const index = arrTimes.findIndex(
      //     (item) => item.value === "actualDeliveredAt"
      //   );
      //   if (type !== "history" && index !== -1) {
      //     arrTimes.splice(index, 1);
      //   }

      //   if (type === "history" && index === -1) {
      //     arrTimes.push({
      //       label: "实际送达时间",
      //       value: "actualDeliveredAt",
      //     });
      //   }
      //   // console.log("送达/取货/下单时间 ", arrTimes);
      //   return (
      //     <Select
      //       defaultValue={filterPrefixTypes?.deliveryTimes}
      //       onSelect={(val) => onFilterPrefixSelect(val, "deliveryTimes")}
      //     >
      //       {arrTimes.map((item: any) => (
      //         <Option key={item.value} value={item.value}>
      //           <Tooltip title={item.label}>
      //             <span>{item.label}</span>
      //           </Tooltip>
      //         </Option>
      //       ))}
      //     </Select>
      //   );
      // },

修复后,也不能说修复,只是绕过了

searchSelectColumns = produce(
    searchSelectColumns,
    (draftSearchSelectColumns) => {
      let arrTimes: any[] = [];
      deliveryTimes.map((time) => arrTimes.push(time)); 

      const index = arrTimes.findIndex(
        (item) => item.value === "actualDeliveredAt"
      );
      if (type !== "history" && index !== -1) {
        arrTimes.splice(index, 1);
      }

      if (type === "history" && index === -1) {
        arrTimes.push({
          label: "实际送达时间",
          value: "actualDeliveredAt",
        });
      }
      console.log("送达/取货/下单时间 ", arrTimes);
      draftSearchSelectColumns[2].title = (
        <Select
          defaultValue={filterPrefixTypes?.deliveryTimes}
          onSelect={(val) => onFilterPrefixSelect(val, "deliveryTimes")}
        >
          {arrTimes.map((item: any) => (
            <Option key={item.value} value={item.value}>
              <Tooltip title={item.label}>
                <span>{item.label}</span>
              </Tooltip>
            </Option>
          ))}
        </Select>
      );
    }
  );

© 版本信息

"@amap/amap-jsapi-types": "^0.0.4",
    "@ant-design/pro-layout": "^5.0.9",
    "@ant-design/pro-table": "^2.2.7",
    "@types/jest": "^25.2.1",
    "@types/react": "^16.9.34",
    "@umijs/hooks": "^1.9.2",
    "@umijs/preset-react": "1.x",
    "@umijs/test": "^3.1.1",
    "antd-dayjs-webpack-plugin": "^1.0.0",
    "cross-env": "^7.0.2",
    "html2canvas": "^1.0.0-rc.5",
    "lint-staged": "^10.0.7",
    "postcss-px-to-viewport": "^1.1.1",
    "prettier": "^2.0.5",
    "react": "^16.12.0",
    "react-amap": "^1.2.8",
    "react-dom": "^16.12.0",
    "stylus": "^0.54.7",
    "stylus-loader": "^3.0.2",
    "ts-md5": "^1.2.7",
    "typescript": "^3.8.3",
    "umi": "^3.1.1",
    "yorkie": "^2.0.0"

这样修改之后,开发环境和online才都正常了,具体原因不知,估计是和打包插件有冲突

问一下这个库的计划

没看到这个库,我本来是打算把 ant-design-atom 这个库做完之后转移到 ant-design 组织下面的。因为一直有别的事耽搁了,所以一直没做完。
不知道 pro-components 这个库是什么计划?

How to get Untranspiled code of Chart Components

Hello there,
first of all thank you for your time.

I have stopped using ant-design-pro-components alone due to the last update of ant-design to V4.

Now I have included the components directly using this project (removed ant-design-pro dependency).

Going through the Charts component code I have noticed that it is hard to read it. I do not know if it is transpiled... Could anyone share with me the original raw js code of the Carts components??

Thanks!!!

pro-table 设置locale 中 emptyText 无效

🐛 bug 描述

pro-table 设置locale 中 emptyText 无效

📷 复现步骤

image
image

🏞 期望结果

期望emptyText有改变

💻 复现代码

locale={{
      emptyText:'请先选择搜索条件'
    }}

© 版本信息

"@ant-design/pro-table": "^2.4.2",
"@umijs/preset-react": "^1.5.6",
"@umijs/test": "^3.2.3",
开发环境:windows

🚑 其他信息

👑 [需求] ProTable type="form"时,后端返回字段错误 无法传入form.item 展示问题

🥰 需求描述

自己开发创建和编辑的 form 表单时,我可以通过validateStatus和 help 来展示后端返回的校验errors。比如用户名必须唯一,只有后端可以校验。

      <Form.Item
        validateStatus={errors.username ? 'error' : ''}
        help={errors.username ? errors.username.join(', ') : ''}

对于一张很多字段的表格,ProTable type="form" 实现的新增和编辑表单非常好用。唯一就是如果对于某些字段有后端校验需求,现在无法加入。希望可以有接口或好的方式,给Form.item 传入。

🧐 解决方案

尝试了renderFormItem 它不能对于form.item 做什么。
formItemProps 只能对于Input 做点自定义。
现在的解决方案就是只要表单里有一个字段需要后端校验,我就不能使用ProTable type="form",得自己写枯燥的代码。

🚑 其他信息

希望可以对于这种常见需求做一些适配呢!或者已经有解决方案,可否分享下。谢谢

ProTable列类型选择indexBorder居中无效的问题

🐛 bug 描述

ProTable列类型选择indexBorder居中无效的问题

📷 复现步骤

{
  title: "序号",
  dataIndex: "index",
  align: "center",
  valueType: "indexBorder",
  width: 30,
},

🏞 实际结果

image

© 版本信息

  • Ant Design Pro 版本: [e.g. 4.0.0]
  • umi 版本
  • 浏览器环境
  • 开发环境 [e.g. mac OS]

🐛[BUG] ProTable 分页问题

🐛 bug 描述

ProTable 分页bug。非第1页,将pageSize改为比现有size小的数时,没有重新请求更新数据,表格显示的是原有页码的前几条,且当前页码显示为第1页,不正确([antd: Table] dataSource length is less than pagination.total but large than pagination.pageSize. Please make sure your config correct data with async mode.)

📷 复现步骤

1、初始状态,默认current为1,pageSize为20,请求current=1&pageSize=20,得99-80 --- 正确
2、点击下一页,current为2,pageSize为20,请求current=2&pageSize=20,得79-60 --- 正确
3、切换pageSize为10,没有重新请求,表格显示79-70,底部显示当前页码为第1页,控制台出现警告 --- 错误
4、点击下一页,没有发送请求,显示69-60,再下一页表格将为空 --- 错误

🏞 期望结果

3中,请求current=2&pageSize=10

💻 复现代码

© 版本信息

  • Ant Design Pro 版本: [e.g. 4.0.0]
  • umi 版本
  • 浏览器环境
  • 开发环境 [e.g. mac OS]

🚑 其他信息

打包体积要监控起来

  • bundle size 的 CI 和 badge
  • 支持 Tree Shaking
  • 检查和移除无用的依赖包
  • 复用 rc-util 和最新的 rc-xxx 版本
  • 开启使用 @babel/runtime

避免 antd 辛辛苦苦省下的体积被挥霍了。

pro-table的hideInTable BUG ,显示隐藏列引发顺序错误

[
    {
      title: 'A',
      dataIndex: 'a',
    },
{
      title: 'B',
      dataIndex: 'b',
       hideInTable: hideB
    },
{
      title: 'C',
      dataIndex: 'c',
     hideInTable:hideC
    },
]

如上,假设我1个表有多个列。 最后有2个列是默认隐藏的,
我通过动态改变 hideB或hideC 的值显示或隐藏B或C列。
当我显示B列或显示B和C列时,显示正常。
当我隐藏B列,显示C列时,C会跑到表格最前面去(预期是 A列,C列,实际是 C列,A列)

🐛[BUG]Table 样式问题

🐛 bug 描述

.@{ant-prefix}-table-row .@{ant-prefix}-table-cell:first-child {
padding-left: 24px;
a {
padding: 0;
}
}

此处代码导致下图的问题
image

📷 复现步骤

当表格中有合并单元格时出现样式错误

🏞 期望结果

image

💻 复现代码

© 版本信息

  • Ant Design Pro 版本: [e.g. 4.0.0]
  • umi 版本
  • 浏览器环境
  • 开发环境 [e.g. mac OS]

🚑 其他信息

官方设计组件时可能有很好的想法,但有时候会导致出乎开发者预料的情况,比如刚开始pro-table 会给a标签加padding增加点击面积和这次的给第一列左侧留白(个人认为这样并不美观),初衷都是好的,但不一定是大家都需要的,这不在开发者预期中,会导致我们很迷惑,希望以后减少这种情况

🐛[BUG]ProTable的bug

🐛 bug 描述

image
如图,antd的本地化变成了英文,这个地方应该显示的是中文

📷 复现步骤

🏞 期望结果

💻 复现代码

© 版本信息

  • Ant Design Pro 版本: [e.g. 4.0.0]
  • umi 版本
  • 浏览器环境
  • 开发环境 [e.g. mac OS]

🚑 其他信息

🐛[BUG] pro-table 的 ellipsis = true, 会出现多个tooltip

🐛 bug 描述

pro-table 的 ellipsis = true, 会出现多个tooltip

📷 复现步骤

设置column的ellipsis=true;

const columns = [{
title: 'xx信息',
dataIndex: 'content',
ellipsis: true,
copyable: true,
width: 400,
},
xxxx,
xxxx,
]

🏞 期望结果

去掉Tooltip,直接用antd自带的即可。

💻 复现代码

© 版本信息

  • Ant Design Pro 版本: [e.g. 4.0.0]
  • umi 版本
  • 浏览器环境
  • 开发环境 [e.g. mac OS]

🚑 其他信息

image

🐛[BUG]页面中引入了antd.css,pro页面布局错乱

🐛 bug 描述

在页面中,如果使用了 import 'antd/dist/antd.css'; ,那么pro的页面样式就被破坏了

📷 复现步骤

Welcome.tsx
引入 import 'antd/dist/antd.css';

🏞 期望结果

pro页面正常

💻 复现代码

© 版本信息

  • Ant Design Pro 版本: [e.g. 4.0.0]
  • umi 版本
  • 浏览器环境
  • 开发环境 [e.g. mac OS]

🚑 其他信息

image

👑 [需求]支持搜索表单项 自定义单独的 span 属性或 span属性支持函数

🥰 需求描述 [详细地描述需求,让大家都能理解]

目前查询表单项的大小可以通过,设置 searchspan 属性来修改.

 search={{ span: defaultSearchColConfig }}

但是这有一个问题就是, 所有的查询表单项的宽度都是一样的.一般来说这没有问题.
但是不同的表单项有时对宽度的要求差别比较大.
比如:

  1. 一个搜索输入框,如果输入的值比较长,要求是 8列左右.
  2. 一个简单的是/否状态 Select 则只需要4列就足够了.

🧐 解决方案 [如果你有解决方案,在这里清晰地阐述]

span 属性支持设置为一个 function
比如:

 { span: (index|key) => colConfig }

🚑 其他信息 [如截图等其他信息可以贴在这里]

🐛[BUG] pro-table 使用时遇到的几个BUG

🐛 bug 描述

使用时遇到的几个BUG

  1. 当表格第一列设置为hideInTable({ title: 'ID', dataIndex: 'id', hideInTable: true }),最后一列设置为valueType: 'option' ({ title: '操作', valueType: 'option'}),最后一列会跑到第一列

  2. 当表格rowKey设置的字段有重复值时, 改变请求参数, 使用actionRef?.current?.reloadAndRest()actionRef?.current?.reload()刷新表单获取其他数据, 重复的数据会被保留下来与最新请求的数据一起显示出来

复测了一下, 删除了一条

© 版本信息

  • Ant Design Pro 版本: 4.5.2
  • umi 版本 3.2.14
  • pro-table 版本 2.4.4

🐛[BUG] 国际化设置

🐛 bug 描述

官网例子:
image

项目使用:
image

📷 相关代码


var IntlContext = _react.default.createContext(intlMap[(0, _util.getLang)() || ''] || zhCNIntl);

<IntlProvider value={zhCNIntl}>
      <ProTable {...props} />
</IntlProvider>

🏞 期望结果

期望表现与antd-pro官方例子

© 版本信息

  • Ant Design Pro-table 版本: 2.4.4
  • umi 版本 3.2.4
  • 浏览器环境 Google Chrome 78.0.3904.108
  • 开发环境 [win10]

🐛搜索项如果只选择起始日期时,会出现Invalid Date

🐛 bug 描述

pro-table相关。
valueType为dateRange,搜索项如果只选择起始日期时,提交,会出现['Invalid Date', 'yyyy-MM-dd']这样值。结束日期也一样。
导致请求连接为:http://localhost:8000/api/services/app/User/GetAll?creationTime=2020-08-05&creationTime=Invalid%20date&_timestamp=1596613814213&skipCount=0&maxResultCount=20

📷 复现步骤

ProColumns配置为:

 {
      title: '创建时间',
      dataIndex: 'creationTime',
      valueType: 'dateRange',
      hideInForm: true,
      formItemProps: {
        allowEmpty: [true, true],
      },
},

仅选择起始/结束日期,点击搜索

🏞 期望结果

希望请求连接为: http://localhost:8000/api/services/app/User/GetAll?creationTime=2020-08-05&creationTime=&_timestamp=1596613814213&skipCount=0&maxResultCount=20

原因

查看了源代码

/pakeages/table/src/form/index.tsx 中 的 conversionValue方法

    // 这里是日期数组
    if (Array.isArray(itemValue) && itemValue.length === 2 && dateFormatter) {
      if (dateFormatter === 'string') {
        const formatString = dateFormatterMap[valueType as 'dateTime'];
        const [startValue, endValue] = itemValue;
    // 这里为空时,返回空字符串即可。或者可以进行配置。
        tmpValue[key] = [
          moment(startValue as Moment).format(formatString || 'YYYY-MM-DD HH:mm:ss'),
          moment(endValue as Moment).format(formatString || 'YYYY-MM-DD HH:mm:ss'),
        ];
        return;
      }
      if (dateFormatter === 'number') {
        const [startValue, endValue] = itemValue;
        tmpValue[key] = [
          moment(startValue as Moment).valueOf(),
          moment(endValue as Moment).valueOf(),
        ];
      }
    }

© 版本信息

  • Ant Design Pro 版本: 4.1.0
  • 浏览器环境 chrome
  • 开发环境 windows 10

🚑 其他信息

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.