@glodon-aiot/react-components 3.11.0-snapshot.1765331440 → 3.11.0-snapshot.1765331443
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/components/DocumentViewer/components/ErrorAlert.mjs +11 -10
- package/dist/es/components/DocumentViewer/components/FileRenderers.mjs +112 -103
- package/dist/es/components/DocumentViewer/components/MediaRenderers.mjs +7 -2
- package/dist/es/components/DocumentViewer/components/ZipRenderer.mjs +16 -14
- package/dist/es/components/DocumentViewer/index.mjs +270 -141
- package/dist/es/index.mjs +1 -1
- package/dist/es/utils/file.mjs +6 -6
- package/dist/lib/index.js +10 -10
- package/dist/src/components/DocumentViewer/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,236 +1,365 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var y = (o, e, r) => new Promise((b, p) => {
|
|
2
|
+
var C = (c) => {
|
|
3
3
|
try {
|
|
4
|
-
|
|
5
|
-
} catch (
|
|
6
|
-
|
|
4
|
+
u(r.next(c));
|
|
5
|
+
} catch (v) {
|
|
6
|
+
p(v);
|
|
7
7
|
}
|
|
8
|
-
},
|
|
8
|
+
}, s = (c) => {
|
|
9
9
|
try {
|
|
10
|
-
|
|
11
|
-
} catch (
|
|
12
|
-
|
|
10
|
+
u(r.throw(c));
|
|
11
|
+
} catch (v) {
|
|
12
|
+
p(v);
|
|
13
13
|
}
|
|
14
|
-
},
|
|
15
|
-
|
|
14
|
+
}, u = (c) => c.done ? b(c.value) : Promise.resolve(c.value).then(C, s);
|
|
15
|
+
u((r = r.apply(o, e)).next());
|
|
16
16
|
});
|
|
17
|
-
import {
|
|
18
|
-
import { useMemo as
|
|
19
|
-
import { Spin as
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
17
|
+
import { jsxs as x, jsx as t } from "react/jsx-runtime";
|
|
18
|
+
import { useMemo as g, useState as w, useEffect as ie, useCallback as z } from "react";
|
|
19
|
+
import { message as h, Space as ae, Button as se, Dropdown as ce, Spin as le, Alert as de } from "antd";
|
|
20
|
+
import { DownloadOutlined as ue, CopyOutlined as pe } from "@ant-design/icons";
|
|
21
|
+
import { getFileExtension as A, getFileType as me } from "../../utils/file.mjs";
|
|
22
|
+
import { MAX_FILE_SIZE as S } from "./constants.mjs";
|
|
23
|
+
import { usePdfViewer as fe } from "./hooks/usePdfViewer.mjs";
|
|
24
|
+
import { useZipViewer as we } from "./hooks/useZipViewer.mjs";
|
|
25
|
+
import { TextRenderer as P, CodeRenderer as he, XmlRenderer as ve, HtmlRenderer as ye, MarkdownRenderer as xe, JsonlRenderer as be, TsvRenderer as ge, CsvRenderer as Ce, JsonRenderer as ke } from "./components/FileRenderers.mjs";
|
|
26
|
+
import { AudioRenderer as Re, VideoRenderer as Fe, ImageRenderer as Te } from "./components/MediaRenderers.mjs";
|
|
27
|
+
import { PdfRenderer as Ee } from "./components/PdfRenderer.mjs";
|
|
28
|
+
import { ZipRenderer as Ne } from "./components/ZipRenderer.mjs";
|
|
29
|
+
import { ErrorAlert as ze } from "./components/ErrorAlert.mjs";
|
|
29
30
|
import "./style.less.mjs";
|
|
30
|
-
const
|
|
31
|
+
const Se = (o) => {
|
|
32
|
+
if (!o)
|
|
33
|
+
return "unknown";
|
|
34
|
+
const e = o.split(";")[0].trim().toLowerCase();
|
|
35
|
+
return e.startsWith("image/") ? "image" : e.startsWith("video/") ? "video" : e.startsWith("audio/") ? "audio" : e === "application/pdf" ? "pdf" : e === "text/markdown" || e === "text/x-markdown" ? "markdown" : e === "application/json" ? "json" : e === "application/jsonl" ? "jsonl" : e === "text/csv" || e === "application/csv" ? "csv" : e === "text/tab-separated-values" ? "tsv" : e === "application/javascript" || e === "text/javascript" ? "code" : e === "application/xml" || e === "text/xml" ? "xml" : e === "text/html" || e === "application/xhtml+xml" ? "html" : e === "text/plain" ? "text" : "unknown";
|
|
36
|
+
}, Be = (o) => !o || Number.isNaN(o) ? "大小未知" : o < 1024 ? `${o}B` : o < 1024 * 1024 ? `${(o / 1024).toFixed(1)}KB` : o < 1024 * 1024 * 1024 ? `${(o / 1024 / 1024).toFixed(1)}MB` : `${(o / 1024 / 1024 / 1024).toFixed(1)}GB`, Le = (o, e) => {
|
|
37
|
+
if (e)
|
|
38
|
+
return e;
|
|
39
|
+
try {
|
|
40
|
+
const p = new URL(o).pathname.split("/").filter(Boolean).pop();
|
|
41
|
+
return decodeURIComponent(p || o);
|
|
42
|
+
} catch (r) {
|
|
43
|
+
return o;
|
|
44
|
+
}
|
|
45
|
+
}, je = (o) => {
|
|
31
46
|
const {
|
|
32
47
|
url: e,
|
|
33
|
-
fileName:
|
|
34
|
-
className:
|
|
35
|
-
style:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
fileName: r,
|
|
49
|
+
className: b,
|
|
50
|
+
style: p,
|
|
51
|
+
showToolbar: C = !0
|
|
52
|
+
} = o, s = g(() => {
|
|
53
|
+
const a = A(e), n = r ? A(r) : void 0;
|
|
54
|
+
return me(a || n);
|
|
55
|
+
}, [e, r]), [u, c] = w(s), {
|
|
56
|
+
pdfBlobUrl: v,
|
|
57
|
+
pdfLoading: V,
|
|
58
|
+
pdfError: W
|
|
59
|
+
} = fe(s === "pdf" ? e : ""), {
|
|
60
|
+
zipFiles: H,
|
|
61
|
+
zipLoading: Z,
|
|
62
|
+
zipError: _,
|
|
63
|
+
selectedZipFile: J,
|
|
64
|
+
zipFileContent: X,
|
|
65
|
+
handleFileClick: G
|
|
66
|
+
} = we(s === "zip" ? e : ""), [K, d] = w(!0), [B, m] = w(null), [i, L] = w(null), [l, j] = w(0), [q, M] = w(!1), $ = g(() => Le(e, r), [r, e]), Q = g(() => Be(l), [l]), k = !!(i != null && i.content), Y = !k && !e, ee = g(() => [{
|
|
67
|
+
key: "copy-content",
|
|
68
|
+
label: "复制内容",
|
|
69
|
+
disabled: !k
|
|
70
|
+
}, {
|
|
71
|
+
key: "copy-url",
|
|
72
|
+
label: "复制地址",
|
|
73
|
+
disabled: !e
|
|
74
|
+
}], [k, e]);
|
|
75
|
+
ie(() => {
|
|
76
|
+
if (c(s), s === "pdf" || s === "zip") {
|
|
77
|
+
d(!1);
|
|
54
78
|
return;
|
|
55
79
|
}
|
|
56
80
|
if (!e) {
|
|
57
|
-
|
|
81
|
+
m("文件URL不能为空"), d(!1);
|
|
58
82
|
return;
|
|
59
83
|
}
|
|
60
|
-
if (["image", "video", "audio", "office"
|
|
61
|
-
|
|
84
|
+
if (["image", "video", "audio", "office"].includes(s)) {
|
|
85
|
+
d(!1);
|
|
62
86
|
return;
|
|
63
87
|
}
|
|
64
|
-
|
|
88
|
+
d(!0), m(null), y(void 0, null, function* () {
|
|
65
89
|
try {
|
|
66
|
-
|
|
90
|
+
if (e.startsWith("blob:") || e.startsWith("data:")) {
|
|
91
|
+
const f = yield fetch(e);
|
|
92
|
+
if (!f.ok)
|
|
93
|
+
throw new Error(`HTTP error! status: ${f.status}`);
|
|
94
|
+
const O = yield f.blob(), N = O.size;
|
|
95
|
+
if (j(N), N > S) {
|
|
96
|
+
m(`文件过大(${Math.round(N / 1024 / 1024)}MB),无法预览。请下载后查看。`), d(!1);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const oe = yield O.text();
|
|
100
|
+
s === "unknown" && c("text"), L({
|
|
101
|
+
content: oe
|
|
102
|
+
}), d(!1);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const n = yield fetch(e, {
|
|
67
106
|
method: "HEAD"
|
|
68
|
-
})
|
|
69
|
-
if (
|
|
70
|
-
f
|
|
107
|
+
}), F = n.headers.get("Content-Length"), ne = n.headers.get("Content-Type"), T = F ? parseInt(F, 10) : 0;
|
|
108
|
+
if (j(T), s === "unknown") {
|
|
109
|
+
const f = Se(ne);
|
|
110
|
+
f !== "unknown" && c(f);
|
|
111
|
+
}
|
|
112
|
+
if (T > S) {
|
|
113
|
+
m(`文件过大(${Math.round(T / 1024 / 1024)}MB),无法预览。请下载后查看。`), d(!1);
|
|
71
114
|
return;
|
|
72
115
|
}
|
|
73
|
-
const
|
|
74
|
-
if (!
|
|
75
|
-
throw new Error(`HTTP error! status: ${
|
|
76
|
-
const
|
|
77
|
-
if (
|
|
78
|
-
|
|
116
|
+
const E = yield fetch(e);
|
|
117
|
+
if (!E.ok)
|
|
118
|
+
throw new Error(`HTTP error! status: ${E.status}`);
|
|
119
|
+
const D = yield E.text(), I = new Blob([D]).size;
|
|
120
|
+
if (I > S) {
|
|
121
|
+
m(`文件过大(${Math.round(I / 1024 / 1024)}MB),无法预览。请下载后查看。`), d(!1);
|
|
79
122
|
return;
|
|
80
123
|
}
|
|
81
|
-
|
|
82
|
-
content:
|
|
83
|
-
}),
|
|
84
|
-
} catch (
|
|
85
|
-
|
|
124
|
+
u === "unknown" && c("text"), L({
|
|
125
|
+
content: D
|
|
126
|
+
}), d(!1);
|
|
127
|
+
} catch (a) {
|
|
128
|
+
m(a.message || "加载文件失败"), d(!1);
|
|
86
129
|
}
|
|
87
130
|
});
|
|
88
|
-
}, [e,
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
131
|
+
}, [e, s]);
|
|
132
|
+
const R = z(() => y(void 0, null, function* () {
|
|
133
|
+
var a;
|
|
134
|
+
if (!(i != null && i.content)) {
|
|
135
|
+
h.warning("暂无可复制的内容");
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
try {
|
|
139
|
+
if (M(!0), (a = navigator == null ? void 0 : navigator.clipboard) != null && a.writeText)
|
|
140
|
+
yield navigator.clipboard.writeText(i.content);
|
|
141
|
+
else {
|
|
142
|
+
const n = document.createElement("textarea");
|
|
143
|
+
n.value = i.content, n.style.position = "fixed", n.style.opacity = "0", document.body.appendChild(n), n.select(), document.execCommand("copy"), document.body.removeChild(n);
|
|
144
|
+
}
|
|
145
|
+
h.success("内容已复制到剪贴板");
|
|
146
|
+
} catch (n) {
|
|
147
|
+
h.error((n == null ? void 0 : n.message) || "复制失败,请手动复制");
|
|
148
|
+
} finally {
|
|
149
|
+
M(!1);
|
|
150
|
+
}
|
|
151
|
+
}), [i]), U = z(() => y(void 0, null, function* () {
|
|
152
|
+
var a;
|
|
153
|
+
if (!e) {
|
|
154
|
+
h.warning("暂无可复制的地址");
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
try {
|
|
158
|
+
if ((a = navigator == null ? void 0 : navigator.clipboard) != null && a.writeText)
|
|
159
|
+
yield navigator.clipboard.writeText(e);
|
|
160
|
+
else {
|
|
161
|
+
const n = document.createElement("textarea");
|
|
162
|
+
n.value = e, n.style.position = "fixed", n.style.opacity = "0", document.body.appendChild(n), n.select(), document.execCommand("copy"), document.body.removeChild(n);
|
|
163
|
+
}
|
|
164
|
+
h.success("链接已复制到剪贴板");
|
|
165
|
+
} catch (n) {
|
|
166
|
+
h.error((n == null ? void 0 : n.message) || "复制失败,请手动复制");
|
|
167
|
+
}
|
|
168
|
+
}), [e]), te = z((n) => y(void 0, [n], function* ({
|
|
169
|
+
key: a
|
|
170
|
+
}) {
|
|
171
|
+
a === "copy-content" && (yield R()), a === "copy-url" && (yield U());
|
|
172
|
+
}), [R, U]), re = () => {
|
|
173
|
+
if (K)
|
|
174
|
+
return /* @__PURE__ */ t("div", {
|
|
92
175
|
className: "document-viewer-loading",
|
|
93
|
-
children: /* @__PURE__ */
|
|
176
|
+
children: /* @__PURE__ */ t(le, {
|
|
94
177
|
size: "large",
|
|
95
178
|
tip: "加载中..."
|
|
96
179
|
})
|
|
97
180
|
});
|
|
98
|
-
if (
|
|
99
|
-
return /* @__PURE__ */
|
|
181
|
+
if (B)
|
|
182
|
+
return /* @__PURE__ */ t(ze, {
|
|
100
183
|
message: "加载失败",
|
|
101
|
-
description:
|
|
184
|
+
description: B,
|
|
102
185
|
url: e,
|
|
103
|
-
fileName:
|
|
186
|
+
fileName: r
|
|
104
187
|
});
|
|
105
|
-
|
|
188
|
+
if (u === "unknown" && (i != null && i.content))
|
|
189
|
+
return /* @__PURE__ */ t(P, {
|
|
190
|
+
fileContent: i,
|
|
191
|
+
fileSize: l,
|
|
192
|
+
url: e,
|
|
193
|
+
fileName: r
|
|
194
|
+
});
|
|
195
|
+
switch (u) {
|
|
106
196
|
case "text":
|
|
107
|
-
return /* @__PURE__ */
|
|
197
|
+
return /* @__PURE__ */ t(P, {
|
|
108
198
|
fileContent: i,
|
|
109
|
-
fileSize:
|
|
199
|
+
fileSize: l,
|
|
110
200
|
url: e,
|
|
111
|
-
fileName:
|
|
201
|
+
fileName: r
|
|
112
202
|
});
|
|
113
203
|
case "json":
|
|
114
|
-
return /* @__PURE__ */
|
|
204
|
+
return /* @__PURE__ */ t(ke, {
|
|
115
205
|
fileContent: i,
|
|
116
|
-
fileSize:
|
|
206
|
+
fileSize: l,
|
|
117
207
|
url: e,
|
|
118
|
-
fileName:
|
|
208
|
+
fileName: r
|
|
119
209
|
});
|
|
120
210
|
case "csv":
|
|
121
|
-
return /* @__PURE__ */
|
|
211
|
+
return /* @__PURE__ */ t(Ce, {
|
|
122
212
|
fileContent: i,
|
|
123
|
-
fileSize:
|
|
213
|
+
fileSize: l,
|
|
124
214
|
url: e,
|
|
125
|
-
fileName:
|
|
215
|
+
fileName: r
|
|
126
216
|
});
|
|
127
217
|
case "tsv":
|
|
128
|
-
return /* @__PURE__ */
|
|
218
|
+
return /* @__PURE__ */ t(ge, {
|
|
129
219
|
fileContent: i,
|
|
130
|
-
fileSize:
|
|
220
|
+
fileSize: l,
|
|
131
221
|
url: e,
|
|
132
|
-
fileName:
|
|
222
|
+
fileName: r
|
|
133
223
|
});
|
|
134
224
|
case "jsonl":
|
|
135
|
-
return /* @__PURE__ */
|
|
225
|
+
return /* @__PURE__ */ t(be, {
|
|
136
226
|
fileContent: i,
|
|
137
|
-
fileSize:
|
|
227
|
+
fileSize: l,
|
|
138
228
|
url: e,
|
|
139
|
-
fileName:
|
|
229
|
+
fileName: r
|
|
140
230
|
});
|
|
141
231
|
case "markdown":
|
|
142
|
-
return /* @__PURE__ */
|
|
232
|
+
return /* @__PURE__ */ t(xe, {
|
|
143
233
|
fileContent: i,
|
|
144
|
-
fileSize:
|
|
234
|
+
fileSize: l,
|
|
145
235
|
url: e,
|
|
146
|
-
fileName:
|
|
236
|
+
fileName: r
|
|
147
237
|
});
|
|
148
238
|
case "html":
|
|
149
|
-
return /* @__PURE__ */
|
|
239
|
+
return /* @__PURE__ */ t(ye, {
|
|
150
240
|
fileContent: i,
|
|
151
|
-
fileSize:
|
|
241
|
+
fileSize: l,
|
|
152
242
|
url: e,
|
|
153
|
-
fileName:
|
|
243
|
+
fileName: r
|
|
154
244
|
});
|
|
155
245
|
case "xml":
|
|
156
|
-
return /* @__PURE__ */
|
|
246
|
+
return /* @__PURE__ */ t(ve, {
|
|
157
247
|
fileContent: i,
|
|
158
|
-
fileSize:
|
|
248
|
+
fileSize: l,
|
|
159
249
|
url: e,
|
|
160
|
-
fileName:
|
|
250
|
+
fileName: r
|
|
161
251
|
});
|
|
162
252
|
case "code":
|
|
163
|
-
return /* @__PURE__ */
|
|
253
|
+
return /* @__PURE__ */ t(he, {
|
|
164
254
|
fileContent: i,
|
|
165
|
-
fileSize:
|
|
255
|
+
fileSize: l,
|
|
166
256
|
url: e,
|
|
167
|
-
fileName:
|
|
257
|
+
fileName: r
|
|
168
258
|
});
|
|
169
259
|
case "image":
|
|
170
|
-
return /* @__PURE__ */
|
|
260
|
+
return /* @__PURE__ */ t(Te, {
|
|
171
261
|
url: e,
|
|
172
|
-
fileName:
|
|
262
|
+
fileName: r
|
|
173
263
|
});
|
|
174
264
|
case "video":
|
|
175
|
-
return /* @__PURE__ */
|
|
265
|
+
return /* @__PURE__ */ t(Fe, {
|
|
176
266
|
url: e,
|
|
177
|
-
fileName:
|
|
267
|
+
fileName: r
|
|
178
268
|
});
|
|
179
269
|
case "audio":
|
|
180
|
-
return /* @__PURE__ */
|
|
270
|
+
return /* @__PURE__ */ t(Re, {
|
|
181
271
|
url: e,
|
|
182
|
-
fileName:
|
|
272
|
+
fileName: r
|
|
183
273
|
});
|
|
184
274
|
case "pdf":
|
|
185
|
-
return /* @__PURE__ */
|
|
186
|
-
pdfBlobUrl:
|
|
187
|
-
pdfLoading:
|
|
188
|
-
pdfError:
|
|
275
|
+
return /* @__PURE__ */ t(Ee, {
|
|
276
|
+
pdfBlobUrl: v,
|
|
277
|
+
pdfLoading: V,
|
|
278
|
+
pdfError: W,
|
|
189
279
|
url: e,
|
|
190
|
-
fileName:
|
|
280
|
+
fileName: r
|
|
191
281
|
});
|
|
192
282
|
case "office":
|
|
193
|
-
return /* @__PURE__ */
|
|
283
|
+
return /* @__PURE__ */ t(Me, {
|
|
194
284
|
url: e
|
|
195
285
|
});
|
|
196
286
|
case "zip":
|
|
197
|
-
return /* @__PURE__ */
|
|
198
|
-
zipFiles:
|
|
199
|
-
zipLoading:
|
|
200
|
-
zipError:
|
|
201
|
-
selectedZipFile:
|
|
202
|
-
zipFileContent:
|
|
203
|
-
onFileClick:
|
|
287
|
+
return /* @__PURE__ */ t(Ne, {
|
|
288
|
+
zipFiles: H,
|
|
289
|
+
zipLoading: Z,
|
|
290
|
+
zipError: _,
|
|
291
|
+
selectedZipFile: J,
|
|
292
|
+
zipFileContent: X,
|
|
293
|
+
onFileClick: G,
|
|
204
294
|
url: e
|
|
205
295
|
});
|
|
206
296
|
case "unknown":
|
|
207
297
|
default:
|
|
208
|
-
return /* @__PURE__ */
|
|
298
|
+
return /* @__PURE__ */ t($e, {
|
|
209
299
|
url: e
|
|
210
300
|
});
|
|
211
301
|
}
|
|
212
302
|
};
|
|
213
|
-
return /* @__PURE__ */
|
|
214
|
-
className: `document-viewer ${
|
|
215
|
-
style:
|
|
216
|
-
children:
|
|
303
|
+
return /* @__PURE__ */ x("div", {
|
|
304
|
+
className: `document-viewer ${b || ""}`,
|
|
305
|
+
style: p,
|
|
306
|
+
children: [C && /* @__PURE__ */ x("div", {
|
|
307
|
+
className: "document-viewer-toolbar",
|
|
308
|
+
children: [/* @__PURE__ */ x("div", {
|
|
309
|
+
className: "document-viewer-toolbar-meta",
|
|
310
|
+
children: [/* @__PURE__ */ t("span", {
|
|
311
|
+
className: "document-viewer-toolbar-name",
|
|
312
|
+
title: $,
|
|
313
|
+
children: $
|
|
314
|
+
}), /* @__PURE__ */ t("span", {
|
|
315
|
+
className: "document-viewer-toolbar-size",
|
|
316
|
+
children: Q
|
|
317
|
+
})]
|
|
318
|
+
}), /* @__PURE__ */ x(ae, {
|
|
319
|
+
size: 8,
|
|
320
|
+
wrap: !0,
|
|
321
|
+
children: [/* @__PURE__ */ t(se, {
|
|
322
|
+
icon: /* @__PURE__ */ t(ue, {}),
|
|
323
|
+
size: "small",
|
|
324
|
+
href: e,
|
|
325
|
+
target: "_blank",
|
|
326
|
+
rel: "noopener noreferrer",
|
|
327
|
+
download: r || void 0,
|
|
328
|
+
children: "下载"
|
|
329
|
+
}), /* @__PURE__ */ t(ce.Button, {
|
|
330
|
+
size: "small",
|
|
331
|
+
icon: /* @__PURE__ */ t(pe, {}),
|
|
332
|
+
menu: {
|
|
333
|
+
items: ee,
|
|
334
|
+
onClick: te
|
|
335
|
+
},
|
|
336
|
+
disabled: Y,
|
|
337
|
+
loading: q,
|
|
338
|
+
onClick: R,
|
|
339
|
+
children: "复制"
|
|
340
|
+
})]
|
|
341
|
+
})]
|
|
342
|
+
}), /* @__PURE__ */ t("div", {
|
|
343
|
+
className: "document-viewer-body",
|
|
344
|
+
children: re()
|
|
345
|
+
})]
|
|
217
346
|
});
|
|
218
|
-
},
|
|
219
|
-
url:
|
|
347
|
+
}, Me = ({
|
|
348
|
+
url: o
|
|
220
349
|
}) => {
|
|
221
|
-
const e = `https://view.officeapps.live.com/op/embed.aspx?src=${encodeURIComponent(
|
|
222
|
-
return /* @__PURE__ */
|
|
350
|
+
const e = `https://view.officeapps.live.com/op/embed.aspx?src=${encodeURIComponent(o)}`;
|
|
351
|
+
return /* @__PURE__ */ x("div", {
|
|
223
352
|
className: "document-viewer-office",
|
|
224
|
-
children: [/* @__PURE__ */
|
|
353
|
+
children: [/* @__PURE__ */ t("iframe", {
|
|
225
354
|
src: e,
|
|
226
355
|
className: "document-viewer-iframe",
|
|
227
356
|
title: "Office Document Preview"
|
|
228
|
-
}), /* @__PURE__ */
|
|
357
|
+
}), /* @__PURE__ */ t("div", {
|
|
229
358
|
className: "document-viewer-fallback",
|
|
230
|
-
children: /* @__PURE__ */
|
|
359
|
+
children: /* @__PURE__ */ t(de, {
|
|
231
360
|
message: "预览可能不可用",
|
|
232
|
-
description: /* @__PURE__ */
|
|
233
|
-
href:
|
|
361
|
+
description: /* @__PURE__ */ t("a", {
|
|
362
|
+
href: o,
|
|
234
363
|
target: "_blank",
|
|
235
364
|
rel: "noopener noreferrer",
|
|
236
365
|
children: "点击下载文件"
|
|
@@ -240,16 +369,16 @@ const oe = (a) => {
|
|
|
240
369
|
})
|
|
241
370
|
})]
|
|
242
371
|
});
|
|
243
|
-
},
|
|
244
|
-
url:
|
|
245
|
-
}) => /* @__PURE__ */
|
|
372
|
+
}, $e = ({
|
|
373
|
+
url: o
|
|
374
|
+
}) => /* @__PURE__ */ t("div", {
|
|
246
375
|
className: "document-viewer-unknown",
|
|
247
|
-
children: /* @__PURE__ */
|
|
248
|
-
src:
|
|
376
|
+
children: /* @__PURE__ */ t("iframe", {
|
|
377
|
+
src: o,
|
|
249
378
|
className: "document-viewer-iframe",
|
|
250
379
|
title: "File Preview"
|
|
251
380
|
})
|
|
252
|
-
}),
|
|
381
|
+
}), qe = je;
|
|
253
382
|
export {
|
|
254
|
-
|
|
383
|
+
qe as default
|
|
255
384
|
};
|