@spacecorexdev/core 0.0.5 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (368) hide show
  1. package/dist/api/index.js +1 -0
  2. package/dist/contract.js +1 -0
  3. package/dist/hooks/index.js +1 -0
  4. package/dist/index.js +7 -0
  5. package/{src → dist}/styles/ant-table.css +5 -26
  6. package/{src → dist}/styles/index.css +8 -8
  7. package/dist/types/index.js +1 -0
  8. package/dist/ui/index.js +1 -0
  9. package/dist/utils/index.js +7 -0
  10. package/package.json +67 -70
  11. package/types/api/project.d.ts +9 -1
  12. package/types/hooks.d.ts +1 -1
  13. package/types/index.d.ts +4 -4
  14. package/types/types/index.d.ts +1 -3
  15. package/types/types/project/base.d.ts +3 -1
  16. package/types/types/project/index.d.ts +1 -0
  17. package/types/types/project/member.d.ts +1 -1
  18. package/types/types/project/projectRole.d.ts +17 -0
  19. package/types/types/projectRole.d.ts +2 -2
  20. package/types/ui/FileManager/types.d.ts +1 -5
  21. package/types/ui/FileManager/utils/fileUtils.d.ts +0 -16
  22. package/types/ui/ResizableTable/index.d.ts +7 -0
  23. package/types/ui/RoleSelector/index.d.ts +7 -1
  24. package/types/ui/UIFilePreview/RichDocEditor/index.d.ts +0 -13
  25. package/types/ui/UIFilePreview/WordEditor/style.d.ts +0 -6
  26. package/types/ui/UIFileUpload.d.ts +2 -2
  27. package/types/ui/index.d.ts +1 -10
  28. package/types/ui/upload/index.d.ts +6 -0
  29. package/types/ui.d.ts +1 -1
  30. package/types/utils/CacheIndexedDB.d.ts +9 -0
  31. package/types/utils/index.d.ts +2 -2
  32. package/types/utils/mailto.d.ts +12 -0
  33. package/types/utils.d.ts +1 -1
  34. package/public/cmaps/78-EUC-H.bcmap +0 -0
  35. package/public/cmaps/78-EUC-V.bcmap +0 -0
  36. package/public/cmaps/78-H.bcmap +0 -0
  37. package/public/cmaps/78-RKSJ-H.bcmap +0 -0
  38. package/public/cmaps/78-RKSJ-V.bcmap +0 -0
  39. package/public/cmaps/78-V.bcmap +0 -0
  40. package/public/cmaps/78ms-RKSJ-H.bcmap +0 -0
  41. package/public/cmaps/78ms-RKSJ-V.bcmap +0 -0
  42. package/public/cmaps/83pv-RKSJ-H.bcmap +0 -0
  43. package/public/cmaps/90ms-RKSJ-H.bcmap +0 -0
  44. package/public/cmaps/90ms-RKSJ-V.bcmap +0 -0
  45. package/public/cmaps/90msp-RKSJ-H.bcmap +0 -0
  46. package/public/cmaps/90msp-RKSJ-V.bcmap +0 -0
  47. package/public/cmaps/90pv-RKSJ-H.bcmap +0 -0
  48. package/public/cmaps/90pv-RKSJ-V.bcmap +0 -0
  49. package/public/cmaps/Add-H.bcmap +0 -0
  50. package/public/cmaps/Add-RKSJ-H.bcmap +0 -0
  51. package/public/cmaps/Add-RKSJ-V.bcmap +0 -0
  52. package/public/cmaps/Add-V.bcmap +0 -0
  53. package/public/cmaps/Adobe-CNS1-0.bcmap +0 -0
  54. package/public/cmaps/Adobe-CNS1-1.bcmap +0 -0
  55. package/public/cmaps/Adobe-CNS1-2.bcmap +0 -0
  56. package/public/cmaps/Adobe-CNS1-3.bcmap +0 -0
  57. package/public/cmaps/Adobe-CNS1-4.bcmap +0 -0
  58. package/public/cmaps/Adobe-CNS1-5.bcmap +0 -0
  59. package/public/cmaps/Adobe-CNS1-6.bcmap +0 -0
  60. package/public/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
  61. package/public/cmaps/Adobe-GB1-0.bcmap +0 -0
  62. package/public/cmaps/Adobe-GB1-1.bcmap +0 -0
  63. package/public/cmaps/Adobe-GB1-2.bcmap +0 -0
  64. package/public/cmaps/Adobe-GB1-3.bcmap +0 -0
  65. package/public/cmaps/Adobe-GB1-4.bcmap +0 -0
  66. package/public/cmaps/Adobe-GB1-5.bcmap +0 -0
  67. package/public/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
  68. package/public/cmaps/Adobe-Japan1-0.bcmap +0 -0
  69. package/public/cmaps/Adobe-Japan1-1.bcmap +0 -0
  70. package/public/cmaps/Adobe-Japan1-2.bcmap +0 -0
  71. package/public/cmaps/Adobe-Japan1-3.bcmap +0 -0
  72. package/public/cmaps/Adobe-Japan1-4.bcmap +0 -0
  73. package/public/cmaps/Adobe-Japan1-5.bcmap +0 -0
  74. package/public/cmaps/Adobe-Japan1-6.bcmap +0 -0
  75. package/public/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
  76. package/public/cmaps/Adobe-Korea1-0.bcmap +0 -0
  77. package/public/cmaps/Adobe-Korea1-1.bcmap +0 -0
  78. package/public/cmaps/Adobe-Korea1-2.bcmap +0 -0
  79. package/public/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
  80. package/public/cmaps/B5-H.bcmap +0 -0
  81. package/public/cmaps/B5-V.bcmap +0 -0
  82. package/public/cmaps/B5pc-H.bcmap +0 -0
  83. package/public/cmaps/B5pc-V.bcmap +0 -0
  84. package/public/cmaps/CNS-EUC-H.bcmap +0 -0
  85. package/public/cmaps/CNS-EUC-V.bcmap +0 -0
  86. package/public/cmaps/CNS1-H.bcmap +0 -0
  87. package/public/cmaps/CNS1-V.bcmap +0 -0
  88. package/public/cmaps/CNS2-H.bcmap +0 -0
  89. package/public/cmaps/CNS2-V.bcmap +0 -3
  90. package/public/cmaps/ETHK-B5-H.bcmap +0 -0
  91. package/public/cmaps/ETHK-B5-V.bcmap +0 -0
  92. package/public/cmaps/ETen-B5-H.bcmap +0 -0
  93. package/public/cmaps/ETen-B5-V.bcmap +0 -0
  94. package/public/cmaps/ETenms-B5-H.bcmap +0 -3
  95. package/public/cmaps/ETenms-B5-V.bcmap +0 -0
  96. package/public/cmaps/EUC-H.bcmap +0 -0
  97. package/public/cmaps/EUC-V.bcmap +0 -0
  98. package/public/cmaps/Ext-H.bcmap +0 -0
  99. package/public/cmaps/Ext-RKSJ-H.bcmap +0 -0
  100. package/public/cmaps/Ext-RKSJ-V.bcmap +0 -0
  101. package/public/cmaps/Ext-V.bcmap +0 -0
  102. package/public/cmaps/GB-EUC-H.bcmap +0 -0
  103. package/public/cmaps/GB-EUC-V.bcmap +0 -0
  104. package/public/cmaps/GB-H.bcmap +0 -4
  105. package/public/cmaps/GB-V.bcmap +0 -0
  106. package/public/cmaps/GBK-EUC-H.bcmap +0 -0
  107. package/public/cmaps/GBK-EUC-V.bcmap +0 -0
  108. package/public/cmaps/GBK2K-H.bcmap +0 -0
  109. package/public/cmaps/GBK2K-V.bcmap +0 -0
  110. package/public/cmaps/GBKp-EUC-H.bcmap +0 -0
  111. package/public/cmaps/GBKp-EUC-V.bcmap +0 -0
  112. package/public/cmaps/GBT-EUC-H.bcmap +0 -0
  113. package/public/cmaps/GBT-EUC-V.bcmap +0 -0
  114. package/public/cmaps/GBT-H.bcmap +0 -0
  115. package/public/cmaps/GBT-V.bcmap +0 -0
  116. package/public/cmaps/GBTpc-EUC-H.bcmap +0 -0
  117. package/public/cmaps/GBTpc-EUC-V.bcmap +0 -0
  118. package/public/cmaps/GBpc-EUC-H.bcmap +0 -0
  119. package/public/cmaps/GBpc-EUC-V.bcmap +0 -0
  120. package/public/cmaps/H.bcmap +0 -0
  121. package/public/cmaps/HKdla-B5-H.bcmap +0 -0
  122. package/public/cmaps/HKdla-B5-V.bcmap +0 -0
  123. package/public/cmaps/HKdlb-B5-H.bcmap +0 -0
  124. package/public/cmaps/HKdlb-B5-V.bcmap +0 -0
  125. package/public/cmaps/HKgccs-B5-H.bcmap +0 -0
  126. package/public/cmaps/HKgccs-B5-V.bcmap +0 -0
  127. package/public/cmaps/HKm314-B5-H.bcmap +0 -0
  128. package/public/cmaps/HKm314-B5-V.bcmap +0 -0
  129. package/public/cmaps/HKm471-B5-H.bcmap +0 -0
  130. package/public/cmaps/HKm471-B5-V.bcmap +0 -0
  131. package/public/cmaps/HKscs-B5-H.bcmap +0 -0
  132. package/public/cmaps/HKscs-B5-V.bcmap +0 -0
  133. package/public/cmaps/Hankaku.bcmap +0 -0
  134. package/public/cmaps/Hiragana.bcmap +0 -0
  135. package/public/cmaps/KSC-EUC-H.bcmap +0 -0
  136. package/public/cmaps/KSC-EUC-V.bcmap +0 -0
  137. package/public/cmaps/KSC-H.bcmap +0 -0
  138. package/public/cmaps/KSC-Johab-H.bcmap +0 -0
  139. package/public/cmaps/KSC-Johab-V.bcmap +0 -0
  140. package/public/cmaps/KSC-V.bcmap +0 -0
  141. package/public/cmaps/KSCms-UHC-H.bcmap +0 -0
  142. package/public/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
  143. package/public/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
  144. package/public/cmaps/KSCms-UHC-V.bcmap +0 -0
  145. package/public/cmaps/KSCpc-EUC-H.bcmap +0 -0
  146. package/public/cmaps/KSCpc-EUC-V.bcmap +0 -0
  147. package/public/cmaps/Katakana.bcmap +0 -0
  148. package/public/cmaps/LICENSE +0 -36
  149. package/public/cmaps/NWP-H.bcmap +0 -0
  150. package/public/cmaps/NWP-V.bcmap +0 -0
  151. package/public/cmaps/RKSJ-H.bcmap +0 -0
  152. package/public/cmaps/RKSJ-V.bcmap +0 -0
  153. package/public/cmaps/Roman.bcmap +0 -0
  154. package/public/cmaps/UniCNS-UCS2-H.bcmap +0 -0
  155. package/public/cmaps/UniCNS-UCS2-V.bcmap +0 -0
  156. package/public/cmaps/UniCNS-UTF16-H.bcmap +0 -0
  157. package/public/cmaps/UniCNS-UTF16-V.bcmap +0 -0
  158. package/public/cmaps/UniCNS-UTF32-H.bcmap +0 -0
  159. package/public/cmaps/UniCNS-UTF32-V.bcmap +0 -0
  160. package/public/cmaps/UniCNS-UTF8-H.bcmap +0 -0
  161. package/public/cmaps/UniCNS-UTF8-V.bcmap +0 -0
  162. package/public/cmaps/UniGB-UCS2-H.bcmap +0 -0
  163. package/public/cmaps/UniGB-UCS2-V.bcmap +0 -0
  164. package/public/cmaps/UniGB-UTF16-H.bcmap +0 -0
  165. package/public/cmaps/UniGB-UTF16-V.bcmap +0 -0
  166. package/public/cmaps/UniGB-UTF32-H.bcmap +0 -0
  167. package/public/cmaps/UniGB-UTF32-V.bcmap +0 -0
  168. package/public/cmaps/UniGB-UTF8-H.bcmap +0 -0
  169. package/public/cmaps/UniGB-UTF8-V.bcmap +0 -0
  170. package/public/cmaps/UniJIS-UCS2-H.bcmap +0 -0
  171. package/public/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
  172. package/public/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
  173. package/public/cmaps/UniJIS-UCS2-V.bcmap +0 -0
  174. package/public/cmaps/UniJIS-UTF16-H.bcmap +0 -0
  175. package/public/cmaps/UniJIS-UTF16-V.bcmap +0 -0
  176. package/public/cmaps/UniJIS-UTF32-H.bcmap +0 -0
  177. package/public/cmaps/UniJIS-UTF32-V.bcmap +0 -0
  178. package/public/cmaps/UniJIS-UTF8-H.bcmap +0 -0
  179. package/public/cmaps/UniJIS-UTF8-V.bcmap +0 -0
  180. package/public/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
  181. package/public/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
  182. package/public/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
  183. package/public/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
  184. package/public/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
  185. package/public/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
  186. package/public/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
  187. package/public/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
  188. package/public/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
  189. package/public/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
  190. package/public/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
  191. package/public/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
  192. package/public/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
  193. package/public/cmaps/UniKS-UCS2-H.bcmap +0 -0
  194. package/public/cmaps/UniKS-UCS2-V.bcmap +0 -0
  195. package/public/cmaps/UniKS-UTF16-H.bcmap +0 -0
  196. package/public/cmaps/UniKS-UTF16-V.bcmap +0 -0
  197. package/public/cmaps/UniKS-UTF32-H.bcmap +0 -0
  198. package/public/cmaps/UniKS-UTF32-V.bcmap +0 -0
  199. package/public/cmaps/UniKS-UTF8-H.bcmap +0 -0
  200. package/public/cmaps/UniKS-UTF8-V.bcmap +0 -0
  201. package/public/cmaps/V.bcmap +0 -0
  202. package/public/cmaps/WP-Symbol.bcmap +0 -0
  203. package/public/polyfills/polyfills.js +0 -802
  204. package/public/vendor/docx/docx.worker.js +0 -5
  205. package/public/vendor/docx/jszip.min.js +0 -13
  206. package/public/vendor/libarchive/libarchive.wasm +0 -0
  207. package/public/vendor/libarchive/worker-bundle.js +0 -6
  208. package/public/vendor/pptx/pptx.worker.js +0 -26
  209. package/public/wasm/cad/0.8.2/dwfv-render.wasm +0 -0
  210. package/public/wasm/cad/0.8.2/dwg-worker.js +0 -24
  211. package/public/wasm/cad/0.8.2/dwg-worker.js.map +0 -1
  212. package/public/wasm/cad/0.8.2/libredwg-web.js +0 -2
  213. package/public/wasm/cad/0.8.2/libredwg-web.wasm +0 -0
  214. package/public/wasm/cad/dwfv-render.wasm +0 -0
  215. package/public/wasm/cad/dwg-worker.js +0 -24
  216. package/public/wasm/cad/dwg-worker.js.map +0 -1
  217. package/public/wasm/cad/libredwg-web.js +0 -2
  218. package/public/wasm/cad/libredwg-web.wasm +0 -0
  219. package/public/wasm/data/sql-wasm.wasm +0 -0
  220. package/public/wasm/hdiff.wasm +0 -0
  221. package/public/wasm/model/LICENSE.occt-import-js.txt +0 -504
  222. package/public/wasm/model/LICENSE.occt.txt +0 -502
  223. package/public/wasm/model/occt-import-js.js +0 -19
  224. package/public/wasm/model/occt-import-js.wasm +0 -0
  225. package/public/wasm/model/occt-worker.js +0 -83
  226. package/public/wasm/typst/fonts/DejaVuSansMono-Bold.ttf +0 -0
  227. package/public/wasm/typst/fonts/DejaVuSansMono-BoldOblique.ttf +0 -0
  228. package/public/wasm/typst/fonts/DejaVuSansMono-Oblique.ttf +0 -0
  229. package/public/wasm/typst/fonts/DejaVuSansMono.ttf +0 -0
  230. package/public/wasm/typst/fonts/LibertinusSerif-Bold.otf +0 -0
  231. package/public/wasm/typst/fonts/LibertinusSerif-BoldItalic.otf +0 -0
  232. package/public/wasm/typst/fonts/LibertinusSerif-Italic.otf +0 -0
  233. package/public/wasm/typst/fonts/LibertinusSerif-Regular.otf +0 -0
  234. package/public/wasm/typst/fonts/LibertinusSerif-Semibold.otf +0 -0
  235. package/public/wasm/typst/fonts/LibertinusSerif-SemiboldItalic.otf +0 -0
  236. package/public/wasm/typst/fonts/NewCM10-Bold.otf +0 -0
  237. package/public/wasm/typst/fonts/NewCM10-BoldItalic.otf +0 -0
  238. package/public/wasm/typst/fonts/NewCM10-Italic.otf +0 -0
  239. package/public/wasm/typst/fonts/NewCM10-Regular.otf +0 -0
  240. package/public/wasm/typst/fonts/NewCMMath-Bold.otf +0 -0
  241. package/public/wasm/typst/fonts/NewCMMath-Book.otf +0 -0
  242. package/public/wasm/typst/fonts/NewCMMath-Regular.otf +0 -0
  243. package/public/wasm/typst/fonts/README.md +0 -7
  244. package/public/wasm/typst/typst_ts_renderer_bg.wasm +0 -0
  245. package/public/wasm/typst/typst_ts_web_compiler_bg.wasm +0 -0
  246. package/scripts/patch-docx-grid.cjs +0 -412
  247. package/src/api/_base.ts +0 -243
  248. package/src/api/index.ts +0 -17
  249. package/src/api/project.ts +0 -1345
  250. package/src/api/user.ts +0 -1174
  251. package/src/contract.ts +0 -50
  252. package/src/hooks/index.ts +0 -2
  253. package/src/hooks/useLongPress.ts +0 -137
  254. package/src/hooks/useOnlineStatus.ts +0 -22
  255. package/src/index.ts +0 -14
  256. package/src/types/id.ts +0 -2
  257. package/src/types/index.ts +0 -5
  258. package/src/types/project/base.ts +0 -63
  259. package/src/types/project/contract.ts +0 -79
  260. package/src/types/project/contractStatus.tsx +0 -15
  261. package/src/types/project/index.ts +0 -5
  262. package/src/types/project/member.ts +0 -46
  263. package/src/types/project/progress.ts +0 -43
  264. package/src/types/projectRole.ts +0 -17
  265. package/src/types/theme.ts +0 -1
  266. package/src/types/user/index.ts +0 -1
  267. package/src/types/user/role.ts +0 -7
  268. package/src/ui/CommentTimeline/index.tsx +0 -330
  269. package/src/ui/FileManager/FileContextMenu.tsx +0 -628
  270. package/src/ui/FileManager/FileGridView.tsx +0 -529
  271. package/src/ui/FileManager/FileTableView.tsx +0 -405
  272. package/src/ui/FileManager/FileToolbar.tsx +0 -119
  273. package/src/ui/FileManager/FileVersionHistoryModal.tsx +0 -175
  274. package/src/ui/FileManager/MoveCopyToProjectModal.tsx +0 -119
  275. package/src/ui/FileManager/ShareToWechatModal.tsx +0 -419
  276. package/src/ui/FileManager/hooks/useFileManagerActions.ts +0 -2532
  277. package/src/ui/FileManager/hooks/useFileManagerState.ts +0 -419
  278. package/src/ui/FileManager/index.tsx +0 -580
  279. package/src/ui/FileManager/projectFileManagerApi.ts +0 -57
  280. package/src/ui/FileManager/types.ts +0 -184
  281. package/src/ui/FileManager/utils/fileDeltaWorker.ts +0 -193
  282. package/src/ui/FileManager/utils/fileTree.ts +0 -178
  283. package/src/ui/FileManager/utils/fileUpload.ts +0 -714
  284. package/src/ui/FileManager/utils/fileUtils.ts +0 -65
  285. package/src/ui/InvoiceRecordsList/index.tsx +0 -813
  286. package/src/ui/MyFileSelectorModal.tsx +0 -261
  287. package/src/ui/ProjectSelector/index.tsx +0 -472
  288. package/src/ui/ProjectSelector/projectCache.ts +0 -40
  289. package/src/ui/RoleSelector/index.tsx +0 -473
  290. package/src/ui/RoleSelector/roleCache.ts +0 -40
  291. package/src/ui/UIAlert.tsx +0 -399
  292. package/src/ui/UIAlertExample.tsx +0 -129
  293. package/src/ui/UIConfirm.tsx +0 -335
  294. package/src/ui/UIConfirmExample.tsx +0 -165
  295. package/src/ui/UIDatePicker.tsx +0 -146
  296. package/src/ui/UIDateRangePicker.tsx +0 -38
  297. package/src/ui/UIFilePreview/ExcelEditor/index.tsx +0 -617
  298. package/src/ui/UIFilePreview/ExcelEditor/types.ts +0 -24
  299. package/src/ui/UIFilePreview/ExportDropdown.css +0 -85
  300. package/src/ui/UIFilePreview/ExportDropdown.tsx +0 -109
  301. package/src/ui/UIFilePreview/IndexedDBUtils.ts +0 -564
  302. package/src/ui/UIFilePreview/MarkdownEditor/exportMarkdownPdf.ts +0 -576
  303. package/src/ui/UIFilePreview/MarkdownEditor/index.tsx +0 -677
  304. package/src/ui/UIFilePreview/MarkdownEditor/markdownEditor.css +0 -1005
  305. package/src/ui/UIFilePreview/MarkdownEditor/types.ts +0 -15
  306. package/src/ui/UIFilePreview/PPTXEditor/index.tsx +0 -602
  307. package/src/ui/UIFilePreview/RichDocEditor/exportRDocMarkdown.ts +0 -77
  308. package/src/ui/UIFilePreview/RichDocEditor/exportRDocPdf.ts +0 -374
  309. package/src/ui/UIFilePreview/RichDocEditor/index.tsx +0 -730
  310. package/src/ui/UIFilePreview/RichDocEditor/richdoc-editor.css +0 -59
  311. package/src/ui/UIFilePreview/UIFilePreview.tsx +0 -611
  312. package/src/ui/UIFilePreview/WordEditor/index.tsx +0 -3933
  313. package/src/ui/UIFilePreview/WordEditor/style.ts +0 -1213
  314. package/src/ui/UIFilePreview/WordEditor/word-editor.css +0 -999
  315. package/src/ui/UIFilePreview/filePreview.css +0 -193
  316. package/src/ui/UIFilePreview/filetypes/archive.tsx +0 -66
  317. package/src/ui/UIFilePreview/filetypes/cad.tsx +0 -287
  318. package/src/ui/UIFilePreview/filetypes/excel.tsx +0 -355
  319. package/src/ui/UIFilePreview/filetypes/image.tsx +0 -20
  320. package/src/ui/UIFilePreview/filetypes/imageLoader.ts +0 -63
  321. package/src/ui/UIFilePreview/filetypes/pdf.tsx +0 -156
  322. package/src/ui/UIFilePreview/filetypes/ppt.tsx +0 -535
  323. package/src/ui/UIFilePreview/filetypes/pptExportPdf.ts +0 -523
  324. package/src/ui/UIFilePreview/filetypes/video.tsx +0 -482
  325. package/src/ui/UIFilePreview/filetypes/word.tsx +0 -245
  326. package/src/ui/UIFilePreview/filetypes/wordExportMarkdown.ts +0 -86
  327. package/src/ui/UIFilePreview/filetypes/wordExportPdf.tsx +0 -427
  328. package/src/ui/UIFilePreview/index.ts +0 -35
  329. package/src/ui/UIFilePreview/pdfPagination.ts +0 -143
  330. package/src/ui/UIFilePreview/previewUtils.tsx +0 -531
  331. package/src/ui/UIFileUpload.tsx +0 -382
  332. package/src/ui/UIImageUpload.tsx +0 -195
  333. package/src/ui/UILoading.tsx +0 -255
  334. package/src/ui/UILoadingExample.tsx +0 -139
  335. package/src/ui/UISelect.tsx +0 -105
  336. package/src/ui/UIToast.tsx +0 -381
  337. package/src/ui/UIToastExample.tsx +0 -69
  338. package/src/ui/UIToastSingle.tsx +0 -279
  339. package/src/ui/UIViewToggle.tsx +0 -64
  340. package/src/ui/UserSelector/index.tsx +0 -583
  341. package/src/ui/index.ts +0 -84
  342. package/src/ui/upload/image.ts +0 -135
  343. package/src/ui/upload/index.ts +0 -73
  344. package/src/ui/upload/submitFile.ts +0 -106
  345. package/src/ui/upload/submitForm.ts +0 -124
  346. package/src/ui/upload/upload.err.ts +0 -15
  347. package/src/ui/upload/upload.ts +0 -250
  348. package/src/utils/CacheDepartmentInfo.ts +0 -372
  349. package/src/utils/CacheFileContent.ts +0 -315
  350. package/src/utils/CachePermissionInfo.ts +0 -235
  351. package/src/utils/CacheRoleInfo.ts +0 -303
  352. package/src/utils/CacheUserInfo.ts +0 -818
  353. package/src/utils/CacheViewToggleInfo.ts +0 -182
  354. package/src/utils/MessageContentUtils.ts +0 -268
  355. package/src/utils/clipboard.ts +0 -70
  356. package/src/utils/companyEmail.ts +0 -19
  357. package/src/utils/forbidDebugger.ts +0 -59
  358. package/src/utils/formatters.ts +0 -94
  359. package/src/utils/htmlUtils.tsx +0 -59
  360. package/src/utils/index.ts +0 -18
  361. package/src/utils/keyboard.ts +0 -114
  362. package/src/utils/mammothApi.ts +0 -16
  363. package/src/utils/polyfills.ts +0 -928
  364. package/src/utils/regex.ts +0 -14
  365. package/src/utils/storage.ts +0 -95
  366. package/src/utils/workerBootstrap.ts +0 -87
  367. /package/{src → dist}/styles/ant-modal.css +0 -0
  368. /package/{src → dist}/styles/ant-spin.css +0 -0
