Installations
npm install uxcore-cg-uploader
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
6.11.3
NPM Version
3.10.10
Score
71
Supply Chain
80.1
Quality
72.3
Maintenance
100
Vulnerability
99.6
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (65.66%)
Less (31.22%)
HTML (3.12%)
Developer
Download Statistics
Total Downloads
1,107
Last Day
1
Last Week
1
Last Month
22
Last Year
383
GitHub Statistics
24 Stars
233 Commits
24 Forks
10 Watching
13 Branches
16 Contributors
Bundle Size
201.66 kB
Minified
48.27 kB
Minified + Gzipped
Package Meta Information
Latest Version
1.1.0
Package Id
uxcore-cg-uploader@1.1.0
Size
36.44 kB
NPM Version
3.10.10
Node Version
6.11.3
Total Downloads
Cumulative downloads
Total Downloads
1,107
Last day
0%
1
Compared to previous day
Last week
-85.7%
1
Compared to previous week
Last month
340%
22
Compared to previous month
Last year
264.8%
383
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Uxcore Uploader
uxcore-uploader component for react
1$ git clone https://github.com/uxcore/uxcore-uploader 2$ cd uxcore-uploader 3$ npm start
see http://uxco.re/components/uploader/ for details.
上传组件, 封装UploadCore核心组件, 作为UI层.
API
reset()
重置文件队列
Props
name | type | default | Since Ver. | description |
---|---|---|---|---|
className | ||||
locale | string | zh-cn | 1.1.10 | 国际化,目前支持 zh-cn , en-us 和 pl-pl |
fileList | array | [] | 1.2.3 | 用于展示的文件列表 |
isOnlyImg | boolean | false | 1.2.1 | 是否以图片形式展示 |
isVisual | boolean | false | 2.0.0 | 是否可视化展示 |
core | string/Core | null | 唯一标识或者UploadCore对象, 防止重复创建, 当传入UploadCore对象时,下列参数和事件设置均无效 | |
name | string | 'file' | 上传文件字段名称 | |
url | string | '' | 响应上传服务器地址 | |
params | object/array | null | 上传文件额外参数 | |
headers | array | null | 上传文件额外头 | |
withCredentials | bool | false | 上传文件是否自动附带cookie等信息 | |
timeout | int | 0 | 上传超时限制 0表示不限制 | |
chunkEnable | bool | false | 是否允许分片上传 | |
chunkSize | size | 0 | 文件分片大小, 默认单位b,0不分片 | |
chunkRetries | int | 0 | 文件分片上传重试次数 | |
chunkProcessThreads | int | 2 | 分片上传并发数 | |
processThreads | int | 2 | 文件上传并发数 | |
queueCapcity | int | 0 | 队列容量,0无限 | |
autoPending | bool | true | 是否选择后自动等待上传 | |
multiple | bool | true | 是否多选 | |
accept | string/array | null | 允许文件类型, chrome 下的已知问题 | |
sizeLimit | size | 0 | 文件大小限制, 0表示不限制 | |
preventDuplicate | bool | false | 是否防止文件重复 | |
readOnly | bool | false | 3.0.0 | 是否以只读方式显示图片,有该属性时请fileList不能为空 |
showErrFile | bool | true | 3.2.0 | 是否显示上传出错的文件项 |
actionOnQueueLimit | string | error | 1.5.10 | 当队列超长时采取的策略:error, 抛错;cover, 覆盖 |
fileList 的最小格式 (格式稍显麻烦,是为了 onChange 的返回值可以传回给 fileList)
1[ 2 { 3 name: '', // 文件名称,列表形式必填 4 ext: '', // 文件扩展名。例如 jpg。可选,不填时无法根据类型展示对应图标 5 fileType: '', // 文件 mimetypes 类型。 例如 image/jpg。 可选,不填时无法根据类型展示对应图标 6 response: { 7 url: xxx, // 文件链接,必填 8 canRemove: true, // 是否可以删除,可选 9 downloadUrl: 'xxxx', // 下载 URL,可选 10 } 11 } 12] 13
Events
name | arguments | description |
---|---|---|
onChange | fileList | 在上传成功或文件移除后触发,返回文件队列,包括自己传入的fileList |
onCancel | file | 文件移除后触发,上传的文件和默认列表的文件格式会有所不同,文件格式参见下面的 fileList 格式 |
onfileuploaderror | File , Error | 文件上传失败 |
onChange 的 fileList 的枚举格式有如下几种
1[ 2 // 上传后的文件的格式, response 即服务器返回的值 3 { 4 type: 'upload', 5 ext: file.ext, 6 name: file.name, 7 response: JSON.parse(file.response.rawResponse.rawResponse) 8 }, 9 // 预览用文件的格式, `props.fileList` 相关, responce 即 `props.fileList` 里传入的格式。 10 { 11 type: 'list', 12 response: file 13 }, 14 // 被删除的文件的格式 15 { 16 type: 'delete', 17 subType: 'list/upload', // 与上面两种类型对应,用于解析 response 18 response: file // 与上面的 subType 相对应 19 } 20]
Other Events
name | arguments | description |
---|---|---|
onqueueuploadstart | 队列上传开始 | |
onqueueuploadend | 队列上传结束 | |
onqueuefileadded | File | 队列添加了一个文件 |
onqueuefilefiltered | File , Error | 队列过滤了一个文件 |
onqueueerror | Error | 队列错误 |
onstatchange | Stat | 文件统计发生变化 |
onfileuploadstart | File | 文件上传开始 |
onfileuploadpreparing | FileRequest | 文件上传准备时 |
onfileuploadprepared | File , FileRequest | 文件上传准备好了 |
onchunkuploadpreparing | ChunkRequest | 分块上传准备时 |
onchunkuploadcompleting | ChunkResponse | 分块上传结束时 |
onfileuploadprogress | File , Progress | 文件上传进度中 |
onfileuploadend | File | 文件上传结束 |
onfileuploadcompleting | FileResponse | 文件上传结束时 |
onfileuploadsuccess | File , FileResponse | 文件上传成功 |
onfileuploadcompleted | File , Status | 文件上传完成了 |
onfilestatuschange | File , Status | 文件状态发生变化 |
onfilecancel | File | 文件退出 |
具体配置信息见https://github.com/uxcore/uxcore-uploadcore/blob/master/README.md.
![Empty State](/_next/static/media/empty.e5fae2e5.png)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
Found 6/23 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
license file not detected
Details
- Warn: project does not have a license file
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 13 are checked with a SAST tool
Score
2.9
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More