@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.
Files changed (63) hide show
  1. package/dist/api/index.js +1 -1
  2. package/dist/index.js +1 -1
  3. package/dist/types/index.js +1 -1
  4. package/dist/ui/index.js +1 -1
  5. package/dist/utils/index.js +1 -1
  6. package/package.json +2 -2
  7. package/types/api/project.d.ts +1 -0
  8. package/types/types/project/base.d.ts +3 -0
  9. package/types/hooks.d.ts +0 -5
  10. package/types/types/projectRole.d.ts +0 -17
  11. package/types/types/user/index.d.ts +0 -1
  12. package/types/types/user/role.d.ts +0 -7
  13. package/types/ui/FileManager/FileContextMenu.d.ts +0 -50
  14. package/types/ui/FileManager/FileGridView.d.ts +0 -51
  15. package/types/ui/FileManager/FileTableView.d.ts +0 -49
  16. package/types/ui/FileManager/FileToolbar.d.ts +0 -16
  17. package/types/ui/FileManager/FileVersionHistoryModal.d.ts +0 -9
  18. package/types/ui/FileManager/MoveCopyToProjectModal.d.ts +0 -17
  19. package/types/ui/FileManager/ShareToWechatModal.d.ts +0 -10
  20. package/types/ui/FileManager/hooks/useFileManagerActions.d.ts +0 -143
  21. package/types/ui/FileManager/hooks/useFileManagerState.d.ts +0 -146
  22. package/types/ui/FileManager/index.d.ts +0 -16
  23. package/types/ui/FileManager/projectFileManagerApi.d.ts +0 -6
  24. package/types/ui/FileManager/types.d.ts +0 -174
  25. package/types/ui/FileManager/utils/fileDeltaWorker.d.ts +0 -14
  26. package/types/ui/FileManager/utils/fileTree.d.ts +0 -7
  27. package/types/ui/FileManager/utils/fileUpload.d.ts +0 -60
  28. package/types/ui/FileManager/utils/fileUtils.d.ts +0 -10
  29. package/types/ui/InvoiceRecordsList/index.d.ts +0 -43
  30. package/types/ui/MyFileSelectorModal.d.ts +0 -16
  31. package/types/ui/UIFilePreview/ExcelEditor/index.d.ts +0 -20
  32. package/types/ui/UIFilePreview/ExcelEditor/types.d.ts +0 -29
  33. package/types/ui/UIFilePreview/ExportDropdown.d.ts +0 -26
  34. package/types/ui/UIFilePreview/IndexedDBUtils.d.ts +0 -109
  35. package/types/ui/UIFilePreview/MarkdownEditor/exportMarkdownPdf.d.ts +0 -27
  36. package/types/ui/UIFilePreview/MarkdownEditor/index.d.ts +0 -34
  37. package/types/ui/UIFilePreview/MarkdownEditor/types.d.ts +0 -14
  38. package/types/ui/UIFilePreview/PPTXEditor/index.d.ts +0 -19
  39. package/types/ui/UIFilePreview/RichDocEditor/exportRDocMarkdown.d.ts +0 -23
  40. package/types/ui/UIFilePreview/RichDocEditor/exportRDocPdf.d.ts +0 -22
  41. package/types/ui/UIFilePreview/RichDocEditor/index.d.ts +0 -26
  42. package/types/ui/UIFilePreview/UIFilePreview.d.ts +0 -34
  43. package/types/ui/UIFilePreview/WordEditor/index.d.ts +0 -20
  44. package/types/ui/UIFilePreview/WordEditor/style.d.ts +0 -75
  45. package/types/ui/UIFilePreview/filetypes/archive.d.ts +0 -6
  46. package/types/ui/UIFilePreview/filetypes/cad.d.ts +0 -5
  47. package/types/ui/UIFilePreview/filetypes/excel.d.ts +0 -6
  48. package/types/ui/UIFilePreview/filetypes/image.d.ts +0 -6
  49. package/types/ui/UIFilePreview/filetypes/imageLoader.d.ts +0 -7
  50. package/types/ui/UIFilePreview/filetypes/pdf.d.ts +0 -7
  51. package/types/ui/UIFilePreview/filetypes/ppt.d.ts +0 -5
  52. package/types/ui/UIFilePreview/filetypes/pptExportPdf.d.ts +0 -28
  53. package/types/ui/UIFilePreview/filetypes/video.d.ts +0 -6
  54. package/types/ui/UIFilePreview/filetypes/word.d.ts +0 -5
  55. package/types/ui/UIFilePreview/filetypes/wordExportMarkdown.d.ts +0 -19
  56. package/types/ui/UIFilePreview/filetypes/wordExportPdf.d.ts +0 -32
  57. package/types/ui/UIFilePreview/index.d.ts +0 -46
  58. package/types/ui/UIFilePreview/pdfPagination.d.ts +0 -25
  59. package/types/ui/UIFilePreview/previewUtils.d.ts +0 -62
  60. package/types/ui.d.ts +0 -5
  61. package/types/utils/CacheFileContent.d.ts +0 -31
  62. package/types/utils/mammothApi.d.ts +0 -14
  63. package/types/utils.d.ts +0 -5