@@ -1,355 +0,0 @@
1
- import React, { useEffect, useRef, useState } from 'react';
2
- import * as XLSX from 'xlsx';
3
- import { UniverSheetsCorePreset } from '@univerjs/preset-sheets-core';
4
- import UniverPresetSheetsCoreZhCN from '@univerjs/preset-sheets-core/locales/zh-CN';
5
- import { createUniver, LocaleType, mergeLocales } from '@univerjs/presets';
6
- import '@univerjs/preset-sheets-core/lib/index.css';
7
-
8
- export interface ExcelPreviewProps {
9
- file: File | null;
10
- }
11
-
12
- type PreviewStatus = 'loading' | 'ready' | 'error';
13
-
14
- type UniverAPI = ReturnType<typeof createUniver>['univerAPI'];
15
-
16
- /**
17
- * 把 SheetJS 工作簿转换为 Univer 的 IWorkbookData(只读预览用)。
18
- * 覆盖:多工作表、值类型、公式、合并单元格、列宽行高、隐藏行列/工作表、冻结窗格、日期/数字格式。
19
- */
20
- function convertWorkbook(workbook: XLSX.WorkBook, fileName: string): Record<string, unknown> {
21
- const sheets: Record<string, unknown> = {};
22
- const sheetOrder: string[] = [];
23
-
24
- const hiddenMap = new Map<string, boolean>();
25
- (workbook.Workbook?.Sheets ?? []).forEach((meta) => {
26
- if (meta.name) hiddenMap.set(meta.name, Boolean(meta.Hidden));
27
- });
28
-
29
- workbook.SheetNames.forEach((sheetName, sheetIndex) => {
30
- const worksheet = workbook.Sheets[sheetName];
31
- const sheetId = `sheet-${sheetIndex + 1}`;
32
-
33
- const cellData: Record<number, Record<number, unknown>> = {};
34
- let maxRow = 0;
35
- let maxColumn = 0;
36
-
37
- // 单元格
38
- Object.keys(worksheet).forEach((address) => {
39
- if (address.startsWith('!')) return;
40
- const cell = worksheet[address] as XLSX.CellObject | undefined;
41
- if (!cell) return;
42
-
43
- const { r, c } = XLSX.utils.decode_cell(address);
44
- maxRow = Math.max(maxRow, r);
45
- maxColumn = Math.max(maxColumn, c);
46
-
47
- const univerCell: Record<string, unknown> = {};
48
-
49
- // 公式(SheetJS 的 f 不含开头的 '=')
50
- if (typeof cell.f === 'string' && cell.f.length > 0) {
51
- univerCell.f = cell.f.startsWith('=') ? cell.f.slice(1) : cell.f;
52
- }
53
-
54
- // 值:保留原始类型(数字/布尔/字符串),日期转换为 Excel 序列值
55
- const rawValue = cell.v;
56
- if (rawValue !== undefined && rawValue !== null && rawValue !== '') {
57
- if (cell.t === 'd' && rawValue instanceof Date) {
58
- univerCell.v = dateToExcelSerial(rawValue);
59
- univerCell.s = { n: { pattern: normalizeNumfmt(cell.z) || 'yyyy-mm-dd' } };
60
- } else if (cell.t === 'n' && typeof rawValue === 'number') {
61
- univerCell.v = rawValue;
62
- const pattern = normalizeNumfmt(cell.z);
63
- if (pattern) univerCell.s = { n: { pattern } };
64
- } else if (cell.t === 'b') {
65
- univerCell.v = Boolean(rawValue);
66
- } else {
67
- univerCell.v = String(rawValue);
68
- }
69
- }
70
-
71
- if (Object.keys(univerCell).length > 0) {
72
- if (!cellData[r]) cellData[r] = {};
73
- cellData[r][c] = univerCell;
74
- }
75
- });
76
-
77
- // 合并单元格
78
- const mergeData = (worksheet['!merges'] ?? []).map((range) => ({
79
- startRow: range.s.r,
80
- startColumn: range.s.c,
81
- endRow: range.e.r,
82
- endColumn: range.e.c,
83
- }));
84
- (worksheet['!merges'] ?? []).forEach((range) => {
85
- maxRow = Math.max(maxRow, range.e.r);
86
- maxColumn = Math.max(maxColumn, range.e.c);
87
- });
88
-
89
- // 列宽
90
- const columnData: Record<number, { w?: number; hd?: 1 }> = {};
91
- (worksheet['!cols'] ?? []).forEach((col, index) => {
92
- const column: { w?: number; hd?: 1 } = {};
93
- if (typeof col.wpx === 'number') column.w = Math.round(col.wpx);
94
- else if (typeof col.wch === 'number') column.w = Math.round(col.wch * 7 + 5);
95
- if (col.hidden) column.hd = 1;
96
- if (column.w !== undefined || column.hd !== undefined) columnData[index] = column;
97
- });
98
-
99
- // 行高
100
- const rowData: Record<number, { h?: number; hd?: 1 }> = {};
101
- (worksheet['!rows'] ?? []).forEach((row, index) => {
102
- const rowInfo: { h?: number; hd?: 1 } = {};
103
- if (typeof row.hpx === 'number') rowInfo.h = Math.round(row.hpx);
104
- else if (typeof row.hpt === 'number') rowInfo.h = Math.round((row.hpt * 96) / 72);
105
- if (row.hidden) rowInfo.hd = 1;
106
- if (rowInfo.h !== undefined || rowInfo.hd !== undefined) rowData[index] = rowInfo;
107
- });
108
-
109
- // 冻结窗格(部分格式/版本下 SheetJS 可能不提供)
110
- const freezePane = (worksheet as XLSX.WorkSheet & {
111
- '!freeze'?: { xSplit?: number; ySplit?: number; topLeftCell?: string };
112
- })['!freeze'];
113
- let freeze: { xSplit: number; ySplit: number; startRow: number; startColumn: number } | undefined;
114
- if (freezePane && (freezePane.xSplit || freezePane.ySplit)) {
115
- let startRow = freezePane.ySplit ?? 0;
116
- let startColumn = freezePane.xSplit ?? 0;
117
- if (freezePane.topLeftCell) {
118
- const anchor = XLSX.utils.decode_cell(freezePane.topLeftCell);
119
- startRow = anchor.r;
120
- startColumn = anchor.c;
121
- }
122
- freeze = {
123
- xSplit: freezePane.xSplit ?? 0,
124
- ySplit: freezePane.ySplit ?? 0,
125
- startRow,
126
- startColumn,
127
- };
128
- }
129
-
130
- // 实际使用范围(!ref 可能比已解析单元格更大)
131
- let refMaxRow = maxRow;
132
- let refMaxColumn = maxColumn;
133
- if (worksheet['!ref']) {
134
- const range = XLSX.utils.decode_range(worksheet['!ref']);
135
- refMaxRow = Math.max(refMaxRow, range.e.r);
136
- refMaxColumn = Math.max(refMaxColumn, range.e.c);
137
- }
138
-
139
- sheets[sheetId] = {
140
- id: sheetId,
141
- name: sheetName,
142
- hidden: hiddenMap.get(sheetName) ? 1 : 0,
143
- ...(freeze ? { freeze } : {}),
144
- rowCount: Math.max(refMaxRow + 1, 100),
145
- columnCount: Math.max(refMaxColumn + 1, 26),
146
- defaultColumnWidth: 88,
147
- defaultRowHeight: 24,
148
- showGridlines: 1,
149
- rowHeader: { width: 46 },
150
- columnHeader: { height: 22 },
151
- mergeData,
152
- cellData,
153
- rowData,
154
- columnData,
155
- };
156
- sheetOrder.push(sheetId);
157
- });
158
-
159
- return {
160
- id: `workbook-preview-${Date.now()}`,
161
- name: fileName,
162
- sheetOrder,
163
- sheets,
164
- };
165
- }
166
-
167
- /** JS Date 转 Excel 1900 日期系统的序列值(兼容 Excel 1900 闰年 Bug)。 */
168
- function dateToExcelSerial(date: Date): number {
169
- const epoch = Date.UTC(1899, 11, 30);
170
- const current = Date.UTC(
171
- date.getFullYear(),
172
- date.getMonth(),
173
- date.getDate(),
174
- date.getHours(),
175
- date.getMinutes(),
176
- date.getSeconds(),
177
- );
178
- return (current - epoch) / 86_400_000;
179
- }
180
-
181
- /** Excel 内置数字格式 ID(数字形式 z)中常见的日期/时间格式。 */
182
- const BUILTIN_NUMFMT: Record<number, string> = {
183
- 14: 'yyyy/m/d',
184
- 15: 'd-mmm-yy',
185
- 16: 'd-mmm',
186
- 17: 'mmm-yy',
187
- 18: 'h:mm AM/PM',
188
- 19: 'h:mm:ss AM/PM',
189
- 20: 'h:mm',
190
- 21: 'h:mm:ss',
191
- 22: 'yyyy/m/d h:mm',
192
- 27: 'yyyy-mm-dd',
193
- 28: 'mmm-dd',
194
- };
195
-
196
- /**
197
- * 归一化数字格式:General 等通用格式无需写入 Univer;
198
- * 内置格式 ID 映射为日期/时间模式;其余 Excel 格式串与 Univer 基本兼容,直接透传。
199
- */
200
- function normalizeNumfmt(pattern?: string | number): string | undefined {
201
- if (pattern === undefined || pattern === null) return undefined;
202
- if (typeof pattern === 'number') return BUILTIN_NUMFMT[pattern];
203
- const trimmed = pattern.trim();
204
- if (!trimmed || trimmed.toLowerCase() === 'general') return undefined;
205
- return trimmed;
206
- }
207
-
208
- export const ExcelPreview: React.FC<ExcelPreviewProps> = ({ file }) => {
209
- const [status, setStatus] = useState<PreviewStatus>('loading');
210
- const [retryTick, setRetryTick] = useState(0);
211
- const containerRef = useRef<HTMLDivElement>(null);
212
-
213
- useEffect(() => {
214
- if (!file || !containerRef.current) return;
215
-
216
- let disposed = false;
217
- let univerAPI: UniverAPI | null = null;
218
-
219
- setStatus('loading');
220
-
221
- (async () => {
222
- try {
223
- const arrayBuffer = await file.arrayBuffer();
224
- // cellDates: 日期单元格解析为 JS Date;cellNF: 保留数字格式串到 cell.z
225
- const workbook = XLSX.read(arrayBuffer, { type: 'array', cellDates: true, cellNF: true });
226
- const workbookData = convertWorkbook(workbook, file.name);
227
-
228
- if (disposed || !containerRef.current) return;
229
-
230
- const instance = createUniver({
231
- locale: LocaleType.ZH_CN,
232
- locales: {
233
- [LocaleType.ZH_CN]: mergeLocales(UniverPresetSheetsCoreZhCN),
234
- },
235
- presets: [
236
- UniverSheetsCorePreset({
237
- container: containerRef.current,
238
- header: true,
239
- toolbar: true,
240
- formulaBar: true,
241
- contextMenu: true,
242
- }),
243
- ],
244
- });
245
- univerAPI = instance.univerAPI;
246
-
247
- if (disposed) {
248
- univerAPI.dispose();
249
- univerAPI = null;
250
- return;
251
- }
252
-
253
- const univerWorkbook = univerAPI.createWorkbook(workbookData as any);
254
- // 只读预览:禁止编辑,保留选中、滚动、多工作表切换
255
- univerWorkbook.setEditable(false);
256
-
257
- setStatus('ready');
258
- } catch (error) {
259
- console.error('[ExcelPreview] 文档加载失败:', error);
260
- if (!disposed) setStatus('error');
261
- }
262
- })();
263
-
264
- return () => {
265
- disposed = true;
266
- if (univerAPI) {
267
- univerAPI.dispose();
268
- univerAPI = null;
269
- }
270
- };
271
- }, [file, retryTick]);
272
-
273
- return (
274
- <div className="ui-file-preview-excel" data-global-context-menu-ignore="true">
275
- <style>
276
- {`.excel-loading-overlay {
277
- position: absolute;
278
- top: 0;
279
- left: 0;
280
- right: 0;
281
- bottom: 0;
282
- background: #ffffff;
283
- display: flex;
284
- flex-direction: column;
285
- align-items: center;
286
- justify-content: center;
287
- z-index: 100;
288
- }
289
- .excel-loading-spinner {
290
- width: 40px;
291
- height: 40px;
292
- border: 3px solid #f3f3f3;
293
- border-top: 3px solid #5292f7;
294
- border-radius: 50%;
295
- animation: excel-spin 1s linear infinite;
296
- }
297
- .excel-loading-text {
298
- margin-top: 16px;
299
- color: #666;
300
- font-size: 14px;
301
- }
302
- .excel-loading-error-icon {
303
- font-size: 48px;
304
- color: #f56c6c;
305
- }
306
- .excel-loading-error-text {
307
- margin-top: 16px;
308
- color: #f56c6c;
309
- font-size: 14px;
310
- }
311
- .excel-loading-retry-btn {
312
- margin-top: 20px;
313
- padding: 8px 24px;
314
- background: #5292f7;
315
- color: #fff;
316
- border: none;
317
- border-radius: 4px;
318
- cursor: pointer;
319
- font-size: 14px;
320
- }
321
- .excel-loading-retry-btn:hover {
322
- background: #67b8ff;
323
- }
324
- @keyframes excel-spin {
325
- 0% { transform: rotate(0deg); }
326
- 100% { transform: rotate(360deg); }
327
- }`}
328
- </style>
329
- {file && status !== 'ready' && (
330
- <div className="excel-loading-overlay">
331
- {status === 'error' ? (
332
- <>
333
- <div className="excel-loading-error-icon">✕</div>
334
- <div className="excel-loading-error-text">文档加载失败</div>
335
- <button
336
- className="excel-loading-retry-btn"
337
- onClick={() => setRetryTick((tick) => tick + 1)}
338
- >
339
- 重新加载
340
- </button>
341
- </>
342
- ) : (
343
- <>
344
- <div className="excel-loading-spinner"></div>
345
- <div className="excel-loading-text">加载中...</div>
346
- </>
347
- )}
348
- </div>
349
- )}
350
- {file ? (
351
- <div key={retryTick} ref={containerRef} style={{ width: '100%', height: '100dvh' }} />
352
- ) : null}
353
- </div>
354
- );
355
- };
@@ -1,20 +0,0 @@
1
- import React, { useState } from 'react';
2
-
3
- export interface ImagePreviewProps {
4
- containerRef: React.RefObject<HTMLDivElement>;
5
- type: string;
6
- }
7
-
8
- export const ImagePreview: React.FC<ImagePreviewProps> = ({ containerRef, type }) => {
9
- return (
10
- type === 'image' && (
11
- <div ref={containerRef}
12
- style={{
13
- display: type === 'image'? 'inherit': 'none',
14
- maxWidth: '100%',
15
- maxHeight: 'calc(100vh - 40px)',
16
- objectFit: 'contain'
17
- }}
18
- />
19
- ));
20
- };
@@ -1,63 +0,0 @@
1
- import type { Dispatch, RefObject, SetStateAction } from 'react';
2
- import * as febs from 'febs-browser';
3
-
4
- /**
5
- * 根据 ArrayBuffer 开头的 Magic Bytes 推断图片 MIME 类型。
6
- * 作为兜底方案:当 Content-Type 响应头/缓存类型都缺失时(尤其 Safari 缓存 Blob.type 丢失后),
7
- * 用于保证 <img src="blob:..."> 在 Safari 严格模式下仍能正确解码。
8
- */
9
- const detectImageMimeFromBuffer = (ab: ArrayBuffer): string => {
10
- if (!ab || ab.byteLength < 4) return '';
11
- const view = new Uint8Array(ab, 0, Math.min(16, ab.byteLength));
12
- // JPEG: FF D8 FF
13
- if (view[0] === 0xFF && view[1] === 0xD8 && view[2] === 0xFF) return 'image/jpeg';
14
- // PNG: 89 50 4E 47
15
- if (view[0] === 0x89 && view[1] === 0x50 && view[2] === 0x4E && view[3] === 0x47) return 'image/png';
16
- // GIF: 47 49 46 38
17
- if (view[0] === 0x47 && view[1] === 0x49 && view[2] === 0x46 && view[3] === 0x38) return 'image/gif';
18
- // WEBP: 52 49 46 46 .. .. .. .. 57 45 42 50 ("RIFF" + ... + "WEBP")
19
- if (view.length >= 12
20
- && view[0] === 0x52 && view[1] === 0x49 && view[2] === 0x46 && view[3] === 0x46
21
- && view[8] === 0x57 && view[9] === 0x45 && view[10] === 0x42 && view[11] === 0x50) return 'image/webp';
22
- // BMP: 42 4D
23
- if (view[0] === 0x42 && view[1] === 0x4D) return 'image/bmp';
24
- // SVG: <svg 开头的文本(text/xml 或 image/svg+xml)
25
- try {
26
- const head = new TextDecoder('utf-8').decode(view.slice(0, 16)).trimStart();
27
- if (head.startsWith('<svg') || head.startsWith('<?xml')) return 'image/svg+xml';
28
- } catch { /* ignore decode errors */ }
29
- return '';
30
- };
31
-
32
- export const loadImagePreview = async (
33
- buffer: {
34
- buffer: ArrayBuffer;
35
- headers: any;
36
- status: number;
37
- },
38
- imageRef: RefObject<HTMLDivElement>,
39
- ) => {
40
- const img = new Image();
41
- // 优先 headers → 再用 Magic Bytes 兜底(Safari Blob/IDB 的 Content-Type 可能被清空)
42
- let mimeType = buffer.headers?.get?.('Content-Type') || '';
43
- if (!mimeType) {
44
- mimeType = detectImageMimeFromBuffer(buffer.buffer);
45
- }
46
- const blob = new Blob([buffer.buffer], { type: mimeType });
47
- img.src = URL.createObjectURL(blob);
48
- img.onload = () => {
49
- img.style.maxWidth = '100%';
50
- img.style.maxHeight = 'calc(100vh - 40px)';
51
- img.style.objectFit = 'contain';
52
-
53
- (imageRef.current as any).innerHTML = '';
54
- (imageRef.current as any).appendChild(img);
55
- URL.revokeObjectURL(img.src);
56
- }
57
- };
58
-
59
- export const destroyImagePreview = (imageRef: RefObject<HTMLDivElement>) => {
60
- // if (imageRef.current) {
61
- // (imageRef.current as any).innerHTML = '';
62
- // }
63
- }
@@ -1,156 +0,0 @@
1
- import React, { useCallback, useEffect, useMemo, useRef } from 'react';
2
- import { FileViewer } from '@file-viewer/react';
3
- import { pdfRenderer } from '@file-viewer/renderer-pdf';
4
-
5
- /** localStorage 存储前缀 */
6
- const PROGRESS_STORAGE_PREFIX = 'reading-progress:';
7
-
8
- /** 防抖保存间隔(ms) */
9
- const SAVE_DEBOUNCE_MS = 500;
10
-
11
- /** 阅读进度记录 */
12
- interface ReadingProgressRecord {
13
- state: Record<string, unknown>;
14
- savedAt: number;
15
- }
16
-
17
- const readProgress = (key: string): Record<string, unknown> | undefined => {
18
- try {
19
- const raw = localStorage.getItem(PROGRESS_STORAGE_PREFIX + key);
20
- if (raw) {
21
- const parsed = JSON.parse(raw) as ReadingProgressRecord;
22
- return parsed.state;
23
- }
24
- } catch {
25
- // ignore
26
- }
27
- return undefined;
28
- };
29
-
30
- const writeProgress = (key: string, state: Record<string, unknown>) => {
31
- try {
32
- const record: ReadingProgressRecord = { state, savedAt: Date.now() };
33
- localStorage.setItem(PROGRESS_STORAGE_PREFIX + key, JSON.stringify(record));
34
- } catch {
35
- // ignore
36
- }
37
- };
38
-
39
- export interface PdfPreviewProps {
40
- file: File | null;
41
- /** 阅读进度本地存储 key(通常为文件 ID);未提供时不保存/恢复进度 */
42
- progressKey?: string;
43
- }
44
-
45
- export const PdfPreview: React.FC<PdfPreviewProps> = ({ file, progressKey }) => {
46
- const latestStateRef = useRef<Record<string, unknown> | null>(null);
47
- const saveTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
48
- const progressKeyRef = useRef(progressKey);
49
- progressKeyRef.current = progressKey;
50
-
51
- const initialViewState = useMemo(() => {
52
- if (!progressKey) return undefined;
53
- return readProgress(progressKey);
54
- }, [progressKey]);
55
-
56
- const onEvent = useCallback((event: { type: string; payload?: unknown }) => {
57
- if (event.type !== 'view-state-change' || !progressKey) return;
58
- const change = event.payload as { state?: Record<string, unknown> } | undefined;
59
- if (change?.state) {
60
- latestStateRef.current = change.state;
61
- if (saveTimerRef.current) clearTimeout(saveTimerRef.current);
62
- saveTimerRef.current = setTimeout(() => {
63
- if (latestStateRef.current) writeProgress(progressKey, latestStateRef.current);
64
- }, SAVE_DEBOUNCE_MS);
65
- }
66
- }, [progressKey]);
67
-
68
- useEffect(() => {
69
- return () => {
70
- if (saveTimerRef.current) {
71
- clearTimeout(saveTimerRef.current);
72
- saveTimerRef.current = null;
73
- }
74
- const key = progressKeyRef.current;
75
- if (key && latestStateRef.current) {
76
- writeProgress(key, latestStateRef.current);
77
- }
78
- };
79
- }, []);
80
-
81
- const pdfRenderers = [pdfRenderer];
82
-
83
- const options = useMemo(() => ({
84
- locale: 'zh-CN',
85
- rendererMode: 'replace' as const,
86
- renderers: pdfRenderers as any,
87
- theme: 'light' as const,
88
- toolbar: {
89
- position: 'bottom-right' as const,
90
- download: false,
91
- print: false,
92
- exportHtml: false,
93
- },
94
- pdf: {
95
- cMapUrl: '/cmaps/',
96
- defaultNavigationVisible: false,
97
- },
98
- initialViewState,
99
- }), [initialViewState]);
100
-
101
- return (
102
- <div className="ui-file-preview-pdf" data-global-context-menu-ignore="true">
103
- <style>
104
- {`.pdf-toolbar {
105
- padding-right: 50px !important;
106
- }
107
-
108
- /* 文本层提升到 canvas 之上,确保鼠标事件被文本层捕获 */
109
- .ui-file-preview-pdf .pdfViewer .page .textLayer {
110
- z-index: 2 !important;
111
- pointer-events: auto !important;
112
- }
113
-
114
- /* 强制覆盖权限模式和通用 user-select 规则 */
115
- .ui-file-preview-pdf .pdfViewer .textLayer span,
116
- .ui-file-preview-pdf .pdfViewer .textLayer br,
117
- .ui-file-preview-pdf .pdfViewer.enablePermissions .textLayer span {
118
- -webkit-user-select: text !important;
119
- -moz-user-select: text !important;
120
- user-select: text !important;
121
- cursor: text !important;
122
- pointer-events: auto !important;
123
- }
124
-
125
- /* 恢复选择高亮背景(PDF.js 默认设为透明导致选中时看不到) */
126
- .ui-file-preview-pdf .pdfViewer .textLayer ::selection,
127
- .ui-file-preview-pdf .pdfViewer .textLayer span::selection,
128
- .ui-file-preview-pdf .pdfViewer .textLayer br::selection {
129
- background: highlight !important;
130
- }
131
- .ui-file-preview-pdf .pdfViewer .textLayer ::-moz-selection,
132
- .ui-file-preview-pdf .pdfViewer .textLayer span::-moz-selection,
133
- .ui-file-preview-pdf .pdfViewer .textLayer br::-moz-selection {
134
- background: highlight !important;
135
- }
136
-
137
- /* 父级元素 user-select 统一放开 */
138
- .ui-file-preview-pdf .pdfViewer,
139
- .ui-file-preview-pdf .pdfViewer .page,
140
- .ui-file-preview-pdf .pdfViewer .textLayer {
141
- -webkit-user-select: text !important;
142
- -moz-user-select: text !important;
143
- user-select: text !important;
144
- }`}
145
- </style>
146
- {file ? (
147
- <FileViewer
148
- file={file}
149
- name={file.name}
150
- options={options}
151
- onEvent={onEvent}
152
- />
153
- ) : null}
154
- </div>
155
- );
156
- };