Skip to content

Commit 2e160a2

Browse files
EmilyyyLiu刘欢
andauthored
chore: migrate to @rc-component namespace and update (#662)
* chore: migrate to @rc-component namespace and update * docs: midify readme * feat: rc-util->@rc-component/util * feat: modify rc-util path in component * docs: format --------- Co-authored-by: 刘欢 <[email protected]>
1 parent c1ecf49 commit 2e160a2

18 files changed

+73
-104
lines changed

.dumirc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import path from 'path';
33

44
export default defineConfig({
55
alias: {
6-
'rc-upload$': path.resolve('src'),
7-
'rc-upload/es': path.resolve('src'),
6+
'@rc-component/upload$': path.resolve('src'),
7+
'@rc-component/upload/es': path.resolve('src'),
88
},
99
mfsu: false,
1010
favicons: ['https://avatars0.githubusercontent.com/u/9441414?s=200&v=4'],

README.md

Lines changed: 46 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
1-
# rc-upload
1+
# @rc-component/upload
22

33
React Upload
44

5-
[![NPM version][npm-image]][npm-url]
6-
[![npm download][download-image]][download-url]
7-
[![build status][github-actions-image]][github-actions-url]
8-
[![Codecov][codecov-image]][codecov-url]
9-
[![bundle size][bundlephobia-image]][bundlephobia-url]
10-
[![dumi][dumi-image]][dumi-url]
5+
[![NPM version][npm-image]][npm-url] [![npm download][download-image]][download-url] [![build status][github-actions-image]][github-actions-url] [![Codecov][codecov-image]][codecov-url] [![bundle size][bundlephobia-image]][bundlephobia-url] [![dumi][dumi-image]][dumi-url]
116

12-
[npm-image]: http://img.shields.io/npm/v/rc-upload.svg?style=flat-square
13-
[npm-url]: http://npmjs.org/package/rc-upload
7+
[npm-image]: http://img.shields.io/npm/v/@rc-component/upload.svg?style=flat-square
8+
[npm-url]: http://npmjs.org/package/@rc-component/upload
149
[travis-image]: https://img.shields.io/travis/react-component/upload/master?style=flat-square
1510
[travis-url]: https://travis-ci.com/react-component/upload
1611
[github-actions-image]: https://github.com/react-component/upload/workflows/CI/badge.svg
@@ -21,10 +16,10 @@ React Upload
2116
[david-image]: https://david-dm.org/react-component/upload/status.svg?style=flat-square
2217
[david-dev-url]: https://david-dm.org/react-component/upload?type=dev
2318
[david-dev-image]: https://david-dm.org/react-component/upload/dev-status.svg?style=flat-square
24-
[download-image]: https://img.shields.io/npm/dm/rc-upload.svg?style=flat-square
25-
[download-url]: https://npmjs.org/package/rc-upload
26-
[bundlephobia-url]: https://bundlephobia.com/package/rc-upload
27-
[bundlephobia-image]: https://badgen.net/bundlephobia/minzip/rc-upload
19+
[download-image]: https://img.shields.io/npm/dm/@rc-component/upload.svg?style=flat-square
20+
[download-url]: https://npmjs.org/package/@rc-component/upload
21+
[bundlephobia-url]: https://bundlephobia.com/package/@rc-component/upload
22+
[bundlephobia-image]: https://badgen.net/bundlephobia/minzip/@rc-component/upload
2823
[dumi-url]: https://github.com/umijs/dumi
2924
[dumi-image]: https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square
3025

@@ -43,16 +38,16 @@ online example: https://upload.react-component.vercel.app/
4338

4439
## Feature
4540

46-
* support IE11+, Chrome, Firefox, Safari
41+
- support IE11+, Chrome, Firefox, Safari
4742

4843
## install
4944

50-
[![rc-upload](https://nodei.co/npm/rc-upload.png)](https://npmjs.org/package/rc-upload)
45+
[![@rc-component/upload](https://nodei.co/npm/@rc-component/upload.png)](https://npmjs.org/package/@rc-component/upload)
5146

5247
## Usage
5348

5449
```js
55-
var Upload = require('rc-upload');
50+
var Upload = require('@rc-component/upload');
5651
var React = require('react');
5752
React.render(<Upload />, container);
5853
```
@@ -61,30 +56,30 @@ React.render(<Upload />, container);
6156

6257
### props
6358

64-
|name|type|default| description|
65-
|-----|---|--------|----|
66-
|name | string | file| file param post to server |
67-
|style | object | {}| root component inline style |
68-
|className | string | - | root component className |
69-
|disabled | boolean | false | whether disabled |
70-
|component | "div"|"span" | "span"| wrap component name |
71-
|action| string &#124; function(file): string &#124; Promise&lt;string&gt; | | form action url |
72-
|method | string | post | request method |
73-
|directory| boolean | false | support upload whole directory |
74-
|data| object/function(file) | | other data object to post or a function which returns a data object(a promise object which resolve a data object) |
75-
|headers| object | {} | http headers to post, available in modern browsers |
76-
|accept | string | | input accept attribute |
77-
|capture | string | | input capture attribute |
78-
|multiple | boolean | false | only support ie10+|
79-
|onStart | function| | start upload file |
80-
|onError| function| | error callback |
81-
|onSuccess | function | | success callback |
82-
|onProgress | function || progress callback, only for modern browsers|
83-
|beforeUpload| function |null| before upload check, return false or a rejected Promise will stop upload, only for modern browsers|
84-
|customRequest | function | null | provide an override for the default xhr behavior for additional customization|
85-
|withCredentials | boolean | false | ajax upload with cookie send |
86-
|openFileDialogOnClick | boolean | true | useful for drag only upload as it does not trigger on enter key or click event |
87-
|pastable | boolean | false | support paste upload |
59+
| name | type | default | description |
60+
| --- | --- | --- | --- |
61+
| name | string | file | file param post to server |
62+
| style | object | {} | root component inline style |
63+
| className | string | - | root component className |
64+
| disabled | boolean | false | whether disabled |
65+
| component | "div" \| "span" | "span" | wrap component name |
66+
| action | string &#124; function(file): string &#124; Promise&lt;string&gt; | | form action url |
67+
| method | string | post | request method |
68+
| directory | boolean | false | support upload whole directory |
69+
| data | object/function(file) | | other data object to post or a function which returns a data object(a promise object which resolve a data object) |
70+
| headers | object | {} | http headers to post, available in modern browsers |
71+
| accept | string | | input accept attribute |
72+
| capture | string | | input capture attribute |
73+
| multiple | boolean | false | only support ie10+ |
74+
| onStart | function | | start upload file |
75+
| onError | function | | error callback |
76+
| onSuccess | function | | success callback |
77+
| onProgress | function | | progress callback, only for modern browsers |
78+
| beforeUpload | function | null | before upload check, return false or a rejected Promise will stop upload, only for modern browsers |
79+
| customRequest | function | null | provide an override for the default xhr behavior for additional customization |
80+
| withCredentials | boolean | false | ajax upload with cookie send |
81+
| openFileDialogOnClick | boolean | true | useful for drag only upload as it does not trigger on enter key or click event |
82+
| pastable | boolean | false | support paste upload |
8883

8984
#### onError arguments
9085

@@ -96,31 +91,28 @@ React.render(<Upload />, container);
9691

9792
1. `result`: response body
9893
2. `file`: upload file
99-
3. `xhr`: xhr header, only for modern browsers which support AJAX upload. since
100-
2.4.0
101-
94+
3. `xhr`: xhr header, only for modern browsers which support AJAX upload. since 2.4.0
10295

10396
### customRequest
10497

10598
Allows for advanced customization by overriding default behavior in AjaxUploader. Provide your own XMLHttpRequest calls to interface with custom backend processes or interact with AWS S3 service through the aws-sdk-js package.
10699

107100
customRequest callback is passed an object with:
108101

109-
* `onProgress: (event: { percent: number }): void`
110-
* `onError: (event: Error, body?: Object): void`
111-
* `onSuccess: (body: Object): void`
112-
* `data: Object`
113-
* `filename: String`
114-
* `file: File`
115-
* `withCredentials: Boolean`
116-
* `action: String`
117-
* `headers: Object`
118-
102+
- `onProgress: (event: { percent: number }): void`
103+
- `onError: (event: Error, body?: Object): void`
104+
- `onSuccess: (body: Object): void`
105+
- `data: Object`
106+
- `filename: String`
107+
- `file: File`
108+
- `withCredentials: Boolean`
109+
- `action: String`
110+
- `headers: Object`
119111

120112
### methods
121113

122114
abort(file?: File) => void: abort the uploading file
123115

124116
## License
125117

126-
rc-upload is released under the MIT license.
118+
@rc-component/upload is released under the MIT license.

docs/examples/asyncAction.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint no-console:0 */
22
import React from 'react';
3-
import Upload from 'rc-upload';
3+
import Upload from '@rc-component/upload';
44

55
const props = {
66
action: () => {

docs/examples/beforeUpload.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint no-console:0 */
22

33
import type { Action, RcFile } from '@/interface';
4-
import Upload from 'rc-upload';
4+
import Upload from '@rc-component/upload';
55

66
const props = {
77
action: '/upload.do' as Action,

docs/examples/customRequest.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint no-console:0 */
22
import React from 'react';
33
import axios from 'axios';
4-
import Upload from 'rc-upload';
4+
import Upload from '@rc-component/upload';
55
import { UploadRequestOption } from '@/interface';
66

77
const uploadProps = {

docs/examples/directoryUpload.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint no-console:0 */
22

33
import React from 'react';
4-
import Upload from 'rc-upload';
4+
import Upload from '@rc-component/upload';
55

66
const Test = () => {
77
const uploaderProps = {

docs/examples/drag.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint no-console:0 */
22
import React from 'react';
3-
import Upload from 'rc-upload';
3+
import Upload from '@rc-component/upload';
44

55
const props = {
66
action: '/upload.do',

docs/examples/dragDirectory.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint no-console:0 */
22
import React from 'react';
3-
import Upload from 'rc-upload';
3+
import Upload from '@rc-component/upload';
44

55
const props = {
66
action: '/upload.do',

docs/examples/paste.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint no-console:0 */
22
import React from 'react';
3-
import Upload from 'rc-upload';
3+
import Upload from '@rc-component/upload';
44

55
const props = {
66
action: '/upload.do',

docs/examples/pasteDirectory.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint no-console:0 */
22
import React from 'react';
3-
import Upload from 'rc-upload';
3+
import Upload from '@rc-component/upload';
44

55
const props = {
66
action: '/upload.do',

0 commit comments

Comments
 (0)