@lingshugroup/web-plus 1.0.36 → 1.0.38
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 +1 -1
- package/lib/index.css +1 -1
- package/lib/index.css.br +0 -0
- package/lib/index.css.gz +0 -0
- package/lib/packages/ls-components/components/descriptions/Index.vue/index.cjs +1 -1
- package/lib/packages/ls-components/components/descriptions/Index.vue/index.js +1 -1
- package/lib/packages/ls-components/components/descriptions/Index.vue/index2.cjs +1 -1
- package/lib/packages/ls-components/components/descriptions/Index.vue/index2.js +62 -60
- package/lib/packages/ls-components/components/descriptions/Index.vue/index2.js.br +0 -0
- package/lib/packages/ls-components/components/descriptions/Index.vue/index2.js.gz +0 -0
- package/lib/packages/ls-components/components/preview_docx/Docx.vue/index.cjs +1 -1
- package/lib/packages/ls-components/components/preview_docx/Docx.vue/index.js +2 -2
- package/lib/packages/ls-components/components/preview_docx/Index.vue/index.cjs +1 -1
- package/lib/packages/ls-components/components/preview_docx/Index.vue/index.js +2 -2
- package/lib/packages/ls-components/components/preview_docx/Index.vue/index2.cjs +1 -1
- package/lib/packages/ls-components/components/preview_docx/Index.vue/index2.js +42 -42
- package/lib/packages/ls-components/components/preview_docx/Index.vue/index2.js.br +0 -0
- package/lib/packages/ls-components/components/preview_docx/Index.vue/index2.js.gz +0 -0
- package/lib/packages/ls-components/components/preview_image/Image.vue/index.cjs +1 -1
- package/lib/packages/ls-components/components/preview_image/Image.vue/index.js +2 -2
- package/lib/packages/ls-components/components/preview_image/Image.vue/index2.cjs +1 -1
- package/lib/packages/ls-components/components/preview_image/Image.vue/index2.js +159 -149
- package/lib/packages/ls-components/components/preview_image/Image.vue/index2.js.br +0 -0
- package/lib/packages/ls-components/components/preview_image/Image.vue/index2.js.gz +0 -0
- package/lib/packages/ls-components/components/preview_image/Index.vue/index.cjs +1 -1
- package/lib/packages/ls-components/components/preview_image/Index.vue/index.js +2 -2
- package/lib/packages/ls-components/components/preview_image/Index.vue/index2.cjs +1 -1
- package/lib/packages/ls-components/components/preview_image/Index.vue/index2.js +44 -44
- package/lib/packages/ls-components/components/preview_image/Index.vue/index2.js.br +0 -0
- package/lib/packages/ls-components/components/preview_image/Index.vue/index2.js.gz +0 -0
- package/lib/packages/ls-components/components/preview_pdf/Index.vue/index.cjs +1 -1
- package/lib/packages/ls-components/components/preview_pdf/Index.vue/index.js +4 -4
- package/lib/packages/ls-components/components/preview_pdf/Index.vue/index2.cjs +1 -1
- package/lib/packages/ls-components/components/preview_pdf/Index.vue/index2.js +38 -38
- package/lib/packages/ls-components/components/preview_pdf/Index.vue/index2.js.br +0 -0
- package/lib/packages/ls-components/components/preview_pdf/Index.vue/index2.js.gz +0 -0
- package/lib/packages/ls-components/components/preview_pdf/composable/index.cjs +1 -1
- package/lib/packages/ls-components/components/preview_pdf/composable/index.js +43 -43
- package/lib/packages/ls-components/components/preview_pdf/composable/index.js.br +0 -0
- package/lib/packages/ls-components/components/preview_pdf/composable/index.js.gz +0 -0
- package/lib/packages/ls-components/components/preview_pdf/pdfs/Annotation.vue/index.cjs +1 -1
- package/lib/packages/ls-components/components/preview_pdf/pdfs/Annotation.vue/index.js +20 -20
- package/lib/packages/ls-components/components/preview_pdf/pdfs/Annotation.vue/index.js.br +0 -0
- package/lib/packages/ls-components/components/preview_pdf/pdfs/Annotation.vue/index.js.gz +0 -0
- package/lib/packages/ls-components/components/preview_pdf/pdfs/PdfItem.vue/index.cjs +1 -1
- package/lib/packages/ls-components/components/preview_pdf/pdfs/PdfItem.vue/index.js +37 -37
- package/lib/packages/ls-components/components/preview_pdf/pdfs/PdfItem.vue/index.js.br +0 -0
- package/lib/packages/ls-components/components/preview_pdf/pdfs/PdfItem.vue/index.js.gz +0 -0
- package/lib/packages/ls-components/components/preview_pdf/pdfs/Text.vue/index.cjs +1 -1
- package/lib/packages/ls-components/components/preview_pdf/pdfs/Text.vue/index.js +12 -12
- package/lib/packages/ls-components/components/preview_pdf/pdfs/Text.vue/index.js.br +0 -0
- package/lib/packages/ls-components/components/preview_pdf/pdfs/Text.vue/index.js.gz +0 -0
- package/lib/packages/ls-components/components/preview_pdf/pdfs/XFA.vue/index.cjs +1 -1
- package/lib/packages/ls-components/components/preview_pdf/pdfs/XFA.vue/index.js +6 -6
- package/lib/packages/ls-components/components/preview_pdf/pdfs/XFA.vue/index.js.br +0 -0
- package/lib/packages/ls-components/components/preview_pdf/pdfs/XFA.vue/index.js.gz +0 -0
- package/lib/packages/ls-components/components/preview_xlsx/Index.vue/index.cjs +1 -1
- package/lib/packages/ls-components/components/preview_xlsx/Index.vue/index.js +1 -1
- package/lib/packages/ls-components/components/preview_xlsx/Index.vue/index2.cjs +1 -1
- package/lib/packages/ls-components/components/preview_xlsx/Index.vue/index2.js +41 -41
- package/lib/packages/ls-components/components/preview_xlsx/Index.vue/index2.js.br +0 -0
- package/lib/packages/ls-components/components/preview_xlsx/Index.vue/index2.js.gz +0 -0
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=;/* empty css */;/* empty css */const t=,/* empty css */u=t.default(e.default,[["__scopeId","data-v-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=;/* empty css */;/* empty css */const t=,/* empty css */u=t.default(e.default,[["__scopeId","data-v-d1962326"]]);exports.default=u;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import o from "./index2.js";
|
|
2
2
|
/* empty css */
|
|
3
|
-
import
|
|
4
|
-
const
|
|
3
|
+
import r from "../../../../../_virtual/_plugin-vue_export-helper/index.js";
|
|
4
|
+
const f = /* @__PURE__ */ r(o, [["__scopeId", "data-v-d1962326"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
f as default
|
|
7
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var q=Object.defineProperty;var n=(s,u)=>q(s,"name",{value:u,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),L=,/* empty css */f=,/* empty css */C=,/* empty css */M=require("element-plus");;/* empty css */;/* empty css */;/* empty css */const E=,/* empty css */_=,/* empty css */S=e.defineComponent({name:"LSPreviewPdf"}),w=e.defineComponent({...S,name:"LSPreviewPdf",components:{LSPdf:f.default},inheritAttrs:!1,props:e.mergeModels(C.lsPreviewProp,{modelValue:{type:Boolean},modelModifiers:{}}),emits:e.mergeModels(["loadComplete","loadError"],["update:modelValue"]),setup(s,{emit:u}){const d=u,o=s,{zoomSize:p}=e.toRefs(o),r=e.useModel(s,"modelValue"),i=e.reactive({zoomSize:p,source:""}),v=L.useNamespace("preview").b(),c=e.ref();let a=null;e.watch(()=>r==null?void 0:r.value,t=>{t&&m()},{immediate:!0,deep:!0}),e.watch(()=>o.source,t=>{i.source=t},{immediate:!0,deep:!0});function m(){o.needLoading&&(c.value=M.ElLoading.service(o.loadingOption)),a=setTimeout(()=>{o.source||(E.ElMessage.error("文件加载超时,请检查文件是否存在!"),l(),r.value=!1),clearTimeout(a)},6e3)}n(m,"openLoading");const l=n(()=>{a&&clearTimeout(a),o.needLoading&&c.value&&c.value.close()},"closeLoading"),g=n(()=>{l(),d("loadComplete")},"loadComplete"),P=n(()=>{l(),d("loadError")},"loadError");return e.onBeforeMount(()=>{r.value&&m()}),e.onBeforeUnmount(()=>{l()}),(t,h)=>r.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(v))},[e.createVNode(f.default,e.mergeProps(e.unref(_.default)(e.unref(i),t.$attrs),{onLoadComplete:g,onLoadError:P}),null,16)],2)):e.createCommentVNode("",!0)}});exports.default=w;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
var
|
|
2
|
-
var t = (n, l) =>
|
|
3
|
-
import { defineComponent as
|
|
4
|
-
import { useNamespace as
|
|
5
|
-
import
|
|
6
|
-
import { lsPreviewProp as
|
|
7
|
-
import { ElLoading as
|
|
1
|
+
var B = Object.defineProperty;
|
|
2
|
+
var t = (n, l) => B(n, "name", { value: l, configurable: !0 });
|
|
3
|
+
import { defineComponent as g, mergeModels as p, toRefs as M, useModel as _, reactive as w, ref as S, watch as f, onBeforeMount as V, onBeforeUnmount as h, openBlock as k, createElementBlock as z, normalizeClass as N, unref as i, createVNode as T, mergeProps as y, createCommentVNode as A } from "vue";
|
|
4
|
+
import { useNamespace as x } from "../../_hooks/useNamespace/index.js";
|
|
5
|
+
import v from "../Pdf.vue/index.js";
|
|
6
|
+
import { lsPreviewProp as I } from "../types/index.js";
|
|
7
|
+
import { ElLoading as O } from "element-plus";
|
|
8
8
|
/* empty css */
|
|
9
9
|
/* empty css */
|
|
10
10
|
/* empty css */
|
|
11
|
-
import { ElMessage as
|
|
12
|
-
import
|
|
13
|
-
const
|
|
11
|
+
import { ElMessage as R } from "../../../../../node_modules/.pnpm/element-plus@2.8.1_vue@3.5.13_typescript@5.5.4_/node_modules/element-plus/es/components/message/index/index.js";
|
|
12
|
+
import U from "../../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/merge/index.js";
|
|
13
|
+
const $ = g({
|
|
14
14
|
name: "LSPreviewPdf"
|
|
15
|
-
}),
|
|
16
|
-
|
|
15
|
+
}), Z = /* @__PURE__ */ g({
|
|
16
|
+
...$,
|
|
17
17
|
name: "LSPreviewPdf",
|
|
18
18
|
components: {
|
|
19
|
-
LSPdf:
|
|
19
|
+
LSPdf: v
|
|
20
20
|
},
|
|
21
21
|
inheritAttrs: !1,
|
|
22
|
-
props: /* @__PURE__ */ p(
|
|
22
|
+
props: /* @__PURE__ */ p(I, {
|
|
23
23
|
modelValue: {
|
|
24
24
|
type: Boolean
|
|
25
25
|
},
|
|
@@ -27,12 +27,12 @@ const b = L({
|
|
|
27
27
|
}),
|
|
28
28
|
emits: /* @__PURE__ */ p(["loadComplete", "loadError"], ["update:modelValue"]),
|
|
29
29
|
setup(n, { emit: l }) {
|
|
30
|
-
const
|
|
31
|
-
zoomSize:
|
|
30
|
+
const d = l, e = n, { zoomSize: L } = M(e), o = _(n, "modelValue"), c = w({
|
|
31
|
+
zoomSize: L,
|
|
32
32
|
source: ""
|
|
33
|
-
}),
|
|
33
|
+
}), C = x("preview").b(), s = S();
|
|
34
34
|
let a = null;
|
|
35
|
-
|
|
35
|
+
f(
|
|
36
36
|
() => o == null ? void 0 : o.value,
|
|
37
37
|
(r) => {
|
|
38
38
|
r && u();
|
|
@@ -41,10 +41,10 @@ const b = L({
|
|
|
41
41
|
immediate: !0,
|
|
42
42
|
deep: !0
|
|
43
43
|
}
|
|
44
|
-
),
|
|
44
|
+
), f(
|
|
45
45
|
() => e.source,
|
|
46
46
|
(r) => {
|
|
47
|
-
|
|
47
|
+
c.source = r;
|
|
48
48
|
},
|
|
49
49
|
{
|
|
50
50
|
immediate: !0,
|
|
@@ -52,33 +52,33 @@ const b = L({
|
|
|
52
52
|
}
|
|
53
53
|
);
|
|
54
54
|
function u() {
|
|
55
|
-
e.needLoading && (
|
|
56
|
-
e.source || (
|
|
55
|
+
e.needLoading && (s.value = O.service(e.loadingOption)), a = setTimeout(() => {
|
|
56
|
+
e.source || (R.error("文件加载超时,请检查文件是否存在!"), m(), o.value = !1), clearTimeout(a);
|
|
57
57
|
}, 6e3);
|
|
58
58
|
}
|
|
59
59
|
t(u, "openLoading");
|
|
60
|
-
const
|
|
61
|
-
a && clearTimeout(a), e.needLoading &&
|
|
62
|
-
}, "closeLoading"),
|
|
63
|
-
|
|
64
|
-
}, "loadComplete"),
|
|
65
|
-
|
|
60
|
+
const m = /* @__PURE__ */ t(() => {
|
|
61
|
+
a && clearTimeout(a), e.needLoading && s.value && s.value.close();
|
|
62
|
+
}, "closeLoading"), P = /* @__PURE__ */ t(() => {
|
|
63
|
+
m(), d("loadComplete");
|
|
64
|
+
}, "loadComplete"), E = /* @__PURE__ */ t(() => {
|
|
65
|
+
m(), d("loadError");
|
|
66
66
|
}, "loadError");
|
|
67
|
-
return
|
|
67
|
+
return V(() => {
|
|
68
68
|
o.value && u();
|
|
69
|
-
}),
|
|
70
|
-
|
|
71
|
-
}), (r,
|
|
69
|
+
}), h(() => {
|
|
70
|
+
m();
|
|
71
|
+
}), (r, j) => o.value ? (k(), z("div", {
|
|
72
72
|
key: 0,
|
|
73
|
-
class:
|
|
73
|
+
class: N(i(C))
|
|
74
74
|
}, [
|
|
75
|
-
|
|
76
|
-
onLoadComplete:
|
|
77
|
-
onLoadError:
|
|
75
|
+
T(v, y(i(U)(i(c), r.$attrs), {
|
|
76
|
+
onLoadComplete: P,
|
|
77
|
+
onLoadError: E
|
|
78
78
|
}), null, 16)
|
|
79
|
-
], 2)) :
|
|
79
|
+
], 2)) : A("", !0);
|
|
80
80
|
}
|
|
81
81
|
});
|
|
82
82
|
export {
|
|
83
|
-
|
|
83
|
+
Z as default
|
|
84
84
|
};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var U=Object.defineProperty;var c=(s,r)=>U(s,"name",{value:r,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("pdfjs-dist"),N=require("../../../../../node_modules/.pnpm/pdfjs-dist@4.8.69/node_modules/pdfjs-dist/build/pdf.worker.min/index.cjs"),f=require("vue"),h=require("../pdfs/destination/index.cjs"),L=require("../pdfs/miscellaneous/index.cjs");function O(s){P.GlobalWorkerOptions.workerSrc=s}c(O,"configWorker");function q(s,r={onProgress:void 0,onPassword:void 0,onError:void 0,password:""}){var R;(R=P.GlobalWorkerOptions)!=null&&R.workerSrc||O(N.default);const b=f.shallowRef(),l=f.shallowRef(),D=f.shallowRef(0),k=f.shallowRef({});function g(u){l.value&&l.value.destroy();const o=P.getDocument(u);if(r.onProgress&&(o.onProgress=r.onProgress),r.onPassword)o.onPassword=r.onPassword;else if(r.password){const e=c(i=>{i(r.password??"")},"onPassword");o.onPassword=e}return o.promise.then(async e=>{l.value=e,b.value=e.loadingTask,D.value=e.numPages;const i=await e.getMetadata(),a=await e.getAttachments(),n=await e.getJSActions(),d=await e.getOutline();k.value={metadata:i,attachments:a,javascript:n,outline:d}},e=>{typeof r.onError=="function"&&r.onError(e)})}c(g,"processLoadingTask");async function I(u){var t;const o=await((t=b.value)==null?void 0:t.promise);if(!o)return null;const e=await h.getDestinationArray(o,u),i=await h.getDestinationRef(o,e);if(!i||!e)return null;const a=await o.getPageIndex(i),n=e[1].name,d=e.slice(2),v=h.isSpecLike(d)?h.getLocation(n,d):null;return{pageIndex:a,location:v??{type:"Fit",spec:[]}}}c(I,"getPDFDestination");async function x(u="filename"){var n;if(!l.value)throw new Error("Current PDFDocumentProxy have not loaded yet");const o=await((n=l.value)==null?void 0:n.saveDocument()),e=new Blob([o],{type:"application/pdf"}),i=URL.createObjectURL(e),a=document.createElement("a");document.body.appendChild(a),a.href=i,a.download=u,a.style.display="none",a.click(),setTimeout(()=>{URL.revokeObjectURL(i),document.body.removeChild(a)},10)}c(x,"download");async function E(u=150,o="filename"){var S,C;if(!l.value)throw new Error("Current PDFDocumentProxy have not loaded yet");const e=await((S=l.value)==null?void 0:S.saveDocument()),a=await P.getDocument(e.buffer).promise,n=u/72,d=96/72,v=await L.createIframe(),t=v.contentWindow;t.document.title=o;const F=[...Array(a.numPages).keys()].map(p=>p+1);for(const p of F){const y=await a.getPage(p),m=y.getViewport({scale:1});p===1&&L.addStylesToIframe(t,m.width*n/d,m.height*n/d);const w=document.createElement("canvas");w.width=m.width*n,w.height=m.height*n;const T=w.cloneNode();t==null||t.document.body.appendChild(T),await(y==null?void 0:y.render({canvasContext:w.getContext("2d"),intent:"print",transform:[n,0,0,n,0,0],viewport:m}).promise),(C=T.getContext("2d"))==null||C.drawImage(w,0,0)}t==null||t.focus(),t==null||t.print(),document.body.removeChild(v)}return c(E,"print"),f.isRef(s)?(s.value&&g(s.value),f.watch(s,()=>{s.value&&g(s.value)})):s&&g(s),{pdf:b,pages:D,info:k,print:E,download:x,getPDFDestination:I,processLoadingTask:g}}c(q,"usePDF");exports.usePDF=q;
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
var
|
|
2
|
-
var c = (r, s) =>
|
|
3
|
-
import
|
|
1
|
+
var U = Object.defineProperty;
|
|
2
|
+
var c = (r, s) => U(r, "name", { value: s, configurable: !0 });
|
|
3
|
+
import { GlobalWorkerOptions as S, getDocument as R } from "pdfjs-dist";
|
|
4
4
|
import F from "../../../../../node_modules/.pnpm/pdfjs-dist@4.8.69/node_modules/pdfjs-dist/build/pdf.worker.min/index.js";
|
|
5
|
-
import { shallowRef as y, isRef as
|
|
6
|
-
import { getDestinationArray as
|
|
5
|
+
import { shallowRef as y, isRef as N, watch as A } from "vue";
|
|
6
|
+
import { getDestinationArray as O, getDestinationRef as j, isSpecLike as B, getLocation as _ } from "../pdfs/destination/index.js";
|
|
7
7
|
import { createIframe as G, addStylesToIframe as J } from "../pdfs/miscellaneous/index.js";
|
|
8
|
-
function
|
|
9
|
-
|
|
8
|
+
function M(r) {
|
|
9
|
+
S.workerSrc = r;
|
|
10
10
|
}
|
|
11
|
-
c(
|
|
12
|
-
function
|
|
11
|
+
c(M, "configWorker");
|
|
12
|
+
function X(r, s = {
|
|
13
13
|
onProgress: void 0,
|
|
14
14
|
onPassword: void 0,
|
|
15
15
|
onError: void 0,
|
|
16
16
|
password: ""
|
|
17
17
|
}) {
|
|
18
|
-
var
|
|
19
|
-
(
|
|
20
|
-
const
|
|
21
|
-
function w(
|
|
22
|
-
|
|
23
|
-
const o =
|
|
18
|
+
var D;
|
|
19
|
+
(D = S) != null && D.workerSrc || M(F);
|
|
20
|
+
const h = y(), d = y(), P = y(0), b = y({});
|
|
21
|
+
function w(l) {
|
|
22
|
+
d.value && d.value.destroy();
|
|
23
|
+
const o = R(l);
|
|
24
24
|
if (s.onProgress && (o.onProgress = s.onProgress), s.onPassword)
|
|
25
25
|
o.onPassword = s.onPassword;
|
|
26
26
|
else if (s.password) {
|
|
@@ -31,9 +31,9 @@ function K(r, s = {
|
|
|
31
31
|
}
|
|
32
32
|
return o.promise.then(
|
|
33
33
|
async (e) => {
|
|
34
|
-
|
|
34
|
+
d.value = e, h.value = e.loadingTask, P.value = e.numPages;
|
|
35
35
|
const i = await e.getMetadata(), a = await e.getAttachments(), n = await e.getJSActions(), u = await e.getOutline();
|
|
36
|
-
|
|
36
|
+
b.value = {
|
|
37
37
|
metadata: i,
|
|
38
38
|
attachments: a,
|
|
39
39
|
javascript: n,
|
|
@@ -46,32 +46,32 @@ function K(r, s = {
|
|
|
46
46
|
);
|
|
47
47
|
}
|
|
48
48
|
c(w, "processLoadingTask");
|
|
49
|
-
async function
|
|
49
|
+
async function T(l) {
|
|
50
50
|
var t;
|
|
51
|
-
const o = await ((t =
|
|
51
|
+
const o = await ((t = h.value) == null ? void 0 : t.promise);
|
|
52
52
|
if (!o) return null;
|
|
53
|
-
const e = await
|
|
53
|
+
const e = await O(o, l), i = await j(o, e);
|
|
54
54
|
if (!i || !e) return null;
|
|
55
|
-
const a = await o.getPageIndex(i), n = e[1].name, u = e.slice(2), g =
|
|
55
|
+
const a = await o.getPageIndex(i), n = e[1].name, u = e.slice(2), g = B(u) ? _(n, u) : null;
|
|
56
56
|
return { pageIndex: a, location: g ?? { type: "Fit", spec: [] } };
|
|
57
57
|
}
|
|
58
|
-
c(
|
|
59
|
-
async function
|
|
58
|
+
c(T, "getPDFDestination");
|
|
59
|
+
async function x(l = "filename") {
|
|
60
60
|
var n;
|
|
61
|
-
if (!
|
|
62
|
-
const o = await ((n =
|
|
63
|
-
document.body.appendChild(a), a.href = i, a.download =
|
|
61
|
+
if (!d.value) throw new Error("Current PDFDocumentProxy have not loaded yet");
|
|
62
|
+
const o = await ((n = d.value) == null ? void 0 : n.saveDocument()), e = new Blob([o], { type: "application/pdf" }), i = URL.createObjectURL(e), a = document.createElement("a");
|
|
63
|
+
document.body.appendChild(a), a.href = i, a.download = l, a.style.display = "none", a.click(), setTimeout(() => {
|
|
64
64
|
URL.revokeObjectURL(i), document.body.removeChild(a);
|
|
65
65
|
}, 10);
|
|
66
66
|
}
|
|
67
|
-
c(
|
|
68
|
-
async function
|
|
69
|
-
var
|
|
70
|
-
if (!
|
|
71
|
-
const e = await ((
|
|
67
|
+
c(x, "download");
|
|
68
|
+
async function I(l = 150, o = "filename") {
|
|
69
|
+
var k, C;
|
|
70
|
+
if (!d.value) throw new Error("Current PDFDocumentProxy have not loaded yet");
|
|
71
|
+
const e = await ((k = d.value) == null ? void 0 : k.saveDocument()), a = await R(e.buffer).promise, n = l / 72, u = 96 / 72, g = await G(), t = g.contentWindow;
|
|
72
72
|
t.document.title = o;
|
|
73
|
-
const
|
|
74
|
-
for (const v of
|
|
73
|
+
const E = [...Array(a.numPages).keys()].map((v) => v + 1);
|
|
74
|
+
for (const v of E) {
|
|
75
75
|
const p = await a.getPage(v), m = p.getViewport({ scale: 1 });
|
|
76
76
|
v === 1 && J(
|
|
77
77
|
t,
|
|
@@ -86,23 +86,23 @@ function K(r, s = {
|
|
|
86
86
|
intent: "print",
|
|
87
87
|
transform: [n, 0, 0, n, 0, 0],
|
|
88
88
|
viewport: m
|
|
89
|
-
}).promise), (
|
|
89
|
+
}).promise), (C = L.getContext("2d")) == null || C.drawImage(f, 0, 0);
|
|
90
90
|
}
|
|
91
91
|
t == null || t.focus(), t == null || t.print(), document.body.removeChild(g);
|
|
92
92
|
}
|
|
93
|
-
return c(
|
|
93
|
+
return c(I, "print"), N(r) ? (r.value && w(r.value), A(r, () => {
|
|
94
94
|
r.value && w(r.value);
|
|
95
95
|
})) : r && w(r), {
|
|
96
|
-
pdf:
|
|
97
|
-
pages:
|
|
98
|
-
info:
|
|
99
|
-
print:
|
|
100
|
-
download:
|
|
101
|
-
getPDFDestination:
|
|
96
|
+
pdf: h,
|
|
97
|
+
pages: P,
|
|
98
|
+
info: b,
|
|
99
|
+
print: I,
|
|
100
|
+
download: x,
|
|
101
|
+
getPDFDestination: T,
|
|
102
102
|
processLoadingTask: w
|
|
103
103
|
};
|
|
104
104
|
}
|
|
105
|
-
c(
|
|
105
|
+
c(X, "usePDF");
|
|
106
106
|
export {
|
|
107
|
-
|
|
107
|
+
X as usePDF
|
|
108
108
|
};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var k=Object.defineProperty;var c=(p,v)=>k(p,"name",{value:v,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("vue"),T=require("pdfjs-dist"),m=require("../annotations/index.cjs"),L=require("../linkService/index.cjs"),O=i.defineComponent({__name:"Annotation",props:{page:{},viewport:{},document:{},annotationsFilter:{},annotationsMap:{},imageResourcesPath:{},hideForms:{type:Boolean},enableScripting:{type:Boolean},intent:{}},emits:["annotation","annotationLoaded"],setup(p,{emit:v}){const t=p,y=v,s=i.ref(),u=i.ref();function w(o){const e=m.annotationEventsHandler(o,t.document,u.value);Promise.resolve(e).then(n=>{n&&y("annotation",n)})}c(w,"annotationsEvents");async function E(){var e;return await((e=i.toRaw(t.document))==null?void 0:e.getFieldObjects())}c(E,"getFieldObjects");async function M(){var e;return await((e=i.toRaw(t.document))==null?void 0:e.hasJSActions())}c(M,"getHasJSActions");async function h(){const o=t.page;let e=await(o==null?void 0:o.getAnnotations({intent:t.intent}));if(t.annotationsFilter){const n=t.annotationsFilter;e=e.filter(r=>{const l=r.subtype,d=r.fieldType?`${l}.${r.fieldType}`:null;return(n==null?void 0:n.includes(l))||d!==null&&(n==null?void 0:n.includes(d))})}return e}c(h,"getAnnotations");async function S(){var b,A;(A=(b=s.value).replaceChildren)==null||A.call(b);for(const a of m.EVENTS_TO_HANDLER)s.value.removeEventListener(a,w);const o=i.toRaw(t.document),e=t.page,n=t.viewport;u.value=await h();const r=new Map([]);for(const a of u.value)if(a.subtype==="Widget"&&a.fieldType==="Btn"&&a.pushButton){const f=a.rect[2]-a.rect[0],F=a.rect[3]-a.rect[1],g=document.createElement("canvas");g.setAttribute("width",(f*n.scale).toString()),g.setAttribute("height",(F*n.scale).toString()),r.set(a.id,g)}const l=o.annotationStorage;if(t.annotationsMap)for(const[a,f]of Object.entries(t.annotationsMap))l.setValue(a,f);const d={accessibilityManager:void 0,annotationCanvasMap:r,div:s.value,page:e,viewport:n.clone({dontFlip:!0}),annotationEditorUIManager:null,l10n:null},_={annotations:u.value,viewport:n.clone({dontFlip:!0}),linkService:new L.SimpleLinkService,annotationCanvasMap:r,div:s.value,annotationStorage:l,renderForms:!t.hideForms,page:e,enableScripting:!1,hasJSActions:await M(),fieldObjects:await E(),downloadManager:null,imageResourcesPath:t.imageResourcesPath};new T.AnnotationLayer(d).render(_).then(async()=>{y("annotationLoaded",await h())});for(const a of m.EVENTS_TO_HANDLER)s.value.addEventListener(a,w)}return c(S,"render"),i.watch(()=>t.viewport,()=>{t.page&&t.viewport&&s.value&&S()}),i.onMounted(()=>{t.page&&t.viewport&&s.value&&S()}),(o,e)=>(i.openBlock(),i.createElementBlock("div",{ref_key:"layer",ref:s,class:"annotationLayer",style:{display:"block"}},null,512))}});exports.default=O;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
var L = Object.defineProperty;
|
|
2
2
|
var r = (d, p) => L(d, "name", { value: p, configurable: !0 });
|
|
3
|
-
import { defineComponent as O, ref as A, watch as
|
|
4
|
-
import
|
|
5
|
-
import { EVENTS_TO_HANDLER as
|
|
6
|
-
import { SimpleLinkService as
|
|
7
|
-
const
|
|
3
|
+
import { defineComponent as O, ref as A, watch as T, onMounted as j, openBlock as B, createElementBlock as H, toRaw as m } from "vue";
|
|
4
|
+
import { AnnotationLayer as P } from "pdfjs-dist";
|
|
5
|
+
import { EVENTS_TO_HANDLER as M, annotationEventsHandler as C } from "../annotations/index.js";
|
|
6
|
+
import { SimpleLinkService as J } from "../linkService/index.js";
|
|
7
|
+
const D = /* @__PURE__ */ O({
|
|
8
8
|
__name: "Annotation",
|
|
9
9
|
props: {
|
|
10
10
|
page: {},
|
|
@@ -21,22 +21,22 @@ const W = /* @__PURE__ */ O({
|
|
|
21
21
|
setup(d, { emit: p }) {
|
|
22
22
|
const t = d, g = p, i = A(), l = A();
|
|
23
23
|
function y(o) {
|
|
24
|
-
const n =
|
|
24
|
+
const n = C(o, t.document, l.value);
|
|
25
25
|
Promise.resolve(n).then((e) => {
|
|
26
26
|
e && g("annotation", e);
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
r(y, "annotationsEvents");
|
|
30
|
-
async function
|
|
30
|
+
async function E() {
|
|
31
31
|
var n;
|
|
32
32
|
return await ((n = m(t.document)) == null ? void 0 : n.getFieldObjects());
|
|
33
33
|
}
|
|
34
|
-
r(
|
|
35
|
-
async function
|
|
34
|
+
r(E, "getFieldObjects");
|
|
35
|
+
async function F() {
|
|
36
36
|
var n;
|
|
37
37
|
return await ((n = m(t.document)) == null ? void 0 : n.hasJSActions());
|
|
38
38
|
}
|
|
39
|
-
r(
|
|
39
|
+
r(F, "getHasJSActions");
|
|
40
40
|
async function w() {
|
|
41
41
|
const o = t.page;
|
|
42
42
|
let n = await (o == null ? void 0 : o.getAnnotations({ intent: t.intent }));
|
|
@@ -53,7 +53,7 @@ const W = /* @__PURE__ */ O({
|
|
|
53
53
|
async function h() {
|
|
54
54
|
var b, S;
|
|
55
55
|
(S = (b = i.value).replaceChildren) == null || S.call(b);
|
|
56
|
-
for (const a of
|
|
56
|
+
for (const a of M) i.value.removeEventListener(a, y);
|
|
57
57
|
const o = m(t.document), n = t.page, e = t.viewport;
|
|
58
58
|
l.value = await w();
|
|
59
59
|
const s = /* @__PURE__ */ new Map([]);
|
|
@@ -76,31 +76,31 @@ const W = /* @__PURE__ */ O({
|
|
|
76
76
|
}, k = {
|
|
77
77
|
annotations: l.value,
|
|
78
78
|
viewport: e.clone({ dontFlip: !0 }),
|
|
79
|
-
linkService: new
|
|
79
|
+
linkService: new J(),
|
|
80
80
|
annotationCanvasMap: s,
|
|
81
81
|
div: i.value,
|
|
82
82
|
annotationStorage: c,
|
|
83
83
|
renderForms: !t.hideForms,
|
|
84
84
|
page: n,
|
|
85
85
|
enableScripting: !1,
|
|
86
|
-
hasJSActions: await
|
|
87
|
-
fieldObjects: await
|
|
86
|
+
hasJSActions: await F(),
|
|
87
|
+
fieldObjects: await E(),
|
|
88
88
|
downloadManager: null,
|
|
89
89
|
imageResourcesPath: t.imageResourcesPath
|
|
90
90
|
};
|
|
91
|
-
new
|
|
91
|
+
new P(u).render(k).then(async () => {
|
|
92
92
|
g("annotationLoaded", await w());
|
|
93
93
|
});
|
|
94
|
-
for (const a of
|
|
94
|
+
for (const a of M) i.value.addEventListener(a, y);
|
|
95
95
|
}
|
|
96
|
-
return r(h, "render"),
|
|
96
|
+
return r(h, "render"), T(
|
|
97
97
|
() => t.viewport,
|
|
98
98
|
() => {
|
|
99
99
|
t.page && t.viewport && i.value && h();
|
|
100
100
|
}
|
|
101
|
-
),
|
|
101
|
+
), j(() => {
|
|
102
102
|
t.page && t.viewport && i.value && h();
|
|
103
|
-
}), (o, n) => (
|
|
103
|
+
}), (o, n) => (B(), H("div", {
|
|
104
104
|
ref_key: "layer",
|
|
105
105
|
ref: i,
|
|
106
106
|
class: "annotationLayer",
|
|
@@ -109,5 +109,5 @@ const W = /* @__PURE__ */ O({
|
|
|
109
109
|
}
|
|
110
110
|
});
|
|
111
111
|
export {
|
|
112
|
-
|
|
112
|
+
D as default
|
|
113
113
|
};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var D=Object.defineProperty;var
|
|
1
|
+
"use strict";var D=Object.defineProperty;var i=(x,k)=>D(x,"name",{value:k,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("vue"),A=require("pdfjs-dist"),z=;/* empty css */;/* empty css */const H=,/* empty css */X=;/* empty css */;/* empty css */const j=,/* empty css */I=o.defineComponent({name:"LSPdf"}),J=o.defineComponent({...I,props:{pdf:{},page:{default:1},scale:{default:1},rotation:{},fitParent:{type:Boolean},width:{},height:{},textLayer:{type:Boolean},imageResourcesPath:{},hideForms:{type:Boolean},intent:{default:"display"},annotationLayer:{type:Boolean},annotationsFilter:{},annotationsMap:{},watermarkText:{},watermarkOptions:{},highlightText:{},highlightOptions:{}},emits:["annotation","highlight","loaded","textLoaded","annotationLoaded","xfaLoaded","loadComplete","loadError","update:source"],setup(x,{expose:k,emit:S}){const n=x,s=S;o.watch(()=>n.pdf,()=>{W()},{immediate:!0,deep:!0});const p=o.ref(),g=o.ref(),P=o.ref(!1);let v;const u=o.computed(()=>({viewport:void 0,document:void 0,page:void 0})),b=o.computed(()=>({annotationsMap:n.annotationsMap,annotationsFilter:n.annotationsFilter,imageResourcesPath:n.imageResourcesPath,hideForms:n.hideForms,intent:n.intent})),T=o.computed(()=>({highlightText:n.highlightText,highlightOptions:n.highlightOptions}));function B(){return j.default({},{columns:4,rows:4,rotation:45,fontSize:18,color:"rgba(211, 210, 211, 0.4)"},n.watermarkOptions)}i(B,"getWatermarkOptionsWithDefaults");function _(a){if(!(typeof a=="number"&&a%90===0))return 0;const e=a/90;return e>4?_(a-360):e<0?_(a+360):a}i(_,"getRotation");function V(a){let e=n.scale;if(n.fitParent){const t=p.value.parentNode.clientWidth,r=a.getViewport({scale:1}).width;e=t/r}else if(n.width){const t=a.getViewport({scale:1}).width;e=n.width/t}else if(n.height){const t=a.getViewport({scale:1}).height;e=n.height/t}return e}i(V,"getScale");function E(a=1){if(!n.watermarkText)return;const e=L();if(!e)return;const t=e.getContext("2d");if(!t)return;const r=B(),c=n.watermarkText,l=r.columns,f=r.rows,d=l*f,m=r.rotation,y=r.fontSize*a;t.font=`${y}px Trebuchet MS`,t.fillStyle=r.color;for(let h=0;h<d;h++){const w=h%l*(e.width/l)+e.width/(l*2),q=Math.floor(h/l)*(e.height/f)+e.height/(f*2),$=t.measureText(c).width;t.save(),t.translate(w,q),t.rotate(-m*(Math.PI/180)),t.fillText(c,-$/2,y/2),t.restore()}}i(E,"paintWatermark");function L(){var e;let a=null;return(e=p.value)==null||e.childNodes.forEach(t=>{t.tagName==="CANVAS"&&(a=t)}),a}i(L,"getCurrentCanvas");function F(a){var c;let e;const t=L();t&&(t==null?void 0:t.getAttribute("role"))==="main"?e=t:(e=document.createElement("canvas"),e.style.display="block",e.setAttribute("dir","ltr"));const r=window.devicePixelRatio||1;return e.width=Math.floor(a.width*r),e.height=Math.floor(a.height*r),e.style.width=`${Math.floor(a.width)}px`,e.style.height=`${Math.floor(a.height)}px`,e.setAttribute("class","pdf-canvas"),(c=p.value)==null||c.style.setProperty("--scale-factor",`${a.scale}`),g.value.style.width=`${Math.floor(a.width)}px`,g.value.style.height=`${Math.floor(a.height)}px`,g.value.style.top="0",g.value.style.left="0",P.value=!0,e}i(F,"setupCanvas");function C(){v&&v.cancel()}i(C,"cancelRender");function M(a){var e;(e=o.toRaw(u.value.document))==null||e.getPage(a).then(t=>{var w;C();const r=t.getViewport(),c={scale:V(t),rotation:_((n.rotation||0)+r.rotation)},l=t.getViewport(c),f=L(),d=F(l),m=window.devicePixelRatio||1,y=m!==1?[m,0,0,m,0,0]:void 0,h={canvasContext:d.getContext("2d"),viewport:l,annotationMode:n.hideForms?A.AnnotationMode.ENABLE:A.AnnotationMode.ENABLE_FORMS,transform:y,intent:n.intent};(d==null?void 0:d.getAttribute("role"))!=="main"?f&&((w=p.value)==null||w.replaceChild(d,f)):d.removeAttribute("role"),u.value.page=t,u.value.viewport=l,v=t.render(h),v.promise.then(()=>{P.value=!1,E(l.scale),s("loaded",u.value.viewport),s("loadComplete")}).catch(()=>{s("loadError")})})}i(M,"renderPage");function N(a){a.promise&&a.promise.then(async e=>{u.value.document=e,M(n.page)})}i(N,"initDoc"),o.watch(()=>[n.page,n.scale,n.width,n.height,n.rotation,n.hideForms,n.intent],()=>{M(n.page)});function O(){M(n.page)}i(O,"reload");function R(){C()}i(R,"cancel");async function W(){if(n.pdf)try{N(n.pdf)}finally{}}return i(W,"initPdf"),k({reload:O,cancel:R}),(a,e)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"container",ref:p,style:{position:"relative",display:"block"}},[e[5]||(e[5]=o.createElementVNode("canvas",{dir:"ltr",style:{display:"block"},role:"main"},null,-1)),a.annotationLayer?(o.openBlock(),o.createBlock(z.default,o.mergeProps({key:0},{...o.unref(u),...o.unref(b)},{onAnnotation:e[0]||(e[0]=t=>s("annotation",t)),onAnnotationLoaded:e[1]||(e[1]=t=>s("annotationLoaded",t))}),null,16)):o.createCommentVNode("",!0),a.textLayer?(o.openBlock(),o.createBlock(H.default,o.mergeProps({key:1},{...o.unref(u),...o.unref(T)},{onHighlight:e[2]||(e[2]=t=>s("highlight",t)),onTextLoaded:e[3]||(e[3]=t=>s("textLoaded",t))}),null,16)):o.createCommentVNode("",!0),o.createVNode(X.default,o.mergeProps({...o.unref(u)},{onXfaLoaded:e[4]||(e[4]=t=>s("xfaLoaded"))}),null,16),o.withDirectives(o.createElementVNode("div",{ref_key:"loadingLayer",ref:g,style:{position:"absolute"}},[o.renderSlot(a.$slots,"default")],512),[[o.vShow,o.unref(P)]])],512))}});exports.default=J;
|