@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,119 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import { Modal, message, Alert } from 'antd';
|
|
3
|
-
import ProjectSelector from '../ProjectSelector/index';
|
|
4
|
-
import { API } from '../../api/index';
|
|
5
|
-
import { ResponseCode } from '../../api/_base';
|
|
6
|
-
|
|
7
|
-
interface MoveCopyFileInfo {
|
|
8
|
-
fileName: string;
|
|
9
|
-
fileType: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
interface MoveCopyToProjectModalProps {
|
|
13
|
-
visible: boolean;
|
|
14
|
-
fileIds: string[];
|
|
15
|
-
/** 当前操作的文件/文件夹信息(用于文件夹场景的文案展示) */
|
|
16
|
-
files?: MoveCopyFileInfo[];
|
|
17
|
-
currentProjectId: string;
|
|
18
|
-
mode: 'move' | 'copy';
|
|
19
|
-
onCancel: () => void;
|
|
20
|
-
onSuccess: () => void;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export const MoveCopyToProjectModal: React.FC<MoveCopyToProjectModalProps> = ({
|
|
24
|
-
visible,
|
|
25
|
-
fileIds,
|
|
26
|
-
files,
|
|
27
|
-
currentProjectId,
|
|
28
|
-
mode,
|
|
29
|
-
onCancel,
|
|
30
|
-
onSuccess,
|
|
31
|
-
}) => {
|
|
32
|
-
const [submitting, setSubmitting] = useState(false);
|
|
33
|
-
const [selectedProjectId, setSelectedProjectId] = useState<string | undefined>(undefined);
|
|
34
|
-
|
|
35
|
-
// 当前仅文件夹入口为单选操作
|
|
36
|
-
const isFolder = files?.length === 1 && files[0].fileType === 'folder';
|
|
37
|
-
const actionText = mode === 'move' ? '移动' : '复制';
|
|
38
|
-
|
|
39
|
-
const handleSubmit = async () => {
|
|
40
|
-
if (!selectedProjectId) {
|
|
41
|
-
message.warning('请选择目标项目');
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
setSubmitting(true);
|
|
46
|
-
try {
|
|
47
|
-
const apiMethod = mode === 'move'
|
|
48
|
-
? API.project.file.moveFileToProject
|
|
49
|
-
: API.project.file.copyFileToProject;
|
|
50
|
-
|
|
51
|
-
// 处理多个文件
|
|
52
|
-
const results = await Promise.all(
|
|
53
|
-
fileIds.map((fileId) =>
|
|
54
|
-
apiMethod({ projectId: selectedProjectId, fileId })
|
|
55
|
-
)
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
const failedCount = results.filter((r) => r.code !== ResponseCode.SUCCESS).length;
|
|
59
|
-
if (failedCount === 0) {
|
|
60
|
-
if (isFolder) {
|
|
61
|
-
message.success(`文件夹复制成功,目标项目中的文件夹名为:${results[0].data}`);
|
|
62
|
-
} else {
|
|
63
|
-
message.success(`${actionText}成功, 文件名为:${results[0].data}`);
|
|
64
|
-
}
|
|
65
|
-
onSuccess();
|
|
66
|
-
} else if (failedCount < fileIds.length) {
|
|
67
|
-
message.warning(`部分${isFolder ? '文件夹' : '文件'}${actionText}成功`);
|
|
68
|
-
onSuccess();
|
|
69
|
-
} else {
|
|
70
|
-
message.error(`${actionText}失败`);
|
|
71
|
-
}
|
|
72
|
-
} catch (error) {
|
|
73
|
-
message.error(`${actionText}失败`);
|
|
74
|
-
} finally {
|
|
75
|
-
setSubmitting(false);
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
const modalTitle = isFolder
|
|
80
|
-
? '复制文件夹到其他项目'
|
|
81
|
-
: mode === 'move' ? '移动到其他项目' : '复制到其他项目';
|
|
82
|
-
|
|
83
|
-
return (
|
|
84
|
-
<Modal
|
|
85
|
-
title={modalTitle}
|
|
86
|
-
className='ant-modal-nofull'
|
|
87
|
-
open={visible}
|
|
88
|
-
onCancel={onCancel}
|
|
89
|
-
onOk={handleSubmit}
|
|
90
|
-
okText="确定"
|
|
91
|
-
cancelText="取消"
|
|
92
|
-
confirmLoading={submitting}
|
|
93
|
-
okButtonProps={{ disabled: !selectedProjectId }}
|
|
94
|
-
width={480}
|
|
95
|
-
>
|
|
96
|
-
{isFolder && (
|
|
97
|
-
<Alert
|
|
98
|
-
className="mb-3"
|
|
99
|
-
type="info"
|
|
100
|
-
showIcon
|
|
101
|
-
message="文件夹内的全部子文件夹和文件将一并复制到目标项目的根目录,重名时会自动追加数字后缀。"
|
|
102
|
-
/>
|
|
103
|
-
)}
|
|
104
|
-
<div className="w-full flex items-center justify-center">
|
|
105
|
-
<ProjectSelector
|
|
106
|
-
value={selectedProjectId ? [selectedProjectId] : undefined}
|
|
107
|
-
onChange={(projectIds) => {
|
|
108
|
-
setSelectedProjectId(projectIds[0]);
|
|
109
|
-
}}
|
|
110
|
-
className='w-[100%]'
|
|
111
|
-
excludeProjectIds={[currentProjectId]}
|
|
112
|
-
placeholder="请选择目标项目"
|
|
113
|
-
multiple={false}
|
|
114
|
-
allowClear={true}
|
|
115
|
-
/>
|
|
116
|
-
</div>
|
|
117
|
-
</Modal>
|
|
118
|
-
);
|
|
119
|
-
};
|
|
@@ -1,419 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
-
import { Modal, message, Button } from 'antd';
|
|
3
|
-
import { CopyOutlined, ShareAltOutlined } from '@ant-design/icons';
|
|
4
|
-
import { ProjectFile } from './types';
|
|
5
|
-
import { downloadFile, getFileUrl } from '../UIFilePreview/previewUtils';
|
|
6
|
-
import { AuthorizationHandler } from '../../api/_base';
|
|
7
|
-
import { CacheFileContent } from '../../utils/CacheFileContent';
|
|
8
|
-
import { copyToClipboard } from '../../utils/clipboard';
|
|
9
|
-
|
|
10
|
-
interface ShareToWechatModalProps {
|
|
11
|
-
visible: boolean;
|
|
12
|
-
file: ProjectFile | null;
|
|
13
|
-
onClose: () => void;
|
|
14
|
-
onFileCached?: (fileId: string) => void;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// 根据文件名扩展名推断 MIME 类型。
|
|
18
|
-
// 服务端对这些文件资源常返回 application/octet-stream 或不返回 Content-Type,
|
|
19
|
-
// 此时需推断出正确 MIME 供 navigator.share({ files }) 使用。
|
|
20
|
-
const MIME_BY_EXT: Record<string, string> = {
|
|
21
|
-
doc: 'application/msword',
|
|
22
|
-
docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
23
|
-
xls: 'application/vnd.ms-excel',
|
|
24
|
-
xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
25
|
-
ppt: 'application/vnd.ms-powerpoint',
|
|
26
|
-
pptx: 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
|
27
|
-
pdf: 'application/pdf',
|
|
28
|
-
png: 'image/png',
|
|
29
|
-
jpg: 'image/jpeg',
|
|
30
|
-
jpeg: 'image/jpeg',
|
|
31
|
-
gif: 'image/gif',
|
|
32
|
-
webp: 'image/webp',
|
|
33
|
-
bmp: 'image/bmp',
|
|
34
|
-
txt: 'text/plain',
|
|
35
|
-
csv: 'text/csv',
|
|
36
|
-
mp4: 'video/mp4',
|
|
37
|
-
mp3: 'audio/mpeg',
|
|
38
|
-
zip: 'application/zip',
|
|
39
|
-
};
|
|
40
|
-
const getMimeFromFilename = (fileName: string): string => {
|
|
41
|
-
const ext = fileName.split('.').pop()?.toLowerCase() ?? '';
|
|
42
|
-
return MIME_BY_EXT[ext] ?? '';
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export const ShareToWechatModal: React.FC<ShareToWechatModalProps> = ({
|
|
46
|
-
visible,
|
|
47
|
-
file,
|
|
48
|
-
onClose,
|
|
49
|
-
onFileCached,
|
|
50
|
-
}) => {
|
|
51
|
-
const [isProcessing, setIsProcessing] = useState(false);
|
|
52
|
-
const [downloaded, setDownloaded] = useState(false);
|
|
53
|
-
const [isMobile, setIsMobile] = useState(false);
|
|
54
|
-
const [hasNativeShare, setHasNativeShare] = useState(false);
|
|
55
|
-
// PWA standalone 模式(从主屏幕打开)。iOS standalone PWA 不支持 navigator.share(iOS < 16.4),
|
|
56
|
-
// 需引导用户在系统浏览器中打开
|
|
57
|
-
const [isWechatBrowser, setIsWechatBrowser] = useState(false);
|
|
58
|
-
const [isStandalone, setIsStandalone] = useState(false);
|
|
59
|
-
|
|
60
|
-
// 预取的文件 blob。移动端有 navigator.share 时,需在用户手势内同步调用它,
|
|
61
|
-
// 因此在弹窗打开时提前拉取,避免点击分享时 await 网络请求导致手势失效(iOS 抛 NotAllowedError)
|
|
62
|
-
const blobRef = useRef<Blob | null>(null);
|
|
63
|
-
|
|
64
|
-
const shareLink = useMemo(() => {
|
|
65
|
-
if (!file) return '';
|
|
66
|
-
return `${window.location.origin}/filepreview?fileid=${file.id}&path=${encodeURIComponent(file.fileResourcePath)}&name=${encodeURIComponent(file.fileName)}`;
|
|
67
|
-
}, [file]);
|
|
68
|
-
|
|
69
|
-
useEffect(() => {
|
|
70
|
-
if (!visible) {
|
|
71
|
-
blobRef.current = null;
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
const ua = navigator.userAgent || '';
|
|
75
|
-
const mobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(ua);
|
|
76
|
-
// 微信内置浏览器检测:部分微信版本会限制 navigator.share,需在不支持时回退到复制链接
|
|
77
|
-
const isWechatBrowser = /MicroMessenger/i.test(ua);
|
|
78
|
-
// standalone 检测:PWA 从主屏幕打开时 display-mode 为 standalone(iOS 也可用 navigator.standalone)
|
|
79
|
-
const standalone = window.matchMedia('(display-mode: standalone)').matches || Boolean((navigator as any).standalone);
|
|
80
|
-
const nativeShare = !!navigator.share;
|
|
81
|
-
|
|
82
|
-
console.log('[ShareToWechat] 环境检测:', {
|
|
83
|
-
userAgent: ua,
|
|
84
|
-
isMobile: mobile,
|
|
85
|
-
isWechatBrowser,
|
|
86
|
-
hasNativeShare: nativeShare,
|
|
87
|
-
protocol: window.location.protocol,
|
|
88
|
-
hostname: window.location.hostname,
|
|
89
|
-
standalone,
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
setIsMobile(mobile);
|
|
93
|
-
setIsWechatBrowser(isWechatBrowser);
|
|
94
|
-
// 只要浏览器支持 navigator.share 就启用:微信内置浏览器中也先尝试调用系统分享面板,
|
|
95
|
-
// 失败时由 handleShare 内部回退到下载(恢复早期可对 word 等文件触发 navigator.share 的行为)
|
|
96
|
-
setHasNativeShare(nativeShare);
|
|
97
|
-
setIsStandalone(standalone);
|
|
98
|
-
setDownloaded(false);
|
|
99
|
-
setIsProcessing(false);
|
|
100
|
-
blobRef.current = null;
|
|
101
|
-
|
|
102
|
-
// 只有移动端且支持分享 API 时才预取 blob(文件分享需要 blob,链接分享不需要)。
|
|
103
|
-
// 预取不阻塞分享按钮:即使未就绪,点击时也会回退到链接分享(无需 blob),
|
|
104
|
-
// 避免 prefetch 卡住时按钮被 loading 永久禁用、navigator.share 永不触发。
|
|
105
|
-
if (mobile && nativeShare) {
|
|
106
|
-
getFileBlob()
|
|
107
|
-
.then((blob) => { blobRef.current = blob; })
|
|
108
|
-
.catch((err) => { console.error('[ShareToWechat] 预取文件失败:', err); });
|
|
109
|
-
}
|
|
110
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
111
|
-
}, [visible]);
|
|
112
|
-
|
|
113
|
-
const getFileBlob = async (): Promise<Blob> => {
|
|
114
|
-
if (!file) throw new Error('文件不存在');
|
|
115
|
-
|
|
116
|
-
if (file.hasLocalCache && file.id) {
|
|
117
|
-
try {
|
|
118
|
-
const cached = await CacheFileContent.getCachedContent(file.id);
|
|
119
|
-
if (cached) {
|
|
120
|
-
console.log('[ShareToWechat] 使用本地缓存的文件');
|
|
121
|
-
return cached.content;
|
|
122
|
-
}
|
|
123
|
-
} catch (error) {
|
|
124
|
-
console.error('[ShareToWechat] 读取缓存失败,将从网络获取:', error);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
console.log('[ShareToWechat] 从网络获取文件');
|
|
129
|
-
const url = getFileUrl(file.fileResourcePath);
|
|
130
|
-
if (!url) {
|
|
131
|
-
throw new Error('文件资源路径不可用');
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
const headers: Record<string, string> = {} as any;
|
|
135
|
-
(headers as any).set = (key: string, value: string) => {
|
|
136
|
-
headers[key] = value;
|
|
137
|
-
};
|
|
138
|
-
AuthorizationHandler.requestHandleSid({ headers });
|
|
139
|
-
|
|
140
|
-
const response = await fetch(url, {
|
|
141
|
-
headers: { Authorization: headers.Authorization || '' },
|
|
142
|
-
credentials: 'include',
|
|
143
|
-
mode: 'cors',
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
if (!response.ok) {
|
|
147
|
-
throw new Error(`文件加载失败,状态码 ${response.status}`);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
const blob = await response.blob();
|
|
151
|
-
|
|
152
|
-
if (file.id) {
|
|
153
|
-
try {
|
|
154
|
-
await CacheFileContent.saveToCache(file.id, blob, file.crc32);
|
|
155
|
-
console.log('[ShareToWechat] 已保存到本地缓存');
|
|
156
|
-
onFileCached?.(file.id);
|
|
157
|
-
} catch (error) {
|
|
158
|
-
console.error('[ShareToWechat] 保存到缓存失败:', error);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
return blob;
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
const handleShare = async () => {
|
|
166
|
-
if (!file) return;
|
|
167
|
-
|
|
168
|
-
// 移动端且有 navigator.share:真正调用系统分享面板(内含微信选项)
|
|
169
|
-
if (isMobile && hasNativeShare) {
|
|
170
|
-
// 注意:不在此处调用 setIsProcessing(true),
|
|
171
|
-
// 因为 React 重渲染会破坏 iOS Safari 的用户手势上下文,
|
|
172
|
-
// 导致 navigator.share() 抛出 NotAllowedError,系统分享面板不弹出。
|
|
173
|
-
try {
|
|
174
|
-
const blob = blobRef.current;
|
|
175
|
-
// 不在此处 await 拉取 blob:任何 await 都可能消耗 Android 的 transient activation,
|
|
176
|
-
// 导致 navigator.share 抛 "NotAllowedError: Permission denied"。
|
|
177
|
-
// blob 由弹窗打开时预取;若未就绪则跳过文件分享,直接走链接分享(无需 blob)。
|
|
178
|
-
let shareCalled = false;
|
|
179
|
-
// 1) 优先文件分享(需 blob 就绪且浏览器支持 canShare files)
|
|
180
|
-
if (blob && !!navigator.canShare) {
|
|
181
|
-
// MIME 类型处理:
|
|
182
|
-
// - 'application/octet-stream' 会被 Android 以 "NotAllowedError: Permission denied" 拒绝;
|
|
183
|
-
// - 空类型在 Android 上对 office 文档也不可靠(浏览器推断可能不触发系统分享);
|
|
184
|
-
// - 正确做法:blob.type 有效时直接用,否则按文件名扩展名推断正确 MIME。
|
|
185
|
-
// Android 系统分享菜单本身支持 office 文档,只要 MIME 正确即可分享。
|
|
186
|
-
// 之前的 "Permission denied" 实为 await getFileBlob() 消耗了 transient activation 所致,
|
|
187
|
-
// 现已移除该 await(blob 仅靠预取),手势完好,MIME 正确即可成功。
|
|
188
|
-
const fileType = blob.type && blob.type !== 'application/octet-stream'
|
|
189
|
-
? blob.type
|
|
190
|
-
: getMimeFromFilename(file.fileName);
|
|
191
|
-
const fileObj = new File([blob], file.fileName, { type: fileType });
|
|
192
|
-
console.log('[ShareToWechat] 准备文件分享:', {
|
|
193
|
-
fileName: file.fileName,
|
|
194
|
-
blobType: blob.type,
|
|
195
|
-
fileType,
|
|
196
|
-
blobSize: blob.size,
|
|
197
|
-
canShare: navigator.canShare({ files: [fileObj] }),
|
|
198
|
-
});
|
|
199
|
-
if (navigator.canShare({ files: [fileObj] })) {
|
|
200
|
-
shareCalled = true;
|
|
201
|
-
try {
|
|
202
|
-
await navigator.share({
|
|
203
|
-
files: [fileObj],
|
|
204
|
-
title: file.fileName,
|
|
205
|
-
text: `请查看文件:${file.fileName}`,
|
|
206
|
-
});
|
|
207
|
-
message.success('分享成功');
|
|
208
|
-
onClose();
|
|
209
|
-
return;
|
|
210
|
-
} catch (err) {
|
|
211
|
-
if ((err as Error).name === 'AbortError') {
|
|
212
|
-
message.info('分享已取消');
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
|
-
// navigator.share 调用(即使失败)会消耗用户手势,
|
|
216
|
-
// 后续 navigator.share 必然抛 "Must be handling a user gesture",因此直接回退下载。
|
|
217
|
-
console.warn('[ShareToWechat] 文件分享失败,回退下载:', err);
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
// 2) 链接分享(仅在未调用过 navigator.share 时尝试,手势仍有效)
|
|
222
|
-
if (!shareCalled) {
|
|
223
|
-
try {
|
|
224
|
-
await navigator.share({
|
|
225
|
-
title: file.fileName,
|
|
226
|
-
text: `请查看文件:${file.fileName}`,
|
|
227
|
-
url: shareLink,
|
|
228
|
-
});
|
|
229
|
-
message.success('分享成功');
|
|
230
|
-
onClose();
|
|
231
|
-
return;
|
|
232
|
-
} catch (err) {
|
|
233
|
-
if ((err as Error).name === 'AbortError') {
|
|
234
|
-
message.info('分享已取消');
|
|
235
|
-
return;
|
|
236
|
-
}
|
|
237
|
-
console.warn('[ShareToWechat] 链接分享失败,回退下载:', err);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
} catch (err) {
|
|
241
|
-
console.error('[ShareToWechat] 分享过程异常:', err);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
// 桌面端或移动端无 navigator.share:下载文件
|
|
246
|
-
setIsProcessing(true);
|
|
247
|
-
try {
|
|
248
|
-
await downloadFile(file.fileResourcePath, file.fileName, file.id, file.crc32);
|
|
249
|
-
setDownloaded(true);
|
|
250
|
-
onFileCached?.(file.id);
|
|
251
|
-
} catch (error) {
|
|
252
|
-
console.error('下载失败:', error);
|
|
253
|
-
// downloadFile 内部已统一提示下载失败,此处不重复提示
|
|
254
|
-
} finally {
|
|
255
|
-
setIsProcessing(false);
|
|
256
|
-
}
|
|
257
|
-
};
|
|
258
|
-
|
|
259
|
-
const handleOpenWechat = async () => {
|
|
260
|
-
if (!file) return;
|
|
261
|
-
// 先复制链接到剪贴板,再尝试通过 URL scheme 打开微信
|
|
262
|
-
try {
|
|
263
|
-
await copyToClipboard(shareLink);
|
|
264
|
-
} catch (err) {
|
|
265
|
-
console.warn('[ShareToWechat] 复制链接失败:', err);
|
|
266
|
-
}
|
|
267
|
-
// 通过 weixin:// URL scheme 打开微信
|
|
268
|
-
window.location.href = 'weixin://';
|
|
269
|
-
message.info('链接已复制,请在微信聊天中粘贴发送');
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
const handleCopyLink = async () => {
|
|
273
|
-
if (!file) return;
|
|
274
|
-
try {
|
|
275
|
-
await copyToClipboard(shareLink);
|
|
276
|
-
message.success('分享链接已复制');
|
|
277
|
-
} catch (error) {
|
|
278
|
-
message.error('复制链接失败');
|
|
279
|
-
console.error('复制失败:', error);
|
|
280
|
-
}
|
|
281
|
-
};
|
|
282
|
-
|
|
283
|
-
// standalone PWA 且无 navigator.share:需引导用户在系统浏览器中打开
|
|
284
|
-
const needOpenInBrowser = isStandalone && !hasNativeShare;
|
|
285
|
-
|
|
286
|
-
// 主按钮文字:按环境区分
|
|
287
|
-
const mainButtonText = (): string => {
|
|
288
|
-
if (isProcessing) return '处理中...';
|
|
289
|
-
if (needOpenInBrowser) return '在浏览器中打开';
|
|
290
|
-
if (isMobile && hasNativeShare) return '分享到微信';
|
|
291
|
-
if (isWechatBrowser) return '复制链接';
|
|
292
|
-
if (isMobile) return '打开微信';
|
|
293
|
-
return '下载文件';
|
|
294
|
-
};
|
|
295
|
-
|
|
296
|
-
// 顶部提示文字
|
|
297
|
-
const tipText = (): string => {
|
|
298
|
-
if (needOpenInBrowser) {
|
|
299
|
-
return '当前为桌面应用模式,不支持直接分享。请点击下方按钮在浏览器中打开后分享';
|
|
300
|
-
}
|
|
301
|
-
if (isMobile && hasNativeShare) {
|
|
302
|
-
return '点击下方按钮,在系统分享面板中选择微信发送';
|
|
303
|
-
}
|
|
304
|
-
if (isWechatBrowser) {
|
|
305
|
-
return '点击下方按钮复制链接,然后点击右上角「···」→「发送给朋友」即可分享';
|
|
306
|
-
}
|
|
307
|
-
if (isMobile) {
|
|
308
|
-
return '点击下方按钮打开微信,链接已自动复制,请在聊天中粘贴发送';
|
|
309
|
-
}
|
|
310
|
-
return '请下载文件后,在微信中发送给好友';
|
|
311
|
-
};
|
|
312
|
-
|
|
313
|
-
if (!file) return null;
|
|
314
|
-
|
|
315
|
-
return (
|
|
316
|
-
<Modal
|
|
317
|
-
open={visible}
|
|
318
|
-
onCancel={onClose}
|
|
319
|
-
title="分享到微信"
|
|
320
|
-
footer={null}
|
|
321
|
-
width={320}
|
|
322
|
-
className="ant-modal-nofull"
|
|
323
|
-
>
|
|
324
|
-
<div className="flex flex-col items-center">
|
|
325
|
-
<div className="mb-4 text-center">
|
|
326
|
-
<p className="text-sm text-gray-600">{tipText()}</p>
|
|
327
|
-
</div>
|
|
328
|
-
|
|
329
|
-
<div className="w-full mb-4">
|
|
330
|
-
<div className="bg-gray-50 rounded-lg p-3">
|
|
331
|
-
<p className="text-sm font-medium text-gray-700 truncate">
|
|
332
|
-
{file.fileName}
|
|
333
|
-
</p>
|
|
334
|
-
<p className="text-xs text-gray-400 mt-1">
|
|
335
|
-
{(file.fileSize / 1024 / 1024).toFixed(2)} MB
|
|
336
|
-
</p>
|
|
337
|
-
{file.hasLocalCache && (
|
|
338
|
-
<p className="text-xs text-green-500 mt-1">
|
|
339
|
-
📁 已缓存,可离线使用
|
|
340
|
-
</p>
|
|
341
|
-
)}
|
|
342
|
-
</div>
|
|
343
|
-
</div>
|
|
344
|
-
|
|
345
|
-
<div className="w-full space-y-2">
|
|
346
|
-
{needOpenInBrowser ? (
|
|
347
|
-
// standalone PWA 无 navigator.share:用 <a target="_blank"> 在系统浏览器中打开
|
|
348
|
-
<Button
|
|
349
|
-
type="primary"
|
|
350
|
-
block
|
|
351
|
-
icon={<ShareAltOutlined />}
|
|
352
|
-
href={window.location.href}
|
|
353
|
-
// @ts-ignore antd Button href 模式下 target 透传到 <a>
|
|
354
|
-
target="_blank"
|
|
355
|
-
rel="noopener"
|
|
356
|
-
>
|
|
357
|
-
{mainButtonText()}
|
|
358
|
-
</Button>
|
|
359
|
-
) : isWechatBrowser && !hasNativeShare ? (
|
|
360
|
-
// 微信内置浏览器且 navigator.share 不可用:weixin:// 也无意义(已在微信内)
|
|
361
|
-
// 引导用户复制链接后通过微信右上角菜单分享
|
|
362
|
-
<Button
|
|
363
|
-
type="primary"
|
|
364
|
-
block
|
|
365
|
-
icon={<CopyOutlined />}
|
|
366
|
-
onClick={handleCopyLink}
|
|
367
|
-
>
|
|
368
|
-
{mainButtonText()}
|
|
369
|
-
</Button>
|
|
370
|
-
) : isMobile && !hasNativeShare ? (
|
|
371
|
-
// 移动端非微信浏览器但无 navigator.share:通过 URL scheme 打开微信
|
|
372
|
-
<Button
|
|
373
|
-
type="primary"
|
|
374
|
-
block
|
|
375
|
-
icon={<ShareAltOutlined />}
|
|
376
|
-
onClick={handleOpenWechat}
|
|
377
|
-
>
|
|
378
|
-
{mainButtonText()}
|
|
379
|
-
</Button>
|
|
380
|
-
) : (
|
|
381
|
-
<Button
|
|
382
|
-
type="primary"
|
|
383
|
-
block
|
|
384
|
-
icon={<ShareAltOutlined />}
|
|
385
|
-
loading={isProcessing}
|
|
386
|
-
onClick={handleShare}
|
|
387
|
-
>
|
|
388
|
-
{mainButtonText()}
|
|
389
|
-
</Button>
|
|
390
|
-
)}
|
|
391
|
-
|
|
392
|
-
{/* 辅助按钮:非微信浏览器且不支持原生分享时显示复制链接,桌面端也显示 */}
|
|
393
|
-
{!isWechatBrowser && !(isMobile && hasNativeShare) && (
|
|
394
|
-
<Button
|
|
395
|
-
block
|
|
396
|
-
icon={<CopyOutlined />}
|
|
397
|
-
onClick={handleCopyLink}
|
|
398
|
-
>
|
|
399
|
-
复制分享链接
|
|
400
|
-
</Button>
|
|
401
|
-
)}
|
|
402
|
-
</div>
|
|
403
|
-
|
|
404
|
-
{downloaded && (
|
|
405
|
-
<div className="mt-4 pt-4 border-t border-gray-100 w-full">
|
|
406
|
-
<div className="space-y-2">
|
|
407
|
-
<p className="text-xs text-gray-400 text-center">
|
|
408
|
-
💡 分享方式:打开微信 → 进入聊天窗口
|
|
409
|
-
</p>
|
|
410
|
-
<p className="text-xs text-gray-400 text-center">
|
|
411
|
-
点击右下角「+」→「文件」→ 选择刚下载的文件
|
|
412
|
-
</p>
|
|
413
|
-
</div>
|
|
414
|
-
</div>
|
|
415
|
-
)}
|
|
416
|
-
</div>
|
|
417
|
-
</Modal>
|
|
418
|
-
);
|
|
419
|
-
};
|