@nutui/nutui-react 2.0.19-beta.1 → 2.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/esm/Button.js +84 -5
- package/dist/esm/Uploader.js +191 -191
- package/dist/esm/types/src/packages/uploader/demo.taro.d.ts +0 -15
- package/dist/esm/types/src/packages/uploader/file-item.d.ts +19 -0
- package/dist/esm/types/src/packages/uploader/index.d.ts +2 -1
- package/dist/esm/types/src/packages/uploader/index.taro.d.ts +2 -1
- package/dist/esm/types/src/packages/uploader/preview.d.ts +2 -0
- package/dist/esm/types/src/packages/uploader/preview.taro.d.ts +2 -0
- package/dist/esm/types/src/packages/uploader/upload.d.ts +3 -0
- package/dist/esm/types/src/packages/uploader/uploader.d.ts +5 -23
- package/dist/esm/types/src/packages/uploader/uploader.taro.d.ts +10 -26
- package/dist/locales/base.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/id-ID.js +1 -1
- package/dist/locales/tr-TR.js +1 -1
- package/dist/locales/zh-CN.js +1 -1
- package/dist/locales/zh-TW.js +1 -1
- package/dist/locales/zh-UG.js +1 -1
- package/dist/nutui.react.es.js +257 -254
- package/dist/nutui.react.umd.js +257 -254
- package/dist/style.mjs +1 -1
- package/dist/types/packages/uploader/file-item.d.ts +19 -0
- package/dist/types/packages/uploader/index.d.ts +2 -1
- package/dist/types/packages/uploader/preview.d.ts +2 -0
- package/dist/types/packages/uploader/upload.d.ts +3 -0
- package/dist/types/packages/uploader/uploader.d.ts +5 -23
- package/package.json +1 -1
- package/dist/esm/button2.js +0 -87
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { Uploader } from './uploader';
|
|
2
|
-
export type {
|
|
2
|
+
export type { UploaderProps } from './uploader';
|
|
3
|
+
export type { FileType, FileItem, FileItemStatus } from './file-item';
|
|
3
4
|
export default Uploader;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { Uploader } from './uploader.taro';
|
|
2
|
-
export type {
|
|
2
|
+
export type { UploaderProps } from './uploader.taro';
|
|
3
|
+
export type { FileType, FileItem, FileItemStatus } from './file-item';
|
|
3
4
|
export default Uploader;
|
|
@@ -16,6 +16,9 @@ export declare class UploadOptions {
|
|
|
16
16
|
onFailure?: any;
|
|
17
17
|
beforeXhrUpload?: any;
|
|
18
18
|
}
|
|
19
|
+
export declare const UPLOADING = "uploading";
|
|
20
|
+
export declare const SUCCESS = "success";
|
|
21
|
+
export declare const ERROR = "error";
|
|
19
22
|
export declare class Upload {
|
|
20
23
|
options: UploadOptions;
|
|
21
24
|
constructor(options: UploadOptions);
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { UploadOptions } from './upload';
|
|
3
3
|
import { BasicComponent } from '@/utils/typings';
|
|
4
|
-
|
|
5
|
-
[key: string]: T;
|
|
6
|
-
};
|
|
7
|
-
export type FileItemStatus = 'ready' | 'uploading' | 'success' | 'error' | 'removed';
|
|
4
|
+
import { FileItem } from './file-item';
|
|
8
5
|
export interface UploaderProps extends BasicComponent {
|
|
9
6
|
url: string;
|
|
10
7
|
maxCount: string | number;
|
|
11
8
|
maxFileSize: number;
|
|
12
|
-
defaultValue?:
|
|
13
|
-
value?:
|
|
9
|
+
defaultValue?: FileItem[];
|
|
10
|
+
value?: FileItem[];
|
|
14
11
|
previewType: 'picture' | 'list';
|
|
15
12
|
fit: 'contain' | 'cover' | 'fill' | 'none' | 'scale-down';
|
|
16
13
|
uploadIcon?: React.ReactNode;
|
|
@@ -29,7 +26,7 @@ export interface UploaderProps extends BasicComponent {
|
|
|
29
26
|
clearInput: boolean;
|
|
30
27
|
preview: boolean;
|
|
31
28
|
deletable: boolean;
|
|
32
|
-
capture: boolean;
|
|
29
|
+
capture: boolean | 'user' | 'environment';
|
|
33
30
|
className: string;
|
|
34
31
|
previewUrl?: string;
|
|
35
32
|
style: React.CSSProperties;
|
|
@@ -52,27 +49,12 @@ export interface UploaderProps extends BasicComponent {
|
|
|
52
49
|
}) => void;
|
|
53
50
|
onUpdate?: (fileList: FileItem[]) => void;
|
|
54
51
|
onOversize?: (file: File[]) => void;
|
|
55
|
-
onChange?: (
|
|
56
|
-
fileList: FileItem[];
|
|
57
|
-
event: React.ChangeEvent<HTMLInputElement>;
|
|
58
|
-
}) => void;
|
|
52
|
+
onChange?: (p: FileItem[]) => void;
|
|
59
53
|
beforeUpload?: (file: File[]) => Promise<File[] | boolean>;
|
|
60
54
|
beforeXhrUpload?: (xhr: XMLHttpRequest, options: any) => void;
|
|
61
55
|
beforeDelete?: (file: FileItem, files: FileItem[]) => boolean;
|
|
62
56
|
onFileItemClick?: (file: FileItem) => void;
|
|
63
57
|
}
|
|
64
|
-
export declare class FileItem {
|
|
65
|
-
status: FileItemStatus;
|
|
66
|
-
message: string;
|
|
67
|
-
uid: string;
|
|
68
|
-
name?: string;
|
|
69
|
-
url?: string;
|
|
70
|
-
type?: string;
|
|
71
|
-
path?: string;
|
|
72
|
-
percentage: string | number;
|
|
73
|
-
formData: FormData;
|
|
74
|
-
responseText?: string;
|
|
75
|
-
}
|
|
76
58
|
export declare const Uploader: React.ForwardRefExoticComponent<Partial<UploaderProps> & {
|
|
77
59
|
children?: React.ReactNode;
|
|
78
60
|
} & React.RefAttributes<unknown>>;
|
|
@@ -2,10 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import Taro from '@tarojs/taro';
|
|
3
3
|
import { UploadOptions } from './upload';
|
|
4
4
|
import { BasicComponent } from '@/utils/typings';
|
|
5
|
-
|
|
6
|
-
[key: string]: T;
|
|
7
|
-
};
|
|
8
|
-
export type FileItemStatus = 'ready' | 'uploading' | 'success' | 'error' | 'removed';
|
|
5
|
+
import { FileItem } from './file-item';
|
|
9
6
|
/** 图片的尺寸 */
|
|
10
7
|
interface sizeType {
|
|
11
8
|
/** 原图 */
|
|
@@ -35,8 +32,8 @@ export interface UploaderProps extends BasicComponent {
|
|
|
35
32
|
mediaType: (keyof mediaType)[];
|
|
36
33
|
camera: string;
|
|
37
34
|
maxFileSize: number;
|
|
38
|
-
defaultValue?:
|
|
39
|
-
value?:
|
|
35
|
+
defaultValue?: FileItem[];
|
|
36
|
+
value?: FileItem[];
|
|
40
37
|
previewType: 'picture' | 'list';
|
|
41
38
|
fit: 'contain' | 'cover' | 'fill' | 'none' | 'scale-down';
|
|
42
39
|
uploadIcon?: React.ReactNode;
|
|
@@ -58,42 +55,29 @@ export interface UploaderProps extends BasicComponent {
|
|
|
58
55
|
maxDuration: number;
|
|
59
56
|
style: React.CSSProperties;
|
|
60
57
|
onStart?: (option: UploadOptions) => void;
|
|
61
|
-
onDelete?: (file: FileItem, fileList:
|
|
58
|
+
onDelete?: (file: FileItem, fileList: FileItem[]) => void;
|
|
62
59
|
onSuccess?: (param: {
|
|
63
60
|
responseText: XMLHttpRequest['responseText'];
|
|
64
61
|
option: UploadOptions;
|
|
65
|
-
fileList:
|
|
62
|
+
fileList: FileItem[];
|
|
66
63
|
}) => void;
|
|
67
64
|
onProgress?: (param: {
|
|
68
65
|
e: ProgressEvent<XMLHttpRequestEventTarget>;
|
|
69
66
|
option: UploadOptions;
|
|
70
|
-
percentage:
|
|
67
|
+
percentage: number | string;
|
|
71
68
|
}) => void;
|
|
72
69
|
onFailure?: (param: {
|
|
73
70
|
responseText: XMLHttpRequest['responseText'];
|
|
74
71
|
option: UploadOptions;
|
|
75
|
-
fileList:
|
|
72
|
+
fileList: FileItem[];
|
|
76
73
|
}) => void;
|
|
77
|
-
onUpdate?: (fileList:
|
|
74
|
+
onUpdate?: (fileList: FileItem[]) => void;
|
|
78
75
|
onOversize?: (files: Taro.chooseImage.ImageFile[] | Taro.chooseMedia.ChooseMedia[] | any) => void;
|
|
79
|
-
onChange?: (
|
|
80
|
-
fileList: FileType<React.ReactNode>[];
|
|
81
|
-
}) => void;
|
|
76
|
+
onChange?: (p: FileItem[]) => void;
|
|
82
77
|
beforeXhrUpload?: (xhr: XMLHttpRequest, options: any) => void;
|
|
83
|
-
beforeDelete?: (file: FileItem, files:
|
|
78
|
+
beforeDelete?: (file: FileItem, files: FileItem[]) => boolean;
|
|
84
79
|
onFileItemClick?: (file: FileItem) => void;
|
|
85
80
|
}
|
|
86
|
-
export declare class FileItem {
|
|
87
|
-
status: FileItemStatus;
|
|
88
|
-
message: string;
|
|
89
|
-
uid: string;
|
|
90
|
-
name?: string;
|
|
91
|
-
url?: string;
|
|
92
|
-
type?: string;
|
|
93
|
-
path?: string;
|
|
94
|
-
percentage: string | number;
|
|
95
|
-
formData: any;
|
|
96
|
-
}
|
|
97
81
|
export declare const Uploader: React.ForwardRefExoticComponent<Partial<UploaderProps> & {
|
|
98
82
|
children?: React.ReactNode;
|
|
99
83
|
} & React.RefAttributes<unknown>>;
|
package/dist/locales/base.js
CHANGED
package/dist/locales/en-US.js
CHANGED
package/dist/locales/id-ID.js
CHANGED
package/dist/locales/tr-TR.js
CHANGED
package/dist/locales/zh-CN.js
CHANGED
package/dist/locales/zh-TW.js
CHANGED
package/dist/locales/zh-UG.js
CHANGED