{"_id":"@rc-component/upload","_rev":"4-d33ba75ef8b692f74d75f3e34512852a","name":"@rc-component/upload","dist-tags":{"latest":"1.2.0"},"versions":{"1.0.0":{"name":"@rc-component/upload","version":"1.0.0","keywords":["react","react-component","react-upload","upload"],"license":"MIT","_id":"@rc-component/upload@1.0.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":"http://github.com/react-component/upload","bugs":{"url":"http://github.com/react-component/upload/issues"},"dist":{"shasum":"8de5b9bef62f130cca764486cc443f88296b8717","tarball":"https://registry.npmjs.org/@rc-component/upload/-/upload-1.0.0.tgz","fileCount":35,"integrity":"sha512-jRnGElnVycACSAm9DvDrOJuC1PefhwjkZH60DFUz836dJF4kfrOVhqTg86kD3gemcRRGIbxO8RA5tvsTk+q2rA==","signatures":[{"sig":"MEYCIQD2nLRmaPoHaP4bPfbCX0Ahq7nguvP6cK0lrQVqtd3ZuwIhAIELrBgP1jt16nTaZMJWiUY1a3Ax6MDCdPEbjX1mBLNj","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":57989},"main":"./lib/index","types":"./lib/index.d.ts","module":"./es/index","gitHead":"2e160a2b4c24d954e95dff302519528ca408823d","scripts":{"lint":"eslint src/ --ext .ts,.tsx,.jsx,.js,.md","test":"rc-test","start":"dumi dev","compile":"father build","coverage":"rc-test --coverage","prettier":"prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"","now-build":"npm run docs:build","docs:build":"dumi build","docs:deploy":"npm run docs:build && gh-pages -d dist","postpublish":"npm run docs:deploy","prepublishOnly":"npm run compile && rc-np"},"_npmUser":{"name":"zombiej","email":"smith3816@gmail.com"},"repository":{"url":"git+ssh://git@github.com/react-component/upload.git","type":"git"},"_npmVersion":"10.9.2","description":"upload ui component for react","directories":{},"_nodeVersion":"22.15.1","dependencies":{"classnames":"^2.2.5","@rc-component/util":"^1.3.0"},"_hasShrinkwrap":false,"devDependencies":{"raf":"^3.4.0","dumi":"^2.1.0","axios":"^1.9.0","react":"^18.0.0","sinon":"^9.0.2","eslint":"^8.0.0","father":"^4.0.0","rc-test":"^7.0.13","fs-extra":"^11.2.0","gh-pages":"^6.1.1","vinyl-fs":"^4.0.0","co-busboy":"^2.0.2","coveralls":"^3.0.3","cross-env":"^7.0.0","react-dom":"^18.0.0","typescript":"^5.3.3","@types/jest":"^30.0.0","@types/react":"^18.0.0","@umijs/fabric":"^4.0.1","@rc-component/np":"^1.0.4","@types/react-dom":"^18.0.0","regenerator-runtime":"^0.14.1","@testing-library/react":"^16.2.0","@testing-library/jest-dom":"^6.1.5","@rc-component/father-plugin":"^2.0.2"},"peerDependencies":{"react":">=16.9.0","react-dom":">=16.9.0"},"_npmOperationalInternal":{"tmp":"tmp/upload_1.0.0_1759047678216_0.4514754494547575","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@rc-component/upload","version":"1.1.0","keywords":["react","react-component","react-upload","upload"],"license":"MIT","_id":"@rc-component/upload@1.1.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":"http://github.com/react-component/upload","bugs":{"url":"http://github.com/react-component/upload/issues"},"dist":{"shasum":"cb634587ffdf8a8a4a26a279fac06989fb47f593","tarball":"https://registry.npmjs.org/@rc-component/upload/-/upload-1.1.0.tgz","fileCount":35,"integrity":"sha512-LIBV90mAnUE6VK5N4QvForoxZc4XqEYZimcp7fk+lkE4XwHHyJWxpIXQQwMU8hJM+YwBbsoZkGksL1sISWHQxw==","signatures":[{"sig":"MEUCIFIk5CNIdrTuCtQaJOFWw1lTSsuZSD5p4GebL/2JqJ2xAiEAnBUO079SmHbFzew8Emm5Ijhk8i4TFTTl93rsQ2WTTJU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":58992},"main":"./lib/index","types":"./lib/index.d.ts","module":"./es/index","gitHead":"705141ce4f2c3d1c506fd0cef9531ae48d8dfc5d","scripts":{"lint":"eslint src/ --ext .ts,.tsx,.jsx,.js,.md","test":"rc-test","start":"dumi dev","compile":"father build","coverage":"rc-test --coverage","prettier":"prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"","now-build":"npm run docs:build","docs:build":"dumi build","docs:deploy":"npm run docs:build && gh-pages -d dist","postpublish":"npm run docs:deploy","prepublishOnly":"npm run compile && rc-np"},"_npmUser":{"name":"zombiej","email":"smith3816@gmail.com"},"repository":{"url":"git+ssh://git@github.com/react-component/upload.git","type":"git"},"_npmVersion":"10.9.2","description":"upload ui component for react","directories":{},"_nodeVersion":"22.15.1","dependencies":{"clsx":"^2.1.1","@rc-component/util":"^1.3.0"},"_hasShrinkwrap":false,"devDependencies":{"dumi":"^2.1.0","axios":"^1.9.0","react":"^18.0.0","sinon":"^9.0.2","eslint":"^8.0.0","father":"^4.0.0","rc-test":"^7.0.13","fs-extra":"^11.2.0","gh-pages":"^6.1.1","vinyl-fs":"^4.0.0","co-busboy":"^2.0.2","coveralls":"^3.0.3","cross-env":"^10.1.0","react-dom":"^18.0.0","typescript":"^5.3.3","@types/jest":"^30.0.0","@types/node":"^24.5.2","@types/react":"^19.2.2","@umijs/fabric":"^4.0.1","@rc-component/np":"^1.0.4","@types/react-dom":"^19.2.2","regenerator-runtime":"^0.14.1","@testing-library/react":"^16.2.0","@testing-library/jest-dom":"^6.1.5","@rc-component/father-plugin":"^2.0.2"},"peerDependencies":{"react":">=16.9.0","react-dom":">=16.9.0"},"_npmOperationalInternal":{"tmp":"tmp/upload_1.1.0_1761892707120_0.11129739285173335","host":"s3://npm-registry-packages-npm-production"}},"1.1.1":{"name":"@rc-component/upload","version":"1.1.1","keywords":["react","react-component","react-upload","upload"],"license":"MIT","_id":"@rc-component/upload@1.1.1","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":"http://github.com/react-component/upload","bugs":{"url":"http://github.com/react-component/upload/issues"},"dist":{"shasum":"90d16edcdaeb104ffa9111fd0b428061de7c21ac","tarball":"https://registry.npmjs.org/@rc-component/upload/-/upload-1.1.1.tgz","fileCount":35,"integrity":"sha512-GvYWSKeaJTOxxC5p6+nOSadzfvXA1h8C/iHFPFZX+szH3JUXrvs+DLiW8YUTBgvMh8m63mJeHrlYlJzAlg+pDA==","signatures":[{"sig":"MEUCIQCBLsUgqRwjLeyKSbbKls20ng6hGeOUqQ9xoW5nTr0qNwIgELbEzizTisLkAeljQBzsQIpLzbqyfWyBy8tAnfexkw8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":58977},"main":"./lib/index","types":"./lib/index.d.ts","module":"./es/index","gitHead":"d53036dbfab8b2efca4942a7f8c76d15fbdcafc5","scripts":{"lint":"eslint src/ --ext .ts,.tsx,.jsx,.js,.md","test":"rc-test","start":"dumi dev","compile":"father build","coverage":"rc-test --coverage","prettier":"prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"","now-build":"npm run docs:build","docs:build":"dumi build","docs:deploy":"npm run docs:build && gh-pages -d dist","postpublish":"npm run docs:deploy","prepublishOnly":"npm run compile && rc-np"},"_npmUser":{"name":"zombiej","email":"smith3816@gmail.com"},"repository":{"url":"git+ssh://git@github.com/react-component/upload.git","type":"git"},"_npmVersion":"11.7.0","description":"upload ui component for react","directories":{},"_nodeVersion":"22.15.1","dependencies":{"clsx":"^2.1.1","@rc-component/util":"^1.11.1"},"_hasShrinkwrap":false,"devDependencies":{"dumi":"^2.1.0","axios":"^1.9.0","react":"^18.0.0","sinon":"^9.0.2","eslint":"^8.0.0","father":"^4.0.0","rc-test":"^7.0.13","gh-pages":"^6.1.1","react-dom":"^18.0.0","typescript":"^5.3.3","@types/jest":"^30.0.0","@types/node":"^25.0.1","@types/react":"^19.2.2","@umijs/fabric":"^4.0.1","@rc-component/np":"^1.0.4","@types/react-dom":"^19.2.2","regenerator-runtime":"^0.14.1","@testing-library/react":"^16.2.0","@testing-library/jest-dom":"^6.1.5","@rc-component/father-plugin":"^2.2.0"},"peerDependencies":{"react":">=16.9.0","react-dom":">=16.9.0"},"_npmOperationalInternal":{"tmp":"tmp/upload_1.1.1_1779780998671_0.46266048295966256","host":"s3://npm-registry-packages-npm-production"}},"1.2.0":{"_id":"@rc-component/upload@1.2.0","bugs":{"url":"https://github.com/react-component/upload/issues"},"dist":{"shasum":"26290a49f84d5c55f37032ecba4971a828f1df1a","tarball":"https://registry.npmjs.org/@rc-component/upload/-/upload-1.2.0.tgz","fileCount":36,"integrity":"sha512-Mvlk4RGi4GKi4mdkDvJRd+W1f1AexRMwVMmCNFqrQvp1EHPw3xgwKSX3rak1wLzY/iKbnhBc5XpeAEPOyAUTAQ==","signatures":[{"sig":"MEYCIQDi5AZfv9hVb2OwWAAYiH64eXrtTY95KkKoqw5j68hBxgIhAJMBPatawt+AN8Vb0/TsB+x1/dSNthH9YmVWNBBAbd5+","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIBO6BPiEUmKsWNXX7cmcCr0EUdacA5pe/UPl+fSWXLeTAiBDE8ZiprUo0aSHdbOdPlTuo3plJr7a3+9UWGxYvPLbpw=="}],"unpackedSize":66396},"main":"./lib/index","name":"@rc-component/upload","types":"./es/index.d.ts","module":"./es/index","gitHead":"c927881d6b2e9a8fcb91f81e124303e733532ada","license":"MIT","scripts":{"tsc":"tsc --noEmit","lint":"eslint src/ --ext .ts,.tsx,.jsx,.js,.md","test":"rc-test","build":"npm run compile && npm run docs:build","start":"dumi dev","deploy":"npm run gh-pages","compile":"father build","prepare":"husky","coverage":"rc-test --coverage","gh-pages":"npm run compile && cross-env GH_PAGES=1 npm run docs:build && npm run docs:deploy","prettier":"prettier --write --ignore-unknown .","docs:build":"dumi build","docs:deploy":"gh-pages -d docs-dist","prepublishOnly":"npm run compile && rc-np"},"version":"1.2.0","_npmUser":{"name":"zombiej","email":"smith3816@gmail.com"},"homepage":"https://react-component.github.io/upload","keywords":["react","react-component","react-upload","upload"],"repository":{"url":"git+https://github.com/react-component/upload.git","type":"git"},"_npmVersion":"11.17.0","description":"Upload UI component for React","directories":{},"lint-staged":{"*":"prettier --write --ignore-unknown"},"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"}],"_nodeVersion":"24.19.0","dependencies":{"clsx":"^2.1.1","@rc-component/util":"^1.11.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"dumi":"^2.4.38","axios":"^1.9.0","husky":"^9.1.7","react":"^19.2.7","sinon":"^9.0.2","eslint":"^10.6.0","father":"^4.6.24","globals":"^17.7.0","rc-test":"^7.1.3","gh-pages":"^6.3.0","prettier":"^3.9.4","cross-env":"^10.1.0","react-dom":"^19.2.7","@eslint/js":"^10.0.1","typescript":"^6.0.3","@types/jest":"^30.0.0","@types/node":"^26.0.1","lint-staged":"^17.0.8","@types/react":"^19.2.17","@eslint/compat":"^2.1.0","@rc-component/np":"^1.0.4","@types/react-dom":"^19.2.3","typescript-eslint":"^8.62.1","eslint-plugin-jest":"^29.15.4","eslint-plugin-react":"^7.37.5","regenerator-runtime":"^0.14.1","@testing-library/dom":"^10.4.1","@testing-library/react":"^16.3.2","eslint-config-prettier":"^10.1.8","@testing-library/jest-dom":"^6.9.1","eslint-plugin-react-hooks":"^7.1.1","@rc-component/father-plugin":"^2.2.0"},"peerDependencies":{"react":">=16.9.0","react-dom":">=16.9.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/upload_1.2.0_1789097808422_0.7359335332923986"}}},"time":{"created":"2025-09-28T08:21:18.073Z","modified":"2026-09-11T03:36:48.706Z","1.0.0":"2025-09-28T08:21:18.405Z","1.1.0":"2025-10-31T06:38:27.287Z","1.1.1":"2026-05-26T07:36:38.804Z","1.2.0":"2026-09-11T03:36:48.510Z"},"bugs":{"url":"https://github.com/react-component/upload/issues"},"license":"MIT","homepage":"https://react-component.github.io/upload","keywords":["react","react-component","react-upload","upload"],"repository":{"url":"git+https://github.com/react-component/upload.git","type":"git"},"description":"Upload UI component for React","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"}],"readme":"<div align=\"center\">\n  <h1>@rc-component/upload</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/upload\"><img alt=\"NPM version\" src=\"https://img.shields.io/npm/v/@rc-component/upload.svg?style=flat-square\"></a>\n    <a href=\"https://npmjs.org/package/@rc-component/upload\"><img alt=\"npm downloads\" src=\"https://img.shields.io/npm/dm/@rc-component/upload.svg?style=flat-square\"></a>\n    <a href=\"https://github.com/react-component/upload/actions/workflows/react-component-ci.yml\"><img alt=\"build status\" src=\"https://github.com/react-component/upload/actions/workflows/react-component-ci.yml/badge.svg\"></a>\n    <a href=\"https://app.codecov.io/gh/react-component/upload\"><img alt=\"Codecov\" src=\"https://img.shields.io/codecov/c/github/react-component/upload/master.svg?style=flat-square\"></a>\n    <a href=\"https://bundlephobia.com/package/@rc-component/upload\"><img alt=\"bundle size\" src=\"https://img.shields.io/bundlephobia/minzip/@rc-component/upload?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- 支持带进度、请求头、凭证和自定义请求覆盖的 Ajax 上传。\n- 支持目录上传、拖拽、粘贴、异步 action 和上传前处理流程。\n- 通过组件实例暴露 `abort(file)`，用于中止进行中的请求。\n- 为隐藏 input 提供语义化 `classNames` 和 `styles` 插槽。\n\n## 安装\n\n```bash\nnpm install @rc-component/upload\n```\n\n## 使用\n\n```tsx pure\nimport Upload from '@rc-component/upload';\n\nexport default () => (\n  <Upload\n    action=\"/upload\"\n    onStart={file => {\n      console.log('start', file.name);\n    }}\n    onSuccess={(response, file) => {\n      console.log('success', file.name, response);\n    }}\n  >\n    <button type=\"button\">Upload</button>\n  </Upload>\n);\n```\n\n在线预览：https://upload.react-component.vercel.app/\n\n## 示例\n\n运行本地 dumi 站点：\n\n```bash\nnpm install\nnpm start\n```\n\n然后打开 `http://localhost:8000`。\n\n## API\n\n### Upload\n\n| 名称 | 类型 | 默认值 | 说明 |\n| --- | --- | --- | --- |\n| `accept` | string \\| AcceptConfig | - | input accept 配置。 |\n| `action` | string \\| `(file) => string \\| PromiseLike<string>` | - | 上传地址或异步解析函数。 |\n| `beforeUpload` | `(file, fileList) => BeforeUploadFileType \\| Promise<void \\| BeforeUploadFileType> \\| void` | - | 上传前校验或转换文件。返回 false 可阻止上传。 |\n| `className` | string | - | 根 className。 |\n| `classNames` | `{ input?: string }` | - | 语义化类名。 |\n| `component` | React.ComponentType<any> \\| string | `'span'` | 根组件。 |\n| `customRequest` | CustomUploadRequestOption | - | 覆盖默认请求行为。 |\n| `data` | object \\| `(file) => object` | `{}` | 额外上传数据。 |\n| `directory` | boolean | false | 启用目录上传。 |\n| `disabled` | boolean | false | 禁用上传触发器。 |\n| `hasControlInside` | boolean | false | 子节点是否已包含控制元素。 |\n| `headers` | Record<string, string> | `{}` | 请求头。 |\n| `id` | string | - | Input id。 |\n| `method` | `'POST' \\| 'PUT' \\| 'PATCH' \\| 'post' \\| 'put' \\| 'patch'` | `'post'` | 请求方法。 |\n| `multiple` | boolean | false | 允许多文件选择。 |\n| `name` | string | `'file'` | 文件字段名。 |\n| `onBatchStart` | `(fileList) => void` | - | 批量开始时调用。 |\n| `onError` | `(error, response, file) => void` | - | 上传错误回调。 |\n| `onProgress` | `(event, file) => void` | - | 上传进度回调。 |\n| `onStart` | `(file) => void` | - | 上传开始回调。 |\n| `onSuccess` | `(response, file, xhr) => void` | - | 上传成功回调。 |\n| `openFileDialogOnClick` | boolean | true | 点击根节点时打开文件选择框。 |\n| `pastable` | boolean | false | 启用粘贴上传。 |\n| `prefixCls` | string | `'rc-upload'` | 前缀 className。 |\n| `style` | React.CSSProperties | - | 根样式。 |\n| `styles` | `{ input?: React.CSSProperties }` | - | 语义化样式。 |\n| `withCredentials` | boolean | false | 随 Ajax 上传发送凭证。 |\n\n### 方法\n\n| 名称    | 类型                     | 说明                 |\n| ------- | ------------------------ | -------------------- |\n| `abort` | `(file: RcFile) => void` | 中止进行中的上传。   |\n| `retry` | `(file: RcFile) => void` | 重试特定文件的上传。 |\n\n## 本地开发\n\n```bash\nnpm install\nnpm start\nnpm test\nnpm run tsc\nnpm run compile\nnpm run build\n```\n\ndumi 站点默认运行在 `http://localhost:8000`。\n\n## 发布\n\n```bash\nnpm run prepublishOnly\n```\n\n包构建完成后，发布流程由 `@rc-component/np` 通过 `rc-np` 命令处理。\n\n## 许可证\n\n@rc-component/upload 基于 [MIT](./LICENSE) 许可证发布。\n","readmeFilename":"README.zh-CN.md"}