@emailmaker/filemanager 0.10.3 → 0.10.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/EmIcons/EmIcons.d.ts +15 -0
- package/components/FileContent/FileContent.d.ts +7 -1
- package/components/FileManagerApp/ActionsHeader.d.ts +1 -9
- package/components/FileModals/FileModals.d.ts +2 -1
- package/components/FolderSidebar/FolderSidebar.d.ts +1 -1
- package/file-manager.css +467 -327
- package/file-manager.esm.js +10 -10
- package/file-manager.esm.js.map +1 -1
- package/file-manager.js +1 -1
- package/file-manager.js.LICENSE.txt +2 -42
- package/hooks/core/context.d.ts +1 -1
- package/hooks/core/types.d.ts +4 -1
- package/hooks/useCustomIcons.d.ts +6 -0
- package/hooks/useFileActions.d.ts +3 -2
- package/package.json +1 -1
- package/types.d.ts +38 -7
- package/utils/jsonDataProvider.d.ts +1 -1
|
@@ -30,16 +30,6 @@ and limitations under the License.
|
|
|
30
30
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
31
31
|
*/
|
|
32
32
|
|
|
33
|
-
/**
|
|
34
|
-
* @license React
|
|
35
|
-
* react-dom-client.production.js
|
|
36
|
-
*
|
|
37
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
38
|
-
*
|
|
39
|
-
* This source code is licensed under the MIT license found in the
|
|
40
|
-
* LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/
|
|
42
|
-
|
|
43
33
|
/**
|
|
44
34
|
* @license React
|
|
45
35
|
* react-is.production.min.js
|
|
@@ -50,16 +40,6 @@ and limitations under the License.
|
|
|
50
40
|
* LICENSE file in the root directory of this source tree.
|
|
51
41
|
*/
|
|
52
42
|
|
|
53
|
-
/**
|
|
54
|
-
* @license React
|
|
55
|
-
* react-jsx-runtime.production.js
|
|
56
|
-
*
|
|
57
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
58
|
-
*
|
|
59
|
-
* This source code is licensed under the MIT license found in the
|
|
60
|
-
* LICENSE file in the root directory of this source tree.
|
|
61
|
-
*/
|
|
62
|
-
|
|
63
43
|
/**
|
|
64
44
|
* @license React
|
|
65
45
|
* react-jsx-runtime.production.min.js
|
|
@@ -70,16 +50,6 @@ and limitations under the License.
|
|
|
70
50
|
* LICENSE file in the root directory of this source tree.
|
|
71
51
|
*/
|
|
72
52
|
|
|
73
|
-
/**
|
|
74
|
-
* @license React
|
|
75
|
-
* scheduler.production.js
|
|
76
|
-
*
|
|
77
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
78
|
-
*
|
|
79
|
-
* This source code is licensed under the MIT license found in the
|
|
80
|
-
* LICENSE file in the root directory of this source tree.
|
|
81
|
-
*/
|
|
82
|
-
|
|
83
53
|
/**
|
|
84
54
|
* @license React
|
|
85
55
|
* use-sync-external-store-shim.production.min.js
|
|
@@ -173,18 +143,14 @@ and limitations under the License.
|
|
|
173
143
|
|
|
174
144
|
/** */
|
|
175
145
|
|
|
176
|
-
/** */
|
|
177
|
-
|
|
178
|
-
/** */
|
|
179
|
-
|
|
180
146
|
/** */
|
|
181
147
|
|
|
182
|
-
/** */
|
|
183
|
-
|
|
184
148
|
/** */
|
|
185
149
|
|
|
186
150
|
/** */
|
|
187
151
|
|
|
152
|
+
/** */
|
|
153
|
+
|
|
188
154
|
/** */
|
|
189
155
|
|
|
190
156
|
/** */
|
|
@@ -203,12 +169,6 @@ and limitations under the License.
|
|
|
203
169
|
|
|
204
170
|
/** */
|
|
205
171
|
|
|
206
|
-
/** */
|
|
207
|
-
|
|
208
|
-
/** */
|
|
209
|
-
|
|
210
172
|
/** */
|
|
211
173
|
|
|
212
|
-
/** */
|
|
213
|
-
|
|
214
174
|
/** */
|
package/hooks/core/context.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
import { FileManagerOptions } from '../../types';
|
|
3
|
-
import {
|
|
3
|
+
import { FileManagerActions, FileManagerState } from './types';
|
|
4
4
|
export interface FileManagerContextValue {
|
|
5
5
|
state: FileManagerState;
|
|
6
6
|
actions: Partial<FileManagerActions>;
|
package/hooks/core/types.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export interface FileManagerState {
|
|
|
18
18
|
sortOrder: SortOrderType;
|
|
19
19
|
pathHistory: PathItem[];
|
|
20
20
|
selectedFiles: Set<string>;
|
|
21
|
+
currentMenuFile: string;
|
|
21
22
|
loading: boolean;
|
|
22
23
|
pagination: PaginationState;
|
|
23
24
|
isModalVisible: boolean;
|
|
@@ -36,6 +37,7 @@ export interface FileManagerState {
|
|
|
36
37
|
fileToRename: string | null;
|
|
37
38
|
activeLibraryItem: string;
|
|
38
39
|
folderToRename: string | null;
|
|
40
|
+
multiSelect: boolean;
|
|
39
41
|
}
|
|
40
42
|
export interface FileManagerActions {
|
|
41
43
|
setFolders: (folders: Folder[]) => void;
|
|
@@ -46,7 +48,8 @@ export interface FileManagerActions {
|
|
|
46
48
|
setSortBy: (sortBy: SortByType) => void;
|
|
47
49
|
setSortOrder: (sortOrder: SortOrderType) => void;
|
|
48
50
|
setPathHistory: (history: PathItem[]) => void;
|
|
49
|
-
setSelectedFiles: (files
|
|
51
|
+
setSelectedFiles: (files?: Set<string>) => void;
|
|
52
|
+
setCurrentMenuFile: (file: string) => void;
|
|
50
53
|
setLoading: (isLoading: boolean) => void;
|
|
51
54
|
setPagination: (pagination: Partial<PaginationState>) => void;
|
|
52
55
|
setIsModalVisible: (visible: boolean) => void;
|
|
@@ -10,8 +10,14 @@ export declare const useCustomIcons: () => {
|
|
|
10
10
|
UploadByUrlIcon: (props?: IconProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
11
11
|
ExpandArrowIcon: (props?: IconProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
12
12
|
CollapseArrowIcon: (props?: IconProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
13
|
+
ExpandFolderIcon: (props?: IconProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
14
|
+
CollapseFolderIcon: (props?: IconProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
13
15
|
FolderPreviewIcon: (props?: IconProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
16
|
+
EmptyFolderIcon: (props?: IconProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
14
17
|
GridViewIcon: (props?: IconProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
15
18
|
ListViewIcon: (props?: IconProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
19
|
+
DropZoneFileIcon: (props?: IconProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
20
|
+
BigStockIcon: (props?: IconProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
21
|
+
BigAIIcon: (props?: IconProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
16
22
|
getCustomIcon: (iconName: keyof NonNullable<import("../types").CustomIcons | undefined>, defaultIcon: React.ComponentType<any>, props?: IconProps) => React.ReactElement;
|
|
17
23
|
};
|
|
@@ -2,6 +2,7 @@ import { File as AppFile, ThumbnailFile } from '../types';
|
|
|
2
2
|
interface UseFileActionsProps {
|
|
3
3
|
files: AppFile[];
|
|
4
4
|
selectedFiles: Set<string>;
|
|
5
|
+
currentMenuFile: string;
|
|
5
6
|
toggleFileSelection: (fileId: string) => void;
|
|
6
7
|
showRenameModal: (fileId: string) => void;
|
|
7
8
|
showMoveModal: () => void;
|
|
@@ -13,8 +14,8 @@ interface UseFileActionsProps {
|
|
|
13
14
|
}
|
|
14
15
|
export declare const useFileActions: ({ files, selectedFiles, toggleFileSelection, showRenameModal, showMoveModal, showCopyModal, handleDeleteFile, handleDeleteFolder, showDeleteConfirm, onEdit, }: UseFileActionsProps) => {
|
|
15
16
|
handleClearSelection: () => void;
|
|
16
|
-
handleRename: () => void;
|
|
17
|
-
handleDeleteSelected: () => void;
|
|
17
|
+
handleRename: (selectedFileId?: string) => void;
|
|
18
|
+
handleDeleteSelected: (file: AppFile | undefined) => void;
|
|
18
19
|
handleCopy: () => void;
|
|
19
20
|
handleMove: () => void;
|
|
20
21
|
handleEdit: () => void;
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export interface Folder {
|
|
|
7
7
|
id: string;
|
|
8
8
|
name: string;
|
|
9
9
|
parentId?: string | null;
|
|
10
|
+
childCount?: number;
|
|
10
11
|
}
|
|
11
12
|
export interface ThumbnailFile {
|
|
12
13
|
thumbnail: string;
|
|
@@ -16,7 +17,7 @@ export interface ThumbnailFile {
|
|
|
16
17
|
export interface File {
|
|
17
18
|
id: string;
|
|
18
19
|
name: string;
|
|
19
|
-
size?:
|
|
20
|
+
size?: number;
|
|
20
21
|
date?: string;
|
|
21
22
|
folderId: string;
|
|
22
23
|
type?: string;
|
|
@@ -29,6 +30,7 @@ export interface File {
|
|
|
29
30
|
selected?: boolean;
|
|
30
31
|
isFolder?: boolean;
|
|
31
32
|
lastEdited?: string;
|
|
33
|
+
childCount?: number;
|
|
32
34
|
}
|
|
33
35
|
export interface PathItem {
|
|
34
36
|
id: string;
|
|
@@ -124,12 +126,30 @@ export interface FileManagerOptions {
|
|
|
124
126
|
dragDropIcon?: string;
|
|
125
127
|
notification?: Partial<Omit<NotificationInstance, 'destroy'>>;
|
|
126
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* Результат операции
|
|
131
|
+
*/
|
|
132
|
+
export interface OperationResult<T = void> {
|
|
133
|
+
id?: string;
|
|
134
|
+
success?: boolean;
|
|
135
|
+
data?: T;
|
|
136
|
+
error?: string;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Результат групповой операции
|
|
140
|
+
*/
|
|
141
|
+
export type BatchResult<T> = {
|
|
142
|
+
success: boolean;
|
|
143
|
+
error?: string;
|
|
144
|
+
detailed?: OperationResult<T>[];
|
|
145
|
+
};
|
|
127
146
|
export interface FileManagerDataProviders {
|
|
128
147
|
getFileData: (file: File) => Promise<Blob>;
|
|
129
148
|
getFolders?: (options?: {
|
|
130
149
|
parentId?: string | null;
|
|
131
150
|
deep?: boolean;
|
|
132
151
|
}) => Promise<Folder[]>;
|
|
152
|
+
getChildrenCount?: (folderId?: string) => Promise<number>;
|
|
133
153
|
getFiles: (options: {
|
|
134
154
|
folderId?: string;
|
|
135
155
|
search?: string;
|
|
@@ -137,7 +157,7 @@ export interface FileManagerDataProviders {
|
|
|
137
157
|
sortOrder?: SortState['sortOrder'];
|
|
138
158
|
page?: number;
|
|
139
159
|
limit?: number;
|
|
140
|
-
itemType
|
|
160
|
+
itemType: 'file' | 'folder' | 'all';
|
|
141
161
|
}) => Promise<{
|
|
142
162
|
files: File[];
|
|
143
163
|
pagination?: Partial<ApiPaginationResponse>;
|
|
@@ -150,7 +170,7 @@ export interface FileManagerDataProviders {
|
|
|
150
170
|
deleteFolder?: (folderId: string) => Promise<boolean>;
|
|
151
171
|
uploadFile: (file: {
|
|
152
172
|
name: string;
|
|
153
|
-
size:
|
|
173
|
+
size: number;
|
|
154
174
|
type: string;
|
|
155
175
|
folderId?: string | null;
|
|
156
176
|
data: Blob | string;
|
|
@@ -165,20 +185,20 @@ export interface FileManagerDataProviders {
|
|
|
165
185
|
noFolder?: boolean;
|
|
166
186
|
}) => Promise<File>;
|
|
167
187
|
deleteFile: (fileId: string) => Promise<boolean>;
|
|
188
|
+
deleteItems?: (items: string[]) => Promise<BatchResult<{}>>;
|
|
168
189
|
renameFile?: (fileId: string, newName: string) => Promise<File>;
|
|
169
190
|
moveItem?: (options: {
|
|
170
191
|
itemId: string;
|
|
171
192
|
targetFolderId: string;
|
|
172
193
|
isFolder: boolean;
|
|
173
194
|
}) => Promise<boolean>;
|
|
195
|
+
moveItems?: (targetFolderId: string, files: string[]) => Promise<BatchResult<{}>>;
|
|
174
196
|
copyItem?: (options: {
|
|
175
197
|
itemId: string;
|
|
176
198
|
targetFolderId: string;
|
|
177
199
|
isFolder: boolean;
|
|
178
|
-
}) => Promise<
|
|
179
|
-
|
|
180
|
-
url?: string;
|
|
181
|
-
}>;
|
|
200
|
+
}) => Promise<boolean>;
|
|
201
|
+
copyItems?: (targetFolderId: string, files: string[]) => Promise<BatchResult<{}>>;
|
|
182
202
|
updateFile?: (fileId: string, updates: {
|
|
183
203
|
name?: string;
|
|
184
204
|
type?: string;
|
|
@@ -261,14 +281,24 @@ export interface Config {
|
|
|
261
281
|
locale?: string;
|
|
262
282
|
mode?: 'fileManager' | 'imageCenter' | 'plugin';
|
|
263
283
|
enabledTabs?: string[];
|
|
284
|
+
iconStrokeWidth?: number;
|
|
264
285
|
features?: {
|
|
265
286
|
enableRenameFolder?: boolean;
|
|
266
287
|
enableRenameFile?: boolean;
|
|
267
288
|
enableUpdateFile?: boolean;
|
|
289
|
+
/** Включить кнопку/пункт редактирования файла */
|
|
290
|
+
enableEdit?: boolean;
|
|
291
|
+
/** Включить перемещение */
|
|
292
|
+
enableMove?: boolean;
|
|
293
|
+
/** Включить копирование */
|
|
294
|
+
enableCopy?: boolean;
|
|
295
|
+
/** Включить удаление */
|
|
296
|
+
enableDelete?: boolean;
|
|
268
297
|
};
|
|
269
298
|
dataProcessingMode?: 'server' | 'client' | 'auto';
|
|
270
299
|
enableClientSideProcessing?: boolean;
|
|
271
300
|
disablePagination?: boolean;
|
|
301
|
+
enableTrashFolder?: boolean;
|
|
272
302
|
staticData?: {
|
|
273
303
|
files?: File[];
|
|
274
304
|
folders?: Folder[];
|
|
@@ -299,6 +329,7 @@ export interface Config {
|
|
|
299
329
|
expandAllFoldersOnInit?: boolean;
|
|
300
330
|
/** Запоминать последнюю открытую папку между сессиями */
|
|
301
331
|
rememberLastFolder?: boolean;
|
|
332
|
+
multiSelect?: boolean;
|
|
302
333
|
}
|
|
303
334
|
export type LibraryMenuKey = typeof MY_FILES | typeof GIF | typeof STOCK_IMAGES | typeof AI | typeof EDITOR;
|
|
304
335
|
export interface GifItem {
|
|
@@ -33,7 +33,7 @@ export declare class JSONDataProvider implements FileManagerDataProviders {
|
|
|
33
33
|
deleteFolder: (folderId: string) => Promise<boolean>;
|
|
34
34
|
uploadFile: (file: {
|
|
35
35
|
name: string;
|
|
36
|
-
size:
|
|
36
|
+
size: number;
|
|
37
37
|
type: string;
|
|
38
38
|
folderId?: string | null;
|
|
39
39
|
data: Blob | string;
|