diff --git a/.dumirc.ts b/.dumirc.ts
index 4e550faa2..47add1680 100644
--- a/.dumirc.ts
+++ b/.dumirc.ts
@@ -1,12 +1,29 @@
import { defineConfig } from 'dumi';
import path from 'path';
+const basePath = process.env.GH_PAGES ? '/table/' : '/';
+const publicPath = basePath;
+
export default defineConfig({
alias: {
- 'rc-table$': path.resolve('src'),
- 'rc-table/es': path.resolve('src'),
+ '@rc-component/table$': path.resolve(__dirname, 'src'),
+ '@rc-component/table/es': path.resolve(__dirname, 'src'),
+ '@rc-component/dropdown/assets': path.resolve(
+ __dirname,
+ 'node_modules/@rc-component/dropdown/assets',
+ ),
+ '@rc-component/menu/assets': path.resolve(__dirname, 'node_modules/@rc-component/menu/assets'),
+ '@rc-component/tooltip/assets': path.resolve(
+ __dirname,
+ 'node_modules/@rc-component/tooltip/assets',
+ ),
+ 'rc-table$': path.resolve(__dirname, 'src'),
+ 'rc-table/es': path.resolve(__dirname, 'src'),
},
favicons: ['https://avatars0.githubusercontent.com/u/9441414?s=200&v=4'],
+ outputPath: 'docs-dist',
+ base: basePath,
+ publicPath,
themeConfig: {
name: 'Table',
logo: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4',
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
index 33b1999c7..758659af3 100644
--- a/.github/FUNDING.yml
+++ b/.github/FUNDING.yml
@@ -1,15 +1,2 @@
-# These are supported funding model platforms
-
-github: ant-design # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
-patreon: # Replace with a single Patreon username
-open_collective: ant-design # Replace with a single Open Collective username
-ko_fi: # Replace with a single Ko-fi username
-tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
-community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
-liberapay: # Replace with a single Liberapay username
-issuehunt: # Replace with a single IssueHunt username
-lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
-polar: # Replace with a single Polar username
-buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
-thanks_dev: # Replace with a single thanks.dev username
-custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
+github: ant-design
+open_collective: ant-design
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index 849a129ff..3b730ef99 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -1,38 +1,19 @@
version: 2
updates:
-- package-ecosystem: npm
- directory: "/"
- schedule:
- interval: daily
- time: "21:00"
- open-pull-requests-limit: 10
- ignore:
- - dependency-name: "@types/react"
- versions:
- - 17.0.0
- - 17.0.1
- - 17.0.2
- - 17.0.3
- - dependency-name: "@types/react-dom"
- versions:
- - 17.0.0
- - 17.0.1
- - 17.0.2
- - dependency-name: react-dnd
- versions:
- - 11.1.3
- - 13.0.0
- - 13.1.0
- - 13.1.1
- - 14.0.1
- - dependency-name: react-dnd-html5-backend
- versions:
- - 11.1.3
- - 12.1.0
- - 12.1.1
- - dependency-name: rc-tooltip
- versions:
- - 5.0.2
- - dependency-name: less
- versions:
- - 4.1.0
+ - package-ecosystem: npm
+ directory: '/'
+ schedule:
+ interval: weekly
+ day: monday
+ time: '21:00'
+ timezone: Asia/Shanghai
+ open-pull-requests-limit: 10
+
+ - package-ecosystem: github-actions
+ directory: '/'
+ schedule:
+ interval: weekly
+ day: monday
+ time: '21:00'
+ timezone: Asia/Shanghai
+ open-pull-requests-limit: 10
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml
index 8aaf0ca51..563e9984c 100644
--- a/.github/workflows/codeql.yml
+++ b/.github/workflows/codeql.yml
@@ -1,12 +1,12 @@
-name: "CodeQL"
+name: CodeQL
on:
push:
- branches: [ "master" ]
+ branches: [master]
pull_request:
- branches: [ "master" ]
+ branches: [master]
schedule:
- - cron: "53 22 * * 2"
+ - cron: '53 22 * * 2'
jobs:
analyze:
@@ -20,22 +20,24 @@ jobs:
strategy:
fail-fast: false
matrix:
- language: [ javascript ]
+ language: [javascript]
steps:
- name: Checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
- name: Initialize CodeQL
- uses: github/codeql-action/init@v2
+ uses: github/codeql-action/init@8aad20d150bbac5944a9f9d289da16a4b0d87c1e
with:
languages: ${{ matrix.language }}
queries: +security-and-quality
- name: Autobuild
- uses: github/codeql-action/autobuild@v2
+ uses: github/codeql-action/autobuild@8aad20d150bbac5944a9f9d289da16a4b0d87c1e
- name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@v2
+ uses: github/codeql-action/analyze@8aad20d150bbac5944a9f9d289da16a4b0d87c1e
with:
- category: "/language:${{ matrix.language }}"
+ category: '/language:${{ matrix.language }}'
diff --git a/.github/workflows/issue-reply.yml b/.github/workflows/issue-reply.yml
index 02c123323..21039bb16 100644
--- a/.github/workflows/issue-reply.yml
+++ b/.github/workflows/issue-reply.yml
@@ -4,25 +4,29 @@ on:
issues:
types: [labeled]
+permissions:
+ issues: write
+
jobs:
reply-help:
runs-on: ubuntu-latest
steps:
- name: help wanted
if: github.event.label.name == 'help wanted' || github.event.label.name == 'PR welcome'
- uses: actions-cool/issues-helper@v1.11
- with:
- actions: 'create-comment'
- token: ${{ secrets.GITHUB_TOKEN }}
- issue-number: ${{ github.event.issue.number }}
- body: |
+ run: |
+ gh issue comment "$ISSUE_NUMBER" --body "$BODY"
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ ISSUE_NUMBER: ${{ github.event.issue.number }}
+ BODY: |
Hello @${{ github.event.issue.user.login }}. We totally like your proposal/feedback, welcome to send us a Pull Request for it. Please provide changelog/TypeScript/documentation/test cases if needed and make sure CI passed, we will review it soon. We appreciate your effort in advance and looking forward to your contribution!
- name: need reproduce
if: github.event.label.name == 'need reproduce'
- uses: actions-cool/issues-helper@v1.11
- with:
- actions: 'create-comment'
- issue-number: ${{ github.event.issue.number }}
- body: |
+ run: |
+ gh issue comment "$ISSUE_NUMBER" --body "$BODY"
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ ISSUE_NUMBER: ${{ github.event.issue.number }}
+ BODY: |
Hello @${{ github.event.issue.user.login }}. Please provide a online reproduction by forking this link https://codesandbox.io or a minimal GitHub repository.
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 1fe5da5f2..ac66bc43f 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -1,6 +1,14 @@
name: ✅ test
-on: [push, pull_request]
+on:
+ push:
+ branches: [master]
+ pull_request:
+ branches: [master]
+
+permissions:
+ contents: read
+
jobs:
test:
- uses: react-component/rc-test/.github/workflows/test-npm.yml@main
- secrets: inherit
\ No newline at end of file
+ uses: react-component/rc-test/.github/workflows/test-utoo.yml@main
+ secrets: inherit
diff --git a/.github/workflows/react-doctor.yml b/.github/workflows/react-doctor.yml
new file mode 100644
index 000000000..e4b7d9662
--- /dev/null
+++ b/.github/workflows/react-doctor.yml
@@ -0,0 +1,25 @@
+name: React Doctor
+
+on:
+ pull_request:
+ branches: [master]
+
+permissions:
+ contents: read
+ pull-requests: write
+
+concurrency:
+ group: react-doctor-${{ github.event.pull_request.number || github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ react-doctor:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v7
+ with:
+ persist-credentials: false
+
+ - uses: millionco/react-doctor@0b4f4f4bd248a154e64eb508a48347f71154b3f3
+ with:
+ github-token: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/surge-preview.yml b/.github/workflows/surge-preview.yml
new file mode 100644
index 000000000..58dd21534
--- /dev/null
+++ b/.github/workflows/surge-preview.yml
@@ -0,0 +1,49 @@
+name: Surge Preview
+
+on:
+ pull_request:
+ branches: [master]
+
+permissions:
+ contents: read
+ pull-requests: write
+ statuses: write
+
+concurrency:
+ group: surge-preview-${{ github.event.pull_request.number || github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ preview:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v7
+ with:
+ persist-credentials: false
+ - name: Check Surge token
+ id: surge-token
+ env:
+ SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}
+ run: |
+ if [ -n "$SURGE_TOKEN" ]; then
+ echo "enabled=true" >> "$GITHUB_OUTPUT"
+ else
+ echo "enabled=false" >> "$GITHUB_OUTPUT"
+ fi
+
+ - name: Install dependencies
+ if: ${{ steps.surge-token.outputs.enabled == 'true' }}
+ run: npm install --ignore-scripts --no-audit --loglevel=warn
+
+ - name: Build preview
+ if: ${{ steps.surge-token.outputs.enabled == 'true' }}
+ run: npm run build
+ - uses: afc163/surge-preview@bf90a5a86111f6311ca42f0a5a0f80fb0fb03cec
+ if: ${{ steps.surge-token.outputs.enabled == 'true' }}
+ env:
+ SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}
+ with:
+ dist: docs-dist
+ failOnError: false
+ github_token: ${{ secrets.GITHUB_TOKEN }}
+ surge_token: ${{ env.SURGE_TOKEN }}
diff --git a/.gitignore b/.gitignore
index 94be18dab..52eef8f1c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,6 +23,7 @@ Thumbs.db
node_modules
.cache
dist
+docs-dist
assets/**/*.css
build
lib
@@ -43,7 +44,10 @@ examples/debug.tsx
.umi-production
.umi-test
.env.local
-.dumi
+.dumi/tmp*
+.vercel
bun.lockb
-pnpm-lock.yaml
\ No newline at end of file
+pnpm-lock.yaml
+.dumi/tmp
+.dumi/tmp-production
diff --git a/.husky/pre-commit b/.husky/pre-commit
index 041c660c9..2312dc587 100755
--- a/.husky/pre-commit
+++ b/.husky/pre-commit
@@ -1 +1 @@
-npx --no-install lint-staged
+npx lint-staged
diff --git a/.prettierignore b/.prettierignore
index 214377229..f6166fa09 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -9,3 +9,15 @@ package.json
.umi
.umi-production
.umi-test
+node_modules
+coverage
+docs-dist
+dist
+.dumi/tmp
+.dumi/tmp-production
+.vercel
+package-lock.json
+pnpm-lock.yaml
+yarn.lock
+bun.lockb
+*.log
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 000000000..bd0a1f722
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2019-present react-component
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
index ed9515839..90d236768 100644
--- a/README.md
+++ b/README.md
@@ -1,81 +1,70 @@
-# @rc-component/table
+
+
@rc-component/table
+
Part of the Ant Design ecosystem.
+
📋 Low-level table primitives for React, maintained in the Ant Design ecosystem.
-React table component with useful functions.
+
+
+
+
+
+
+
+
+
-[![NPM version][npm-image]][npm-url] [](https://github.com/umijs/dumi) [![build status][github-actions-image]][github-actions-url] [![Test coverage][codecov-image]][codecov-url] [![npm download][download-image]][download-url] [![bundle size][bundlephobia-image]][bundlephobia-url]
+English | 简体中文
-[npm-image]: http://img.shields.io/npm/v/@rc-component/table.svg?style=flat-square
-[npm-url]: http://npmjs.org/package/@rc-component/table
-[github-actions-image]: https://github.com/react-component/table/actions/workflows/main.yml/badge.svg
-[github-actions-url]: https://github.com/react-component/table/actions/workflows/main.yml
-[coveralls-image]: https://img.shields.io/coveralls/react-component/table.svg?style=flat-square
-[coveralls-url]: https://coveralls.io/r/react-component/table?branch=master
-[codecov-image]: https://img.shields.io/codecov/c/github/react-component/table/master.svg?style=flat-square
-[codecov-url]: https://codecov.io/gh/react-component/table/branch/master
-[david-url]: https://david-dm.org/react-component/table
-[david-image]: https://david-dm.org/react-component/table/status.svg?style=flat-square
-[david-dev-url]: https://david-dm.org/react-component/table?type=dev
-[david-dev-image]: https://david-dm.org/react-component/table/dev-status.svg?style=flat-square
-[download-image]: https://img.shields.io/npm/dm/@rc-component/table.svg?style=flat-square
-[download-url]: https://npmjs.org/package/@rc-component/table
-[bundlephobia-url]: https://bundlephobia.com/result?p=@rc-component/table
-[bundlephobia-image]: https://badgen.net/bundlephobia/minzip/@rc-component/table
+## Highlights
-## install
+- Flexible column, summary, fixed header, sticky, expandable row, and virtual table support.
+- TypeScript-first API designed for composition in design systems.
+- Used by Ant Design Table and other React data display experiences.
-[](https://npmjs.org/package/@rc-component/table)
+## Install
-## Development
-
-```
-npm install
-npm start
+```bash
+npm install @rc-component/table
```
-## Example
-
-https://table-react-component.vercel.app/
-
## Usage
-```js
+```tsx
import Table from '@rc-component/table';
-
-const columns = [
- {
- title: 'Name',
- dataIndex: 'name',
- key: 'name',
- width: 100,
- },
- {
- title: 'Age',
- dataIndex: 'age',
- key: 'age',
- width: 100,
- },
- {
- title: 'Address',
- dataIndex: 'address',
- key: 'address',
- width: 200,
- },
- {
- title: 'Operations',
- dataIndex: '',
- key: 'operations',
- render: () => Delete,
- },
+import type { ColumnsType } from '@rc-component/table';
+
+interface User {
+ key: string;
+ name: string;
+ age: number;
+ address: string;
+}
+
+const columns: ColumnsType = [
+ { title: 'Name', dataIndex: 'name', key: 'name', width: 120 },
+ { title: 'Age', dataIndex: 'age', key: 'age', width: 80 },
+ { title: 'Address', dataIndex: 'address', key: 'address' },
];
-const data = [
- { name: 'Jack', age: 28, address: 'some where', key: '1' },
- { name: 'Rose', age: 36, address: 'some where', key: '2' },
+const data: User[] = [
+ { key: '1', name: 'Jack', age: 28, address: 'Somewhere' },
+ { key: '2', name: 'Rose', age: 36, address: 'Somewhere else' },
];
-React.render(, mountNode);
+export default () => ;
+```
+
+## Examples
+
+Run the local dumi site:
+
+```bash
+npm install
+npm start
```
+Then open `http://localhost:8000`.
+
## API
### Properties
@@ -175,6 +164,36 @@ tblRef.current?.scrollTo({ key: 'rowKey', align: 'start' });
| style | React.CSSProperties | - | style of this summary row |
| onClick | (e?: React.MouseEvent\) => void | - | The `onClick` attribute in `Table.Summary.Row` component can be used to set a click event handler for the summary row. |
+## Development
+
+```bash
+npm install
+npm start
+```
+
+The dumi site runs at `http://localhost:8000` by default.
+
+Run checks before sending a pull request:
+
+```bash
+npm run lint
+npm run tsc
+npm test
+npm run build
+```
+
+## Release
+
+```bash
+npm run prepublishOnly
+```
+
+The release flow is handled by `@rc-component/np` through the `rc-np` command after the package build.
+
+## Ecosystem
+
+This package is part of the React Component organization and is maintained alongside Ant Design. The Ant Design mark above is used only as ecosystem context; the package itself stays framework-level and unstyled except for its bundled assets.
+
## License
-@rc-component/table is released under the MIT license.
+@rc-component/table is released under the [MIT](./LICENSE) license.
diff --git a/README.zh-CN.md b/README.zh-CN.md
new file mode 100644
index 000000000..c31da3443
--- /dev/null
+++ b/README.zh-CN.md
@@ -0,0 +1,199 @@
+
+
@rc-component/table
+
Ant Design 生态的一部分。
+
📋 React 底层表格基础组件,服务于复杂数据展示。
+
+
+
+
+
+
+
+
+
+
+
+English | 简体中文
+
+## 特性
+
+- 灵活的列、摘要、固定标题、粘性、可扩展行和虚拟表支持。
+- TypeScript-first API 专为设计系统中的组合而设计。
+- 被 Ant Design 使用 Table 等 React 数据展示体验。
+
+## 安装
+
+```bash
+npm install @rc-component/table
+```
+
+## 使用
+
+```tsx
+import Table from '@rc-component/table';
+import type { ColumnsType } from '@rc-component/table';
+
+interface User {
+ key: string;
+ name: string;
+ age: number;
+ address: string;
+}
+
+const columns: ColumnsType = [
+ { title: 'Name', dataIndex: 'name', key: 'name', width: 120 },
+ { title: 'Age', dataIndex: 'age', key: 'age', width: 80 },
+ { title: 'Address', dataIndex: 'address', key: 'address' },
+];
+
+const data: User[] = [
+ { key: '1', name: 'Jack', age: 28, address: 'Somewhere' },
+ { key: '2', name: 'Rose', age: 36, address: 'Somewhere else' },
+];
+
+export default () => ;
+```
+
+## 示例
+
+运行本地 dumi 站点:
+
+```bash
+npm install
+npm start
+```
+
+然后打开 `http://localhost:8000`。
+
+## API
+
+### Properties
+
+| 名称 | 类型 | 默认值 | 说明 |
+| --- | --- | --- | --- |
+| tableLayout | `auto` \| `fixed` | `auto` \| 任何列的 `fixed` 都是固定的,或者省略号或标题是固定的 | https://developer.mozilla.org/en-US/docs/Web/CSS/table-layout |
+| prefixCls | String | `rc-table` | |
+| className | String | | 附加 className |
+| id | String | | 容器div的标识符 |
+| useFixedHeader | Boolean | false | 是否对标题使用分隔符表。更好地设置列宽度 |
+| scroll | Object | {x: false, y: false} | 表格是否可以在x/y方向滚动,`x`或`y`可以是一个数字,表示表格主体的宽度和高度 |
+| expandable | Object | | 配置展开道具 |
+| expandable.defaultExpandAllRows | Boolean | false | 初始展开所有行 |
+| expandable.defaultExpandedRowKeys | String[] | [] | 初始扩展行键 |
+| expandable.expandedRowKeys | String[] | | 当前扩展行键 |
+| expandable.expandedRowRender | Function(recode, index, indent, expanded):ReactNode | | 内容渲染到扩展行 |
+| expandable.expandedRowClassName | `string` \| `(recode, index, indent) => string` | | 获取扩展行的 className |
+| expandable.expandRowByClick | boolean | | 支持点击行展开 |
+| expandable.expandIconColumnIndex | Number | 0 | ExpandIconAsCell 为 false 时将插入哪一列的 ExpandIcon 索引 |
+| expandable.expandIcon | props => ReactNode | | 自定义展开图标 |
+| expandable.indentSize | Number | 15 | 每一级 `data[i].children` 的缩进尺寸,建议配合指定的 `column.width` 使用 |
+| expandable.rowExpandable | (record) => boolean | | 配置行支持可扩展 |
+| expandable.onExpand | Function(expanded, record) | | 单击展开图标时调用的函数 |
+| expandable.onExpandedRowsChange | Function(expandedRows) | | 扩展行更改时调用的函数 |
+| expandable.fixed | String \| Boolean | - | 当表格水平滚动时,此展开图标将被修复: true 或 `left` 或 `right` 和 `expandIconColumnIndex` 需要保留在第一个或最后一个 |
+| rowKey | string or Function(record, index):string | 'key' | 如果 rowKey 是字符串,则 `record[rowKey]` 将用作键。如果 rowKey 是函数,则 `rowKey(record, index)` 的返回值将用作 key。 |
+| rowClassName | string or Function(record, index, indent):string | | 获取行的 className |
+| rowRef | Function(record, index, indent):string | | 获取行 ref key |
+| data | Object[] | | 要呈现的数据记录数组 |
+| onRow | Function(record, index) | | 每行设置自定义道具。 |
+| onHeaderRow | Function(record, index) | | 为每个标题行设置自定义道具。 |
+| showHeader | Boolean | true | 是否显示表头 |
+| hidden | Boolean | `false` | 隐藏列。 |
+| title | Function(currentData) | | 表格标题渲染函数 |
+| footer | Function(currentData) | | 表页脚渲染函数 |
+| emptyText | React.Node or Function | `No Data` | 数据为空时显示文本 |
+| columns | Object[] | | 表的列配置见下表 |
+| components | Object | | 覆盖表元素,请参阅 [#171](https://github.com/react-component/table/pull/171) 了解更多详细信息 |
+| sticky | boolean \| {offsetHeader?: number, offsetScroll?: number, getContainer?: () => Window \| HTMLElement } | false | 粘贴标题和滚动条 |
+| summary | (data: readonly RecordType[]) => React.ReactNode | - | `table` 组件中的 `summary` 属性用于定义汇总行。 |
+| rowHoverable | boolean | true | 表格 hover 交互 |
+
+### 方法
+
+#### scrollTo
+
+Table 组件公开 `scrollTo` 方法来滚动到特定位置:
+
+```js
+const tblRef = useRef();
+tblRef.current?.scrollTo({ key: 'rowKey', align: 'start' });
+```
+
+| 名称 | 类型 | 默认值 | 说明 |
+| --- | --- | --- | --- |
+| index | number | - | 要滚动到的行索引 |
+| top | number | - | 滚动到特定顶部位置(以像素为单位) |
+| key | string | - | 按行键滚动至行 |
+| offset | number | - | 与目标位置的额外偏移 |
+| align | `start` \| `center` \| `end` \| `nearest` | `nearest` | 滚动容器内目标元素的对齐方式。 `start` 对齐到顶部,`center` 对齐到中间,`end` 对齐到底部,`nearest` 自动选择最接近的对齐方式。注意:虚拟表不支持 `center`。 |
+
+## Column 属性
+
+| 名称 | 类型 | 默认值 | 说明 |
+| --- | --- | --- | --- |
+| key | String | | 本栏目关键 |
+| className | String | | 该列的 className |
+| colSpan | Number | | 该列的 head colSpan |
+| title | React节点 | | 本栏目标题 |
+| dataIndex | String | | 数据记录的显示字段 |
+| 宽度 | String \| Number | | 宽度具体比例根据柱子的宽度计算 |
+| minWidth | Number | | 列的最小宽度,仅当 tableLayout 为 auto 时有效 |
+| fixed | String \| Boolean | | 当表格水平滚动时此列将被固定: true 或 'left' 或 'right' |
+| align | String | | 指定单元格内容的对齐方式 |
+| ellipsis | Boolean | | 指定单元格内容是否省略 |
+| rowScope | 'row' \| 'rowgroup' | | 设置此列中所有单元格的范围属性 |
+| onCell | Function(record, index) | | 为每个单元格设置自定义道具。 |
+| onHeaderCell | Function(record) | | 为每个标题单元格设置自定义属性。 |
+| 使成为 | 函数(值、行、索引) | | 单元格渲染函数,参数为单元格文本、当前行记录和行索引。可返回 `{ children: value, props: { colSpan: 1, rowSpan: 1 } }`,其中 `children` 是单元格文本,`props` 是单元格设置,例如 `colSpan` 设置 td colspan,`rowSpan` 设置 td rowspan |
+
+## Summary Props
+
+### Table.Summary
+
+| 名称 | 类型 | 默认值 | 说明 |
+| --- | --- | --- | --- |
+| key | String | | 本摘要的关键 |
+| fixed | boolean \| 'top' \| 'bottom' | - | `true` 修复了表格底部的汇总行。 `top` 将汇总行固定在表格顶部,而 `bottom` 将其固定在底部。 `undefined` 或 `false` 使摘要行可随表格一起滚动。 |
+
+### Table.Summary.Row
+
+| 名称 | 类型 | 默认值 | 说明 |
+| --- | --- | --- | --- |
+| key | String | | 本摘要的关键 |
+| className | String | - | 此摘要行的 className |
+| 风格 | React.CSSProperties | - | 此摘要行的样式 |
+| onClick | (e?: React.MouseEvent\) => void | - | `Table.Summary.Row` 组件中的 `onClick` 属性可用于设置汇总行的单击事件处理程序。 |
+
+## 本地开发
+
+```bash
+npm install
+npm start
+```
+
+dumi 站点默认运行在 `http://localhost:8000`。
+
+在发送拉取请求之前运行检查:
+
+```bash
+npm run lint
+npm run tsc
+npm test
+npm run build
+```
+
+## 发布
+
+```bash
+npm run prepublishOnly
+```
+
+包构建完成后,发布流程由 `@rc-component/np` 通过 `rc-np` 命令处理。
+
+## Ecosystem
+
+该包属于 React Component 组织,并与 Ant Design 一同维护。 上方 Ant Design 标识仅用于说明生态归属;组件本身仍保持框架级、低样式耦合的定位。
+
+## 许可证
+
+@rc-component/table 基于 [MIT](./LICENSE) 许可证发布。
diff --git a/docs/examples/animation.tsx b/docs/examples/animation.tsx
index d56cd1e0a..ef6f6d989 100644
--- a/docs/examples/animation.tsx
+++ b/docs/examples/animation.tsx
@@ -2,8 +2,8 @@ import React from 'react';
import { CSSMotionList } from '@rc-component/motion';
import { clsx } from 'clsx';
import { toArray } from '@rc-component/util';
-import type { TableProps } from 'rc-table';
-import Table from 'rc-table';
+import type { TableProps } from '@rc-component/table';
+import Table from '@rc-component/table';
import '../../assets/index.less';
import './animation.less';
diff --git a/docs/examples/aria.tsx b/docs/examples/aria.tsx
index 5b5f2054c..233e67c49 100644
--- a/docs/examples/aria.tsx
+++ b/docs/examples/aria.tsx
@@ -1,6 +1,6 @@
import React from 'react';
-import type { TableProps } from 'rc-table';
-import Table from 'rc-table';
+import type { TableProps } from '@rc-component/table';
+import Table from '@rc-component/table';
import '../../assets/index.less';
interface FieldType {
diff --git a/docs/examples/caption.tsx b/docs/examples/caption.tsx
index b6d94461d..9b969d40e 100644
--- a/docs/examples/caption.tsx
+++ b/docs/examples/caption.tsx
@@ -1,6 +1,6 @@
import React from 'react';
-import type { TableProps } from 'rc-table';
-import Table from 'rc-table';
+import type { TableProps } from '@rc-component/table';
+import Table from '@rc-component/table';
import '../../assets/index.less';
const columns: TableProps['columns'] = [
diff --git a/docs/examples/childrenIndent.tsx b/docs/examples/childrenIndent.tsx
index 47a1cad47..573b974d8 100644
--- a/docs/examples/childrenIndent.tsx
+++ b/docs/examples/childrenIndent.tsx
@@ -1,6 +1,6 @@
import React from 'react';
-import type { TableProps } from 'rc-table';
-import Table from 'rc-table';
+import type { TableProps } from '@rc-component/table';
+import Table from '@rc-component/table';
import '../../assets/index.less';
interface RecordType {
diff --git a/docs/examples/className.tsx b/docs/examples/className.tsx
index 8deffd2b1..f5b2d421b 100644
--- a/docs/examples/className.tsx
+++ b/docs/examples/className.tsx
@@ -1,6 +1,6 @@
import React from 'react';
-import type { TableProps } from 'rc-table';
-import Table from 'rc-table';
+import type { TableProps } from '@rc-component/table';
+import Table from '@rc-component/table';
import '../../assets/index.less';
const columns: TableProps['columns'] = [
@@ -56,7 +56,7 @@ const Demo = () => (
footer={() => footer}
/>
scroll
- `row-${i}`}
expandedRowRender={record => extra: {record.a}
}
diff --git a/docs/examples/click-summary-row.tsx b/docs/examples/click-summary-row.tsx
index e5b64c0e7..d4291ecb7 100644
--- a/docs/examples/click-summary-row.tsx
+++ b/docs/examples/click-summary-row.tsx
@@ -1,6 +1,6 @@
/* eslint-disable no-console,func-names,react/no-multi-comp, no-nested-ternary */
import type { ColumnType } from '@/interface';
-import Table from 'rc-table';
+import Table from '@rc-component/table';
import React from 'react';
import '../../assets/index.less';
diff --git a/docs/examples/colspan-rowspan-legacy.tsx b/docs/examples/colspan-rowspan-legacy.tsx
index 1bb33fd3e..fb45b9d7d 100644
--- a/docs/examples/colspan-rowspan-legacy.tsx
+++ b/docs/examples/colspan-rowspan-legacy.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import Table from 'rc-table';
+import Table from '@rc-component/table';
import '../../assets/index.less';
import type { ColumnsType, RenderedCell } from '@/interface';
diff --git a/docs/examples/colspan-rowspan.tsx b/docs/examples/colspan-rowspan.tsx
index 698244db3..695543dfe 100644
--- a/docs/examples/colspan-rowspan.tsx
+++ b/docs/examples/colspan-rowspan.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import Table from 'rc-table';
+import Table from '@rc-component/table';
import '../../assets/index.less';
import type { ColumnsType } from '@/interface';
diff --git a/docs/examples/column-hidden.tsx b/docs/examples/column-hidden.tsx
index 91abb6bfb..2b2dbfcc9 100644
--- a/docs/examples/column-hidden.tsx
+++ b/docs/examples/column-hidden.tsx
@@ -1,5 +1,5 @@
-import type { TableProps } from 'rc-table';
-import Table from 'rc-table';
+import type { TableProps } from '@rc-component/table';
+import Table from '@rc-component/table';
import React from 'react';
import '../../assets/index.less';
diff --git a/docs/examples/column-resize.tsx b/docs/examples/column-resize.tsx
index a3f15cbbc..295204c59 100644
--- a/docs/examples/column-resize.tsx
+++ b/docs/examples/column-resize.tsx
@@ -1,6 +1,6 @@
import React from 'react';
import { Resizable } from 'react-resizable';
-import Table from 'rc-table';
+import Table from '@rc-component/table';
import '../../assets/index.less';
import 'react-resizable/css/styles.css';
import type { ColumnType } from '@/interface';
diff --git a/docs/examples/components.tsx b/docs/examples/components.tsx
index 6883c6ae3..ab3c1ac03 100644
--- a/docs/examples/components.tsx
+++ b/docs/examples/components.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import Table from 'rc-table';
+import Table from '@rc-component/table';
const data = [];
for (let i = 0; i < 100; i += 1) {
diff --git a/docs/examples/dropdown.tsx b/docs/examples/dropdown.tsx
index 4cb3990cf..1b211cce2 100644
--- a/docs/examples/dropdown.tsx
+++ b/docs/examples/dropdown.tsx
@@ -1,9 +1,9 @@
import React from 'react';
-import Menu, { Item, Divider } from 'rc-menu';
-import DropDown from 'rc-dropdown';
-import 'rc-dropdown/assets/index.css';
-import 'rc-menu/assets/index.css';
-import Table from 'rc-table';
+import Menu, { Item, Divider } from '@rc-component/menu';
+import DropDown from '@rc-component/dropdown';
+import '@rc-component/dropdown/assets/index.css';
+import '@rc-component/menu/assets/index.css';
+import Table from '@rc-component/table';
import '../../assets/index.less';
const data = [];
diff --git a/docs/examples/ellipsis-custom-tooltip.tsx b/docs/examples/ellipsis-custom-tooltip.tsx
index 7ae3f7239..cb168dc49 100644
--- a/docs/examples/ellipsis-custom-tooltip.tsx
+++ b/docs/examples/ellipsis-custom-tooltip.tsx
@@ -1,9 +1,9 @@
import React from 'react';
-import Tooltip from 'rc-tooltip';
-import type { TableProps } from 'rc-table';
-import Table from 'rc-table';
+import Tooltip from '@rc-component/tooltip';
+import type { TableProps } from '@rc-component/table';
+import Table from '@rc-component/table';
import '../../assets/index.less';
-import 'rc-tooltip/assets/bootstrap.css';
+import '@rc-component/tooltip/assets/bootstrap.css';
const createColumns = (length: number) => {
return Array.from({ length }, (_, i) => ({
diff --git a/docs/examples/ellipsis.tsx b/docs/examples/ellipsis.tsx
index ded80b949..af64ca9ac 100644
--- a/docs/examples/ellipsis.tsx
+++ b/docs/examples/ellipsis.tsx
@@ -1,6 +1,6 @@
import React from 'react';
-import type { TableProps } from 'rc-table';
-import Table from 'rc-table';
+import type { TableProps } from '@rc-component/table';
+import Table from '@rc-component/table';
import '../../assets/index.less';
const columns: TableProps['columns'] = [
diff --git a/docs/examples/expandIcon.tsx b/docs/examples/expandIcon.tsx
index 981eaba9d..0ec9402f1 100644
--- a/docs/examples/expandIcon.tsx
+++ b/docs/examples/expandIcon.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import Table from 'rc-table';
+import Table from '@rc-component/table';
import '../../assets/index.less';
const data = [
diff --git a/docs/examples/expandedRowClassName.tsx b/docs/examples/expandedRowClassName.tsx
index 6d82f5bb6..d6f78ac8c 100644
--- a/docs/examples/expandedRowClassName.tsx
+++ b/docs/examples/expandedRowClassName.tsx
@@ -1,6 +1,6 @@
import React from 'react';
-import type { TableProps } from 'rc-table';
-import Table from 'rc-table';
+import type { TableProps } from '@rc-component/table';
+import Table from '@rc-component/table';
import styles from './expandedRowClassName.module.less';
diff --git a/docs/examples/expandedRowRender.tsx b/docs/examples/expandedRowRender.tsx
index 791f5a7c7..cb1ec2c63 100644
--- a/docs/examples/expandedRowRender.tsx
+++ b/docs/examples/expandedRowRender.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import Table from 'rc-table';
+import Table from '@rc-component/table';
import '../../assets/index.less';
import { useCheckbox } from './utils/useInput';
import type { ColumnType } from '@/interface';
diff --git a/docs/examples/expandedSticky.tsx b/docs/examples/expandedSticky.tsx
index 8074e74fb..eea552326 100644
--- a/docs/examples/expandedSticky.tsx
+++ b/docs/examples/expandedSticky.tsx
@@ -1,6 +1,6 @@
import React, { useState } from 'react';
-import type { ColumnType } from 'rc-table';
-import Table from 'rc-table';
+import type { ColumnType } from '@rc-component/table';
+import Table from '@rc-component/table';
import '../../assets/index.less';
// 合并单元格
diff --git a/docs/examples/fixedColumns-auto-height.tsx b/docs/examples/fixedColumns-auto-height.tsx
index 9fbe79648..ff5ccc9fa 100644
--- a/docs/examples/fixedColumns-auto-height.tsx
+++ b/docs/examples/fixedColumns-auto-height.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import Table from 'rc-table';
+import Table from '@rc-component/table';
import '../../assets/index.less';
import { ColumnType } from '@/interface';
diff --git a/docs/examples/fixedColumns-resize.tsx b/docs/examples/fixedColumns-resize.tsx
index f30f8244f..2d9977908 100644
--- a/docs/examples/fixedColumns-resize.tsx
+++ b/docs/examples/fixedColumns-resize.tsx
@@ -1,6 +1,6 @@
import React, { useState, useCallback } from 'react';
-import type { TableProps } from 'rc-table';
-import Table from 'rc-table';
+import type { TableProps } from '@rc-component/table';
+import Table from '@rc-component/table';
import '../../assets/index.less';
import type { ColumnType } from '@/interface';
diff --git a/docs/examples/fixedColumns.tsx b/docs/examples/fixedColumns.tsx
index 705c919ae..01cb76781 100644
--- a/docs/examples/fixedColumns.tsx
+++ b/docs/examples/fixedColumns.tsx
@@ -1,5 +1,5 @@
-import type { ColumnType } from 'rc-table';
-import Table from 'rc-table';
+import type { ColumnType } from '@rc-component/table';
+import Table from '@rc-component/table';
import React from 'react';
import '../../assets/index.less';
@@ -34,7 +34,7 @@ const columns: ColumnType[] = [
{ title: 'title8', dataIndex: 'b', key: 'h' },
{ title: 'title9', dataIndex: 'b', key: 'i' },
{ title: 'title10', dataIndex: 'b', key: 'j' },
- { title: 'title11', dataIndex: 'b', key: 'k', width: 50, fixed: 'right' },
+ { title: 'title11', dataIndex: 'b', key: 'k', width: 50, fixed: 'right' },
{ title: 'title12', dataIndex: 'b', key: 'l', width: 100, fixed: 'right' },
];
diff --git a/docs/examples/fixedColumnsAndHeader.tsx b/docs/examples/fixedColumnsAndHeader.tsx
index 022658c90..fe41926db 100644
--- a/docs/examples/fixedColumnsAndHeader.tsx
+++ b/docs/examples/fixedColumnsAndHeader.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import Table from 'rc-table';
+import Table from '@rc-component/table';
import '../../assets/index.less';
const columns = [
diff --git a/docs/examples/fixedColumnsAndHeaderRtl.tsx b/docs/examples/fixedColumnsAndHeaderRtl.tsx
index 06cba5184..d4435d296 100644
--- a/docs/examples/fixedColumnsAndHeaderRtl.tsx
+++ b/docs/examples/fixedColumnsAndHeaderRtl.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import Table from 'rc-table';
+import Table from '@rc-component/table';
import '../../assets/index.less';
import { ColumnsType } from '@/interface';
import { useCheckbox } from './utils/useInput';
diff --git a/docs/examples/grouping-columns-hidden.tsx b/docs/examples/grouping-columns-hidden.tsx
index cbe307028..e9431a67f 100644
--- a/docs/examples/grouping-columns-hidden.tsx
+++ b/docs/examples/grouping-columns-hidden.tsx
@@ -1,6 +1,6 @@
import React from 'react';
-import type { TableProps } from 'rc-table';
-import Table from 'rc-table';
+import type { TableProps } from '@rc-component/table';
+import Table from '@rc-component/table';
import '../../assets/index.less';
const columns: TableProps['columns'] = [
diff --git a/docs/examples/grouping-columns.tsx b/docs/examples/grouping-columns.tsx
index e103d0c56..7ac204911 100644
--- a/docs/examples/grouping-columns.tsx
+++ b/docs/examples/grouping-columns.tsx
@@ -1,6 +1,6 @@
import React from 'react';
-import type { TableProps } from 'rc-table';
-import Table from 'rc-table';
+import type { TableProps } from '@rc-component/table';
+import Table from '@rc-component/table';
import '../../assets/index.less';
const columns: TableProps['columns'] = [
diff --git a/docs/examples/hide-header.tsx b/docs/examples/hide-header.tsx
index 3e4d83121..4a6cd53dc 100644
--- a/docs/examples/hide-header.tsx
+++ b/docs/examples/hide-header.tsx
@@ -1,6 +1,6 @@
import React from 'react';
-import type { TableProps } from 'rc-table';
-import Table from 'rc-table';
+import type { TableProps } from '@rc-component/table';
+import Table from '@rc-component/table';
import '../../assets/index.less';
const columns: TableProps['columns'] = [
diff --git a/docs/examples/hover-perf.tsx b/docs/examples/hover-perf.tsx
index ef739e2a5..acd002315 100644
--- a/docs/examples/hover-perf.tsx
+++ b/docs/examples/hover-perf.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import Table from 'rc-table';
+import Table from '@rc-component/table';
import '../../assets/index.less';
const CellExample = ({ data, count }) => {
diff --git a/docs/examples/jsx.tsx b/docs/examples/jsx.tsx
index 5f5107e67..ed1a682aa 100644
--- a/docs/examples/jsx.tsx
+++ b/docs/examples/jsx.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import Table from 'rc-table';
+import Table from '@rc-component/table';
import '../../assets/index.less';
const { ColumnGroup, Column } = Table;
diff --git a/docs/examples/key.tsx b/docs/examples/key.tsx
index 88e30e9cf..6459341da 100644
--- a/docs/examples/key.tsx
+++ b/docs/examples/key.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import Table from 'rc-table';
+import Table from '@rc-component/table';
import '../../assets/index.less';
const CheckBox = ({ id }) => (
diff --git a/docs/examples/measureRowRender.tsx b/docs/examples/measureRowRender.tsx
index ad482c455..01eb5611b 100644
--- a/docs/examples/measureRowRender.tsx
+++ b/docs/examples/measureRowRender.tsx
@@ -1,6 +1,6 @@
import React from 'react';
-import Table from 'rc-table';
-import type { TableProps } from 'rc-table';
+import Table from '@rc-component/table';
+import type { TableProps } from '@rc-component/table';
const columns = [
{
diff --git a/docs/examples/nested.tsx b/docs/examples/nested.tsx
index 4acbcb3b4..0077b008f 100644
--- a/docs/examples/nested.tsx
+++ b/docs/examples/nested.tsx
@@ -1,6 +1,6 @@
import React from 'react';
-import type { TableProps } from 'rc-table';
-import Table from 'rc-table';
+import type { TableProps } from '@rc-component/table';
+import Table from '@rc-component/table';
import '../../assets/index.less';
const columns: TableProps['columns'] = [
diff --git a/docs/examples/no-data.tsx b/docs/examples/no-data.tsx
index 805e03cce..8289599cc 100644
--- a/docs/examples/no-data.tsx
+++ b/docs/examples/no-data.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import Table from 'rc-table';
+import Table from '@rc-component/table';
import '../../assets/index.less';
const columns = [
diff --git a/docs/examples/react-dnd.tsx b/docs/examples/react-dnd.tsx
index 085b3c4a9..b28600274 100644
--- a/docs/examples/react-dnd.tsx
+++ b/docs/examples/react-dnd.tsx
@@ -5,8 +5,8 @@ import { createGlobalStyle } from 'styled-components';
import update from 'immutability-helper';
import { DragDropContext, DragSource, DropTarget } from 'react-dnd';
import HTML5Backend from 'react-dnd-html5-backend';
-import type { TableProps } from 'rc-table';
-import Table from 'rc-table';
+import type { TableProps } from '@rc-component/table';
+import Table from '@rc-component/table';
import '../../assets/index.less';
// eslint-disable-next-line @babel/no-unused-expressions
diff --git a/docs/examples/row-hoverable.tsx b/docs/examples/row-hoverable.tsx
index 8e89d2ed9..3e84e6ede 100644
--- a/docs/examples/row-hoverable.tsx
+++ b/docs/examples/row-hoverable.tsx
@@ -1,5 +1,5 @@
-import type { TableProps } from 'rc-table';
-import Table from 'rc-table';
+import type { TableProps } from '@rc-component/table';
+import Table from '@rc-component/table';
import React from 'react';
import '../../assets/index.less';
diff --git a/docs/examples/rowAndCellClick.tsx b/docs/examples/rowAndCellClick.tsx
index 4f9bb94ab..278274260 100644
--- a/docs/examples/rowAndCellClick.tsx
+++ b/docs/examples/rowAndCellClick.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import Table from 'rc-table';
+import Table from '@rc-component/table';
import '../../assets/index.less';
const onRowClick = (record, index, event) => {
diff --git a/docs/examples/scopeCol.tsx b/docs/examples/scopeCol.tsx
index 0185b0594..ac89be3b1 100644
--- a/docs/examples/scopeCol.tsx
+++ b/docs/examples/scopeCol.tsx
@@ -1,5 +1,5 @@
import type { ColumnsType } from '@/interface';
-import Table from 'rc-table';
+import Table from '@rc-component/table';
import React from 'react';
import '../../assets/index.less';
diff --git a/docs/examples/scopeRow.tsx b/docs/examples/scopeRow.tsx
index 6f59028ea..7053645c4 100644
--- a/docs/examples/scopeRow.tsx
+++ b/docs/examples/scopeRow.tsx
@@ -1,5 +1,5 @@
import type { ColumnsType } from '@/interface';
-import Table from 'rc-table';
+import Table from '@rc-component/table';
import React from 'react';
import '../../assets/index.less';
diff --git a/docs/examples/scrollX.tsx b/docs/examples/scrollX.tsx
index 49206bc72..4831988c4 100644
--- a/docs/examples/scrollX.tsx
+++ b/docs/examples/scrollX.tsx
@@ -1,6 +1,6 @@
import React from 'react';
-import type { TableProps } from 'rc-table';
-import Table from 'rc-table';
+import type { TableProps } from '@rc-component/table';
+import Table from '@rc-component/table';
import '../../assets/index.less';
const columns: TableProps['columns'] = [
diff --git a/docs/examples/scrollXY.tsx b/docs/examples/scrollXY.tsx
index d435840bf..9bb50aec5 100644
--- a/docs/examples/scrollXY.tsx
+++ b/docs/examples/scrollXY.tsx
@@ -1,6 +1,6 @@
import React from 'react';
-import type { TableProps } from 'rc-table';
-import Table from 'rc-table';
+import type { TableProps } from '@rc-component/table';
+import Table from '@rc-component/table';
import '../../assets/index.less';
const columns: TableProps['columns'] = [
diff --git a/docs/examples/scrollY.tsx b/docs/examples/scrollY.tsx
index fa7908698..965a2afe3 100644
--- a/docs/examples/scrollY.tsx
+++ b/docs/examples/scrollY.tsx
@@ -1,4 +1,4 @@
-import Table, { type Reference } from 'rc-table';
+import Table, { type Reference } from '@rc-component/table';
import React from 'react';
import '../../assets/index.less';
diff --git a/docs/examples/shadow.tsx b/docs/examples/shadow.tsx
index 9069c9f51..af935ea2a 100644
--- a/docs/examples/shadow.tsx
+++ b/docs/examples/shadow.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import Table from 'rc-table';
+import Table from '@rc-component/table';
import '../../assets/index.less';
import type { ColumnsType } from '@/interface';
diff --git a/docs/examples/simple.tsx b/docs/examples/simple.tsx
index 6d636d8cf..116e9f6b1 100644
--- a/docs/examples/simple.tsx
+++ b/docs/examples/simple.tsx
@@ -1,5 +1,5 @@
-import type { TableProps } from 'rc-table';
-import Table from 'rc-table';
+import type { TableProps } from '@rc-component/table';
+import Table from '@rc-component/table';
import React, { useState } from 'react';
import '../../assets/index.less';
diff --git a/docs/examples/stickyHeader.tsx b/docs/examples/stickyHeader.tsx
index 3f602e90b..91fe99b79 100644
--- a/docs/examples/stickyHeader.tsx
+++ b/docs/examples/stickyHeader.tsx
@@ -1,6 +1,6 @@
/* eslint-disable no-console,func-names,react/no-multi-comp */
import React, { useRef } from 'react';
-import Table from 'rc-table';
+import Table from '@rc-component/table';
import '../../assets/index.less';
import type { ColumnType, ColumnsType } from '@/interface';
diff --git a/docs/examples/stickyHeaderAndSummary.tsx b/docs/examples/stickyHeaderAndSummary.tsx
index eb50f096b..aef315b1d 100644
--- a/docs/examples/stickyHeaderAndSummary.tsx
+++ b/docs/examples/stickyHeaderAndSummary.tsx
@@ -1,6 +1,6 @@
/* eslint-disable no-console,func-names,react/no-multi-comp, no-nested-ternary */
import React from 'react';
-import Table from 'rc-table';
+import Table, { Summary } from '@rc-component/table';
import '../../assets/index.less';
import type { ColumnType } from '@/interface';
@@ -89,20 +89,20 @@ const Demo = () => {
scroll={{ x: 1200, y: sticky ? null : 800 }}
data={data}
summary={() => (
-
-
-
-
+
+
+
+
Summary
-
-
+
+
Content
-
-
+
+
Right
-
-
-
+
+
+
)}
/>
diff --git a/docs/examples/styled-components.tsx b/docs/examples/styled-components.tsx
index 72212894b..97b2d26fa 100644
--- a/docs/examples/styled-components.tsx
+++ b/docs/examples/styled-components.tsx
@@ -1,7 +1,7 @@
import React from 'react';
import styled from 'styled-components';
-import type { TableProps } from 'rc-table';
-import Table from 'rc-table';
+import type { TableProps } from '@rc-component/table';
+import Table from '@rc-component/table';
import '../../assets/index.less';
const columns: TableProps['columns'] = [
diff --git a/docs/examples/subTable.tsx b/docs/examples/subTable.tsx
index a0bdcd89b..9df9c5124 100644
--- a/docs/examples/subTable.tsx
+++ b/docs/examples/subTable.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import Table from 'rc-table';
+import Table from '@rc-component/table';
import '../../assets/index.less';
const generateData = () => {
diff --git a/docs/examples/title-and-footer.tsx b/docs/examples/title-and-footer.tsx
index a767591ef..009f28284 100644
--- a/docs/examples/title-and-footer.tsx
+++ b/docs/examples/title-and-footer.tsx
@@ -1,6 +1,6 @@
/* eslint-disable no-param-reassign */
import React from 'react';
-import Table from 'rc-table';
+import Table from '@rc-component/table';
import { useCheckbox } from './utils/useInput';
import '../../assets/index.less';
import type { ColumnType } from '@/interface';
diff --git a/docs/examples/virtual-list-grid.tsx b/docs/examples/virtual-list-grid.tsx
index 30caca3c0..72de31087 100644
--- a/docs/examples/virtual-list-grid.tsx
+++ b/docs/examples/virtual-list-grid.tsx
@@ -1,7 +1,7 @@
import React from 'react';
import { clsx } from 'clsx';
import { VariableSizeGrid as Grid } from 'react-window';
-import Table from 'rc-table';
+import Table from '@rc-component/table';
import '../../assets/index.less';
import './virtual-list.less';
diff --git a/docs/examples/virtual-list.tsx b/docs/examples/virtual-list.tsx
index 4fec48387..55ce842a5 100644
--- a/docs/examples/virtual-list.tsx
+++ b/docs/examples/virtual-list.tsx
@@ -1,7 +1,7 @@
import React from 'react';
import { clsx } from 'clsx';
import { VariableSizeGrid as Grid } from 'react-window';
-import Table from 'rc-table';
+import Table from '@rc-component/table';
import '../../assets/index.less';
import './virtual-list.less';
diff --git a/docs/index.md b/docs/index.md
index 21c746af4..170e08150 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -1,8 +1,7 @@
---
hero:
- title: rc-table
- description: React table component with useful functions
+ title: '@rc-component/table'
+ description: Data table component for React
---
-
diff --git a/package.json b/package.json
index 7470dbb20..16865994a 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "@rc-component/table",
"version": "1.10.2",
- "description": "table ui component for react",
+ "description": "📋 Data table component for React",
"engines": {
"node": ">=8.x"
},
@@ -19,34 +19,35 @@
],
"main": "./lib/index",
"module": "./es/index",
- "types": "./lib/index.d.ts",
- "homepage": "https://github.com/react-component/table",
+ "types": "./es/index.d.ts",
+ "homepage": "https://react-component.github.io/table",
"maintainers": [
"yiminghe@gmail.com",
"afc163@gmail.com"
],
"repository": {
"type": "git",
- "url": "git@github.com:react-component/table.git"
+ "url": "https://github.com/react-component/table.git"
},
"bugs": {
- "url": "https://github.com/react-component/table/issues"
+ "url": "https://github.com/react-component/table/issues"
},
"license": "MIT",
"scripts": {
"start": "dumi dev",
+ "build": "npm run docs:build",
"docs:build": "dumi build",
- "docs:deploy": "gh-pages -d .doc",
+ "docs:deploy": "gh-pages -d docs-dist",
"compile": "father build && lessc assets/index.less assets/index.css",
- "deploy": "npm run docs:build && npm run docs:deploy",
+ "deploy": "npm run docs:build:gh-pages && npm run docs:deploy",
"prettier": "prettier --write \"**/*.{js,jsx,tsx,ts,less,md,json}\"",
- "test": "vitest --watch false",
- "coverage": "vitest run --coverage",
- "prepublishOnly": "npm run compile && rc-np",
"lint": "eslint src",
"tsc": "tsc -p tsconfig.json --noEmit",
- "now-build": "npm run docs:build",
- "prepare": "husky"
+ "test": "vitest run",
+ "coverage": "vitest run --coverage",
+ "prepublishOnly": "npm run compile && rc-np",
+ "prepare": "husky",
+ "docs:build:gh-pages": "GH_PAGES=1 npm run docs:build"
},
"dependencies": {
"@rc-component/context": "^2.0.1",
@@ -56,52 +57,53 @@
"clsx": "^2.1.1"
},
"devDependencies": {
+ "@rc-component/dropdown": "^1.0.2",
"@rc-component/father-plugin": "^2.2.0",
+ "@rc-component/menu": "^1.4.1",
"@rc-component/motion": "^1.3.2",
- "@rc-component/np": "^1.0.3",
+ "@rc-component/np": "^1.0.4",
+ "@rc-component/tooltip": "^1.4.0",
"@testing-library/dom": "^10.4.1",
- "@testing-library/jest-dom": "^6.4.0",
- "@testing-library/react": "^16.3.0",
- "@types/jest": "^30.0.0",
- "@types/node": "^25.2.1",
- "@types/react": "^19.1.13",
- "@types/react-dom": "^19.1.9",
+ "@testing-library/jest-dom": "^6.9.1",
+ "@testing-library/react": "^15.0.7",
+ "@types/jest": "^29.5.14",
+ "@types/node": "^26.0.1",
+ "@types/react": "^18.3.31",
+ "@types/react-dom": "^18.3.7",
"@types/responselike": "^1.0.0",
"@types/styled-components": "^5.1.32",
"@umijs/fabric": "^4.0.1",
- "@vitest/coverage-v8": "^3.2.4",
- "dumi": "^2.1.3",
- "eslint": "^8.54.0",
- "father": "^4.0.0",
- "gh-pages": "^6.1.0",
- "glob": "^11.0.0",
- "husky": "^9.0.11",
+ "@vitest/coverage-v8": "^4.1.9",
+ "dumi": "^2.4.35",
+ "eslint": "^8.57.1",
+ "father": "^4.6.23",
+ "gh-pages": "^6.3.0",
+ "glob": "^13.0.6",
+ "husky": "^9.1.7",
"immutability-helper": "^3.0.0",
- "jsdom": "^28.0.0",
- "less": "^4.1.3",
- "lint-staged": "^16.1.5",
- "prettier": "^3.1.0",
- "rc-dropdown": "~4.0.1",
- "rc-menu": "~9.16.1",
- "rc-tooltip": "^6.2.0",
- "react": "^19.1.1",
+ "jsdom": "^29.1.1",
+ "less": "^4.6.7",
+ "lint-staged": "^16.4.0",
+ "prettier": "^3.9.0",
+ "react": "^18.3.1",
"react-dnd": "^2.5.4",
"react-dnd-html5-backend": "^2.5.4",
- "react-dom": "^19.1.1",
+ "react-dom": "^18.3.1",
"react-resizable": "^3.0.5",
"react-window": "^1.8.5",
"regenerator-runtime": "^0.14.0",
"styled-components": "^6.1.1",
- "typescript": "~5.9.2",
- "vitest": "^3.2.4"
+ "typescript": "^5.9.3",
+ "vitest": "^4.1.9"
},
"peerDependencies": {
"react": ">=18.0.0",
"react-dom": ">=18.0.0"
},
"lint-staged": {
- "**/*.{js,jsx,tsx,ts,md,json}": [
- "prettier --write"
- ]
+ "*": "prettier --write --ignore-unknown"
+ },
+ "publishConfig": {
+ "access": "public"
}
}
diff --git a/tsconfig.json b/tsconfig.json
index d40b7759b..967a67218 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -8,12 +8,53 @@
"skipLibCheck": true,
"esModuleInterop": true,
"paths": {
- "@/*": ["src/*"],
- "@@/*": [".dumi/tmp/*"],
- "rc-table": ["src/index.ts"]
+ "@/*": [
+ "src/*"
+ ],
+ "@@/*": [
+ ".dumi/tmp/*"
+ ],
+ "@rc-component/table": [
+ "src/index.ts"
+ ],
+ "@rc-component/table/es": [
+ "src"
+ ],
+ "@rc-component/table/es/*": [
+ "src/*"
+ ],
+ "rc-table": [
+ "src/index.ts"
+ ],
+ "rc-table/es": [
+ "src"
+ ],
+ "rc-table/es/*": [
+ "src/*"
+ ]
},
- "types": ["vitest/globals", "@testing-library/jest-dom"]
+ "types": [
+ "vitest/globals",
+ "@testing-library/jest-dom"
+ ],
+ "ignoreDeprecations": "5.0"
},
- "include": [".dumirc.ts", "**/*.ts", "**/*.tsx", "tests/__mocks__/shadowTest.tsx"],
- "exclude": ["./vitest.config.ts"]
+ "include": [
+ ".fatherrc.ts",
+ ".dumirc.ts",
+ "typings.d.ts",
+ "./src/**/*.ts",
+ "./src/**/*.tsx",
+ "./docs/**/*.ts",
+ "./docs/**/*.tsx",
+ "./tests/**/*.ts",
+ "./tests/**/*.tsx",
+ "tests/__mocks__/shadowTest.tsx"
+ ],
+ "exclude": [
+ "./vitest.config.mts",
+ "docs-dist",
+ "lib",
+ "es"
+ ]
}
diff --git a/vercel.json b/vercel.json
index cc12e4054..abcaed321 100644
--- a/vercel.json
+++ b/vercel.json
@@ -1,3 +1,6 @@
{
- "framework": "umijs"
+ "buildCommand": "npm run build",
+ "outputDirectory": "docs-dist",
+ "installCommand": "npm install --ignore-scripts --no-audit --loglevel=warn",
+ "framework": null
}
diff --git a/vitest.config.mts b/vitest.config.mts
index 8ecfb24e0..d6d6e391a 100644
--- a/vitest.config.mts
+++ b/vitest.config.mts
@@ -10,7 +10,20 @@ export default defineConfig({
setupFiles: './tests/setup.ts',
environment: 'jsdom',
coverage: {
- exclude: ['**/docs/**', '**/__mocks__/**', '**/coverage/**'],
+ include: ['src/**/*.{ts,tsx}'],
+ exclude: [
+ '**/docs/**',
+ '**/__mocks__/**',
+ '**/coverage/**',
+ '**/.dumi/**',
+ '**/.vercel/**',
+ '**/es/**',
+ '**/lib/**',
+ '**/*.config.*',
+ '**/.dumirc.ts',
+ '**/.fatherrc.ts',
+ '**/*.d.ts',
+ ],
},
},
});