@emailmaker/filemanager 0.0.1
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/app/themeProvider/ThemeProvider.d.ts +7 -0
- package/app/themeProvider/index.d.ts +1 -0
- package/components/CloseButton/CloseButton.d.ts +10 -0
- package/components/EmIcons/EmIcons.d.ts +14 -0
- package/components/FileContent/FileContent.d.ts +30 -0
- package/components/FileContent/GridView.d.ts +11 -0
- package/components/FileManagerApp/ActionsHeader.d.ts +14 -0
- package/components/FileManagerApp/FileManagerApp.d.ts +29 -0
- package/components/FileModals/FileModals.d.ts +37 -0
- package/components/FolderSidebar/FolderSidebar.d.ts +20 -0
- package/components/ImageAI/ImageAI.d.ts +4 -0
- package/components/ImageAI/SlideShowForImageAI/SlideShowForImageAI.d.ts +7 -0
- package/components/ImageAI/useImageAIGeneration/useImageAIGeneration.d.ts +2 -0
- package/components/ImageGif/ImageGif.d.ts +4 -0
- package/components/ImageStock/ImageStock.d.ts +4 -0
- package/components/LimitsCounter/LimitsCounter.d.ts +10 -0
- package/components/PixieEditor/PixieEditorIframe.d.ts +10 -0
- package/components/PixieEditor/index.d.ts +1 -0
- package/components/SearchInput/SearchInput.d.ts +8 -0
- package/components/SearchInput/index.d.ts +1 -0
- package/components/Tag/index.d.ts +11 -0
- package/components/UploadProgress/UploadProgress.d.ts +20 -0
- package/components/UploadProgress/index.d.ts +2 -0
- package/components/ViewModeToggle/ViewModeToggle.d.ts +9 -0
- package/components/index.d.ts +5 -0
- package/config/config.d.ts +5 -0
- package/config/usersConfigs/index.d.ts +26 -0
- package/constants/index.d.ts +11 -0
- package/debug-script.js +1 -0
- package/dev/index.d.ts +4 -0
- package/file-manager.css +1 -0
- package/file-manager.d.ts +46 -0
- package/file-manager.esm.js +2 -0
- package/file-manager.esm.js.map +1 -0
- package/file-manager.js +2 -0
- package/file-manager.js.LICENSE.txt +110 -0
- package/helpers/gtm.d.ts +16 -0
- package/hooks/core/context.d.ts +15 -0
- package/hooks/core/files/index.d.ts +4 -0
- package/hooks/core/files/useFilesAPI.d.ts +16 -0
- package/hooks/core/files/useFilesAPIHelpers.d.ts +18 -0
- package/hooks/core/files/useFilesModals.d.ts +20 -0
- package/hooks/core/files/useFilesSelection.d.ts +10 -0
- package/hooks/core/index.d.ts +11 -0
- package/hooks/core/temp/context.d.ts +0 -0
- package/hooks/core/types.d.ts +160 -0
- package/hooks/core/useFiles.d.ts +37 -0
- package/hooks/core/useFolderModals.d.ts +13 -0
- package/hooks/core/useFolders.d.ts +19 -0
- package/hooks/core/useModals.d.ts +17 -0
- package/hooks/core/useNavigation.d.ts +15 -0
- package/hooks/core/usePagination.d.ts +12 -0
- package/hooks/core/useSortAndFilter.d.ts +20 -0
- package/hooks/index.d.ts +5 -0
- package/hooks/useCustomIcons.d.ts +17 -0
- package/hooks/useFileActions.d.ts +21 -0
- package/hooks/useFileUpload.d.ts +16 -0
- package/hooks/useLastDirectory.d.ts +18 -0
- package/hooks/usePixieEditor.d.ts +15 -0
- package/hooks/useSidebarResize.d.ts +9 -0
- package/hooks/useViewMode.d.ts +7 -0
- package/i18n.d.ts +3 -0
- package/index.d.ts +13 -0
- package/index.html +141 -0
- package/loacal_module/pixie/dist/images/empty-canvas-bg.png +0 -0
- package/loacal_module/pixie/dist/pixie.es.js +2 -0
- package/loacal_module/pixie/dist/pixie.es.js.LICENSE.txt +86 -0
- package/loacal_module/pixie/dist/pixie.es.js.map +1 -0
- package/loacal_module/pixie/dist/pixie.umd.js +2 -0
- package/loacal_module/pixie/dist/pixie.umd.js.LICENSE.txt +116 -0
- package/loacal_module/pixie/dist/pixie.umd.js.map +1 -0
- package/mockServiceWorker.js +1 -0
- package/package.json +30 -0
- package/pixie-editor.html +187 -0
- package/shared/config.d.ts +13 -0
- package/shared/helpers/getParendFolderPath.d.ts +1 -0
- package/shared/helpers/index.d.ts +1 -0
- package/suppress-resize-observer-errors.js +1 -0
- package/test-pixie-loading.html +108 -0
- package/types.d.ts +379 -0
- package/utils/fileValidation.d.ts +34 -0
- package/utils/resizeObserverHandler.d.ts +6 -0
- package/utils/themeUtils.d.ts +17 -0
- package/widgets/layout/errorBoundary/errorBoundary.d.ts +19 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
Copyright (c) 2018 Jed Watson.
|
|
3
|
+
Licensed under the MIT License (MIT), see
|
|
4
|
+
http://jedwatson.github.io/classnames
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @license
|
|
9
|
+
* Lodash <https://lodash.com/>
|
|
10
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
11
|
+
* Released under MIT license <https://lodash.com/license>
|
|
12
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
13
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @license React
|
|
18
|
+
* react-dom-client.production.js
|
|
19
|
+
*
|
|
20
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
21
|
+
*
|
|
22
|
+
* This source code is licensed under the MIT license found in the
|
|
23
|
+
* LICENSE file in the root directory of this source tree.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @license React
|
|
28
|
+
* react-is.production.min.js
|
|
29
|
+
*
|
|
30
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
31
|
+
*
|
|
32
|
+
* This source code is licensed under the MIT license found in the
|
|
33
|
+
* LICENSE file in the root directory of this source tree.
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @license React
|
|
38
|
+
* react-jsx-runtime.production.js
|
|
39
|
+
*
|
|
40
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
41
|
+
*
|
|
42
|
+
* This source code is licensed under the MIT license found in the
|
|
43
|
+
* LICENSE file in the root directory of this source tree.
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @license React
|
|
48
|
+
* scheduler.production.js
|
|
49
|
+
*
|
|
50
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
51
|
+
*
|
|
52
|
+
* This source code is licensed under the MIT license found in the
|
|
53
|
+
* LICENSE file in the root directory of this source tree.
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
/** */
|
|
57
|
+
|
|
58
|
+
/** */
|
|
59
|
+
|
|
60
|
+
/** */
|
|
61
|
+
|
|
62
|
+
/** */
|
|
63
|
+
|
|
64
|
+
/** */
|
|
65
|
+
|
|
66
|
+
/** */
|
|
67
|
+
|
|
68
|
+
/** */
|
|
69
|
+
|
|
70
|
+
/** */
|
|
71
|
+
|
|
72
|
+
/** */
|
|
73
|
+
|
|
74
|
+
/** */
|
|
75
|
+
|
|
76
|
+
/** */
|
|
77
|
+
|
|
78
|
+
/** */
|
|
79
|
+
|
|
80
|
+
/** */
|
|
81
|
+
|
|
82
|
+
/** */
|
|
83
|
+
|
|
84
|
+
/** */
|
|
85
|
+
|
|
86
|
+
/** */
|
|
87
|
+
|
|
88
|
+
/** */
|
|
89
|
+
|
|
90
|
+
/** */
|
|
91
|
+
|
|
92
|
+
/** */
|
|
93
|
+
|
|
94
|
+
/** */
|
|
95
|
+
|
|
96
|
+
/** */
|
|
97
|
+
|
|
98
|
+
/** */
|
|
99
|
+
|
|
100
|
+
/** */
|
|
101
|
+
|
|
102
|
+
/** */
|
|
103
|
+
|
|
104
|
+
/** */
|
|
105
|
+
|
|
106
|
+
/** */
|
|
107
|
+
|
|
108
|
+
/** */
|
|
109
|
+
|
|
110
|
+
/** */
|
package/helpers/gtm.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface Window {
|
|
3
|
+
dataLayer?: any[];
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
interface GTMEvent {
|
|
7
|
+
event: string;
|
|
8
|
+
eventData?: string;
|
|
9
|
+
action?: string;
|
|
10
|
+
label?: string;
|
|
11
|
+
appLabel?: string;
|
|
12
|
+
value?: number;
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
}
|
|
15
|
+
export declare const usePushToDataLayer: () => (eventObj: GTMEvent, delay?: number) => void;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { FileManagerOptions } from '../../types';
|
|
3
|
+
import { FileManagerState, FileManagerActions } from './types';
|
|
4
|
+
export interface FileManagerContextValue {
|
|
5
|
+
state: FileManagerState;
|
|
6
|
+
actions: Partial<FileManagerActions>;
|
|
7
|
+
options: FileManagerOptions;
|
|
8
|
+
}
|
|
9
|
+
export declare const FileManagerContext: React.Context<FileManagerContextValue>;
|
|
10
|
+
export declare const useFileManagerContext: () => FileManagerContextValue;
|
|
11
|
+
export interface FileManagerProviderProps {
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
options: FileManagerOptions;
|
|
14
|
+
}
|
|
15
|
+
export declare const FileManagerProvider: React.FC<FileManagerProviderProps>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { useFilesAPI, type UseFilesAPIActions } from './useFilesAPI';
|
|
2
|
+
export { useFilesSelection, type UseFilesSelectionState, type UseFilesSelectionActions } from './useFilesSelection';
|
|
3
|
+
export { useFilesModals, type UseFilesModalsState, type UseFilesModalsActions } from './useFilesModals';
|
|
4
|
+
export * from './useFilesAPIHelpers';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FilesQueryParams } from '../../../types';
|
|
2
|
+
export interface UseFilesAPIActions {
|
|
3
|
+
fetchFiles: (params?: FilesQueryParams) => Promise<void>;
|
|
4
|
+
handleDeleteFile: (fileId: string) => Promise<void>;
|
|
5
|
+
handleDeleteFolder: (folderId: string) => Promise<void>;
|
|
6
|
+
handleAddFile: (progressCallbacks?: {
|
|
7
|
+
onStart: (file: globalThis.File) => void;
|
|
8
|
+
onProgress: (fileName: string, progress: number) => void;
|
|
9
|
+
onComplete: (fileName: string) => void;
|
|
10
|
+
onError: (fileName: string, error: string) => void;
|
|
11
|
+
}) => Promise<void>;
|
|
12
|
+
handleAddFileByUrl: (url?: string | null) => Promise<void>;
|
|
13
|
+
handleDroppedFiles: (droppedFiles: globalThis.File[]) => Promise<void>;
|
|
14
|
+
getFileData: (fileId: string) => Promise<Blob | undefined>;
|
|
15
|
+
}
|
|
16
|
+
export declare const useFilesAPI: () => UseFilesAPIActions;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { File as AppFile, Folder, FilesQueryParams } from '../../../types';
|
|
2
|
+
export interface ApiPagination {
|
|
3
|
+
page: number;
|
|
4
|
+
limit: number;
|
|
5
|
+
total: number;
|
|
6
|
+
}
|
|
7
|
+
interface ApiResponse {
|
|
8
|
+
data?: AppFile[];
|
|
9
|
+
files?: AppFile[];
|
|
10
|
+
pagination?: ApiPagination;
|
|
11
|
+
}
|
|
12
|
+
export declare const buildFilesURL: (baseURL: string, params?: FilesQueryParams) => string;
|
|
13
|
+
export declare const processApiResponse: (data: ApiResponse | AppFile[]) => {
|
|
14
|
+
files: AppFile[];
|
|
15
|
+
pagination?: ApiPagination;
|
|
16
|
+
};
|
|
17
|
+
export declare const addSubfoldersToFiles: (files: AppFile[], params: FilesQueryParams, getFolders: (() => Promise<Folder[]>) | undefined, getFoldersEndpoint: string | undefined) => Promise<AppFile[]>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FilesQueryParams } from '../../../types';
|
|
2
|
+
export interface UseFilesModalsState {
|
|
3
|
+
isRenamingFile: boolean;
|
|
4
|
+
fileToRename: string | null;
|
|
5
|
+
}
|
|
6
|
+
export interface UseFilesModalsActions {
|
|
7
|
+
showRenameModal: (fileId: string) => void;
|
|
8
|
+
handleRenameCancel: () => void;
|
|
9
|
+
handleRenameOk: () => Promise<void>;
|
|
10
|
+
showMoveModal: () => void;
|
|
11
|
+
handleMoveCancel: () => void;
|
|
12
|
+
handleMoveOk: () => Promise<void>;
|
|
13
|
+
showCopyModal: () => void;
|
|
14
|
+
handleCopyCancel: () => void;
|
|
15
|
+
handleCopyOk: () => Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export declare const useFilesModals: (fetchFiles: (params?: FilesQueryParams) => Promise<void>) => {
|
|
18
|
+
state: UseFilesModalsState;
|
|
19
|
+
actions: UseFilesModalsActions;
|
|
20
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface UseFilesSelectionState {
|
|
2
|
+
selectedFiles: Set<string>;
|
|
3
|
+
}
|
|
4
|
+
export interface UseFilesSelectionActions {
|
|
5
|
+
toggleFileSelection: (fileId: string) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const useFilesSelection: () => {
|
|
8
|
+
state: UseFilesSelectionState;
|
|
9
|
+
actions: UseFilesSelectionActions;
|
|
10
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type { FileManagerState, FileManagerActions, FileManagerHookBase, SearchSortState, ModalState, ApiResponse, FileManagerContextType, SortByType, SortOrderType, } from './types';
|
|
2
|
+
import { FileManagerContext as FileManagerContextInterface } from './types';
|
|
3
|
+
export type { FileManagerContextInterface };
|
|
4
|
+
export { FileManagerContext, useFileManagerContext, FileManagerProvider } from './context';
|
|
5
|
+
export type { FileManagerContextValue, FileManagerProviderProps } from './context';
|
|
6
|
+
export * from './useFiles';
|
|
7
|
+
export * from './useFolders';
|
|
8
|
+
export * from './useModals';
|
|
9
|
+
export * from './useNavigation';
|
|
10
|
+
export * from './usePagination';
|
|
11
|
+
export * from './useSortAndFilter';
|
|
File without changes
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { FormInstance } from 'antd/es/form';
|
|
2
|
+
import { File, Folder, FileManagerDataProviders, PaginationState, PathItem, MenuItem, FilesQueryParams, LibraryMenuKey } from '../../types';
|
|
3
|
+
export type SortByType = 'name' | 'size' | 'date' | 'type';
|
|
4
|
+
export type SortOrderType = 'asc' | 'desc';
|
|
5
|
+
export type SortOptionType = 'date-desc' | 'date-asc' | 'size-desc' | 'size-asc' | 'name-asc' | 'name-desc' | 'type-asc';
|
|
6
|
+
export declare const parseSortOption: (option: SortOptionType) => {
|
|
7
|
+
sortBy: SortByType;
|
|
8
|
+
sortOrder: SortOrderType;
|
|
9
|
+
};
|
|
10
|
+
export declare const createSortOption: (sortBy: SortByType, sortOrder: SortOrderType) => SortOptionType;
|
|
11
|
+
export interface FileManagerState {
|
|
12
|
+
folders: Folder[];
|
|
13
|
+
files: File[];
|
|
14
|
+
selectedFolder: string | null;
|
|
15
|
+
searchTerm: string;
|
|
16
|
+
sortField: string;
|
|
17
|
+
sortBy: SortByType;
|
|
18
|
+
sortOrder: SortOrderType;
|
|
19
|
+
pathHistory: PathItem[];
|
|
20
|
+
selectedFiles: Set<string>;
|
|
21
|
+
loading: boolean;
|
|
22
|
+
pagination: PaginationState;
|
|
23
|
+
isModalVisible: boolean;
|
|
24
|
+
isUrlModalVisible: boolean;
|
|
25
|
+
isRenameModalVisible: boolean;
|
|
26
|
+
isMoveModalVisible: boolean;
|
|
27
|
+
isRenameFolderModalVisible: boolean;
|
|
28
|
+
isCopyModalVisible: boolean;
|
|
29
|
+
form: FormInstance;
|
|
30
|
+
urlForm: FormInstance;
|
|
31
|
+
renameForm: FormInstance;
|
|
32
|
+
moveForm: FormInstance;
|
|
33
|
+
renameFolderForm: FormInstance;
|
|
34
|
+
copyForm: FormInstance;
|
|
35
|
+
fileToRename: string | null;
|
|
36
|
+
activeLibraryItem: string;
|
|
37
|
+
folderToRename: string | null;
|
|
38
|
+
}
|
|
39
|
+
export interface FileManagerActions {
|
|
40
|
+
setFolders: (folders: Folder[]) => void;
|
|
41
|
+
setFiles: (files: File[]) => void;
|
|
42
|
+
setSelectedFolder: (folderId: string | null) => void;
|
|
43
|
+
setSearchTerm: (term: string) => void;
|
|
44
|
+
setSortField: (field: string) => void;
|
|
45
|
+
setSortBy: (sortBy: SortByType) => void;
|
|
46
|
+
setSortOrder: (sortOrder: SortOrderType) => void;
|
|
47
|
+
setPathHistory: (history: PathItem[]) => void;
|
|
48
|
+
setSelectedFiles: (files: Set<string>) => void;
|
|
49
|
+
setLoading: (isLoading: boolean) => void;
|
|
50
|
+
setPagination: (pagination: Partial<PaginationState>) => void;
|
|
51
|
+
setIsModalVisible: (visible: boolean) => void;
|
|
52
|
+
setIsUrlModalVisible: (visible: boolean) => void;
|
|
53
|
+
setIsRenameModalVisible: (visible: boolean) => void;
|
|
54
|
+
setIsMoveModalVisible: (visible: boolean) => void;
|
|
55
|
+
setIsRenameFolderModalVisible: (visible: boolean) => void;
|
|
56
|
+
setIsCopyModalVisible: (visible: boolean) => void;
|
|
57
|
+
setFileToRename: (fileId: string | null) => void;
|
|
58
|
+
setActiveLibraryItem: (item: LibraryMenuKey) => void;
|
|
59
|
+
setFolderToRename: (folderId: string | null) => void;
|
|
60
|
+
updatePathHistoryOnFolderRename: (folderId: string, newName: string) => void;
|
|
61
|
+
fetchFolders: () => Promise<void>;
|
|
62
|
+
handleCreateFolder: () => void;
|
|
63
|
+
handleModalOk: () => Promise<void>;
|
|
64
|
+
handleModalCancel: () => void;
|
|
65
|
+
generateMenuItems: () => MenuItem[];
|
|
66
|
+
fetchFiles: (params?: FilesQueryParams) => Promise<void>;
|
|
67
|
+
handleDeleteFile: (fileId: string) => Promise<void>;
|
|
68
|
+
toggleFileSelection: (fileId: string) => void;
|
|
69
|
+
handleItemClick: (record: File) => void;
|
|
70
|
+
handleAddFile: () => Promise<void>;
|
|
71
|
+
handleDroppedFiles: (droppedFiles: globalThis.File[]) => Promise<void>;
|
|
72
|
+
handleFolderSelect: (folderId: string) => void;
|
|
73
|
+
handleBreadcrumbClick: (index: number) => void;
|
|
74
|
+
showRenameModal: (fileId: string) => void;
|
|
75
|
+
handleRenameCancel: () => void;
|
|
76
|
+
handleRenameOk: () => Promise<void>;
|
|
77
|
+
handleAddFileByUrl: () => Promise<void>;
|
|
78
|
+
showMoveModal: () => void;
|
|
79
|
+
handleMoveCancel: () => void;
|
|
80
|
+
handleMoveOk: () => Promise<void>;
|
|
81
|
+
showCopyModal: () => void;
|
|
82
|
+
handleCopyCancel: () => void;
|
|
83
|
+
handleCopyOk: () => Promise<void>;
|
|
84
|
+
}
|
|
85
|
+
export interface FileManagerContext {
|
|
86
|
+
apiEndpoints: Record<string, string | undefined>;
|
|
87
|
+
dataProviders?: FileManagerDataProviders;
|
|
88
|
+
onPathChange?: (path: string[]) => void;
|
|
89
|
+
}
|
|
90
|
+
export interface FileManagerHookBase {
|
|
91
|
+
state: Partial<FileManagerState>;
|
|
92
|
+
actions: Partial<FileManagerActions>;
|
|
93
|
+
}
|
|
94
|
+
export interface SearchSortState {
|
|
95
|
+
searchQuery: string;
|
|
96
|
+
sortBy: SortByType;
|
|
97
|
+
sortDirection: SortOrderType;
|
|
98
|
+
currentPage: number;
|
|
99
|
+
itemsPerPage: number;
|
|
100
|
+
}
|
|
101
|
+
export interface ModalState {
|
|
102
|
+
isAddFolderModalOpen: boolean;
|
|
103
|
+
isAddFileModalOpen: boolean;
|
|
104
|
+
isAddFileByUrlModalOpen: boolean;
|
|
105
|
+
isRenameModalOpen: boolean;
|
|
106
|
+
fileToRenameObj: File | null;
|
|
107
|
+
folderToRename: Folder | null;
|
|
108
|
+
}
|
|
109
|
+
export interface ApiResponse<T> {
|
|
110
|
+
success: boolean;
|
|
111
|
+
data?: T;
|
|
112
|
+
error?: string;
|
|
113
|
+
}
|
|
114
|
+
export interface FileManagerContextType {
|
|
115
|
+
folders: Folder[];
|
|
116
|
+
files: File[];
|
|
117
|
+
selectedFolder: string | null;
|
|
118
|
+
searchTerm: string;
|
|
119
|
+
sortField: string;
|
|
120
|
+
sortBy: SortByType;
|
|
121
|
+
sortOrder: SortOrderType;
|
|
122
|
+
pathHistory: PathItem[];
|
|
123
|
+
selectedFiles: Set<string>;
|
|
124
|
+
loading: boolean;
|
|
125
|
+
pagination: PaginationState;
|
|
126
|
+
searchQuery: string;
|
|
127
|
+
sortDirection: SortOrderType;
|
|
128
|
+
currentPage: number;
|
|
129
|
+
itemsPerPage: number;
|
|
130
|
+
isAddFolderModalOpen: boolean;
|
|
131
|
+
isAddFileModalOpen: boolean;
|
|
132
|
+
isAddFileByUrlModalOpen: boolean;
|
|
133
|
+
isRenameModalOpen: boolean;
|
|
134
|
+
fileToRename: string | null;
|
|
135
|
+
fileToRenameObj: File | null;
|
|
136
|
+
folderToRename: Folder | null;
|
|
137
|
+
addFile: (file: File) => Promise<void>;
|
|
138
|
+
addFileByUrl: (url: string, name: string) => Promise<void>;
|
|
139
|
+
deleteFiles: (fileIds: string[]) => Promise<void>;
|
|
140
|
+
renameFile: (fileId: string, newName: string) => Promise<void>;
|
|
141
|
+
addFolder: (folderName: string) => Promise<void>;
|
|
142
|
+
deleteFolder: (folderId: string) => Promise<void>;
|
|
143
|
+
renameFolder: (folderId: string, newName: string) => Promise<void>;
|
|
144
|
+
navigateToFolder: (folderId: string | null) => void;
|
|
145
|
+
toggleSelectFile: (fileId: string) => void;
|
|
146
|
+
toggleSelectFolder: (folderId: string) => void;
|
|
147
|
+
clearSelection: () => void;
|
|
148
|
+
openAddFolderModal: () => void;
|
|
149
|
+
closeAddFolderModal: () => void;
|
|
150
|
+
openAddFileModal: () => void;
|
|
151
|
+
closeAddFileModal: () => void;
|
|
152
|
+
openAddFileByUrlModal: () => void;
|
|
153
|
+
closeAddFileByUrlModal: () => void;
|
|
154
|
+
openRenameModal: (item: File | Folder) => void;
|
|
155
|
+
closeRenameModal: () => void;
|
|
156
|
+
setSearchQuery: (query: string) => void;
|
|
157
|
+
setSortBy: (field: SortByType) => void;
|
|
158
|
+
setSortDirection: (direction: SortOrderType) => void;
|
|
159
|
+
setCurrentPage: (page: number) => void;
|
|
160
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { File as AppFile, FilesQueryParams } from '../../types';
|
|
2
|
+
import { FileManagerHookBase } from './types';
|
|
3
|
+
export interface UseFilesState {
|
|
4
|
+
files: AppFile[];
|
|
5
|
+
selectedFiles: Set<string>;
|
|
6
|
+
loading: boolean;
|
|
7
|
+
isAddingFileByUrl: boolean;
|
|
8
|
+
isRenamingFile: boolean;
|
|
9
|
+
fileToRename: string | null;
|
|
10
|
+
}
|
|
11
|
+
export interface UseFilesActions {
|
|
12
|
+
fetchFiles: (params?: FilesQueryParams) => Promise<void>;
|
|
13
|
+
handleDeleteFile: (fileId: string) => Promise<void>;
|
|
14
|
+
handleDeleteFolder: (folderId: string) => Promise<void>;
|
|
15
|
+
handleAddFile: (progressCallbacks?: {
|
|
16
|
+
onStart: (file: globalThis.File) => void;
|
|
17
|
+
onProgress: (fileName: string, progress: number) => void;
|
|
18
|
+
onComplete: (fileName: string) => void;
|
|
19
|
+
onError: (fileName: string, error: string) => void;
|
|
20
|
+
}) => Promise<void>;
|
|
21
|
+
handleAddFileByUrl: (url?: string | null) => Promise<void>;
|
|
22
|
+
toggleFileSelection: (fileId: string) => void;
|
|
23
|
+
showRenameModal: (fileId: string) => void;
|
|
24
|
+
handleRenameCancel: () => void;
|
|
25
|
+
handleRenameOk: () => Promise<void>;
|
|
26
|
+
handleDroppedFiles: (droppedFiles: globalThis.File[]) => Promise<void>;
|
|
27
|
+
showMoveModal: () => void;
|
|
28
|
+
handleMoveCancel: () => void;
|
|
29
|
+
handleMoveOk: () => Promise<void>;
|
|
30
|
+
showCopyModal: () => void;
|
|
31
|
+
handleCopyCancel: () => void;
|
|
32
|
+
handleCopyOk: () => Promise<void>;
|
|
33
|
+
}
|
|
34
|
+
export declare const useFiles: () => FileManagerHookBase & {
|
|
35
|
+
state: UseFilesState;
|
|
36
|
+
actions: UseFilesActions;
|
|
37
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface UseFolderModalsState {
|
|
2
|
+
isRenamingFolder: boolean;
|
|
3
|
+
folderToRename: string | null;
|
|
4
|
+
}
|
|
5
|
+
export interface UseFolderModalsActions {
|
|
6
|
+
showRenameFolderModal: (folderId: string) => void;
|
|
7
|
+
handleRenameFolderCancel: () => void;
|
|
8
|
+
handleRenameFolderOk: () => Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
export declare const useFolderModals: (fetchFolders: () => Promise<void>) => {
|
|
11
|
+
state: UseFolderModalsState;
|
|
12
|
+
actions: UseFolderModalsActions;
|
|
13
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Folder, MenuItem } from '../../types';
|
|
2
|
+
import { FileManagerHookBase } from './types';
|
|
3
|
+
export interface UseFoldersState {
|
|
4
|
+
folders: Folder[];
|
|
5
|
+
isCreatingFolder: boolean;
|
|
6
|
+
loading: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface UseFoldersActions {
|
|
9
|
+
fetchFolders: () => Promise<void>;
|
|
10
|
+
handleCreateFolder: () => void;
|
|
11
|
+
handleModalOk: () => Promise<void>;
|
|
12
|
+
handleModalCancel: () => void;
|
|
13
|
+
generateMenuItems: () => MenuItem[];
|
|
14
|
+
renameFolder: (folderId: string, newName: string) => Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
export declare const useFolders: () => FileManagerHookBase & {
|
|
17
|
+
state: UseFoldersState;
|
|
18
|
+
actions: UseFoldersActions;
|
|
19
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { File, Folder } from '../../types';
|
|
2
|
+
import { ModalState } from './types';
|
|
3
|
+
export interface UseModalsActions {
|
|
4
|
+
openAddFolderModal: () => void;
|
|
5
|
+
closeAddFolderModal: () => void;
|
|
6
|
+
openAddFileModal: () => void;
|
|
7
|
+
closeAddFileModal: () => void;
|
|
8
|
+
openAddFileByUrlModal: () => void;
|
|
9
|
+
closeAddFileByUrlModal: () => void;
|
|
10
|
+
openRenameModal: (item: File | Folder) => void;
|
|
11
|
+
closeRenameModal: () => void;
|
|
12
|
+
}
|
|
13
|
+
export interface UseModalsResult {
|
|
14
|
+
state: ModalState;
|
|
15
|
+
actions: UseModalsActions;
|
|
16
|
+
}
|
|
17
|
+
export declare const useModals: () => UseModalsResult;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { File as AppFile } from '../../types';
|
|
2
|
+
import { FileManagerHookBase } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Хук для навигации по структуре папок
|
|
5
|
+
*/
|
|
6
|
+
export declare const useNavigation: () => FileManagerHookBase & {
|
|
7
|
+
selectedFolder: string | null;
|
|
8
|
+
pathHistory: Array<{
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
}>;
|
|
12
|
+
handleFolderSelect: (folderId: string) => void;
|
|
13
|
+
handleBreadcrumbClick: (index: number) => void;
|
|
14
|
+
handleItemClick: (record: AppFile) => void;
|
|
15
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PaginationState } from '../../types';
|
|
2
|
+
import { FileManagerHookBase } from './types';
|
|
3
|
+
export interface UsePaginationState {
|
|
4
|
+
pagination: PaginationState;
|
|
5
|
+
}
|
|
6
|
+
export interface UsePaginationActions {
|
|
7
|
+
handlePaginationChange: (page: number, pageSize?: number) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const usePagination: () => FileManagerHookBase & {
|
|
10
|
+
state: UsePaginationState;
|
|
11
|
+
actions: UsePaginationActions;
|
|
12
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FilesQueryParams } from '../../types';
|
|
2
|
+
import { FileManagerHookBase, SortByType, SortOrderType } from './types';
|
|
3
|
+
export interface UseSortAndFilterState {
|
|
4
|
+
searchTerm: string;
|
|
5
|
+
sortBy: SortByType;
|
|
6
|
+
sortOrder: SortOrderType;
|
|
7
|
+
}
|
|
8
|
+
export interface UseSortAndFilterActions {
|
|
9
|
+
setSearchTerm: (term: string) => void;
|
|
10
|
+
setSortBy: (sortBy: SortByType) => void;
|
|
11
|
+
setSortOrder: (sortOrder: SortOrderType) => void;
|
|
12
|
+
handleSearch: (searchTerm: string) => void;
|
|
13
|
+
handleSort: (sortBy: SortByType, sortOrder: SortOrderType) => void;
|
|
14
|
+
handlePaginationChange: (page: number, pageSize?: number) => void;
|
|
15
|
+
getCurrentQueryParams: () => FilesQueryParams;
|
|
16
|
+
}
|
|
17
|
+
export declare const useSortAndFilter: (fetchFilesFn?: (params?: FilesQueryParams) => Promise<void>) => FileManagerHookBase & {
|
|
18
|
+
state: UseSortAndFilterState;
|
|
19
|
+
actions: UseSortAndFilterActions;
|
|
20
|
+
};
|
package/hooks/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IconProps } from '../types';
|
|
3
|
+
export declare const useCustomIcons: () => {
|
|
4
|
+
RootFolderIcon: (props?: IconProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
5
|
+
FolderIcon: (props?: IconProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
6
|
+
FolderOpenIcon: (props?: IconProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
7
|
+
AddFolderIcon: (props?: IconProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
8
|
+
FileIcon: (props?: IconProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
9
|
+
UploadIcon: (props?: IconProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
10
|
+
UploadByUrlIcon: (props?: IconProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
11
|
+
ExpandArrowIcon: (props?: IconProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
12
|
+
CollapseArrowIcon: (props?: IconProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
13
|
+
FolderPreviewIcon: (props?: IconProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
14
|
+
GridViewIcon: (props?: IconProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
15
|
+
ListViewIcon: (props?: IconProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
16
|
+
getCustomIcon: (iconName: keyof NonNullable<import("../types").CustomIcons | undefined>, defaultIcon: React.ComponentType<any>, props?: IconProps) => React.ReactElement;
|
|
17
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { File as AppFile, ThumbnailFile } from '../types';
|
|
2
|
+
interface UseFileActionsProps {
|
|
3
|
+
files: AppFile[];
|
|
4
|
+
selectedFiles: Set<string>;
|
|
5
|
+
toggleFileSelection: (fileId: string) => void;
|
|
6
|
+
showRenameModal: (fileId: string) => void;
|
|
7
|
+
showMoveModal: () => void;
|
|
8
|
+
showCopyModal: () => void;
|
|
9
|
+
handleDeleteFile: (fileId: string) => void;
|
|
10
|
+
handleDeleteFolder: (folderId: string) => void;
|
|
11
|
+
onEdit: (file?: AppFile | ThumbnailFile) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const useFileActions: ({ files, selectedFiles, toggleFileSelection, showRenameModal, showMoveModal, showCopyModal, handleDeleteFile, handleDeleteFolder, onEdit, }: UseFileActionsProps) => {
|
|
14
|
+
handleClearSelection: () => void;
|
|
15
|
+
handleRename: () => void;
|
|
16
|
+
handleDeleteSelected: () => void;
|
|
17
|
+
handleCopy: () => void;
|
|
18
|
+
handleMove: () => void;
|
|
19
|
+
handleEdit: () => void;
|
|
20
|
+
};
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { UploadFileItem } from '../components/UploadProgress/UploadProgress';
|
|
2
|
+
export interface UseFileUploadReturn {
|
|
3
|
+
uploadFiles: UploadFileItem[];
|
|
4
|
+
isUploadVisible: boolean;
|
|
5
|
+
isUploadMinimized: boolean;
|
|
6
|
+
totalFiles: number;
|
|
7
|
+
completedFiles: number;
|
|
8
|
+
startUpload: (files: globalThis.File[]) => string[];
|
|
9
|
+
updateProgress: (fileId: string, progress: number) => void;
|
|
10
|
+
markAsSuccess: (fileId: string) => void;
|
|
11
|
+
markAsError: (fileId: string, error: string) => void;
|
|
12
|
+
closeUpload: () => void;
|
|
13
|
+
minimizeUpload: () => void;
|
|
14
|
+
insertFile: (fileId: string) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare const useFileUpload: () => UseFileUploadReturn;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface LastDirectoryData {
|
|
2
|
+
folderId: string | null;
|
|
3
|
+
pathHistory: Array<{
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
}>;
|
|
7
|
+
timestamp: number;
|
|
8
|
+
}
|
|
9
|
+
export interface UseLastDirectoryResult {
|
|
10
|
+
getLastDirectory: () => LastDirectoryData | null;
|
|
11
|
+
saveLastDirectory: (folderId: string | null, pathHistory: Array<{
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
}>) => void;
|
|
15
|
+
clearLastDirectory: () => void;
|
|
16
|
+
hasValidLastDirectory: () => boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare const useLastDirectory: () => UseLastDirectoryResult;
|