@spacecorexdev/core 0.1.0 → 0.2.1

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 +17 -17
  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,9 +0,0 @@
1
- import React from 'react';
2
- import { ProjectFile } from './types';
3
- interface FileVersionHistoryModalProps {
4
- visible: boolean;
5
- file: ProjectFile | null;
6
- onClose: () => void;
7
- }
8
- export declare const FileVersionHistoryModal: React.FC<FileVersionHistoryModalProps>;
9
- export default FileVersionHistoryModal;
@@ -1,17 +0,0 @@
1
- import React from 'react';
2
- interface MoveCopyFileInfo {
3
- fileName: string;
4
- fileType: string;
5
- }
6
- interface MoveCopyToProjectModalProps {
7
- visible: boolean;
8
- fileIds: string[];
9
- /** 当前操作的文件/文件夹信息(用于文件夹场景的文案展示) */
10
- files?: MoveCopyFileInfo[];
11
- currentProjectId: string;
12
- mode: 'move' | 'copy';
13
- onCancel: () => void;
14
- onSuccess: () => void;
15
- }
16
- export declare const MoveCopyToProjectModal: React.FC<MoveCopyToProjectModalProps>;
17
- export {};
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- import { ProjectFile } from './types';
3
- interface ShareToWechatModalProps {
4
- visible: boolean;
5
- file: ProjectFile | null;
6
- onClose: () => void;
7
- onFileCached?: (fileId: string) => void;
8
- }
9
- export declare const ShareToWechatModal: React.FC<ShareToWechatModalProps>;
10
- export {};
@@ -1,143 +0,0 @@
1
- import React from 'react';
2
- import { ProjectFile, ProjectRole, FileManagerApi, FileManagerFeatures, FileSortBy } from '../types';
3
- type ViewMode = 'table' | 'grid';
4
- type CreatingFileType = 'pptx' | 'md' | 'xlsx' | 'docx' | 'rdoc' | null;
5
- interface FileManagerState {
6
- files: ProjectFile[];
7
- expandedRowKeys: string[];
8
- selectedFolderId: string | null;
9
- dragOverId: string | null;
10
- /** 排序字段(与 useFileManagerState 中定义保持一致) */
11
- sortBy: FileSortBy;
12
- /** 当前用户是否具备项目管理权限(文件夹下载等入口) */
13
- isManager: boolean;
14
- }
15
- interface FileManagerStateActions {
16
- setFiles: (files: ProjectFile[]) => void;
17
- setFileTreeData: (data: ProjectFile[]) => void;
18
- setLoading: (loading: boolean) => void;
19
- setExpandedRowKeys: (keys: string[]) => void;
20
- setViewMode: (mode: ViewMode) => void;
21
- setSelectedFolderId: (id: string | null) => void;
22
- setUploadPercent: (percent: number | undefined) => void;
23
- setUploadSuccess: (success: boolean | undefined) => void;
24
- setDragUploadPercent: (percent: number | undefined) => void;
25
- setDragUploadSuccess: (success: boolean | undefined) => void;
26
- setDragUploadingFileName: (name: string) => void;
27
- setIsExternalDragOver: (over: boolean) => void;
28
- setNewFolderName: (name: string) => void;
29
- setIsManager: (manager: boolean) => void;
30
- setEditingFile: (file: ProjectFile | null) => void;
31
- setEditorVisible: (visible: boolean) => void;
32
- setPreviewFileName: (name: string | null) => void;
33
- setPreviewUrl: (url: string | null) => void;
34
- setPreviewVisible: (visible: boolean) => void;
35
- setPreviewingFile: (file: ProjectFile | null) => void;
36
- setPreviewCrc32: (crc32: number | undefined) => void;
37
- setShareToWechatFile: (file: ProjectFile | null) => void;
38
- setShareToWechatVisible: (visible: boolean) => void;
39
- setRenameFileId: (id: string | null) => void;
40
- setRenameFileName: (name: string) => void;
41
- setRenameVisible: (visible: boolean) => void;
42
- setDescsFileId: (id: string | null) => void;
43
- setDescsValue: (value: string) => void;
44
- setDescsVisible: (visible: boolean) => void;
45
- setIsEncryptedFolder: (encrypted: boolean) => void;
46
- setCreateFolderVisible: (visible: boolean) => void;
47
- setNewFolderDescs: (descs: string) => void;
48
- setCreatingFileName: (name: string) => void;
49
- setCreatingFileType: (type: CreatingFileType) => void;
50
- setCreatorVisible: (visible: boolean) => void;
51
- setContextMenuVisible: (visible: boolean) => void;
52
- setContextMenuRecord: (record: ProjectFile | null) => void;
53
- setContextMenuPosition: (pos: {
54
- x: number;
55
- y: number;
56
- }) => void;
57
- setMoveCopyFiles: (files: ProjectFile[]) => void;
58
- setMoveCopyMode: (mode: 'move' | 'copy') => void;
59
- setMoveCopyModalVisible: (visible: boolean) => void;
60
- setVersionHistoryFile: (file: ProjectFile | null) => void;
61
- setVersionHistoryModalVisible: (visible: boolean) => void;
62
- setDragSourceId: (id: string | null) => void;
63
- setDragOverId: (id: string | null) => void;
64
- setRootDragOver: (over: boolean) => void;
65
- setIsOnline: (online: boolean) => void;
66
- setPreviewLocalId: (localId: string | null) => void;
67
- setPreviewIsLocalOnly: (isLocalOnly: boolean) => void;
68
- setPreviewHasUnsyncedChanges: (has: boolean) => void;
69
- setCreateFileVisible: (visible: boolean) => void;
70
- setNewFileName: (name: string) => void;
71
- setPendingFileType: (type: CreatingFileType) => void;
72
- }
73
- interface FileManagerActions {
74
- loadFiles: () => Promise<void>;
75
- uploadFiles: (fileList: any[]) => Promise<void>;
76
- handlePreview: (file: ProjectFile) => void;
77
- handleDownload: (file: ProjectFile) => void;
78
- /** 发起文件夹异步打包下载(仅管理员/负责人可用) */
79
- handleDownloadFolder: (file: ProjectFile) => void;
80
- handleShareToWechat: (file: ProjectFile) => void;
81
- handleCopyLink: (file: ProjectFile) => void;
82
- handleJumpToContract: (file: ProjectFile) => void;
83
- /** 在合同根文件夹右键菜单中点击"创建合同":切换到合同页签并打开新建合同弹窗 */
84
- handleCreateContract: (file: ProjectFile) => void;
85
- handleGenerateTempLink: (file: ProjectFile) => void;
86
- handleDelete: (fileId: string) => void;
87
- isFolderExpanded: (folderId: string) => boolean;
88
- handleMove: (fileId: string, targetFolderId: string | null) => void;
89
- handleRename: (file: ProjectFile) => void;
90
- handleEditDescs: (file: ProjectFile) => void;
91
- handleDescsConfirm: (descsFileId: string | null, descsValue: string) => void;
92
- handleRenameConfirm: (renameFileId: string | null, renameFileName: string) => void;
93
- handleCreateFolder: () => void;
94
- openCreator: (fileName: string, fileType: CreatingFileType) => void;
95
- handleCreatePptx: () => void;
96
- handleCreateMarkdown: () => void;
97
- handleCreateRdoc: () => void;
98
- handleCreateExcel: () => void;
99
- handleCreateWord: () => void;
100
- handleCreateFileConfirm: (fileName: string, fileType: CreatingFileType) => void;
101
- handleCreateFolderConfirm: (newFolderName: string, newFolderDescs: string, isEncryptedFolder: boolean) => void;
102
- handleEditFile: (file: ProjectFile) => void;
103
- handleUploadBlob: (editingFile: ProjectFile | null, initialBlob: Blob | undefined, blob: Blob, fileName: string) => void;
104
- handleUploadMarkdown: (editingFile: ProjectFile | null, oldContent: string, content: string, fileName: string) => void;
105
- handleCreateUploadBlob: (initialBlob: Blob | undefined, blob: Blob, fileName: string) => void;
106
- handleCreateUploadMarkdown: (oldContent: string, content: string, fileName: string) => void;
107
- /** 编辑器点击"保存本地缓存"时调用:同步更新 localFiles store 内容,使 hasUnsyncedChanges 标记生效 */
108
- handleSaveLocalBlob: (localId: string | null | undefined, blob: Blob, fileName: string, markUnsynced?: boolean) => Promise<void>;
109
- /** Markdown 编辑器点击"保存本地缓存"时调用 */
110
- handleSaveLocalMarkdown: (localId: string | null | undefined, content: string, fileName: string, markUnsynced?: boolean) => Promise<void>;
111
- handleExpand: (expanded: boolean, record: ProjectFile) => void;
112
- toggleFolderExpand: (record: ProjectFile, tableView: boolean) => void;
113
- handleDragStart: (fileId: string) => void;
114
- handleDragEnd: () => void;
115
- handleDragOver: (fileId: string) => void;
116
- handleDragLeave: (fileId: string) => void;
117
- handleDrop: (sourceId: string, targetId: string) => void;
118
- handleExternalDragEnter: (e: React.DragEvent) => void;
119
- handleExternalDragOver: (e: React.DragEvent) => void;
120
- handleExternalDragLeave: (e: React.DragEvent) => void;
121
- handleExternalDrop: (e: React.DragEvent) => void;
122
- handleContextMenu: (event: React.MouseEvent, record: ProjectFile) => void;
123
- handleMoveToProject: (file: ProjectFile) => void;
124
- handleCopyToProject: (file: ProjectFile) => void;
125
- handleCopyToSelf: (file: ProjectFile) => void;
126
- handleMoveCopySuccess: () => void;
127
- handleViewVersionHistory: (file: ProjectFile) => void;
128
- handleClearCache: (file: ProjectFile) => void;
129
- handleCacheSaved: (fileId: string) => void;
130
- handleOpenInNewWindow: (file: ProjectFile) => void;
131
- handleRootDragOver: (e: React.DragEvent) => void;
132
- handleRootDragLeave: () => void;
133
- handleRootDrop: (e: React.DragEvent) => void;
134
- initUserRole: () => void;
135
- initViewMode: () => void;
136
- }
137
- export declare const useFileManagerActions: (projectId: string, currentUserRole: ProjectRole | null, state: FileManagerState, actions: FileManagerStateActions, options?: {
138
- /** 数据接口适配器,缺省为项目文件 API */
139
- api?: FileManagerApi;
140
- /** 功能开关,缺省全部开启 */
141
- features?: FileManagerFeatures;
142
- }) => FileManagerActions;
143
- export {};
@@ -1,146 +0,0 @@
1
- import { ProjectFile, FileSortBy } from '../types';
2
- type ViewMode = 'table' | 'grid';
3
- type CreatingFileType = 'pptx' | 'md' | 'xlsx' | 'docx' | 'rdoc' | null;
4
- interface FileManagerState {
5
- files: ProjectFile[];
6
- fileTreeData: ProjectFile[];
7
- /** 文件列表是否正在加载 */
8
- loading: boolean;
9
- expandedRowKeys: string[];
10
- viewMode: ViewMode;
11
- smallView: boolean;
12
- selectedFolderId: string | null;
13
- dragSourceId: string | null;
14
- dragOverId: string | null;
15
- rootDragOver: boolean;
16
- uploadPercent: number | undefined;
17
- uploadSuccess: boolean | undefined;
18
- dragUploadPercent: number | undefined;
19
- dragUploadSuccess: boolean | undefined;
20
- dragUploadingFileName: string;
21
- isExternalDragOver: boolean;
22
- createFolderVisible: boolean;
23
- newFolderName: string;
24
- newFolderDescs: string;
25
- isEncryptedFolder: boolean;
26
- renameVisible: boolean;
27
- renameFileName: string;
28
- renameFileId: string | null;
29
- descsVisible: boolean;
30
- descsFileId: string | null;
31
- descsValue: string;
32
- editorVisible: boolean;
33
- editingFile: ProjectFile | null;
34
- creatorVisible: boolean;
35
- creatingFileName: string;
36
- creatingFileType: CreatingFileType;
37
- previewUrl: string | null;
38
- previewVisible: boolean;
39
- previewFileName: string | null;
40
- previewCrc32: number | undefined;
41
- /** 当前预览中的文件(由 handlePreview 同步设置,作为 previewFile 计算的权威来源) */
42
- previewingFile: ProjectFile | null;
43
- contextMenuVisible: boolean;
44
- contextMenuPosition: {
45
- x: number;
46
- y: number;
47
- };
48
- contextMenuRecord: ProjectFile | null;
49
- isManager: boolean;
50
- moveCopyModalVisible: boolean;
51
- moveCopyMode: 'move' | 'copy';
52
- moveCopyFiles: ProjectFile[];
53
- versionHistoryModalVisible: boolean;
54
- versionHistoryFile: ProjectFile | null;
55
- shareToWechatVisible: boolean;
56
- shareToWechatFile: ProjectFile | null;
57
- /** 当前是否在线(网络状态) */
58
- isOnline: boolean;
59
- /** 当前预览/编辑的本地文件唯一标识(仅本地文件或有未同步修改时存在) */
60
- previewLocalId: string | null;
61
- /** 当前预览/编辑的是否为仅本地文件(从未上传) */
62
- previewIsLocalOnly: boolean;
63
- /** 当前预览/编辑的文件是否有未同步的本地修改 */
64
- previewHasUnsyncedChanges: boolean;
65
- /** 新建文件名输入对话框可见性 */
66
- createFileVisible: boolean;
67
- /** 新建文件名输入对话框中的文件名(含扩展名) */
68
- newFileName: string;
69
- /** 新建文件名对话框待创建的文件类型 */
70
- pendingFileType: CreatingFileType;
71
- /** 排序字段 */
72
- sortBy: FileSortBy;
73
- /** 排序顺序 */
74
- sortOrder: 'asc' | 'desc';
75
- }
76
- interface FileManagerStateActions {
77
- setFiles: (files: ProjectFile[]) => void;
78
- setFileTreeData: (data: ProjectFile[]) => void;
79
- setLoading: (loading: boolean) => void;
80
- setExpandedRowKeys: (keys: string[]) => void;
81
- toggleExpandKey: (key: string) => void;
82
- setViewMode: (mode: ViewMode) => void;
83
- setSmallView: (small: boolean) => void;
84
- setSelectedFolderId: (id: string | null) => void;
85
- setDragSourceId: (id: string | null) => void;
86
- setDragOverId: (id: string | null) => void;
87
- setRootDragOver: (over: boolean) => void;
88
- setUploadPercent: (percent: number | undefined) => void;
89
- setUploadSuccess: (success: boolean | undefined) => void;
90
- setDragUploadPercent: (percent: number | undefined) => void;
91
- setDragUploadSuccess: (success: boolean | undefined) => void;
92
- setDragUploadingFileName: (name: string) => void;
93
- setIsExternalDragOver: (over: boolean) => void;
94
- setCreateFolderVisible: (visible: boolean) => void;
95
- setNewFolderName: (name: string) => void;
96
- setNewFolderDescs: (descs: string) => void;
97
- setIsEncryptedFolder: (encrypted: boolean) => void;
98
- setRenameVisible: (visible: boolean) => void;
99
- setRenameFileName: (name: string) => void;
100
- setRenameFileId: (id: string | null) => void;
101
- setDescsVisible: (visible: boolean) => void;
102
- setDescsFileId: (id: string | null) => void;
103
- setDescsValue: (value: string) => void;
104
- setEditorVisible: (visible: boolean) => void;
105
- setEditingFile: (file: ProjectFile | null) => void;
106
- setCreatorVisible: (visible: boolean) => void;
107
- setCreatingFileName: (name: string) => void;
108
- setCreatingFileType: (type: CreatingFileType) => void;
109
- setPreviewUrl: (url: string | null) => void;
110
- setPreviewVisible: (visible: boolean) => void;
111
- setPreviewFileName: (name: string | null) => void;
112
- setPreviewCrc32: (crc32: number | undefined) => void;
113
- setPreviewingFile: (file: ProjectFile | null) => void;
114
- setContextMenuVisible: (visible: boolean) => void;
115
- setContextMenuPosition: (pos: {
116
- x: number;
117
- y: number;
118
- }) => void;
119
- setContextMenuRecord: (record: ProjectFile | null) => void;
120
- setIsManager: (manager: boolean) => void;
121
- setMoveCopyModalVisible: (visible: boolean) => void;
122
- setMoveCopyMode: (mode: 'move' | 'copy') => void;
123
- setMoveCopyFiles: (files: ProjectFile[]) => void;
124
- setVersionHistoryModalVisible: (visible: boolean) => void;
125
- setVersionHistoryFile: (file: ProjectFile | null) => void;
126
- setShareToWechatVisible: (visible: boolean) => void;
127
- setShareToWechatFile: (file: ProjectFile | null) => void;
128
- setIsOnline: (online: boolean) => void;
129
- setPreviewLocalId: (localId: string | null) => void;
130
- setPreviewIsLocalOnly: (isLocalOnly: boolean) => void;
131
- setPreviewHasUnsyncedChanges: (has: boolean) => void;
132
- setCreateFileVisible: (visible: boolean) => void;
133
- setNewFileName: (name: string) => void;
134
- setPendingFileType: (type: CreatingFileType) => void;
135
- setSortBy: (by: FileSortBy) => void;
136
- setSortOrder: (order: 'asc' | 'desc') => void;
137
- resetPreviewState: () => void;
138
- resetEditorState: () => void;
139
- resetCreatorState: () => void;
140
- resetContextMenu: () => void;
141
- resetMoveCopyState: () => void;
142
- resetVersionHistoryState: () => void;
143
- resetShareToWechatState: () => void;
144
- }
145
- export declare const useFileManagerState: () => [FileManagerState, FileManagerStateActions];
146
- export {};
@@ -1,16 +0,0 @@
1
- import React from 'react';
2
- import { ProjectRole, FileManagerApi, FileManagerFeatures } from './types';
3
- interface FileManagerProps {
4
- projectId: string;
5
- fileId?: string | null;
6
- currentUserRole: ProjectRole | null;
7
- /** 当前文件 tab 是否处于激活状态:重新激活时刷新文件列表(例如在合同 tab 新建合同后切回) */
8
- isActive?: boolean;
9
- className?: string;
10
- /** 数据接口适配器,缺省为项目文件 API(CRM 等场景注入自定义实现) */
11
- api?: FileManagerApi;
12
- /** 功能开关,缺省全部开启(合同、跨项目移动复制、微信分享、版本历史、外部预览链接) */
13
- features?: FileManagerFeatures;
14
- }
15
- export declare const FileManager: React.FC<FileManagerProps>;
16
- export {};
@@ -1,6 +0,0 @@
1
- import { FileManagerApi } from './types';
2
- /**
3
- * 项目文件场景的默认 FileManagerApi 实现:包装 API.project.*。
4
- * FileManager 未传入自定义 api 时使用。
5
- */
6
- export declare const projectFileManagerApi: FileManagerApi;
@@ -1,174 +0,0 @@
1
- /** 文件列表排序字段。 */
2
- export type FileSortBy = 'fileName' | 'fileType' | 'fileSize' | 'uploadTime';
3
- /** 项目文件或文件夹节点。 */
4
- export interface ProjectFile {
5
- /** 文件唯一标识。 */
6
- id: string;
7
- /** 是否为受保护文件。 */
8
- isSecure: boolean;
9
- /** 所属项目 ID。 */
10
- projectId: string;
11
- /** 子文件或子文件夹列表。 */
12
- children?: ProjectFile[];
13
- /** 父级文件夹 ID,根节点为空。 */
14
- parentId?: string | null;
15
- /** 文件名称。 */
16
- fileName: string;
17
- /** 文件展示或业务路径。 */
18
- filePath: string;
19
- /** 文件类型或扩展名。 */
20
- fileType: string;
21
- /** 文件大小,单位通常为字节。 */
22
- fileSize: number;
23
- /** 文件CRC32校验值。 */
24
- crc32: number;
25
- /** 是否有本地缓存。 */
26
- hasLocalCache?: boolean;
27
- /** 文件资源实际存储路径。 */
28
- fileResourcePath: string;
29
- /** 文件或文件夹备注。 */
30
- descs?: string;
31
- /** 上传人名称。 */
32
- uploaderName: string;
33
- /** 上传时间。 */
34
- uploadTime: Date;
35
- /** 创建时间。 */
36
- createTime: Date;
37
- /** 更新时间。 */
38
- updateTime: Date;
39
- /** 创建人 ID。 */
40
- createBy: string;
41
- /** 更新人 ID。 */
42
- updateBy: string;
43
- /** 层级,根节点为 0。 */
44
- level?: number;
45
- /** 本地文件唯一 ID:仅本地文件(从未上传)或服务器文件未同步修改时存在 */
46
- localId?: string;
47
- /** 是否为仅本地存在(从未上传到服务器) */
48
- isLocalOnly?: boolean;
49
- /** 是否有未同步的本地修改 */
50
- hasUnsyncedChanges?: boolean;
51
- /** 是否为合同附件链接文件(虚拟文件,仅支持查看和下载) */
52
- isContractLink?: boolean;
53
- /** 是否为虚拟合同文件夹(绿色置顶,显示名"合同",服务器名 __contracts__) */
54
- isVirtualContractFolder?: boolean;
55
- /** 是否为合同子文件夹(以合同名称命名的虚拟文件夹,不可重命名/删除/移动) */
56
- isContractSubfolder?: boolean;
57
- /** 关联合同是否已签约(仅合同相关虚拟节点存在;false 表示未签约,显示时弱化) */
58
- contractSigned?: boolean;
59
- /** 合同分类标签(仅合同相关虚拟节点存在;"按类型"排序时用于分组) */
60
- contractTag?: string;
61
- /** 是否为合同分类标签虚拟文件夹("按类型"排序时生成,位于合同文件夹一级) */
62
- isContractTagFolder?: boolean;
63
- }
64
- /** 项目成员角色(统一由 core 的 types/projectRole 提供,避免重复定义)。 */
65
- export { ProjectRole } from '../../types/projectRole';
66
- /** 文件接口通用响应形状。 */
67
- export interface FileManagerApiResponse<T = undefined> {
68
- code: number;
69
- message?: string;
70
- data?: T;
71
- }
72
- /** 新建文件/文件夹提交的数据。 */
73
- export interface FileManagerAddFileInput {
74
- fileName: string;
75
- filePath: string;
76
- isSecure?: boolean;
77
- descs?: string;
78
- fileType?: string;
79
- fileSize?: number;
80
- crc32?: number;
81
- fileResourcePath: string;
82
- }
83
- /** 移动/重命名提交的数据。 */
84
- export interface FileManagerMoveFileInput {
85
- oldFileName: string;
86
- oldFilePath: string;
87
- newFileName: string;
88
- newFilePath: string;
89
- }
90
- /** 文件夹打包下载任务状态。 */
91
- export type FolderDownloadStatus = 'pending' | 'success' | 'failed';
92
- /** 文件夹打包下载任务状态详情。 */
93
- export interface FolderDownloadJobStatus {
94
- jobId: string;
95
- status: FolderDownloadStatus;
96
- /** 打包成功后的下载地址(相对文件根路径) */
97
- url?: string;
98
- /** 下载文件名 */
99
- fileName?: string;
100
- /** 失败原因或提示 */
101
- message?: string;
102
- /** 下载地址过期时间戳(毫秒) */
103
- expireAt?: number;
104
- }
105
- /** 全量更新文件内容提交的数据。 */
106
- export interface FileManagerUpdateDataInput {
107
- fileId: string;
108
- fileSize?: number;
109
- crc32?: number;
110
- fileName: string;
111
- fileResourcePath: string;
112
- }
113
- /** 差分更新文件内容提交的数据。 */
114
- export interface FileManagerUpdateDeltaInput {
115
- fileId: string;
116
- deltaData: string;
117
- deltaSize: number;
118
- newFileSize: number;
119
- crc32?: number;
120
- }
121
- /**
122
- * 文件管理器数据接口适配器。
123
- * 默认实现为项目文件 API(见 projectFileManagerApi);
124
- * CRM 客户附件等场景注入自定义实现以复用同一套文件管理 UI。
125
- */
126
- export interface FileManagerApi {
127
- /** 获取文件列表,scopeId 为项目 ID 或客户 ID 等业务作用域 */
128
- listFiles: (scopeId: string) => Promise<FileManagerApiResponse<ProjectFile[]>>;
129
- /** 获取文件详情 */
130
- getDetail: (fileId: string) => Promise<FileManagerApiResponse<ProjectFile>>;
131
- /** 新建文件/文件夹 */
132
- addFile: (scopeId: string, data: FileManagerAddFileInput) => Promise<FileManagerApiResponse<{
133
- fileId: string;
134
- fileName: string;
135
- }>>;
136
- /** 删除文件/文件夹 */
137
- removeFile: (fileId: string) => Promise<FileManagerApiResponse<boolean>>;
138
- /** 移动/重命名 */
139
- moveFile: (scopeId: string, data: FileManagerMoveFileInput) => Promise<FileManagerApiResponse<string>>;
140
- /** 更新备注 */
141
- updateFileDescs: (data: {
142
- fileId: string;
143
- descs?: string;
144
- }) => Promise<FileManagerApiResponse<boolean>>;
145
- /** 全量更新文件内容 */
146
- updateFile: (data: FileManagerUpdateDataInput) => Promise<FileManagerApiResponse>;
147
- /** 差分更新文件内容;不提供时前端自动回退为全量上传 */
148
- updateFileDelta?: (data: FileManagerUpdateDeltaInput) => Promise<FileManagerApiResponse<string>>;
149
- /** 复制副本/复制到其他项目;不提供时隐藏相关入口 */
150
- copyFileToProject?: (scopeId: string, fileId: string) => Promise<FileManagerApiResponse<string>>;
151
- /** 生成临时访问令牌;不提供时隐藏「临时访问链接」入口 */
152
- generateTempAccessToken?: (fileId: string, expireSeconds: number) => Promise<FileManagerApiResponse<string>>;
153
- /** 发起文件夹异步打包下载(需管理权限);不提供时隐藏「下载文件夹」入口 */
154
- downloadFolder?: (scopeId: string, folderPath: string, folderName: string) => Promise<FileManagerApiResponse<{
155
- jobId: string;
156
- }>>;
157
- /** 查询文件夹打包下载任务状态;与 downloadFolder 同时提供时才启用下载文件夹 */
158
- getFolderDownloadStatus?: (jobId: string) => Promise<FileManagerApiResponse<FolderDownloadJobStatus>>;
159
- /** 判定当前用户是否具备管理能力(控制加密文件夹等入口),缺省视为 false */
160
- resolveIsManager?: (scopeId: string) => Promise<boolean>;
161
- }
162
- /** FileManager 功能开关:缺省全部开启(项目场景);CRM 等场景按需关闭。 */
163
- export interface FileManagerFeatures {
164
- /** 合同虚拟文件夹与合同附件联动,默认 true */
165
- contracts?: boolean;
166
- /** 移动/复制到其他项目(含复制副本),默认 true */
167
- moveCopyToProject?: boolean;
168
- /** 分享到微信,默认 true */
169
- shareToWechat?: boolean;
170
- /** 查看历史版本,默认 true */
171
- versionHistory?: boolean;
172
- /** 复制链接/在新窗口打开(指向 /filepreview 路由),默认 true */
173
- externalLink?: boolean;
174
- }
@@ -1,14 +0,0 @@
1
- /**
2
- * 文件差分计算 Web Worker
3
- *
4
- * 功能:
5
- * - 在 Worker 线程中执行 bsdiff 差分计算
6
- * - 定期向主线程报告计算进度
7
- * - 支持中止计算
8
- *
9
- * 使用方式:
10
- * const worker = new Worker(new URL('./fileDeltaWorker.ts', import.meta.url));
11
- * worker.postMessage({ type: 'computeDelta', oldBuffer, newBuffer });
12
- * worker.onmessage = (e) => { ... };
13
- */
14
- export {};
@@ -1,7 +0,0 @@
1
- import { ProjectFile, FileSortBy } from '../types';
2
- export declare const buildFileTree: (items: ProjectFile[]) => ProjectFile[];
3
- export declare const getDescendantIds: (item: ProjectFile, files: ProjectFile[]) => string[];
4
- export declare const getDescendantIdsOptimized: (item: ProjectFile, files: ProjectFile[]) => string[];
5
- export declare const getFileDescendants: (folder: ProjectFile, files: ProjectFile[]) => ProjectFile[];
6
- export declare const sortFiles: (files: ProjectFile[]) => ProjectFile[];
7
- export declare const sortTree: (items: ProjectFile[], by: FileSortBy, order: "asc" | "desc") => ProjectFile[];
@@ -1,60 +0,0 @@
1
- import type { FileManagerApi } from '../types';
2
- export declare const calculateCRC32: (file: File) => Promise<number>;
3
- export declare const getMimeType: (fileName: string) => string;
4
- export declare const sanitizeFileName: (fileName: string) => string;
5
- export declare const getFileExtension: (fileName: string) => string;
6
- export declare const stripFileExtension: (fileName: string) => string;
7
- export interface UploadFileResult {
8
- crc32: number;
9
- serverFileName: string;
10
- }
11
- export declare const uploadFileBlob: (blob: Blob, fileName: string, progress: (percent: number) => void, finish?: (success: boolean) => void) => Promise<UploadFileResult>;
12
- export declare const uploadMarkdownContent: (content: string, fileName: string, progress: (percent: number) => void, finish?: (success: boolean) => void) => Promise<UploadFileResult>;
13
- /**
14
- * 增量上传文件(通过bsdiff计算差异并压缩后上传)
15
- * 优化点:
16
- * 1. 文件大小预检查:超过10MB的文件直接完整上传
17
- * 2. Worker 线程:差分计算在 Worker 线程执行,防止主线程卡顿
18
- * 3. 实时进度显示:显示差分计算的各个阶段
19
- * 4. 超时回退机制:差分计算超过30秒自动回退到完整上传
20
- *
21
- * @param fileId 文件ID
22
- * @param fileName 文件名
23
- * @param oldBlob 旧文件Blob
24
- * @param newBlob 新文件Blob
25
- * @param progress 进度回调 (0-1)
26
- * @param finish 完成回调
27
- */
28
- export declare const uploadFileDelta: (fileId: string, fileName: string, oldBlob: Blob, newBlob: Blob, progress: (percent: number) => void, finish: (success: boolean) => void, forceFullUpload?: boolean,
29
- /**
30
- * 差分上传失败时的回调(如 CRC32 不匹配)。
31
- * 返回 true 表示确认全量上传,返回 false 表示取消。
32
- * 未提供时自动回退全量上传(默认行为)。
33
- */
34
- onDeltaFail?: (response: {
35
- code: number;
36
- message?: string;
37
- }) => Promise<boolean>,
38
- /**
39
- * 文件更新接口注入(CRM 等自定义数据源场景)。
40
- * 传入后若缺少 updateFileDelta,则视为不支持差分上传,强制走全量上传。
41
- */
42
- apis?: Pick<FileManagerApi, "updateFile" | "updateFileDelta">) => Promise<UploadFileResult>;
43
- /**
44
- * 增量上传 Markdown 内容
45
- * @param fileId 文件ID
46
- * @param oldContent 旧内容
47
- * @param newContent 新内容
48
- * @param progress 进度回调
49
- * @param finish 完成回调
50
- * @param forceFullUpload 是否强制全量上传(用于冲突覆盖场景)
51
- */
52
- export declare const uploadMarkdownDelta: (fileId: string, fileName: string, oldContent: string, newContent: string, progress: (percent: number) => void, finish: (success: boolean) => void, forceFullUpload?: boolean, onDeltaFail?: (response: {
53
- code: number;
54
- message?: string;
55
- }) => Promise<boolean>, apis?: Pick<FileManagerApi, "updateFile" | "updateFileDelta">) => Promise<UploadFileResult>;
56
- export interface DroppedFile {
57
- file: File;
58
- relativePath: string;
59
- }
60
- export declare const extractFilesFromDrop: (items: DataTransferItemList) => Promise<DroppedFile[]>;
@@ -1,10 +0,0 @@
1
- export declare const isEditableFileType: (fileName: string) => boolean;
2
- /** 虚拟合同文件夹的 ID(无真实服务器记录时使用) */
3
- export declare const CONTRACTS_VIRTUAL_FOLDER_ID = "__contracts_virtual__";
4
- /** 获取文件/文件夹的显示名称 */
5
- export declare const getDisplayName: (fileName: string, options?: {
6
- isVirtualContractFolder?: boolean;
7
- isContractSubfolder?: boolean;
8
- descs?: string;
9
- }) => string;
10
- export declare const formatFileSize: (bytes: number) => string;
@@ -1,43 +0,0 @@
1
- import React from 'react';
2
- /**
3
- * 发票类型
4
- */
5
- export declare enum InvoiceType {
6
- /** 其他 */
7
- 其他 = "\u5176\u4ED6",
8
- /** 增值税普通发票 */
9
- 增值税普通发票 = "\u200C\u589E\u503C\u7A0E\u666E\u901A\u53D1\u7968",
10
- /** 增值税专用发票 */
11
- 增值税专用发票 = "\u200C\u589E\u503C\u7A0E\u4E13\u7528\u53D1\u7968",
12
- /** 国有金融、保险、邮政、电信、铁路、航空、存单等 */
13
- 专业发票 = "\u4E13\u4E1A\u53D1\u7968",
14
- /** 机动车销售统一发票 */
15
- 机动车发票 = "\u673A\u52A8\u8F66\u53D1\u7968",
16
- /** 二手车销售统一发票 */
17
- 二手车发票 = "\u4E8C\u624B\u8F66\u53D1\u7968"
18
- }
19
- /**
20
- * 发票状态
21
- */
22
- export declare enum ApprovalInvoiceStatus {
23
- /** 已报销 */
24
- 已报销 = "\u5DF2\u62A5\u9500",
25
- /** 待报销 */
26
- 待报销 = "\u5F85\u62A5\u9500",
27
- /** 作废 */
28
- 作废 = "\u4F5C\u5E9F"
29
- }
30
- /** 发票 API —— 由使用方注入(approval 模块的 approver.approvalinvoice),避免 core 依赖模块专属 API */
31
- export interface InvoiceRecordsApi {
32
- getInvoiceListByProject: (params: any) => Promise<any>;
33
- getInvoiceList: (params: any) => Promise<any>;
34
- updateInvoice: (data: any) => Promise<any>;
35
- }
36
- interface InvoiceRecordsListProps {
37
- /** 项目ID:传入时仅展示该项目关联的发票记录(项目“费用”页签使用),不传则展示全部发票记录 */
38
- projectId?: string;
39
- /** 发票接口实现,由壳层/模块注入 */
40
- invoiceApi: InvoiceRecordsApi;
41
- }
42
- export declare const InvoiceRecordsList: React.FC<InvoiceRecordsListProps>;
43
- export {};