@spacecorexdev/core 0.0.5 → 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 -0
- package/dist/contract.js +1 -0
- package/dist/hooks/index.js +1 -0
- package/dist/index.js +7 -0
- package/{src → dist}/styles/ant-table.css +5 -26
- package/{src → dist}/styles/index.css +8 -8
- package/dist/types/index.js +1 -0
- package/dist/ui/index.js +1 -0
- package/dist/utils/index.js +7 -0
- package/package.json +67 -70
- package/types/api/project.d.ts +10 -1
- package/types/index.d.ts +4 -4
- package/types/types/index.d.ts +1 -3
- package/types/types/project/base.d.ts +6 -1
- package/types/types/project/index.d.ts +1 -0
- package/types/types/project/member.d.ts +1 -1
- package/types/types/{projectRole.d.ts → project/projectRole.d.ts} +2 -2
- package/types/ui/ResizableTable/index.d.ts +7 -0
- package/types/ui/RoleSelector/index.d.ts +7 -1
- package/types/ui/UIFileUpload.d.ts +2 -2
- package/types/ui/index.d.ts +1 -10
- package/types/ui/upload/index.d.ts +6 -0
- package/types/utils/CacheIndexedDB.d.ts +9 -0
- package/types/utils/index.d.ts +2 -2
- package/types/utils/mailto.d.ts +12 -0
- package/public/cmaps/78-EUC-H.bcmap +0 -0
- package/public/cmaps/78-EUC-V.bcmap +0 -0
- package/public/cmaps/78-H.bcmap +0 -0
- package/public/cmaps/78-RKSJ-H.bcmap +0 -0
- package/public/cmaps/78-RKSJ-V.bcmap +0 -0
- package/public/cmaps/78-V.bcmap +0 -0
- package/public/cmaps/78ms-RKSJ-H.bcmap +0 -0
- package/public/cmaps/78ms-RKSJ-V.bcmap +0 -0
- package/public/cmaps/83pv-RKSJ-H.bcmap +0 -0
- package/public/cmaps/90ms-RKSJ-H.bcmap +0 -0
- package/public/cmaps/90ms-RKSJ-V.bcmap +0 -0
- package/public/cmaps/90msp-RKSJ-H.bcmap +0 -0
- package/public/cmaps/90msp-RKSJ-V.bcmap +0 -0
- package/public/cmaps/90pv-RKSJ-H.bcmap +0 -0
- package/public/cmaps/90pv-RKSJ-V.bcmap +0 -0
- package/public/cmaps/Add-H.bcmap +0 -0
- package/public/cmaps/Add-RKSJ-H.bcmap +0 -0
- package/public/cmaps/Add-RKSJ-V.bcmap +0 -0
- package/public/cmaps/Add-V.bcmap +0 -0
- package/public/cmaps/Adobe-CNS1-0.bcmap +0 -0
- package/public/cmaps/Adobe-CNS1-1.bcmap +0 -0
- package/public/cmaps/Adobe-CNS1-2.bcmap +0 -0
- package/public/cmaps/Adobe-CNS1-3.bcmap +0 -0
- package/public/cmaps/Adobe-CNS1-4.bcmap +0 -0
- package/public/cmaps/Adobe-CNS1-5.bcmap +0 -0
- package/public/cmaps/Adobe-CNS1-6.bcmap +0 -0
- package/public/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
- package/public/cmaps/Adobe-GB1-0.bcmap +0 -0
- package/public/cmaps/Adobe-GB1-1.bcmap +0 -0
- package/public/cmaps/Adobe-GB1-2.bcmap +0 -0
- package/public/cmaps/Adobe-GB1-3.bcmap +0 -0
- package/public/cmaps/Adobe-GB1-4.bcmap +0 -0
- package/public/cmaps/Adobe-GB1-5.bcmap +0 -0
- package/public/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
- package/public/cmaps/Adobe-Japan1-0.bcmap +0 -0
- package/public/cmaps/Adobe-Japan1-1.bcmap +0 -0
- package/public/cmaps/Adobe-Japan1-2.bcmap +0 -0
- package/public/cmaps/Adobe-Japan1-3.bcmap +0 -0
- package/public/cmaps/Adobe-Japan1-4.bcmap +0 -0
- package/public/cmaps/Adobe-Japan1-5.bcmap +0 -0
- package/public/cmaps/Adobe-Japan1-6.bcmap +0 -0
- package/public/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
- package/public/cmaps/Adobe-Korea1-0.bcmap +0 -0
- package/public/cmaps/Adobe-Korea1-1.bcmap +0 -0
- package/public/cmaps/Adobe-Korea1-2.bcmap +0 -0
- package/public/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
- package/public/cmaps/B5-H.bcmap +0 -0
- package/public/cmaps/B5-V.bcmap +0 -0
- package/public/cmaps/B5pc-H.bcmap +0 -0
- package/public/cmaps/B5pc-V.bcmap +0 -0
- package/public/cmaps/CNS-EUC-H.bcmap +0 -0
- package/public/cmaps/CNS-EUC-V.bcmap +0 -0
- package/public/cmaps/CNS1-H.bcmap +0 -0
- package/public/cmaps/CNS1-V.bcmap +0 -0
- package/public/cmaps/CNS2-H.bcmap +0 -0
- package/public/cmaps/CNS2-V.bcmap +0 -3
- package/public/cmaps/ETHK-B5-H.bcmap +0 -0
- package/public/cmaps/ETHK-B5-V.bcmap +0 -0
- package/public/cmaps/ETen-B5-H.bcmap +0 -0
- package/public/cmaps/ETen-B5-V.bcmap +0 -0
- package/public/cmaps/ETenms-B5-H.bcmap +0 -3
- package/public/cmaps/ETenms-B5-V.bcmap +0 -0
- package/public/cmaps/EUC-H.bcmap +0 -0
- package/public/cmaps/EUC-V.bcmap +0 -0
- package/public/cmaps/Ext-H.bcmap +0 -0
- package/public/cmaps/Ext-RKSJ-H.bcmap +0 -0
- package/public/cmaps/Ext-RKSJ-V.bcmap +0 -0
- package/public/cmaps/Ext-V.bcmap +0 -0
- package/public/cmaps/GB-EUC-H.bcmap +0 -0
- package/public/cmaps/GB-EUC-V.bcmap +0 -0
- package/public/cmaps/GB-H.bcmap +0 -4
- package/public/cmaps/GB-V.bcmap +0 -0
- package/public/cmaps/GBK-EUC-H.bcmap +0 -0
- package/public/cmaps/GBK-EUC-V.bcmap +0 -0
- package/public/cmaps/GBK2K-H.bcmap +0 -0
- package/public/cmaps/GBK2K-V.bcmap +0 -0
- package/public/cmaps/GBKp-EUC-H.bcmap +0 -0
- package/public/cmaps/GBKp-EUC-V.bcmap +0 -0
- package/public/cmaps/GBT-EUC-H.bcmap +0 -0
- package/public/cmaps/GBT-EUC-V.bcmap +0 -0
- package/public/cmaps/GBT-H.bcmap +0 -0
- package/public/cmaps/GBT-V.bcmap +0 -0
- package/public/cmaps/GBTpc-EUC-H.bcmap +0 -0
- package/public/cmaps/GBTpc-EUC-V.bcmap +0 -0
- package/public/cmaps/GBpc-EUC-H.bcmap +0 -0
- package/public/cmaps/GBpc-EUC-V.bcmap +0 -0
- package/public/cmaps/H.bcmap +0 -0
- package/public/cmaps/HKdla-B5-H.bcmap +0 -0
- package/public/cmaps/HKdla-B5-V.bcmap +0 -0
- package/public/cmaps/HKdlb-B5-H.bcmap +0 -0
- package/public/cmaps/HKdlb-B5-V.bcmap +0 -0
- package/public/cmaps/HKgccs-B5-H.bcmap +0 -0
- package/public/cmaps/HKgccs-B5-V.bcmap +0 -0
- package/public/cmaps/HKm314-B5-H.bcmap +0 -0
- package/public/cmaps/HKm314-B5-V.bcmap +0 -0
- package/public/cmaps/HKm471-B5-H.bcmap +0 -0
- package/public/cmaps/HKm471-B5-V.bcmap +0 -0
- package/public/cmaps/HKscs-B5-H.bcmap +0 -0
- package/public/cmaps/HKscs-B5-V.bcmap +0 -0
- package/public/cmaps/Hankaku.bcmap +0 -0
- package/public/cmaps/Hiragana.bcmap +0 -0
- package/public/cmaps/KSC-EUC-H.bcmap +0 -0
- package/public/cmaps/KSC-EUC-V.bcmap +0 -0
- package/public/cmaps/KSC-H.bcmap +0 -0
- package/public/cmaps/KSC-Johab-H.bcmap +0 -0
- package/public/cmaps/KSC-Johab-V.bcmap +0 -0
- package/public/cmaps/KSC-V.bcmap +0 -0
- package/public/cmaps/KSCms-UHC-H.bcmap +0 -0
- package/public/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
- package/public/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
- package/public/cmaps/KSCms-UHC-V.bcmap +0 -0
- package/public/cmaps/KSCpc-EUC-H.bcmap +0 -0
- package/public/cmaps/KSCpc-EUC-V.bcmap +0 -0
- package/public/cmaps/Katakana.bcmap +0 -0
- package/public/cmaps/LICENSE +0 -36
- package/public/cmaps/NWP-H.bcmap +0 -0
- package/public/cmaps/NWP-V.bcmap +0 -0
- package/public/cmaps/RKSJ-H.bcmap +0 -0
- package/public/cmaps/RKSJ-V.bcmap +0 -0
- package/public/cmaps/Roman.bcmap +0 -0
- package/public/cmaps/UniCNS-UCS2-H.bcmap +0 -0
- package/public/cmaps/UniCNS-UCS2-V.bcmap +0 -0
- package/public/cmaps/UniCNS-UTF16-H.bcmap +0 -0
- package/public/cmaps/UniCNS-UTF16-V.bcmap +0 -0
- package/public/cmaps/UniCNS-UTF32-H.bcmap +0 -0
- package/public/cmaps/UniCNS-UTF32-V.bcmap +0 -0
- package/public/cmaps/UniCNS-UTF8-H.bcmap +0 -0
- package/public/cmaps/UniCNS-UTF8-V.bcmap +0 -0
- package/public/cmaps/UniGB-UCS2-H.bcmap +0 -0
- package/public/cmaps/UniGB-UCS2-V.bcmap +0 -0
- package/public/cmaps/UniGB-UTF16-H.bcmap +0 -0
- package/public/cmaps/UniGB-UTF16-V.bcmap +0 -0
- package/public/cmaps/UniGB-UTF32-H.bcmap +0 -0
- package/public/cmaps/UniGB-UTF32-V.bcmap +0 -0
- package/public/cmaps/UniGB-UTF8-H.bcmap +0 -0
- package/public/cmaps/UniGB-UTF8-V.bcmap +0 -0
- package/public/cmaps/UniJIS-UCS2-H.bcmap +0 -0
- package/public/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
- package/public/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
- package/public/cmaps/UniJIS-UCS2-V.bcmap +0 -0
- package/public/cmaps/UniJIS-UTF16-H.bcmap +0 -0
- package/public/cmaps/UniJIS-UTF16-V.bcmap +0 -0
- package/public/cmaps/UniJIS-UTF32-H.bcmap +0 -0
- package/public/cmaps/UniJIS-UTF32-V.bcmap +0 -0
- package/public/cmaps/UniJIS-UTF8-H.bcmap +0 -0
- package/public/cmaps/UniJIS-UTF8-V.bcmap +0 -0
- package/public/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
- package/public/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
- package/public/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
- package/public/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
- package/public/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
- package/public/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
- package/public/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
- package/public/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
- package/public/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
- package/public/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
- package/public/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
- package/public/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
- package/public/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
- package/public/cmaps/UniKS-UCS2-H.bcmap +0 -0
- package/public/cmaps/UniKS-UCS2-V.bcmap +0 -0
- package/public/cmaps/UniKS-UTF16-H.bcmap +0 -0
- package/public/cmaps/UniKS-UTF16-V.bcmap +0 -0
- package/public/cmaps/UniKS-UTF32-H.bcmap +0 -0
- package/public/cmaps/UniKS-UTF32-V.bcmap +0 -0
- package/public/cmaps/UniKS-UTF8-H.bcmap +0 -0
- package/public/cmaps/UniKS-UTF8-V.bcmap +0 -0
- package/public/cmaps/V.bcmap +0 -0
- package/public/cmaps/WP-Symbol.bcmap +0 -0
- package/public/polyfills/polyfills.js +0 -802
- package/public/vendor/docx/docx.worker.js +0 -5
- package/public/vendor/docx/jszip.min.js +0 -13
- package/public/vendor/libarchive/libarchive.wasm +0 -0
- package/public/vendor/libarchive/worker-bundle.js +0 -6
- package/public/vendor/pptx/pptx.worker.js +0 -26
- package/public/wasm/cad/0.8.2/dwfv-render.wasm +0 -0
- package/public/wasm/cad/0.8.2/dwg-worker.js +0 -24
- package/public/wasm/cad/0.8.2/dwg-worker.js.map +0 -1
- package/public/wasm/cad/0.8.2/libredwg-web.js +0 -2
- package/public/wasm/cad/0.8.2/libredwg-web.wasm +0 -0
- package/public/wasm/cad/dwfv-render.wasm +0 -0
- package/public/wasm/cad/dwg-worker.js +0 -24
- package/public/wasm/cad/dwg-worker.js.map +0 -1
- package/public/wasm/cad/libredwg-web.js +0 -2
- package/public/wasm/cad/libredwg-web.wasm +0 -0
- package/public/wasm/data/sql-wasm.wasm +0 -0
- package/public/wasm/hdiff.wasm +0 -0
- package/public/wasm/model/LICENSE.occt-import-js.txt +0 -504
- package/public/wasm/model/LICENSE.occt.txt +0 -502
- package/public/wasm/model/occt-import-js.js +0 -19
- package/public/wasm/model/occt-import-js.wasm +0 -0
- package/public/wasm/model/occt-worker.js +0 -83
- package/public/wasm/typst/fonts/DejaVuSansMono-Bold.ttf +0 -0
- package/public/wasm/typst/fonts/DejaVuSansMono-BoldOblique.ttf +0 -0
- package/public/wasm/typst/fonts/DejaVuSansMono-Oblique.ttf +0 -0
- package/public/wasm/typst/fonts/DejaVuSansMono.ttf +0 -0
- package/public/wasm/typst/fonts/LibertinusSerif-Bold.otf +0 -0
- package/public/wasm/typst/fonts/LibertinusSerif-BoldItalic.otf +0 -0
- package/public/wasm/typst/fonts/LibertinusSerif-Italic.otf +0 -0
- package/public/wasm/typst/fonts/LibertinusSerif-Regular.otf +0 -0
- package/public/wasm/typst/fonts/LibertinusSerif-Semibold.otf +0 -0
- package/public/wasm/typst/fonts/LibertinusSerif-SemiboldItalic.otf +0 -0
- package/public/wasm/typst/fonts/NewCM10-Bold.otf +0 -0
- package/public/wasm/typst/fonts/NewCM10-BoldItalic.otf +0 -0
- package/public/wasm/typst/fonts/NewCM10-Italic.otf +0 -0
- package/public/wasm/typst/fonts/NewCM10-Regular.otf +0 -0
- package/public/wasm/typst/fonts/NewCMMath-Bold.otf +0 -0
- package/public/wasm/typst/fonts/NewCMMath-Book.otf +0 -0
- package/public/wasm/typst/fonts/NewCMMath-Regular.otf +0 -0
- package/public/wasm/typst/fonts/README.md +0 -7
- package/public/wasm/typst/typst_ts_renderer_bg.wasm +0 -0
- package/public/wasm/typst/typst_ts_web_compiler_bg.wasm +0 -0
- package/scripts/patch-docx-grid.cjs +0 -412
- package/src/api/_base.ts +0 -243
- package/src/api/index.ts +0 -17
- package/src/api/project.ts +0 -1345
- package/src/api/user.ts +0 -1174
- package/src/contract.ts +0 -50
- package/src/hooks/index.ts +0 -2
- package/src/hooks/useLongPress.ts +0 -137
- package/src/hooks/useOnlineStatus.ts +0 -22
- package/src/index.ts +0 -14
- package/src/types/id.ts +0 -2
- package/src/types/index.ts +0 -5
- package/src/types/project/base.ts +0 -63
- package/src/types/project/contract.ts +0 -79
- package/src/types/project/contractStatus.tsx +0 -15
- package/src/types/project/index.ts +0 -5
- package/src/types/project/member.ts +0 -46
- package/src/types/project/progress.ts +0 -43
- package/src/types/projectRole.ts +0 -17
- package/src/types/theme.ts +0 -1
- package/src/types/user/index.ts +0 -1
- package/src/types/user/role.ts +0 -7
- package/src/ui/CommentTimeline/index.tsx +0 -330
- package/src/ui/FileManager/FileContextMenu.tsx +0 -628
- package/src/ui/FileManager/FileGridView.tsx +0 -529
- package/src/ui/FileManager/FileTableView.tsx +0 -405
- package/src/ui/FileManager/FileToolbar.tsx +0 -119
- package/src/ui/FileManager/FileVersionHistoryModal.tsx +0 -175
- package/src/ui/FileManager/MoveCopyToProjectModal.tsx +0 -119
- package/src/ui/FileManager/ShareToWechatModal.tsx +0 -419
- package/src/ui/FileManager/hooks/useFileManagerActions.ts +0 -2532
- package/src/ui/FileManager/hooks/useFileManagerState.ts +0 -419
- package/src/ui/FileManager/index.tsx +0 -580
- package/src/ui/FileManager/projectFileManagerApi.ts +0 -57
- package/src/ui/FileManager/types.ts +0 -184
- package/src/ui/FileManager/utils/fileDeltaWorker.ts +0 -193
- package/src/ui/FileManager/utils/fileTree.ts +0 -178
- package/src/ui/FileManager/utils/fileUpload.ts +0 -714
- package/src/ui/FileManager/utils/fileUtils.ts +0 -65
- package/src/ui/InvoiceRecordsList/index.tsx +0 -813
- package/src/ui/MyFileSelectorModal.tsx +0 -261
- package/src/ui/ProjectSelector/index.tsx +0 -472
- package/src/ui/ProjectSelector/projectCache.ts +0 -40
- package/src/ui/RoleSelector/index.tsx +0 -473
- package/src/ui/RoleSelector/roleCache.ts +0 -40
- package/src/ui/UIAlert.tsx +0 -399
- package/src/ui/UIAlertExample.tsx +0 -129
- package/src/ui/UIConfirm.tsx +0 -335
- package/src/ui/UIConfirmExample.tsx +0 -165
- package/src/ui/UIDatePicker.tsx +0 -146
- package/src/ui/UIDateRangePicker.tsx +0 -38
- package/src/ui/UIFilePreview/ExcelEditor/index.tsx +0 -617
- package/src/ui/UIFilePreview/ExcelEditor/types.ts +0 -24
- package/src/ui/UIFilePreview/ExportDropdown.css +0 -85
- package/src/ui/UIFilePreview/ExportDropdown.tsx +0 -109
- package/src/ui/UIFilePreview/IndexedDBUtils.ts +0 -564
- package/src/ui/UIFilePreview/MarkdownEditor/exportMarkdownPdf.ts +0 -576
- package/src/ui/UIFilePreview/MarkdownEditor/index.tsx +0 -677
- package/src/ui/UIFilePreview/MarkdownEditor/markdownEditor.css +0 -1005
- package/src/ui/UIFilePreview/MarkdownEditor/types.ts +0 -15
- package/src/ui/UIFilePreview/PPTXEditor/index.tsx +0 -602
- package/src/ui/UIFilePreview/RichDocEditor/exportRDocMarkdown.ts +0 -77
- package/src/ui/UIFilePreview/RichDocEditor/exportRDocPdf.ts +0 -374
- package/src/ui/UIFilePreview/RichDocEditor/index.tsx +0 -730
- package/src/ui/UIFilePreview/RichDocEditor/richdoc-editor.css +0 -59
- package/src/ui/UIFilePreview/UIFilePreview.tsx +0 -611
- package/src/ui/UIFilePreview/WordEditor/index.tsx +0 -3933
- package/src/ui/UIFilePreview/WordEditor/style.ts +0 -1213
- package/src/ui/UIFilePreview/WordEditor/word-editor.css +0 -999
- package/src/ui/UIFilePreview/filePreview.css +0 -193
- package/src/ui/UIFilePreview/filetypes/archive.tsx +0 -66
- package/src/ui/UIFilePreview/filetypes/cad.tsx +0 -287
- package/src/ui/UIFilePreview/filetypes/excel.tsx +0 -355
- package/src/ui/UIFilePreview/filetypes/image.tsx +0 -20
- package/src/ui/UIFilePreview/filetypes/imageLoader.ts +0 -63
- package/src/ui/UIFilePreview/filetypes/pdf.tsx +0 -156
- package/src/ui/UIFilePreview/filetypes/ppt.tsx +0 -535
- package/src/ui/UIFilePreview/filetypes/pptExportPdf.ts +0 -523
- package/src/ui/UIFilePreview/filetypes/video.tsx +0 -482
- package/src/ui/UIFilePreview/filetypes/word.tsx +0 -245
- package/src/ui/UIFilePreview/filetypes/wordExportMarkdown.ts +0 -86
- package/src/ui/UIFilePreview/filetypes/wordExportPdf.tsx +0 -427
- package/src/ui/UIFilePreview/index.ts +0 -35
- package/src/ui/UIFilePreview/pdfPagination.ts +0 -143
- package/src/ui/UIFilePreview/previewUtils.tsx +0 -531
- package/src/ui/UIFileUpload.tsx +0 -382
- package/src/ui/UIImageUpload.tsx +0 -195
- package/src/ui/UILoading.tsx +0 -255
- package/src/ui/UILoadingExample.tsx +0 -139
- package/src/ui/UISelect.tsx +0 -105
- package/src/ui/UIToast.tsx +0 -381
- package/src/ui/UIToastExample.tsx +0 -69
- package/src/ui/UIToastSingle.tsx +0 -279
- package/src/ui/UIViewToggle.tsx +0 -64
- package/src/ui/UserSelector/index.tsx +0 -583
- package/src/ui/index.ts +0 -84
- package/src/ui/upload/image.ts +0 -135
- package/src/ui/upload/index.ts +0 -73
- package/src/ui/upload/submitFile.ts +0 -106
- package/src/ui/upload/submitForm.ts +0 -124
- package/src/ui/upload/upload.err.ts +0 -15
- package/src/ui/upload/upload.ts +0 -250
- package/src/utils/CacheDepartmentInfo.ts +0 -372
- package/src/utils/CacheFileContent.ts +0 -315
- package/src/utils/CachePermissionInfo.ts +0 -235
- package/src/utils/CacheRoleInfo.ts +0 -303
- package/src/utils/CacheUserInfo.ts +0 -818
- package/src/utils/CacheViewToggleInfo.ts +0 -182
- package/src/utils/MessageContentUtils.ts +0 -268
- package/src/utils/clipboard.ts +0 -70
- package/src/utils/companyEmail.ts +0 -19
- package/src/utils/forbidDebugger.ts +0 -59
- package/src/utils/formatters.ts +0 -94
- package/src/utils/htmlUtils.tsx +0 -59
- package/src/utils/index.ts +0 -18
- package/src/utils/keyboard.ts +0 -114
- package/src/utils/mammothApi.ts +0 -16
- package/src/utils/polyfills.ts +0 -928
- package/src/utils/regex.ts +0 -14
- package/src/utils/storage.ts +0 -95
- package/src/utils/workerBootstrap.ts +0 -87
- package/types/hooks.d.ts +0 -5
- 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 -178
- 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 -26
- 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 -39
- 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 -81
- 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
- /package/{src → dist}/styles/ant-modal.css +0 -0
- /package/{src → dist}/styles/ant-spin.css +0 -0
|
@@ -1,535 +0,0 @@
|
|
|
1
|
-
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
-
import { message } from 'antd';
|
|
3
|
-
import { PptxViewer } from '@file-viewer/pptx';
|
|
4
|
-
import { withPolyfillWorkerBootstrap } from '../../../utils/workerBootstrap';
|
|
5
|
-
import { exportPptxPdf } from './pptExportPdf';
|
|
6
|
-
import { ExportDropdown } from '../ExportDropdown';
|
|
7
|
-
import { downloadBlob } from '../previewUtils';
|
|
8
|
-
|
|
9
|
-
export interface PptPreviewProps {
|
|
10
|
-
file: File | null;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const PptPreview: React.FC<PptPreviewProps> = ({ file }) => {
|
|
14
|
-
const [isLoading, setIsLoading] = useState(true);
|
|
15
|
-
const [hasError, setHasError] = useState(false);
|
|
16
|
-
const [reloadTick, setReloadTick] = useState(0);
|
|
17
|
-
const [exporting, setExporting] = useState(false);
|
|
18
|
-
// 大文件加载反馈:
|
|
19
|
-
// - stage='parsing':worker 正在解压/解析 PPTX(大文件此阶段可能持续很久且此前只有转圈)
|
|
20
|
-
// - parsePercent:worker 上报的解析进度(0-100),parsedSlides:已解析幻灯片序号
|
|
21
|
-
// - stage='rendering':解析完成后等待首页幻灯片渲染出来
|
|
22
|
-
const [stage, setStage] = useState<'parsing' | 'rendering'>('parsing');
|
|
23
|
-
const [parsePercent, setParsePercent] = useState(0);
|
|
24
|
-
const [parsedSlides, setParsedSlides] = useState(0);
|
|
25
|
-
const [renderedSlides, setRenderedSlides] = useState(0);
|
|
26
|
-
const [totalSlides, setTotalSlides] = useState(0);
|
|
27
|
-
|
|
28
|
-
// 离屏重新以 1:1 尺寸渲染全部幻灯片后逐页光栅化,直接下载 PDF(无打印对话框)。
|
|
29
|
-
const handleExportPdf = useCallback(async () => {
|
|
30
|
-
if (!file) {
|
|
31
|
-
message.warning('文档尚未加载完成,请稍后再试');
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
setExporting(true);
|
|
35
|
-
message.loading({ key: 'ppt-export-pdf', content: '正在准备演示文稿…', duration: 0 });
|
|
36
|
-
try {
|
|
37
|
-
await exportPptxPdf({
|
|
38
|
-
file,
|
|
39
|
-
fileName: file.name,
|
|
40
|
-
onProgress: (page, total) => {
|
|
41
|
-
message.loading({ key: 'ppt-export-pdf', content: `正在导出第 ${page} / ${total} 页…`, duration: 0 });
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
} catch (error) {
|
|
45
|
-
console.error('PPT 导出 PDF 失败:', error);
|
|
46
|
-
message.error(`导出 PDF 失败:${(error as Error)?.message || '请重试'}`);
|
|
47
|
-
} finally {
|
|
48
|
-
message.destroy('ppt-export-pdf');
|
|
49
|
-
setExporting(false);
|
|
50
|
-
}
|
|
51
|
-
}, [file]);
|
|
52
|
-
|
|
53
|
-
// 下载原始文件:只读预览拿到的 File 就是原始文件
|
|
54
|
-
const handleDownload = useCallback(() => {
|
|
55
|
-
if (!file) return;
|
|
56
|
-
downloadBlob(file, file.name);
|
|
57
|
-
}, [file]);
|
|
58
|
-
|
|
59
|
-
const scrollContainerRef = useRef<HTMLDivElement>(null);
|
|
60
|
-
const targetRef = useRef<HTMLDivElement>(null);
|
|
61
|
-
const viewerRef = useRef<PptxViewer | null>(null);
|
|
62
|
-
const slideSizeRef = useRef<{ width?: number; height?: number } | null>(null);
|
|
63
|
-
const fittedRef = useRef(false);
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* 单页显示:只让"视觉中心最接近容器中心"的 slide 可见,
|
|
67
|
-
* 其余 slide 一律 opacity:0(由 CSS 控制)。滚动/键盘翻页时随滚动实时切换,
|
|
68
|
-
* 配合 CSS opacity 过渡形成翻页淡入淡出,任何窗口比例下都只看到一页。
|
|
69
|
-
* 注意:导出 PDF 使用独立离屏渲染器,其 slide 不在 .ppt-scroll-container 内,
|
|
70
|
-
* 不受这里的 class 影响。
|
|
71
|
-
*/
|
|
72
|
-
const updateActiveSlide = useCallback(() => {
|
|
73
|
-
const container = scrollContainerRef.current;
|
|
74
|
-
if (!container) return;
|
|
75
|
-
const slides = Array.from(
|
|
76
|
-
container.querySelectorAll<HTMLElement>('.flyfish-pptx-content .slide'),
|
|
77
|
-
);
|
|
78
|
-
if (slides.length === 0) return;
|
|
79
|
-
|
|
80
|
-
const viewportCenter =
|
|
81
|
-
container.getBoundingClientRect().top + container.clientHeight / 2;
|
|
82
|
-
|
|
83
|
-
let activeIndex = 0;
|
|
84
|
-
let closestDist = Number.POSITIVE_INFINITY;
|
|
85
|
-
slides.forEach((slide, i) => {
|
|
86
|
-
const r = slide.getBoundingClientRect();
|
|
87
|
-
const d = Math.abs(r.top + r.height / 2 - viewportCenter);
|
|
88
|
-
if (d < closestDist) {
|
|
89
|
-
closestDist = d;
|
|
90
|
-
activeIndex = i;
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
slides.forEach((slide, i) => {
|
|
95
|
-
slide.classList.toggle('ppt-slide-active', i === activeIndex);
|
|
96
|
-
});
|
|
97
|
-
}, []);
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* 让幻灯片完整显示在可视区域内(contain 模式),并给每个 slide 加间距
|
|
101
|
-
* 让它们一页一页排列:每页视觉高度 = 100dvh,slide 在页内居中。
|
|
102
|
-
*/
|
|
103
|
-
const layoutSlides = useCallback(async () => {
|
|
104
|
-
const viewer = viewerRef.current;
|
|
105
|
-
const container = scrollContainerRef.current;
|
|
106
|
-
const size = slideSizeRef.current;
|
|
107
|
-
if (!viewer || !container || !size) return;
|
|
108
|
-
|
|
109
|
-
const slideW = size.width ?? 1;
|
|
110
|
-
const slideH = size.height ?? 1;
|
|
111
|
-
|
|
112
|
-
// contain 模式缩放比
|
|
113
|
-
const scaleW = container.clientWidth / slideW;
|
|
114
|
-
const scaleH = container.clientHeight / slideH;
|
|
115
|
-
const scale = Math.min(scaleW, scaleH);
|
|
116
|
-
await viewer.setZoom(scale * 100);
|
|
117
|
-
|
|
118
|
-
// 每页的"布局高度"(content 坐标系里的像素)= 100dvh / scale
|
|
119
|
-
// 这样乘以 transform:scale 后视觉高度正好是 100dvh
|
|
120
|
-
const layoutPageHeight = container.clientHeight / scale;
|
|
121
|
-
|
|
122
|
-
// 等 viewer resize() 完成,再设 margin
|
|
123
|
-
requestAnimationFrame(() => {
|
|
124
|
-
const slides = Array.from(container.querySelectorAll('.flyfish-pptx-content .slide')) as HTMLElement[];
|
|
125
|
-
slides.forEach((slide) => {
|
|
126
|
-
const gap = Math.max(0, layoutPageHeight - slideH);
|
|
127
|
-
// 居中:前面加半个 gap,后面加半个 gap
|
|
128
|
-
slide.style.marginTop = `${gap / 2}px`;
|
|
129
|
-
slide.style.marginBottom = `${gap / 2}px`;
|
|
130
|
-
slide.style.marginLeft = 'auto';
|
|
131
|
-
slide.style.marginRight = 'auto';
|
|
132
|
-
});
|
|
133
|
-
// 间距生效后重新判定当前可见页
|
|
134
|
-
updateActiveSlide();
|
|
135
|
-
});
|
|
136
|
-
}, [updateActiveSlide]);
|
|
137
|
-
|
|
138
|
-
useEffect(() => {
|
|
139
|
-
let disposed = false;
|
|
140
|
-
|
|
141
|
-
const mount = async () => {
|
|
142
|
-
if (!file || !targetRef.current || !scrollContainerRef.current) return;
|
|
143
|
-
|
|
144
|
-
setIsLoading(true);
|
|
145
|
-
setHasError(false);
|
|
146
|
-
setStage('parsing');
|
|
147
|
-
setParsePercent(0);
|
|
148
|
-
setParsedSlides(0);
|
|
149
|
-
setRenderedSlides(0);
|
|
150
|
-
setTotalSlides(0);
|
|
151
|
-
fittedRef.current = false;
|
|
152
|
-
slideSizeRef.current = null;
|
|
153
|
-
scrollContainerRef.current.scrollTop = 0;
|
|
154
|
-
|
|
155
|
-
try {
|
|
156
|
-
const buffer = await file.arrayBuffer();
|
|
157
|
-
if (disposed) return;
|
|
158
|
-
|
|
159
|
-
const viewer = await PptxViewer.open(buffer, targetRef.current, {
|
|
160
|
-
fitMode: 'none',
|
|
161
|
-
workerType: 'classic',
|
|
162
|
-
workerUrl: withPolyfillWorkerBootstrap('/vendor/pptx/pptx.worker.js'),
|
|
163
|
-
lazySlides: false,
|
|
164
|
-
listOptions: undefined,
|
|
165
|
-
// worker 每解析完一页幻灯片上报一次:progress 为 0-100,
|
|
166
|
-
// message 形如 { type:'progress-update', slide_num, data }
|
|
167
|
-
onProgress: (progress: number, message: unknown) => {
|
|
168
|
-
if (disposed) return;
|
|
169
|
-
setParsePercent(Math.min(100, Math.max(0, Math.floor(progress))));
|
|
170
|
-
const slideNum = (message as { slide_num?: number } | null)?.slide_num;
|
|
171
|
-
if (typeof slideNum === 'number') {
|
|
172
|
-
setParsedSlides(slideNum);
|
|
173
|
-
}
|
|
174
|
-
},
|
|
175
|
-
onSlideSize: (size: { width?: number; height?: number }) => {
|
|
176
|
-
slideSizeRef.current = size;
|
|
177
|
-
},
|
|
178
|
-
onSlideRendered: (slideIndex: number) => {
|
|
179
|
-
if (disposed) return;
|
|
180
|
-
setRenderedSlides((count) => Math.max(count, slideIndex + 1));
|
|
181
|
-
setIsLoading(false);
|
|
182
|
-
// 幻灯片是流式逐页追加的:新页默认 opacity:0,
|
|
183
|
-
// 每次追加后都重算激活页,保证首页立即可见、其余页隐藏
|
|
184
|
-
requestAnimationFrame(() => updateActiveSlide());
|
|
185
|
-
if (!fittedRef.current) {
|
|
186
|
-
fittedRef.current = true;
|
|
187
|
-
void layoutSlides();
|
|
188
|
-
}
|
|
189
|
-
},
|
|
190
|
-
onError: (error) => {
|
|
191
|
-
if (disposed) return;
|
|
192
|
-
console.error('[ppt-preview] render error:', error);
|
|
193
|
-
setHasError(true);
|
|
194
|
-
setIsLoading(false);
|
|
195
|
-
},
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
if (disposed) {
|
|
199
|
-
viewer.destroy();
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
viewerRef.current = viewer;
|
|
203
|
-
// open 在 worker 发送 Done(全部解析完成)后才 resolve,
|
|
204
|
-
// 此时可拿到总页数;若首页尚未渲染(极端大文件后处理慢),显示渲染阶段进度
|
|
205
|
-
setTotalSlides(viewer.slideCount || 0);
|
|
206
|
-
setStage('rendering');
|
|
207
|
-
} catch (error) {
|
|
208
|
-
if (disposed) return;
|
|
209
|
-
console.error('[ppt-preview] mount failed:', error);
|
|
210
|
-
setHasError(true);
|
|
211
|
-
setIsLoading(false);
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
void mount();
|
|
216
|
-
|
|
217
|
-
return () => {
|
|
218
|
-
disposed = true;
|
|
219
|
-
viewerRef.current?.destroy();
|
|
220
|
-
viewerRef.current = null;
|
|
221
|
-
};
|
|
222
|
-
}, [file, reloadTick, layoutSlides, updateActiveSlide]);
|
|
223
|
-
|
|
224
|
-
// 窗口尺寸变化时重新适配
|
|
225
|
-
useEffect(() => {
|
|
226
|
-
let frame = 0;
|
|
227
|
-
const handleResize = () => {
|
|
228
|
-
cancelAnimationFrame(frame);
|
|
229
|
-
frame = requestAnimationFrame(() => {
|
|
230
|
-
void layoutSlides();
|
|
231
|
-
});
|
|
232
|
-
};
|
|
233
|
-
window.addEventListener('resize', handleResize);
|
|
234
|
-
return () => {
|
|
235
|
-
cancelAnimationFrame(frame);
|
|
236
|
-
window.removeEventListener('resize', handleResize);
|
|
237
|
-
};
|
|
238
|
-
}, [layoutSlides]);
|
|
239
|
-
|
|
240
|
-
// 滚动过程中逐帧切换"当前页"显隐(与滚动结束后的对齐 snap 相互独立:
|
|
241
|
-
// snap 有 150ms 防抖,显隐必须实时,否则滚动途中仍会看到相邻页)
|
|
242
|
-
useEffect(() => {
|
|
243
|
-
const container = scrollContainerRef.current;
|
|
244
|
-
if (!container) return;
|
|
245
|
-
|
|
246
|
-
let frame = 0;
|
|
247
|
-
const handleScroll = () => {
|
|
248
|
-
if (frame) return;
|
|
249
|
-
frame = requestAnimationFrame(() => {
|
|
250
|
-
frame = 0;
|
|
251
|
-
updateActiveSlide();
|
|
252
|
-
});
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
container.addEventListener('scroll', handleScroll, { passive: true });
|
|
256
|
-
return () => {
|
|
257
|
-
if (frame) cancelAnimationFrame(frame);
|
|
258
|
-
container.removeEventListener('scroll', handleScroll);
|
|
259
|
-
};
|
|
260
|
-
}, [updateActiveSlide]);
|
|
261
|
-
|
|
262
|
-
// 滚动结束后自动对齐到最近的 slide(与方向键同算法,视觉坐标零换算)
|
|
263
|
-
useEffect(() => {
|
|
264
|
-
const container = scrollContainerRef.current;
|
|
265
|
-
if (!container) return;
|
|
266
|
-
|
|
267
|
-
let scrollTimer: number;
|
|
268
|
-
let snapping = false;
|
|
269
|
-
|
|
270
|
-
const snap = () => {
|
|
271
|
-
if (snapping) return;
|
|
272
|
-
const slides = Array.from(container.querySelectorAll('.flyfish-pptx-content .slide')) as HTMLElement[];
|
|
273
|
-
if (slides.length === 0) return;
|
|
274
|
-
|
|
275
|
-
const containerRect = container.getBoundingClientRect();
|
|
276
|
-
const viewportCenter = containerRect.top + container.clientHeight / 2;
|
|
277
|
-
|
|
278
|
-
// 找视觉中心最接近容器中心的 slide
|
|
279
|
-
let closest = slides[0];
|
|
280
|
-
let closestDist = Number.POSITIVE_INFINITY;
|
|
281
|
-
for (const slide of slides) {
|
|
282
|
-
const r = slide.getBoundingClientRect();
|
|
283
|
-
const d = Math.abs(r.top + r.height / 2 - viewportCenter);
|
|
284
|
-
if (d < closestDist) { closestDist = d; closest = slide; }
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
const slideRect = closest.getBoundingClientRect();
|
|
288
|
-
const scrollDelta = slideRect.top + slideRect.height / 2 - viewportCenter;
|
|
289
|
-
if (Math.abs(scrollDelta) < 3) return;
|
|
290
|
-
|
|
291
|
-
snapping = true;
|
|
292
|
-
container.scrollTo({
|
|
293
|
-
top: Math.max(0, container.scrollTop + scrollDelta),
|
|
294
|
-
behavior: 'smooth',
|
|
295
|
-
});
|
|
296
|
-
window.setTimeout(() => { snapping = false; }, 500);
|
|
297
|
-
};
|
|
298
|
-
|
|
299
|
-
const handleScroll = () => {
|
|
300
|
-
clearTimeout(scrollTimer);
|
|
301
|
-
scrollTimer = window.setTimeout(snap, 150);
|
|
302
|
-
};
|
|
303
|
-
|
|
304
|
-
container.addEventListener('scroll', handleScroll, { passive: true });
|
|
305
|
-
return () => {
|
|
306
|
-
clearTimeout(scrollTimer);
|
|
307
|
-
container.removeEventListener('scroll', handleScroll);
|
|
308
|
-
};
|
|
309
|
-
}, []);
|
|
310
|
-
|
|
311
|
-
// 方向键翻页:↑← 上一页,↓→/空格 下一页,Home 首页,End 末页
|
|
312
|
-
useEffect(() => {
|
|
313
|
-
const container = scrollContainerRef.current;
|
|
314
|
-
if (!container) return;
|
|
315
|
-
|
|
316
|
-
const goToIndex = (delta: number) => {
|
|
317
|
-
const slides = Array.from(container.querySelectorAll('.flyfish-pptx-content .slide')) as HTMLElement[];
|
|
318
|
-
if (slides.length === 0) return;
|
|
319
|
-
|
|
320
|
-
const containerRect = container.getBoundingClientRect();
|
|
321
|
-
const viewportVisualCenter = containerRect.top + container.clientHeight / 2;
|
|
322
|
-
|
|
323
|
-
// 当前 slide:视觉中心最接近容器中心的
|
|
324
|
-
let currentIndex = 0;
|
|
325
|
-
let closestDist = Number.POSITIVE_INFINITY;
|
|
326
|
-
slides.forEach((slide, i) => {
|
|
327
|
-
const r = slide.getBoundingClientRect();
|
|
328
|
-
const d = Math.abs(r.top + r.height / 2 - viewportVisualCenter);
|
|
329
|
-
if (d < closestDist) { closestDist = d; currentIndex = i; }
|
|
330
|
-
});
|
|
331
|
-
|
|
332
|
-
const idx = Math.max(0, Math.min(slides.length - 1, currentIndex + delta));
|
|
333
|
-
if (idx === currentIndex) return;
|
|
334
|
-
|
|
335
|
-
// 让目标 slide 的视觉中心对齐容器中心
|
|
336
|
-
// scrollTop 和 getBoundingClientRect 都在视口坐标系,直接对应,
|
|
337
|
-
// scrollTop 增加 delta → slide visual top 减少 delta,零换算!
|
|
338
|
-
const slideRect = slides[idx].getBoundingClientRect();
|
|
339
|
-
const slideCenter = slideRect.top + slideRect.height / 2;
|
|
340
|
-
const scrollDelta = slideCenter - viewportVisualCenter;
|
|
341
|
-
|
|
342
|
-
container.scrollTo({
|
|
343
|
-
top: Math.max(0, container.scrollTop + scrollDelta),
|
|
344
|
-
behavior: 'smooth',
|
|
345
|
-
});
|
|
346
|
-
};
|
|
347
|
-
|
|
348
|
-
const handleKeyDown = (e: KeyboardEvent) => {
|
|
349
|
-
if (['ArrowUp', 'ArrowLeft'].includes(e.key)) {
|
|
350
|
-
e.preventDefault();
|
|
351
|
-
goToIndex(-1);
|
|
352
|
-
} else if (['ArrowDown', 'ArrowRight', ' '].includes(e.key)) {
|
|
353
|
-
e.preventDefault();
|
|
354
|
-
goToIndex(1);
|
|
355
|
-
} else if (e.key === 'Home') {
|
|
356
|
-
e.preventDefault();
|
|
357
|
-
goToIndex(-9999);
|
|
358
|
-
} else if (e.key === 'End') {
|
|
359
|
-
e.preventDefault();
|
|
360
|
-
goToIndex(9999);
|
|
361
|
-
}
|
|
362
|
-
};
|
|
363
|
-
|
|
364
|
-
window.addEventListener('keydown', handleKeyDown);
|
|
365
|
-
return () => window.removeEventListener('keydown', handleKeyDown);
|
|
366
|
-
}, []);
|
|
367
|
-
|
|
368
|
-
return (
|
|
369
|
-
<div className="ui-file-preview-ppt" data-global-context-menu-ignore="true">
|
|
370
|
-
<style>
|
|
371
|
-
{`.ui-file-preview-ppt {
|
|
372
|
-
position: relative;
|
|
373
|
-
width: 100%;
|
|
374
|
-
height: 100dvh;
|
|
375
|
-
background: #000;
|
|
376
|
-
color: #000;
|
|
377
|
-
color-scheme: light;
|
|
378
|
-
overflow: hidden;
|
|
379
|
-
}
|
|
380
|
-
.ppt-export-pdf-btn {
|
|
381
|
-
position: absolute;
|
|
382
|
-
top: 7px;
|
|
383
|
-
right: 16px;
|
|
384
|
-
z-index: 50;
|
|
385
|
-
}
|
|
386
|
-
.ppt-scroll-container {
|
|
387
|
-
width: 100%;
|
|
388
|
-
height: 100dvh;
|
|
389
|
-
overflow-y: auto;
|
|
390
|
-
overflow-x: hidden;
|
|
391
|
-
scrollbar-width: none;
|
|
392
|
-
}
|
|
393
|
-
.ppt-scroll-container::-webkit-scrollbar {
|
|
394
|
-
display: none;
|
|
395
|
-
}
|
|
396
|
-
/* 覆盖 viewer 默认的 .slide margin-bottom: 50px,
|
|
397
|
-
由 layoutSlides() 精确计算间距并 inline 设置。
|
|
398
|
-
单页显示:默认全部透明,仅当前页(视觉中心所在页)加
|
|
399
|
-
.ppt-slide-active 后不透明,保证任何窗口比例下窗口内只出现一页;
|
|
400
|
-
过渡时间要短,翻页时快速淡入淡出而不拖泥带水。
|
|
401
|
-
(离屏导出 PDF 的 viewer 不在 .ppt-scroll-container 内,不受影响) */
|
|
402
|
-
.ppt-scroll-container .flyfish-pptx-content .slide {
|
|
403
|
-
box-shadow: none !important;
|
|
404
|
-
opacity: 0;
|
|
405
|
-
transition: opacity 0.18s ease;
|
|
406
|
-
}
|
|
407
|
-
.ppt-scroll-container .flyfish-pptx-content .slide.ppt-slide-active {
|
|
408
|
-
opacity: 1;
|
|
409
|
-
}
|
|
410
|
-
.ppt-loading-overlay {
|
|
411
|
-
position: absolute;
|
|
412
|
-
top: 0;
|
|
413
|
-
left: 0;
|
|
414
|
-
right: 0;
|
|
415
|
-
bottom: 0;
|
|
416
|
-
background: #000;
|
|
417
|
-
display: flex;
|
|
418
|
-
flex-direction: column;
|
|
419
|
-
align-items: center;
|
|
420
|
-
justify-content: center;
|
|
421
|
-
z-index: 100;
|
|
422
|
-
}
|
|
423
|
-
.ppt-loading-spinner {
|
|
424
|
-
width: 40px;
|
|
425
|
-
height: 40px;
|
|
426
|
-
border: 3px solid #333;
|
|
427
|
-
border-top: 3px solid #5292f7;
|
|
428
|
-
border-radius: 50%;
|
|
429
|
-
animation: ppt-spin 1s linear infinite;
|
|
430
|
-
}
|
|
431
|
-
.ppt-loading-text {
|
|
432
|
-
margin-top: 16px;
|
|
433
|
-
color: #ccc;
|
|
434
|
-
font-size: 14px;
|
|
435
|
-
}
|
|
436
|
-
.ppt-loading-progress {
|
|
437
|
-
margin-top: 20px;
|
|
438
|
-
width: 220px;
|
|
439
|
-
height: 6px;
|
|
440
|
-
background: #2a2a2a;
|
|
441
|
-
border-radius: 3px;
|
|
442
|
-
overflow: hidden;
|
|
443
|
-
}
|
|
444
|
-
.ppt-loading-progress-bar {
|
|
445
|
-
height: 100%;
|
|
446
|
-
background: linear-gradient(90deg, #5292f7, #67b8ff);
|
|
447
|
-
border-radius: 3px;
|
|
448
|
-
transition: width 0.3s ease;
|
|
449
|
-
}
|
|
450
|
-
.ppt-loading-percent {
|
|
451
|
-
margin-top: 8px;
|
|
452
|
-
color: #888;
|
|
453
|
-
font-size: 12px;
|
|
454
|
-
min-height: 16px;
|
|
455
|
-
}
|
|
456
|
-
.ppt-loading-error-icon {
|
|
457
|
-
font-size: 48px;
|
|
458
|
-
color: #f56c6c;
|
|
459
|
-
}
|
|
460
|
-
.ppt-loading-error-text {
|
|
461
|
-
margin-top: 16px;
|
|
462
|
-
color: #f56c6c;
|
|
463
|
-
font-size: 14px;
|
|
464
|
-
}
|
|
465
|
-
.ppt-loading-retry-btn {
|
|
466
|
-
margin-top: 20px;
|
|
467
|
-
padding: 8px 24px;
|
|
468
|
-
background: #5292f7;
|
|
469
|
-
color: #fff;
|
|
470
|
-
border: none;
|
|
471
|
-
border-radius: 4px;
|
|
472
|
-
cursor: pointer;
|
|
473
|
-
font-size: 14px;
|
|
474
|
-
}
|
|
475
|
-
.ppt-loading-retry-btn:hover {
|
|
476
|
-
background: #67b8ff;
|
|
477
|
-
}
|
|
478
|
-
@keyframes ppt-spin {
|
|
479
|
-
0% { transform: rotate(0deg); }
|
|
480
|
-
100% { transform: rotate(360deg); }
|
|
481
|
-
}`}
|
|
482
|
-
</style>
|
|
483
|
-
{!isLoading && !hasError && file && (
|
|
484
|
-
<ExportDropdown
|
|
485
|
-
onExportPdf={handleExportPdf}
|
|
486
|
-
onDownload={handleDownload}
|
|
487
|
-
exportingPdf={exporting}
|
|
488
|
-
buttonProps={{ className: 'vendorsys-export-trigger-on-dark ppt-export-pdf-btn mr-[30px] bg-transparent border-none' }}
|
|
489
|
-
/>
|
|
490
|
-
)}
|
|
491
|
-
{file && isLoading && !hasError && (
|
|
492
|
-
<div className="ppt-loading-overlay">
|
|
493
|
-
<div className="ppt-loading-spinner"></div>
|
|
494
|
-
<div className="ppt-loading-text">加载中...</div>
|
|
495
|
-
<div className="ppt-loading-progress">
|
|
496
|
-
<div
|
|
497
|
-
className="ppt-loading-progress-bar"
|
|
498
|
-
style={{ width: `${stage === 'rendering' ? 100 : parsePercent}%` }}
|
|
499
|
-
/>
|
|
500
|
-
</div>
|
|
501
|
-
<div className="ppt-loading-percent">
|
|
502
|
-
{stage === 'rendering'
|
|
503
|
-
? totalSlides > 0
|
|
504
|
-
? `正在渲染幻灯片 第 ${Math.max(renderedSlides, 1)} / ${totalSlides} 页`
|
|
505
|
-
: '正在渲染幻灯片…'
|
|
506
|
-
: parsePercent >= 100
|
|
507
|
-
? '正在处理幻灯片资源…'
|
|
508
|
-
: parsePercent > 0
|
|
509
|
-
? `正在解析演示文稿 ${parsePercent}%${parsedSlides > 0 ? ` · 已解析第 ${parsedSlides} 页` : ''}`
|
|
510
|
-
: '正在读取文件…'}
|
|
511
|
-
</div>
|
|
512
|
-
</div>
|
|
513
|
-
)}
|
|
514
|
-
{file && hasError && (
|
|
515
|
-
<div className="ppt-loading-overlay">
|
|
516
|
-
<div className="ppt-loading-error-icon">✕</div>
|
|
517
|
-
<div className="ppt-loading-error-text">文档加载失败</div>
|
|
518
|
-
<button
|
|
519
|
-
className="ppt-loading-retry-btn"
|
|
520
|
-
onClick={() => {
|
|
521
|
-
setHasError(false);
|
|
522
|
-
setIsLoading(true);
|
|
523
|
-
setReloadTick((v) => v + 1);
|
|
524
|
-
}}
|
|
525
|
-
>
|
|
526
|
-
重新加载
|
|
527
|
-
</button>
|
|
528
|
-
</div>
|
|
529
|
-
)}
|
|
530
|
-
<div ref={scrollContainerRef} className="ppt-scroll-container">
|
|
531
|
-
<div ref={targetRef} className="ppt-render-target" style={{ width: '100%' }} />
|
|
532
|
-
</div>
|
|
533
|
-
</div>
|
|
534
|
-
);
|
|
535
|
-
};
|