@glodon-aiot/react-components 3.11.1-shapshot.1765331458 → 3.13.0-alpha.27

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.
Files changed (38) hide show
  1. package/dist/es/ImageMap/index.mjs +2 -3
  2. package/dist/es/index.mjs +38 -41
  3. package/dist/lib/index.js +2 -10
  4. package/dist/src/index.d.ts +0 -1
  5. package/package.json +11 -18
  6. package/dist/aiot-react-components.js +0 -20191
  7. package/dist/aiot-react-components.umd.cjs +0 -183
  8. package/dist/es/components/DocumentViewer/components/DownloadButton.mjs +0 -18
  9. package/dist/es/components/DocumentViewer/components/ErrorAlert.mjs +0 -28
  10. package/dist/es/components/DocumentViewer/components/FileRenderers.mjs +0 -486
  11. package/dist/es/components/DocumentViewer/components/MediaRenderers.mjs +0 -46
  12. package/dist/es/components/DocumentViewer/components/PDFViewer/index.mjs +0 -62
  13. package/dist/es/components/DocumentViewer/components/PDFViewer/style.less.mjs +0 -4
  14. package/dist/es/components/DocumentViewer/components/ZipRenderer.mjs +0 -154
  15. package/dist/es/components/DocumentViewer/constants.mjs +0 -21
  16. package/dist/es/components/DocumentViewer/hooks/useZipViewer.mjs +0 -153
  17. package/dist/es/components/DocumentViewer/index.mjs +0 -380
  18. package/dist/es/components/DocumentViewer/style.less.mjs +0 -4
  19. package/dist/es/components/DocumentViewer/utils.mjs +0 -96
  20. package/dist/es/node_modules/@react-pdf-viewer/open/lib/styles/index.css.mjs +0 -4
  21. package/dist/es/node_modules/@react-pdf-viewer/toolbar/lib/styles/index.css.mjs +0 -4
  22. package/dist/es/utils/file.mjs +0 -17
  23. package/dist/src/components/DocumentViewer/components/DownloadButton.d.ts +0 -7
  24. package/dist/src/components/DocumentViewer/components/ErrorAlert.d.ts +0 -10
  25. package/dist/src/components/DocumentViewer/components/FileRenderers.d.ts +0 -23
  26. package/dist/src/components/DocumentViewer/components/MediaRenderers.d.ts +0 -9
  27. package/dist/src/components/DocumentViewer/components/PDFViewer/index.d.ts +0 -7
  28. package/dist/src/components/DocumentViewer/components/PdfRenderer.d.ts +0 -11
  29. package/dist/src/components/DocumentViewer/components/ZipRenderer.d.ts +0 -22
  30. package/dist/src/components/DocumentViewer/components/index.d.ts +0 -9
  31. package/dist/src/components/DocumentViewer/constants.d.ts +0 -21
  32. package/dist/src/components/DocumentViewer/hooks/index.d.ts +0 -5
  33. package/dist/src/components/DocumentViewer/hooks/usePdfViewer.d.ts +0 -7
  34. package/dist/src/components/DocumentViewer/hooks/useZipViewer.d.ts +0 -21
  35. package/dist/src/components/DocumentViewer/index.d.ts +0 -11
  36. package/dist/src/components/DocumentViewer/utils.d.ts +0 -23
  37. package/dist/src/utils/file.d.ts +0 -16
  38. package/dist/style.css +0 -1
