@spacecorexdev/core 0.1.0 → 0.2.0
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/dist/api/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/types/index.js +1 -1
- package/dist/ui/index.js +1 -1
- package/dist/utils/index.js +1 -1
- package/package.json +2 -2
- package/types/api/project.d.ts +1 -0
- package/types/types/project/base.d.ts +3 -0
- package/types/hooks.d.ts +0 -5
- package/types/types/projectRole.d.ts +0 -17
- package/types/types/user/index.d.ts +0 -1
- package/types/types/user/role.d.ts +0 -7
- package/types/ui/FileManager/FileContextMenu.d.ts +0 -50
- package/types/ui/FileManager/FileGridView.d.ts +0 -51
- package/types/ui/FileManager/FileTableView.d.ts +0 -49
- package/types/ui/FileManager/FileToolbar.d.ts +0 -16
- package/types/ui/FileManager/FileVersionHistoryModal.d.ts +0 -9
- package/types/ui/FileManager/MoveCopyToProjectModal.d.ts +0 -17
- package/types/ui/FileManager/ShareToWechatModal.d.ts +0 -10
- package/types/ui/FileManager/hooks/useFileManagerActions.d.ts +0 -143
- package/types/ui/FileManager/hooks/useFileManagerState.d.ts +0 -146
- package/types/ui/FileManager/index.d.ts +0 -16
- package/types/ui/FileManager/projectFileManagerApi.d.ts +0 -6
- package/types/ui/FileManager/types.d.ts +0 -174
- package/types/ui/FileManager/utils/fileDeltaWorker.d.ts +0 -14
- package/types/ui/FileManager/utils/fileTree.d.ts +0 -7
- package/types/ui/FileManager/utils/fileUpload.d.ts +0 -60
- package/types/ui/FileManager/utils/fileUtils.d.ts +0 -10
- package/types/ui/InvoiceRecordsList/index.d.ts +0 -43
- package/types/ui/MyFileSelectorModal.d.ts +0 -16
- package/types/ui/UIFilePreview/ExcelEditor/index.d.ts +0 -20
- package/types/ui/UIFilePreview/ExcelEditor/types.d.ts +0 -29
- package/types/ui/UIFilePreview/ExportDropdown.d.ts +0 -26
- package/types/ui/UIFilePreview/IndexedDBUtils.d.ts +0 -109
- package/types/ui/UIFilePreview/MarkdownEditor/exportMarkdownPdf.d.ts +0 -27
- package/types/ui/UIFilePreview/MarkdownEditor/index.d.ts +0 -34
- package/types/ui/UIFilePreview/MarkdownEditor/types.d.ts +0 -14
- package/types/ui/UIFilePreview/PPTXEditor/index.d.ts +0 -19
- package/types/ui/UIFilePreview/RichDocEditor/exportRDocMarkdown.d.ts +0 -23
- package/types/ui/UIFilePreview/RichDocEditor/exportRDocPdf.d.ts +0 -22
- package/types/ui/UIFilePreview/RichDocEditor/index.d.ts +0 -26
- package/types/ui/UIFilePreview/UIFilePreview.d.ts +0 -34
- package/types/ui/UIFilePreview/WordEditor/index.d.ts +0 -20
- package/types/ui/UIFilePreview/WordEditor/style.d.ts +0 -75
- package/types/ui/UIFilePreview/filetypes/archive.d.ts +0 -6
- package/types/ui/UIFilePreview/filetypes/cad.d.ts +0 -5
- package/types/ui/UIFilePreview/filetypes/excel.d.ts +0 -6
- package/types/ui/UIFilePreview/filetypes/image.d.ts +0 -6
- package/types/ui/UIFilePreview/filetypes/imageLoader.d.ts +0 -7
- package/types/ui/UIFilePreview/filetypes/pdf.d.ts +0 -7
- package/types/ui/UIFilePreview/filetypes/ppt.d.ts +0 -5
- package/types/ui/UIFilePreview/filetypes/pptExportPdf.d.ts +0 -28
- package/types/ui/UIFilePreview/filetypes/video.d.ts +0 -6
- package/types/ui/UIFilePreview/filetypes/word.d.ts +0 -5
- package/types/ui/UIFilePreview/filetypes/wordExportMarkdown.d.ts +0 -19
- package/types/ui/UIFilePreview/filetypes/wordExportPdf.d.ts +0 -32
- package/types/ui/UIFilePreview/index.d.ts +0 -46
- package/types/ui/UIFilePreview/pdfPagination.d.ts +0 -25
- package/types/ui/UIFilePreview/previewUtils.d.ts +0 -62
- package/types/ui.d.ts +0 -5
- package/types/utils/CacheFileContent.d.ts +0 -31
- package/types/utils/mammothApi.d.ts +0 -14
- package/types/utils.d.ts +0 -5
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* UIFilePreview 使用示例
|
|
3
|
-
*
|
|
4
|
-
* @example 获取文件预览类型
|
|
5
|
-
* const previewType = getFilePreviewType('document.pdf'); // 'pdf'
|
|
6
|
-
*
|
|
7
|
-
* @example 获取文件完整URL
|
|
8
|
-
* const fileUrl = getFileUrl('/files/document.pdf'); // 'https://example.com/files/document.pdf'
|
|
9
|
-
*
|
|
10
|
-
* @example 获取文件图标
|
|
11
|
-
* const icon = getFileIcon({ fileName: 'report.pdf', fileType: 'application/pdf', size: 24 });
|
|
12
|
-
*
|
|
13
|
-
* @example 下载文件
|
|
14
|
-
* await downloadFile('/files/report.pdf');
|
|
15
|
-
*
|
|
16
|
-
* @example 获取文件Buffer(带进度回调)
|
|
17
|
-
* const abortController = new AbortController();
|
|
18
|
-
* const result = await fetchFileBuffer('/files/report.pdf', abortController, (percent) => {
|
|
19
|
-
* console.log(`下载进度: ${percent}%`);
|
|
20
|
-
* });
|
|
21
|
-
* const { buffer, headers, status } = result;
|
|
22
|
-
*/
|
|
23
|
-
import { UIFilePreview } from './UIFilePreview';
|
|
24
|
-
export { UIFilePreview };
|
|
25
|
-
export declare const uiFilePreview: {
|
|
26
|
-
downloadFile: (fileResourcePath: string, fileName?: string, fileId?: string, expectedCrc32?: number) => Promise<void>;
|
|
27
|
-
fetchFileBuffer: (fileResourcePath: string, accessToken: string | undefined, abortController: import("febs-browser/types/fetch").AbortControllerClass | null, onProgress?: (percent: number) => void, fileId?: string, expectedCrc32?: number, detailFetcher?: import("./previewUtils").FileDetailFetcher) => Promise<{
|
|
28
|
-
buffer: any;
|
|
29
|
-
headers: any;
|
|
30
|
-
status: any;
|
|
31
|
-
fromCache: boolean;
|
|
32
|
-
}>;
|
|
33
|
-
getFileIcon: ({ fileName, fileType, isExpanded, isSecure, isVirtualContractFolder, isContractSubfolder, isContractTagFolder, contractSigned, size }: {
|
|
34
|
-
fileName: string;
|
|
35
|
-
fileType: string | "folder";
|
|
36
|
-
isExpanded?: boolean;
|
|
37
|
-
isSecure?: boolean;
|
|
38
|
-
isVirtualContractFolder?: boolean;
|
|
39
|
-
isContractSubfolder?: boolean;
|
|
40
|
-
isContractTagFolder?: boolean;
|
|
41
|
-
contractSigned?: boolean;
|
|
42
|
-
size?: number;
|
|
43
|
-
}) => import("react").JSX.Element;
|
|
44
|
-
getFileUrl: (fileResourcePath: string) => string;
|
|
45
|
-
getFilePreviewType: (fileName: string) => "video" | "image" | "unknown" | "pdf" | "word" | "ppt" | "excel" | "markdown" | "richdoc" | "archive" | "cad";
|
|
46
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PDF 导出的分页计算(Markdown 导出与块文档导出共用)。
|
|
3
|
-
*
|
|
4
|
-
* 分页优先落在内容块边界上;当单个块放不下时退到"行级"边界(文本行、表格行、图片等),
|
|
5
|
-
* 保证不会把一行文字从中间切开——这是 html2canvas 按 y 坐标硬切最容易出现的问题。
|
|
6
|
-
*/
|
|
7
|
-
export interface PdfBlockBound {
|
|
8
|
-
/** 块在容器内的纵向起点 */
|
|
9
|
-
top: number;
|
|
10
|
-
/** 块在容器内的纵向终点 */
|
|
11
|
-
bottom: number;
|
|
12
|
-
/** 块内部可用的切分位置(相对容器),按升序排列 */
|
|
13
|
-
lineTops: number[];
|
|
14
|
-
}
|
|
15
|
-
export interface PdfPageSlice {
|
|
16
|
-
y: number;
|
|
17
|
-
height: number;
|
|
18
|
-
}
|
|
19
|
-
/** 计算各内容块在容器内的纵向区间与可切分位置 */
|
|
20
|
-
export declare const measureBlocks: (root: HTMLElement, blocks: Element[]) => PdfBlockBound[];
|
|
21
|
-
/**
|
|
22
|
-
* 按块/行边界把内容划分为若干页。
|
|
23
|
-
* 返回的每一段都是 [y, y + height],互不重叠,且不会切断文本行。
|
|
24
|
-
*/
|
|
25
|
-
export declare const buildPageSlices: (bounds: PdfBlockBound[], pageHeight: number) => PdfPageSlice[];
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { AbortControllerClass } from "febs-browser/types/fetch";
|
|
2
|
-
export declare const ARCHIVE_FILE_EXTENSIONS: readonly ["zip", "zipx", "7z", "rar", "tar", "gz", "gzip", "tgz", "bz2", "bzip2", "tbz", "tbz2", "xz", "txz", "lzma", "zst", "tzst", "cab", "ar", "cpio", "iso", "xar", "lha", "lzh", "jar", "war", "ear", "apk", "cbz", "cbr"];
|
|
3
|
-
export declare const CAD_FILE_EXTENSIONS: readonly ["dwg", "dxf", "dwf", "dwfx", "xps", "oxps"];
|
|
4
|
-
export declare const getFileExtension: (fileName: string) => string;
|
|
5
|
-
export declare const getFileUrl: (fileResourcePath: string) => string;
|
|
6
|
-
export declare const getFilePreviewType: (fileName: string) => "video" | "image" | "unknown" | "pdf" | "word" | "ppt" | "excel" | "markdown" | "richdoc" | "archive" | "cad";
|
|
7
|
-
/**
|
|
8
|
-
* 获取文件图标
|
|
9
|
-
* 根据文件类型和扩展名返回对应的图标组件
|
|
10
|
-
* @param record - 文件记录对象
|
|
11
|
-
* @param size - 图标大小,默认22px
|
|
12
|
-
* @returns 图标组件
|
|
13
|
-
*/
|
|
14
|
-
export declare const getFileIcon: ({ fileName, fileType, isExpanded, isSecure, isVirtualContractFolder, isContractSubfolder, isContractTagFolder, contractSigned, size }: {
|
|
15
|
-
fileName: string;
|
|
16
|
-
fileType: string | "folder";
|
|
17
|
-
isExpanded?: boolean;
|
|
18
|
-
isSecure?: boolean;
|
|
19
|
-
isVirtualContractFolder?: boolean;
|
|
20
|
-
isContractSubfolder?: boolean;
|
|
21
|
-
isContractTagFolder?: boolean;
|
|
22
|
-
contractSigned?: boolean;
|
|
23
|
-
size?: number;
|
|
24
|
-
}) => import("react").JSX.Element;
|
|
25
|
-
/**
|
|
26
|
-
* 下载 Blob 到本地文件
|
|
27
|
-
*/
|
|
28
|
-
export declare const downloadBlob: (blob: Blob, fileName: string) => void;
|
|
29
|
-
/**
|
|
30
|
-
* 下载文件
|
|
31
|
-
* 优先从本地缓存获取,若无缓存则从网络下载
|
|
32
|
-
* @param fileResourcePath 文件资源路径
|
|
33
|
-
* @param fileName 下载文件名(可选)
|
|
34
|
-
* @param fileId 文件ID(可选,用于缓存查找)
|
|
35
|
-
* @param expectedCrc32 期望的CRC32校验值(可选)
|
|
36
|
-
* @returns 下载完成后的文件路径
|
|
37
|
-
*/
|
|
38
|
-
export declare const downloadFile: (fileResourcePath: string, fileName?: string, fileId?: string, expectedCrc32?: number) => Promise<void>;
|
|
39
|
-
/**
|
|
40
|
-
* 文件详情查询函数(用于按业务场景切换详情接口,如项目文件 / CRM 客户文件)
|
|
41
|
-
*/
|
|
42
|
-
export type FileDetailFetcher = (fileId: string) => Promise<{
|
|
43
|
-
code: number;
|
|
44
|
-
data?: {
|
|
45
|
-
crc32?: number;
|
|
46
|
-
projectId?: string;
|
|
47
|
-
} | null;
|
|
48
|
-
}>;
|
|
49
|
-
/**
|
|
50
|
-
* @desc 文件预览组件,支持图片、PDF、Office文档等常见格式的预览。根据文件类型自动选择合适的预览方式,提供加载状态和错误提示。
|
|
51
|
-
* @example
|
|
52
|
-
* <UIFilePreview
|
|
53
|
-
* fileUrl={previewUrl}
|
|
54
|
-
* visible={previewVisible}
|
|
55
|
-
* onClose={() => setPreviewVisible(false)} />
|
|
56
|
-
*/
|
|
57
|
-
export declare const fetchFileBuffer: (fileResourcePath: string, accessToken: string | undefined, abortController: AbortControllerClass | null, onProgress?: (percent: number) => void, fileId?: string, expectedCrc32?: number, detailFetcher?: FileDetailFetcher) => Promise<{
|
|
58
|
-
buffer: any;
|
|
59
|
-
headers: any;
|
|
60
|
-
status: any;
|
|
61
|
-
fromCache: boolean;
|
|
62
|
-
}>;
|
package/types/ui.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export declare const CacheFileContent: {
|
|
2
|
-
saveToCache: (fileId: string, content: Blob, crc32?: number, fileSize?: number, contentType?: string) => Promise<void>;
|
|
3
|
-
removeFromCache: (fileId: string) => Promise<void>;
|
|
4
|
-
hasCache: (fileId: string) => Promise<boolean>;
|
|
5
|
-
getCachedContent: (fileId: string) => Promise<{
|
|
6
|
-
content: Blob;
|
|
7
|
-
crc32: number;
|
|
8
|
-
contentType: string;
|
|
9
|
-
} | null>;
|
|
10
|
-
validateCache: (fileId: string, expectedCrc32: number) => Promise<boolean>;
|
|
11
|
-
clearAllCache: () => Promise<void>;
|
|
12
|
-
getCacheStats: () => Promise<{
|
|
13
|
-
fileCount: number;
|
|
14
|
-
totalSize: number;
|
|
15
|
-
oldestTime: number | null;
|
|
16
|
-
newestTime: number | null;
|
|
17
|
-
}>;
|
|
18
|
-
getCacheList: () => Promise<{
|
|
19
|
-
fileId: string;
|
|
20
|
-
crc32: number;
|
|
21
|
-
fileSize: number;
|
|
22
|
-
updateTime: number;
|
|
23
|
-
}[]>;
|
|
24
|
-
};
|
|
25
|
-
export declare const CacheFileMeta: {
|
|
26
|
-
saveFileMetaBatch: (projectId: string, files: any[]) => Promise<void>;
|
|
27
|
-
saveFileMeta: (projectId: string, file: any) => Promise<void>;
|
|
28
|
-
listFileMetaByProject: (projectId: string) => Promise<any[]>;
|
|
29
|
-
getFileMeta: (fileId: string) => Promise<any | undefined>;
|
|
30
|
-
removeFileMeta: (fileId: string) => Promise<void>;
|
|
31
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as mammothModule from 'mammoth';
|
|
2
|
-
/**
|
|
3
|
-
* mammoth 的浏览器可用实例。
|
|
4
|
-
*
|
|
5
|
-
* 背景:npm 包 mammoth@1.12.3 的 Node 入口依赖 `@xmldom/xmldom`,但它声明的 `^0.8.6`
|
|
6
|
-
* 与项目里被提升到根目录的 `0.9.x` 不兼容(0.9 起会强制校验 parseFromString 的 mimeType,
|
|
7
|
-
* 且构造 DOMParser 时传 errorHandler 会直接报错)。Vite 预打包时把 mammoth 解析到了 0.9,
|
|
8
|
-
* 导致 docx 解析全线失败。
|
|
9
|
-
*
|
|
10
|
-
* 因此 vite.config.ts 里把 `mammoth` 别名到了官方预构建的 `mammoth.browser.js`——它自带
|
|
11
|
-
* `@xmldom/xmldom@0.8.6`,是自包含的。该文件是 UMD 包,只有一个 default 导出,所以这里统一
|
|
12
|
-
* 做一次解包,兼容 UMD(取 .default)与 ESM(直接取命名空间)两种形态。
|
|
13
|
-
*/
|
|
14
|
-
export declare const mammoth: typeof mammothModule;
|