@work-zhanguo/light-file-preview 0.0.6 → 0.0.8

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 (33) hide show
  1. package/README.md +25 -1
  2. package/dist/{DocxRenderer-D0ngcG2T.js → DocxRenderer-DogNhBLd.js} +1 -1
  3. package/dist/PdfRenderer-Due2M5cA.js +57 -0
  4. package/dist/SheetRenderer-Dea6-NBg.js +315 -0
  5. package/dist/{UnsupportedRenderer-Y2AgN0-l.js → UnsupportedRenderer-DDB3UZdt.js} +1 -1
  6. package/dist/_commonjs-dynamic-modules-C74YT1gS.js +32 -0
  7. package/dist/{docx-preview-D_8kC8vU.js → docx-preview-BV-bQyiM.js} +75 -81
  8. package/dist/{index-DZOrV9D_.js → index-B8Ff5iZD.js} +1 -1
  9. package/dist/light-file-preview.js +1 -1
  10. package/dist/light-file-preview.umd.cjs +158 -161
  11. package/dist/pdf-BiKi76Et.js +15320 -0
  12. package/dist/standalone/light-file-preview.iife.js +160 -163
  13. package/dist/standalone/style.css +1 -1
  14. package/dist/style.css +1 -1
  15. package/dist/types/components/FilePreview.vue.d.ts +1 -1
  16. package/dist/vue2/{DocxRenderer-D-MItvaP.js → DocxRenderer-MIU7uOq2.js} +2 -2
  17. package/dist/vue2/PdfRenderer-t62Z-W1l.js +57 -0
  18. package/dist/vue2/SheetRenderer-DF_btSSa.js +315 -0
  19. package/dist/vue2/{TextRenderer-DOzgi4YR.js → TextRenderer-CURVfe6J.js} +1 -1
  20. package/dist/vue2/{UnsupportedRenderer-VozD1bVb.js → UnsupportedRenderer-CXW3m4B9.js} +1 -1
  21. package/dist/vue2/_commonjs-dynamic-modules-C74YT1gS.js +32 -0
  22. package/dist/vue2/{docx-preview-D_8kC8vU.js → docx-preview-BV-bQyiM.js} +75 -81
  23. package/dist/vue2/light-file-preview-vue2.js +1 -1
  24. package/dist/vue2/light-file-preview-vue2.umd.cjs +147 -150
  25. package/dist/vue2/pdf-BiKi76Et.js +15320 -0
  26. package/dist/vue2/{vue2-rrMAk2-n.js → vue2-DRZy2Bxs.js} +4 -2
  27. package/package.json +2 -2
  28. package/dist/PdfRenderer-SICIjXYT.js +0 -57
  29. package/dist/SheetRenderer-D4Y1dYZX.js +0 -77
  30. package/dist/pdf-CV932zwQ.js +0 -14611
  31. package/dist/vue2/PdfRenderer-rw-3PY9w.js +0 -57
  32. package/dist/vue2/SheetRenderer-BxfF54Q3.js +0 -77
  33. package/dist/vue2/pdf-CV932zwQ.js +0 -14611
@@ -1,77 +0,0 @@
1
- import { defineComponent as $, ref as k, computed as B, onMounted as E, onBeforeUnmount as L, openBlock as e, createElementBlock as t, Fragment as v, renderList as f, normalizeClass as M, toDisplayString as r, createCommentVNode as w, createElementVNode as b } from "vue";
2
- import { r as N } from "./text-Bqxn_tMI.js";
3
- const V = { class: "lfp-document lfp-sheet" }, X = {
4
- key: 0,
5
- class: "lfp-sheet__tabs"
6
- }, j = ["onClick"], z = {
7
- key: 1,
8
- class: "lfp-hint"
9
- }, A = {
10
- key: 2,
11
- class: "lfp-sheet__table-wrap"
12
- }, D = { class: "lfp-sheet__table" }, W = /* @__PURE__ */ $({
13
- __name: "SheetRenderer",
14
- props: {
15
- source: {},
16
- maxRows: {},
17
- maxCols: {}
18
- },
19
- emits: ["loading", "error"],
20
- setup(u, { emit: C }) {
21
- const i = u, m = C, y = new AbortController(), d = k(0), c = k([]), n = B(() => c.value[d.value]);
22
- async function g() {
23
- m("loading", !0);
24
- try {
25
- const l = await N(i.source, y.signal), h = await import("./xlsx-j9Zzywas.js"), a = h.read(l, { type: "array" });
26
- c.value = a.SheetNames.map((o) => {
27
- const s = h.utils.sheet_to_json(a.Sheets[o], {
28
- header: 1,
29
- raw: !1,
30
- defval: ""
31
- }), _ = s.length, S = s.reduce((p, R) => Math.max(p, R.length), 0), x = s.slice(0, i.maxRows).map((p) => p.slice(0, i.maxCols).map(String));
32
- return {
33
- name: o,
34
- rows: x,
35
- totalRows: _,
36
- totalCols: S
37
- };
38
- });
39
- } catch (l) {
40
- m("error", l instanceof Error ? l : new Error("表格预览失败"));
41
- } finally {
42
- m("loading", !1);
43
- }
44
- }
45
- return E(() => {
46
- g();
47
- }), L(() => {
48
- y.abort();
49
- }), (l, h) => (e(), t("div", V, [
50
- c.value.length > 1 ? (e(), t("div", X, [
51
- (e(!0), t(v, null, f(c.value, (a, o) => (e(), t("button", {
52
- key: a.name,
53
- class: M(["lfp-sheet__tab", { "is-active": o === d.value }]),
54
- type: "button",
55
- onClick: (s) => d.value = o
56
- }, r(a.name), 11, j))), 128))
57
- ])) : w("", !0),
58
- n.value ? (e(), t("p", z, " 共 " + r(n.value.totalRows) + " 行," + r(n.value.totalCols) + " 列。当前最多展示 " + r(u.maxRows) + " 行、" + r(u.maxCols) + " 列。 ", 1)) : w("", !0),
59
- n.value ? (e(), t("div", A, [
60
- b("table", D, [
61
- b("tbody", null, [
62
- (e(!0), t(v, null, f(n.value.rows, (a, o) => (e(), t("tr", {
63
- key: `${n.value.name}-${o}`
64
- }, [
65
- (e(!0), t(v, null, f(a, (s, _) => (e(), t("td", {
66
- key: `${o}-${_}`
67
- }, r(s), 1))), 128))
68
- ]))), 128))
69
- ])
70
- ])
71
- ])) : w("", !0)
72
- ]));
73
- }
74
- });
75
- export {
76
- W as default
77
- };