@@ -1,380 +0,0 @@
1
- var v = (i, r, n) => new Promise((b, m) => {
2
- var C = (s) => {
3
- try {
4
- e(n.next(s));
5
- } catch (u) {
6
- m(u);
7
- }
8
- }, k = (s) => {
9
- try {
10
- e(n.throw(s));
11
- } catch (u) {
12
- m(u);
13
- }
14
- }, e = (s) => s.done ? b(s.value) : Promise.resolve(s.value).then(C, k);
15
- e((n = n.apply(i, r)).next());
16
- });
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
- import { MAX_FILE_SIZE as S } from "./constants.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";
27
- import { ZipRenderer as ze } from "./components/ZipRenderer.mjs";
28
- import { ErrorAlert as Te } from "./components/ErrorAlert.mjs";
29
- import "./style.less.mjs";
30
- import Ne from "./components/PDFViewer/index.mjs";
31
- const Ee = (i) => {
32
- if (!i)
33
- return "unknown";
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
- try {
40
- const m = new URL(i).pathname.split("/").filter(Boolean).pop();
41
- return decodeURIComponent(m || i);
42
- } catch (n) {
43
- return i;
44
- }
45
- }, Ue = (i) => {
46
- const {
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(() => [{
66
- key: "copy-content",
67
- label: "复制内容",
68
- disabled: !F
69
- }, {
70
- key: "copy-url",
71
- label: "复制地址",
72
- disabled: !e
73
- }], [F, e]);
74
- oe(() => {
75
- if (g(s), s === "pdf" || s === "zip") {
76
- d(!1);
77
- return;
78
- }
79
- if (!e) {
80
- p("文件URL不能为空"), d(!1);
81
- return;
82
- }
83
- if (["image", "video", "audio", "office"].includes(s)) {
84
- d(!1);
85
- return;
86
- }
87
- d(!0), p(null), v(void 0, null, function* () {
88
- try {
89
- if (e.startsWith("blob:") || e.startsWith("data:")) {
90
- const f = yield fetch(e);
91
- if (!f.ok)
92
- throw new Error(`HTTP error! status: ${f.status}`);
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);
96
- return;
97
- }
98
- const ne = yield A.text();
99
- s === "unknown" && g("text"), j({
100
- content: ne
101
- }), d(!1);
102
- return;
103
- }
104
- const o = yield fetch(e, {
105
- method: "HEAD"
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);
110
- }
111
- if (T > S) {
112
- p(`文件过大(${Math.round(T / 1024 / 1024)}MB),无法预览。请下载后查看。`), d(!1);
113
- return;
114
- }
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);
121
- return;
122
- }
123
- u === "unknown" && g("text"), j({
124
- content: I
125
- }), d(!1);
126
- } catch (c) {
127
- p(c.message || "加载文件失败"), d(!1);
128
- }
129
- });
130
- }, [e, s]);
131
- const R = B(() => v(void 0, null, function* () {
132
- var c;
133
- if (!(a != null && a.content)) {
134
- h.warning("暂无可复制的内容");
135
- return;
136
- }
137
- try {
138
- if ($(!0), (c = navigator == null ? void 0 : navigator.clipboard) != null && c.writeText)
139
- yield navigator.clipboard.writeText(a.content);
140
- else {
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);
143
- }
144
- h.success("内容已复制到剪贴板");
145
- } catch (o) {
146
- h.error((o == null ? void 0 : o.message) || "复制失败,请手动复制");
147
- } finally {
148
- $(!1);
149
- }
150
- }), [a]), L = B(() => v(void 0, null, function* () {
151
- var c;
152
- if (!e) {
153
- h.warning("暂无可复制的地址");
154
- return;
155
- }
156
- try {
157
- if ((c = navigator == null ? void 0 : navigator.clipboard) != null && c.writeText)
158
- yield navigator.clipboard.writeText(e);
159
- else {
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);
162
- }
163
- h.success("链接已复制到剪贴板");
164
- } catch (o) {
165
- h.error((o == null ? void 0 : o.message) || "复制失败,请手动复制");
166
- }
167
- }), [e]), ee = B((o) => v(void 0, [o], function* ({
168
- key: c
169
- }) {
170
- c === "copy-content" && (yield R()), c === "copy-url" && (yield L());
171
- }), [R, L]), te = () => {
172
- if (G)
173
- return /* @__PURE__ */ t("div", {
174
- className: "document-viewer-loading",
175
- children: /* @__PURE__ */ t(ce, {
176
- size: "large",
177
- tip: "加载中..."
178
- })
179
- });
180
- if (U)
181
- return /* @__PURE__ */ t(Te, {
182
- message: "加载失败",
183
- description: U,
184
- url: e,
185
- fileName: n
186
- });
187
- if (u === "unknown" && (a != null && a.content))
188
- return /* @__PURE__ */ t(P, {
189
- fileContent: a,
190
- fileSize: l,
191
- url: e,
192
- fileName: n
193
- });
194
- switch (u) {
195
- case "text":
196
- return /* @__PURE__ */ t(P, {
197
- fileContent: a,
198
- fileSize: l,
199
- url: e,
200
- fileName: n
201
- });
202
- case "json":
203
- return /* @__PURE__ */ t(Ce, {
204
- fileContent: a,
205
- fileSize: l,
206
- url: e,
207
- fileName: n
208
- });
209
- case "csv":
210
- return /* @__PURE__ */ t(ge, {
211
- fileContent: a,
212
- fileSize: l,
213
- url: e,
214
- fileName: n
215
- });
216
- case "tsv":
217
- return /* @__PURE__ */ t(be, {
218
- fileContent: a,
219
- fileSize: l,
220
- url: e,
221
- fileName: n
222
- });
223
- case "jsonl":
224
- return /* @__PURE__ */ t(xe, {
225
- fileContent: a,
226
- fileSize: l,
227
- url: e,
228
- fileName: n
229
- });
230
- case "markdown":
231
- return /* @__PURE__ */ t(ye, {
232
- fileContent: a,
233
- fileSize: l,
234
- url: e,
235
- fileName: n
236
- });
237
- case "html":
238
- return /* @__PURE__ */ t(ve, {
239
- fileContent: a,
240
- fileSize: l,
241
- url: e,
242
- fileName: n
243
- });
244
- case "xml":
245
- return /* @__PURE__ */ t(he, {
246
- fileContent: a,
247
- fileSize: l,
248
- url: e,
249
- fileName: n
250
- });
251
- case "code":
252
- return /* @__PURE__ */ t(we, {
253
- fileContent: a,
254
- fileSize: l,
255
- url: e,
256
- fileName: n
257
- });
258
- case "image":
259
- return /* @__PURE__ */ t(Re, {
260
- url: e,
261
- fileName: n
262
- });
263
- case "video":
264
- return /* @__PURE__ */ t(Fe, {
265
- url: e,
266
- fileName: n
267
- });
268
- case "audio":
269
- return /* @__PURE__ */ t(ke, {
270
- url: e,
271
- fileName: n
272
- });
273
- case "pdf":
274
- return /* @__PURE__ */ t(Ne, {
275
- fileUrl: e,
276
- pageNumber: k
277
- });
278
- case "office":
279
- return /* @__PURE__ */ t(je, {
280
- url: e
281
- });
282
- case "zip":
283
- return /* @__PURE__ */ t(ze, {
284
- zipFiles: W,
285
- zipLoading: H,
286
- zipError: Z,
287
- selectedZipFile: _,
288
- zipFileContent: J,
289
- onFileClick: X,
290
- url: e
291
- });
292
- case "unknown":
293
- default:
294
- return /* @__PURE__ */ t(Me, {
295
- url: e
296
- });
297
- }
298
- };
299
- return /* @__PURE__ */ x("div", {
300
- className: `document-viewer ${b || ""}`,
301
- style: m,
302
- children: [C && /* @__PURE__ */ x("div", {
303
- className: "document-viewer-toolbar",
304
- children: [/* @__PURE__ */ x("div", {
305
- className: "document-viewer-toolbar-meta",
306
- children: [/* @__PURE__ */ t("span", {
307
- className: "document-viewer-toolbar-name",
308
- title: D,
309
- children: D
310
- }), /* @__PURE__ */ t("span", {
311
- className: "document-viewer-toolbar-size",
312
- children: q
313
- })]
314
- }), /* @__PURE__ */ x(ie, {
315
- size: 8,
316
- wrap: !0,
317
- children: [/* @__PURE__ */ t(ae, {
318
- icon: /* @__PURE__ */ t(de, {}),
319
- size: "small",
320
- href: e,
321
- target: "_blank",
322
- rel: "noopener noreferrer",
323
- download: n || void 0,
324
- children: "下载"
325
- }), /* @__PURE__ */ t(se.Button, {
326
- size: "small",
327
- icon: /* @__PURE__ */ t(ue, {}),
328
- menu: {
329
- items: Y,
330
- onClick: ee
331
- },
332
- disabled: Q,
333
- loading: K,
334
- onClick: R,
335
- children: "复制"
336
- })]
337
- })]
338
- }), /* @__PURE__ */ t("div", {
339
- className: "document-viewer-body",
340
- children: te()
341
- })]
342
- });
343
- }, je = ({
344
- url: i
345
- }) => {
346
- const r = `https://view.officeapps.live.com/op/embed.aspx?src=${encodeURIComponent(i)}`;
347
- return /* @__PURE__ */ x("div", {
348
- className: "document-viewer-office",
349
- children: [/* @__PURE__ */ t("iframe", {
350
- src: r,
351
- className: "document-viewer-iframe",
352
- title: "Office Document Preview"
353
- }), /* @__PURE__ */ t("div", {
354
- className: "document-viewer-fallback",
355
- children: /* @__PURE__ */ t(le, {
356
- message: "预览可能不可用",
357
- description: /* @__PURE__ */ t("a", {
358
- href: i,
359
- target: "_blank",
360
- rel: "noopener noreferrer",
361
- children: "点击下载文件"
362
- }),
363
- type: "info",
364
- showIcon: !0
365
- })
366
- })]
367
- });
368
- }, Me = ({
369
- url: i
370
- }) => /* @__PURE__ */ t("div", {
371
- className: "document-viewer-unknown",
372
- children: /* @__PURE__ */ t("iframe", {
373
- src: i,
374
- className: "document-viewer-iframe",
375
- title: "File Preview"
376
- })
377
- }), Ke = Ue;
378
- export {
379
- Ke as default
380
- };
@@ -1,4 +0,0 @@
1
- const t = "";
2
- export {
3
- t as default
4
- };
@@ -1,96 +0,0 @@
1
- var u = (e, s, t) => new Promise((n, c) => {
2
- var a = (r) => {
3
- try {
4
- o(t.next(r));
5
- } catch (h) {
6
- c(h);
7
- }
8
- }, i = (r) => {
9
- try {
10
- o(t.throw(r));
11
- } catch (h) {
12
- c(h);
13
- }
14
- }, o = (r) => r.done ? n(r.value) : Promise.resolve(r.value).then(a, i);
15
- o((t = t.apply(e, s)).next());
16
- });
17
- const m = (e) => {
18
- if (e === 0)
19
- return "0 B";
20
- const s = 1024, t = ["B", "KB", "MB", "GB"], n = Math.floor(Math.log(e) / Math.log(s));
21
- return Math.round(e / Math.pow(s, n) * 100) / 100 + " " + t[n];
22
- }, S = (e) => u(void 0, null, function* () {
23
- let s = !1, t = 0;
24
- try {
25
- const n = yield fetch(e, {
26
- method: "HEAD",
27
- headers: {
28
- Range: "bytes=0-0"
29
- }
30
- }), c = n.headers.get("Accept-Ranges"), a = n.headers.get("Content-Range"), i = n.headers.get("Content-Length");
31
- if (a) {
32
- const o = a.match(/bytes \d+-\d+\/(\d+)/);
33
- o && (t = parseInt(o[1], 10));
34
- } else
35
- i && (t = parseInt(i, 10));
36
- return s = n.status === 206 || c === "bytes" || a !== null && a.startsWith("bytes"), {
37
- supportsRange: s,
38
- fileSize: t
39
- };
40
- } catch (n) {
41
- return console.warn("Range 支持检测失败:", n), {
42
- supportsRange: !1,
43
- fileSize: 0
44
- };
45
- }
46
- }), x = (e) => u(void 0, null, function* () {
47
- try {
48
- const t = (yield fetch(e, {
49
- method: "HEAD"
50
- })).headers.get("Content-Length");
51
- return t ? parseInt(t, 10) : 0;
52
- } catch (s) {
53
- return console.warn("无法获取文件大小:", s), 0;
54
- }
55
- }), z = (e) => {
56
- if (!e || e.startsWith("blob:") || e.startsWith("data:"))
57
- return e;
58
- const s = e.startsWith("http%3A%2F%2F") || e.startsWith("https%3A%2F%2F");
59
- let t = e;
60
- if (s)
61
- try {
62
- t = decodeURIComponent(e);
63
- } catch (n) {
64
- t = e;
65
- }
66
- try {
67
- return new URL(t).toString();
68
- } catch (n) {
69
- try {
70
- const c = t.indexOf("://");
71
- if (c === -1)
72
- return t;
73
- const a = t.substring(0, c + 3), i = t.substring(c + 3), o = i.indexOf("/");
74
- if (o === -1)
75
- return t;
76
- const r = i.substring(0, o), h = i.substring(o + 1), p = h.indexOf("?"), f = p === -1 ? h : h.substring(0, p), g = p === -1 ? "" : h.substring(p + 1), l = f.split("/").map((d) => {
77
- if (!d)
78
- return d;
79
- try {
80
- return decodeURIComponent(d) !== d ? d : encodeURIComponent(d);
81
- } catch (R) {
82
- return encodeURIComponent(d);
83
- }
84
- }).join("/");
85
- return g ? `${a}${r}/${l}?${g}` : `${a}${r}/${l}`;
86
- } catch (c) {
87
- return t;
88
- }
89
- }
90
- };
91
- export {
92
- S as checkRangeSupport,
93
- m as formatFileSize,
94
- x as getFileSize,
95
- z as normalizeUrl
96
- };
@@ -1,4 +0,0 @@
1
- const e = "";
2
- export {
3
- e as default
4
- };
@@ -1,4 +0,0 @@
1
- const e = "";
2
- export {
3
- e as default
4
- };
@@ -1,17 +0,0 @@
1
- const r = (t) => {
2
- var e;
3
- if (!t)
4
- return;
5
- const s = t.split(/[?#]/)[0], n = (s.split("/").pop() || s).split(".");
6
- if (!(n.length < 2))
7
- return (e = n.pop()) == null ? void 0 : e.toLowerCase();
8
- }, o = (t) => {
9
- if (!t)
10
- return "unknown";
11
- const s = t.toLowerCase();
12
- return ["svg", "png", "gif", "jpg", "jpeg", "tiff", "tif", "bmp"].includes(s) ? "image" : s === "mp4" ? "video" : s === "mp3" ? "audio" : s === "pdf" ? "pdf" : s === "markdown" || s === "md" ? "markdown" : s === "json" ? "json" : s === "jsonl" || s === "josnl" ? "jsonl" : s === "csv" ? "csv" : s === "tsv" ? "tsv" : s === "html" || s === "htm" ? "html" : s === "xml" ? "xml" : ["doc", "docx", "ppt", "pptx", "xls", "xlsx", "wps", "odt", "rtf", "ods", "pps", "ppsx", "odp", "key"].includes(s) ? "office" : ["js", "jsx", "ts", "tsx", "py", "java", "cpp", "c", "cc", "cxx", "h", "hpp", "hxx", "css", "less", "scss", "sass", "vue", "go", "rs", "rb", "php", "swift", "kt", "scala", "sh", "bash", "zsh", "fish", "ps1", "bat", "cmd", "yml", "yaml", "toml", "ini", "conf", "config", "json", "xml", "sql", "r", "m", "mm", "pl", "pm", "lua", "dart", "elm", "clj", "cljs", "ex", "exs", "erl", "hrl", "hs", "ml", "mli", "fs", "fsx", "vb", "cs", "d", "nim", "zig", "v", "odin"].includes(s) ? "code" : s === "txt" ? "text" : s === "zip" ? "zip" : s === "tex" || s === "latex" ? "text" : "unknown";
13
- };
14
- export {
15
- r as getFileExtension,
16
- o as getFileType
17
- };
@@ -1,7 +0,0 @@
1
- import { default as React } from 'react';
2
- interface DownloadButtonProps {
3
- url: string;
4
- fileName?: string;
5
- }
6
- export declare const DownloadButton: React.FC<DownloadButtonProps>;
7
- export {};
@@ -1,10 +0,0 @@
1
- import { default as React, ReactNode } from 'react';
2
- interface ErrorAlertProps {
3
- message: string;
4
- description?: string;
5
- action?: ReactNode;
6
- url?: string;
7
- fileName?: string;
8
- }
9
- export declare const ErrorAlert: React.FC<ErrorAlertProps>;
10
- export {};
@@ -1,23 +0,0 @@
1
- import { default as React } from 'react';
2
- interface FileContent {
3
- content: string;
4
- error?: string;
5
- }
6
- interface BaseRendererProps {
7
- fileContent: FileContent | null;
8
- fileSize: number;
9
- url: string;
10
- fileName?: string;
11
- }
12
- export declare const TextRenderer: React.FC<BaseRendererProps>;
13
- export declare const JsonRenderer: React.FC<BaseRendererProps>;
14
- export declare const CsvRenderer: React.FC<BaseRendererProps>;
15
- export declare const TsvRenderer: React.FC<BaseRendererProps>;
16
- export declare const JsonlRenderer: React.FC<BaseRendererProps>;
17
- export declare const MarkdownRenderer: React.FC<BaseRendererProps>;
18
- export declare const HtmlRenderer: React.FC<BaseRendererProps>;
19
- export declare const XmlRenderer: React.FC<BaseRendererProps>;
20
- export declare const CodeRenderer: React.FC<BaseRendererProps & {
21
- url: string;
22
- }>;
23
- export {};
@@ -1,9 +0,0 @@
1
- import { default as React } from 'react';
2
- interface MediaRendererProps {
3
- url: string;
4
- fileName?: string;
5
- }
6
- export declare const ImageRenderer: React.FC<MediaRendererProps>;
7
- export declare const VideoRenderer: React.FC<MediaRendererProps>;
8
- export declare const AudioRenderer: React.FC<MediaRendererProps>;
9
- export {};
@@ -1,7 +0,0 @@
1
- import { FC } from 'react';
2
- interface PDFViewerProps {
3
- fileUrl: string;
4
- pageNumber?: number;
5
- }
6
- declare const PDFViewer: FC<PDFViewerProps>;
7
- export default PDFViewer;
@@ -1,11 +0,0 @@
1
- import { default as React } from 'react';
2
- interface PdfRendererProps {
3
- pdfBlobUrl: string | null;
4
- pdfLoading: boolean;
5
- pdfError: string | null;
6
- url: string;
7
- fileName?: string;
8
- page?: number;
9
- }
10
- export declare const PdfRenderer: React.FC<PdfRendererProps>;
11
- export {};
@@ -1,22 +0,0 @@
1
- import { default as React } from 'react';
2
- interface ZipFile {
3
- name: string;
4
- size: number;
5
- isDirectory: boolean;
6
- }
7
- interface ZipFileContent {
8
- name: string;
9
- blobUrl: string;
10
- type: string;
11
- }
12
- interface ZipRendererProps {
13
- zipFiles: ZipFile[];
14
- zipLoading: boolean;
15
- zipError: string | null;
16
- selectedZipFile: string | null;
17
- zipFileContent: ZipFileContent | null;
18
- onFileClick: (fileName: string) => Promise<void>;
19
- url: string;
20
- }
21
- export declare const ZipRenderer: React.FC<ZipRendererProps>;
22
- export {};
@@ -1,9 +0,0 @@
1
- /**
2
- * DocumentViewer 子组件导出
3
- */
4
- export { ErrorAlert } from './ErrorAlert';
5
- export { DownloadButton } from './DownloadButton';
6
- export { TextRenderer, JsonRenderer, CsvRenderer, TsvRenderer, JsonlRenderer, MarkdownRenderer, HtmlRenderer, XmlRenderer, CodeRenderer, } from './FileRenderers';
7
- export { ImageRenderer, VideoRenderer, AudioRenderer, } from './MediaRenderers';
8
- export { ZipRenderer } from './ZipRenderer';
9
- export { default as PDFViewer } from './PDFViewer';
@@ -1,21 +0,0 @@
1
- /**
2
- * DocumentViewer 组件常量配置
3
- */
4
- export declare const MAX_FILE_SIZE: number;
5
- export declare const MAX_DISPLAY_SIZE: number;
6
- export declare const MAX_JSON_SIZE: number;
7
- export declare const MAX_CSV_SIZE: number;
8
- export declare const MAX_TSV_SIZE: number;
9
- export declare const MAX_JSONL_SIZE: number;
10
- export declare const MAX_MARKDOWN_SIZE: number;
11
- export declare const MAX_XML_SIZE: number;
12
- export declare const MAX_HIGHLIGHT_SIZE: number;
13
- export declare const MAX_FALLBACK_SIZE: number;
14
- export declare const MAX_ZIP_FILE_SIZE: number;
15
- export declare const MAX_DISPLAY_LINES = 10000;
16
- export declare const MAX_CSV_ROWS = 10000;
17
- export declare const MAX_JSONL_LINES = 5000;
18
- export declare const MAX_ZIP_FILES = 1000;
19
- export declare const ZIP_CHUNK_SIZE: number;
20
- export declare const ZIP_ENTRIES_TIMEOUT = 30000;
21
- export declare const SAFE_FILE_TYPES: readonly ["text", "json", "csv", "tsv", "markdown", "html", "xml", "jsonl", "image", "pdf", "code"];
@@ -1,5 +0,0 @@
1
- /**
2
- * DocumentViewer Hooks 导出
3
- */
4
- export { usePdfViewer } from './usePdfViewer';
5
- export { useZipViewer } from './useZipViewer';
@@ -1,7 +0,0 @@
1
- interface UsePdfViewerResult {
2
- pdfBlobUrl: string | null;
3
- pdfLoading: boolean;
4
- pdfError: string | null;
5
- }
6
- export declare const usePdfViewer: (url: string) => UsePdfViewerResult;
7
- export {};
@@ -1,21 +0,0 @@
1
- interface ZipFile {
2
- name: string;
3
- size: number;
4
- isDirectory: boolean;
5
- }
6
- interface ZipFileContent {
7
- name: string;
8
- blobUrl: string;
9
- type: string;
10
- }
11
- interface UseZipViewerResult {
12
- zipFiles: ZipFile[];
13
- zipLoading: boolean;
14
- zipError: string | null;
15
- selectedZipFile: string | null;
16
- zipFileContent: ZipFileContent | null;
17
- handleFileClick: (fileName: string) => Promise<void>;
18
- setSelectedZipFile: (fileName: string | null) => void;
19
- }
20
- export declare const useZipViewer: (url: string) => UseZipViewerResult;
21
- export {};