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