@emailmaker/filemanager 0.10.66 → 0.10.68
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/FileContent/FileContent.d.ts +7 -19
- package/components/FileContent/FileContentHeader.d.ts +34 -0
- package/components/FileContent/FileSelectionCheckbox.d.ts +14 -0
- package/components/FileContent/SelectableTableRow.d.ts +12 -0
- package/components/FileContent/presentation/FileGridItem.d.ts +33 -0
- package/components/FileContent/presentation/FileItemActionsDropdown.d.ts +24 -0
- package/components/FileContent/presentation/FileItemDate.d.ts +11 -0
- package/components/FileContent/presentation/FileItemName.d.ts +13 -0
- package/components/FileContent/presentation/FileItemPreview.d.ts +22 -0
- package/components/FileContent/presentation/types.d.ts +1 -0
- package/components/FileContent/renderers/FileGridView.d.ts +36 -0
- package/components/FileContent/renderers/FileTableView.d.ts +26 -0
- package/file-manager.css +11 -2
- 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/index.d.ts +1 -0
- package/hooks/core/files/useFileSelectionStore.d.ts +32 -0
- package/hooks/core/types.d.ts +0 -3
- package/hooks/useFileActions.d.ts +2 -9
- package/hooks/usePixieEditor.d.ts +1 -2
- package/my-files.json +1 -0
- package/package.json +1 -1
- package/presentation/file-list/FileListAdapter.d.ts +10 -0
- package/presentation/file-list/types.d.ts +20 -0
- package/presentation/file-list/useFileListEngine.d.ts +26 -0
- package/presentation/list-core/ListItemAdapter.d.ts +9 -0
- package/presentation/list-core/RowModelCache.d.ts +13 -0
- package/presentation/list-core/ViewportController.d.ts +10 -0
- package/presentation/list-core/types.d.ts +31 -0
- package/presentation/list-core/useListPresentationEngine.d.ts +20 -0
- package/presentation/list-core/useViewportRenderController.d.ts +24 -0
- package/presentation/list-core/viewportMetrics.d.ts +3 -0
- package/types.d.ts +9 -0
- package/utils/imageCompression.d.ts +4 -2
- package/utils/jsonDataProvider.d.ts +1 -0
package/package.json
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TFunction } from 'i18next';
|
|
2
|
+
import type { File as AppFile } from '../../types';
|
|
3
|
+
import type { ListItemAdapter } from '../list-core/ListItemAdapter';
|
|
4
|
+
import type { FileListRowModel } from './types';
|
|
5
|
+
export interface FileListContext {
|
|
6
|
+
folderFileCounts: Record<string, number>;
|
|
7
|
+
features: Record<string, boolean | undefined>;
|
|
8
|
+
t: TFunction;
|
|
9
|
+
}
|
|
10
|
+
export declare const fileListAdapter: ListItemAdapter<AppFile, FileListContext, FileListRowModel>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { File as AppFile } from '../../types';
|
|
2
|
+
import type { ListRowModelBase } from '../list-core/types';
|
|
3
|
+
export interface FileListRowModel extends ListRowModelBase<AppFile> {
|
|
4
|
+
file: AppFile;
|
|
5
|
+
isFolder: boolean;
|
|
6
|
+
nameText: string;
|
|
7
|
+
folderItemsText: string;
|
|
8
|
+
dimensionsText: string;
|
|
9
|
+
sizeText: string;
|
|
10
|
+
typeText: string;
|
|
11
|
+
dateText: string;
|
|
12
|
+
gridInfoText: string;
|
|
13
|
+
thumbnailSrc?: string;
|
|
14
|
+
previewSrc?: string;
|
|
15
|
+
canEdit: boolean;
|
|
16
|
+
canMove: boolean;
|
|
17
|
+
canCopy: boolean;
|
|
18
|
+
canRename: boolean;
|
|
19
|
+
canDelete: boolean;
|
|
20
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { TFunction } from 'i18next';
|
|
2
|
+
import type { File as AppFile } from '../../types';
|
|
3
|
+
import type { RenderWindow, ViewportMetrics } from '../list-core/types';
|
|
4
|
+
import type { FileListRowModel } from './types';
|
|
5
|
+
interface UseFileListEngineParams {
|
|
6
|
+
files: AppFile[];
|
|
7
|
+
folderFileCounts: Record<string, number>;
|
|
8
|
+
features: Record<string, boolean | undefined>;
|
|
9
|
+
t: TFunction;
|
|
10
|
+
viewMode: 'table' | 'grid';
|
|
11
|
+
}
|
|
12
|
+
interface UseFileListEngineResult {
|
|
13
|
+
rowModels: FileListRowModel[];
|
|
14
|
+
renderRows: FileListRowModel[];
|
|
15
|
+
renderWindow: RenderWindow<FileListRowModel>;
|
|
16
|
+
hasAnyValidDate: boolean;
|
|
17
|
+
handleViewportChange: (metrics: ViewportMetrics) => void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* File-specific adapter поверх generic list-core.
|
|
21
|
+
*
|
|
22
|
+
* Здесь файловый менеджер только передаёт сырые данные и контекст derive-логики,
|
|
23
|
+
* а само ядро уже отвечает за reuse row-model и подготовку render-window.
|
|
24
|
+
*/
|
|
25
|
+
export declare function useFileListEngine({ files, folderFileCounts, features, t, viewMode, }: UseFileListEngineParams): UseFileListEngineResult;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ListRowModelBase } from './types';
|
|
2
|
+
export interface ListItemAdapter<TItem, TContext, TRowModel extends ListRowModelBase<TItem>> {
|
|
3
|
+
getId: (item: TItem) => string;
|
|
4
|
+
buildSignature: (item: TItem, context: TContext) => string;
|
|
5
|
+
buildRowModel: (item: TItem, context: TContext, meta: {
|
|
6
|
+
id: string;
|
|
7
|
+
signature: string;
|
|
8
|
+
}) => TRowModel;
|
|
9
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ListItemAdapter } from './ListItemAdapter';
|
|
2
|
+
import type { ListRowModelBase } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Кэш row-model по `id`.
|
|
5
|
+
*
|
|
6
|
+
* Если сигнатура строки не изменилась, возвращаем тот же объект row-model.
|
|
7
|
+
* Это ключевой механизм для поверхностного rerender таблицы:
|
|
8
|
+
* `shouldCellUpdate(record !== prevRecord)` начинает реально работать.
|
|
9
|
+
*/
|
|
10
|
+
export declare class RowModelCache<TItem, TContext, TRowModel extends ListRowModelBase<TItem>> {
|
|
11
|
+
private rowsById;
|
|
12
|
+
reconcile(items: TItem[], adapter: ListItemAdapter<TItem, TContext, TRowModel>, context: TContext): TRowModel[];
|
|
13
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ListEngineOptions, ListRowModelBase, RenderWindow } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Контроллер render-window.
|
|
4
|
+
*
|
|
5
|
+
* Сейчас по умолчанию работает в режиме `full`, но интерфейс сразу готов
|
|
6
|
+
* под будущий windowed/lazy render без переписывания row-model ядра.
|
|
7
|
+
*/
|
|
8
|
+
export declare class ViewportController<TRowModel extends ListRowModelBase> {
|
|
9
|
+
createRenderWindow(rows: TRowModel[], options?: ListEngineOptions): RenderWindow<TRowModel>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export type RenderStrategy = 'full' | 'windowed';
|
|
2
|
+
export interface ListRowModelBase<TItem = unknown> {
|
|
3
|
+
id: string;
|
|
4
|
+
signature: string;
|
|
5
|
+
item: TItem;
|
|
6
|
+
}
|
|
7
|
+
export interface WindowedRenderConfig {
|
|
8
|
+
startIndex?: number;
|
|
9
|
+
endIndex?: number;
|
|
10
|
+
overscan?: number;
|
|
11
|
+
estimatedItemSize?: number;
|
|
12
|
+
itemsPerLane?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface ListEngineOptions {
|
|
15
|
+
renderStrategy?: RenderStrategy;
|
|
16
|
+
windowed?: WindowedRenderConfig;
|
|
17
|
+
}
|
|
18
|
+
export interface ViewportMetrics {
|
|
19
|
+
scrollTop: number;
|
|
20
|
+
viewportHeight: number;
|
|
21
|
+
viewportWidth: number;
|
|
22
|
+
scrollHeight: number;
|
|
23
|
+
}
|
|
24
|
+
export interface RenderWindow<TRowModel> {
|
|
25
|
+
rows: TRowModel[];
|
|
26
|
+
startIndex: number;
|
|
27
|
+
endIndex: number;
|
|
28
|
+
topOffset: number;
|
|
29
|
+
bottomOffset: number;
|
|
30
|
+
totalCount: number;
|
|
31
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ListItemAdapter } from './ListItemAdapter';
|
|
2
|
+
import type { ListEngineOptions, ListRowModelBase, RenderWindow } from './types';
|
|
3
|
+
interface UseListPresentationEngineParams<TItem, TContext, TRowModel extends ListRowModelBase<TItem>> {
|
|
4
|
+
items: TItem[];
|
|
5
|
+
context: TContext;
|
|
6
|
+
adapter: ListItemAdapter<TItem, TContext, TRowModel>;
|
|
7
|
+
options?: ListEngineOptions;
|
|
8
|
+
}
|
|
9
|
+
interface ListPresentationEngineResult<TRowModel> {
|
|
10
|
+
rowModels: TRowModel[];
|
|
11
|
+
renderWindow: RenderWindow<TRowModel>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Generic headless engine:
|
|
15
|
+
* - строит стабильные row-model через cache по `id`;
|
|
16
|
+
* - отдельно считает render-window;
|
|
17
|
+
* - не знает ничего про файлы, таблицу или плитку.
|
|
18
|
+
*/
|
|
19
|
+
export declare function useListPresentationEngine<TItem, TContext, TRowModel extends ListRowModelBase<TItem>>({ items, context, adapter, options, }: UseListPresentationEngineParams<TItem, TContext, TRowModel>): ListPresentationEngineResult<TRowModel>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ListEngineOptions, ViewportMetrics } from './types';
|
|
2
|
+
export interface ViewportRenderPlan {
|
|
3
|
+
enabled: boolean;
|
|
4
|
+
estimatedItemSize: number;
|
|
5
|
+
overscan: number;
|
|
6
|
+
itemsPerLane: number;
|
|
7
|
+
fallbackViewportHeight?: number;
|
|
8
|
+
}
|
|
9
|
+
interface UseViewportRenderControllerParams {
|
|
10
|
+
totalCount: number;
|
|
11
|
+
plan: ViewportRenderPlan;
|
|
12
|
+
}
|
|
13
|
+
interface ViewportRenderControllerResult {
|
|
14
|
+
engineOptions: ListEngineOptions;
|
|
15
|
+
handleViewportChange: (metrics: ViewportMetrics) => void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Generic viewport virtualization controller.
|
|
19
|
+
*
|
|
20
|
+
* Возвращает готовые `ListEngineOptions` для `ViewportController`, а renderer
|
|
21
|
+
* снаружи только сообщает текущие scroll metrics контейнера.
|
|
22
|
+
*/
|
|
23
|
+
export declare function useViewportRenderController({ totalCount, plan, }: UseViewportRenderControllerParams): ViewportRenderControllerResult;
|
|
24
|
+
export {};
|
package/types.d.ts
CHANGED
|
@@ -57,6 +57,7 @@ export interface PaginationState {
|
|
|
57
57
|
}
|
|
58
58
|
export interface FilesQueryParams {
|
|
59
59
|
folderId?: string;
|
|
60
|
+
noFolder?: boolean;
|
|
60
61
|
search?: string;
|
|
61
62
|
page?: number;
|
|
62
63
|
limit?: number;
|
|
@@ -222,6 +223,7 @@ export interface FileManagerDataProviders {
|
|
|
222
223
|
getChildrenCount?: (folderId?: string) => Promise<number>;
|
|
223
224
|
getFiles: (options: {
|
|
224
225
|
folderId?: string;
|
|
226
|
+
noFolder?: boolean;
|
|
225
227
|
search?: string;
|
|
226
228
|
sortBy?: SortState['sortBy'];
|
|
227
229
|
sortOrder?: SortState['sortOrder'];
|
|
@@ -384,6 +386,12 @@ export interface Config {
|
|
|
384
386
|
enableUpdateFile?: boolean;
|
|
385
387
|
/** Разрешить выбор директорий в диалоге загрузки (webkitdirectory) */
|
|
386
388
|
enableDirectoryUpload?: boolean;
|
|
389
|
+
/** Включить вкладку GIF */
|
|
390
|
+
enableGif?: boolean;
|
|
391
|
+
/** Включить вкладку stock images */
|
|
392
|
+
enableStockImages?: boolean;
|
|
393
|
+
/** Включить вкладку icon stock */
|
|
394
|
+
enableIconStock?: boolean;
|
|
387
395
|
/** Включить кнопку/пункт редактирования файла */
|
|
388
396
|
enableEdit?: boolean;
|
|
389
397
|
/** Включить перемещение */
|
|
@@ -658,4 +666,5 @@ export interface SafeImageProps {
|
|
|
658
666
|
height?: number;
|
|
659
667
|
preview?: boolean;
|
|
660
668
|
file?: File;
|
|
669
|
+
getFileData?: (fileId: string, silent?: boolean) => Promise<Blob | undefined>;
|
|
661
670
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface PrepareImageForUploadOptions {
|
|
2
2
|
maxSizeMB?: number;
|
|
3
3
|
maxWidthOrHeight?: number;
|
|
4
4
|
mimeType?: string;
|
|
5
5
|
fileName?: string;
|
|
6
6
|
libURL?: string;
|
|
7
|
+
enableCompression?: boolean;
|
|
7
8
|
}
|
|
8
|
-
export declare function
|
|
9
|
+
export declare function prepareImageForUpload(file: File, options?: PrepareImageForUploadOptions): Promise<File>;
|
|
10
|
+
export declare const compressImageWithLimits: typeof prepareImageForUpload;
|
|
@@ -19,6 +19,7 @@ export declare class JSONDataProvider implements FileManagerDataProviders {
|
|
|
19
19
|
}) => Promise<Folder[]>;
|
|
20
20
|
getFiles: (options?: {
|
|
21
21
|
folderId?: string;
|
|
22
|
+
noFolder?: boolean;
|
|
22
23
|
search?: string;
|
|
23
24
|
sortBy?: "name" | "size" | "date" | "type";
|
|
24
25
|
sortOrder?: "asc" | "desc";
|