@glodon-aiot/react-components 3.11.0 → 3.11.1-shapshot.1765331455
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/PDFViewer/index.mjs +62 -0
- package/dist/es/components/DocumentViewer/components/PDFViewer/style.less.mjs +4 -0
- package/dist/es/components/DocumentViewer/index.mjs +195 -201
- package/dist/es/components/DocumentViewer/utils.mjs +72 -36
- package/dist/es/index.mjs +1 -1
- 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 +4 -1
- package/dist/es/components/DocumentViewer/components/PdfRenderer.mjs +0 -45
- package/dist/es/components/DocumentViewer/hooks/usePdfViewer.mjs +0 -31
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
var d = Object.defineProperty, h = Object.defineProperties;
|
|
2
|
+
var f = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var a = Object.getOwnPropertySymbols;
|
|
4
|
+
var g = Object.prototype.hasOwnProperty, P = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var m = (r, e, o) => e in r ? d(r, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : r[e] = o, c = (r, e) => {
|
|
6
|
+
for (var o in e || (e = {}))
|
|
7
|
+
g.call(e, o) && m(r, o, e[o]);
|
|
8
|
+
if (a)
|
|
9
|
+
for (var o of a(e))
|
|
10
|
+
P.call(e, o) && m(r, o, e[o]);
|
|
11
|
+
return r;
|
|
12
|
+
}, s = (r, e) => h(r, f(e));
|
|
13
|
+
import { jsx as t, Fragment as i } from "react/jsx-runtime";
|
|
14
|
+
import { Worker as w, Viewer as S, SpecialZoomLevel as b } from "@react-pdf-viewer/core";
|
|
15
|
+
import "@react-pdf-viewer/core/lib/styles/index.css";
|
|
16
|
+
import { defaultLayoutPlugin as T } from "@react-pdf-viewer/default-layout";
|
|
17
|
+
import v from "@react-pdf-viewer/locales/lib/zh_CN.json";
|
|
18
|
+
import "@react-pdf-viewer/default-layout/lib/styles/index.css";
|
|
19
|
+
import "../../../../node_modules/@react-pdf-viewer/toolbar/lib/styles/index.css.mjs";
|
|
20
|
+
import "../../../../node_modules/@react-pdf-viewer/open/lib/styles/index.css.mjs";
|
|
21
|
+
import "./style.less.mjs";
|
|
22
|
+
const I = (r) => {
|
|
23
|
+
const {
|
|
24
|
+
fileUrl: e,
|
|
25
|
+
pageNumber: o
|
|
26
|
+
} = r, p = (n) => s(c({}, n), {
|
|
27
|
+
Open: () => /* @__PURE__ */ t(i, {}),
|
|
28
|
+
Search: () => /* @__PURE__ */ t(i, {}),
|
|
29
|
+
ShowSearchPopover: () => /* @__PURE__ */ t(i, {}),
|
|
30
|
+
SwitchTheme: () => /* @__PURE__ */ t(i, {}),
|
|
31
|
+
SwitchThemeMenuItem: () => /* @__PURE__ */ t(i, {}),
|
|
32
|
+
ShowProperties: () => /* @__PURE__ */ t(i, {}),
|
|
33
|
+
ShowPropertiesMenuItem: () => /* @__PURE__ */ t(i, {})
|
|
34
|
+
}), l = T({
|
|
35
|
+
renderToolbar: (n) => /* @__PURE__ */ t(n, {
|
|
36
|
+
children: u(p)
|
|
37
|
+
}),
|
|
38
|
+
toolbarPlugin: {
|
|
39
|
+
zoomPlugin: {
|
|
40
|
+
enableShortcuts: !1
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}), {
|
|
44
|
+
renderDefaultToolbar: u
|
|
45
|
+
} = l.toolbarPluginInstance;
|
|
46
|
+
return /* @__PURE__ */ t("div", {
|
|
47
|
+
className: "pdf-viewer",
|
|
48
|
+
children: /* @__PURE__ */ t(w, {
|
|
49
|
+
workerUrl: "https://aiot-acceleration.glodon.com/glodon/libs/pdfjs-dist/3.11.174/pdf.worker.min.js",
|
|
50
|
+
children: /* @__PURE__ */ t(S, {
|
|
51
|
+
defaultScale: b.PageWidth,
|
|
52
|
+
localization: v,
|
|
53
|
+
fileUrl: e,
|
|
54
|
+
plugins: [l],
|
|
55
|
+
initialPage: o ? o - 1 : 0
|
|
56
|
+
})
|
|
57
|
+
})
|
|
58
|
+
});
|
|
59
|
+
}, U = I;
|
|
60
|
+
export {
|
|
61
|
+
U as default
|
|
62
|
+
};
|
|
@@ -1,367 +1,361 @@
|
|
|
1
|
-
var v = (
|
|
2
|
-
var
|
|
1
|
+
var v = (i, r, n) => new Promise((b, 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 ? b(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
|
|
17
|
+
import { jsxs as x, jsx as t } from "react/jsx-runtime";
|
|
18
|
+
import { useMemo as y, 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, Alert as le } from "antd";
|
|
20
|
+
import { DownloadOutlined as de, CopyOutlined as ue } from "@ant-design/icons";
|
|
21
|
+
import { getFileExtension as V, getFileType as me } 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 { PdfRenderer as Ne } from "./components/PdfRenderer.mjs";
|
|
23
|
+
import { normalizeUrl as pe } from "./utils.mjs";
|
|
24
|
+
import { useZipViewer as fe } from "./hooks/useZipViewer.mjs";
|
|
25
|
+
import { TextRenderer as P, CodeRenderer as we, XmlRenderer as he, HtmlRenderer as ve, MarkdownRenderer as ye, JsonlRenderer as xe, TsvRenderer as be, CsvRenderer as ge, JsonRenderer as Ce } from "./components/FileRenderers.mjs";
|
|
26
|
+
import { AudioRenderer as ke, VideoRenderer as Fe, ImageRenderer as Re } from "./components/MediaRenderers.mjs";
|
|
28
27
|
import { ZipRenderer as ze } from "./components/ZipRenderer.mjs";
|
|
29
|
-
import { ErrorAlert as
|
|
28
|
+
import { ErrorAlert as Te } from "./components/ErrorAlert.mjs";
|
|
30
29
|
import "./style.less.mjs";
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
import Ne from "./components/PDFViewer/index.mjs";
|
|
31
|
+
const Ee = (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
|
+
}, Be = (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`, Se = (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
|
+
}, Ue = (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: b,
|
|
50
|
+
style: m,
|
|
51
|
+
showToolbar: C = !1,
|
|
52
|
+
page: k = 1
|
|
53
|
+
} = i, e = y(() => pe(r), [r]);
|
|
54
|
+
console.log("normalizedUrl", e);
|
|
55
|
+
const s = y(() => {
|
|
56
|
+
const c = V(e), o = n ? V(n) : void 0;
|
|
57
|
+
return me(c || o);
|
|
58
|
+
}, [e, n]), [u, g] = w(s), {
|
|
59
|
+
zipFiles: W,
|
|
60
|
+
zipLoading: H,
|
|
61
|
+
zipError: Z,
|
|
62
|
+
selectedZipFile: _,
|
|
63
|
+
zipFileContent: J,
|
|
64
|
+
handleFileClick: X
|
|
65
|
+
} = fe(s === "zip" ? e : ""), [G, d] = w(!0), [U, p] = w(null), [a, j] = w(null), [l, M] = w(0), [K, $] = w(!1), D = y(() => Se(e, n), [n, e]), q = y(() => Be(l), [l]), F = !!(a != null && a.content), Q = !F && !e, Y = y(() => [{
|
|
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 (g(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 A = yield f.blob(), E = A.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 A.text();
|
|
99
|
+
s === "unknown" && g("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 = Ee(re);
|
|
109
|
+
f !== "unknown" && g(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
|
|
121
|
-
if (
|
|
122
|
-
|
|
115
|
+
const N = yield fetch(e);
|
|
116
|
+
if (!N.ok)
|
|
117
|
+
throw new Error(`HTTP error! status: ${N.status}`);
|
|
118
|
+
const I = yield N.text(), O = new Blob([I]).size;
|
|
119
|
+
if (O > S) {
|
|
120
|
+
p(`文件过大(${Math.round(O / 1024 / 1024)}MB),无法预览。请下载后查看。`), d(!1);
|
|
123
121
|
return;
|
|
124
122
|
}
|
|
125
|
-
|
|
126
|
-
content:
|
|
123
|
+
u === "unknown" && g("text"), j({
|
|
124
|
+
content: I
|
|
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(Te, {
|
|
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(Ce, {
|
|
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(ge, {
|
|
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(be, {
|
|
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(ye, {
|
|
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(ve, {
|
|
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(he, {
|
|
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(we, {
|
|
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(Re, {
|
|
262
260
|
url: e,
|
|
263
|
-
fileName:
|
|
261
|
+
fileName: n
|
|
264
262
|
});
|
|
265
263
|
case "video":
|
|
266
|
-
return /* @__PURE__ */ t(
|
|
264
|
+
return /* @__PURE__ */ t(Fe, {
|
|
267
265
|
url: e,
|
|
268
|
-
fileName:
|
|
266
|
+
fileName: n
|
|
269
267
|
});
|
|
270
268
|
case "audio":
|
|
271
|
-
return /* @__PURE__ */ t(
|
|
269
|
+
return /* @__PURE__ */ t(ke, {
|
|
272
270
|
url: e,
|
|
273
|
-
fileName:
|
|
271
|
+
fileName: n
|
|
274
272
|
});
|
|
275
273
|
case "pdf":
|
|
276
274
|
return /* @__PURE__ */ t(Ne, {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
pdfError: H,
|
|
280
|
-
url: e,
|
|
281
|
-
fileName: r,
|
|
282
|
-
page: C
|
|
275
|
+
fileUrl: e,
|
|
276
|
+
pageNumber: k
|
|
283
277
|
});
|
|
284
278
|
case "office":
|
|
285
|
-
return /* @__PURE__ */ t(
|
|
279
|
+
return /* @__PURE__ */ t(je, {
|
|
286
280
|
url: e
|
|
287
281
|
});
|
|
288
282
|
case "zip":
|
|
289
283
|
return /* @__PURE__ */ t(ze, {
|
|
290
|
-
zipFiles:
|
|
291
|
-
zipLoading:
|
|
292
|
-
zipError:
|
|
293
|
-
selectedZipFile:
|
|
294
|
-
zipFileContent:
|
|
295
|
-
onFileClick:
|
|
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(Me, {
|
|
301
295
|
url: e
|
|
302
296
|
});
|
|
303
297
|
}
|
|
304
298
|
};
|
|
305
|
-
return /* @__PURE__ */
|
|
306
|
-
className: `document-viewer ${
|
|
307
|
-
style:
|
|
308
|
-
children: [
|
|
299
|
+
return /* @__PURE__ */ x("div", {
|
|
300
|
+
className: `document-viewer ${b || ""}`,
|
|
301
|
+
style: m,
|
|
302
|
+
children: [C && /* @__PURE__ */ x("div", {
|
|
309
303
|
className: "document-viewer-toolbar",
|
|
310
|
-
children: [/* @__PURE__ */
|
|
304
|
+
children: [/* @__PURE__ */ x("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__ */ x(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(de, {}),
|
|
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(ue, {}),
|
|
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
|
+
}, je = ({
|
|
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__ */ x("div", {
|
|
354
348
|
className: "document-viewer-office",
|
|
355
349
|
children: [/* @__PURE__ */ t("iframe", {
|
|
356
|
-
src:
|
|
350
|
+
src: r,
|
|
357
351
|
className: "document-viewer-iframe",
|
|
358
352
|
title: "Office Document Preview"
|
|
359
353
|
}), /* @__PURE__ */ t("div", {
|
|
360
354
|
className: "document-viewer-fallback",
|
|
361
|
-
children: /* @__PURE__ */ t(
|
|
355
|
+
children: /* @__PURE__ */ t(le, {
|
|
362
356
|
message: "预览可能不可用",
|
|
363
357
|
description: /* @__PURE__ */ t("a", {
|
|
364
|
-
href:
|
|
358
|
+
href: i,
|
|
365
359
|
target: "_blank",
|
|
366
360
|
rel: "noopener noreferrer",
|
|
367
361
|
children: "点击下载文件"
|
|
@@ -371,16 +365,16 @@ const Be = (o) => {
|
|
|
371
365
|
})
|
|
372
366
|
})]
|
|
373
367
|
});
|
|
374
|
-
},
|
|
375
|
-
url:
|
|
368
|
+
}, Me = ({
|
|
369
|
+
url: i
|
|
376
370
|
}) => /* @__PURE__ */ t("div", {
|
|
377
371
|
className: "document-viewer-unknown",
|
|
378
372
|
children: /* @__PURE__ */ t("iframe", {
|
|
379
|
-
src:
|
|
373
|
+
src: i,
|
|
380
374
|
className: "document-viewer-iframe",
|
|
381
375
|
title: "File Preview"
|
|
382
376
|
})
|
|
383
|
-
}),
|
|
377
|
+
}), Ke = Ue;
|
|
384
378
|
export {
|
|
385
|
-
|
|
379
|
+
Ke as default
|
|
386
380
|
};
|