@glodon-aiot/react-components 3.11.0-snapshot.1765331441 → 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 +274 -160
- 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,251 +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:")) {
|
|
67
|
-
const
|
|
68
|
-
if (!
|
|
69
|
-
throw new Error(`HTTP error! status: ${
|
|
70
|
-
const
|
|
71
|
-
if (
|
|
72
|
-
|
|
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);
|
|
73
97
|
return;
|
|
74
98
|
}
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
content:
|
|
78
|
-
}),
|
|
99
|
+
const oe = yield O.text();
|
|
100
|
+
s === "unknown" && c("text"), L({
|
|
101
|
+
content: oe
|
|
102
|
+
}), d(!1);
|
|
79
103
|
return;
|
|
80
104
|
}
|
|
81
|
-
const
|
|
105
|
+
const n = yield fetch(e, {
|
|
82
106
|
method: "HEAD"
|
|
83
|
-
})
|
|
84
|
-
if (
|
|
85
|
-
|
|
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);
|
|
86
114
|
return;
|
|
87
115
|
}
|
|
88
|
-
const
|
|
89
|
-
if (!
|
|
90
|
-
throw new Error(`HTTP error! status: ${
|
|
91
|
-
const
|
|
92
|
-
if (
|
|
93
|
-
|
|
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);
|
|
94
122
|
return;
|
|
95
123
|
}
|
|
96
|
-
|
|
97
|
-
content:
|
|
98
|
-
}),
|
|
99
|
-
} catch (
|
|
100
|
-
|
|
124
|
+
u === "unknown" && c("text"), L({
|
|
125
|
+
content: D
|
|
126
|
+
}), d(!1);
|
|
127
|
+
} catch (a) {
|
|
128
|
+
m(a.message || "加载文件失败"), d(!1);
|
|
101
129
|
}
|
|
102
130
|
});
|
|
103
|
-
}, [e,
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
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", {
|
|
107
175
|
className: "document-viewer-loading",
|
|
108
|
-
children: /* @__PURE__ */
|
|
176
|
+
children: /* @__PURE__ */ t(le, {
|
|
109
177
|
size: "large",
|
|
110
178
|
tip: "加载中..."
|
|
111
179
|
})
|
|
112
180
|
});
|
|
113
|
-
if (
|
|
114
|
-
return /* @__PURE__ */
|
|
181
|
+
if (B)
|
|
182
|
+
return /* @__PURE__ */ t(ze, {
|
|
115
183
|
message: "加载失败",
|
|
116
|
-
description:
|
|
184
|
+
description: B,
|
|
185
|
+
url: e,
|
|
186
|
+
fileName: r
|
|
187
|
+
});
|
|
188
|
+
if (u === "unknown" && (i != null && i.content))
|
|
189
|
+
return /* @__PURE__ */ t(P, {
|
|
190
|
+
fileContent: i,
|
|
191
|
+
fileSize: l,
|
|
117
192
|
url: e,
|
|
118
|
-
fileName:
|
|
193
|
+
fileName: r
|
|
119
194
|
});
|
|
120
|
-
switch (
|
|
195
|
+
switch (u) {
|
|
121
196
|
case "text":
|
|
122
|
-
return /* @__PURE__ */
|
|
123
|
-
fileContent:
|
|
124
|
-
fileSize:
|
|
197
|
+
return /* @__PURE__ */ t(P, {
|
|
198
|
+
fileContent: i,
|
|
199
|
+
fileSize: l,
|
|
125
200
|
url: e,
|
|
126
|
-
fileName:
|
|
201
|
+
fileName: r
|
|
127
202
|
});
|
|
128
203
|
case "json":
|
|
129
|
-
return /* @__PURE__ */
|
|
130
|
-
fileContent:
|
|
131
|
-
fileSize:
|
|
204
|
+
return /* @__PURE__ */ t(ke, {
|
|
205
|
+
fileContent: i,
|
|
206
|
+
fileSize: l,
|
|
132
207
|
url: e,
|
|
133
|
-
fileName:
|
|
208
|
+
fileName: r
|
|
134
209
|
});
|
|
135
210
|
case "csv":
|
|
136
|
-
return /* @__PURE__ */
|
|
137
|
-
fileContent:
|
|
138
|
-
fileSize:
|
|
211
|
+
return /* @__PURE__ */ t(Ce, {
|
|
212
|
+
fileContent: i,
|
|
213
|
+
fileSize: l,
|
|
139
214
|
url: e,
|
|
140
|
-
fileName:
|
|
215
|
+
fileName: r
|
|
141
216
|
});
|
|
142
217
|
case "tsv":
|
|
143
|
-
return /* @__PURE__ */
|
|
144
|
-
fileContent:
|
|
145
|
-
fileSize:
|
|
218
|
+
return /* @__PURE__ */ t(ge, {
|
|
219
|
+
fileContent: i,
|
|
220
|
+
fileSize: l,
|
|
146
221
|
url: e,
|
|
147
|
-
fileName:
|
|
222
|
+
fileName: r
|
|
148
223
|
});
|
|
149
224
|
case "jsonl":
|
|
150
|
-
return /* @__PURE__ */
|
|
151
|
-
fileContent:
|
|
152
|
-
fileSize:
|
|
225
|
+
return /* @__PURE__ */ t(be, {
|
|
226
|
+
fileContent: i,
|
|
227
|
+
fileSize: l,
|
|
153
228
|
url: e,
|
|
154
|
-
fileName:
|
|
229
|
+
fileName: r
|
|
155
230
|
});
|
|
156
231
|
case "markdown":
|
|
157
|
-
return /* @__PURE__ */
|
|
158
|
-
fileContent:
|
|
159
|
-
fileSize:
|
|
232
|
+
return /* @__PURE__ */ t(xe, {
|
|
233
|
+
fileContent: i,
|
|
234
|
+
fileSize: l,
|
|
160
235
|
url: e,
|
|
161
|
-
fileName:
|
|
236
|
+
fileName: r
|
|
162
237
|
});
|
|
163
238
|
case "html":
|
|
164
|
-
return /* @__PURE__ */
|
|
165
|
-
fileContent:
|
|
166
|
-
fileSize:
|
|
239
|
+
return /* @__PURE__ */ t(ye, {
|
|
240
|
+
fileContent: i,
|
|
241
|
+
fileSize: l,
|
|
167
242
|
url: e,
|
|
168
|
-
fileName:
|
|
243
|
+
fileName: r
|
|
169
244
|
});
|
|
170
245
|
case "xml":
|
|
171
|
-
return /* @__PURE__ */
|
|
172
|
-
fileContent:
|
|
173
|
-
fileSize:
|
|
246
|
+
return /* @__PURE__ */ t(ve, {
|
|
247
|
+
fileContent: i,
|
|
248
|
+
fileSize: l,
|
|
174
249
|
url: e,
|
|
175
|
-
fileName:
|
|
250
|
+
fileName: r
|
|
176
251
|
});
|
|
177
252
|
case "code":
|
|
178
|
-
return /* @__PURE__ */
|
|
179
|
-
fileContent:
|
|
180
|
-
fileSize:
|
|
253
|
+
return /* @__PURE__ */ t(he, {
|
|
254
|
+
fileContent: i,
|
|
255
|
+
fileSize: l,
|
|
181
256
|
url: e,
|
|
182
|
-
fileName:
|
|
257
|
+
fileName: r
|
|
183
258
|
});
|
|
184
259
|
case "image":
|
|
185
|
-
return /* @__PURE__ */
|
|
260
|
+
return /* @__PURE__ */ t(Te, {
|
|
186
261
|
url: e,
|
|
187
|
-
fileName:
|
|
262
|
+
fileName: r
|
|
188
263
|
});
|
|
189
264
|
case "video":
|
|
190
|
-
return /* @__PURE__ */
|
|
265
|
+
return /* @__PURE__ */ t(Fe, {
|
|
191
266
|
url: e,
|
|
192
|
-
fileName:
|
|
267
|
+
fileName: r
|
|
193
268
|
});
|
|
194
269
|
case "audio":
|
|
195
|
-
return /* @__PURE__ */
|
|
270
|
+
return /* @__PURE__ */ t(Re, {
|
|
196
271
|
url: e,
|
|
197
|
-
fileName:
|
|
272
|
+
fileName: r
|
|
198
273
|
});
|
|
199
274
|
case "pdf":
|
|
200
|
-
return /* @__PURE__ */
|
|
201
|
-
pdfBlobUrl:
|
|
202
|
-
pdfLoading:
|
|
203
|
-
pdfError:
|
|
275
|
+
return /* @__PURE__ */ t(Ee, {
|
|
276
|
+
pdfBlobUrl: v,
|
|
277
|
+
pdfLoading: V,
|
|
278
|
+
pdfError: W,
|
|
204
279
|
url: e,
|
|
205
|
-
fileName:
|
|
280
|
+
fileName: r
|
|
206
281
|
});
|
|
207
282
|
case "office":
|
|
208
|
-
return /* @__PURE__ */
|
|
283
|
+
return /* @__PURE__ */ t(Me, {
|
|
209
284
|
url: e
|
|
210
285
|
});
|
|
211
286
|
case "zip":
|
|
212
|
-
return /* @__PURE__ */
|
|
213
|
-
zipFiles:
|
|
214
|
-
zipLoading:
|
|
215
|
-
zipError:
|
|
216
|
-
selectedZipFile:
|
|
217
|
-
zipFileContent:
|
|
218
|
-
onFileClick:
|
|
287
|
+
return /* @__PURE__ */ t(Ne, {
|
|
288
|
+
zipFiles: H,
|
|
289
|
+
zipLoading: Z,
|
|
290
|
+
zipError: _,
|
|
291
|
+
selectedZipFile: J,
|
|
292
|
+
zipFileContent: X,
|
|
293
|
+
onFileClick: G,
|
|
219
294
|
url: e
|
|
220
295
|
});
|
|
221
296
|
case "unknown":
|
|
222
297
|
default:
|
|
223
|
-
return /* @__PURE__ */
|
|
298
|
+
return /* @__PURE__ */ t($e, {
|
|
224
299
|
url: e
|
|
225
300
|
});
|
|
226
301
|
}
|
|
227
302
|
};
|
|
228
|
-
return /* @__PURE__ */
|
|
229
|
-
className: `document-viewer ${
|
|
230
|
-
style:
|
|
231
|
-
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
|
+
})]
|
|
232
346
|
});
|
|
233
|
-
},
|
|
234
|
-
url:
|
|
347
|
+
}, Me = ({
|
|
348
|
+
url: o
|
|
235
349
|
}) => {
|
|
236
|
-
const e = `https://view.officeapps.live.com/op/embed.aspx?src=${encodeURIComponent(
|
|
237
|
-
return /* @__PURE__ */
|
|
350
|
+
const e = `https://view.officeapps.live.com/op/embed.aspx?src=${encodeURIComponent(o)}`;
|
|
351
|
+
return /* @__PURE__ */ x("div", {
|
|
238
352
|
className: "document-viewer-office",
|
|
239
|
-
children: [/* @__PURE__ */
|
|
353
|
+
children: [/* @__PURE__ */ t("iframe", {
|
|
240
354
|
src: e,
|
|
241
355
|
className: "document-viewer-iframe",
|
|
242
356
|
title: "Office Document Preview"
|
|
243
|
-
}), /* @__PURE__ */
|
|
357
|
+
}), /* @__PURE__ */ t("div", {
|
|
244
358
|
className: "document-viewer-fallback",
|
|
245
|
-
children: /* @__PURE__ */
|
|
359
|
+
children: /* @__PURE__ */ t(de, {
|
|
246
360
|
message: "预览可能不可用",
|
|
247
|
-
description: /* @__PURE__ */
|
|
248
|
-
href:
|
|
361
|
+
description: /* @__PURE__ */ t("a", {
|
|
362
|
+
href: o,
|
|
249
363
|
target: "_blank",
|
|
250
364
|
rel: "noopener noreferrer",
|
|
251
365
|
children: "点击下载文件"
|
|
@@ -255,16 +369,16 @@ const de = (c) => {
|
|
|
255
369
|
})
|
|
256
370
|
})]
|
|
257
371
|
});
|
|
258
|
-
},
|
|
259
|
-
url:
|
|
260
|
-
}) => /* @__PURE__ */
|
|
372
|
+
}, $e = ({
|
|
373
|
+
url: o
|
|
374
|
+
}) => /* @__PURE__ */ t("div", {
|
|
261
375
|
className: "document-viewer-unknown",
|
|
262
|
-
children: /* @__PURE__ */
|
|
263
|
-
src:
|
|
376
|
+
children: /* @__PURE__ */ t("iframe", {
|
|
377
|
+
src: o,
|
|
264
378
|
className: "document-viewer-iframe",
|
|
265
379
|
title: "File Preview"
|
|
266
380
|
})
|
|
267
|
-
}),
|
|
381
|
+
}), qe = je;
|
|
268
382
|
export {
|
|
269
|
-
|
|
383
|
+
qe as default
|
|
270
384
|
};
|