Skip to content

Commit 999dd67

Browse files
author
刘欢
committed
chore: migrate to @rc-component namespace and update
1 parent c1ecf49 commit 999dd67

File tree

14 files changed

+60
-90
lines changed

14 files changed

+60
-90
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: 37 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@
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

127
[npm-image]: http://img.shields.io/npm/v/rc-upload.svg?style=flat-square
138
[npm-url]: http://npmjs.org/package/rc-upload
@@ -43,7 +38,7 @@ 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

@@ -52,7 +47,7 @@ online example: https://upload.react-component.vercel.app/
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,26 +91,23 @@ 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

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)