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