@glodon-aiot/react-components 3.11.1-shapshot.1765331459 → 3.13.0-alpha.28
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 +2 -3
- package/dist/es/index.mjs +38 -41
- package/dist/lib/index.js +2 -10
- package/dist/src/index.d.ts +0 -1
- package/package.json +12 -24
- package/dist/aiot-react-components.js +0 -20191
- package/dist/aiot-react-components.umd.cjs +0 -183
- package/dist/es/components/DocumentViewer/components/DownloadButton.mjs +0 -18
- package/dist/es/components/DocumentViewer/components/ErrorAlert.mjs +0 -28
- package/dist/es/components/DocumentViewer/components/FileRenderers.mjs +0 -486
- package/dist/es/components/DocumentViewer/components/MediaRenderers.mjs +0 -46
- package/dist/es/components/DocumentViewer/components/PDFViewer/index.mjs +0 -62
- package/dist/es/components/DocumentViewer/components/PDFViewer/style.less.mjs +0 -4
- package/dist/es/components/DocumentViewer/components/ZipRenderer.mjs +0 -154
- package/dist/es/components/DocumentViewer/constants.mjs +0 -21
- package/dist/es/components/DocumentViewer/hooks/useZipViewer.mjs +0 -153
- package/dist/es/components/DocumentViewer/index.mjs +0 -367
- package/dist/es/components/DocumentViewer/style.less.mjs +0 -4
- package/dist/es/components/DocumentViewer/utils.mjs +0 -96
- package/dist/es/node_modules/@react-pdf-viewer/open/lib/styles/index.css.mjs +0 -4
- package/dist/es/node_modules/@react-pdf-viewer/toolbar/lib/styles/index.css.mjs +0 -4
- package/dist/es/utils/file.mjs +0 -17
- package/dist/src/components/DocumentViewer/components/DownloadButton.d.ts +0 -7
- package/dist/src/components/DocumentViewer/components/ErrorAlert.d.ts +0 -10
- package/dist/src/components/DocumentViewer/components/FileRenderers.d.ts +0 -23
- package/dist/src/components/DocumentViewer/components/MediaRenderers.d.ts +0 -9
- package/dist/src/components/DocumentViewer/components/PDFViewer/index.d.ts +0 -7
- package/dist/src/components/DocumentViewer/components/PdfRenderer.d.ts +0 -11
- package/dist/src/components/DocumentViewer/components/ZipRenderer.d.ts +0 -22
- package/dist/src/components/DocumentViewer/components/index.d.ts +0 -9
- package/dist/src/components/DocumentViewer/constants.d.ts +0 -21
- package/dist/src/components/DocumentViewer/hooks/index.d.ts +0 -5
- package/dist/src/components/DocumentViewer/hooks/usePdfViewer.d.ts +0 -7
- package/dist/src/components/DocumentViewer/hooks/useZipViewer.d.ts +0 -21
- package/dist/src/components/DocumentViewer/index.d.ts +0 -11
- package/dist/src/components/DocumentViewer/utils.d.ts +0 -23
- package/dist/src/utils/file.d.ts +0 -16
- package/dist/style.css +0 -1
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import { Button as t } from "antd";
|
|
3
|
-
import { DownloadOutlined as e } from "@ant-design/icons";
|
|
4
|
-
const m = ({
|
|
5
|
-
url: r,
|
|
6
|
-
fileName: n
|
|
7
|
-
}) => /* @__PURE__ */ o(t, {
|
|
8
|
-
type: "link",
|
|
9
|
-
icon: /* @__PURE__ */ o(e, {}),
|
|
10
|
-
href: r,
|
|
11
|
-
download: n,
|
|
12
|
-
target: "_blank",
|
|
13
|
-
rel: "noopener noreferrer",
|
|
14
|
-
children: "下载文件"
|
|
15
|
-
});
|
|
16
|
-
export {
|
|
17
|
-
m as DownloadButton
|
|
18
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { Alert as i, Button as a } from "antd";
|
|
3
|
-
import { DownloadOutlined as c } from "@ant-design/icons";
|
|
4
|
-
const p = ({
|
|
5
|
-
message: e,
|
|
6
|
-
description: t,
|
|
7
|
-
action: n,
|
|
8
|
-
url: o,
|
|
9
|
-
fileName: l
|
|
10
|
-
}) => /* @__PURE__ */ r(i, {
|
|
11
|
-
className: "document-viewer-alert-full",
|
|
12
|
-
message: e,
|
|
13
|
-
description: t,
|
|
14
|
-
type: "error",
|
|
15
|
-
showIcon: !0,
|
|
16
|
-
action: n || (o ? /* @__PURE__ */ r(a, {
|
|
17
|
-
type: "link",
|
|
18
|
-
icon: /* @__PURE__ */ r(c, {}),
|
|
19
|
-
href: o,
|
|
20
|
-
download: l,
|
|
21
|
-
target: "_blank",
|
|
22
|
-
rel: "noopener noreferrer",
|
|
23
|
-
children: "下载文件"
|
|
24
|
-
}) : null)
|
|
25
|
-
});
|
|
26
|
-
export {
|
|
27
|
-
p as ErrorAlert
|
|
28
|
-
};
|
|
@@ -1,486 +0,0 @@
|
|
|
1
|
-
import { jsxs as x, jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo as B } from "react";
|
|
3
|
-
import { Alert as d, Table as _ } from "antd";
|
|
4
|
-
import { Prism as b } from "react-syntax-highlighter";
|
|
5
|
-
import { Markdown as N } from "../../Markdown/index.mjs";
|
|
6
|
-
import { getFileExtension as z } from "../../../utils/file.mjs";
|
|
7
|
-
import { MAX_DISPLAY_SIZE as T, MAX_DISPLAY_LINES as w, MAX_JSON_SIZE as $, MAX_CSV_SIZE as A, MAX_CSV_ROWS as S, MAX_TSV_SIZE as J, MAX_JSONL_SIZE as O, MAX_JSONL_LINES as L, MAX_MARKDOWN_SIZE as X, MAX_XML_SIZE as E, MAX_HIGHLIGHT_SIZE as k } from "../constants.mjs";
|
|
8
|
-
import { DownloadButton as l } from "./DownloadButton.mjs";
|
|
9
|
-
const R = ({
|
|
10
|
-
fileContent: e,
|
|
11
|
-
fileSize: i,
|
|
12
|
-
url: s,
|
|
13
|
-
fileName: t
|
|
14
|
-
}) => {
|
|
15
|
-
if (!(e != null && e.content))
|
|
16
|
-
return null;
|
|
17
|
-
if ((i || new Blob([e.content]).size) > T) {
|
|
18
|
-
const r = e.content.split(`
|
|
19
|
-
`), m = r.length > w, a = (m ? r.slice(0, w) : r).join(`
|
|
20
|
-
`);
|
|
21
|
-
return /* @__PURE__ */ x("div", {
|
|
22
|
-
style: {
|
|
23
|
-
display: "flex",
|
|
24
|
-
flexDirection: "column",
|
|
25
|
-
height: "100%",
|
|
26
|
-
overflow: "hidden"
|
|
27
|
-
},
|
|
28
|
-
children: [m && /* @__PURE__ */ n(d, {
|
|
29
|
-
message: "文件过大",
|
|
30
|
-
description: `文件包含 ${r.length} 行,仅显示前 ${w} 行。请下载完整文件查看。`,
|
|
31
|
-
type: "warning",
|
|
32
|
-
showIcon: !0,
|
|
33
|
-
style: {
|
|
34
|
-
marginBottom: 16,
|
|
35
|
-
flexShrink: 0
|
|
36
|
-
},
|
|
37
|
-
action: /* @__PURE__ */ n(l, {
|
|
38
|
-
url: s,
|
|
39
|
-
fileName: t
|
|
40
|
-
})
|
|
41
|
-
}), /* @__PURE__ */ n("pre", {
|
|
42
|
-
className: "document-viewer-text",
|
|
43
|
-
children: a
|
|
44
|
-
})]
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
return /* @__PURE__ */ n("pre", {
|
|
48
|
-
className: "document-viewer-text",
|
|
49
|
-
children: e.content
|
|
50
|
-
});
|
|
51
|
-
}, Y = ({
|
|
52
|
-
fileContent: e,
|
|
53
|
-
fileSize: i,
|
|
54
|
-
url: s,
|
|
55
|
-
fileName: t
|
|
56
|
-
}) => {
|
|
57
|
-
if (!(e != null && e.content))
|
|
58
|
-
return null;
|
|
59
|
-
const o = i || new Blob([e.content]).size;
|
|
60
|
-
if (o > $)
|
|
61
|
-
return /* @__PURE__ */ n(d, {
|
|
62
|
-
message: "JSON文件过大",
|
|
63
|
-
description: `文件大小 ${Math.round(o / 1024 / 1024)}MB,无法预览。请下载后查看。`,
|
|
64
|
-
type: "warning",
|
|
65
|
-
showIcon: !0,
|
|
66
|
-
action: /* @__PURE__ */ n(l, {
|
|
67
|
-
url: s,
|
|
68
|
-
fileName: t
|
|
69
|
-
})
|
|
70
|
-
});
|
|
71
|
-
try {
|
|
72
|
-
const r = JSON.parse(e.content);
|
|
73
|
-
return /* @__PURE__ */ n("pre", {
|
|
74
|
-
className: "document-viewer-json",
|
|
75
|
-
children: JSON.stringify(r, null, 2)
|
|
76
|
-
});
|
|
77
|
-
} catch (r) {
|
|
78
|
-
return /* @__PURE__ */ n(d, {
|
|
79
|
-
message: "JSON解析失败",
|
|
80
|
-
description: "文件内容不是有效的JSON格式",
|
|
81
|
-
type: "error",
|
|
82
|
-
action: /* @__PURE__ */ n(l, {
|
|
83
|
-
url: s,
|
|
84
|
-
fileName: t
|
|
85
|
-
})
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
}, F = ({
|
|
89
|
-
fileContent: e,
|
|
90
|
-
fileSize: i,
|
|
91
|
-
url: s,
|
|
92
|
-
fileName: t
|
|
93
|
-
}) => {
|
|
94
|
-
if (!(e != null && e.content))
|
|
95
|
-
return null;
|
|
96
|
-
const o = i || new Blob([e.content]).size;
|
|
97
|
-
if (o > A)
|
|
98
|
-
return /* @__PURE__ */ n(d, {
|
|
99
|
-
message: "CSV文件过大",
|
|
100
|
-
description: `文件大小 ${Math.round(o / 1024 / 1024)}MB,无法预览。请下载后查看。`,
|
|
101
|
-
type: "warning",
|
|
102
|
-
showIcon: !0,
|
|
103
|
-
action: /* @__PURE__ */ n(l, {
|
|
104
|
-
url: s,
|
|
105
|
-
fileName: t
|
|
106
|
-
})
|
|
107
|
-
});
|
|
108
|
-
try {
|
|
109
|
-
const r = e.content.split(`
|
|
110
|
-
`).filter((c) => c.trim());
|
|
111
|
-
if (r.length === 0)
|
|
112
|
-
return null;
|
|
113
|
-
const m = r.length > S, u = m ? r.slice(0, S) : r, a = u[0].split(",").map((c) => c.trim()), p = u.slice(1).map((c, v) => {
|
|
114
|
-
const M = c.split(",").map((g) => g.trim()), y = {
|
|
115
|
-
key: String(v)
|
|
116
|
-
};
|
|
117
|
-
return a.forEach((g, I) => {
|
|
118
|
-
y[g] = M[I] || "";
|
|
119
|
-
}), y;
|
|
120
|
-
}), h = a.map((c) => ({
|
|
121
|
-
title: c,
|
|
122
|
-
dataIndex: c,
|
|
123
|
-
key: c
|
|
124
|
-
}));
|
|
125
|
-
return /* @__PURE__ */ x("div", {
|
|
126
|
-
style: {
|
|
127
|
-
display: "flex",
|
|
128
|
-
flexDirection: "column",
|
|
129
|
-
height: "100%",
|
|
130
|
-
overflow: "hidden"
|
|
131
|
-
},
|
|
132
|
-
children: [m && /* @__PURE__ */ n(d, {
|
|
133
|
-
message: "文件过大",
|
|
134
|
-
description: `CSV文件包含 ${r.length} 行,仅显示前 ${S} 行。请下载完整文件查看。`,
|
|
135
|
-
type: "warning",
|
|
136
|
-
showIcon: !0,
|
|
137
|
-
style: {
|
|
138
|
-
marginBottom: 16,
|
|
139
|
-
flexShrink: 0
|
|
140
|
-
},
|
|
141
|
-
action: /* @__PURE__ */ n(l, {
|
|
142
|
-
url: s,
|
|
143
|
-
fileName: t
|
|
144
|
-
})
|
|
145
|
-
}), /* @__PURE__ */ n("div", {
|
|
146
|
-
style: {
|
|
147
|
-
flex: 1,
|
|
148
|
-
overflow: "auto",
|
|
149
|
-
minHeight: 0
|
|
150
|
-
},
|
|
151
|
-
children: /* @__PURE__ */ n(_, {
|
|
152
|
-
dataSource: p,
|
|
153
|
-
columns: h,
|
|
154
|
-
pagination: !1,
|
|
155
|
-
scroll: {
|
|
156
|
-
x: "max-content",
|
|
157
|
-
y: "100%"
|
|
158
|
-
},
|
|
159
|
-
size: "small"
|
|
160
|
-
})
|
|
161
|
-
})]
|
|
162
|
-
});
|
|
163
|
-
} catch (r) {
|
|
164
|
-
return /* @__PURE__ */ n(d, {
|
|
165
|
-
message: "CSV解析失败",
|
|
166
|
-
description: "文件内容不是有效的CSV格式",
|
|
167
|
-
type: "error",
|
|
168
|
-
action: /* @__PURE__ */ n(l, {
|
|
169
|
-
url: s,
|
|
170
|
-
fileName: t
|
|
171
|
-
})
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
}, K = ({
|
|
175
|
-
fileContent: e,
|
|
176
|
-
fileSize: i,
|
|
177
|
-
url: s,
|
|
178
|
-
fileName: t
|
|
179
|
-
}) => {
|
|
180
|
-
if (!(e != null && e.content))
|
|
181
|
-
return null;
|
|
182
|
-
const o = i || new Blob([e.content]).size;
|
|
183
|
-
if (o > J)
|
|
184
|
-
return /* @__PURE__ */ n(d, {
|
|
185
|
-
message: "TSV文件过大",
|
|
186
|
-
description: `文件大小 ${Math.round(o / 1024 / 1024)}MB,无法预览。请下载后查看。`,
|
|
187
|
-
type: "warning",
|
|
188
|
-
showIcon: !0,
|
|
189
|
-
action: /* @__PURE__ */ n(l, {
|
|
190
|
-
url: s,
|
|
191
|
-
fileName: t
|
|
192
|
-
})
|
|
193
|
-
});
|
|
194
|
-
try {
|
|
195
|
-
const r = e.content.split(`
|
|
196
|
-
`).filter((c) => c.trim());
|
|
197
|
-
if (r.length === 0)
|
|
198
|
-
return null;
|
|
199
|
-
const m = r.length > S, u = m ? r.slice(0, S) : r, a = u[0].split(" ").map((c) => c.trim()), p = u.slice(1).map((c, v) => {
|
|
200
|
-
const M = c.split(" ").map((g) => g.trim()), y = {
|
|
201
|
-
key: String(v)
|
|
202
|
-
};
|
|
203
|
-
return a.forEach((g, I) => {
|
|
204
|
-
y[g] = M[I] || "";
|
|
205
|
-
}), y;
|
|
206
|
-
}), h = a.map((c) => ({
|
|
207
|
-
title: c,
|
|
208
|
-
dataIndex: c,
|
|
209
|
-
key: c
|
|
210
|
-
}));
|
|
211
|
-
return /* @__PURE__ */ x("div", {
|
|
212
|
-
style: {
|
|
213
|
-
display: "flex",
|
|
214
|
-
flexDirection: "column",
|
|
215
|
-
height: "100%",
|
|
216
|
-
overflow: "hidden"
|
|
217
|
-
},
|
|
218
|
-
children: [m && /* @__PURE__ */ n(d, {
|
|
219
|
-
message: "文件过大",
|
|
220
|
-
description: `TSV文件包含 ${r.length} 行,仅显示前 ${S} 行。请下载完整文件查看。`,
|
|
221
|
-
type: "warning",
|
|
222
|
-
showIcon: !0,
|
|
223
|
-
style: {
|
|
224
|
-
marginBottom: 16,
|
|
225
|
-
flexShrink: 0
|
|
226
|
-
},
|
|
227
|
-
action: /* @__PURE__ */ n(l, {
|
|
228
|
-
url: s,
|
|
229
|
-
fileName: t
|
|
230
|
-
})
|
|
231
|
-
}), /* @__PURE__ */ n("div", {
|
|
232
|
-
style: {
|
|
233
|
-
flex: 1,
|
|
234
|
-
overflow: "auto",
|
|
235
|
-
minHeight: 0
|
|
236
|
-
},
|
|
237
|
-
children: /* @__PURE__ */ n(_, {
|
|
238
|
-
dataSource: p,
|
|
239
|
-
columns: h,
|
|
240
|
-
pagination: !1,
|
|
241
|
-
scroll: {
|
|
242
|
-
x: "max-content",
|
|
243
|
-
y: "100%"
|
|
244
|
-
},
|
|
245
|
-
size: "small"
|
|
246
|
-
})
|
|
247
|
-
})]
|
|
248
|
-
});
|
|
249
|
-
} catch (r) {
|
|
250
|
-
return /* @__PURE__ */ n(d, {
|
|
251
|
-
message: "TSV解析失败",
|
|
252
|
-
description: "文件内容不是有效的TSV格式",
|
|
253
|
-
type: "error",
|
|
254
|
-
action: /* @__PURE__ */ n(l, {
|
|
255
|
-
url: s,
|
|
256
|
-
fileName: t
|
|
257
|
-
})
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
|
-
}, q = ({
|
|
261
|
-
fileContent: e,
|
|
262
|
-
fileSize: i,
|
|
263
|
-
url: s,
|
|
264
|
-
fileName: t
|
|
265
|
-
}) => {
|
|
266
|
-
if (!(e != null && e.content))
|
|
267
|
-
return null;
|
|
268
|
-
const o = i || new Blob([e.content]).size;
|
|
269
|
-
if (o > O)
|
|
270
|
-
return /* @__PURE__ */ n(d, {
|
|
271
|
-
message: "JSONL文件过大",
|
|
272
|
-
description: `文件大小 ${Math.round(o / 1024 / 1024)}MB,无法预览。请下载后查看。`,
|
|
273
|
-
type: "warning",
|
|
274
|
-
showIcon: !0,
|
|
275
|
-
action: /* @__PURE__ */ n(l, {
|
|
276
|
-
url: s,
|
|
277
|
-
fileName: t
|
|
278
|
-
})
|
|
279
|
-
});
|
|
280
|
-
try {
|
|
281
|
-
const r = e.content.split(`
|
|
282
|
-
`).filter((a) => a.trim()), m = r.length > L, u = m ? r.slice(0, L) : r;
|
|
283
|
-
return /* @__PURE__ */ x("div", {
|
|
284
|
-
style: {
|
|
285
|
-
display: "flex",
|
|
286
|
-
flexDirection: "column",
|
|
287
|
-
height: "100%",
|
|
288
|
-
width: "100%",
|
|
289
|
-
overflow: "hidden"
|
|
290
|
-
},
|
|
291
|
-
children: [m && /* @__PURE__ */ n(d, {
|
|
292
|
-
message: "文件过大",
|
|
293
|
-
description: `JSONL文件包含 ${r.length} 行,仅显示前 ${L} 行。请下载完整文件查看。`,
|
|
294
|
-
type: "warning",
|
|
295
|
-
showIcon: !0,
|
|
296
|
-
style: {
|
|
297
|
-
marginBottom: 16,
|
|
298
|
-
flexShrink: 0
|
|
299
|
-
},
|
|
300
|
-
action: /* @__PURE__ */ n(l, {
|
|
301
|
-
url: s,
|
|
302
|
-
fileName: t
|
|
303
|
-
})
|
|
304
|
-
}), /* @__PURE__ */ n("div", {
|
|
305
|
-
className: "document-viewer-jsonl",
|
|
306
|
-
children: u.map((a, p) => {
|
|
307
|
-
try {
|
|
308
|
-
const h = JSON.parse(a);
|
|
309
|
-
return /* @__PURE__ */ n("div", {
|
|
310
|
-
className: "document-viewer-jsonl-item",
|
|
311
|
-
children: /* @__PURE__ */ n("pre", {
|
|
312
|
-
children: JSON.stringify(h, null, 2)
|
|
313
|
-
})
|
|
314
|
-
}, p);
|
|
315
|
-
} catch (h) {
|
|
316
|
-
return /* @__PURE__ */ n("div", {
|
|
317
|
-
className: "document-viewer-jsonl-item",
|
|
318
|
-
children: /* @__PURE__ */ n("pre", {
|
|
319
|
-
children: a
|
|
320
|
-
})
|
|
321
|
-
}, p);
|
|
322
|
-
}
|
|
323
|
-
})
|
|
324
|
-
})]
|
|
325
|
-
});
|
|
326
|
-
} catch (r) {
|
|
327
|
-
return /* @__PURE__ */ n(d, {
|
|
328
|
-
message: "JSONL解析失败",
|
|
329
|
-
description: "文件内容解析出错",
|
|
330
|
-
type: "error",
|
|
331
|
-
action: /* @__PURE__ */ n(l, {
|
|
332
|
-
url: s,
|
|
333
|
-
fileName: t
|
|
334
|
-
})
|
|
335
|
-
});
|
|
336
|
-
}
|
|
337
|
-
}, Q = ({
|
|
338
|
-
fileContent: e,
|
|
339
|
-
fileSize: i,
|
|
340
|
-
url: s,
|
|
341
|
-
fileName: t
|
|
342
|
-
}) => {
|
|
343
|
-
if (!(e != null && e.content))
|
|
344
|
-
return null;
|
|
345
|
-
const o = i || new Blob([e.content]).size;
|
|
346
|
-
return o > X ? /* @__PURE__ */ n(d, {
|
|
347
|
-
message: "Markdown文件过大",
|
|
348
|
-
description: `文件大小 ${Math.round(o / 1024 / 1024)}MB,无法预览。请下载后查看。`,
|
|
349
|
-
type: "warning",
|
|
350
|
-
showIcon: !0,
|
|
351
|
-
action: /* @__PURE__ */ n(l, {
|
|
352
|
-
url: s,
|
|
353
|
-
fileName: t
|
|
354
|
-
})
|
|
355
|
-
}) : /* @__PURE__ */ n("div", {
|
|
356
|
-
style: {
|
|
357
|
-
height: "100%",
|
|
358
|
-
overflow: "auto",
|
|
359
|
-
padding: "16px"
|
|
360
|
-
},
|
|
361
|
-
children: /* @__PURE__ */ n(N, {
|
|
362
|
-
children: e.content
|
|
363
|
-
})
|
|
364
|
-
});
|
|
365
|
-
}, U = ({
|
|
366
|
-
fileContent: e
|
|
367
|
-
}) => e != null && e.content ? /* @__PURE__ */ n("iframe", {
|
|
368
|
-
srcDoc: e.content,
|
|
369
|
-
className: "document-viewer-iframe",
|
|
370
|
-
title: "HTML Preview",
|
|
371
|
-
sandbox: "allow-same-origin allow-scripts"
|
|
372
|
-
}) : null, f = ({
|
|
373
|
-
fileContent: e,
|
|
374
|
-
fileSize: i,
|
|
375
|
-
url: s,
|
|
376
|
-
fileName: t
|
|
377
|
-
}) => {
|
|
378
|
-
if (!(e != null && e.content))
|
|
379
|
-
return null;
|
|
380
|
-
const o = i || new Blob([e.content]).size;
|
|
381
|
-
if (o > E)
|
|
382
|
-
return /* @__PURE__ */ n(d, {
|
|
383
|
-
message: "XML文件过大",
|
|
384
|
-
description: `文件大小 ${Math.round(o / 1024 / 1024)}MB,无法预览。请下载后查看。`,
|
|
385
|
-
type: "warning",
|
|
386
|
-
showIcon: !0,
|
|
387
|
-
action: /* @__PURE__ */ n(l, {
|
|
388
|
-
url: s,
|
|
389
|
-
fileName: t
|
|
390
|
-
})
|
|
391
|
-
});
|
|
392
|
-
try {
|
|
393
|
-
const r = e.content.replace(/></g, `>
|
|
394
|
-
<`).replace(/^\s+/gm, "");
|
|
395
|
-
return /* @__PURE__ */ n("pre", {
|
|
396
|
-
className: "document-viewer-xml",
|
|
397
|
-
children: r
|
|
398
|
-
});
|
|
399
|
-
} catch (r) {
|
|
400
|
-
return /* @__PURE__ */ n(R, {
|
|
401
|
-
fileContent: e,
|
|
402
|
-
fileSize: i,
|
|
403
|
-
url: s,
|
|
404
|
-
fileName: t
|
|
405
|
-
});
|
|
406
|
-
}
|
|
407
|
-
}, C = ({
|
|
408
|
-
fileContent: e,
|
|
409
|
-
fileSize: i,
|
|
410
|
-
url: s,
|
|
411
|
-
fileName: t
|
|
412
|
-
}) => {
|
|
413
|
-
if (!(e != null && e.content))
|
|
414
|
-
return null;
|
|
415
|
-
const r = B(() => t ? z(t) : z(s), [t, s]) || "text";
|
|
416
|
-
if ((i || new Blob([e.content]).size) > k) {
|
|
417
|
-
const u = e.content.split(`
|
|
418
|
-
`), a = u.length > w, h = (a ? u.slice(0, w) : u).join(`
|
|
419
|
-
`);
|
|
420
|
-
return /* @__PURE__ */ x("div", {
|
|
421
|
-
className: "document-viewer-code",
|
|
422
|
-
children: [a && /* @__PURE__ */ n(d, {
|
|
423
|
-
message: "文件过大",
|
|
424
|
-
description: `文件包含 ${u.length} 行,仅显示前 ${w} 行。请下载完整文件查看。`,
|
|
425
|
-
type: "warning",
|
|
426
|
-
showIcon: !0,
|
|
427
|
-
style: {
|
|
428
|
-
marginBottom: 16,
|
|
429
|
-
flexShrink: 0
|
|
430
|
-
},
|
|
431
|
-
action: /* @__PURE__ */ n(l, {
|
|
432
|
-
url: s,
|
|
433
|
-
fileName: t
|
|
434
|
-
})
|
|
435
|
-
}), /* @__PURE__ */ n("div", {
|
|
436
|
-
style: {
|
|
437
|
-
overflow: "auto",
|
|
438
|
-
flex: 1,
|
|
439
|
-
width: "100%"
|
|
440
|
-
},
|
|
441
|
-
children: /* @__PURE__ */ n("pre", {
|
|
442
|
-
className: "document-viewer-text",
|
|
443
|
-
style: {
|
|
444
|
-
fontSize: "12px",
|
|
445
|
-
width: "100%",
|
|
446
|
-
boxSizing: "border-box"
|
|
447
|
-
},
|
|
448
|
-
children: h
|
|
449
|
-
})
|
|
450
|
-
})]
|
|
451
|
-
});
|
|
452
|
-
}
|
|
453
|
-
return /* @__PURE__ */ n("div", {
|
|
454
|
-
className: "document-viewer-code",
|
|
455
|
-
children: /* @__PURE__ */ n("div", {
|
|
456
|
-
style: {
|
|
457
|
-
overflow: "auto",
|
|
458
|
-
flex: 1,
|
|
459
|
-
width: "100%"
|
|
460
|
-
},
|
|
461
|
-
children: /* @__PURE__ */ n(b, {
|
|
462
|
-
language: r,
|
|
463
|
-
wrapLongLines: !0,
|
|
464
|
-
showLineNumbers: !0,
|
|
465
|
-
PreTag: "div",
|
|
466
|
-
customStyle: {
|
|
467
|
-
width: "100%",
|
|
468
|
-
margin: 0,
|
|
469
|
-
boxSizing: "border-box"
|
|
470
|
-
},
|
|
471
|
-
children: e.content
|
|
472
|
-
})
|
|
473
|
-
})
|
|
474
|
-
});
|
|
475
|
-
};
|
|
476
|
-
export {
|
|
477
|
-
C as CodeRenderer,
|
|
478
|
-
F as CsvRenderer,
|
|
479
|
-
U as HtmlRenderer,
|
|
480
|
-
Y as JsonRenderer,
|
|
481
|
-
q as JsonlRenderer,
|
|
482
|
-
Q as MarkdownRenderer,
|
|
483
|
-
R as TextRenderer,
|
|
484
|
-
K as TsvRenderer,
|
|
485
|
-
f as XmlRenderer
|
|
486
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { Image as i } from "antd";
|
|
3
|
-
const c = ({
|
|
4
|
-
url: r,
|
|
5
|
-
fileName: t
|
|
6
|
-
}) => /* @__PURE__ */ e("div", {
|
|
7
|
-
className: "document-viewer-image",
|
|
8
|
-
children: /* @__PURE__ */ e(i, {
|
|
9
|
-
src: r,
|
|
10
|
-
alt: t || "Image",
|
|
11
|
-
style: {
|
|
12
|
-
maxWidth: "100%",
|
|
13
|
-
maxHeight: "100%",
|
|
14
|
-
objectFit: "contain"
|
|
15
|
-
}
|
|
16
|
-
})
|
|
17
|
-
}), n = ({
|
|
18
|
-
url: r
|
|
19
|
-
}) => /* @__PURE__ */ e("div", {
|
|
20
|
-
className: "document-viewer-video",
|
|
21
|
-
children: /* @__PURE__ */ e("video", {
|
|
22
|
-
src: r,
|
|
23
|
-
controls: !0,
|
|
24
|
-
style: {
|
|
25
|
-
maxWidth: "100%"
|
|
26
|
-
},
|
|
27
|
-
children: "您的浏览器不支持视频播放"
|
|
28
|
-
})
|
|
29
|
-
}), s = ({
|
|
30
|
-
url: r
|
|
31
|
-
}) => /* @__PURE__ */ e("div", {
|
|
32
|
-
className: "document-viewer-audio",
|
|
33
|
-
children: /* @__PURE__ */ e("audio", {
|
|
34
|
-
src: r,
|
|
35
|
-
controls: !0,
|
|
36
|
-
style: {
|
|
37
|
-
width: "100%"
|
|
38
|
-
},
|
|
39
|
-
children: "您的浏览器不支持音频播放"
|
|
40
|
-
})
|
|
41
|
-
});
|
|
42
|
-
export {
|
|
43
|
-
s as AudioRenderer,
|
|
44
|
-
c as ImageRenderer,
|
|
45
|
-
n as VideoRenderer
|
|
46
|
-
};
|
|
@@ -1,62 +0,0 @@
|
|
|
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
|
-
};
|