@l1yp/file-viewer 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.
- package/LICENSE +21 -0
- package/README.md +134 -0
- package/dist/FileViewer.js +7 -0
- package/dist/FileViewer.vue.d.ts +37 -0
- package/dist/FileViewer.vue_vue_type_script_setup_true_lang.js +103 -0
- package/dist/_virtual/_plugin-vue_export-helper.js +8 -0
- package/dist/components/AppxViewer.js +7 -0
- package/dist/components/AppxViewer.vue.d.ts +18 -0
- package/dist/components/AppxViewer.vue_vue_type_script_setup_true_lang.js +174 -0
- package/dist/components/ArchiveBrowser.js +7 -0
- package/dist/components/ArchiveBrowser.vue.d.ts +18 -0
- package/dist/components/ArchiveBrowser.vue_vue_type_script_setup_true_lang.js +279 -0
- package/dist/components/AudioViewer.js +7 -0
- package/dist/components/AudioViewer.vue.d.ts +21 -0
- package/dist/components/AudioViewer.vue_vue_type_script_setup_true_lang.js +201 -0
- package/dist/components/BinObjBrowser.js +7 -0
- package/dist/components/BinObjBrowser.vue.d.ts +19 -0
- package/dist/components/BinObjBrowser.vue_vue_type_script_setup_true_lang.js +141 -0
- package/dist/components/CertViewer.js +7 -0
- package/dist/components/CertViewer.vue.d.ts +17 -0
- package/dist/components/CertViewer.vue_vue_type_script_setup_true_lang.js +251 -0
- package/dist/components/ClassViewer.js +7 -0
- package/dist/components/ClassViewer.vue.d.ts +15 -0
- package/dist/components/ClassViewer.vue_vue_type_script_setup_true_lang.js +164 -0
- package/dist/components/CodeBlock.js +7 -0
- package/dist/components/CodeBlock.vue.d.ts +17 -0
- package/dist/components/CodeBlock.vue_vue_type_script_setup_true_lang.js +79 -0
- package/dist/components/CodeView.js +7 -0
- package/dist/components/CodeView.vue.d.ts +21 -0
- package/dist/components/CodeView.vue_vue_type_script_setup_true_lang.js +180 -0
- package/dist/components/CsvViewer.js +7 -0
- package/dist/components/CsvViewer.vue.d.ts +26 -0
- package/dist/components/CsvViewer.vue_vue_type_script_setup_true_lang.js +187 -0
- package/dist/components/DicomViewer.js +7 -0
- package/dist/components/DicomViewer.vue.d.ts +30 -0
- package/dist/components/DicomViewer.vue_vue_type_script_setup_true_lang.js +362 -0
- package/dist/components/DocxViewer.js +7 -0
- package/dist/components/DocxViewer.vue.d.ts +19 -0
- package/dist/components/DocxViewer.vue_vue_type_script_setup_true_lang.js +59 -0
- package/dist/components/DrawioViewer.js +7 -0
- package/dist/components/DrawioViewer.vue.d.ts +16 -0
- package/dist/components/DrawioViewer.vue_vue_type_script_setup_true_lang.js +38 -0
- package/dist/components/DxfViewer.js +7 -0
- package/dist/components/DxfViewer.vue.d.ts +14 -0
- package/dist/components/DxfViewer.vue_vue_type_script_setup_true_lang.js +239 -0
- package/dist/components/EbookViewer.js +7 -0
- package/dist/components/EbookViewer.vue.d.ts +22 -0
- package/dist/components/EbookViewer.vue_vue_type_script_setup_true_lang.js +170 -0
- package/dist/components/EmlViewer.js +7 -0
- package/dist/components/EmlViewer.vue.d.ts +21 -0
- package/dist/components/EmlViewer.vue_vue_type_script_setup_true_lang.js +193 -0
- package/dist/components/EplViewer.js +7 -0
- package/dist/components/EplViewer.vue.d.ts +19 -0
- package/dist/components/EplViewer.vue_vue_type_script_setup_true_lang.js +201 -0
- package/dist/components/FileViewerBody.js +7 -0
- package/dist/components/FileViewerBody.vue.d.ts +47 -0
- package/dist/components/FileViewerBody.vue_vue_type_script_setup_true_lang.js +599 -0
- package/dist/components/FileViewerPanel.js +7 -0
- package/dist/components/FileViewerPanel.vue.d.ts +3 -0
- package/dist/components/FileViewerPanel.vue_vue_type_script_setup_true_lang.js +207 -0
- package/dist/components/FontViewer.js +7 -0
- package/dist/components/FontViewer.vue.d.ts +17 -0
- package/dist/components/FontViewer.vue_vue_type_script_setup_true_lang.js +120 -0
- package/dist/components/FrontmatterCard.js +7 -0
- package/dist/components/FrontmatterCard.vue.d.ts +11 -0
- package/dist/components/FrontmatterCard.vue_vue_type_script_setup_true_lang.js +30 -0
- package/dist/components/GeoViewer.js +7 -0
- package/dist/components/GeoViewer.vue.d.ts +17 -0
- package/dist/components/GeoViewer.vue_vue_type_script_setup_true_lang.js +255 -0
- package/dist/components/HarViewer.js +7 -0
- package/dist/components/HarViewer.vue.d.ts +20 -0
- package/dist/components/HarViewer.vue_vue_type_script_setup_true_lang.js +322 -0
- package/dist/components/HexViewer.js +7 -0
- package/dist/components/HexViewer.vue.d.ts +22 -0
- package/dist/components/HexViewer.vue_vue_type_script_setup_true_lang.js +121 -0
- package/dist/components/HprofViewer.js +7 -0
- package/dist/components/HprofViewer.vue.d.ts +27 -0
- package/dist/components/HprofViewer.vue_vue_type_script_setup_true_lang.js +561 -0
- package/dist/components/ImageLightbox.js +7 -0
- package/dist/components/ImageLightbox.vue.d.ts +3 -0
- package/dist/components/ImageLightbox.vue_vue_type_script_setup_true_lang.js +86 -0
- package/dist/components/InlineText.d.ts +29 -0
- package/dist/components/InlineText.js +21 -0
- package/dist/components/JksViewer.js +7 -0
- package/dist/components/JksViewer.vue.d.ts +22 -0
- package/dist/components/JksViewer.vue_vue_type_script_setup_true_lang.js +353 -0
- package/dist/components/JsonlViewer.js +7 -0
- package/dist/components/JsonlViewer.vue.d.ts +15 -0
- package/dist/components/JsonlViewer.vue_vue_type_script_setup_true_lang.js +103 -0
- package/dist/components/LogViewer.js +7 -0
- package/dist/components/LogViewer.vue.d.ts +29 -0
- package/dist/components/LogViewer.vue_vue_type_script_setup_true_lang.js +670 -0
- package/dist/components/LrcViewer.js +7 -0
- package/dist/components/LrcViewer.vue.d.ts +17 -0
- package/dist/components/LrcViewer.vue_vue_type_script_setup_true_lang.js +106 -0
- package/dist/components/MarkdownTable.js +7 -0
- package/dist/components/MarkdownTable.vue.d.ts +19 -0
- package/dist/components/MarkdownTable.vue_vue_type_script_setup_true_lang.js +71 -0
- package/dist/components/MarkdownText.d.ts +30 -0
- package/dist/components/MarkdownText.js +21 -0
- package/dist/components/MhtViewer.js +7 -0
- package/dist/components/MhtViewer.vue.d.ts +22 -0
- package/dist/components/MhtViewer.vue_vue_type_script_setup_true_lang.js +112 -0
- package/dist/components/MindMapView.js +7 -0
- package/dist/components/MindMapView.vue.d.ts +23 -0
- package/dist/components/MindMapView.vue_vue_type_script_setup_true_lang.js +337 -0
- package/dist/components/MissingDependency.js +7 -0
- package/dist/components/MissingDependency.vue.d.ts +17 -0
- package/dist/components/MissingDependency.vue_vue_type_script_setup_true_lang.js +37 -0
- package/dist/components/ModelViewer.js +7 -0
- package/dist/components/ModelViewer.vue.d.ts +18 -0
- package/dist/components/ModelViewer.vue_vue_type_script_setup_true_lang.js +157 -0
- package/dist/components/MsiViewer.js +7 -0
- package/dist/components/MsiViewer.vue.d.ts +19 -0
- package/dist/components/MsiViewer.vue_vue_type_script_setup_true_lang.js +136 -0
- package/dist/components/NotebookViewer.js +7 -0
- package/dist/components/NotebookViewer.vue.d.ts +20 -0
- package/dist/components/NotebookViewer.vue_vue_type_script_setup_true_lang.js +125 -0
- package/dist/components/PdfViewer.js +7 -0
- package/dist/components/PdfViewer.vue.d.ts +19 -0
- package/dist/components/PdfViewer.vue_vue_type_script_setup_true_lang.js +114 -0
- package/dist/components/PptxViewer.js +7 -0
- package/dist/components/PptxViewer.vue.d.ts +20 -0
- package/dist/components/PptxViewer.vue_vue_type_script_setup_true_lang.js +73 -0
- package/dist/components/PsdViewer.js +7 -0
- package/dist/components/PsdViewer.vue.d.ts +15 -0
- package/dist/components/PsdViewer.vue_vue_type_script_setup_true_lang.js +218 -0
- package/dist/components/QmcAudioViewer.js +7 -0
- package/dist/components/QmcAudioViewer.vue.d.ts +18 -0
- package/dist/components/QmcAudioViewer.vue_vue_type_script_setup_true_lang.js +92 -0
- package/dist/components/RasterViewer.js +7 -0
- package/dist/components/RasterViewer.vue.d.ts +21 -0
- package/dist/components/RasterViewer.vue_vue_type_script_setup_true_lang.js +161 -0
- package/dist/components/RtfViewer.js +7 -0
- package/dist/components/RtfViewer.vue.d.ts +21 -0
- package/dist/components/RtfViewer.vue_vue_type_script_setup_true_lang.js +66 -0
- package/dist/components/SevenZipBrowser.js +7 -0
- package/dist/components/SevenZipBrowser.vue.d.ts +13 -0
- package/dist/components/SevenZipBrowser.vue_vue_type_script_setup_true_lang.js +366 -0
- package/dist/components/SqliteViewer.js +7 -0
- package/dist/components/SqliteViewer.vue.d.ts +18 -0
- package/dist/components/SqliteViewer.vue_vue_type_script_setup_true_lang.js +186 -0
- package/dist/components/SubtitleViewer.js +7 -0
- package/dist/components/SubtitleViewer.vue.d.ts +15 -0
- package/dist/components/SubtitleViewer.vue_vue_type_script_setup_true_lang.js +48 -0
- package/dist/components/XlsxChart.js +7 -0
- package/dist/components/XlsxChart.vue.d.ts +14 -0
- package/dist/components/XlsxChart.vue_vue_type_script_setup_true_lang.js +240 -0
- package/dist/components/XlsxViewer.js +7 -0
- package/dist/components/XlsxViewer.vue.d.ts +22 -0
- package/dist/components/XlsxViewer.vue_vue_type_script_setup_true_lang.js +814 -0
- package/dist/components/XmindViewer.js +7 -0
- package/dist/components/XmindViewer.vue.d.ts +13 -0
- package/dist/components/XmindViewer.vue_vue_type_script_setup_true_lang.js +48 -0
- package/dist/components/ZipBrowser.js +7 -0
- package/dist/components/ZipBrowser.vue.d.ts +14 -0
- package/dist/components/ZipBrowser.vue_vue_type_script_setup_true_lang.js +326 -0
- package/dist/components/ZoomImage.js +7 -0
- package/dist/components/ZoomImage.vue.d.ts +29 -0
- package/dist/components/ZoomImage.vue_vue_type_script_setup_true_lang.js +147 -0
- package/dist/components/epl/EplCodeBlock.js +7 -0
- package/dist/components/epl/EplCodeBlock.vue.d.ts +15 -0
- package/dist/components/epl/EplCodeBlock.vue_vue_type_script_setup_true_lang.js +72 -0
- package/dist/components/epl/EplDoc.js +7 -0
- package/dist/components/epl/EplDoc.vue.d.ts +19 -0
- package/dist/components/epl/EplDoc.vue_vue_type_script_setup_true_lang.js +327 -0
- package/dist/components/epl/EplMethod.js +7 -0
- package/dist/components/epl/EplMethod.vue.d.ts +14 -0
- package/dist/components/epl/EplMethod.vue_vue_type_script_setup_true_lang.js +100 -0
- package/dist/components/epl/EplResource.js +7 -0
- package/dist/components/epl/EplResource.vue.d.ts +15 -0
- package/dist/components/epl/EplResource.vue_vue_type_script_setup_true_lang.js +204 -0
- package/dist/components/epl/EplTree.js +7 -0
- package/dist/components/epl/EplTree.vue.d.ts +27 -0
- package/dist/components/epl/EplTree.vue_vue_type_script_setup_true_lang.js +123 -0
- package/dist/components/epl/EplVarTable.js +7 -0
- package/dist/components/epl/EplVarTable.vue.d.ts +21 -0
- package/dist/components/epl/EplVarTable.vue_vue_type_script_setup_true_lang.js +60 -0
- package/dist/components/epl/docTypes.d.ts +12 -0
- package/dist/components/epl/numbering.d.ts +21 -0
- package/dist/components/epl/numbering.js +14 -0
- package/dist/components/icons/Icon.js +7 -0
- package/dist/components/icons/Icon.vue.d.ts +14 -0
- package/dist/components/icons/Icon.vue_vue_type_script_setup_true_lang.js +33 -0
- package/dist/components/icons/iconPaths.d.ts +60 -0
- package/dist/components/icons/iconPaths.js +54 -0
- package/dist/components/optionalViewer.d.ts +14 -0
- package/dist/components/optionalViewer.js +37 -0
- package/dist/components/ui/ClampBlock.d.ts +82 -0
- package/dist/components/ui/ClampBlock.js +63 -0
- package/dist/composables/useFileViewer.d.ts +428 -0
- package/dist/composables/useFileViewer.js +27 -0
- package/dist/composables/useLightbox.d.ts +33 -0
- package/dist/composables/useLightbox.js +17 -0
- package/dist/composables/useLogRules.d.ts +47 -0
- package/dist/composables/useLogRules.js +74 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.js +30 -0
- package/dist/lib/aes.d.ts +25 -0
- package/dist/lib/aes.js +99 -0
- package/dist/lib/appx.d.ts +66 -0
- package/dist/lib/appx.js +112 -0
- package/dist/lib/archive.d.ts +29 -0
- package/dist/lib/asn1.d.ts +47 -0
- package/dist/lib/asn1.js +122 -0
- package/dist/lib/binobj.d.ts +69 -0
- package/dist/lib/binobj.js +430 -0
- package/dist/lib/brotli.d.ts +14 -0
- package/dist/lib/brotli.js +16 -0
- package/dist/lib/bzip2.d.ts +14 -0
- package/dist/lib/bzip2.js +161 -0
- package/dist/lib/classfile.d.ts +72 -0
- package/dist/lib/classfile.js +210 -0
- package/dist/lib/codePreview.d.ts +22 -0
- package/dist/lib/codePreview.js +27 -0
- package/dist/lib/codefold.d.ts +14 -0
- package/dist/lib/codefold.js +30 -0
- package/dist/lib/codeformat.d.ts +21 -0
- package/dist/lib/codeformat.js +130 -0
- package/dist/lib/csv.d.ts +19 -0
- package/dist/lib/csv.js +74 -0
- package/dist/lib/des.d.ts +17 -0
- package/dist/lib/des.js +928 -0
- package/dist/lib/diagram.d.ts +5 -0
- package/dist/lib/diagram.js +479 -0
- package/dist/lib/dicom.d.ts +69 -0
- package/dist/lib/dicom.js +442 -0
- package/dist/lib/dicomCodecs.d.ts +28 -0
- package/dist/lib/dicomCodecs.js +156 -0
- package/dist/lib/dicomRender.d.ts +46 -0
- package/dist/lib/dicomRender.js +114 -0
- package/dist/lib/dxf.d.ts +86 -0
- package/dist/lib/dxf.js +399 -0
- package/dist/lib/eml.d.ts +40 -0
- package/dist/lib/eml.js +46 -0
- package/dist/lib/encoding.d.ts +28 -0
- package/dist/lib/encoding.js +44 -0
- package/dist/lib/epl/code/ast.d.ts +150 -0
- package/dist/lib/epl/code/codeDataParser.d.ts +3 -0
- package/dist/lib/epl/code/codeDataParser.js +330 -0
- package/dist/lib/epl/code/codeLines.d.ts +20 -0
- package/dist/lib/epl/code/codeLines.js +191 -0
- package/dist/lib/epl/code/structures.d.ts +86 -0
- package/dist/lib/epl/code/textCode.d.ts +29 -0
- package/dist/lib/epl/code/textCode.js +150 -0
- package/dist/lib/epl/code/variable.d.ts +25 -0
- package/dist/lib/epl/eplDocument.d.ts +21 -0
- package/dist/lib/epl/eplDocument.js +36 -0
- package/dist/lib/epl/imageList.d.ts +28 -0
- package/dist/lib/epl/imageList.js +66 -0
- package/dist/lib/epl/index.d.ts +53 -0
- package/dist/lib/epl/index.js +45 -0
- package/dist/lib/epl/io/binaryReader.d.ts +56 -0
- package/dist/lib/epl/io/binaryReader.js +119 -0
- package/dist/lib/epl/io/encoding.d.ts +16 -0
- package/dist/lib/epl/io/encoding.js +27 -0
- package/dist/lib/epl/model/eplSystemId.d.ts +64 -0
- package/dist/lib/epl/model/eplSystemId.js +16 -0
- package/dist/lib/epl/model/section.d.ts +46 -0
- package/dist/lib/epl/names/eplLibData.js +39 -0
- package/dist/lib/epl/names/idToNameMap.d.ts +33 -0
- package/dist/lib/epl/names/idToNameMap.js +130 -0
- package/dist/lib/epl/names/libNameProvider.d.ts +15 -0
- package/dist/lib/epl/names/libNameProvider.js +18 -0
- package/dist/lib/epl/program.d.ts +120 -0
- package/dist/lib/epl/program.js +134 -0
- package/dist/lib/epl/projectFileReader.d.ts +23 -0
- package/dist/lib/epl/projectFileReader.js +65 -0
- package/dist/lib/epl/sections/code.d.ts +20 -0
- package/dist/lib/epl/sections/esystemInfo.d.ts +14 -0
- package/dist/lib/epl/sections/losable.d.ts +11 -0
- package/dist/lib/epl/sections/projectConfig.d.ts +23 -0
- package/dist/lib/epl/sections/resource.d.ts +57 -0
- package/dist/lib/fb2.d.ts +14 -0
- package/dist/lib/fb2.js +62 -0
- package/dist/lib/fileType.d.ts +315 -0
- package/dist/lib/fileType.js +800 -0
- package/dist/lib/fonts.d.ts +8 -0
- package/dist/lib/fonts.js +4 -0
- package/dist/lib/format.d.ts +16 -0
- package/dist/lib/format.js +38 -0
- package/dist/lib/frontmatter.d.ts +13 -0
- package/dist/lib/frontmatter.js +23 -0
- package/dist/lib/geo.d.ts +30 -0
- package/dist/lib/geo.js +235 -0
- package/dist/lib/har.d.ts +171 -0
- package/dist/lib/har.js +397 -0
- package/dist/lib/highlight.d.ts +18 -0
- package/dist/lib/highlight.js +34 -0
- package/dist/lib/highlightLangs.d.ts +15 -0
- package/dist/lib/highlightLangs.js +93 -0
- package/dist/lib/hprof.d.ts +211 -0
- package/dist/lib/hprof.js +709 -0
- package/dist/lib/ipynb.d.ts +48 -0
- package/dist/lib/ipynb.js +130 -0
- package/dist/lib/jks.d.ts +86 -0
- package/dist/lib/jks.js +167 -0
- package/dist/lib/jsonl.d.ts +29 -0
- package/dist/lib/jsonl.js +24 -0
- package/dist/lib/lrc.d.ts +32 -0
- package/dist/lib/lrc.js +84 -0
- package/dist/lib/lzma.d.ts +70 -0
- package/dist/lib/lzma.js +204 -0
- package/dist/lib/markdown/blocks.d.ts +9 -0
- package/dist/lib/markdown/blocks.js +221 -0
- package/dist/lib/markdown/index.d.ts +3 -0
- package/dist/lib/markdown/inline.d.ts +33 -0
- package/dist/lib/markdown/inline.js +84 -0
- package/dist/lib/markdown/math.d.ts +5 -0
- package/dist/lib/markdown/math.js +25 -0
- package/dist/lib/markdown/segmentize.d.ts +11 -0
- package/dist/lib/markdown/segmentize.js +28 -0
- package/dist/lib/markdown/styles.d.ts +26 -0
- package/dist/lib/markdown/styles.js +135 -0
- package/dist/lib/mht.d.ts +51 -0
- package/dist/lib/mht.js +122 -0
- package/dist/lib/midi.d.ts +28 -0
- package/dist/lib/midi.js +84 -0
- package/dist/lib/mime.d.ts +82 -0
- package/dist/lib/mime.js +151 -0
- package/dist/lib/mindmap.d.ts +51 -0
- package/dist/lib/mindmap.js +113 -0
- package/dist/lib/mobi.d.ts +15 -0
- package/dist/lib/mobi.js +68 -0
- package/dist/lib/msi.d.ts +50 -0
- package/dist/lib/msi.js +332 -0
- package/dist/lib/optionalDep.d.ts +26 -0
- package/dist/lib/optionalDep.js +20 -0
- package/dist/lib/pkcs12.d.ts +56 -0
- package/dist/lib/pkcs12.js +356 -0
- package/dist/lib/qmc.d.ts +50 -0
- package/dist/lib/qmc.js +213 -0
- package/dist/lib/rar.d.ts +16 -0
- package/dist/lib/rar.js +40 -0
- package/dist/lib/rawPreview.d.ts +12 -0
- package/dist/lib/rawPreview.js +54 -0
- package/dist/lib/rc2.d.ts +12 -0
- package/dist/lib/rc2.js +298 -0
- package/dist/lib/resolveInput.d.ts +22 -0
- package/dist/lib/resolveInput.js +55 -0
- package/dist/lib/rtf.d.ts +53 -0
- package/dist/lib/rtf.js +413 -0
- package/dist/lib/sevenZip.d.ts +82 -0
- package/dist/lib/sevenZip.js +395 -0
- package/dist/lib/sha1.d.ts +24 -0
- package/dist/lib/sha1.js +53 -0
- package/dist/lib/sha256.d.ts +21 -0
- package/dist/lib/sha256.js +119 -0
- package/dist/lib/speechAudio.d.ts +36 -0
- package/dist/lib/speechAudio.js +85 -0
- package/dist/lib/sqlite.d.ts +38 -0
- package/dist/lib/sqlite.js +104 -0
- package/dist/lib/subtitle.d.ts +26 -0
- package/dist/lib/subtitle.js +99 -0
- package/dist/lib/tarball.d.ts +20 -0
- package/dist/lib/tarball.js +248 -0
- package/dist/lib/viewerFormats.d.ts +35 -0
- package/dist/lib/viewerFormats.js +83 -0
- package/dist/lib/viewerKind.d.ts +36 -0
- package/dist/lib/viewerKind.js +233 -0
- package/dist/lib/x509.d.ts +68 -0
- package/dist/lib/x509.js +267 -0
- package/dist/lib/xlsx.d.ts +55 -0
- package/dist/lib/xlsx.js +321 -0
- package/dist/lib/xlsxCharts.d.ts +34 -0
- package/dist/lib/xlsxCharts.js +152 -0
- package/dist/lib/xmind.d.ts +6 -0
- package/dist/lib/xmind.js +124 -0
- package/dist/lib/zip.d.ts +56 -0
- package/dist/lib/zip.js +169 -0
- package/dist/style.css +2 -0
- package/dist/types.d.ts +42 -0
- package/package.json +128 -0
|
@@ -0,0 +1,814 @@
|
|
|
1
|
+
import { numToCol as e, parseXlsx as t } from "../lib/xlsx.js";
|
|
2
|
+
import { parseXlsxCharts as n } from "../lib/xlsxCharts.js";
|
|
3
|
+
import r from "./XlsxChart.js";
|
|
4
|
+
import { Fragment as i, computed as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, nextTick as f, normalizeClass as p, normalizeStyle as m, onBeforeUnmount as ee, onMounted as te, openBlock as h, ref as g, renderList as _, toDisplayString as v, watch as ne, withModifiers as y } from "vue";
|
|
5
|
+
//#region src/components/XlsxViewer.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
+
var re = { class: "xv" }, ie = {
|
|
7
|
+
key: 0,
|
|
8
|
+
class: "xv__msg"
|
|
9
|
+
}, ae = {
|
|
10
|
+
key: 1,
|
|
11
|
+
class: "xv__msg xv__msg--error"
|
|
12
|
+
}, oe = { class: "xv__formulabar" }, se = { class: "xv__fb-addr" }, ce = { class: "xv__fb-content" }, le = { class: "xv__grid" }, ue = ["onMousedown", "onMouseenter"], de = ["title", "onClick"], fe = { class: "xv__colhead-text" }, pe = ["onMousedown"], me = ["onMousedown", "onMouseenter"], he = ["title", "onClick"], ge = { class: "xv__rowhead-text" }, _e = ["onMousedown"], ve = [
|
|
13
|
+
"rowspan",
|
|
14
|
+
"colspan",
|
|
15
|
+
"onMousedown",
|
|
16
|
+
"onMouseenter",
|
|
17
|
+
"onDblclick"
|
|
18
|
+
], ye = { class: "xv__charts" }, be = { class: "xv__status" }, xe = {
|
|
19
|
+
key: 0,
|
|
20
|
+
class: "xv__status-sel"
|
|
21
|
+
}, Se = {
|
|
22
|
+
key: 1,
|
|
23
|
+
class: "xv__status-hint"
|
|
24
|
+
}, Ce = { class: "xv__status-right" }, we = {
|
|
25
|
+
key: 0,
|
|
26
|
+
class: "xv__tabbar"
|
|
27
|
+
}, Te = ["disabled"], Ee = ["title", "onClick"], De = ["disabled"], Oe = 42, ke = 22, Ae = 20, je = 24, Me = 14, Ne = 9, b = /*@__PURE__*/ d({
|
|
28
|
+
__name: "XlsxViewer",
|
|
29
|
+
props: {
|
|
30
|
+
url: {},
|
|
31
|
+
name: {},
|
|
32
|
+
size: {}
|
|
33
|
+
},
|
|
34
|
+
setup(d) {
|
|
35
|
+
let b = d, x = g("loading"), Pe = g(""), Fe = g(null), Ie = g(/* @__PURE__ */ new Map()), S = g(0), Le = a(() => Fe.value?.sheets ?? []), C = a(() => Le.value[S.value] ?? null), Re = {
|
|
36
|
+
colW: {},
|
|
37
|
+
rowH: {},
|
|
38
|
+
revealCol: {},
|
|
39
|
+
revealRow: {},
|
|
40
|
+
revealAll: !1
|
|
41
|
+
}, w = g({}), T = a(() => w.value[S.value] ?? Re);
|
|
42
|
+
function E() {
|
|
43
|
+
let e = w.value[S.value];
|
|
44
|
+
return e || (e = {
|
|
45
|
+
colW: {},
|
|
46
|
+
rowH: {},
|
|
47
|
+
revealCol: {},
|
|
48
|
+
revealRow: {},
|
|
49
|
+
revealAll: !1
|
|
50
|
+
}, w.value[S.value] = e), e;
|
|
51
|
+
}
|
|
52
|
+
let ze = a(() => {
|
|
53
|
+
let e = T.value;
|
|
54
|
+
return e.revealAll || Object.keys(e.colW).length > 0 || Object.keys(e.rowH).length > 0 || Object.keys(e.revealCol).length > 0 || Object.keys(e.revealRow).length > 0;
|
|
55
|
+
});
|
|
56
|
+
function Be() {
|
|
57
|
+
w.value[S.value] = {
|
|
58
|
+
colW: {},
|
|
59
|
+
rowH: {},
|
|
60
|
+
revealCol: {},
|
|
61
|
+
revealRow: {},
|
|
62
|
+
revealAll: !1
|
|
63
|
+
}, L();
|
|
64
|
+
}
|
|
65
|
+
function Ve() {
|
|
66
|
+
E().revealAll = !T.value.revealAll, L();
|
|
67
|
+
}
|
|
68
|
+
let D = a(() => C.value?.colWidths.length ?? 0);
|
|
69
|
+
function O(e) {
|
|
70
|
+
return !!C.value?.colHidden[e - 1] && !T.value.revealAll && !T.value.revealCol[e];
|
|
71
|
+
}
|
|
72
|
+
function k(e) {
|
|
73
|
+
return !!C.value?.rows[e]?.hidden && !T.value.revealAll && !T.value.revealRow[e + 1];
|
|
74
|
+
}
|
|
75
|
+
function A(e) {
|
|
76
|
+
return O(e) ? 0 : T.value.colW[e] ?? C.value?.colWidths[e - 1] ?? 80;
|
|
77
|
+
}
|
|
78
|
+
function j(e) {
|
|
79
|
+
return k(e) ? 0 : T.value.rowH[e + 1] ?? C.value?.rows[e]?.height ?? Ae;
|
|
80
|
+
}
|
|
81
|
+
let He = a(() => {
|
|
82
|
+
let t = [];
|
|
83
|
+
for (let n = 1; n <= D.value; n++) t.push(e(n));
|
|
84
|
+
return t;
|
|
85
|
+
}), M = a(() => C.value?.frozenCols ?? 0), N = a(() => C.value?.frozenRows ?? 0), Ue = a(() => {
|
|
86
|
+
let e = [], t = Oe;
|
|
87
|
+
for (let n = 1; n <= D.value; n++) e[n] = t, t += A(n);
|
|
88
|
+
return e[D.value + 1] = t, e;
|
|
89
|
+
}), We = a(() => {
|
|
90
|
+
let e = C.value?.rows ?? [], t = [], n = ke;
|
|
91
|
+
for (let r = 0; r < e.length; r++) t[r + 1] = n, n += j(r);
|
|
92
|
+
return t[e.length + 1] = n, t;
|
|
93
|
+
}), Ge = g(null), P = g(null), F = g([]), I = g([]);
|
|
94
|
+
function Ke() {
|
|
95
|
+
let e = Ge.value;
|
|
96
|
+
if (!e) return;
|
|
97
|
+
let t = e.querySelectorAll("thead th"), n = [];
|
|
98
|
+
for (let e = 1; e <= D.value; e++) {
|
|
99
|
+
let r = t[e];
|
|
100
|
+
r && (n[e] = r.offsetLeft);
|
|
101
|
+
}
|
|
102
|
+
let r = t[D.value];
|
|
103
|
+
r && (n[D.value + 1] = r.offsetLeft + r.offsetWidth);
|
|
104
|
+
let i = e.querySelectorAll("tbody > tr > th.xv__rowhead"), a = [];
|
|
105
|
+
for (let e = 0; e < i.length; e++) a[e + 1] = i[e].offsetTop;
|
|
106
|
+
let o = i[i.length - 1];
|
|
107
|
+
o && (a[i.length + 1] = o.offsetTop + o.offsetHeight), F.value = n, I.value = a;
|
|
108
|
+
}
|
|
109
|
+
function L() {
|
|
110
|
+
f(Ke);
|
|
111
|
+
}
|
|
112
|
+
let R = (e) => F.value[e] ?? Ue.value[e], z = (e) => I.value[e] ?? We.value[e], qe = a(() => {
|
|
113
|
+
let e = /* @__PURE__ */ new Map();
|
|
114
|
+
if (!C.value) return e;
|
|
115
|
+
let t = 0;
|
|
116
|
+
for (let n = 1; n <= D.value; n++) O(n) ? t ||= n : (t && e.set(n, {
|
|
117
|
+
start: t,
|
|
118
|
+
end: n - 1,
|
|
119
|
+
count: n - t
|
|
120
|
+
}), t = 0);
|
|
121
|
+
return e;
|
|
122
|
+
}), Je = a(() => {
|
|
123
|
+
let e = /* @__PURE__ */ new Map(), t = C.value?.rows ?? [], n = 0;
|
|
124
|
+
for (let r = 0; r < t.length; r++) k(r) ? n ||= r + 1 : (n && e.set(r, {
|
|
125
|
+
start: n,
|
|
126
|
+
end: r,
|
|
127
|
+
count: r + 1 - n
|
|
128
|
+
}), n = 0);
|
|
129
|
+
return e;
|
|
130
|
+
});
|
|
131
|
+
function Ye(e) {
|
|
132
|
+
let t = E();
|
|
133
|
+
for (let n = e.start; n <= e.end; n++) t.revealCol[n] = !0;
|
|
134
|
+
L();
|
|
135
|
+
}
|
|
136
|
+
function Xe(e) {
|
|
137
|
+
let t = E();
|
|
138
|
+
for (let n = e.start; n <= e.end; n++) t.revealRow[n] = !0;
|
|
139
|
+
L();
|
|
140
|
+
}
|
|
141
|
+
let Ze;
|
|
142
|
+
function Qe(e, t, n) {
|
|
143
|
+
if (typeof document > "u") {
|
|
144
|
+
let n = 0;
|
|
145
|
+
for (let r of e) n += r.codePointAt(0) > 11903 ? t : t * .6;
|
|
146
|
+
return n;
|
|
147
|
+
}
|
|
148
|
+
Ze === void 0 && (Ze = document.createElement("canvas").getContext("2d"));
|
|
149
|
+
let r = Ze;
|
|
150
|
+
if (!r) {
|
|
151
|
+
let n = 0;
|
|
152
|
+
for (let r of e) n += r.codePointAt(0) > 11903 ? t : t * .6;
|
|
153
|
+
return n;
|
|
154
|
+
}
|
|
155
|
+
return r.font = `${n ? "700 " : ""}${t}px Calibri, 'Segoe UI', system-ui, sans-serif`, r.measureText(e).width;
|
|
156
|
+
}
|
|
157
|
+
let B = a(() => {
|
|
158
|
+
let e = /* @__PURE__ */ new Map(), t = C.value?.rows ?? [];
|
|
159
|
+
for (let n = 0; n < t.length; n++) {
|
|
160
|
+
let r = t[n].cells;
|
|
161
|
+
for (let t = 0; t < r.length; t++) {
|
|
162
|
+
let i = r[t];
|
|
163
|
+
if (!i.text.trim() || i.wrap || O(i.col) || i.colSpan > 1 || i.rowSpan > 1) continue;
|
|
164
|
+
let a = A(i.col), o = Qe(i.text, i.fontSize ?? 16, i.bold);
|
|
165
|
+
if (o <= a - Ne) continue;
|
|
166
|
+
let s = 0, c = i.col + i.colSpan;
|
|
167
|
+
for (let e = t + 1; e < r.length; e++) {
|
|
168
|
+
let t = r[e];
|
|
169
|
+
if (t.col !== c || t.text.trim() !== "") break;
|
|
170
|
+
c = t.col + t.colSpan, O(t.col) || (s += A(t.col));
|
|
171
|
+
}
|
|
172
|
+
let l = 0, u = i.col;
|
|
173
|
+
for (let e = t - 1; e >= 0; e--) {
|
|
174
|
+
let t = r[e];
|
|
175
|
+
if (t.col + t.colSpan !== u || t.text.trim() !== "") break;
|
|
176
|
+
u = t.col, O(t.col) || (l += A(t.col));
|
|
177
|
+
}
|
|
178
|
+
let d, f;
|
|
179
|
+
if (i.align === "right") d = Math.min(o, a + l), f = d - a;
|
|
180
|
+
else if (i.align === "center") {
|
|
181
|
+
d = Math.min(o, a + l + s);
|
|
182
|
+
let e = d - a;
|
|
183
|
+
f = Math.min(l, e - Math.min(s, e / 2));
|
|
184
|
+
} else d = Math.min(o, a + s), f = 0;
|
|
185
|
+
d > a + .5 && e.set(`${n}:${i.col}`, {
|
|
186
|
+
w: d,
|
|
187
|
+
left: f
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return e;
|
|
192
|
+
});
|
|
193
|
+
function $e(e, t) {
|
|
194
|
+
let n = B.value.get(`${t}:${e.col}`);
|
|
195
|
+
if (n) return {
|
|
196
|
+
maxWidth: `${n.w}px`,
|
|
197
|
+
marginLeft: `${-n.left}px`,
|
|
198
|
+
textAlign: e.align ?? "left"
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
function et(e) {
|
|
202
|
+
return M.value > 0 && e === M.value;
|
|
203
|
+
}
|
|
204
|
+
function tt(e) {
|
|
205
|
+
return N.value > 0 && e + 1 === N.value;
|
|
206
|
+
}
|
|
207
|
+
function nt(e, t) {
|
|
208
|
+
let n = t + 1, r = e.col <= M.value, i = n <= N.value, a = {
|
|
209
|
+
color: e.color,
|
|
210
|
+
backgroundColor: e.bg,
|
|
211
|
+
textAlign: B.value.has(`${t}:${e.col}`) ? "left" : e.align,
|
|
212
|
+
verticalAlign: e.valign,
|
|
213
|
+
fontSize: e.fontSize ? `${e.fontSize}px` : void 0
|
|
214
|
+
};
|
|
215
|
+
return r && (a.left = `${R(e.col)}px`), i && (a.top = `${z(n)}px`), (r || i) && (a.backgroundColor = e.bg || "#fff"), a;
|
|
216
|
+
}
|
|
217
|
+
function rt(e) {
|
|
218
|
+
return e + 1 <= N.value ? { top: `${z(e + 1)}px` } : {};
|
|
219
|
+
}
|
|
220
|
+
function it(e) {
|
|
221
|
+
return e <= M.value ? { left: `${R(e)}px` } : {};
|
|
222
|
+
}
|
|
223
|
+
let V = null;
|
|
224
|
+
function at(e, t) {
|
|
225
|
+
V = {
|
|
226
|
+
kind: "col",
|
|
227
|
+
index: e,
|
|
228
|
+
startPos: t.clientX,
|
|
229
|
+
startSize: A(e)
|
|
230
|
+
}, document.body.style.cursor = "col-resize";
|
|
231
|
+
}
|
|
232
|
+
function ot(e, t) {
|
|
233
|
+
V = {
|
|
234
|
+
kind: "row",
|
|
235
|
+
index: e,
|
|
236
|
+
startPos: t.clientY,
|
|
237
|
+
startSize: j(e - 1)
|
|
238
|
+
}, document.body.style.cursor = "row-resize";
|
|
239
|
+
}
|
|
240
|
+
function st(e) {
|
|
241
|
+
if (!V) return;
|
|
242
|
+
let t = E();
|
|
243
|
+
V.kind === "col" ? t.colW[V.index] = Math.max(je, Math.round(V.startSize + (e.clientX - V.startPos))) : t.rowH[V.index] = Math.max(Me, Math.round(V.startSize + (e.clientY - V.startPos)));
|
|
244
|
+
}
|
|
245
|
+
function ct() {
|
|
246
|
+
V && (V = null, document.body.style.cursor = "", L());
|
|
247
|
+
}
|
|
248
|
+
let H = g([]), U = !1, W = "cell";
|
|
249
|
+
function G() {
|
|
250
|
+
return H.value[H.value.length - 1] ?? null;
|
|
251
|
+
}
|
|
252
|
+
function lt() {
|
|
253
|
+
return Math.max(0, (C.value?.rows.length ?? 1) - 1);
|
|
254
|
+
}
|
|
255
|
+
function ut() {
|
|
256
|
+
return Math.max(1, D.value);
|
|
257
|
+
}
|
|
258
|
+
let K = g(null);
|
|
259
|
+
function dt(e, t) {
|
|
260
|
+
return !!K.value && K.value.r === e && K.value.c === t;
|
|
261
|
+
}
|
|
262
|
+
function ft(e, t, n, r, i) {
|
|
263
|
+
if (K.value = null, e.shiftKey && H.value.length) {
|
|
264
|
+
let e = H.value.slice();
|
|
265
|
+
e[e.length - 1] = {
|
|
266
|
+
a: i,
|
|
267
|
+
f: r,
|
|
268
|
+
kind: t
|
|
269
|
+
}, H.value = e;
|
|
270
|
+
} else e.ctrlKey || e.metaKey ? H.value = [...H.value, {
|
|
271
|
+
a: n,
|
|
272
|
+
f: r,
|
|
273
|
+
kind: t
|
|
274
|
+
}] : H.value = [{
|
|
275
|
+
a: n,
|
|
276
|
+
f: r,
|
|
277
|
+
kind: t
|
|
278
|
+
}];
|
|
279
|
+
U = !0, W = t, P.value?.focus({ preventScroll: !0 });
|
|
280
|
+
}
|
|
281
|
+
function pt(e, t, n) {
|
|
282
|
+
if (n.button !== 0 || dt(e, t)) return;
|
|
283
|
+
let r = {
|
|
284
|
+
r: e,
|
|
285
|
+
c: t
|
|
286
|
+
};
|
|
287
|
+
ft(n, "cell", r, r, G()?.a ?? r);
|
|
288
|
+
}
|
|
289
|
+
function mt(e, t) {
|
|
290
|
+
K.value = {
|
|
291
|
+
r: e,
|
|
292
|
+
c: t
|
|
293
|
+
}, H.value = [{
|
|
294
|
+
a: {
|
|
295
|
+
r: e,
|
|
296
|
+
c: t
|
|
297
|
+
},
|
|
298
|
+
f: {
|
|
299
|
+
r: e,
|
|
300
|
+
c: t
|
|
301
|
+
},
|
|
302
|
+
kind: "cell"
|
|
303
|
+
}];
|
|
304
|
+
}
|
|
305
|
+
function ht(e, t) {
|
|
306
|
+
let n = H.value;
|
|
307
|
+
if (!n.length) return;
|
|
308
|
+
let r = n[n.length - 1], i;
|
|
309
|
+
i = W === "col" ? {
|
|
310
|
+
r: lt(),
|
|
311
|
+
c: t
|
|
312
|
+
} : W === "row" ? {
|
|
313
|
+
r: e,
|
|
314
|
+
c: ut()
|
|
315
|
+
} : {
|
|
316
|
+
r: e,
|
|
317
|
+
c: t
|
|
318
|
+
};
|
|
319
|
+
let a = n.slice();
|
|
320
|
+
a[a.length - 1] = {
|
|
321
|
+
a: r.a,
|
|
322
|
+
f: i,
|
|
323
|
+
kind: W
|
|
324
|
+
}, H.value = a;
|
|
325
|
+
}
|
|
326
|
+
function gt(e, t) {
|
|
327
|
+
U && ht(e, t);
|
|
328
|
+
}
|
|
329
|
+
function _t() {
|
|
330
|
+
U = !1;
|
|
331
|
+
}
|
|
332
|
+
function vt(e, t) {
|
|
333
|
+
t.button === 0 && ft(t, "col", {
|
|
334
|
+
r: 0,
|
|
335
|
+
c: e
|
|
336
|
+
}, {
|
|
337
|
+
r: lt(),
|
|
338
|
+
c: e
|
|
339
|
+
}, {
|
|
340
|
+
r: 0,
|
|
341
|
+
c: G()?.a.c ?? e
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
function yt(e) {
|
|
345
|
+
U && W === "col" && ht(0, e);
|
|
346
|
+
}
|
|
347
|
+
function bt(e, t) {
|
|
348
|
+
t.button === 0 && ft(t, "row", {
|
|
349
|
+
r: e,
|
|
350
|
+
c: 1
|
|
351
|
+
}, {
|
|
352
|
+
r: e,
|
|
353
|
+
c: ut()
|
|
354
|
+
}, {
|
|
355
|
+
r: G()?.a.r ?? e,
|
|
356
|
+
c: 1
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
function xt(e) {
|
|
360
|
+
U && W === "row" && ht(e, 1);
|
|
361
|
+
}
|
|
362
|
+
function St(e, t) {
|
|
363
|
+
let n = C.value?.rows.length ?? 0, r = e;
|
|
364
|
+
for (let i = 0; i < n; i++) {
|
|
365
|
+
if (r += t, r < 0 || r >= n) return e;
|
|
366
|
+
if (!k(r)) return r;
|
|
367
|
+
}
|
|
368
|
+
return e;
|
|
369
|
+
}
|
|
370
|
+
function Ct(e, t) {
|
|
371
|
+
let n = D.value, r = e;
|
|
372
|
+
for (let i = 0; i < n; i++) {
|
|
373
|
+
if (r += t, r < 1 || r > n) return e;
|
|
374
|
+
if (!O(r)) return r;
|
|
375
|
+
}
|
|
376
|
+
return e;
|
|
377
|
+
}
|
|
378
|
+
function q(e, t) {
|
|
379
|
+
f(() => {
|
|
380
|
+
let n = P.value;
|
|
381
|
+
if (!n) return;
|
|
382
|
+
let r = R(t), i = R(t + 1), a = z(e + 1), o = z(e + 2);
|
|
383
|
+
if (r == null || i == null || a == null || o == null) return;
|
|
384
|
+
let s = 0;
|
|
385
|
+
for (let e = 1; e <= M.value; e++) s += A(e);
|
|
386
|
+
let c = 0;
|
|
387
|
+
for (let e = 0; e < N.value; e++) c += j(e);
|
|
388
|
+
let l = Oe + s, u = ke + c;
|
|
389
|
+
r - l < n.scrollLeft ? n.scrollLeft = r - l : i > n.scrollLeft + n.clientWidth && (n.scrollLeft = i - n.clientWidth), a - u < n.scrollTop ? n.scrollTop = a - u : o > n.scrollTop + n.clientHeight && (n.scrollTop = o - n.clientHeight);
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
function wt(e) {
|
|
393
|
+
if (K.value) {
|
|
394
|
+
e.key === "Escape" && (K.value = null, e.preventDefault());
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
let t = {
|
|
398
|
+
ArrowUp: [-1, 0],
|
|
399
|
+
ArrowDown: [1, 0],
|
|
400
|
+
ArrowLeft: [0, -1],
|
|
401
|
+
ArrowRight: [0, 1]
|
|
402
|
+
}, n = G();
|
|
403
|
+
if (e.key in t) {
|
|
404
|
+
if (e.preventDefault(), !n) {
|
|
405
|
+
H.value = [{
|
|
406
|
+
a: {
|
|
407
|
+
r: 0,
|
|
408
|
+
c: 1
|
|
409
|
+
},
|
|
410
|
+
f: {
|
|
411
|
+
r: 0,
|
|
412
|
+
c: 1
|
|
413
|
+
},
|
|
414
|
+
kind: "cell"
|
|
415
|
+
}], q(0, 1);
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
let [r, i] = t[e.key], a = e.shiftKey ? n.f : n.a, o = r ? St(a.r, r) : a.r, s = i ? Ct(a.c, i) : a.c;
|
|
419
|
+
H.value = e.shiftKey ? [{
|
|
420
|
+
a: n.a,
|
|
421
|
+
f: {
|
|
422
|
+
r: o,
|
|
423
|
+
c: s
|
|
424
|
+
},
|
|
425
|
+
kind: "cell"
|
|
426
|
+
}] : [{
|
|
427
|
+
a: {
|
|
428
|
+
r: o,
|
|
429
|
+
c: s
|
|
430
|
+
},
|
|
431
|
+
f: {
|
|
432
|
+
r: o,
|
|
433
|
+
c: s
|
|
434
|
+
},
|
|
435
|
+
kind: "cell"
|
|
436
|
+
}], q(o, s);
|
|
437
|
+
} else if (e.key === "Enter") {
|
|
438
|
+
if (!n) return;
|
|
439
|
+
e.preventDefault();
|
|
440
|
+
let t = St(n.a.r, e.shiftKey ? -1 : 1);
|
|
441
|
+
H.value = [{
|
|
442
|
+
a: {
|
|
443
|
+
r: t,
|
|
444
|
+
c: n.a.c
|
|
445
|
+
},
|
|
446
|
+
f: {
|
|
447
|
+
r: t,
|
|
448
|
+
c: n.a.c
|
|
449
|
+
},
|
|
450
|
+
kind: "cell"
|
|
451
|
+
}], q(t, n.a.c);
|
|
452
|
+
} else if (e.key === "Tab") {
|
|
453
|
+
if (!n) return;
|
|
454
|
+
e.preventDefault();
|
|
455
|
+
let t = Ct(n.a.c, e.shiftKey ? -1 : 1);
|
|
456
|
+
H.value = [{
|
|
457
|
+
a: {
|
|
458
|
+
r: n.a.r,
|
|
459
|
+
c: t
|
|
460
|
+
},
|
|
461
|
+
f: {
|
|
462
|
+
r: n.a.r,
|
|
463
|
+
c: t
|
|
464
|
+
},
|
|
465
|
+
kind: "cell"
|
|
466
|
+
}], q(n.a.r, t);
|
|
467
|
+
} else e.key === "Escape" && (H.value = []);
|
|
468
|
+
}
|
|
469
|
+
let Tt = a(() => {
|
|
470
|
+
let e = [], t = C.value?.rows ?? [];
|
|
471
|
+
for (let n = 0; n < t.length; n++) for (let r of t[n].cells) (r.colSpan > 1 || r.rowSpan > 1) && e.push({
|
|
472
|
+
r0: n,
|
|
473
|
+
r1: n + r.rowSpan - 1,
|
|
474
|
+
c0: r.col,
|
|
475
|
+
c1: r.col + r.colSpan - 1
|
|
476
|
+
});
|
|
477
|
+
return e;
|
|
478
|
+
});
|
|
479
|
+
function Et(e) {
|
|
480
|
+
let t = Math.min(e.a.r, e.f.r), n = Math.max(e.a.r, e.f.r), r = Math.min(e.a.c, e.f.c), i = Math.max(e.a.c, e.f.c);
|
|
481
|
+
if (e.kind === "cell") {
|
|
482
|
+
let e = Tt.value;
|
|
483
|
+
for (let a = 0; a <= e.length; a++) {
|
|
484
|
+
let a = !1;
|
|
485
|
+
for (let o of e) o.r0 > n || o.r1 < t || o.c0 > i || o.c1 < r || (o.r0 < t && (t = o.r0, a = !0), o.r1 > n && (n = o.r1, a = !0), o.c0 < r && (r = o.c0, a = !0), o.c1 > i && (i = o.c1, a = !0));
|
|
486
|
+
if (!a) break;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
return {
|
|
490
|
+
minR: t,
|
|
491
|
+
maxR: n,
|
|
492
|
+
minC: r,
|
|
493
|
+
maxC: i
|
|
494
|
+
};
|
|
495
|
+
}
|
|
496
|
+
let J = a(() => H.value.map(Et)), Dt = a(() => {
|
|
497
|
+
let e = G();
|
|
498
|
+
return e ? Et(e) : null;
|
|
499
|
+
}), Ot = a(() => {
|
|
500
|
+
let e = [];
|
|
501
|
+
for (let t of J.value) {
|
|
502
|
+
let n = R(t.minC), r = R(t.maxC + 1), i = z(t.minR + 1), a = z(t.maxR + 2);
|
|
503
|
+
n == null || r == null || i == null || a == null || e.push({
|
|
504
|
+
left: `${n}px`,
|
|
505
|
+
top: `${i}px`,
|
|
506
|
+
width: `${r - n}px`,
|
|
507
|
+
height: `${a - i}px`
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
return e;
|
|
511
|
+
});
|
|
512
|
+
function kt(e, t) {
|
|
513
|
+
let n = t, r = t + e.rowSpan - 1, i = e.col, a = e.col + e.colSpan - 1;
|
|
514
|
+
for (let e of J.value) if (r >= e.minR && n <= e.maxR && a >= e.minC && i <= e.maxC) return !0;
|
|
515
|
+
return !1;
|
|
516
|
+
}
|
|
517
|
+
function At(e) {
|
|
518
|
+
if (!e) return null;
|
|
519
|
+
let t = Number(e.replace(/,/g, "").trim());
|
|
520
|
+
return Number.isFinite(t) ? t : null;
|
|
521
|
+
}
|
|
522
|
+
let Y = a(() => {
|
|
523
|
+
let t = C.value, n = Dt.value;
|
|
524
|
+
if (!t || !n) return null;
|
|
525
|
+
let r = 0, i = 0;
|
|
526
|
+
for (let e = 0; e < t.rows.length; e++) for (let n of t.rows[e].cells) {
|
|
527
|
+
if (!kt(n, e)) continue;
|
|
528
|
+
let t = At(n.text);
|
|
529
|
+
t != null && (r += t, i++);
|
|
530
|
+
}
|
|
531
|
+
let a = (n.maxR - n.minR + 1) * (n.maxC - n.minC + 1);
|
|
532
|
+
return {
|
|
533
|
+
addr: `${e(n.minC)}${n.minR + 1}${a > 1 ? `:${e(n.maxC)}${n.maxR + 1}` : ""}`,
|
|
534
|
+
total: a,
|
|
535
|
+
numCount: i,
|
|
536
|
+
sum: r,
|
|
537
|
+
avg: i ? r / i : 0
|
|
538
|
+
};
|
|
539
|
+
});
|
|
540
|
+
function jt(e) {
|
|
541
|
+
return (Math.round(e * 1e3) / 1e3).toLocaleString("en-US");
|
|
542
|
+
}
|
|
543
|
+
function Mt(e) {
|
|
544
|
+
for (let t of J.value) if (e >= t.minC && e <= t.maxC) return !0;
|
|
545
|
+
return !1;
|
|
546
|
+
}
|
|
547
|
+
function Nt(e) {
|
|
548
|
+
for (let t of J.value) if (e >= t.minR && e <= t.maxR) return !0;
|
|
549
|
+
return !1;
|
|
550
|
+
}
|
|
551
|
+
function Pt(e, t) {
|
|
552
|
+
return C.value?.rows[e]?.cells.find((e) => e.col === t) ?? null;
|
|
553
|
+
}
|
|
554
|
+
let Ft = a(() => {
|
|
555
|
+
let t = G()?.a;
|
|
556
|
+
return t ? `${e(t.c)}${t.r + 1}` : "";
|
|
557
|
+
}), It = a(() => {
|
|
558
|
+
let e = G()?.a;
|
|
559
|
+
if (!e) return "";
|
|
560
|
+
let t = Pt(e.r, e.c);
|
|
561
|
+
return t ? t.formula ? `=${t.formula}` : t.text : "";
|
|
562
|
+
}), Lt = a(() => C.value ? Ie.value.get(C.value.name) ?? [] : []), Rt = a(() => Lt.value.map((e) => {
|
|
563
|
+
let t = e.anchor.fromCol + 1, n = e.anchor.fromRow + 1;
|
|
564
|
+
return {
|
|
565
|
+
chart: e,
|
|
566
|
+
left: (R(t) ?? R(D.value + 1) ?? Oe) + e.anchor.offX,
|
|
567
|
+
top: (z(n) ?? z((C.value?.rows.length ?? 0) + 1) ?? ke) + e.anchor.offY,
|
|
568
|
+
width: e.anchor.wPx,
|
|
569
|
+
height: e.anchor.hPx
|
|
570
|
+
};
|
|
571
|
+
})), X = g(null), Z = g(!1), zt = g(!0), Bt = g(!1);
|
|
572
|
+
function Q() {
|
|
573
|
+
let e = X.value;
|
|
574
|
+
if (!e) {
|
|
575
|
+
Z.value = !1;
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
578
|
+
let t = e.scrollWidth - e.clientWidth;
|
|
579
|
+
Z.value = t > 1, zt.value = e.scrollLeft <= 1, Bt.value = e.scrollLeft >= t - 1;
|
|
580
|
+
}
|
|
581
|
+
function Vt(e) {
|
|
582
|
+
let t = X.value;
|
|
583
|
+
t && t.scrollBy({
|
|
584
|
+
left: e * Math.max(120, t.clientWidth * .7),
|
|
585
|
+
behavior: "smooth"
|
|
586
|
+
});
|
|
587
|
+
}
|
|
588
|
+
function Ht(e) {
|
|
589
|
+
let t = X.value;
|
|
590
|
+
if (!t || t.scrollWidth <= t.clientWidth) return;
|
|
591
|
+
let n = Math.abs(e.deltaY) > Math.abs(e.deltaX) ? e.deltaY : e.deltaX;
|
|
592
|
+
n && (t.scrollLeft += n, e.preventDefault(), Q());
|
|
593
|
+
}
|
|
594
|
+
function Ut() {
|
|
595
|
+
f(() => {
|
|
596
|
+
X.value?.querySelector(".xv__tab--on")?.scrollIntoView({
|
|
597
|
+
inline: "nearest",
|
|
598
|
+
block: "nearest"
|
|
599
|
+
}), Q();
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
let $ = null;
|
|
603
|
+
ne(X, (e) => {
|
|
604
|
+
$?.disconnect(), e && typeof ResizeObserver < "u" && ($ = new ResizeObserver(Q), $.observe(e), Q());
|
|
605
|
+
});
|
|
606
|
+
async function Wt() {
|
|
607
|
+
if (!b.url) return;
|
|
608
|
+
x.value = "loading", Pe.value = "", Fe.value = null, Ie.value = /* @__PURE__ */ new Map(), w.value = {}, H.value = [], K.value = null, S.value = 0, F.value = [], I.value = [];
|
|
609
|
+
let e = b.url;
|
|
610
|
+
try {
|
|
611
|
+
let r = await fetch(e);
|
|
612
|
+
if (!r.ok) throw Error(`HTTP ${r.status}`);
|
|
613
|
+
let i = await r.arrayBuffer();
|
|
614
|
+
if (b.url !== e) return;
|
|
615
|
+
let a = await t(i);
|
|
616
|
+
if (b.url !== e) return;
|
|
617
|
+
Fe.value = a, x.value = "ready", L();
|
|
618
|
+
try {
|
|
619
|
+
let t = await n(i);
|
|
620
|
+
b.url === e && (Ie.value = t, L());
|
|
621
|
+
} catch {}
|
|
622
|
+
} catch (e) {
|
|
623
|
+
Pe.value = e instanceof Error ? e.message : String(e), x.value = "error";
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
ne(S, () => {
|
|
627
|
+
H.value = [], K.value = null, F.value = [], I.value = [];
|
|
628
|
+
let e = P.value;
|
|
629
|
+
e && (e.scrollTop = 0, e.scrollLeft = 0), L(), Ut();
|
|
630
|
+
}), te(() => {
|
|
631
|
+
Wt(), window.addEventListener("mousemove", st), window.addEventListener("mouseup", Gt);
|
|
632
|
+
}), ee(() => {
|
|
633
|
+
window.removeEventListener("mousemove", st), window.removeEventListener("mouseup", Gt), $?.disconnect();
|
|
634
|
+
});
|
|
635
|
+
function Gt() {
|
|
636
|
+
ct(), _t();
|
|
637
|
+
}
|
|
638
|
+
return ne(() => b.url, Wt), (e, t) => (h(), s("div", re, [x.value === "loading" ? (h(), s("p", ie, "正在解析表格…")) : x.value === "error" ? (h(), s("div", ae, [c("p", null, "解析失败:" + v(Pe.value), 1), c("button", {
|
|
639
|
+
type: "button",
|
|
640
|
+
class: "xv__retry",
|
|
641
|
+
onClick: Wt
|
|
642
|
+
}, "重试")])) : x.value === "ready" && C.value ? (h(), s(i, { key: 2 }, [
|
|
643
|
+
c("div", oe, [c("span", se, v(Ft.value || "—"), 1), c("span", ce, v(It.value), 1)]),
|
|
644
|
+
c("div", {
|
|
645
|
+
ref_key: "scrollEl",
|
|
646
|
+
ref: P,
|
|
647
|
+
class: "xv__scroll",
|
|
648
|
+
tabindex: "0",
|
|
649
|
+
onKeydown: wt
|
|
650
|
+
}, [c("div", le, [
|
|
651
|
+
c("table", {
|
|
652
|
+
ref_key: "tableEl",
|
|
653
|
+
ref: Ge,
|
|
654
|
+
class: "xv__table",
|
|
655
|
+
style: m({ width: Ue.value[D.value + 1] + "px" })
|
|
656
|
+
}, [
|
|
657
|
+
c("colgroup", null, [t[4] ||= c("col", { class: "xv__rowhead-col" }, null, -1), (h(!0), s(i, null, _(D.value, (e) => (h(), s("col", {
|
|
658
|
+
key: e,
|
|
659
|
+
style: m({
|
|
660
|
+
width: A(e) + "px",
|
|
661
|
+
minWidth: A(e) + "px"
|
|
662
|
+
})
|
|
663
|
+
}, null, 4))), 128))]),
|
|
664
|
+
c("thead", null, [c("tr", null, [t[5] ||= c("th", { class: "xv__corner" }, null, -1), (h(!0), s(i, null, _(He.value, (e, n) => (h(), s("th", {
|
|
665
|
+
key: n,
|
|
666
|
+
class: p(["xv__colhead", {
|
|
667
|
+
"xv__colhead--coll": O(n + 1),
|
|
668
|
+
"xv__colhead--frz": n + 1 <= M.value,
|
|
669
|
+
"xv__colhead--frzedge": et(n + 1),
|
|
670
|
+
"xv__colhead--sel": Mt(n + 1)
|
|
671
|
+
}]),
|
|
672
|
+
style: m(it(n + 1)),
|
|
673
|
+
title: "点击选中整列 · 拖动选多列 · Shift 连选 · Ctrl 多选",
|
|
674
|
+
onMousedown: (e) => vt(n + 1, e),
|
|
675
|
+
onMouseenter: (e) => yt(n + 1)
|
|
676
|
+
}, [
|
|
677
|
+
qe.value.get(n + 1) ? (h(), s("button", {
|
|
678
|
+
key: 0,
|
|
679
|
+
type: "button",
|
|
680
|
+
class: "xv__expander xv__expander--col",
|
|
681
|
+
title: `展开 ${qe.value.get(n + 1).count} 个隐藏列`,
|
|
682
|
+
onMousedown: t[0] ||= y(() => {}, ["stop"]),
|
|
683
|
+
onClick: y((e) => Ye(qe.value.get(n + 1)), ["stop"])
|
|
684
|
+
}, " ›‹ ", 40, de)) : o("", !0),
|
|
685
|
+
c("span", fe, v(e), 1),
|
|
686
|
+
c("span", {
|
|
687
|
+
class: "xv__col-resize",
|
|
688
|
+
title: "拖动调整列宽",
|
|
689
|
+
onMousedown: y((e) => at(n + 1, e), ["stop", "prevent"])
|
|
690
|
+
}, null, 40, pe)
|
|
691
|
+
], 46, ue))), 128))])]),
|
|
692
|
+
c("tbody", null, [(h(!0), s(i, null, _(C.value.rows, (e, n) => (h(), s("tr", {
|
|
693
|
+
key: n,
|
|
694
|
+
class: p({ "xv__row--coll": k(n) }),
|
|
695
|
+
style: m({ height: j(n) + "px" })
|
|
696
|
+
}, [c("th", {
|
|
697
|
+
class: p(["xv__rowhead", {
|
|
698
|
+
"xv__rowhead--frz": n + 1 <= N.value,
|
|
699
|
+
"xv__rowhead--frzedge": tt(n),
|
|
700
|
+
"xv__rowhead--sel": Nt(n)
|
|
701
|
+
}]),
|
|
702
|
+
style: m(rt(n)),
|
|
703
|
+
title: "点击选中整行 · 拖动选多行 · Shift 连选 · Ctrl 多选",
|
|
704
|
+
onMousedown: (e) => bt(n, e),
|
|
705
|
+
onMouseenter: (e) => xt(n)
|
|
706
|
+
}, [
|
|
707
|
+
Je.value.get(n) ? (h(), s("button", {
|
|
708
|
+
key: 0,
|
|
709
|
+
type: "button",
|
|
710
|
+
class: "xv__expander xv__expander--row",
|
|
711
|
+
title: `展开 ${Je.value.get(n).count} 个隐藏行`,
|
|
712
|
+
onMousedown: t[1] ||= y(() => {}, ["stop"]),
|
|
713
|
+
onClick: y((e) => Xe(Je.value.get(n)), ["stop"])
|
|
714
|
+
}, " ⌄ ", 40, he)) : o("", !0),
|
|
715
|
+
c("span", ge, v(e.num), 1),
|
|
716
|
+
c("span", {
|
|
717
|
+
class: "xv__row-resize",
|
|
718
|
+
title: "拖动调整行高",
|
|
719
|
+
onMousedown: y((t) => ot(e.num, t), ["stop", "prevent"])
|
|
720
|
+
}, null, 40, _e)
|
|
721
|
+
], 46, me), (h(!0), s(i, null, _(e.cells, (e) => (h(), s("td", {
|
|
722
|
+
key: e.col,
|
|
723
|
+
class: p(["xv__cell", {
|
|
724
|
+
"xv__cell--bold": e.bold,
|
|
725
|
+
"xv__cell--italic": e.italic,
|
|
726
|
+
"xv__cell--underline": e.underline,
|
|
727
|
+
"xv__cell--strike": e.strike,
|
|
728
|
+
"xv__cell--wrap": e.wrap,
|
|
729
|
+
"xv__cell--bt": e.bt,
|
|
730
|
+
"xv__cell--br": e.br,
|
|
731
|
+
"xv__cell--bb": e.bb,
|
|
732
|
+
"xv__cell--bl": e.bl,
|
|
733
|
+
"xv__cell--coll": O(e.col),
|
|
734
|
+
"xv__cell--frz-col": e.col <= M.value,
|
|
735
|
+
"xv__cell--frz-row": n + 1 <= N.value,
|
|
736
|
+
"xv__cell--frzedge-col": et(e.col),
|
|
737
|
+
"xv__cell--frzedge-row": tt(n),
|
|
738
|
+
"xv__cell--edit": dt(n, e.col),
|
|
739
|
+
"xv__cell--spill": B.value.has(`${n}:${e.col}`),
|
|
740
|
+
"xv__cell--sel": kt(e, n)
|
|
741
|
+
}]),
|
|
742
|
+
rowspan: e.rowSpan > 1 ? e.rowSpan : void 0,
|
|
743
|
+
colspan: e.colSpan > 1 ? e.colSpan : void 0,
|
|
744
|
+
style: m(nt(e, n)),
|
|
745
|
+
onMousedown: (t) => pt(n, e.col, t),
|
|
746
|
+
onMouseenter: (t) => gt(n, e.col),
|
|
747
|
+
onDblclick: (t) => mt(n, e.col)
|
|
748
|
+
}, [c("span", {
|
|
749
|
+
class: "xv__cellt",
|
|
750
|
+
style: m($e(e, n))
|
|
751
|
+
}, v(e.text), 5)], 46, ve))), 128))], 6))), 128))])
|
|
752
|
+
], 4),
|
|
753
|
+
(h(!0), s(i, null, _(Ot.value, (e, t) => (h(), s("div", {
|
|
754
|
+
key: t,
|
|
755
|
+
class: "xv__sel",
|
|
756
|
+
style: m(e)
|
|
757
|
+
}, null, 4))), 128)),
|
|
758
|
+
c("div", ye, [(h(!0), s(i, null, _(Rt.value, (e, t) => (h(), s("div", {
|
|
759
|
+
key: t,
|
|
760
|
+
class: "xv__chart",
|
|
761
|
+
style: m({
|
|
762
|
+
left: e.left + "px",
|
|
763
|
+
top: e.top + "px",
|
|
764
|
+
width: e.width + "px",
|
|
765
|
+
height: e.height + "px"
|
|
766
|
+
})
|
|
767
|
+
}, [u(r, { chart: e.chart }, null, 8, ["chart"])], 4))), 128))])
|
|
768
|
+
])], 544),
|
|
769
|
+
c("div", be, [Y.value ? (h(), s("span", xe, [l(v(Y.value.addr) + " ", 1), Y.value.numCount > 0 ? (h(), s(i, { key: 0 }, [l(" · 计数 " + v(Y.value.numCount) + " · 求和 " + v(jt(Y.value.sum)) + " ", 1), Y.value.numCount > 1 ? (h(), s(i, { key: 0 }, [l(" · 平均 " + v(jt(Y.value.avg)), 1)], 64)) : o("", !0)], 64)) : o("", !0)])) : (h(), s("span", Se, "拖动 / 方向键选择 · Shift 连选 · Ctrl 多选 · 点击或拖动行列头选整行/列 · 双击编辑文本 · 拖行列头边缘调尺寸")), c("span", Ce, [c("button", {
|
|
770
|
+
type: "button",
|
|
771
|
+
class: p(["xv__status-btn", { "xv__status-btn--on": T.value.revealAll }]),
|
|
772
|
+
onClick: Ve
|
|
773
|
+
}, v(T.value.revealAll ? "折叠隐藏行列" : "显示隐藏行列"), 3), ze.value ? (h(), s("button", {
|
|
774
|
+
key: 0,
|
|
775
|
+
type: "button",
|
|
776
|
+
class: "xv__status-btn",
|
|
777
|
+
onClick: Be
|
|
778
|
+
}, " 复位 ")) : o("", !0)])]),
|
|
779
|
+
Le.value.length > 1 ? (h(), s("div", we, [
|
|
780
|
+
Z.value ? (h(), s("button", {
|
|
781
|
+
key: 0,
|
|
782
|
+
type: "button",
|
|
783
|
+
class: "xv__tabscroll",
|
|
784
|
+
disabled: zt.value,
|
|
785
|
+
title: "向左滚动标签",
|
|
786
|
+
onClick: t[2] ||= (e) => Vt(-1)
|
|
787
|
+
}, " ‹ ", 8, Te)) : o("", !0),
|
|
788
|
+
c("div", {
|
|
789
|
+
ref_key: "tabsEl",
|
|
790
|
+
ref: X,
|
|
791
|
+
class: "xv__tabs",
|
|
792
|
+
onScroll: Q,
|
|
793
|
+
onWheel: Ht
|
|
794
|
+
}, [(h(!0), s(i, null, _(Le.value, (e, t) => (h(), s("button", {
|
|
795
|
+
key: t,
|
|
796
|
+
type: "button",
|
|
797
|
+
class: p(["xv__tab", { "xv__tab--on": t === S.value }]),
|
|
798
|
+
title: e.name,
|
|
799
|
+
onClick: (e) => S.value = t
|
|
800
|
+
}, v(e.name), 11, Ee))), 128))], 544),
|
|
801
|
+
Z.value ? (h(), s("button", {
|
|
802
|
+
key: 1,
|
|
803
|
+
type: "button",
|
|
804
|
+
class: "xv__tabscroll",
|
|
805
|
+
disabled: Bt.value,
|
|
806
|
+
title: "向右滚动标签",
|
|
807
|
+
onClick: t[3] ||= (e) => Vt(1)
|
|
808
|
+
}, " › ", 8, De)) : o("", !0)
|
|
809
|
+
])) : o("", !0)
|
|
810
|
+
], 64)) : o("", !0)]));
|
|
811
|
+
}
|
|
812
|
+
});
|
|
813
|
+
//#endregion
|
|
814
|
+
export { b as default };
|