@sv-print/plugin-api-pdf 0.2.1 → 0.2.3
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/index.js +1 -37
- package/dist/index.mjs +101 -156
- package/dist/index.umd.js +1 -37
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,37 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
}
|
|
3
|
-
.hiprint-printTemplate .hiprint-printPanel-small {
|
|
4
|
-
display:inline-block;
|
|
5
|
-
padding: `+(Number(r[x(132)])||0)/2+"mm "+(Number(r.layoutColumnGap)||0)/2+x(185)):s[x(168)](`<style>
|
|
6
|
-
.hiprint-printPanel-small{
|
|
7
|
-
box-sizing: border-box;
|
|
8
|
-
border: 0px;
|
|
9
|
-
}
|
|
10
|
-
.hiprint-printPaper-small{
|
|
11
|
-
position: relative;
|
|
12
|
-
padding: 0;
|
|
13
|
-
}
|
|
14
|
-
.hiprint-printTemplate .hiprint-printPaper{
|
|
15
|
-
display: flex;
|
|
16
|
-
flex-wrap: wrap;
|
|
17
|
-
flex-direction: column;
|
|
18
|
-
align-content: flex-start;
|
|
19
|
-
margin: -`+(Number(r[x(132)])||0)/2+"mm -"+(Number(r[x(129)])||0)/2+x(204)+(Number(r[x(132)])||0)/2+x(157)+(Number(r.layoutColumnGap)||0)/2+x(185));for(let p=0;p<n;p++){const G=globalThis.$(x(152)+t.paperWidth+x(154)+t[x(153)]+x(118)),$=p*T,U=Math.min((p+1)*T,y);for(let N=$;N<U;N++){const q=l.eq(N)[x(150)]();q[x(127)](x(170)),q[x(158)](x(160)+N);const A=globalThis.$('<div class="hiprint-printPanel-small"></div>');A.append(q),G[x(139)](x(178)).append(A)}s.append(G)}this[x(169)](s,f),v[x(145)](s[0]),globalThis.$(s)[x(137)](x(200))}else this.svg2canvas(g,f),v[x(145)](g[0]),globalThis.$(g)[x(137)](x(200));let M=v[x(139)](x(123))[x(174)];this.loadAllImages(v,function(){const c=x;try{v[c(139)](c(123))[c(165)](function(h,T){const l=c;globalThis[l(140)][l(191)][l(119)](function(y){const n=l;W.snapdom[n(147)](T,f)[n(159)](function(s){const p=n;var G=s[p(180)]("2d");G[p(126)]=![];var $=s[p(142)]("image/jpeg",f.quality||.92);C[p(205)]($,"JPEG",0,0,u,J),h<M-1&&C[p(124)](),m(h+1,M),y()})[n(121)](s=>{const p=n;throw new Error(s[p(206)])})}),h==M-1&&(globalThis[l(140)][l(191)][l(119)](function(y){const n=l;if(w)o[n(202)](),C[n(130)](t[n(182)]);else{o[n(202)]();let s=t[n(167)]||"blob",p=C[n(149)](s);b[n(166)](p)}globalThis.hinnn[n(191)][n(203)]()}),globalThis[l(140)].queue.run())})}catch(h){console[c(163)](c(188)),console[c(156)](h)}})}return b[x(190)]()})};function I(i,e){const a=k();return I=function(x,o){return x=x-118,a[x]},I(i,e)}function k(){const i=["clone","6dMscGT",`<div class="hiprint-printPanel">
|
|
20
|
-
<div class="hiprint-printPaper" style="width:`,"paperHeight","mm;height:","getTempContainer","log","mm ","addClass","then","hiprint-printPaper-small start-","getOrient","toPt","error","getHtml","each","resolve","type","append","svg2canvas","hiprint-printPaper","printPanels","string","row","length","paperWidth","panelLayoutOptions","1023631wWoxaT",".hiprint-printPaper",".pdf","getContext","landscape","name","height","30WptyTU",`mm;
|
|
21
|
-
}
|
|
22
|
-
</style>`,"layoutType","toPdf percent: ","toPdf \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ","1168448GPmBDt","promise","queue","total","sv-print-","createTempContainer","2647114kIxruS","1428210JcRIkc","extend","pixelRatio","floor","position:fixed","261MdYkZK","removeTempContainer","clear",`mm;
|
|
23
|
-
}
|
|
24
|
-
.hiprint-printTemplate .hiprint-printPanel-small {
|
|
25
|
-
display:inline-block;
|
|
26
|
-
padding: `,"addImage","message",`mm;"></div>
|
|
27
|
-
</div>`,"add","ceil","catch","mm -",".hiprint-printPanel .hiprint-printPaper","addPage","indexOf","imageSmoothingEnabled","removeClass","paperType","layoutColumnGap","save","now","layoutRowGap","303088jpjeEu","isDownload",`<style>
|
|
28
|
-
.hiprint-printPanel-small{
|
|
29
|
-
box-sizing: border-box;
|
|
30
|
-
border: 0px;
|
|
31
|
-
}
|
|
32
|
-
.hiprint-printPaper-small{
|
|
33
|
-
position: relative;
|
|
34
|
-
padding: 0;
|
|
35
|
-
}
|
|
36
|
-
.hiprint-printTemplate .hiprint-printPaper{
|
|
37
|
-
margin: -`,"portrait","css","2985212aXroAw","find","hinnn","width","toDataURL","4722770jKjDwl","\u81EA\u5B9A\u4E49","html",'<div class="hiprint-printTemplate"></div>',"toCanvas","onProgress","output"];return k=function(){return i},k()}(function(i,e){for(var a=D,x=i();[];)try{var o=parseInt(a(285))/1*(-parseInt(a(271))/2)+-parseInt(a(278))/3*(-parseInt(a(274))/4)+parseInt(a(276))/5*(-parseInt(a(270))/6)+-parseInt(a(269))/7*(parseInt(a(281))/8)+parseInt(a(286))/9+-parseInt(a(282))/10+-parseInt(a(279))/11*(-parseInt(a(272))/12);if(o===e)break;x.push(x.shift())}catch(b){x.push(x.shift())}})(j,888198);function j(){var i=["defineProperty","add toPdf Api to PrintTemplate","2723IGOXJN","8021799kZgTqd","101689obIHjr","195666UJaNvt","530sNXPXd","29986056hlVKwJ","0.3.0","2852356gBcZAa","newPrintTemplate","30pJdmwU","toPdf","6DDlCVP","11vOMLVp","add toPdf Api","808UNSBJG","15436410LeGBkC"];return j=function(){return i},j()}function D(i,e){var a=j();return D=function(x,o){x=x-269;var b=a[x];return b},D(i,e)}function H(i){var e=D;return{name:"add toPdf Api",description:e(280),hooks:[{hook:e(275),name:e(284),description:e(284),priority:1,run:({template:a,options:x})=>{var o=e;Object[o(283)](a,o(277),{value:E,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:e(273)}}module.exports=H;
|
|
1
|
+
"use strict";var k=(a,n,x)=>new Promise((t,o)=>{var s=e=>{try{d(x.next(e))}catch(f){o(f)}},m=e=>{try{d(x.throw(e))}catch(f){o(f)}},d=e=>e.done?t(e.value):Promise.resolve(e.value).then(s,m);d((x=x.apply(a,n)).next())});const E=require("@zumer/snapdom"),M=require("jspdf");function T(a,n){const x=H();return T=function(t,o){return t=t-279,x[t]},T(a,n)}(function(a,n){const x=T,t=a();for(;;)try{if(-parseInt(x(286))/1*(-parseInt(x(295))/2)+parseInt(x(337))/3*(-parseInt(x(333))/4)+-parseInt(x(345))/5+parseInt(x(338))/6+parseInt(x(331))/7*(parseInt(x(342))/8)+-parseInt(x(309))/9*(parseInt(x(279))/10)+parseInt(x(281))/11===n)break;t.push(t.shift())}catch(o){t.push(t.shift())}})(H,732272);const N=function(a,n,x){return k(this,null,function*(){const t=T;var o=this,s=globalThis.$[t(336)](),m=!0;let d=(h,I)=>{const c=t,w=Math[c(291)](h/I*100);console[c(307)](c(324),h,c(334),I),console[c(307)](c(328),w+"%")},e=x||{};if(this.printPanels[t(322)]){if(typeof n=="string"){const p=n[t(330)](t(319))>-1?n:n+t(319);e[t(329)]=p}else e=n||{},!e[t(329)]&&(e[t(329)]="sv-print-"+Date[t(280)]()+t(319));const h=this.printPanels[0];let I=h.width,c=h[t(297)];const w=h[t(313)](),q=e.paperWidth||w.paperWidth,A=e[t(326)]||w.paperHeight,R=q&&A;var f=globalThis[t(283)].mm[t(311)](q||I),L=globalThis[t(283)].mm.toPt(A||c),b=globalThis.$.extend({backgroundColor:"#fff"},e||{});const y=this[t(314)][0].paperType,G=y!=null&&y!=""&&y!=t(306),F=this[t(296)](0)==1||R?"portrait":"landscape",J=G&&!R?y[t(312)]():[f,L];var _=new M.jsPDF({orientation:F,unit:"pt",format:J}),v=yield this[t(320)](a,e);e&&(e[t(290)]&&(b[t(292)]=e[t(290)],b[t(301)]=e[t(290)]),e.isDownload!=null&&(m=e[t(318)]),e[t(339)]!=null&&(d=e[t(339)])),globalThis.$(v)[t(344)](t(293),"")[t(344)](t(297),""),this[t(310)]();var P=this[t(305)]();this[t(315)](v,b),P.html(v[0]),globalThis.$(v)[t(344)](t(300));let D=P[t(303)](".hiprint-printPanel .hiprint-printPaper")[t(322)];this[t(316)](P,function(){const p=t;try{P.find(p(323))[p(317)](function(g,K){const l=p;globalThis[l(283)][l(294)].add(function(W){const r=l;E.snapdom[r(308)](K,b)[r(335)](function(u){const i=r;var O=u[i(340)]("2d");O[i(327)]=!1;var $=u[i(289)](i(282),b[i(284)]||.92);_.addImage($,i(321),0,0,f,L),g<D-1&&_[i(287)](),d(g+1,D),W()})[r(288)](u=>{const i=r;throw new Error(u[i(299)])})}),g==D-1&&(globalThis[l(283)][l(294)].add(function(W){const r=l;if(m)o[r(341)](),_[r(332)](e[r(329)]);else{o[r(341)]();let u=e[r(343)]||r(302),i=_.output(u);s.resolve(i)}globalThis.hinnn[r(294)][r(325)]()}),globalThis[l(283)][l(294)].run())})}catch(g){console[p(285)](p(304)),console[p(307)](g)}})}return s[t(298)]()})};function H(){const a=["toDataURL","pixelRatio","floor","dpr","width","queue","3946ouZolz","getOrient","height","promise","message","position:fixed","scale","blob","find","toPdf 失败(可能您的图片资源无法正常加载): ","getTempContainer","自定义","log","toCanvas","18yiqpGm","createTempContainer","toPt","toLocaleLowerCase","getLayoutSize","printPanels","svg2canvas","loadAllImages","each","isDownload",".pdf","getHtml","JPEG","length",".hiprint-printPanel .hiprint-printPaper","cur","clear","paperHeight","imageSmoothingEnabled","toPdf percent: ","name","indexOf","1281273gYGLca","save","708324LMtpOj","total","then","Deferred","15iWqryt","2855424nmbAjG","onProgress","getContext","removeTempContainer","16rRmZWn","type","css","6281095awfIiF","5831160ywWuuj","now","30057698dRvYbm","image/jpeg","hinnn","quality","error","236FgluNH","addPage","catch"];return H=function(){return a},H()}(function(a,n){for(var x=j,t=a();;)try{var o=-parseInt(x(152))/1+parseInt(x(158))/2*(parseInt(x(155))/3)+parseInt(x(162))/4+parseInt(x(160))/5*(parseInt(x(159))/6)+parseInt(x(154))/7+parseInt(x(150))/8+parseInt(x(156))/9*(-parseInt(x(161))/10);if(o===n)break;t.push(t.shift())}catch(s){t.push(t.shift())}})(C,962088);function j(a,n){var x=C();return j=function(t,o){t=t-149;var s=x[t];return s},j(a,n)}function C(){var a=["defineProperty","12266BZqKVx","39924cKCDbi","395LHKJpt","33059140QHMajH","6526700GPwrKA","add toPdf Api","4501944fBRyJv","newPrintTemplate","1380525oRWpyH","0.3.0","9294110NjLFcP","783HNQJgo","9SYADty"];return C=function(){return a},C()}function S(a){var n=j;return{name:n(149),description:n(149),hooks:[{hook:n(151),name:"add toPdf Api to PrintTemplate",description:"add toPdf Api to PrintTemplate",priority:1,run:({template:x,options:t})=>{var o=n;Object[o(157)](x,"toPdf",{value:N,enumerable:!1,writable:!0,configurable:!0})}}],leastHiprintVersion:n(153)}}module.exports=S;
|
package/dist/index.mjs
CHANGED
|
@@ -1,188 +1,133 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var q = (a, n, t) => new Promise((x, o) => {
|
|
2
|
+
var s = (e) => {
|
|
3
3
|
try {
|
|
4
|
-
|
|
5
|
-
} catch (
|
|
6
|
-
o(
|
|
4
|
+
d(t.next(e));
|
|
5
|
+
} catch (f) {
|
|
6
|
+
o(f);
|
|
7
7
|
}
|
|
8
|
-
},
|
|
8
|
+
}, m = (e) => {
|
|
9
9
|
try {
|
|
10
|
-
|
|
11
|
-
} catch (
|
|
12
|
-
o(
|
|
10
|
+
d(t.throw(e));
|
|
11
|
+
} catch (f) {
|
|
12
|
+
o(f);
|
|
13
13
|
}
|
|
14
|
-
},
|
|
15
|
-
|
|
14
|
+
}, d = (e) => e.done ? x(e.value) : Promise.resolve(e.value).then(s, m);
|
|
15
|
+
d((t = t.apply(a, n)).next());
|
|
16
16
|
});
|
|
17
|
-
import { snapdom as
|
|
18
|
-
import { jsPDF as
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
|
|
17
|
+
import { snapdom as E } from "@zumer/snapdom";
|
|
18
|
+
import { jsPDF as M } from "jspdf";
|
|
19
|
+
function T(a, n) {
|
|
20
|
+
const t = H();
|
|
21
|
+
return T = function(x, o) {
|
|
22
|
+
return x = x - 279, t[x];
|
|
23
|
+
}, T(a, n);
|
|
24
|
+
}
|
|
25
|
+
(function(a, n) {
|
|
26
|
+
const t = T, x = a();
|
|
27
|
+
for (; ; )
|
|
22
28
|
try {
|
|
23
|
-
if (parseInt(
|
|
24
|
-
break;
|
|
29
|
+
if (-parseInt(t(286)) / 1 * (-parseInt(t(295)) / 2) + parseInt(t(337)) / 3 * (-parseInt(t(333)) / 4) + -parseInt(t(345)) / 5 + parseInt(t(338)) / 6 + parseInt(t(331)) / 7 * (parseInt(t(342)) / 8) + -parseInt(t(309)) / 9 * (parseInt(t(279)) / 10) + parseInt(t(281)) / 11 === n) break;
|
|
25
30
|
x.push(x.shift());
|
|
26
31
|
} catch (o) {
|
|
27
32
|
x.push(x.shift());
|
|
28
33
|
}
|
|
29
|
-
})(
|
|
30
|
-
const
|
|
31
|
-
return
|
|
32
|
-
const x =
|
|
33
|
-
var o = this,
|
|
34
|
-
let
|
|
35
|
-
const
|
|
36
|
-
console
|
|
37
|
-
},
|
|
38
|
-
if (this[x(
|
|
39
|
-
if (typeof
|
|
40
|
-
const c =
|
|
41
|
-
|
|
42
|
-
} else
|
|
43
|
-
|
|
44
|
-
let
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
r[x(186)] == x(173) ? s[x(168)](x(135) + (Number(r[x(132)]) || 0) / 2 + x(122) + (Number(r.layoutColumnGap) || 0) / 2 + `mm;
|
|
55
|
-
}
|
|
56
|
-
.hiprint-printTemplate .hiprint-printPanel-small {
|
|
57
|
-
display:inline-block;
|
|
58
|
-
padding: ` + (Number(r[x(132)]) || 0) / 2 + "mm " + (Number(r.layoutColumnGap) || 0) / 2 + x(185)) : s[x(168)](`<style>
|
|
59
|
-
.hiprint-printPanel-small{
|
|
60
|
-
box-sizing: border-box;
|
|
61
|
-
border: 0px;
|
|
62
|
-
}
|
|
63
|
-
.hiprint-printPaper-small{
|
|
64
|
-
position: relative;
|
|
65
|
-
padding: 0;
|
|
66
|
-
}
|
|
67
|
-
.hiprint-printTemplate .hiprint-printPaper{
|
|
68
|
-
display: flex;
|
|
69
|
-
flex-wrap: wrap;
|
|
70
|
-
flex-direction: column;
|
|
71
|
-
align-content: flex-start;
|
|
72
|
-
margin: -` + (Number(r[x(132)]) || 0) / 2 + "mm -" + (Number(r[x(129)]) || 0) / 2 + x(204) + (Number(r[x(132)]) || 0) / 2 + x(157) + (Number(r.layoutColumnGap) || 0) / 2 + x(185));
|
|
73
|
-
for (let p = 0; p < n; p++) {
|
|
74
|
-
const G = globalThis.$(x(152) + t.paperWidth + x(154) + t[x(153)] + x(118)), $ = p * T, U = Math.min((p + 1) * T, y);
|
|
75
|
-
for (let N = $; N < U; N++) {
|
|
76
|
-
const J = l.eq(N)[x(150)]();
|
|
77
|
-
J[x(127)](x(170)), J[x(158)](x(160) + N);
|
|
78
|
-
const L = globalThis.$('<div class="hiprint-printPanel-small"></div>');
|
|
79
|
-
L.append(J), G[x(139)](x(178)).append(L);
|
|
80
|
-
}
|
|
81
|
-
s.append(G);
|
|
82
|
-
}
|
|
83
|
-
this[x(169)](s, f), v[x(145)](s[0]), globalThis.$(s)[x(137)](x(200));
|
|
84
|
-
} else
|
|
85
|
-
this.svg2canvas(g, f), v[x(145)](g[0]), globalThis.$(g)[x(137)](x(200));
|
|
86
|
-
let M = v[x(139)](x(123))[x(174)];
|
|
87
|
-
this.loadAllImages(v, function() {
|
|
34
|
+
})(H, 732272);
|
|
35
|
+
const N = function(a, n, t) {
|
|
36
|
+
return q(this, null, function* () {
|
|
37
|
+
const x = T;
|
|
38
|
+
var o = this, s = globalThis.$[x(336)](), m = !0;
|
|
39
|
+
let d = (h, I) => {
|
|
40
|
+
const p = x, w = Math[p(291)](h / I * 100);
|
|
41
|
+
console[p(307)](p(324), h, p(334), I), console[p(307)](p(328), w + "%");
|
|
42
|
+
}, e = t || {};
|
|
43
|
+
if (this.printPanels[x(322)]) {
|
|
44
|
+
if (typeof n == "string") {
|
|
45
|
+
const c = n[x(330)](x(319)) > -1 ? n : n + x(319);
|
|
46
|
+
e[x(329)] = c;
|
|
47
|
+
} else e = n || {}, !e[x(329)] && (e[x(329)] = "sv-print-" + Date[x(280)]() + x(319));
|
|
48
|
+
const h = this.printPanels[0];
|
|
49
|
+
let I = h.width, p = h[x(297)];
|
|
50
|
+
const w = h[x(313)](), A = e.paperWidth || w.paperWidth, R = e[x(326)] || w.paperHeight, W = A && R;
|
|
51
|
+
var f = globalThis[x(283)].mm[x(311)](A || I), L = globalThis[x(283)].mm.toPt(R || p), b = globalThis.$.extend({ backgroundColor: "#fff" }, e || {});
|
|
52
|
+
const y = this[x(314)][0].paperType, G = y != null && y != "" && y != x(306), F = this[x(296)](0) == 1 || W ? "portrait" : "landscape", J = G && !W ? y[x(312)]() : [f, L];
|
|
53
|
+
var _ = new M({ orientation: F, unit: "pt", format: J }), v = yield this[x(320)](a, e);
|
|
54
|
+
e && (e[x(290)] && (b[x(292)] = e[x(290)], b[x(301)] = e[x(290)]), e.isDownload != null && (m = e[x(318)]), e[x(339)] != null && (d = e[x(339)])), globalThis.$(v)[x(344)](x(293), "")[x(344)](x(297), ""), this[x(310)]();
|
|
55
|
+
var P = this[x(305)]();
|
|
56
|
+
this[x(315)](v, b), P.html(v[0]), globalThis.$(v)[x(344)](x(300));
|
|
57
|
+
let D = P[x(303)](".hiprint-printPanel .hiprint-printPaper")[x(322)];
|
|
58
|
+
this[x(316)](P, function() {
|
|
88
59
|
const c = x;
|
|
89
60
|
try {
|
|
90
|
-
|
|
61
|
+
P.find(c(323))[c(317)](function(g, K) {
|
|
91
62
|
const l = c;
|
|
92
|
-
globalThis[l(
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
const
|
|
96
|
-
var
|
|
97
|
-
|
|
98
|
-
var $ =
|
|
99
|
-
|
|
100
|
-
})[
|
|
101
|
-
const
|
|
102
|
-
throw new Error(
|
|
63
|
+
globalThis[l(283)][l(294)].add(function(k) {
|
|
64
|
+
const r = l;
|
|
65
|
+
E[r(308)](K, b)[r(335)](function(u) {
|
|
66
|
+
const i = r;
|
|
67
|
+
var O = u[i(340)]("2d");
|
|
68
|
+
O[i(327)] = !1;
|
|
69
|
+
var $ = u[i(289)](i(282), b[i(284)] || 0.92);
|
|
70
|
+
_.addImage($, i(321), 0, 0, f, L), g < D - 1 && _[i(287)](), d(g + 1, D), k();
|
|
71
|
+
})[r(288)]((u) => {
|
|
72
|
+
const i = r;
|
|
73
|
+
throw new Error(u[i(299)]);
|
|
103
74
|
});
|
|
104
|
-
}),
|
|
105
|
-
const
|
|
106
|
-
if (
|
|
107
|
-
o[n(202)](), C[n(130)](t[n(182)]);
|
|
75
|
+
}), g == D - 1 && (globalThis[l(283)][l(294)].add(function(k) {
|
|
76
|
+
const r = l;
|
|
77
|
+
if (m) o[r(341)](), _[r(332)](e[r(329)]);
|
|
108
78
|
else {
|
|
109
|
-
o[
|
|
110
|
-
let
|
|
111
|
-
|
|
79
|
+
o[r(341)]();
|
|
80
|
+
let u = e[r(343)] || r(302), i = _.output(u);
|
|
81
|
+
s.resolve(i);
|
|
112
82
|
}
|
|
113
|
-
globalThis.hinnn[
|
|
114
|
-
}), globalThis[l(
|
|
83
|
+
globalThis.hinnn[r(294)][r(325)]();
|
|
84
|
+
}), globalThis[l(283)][l(294)].run());
|
|
115
85
|
});
|
|
116
|
-
} catch (
|
|
117
|
-
console[c(
|
|
86
|
+
} catch (g) {
|
|
87
|
+
console[c(285)](c(304)), console[c(307)](g);
|
|
118
88
|
}
|
|
119
89
|
});
|
|
120
90
|
}
|
|
121
|
-
return
|
|
91
|
+
return s[x(298)]();
|
|
122
92
|
});
|
|
123
93
|
};
|
|
124
|
-
function
|
|
125
|
-
const a =
|
|
126
|
-
return
|
|
127
|
-
return
|
|
128
|
-
},
|
|
129
|
-
}
|
|
130
|
-
function k() {
|
|
131
|
-
const i = ["clone", "6dMscGT", `<div class="hiprint-printPanel">
|
|
132
|
-
<div class="hiprint-printPaper" style="width:`, "paperHeight", "mm;height:", "getTempContainer", "log", "mm ", "addClass", "then", "hiprint-printPaper-small start-", "getOrient", "toPt", "error", "getHtml", "each", "resolve", "type", "append", "svg2canvas", "hiprint-printPaper", "printPanels", "string", "row", "length", "paperWidth", "panelLayoutOptions", "1023631wWoxaT", ".hiprint-printPaper", ".pdf", "getContext", "landscape", "name", "height", "30WptyTU", `mm;
|
|
133
|
-
}
|
|
134
|
-
</style>`, "layoutType", "toPdf percent: ", "toPdf \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ", "1168448GPmBDt", "promise", "queue", "total", "sv-print-", "createTempContainer", "2647114kIxruS", "1428210JcRIkc", "extend", "pixelRatio", "floor", "position:fixed", "261MdYkZK", "removeTempContainer", "clear", `mm;
|
|
135
|
-
}
|
|
136
|
-
.hiprint-printTemplate .hiprint-printPanel-small {
|
|
137
|
-
display:inline-block;
|
|
138
|
-
padding: `, "addImage", "message", `mm;"></div>
|
|
139
|
-
</div>`, "add", "ceil", "catch", "mm -", ".hiprint-printPanel .hiprint-printPaper", "addPage", "indexOf", "imageSmoothingEnabled", "removeClass", "paperType", "layoutColumnGap", "save", "now", "layoutRowGap", "303088jpjeEu", "isDownload", `<style>
|
|
140
|
-
.hiprint-printPanel-small{
|
|
141
|
-
box-sizing: border-box;
|
|
142
|
-
border: 0px;
|
|
143
|
-
}
|
|
144
|
-
.hiprint-printPaper-small{
|
|
145
|
-
position: relative;
|
|
146
|
-
padding: 0;
|
|
147
|
-
}
|
|
148
|
-
.hiprint-printTemplate .hiprint-printPaper{
|
|
149
|
-
margin: -`, "portrait", "css", "2985212aXroAw", "find", "hinnn", "width", "toDataURL", "4722770jKjDwl", "\u81EA\u5B9A\u4E49", "html", '<div class="hiprint-printTemplate"></div>', "toCanvas", "onProgress", "output"];
|
|
150
|
-
return k = function() {
|
|
151
|
-
return i;
|
|
152
|
-
}, k();
|
|
94
|
+
function H() {
|
|
95
|
+
const a = ["toDataURL", "pixelRatio", "floor", "dpr", "width", "queue", "3946ouZolz", "getOrient", "height", "promise", "message", "position:fixed", "scale", "blob", "find", "toPdf 失败(可能您的图片资源无法正常加载): ", "getTempContainer", "自定义", "log", "toCanvas", "18yiqpGm", "createTempContainer", "toPt", "toLocaleLowerCase", "getLayoutSize", "printPanels", "svg2canvas", "loadAllImages", "each", "isDownload", ".pdf", "getHtml", "JPEG", "length", ".hiprint-printPanel .hiprint-printPaper", "cur", "clear", "paperHeight", "imageSmoothingEnabled", "toPdf percent: ", "name", "indexOf", "1281273gYGLca", "save", "708324LMtpOj", "total", "then", "Deferred", "15iWqryt", "2855424nmbAjG", "onProgress", "getContext", "removeTempContainer", "16rRmZWn", "type", "css", "6281095awfIiF", "5831160ywWuuj", "now", "30057698dRvYbm", "image/jpeg", "hinnn", "quality", "error", "236FgluNH", "addPage", "catch"];
|
|
96
|
+
return H = function() {
|
|
97
|
+
return a;
|
|
98
|
+
}, H();
|
|
153
99
|
}
|
|
154
|
-
(function(
|
|
155
|
-
for (var
|
|
100
|
+
(function(a, n) {
|
|
101
|
+
for (var t = j, x = a(); ; )
|
|
156
102
|
try {
|
|
157
|
-
var o = parseInt(
|
|
158
|
-
if (o ===
|
|
159
|
-
break;
|
|
103
|
+
var o = -parseInt(t(152)) / 1 + parseInt(t(158)) / 2 * (parseInt(t(155)) / 3) + parseInt(t(162)) / 4 + parseInt(t(160)) / 5 * (parseInt(t(159)) / 6) + parseInt(t(154)) / 7 + parseInt(t(150)) / 8 + parseInt(t(156)) / 9 * (-parseInt(t(161)) / 10);
|
|
104
|
+
if (o === n) break;
|
|
160
105
|
x.push(x.shift());
|
|
161
|
-
} catch (
|
|
106
|
+
} catch (s) {
|
|
162
107
|
x.push(x.shift());
|
|
163
108
|
}
|
|
164
|
-
})(
|
|
165
|
-
function
|
|
166
|
-
var
|
|
167
|
-
return D = function() {
|
|
168
|
-
return i;
|
|
169
|
-
}, D();
|
|
170
|
-
}
|
|
171
|
-
function j(i, e) {
|
|
172
|
-
var a = D();
|
|
109
|
+
})(C, 962088);
|
|
110
|
+
function j(a, n) {
|
|
111
|
+
var t = C();
|
|
173
112
|
return j = function(x, o) {
|
|
174
|
-
x = x -
|
|
175
|
-
var
|
|
176
|
-
return
|
|
177
|
-
}, j(
|
|
113
|
+
x = x - 149;
|
|
114
|
+
var s = t[x];
|
|
115
|
+
return s;
|
|
116
|
+
}, j(a, n);
|
|
117
|
+
}
|
|
118
|
+
function C() {
|
|
119
|
+
var a = ["defineProperty", "12266BZqKVx", "39924cKCDbi", "395LHKJpt", "33059140QHMajH", "6526700GPwrKA", "add toPdf Api", "4501944fBRyJv", "newPrintTemplate", "1380525oRWpyH", "0.3.0", "9294110NjLFcP", "783HNQJgo", "9SYADty"];
|
|
120
|
+
return C = function() {
|
|
121
|
+
return a;
|
|
122
|
+
}, C();
|
|
178
123
|
}
|
|
179
|
-
function
|
|
180
|
-
var
|
|
181
|
-
return { name:
|
|
182
|
-
var o =
|
|
183
|
-
Object[o(
|
|
184
|
-
} }], leastHiprintVersion:
|
|
124
|
+
function z(a) {
|
|
125
|
+
var n = j;
|
|
126
|
+
return { name: n(149), description: n(149), hooks: [{ hook: n(151), name: "add toPdf Api to PrintTemplate", description: "add toPdf Api to PrintTemplate", priority: 1, run: ({ template: t, options: x }) => {
|
|
127
|
+
var o = n;
|
|
128
|
+
Object[o(157)](t, "toPdf", { value: N, enumerable: !1, writable: !0, configurable: !0 });
|
|
129
|
+
} }], leastHiprintVersion: n(153) };
|
|
185
130
|
}
|
|
186
131
|
export {
|
|
187
|
-
|
|
132
|
+
z as default
|
|
188
133
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1,37 +1 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
}
|
|
3
|
-
.hiprint-printTemplate .hiprint-printPanel-small {
|
|
4
|
-
display:inline-block;
|
|
5
|
-
padding: `+(Number(r[x(132)])||0)/2+"mm "+(Number(r.layoutColumnGap)||0)/2+x(185)):p[x(168)](`<style>
|
|
6
|
-
.hiprint-printPanel-small{
|
|
7
|
-
box-sizing: border-box;
|
|
8
|
-
border: 0px;
|
|
9
|
-
}
|
|
10
|
-
.hiprint-printPaper-small{
|
|
11
|
-
position: relative;
|
|
12
|
-
padding: 0;
|
|
13
|
-
}
|
|
14
|
-
.hiprint-printTemplate .hiprint-printPaper{
|
|
15
|
-
display: flex;
|
|
16
|
-
flex-wrap: wrap;
|
|
17
|
-
flex-direction: column;
|
|
18
|
-
align-content: flex-start;
|
|
19
|
-
margin: -`+(Number(r[x(132)])||0)/2+"mm -"+(Number(r[x(129)])||0)/2+x(204)+(Number(r[x(132)])||0)/2+x(157)+(Number(r.layoutColumnGap)||0)/2+x(185));for(let o=0;o<i;o++){const D=globalThis.$(x(152)+t.paperWidth+x(154)+t[x(153)]+x(118)),q=o*j,E=Math.min((o+1)*j,N);for(let M=q;M<E;M++){const A=s.eq(M)[x(150)]();A[x(127)](x(170)),A[x(158)](x(160)+M);const U=globalThis.$('<div class="hiprint-printPanel-small"></div>');U.append(A),D[x(139)](x(178)).append(U)}p.append(D)}this[x(169)](p,T),w[x(145)](p[0]),globalThis.$(p)[x(137)](x(200))}else this.svg2canvas(I,T),w[x(145)](I[0]),globalThis.$(I)[x(137)](x(200));let $=w[x(139)](x(123))[x(174)];this.loadAllImages(w,function(){const c=x;try{w[c(139)](c(123))[c(165)](function(f,j){const s=c;globalThis[s(140)][s(191)][s(119)](function(N){const i=s;d.snapdom[i(147)](j,T)[i(159)](function(p){const o=i;var D=p[o(180)]("2d");D[o(126)]=![];var q=p[o(142)]("image/jpeg",T.quality||.92);k[o(205)](q,"JPEG",0,0,O,R),f<$-1&&k[o(124)](),L(f+1,$),N()})[i(121)](p=>{const o=i;throw new Error(p[o(206)])})}),f==$-1&&(globalThis[s(140)][s(191)][s(119)](function(N){const i=s;if(J)l[i(202)](),k[i(130)](t[i(182)]);else{l[i(202)]();let p=t[i(167)]||"blob",o=k[i(149)](p);_[i(166)](o)}globalThis.hinnn[i(191)][i(203)]()}),globalThis[s(140)].queue.run())})}catch(f){console[c(163)](c(188)),console[c(156)](f)}})}return _[x(190)]()})};function m(n,e){const a=u();return m=function(x,l){return x=x-118,a[x]},m(n,e)}function u(){const n=["clone","6dMscGT",`<div class="hiprint-printPanel">
|
|
20
|
-
<div class="hiprint-printPaper" style="width:`,"paperHeight","mm;height:","getTempContainer","log","mm ","addClass","then","hiprint-printPaper-small start-","getOrient","toPt","error","getHtml","each","resolve","type","append","svg2canvas","hiprint-printPaper","printPanels","string","row","length","paperWidth","panelLayoutOptions","1023631wWoxaT",".hiprint-printPaper",".pdf","getContext","landscape","name","height","30WptyTU",`mm;
|
|
21
|
-
}
|
|
22
|
-
</style>`,"layoutType","toPdf percent: ","toPdf \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ","1168448GPmBDt","promise","queue","total","sv-print-","createTempContainer","2647114kIxruS","1428210JcRIkc","extend","pixelRatio","floor","position:fixed","261MdYkZK","removeTempContainer","clear",`mm;
|
|
23
|
-
}
|
|
24
|
-
.hiprint-printTemplate .hiprint-printPanel-small {
|
|
25
|
-
display:inline-block;
|
|
26
|
-
padding: `,"addImage","message",`mm;"></div>
|
|
27
|
-
</div>`,"add","ceil","catch","mm -",".hiprint-printPanel .hiprint-printPaper","addPage","indexOf","imageSmoothingEnabled","removeClass","paperType","layoutColumnGap","save","now","layoutRowGap","303088jpjeEu","isDownload",`<style>
|
|
28
|
-
.hiprint-printPanel-small{
|
|
29
|
-
box-sizing: border-box;
|
|
30
|
-
border: 0px;
|
|
31
|
-
}
|
|
32
|
-
.hiprint-printPaper-small{
|
|
33
|
-
position: relative;
|
|
34
|
-
padding: 0;
|
|
35
|
-
}
|
|
36
|
-
.hiprint-printTemplate .hiprint-printPaper{
|
|
37
|
-
margin: -`,"portrait","css","2985212aXroAw","find","hinnn","width","toDataURL","4722770jKjDwl","\u81EA\u5B9A\u4E49","html",'<div class="hiprint-printTemplate"></div>',"toCanvas","onProgress","output"];return u=function(){return n},u()}(function(n,e){for(var a=P,x=n();[];)try{var l=parseInt(a(285))/1*(-parseInt(a(271))/2)+-parseInt(a(278))/3*(-parseInt(a(274))/4)+parseInt(a(276))/5*(-parseInt(a(270))/6)+-parseInt(a(269))/7*(parseInt(a(281))/8)+parseInt(a(286))/9+-parseInt(a(282))/10+-parseInt(a(279))/11*(-parseInt(a(272))/12);if(l===e)break;x.push(x.shift())}catch(_){x.push(x.shift())}})(v,888198);function v(){var n=["defineProperty","add toPdf Api to PrintTemplate","2723IGOXJN","8021799kZgTqd","101689obIHjr","195666UJaNvt","530sNXPXd","29986056hlVKwJ","0.3.0","2852356gBcZAa","newPrintTemplate","30pJdmwU","toPdf","6DDlCVP","11vOMLVp","add toPdf Api","808UNSBJG","15436410LeGBkC"];return v=function(){return n},v()}function P(n,e){var a=v();return P=function(x,l){x=x-269;var _=a[x];return _},P(n,e)}function y(n){var e=P;return{name:"add toPdf Api",description:e(280),hooks:[{hook:e(275),name:e(284),description:e(284),priority:1,run:({template:a,options:x})=>{var l=e;Object[l(283)](a,l(277),{value:g,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:e(273)}}return y});
|
|
1
|
+
(function(s,f){typeof exports=="object"&&typeof module!="undefined"?module.exports=f(require("@zumer/snapdom"),require("jspdf")):typeof define=="function"&&define.amd?define(["@zumer/snapdom","jspdf"],f):(s=typeof globalThis!="undefined"?globalThis:s||self,s.pluginApiPdf=f(s.window,s.jspdf))})(this,function(s,f){"use strict";var J=(s,f,p)=>new Promise((C,u)=>{var h=n=>{try{P(p.next(n))}catch(e){u(e)}},b=n=>{try{P(p.throw(n))}catch(e){u(e)}},P=n=>n.done?C(n.value):Promise.resolve(n.value).then(h,b);P((p=p.apply(s,f)).next())});function p(n,e){const x=u();return p=function(t,o){return t=t-279,x[t]},p(n,e)}(function(n,e){const x=p,t=n();for(;;)try{if(-parseInt(x(286))/1*(-parseInt(x(295))/2)+parseInt(x(337))/3*(-parseInt(x(333))/4)+-parseInt(x(345))/5+parseInt(x(338))/6+parseInt(x(331))/7*(parseInt(x(342))/8)+-parseInt(x(309))/9*(parseInt(x(279))/10)+parseInt(x(281))/11===e)break;t.push(t.shift())}catch(o){t.push(t.shift())}})(u,732272);const C=function(n,e,x){return J(this,null,function*(){const t=p;var o=this,m=globalThis.$[t(336)](),L=!0;let q=(g,j)=>{const c=t,H=Math[c(291)](g/j*100);console[c(307)](c(324),g,c(334),j),console[c(307)](c(328),H+"%")},a=x||{};if(this.printPanels[t(322)]){if(typeof e=="string"){const d=e[t(330)](t(319))>-1?e:e+t(319);a[t(329)]=d}else a=e||{},!a[t(329)]&&(a[t(329)]="sv-print-"+Date[t(280)]()+t(319));const g=this.printPanels[0];let j=g.width,c=g[t(297)];const H=g[t(313)](),k=a.paperWidth||H.paperWidth,G=a[t(326)]||H.paperHeight,z=k&&G;var R=globalThis[t(283)].mm[t(311)](k||j),W=globalThis[t(283)].mm.toPt(G||c),v=globalThis.$.extend({backgroundColor:"#fff"},a||{});const A=this[t(314)][0].paperType,K=A!=null&&A!=""&&A!=t(306),O=this[t(296)](0)==1||z?"portrait":"landscape",$=K&&!z?A[t(312)]():[R,W];var w=new f.jsPDF({orientation:O,unit:"pt",format:$}),y=yield this[t(320)](n,a);a&&(a[t(290)]&&(v[t(292)]=a[t(290)],v[t(301)]=a[t(290)]),a.isDownload!=null&&(L=a[t(318)]),a[t(339)]!=null&&(q=a[t(339)])),globalThis.$(y)[t(344)](t(293),"")[t(344)](t(297),""),this[t(310)]();var T=this[t(305)]();this[t(315)](y,v),T.html(y[0]),globalThis.$(y)[t(344)](t(300));let D=T[t(303)](".hiprint-printPanel .hiprint-printPaper")[t(322)];this[t(316)](T,function(){const d=t;try{T.find(d(323))[d(317)](function(I,E){const l=d;globalThis[l(283)][l(294)].add(function(F){const i=l;s.snapdom[i(308)](E,v)[i(335)](function(_){const r=i;var M=_[r(340)]("2d");M[r(327)]=!1;var N=_[r(289)](r(282),v[r(284)]||.92);w.addImage(N,r(321),0,0,R,W),I<D-1&&w[r(287)](),q(I+1,D),F()})[i(288)](_=>{const r=i;throw new Error(_[r(299)])})}),I==D-1&&(globalThis[l(283)][l(294)].add(function(F){const i=l;if(L)o[i(341)](),w[i(332)](a[i(329)]);else{o[i(341)]();let _=a[i(343)]||i(302),r=w.output(_);m.resolve(r)}globalThis.hinnn[i(294)][i(325)]()}),globalThis[l(283)][l(294)].run())})}catch(I){console[d(285)](d(304)),console[d(307)](I)}})}return m[t(298)]()})};function u(){const n=["toDataURL","pixelRatio","floor","dpr","width","queue","3946ouZolz","getOrient","height","promise","message","position:fixed","scale","blob","find","toPdf 失败(可能您的图片资源无法正常加载): ","getTempContainer","自定义","log","toCanvas","18yiqpGm","createTempContainer","toPt","toLocaleLowerCase","getLayoutSize","printPanels","svg2canvas","loadAllImages","each","isDownload",".pdf","getHtml","JPEG","length",".hiprint-printPanel .hiprint-printPaper","cur","clear","paperHeight","imageSmoothingEnabled","toPdf percent: ","name","indexOf","1281273gYGLca","save","708324LMtpOj","total","then","Deferred","15iWqryt","2855424nmbAjG","onProgress","getContext","removeTempContainer","16rRmZWn","type","css","6281095awfIiF","5831160ywWuuj","now","30057698dRvYbm","image/jpeg","hinnn","quality","error","236FgluNH","addPage","catch"];return u=function(){return n},u()}(function(n,e){for(var x=h,t=n();;)try{var o=-parseInt(x(152))/1+parseInt(x(158))/2*(parseInt(x(155))/3)+parseInt(x(162))/4+parseInt(x(160))/5*(parseInt(x(159))/6)+parseInt(x(154))/7+parseInt(x(150))/8+parseInt(x(156))/9*(-parseInt(x(161))/10);if(o===e)break;t.push(t.shift())}catch(m){t.push(t.shift())}})(b,962088);function h(n,e){var x=b();return h=function(t,o){t=t-149;var m=x[t];return m},h(n,e)}function b(){var n=["defineProperty","12266BZqKVx","39924cKCDbi","395LHKJpt","33059140QHMajH","6526700GPwrKA","add toPdf Api","4501944fBRyJv","newPrintTemplate","1380525oRWpyH","0.3.0","9294110NjLFcP","783HNQJgo","9SYADty"];return b=function(){return n},b()}function P(n){var e=h;return{name:e(149),description:e(149),hooks:[{hook:e(151),name:"add toPdf Api to PrintTemplate",description:"add toPdf Api to PrintTemplate",priority:1,run:({template:x,options:t})=>{var o=e;Object[o(157)](x,"toPdf",{value:C,enumerable:!1,writable:!0,configurable:!0})}}],leastHiprintVersion:e(153)}}return P});
|