From bbca1c74035c67f49f7c9ed3b7083b5a36a43fe6 Mon Sep 17 00:00:00 2001
From: afc163 📜 Virtual scrolling list component for React.
+
+ Part of the Ant Design ecosystem.@rc-component/virtual-list
+
+
+
+ {(item) =>
+);
+```
-[](https://npmjs.org/package/@rc-component/virtual-list)
+## Examples
-## Usage
+Run the local dumi site to explore the examples:
-```tsx
-import List from '@rc-component/virtual-list';
+```bash
+npm install
+npm start
+```
+
+## API
+
+### List
+
+| Prop | Description | Type | Default |
+| ---------- | ---------------------------------------------------------------------------------------------------------------------- | -------------------------------------- | ------- |
+| children | Render function for each item. The third argument contains measuring props used by legacy browser compatibility paths. | `(item, index, props) => ReactElement` | - |
+| component | Custom list container element. | `string` \| `ComponentType` | `div` |
+| data | Items rendered by the virtual list. | `T[]` | - |
+| disabled | Disable scroll position checks, usually while coordinating animation. | `boolean` | `false` |
+| fullHeight | Whether the holder should keep full height. | `boolean` | `true` |
+| height | Visible list height. | `number` | - |
+| itemHeight | Minimum item height used to calculate the virtual range. | `number` | - |
+| itemKey | Key field or key getter for items. | `string` \| `(item) => React.Key` | - |
+| onScroll | Called when the list scrolls. | `React.UIEventHandler
- {(index) =>
;
+```bash
+npm install
+npm start
+npm test
+npm run tsc
+npm run compile
+npm run build
```
-# API
+## Release
-## List
+The release flow is handled by `@rc-component/np` from the `prepublishOnly` script:
+
+```bash
+npm publish
+```
-| Prop | Description | Type | Default |
-| ---------- | ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
-| children | Render props of item | (item, index, props) => ReactElement | - |
-| component | Customize List dom element | string \| Component | div |
-| data | Data list | Array | - |
-| disabled | Disable scroll check. Usually used on animation control | boolean | false |
-| height | List height | number | - |
-| itemHeight | Item minimum height | number | - |
-| itemKey | Match key with item | string | - |
-| styles | style | { horizontalScrollBar?: React.CSSProperties; horizontalScrollBarThumb?: React.CSSProperties; verticalScrollBar?: React.CSSProperties; verticalScrollBarThumb?: React.CSSProperties; } | - |
+## License
-`children` provides additional `props` argument to support IE 11 scroll shaking.
-It will set `style` to `visibility: hidden` when measuring. You can ignore this if no requirement on IE.
+@rc-component/virtual-list is released under the MIT license.
diff --git a/docs/demo/horizontal-scroll.md b/docs/demo/horizontal-scroll.md
index 7afcf130..8ae96f1e 100644
--- a/docs/demo/horizontal-scroll.md
+++ b/docs/demo/horizontal-scroll.md
@@ -5,4 +5,4 @@ nav:
path: /demo
---
-
\ No newline at end of file
+
diff --git a/docs/index.md b/docs/index.md
index 8eb92fd2..501296b5 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -1,5 +1,5 @@
---
-title: rc-virtual-list
+title: '@rc-component/virtual-list'
---
diff --git a/package.json b/package.json
index 2ed54719..6762108d 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "@rc-component/virtual-list",
"version": "1.2.0",
- "description": "React Virtual List Component",
+ "description": "Virtual scrolling list component for React.",
"engines": {
"node": ">=8.x"
},
@@ -28,13 +28,19 @@
"main": "./lib/index",
"module": "./es/index",
"scripts": {
- "start": "dumi dev",
- "build": "dumi build",
+ "build": "npm run compile && npm run docs:build",
"compile": "father build",
- "prepublishOnly": "npm run compile && rc-np",
+ "coverage": "rc-test --coverage",
+ "docs:build": "dumi build",
+ "docs:deploy": "gh-pages -d docs-dist",
+ "deploy": "npm run gh-pages",
+ "gh-pages": "cross-env GH_PAGES=1 npm run compile && npm run docs:build && npm run docs:deploy",
"lint": "eslint src/ --ext .tsx,.ts",
+ "prepublishOnly": "npm run compile && rc-np",
+ "prettier": "prettier --write --ignore-unknown .",
+ "start": "dumi dev",
"test": "rc-test",
- "now-build": "npm run build"
+ "tsc": "tsc --noEmit"
},
"peerDependencies": {
"react": ">=18.0.0",
@@ -59,7 +65,10 @@
"rc-test": "^7.1.3",
"react": "^18.3.1",
"react-dom": "^18.3.1",
- "typescript": "^5.0.0"
+ "typescript": "^5.0.0",
+ "cross-env": "^10.1.0",
+ "gh-pages": "^6.3.0",
+ "prettier": "^3.3.2"
},
"dependencies": {
"@babel/runtime": "^7.20.0",
diff --git a/tsconfig.json b/tsconfig.json
index 30faa7c5..82c7ef7a 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -8,15 +8,13 @@
"skipLibCheck": true,
"esModuleInterop": true,
"paths": {
- "@/*": [
- "src/*"
- ],
- "@@/*": [
- "src/.umi/*"
- ],
- "rc-virtual-list": [
- "src/index.ts"
- ]
+ "@/*": ["src/*"],
+ "@@/*": [".dumi/tmp/*"],
+ "@rc-component/virtual-list": ["src/index.ts"],
+ "@rc-component/virtual-list/es": ["src"],
+ "@rc-component/virtual-list/es/*": ["src/*"]
}
- }
-}
\ No newline at end of file
+ },
+ "include": [".dumirc.ts", "src", "tests", "docs/examples"],
+ "exclude": ["docs-dist", "lib", "es"]
+}
diff --git a/vercel.json b/vercel.json
index 57c51ac8..5f9139ef 100644
--- a/vercel.json
+++ b/vercel.json
@@ -1,3 +1,6 @@
{
- "framework": "umijs"
-}
\ No newline at end of file
+ "framework": "umijs",
+ "installCommand": "npm install",
+ "buildCommand": "npm run build",
+ "outputDirectory": "docs-dist"
+}
From ec1632067732aef4a67e6f5f943ddeb09e3fe065 Mon Sep 17 00:00:00 2001
From: afc163
Part of the Ant Design ecosystem.
+Part of the Ant Design ecosystem.
Part of the Ant Design ecosystem. 📜 Virtual scrolling list component for React.
-
- Part of the Ant Design ecosystem.
From 5e42665450ec620b7319ac65e4d71f5b53f79d5a Mon Sep 17 00:00:00 2001
From: afc163
@rc-component/virtual-list
+
-
-
English | 简体中文
+ ## Highlights diff --git a/README.zh-CN.md b/README.zh-CN.md new file mode 100644 index 00000000..2e93794e --- /dev/null +++ b/README.zh-CN.md @@ -0,0 +1,94 @@ + + +English | 简体中文
+ + +## 特性 + +- Built for React and maintained by the rc-component team. +- 被 Ant Design 使用和其他 React 组件库使用。 +- 提供 TypeScript declarations with both ES module and CommonJS outputs. +- 保留 examples, tests, and preview builds aligned with the package source. + +## 安装 + +```bash +npm install @rc-component/virtual-list +``` + +## 使用 + +```tsx +import List from '@rc-component/virtual-list'; + +const data = Array.from({ length: 1000 }).map((_, index) => ({ + id: index, + label: `Item ${index}`, +})); + +export default () => ( +Part of the Ant Design ecosystem.
+📜 Virtual scrolling list component for React.
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 2e93794e..6965130e 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -1,6 +1,7 @@
Ant Design 生态的一部分。
+🧾 React 虚拟列表组件,用于高性能渲染长列表。
Part of the Ant Design ecosystem. 📜 Virtual scrolling list component for React.
Ant Design 生态的一部分。 🧾 React 虚拟列表组件,用于高性能渲染长列表。 📜 React 虚拟列表组件,用于高性能渲染长列表。
📜 Virtual scrolling list component for React. 📜 React 虚拟列表组件,用于高性能渲染长列表。
From 5341593deaddbd851b628072d29b6aac3964e6e9 Mon Sep 17 00:00:00 2001
From: afc163
@rc-component/virtual-list
-
+
Part of the Ant Design ecosystem.
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 6965130e..832180e8 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -1,8 +1,7 @@
@rc-component/virtual-list
-
-
Ant Design 生态的一部分。
@@ -18,10 +17,10 @@
## 特性
-- Built for React and maintained by the rc-component team.
+- 面向 React 构建,并由 rc-component 团队维护。
- 被 Ant Design 使用和其他 React 组件库使用。
-- 提供 TypeScript declarations with both ES module and CommonJS outputs.
-- 保留 examples, tests, and preview builds aligned with the package source.
+- 提供 TypeScript 类型声明,同时输出 ES module 和 CommonJS 产物。
+- 示例、测试和预览构建与包源码保持一致。
## 安装
@@ -48,7 +47,7 @@ export default () => (
## 示例
-Run the local dumi site to explore the examples:
+运行本地 dumi 站点查看示例:
```bash
npm install
@@ -61,17 +60,17 @@ npm start
| 属性 | 说明 | 类型 | 默认值 |
| ---------- | ---------------------------------------------------------------------------------------------------------------------- | -------------------------------------- | ------- |
-| children | Render function for each item. The third argument contains measuring props used by legacy browser compatibility paths. | `(item, index, props) => ReactElement` | - |
-| component | Custom list container element. | `string` \| `ComponentType` | `div` |
-| data | Items rendered by the virtual list. | `T[]` | - |
-| disabled | Disable scroll position checks, usually while coordinating animation. | `boolean` | `false` |
-| fullHeight | Whether the holder should keep full height. | `boolean` | `true` |
-| height | Visible list height. | `number` | - |
-| itemHeight | Minimum item height used to calculate the virtual range. | `number` | - |
-| itemKey | Key field or key getter for items. | `string` \| `(item) => React.Key` | - |
-| onScroll | Called when the list scrolls. | `React.UIEventHandler
@rc-component/virtual-list
Part of the Ant Design ecosystem.
@rc-component/virtual-list
Ant Design 生态的一部分。