{"name":"@rc-component/table","version":"1.3.0","keywords":["react","react-table","table","component","ui"],"license":"MIT","_id":"@rc-component/table@1.3.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"}],"homepage":"http://github.com/react-component/table","bugs":{"url":"http://github.com/react-component/table/issues"},"dist":{"shasum":"c540ebd11eab11bb555ddfcf50868eb5485dc37c","tarball":"http://registry-npm.ywwl.com/@rc-component/table/download/@rc-component/table-1.3.0.tgz","fileCount":200,"integrity":"sha512-B6oVlFOnMrPbT7gM9kD1w0IN+ea3YSHYpGy3sRb2ZRsAAyajpSY4wRDtAr+TqiS19l0lA7aEXHi67inTwGDP1Q==","signatures":[{"sig":"MEUCIQDjfGrJyImi7JoMwxxxP9Os4NQS35+Rh5ic+R32ocFnFQIgXvM4zibGteVa0QPD/vV9aj01jj4WxiCldPqGefMidwk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":363326,"size":57997,"noattachment":false,"key":"/@rc-component/table/-/@rc-component/table-1.3.0.tgz"},"main":"./lib/index","types":"./lib/index.d.ts","module":"./es/index","engines":{"node":">=8.x"},"gitHead":"d696f7549c92f59a15ceeda72e193677906e0209","scripts":{"tsc":"tsc -p tsconfig.json --noEmit","lint":"eslint src/ --ext .tsx,.ts","test":"vitest --watch false","start":"dumi dev","deploy":"npm run docs:build && npm run docs:deploy","compile":"father build && lessc assets/index.less assets/index.css","prepare":"husky install","coverage":"vitest run --coverage","prettier":"prettier --write \"**/*.{js,jsx,tsx,ts,less,md,json}\"","now-build":"npm run docs:build","docs:build":"dumi build","docs:deploy":"gh-pages -d .doc","prepublishOnly":"npm run compile && rc-np"},"_npmUser":{"name":"zombiej","email":"smith3816@gmail.com"},"repository":{"url":"git+ssh://git@github.com/react-component/table.git","type":"git"},"_npmVersion":"10.9.2","description":"table ui component for react","directories":{},"lint-staged":{"**/*.{js,jsx,tsx,ts,md,json}":["prettier --write"]},"_nodeVersion":"22.15.1","dependencies":{"classnames":"^2.2.5","rc-virtual-list":"^3.14.2","@rc-component/util":"^1.1.0","@rc-component/context":"^1.4.0","@rc-component/resize-observer":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"dumi":"^2.1.3","glob":"^11.0.0","less":"^4.1.3","husky":"^9.0.11","jsdom":"^25.0.0","react":"^16.0.0","eslint":"^8.54.0","father":"^4.0.0","vitest":"^2.0.5","rc-menu":"~9.16.1","gh-pages":"^6.1.0","prettier":"^3.1.0","cross-env":"^7.0.0","react-dnd":"^2.5.4","react-dom":"^16.0.0","rc-animate":"^3.0.0","rc-tooltip":"^6.2.0","typescript":"~5.7.2","@types/jest":"^29.5.0","lint-staged":"^15.1.0","rc-dropdown":"~4.0.1","@types/react":"^18.0.28","react-window":"^1.8.5","@umijs/fabric":"^4.0.1","react-resizable":"^3.0.5","@rc-component/np":"^1.0.3","@types/react-dom":"^19.0.4","react-virtualized":"^9.12.0","styled-components":"^6.1.1","eslint-plugin-jest":"^28.2.0","@types/responselike":"^1.0.0","@vitest/coverage-v8":"^2.0.5","immutability-helper":"^3.0.0","regenerator-runtime":"^0.14.0","eslint-plugin-unicorn":"^56.0.0","@testing-library/react":"^12.1.5","react-dnd-html5-backend":"^2.5.4","@types/styled-components":"^5.1.32","@testing-library/jest-dom":"^6.4.0","@rc-component/father-plugin":"^2.0.1"},"peerDependencies":{"react":">=16.9.0","react-dom":">=16.9.0"},"_npmOperationalInternal":{"tmp":"tmp/table_1.3.0_1747741215628_0.42935784117028275","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":1747741215860,"_cnpm_publish_time":1747741215860,"dist-tags":{"latest":"1.12.0"}}