@@ -1,29 +0,0 @@
1
- export interface ExcelEditorProps {
2
- visible: boolean;
3
- onClose: () => void;
4
- fileName: string;
5
- }
6
- export interface ExcelCell {
7
- value: string | number | boolean | null;
8
- formula?: string;
9
- }
10
- export interface ExcelSheet {
11
- name: string;
12
- data: ExcelCell[][];
13
- colWidths: number[];
14
- rowHeights: number[];
15
- }
16
- export interface ExcelEditorState {
17
- sheets: ExcelSheet[];
18
- currentSheetIndex: number;
19
- selectedCell: {
20
- row: number;
21
- col: number;
22
- } | null;
23
- selectedRange: {
24
- startRow: number;
25
- startCol: number;
26
- endRow: number;
27
- endCol: number;
28
- } | null;
29
- }
@@ -1,26 +0,0 @@
1
- import React from 'react';
2
- import { type ButtonProps, type MenuProps } from 'antd';
3
- import './ExportDropdown.css';
4
- export interface ExportDropdownProps {
5
- /** 导出 PDF(不传则菜单里不出现该项) */
6
- onExportPdf?: () => void;
7
- /** 下载原始文件(不传则菜单里不出现该项) */
8
- onDownload?: () => void | Promise<void>;
9
- exportingPdf?: boolean;
10
- downloading?: boolean;
11
- disabled?: boolean;
12
- /** 触发按钮文案,默认「导出」 */
13
- label?: string;
14
- /** 透传给触发按钮,用于各出入口保留原有 type / size / className / style */
15
- buttonProps?: ButtonProps;
16
- /** 透传给 Dropdown,默认 'vendorsys-export-dropdown' */
17
- overlayClassName?: string;
18
- /** 额外的自定义菜单项,插入在「导出PDF」与「下载」之间 */
19
- extraItems?: MenuProps['items'];
20
- }
21
- /**
22
- * 统一的「导出」下拉按钮:「导出PDF」+ 自定义项 + 「下载」。
23
- * 两项都没有时整体不渲染,避免出现空下拉。
24
- */
25
- export declare const ExportDropdown: React.FC<ExportDropdownProps>;
26
- export default ExportDropdown;
@@ -1,109 +0,0 @@
1
- /**
2
- * IndexedDB 工具模块
3
- * 用于本地存储编辑器的文件数据
4
- */
5
- export type FileType = 'pptx' | 'xlsx' | 'md' | 'markdown' | 'docx' | 'rdoc';
6
- /** 本地文件记录(包含未上传的新文件和服务器文件的本地未同步修改) */
7
- export interface LocalFileRecord {
8
- /** 本地唯一标识 */
9
- localId: string;
10
- /** 用户 ID */
11
- userId: string;
12
- /** 项目 ID */
13
- projectId: string;
14
- /** 父文件夹 ID(服务器文件 ID 或本地文件夹 ID,根目录为 null) */
15
- parentId: string | null;
16
- /** 文件名 */
17
- fileName: string;
18
- /** 文件类型 */
19
- fileType: FileType;
20
- /** 对应服务器文件 ID:null 表示从未上传的本地新文件;非 null 表示该服务器文件的本地修改版本 */
21
- serverFileId: string | null;
22
- /** 是否为仅本地存在(从未上传) */
23
- isLocalOnly: boolean;
24
- /** 是否有未同步的修改 */
25
- hasUnsyncedChanges: boolean;
26
- /** 原始服务器文件快照(用于离线编辑后,上传时可回填服务器元数据,仅 serverFileId 非空时有值) */
27
- originalServerFile?: any | null;
28
- /** 原始服务器文件内容(用于差分上传基准,仅 serverFileId 非空时有值;二进制为 ArrayBuffer,Markdown 为 string) */
29
- originalContent?: ArrayBuffer | string;
30
- /** 文件实际内容(二进制为 ArrayBuffer,Markdown 为 string) */
31
- content: ArrayBuffer | string;
32
- /** 文件大小(字节) */
33
- fileSize: number;
34
- /** 创建时间戳 */
35
- createdAt: number;
36
- /** 更新时间戳 */
37
- updatedAt: number;
38
- }
39
- /**
40
- * 保存文件数据到 IndexedDB
41
- */
42
- export declare function saveFile(userId: string, fileName: string, fileType: FileType, data: any): Promise<void>;
43
- /**
44
- * 从 IndexedDB 读取文件数据
45
- */
46
- export declare function loadFile(userId: string, fileName: string, fileType: FileType): Promise<any | null>;
47
- /**
48
- * 删除 IndexedDB 中的文件
49
- */
50
- export declare function deleteFile(userId: string, fileName: string, fileType: FileType): Promise<void>;
51
- /**
52
- * 获取所有本地缓存的文件列表(指定用户)
53
- */
54
- export declare function listFiles(userId: string, fileType?: FileType): Promise<Array<{
55
- fileName: string;
56
- fileType: FileType;
57
- updatedAt: number;
58
- }>>;
59
- /**
60
- * 创建并保存一个新的本地仅存在文件(未上传到服务器)
61
- */
62
- export declare function createLocalOnlyFile(params: {
63
- userId: string;
64
- projectId: string;
65
- parentId: string | null;
66
- fileName: string;
67
- fileType: FileType;
68
- content: ArrayBuffer | string;
69
- }): Promise<LocalFileRecord>;
70
- /**
71
- * 为已上传的服务器文件保存本地未同步修改快照
72
- */
73
- export declare function saveUnsyncedServerFile(params: {
74
- userId: string;
75
- projectId: string;
76
- parentId: string | null;
77
- fileName: string;
78
- fileType: FileType;
79
- serverFileId: string;
80
- originalServerFile: any;
81
- content: ArrayBuffer | string;
82
- /** 原始服务器文件内容(用于差分上传基准) */
83
- originalContent?: ArrayBuffer | string;
84
- markUnsynced?: boolean;
85
- }): Promise<LocalFileRecord>;
86
- /**
87
- * 更新本地文件内容(用户编辑后)
88
- */
89
- export declare function updateLocalFileContent(localId: string, content: ArrayBuffer | string, fileName?: string, markUnsynced?: boolean): Promise<LocalFileRecord | null>;
90
- /**
91
- * 获取单个本地文件记录
92
- */
93
- export declare function getLocalFile(localId: string): Promise<LocalFileRecord | null>;
94
- /**
95
- * 通过服务器文件 ID 查找对应的本地未同步记录
96
- */
97
- export declare function getLocalFileByServerId(userId: string, serverFileId: string): Promise<LocalFileRecord | null>;
98
- /**
99
- * 列出指定项目下所有本地文件(本地新文件 + 服务器文件未同步修改)
100
- */
101
- export declare function listLocalFilesByProject(userId: string, projectId: string): Promise<LocalFileRecord[]>;
102
- /**
103
- * 标记本地文件为已同步(上传成功后调用)。如果 isLocalOnly=true 则删除记录;否则保留但 hasUnsyncedChanges=false
104
- */
105
- export declare function markLocalFileSynced(localId: string, uploadedServerFileId?: string): Promise<void>;
106
- /**
107
- * 删除本地文件记录
108
- */
109
- export declare function deleteLocalFile(localId: string): Promise<void>;
@@ -1,27 +0,0 @@
1
- import type EasyMDE from 'easymde';
2
- /**
3
- * Markdown 导出 PDF(纯前端生成,不经过浏览器打印对话框)。
4
- *
5
- * 实现思路:
6
- * 1. 复用 EasyMDE 的 previewRender(marked) 把 Markdown 渲染成与预览一致的 HTML;
7
- * 2. 放入离屏容器(.EasyMDEContainer .editor-preview),强制使用浅色主题变量,
8
- * 导出排版与编辑器预览保持 1:1;
9
- * 3. 按 A4 内容区高度对容器分块截图,规避浏览器单 canvas ~16384px 的高度上限,
10
- * 同时天然完成分页;
11
- * 4. 逐块写入 jsPDF(A4),最后直接触发下载。
12
- */
13
- export interface ExportMarkdownPdfOptions {
14
- /** 最新的 Markdown 原文 */
15
- content: string;
16
- /** 文件名(.md/.markdown 后缀会被替换为 .pdf) */
17
- fileName: string;
18
- /** EasyMDE 实例,用于复用其 previewRender 渲染逻辑 */
19
- editor?: EasyMDE | null;
20
- /** 分页进度回调(当前页 / 总页数) */
21
- onProgress?: (page: number, total: number) => void;
22
- }
23
- /**
24
- * 将 Markdown 内容导出为 PDF 并触发浏览器下载。
25
- * @throws 导出失败时抛出异常,由调用方提示用户
26
- */
27
- export declare const exportMarkdownPdf: (options: ExportMarkdownPdfOptions) => Promise<void>;
@@ -1,34 +0,0 @@
1
- import React from 'react';
2
- import 'easymde/dist/easymde.min.css';
3
- import './markdownEditor.css';
4
- export interface MarkdownEditorProps {
5
- value?: string;
6
- hiddenClose?: boolean;
7
- visible?: boolean;
8
- isCreate?: boolean;
9
- onClose?: () => void;
10
- onSaveLocal?: (value: string) => void;
11
- onChange?: (value: string) => void;
12
- fileName?: string;
13
- onUpload?: (oldValue: string, value: string, fileName: string) => Promise<void>;
14
- placeholder?: string;
15
- readOnly?: boolean;
16
- allowFullscreen?: boolean;
17
- defaultPreviewMode?: boolean;
18
- /** 是否显示「导出PDF」按钮,默认显示 */
19
- showExportPdf?: boolean;
20
- /**
21
- * 不适用本地缓存方式,如果为true,也不会出现上传按钮;
22
- * true:不会使用modal方式展示.
23
- */
24
- noLocalCache?: boolean;
25
- uploadPercent?: number;
26
- uploadSuccess?: boolean | undefined;
27
- isOffline?: boolean;
28
- isLocalOnly?: boolean;
29
- hasUnsyncedChanges?: boolean;
30
- onSaveLocalMarkdown?: (content: string, fileName: string, markUnsynced?: boolean) => Promise<void>;
31
- }
32
- declare const MarkdownEditor: React.FC<MarkdownEditorProps>;
33
- export default MarkdownEditor;
34
- export { MarkdownEditor };
@@ -1,14 +0,0 @@
1
- export interface MarkdownEditorProps {
2
- value?: string;
3
- visible?: boolean;
4
- onClose?: () => void;
5
- onSave?: (value: string) => void;
6
- placeholder?: string;
7
- readOnly?: boolean;
8
- allowFullscreen?: boolean;
9
- defaultPreviewMode?: boolean;
10
- }
11
- export interface MarkdownEditorState {
12
- content: string;
13
- isPreviewMode: boolean;
14
- }
@@ -1,19 +0,0 @@
1
- import React from 'react';
2
- interface PPTXEditorProps {
3
- visible: boolean;
4
- hiddenClose?: boolean;
5
- isCreate?: boolean;
6
- onClose: () => void;
7
- fileName: string;
8
- onUpload?: (initialBlob: Blob | undefined, blob: Blob, fileName: string) => Promise<void>;
9
- initialBlob?: Blob;
10
- readOnly?: boolean;
11
- uploadPercent?: number;
12
- uploadSuccess?: boolean;
13
- isOffline?: boolean;
14
- isLocalOnly?: boolean;
15
- hasUnsyncedChanges?: boolean;
16
- onSaveLocalBlob?: (blob: Blob, fileName: string, markUnsynced?: boolean) => Promise<void>;
17
- }
18
- export declare const PPTXEditor: React.FC<PPTXEditorProps>;
19
- export default PPTXEditor;
@@ -1,23 +0,0 @@
1
- /**
2
- * 将块文档(.rdoc)导出为 Markdown 文件。
3
- *
4
- * 图片块不参与导出:.rdoc 里的图片是 base64 内嵌在 JSON 中,直接写进 Markdown
5
- * 会让 .md 文件体积暴涨且难以在其他编辑器里使用,因此导出时整体跳过图片块。
6
- */
7
- import type { Block } from '@blocknote/core';
8
- /** 只需要改造文档为 Markdown 的能力,避免依赖编辑器的完整类型 */
9
- interface MarkdownSerializableEditor {
10
- blocksToMarkdownLossy(blocks?: Block[]): string;
11
- }
12
- export interface ExportRDocMarkdownResult {
13
- /** 生成的 Markdown 文本 */
14
- markdown: string;
15
- /** 被跳过的图片块数量 */
16
- skippedImages: number;
17
- }
18
- /**
19
- * 将块文档导出为 Markdown 并触发浏览器下载。
20
- * @throws 没有可导出内容时抛出异常,由调用方提示用户
21
- */
22
- export declare const exportRDocMarkdown: (editor: MarkdownSerializableEditor, blocks: Block[], fileName: string) => ExportRDocMarkdownResult;
23
- export {};
@@ -1,22 +0,0 @@
1
- /**
2
- * 将块文档(.rdoc)导出为 PDF。
3
- *
4
- * 与 Markdown 导出完全独立:
5
- * 1. 直接克隆编辑器真实 DOM(.bn-editor),并放在 .richdoc-editor-host 作用域下,
6
- * 复用编辑器自身的 BlockNote / richdoc 样式,保证导出与编辑时所见一致;
7
- * 2. 按块/行边界分页(见 pdfPagination),不会把一行文字切成两半;
8
- * 3. 逐页 html2canvas 截图后写入 jsPDF,触发浏览器下载。
9
- */
10
- export interface ExportRDocPdfOptions {
11
- /** 编辑器根 DOM(BlockNote 的 editor.domElement) */
12
- editorElement: HTMLElement;
13
- /** 文件名(.rdoc 后缀会被替换为 .pdf) */
14
- fileName: string;
15
- /** 分页进度回调(当前页 / 总页数) */
16
- onProgress?: (page: number, total: number) => void;
17
- }
18
- /**
19
- * 将块文档导出为 PDF 并触发浏览器下载。
20
- * @throws 导出失败时抛出异常,由调用方提示用户
21
- */
22
- export declare const exportRDocPdf: (options: ExportRDocPdfOptions) => Promise<void>;
@@ -1,26 +0,0 @@
1
- import React from 'react';
2
- import '@blocknote/core/fonts/inter.css';
3
- import '@blocknote/mantine/style.css';
4
- import './richdoc-editor.css';
5
- export interface RichDocEditorProps {
6
- /** 文件内容:BlockNote 块数组的 JSON 字符串;空字符串表示新建文档 */
7
- value?: string;
8
- hiddenClose?: boolean;
9
- visible?: boolean;
10
- isCreate?: boolean;
11
- onClose?: () => void;
12
- onSaveLocal?: (value: string) => void;
13
- onChange?: (value: string) => void;
14
- fileName?: string;
15
- onUpload?: (oldValue: string, value: string, fileName: string) => Promise<void>;
16
- readOnly?: boolean;
17
- uploadPercent?: number;
18
- uploadSuccess?: boolean | undefined;
19
- isOffline?: boolean;
20
- isLocalOnly?: boolean;
21
- hasUnsyncedChanges?: boolean;
22
- onSaveLocalMarkdown?: (content: string, fileName: string, markUnsynced?: boolean) => Promise<void>;
23
- }
24
- declare const RichDocEditor: React.FC<RichDocEditorProps>;
25
- export default RichDocEditor;
26
- export { RichDocEditor };
@@ -1,34 +0,0 @@
1
- import React from 'react';
2
- import { FileDetailFetcher } from './previewUtils';
3
- import './filePreview.css';
4
- export declare const UIFilePreview: React.FC<{
5
- fileUrl: string | null;
6
- accessToken?: string;
7
- visible: boolean;
8
- onClose: () => void;
9
- hiddenClose?: boolean;
10
- isCreate?: boolean;
11
- editable?: boolean;
12
- fileName?: string;
13
- uploadPercent: number | undefined;
14
- uploadSuccess?: boolean | undefined;
15
- onUploadBlob?: (initialBlob: Blob | undefined, blob: Blob, fileName: string) => Promise<void>;
16
- onUploadMarkdown?: (oldContent: string, content: string, fileName: string) => Promise<void>;
17
- fileId?: string;
18
- crc32?: number;
19
- /** 文件详情查询函数:不传时使用项目文件接口;CRM 等场景可注入自有接口 */
20
- fetchFileDetail?: FileDetailFetcher;
21
- onCacheSaved?: (fileId: string) => void;
22
- /** 本地文件唯一 ID(本地文件或未同步服务器文件),设置后将从 localFiles store 加载内容,不从服务器 fetch */
23
- localId?: string;
24
- /** 是否为仅本地存在(从未上传)*/
25
- isLocalOnly?: boolean;
26
- /** 是否有未同步的本地修改 */
27
- hasUnsyncedChanges?: boolean;
28
- /** 离线模式:true 时隐藏上传按钮,仅允许本地保存,并显示离线提示 */
29
- isOffline?: boolean;
30
- /** 编辑本地/离线文件时,保存(非上传)到本地的回调,更新 localFiles store 内容 */
31
- onSaveLocalBlob?: (blob: Blob, fileName: string, markUnsynced?: boolean) => Promise<void>;
32
- /** 编辑本地/离线 Markdown 文件时,保存(非上传)到本地的回调 */
33
- onSaveLocalMarkdown?: (content: string, fileName: string, markUnsynced?: boolean) => Promise<void>;
34
- }>;
@@ -1,20 +0,0 @@
1
- import { type DocxEditorRef } from '@eigenpal/docx-editor-react';
2
- import '@eigenpal/docx-editor-react/styles.css';
3
- import './word-editor.css';
4
- interface WordEditorProps {
5
- visible: boolean;
6
- hiddenClose?: boolean;
7
- isCreate?: boolean;
8
- onClose: () => void;
9
- fileName: string;
10
- onUpload?: (initialBlob: Blob | undefined, blob: Blob, fileName: string) => Promise<void>;
11
- initialBlob?: Blob;
12
- readOnly?: boolean;
13
- uploadPercent?: number;
14
- isOffline?: boolean;
15
- isLocalOnly?: boolean;
16
- hasUnsyncedChanges?: boolean;
17
- onSaveLocalBlob?: (blob: Blob, fileName: string, markUnsynced?: boolean) => Promise<void>;
18
- }
19
- export declare const WordEditor: import("react").ForwardRefExoticComponent<WordEditorProps & import("react").RefAttributes<DocxEditorRef>>;
20
- export default WordEditor;
@@ -1,75 +0,0 @@
1
- import { Document, Style } from "@eigenpal/docx-editor-core";
2
- export declare const CUSTOM_FONT_FAMILIES: ({
3
- name: string;
4
- fontFamily: string;
5
- category: "serif";
6
- } | {
7
- name: string;
8
- fontFamily: string;
9
- category: "sans-serif";
10
- } | {
11
- name: string;
12
- fontFamily: string;
13
- category: "monospace";
14
- })[];
15
- export declare const PRESET_STYLES: Style[];
16
- export declare function createDocumentWithStyles(): Document;
17
- /**
18
- * 将预设样式应用到已解析的文档中。
19
- * 合并策略:
20
- * 1. 从现有样式中删除所有与任一预设"名称相同(规范化后)"或"styleId 相同"的冲突样式
21
- * (同时解决原文档 styleId=1/name=标题1 与 styleId=Heading1/name=Heading1 两套共存的重复问题)
22
- * 2. 在样式列表末尾统一追加一份完整的预设样式集合
23
- * 这样可以确保我们的预设样式(如仿宋正文、黑体标题等)始终作为可用样式存在,且无重复。
24
- */
25
- export declare function applyPresetStylesToDocument(doc: Document): Document;
26
- /**
27
- * 按节 docGrid 设置,为缺少显式行距的段落注入「整数格对齐」的 atLeast 行距。
28
- * 必须在 parseDocx 之后、文档交给 <DocxEditor> 之前调用。幂等:已有显式行距的段落不动。
29
- */
30
- export declare function applyDocGridLineSpacing(doc: Document): Document;
31
- /**
32
- * 规范化样式名称用于「去重/等值比较」。
33
- *
34
- * 注意:这是强归一化函数,不仅去空格/转小写,还做:
35
- * 1) 全角数字/字母/符号 → 半角
36
- * 2) 中文全角空格 → 半角空格 → 最终所有空格全部剥离
37
- * 3) 中文前缀同义词归一:「标题 N」= 「headingN」= 「heading N」(因为文件自带的
38
- * Normal/Heading1 等 style 在中文环境里 name 可能是"标题 1",在英文环境里
39
- * name 是 "Heading 1",两套 name 实际指向同一个公文里的"标题 1"语义)
40
- *
41
- * 只有经过这么彻底的归一,才能把原 docx 里 styleId 数字 1/name=标题1(全角)、
42
- * styleId 数字 1/name=Heading 1、preset styleId Heading1/name=标题 1(半角)
43
- * 这三个本质上是同一个样式的不同表达都识别成等价项,不会在样式下拉框里出现
44
- * 三个重复项。
45
- */
46
- export declare function normalizeStyleName(name: string | undefined | null): string;
47
- /**
48
- * 将预设样式合并进 styles.xml 内容:
49
- * 1. 扫描现有样式,删除所有与任一预设"名称相同(规范化后)"或"styleId 相同"的旧样式定义
50
- * (这一步同时解决:原文件用 styleId=1/name=标题1 与 styleId=Heading1/name=Heading1 两套共存的重复问题)
51
- * 2. 在 </w:styles> 前统一追加一份完整的预设样式定义
52
- *
53
- * 返回合并后的 styles.xml 字符串。若原内容已经包含正确的预设集合且无冲突,返回原值。
54
- *
55
- * 使用纯字符串替换,避免 DOMParser/XMLSerializer 破坏 OOXML 结构。
56
- */
57
- export declare function mergePresetStylesIntoStylesXml(stylesXml: string): string;
58
- /**
59
- * 确保 document.xml 中引用了带间距样式的段落有内联 <w:spacing> 标签。
60
- *
61
- * 规则:
62
- * - 仅对引用了 PRESET_STYLES 中带间距样式(如 Heading1)的段落处理
63
- * - 如果段落已有 <w:spacing>,只补充缺失的属性(不覆盖用户手动设置的值)
64
- * - 如果段落没有 <w:spacing>,创建并插入到 <w:pStyle> 之后
65
- * (遵循 OOXML CT_PPr 子元素顺序:pStyle → ... → spacing → ind → jc)
66
- *
67
- * 使用字符串操作而非 DOM API,避免 XMLSerializer 丢失 XML 声明、
68
- * 命名空间处理不一致等问题。
69
- */
70
- export declare function ensureInlineSpacingInDocumentXml(documentXml: string): string;
71
- /**
72
- * 在 document.xml 中为所有引用了 styleId=HongTouSeparator 的段落,
73
- * 强制注入/替换一段完整的 4 边内联 <w:pBdr>,保证 WPS 打开也能显示红线。
74
- */
75
- export declare function ensureHongTouSeparatorBorderInDocumentXml(documentXml: string): string;
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- interface ArchivePreviewProps {
3
- file: File | null;
4
- }
5
- export declare const ArchivePreview: React.FC<ArchivePreviewProps>;
6
- export {};
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- export interface CadPreviewProps {
3
- file: File | null;
4
- }
5
- export declare const CadPreview: React.FC<CadPreviewProps>;
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- import '@univerjs/preset-sheets-core/lib/index.css';
3
- export interface ExcelPreviewProps {
4
- file: File | null;
5
- }
6
- export declare const ExcelPreview: React.FC<ExcelPreviewProps>;
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- export interface ImagePreviewProps {
3
- containerRef: React.RefObject<HTMLDivElement>;
4
- type: string;
5
- }
6
- export declare const ImagePreview: React.FC<ImagePreviewProps>;
@@ -1,7 +0,0 @@
1
- import type { RefObject } from 'react';
2
- export declare const loadImagePreview: (buffer: {
3
- buffer: ArrayBuffer;
4
- headers: any;
5
- status: number;
6
- }, imageRef: RefObject<HTMLDivElement>) => Promise<void>;
7
- export declare const destroyImagePreview: (imageRef: RefObject<HTMLDivElement>) => void;
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- export interface PdfPreviewProps {
3
- file: File | null;
4
- /** 阅读进度本地存储 key(通常为文件 ID);未提供时不保存/恢复进度 */
5
- progressKey?: string;
6
- }
7
- export declare const PdfPreview: React.FC<PdfPreviewProps>;
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- export interface PptPreviewProps {
3
- file: File | null;
4
- }
5
- export declare const PptPreview: React.FC<PptPreviewProps>;
@@ -1,28 +0,0 @@
1
- export interface ExportPptxPdfOptions {
2
- /** pptx/ppt 文件(编辑器侧应传入含最新修改的导出产物) */
3
- file: Blob;
4
- /** 文件名(.pptx/.ppt 后缀会被替换为 .pdf) */
5
- fileName: string;
6
- /** 逐页进度回调(当前页 / 总页数) */
7
- onProgress?: (page: number, total: number) => void;
8
- }
9
- export interface PptxSlideImage {
10
- /** PNG data URL(SCALE 倍分辨率) */
11
- dataUrl: string;
12
- /** 幻灯片原始 CSS 像素尺寸 */
13
- widthPx: number;
14
- heightPx: number;
15
- /** PDF 页面尺寸(pt,px × 0.75) */
16
- widthPt: number;
17
- heightPt: number;
18
- }
19
- /**
20
- * 把 PPT 渲染成逐页图片(导出 PDF 的核心,也可单独用于预览/其他导出格式)。
21
- * 离屏独立渲染一份,避免用户当前视图的缩放/样式干扰光栅化,结束后自动卸载。
22
- */
23
- export declare const renderPptxSlidesToImages: (file: Blob, onProgress?: (page: number, total: number) => void) => Promise<PptxSlideImage[]>;
24
- /**
25
- * PPT 导出 PDF(逐张幻灯片 SVG foreignObject 光栅化 → jsPDF 直接下载)。
26
- * @returns 生成的 PDF 文件名
27
- */
28
- export declare const exportPptxPdf: ({ file, fileName, onProgress, }: ExportPptxPdfOptions) => Promise<string>;
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- export interface VideoPreviewProps {
3
- previewUrl: string;
4
- type: string;
5
- }
6
- export declare const VideoPreview: React.FC<VideoPreviewProps>;
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- export interface WordPreviewProps {
3
- file: File | null;
4
- }
5
- export declare const WordPreview: React.FC<WordPreviewProps>;
@@ -1,19 +0,0 @@
1
- /**
2
- * Word 导出 Markdown。
3
- *
4
- * 说明:markitdown 是 Python 库,浏览器端跑不了,这里用等价链路实现:
5
- * docx --mammoth--> 语义化 HTML --turndown(gfm)--> Markdown
6
- * mammoth 负责 docx 的结构解析(标题、列表、表格、加粗等),turndown + gfm
7
- * 负责 HTML → Markdown 的还原,表格用 gfm 插件保住 Markdown 表格语法。
8
- * mammoth 已是项目依赖(原本用于 docx 文本提取)。
9
- */
10
- export interface ExportWordMarkdownOptions {
11
- /** docx/doc 文件(编辑器侧应传入含最新修改的 save() 产物) */
12
- file: Blob;
13
- /** 文件名(.docx/.doc 后缀会被替换为 .md) */
14
- fileName: string;
15
- }
16
- /** docx → Markdown 文本(不下载,便于复用/测试) */
17
- export declare const convertDocxToMarkdown: (file: Blob) => Promise<string>;
18
- /** docx → Markdown 并直接下载 .md 文件,返回转换结果 */
19
- export declare const exportWordMarkdown: ({ file, fileName }: ExportWordMarkdownOptions) => Promise<string>;
@@ -1,32 +0,0 @@
1
- export interface ExportWordPdfOptions {
2
- /** docx/doc 文件(编辑器侧应传入含最新修改的 save() 产物) */
3
- file: Blob;
4
- /** 文件名(.docx/.doc 后缀会被替换为 .pdf) */
5
- fileName: string;
6
- /** 逐页进度回调(当前页 / 总页数) */
7
- onProgress?: (page: number, total: number) => void;
8
- }
9
- /** Word 预览页使用的 FileViewer 配置(连续滚动视图、隐藏内置工具栏) */
10
- export declare const buildWordViewerOptions: () => {
11
- locale: "zh-CN";
12
- rendererMode: "replace";
13
- styleIsolation: "none";
14
- renderers: any;
15
- theme: "light";
16
- toolbar: {
17
- position: "bottom-right";
18
- download: boolean;
19
- print: boolean;
20
- exportHtml: boolean;
21
- };
22
- docx: {
23
- workerUrl: string;
24
- workerJsZipUrl: string;
25
- visualPagination: boolean;
26
- };
27
- };
28
- /**
29
- * Word 文档导出 PDF(SVG foreignObject 逐页光栅化 → jsPDF 直接下载)。
30
- * @returns 生成的 PDF 文件名
31
- */
32
- export declare const exportWordPdf: ({ file, fileName, onProgress, }: ExportWordPdfOptions) => Promise<string>;