@emailmaker/filemanager 0.10.85 → 0.10.86
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/{file-manager-IconsTab-CJ34Rtaj.js → file-manager-IconsTab-CtsLkcy2.js} +2 -2
- package/{file-manager-ImageCodeGenerator-CkdzoWfD.js → file-manager-ImageCodeGenerator-b6--9FnA.js} +2 -2
- package/{file-manager-JsBarcode-YTpHbsV3.js → file-manager-JsBarcode-Bs9SDyWX.js} +2 -2
- package/{file-manager-browser-DgSQCpyR.js → file-manager-browser-DC8fkuqa.js} +2 -2
- package/{file-manager-index-DptuziBQ.js → file-manager-index-B4pgaHpG.js} +3 -3
- package/file-manager.esm.js +1 -1
- package/file-manager.js +25 -13
- package/package.json +1 -1
package/file-manager.esm.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{D as FileContent,J as FileManagerApiError,C as FileManagerApp,x as FileManagerAppWithContext,E as FileModals,G as FolderSidebar,P as PixieOnlyApp,B as default,v as init,A as initFileManager,y as initPixieEditor,H as installResizeObserverErrorHandler,K as mapHttpStatusToErrorCode,I as uninstallResizeObserverErrorHandler,w as unmount,z as unmountPixieEditor}from"./file-manager-index-
|
|
1
|
+
export{D as FileContent,J as FileManagerApiError,C as FileManagerApp,x as FileManagerAppWithContext,E as FileModals,G as FolderSidebar,P as PixieOnlyApp,B as default,v as init,A as initFileManager,y as initPixieEditor,H as installResizeObserverErrorHandler,K as mapHttpStatusToErrorCode,I as uninstallResizeObserverErrorHandler,w as unmount,z as unmountPixieEditor}from"./file-manager-index-B4pgaHpG.js";import"react/jsx-runtime";import"react";import"react-dom/client";import"antd";import"antd/es/alert/ErrorBoundary";import"@ant-design/icons";import"react-dom";
|
|
2
2
|
//# sourceMappingURL=file-manager.esm.js.map
|
package/file-manager.js
CHANGED
|
@@ -31156,6 +31156,9 @@ function pathHistoryEqual(a, b) {
|
|
|
31156
31156
|
}
|
|
31157
31157
|
return a.every((p, i) => { var _a; return p.id === ((_a = b[i]) === null || _a === void 0 ? void 0 : _a.id); });
|
|
31158
31158
|
}
|
|
31159
|
+
/** Без page/limit хост (EmailMaker) мог запрашивать весь каталог (per_page=10000). */
|
|
31160
|
+
const DEFAULT_FILES_LIST_PAGE = 1;
|
|
31161
|
+
const DEFAULT_FILES_LIST_PAGE_SIZE = 20;
|
|
31159
31162
|
async function fetchBlobFromUrl(url) {
|
|
31160
31163
|
const response = await fetch(url, { mode: 'cors' });
|
|
31161
31164
|
if (!response.ok) {
|
|
@@ -31192,22 +31195,24 @@ const useFilesAPI = () => {
|
|
|
31192
31195
|
const { setFiles, setLoading, setIsUrlModalVisible, setActiveLibraryItem, setPagination, setSelectedFolder, setPathHistory, } = actions;
|
|
31193
31196
|
const { dataProviders } = options;
|
|
31194
31197
|
const fetchFilesFromDataProvider = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(async (params) => {
|
|
31195
|
-
var _a, _b, _c;
|
|
31198
|
+
var _a, _b, _c, _d, _e;
|
|
31196
31199
|
if (!(dataProviders === null || dataProviders === void 0 ? void 0 : dataProviders.getFiles))
|
|
31197
31200
|
return [];
|
|
31198
31201
|
const disablePagination = (_a = options === null || options === void 0 ? void 0 : options.config) === null || _a === void 0 ? void 0 : _a.disablePagination;
|
|
31202
|
+
const resolvedPage = disablePagination ? undefined : ((_b = params === null || params === void 0 ? void 0 : params.page) !== null && _b !== void 0 ? _b : DEFAULT_FILES_LIST_PAGE);
|
|
31203
|
+
const resolvedLimit = disablePagination ? undefined : ((_c = params === null || params === void 0 ? void 0 : params.limit) !== null && _c !== void 0 ? _c : DEFAULT_FILES_LIST_PAGE_SIZE);
|
|
31199
31204
|
const { files, pagination: responsePagination } = await dataProviders.getFiles({
|
|
31200
31205
|
folderId: (params === null || params === void 0 ? void 0 : params.folderId) !== 'folders' ? params === null || params === void 0 ? void 0 : params.folderId : undefined,
|
|
31201
31206
|
noFolder: params === null || params === void 0 ? void 0 : params.noFolder,
|
|
31202
|
-
search: ((
|
|
31207
|
+
search: ((_d = params === null || params === void 0 ? void 0 : params.search) === null || _d === void 0 ? void 0 : _d.trim()) || undefined,
|
|
31203
31208
|
sortBy: params === null || params === void 0 ? void 0 : params.sortBy,
|
|
31204
31209
|
sortOrder: params === null || params === void 0 ? void 0 : params.sortOrder,
|
|
31205
|
-
page:
|
|
31206
|
-
limit:
|
|
31210
|
+
page: resolvedPage,
|
|
31211
|
+
limit: resolvedLimit,
|
|
31207
31212
|
itemType: (params === null || params === void 0 ? void 0 : params.itemType) || 'all',
|
|
31208
31213
|
});
|
|
31209
31214
|
if (setPagination) {
|
|
31210
|
-
if ((
|
|
31215
|
+
if ((_e = options === null || options === void 0 ? void 0 : options.config) === null || _e === void 0 ? void 0 : _e.disablePagination) {
|
|
31211
31216
|
setPagination({ current: 1, pageSize: files.length || 1, total: files.length || 0 });
|
|
31212
31217
|
}
|
|
31213
31218
|
else if (responsePagination) {
|
|
@@ -31736,7 +31741,7 @@ const useFilesAPI = () => {
|
|
|
31736
31741
|
}
|
|
31737
31742
|
}, [dataProviders, notification, t]);
|
|
31738
31743
|
const uploadFileWithProvider = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(async (file, targetFolderId, suppressNotifications, noFolder) => {
|
|
31739
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
31744
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
31740
31745
|
const effectiveFolderId = noFolder ? '' : (targetFolderId !== null && targetFolderId !== void 0 ? targetFolderId : (selectedFolder || ''));
|
|
31741
31746
|
if (effectiveFolderId === 'Trash') {
|
|
31742
31747
|
throw new Error(t('Upload to Trash is forbidden'));
|
|
@@ -31807,10 +31812,8 @@ const useFilesAPI = () => {
|
|
|
31807
31812
|
const resultData = firstResult.data;
|
|
31808
31813
|
if (resultData.id) {
|
|
31809
31814
|
const targetFolder = ((_j = resultData.folderId) !== null && _j !== void 0 ? _j : folderId) || undefined;
|
|
31810
|
-
|
|
31811
|
-
await fetchFiles({ folderId:
|
|
31812
|
-
// Пытаемся получить актуальный файл напрямую из провайдера,
|
|
31813
|
-
// чтобы не зависеть от асинхронного обновления state.files
|
|
31815
|
+
const refreshFolderId = (_k = targetFolder !== null && targetFolder !== void 0 ? targetFolder : selectedFolder) !== null && _k !== void 0 ? _k : '';
|
|
31816
|
+
await fetchFiles({ folderId: refreshFolderId, noFolder });
|
|
31814
31817
|
let fileFromList = state.files.find(f => f.id === resultData.id);
|
|
31815
31818
|
if (!fileFromList) {
|
|
31816
31819
|
try {
|
|
@@ -31832,9 +31835,9 @@ const useFilesAPI = () => {
|
|
|
31832
31835
|
return fileFromList;
|
|
31833
31836
|
}
|
|
31834
31837
|
// Если файл не найден в списке, возвращаем частичный объект
|
|
31835
|
-
return Object.assign(Object.assign({}, resultData), { id: resultData.id, name: resultData.name || normalizedFileName, folderId: (
|
|
31838
|
+
return Object.assign(Object.assign({}, resultData), { id: resultData.id, name: resultData.name || normalizedFileName, folderId: (_m = (_l = resultData.folderId) !== null && _l !== void 0 ? _l : folderId) !== null && _m !== void 0 ? _m : null, type: fileToUpload.type || file.type, size: fileToUpload.size, extension: fileExtension || normalizedFileName.split('.').pop() || '',
|
|
31836
31839
|
// Пробрасываем базовые preview-поля, если они есть в ответе провайдера
|
|
31837
|
-
thumbnail: (
|
|
31840
|
+
thumbnail: (_o = resultData.thumbnail) !== null && _o !== void 0 ? _o : undefined, url: (_p = resultData.url) !== null && _p !== void 0 ? _p : undefined, thumbnailUrl: (_q = resultData.thumbnailUrl) !== null && _q !== void 0 ? _q : undefined, isFolder: false, selected: false });
|
|
31838
31841
|
}
|
|
31839
31842
|
}
|
|
31840
31843
|
else {
|
|
@@ -93508,6 +93511,15 @@ const FileManagerContent = () => {
|
|
|
93508
93511
|
else {
|
|
93509
93512
|
fileUpload.markAsSuccess(uploadId);
|
|
93510
93513
|
}
|
|
93514
|
+
const rawTargetFolderId = (uploaded && uploaded.folderId) || selectedFolder || null;
|
|
93515
|
+
if (handleFolderSelect) {
|
|
93516
|
+
if (!rawTargetFolderId || rawTargetFolderId === 'folders') {
|
|
93517
|
+
handleFolderSelect('folders');
|
|
93518
|
+
}
|
|
93519
|
+
else {
|
|
93520
|
+
handleFolderSelect(rawTargetFolderId);
|
|
93521
|
+
}
|
|
93522
|
+
}
|
|
93511
93523
|
await ((_a = folderSidebarRef.current) === null || _a === void 0 ? void 0 : _a.refreshFileCounts());
|
|
93512
93524
|
return uploaded;
|
|
93513
93525
|
}
|
|
@@ -93517,7 +93529,7 @@ const FileManagerContent = () => {
|
|
|
93517
93529
|
fileUpload.markAsError(uploadId, errorMessage);
|
|
93518
93530
|
throw error;
|
|
93519
93531
|
}
|
|
93520
|
-
}, [filesApi, fileUpload, selectedFolder, files]);
|
|
93532
|
+
}, [filesApi, fileUpload, selectedFolder, files, handleFolderSelect]);
|
|
93521
93533
|
const handleDroppedFilesWithRefresh = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useCallback(async (files) => {
|
|
93522
93534
|
var _a;
|
|
93523
93535
|
if (handleDroppedFiles) {
|