@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.
@@ -1,3 +1,4 @@
1
1
  import { Uploader } from './uploader';
2
- export type { FileType, FileItem, UploaderProps, FileItemStatus, } from './uploader';
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 { FileType, FileItem, UploaderProps, FileItemStatus, } from './uploader.taro';
2
+ export type { UploaderProps } from './uploader.taro';
3
+ export type { FileType, FileItem, FileItemStatus } from './file-item';
3
4
  export default Uploader;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const Preview: React.FunctionComponent<any>;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const Preview: React.FunctionComponent<any>;
@@ -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
- export type FileType<T> = {
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?: FileType<React.ReactNode>[];
13
- value?: FileType<string>[];
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?: (param: {
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
- export type FileType<T> = {
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?: FileType<React.ReactNode>[];
39
- value?: FileType<string>[];
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: FileType<React.ReactNode>[]) => void;
58
+ onDelete?: (file: FileItem, fileList: FileItem[]) => void;
62
59
  onSuccess?: (param: {
63
60
  responseText: XMLHttpRequest['responseText'];
64
61
  option: UploadOptions;
65
- fileList: FileType<React.ReactNode>[];
62
+ fileList: FileItem[];
66
63
  }) => void;
67
64
  onProgress?: (param: {
68
65
  e: ProgressEvent<XMLHttpRequestEventTarget>;
69
66
  option: UploadOptions;
70
- percentage: React.ReactNode;
67
+ percentage: number | string;
71
68
  }) => void;
72
69
  onFailure?: (param: {
73
70
  responseText: XMLHttpRequest['responseText'];
74
71
  option: UploadOptions;
75
- fileList: FileType<React.ReactNode>[];
72
+ fileList: FileItem[];
76
73
  }) => void;
77
- onUpdate?: (fileList: FileType<React.ReactNode>[]) => void;
74
+ onUpdate?: (fileList: FileItem[]) => void;
78
75
  onOversize?: (files: Taro.chooseImage.ImageFile[] | Taro.chooseMedia.ChooseMedia[] | any) => void;
79
- onChange?: (param: {
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: FileType<React.ReactNode>[]) => boolean;
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>>;
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v2.0.19-beta.1 Tue Sep 26 2023 19:09:11 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v2.0.19 Wed Sep 27 2023 18:12:39 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v2.0.19-beta.1 Tue Sep 26 2023 19:09:11 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v2.0.19 Wed Sep 27 2023 18:12:39 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v2.0.19-beta.1 Tue Sep 26 2023 19:09:11 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v2.0.19 Wed Sep 27 2023 18:12:39 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v2.0.19-beta.1 Tue Sep 26 2023 19:09:11 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v2.0.19 Wed Sep 27 2023 18:12:39 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v2.0.19-beta.1 Tue Sep 26 2023 19:09:11 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v2.0.19 Wed Sep 27 2023 18:12:39 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v2.0.19-beta.1 Tue Sep 26 2023 19:09:11 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v2.0.19 Wed Sep 27 2023 18:12:39 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react v2.0.19-beta.1 Tue Sep 26 2023 19:09:11 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react v2.0.19 Wed Sep 27 2023 18:12:39 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */