{"name":"@rc-component/table","version":"1.11.0","keywords":["react","react-table","table","component","ui"],"license":"MIT","_id":"@rc-component/table@1.11.0","maintainers":[{"name":"zombiej","email":"smith3816@gmail.com"},{"name":"afc163","email":"afc163@gmail.com"},{"name":"madccc","email":"1075746765@qq.com"},{"name":"peachscript","email":"scdzwyxst@gmail.com"},{"name":"chenshuai2144","email":"wasd2144@hotmail.com"}],"homepage":"https://react-component.github.io/table","bugs":{"url":"https://github.com/react-component/table/issues"},"dist":{"shasum":"928745f063a62cfefdd58b2c46fad03a0bea81f0","tarball":"http://registry-npm.ywwl.com/@rc-component/table/download/@rc-component/table-1.11.0.tgz","fileCount":202,"integrity":"sha512-04D/WjNf27c5j7D3mgp2dxFlJ3dfqP10nhtfYCZrrCu462U8eLi0U0dN3kBbz+ssXnFaoXUFqU14tLeWujgv7w==","signatures":[{"sig":"MEUCIQCTR2VFY24jmpEBxP6J96z3HRpYI3nN7Fs61eEQ1WWviwIgOb2ZTvh+uVlMaw7WjYEyO+6yNaaZufqLt3novonhQ/w=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIQDomPhmjvLUmop8FRz3+hZwFVHhy4TpgTDrDk4CkXg4fgIgbxb3oihAB3JFyASwIqIU3gcLnpkG5YU8lsp7LCk/QOU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":388095,"size":64455,"noattachment":false,"key":"/@rc-component/table/-/@rc-component/table-1.11.0.tgz"},"main":"./lib/index","types":"./es/index.d.ts","module":"./es/index","engines":{"node":">=8.x"},"gitHead":"08188d34c68e3581e73acb9d8e8aa2f22d21abc9","scripts":{"tsc":"tsc -p tsconfig.json --noEmit","lint":"eslint src","test":"vitest run","build":"npm run docs:build","start":"dumi dev","deploy":"npm run docs:build:gh-pages && npm run docs:deploy","compile":"father build && lessc assets/index.less assets/index.css","prepare":"husky","coverage":"vitest run --coverage","prettier":"prettier --write \"**/*.{js,jsx,tsx,ts,less,md,json}\"","docs:build":"dumi build","docs:deploy":"gh-pages -d docs-dist","prepublishOnly":"npm run compile && rc-np","docs:build:gh-pages":"GH_PAGES=1 npm run docs:build"},"_npmUser":{"name":"zombiej","email":"smith3816@gmail.com"},"repository":{"url":"git+https://github.com/react-component/table.git","type":"git"},"_npmVersion":"11.7.0","description":"📋 Data table component for React","directories":{},"lint-staged":{"*":"prettier --write --ignore-unknown"},"_nodeVersion":"22.15.1","dependencies":{"clsx":"^2.1.1","@rc-component/util":"^1.11.1","@rc-component/context":"^2.0.1","@rc-component/virtual-list":"^1.0.1","@rc-component/resize-observer":"^1.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"dumi":"^2.4.38","glob":"^13.0.6","less":"^4.6.7","husky":"^9.1.7","jsdom":"^29.1.1","react":"^19.2.7","eslint":"^10.6.0","father":"^4.6.24","vitest":"^4.1.9","globals":"^17.7.0","gh-pages":"^6.3.0","prettier":"^3.9.4","react-dnd":"^16.0.1","react-dom":"^19.2.7","@eslint/js":"^10.0.1","typescript":"^6.0.3","@types/node":"^26.0.1","lint-staged":"^17.0.8","@types/react":"^19.2.17","react-window":"^2.2.7","@eslint/compat":"^2.1.0","react-resizable":"^4.0.2","@rc-component/np":"^1.0.4","@types/react-dom":"^19.2.3","styled-components":"^6.1.1","typescript-eslint":"^8.62.1","@rc-component/menu":"^1.4.1","eslint-plugin-jest":"^29.15.4","@types/responselike":"^1.0.3","@vitest/coverage-v8":"^4.1.9","eslint-plugin-react":"^7.37.5","immutability-helper":"^3.0.0","regenerator-runtime":"^0.14.0","@rc-component/motion":"^1.3.2","@testing-library/dom":"^10.4.1","@rc-component/tooltip":"^1.4.0","@rc-component/dropdown":"^1.0.2","@testing-library/react":"^16.3.2","eslint-config-prettier":"^10.1.8","react-dnd-html5-backend":"^16.0.1","@types/styled-components":"^5.1.36","@testing-library/jest-dom":"^6.9.1","eslint-plugin-react-hooks":"^7.1.1","@rc-component/father-plugin":"^2.2.0"},"peerDependencies":{"react":">=18.0.0","react-dom":">=18.0.0"},"_npmOperationalInternal":{"tmp":"tmp/table_1.11.0_1785489404643_0.4116583046057467","host":"s3://npm-registry-packages-npm-production"},"readme":"<div align=\"center\">\n  <h1>@rc-component/table</h1>\n  <p><sub><a href=\"https://ant.design\"><img alt=\"Ant Design\" height=\"14\" src=\"https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg\" style=\"vertical-align: -0.125em;\" /></a> Ant Design 生态的一部分。</sub></p>\n  <p>📋 React 底层表格基础组件，服务于复杂数据展示。</p>\n\n  <p>\n    <a href=\"https://npmjs.org/package/@rc-component/table\"><img alt=\"NPM version\" src=\"https://img.shields.io/npm/v/@rc-component/table.svg?style=flat-square\"></a>\n    <a href=\"https://npmjs.org/package/@rc-component/table\"><img alt=\"npm downloads\" src=\"https://img.shields.io/npm/dm/@rc-component/table.svg?style=flat-square\"></a>\n    <a href=\"https://github.com/react-component/table/actions/workflows/main.yml\"><img alt=\"build status\" src=\"https://github.com/react-component/table/actions/workflows/main.yml/badge.svg\"></a>\n    <a href=\"https://app.codecov.io/gh/react-component/table\"><img alt=\"Codecov\" src=\"https://img.shields.io/codecov/c/github/react-component/table/master.svg?style=flat-square\"></a>\n    <a href=\"https://bundlephobia.com/package/@rc-component/table\"><img alt=\"bundle size\" src=\"https://img.shields.io/bundlephobia/minzip/@rc-component/table?style=flat-square\"></a>\n    <a href=\"https://github.com/umijs/dumi\"><img alt=\"dumi\" src=\"https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square\"></a>\n  </p>\n</div>\n\n<p align=\"center\"><a href=\"./README.md\">English</a> | 简体中文</p>\n\n## 特性\n\n- 灵活的列、摘要、固定标题、粘性、可扩展行和虚拟表支持。\n- TypeScript-first API 专为设计系统中的组合而设计。\n- 被 Ant Design 使用 Table 等 React 数据展示体验。\n\n## 安装\n\n```bash\nnpm install @rc-component/table\n```\n\n## 使用\n\n```tsx\nimport Table from '@rc-component/table';\nimport type { ColumnsType } from '@rc-component/table';\n\ninterface User {\n  key: string;\n  name: string;\n  age: number;\n  address: string;\n}\n\nconst columns: ColumnsType<User> = [\n  { title: 'Name', dataIndex: 'name', key: 'name', width: 120 },\n  { title: 'Age', dataIndex: 'age', key: 'age', width: 80 },\n  { title: 'Address', dataIndex: 'address', key: 'address' },\n];\n\nconst data: User[] = [\n  { key: '1', name: 'Jack', age: 28, address: 'Somewhere' },\n  { key: '2', name: 'Rose', age: 36, address: 'Somewhere else' },\n];\n\nexport default () => <Table columns={columns} data={data} />;\n```\n\n## 示例\n\n运行本地 dumi 站点：\n\n```bash\nnpm install\nnpm start\n```\n\n然后打开 `http://localhost:8000`。\n\n## API\n\n### Properties\n\n| 名称 | 类型 | 默认值 | 说明 |\n| --- | --- | --- | --- |\n| tableLayout | `auto` \\| `fixed` | `auto` \\| 任何列的 `fixed` 都是固定的，或者省略号或标题是固定的 | https://developer.mozilla.org/en-US/docs/Web/CSS/table-layout |\n| prefixCls | String | `rc-table` |  |\n| className | String |  | 附加 className |\n| id | String |  | 容器div的标识符 |\n| useFixedHeader | Boolean | false | 是否对标题使用分隔符表。更好地设置列宽度 |\n| scroll | Object | {x: false, y: false} | 表格是否可以在x/y方向滚动，`x`或`y`可以是一个数字，表示表格主体的宽度和高度 |\n| expandable | Object |  | 配置展开道具 |\n| expandable.defaultExpandAllRows | Boolean | false | 初始展开所有行 |\n| expandable.defaultExpandedRowKeys | String[] | [] | 初始扩展行键 |\n| expandable.expandedRowKeys | String[] |  | 当前扩展行键 |\n| expandable.expandedRowRender | Function(recode, index, indent, expanded):ReactNode |  | 内容渲染到扩展行 |\n| expandable.forceRender | Boolean | false | 在展开前强制渲染展开行内容。虚拟模式下，仅强制渲染虚拟列表当前挂载的行；屏幕外的行仍可能被卸载 |\n| expandable.expandedRowClassName | `string` \\| `(recode, index, indent) => string` |  | 获取扩展行的 className |\n| expandable.columnTitle | ReactNode \\| Function({ expandIcon }) |  | 自定义展开列表头 |\n| expandable.expandRowByClick | boolean |  | 支持点击行展开 |\n| expandable.expandIconColumnIndex | Number | 0 | ExpandIconAsCell 为 false 时将插入哪一列的 ExpandIcon 索引 |\n| expandable.expandIcon | props => ReactNode |  | 已废弃。请使用 `components.ExpandIcon`；此配置仅作为行展开图标的后备方案保留 |\n| expandable.indentSize | Number | 15 | 每一级 `data[i].children` 的缩进尺寸，建议配合指定的 `column.width` 使用 |\n| expandable.rowExpandable | (record) => boolean |  | 配置行支持可扩展 |\n| expandable.showExpandAll | Boolean | false | 使用 `expandedRowRender` 时在展开列的表头中显示全部展开图标 |\n| expandable.onExpand | Function(expanded, record) |  | 单击展开图标时调用的函数 |\n| expandable.onExpandAll | Function(expanded) |  | 单击全部展开图标时调用的函数 |\n| expandable.onExpandedRowsChange | Function(expandedRows) |  | 扩展行更改时调用的函数 |\n| expandable.fixed | String \\| Boolean | - | 当表格水平滚动时，此展开图标将被修复： true 或 `left` 或 `right` 和 `expandIconColumnIndex` 需要保留在第一个或最后一个 |\n| rowKey | string or Function(record, index):string | 'key' | 如果 rowKey 是字符串，则 `record[rowKey]` 将用作键。如果 rowKey 是函数，则 `rowKey(record, index)` 的返回值将用作 key。 |\n| rowClassName | string or Function(record, index, indent):string |  | 获取行的 className |\n| rowRef | Function(record, index, indent):string |  | 获取行 ref key |\n| data | Object[] |  | 要呈现的数据记录数组 |\n| onRow | Function(record, index) |  | 每行设置自定义道具。 |\n| onHeaderRow | Function(record, index) |  | 为每个标题行设置自定义道具。 |\n| showHeader | Boolean | true | 是否显示表头 |\n| hidden | Boolean | `false` | 隐藏列。 |\n| title | Function(currentData) |  | 表格标题渲染函数 |\n| footer | Function(currentData) |  | 表页脚渲染函数 |\n| emptyText | React.Node or Function | `No Data` | 数据为空时显示文本 |\n| columns | Object[] |  | 表的列配置见下表 |\n| components | Object |  | 覆盖表元素，请参阅 [#171](https://github.com/react-component/table/pull/171) 了解更多详细信息 |\n| components.ExpandIcon | `React.ComponentType<ExpandIconProps>` |  | 自定义行展开和全部展开图标。接收 `type`（`row` 或 `all`）、`prefixCls`、`expanded`、`expandable`、`onClick`，仅行图标接收 `record` |\n| sticky | boolean \\| {offsetHeader?: number, offsetScroll?: number, getContainer?: () => Window \\| HTMLElement } | false | 粘贴标题和滚动条 |\n| summary | (data: readonly RecordType[]) => React.ReactNode | - | `table` 组件中的 `summary` 属性用于定义汇总行。 |\n| rowHoverable | boolean | true | 表格 hover 交互 |\n\n### 方法\n\n#### scrollTo\n\nTable 组件公开 `scrollTo` 方法来滚动到特定位置：\n\n```js\nconst tblRef = useRef();\ntblRef.current?.scrollTo({ key: 'rowKey', align: 'start' });\n```\n\n| 名称 | 类型 | 默认值 | 说明 |\n| --- | --- | --- | --- |\n| index | number | - | 要滚动到的行索引 |\n| top | number | - | 滚动到特定顶部位置（以像素为单位） |\n| key | string | - | 按行键滚动至行 |\n| offset | number | - | 与目标位置的额外偏移 |\n| align | `start` \\| `center` \\| `end` \\| `nearest` | `nearest` | 滚动容器内目标元素的对齐方式。 `start` 对齐到顶部，`center` 对齐到中间，`end` 对齐到底部，`nearest` 自动选择最接近的对齐方式。注意：虚拟表不支持 `center`。 |\n\n## Column 属性\n\n| 名称 | 类型 | 默认值 | 说明 |\n| --- | --- | --- | --- |\n| key | String |  | 本栏目关键 |\n| className | String |  | 该列的 className |\n| colSpan | Number |  | 该列的 head colSpan |\n| title | React节点 |  | 本栏目标题 |\n| dataIndex | String |  | 数据记录的显示字段 |\n| 宽度 | String \\| Number |  | 宽度具体比例根据柱子的宽度计算 |\n| minWidth | Number |  | 列的最小宽度，仅当 tableLayout 为 auto 时有效 |\n| fixed | String \\| Boolean |  | 当表格水平滚动时此列将被固定： true 或 'left' 或 'right' |\n| align | String |  | 指定单元格内容的对齐方式 |\n| ellipsis | Boolean |  | 指定单元格内容是否省略 |\n| rowScope | 'row' \\| 'rowgroup' |  | 设置此列中所有单元格的范围属性 |\n| onCell | Function(record, index) |  | 为每个单元格设置自定义道具。 |\n| onHeaderCell | Function(record) |  | 为每个标题单元格设置自定义属性。 |\n| 使成为 | 函数（值、行、索引） |  | 单元格渲染函数，参数为单元格文本、当前行记录和行索引。可返回 `{ children: value, props: { colSpan: 1, rowSpan: 1 } }`，其中 `children` 是单元格文本，`props` 是单元格设置，例如 `colSpan` 设置 td colspan，`rowSpan` 设置 td rowspan |\n\n## Summary Props\n\n### Table.Summary\n\n| 名称 | 类型 | 默认值 | 说明 |\n| --- | --- | --- | --- |\n| key | String |  | 本摘要的关键 |\n| fixed | boolean \\| 'top' \\| 'bottom' | - | `true` 修复了表格底部的汇总行。 `top` 将汇总行固定在表格顶部，而 `bottom` 将其固定在底部。 `undefined` 或 `false` 使摘要行可随表格一起滚动。 |\n\n### Table.Summary.Row\n\n| 名称 | 类型 | 默认值 | 说明 |\n| --- | --- | --- | --- |\n| key | String |  | 本摘要的关键 |\n| className | String | - | 此摘要行的 className |\n| 风格 | React.CSSProperties | - | 此摘要行的样式 |\n| onClick | (e?: React.MouseEvent\\<HTMLElement>) => void | - | `Table.Summary.Row` 组件中的 `onClick` 属性可用于设置汇总行的单击事件处理程序。 |\n\n## 本地开发\n\n```bash\nnpm install\nnpm start\n```\n\ndumi 站点默认运行在 `http://localhost:8000`。\n\n在发送拉取请求之前运行检查：\n\n```bash\nnpm run lint\nnpm run tsc\nnpm test\nnpm run build\n```\n\n## 发布\n\n```bash\nnpm run prepublishOnly\n```\n\n包构建完成后，发布流程由 `@rc-component/np` 通过 `rc-np` 命令处理。\n\n## Ecosystem\n\n该包属于 React Component 组织，并与 Ant Design 一同维护。 上方 Ant Design 标识仅用于说明生态归属；组件本身仍保持框架级、低样式耦合的定位。\n\n## 许可证\n\n@rc-component/table 基于 [MIT](./LICENSE) 许可证发布。\n","publish_time":1785489404726,"_cnpm_publish_time":1785489404726,"dist-tags":{"latest":"1.12.0"}}