@emailmaker/filemanager 0.0.4 → 0.0.6
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/PixieEditor/PixieEditorIframe.d.ts +1 -1
- 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.d.ts +2 -0
- package/file-manager.esm.js +27114 -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/hooks/usePixieEditor.d.ts +1 -1
- package/package.json +1 -1
- package/types.d.ts +44 -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
|
+
};
|
|
@@ -9,7 +9,7 @@ export declare const usePixieEditor: ({ files, selectedFiles, fetchFiles, select
|
|
|
9
9
|
isPixieEditorVisible: boolean;
|
|
10
10
|
editingFile: ThumbnailFile | AppFile | null;
|
|
11
11
|
handleEdit: (fileForEdit?: ThumbnailFile | AppFile) => void;
|
|
12
|
-
handlePixieEditorSave: (updatedFile: AppFile) => Promise<
|
|
12
|
+
handlePixieEditorSave: (updatedFile: AppFile) => Promise<AppFile | undefined>;
|
|
13
13
|
handlePixieEditorClose: () => void;
|
|
14
14
|
};
|
|
15
15
|
export {};
|
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;
|
|
@@ -116,10 +117,12 @@ export interface FileManagerOptions {
|
|
|
116
117
|
sortBySize?: string;
|
|
117
118
|
onPathChange?: (path: string[]) => void;
|
|
118
119
|
onChangeSelection?: (files: File[]) => void;
|
|
120
|
+
onEditorOk?: (file: File) => void;
|
|
119
121
|
config?: Config;
|
|
120
122
|
publicPath?: string;
|
|
121
123
|
customIcons?: CustomIcons;
|
|
122
124
|
dragDropIcon?: string;
|
|
125
|
+
notification?: Partial<Omit<NotificationInstance, 'destroy'>>;
|
|
123
126
|
}
|
|
124
127
|
export interface FileManagerDataProviders {
|
|
125
128
|
getFile: (fileId: string) => Promise<Blob>;
|
|
@@ -129,7 +132,12 @@ export interface FileManagerDataProviders {
|
|
|
129
132
|
search?: string;
|
|
130
133
|
sortBy?: SortState['sortBy'];
|
|
131
134
|
sortOrder?: SortState['sortOrder'];
|
|
132
|
-
|
|
135
|
+
page?: number;
|
|
136
|
+
limit?: number;
|
|
137
|
+
}) => Promise<{
|
|
138
|
+
files: File[];
|
|
139
|
+
pagination?: Partial<ApiPaginationResponse>;
|
|
140
|
+
}>;
|
|
133
141
|
createFolder: (data: {
|
|
134
142
|
name: string;
|
|
135
143
|
parentId?: string | null;
|
|
@@ -339,7 +347,7 @@ export interface ImageAIProps {
|
|
|
339
347
|
file: globalThis.File;
|
|
340
348
|
}) => Promise<void | File>;
|
|
341
349
|
aiTabRef: RefObject<HTMLElement>;
|
|
342
|
-
inputAiRef:
|
|
350
|
+
inputAiRef: RefObject<HTMLTextAreaElement>;
|
|
343
351
|
isImageUploaded: boolean;
|
|
344
352
|
setIsImageUploaded: (val: boolean) => void;
|
|
345
353
|
aiImageRequest: string;
|
|
@@ -398,4 +406,38 @@ export type MessageType = {
|
|
|
398
406
|
data?: unknown;
|
|
399
407
|
[key: string]: unknown;
|
|
400
408
|
};
|
|
409
|
+
export interface FileManagerProps {
|
|
410
|
+
publicPath?: string;
|
|
411
|
+
config?: Config;
|
|
412
|
+
currentPath?: string;
|
|
413
|
+
onPathChange?: (path: string[]) => void;
|
|
414
|
+
onChangeSelection?: (files: File[]) => void;
|
|
415
|
+
onEditorOk?: (files: File) => void;
|
|
416
|
+
searchQuery?: string;
|
|
417
|
+
sortBySize?: string;
|
|
418
|
+
dataProviders?: FileManagerDataProviders;
|
|
419
|
+
apiEndpoints?: {
|
|
420
|
+
getFolders?: string;
|
|
421
|
+
getFiles?: string;
|
|
422
|
+
createFolder?: string;
|
|
423
|
+
deleteFolder?: string;
|
|
424
|
+
addFile?: string;
|
|
425
|
+
deleteFile?: string;
|
|
426
|
+
renameFile?: string;
|
|
427
|
+
moveFile?: string;
|
|
428
|
+
updateFile?: string;
|
|
429
|
+
};
|
|
430
|
+
customIcons?: CustomIcons;
|
|
431
|
+
dragDropIcon?: string;
|
|
432
|
+
notification?: Partial<Omit<NotificationInstance, 'destroy'>>;
|
|
433
|
+
}
|
|
434
|
+
export interface SafeImageProps {
|
|
435
|
+
src?: string;
|
|
436
|
+
alt: string;
|
|
437
|
+
className?: string;
|
|
438
|
+
width?: number;
|
|
439
|
+
height?: number;
|
|
440
|
+
preview?: boolean;
|
|
441
|
+
file?: File;
|
|
442
|
+
}
|
|
401
443
|
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;
|