@emailmaker/filemanager 0.0.7 → 0.0.9

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.
@@ -13,6 +13,9 @@ export interface UseFilesModalsActions {
13
13
  showCopyModal: () => void;
14
14
  handleCopyCancel: () => void;
15
15
  handleCopyOk: () => Promise<void>;
16
+ showDeleteConfirm: () => void;
17
+ handleDeleteConfirmCancel: () => void;
18
+ handleDeleteConfirmOk: () => Promise<void>;
16
19
  }
17
20
  export declare const useFilesModals: (fetchFiles: (params?: FilesQueryParams) => Promise<void>) => {
18
21
  state: UseFilesModalsState;
@@ -26,6 +26,7 @@ export interface FileManagerState {
26
26
  isMoveModalVisible: boolean;
27
27
  isRenameFolderModalVisible: boolean;
28
28
  isCopyModalVisible: boolean;
29
+ isDeleteConfirmVisible: boolean;
29
30
  form: FormInstance;
30
31
  urlForm: FormInstance;
31
32
  renameForm: FormInstance;
@@ -54,6 +55,7 @@ export interface FileManagerActions {
54
55
  setIsMoveModalVisible: (visible: boolean) => void;
55
56
  setIsRenameFolderModalVisible: (visible: boolean) => void;
56
57
  setIsCopyModalVisible: (visible: boolean) => void;
58
+ setIsDeleteConfirmVisible: (visible: boolean) => void;
57
59
  setFileToRename: (fileId: string | null) => void;
58
60
  setActiveLibraryItem: (item: LibraryMenuKey) => void;
59
61
  setFolderToRename: (folderId: string | null) => void;
@@ -81,6 +83,9 @@ export interface FileManagerActions {
81
83
  showCopyModal: () => void;
82
84
  handleCopyCancel: () => void;
83
85
  handleCopyOk: () => Promise<void>;
86
+ showDeleteConfirm?: () => void;
87
+ handleDeleteConfirmCancel?: () => void;
88
+ handleDeleteConfirmOk?: () => Promise<void>;
84
89
  }
85
90
  export interface FileManagerContext {
86
91
  apiEndpoints: Record<string, string | undefined>;
@@ -31,6 +31,9 @@ export interface UseFilesActions {
31
31
  handleCopyCancel: () => void;
32
32
  handleCopyOk: () => Promise<void>;
33
33
  uploadFileWithProvider: (file: globalThis.File) => Promise<AppFile | void>;
34
+ showDeleteConfirm: () => void;
35
+ handleDeleteConfirmCancel: () => void;
36
+ handleDeleteConfirmOk: () => Promise<void>;
34
37
  }
35
38
  export declare const useFiles: () => FileManagerHookBase & {
36
39
  state: UseFilesState;
@@ -8,9 +8,10 @@ interface UseFileActionsProps {
8
8
  showCopyModal: () => void;
9
9
  handleDeleteFile: (fileId: string) => void;
10
10
  handleDeleteFolder: (folderId: string) => void;
11
+ showDeleteConfirm?: () => void;
11
12
  onEdit: (file?: AppFile | ThumbnailFile) => void;
12
13
  }
13
- export declare const useFileActions: ({ files, selectedFiles, toggleFileSelection, showRenameModal, showMoveModal, showCopyModal, handleDeleteFile, handleDeleteFolder, onEdit, }: UseFileActionsProps) => {
14
+ export declare const useFileActions: ({ files, selectedFiles, toggleFileSelection, showRenameModal, showMoveModal, showCopyModal, handleDeleteFile, handleDeleteFolder, showDeleteConfirm, onEdit, }: UseFileActionsProps) => {
14
15
  handleClearSelection: () => void;
15
16
  handleRename: () => void;
16
17
  handleDeleteSelected: () => void;
package/index.d.ts CHANGED
@@ -1,8 +1,15 @@
1
- import { init, unmount, FileManagerAppWithContext } from './file-manager';
2
- export { init, unmount, FileManagerAppWithContext };
1
+ import { init, unmount, FileManagerAppWithContext, initPixieEditor, unmountPixieEditor, initFileManager, PixieOnlyApp } from './file-manager';
2
+ export { init, unmount, FileManagerAppWithContext, PixieOnlyApp, initPixieEditor, unmountPixieEditor, initFileManager };
3
3
  declare const _default: {
4
4
  init: (containerOrOptions: HTMLElement | import("./file-manager").Options, config?: import("./types").Config) => void;
5
5
  unmount: (container: HTMLElement) => void;
6
+ initPixieEditor: (options: import("./file-manager").InitPixieEditorOptions) => void;
7
+ unmountPixieEditor: (container: HTMLElement) => void;
8
+ initFileManager: (options: import("./file-manager").UniversalInitOptions) => {
9
+ unmount: () => void;
10
+ unmountFileManager?: () => void;
11
+ unmountPixieEditor?: () => void;
12
+ };
6
13
  };
7
14
  export default _default;
8
15
  export { FileManagerApp } from './components/FileManagerApp/FileManagerApp';
@@ -11,3 +18,4 @@ export { FileModals } from './components/FileModals/FileModals';
11
18
  export { FolderSidebar } from './components/FolderSidebar/FolderSidebar';
12
19
  export { installResizeObserverErrorHandler, uninstallResizeObserverErrorHandler } from './utils/resizeObserverHandler';
13
20
  export { type Folder, type File, type PathItem, type MenuItem, type FileManagerOptions, type FileManagerHookReturn, } from './types';
21
+ export { type InitPixieEditorOptions, type Options as FileManagerInitOptions, type UniversalInitOptions, } from './file-manager';
package/package.json CHANGED
@@ -1,30 +1,30 @@
1
- {
2
- "name": "@emailmaker/filemanager",
3
- "version": "0.0.7",
4
- "main": "./file-manager.js",
5
- "module": "./file-manager.esm.js",
6
- "types": "./index.d.ts",
7
- "style": "./file-manager.css",
8
- "license": "MIT",
9
- "peerDependencies": {
10
- "react": "^18.2.0 || ^19.0.0",
11
- "react-dom": "^18.2.0 || ^19.0.0"
12
- },
13
- "browserslist": {
14
- "production": [
15
- "last 2 chrome version",
16
- "last 2 firefox version",
17
- "last 2 safari version"
18
- ],
19
- "development": [
20
- "last 1 chrome version",
21
- "last 1 firefox version",
22
- "last 1 safari version"
23
- ]
24
- },
25
- "msw": {
26
- "workerDirectory": [
27
- "public"
28
- ]
29
- }
30
- }
1
+ {
2
+ "name": "@emailmaker/filemanager",
3
+ "version": "0.0.9",
4
+ "main": "./file-manager.js",
5
+ "module": "./file-manager.esm.js",
6
+ "types": "./index.d.ts",
7
+ "style": "./file-manager.css",
8
+ "license": "MIT",
9
+ "peerDependencies": {
10
+ "react": "^18.2.0 || ^19.0.0",
11
+ "react-dom": "^18.2.0 || ^19.0.0"
12
+ },
13
+ "browserslist": {
14
+ "production": [
15
+ "last 2 chrome version",
16
+ "last 2 firefox version",
17
+ "last 2 safari version"
18
+ ],
19
+ "development": [
20
+ "last 1 chrome version",
21
+ "last 1 firefox version",
22
+ "last 1 safari version"
23
+ ]
24
+ },
25
+ "msw": {
26
+ "workerDirectory": [
27
+ "public"
28
+ ]
29
+ }
30
+ }
package/sample-files.json CHANGED
@@ -1,105 +1,105 @@
1
- {
2
- "files": [
3
- {
4
- "id": "sample-1",
5
- "name": "Красивый закат.jpg",
6
- "size": "2845",
7
- "date": "2024-01-15T10:30:00Z",
8
- "folderId": "",
9
- "type": "image",
10
- "url": "https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=400&h=300&fit=crop",
11
- "thumbnailUrl": "https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=150&h=100&fit=crop",
12
- "extension": "jpg",
13
- "isFolder": false,
14
- "selected": false,
15
- "dimensions": "1920x1080",
16
- "aspectRatio": "16:9"
17
- },
18
- {
19
- "id": "sample-2",
20
- "name": "Горы и озеро.jpg",
21
- "size": "3200",
22
- "date": "2024-01-10T14:20:00Z",
23
- "folderId": "nature-folder",
24
- "type": "image",
25
- "url": "https://images.unsplash.com/photo-1464822759380-8ed769e99d5c?w=400&h=300&fit=crop",
26
- "thumbnailUrl": "https://images.unsplash.com/photo-1464822759380-8ed769e99d5c?w=150&h=100&fit=crop",
27
- "extension": "jpg",
28
- "isFolder": false,
29
- "selected": false,
30
- "dimensions": "1920x1280",
31
- "aspectRatio": "3:2"
32
- },
33
- {
34
- "id": "sample-3",
35
- "name": "Отчет_2024.pdf",
36
- "size": "1250",
37
- "date": "2024-01-12T09:15:00Z",
38
- "folderId": "documents-folder",
39
- "type": "document",
40
- "url": "https://via.placeholder.com/400x300/2196F3/white?text=PDF+Document",
41
- "thumbnailUrl": "https://via.placeholder.com/150x100/2196F3/white?text=PDF",
42
- "extension": "pdf",
43
- "isFolder": false,
44
- "selected": false
45
- },
46
- {
47
- "id": "sample-4",
48
- "name": "Презентация.pptx",
49
- "size": "4500",
50
- "date": "2024-01-08T16:45:00Z",
51
- "folderId": "documents-folder",
52
- "type": "document",
53
- "url": "https://via.placeholder.com/400x300/FF9800/white?text=PowerPoint",
54
- "thumbnailUrl": "https://via.placeholder.com/150x100/FF9800/white?text=PPT",
55
- "extension": "pptx",
56
- "isFolder": false,
57
- "selected": false
58
- },
59
- {
60
- "id": "sample-5",
61
- "name": "Лес в тумане.jpg",
62
- "size": "2100",
63
- "date": "2024-01-05T11:30:00Z",
64
- "folderId": "nature-folder",
65
- "type": "image",
66
- "url": "https://images.unsplash.com/photo-1441974231531-c6227db76b6e?w=400&h=300&fit=crop",
67
- "thumbnailUrl": "https://images.unsplash.com/photo-1441974231531-c6227db76b6e?w=150&h=100&fit=crop",
68
- "extension": "jpg",
69
- "isFolder": false,
70
- "selected": false,
71
- "dimensions": "1920x1280",
72
- "aspectRatio": "3:2"
73
- },
74
- {
75
- "id": "sample-6",
76
- "name": "Архивные_данные.zip",
77
- "size": "15600",
78
- "date": "2024-01-01T08:00:00Z",
79
- "folderId": "",
80
- "type": "archive",
81
- "url": "https://via.placeholder.com/400x300/795548/white?text=ZIP+Archive",
82
- "thumbnailUrl": "https://via.placeholder.com/150x100/795548/white?text=ZIP",
83
- "extension": "zip",
84
- "isFolder": false,
85
- "selected": false
86
- }
87
- ],
88
- "folders": [
89
- {
90
- "id": "nature-folder",
91
- "name": "🌲 Природа",
92
- "parentId": null
93
- },
94
- {
95
- "id": "documents-folder",
96
- "name": "📄 Документы",
97
- "parentId": null
98
- },
99
- {
100
- "id": "photos-subfolder",
101
- "name": "📷 Фотографии",
102
- "parentId": "nature-folder"
103
- }
104
- ]
1
+ {
2
+ "files": [
3
+ {
4
+ "id": "sample-1",
5
+ "name": "Красивый закат.jpg",
6
+ "size": "2845",
7
+ "date": "2024-01-15T10:30:00Z",
8
+ "folderId": "",
9
+ "type": "image",
10
+ "url": "https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=400&h=300&fit=crop",
11
+ "thumbnailUrl": "https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=150&h=100&fit=crop",
12
+ "extension": "jpg",
13
+ "isFolder": false,
14
+ "selected": false,
15
+ "dimensions": "1920x1080",
16
+ "aspectRatio": "16:9"
17
+ },
18
+ {
19
+ "id": "sample-2",
20
+ "name": "Горы и озеро.jpg",
21
+ "size": "3200",
22
+ "date": "2024-01-10T14:20:00Z",
23
+ "folderId": "nature-folder",
24
+ "type": "image",
25
+ "url": "https://images.unsplash.com/photo-1464822759380-8ed769e99d5c?w=400&h=300&fit=crop",
26
+ "thumbnailUrl": "https://images.unsplash.com/photo-1464822759380-8ed769e99d5c?w=150&h=100&fit=crop",
27
+ "extension": "jpg",
28
+ "isFolder": false,
29
+ "selected": false,
30
+ "dimensions": "1920x1280",
31
+ "aspectRatio": "3:2"
32
+ },
33
+ {
34
+ "id": "sample-3",
35
+ "name": "Отчет_2024.pdf",
36
+ "size": "1250",
37
+ "date": "2024-01-12T09:15:00Z",
38
+ "folderId": "documents-folder",
39
+ "type": "document",
40
+ "url": "https://via.placeholder.com/400x300/2196F3/white?text=PDF+Document",
41
+ "thumbnailUrl": "https://via.placeholder.com/150x100/2196F3/white?text=PDF",
42
+ "extension": "pdf",
43
+ "isFolder": false,
44
+ "selected": false
45
+ },
46
+ {
47
+ "id": "sample-4",
48
+ "name": "Презентация.pptx",
49
+ "size": "4500",
50
+ "date": "2024-01-08T16:45:00Z",
51
+ "folderId": "documents-folder",
52
+ "type": "document",
53
+ "url": "https://via.placeholder.com/400x300/FF9800/white?text=PowerPoint",
54
+ "thumbnailUrl": "https://via.placeholder.com/150x100/FF9800/white?text=PPT",
55
+ "extension": "pptx",
56
+ "isFolder": false,
57
+ "selected": false
58
+ },
59
+ {
60
+ "id": "sample-5",
61
+ "name": "Лес в тумане.jpg",
62
+ "size": "2100",
63
+ "date": "2024-01-05T11:30:00Z",
64
+ "folderId": "nature-folder",
65
+ "type": "image",
66
+ "url": "https://images.unsplash.com/photo-1441974231531-c6227db76b6e?w=400&h=300&fit=crop",
67
+ "thumbnailUrl": "https://images.unsplash.com/photo-1441974231531-c6227db76b6e?w=150&h=100&fit=crop",
68
+ "extension": "jpg",
69
+ "isFolder": false,
70
+ "selected": false,
71
+ "dimensions": "1920x1280",
72
+ "aspectRatio": "3:2"
73
+ },
74
+ {
75
+ "id": "sample-6",
76
+ "name": "Архивные_данные.zip",
77
+ "size": "15600",
78
+ "date": "2024-01-01T08:00:00Z",
79
+ "folderId": "",
80
+ "type": "archive",
81
+ "url": "https://via.placeholder.com/400x300/795548/white?text=ZIP+Archive",
82
+ "thumbnailUrl": "https://via.placeholder.com/150x100/795548/white?text=ZIP",
83
+ "extension": "zip",
84
+ "isFolder": false,
85
+ "selected": false
86
+ }
87
+ ],
88
+ "folders": [
89
+ {
90
+ "id": "nature-folder",
91
+ "name": "🌲 Природа",
92
+ "parentId": null
93
+ },
94
+ {
95
+ "id": "documents-folder",
96
+ "name": "📄 Документы",
97
+ "parentId": null
98
+ },
99
+ {
100
+ "id": "photos-subfolder",
101
+ "name": "📷 Фотографии",
102
+ "parentId": "nature-folder"
103
+ }
104
+ ]
105
105
  }
@@ -1,108 +1,108 @@
1
- <!DOCTYPE html>
2
- <html lang="ru">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Тест загрузки Pixie</title>
7
- <style>
8
- body {
9
- font-family: Arial, sans-serif;
10
- margin: 20px;
11
- background: #f5f5f5;
12
- }
13
- .status {
14
- padding: 10px;
15
- margin: 10px 0;
16
- border-radius: 4px;
17
- }
18
- .success {
19
- background: #d4edda;
20
- color: #155724;
21
- border: 1px solid #c3e6cb;
22
- }
23
- .error {
24
- background: #f8d7da;
25
- color: #721c24;
26
- border: 1px solid #f5c6cb;
27
- }
28
- .loading {
29
- background: #fff3cd;
30
- color: #856404;
31
- border: 1px solid #ffeaa7;
32
- }
33
- #pixie-container {
34
- width: 800px;
35
- height: 600px;
36
- border: 1px solid #ccc;
37
- margin: 20px 0;
38
- background: white;
39
- }
40
- </style>
41
- </head>
42
- <body>
43
- <h1>Тест загрузки Pixie Editor</h1>
44
-
45
- <div id="status" class="status loading">Проверка загрузки...</div>
46
-
47
- <div id="details">
48
- <h3>Проверки:</h3>
49
- <ul id="checks">
50
- <li id="script-check">Загрузка скрипта Pixie...</li>
51
- <li id="pixie-check">Проверка объекта Pixie...</li>
52
- <li id="assets-check">Проверка ассетов...</li>
53
- </ul>
54
- </div>
55
-
56
- <div id="pixie-container"></div>
57
-
58
- <script src="/loacal_module/pixie/dist/pixie.umd.js"></script>
59
- <script>
60
- function updateCheck(id, text, success = true) {
61
- const element = document.getElementById(id);
62
- element.textContent = text;
63
- element.style.color = success ? 'green' : 'red';
64
- element.style.fontWeight = success ? 'bold' : 'normal';
65
- }
66
-
67
- function updateStatus(text, type = 'loading') {
68
- const status = document.getElementById('status');
69
- status.textContent = text;
70
- status.className = `status ${type}`;
71
- }
72
-
73
- // Проверка загрузки скрипта
74
- updateCheck('script-check', '✓ Скрипт Pixie успешно загружен', true);
75
-
76
- // Проверка объекта Pixie
77
- setTimeout(() => {
78
- if (typeof window.Pixie !== 'undefined') {
79
- updateCheck('pixie-check', '✓ Объект Pixie доступен', true);
80
-
81
- // Попытка инициализации
82
- try {
83
- const pixie = new window.Pixie({
84
- selector: '#pixie-container',
85
- baseUrl: '/loacal_module/pixie/assets',
86
- ui: {
87
- visible: true,
88
- mode: 'inline'
89
- }
90
- });
91
-
92
- updateCheck('assets-check', '✓ Ассеты успешно загружены', true);
93
- updateStatus('✓ Pixie Editor успешно инициализирован!', 'success');
94
-
95
- } catch (error) {
96
- updateCheck('assets-check', `✗ Ошибка инициализации: ${error.message}`, false);
97
- updateStatus('✗ Ошибка инициализации Pixie', 'error');
98
- console.error('Ошибка Pixie:', error);
99
- }
100
- } else {
101
- updateCheck('pixie-check', '✗ Объект Pixie не найден', false);
102
- updateStatus('✗ Pixie не загружен', 'error');
103
- }
104
- }, 1000);
105
-
106
- </script>
107
- </body>
1
+ <!DOCTYPE html>
2
+ <html lang="ru">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Тест загрузки Pixie</title>
7
+ <style>
8
+ body {
9
+ font-family: Arial, sans-serif;
10
+ margin: 20px;
11
+ background: #f5f5f5;
12
+ }
13
+ .status {
14
+ padding: 10px;
15
+ margin: 10px 0;
16
+ border-radius: 4px;
17
+ }
18
+ .success {
19
+ background: #d4edda;
20
+ color: #155724;
21
+ border: 1px solid #c3e6cb;
22
+ }
23
+ .error {
24
+ background: #f8d7da;
25
+ color: #721c24;
26
+ border: 1px solid #f5c6cb;
27
+ }
28
+ .loading {
29
+ background: #fff3cd;
30
+ color: #856404;
31
+ border: 1px solid #ffeaa7;
32
+ }
33
+ #pixie-container {
34
+ width: 800px;
35
+ height: 600px;
36
+ border: 1px solid #ccc;
37
+ margin: 20px 0;
38
+ background: white;
39
+ }
40
+ </style>
41
+ </head>
42
+ <body>
43
+ <h1>Тест загрузки Pixie Editor</h1>
44
+
45
+ <div id="status" class="status loading">Проверка загрузки...</div>
46
+
47
+ <div id="details">
48
+ <h3>Проверки:</h3>
49
+ <ul id="checks">
50
+ <li id="script-check">Загрузка скрипта Pixie...</li>
51
+ <li id="pixie-check">Проверка объекта Pixie...</li>
52
+ <li id="assets-check">Проверка ассетов...</li>
53
+ </ul>
54
+ </div>
55
+
56
+ <div id="pixie-container"></div>
57
+
58
+ <script src="/loacal_module/pixie/dist/pixie.umd.js"></script>
59
+ <script>
60
+ function updateCheck(id, text, success = true) {
61
+ const element = document.getElementById(id);
62
+ element.textContent = text;
63
+ element.style.color = success ? 'green' : 'red';
64
+ element.style.fontWeight = success ? 'bold' : 'normal';
65
+ }
66
+
67
+ function updateStatus(text, type = 'loading') {
68
+ const status = document.getElementById('status');
69
+ status.textContent = text;
70
+ status.className = `status ${type}`;
71
+ }
72
+
73
+ // Проверка загрузки скрипта
74
+ updateCheck('script-check', '✓ Скрипт Pixie успешно загружен', true);
75
+
76
+ // Проверка объекта Pixie
77
+ setTimeout(() => {
78
+ if (typeof window.Pixie !== 'undefined') {
79
+ updateCheck('pixie-check', '✓ Объект Pixie доступен', true);
80
+
81
+ // Попытка инициализации
82
+ try {
83
+ const pixie = new window.Pixie({
84
+ selector: '#pixie-container',
85
+ baseUrl: '/loacal_module/pixie/assets',
86
+ ui: {
87
+ visible: true,
88
+ mode: 'inline'
89
+ }
90
+ });
91
+
92
+ updateCheck('assets-check', '✓ Ассеты успешно загружены', true);
93
+ updateStatus('✓ Pixie Editor успешно инициализирован!', 'success');
94
+
95
+ } catch (error) {
96
+ updateCheck('assets-check', `✗ Ошибка инициализации: ${error.message}`, false);
97
+ updateStatus('✗ Ошибка инициализации Pixie', 'error');
98
+ console.error('Ошибка Pixie:', error);
99
+ }
100
+ } else {
101
+ updateCheck('pixie-check', '✗ Объект Pixie не найден', false);
102
+ updateStatus('✗ Pixie не загружен', 'error');
103
+ }
104
+ }, 1000);
105
+
106
+ </script>
107
+ </body>
108
108
  </html>
package/types.d.ts CHANGED
@@ -119,7 +119,6 @@ export interface FileManagerOptions {
119
119
  onChangeSelection?: (files: File[]) => void;
120
120
  onEditorOk?: (file: File) => void;
121
121
  config?: Config;
122
- publicPath?: string;
123
122
  customIcons?: CustomIcons;
124
123
  dragDropIcon?: string;
125
124
  notification?: Partial<Omit<NotificationInstance, 'destroy'>>;
@@ -393,7 +392,6 @@ export type MessageType = {
393
392
  [key: string]: unknown;
394
393
  };
395
394
  export interface FileManagerProps {
396
- publicPath?: string;
397
395
  config?: Config;
398
396
  currentPath?: string;
399
397
  onPathChange?: (path: string[]) => void;