@work-zhanguo/light-file-preview 0.0.17 → 0.0.19
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/README.md +30 -12
- package/dist/{UnsupportedRenderer-B016ePP5.js → UnsupportedRenderer-CbQ7S46f.js} +1 -1
- package/dist/index-DB5StklO.js +363 -0
- package/dist/light-file-preview.js +1 -1
- package/dist/light-file-preview.umd.cjs +158 -196
- package/dist/standalone/light-file-preview.iife.js +178 -217
- package/dist/standalone/style.css +1 -1
- package/dist/style.css +1 -1
- package/dist/types/components/FilePreview.vue.d.ts +3 -3
- package/dist/types/constants/file.d.ts +0 -1
- package/dist/types/types.d.ts +1 -1
- package/dist/vue2/light-file-preview-vue2.js +55300 -3
- package/dist/vue2/light-file-preview-vue2.umd.cjs +178 -217
- package/package.json +1 -3
- package/dist/PptxRenderer-B4sDptn0.js +0 -14773
- package/dist/index-DX4yvG8n.js +0 -353
- package/dist/types/components/renderers/PptxRenderer.vue.d.ts +0 -13
- package/dist/vue2/DocxRenderer-BYzWAtSx.js +0 -110
- package/dist/vue2/PdfRenderer-2f-SRj0_.js +0 -123
- package/dist/vue2/PptxRenderer-B1TlLH2y.js +0 -14773
- package/dist/vue2/SheetRenderer-DF9A6Tqq.js +0 -940
- package/dist/vue2/TextRenderer-Be7RzYjF.js +0 -59
- package/dist/vue2/UnsupportedRenderer-CIeHYr5T.js +0 -31
- package/dist/vue2/_commonjs-dynamic-modules-C74YT1gS.js +0 -32
- package/dist/vue2/docx-preview-BV-bQyiM.js +0 -5533
- package/dist/vue2/marked.esm-CRmQbSOC.js +0 -1577
- package/dist/vue2/pdf-BiKi76Et.js +0 -15320
- package/dist/vue2/purify.es-CCmmh-Lt.js +0 -553
- package/dist/vue2/style.css +0 -1
- package/dist/vue2/text-Bqxn_tMI.js +0 -24
- package/dist/vue2/vue2-DryhXOWQ.js +0 -6296
- package/dist/vue2/xlsx-j9Zzywas.js +0 -24774
- package/public/screenshots/effect-pptx.png +0 -0
package/README.md
CHANGED
|
@@ -25,13 +25,15 @@
|
|
|
25
25
|
|
|
26
26
|
## 项目简介
|
|
27
27
|
|
|
28
|
-
- 当前版本:`0.0.
|
|
28
|
+
- 当前版本:`0.0.18`
|
|
29
29
|
- 适用场景:业务系统附件预览、在线查看、弹窗预览、新页面预览
|
|
30
30
|
- 支持 Vue 3、Vue 2 适配入口,以及非 Vue 项目的 standalone 产物
|
|
31
|
+
- `PPTX` 预览已拆分为独立项目:[@work-zhanguo/pptx-preview](https://www.npmjs.com/package/@work-zhanguo/pptx-preview) / [Gitee](https://gitee.com/hou_zhan_guo/pptx-review)
|
|
31
32
|
- 在线演示:可通过顶部 `在线演示 Demo` 入口访问
|
|
32
33
|
|
|
33
34
|
最近更新:
|
|
34
35
|
|
|
36
|
+
- `0.0.18`:更新 `PPTX` 在线预览效果截图,README 与文档页展示改为真实预览画面
|
|
35
37
|
- `0.0.17`:补全 `PPTX` 在线预览能力,接入 `@work-zhanguo/pptx-preview`,同步更新演示文件与项目文档
|
|
36
38
|
- `0.0.16`:修复 `style.css` 引入后污染业务全局样式的问题,组件样式已收敛到 `.lfp-*` 作用域
|
|
37
39
|
- `0.0.15`:新增 npm `README.md` 的中英文双版本折叠切换展示,同步调整包描述与文档版本信息
|
|
@@ -59,11 +61,12 @@
|
|
|
59
61
|
|
|
60
62
|

|
|
61
63
|
|
|
62
|
-
### PPTX
|
|
64
|
+
### PPTX 说明
|
|
63
65
|
|
|
64
|
-
`PPTX`
|
|
66
|
+
当前项目不再内置 `PPTX` 预览和相关集成能力。如需演示文稿预览,请直接使用独立项目:
|
|
65
67
|
|
|
66
|
-
|
|
68
|
+
- npm:[@work-zhanguo/pptx-preview](https://www.npmjs.com/package/@work-zhanguo/pptx-preview)
|
|
69
|
+
- Gitee:[hou_zhan_guo/pptx-review](https://gitee.com/hou_zhan_guo/pptx-review)
|
|
67
70
|
|
|
68
71
|
## 支持文件
|
|
69
72
|
|
|
@@ -87,7 +90,6 @@
|
|
|
87
90
|
- `CSS`
|
|
88
91
|
- `MD`
|
|
89
92
|
- `DOCX`
|
|
90
|
-
- `PPTX`
|
|
91
93
|
- `XLS`
|
|
92
94
|
- `XLSX`
|
|
93
95
|
- `CSV`
|
|
@@ -100,6 +102,7 @@
|
|
|
100
102
|
|
|
101
103
|
- `DOC`
|
|
102
104
|
- `PPT`
|
|
105
|
+
- `PPTX`
|
|
103
106
|
- 其他未识别格式
|
|
104
107
|
|
|
105
108
|
补充说明:
|
|
@@ -112,11 +115,17 @@
|
|
|
112
115
|
|
|
113
116
|
- [pdf.js](https://github.com/mozilla/pdf.js)
|
|
114
117
|
- [docx-preview](https://github.com/VolodymyrBaydalka/docxjs)
|
|
115
|
-
- [@work-zhanguo/pptx-preview](https://www.npmjs.com/package/@work-zhanguo/pptx-preview)
|
|
116
118
|
- [SheetJS](https://github.com/SheetJS/sheetjs)
|
|
117
119
|
- [marked](https://github.com/markedjs/marked)
|
|
118
120
|
- [DOMPurify](https://github.com/cure53/DOMPurify)
|
|
119
121
|
|
|
122
|
+
## PPTX 预览
|
|
123
|
+
|
|
124
|
+
`PPTX` 预览已经拆分到独立项目维护。本项目只保留通用文件预览能力,不再内置 `PPTX` 渲染器。
|
|
125
|
+
|
|
126
|
+
- npm:[@work-zhanguo/pptx-preview](https://www.npmjs.com/package/@work-zhanguo/pptx-preview)
|
|
127
|
+
- Gitee:[hou_zhan_guo/pptx-review](https://gitee.com/hou_zhan_guo/pptx-review)
|
|
128
|
+
|
|
120
129
|
## 安装
|
|
121
130
|
|
|
122
131
|
```bash
|
|
@@ -297,13 +306,15 @@ npm run build:site
|
|
|
297
306
|
|
|
298
307
|
## Overview
|
|
299
308
|
|
|
300
|
-
- Current version: `0.0.
|
|
309
|
+
- Current version: `0.0.18`
|
|
301
310
|
- Use cases: attachment preview in business systems, inline viewing, dialog preview, and standalone preview pages
|
|
302
311
|
- Supports Vue 3, a Vue 2 adapter entry, and standalone assets for non-Vue projects
|
|
312
|
+
- `PPTX` preview has been split into a standalone project: [@work-zhanguo/pptx-preview](https://www.npmjs.com/package/@work-zhanguo/pptx-preview) / [Gitee](https://gitee.com/hou_zhan_guo/pptx-review)
|
|
303
313
|
- Demo: available through the `在线演示 Demo` link at the top of this document
|
|
304
314
|
|
|
305
315
|
Recent updates:
|
|
306
316
|
|
|
317
|
+
- `0.0.18`: refreshed the `PPTX` preview screenshot so README and docs now show the real online preview result
|
|
307
318
|
- `0.0.17`: added online `PPTX` preview through `@work-zhanguo/pptx-preview`, and synchronized the demo file and project documentation
|
|
308
319
|
- `0.0.16`: fixed global style leakage caused by importing `style.css`, and scoped published component styles to `.lfp-*` rules only
|
|
309
320
|
- `0.0.15`: rewrote `README.md` for npm with collapsible Chinese and English sections, and synchronized package description and documentation version info
|
|
@@ -331,11 +342,12 @@ The images below use the npm CDN URL. Local repository changes do not affect the
|
|
|
331
342
|
|
|
332
343
|

|
|
333
344
|
|
|
334
|
-
### PPTX
|
|
345
|
+
### PPTX Note
|
|
335
346
|
|
|
336
|
-
|
|
347
|
+
This project no longer ships built-in `PPTX` preview support. If you need slide preview, use the standalone project instead:
|
|
337
348
|
|
|
338
|
-
|
|
349
|
+
- npm: [@work-zhanguo/pptx-preview](https://www.npmjs.com/package/@work-zhanguo/pptx-preview)
|
|
350
|
+
- Gitee: [hou_zhan_guo/pptx-review](https://gitee.com/hou_zhan_guo/pptx-review)
|
|
339
351
|
|
|
340
352
|
## Supported Files
|
|
341
353
|
|
|
@@ -359,7 +371,6 @@ Supported for online preview:
|
|
|
359
371
|
- `CSS`
|
|
360
372
|
- `MD`
|
|
361
373
|
- `DOCX`
|
|
362
|
-
- `PPTX`
|
|
363
374
|
- `XLS`
|
|
364
375
|
- `XLSX`
|
|
365
376
|
- `CSV`
|
|
@@ -372,6 +383,7 @@ Fallback to download entry:
|
|
|
372
383
|
|
|
373
384
|
- `DOC`
|
|
374
385
|
- `PPT`
|
|
386
|
+
- `PPTX`
|
|
375
387
|
- any unrecognized format
|
|
376
388
|
|
|
377
389
|
Notes:
|
|
@@ -384,11 +396,17 @@ Notes:
|
|
|
384
396
|
|
|
385
397
|
- [pdf.js](https://github.com/mozilla/pdf.js)
|
|
386
398
|
- [docx-preview](https://github.com/VolodymyrBaydalka/docxjs)
|
|
387
|
-
- [@work-zhanguo/pptx-preview](https://www.npmjs.com/package/@work-zhanguo/pptx-preview)
|
|
388
399
|
- [SheetJS](https://github.com/SheetJS/sheetjs)
|
|
389
400
|
- [marked](https://github.com/markedjs/marked)
|
|
390
401
|
- [DOMPurify](https://github.com/cure53/DOMPurify)
|
|
391
402
|
|
|
403
|
+
## PPTX Preview
|
|
404
|
+
|
|
405
|
+
`PPTX` preview is now maintained as a standalone project. This package keeps the generic file preview scope and no longer bundles a `PPTX` renderer.
|
|
406
|
+
|
|
407
|
+
- npm: [@work-zhanguo/pptx-preview](https://www.npmjs.com/package/@work-zhanguo/pptx-preview)
|
|
408
|
+
- Gitee: [hou_zhan_guo/pptx-review](https://gitee.com/hou_zhan_guo/pptx-review)
|
|
409
|
+
|
|
392
410
|
## Installation
|
|
393
411
|
|
|
394
412
|
```bash
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as o, openBlock as l, createElementBlock as a, createElementVNode as t, toDisplayString as i, unref as r } from "vue";
|
|
2
|
-
import { d as s } from "./index-
|
|
2
|
+
import { d as s } from "./index-DB5StklO.js";
|
|
3
3
|
const d = { class: "lfp-empty" }, p = { class: "lfp-hint" }, c = /* @__PURE__ */ o({
|
|
4
4
|
__name: "UnsupportedRenderer",
|
|
5
5
|
props: {
|
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
import { defineComponent as ee, defineAsyncComponent as L, ref as R, computed as x, watch as U, onBeforeUnmount as te, openBlock as s, createBlock as E, Teleport as oe, createVNode as N, Transition as O, withCtx as V, createElementBlock as v, normalizeClass as Z, createCommentVNode as S, createElementVNode as l, toDisplayString as D, Fragment as ne, unref as _, reactive as $, createApp as q, h as z } from "vue";
|
|
2
|
+
const y = {
|
|
3
|
+
image: ["png", "jpg", "jpeg", "gif", "webp", "bmp", "svg"],
|
|
4
|
+
pdf: ["pdf"],
|
|
5
|
+
text: ["txt", "json", "js", "ts", "jsx", "tsx", "html", "css", "md", "csv"],
|
|
6
|
+
docx: ["docx"],
|
|
7
|
+
sheet: ["xls", "xlsx", "csv"],
|
|
8
|
+
video: ["mp4", "webm"],
|
|
9
|
+
audio: ["mp3", "wav"]
|
|
10
|
+
}, ae = ["doc", "ppt", "pptx"];
|
|
11
|
+
function I(e = "") {
|
|
12
|
+
const n = e.split("#")[0].split("?")[0].split(".");
|
|
13
|
+
return n.length > 1 ? n[n.length - 1].toLowerCase() : "";
|
|
14
|
+
}
|
|
15
|
+
function le(e) {
|
|
16
|
+
const t = I(e);
|
|
17
|
+
return y.image.includes(t) ? "image" : y.pdf.includes(t) ? "pdf" : y.docx.includes(t) ? "docx" : y.sheet.includes(t) ? "sheet" : y.video.includes(t) ? "video" : y.audio.includes(t) ? "audio" : y.text.includes(t) ? t === "csv" ? "sheet" : "text" : (ae.includes(t), "unsupported");
|
|
18
|
+
}
|
|
19
|
+
function se(e) {
|
|
20
|
+
if (/^(blob:|data:|https?:\/\/|file:\/\/)/i.test(e))
|
|
21
|
+
return e;
|
|
22
|
+
try {
|
|
23
|
+
const t = new URL(e, window.location.href);
|
|
24
|
+
return t.pathname = t.pathname.split("/").map((n) => encodeURIComponent(decodeURIComponent(n))).join("/"), t.toString();
|
|
25
|
+
} catch (t) {
|
|
26
|
+
return e.split("/").map((n) => encodeURIComponent(decodeURIComponent(n))).join("/");
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function H(e, t) {
|
|
30
|
+
var r;
|
|
31
|
+
if (typeof e == "string") {
|
|
32
|
+
const f = se(e), d = e.split("/"), o = (r = t != null ? t : d[d.length - 1]) != null ? r : "unknown";
|
|
33
|
+
return {
|
|
34
|
+
source: e,
|
|
35
|
+
src: f,
|
|
36
|
+
name: decodeURIComponent(o.split("?")[0].split("#")[0]),
|
|
37
|
+
extension: I(o)
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
const n = URL.createObjectURL(e), c = t != null ? t : "name" in e && typeof e.name == "string" ? e.name : "blob";
|
|
41
|
+
return {
|
|
42
|
+
source: e,
|
|
43
|
+
src: n,
|
|
44
|
+
name: c,
|
|
45
|
+
extension: I(c),
|
|
46
|
+
cleanup: () => URL.revokeObjectURL(n)
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function ie(e, t) {
|
|
50
|
+
const n = document.createElement("a");
|
|
51
|
+
n.href = e, n.download = t, n.target = "_blank", n.rel = "noopener", document.body.append(n), n.click(), n.remove();
|
|
52
|
+
}
|
|
53
|
+
const ue = ["aria-modal"], re = {
|
|
54
|
+
key: 0,
|
|
55
|
+
class: "lfp-toolbar"
|
|
56
|
+
}, ce = { class: "lfp-toolbar__meta" }, de = { class: "lfp-title" }, ve = { class: "lfp-badge" }, fe = { class: "lfp-toolbar__actions" }, pe = {
|
|
57
|
+
key: 0,
|
|
58
|
+
class: "lfp-loading"
|
|
59
|
+
}, me = {
|
|
60
|
+
key: 0,
|
|
61
|
+
class: "lfp-error"
|
|
62
|
+
}, ge = ["src", "alt"], xe = ["src"], be = ["src"], A = /* @__PURE__ */ ee({
|
|
63
|
+
__name: "FilePreview",
|
|
64
|
+
props: {
|
|
65
|
+
source: {},
|
|
66
|
+
fileName: {},
|
|
67
|
+
mode: { default: "inline" },
|
|
68
|
+
visible: { type: Boolean, default: !0 },
|
|
69
|
+
loadingText: { default: "文件加载中..." },
|
|
70
|
+
textEncoding: { default: "utf-8" },
|
|
71
|
+
maxTextBytes: { default: 1024 * 1024 * 2 },
|
|
72
|
+
maxSheetRows: { default: 200 },
|
|
73
|
+
maxSheetCols: { default: 50 },
|
|
74
|
+
pdfScale: { default: 1.35 },
|
|
75
|
+
showToolbar: { type: Boolean, default: !0 },
|
|
76
|
+
dialogTitle: { default: "文件预览" }
|
|
77
|
+
},
|
|
78
|
+
emits: ["update:visible", "error"],
|
|
79
|
+
setup(e, { emit: t }) {
|
|
80
|
+
const n = L(() => import("./PdfRenderer-DweDxjLS.js")), c = L(() => import("./TextRenderer-KUhpnf63.js")), r = L(() => import("./DocxRenderer-Cck1uOjU.js")), f = L(() => import("./SheetRenderer-CMDoDBXR.js")), d = L(() => import("./UnsupportedRenderer-CbQ7S46f.js")), o = e, F = t, b = R(null), p = R(!1), h = R(""), k = R(0), a = R(H(o.source, o.fileName)), w = R(!1), X = {
|
|
81
|
+
image: "图片",
|
|
82
|
+
pdf: "PDF",
|
|
83
|
+
text: "文本",
|
|
84
|
+
docx: "DOCX",
|
|
85
|
+
sheet: "表格",
|
|
86
|
+
video: "视频",
|
|
87
|
+
audio: "音频",
|
|
88
|
+
unsupported: "下载"
|
|
89
|
+
}, m = x(() => le(a.value.name)), W = x(() => X[m.value]), G = x(() => o.fileName || a.value.name || o.dialogTitle), g = x(() => o.mode === "dialog"), J = x(() => g.value ? o.visible : !0), B = x(() => `${a.value.src}::${k.value}`), C = x(
|
|
90
|
+
() => [
|
|
91
|
+
a.value.src,
|
|
92
|
+
a.value.extension,
|
|
93
|
+
o.textEncoding,
|
|
94
|
+
o.maxTextBytes,
|
|
95
|
+
o.maxSheetRows,
|
|
96
|
+
o.maxSheetCols,
|
|
97
|
+
o.pdfScale,
|
|
98
|
+
k.value
|
|
99
|
+
].join("::")
|
|
100
|
+
), j = x(() => m.value === "image" ? "img" : m.value === "video" ? "video" : m.value === "audio" ? "audio" : null);
|
|
101
|
+
U(
|
|
102
|
+
() => [o.source, o.fileName],
|
|
103
|
+
() => {
|
|
104
|
+
var i, u;
|
|
105
|
+
(i = b.value) == null || i.call(b), a.value = H(o.source, o.fileName), b.value = (u = a.value.cleanup) != null ? u : null, h.value = "", p.value = !1, k.value += 1;
|
|
106
|
+
},
|
|
107
|
+
{ immediate: !0 }
|
|
108
|
+
), U(
|
|
109
|
+
() => [o.textEncoding, o.maxTextBytes, o.maxSheetRows, o.maxSheetCols, o.pdfScale],
|
|
110
|
+
() => {
|
|
111
|
+
h.value = "", p.value = !1, k.value += 1;
|
|
112
|
+
}
|
|
113
|
+
), U(
|
|
114
|
+
() => o.visible,
|
|
115
|
+
(i, u) => {
|
|
116
|
+
if (g.value) {
|
|
117
|
+
if (!i) {
|
|
118
|
+
w.value = !1, p.value = !1;
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
u || (h.value = "", p.value = !1, k.value += 1, w.value = !1);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
), U(
|
|
125
|
+
() => o.mode,
|
|
126
|
+
(i, u) => {
|
|
127
|
+
i === "dialog" && u !== "dialog" && o.visible && (h.value = "", p.value = !1, k.value += 1, w.value = !1);
|
|
128
|
+
}
|
|
129
|
+
), te(() => {
|
|
130
|
+
var i;
|
|
131
|
+
(i = b.value) == null || i.call(b);
|
|
132
|
+
});
|
|
133
|
+
function M() {
|
|
134
|
+
w.value = !1, F("update:visible", !1);
|
|
135
|
+
}
|
|
136
|
+
function Q() {
|
|
137
|
+
w.value = !0;
|
|
138
|
+
}
|
|
139
|
+
function Y() {
|
|
140
|
+
w.value && (w.value = !1, M());
|
|
141
|
+
}
|
|
142
|
+
function K() {
|
|
143
|
+
ie(a.value.src, a.value.name);
|
|
144
|
+
}
|
|
145
|
+
function P(i) {
|
|
146
|
+
h.value = i.message, F("error", i);
|
|
147
|
+
}
|
|
148
|
+
function T(i) {
|
|
149
|
+
p.value = i;
|
|
150
|
+
}
|
|
151
|
+
return (i, u) => (s(), E(oe, {
|
|
152
|
+
to: "body",
|
|
153
|
+
disabled: !g.value
|
|
154
|
+
}, [
|
|
155
|
+
N(O, {
|
|
156
|
+
name: g.value ? "lfp-dialog" : "lfp-static",
|
|
157
|
+
appear: ""
|
|
158
|
+
}, {
|
|
159
|
+
default: V(() => [
|
|
160
|
+
J.value ? (s(), v("div", {
|
|
161
|
+
key: 0,
|
|
162
|
+
class: Z(["lfp-wrapper", { "is-dialog": g.value }])
|
|
163
|
+
}, [
|
|
164
|
+
g.value ? (s(), v("div", {
|
|
165
|
+
key: 0,
|
|
166
|
+
class: "lfp-backdrop",
|
|
167
|
+
onPointerdown: Q,
|
|
168
|
+
onClick: Y
|
|
169
|
+
}, null, 32)) : S("", !0),
|
|
170
|
+
l("section", {
|
|
171
|
+
class: "lfp-panel",
|
|
172
|
+
role: "dialog",
|
|
173
|
+
"aria-modal": g.value ? "true" : "false"
|
|
174
|
+
}, [
|
|
175
|
+
e.showToolbar ? (s(), v("header", re, [
|
|
176
|
+
l("div", ce, [
|
|
177
|
+
l("strong", de, D(G.value), 1),
|
|
178
|
+
l("span", ve, D(W.value), 1)
|
|
179
|
+
]),
|
|
180
|
+
l("div", fe, [
|
|
181
|
+
l("button", {
|
|
182
|
+
class: "lfp-button lfp-icon-button",
|
|
183
|
+
type: "button",
|
|
184
|
+
"aria-label": "Download",
|
|
185
|
+
title: "Download",
|
|
186
|
+
onClick: K
|
|
187
|
+
}, [...u[0] || (u[0] = [
|
|
188
|
+
l("svg", {
|
|
189
|
+
viewBox: "0 0 24 24",
|
|
190
|
+
"aria-hidden": "true"
|
|
191
|
+
}, [
|
|
192
|
+
l("path", { d: "M12 3.5a1 1 0 0 1 1 1V12l2.8-2.8a1 1 0 1 1 1.4 1.42l-4.5 4.48a1 1 0 0 1-1.4 0l-4.5-4.48a1 1 0 0 1 1.4-1.42L11 12V4.5a1 1 0 0 1 1-1Zm-7 13a1 1 0 0 1 1 1v.75c0 .41.34.75.75.75h10.5a.75.75 0 0 0 .75-.75v-.75a1 1 0 1 1 2 0v.75A2.75 2.75 0 0 1 17.25 21H6.75A2.75 2.75 0 0 1 4 18.25v-.75a1 1 0 0 1 1-1Z" })
|
|
193
|
+
], -1)
|
|
194
|
+
])]),
|
|
195
|
+
g.value ? (s(), v("button", {
|
|
196
|
+
key: 0,
|
|
197
|
+
class: "lfp-button lfp-button is-ghost lfp-icon-button",
|
|
198
|
+
type: "button",
|
|
199
|
+
"aria-label": "Close",
|
|
200
|
+
title: "Close",
|
|
201
|
+
onClick: M
|
|
202
|
+
}, [...u[1] || (u[1] = [
|
|
203
|
+
l("svg", {
|
|
204
|
+
viewBox: "0 0 24 24",
|
|
205
|
+
"aria-hidden": "true"
|
|
206
|
+
}, [
|
|
207
|
+
l("path", { d: "M6.7 5.3a1 1 0 0 1 1.4 0L12 9.17l3.9-3.88a1 1 0 1 1 1.4 1.42L13.4 10.6l3.9 3.89a1 1 0 0 1-1.4 1.42L12 12.03l-3.9 3.88a1 1 0 0 1-1.4-1.42l3.9-3.89-3.9-3.89a1 1 0 0 1 0-1.42Z" })
|
|
208
|
+
], -1)
|
|
209
|
+
])])) : S("", !0)
|
|
210
|
+
])
|
|
211
|
+
])) : S("", !0),
|
|
212
|
+
l("div", {
|
|
213
|
+
class: Z(["lfp-content", { "is-loading": p.value }])
|
|
214
|
+
}, [
|
|
215
|
+
N(O, { name: "lfp-fade" }, {
|
|
216
|
+
default: V(() => [
|
|
217
|
+
p.value ? (s(), v("div", pe, [
|
|
218
|
+
u[2] || (u[2] = l("span", { class: "lfp-spinner" }, null, -1)),
|
|
219
|
+
l("span", null, D(e.loadingText), 1)
|
|
220
|
+
])) : S("", !0)
|
|
221
|
+
]),
|
|
222
|
+
_: 1
|
|
223
|
+
}),
|
|
224
|
+
h.value ? (s(), v("div", me, [
|
|
225
|
+
l("p", null, D(h.value), 1),
|
|
226
|
+
l("button", {
|
|
227
|
+
class: "lfp-button lfp-icon-button",
|
|
228
|
+
type: "button",
|
|
229
|
+
"aria-label": "Download",
|
|
230
|
+
title: "Download",
|
|
231
|
+
onClick: K
|
|
232
|
+
}, [...u[3] || (u[3] = [
|
|
233
|
+
l("svg", {
|
|
234
|
+
viewBox: "0 0 24 24",
|
|
235
|
+
"aria-hidden": "true"
|
|
236
|
+
}, [
|
|
237
|
+
l("path", { d: "M12 3.5a1 1 0 0 1 1 1V12l2.8-2.8a1 1 0 1 1 1.4 1.42l-4.5 4.48a1 1 0 0 1-1.4 0l-4.5-4.48a1 1 0 0 1 1.4-1.42L11 12V4.5a1 1 0 0 1 1-1Zm-7 13a1 1 0 0 1 1 1v.75c0 .41.34.75.75.75h10.5a.75.75 0 0 0 .75-.75v-.75a1 1 0 1 1 2 0v.75A2.75 2.75 0 0 1 17.25 21H6.75A2.75 2.75 0 0 1 4 18.25v-.75a1 1 0 0 1 1-1Z" })
|
|
238
|
+
], -1)
|
|
239
|
+
])])
|
|
240
|
+
])) : (s(), v(ne, { key: 1 }, [
|
|
241
|
+
j.value === "img" ? (s(), v("img", {
|
|
242
|
+
key: B.value,
|
|
243
|
+
class: "lfp-image",
|
|
244
|
+
src: a.value.src,
|
|
245
|
+
alt: a.value.name,
|
|
246
|
+
loading: "lazy"
|
|
247
|
+
}, null, 8, ge)) : j.value === "video" ? (s(), v("video", {
|
|
248
|
+
key: B.value,
|
|
249
|
+
class: "lfp-media",
|
|
250
|
+
src: a.value.src,
|
|
251
|
+
controls: "",
|
|
252
|
+
preload: "metadata"
|
|
253
|
+
}, null, 8, xe)) : j.value === "audio" ? (s(), v("audio", {
|
|
254
|
+
key: B.value,
|
|
255
|
+
class: "lfp-audio",
|
|
256
|
+
src: a.value.src,
|
|
257
|
+
controls: "",
|
|
258
|
+
preload: "metadata"
|
|
259
|
+
}, null, 8, be)) : m.value === "pdf" ? (s(), E(_(n), {
|
|
260
|
+
key: C.value,
|
|
261
|
+
source: typeof o.source == "string" ? a.value.src : o.source,
|
|
262
|
+
scale: e.pdfScale,
|
|
263
|
+
onLoading: T,
|
|
264
|
+
onError: P
|
|
265
|
+
}, null, 8, ["source", "scale"])) : m.value === "docx" ? (s(), E(_(r), {
|
|
266
|
+
key: C.value,
|
|
267
|
+
source: typeof o.source == "string" ? a.value.src : o.source,
|
|
268
|
+
onLoading: T,
|
|
269
|
+
onError: P
|
|
270
|
+
}, null, 8, ["source"])) : m.value === "sheet" ? (s(), E(_(f), {
|
|
271
|
+
key: C.value,
|
|
272
|
+
source: typeof o.source == "string" ? a.value.src : o.source,
|
|
273
|
+
"max-cols": e.maxSheetCols,
|
|
274
|
+
"max-rows": e.maxSheetRows,
|
|
275
|
+
onLoading: T,
|
|
276
|
+
onError: P
|
|
277
|
+
}, null, 8, ["source", "max-cols", "max-rows"])) : m.value === "text" ? (s(), E(_(c), {
|
|
278
|
+
key: C.value,
|
|
279
|
+
source: typeof o.source == "string" ? a.value.src : o.source,
|
|
280
|
+
encoding: e.textEncoding,
|
|
281
|
+
extension: a.value.extension,
|
|
282
|
+
"max-bytes": e.maxTextBytes,
|
|
283
|
+
onLoading: T,
|
|
284
|
+
onError: P
|
|
285
|
+
}, null, 8, ["source", "encoding", "extension", "max-bytes"])) : (s(), E(_(d), {
|
|
286
|
+
key: 7,
|
|
287
|
+
"file-name": a.value.name,
|
|
288
|
+
src: a.value.src
|
|
289
|
+
}, null, 8, ["file-name", "src"]))
|
|
290
|
+
], 64))
|
|
291
|
+
], 2)
|
|
292
|
+
], 8, ue)
|
|
293
|
+
], 2)) : S("", !0)
|
|
294
|
+
]),
|
|
295
|
+
_: 1
|
|
296
|
+
}, 8, ["name"])
|
|
297
|
+
], 8, ["disabled"]));
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
function he(e) {
|
|
301
|
+
if (typeof e == "string") {
|
|
302
|
+
const t = document.querySelector(e);
|
|
303
|
+
if (!t)
|
|
304
|
+
throw new Error(`未找到挂载节点:${e}`);
|
|
305
|
+
return t;
|
|
306
|
+
}
|
|
307
|
+
return e;
|
|
308
|
+
}
|
|
309
|
+
function we(e, t) {
|
|
310
|
+
const n = $({ ...t }), c = he(e), r = q({
|
|
311
|
+
render: () => z(A, n)
|
|
312
|
+
});
|
|
313
|
+
return r.mount(c), {
|
|
314
|
+
update(f) {
|
|
315
|
+
Object.assign(n, f);
|
|
316
|
+
},
|
|
317
|
+
unmount() {
|
|
318
|
+
r.unmount();
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
function ye(e) {
|
|
323
|
+
const t = document.createElement("div");
|
|
324
|
+
document.body.append(t);
|
|
325
|
+
let n;
|
|
326
|
+
const c = e["onUpdate:visible"], r = $({
|
|
327
|
+
visible: !0,
|
|
328
|
+
mode: "dialog",
|
|
329
|
+
...e,
|
|
330
|
+
"onUpdate:visible"(d) {
|
|
331
|
+
c == null || c(d), r.visible = d, d || queueMicrotask(() => n.unmount());
|
|
332
|
+
}
|
|
333
|
+
}), f = q({
|
|
334
|
+
render: () => z(A, r)
|
|
335
|
+
});
|
|
336
|
+
return f.mount(t), n = {
|
|
337
|
+
update(d) {
|
|
338
|
+
Object.assign(r, d);
|
|
339
|
+
},
|
|
340
|
+
unmount() {
|
|
341
|
+
f.unmount(), t.remove();
|
|
342
|
+
}
|
|
343
|
+
}, n;
|
|
344
|
+
}
|
|
345
|
+
function Re() {
|
|
346
|
+
const e = {
|
|
347
|
+
mount: we,
|
|
348
|
+
openDialog: ye
|
|
349
|
+
};
|
|
350
|
+
return typeof window != "undefined" && (window.LightFilePreview = e), e;
|
|
351
|
+
}
|
|
352
|
+
const Ee = {
|
|
353
|
+
install(e) {
|
|
354
|
+
e.component("LightFilePreview", A);
|
|
355
|
+
}
|
|
356
|
+
};
|
|
357
|
+
export {
|
|
358
|
+
A as _,
|
|
359
|
+
ie as d,
|
|
360
|
+
Ee as i,
|
|
361
|
+
ye as o,
|
|
362
|
+
Re as r
|
|
363
|
+
};
|