@emailmaker/filemanager 0.10.30 → 0.10.32
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/FileModals/FileModals.d.ts +1 -1
- package/file-manager.css +20 -9
- package/file-manager.esm.js +9 -9
- package/file-manager.esm.js.map +1 -1
- package/file-manager.js +1 -1
- package/hooks/core/files/actions/useFilesCopy.d.ts +22 -0
- package/hooks/core/files/actions/useFilesDelete.d.ts +18 -0
- package/hooks/core/files/actions/useFilesMove.d.ts +22 -0
- package/hooks/core/files/actions/useFilesRename.d.ts +19 -0
- package/hooks/core/files/modals/helpers.d.ts +12 -0
- package/hooks/core/files/{useFilesCopyModal.d.ts → modals/useFilesCopyModal.d.ts} +1 -1
- package/hooks/core/files/{useFilesDeleteModal.d.ts → modals/useFilesDeleteModal.d.ts} +1 -1
- package/hooks/core/files/{useFilesMoveModal.d.ts → modals/useFilesMoveModal.d.ts} +1 -1
- package/hooks/core/files/{useFilesRenameModal.d.ts → modals/useFilesRenameModal.d.ts} +1 -1
- package/hooks/core/files/modals/useRefreshData.d.ts +16 -0
- package/hooks/notifications/index.d.ts +2 -0
- package/hooks/notifications/types.d.ts +40 -0
- package/hooks/notifications/useNotificationsBase.d.ts +2 -0
- package/hooks/useNotifications.d.ts +1 -22
- package/index.d.ts +1 -0
- package/notification.d.ts +295 -59
- package/package.json +1 -1
- package/shared/fileManagerApiError.d.ts +3 -3
- package/shared/mapHttpStatusToErrorCode.d.ts +5 -0
- package/types.d.ts +3 -9
- package/utils/errorMessages.d.ts +2 -2
- package/utils/fileValidation.d.ts +1 -0
- package/constants/errors.d.ts +0 -47
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Notify } from '../../../../types';
|
|
2
|
+
export interface CopyItemsParams {
|
|
3
|
+
items: Array<{
|
|
4
|
+
id: string;
|
|
5
|
+
isFolder?: boolean;
|
|
6
|
+
}>;
|
|
7
|
+
targetFolderId: string;
|
|
8
|
+
getItemNameById: (id?: string | null) => string | undefined;
|
|
9
|
+
showNotifications?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface UseFilesCopyResult {
|
|
12
|
+
successCount: number;
|
|
13
|
+
failCount: number;
|
|
14
|
+
errorDetails: Notify.OperationErrorDetail[];
|
|
15
|
+
}
|
|
16
|
+
export declare const useFilesCopy: () => {
|
|
17
|
+
copyItems: ({ items, targetFolderId, getItemNameById, showNotifications }: CopyItemsParams) => Promise<{
|
|
18
|
+
successCount: number;
|
|
19
|
+
failCount: number;
|
|
20
|
+
errorDetails: Notify.OperationErrorDetail[];
|
|
21
|
+
}>;
|
|
22
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Notify } from '../../../../types';
|
|
2
|
+
export interface DeleteItemsParams {
|
|
3
|
+
items: Array<{
|
|
4
|
+
id: string;
|
|
5
|
+
isFolder?: boolean;
|
|
6
|
+
}>;
|
|
7
|
+
selectedFolder?: string | null;
|
|
8
|
+
getItemNameById: (id?: string | null) => string | undefined;
|
|
9
|
+
showNotifications?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface UseFilesDeleteApiResult {
|
|
12
|
+
successCount: number;
|
|
13
|
+
failCount: number;
|
|
14
|
+
errorDetails: Notify.OperationErrorDetail[];
|
|
15
|
+
}
|
|
16
|
+
export declare const useFilesDelete: () => {
|
|
17
|
+
deleteItems: ({ items, selectedFolder, getItemNameById, showNotifications, }: DeleteItemsParams) => Promise<UseFilesDeleteApiResult>;
|
|
18
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Notify } from '../../../../types';
|
|
2
|
+
export interface MoveItemsParams {
|
|
3
|
+
items: Array<{
|
|
4
|
+
id: string;
|
|
5
|
+
isFolder?: boolean;
|
|
6
|
+
}>;
|
|
7
|
+
targetFolderId: string;
|
|
8
|
+
getItemNameById: (id?: string | null) => string | undefined;
|
|
9
|
+
showNotifications?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface UseFilesMoveResult {
|
|
12
|
+
successCount: number;
|
|
13
|
+
failCount: number;
|
|
14
|
+
errorDetails: Notify.OperationErrorDetail[];
|
|
15
|
+
}
|
|
16
|
+
export declare const useFilesMove: () => {
|
|
17
|
+
moveItems: ({ items, targetFolderId, getItemNameById, showNotifications }: MoveItemsParams) => Promise<{
|
|
18
|
+
successCount: number;
|
|
19
|
+
failCount: number;
|
|
20
|
+
errorDetails: Notify.OperationErrorDetail[];
|
|
21
|
+
}>;
|
|
22
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { asFileManagerApiError } from '../../../../utils/errorMessages';
|
|
2
|
+
export interface RenameItemParams {
|
|
3
|
+
itemId: string;
|
|
4
|
+
newName: string;
|
|
5
|
+
isFolder: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface RenameItemResult {
|
|
8
|
+
success: boolean;
|
|
9
|
+
renamedItem?: {
|
|
10
|
+
id: string;
|
|
11
|
+
name?: string;
|
|
12
|
+
parentId?: string | null;
|
|
13
|
+
folderId?: string | null;
|
|
14
|
+
};
|
|
15
|
+
error?: ReturnType<typeof asFileManagerApiError>;
|
|
16
|
+
}
|
|
17
|
+
export declare const useFilesRename: () => {
|
|
18
|
+
renameItem: ({ itemId, newName, isFolder }: RenameItemParams) => Promise<RenameItemResult>;
|
|
19
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Notify } from '../../../../types';
|
|
2
|
+
export declare const MAX_NAMES_PREVIEW = 5;
|
|
3
|
+
export declare const createNameHelpers: (files: {
|
|
4
|
+
id: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
}[]) => {
|
|
7
|
+
getItemNameById: (id?: string | null) => string | undefined;
|
|
8
|
+
getItemNamesByIds: (ids: string[]) => string[];
|
|
9
|
+
getNamesPreview: (names: string[]) => string | null;
|
|
10
|
+
};
|
|
11
|
+
export declare const buildOperationSuccessPayload: (ids: string[], successCount: number, totalCount: number, folderId?: string | null, itemNames?: string[]) => Notify.OperationSuccessPayload;
|
|
12
|
+
export declare const buildOperationErrorPayload: (ids: string[], failCount: number, totalCount: number, folderId?: string | null, errors?: Notify.OperationErrorDetail[], itemNames?: string[]) => Notify.OperationErrorPayload;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const useRefreshData: () => {
|
|
2
|
+
refreshFolders: ({ parentIds, selectedFolder, }: {
|
|
3
|
+
parentIds?: Array<string | null>;
|
|
4
|
+
selectedFolder?: string | null;
|
|
5
|
+
}) => Promise<void>;
|
|
6
|
+
refreshFiles: ({ fetchFiles, selectedFolder, page, limit, }: {
|
|
7
|
+
fetchFiles: (params: {
|
|
8
|
+
folderId?: string;
|
|
9
|
+
page?: number;
|
|
10
|
+
limit?: number;
|
|
11
|
+
}) => Promise<void>;
|
|
12
|
+
selectedFolder?: string | null;
|
|
13
|
+
page?: number;
|
|
14
|
+
limit?: number;
|
|
15
|
+
}) => Promise<void>;
|
|
16
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Notify } from '../../types';
|
|
2
|
+
export type NotifyArgs<Map, Event, K extends keyof Map> = Omit<Event, 'type' | 'id' | 'data'> & {
|
|
3
|
+
id: K;
|
|
4
|
+
} & (Map[K] extends never ? {} : {
|
|
5
|
+
data: Map[K];
|
|
6
|
+
});
|
|
7
|
+
export type ErrorPayload<Key extends keyof Notify.ErrorMap = keyof Notify.ErrorMap> = Omit<Notify.ErrorEvent, 'type' | 'id' | 'data'> & {
|
|
8
|
+
id: Key;
|
|
9
|
+
} & (Notify.ErrorMap[Key] extends never ? {
|
|
10
|
+
data?: never;
|
|
11
|
+
} : {
|
|
12
|
+
data: Notify.ErrorMap[Key];
|
|
13
|
+
});
|
|
14
|
+
export type SuccessPayload<Key extends keyof Notify.SuccessMap = keyof Notify.SuccessMap> = Omit<Notify.SuccessEvent, 'type' | 'id' | 'data'> & {
|
|
15
|
+
id: Key;
|
|
16
|
+
} & (Notify.SuccessMap[Key] extends never ? {
|
|
17
|
+
data?: never;
|
|
18
|
+
} : {
|
|
19
|
+
data: Notify.SuccessMap[Key];
|
|
20
|
+
});
|
|
21
|
+
export type WarningPayload<Key extends keyof Notify.WarningMap = keyof Notify.WarningMap> = Omit<Notify.WarningEvent, 'type' | 'id' | 'data'> & {
|
|
22
|
+
id: Key;
|
|
23
|
+
} & (Notify.WarningMap[Key] extends never ? {
|
|
24
|
+
data?: never;
|
|
25
|
+
} : {
|
|
26
|
+
data: Notify.WarningMap[Key];
|
|
27
|
+
});
|
|
28
|
+
export type NotifyPayload<Key extends keyof Notify.ErrorMap | keyof Notify.SuccessMap | keyof Notify.WarningMap = never> = Key extends keyof Notify.ErrorMap ? ErrorPayload<Key> & {
|
|
29
|
+
type: 'error';
|
|
30
|
+
} : Key extends keyof Notify.SuccessMap ? SuccessPayload<Key> & {
|
|
31
|
+
type: 'success';
|
|
32
|
+
} : Key extends keyof Notify.WarningMap ? WarningPayload<Key> & {
|
|
33
|
+
type: 'warning';
|
|
34
|
+
} : never;
|
|
35
|
+
export interface Notification {
|
|
36
|
+
error<Key extends keyof Notify.ErrorMap>(payload: ErrorPayload<Key>, silent?: boolean): Promise<NotifyPayload<Key>>;
|
|
37
|
+
success<Key extends keyof Notify.SuccessMap>(payload: SuccessPayload<Key>, silent?: boolean): Promise<NotifyPayload<Key>>;
|
|
38
|
+
warning<Key extends keyof Notify.WarningMap>(payload: WarningPayload<Key>, silent?: boolean): Promise<NotifyPayload<Key>>;
|
|
39
|
+
notify<Key extends keyof Notify.ErrorMap | keyof Notify.SuccessMap | keyof Notify.WarningMap>(payload: NotifyPayload<Key>, silent?: boolean): Promise<NotifyPayload<Key>>;
|
|
40
|
+
}
|
|
@@ -1,22 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Хук уведомлений
|
|
4
|
-
*/
|
|
5
|
-
export declare const useNotifications: () => {
|
|
6
|
-
error<Key extends keyof Notify.ErrorMap>(args: Omit<Notify.ErrorEvent, "type" | "id" | "data"> & {
|
|
7
|
-
id: Key;
|
|
8
|
-
} & (Notify.ErrorMap[Key] extends never ? {} : {
|
|
9
|
-
data: Notify.ErrorMap[Key];
|
|
10
|
-
})): void;
|
|
11
|
-
success<Key extends keyof Notify.SuccessMap>(args: Omit<Notify.SuccessEvent, "type" | "id" | "data"> & {
|
|
12
|
-
id: Key;
|
|
13
|
-
} & (Notify.SuccessMap[Key] extends never ? {} : {
|
|
14
|
-
data: Notify.SuccessMap[Key];
|
|
15
|
-
})): void;
|
|
16
|
-
warning<Key extends keyof Notify.WarningMap>(args: Omit<Notify.WarningEvent, "type" | "id" | "data"> & {
|
|
17
|
-
id: Key;
|
|
18
|
-
} & (Notify.WarningMap[Key] extends never ? {} : {
|
|
19
|
-
data: Notify.WarningMap[Key];
|
|
20
|
-
})): void;
|
|
21
|
-
notify: (payload: NotifyEvent, silent?: boolean) => Promise<void>;
|
|
22
|
-
};
|
|
1
|
+
export * from './notifications';
|
package/index.d.ts
CHANGED
|
@@ -19,4 +19,5 @@ export { FolderSidebar } from './components/FolderSidebar/FolderSidebar';
|
|
|
19
19
|
export { installResizeObserverErrorHandler, uninstallResizeObserverErrorHandler } from './utils/resizeObserverHandler';
|
|
20
20
|
export { type Folder, type File, type PathItem, type MenuItem, type FileManagerOptions, type FileManagerHookReturn, type FileManagerErrorCode, type IFileManagerApiError, } from './types';
|
|
21
21
|
export { FileManagerApiError } from './shared/fileManagerApiError';
|
|
22
|
+
export { mapHttpStatusToErrorCode } from './shared/mapHttpStatusToErrorCode';
|
|
22
23
|
export { type InitPixieEditorOptions, type Options as FileManagerInitOptions, type UniversalInitOptions, } from './file-manager';
|