@emailmaker/filemanager 0.0.4 → 0.0.5
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/components/CustomUploadIcon/CustomUploadIcon.d.ts +8 -0
- package/components/CustomUploadIcon/index.d.ts +1 -0
- package/components/FileContent/FileContent.d.ts +2 -2
- package/components/FileManagerApp/FileManagerApp.d.ts +2 -26
- package/components/SafeImage/SafeImage.d.ts +3 -0
- package/components/SafeImage/index.d.ts +1 -0
- package/components/index.d.ts +2 -0
- package/constants/index.d.ts +3 -0
- package/file-manager.css +1906 -1
- package/file-manager.esm.js +27110 -1
- package/file-manager.esm.js.map +1 -1
- package/file-manager.js +1 -1
- package/file-manager.js.LICENSE.txt +15 -0
- package/helpers/files/index.d.ts +2 -0
- package/hooks/useNotifications.d.ts +8 -0
- package/package.json +1 -1
- package/types.d.ts +42 -2
- package/utils/imageCache.d.ts +10 -0
- package/utils/jsonDataProvider.d.ts +4 -1
|
@@ -4,6 +4,21 @@
|
|
|
4
4
|
http://jedwatson.github.io/classnames
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
/*! *****************************************************************************
|
|
8
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
9
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
10
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
11
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
15
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
16
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
17
|
+
|
|
18
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
19
|
+
and limitations under the License.
|
|
20
|
+
***************************************************************************** */
|
|
21
|
+
|
|
7
22
|
/**
|
|
8
23
|
* @license
|
|
9
24
|
* Lodash <https://lodash.com/>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const useNotifications: () => {
|
|
2
|
+
error: (args: import("antd").NotificationArgsProps) => void;
|
|
3
|
+
open: (args: import("antd").NotificationArgsProps) => void;
|
|
4
|
+
success: (args: import("antd").NotificationArgsProps) => void;
|
|
5
|
+
info: (args: import("antd").NotificationArgsProps) => void;
|
|
6
|
+
warning: (args: import("antd").NotificationArgsProps) => void;
|
|
7
|
+
destroy(key?: React.Key): void;
|
|
8
|
+
};
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import React, { ReactNode, RefObject } from 'react';
|
|
|
2
2
|
import { FormInstance } from 'antd/es/form';
|
|
3
3
|
import { MY_FILES, GIF, STOCK_IMAGES, AI, EDITOR } from './constants';
|
|
4
4
|
import type { InputRef } from 'antd';
|
|
5
|
+
import { NotificationInstance } from 'antd/es/notification/interface';
|
|
5
6
|
export interface Folder {
|
|
6
7
|
id: string;
|
|
7
8
|
name: string;
|
|
@@ -120,6 +121,7 @@ export interface FileManagerOptions {
|
|
|
120
121
|
publicPath?: string;
|
|
121
122
|
customIcons?: CustomIcons;
|
|
122
123
|
dragDropIcon?: string;
|
|
124
|
+
notification?: Partial<Omit<NotificationInstance, 'destroy'>>;
|
|
123
125
|
}
|
|
124
126
|
export interface FileManagerDataProviders {
|
|
125
127
|
getFile: (fileId: string) => Promise<Blob>;
|
|
@@ -129,7 +131,12 @@ export interface FileManagerDataProviders {
|
|
|
129
131
|
search?: string;
|
|
130
132
|
sortBy?: SortState['sortBy'];
|
|
131
133
|
sortOrder?: SortState['sortOrder'];
|
|
132
|
-
|
|
134
|
+
page?: number;
|
|
135
|
+
limit?: number;
|
|
136
|
+
}) => Promise<{
|
|
137
|
+
files: File[];
|
|
138
|
+
pagination?: Partial<ApiPaginationResponse>;
|
|
139
|
+
}>;
|
|
133
140
|
createFolder: (data: {
|
|
134
141
|
name: string;
|
|
135
142
|
parentId?: string | null;
|
|
@@ -339,7 +346,7 @@ export interface ImageAIProps {
|
|
|
339
346
|
file: globalThis.File;
|
|
340
347
|
}) => Promise<void | File>;
|
|
341
348
|
aiTabRef: RefObject<HTMLElement>;
|
|
342
|
-
inputAiRef:
|
|
349
|
+
inputAiRef: RefObject<HTMLTextAreaElement>;
|
|
343
350
|
isImageUploaded: boolean;
|
|
344
351
|
setIsImageUploaded: (val: boolean) => void;
|
|
345
352
|
aiImageRequest: string;
|
|
@@ -398,4 +405,37 @@ export type MessageType = {
|
|
|
398
405
|
data?: unknown;
|
|
399
406
|
[key: string]: unknown;
|
|
400
407
|
};
|
|
408
|
+
export interface FileManagerProps {
|
|
409
|
+
publicPath?: string;
|
|
410
|
+
config?: Config;
|
|
411
|
+
currentPath?: string;
|
|
412
|
+
onPathChange?: (path: string[]) => void;
|
|
413
|
+
onChangeSelection?: (files: File[]) => void;
|
|
414
|
+
searchQuery?: string;
|
|
415
|
+
sortBySize?: string;
|
|
416
|
+
dataProviders?: FileManagerDataProviders;
|
|
417
|
+
apiEndpoints?: {
|
|
418
|
+
getFolders?: string;
|
|
419
|
+
getFiles?: string;
|
|
420
|
+
createFolder?: string;
|
|
421
|
+
deleteFolder?: string;
|
|
422
|
+
addFile?: string;
|
|
423
|
+
deleteFile?: string;
|
|
424
|
+
renameFile?: string;
|
|
425
|
+
moveFile?: string;
|
|
426
|
+
updateFile?: string;
|
|
427
|
+
};
|
|
428
|
+
customIcons?: CustomIcons;
|
|
429
|
+
dragDropIcon?: string;
|
|
430
|
+
notification?: Partial<Omit<NotificationInstance, 'destroy'>>;
|
|
431
|
+
}
|
|
432
|
+
export interface SafeImageProps {
|
|
433
|
+
src?: string;
|
|
434
|
+
alt: string;
|
|
435
|
+
className?: string;
|
|
436
|
+
width?: number;
|
|
437
|
+
height?: number;
|
|
438
|
+
preview?: boolean;
|
|
439
|
+
file?: File;
|
|
440
|
+
}
|
|
401
441
|
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const getCachedImage: (fileId: string) => string | undefined;
|
|
2
|
+
export declare const setCachedImage: (fileId: string, imageData: string) => void;
|
|
3
|
+
export declare const hasCachedImage: (fileId: string) => boolean;
|
|
4
|
+
export declare const getImageCacheStats: () => {
|
|
5
|
+
size: number;
|
|
6
|
+
maxSize: number;
|
|
7
|
+
cleanupBatchSize: number;
|
|
8
|
+
usage: number;
|
|
9
|
+
};
|
|
10
|
+
export declare const clearImageCache: () => void;
|
|
@@ -17,7 +17,10 @@ export declare class JSONDataProvider implements FileManagerDataProviders {
|
|
|
17
17
|
search?: string;
|
|
18
18
|
sortBy?: "name" | "size" | "date" | "type";
|
|
19
19
|
sortOrder?: "asc" | "desc";
|
|
20
|
-
}) => Promise<
|
|
20
|
+
}) => Promise<{
|
|
21
|
+
files: File[];
|
|
22
|
+
total: number;
|
|
23
|
+
}>;
|
|
21
24
|
createFolder: (data: {
|
|
22
25
|
name: string;
|
|
23
26
|
parentId?: string | null;
|