@sv-print/plugin-api-image 0.1.6 → 0.2.1
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 +14 -18
- package/dist/index.mjs +142 -149
- package/dist/index.umd.js +14 -18
- package/package.json +5 -6
package/dist/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var O=(o,e,x)=>new Promise((t,l)=>{var _=i=>{try{y(x.next(i))}catch(d){l(d)}},f=i=>{try{y(x.throw(i))}catch(d){l(d)}},y=i=>i.done?t(i.value):Promise.resolve(i.value).then(_,f);y((x=x.apply(o,e)).next())});const B=require("@zumer/snapdom");function M(o,e){const x=W();return M=function(t,l){return t=t-396,x[t]},M(o,e)}function W(){const o=["519496OYVHjR","download","total","row","panelLayoutOptions",".hiprint-printPaper","split","printPanels","url","getTempContainer","mm ","12xwNwgn","add","src","href","toCanvas","3hSbbRm","pixelRatio",`mm;
|
|
2
2
|
}
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
.hiprint-printTemplate .hiprint-printPanel-small {
|
|
4
|
+
display:inline-block;
|
|
5
|
+
padding: `,".jpg","imageSmoothingEnabled","height","devicePixelRatio","224830UVVmnU","toImage percent: ","display","find",`mm;
|
|
6
|
+
}
|
|
7
|
+
</style>`,"createTempContainer",`<div class="hiprint-printPanel">
|
|
8
|
+
<div class="hiprint-printPaper" style="width:`,"style","position:fixed","ceil","toType",`<style>
|
|
5
9
|
.hiprint-printPanel-small{
|
|
6
10
|
box-sizing: border-box;
|
|
7
11
|
border: 0px;
|
|
@@ -11,15 +15,11 @@
|
|
|
11
15
|
padding: 0;
|
|
12
16
|
}
|
|
13
17
|
.hiprint-printTemplate .hiprint-printPaper{
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
.hiprint-printTemplate .hiprint-printPanel-small {
|
|
21
|
-
display:inline-block;
|
|
22
|
-
padding: `+(Number(c[x(134)])||0)/2+"mm "+(Number(c.layoutColumnGap)||0)/2+x(184)):I[x(158)](`<style>
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-wrap: wrap;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
align-content: flex-start;
|
|
22
|
+
margin: -`,"7312329NdMtzj","dpr","html","pop","clone","limit","toDataURL","resolve","143tAVkhe","remove","css","click","addClass","length","image/jpeg","removeTempContainer","hinnn","blob","svg2canvas","append","layoutType","mm;height:","error","133055WUqvIp","end","isDownload","getContext","min","toImage \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ","name","replace","body","layoutRowGap","onload",".hiprint-printPanel","quality","1727644XyJEVd","hiprint-printPaper-small start-","3358922mzoRlj","mm -","clearRect","231706BJrlBQ","queue","drawImage","removeClass","loadAllImages",".hiprint-printPanel .hiprint-printPaper","push","createElement","promise","1FEeAYo","log","paperWidth","clear","floor","layoutColumnGap","width","paperHeight","hiprint-printPaper","setAttribute","onProgress"];return W=function(){return o},W()}(function(o,e){const x=M,t=o();for(;[];)try{if(parseInt(x(402))/1*(parseInt(x(489))/2)+-parseInt(x(429))/3*(parseInt(x(484))/4)+-parseInt(x(471))/5*(-parseInt(x(424))/6)+-parseInt(x(486))/7+parseInt(x(413))/8+parseInt(x(448))/9+-parseInt(x(436))/10*(-parseInt(x(456))/11)===e)break;t.push(t.shift())}catch(l){t.push(t.shift())}})(W,427015);const L=function(o,e){return O(this,null,function*(){const x=M;let t=this,l=globalThis.$.Deferred(),_=!![],f=10,y=(i,d)=>{const m=M,G=Math.floor(i/d*100);console[m(403)]("cur",i,m(415),d),console.log(m(437),G+"%")};if(this[x(420)].length){let i=globalThis.$.extend({},e||{}),d=yield this.getHtml(o,e);e&&(e[x(430)]&&(i[x(449)]=e[x(430)],i.scale=e.pixelRatio),e[x(473)]!=null&&(_=e[x(473)]),e.onProgress!=null&&(y=e[x(412)]),e[x(453)]!=null&&(f=e[x(453)])),globalThis.$(d)[x(458)](x(408),"")[x(458)](x(434),""),this[x(441)]();let m=this[x(422)](),G=this[x(420)][0][x(408)],Q=this.printPanels[0].height;const p=this.printPanels[0][x(417)];if(p&&(p[x(480)]>0||p[x(407)]>0)&&e[x(404)]&&e[x(409)]){let a=Math[x(406)](e.paperWidth/(G+p[x(480)]/2)),u=Math[x(406)](e[x(409)]/(Q+p[x(407)]/2));const w=a*u,A=d[x(439)](x(398)),s=A.length,j=Math[x(445)](s/w);let v=globalThis.$('<div class="hiprint-printTemplate"></div>');p[x(468)]==x(416)?v[x(467)](`<style>
|
|
23
23
|
.hiprint-printPanel-small{
|
|
24
24
|
box-sizing: border-box;
|
|
25
25
|
border: 0px;
|
|
@@ -29,9 +29,5 @@
|
|
|
29
29
|
padding: 0;
|
|
30
30
|
}
|
|
31
31
|
.hiprint-printTemplate .hiprint-printPaper{
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
flex-direction: column;
|
|
35
|
-
align-content: flex-start;
|
|
36
|
-
margin: -`+(Number(c.layoutRowGap)||0)/2+"mm -"+(Number(c[x(183)])||0)/2+x(173)+(Number(c[x(134)])||0)/2+x(227)+(Number(c.layoutColumnGap)||0)/2+x(184));for(let P=0;P<q;P++){const g=globalThis.$(`<div class="hiprint-printPanel">
|
|
37
|
-
<div class="hiprint-printPaper" style="width:`+e[x(225)]+x(152)+e.paperHeight+x(125)),k=P*C,M=Math[x(224)]((P+1)*C,b);for(let v=k;v<M;v++){const u=E.eq(v)[x(228)]();u[x(215)]("hiprint-printPaper"),u.addClass("hiprint-printPaper-small start-"+v);const l=globalThis.$(x(137));l.append(u),g[x(237)](x(203))[x(158)](l)}I.append(g)}this[x(154)](I,o),m[x(160)](I[0])}else this.svg2canvas(d,o),m[x(160)](d[0]);let B=m[x(237)](x(236))[x(159)];globalThis.$(d)[x(222)](x(229)),this.loadAllImages(d,function(){const t=x;try{let a=[],C=Math[t(233)](B/f),E=B%f||1;const b=document[t(205)](t(126)),q=b[t(200)]("2d"),I=m[t(237)](t(155)).eq(0).width(),P=I*(o[t(232)]||globalThis[t(206)]);for(let g=0;g<C;g++){q[t(231)](0,0,b[t(140)],b[t(217)]);const k=g==C-1;let M=0,v=k?E:f;for(let u=0;u<v;u++){q[t(231)](0,0,b.width,b[t(217)]);const l=g*f+u,j=m[t(237)](".hiprint-printPanel .hiprint-printPaper")[l];globalThis[t(129)].queue.add(function(R){const N=t;F.toCanvas(j,o)[N(199)](function(w){const p=N;let y=w.getContext("2d");y.imageSmoothingEnabled=![];let A=w.toDataURL(p(157),o[p(223)]||.92),i=new Image;i[p(135)]=A,i[p(149)]=function(){const h=p;u===0&&(b[h(140)]=P,b[h(217)]=i[h(217)]*v),M+=i[h(217)],q[h(172)](i,0,M-i[h(217)],P,i.height),T(l+1,B),R()}})})}globalThis[t(129)][t(168)][t(230)](function(u){const l=t;let j=o[l(213)]||l(157),R=o.toType||"url",N=o.quality||.8;if(_){let w=b[l(169)](j,N),p=new Image;p[l(135)]=w,p[l(149)]=function(){const y=l;a.push({url:w,start:g*f+1,end:g*f+v}),k&&(globalThis[y(129)][y(168)][y(191)](),n[y(166)](),a[y(146)](A=>{const i=y;let h=document.createElement("a"),O=e.name||i(198);O[i(142)](".")==-1&&(O+=".jpg");let L=O[i(179)](".").pop(),S=O[i(240)]("."+L,"")+"_"+A[i(197)]+"-"+A[i(234)]+"."+L;h[i(144)][i(196)]=i(164),h[i(132)](i(127),S),h[i(132)](i(208),A[i(218)]),document[i(211)][i(170)](h),h[i(128)](),h[i(193)]()})),u()};return}if(R==l(218)){a[l(180)](b[l(169)](j,N)),k&&(globalThis.hinnn.queue.clear(),n[l(166)](),s.resolve(a)),u();return}R==l(171)&&b[l(143)](function(w){const p=l;a[p(180)](w),k&&(globalThis[p(129)][p(168)][p(191)](),n[p(166)](),s[p(150)](a)),u()},j,N)})}globalThis[t(129)].queue[t(165)]()}catch(a){console[t(186)](t(139)),console[t(177)](a)}})}return s[x(185)]()})};function V(r,e){var x=D();return V=function(n,s){n=n-439;var _=x[n];return _},V(r,e)}(function(r,e){for(var x=V,n=r();[];)try{var s=-parseInt(x(449))/1+-parseInt(x(450))/2+-parseInt(x(441))/3*(-parseInt(x(451))/4)+-parseInt(x(440))/5+-parseInt(x(448))/6+-parseInt(x(445))/7*(parseInt(x(444))/8)+parseInt(x(452))/9;if(s===e)break;n.push(n.shift())}catch(_){n.push(n.shift())}})(D,672242);function D(){var r=["toImage","newPrintTemplate","5735748wEEXNA","866176wrVrBA","2662854EUUogl","124DeyVZy","40837464ixUXSs","defineProperty","add toImage Api to PrintTemplate","478835hEHDBX","53187kqUhVY","0.3.0","add toImage Api","40AVZCZk","1631735VNBrko"];return D=function(){return r},D()}function W(r){var e=V;return{name:e(443),description:e(443),hooks:[{hook:e(447),name:e(439),description:e(439),priority:1,run:({template:x,options:n})=>{var s=e;Object[s(453)](x,s(446),{value:J,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:e(442)}}module.exports=W;
|
|
32
|
+
margin: -`+(Number(p[x(480)])||0)/2+x(487)+(Number(p.layoutColumnGap)||0)/2+x(431)+(Number(p.layoutRowGap)||0)/2+x(423)+(Number(p[x(407)])||0)/2+x(440)):v.append(x(447)+(Number(p[x(480)])||0)/2+x(487)+(Number(p[x(407)])||0)/2+x(431)+(Number(p[x(480)])||0)/2+x(423)+(Number(p.layoutColumnGap)||0)/2+x(440));for(let T=0;T<j;T++){const g=globalThis.$(x(442)+e.paperWidth+x(469)+e[x(409)]+`mm;"></div>
|
|
33
|
+
</div>`),C=T*w,k=Math[x(475)]((T+1)*w,s);for(let I=C;I<k;I++){const h=A.eq(I)[x(452)]();h[x(396)](x(410)),h[x(460)](x(485)+I);const r=globalThis.$('<div class="hiprint-printPanel-small"></div>');r.append(h),g[x(439)](x(418))[x(467)](r)}v[x(467)](g)}this[x(466)](v,i),m[x(450)](v[0])}else this[x(466)](d,i),m[x(450)](d[0]);let U=m[x(439)](x(398))[x(461)];globalThis.$(d)[x(458)](x(444)),this[x(397)](m,function(){const a=x;try{let u=[],w=Math[a(445)](U/f),A=U%f||1;const s=document.createElement("canvas"),j=s[a(474)]("2d"),v=m[a(439)](a(482)).eq(0)[a(408)](),T=v*(i.pixelRatio||globalThis[a(435)]);for(let g=0;g<w;g++){j[a(488)](0,0,s[a(408)],s[a(434)]);const C=g==w-1;let k=0,I=C?A:f;for(let h=0;h<I;h++){j[a(488)](0,0,s[a(408)],s[a(434)]);const r=g*f+h,q=m[a(439)](a(398))[r];globalThis.hinnn.queue[a(425)](function(E){const R=a;B.snapdom[R(428)](q,i).then(function(P){const c=R;let N=P[c(474)]("2d");N[c(433)]=![];let V=P.toDataURL(c(462),i[c(483)]||.92),n=new Image;n.src=V,n.onload=function(){const b=c;h===0&&(s[b(408)]=T,s.height=n.height*I),k+=n[b(434)],j[b(491)](n,0,k-n[b(434)],T,n.height),y(r+1,U),E()}})})}globalThis[a(464)].queue[a(425)](function(h){const r=a;let q=i.type||r(462),E=i[r(446)]||r(421),R=i[r(483)]||.8;if(_){let P=s[r(454)](q,R),c=new Image;c[r(426)]=P,c[r(481)]=function(){const N=r;u[N(399)]({url:P,start:g*f+1,end:g*f+I}),C&&(globalThis[N(464)].queue[N(405)](),t.removeTempContainer(),u.forEach(V=>{const n=N;let b=document[n(400)]("a"),H=e[n(477)]||"download.jpg";H.indexOf(".")==-1&&(H+=n(432));let D=H[n(419)](".")[n(451)](),Y=H[n(478)]("."+D,"")+"_"+V.start+"-"+V[n(472)]+"."+D;b[n(443)][n(438)]="none",b[n(411)](n(414),Y),b[n(411)](n(427),V.url),document[n(479)].appendChild(b),b[n(459)](),b[n(457)]()})),h()};return}if(E=="url"){u[r(399)](s[r(454)](q,R)),C&&(globalThis.hinnn[r(490)][r(405)](),t.removeTempContainer(),l[r(455)](u)),h();return}E==r(465)&&s.toBlob(function(P){const c=r;u.push(P),C&&(globalThis[c(464)].queue[c(405)](),t[c(463)](),l[c(455)](u)),h()},q,R)})}globalThis[a(464)][a(490)].run()}catch(u){console[a(470)](a(476)),console[a(403)](u)}})}return l[x(401)]()})};(function(o,e){for(var x=$,t=o();[];)try{var l=parseInt(x(485))/1*(-parseInt(x(494))/2)+parseInt(x(491))/3*(-parseInt(x(489))/4)+parseInt(x(483))/5*(parseInt(x(497))/6)+parseInt(x(498))/7*(-parseInt(x(496))/8)+-parseInt(x(493))/9*(parseInt(x(495))/10)+parseInt(x(490))/11+parseInt(x(499))/12;if(l===e)break;t.push(t.shift())}catch(_){t.push(t.shift())}})(z,580570);function $(o,e){var x=z();return $=function(t,l){t=t-483;var _=x[t];return _},$(o,e)}function z(){var o=["0.3.0","toImage","add toImage Api","24iQPRdW","11007271hbTDlo","49947UjjxFt","newPrintTemplate","387QTsgPi","2zygCvZ","265770eQobHQ","29112lgPHhd","6MHaTrY","595KCNjGO","9154260WVvglp","3678655sWyMtE","add toImage Api to PrintTemplate","366657VdPVVY"];return z=function(){return o},z()}function F(o){var e=$;return{name:"add toImage Api",description:e(488),hooks:[{hook:e(492),name:"add toImage Api to PrintTemplate",description:e(484),priority:1,run:({template:x,options:t})=>{var l=e;Object.defineProperty(x,l(487),{value:L,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:e(486)}}module.exports=F;
|
package/dist/index.mjs
CHANGED
|
@@ -1,42 +1,35 @@
|
|
|
1
|
-
var
|
|
2
|
-
var _ = (
|
|
1
|
+
var O = (o, e, x) => new Promise((t, l) => {
|
|
2
|
+
var _ = (i) => {
|
|
3
3
|
try {
|
|
4
|
-
|
|
4
|
+
y(x.next(i));
|
|
5
5
|
} catch (d) {
|
|
6
|
-
|
|
6
|
+
l(d);
|
|
7
7
|
}
|
|
8
|
-
}, f = (
|
|
8
|
+
}, f = (i) => {
|
|
9
9
|
try {
|
|
10
|
-
|
|
10
|
+
y(x.throw(i));
|
|
11
11
|
} catch (d) {
|
|
12
|
-
|
|
12
|
+
l(d);
|
|
13
13
|
}
|
|
14
|
-
},
|
|
15
|
-
|
|
14
|
+
}, y = (i) => i.done ? t(i.value) : Promise.resolve(i.value).then(_, f);
|
|
15
|
+
y((x = x.apply(o, e)).next());
|
|
16
16
|
});
|
|
17
|
-
import
|
|
18
|
-
|
|
19
|
-
const x =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
break;
|
|
24
|
-
i.push(i.shift());
|
|
25
|
-
} catch (p) {
|
|
26
|
-
i.push(i.shift());
|
|
27
|
-
}
|
|
28
|
-
})($, 530777);
|
|
29
|
-
function V(l, a) {
|
|
30
|
-
const x = $();
|
|
31
|
-
return V = function(i, p) {
|
|
32
|
-
return i = i - 125, x[i];
|
|
33
|
-
}, V(l, a);
|
|
17
|
+
import { snapdom as B } from "@zumer/snapdom";
|
|
18
|
+
function M(o, e) {
|
|
19
|
+
const x = W();
|
|
20
|
+
return M = function(t, l) {
|
|
21
|
+
return t = t - 396, x[t];
|
|
22
|
+
}, M(o, e);
|
|
34
23
|
}
|
|
35
|
-
function
|
|
36
|
-
const
|
|
24
|
+
function W() {
|
|
25
|
+
const o = ["519496OYVHjR", "download", "total", "row", "panelLayoutOptions", ".hiprint-printPaper", "split", "printPanels", "url", "getTempContainer", "mm ", "12xwNwgn", "add", "src", "href", "toCanvas", "3hSbbRm", "pixelRatio", `mm;
|
|
37
26
|
}
|
|
38
|
-
|
|
39
|
-
|
|
27
|
+
.hiprint-printTemplate .hiprint-printPanel-small {
|
|
28
|
+
display:inline-block;
|
|
29
|
+
padding: `, ".jpg", "imageSmoothingEnabled", "height", "devicePixelRatio", "224830UVVmnU", "toImage percent: ", "display", "find", `mm;
|
|
30
|
+
}
|
|
31
|
+
</style>`, "createTempContainer", `<div class="hiprint-printPanel">
|
|
32
|
+
<div class="hiprint-printPaper" style="width:`, "style", "position:fixed", "ceil", "toType", `<style>
|
|
40
33
|
.hiprint-printPanel-small{
|
|
41
34
|
box-sizing: border-box;
|
|
42
35
|
border: 0px;
|
|
@@ -46,39 +39,43 @@ function $() {
|
|
|
46
39
|
padding: 0;
|
|
47
40
|
}
|
|
48
41
|
.hiprint-printTemplate .hiprint-printPaper{
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return
|
|
55
|
-
return
|
|
56
|
-
},
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-wrap: wrap;
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
align-content: flex-start;
|
|
46
|
+
margin: -`, "7312329NdMtzj", "dpr", "html", "pop", "clone", "limit", "toDataURL", "resolve", "143tAVkhe", "remove", "css", "click", "addClass", "length", "image/jpeg", "removeTempContainer", "hinnn", "blob", "svg2canvas", "append", "layoutType", "mm;height:", "error", "133055WUqvIp", "end", "isDownload", "getContext", "min", "toImage \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ", "name", "replace", "body", "layoutRowGap", "onload", ".hiprint-printPanel", "quality", "1727644XyJEVd", "hiprint-printPaper-small start-", "3358922mzoRlj", "mm -", "clearRect", "231706BJrlBQ", "queue", "drawImage", "removeClass", "loadAllImages", ".hiprint-printPanel .hiprint-printPaper", "push", "createElement", "promise", "1FEeAYo", "log", "paperWidth", "clear", "floor", "layoutColumnGap", "width", "paperHeight", "hiprint-printPaper", "setAttribute", "onProgress"];
|
|
47
|
+
return W = function() {
|
|
48
|
+
return o;
|
|
49
|
+
}, W();
|
|
57
50
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
51
|
+
(function(o, e) {
|
|
52
|
+
const x = M, t = o();
|
|
53
|
+
for (; []; )
|
|
54
|
+
try {
|
|
55
|
+
if (parseInt(x(402)) / 1 * (parseInt(x(489)) / 2) + -parseInt(x(429)) / 3 * (parseInt(x(484)) / 4) + -parseInt(x(471)) / 5 * (-parseInt(x(424)) / 6) + -parseInt(x(486)) / 7 + parseInt(x(413)) / 8 + parseInt(x(448)) / 9 + -parseInt(x(436)) / 10 * (-parseInt(x(456)) / 11) === e)
|
|
56
|
+
break;
|
|
57
|
+
t.push(t.shift());
|
|
58
|
+
} catch (l) {
|
|
59
|
+
t.push(t.shift());
|
|
60
|
+
}
|
|
61
|
+
})(W, 427015);
|
|
62
|
+
const L = function(o, e) {
|
|
63
|
+
return O(this, null, function* () {
|
|
64
|
+
const x = M;
|
|
65
|
+
let t = this, l = globalThis.$.Deferred(), _ = !![], f = 10, y = (i, d) => {
|
|
66
|
+
const m = M, U = Math.floor(i / d * 100);
|
|
67
|
+
console[m(403)]("cur", i, m(415), d), console.log(m(437), U + "%");
|
|
64
68
|
};
|
|
65
|
-
if (this.
|
|
66
|
-
let
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const C = e * t, R = d[x(237)](x(236)), b = R.length, q = Math[x(233)](b / C);
|
|
76
|
-
let I = globalThis.$(x(192));
|
|
77
|
-
c[x(145)] == x(162) ? I[x(158)](x(148) + (Number(c[x(134)]) || 0) / 2 + x(190) + (Number(c[x(183)]) || 0) / 2 + `mm;
|
|
78
|
-
}
|
|
79
|
-
.hiprint-printTemplate .hiprint-printPanel-small {
|
|
80
|
-
display:inline-block;
|
|
81
|
-
padding: ` + (Number(c[x(134)]) || 0) / 2 + "mm " + (Number(c.layoutColumnGap) || 0) / 2 + x(184)) : I[x(158)](`<style>
|
|
69
|
+
if (this[x(420)].length) {
|
|
70
|
+
let i = globalThis.$.extend({}, e || {}), d = yield this.getHtml(o, e);
|
|
71
|
+
e && (e[x(430)] && (i[x(449)] = e[x(430)], i.scale = e.pixelRatio), e[x(473)] != null && (_ = e[x(473)]), e.onProgress != null && (y = e[x(412)]), e[x(453)] != null && (f = e[x(453)])), globalThis.$(d)[x(458)](x(408), "")[x(458)](x(434), ""), this[x(441)]();
|
|
72
|
+
let m = this[x(422)](), U = this[x(420)][0][x(408)], Q = this.printPanels[0].height;
|
|
73
|
+
const p = this.printPanels[0][x(417)];
|
|
74
|
+
if (p && (p[x(480)] > 0 || p[x(407)] > 0) && e[x(404)] && e[x(409)]) {
|
|
75
|
+
let a = Math[x(406)](e.paperWidth / (U + p[x(480)] / 2)), u = Math[x(406)](e[x(409)] / (Q + p[x(407)] / 2));
|
|
76
|
+
const w = a * u, A = d[x(439)](x(398)), s = A.length, j = Math[x(445)](s / w);
|
|
77
|
+
let v = globalThis.$('<div class="hiprint-printTemplate"></div>');
|
|
78
|
+
p[x(468)] == x(416) ? v[x(467)](`<style>
|
|
82
79
|
.hiprint-printPanel-small{
|
|
83
80
|
box-sizing: border-box;
|
|
84
81
|
border: 0px;
|
|
@@ -88,120 +85,116 @@ const F = function(l, a) {
|
|
|
88
85
|
padding: 0;
|
|
89
86
|
}
|
|
90
87
|
.hiprint-printTemplate .hiprint-printPaper{
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
const m = R.eq(v)[x(228)]();
|
|
101
|
-
m[x(215)]("hiprint-printPaper"), m.addClass("hiprint-printPaper-small start-" + v);
|
|
102
|
-
const o = globalThis.$(x(137));
|
|
103
|
-
o.append(m), g[x(237)](x(203))[x(158)](o);
|
|
88
|
+
margin: -` + (Number(p[x(480)]) || 0) / 2 + x(487) + (Number(p.layoutColumnGap) || 0) / 2 + x(431) + (Number(p.layoutRowGap) || 0) / 2 + x(423) + (Number(p[x(407)]) || 0) / 2 + x(440)) : v.append(x(447) + (Number(p[x(480)]) || 0) / 2 + x(487) + (Number(p[x(407)]) || 0) / 2 + x(431) + (Number(p[x(480)]) || 0) / 2 + x(423) + (Number(p.layoutColumnGap) || 0) / 2 + x(440));
|
|
89
|
+
for (let T = 0; T < j; T++) {
|
|
90
|
+
const g = globalThis.$(x(442) + e.paperWidth + x(469) + e[x(409)] + `mm;"></div>
|
|
91
|
+
</div>`), C = T * w, k = Math[x(475)]((T + 1) * w, s);
|
|
92
|
+
for (let I = C; I < k; I++) {
|
|
93
|
+
const h = A.eq(I)[x(452)]();
|
|
94
|
+
h[x(396)](x(410)), h[x(460)](x(485) + I);
|
|
95
|
+
const r = globalThis.$('<div class="hiprint-printPanel-small"></div>');
|
|
96
|
+
r.append(h), g[x(439)](x(418))[x(467)](r);
|
|
104
97
|
}
|
|
105
|
-
|
|
98
|
+
v[x(467)](g);
|
|
106
99
|
}
|
|
107
|
-
this[x(
|
|
100
|
+
this[x(466)](v, i), m[x(450)](v[0]);
|
|
108
101
|
} else
|
|
109
|
-
this
|
|
110
|
-
let
|
|
111
|
-
globalThis.$(d)[x(
|
|
112
|
-
const
|
|
102
|
+
this[x(466)](d, i), m[x(450)](d[0]);
|
|
103
|
+
let z = m[x(439)](x(398))[x(461)];
|
|
104
|
+
globalThis.$(d)[x(458)](x(444)), this[x(397)](m, function() {
|
|
105
|
+
const a = x;
|
|
113
106
|
try {
|
|
114
|
-
let
|
|
115
|
-
const
|
|
116
|
-
for (let g = 0; g <
|
|
117
|
-
|
|
118
|
-
const
|
|
119
|
-
let
|
|
120
|
-
for (let
|
|
121
|
-
|
|
122
|
-
const
|
|
123
|
-
globalThis[
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
const
|
|
127
|
-
let
|
|
128
|
-
|
|
129
|
-
let
|
|
130
|
-
n
|
|
131
|
-
const
|
|
132
|
-
|
|
107
|
+
let u = [], w = Math[a(445)](z / f), A = z % f || 1;
|
|
108
|
+
const s = document.createElement("canvas"), j = s[a(474)]("2d"), v = m[a(439)](a(482)).eq(0)[a(408)](), T = v * (i.pixelRatio || globalThis[a(435)]);
|
|
109
|
+
for (let g = 0; g < w; g++) {
|
|
110
|
+
j[a(488)](0, 0, s[a(408)], s[a(434)]);
|
|
111
|
+
const C = g == w - 1;
|
|
112
|
+
let k = 0, I = C ? A : f;
|
|
113
|
+
for (let h = 0; h < I; h++) {
|
|
114
|
+
j[a(488)](0, 0, s[a(408)], s[a(434)]);
|
|
115
|
+
const r = g * f + h, V = m[a(439)](a(398))[r];
|
|
116
|
+
globalThis.hinnn.queue[a(425)](function(E) {
|
|
117
|
+
const R = a;
|
|
118
|
+
B[R(428)](V, i).then(function(P) {
|
|
119
|
+
const c = R;
|
|
120
|
+
let N = P[c(474)]("2d");
|
|
121
|
+
N[c(433)] = ![];
|
|
122
|
+
let q = P.toDataURL(c(462), i[c(483)] || 0.92), n = new Image();
|
|
123
|
+
n.src = q, n.onload = function() {
|
|
124
|
+
const b = c;
|
|
125
|
+
h === 0 && (s[b(408)] = T, s.height = n.height * I), k += n[b(434)], j[b(491)](n, 0, k - n[b(434)], T, n.height), y(r + 1, z), E();
|
|
133
126
|
};
|
|
134
127
|
});
|
|
135
128
|
});
|
|
136
129
|
}
|
|
137
|
-
globalThis[
|
|
138
|
-
const
|
|
139
|
-
let
|
|
130
|
+
globalThis[a(464)].queue[a(425)](function(h) {
|
|
131
|
+
const r = a;
|
|
132
|
+
let V = i.type || r(462), E = i[r(446)] || r(421), R = i[r(483)] || 0.8;
|
|
140
133
|
if (_) {
|
|
141
|
-
let
|
|
142
|
-
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
const n =
|
|
146
|
-
let
|
|
147
|
-
|
|
148
|
-
let
|
|
149
|
-
|
|
150
|
-
})),
|
|
134
|
+
let P = s[r(454)](V, R), c = new Image();
|
|
135
|
+
c[r(426)] = P, c[r(481)] = function() {
|
|
136
|
+
const N = r;
|
|
137
|
+
u[N(399)]({ url: P, start: g * f + 1, end: g * f + I }), C && (globalThis[N(464)].queue[N(405)](), t.removeTempContainer(), u.forEach((q) => {
|
|
138
|
+
const n = N;
|
|
139
|
+
let b = document[n(400)]("a"), H = e[n(477)] || "download.jpg";
|
|
140
|
+
H.indexOf(".") == -1 && (H += n(432));
|
|
141
|
+
let D = H[n(419)](".")[n(451)](), Y = H[n(478)]("." + D, "") + "_" + q.start + "-" + q[n(472)] + "." + D;
|
|
142
|
+
b[n(443)][n(438)] = "none", b[n(411)](n(414), Y), b[n(411)](n(427), q.url), document[n(479)].appendChild(b), b[n(459)](), b[n(457)]();
|
|
143
|
+
})), h();
|
|
151
144
|
};
|
|
152
145
|
return;
|
|
153
146
|
}
|
|
154
|
-
if (
|
|
155
|
-
|
|
147
|
+
if (E == "url") {
|
|
148
|
+
u[r(399)](s[r(454)](V, R)), C && (globalThis.hinnn[r(490)][r(405)](), t.removeTempContainer(), l[r(455)](u)), h();
|
|
156
149
|
return;
|
|
157
150
|
}
|
|
158
|
-
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
},
|
|
151
|
+
E == r(465) && s.toBlob(function(P) {
|
|
152
|
+
const c = r;
|
|
153
|
+
u.push(P), C && (globalThis[c(464)].queue[c(405)](), t[c(463)](), l[c(455)](u)), h();
|
|
154
|
+
}, V, R);
|
|
162
155
|
});
|
|
163
156
|
}
|
|
164
|
-
globalThis[
|
|
165
|
-
} catch (
|
|
166
|
-
console[
|
|
157
|
+
globalThis[a(464)][a(490)].run();
|
|
158
|
+
} catch (u) {
|
|
159
|
+
console[a(470)](a(476)), console[a(403)](u);
|
|
167
160
|
}
|
|
168
161
|
});
|
|
169
162
|
}
|
|
170
|
-
return
|
|
163
|
+
return l[x(401)]();
|
|
171
164
|
});
|
|
172
165
|
};
|
|
173
|
-
function
|
|
174
|
-
var x =
|
|
175
|
-
return j = function(i, p) {
|
|
176
|
-
i = i - 439;
|
|
177
|
-
var _ = x[i];
|
|
178
|
-
return _;
|
|
179
|
-
}, j(l, a);
|
|
180
|
-
}
|
|
181
|
-
(function(l, a) {
|
|
182
|
-
for (var x = j, i = l(); []; )
|
|
166
|
+
(function(o, e) {
|
|
167
|
+
for (var x = $, t = o(); []; )
|
|
183
168
|
try {
|
|
184
|
-
var
|
|
185
|
-
if (
|
|
169
|
+
var l = parseInt(x(485)) / 1 * (-parseInt(x(494)) / 2) + parseInt(x(491)) / 3 * (-parseInt(x(489)) / 4) + parseInt(x(483)) / 5 * (parseInt(x(497)) / 6) + parseInt(x(498)) / 7 * (-parseInt(x(496)) / 8) + -parseInt(x(493)) / 9 * (parseInt(x(495)) / 10) + parseInt(x(490)) / 11 + parseInt(x(499)) / 12;
|
|
170
|
+
if (l === e)
|
|
186
171
|
break;
|
|
187
|
-
|
|
172
|
+
t.push(t.shift());
|
|
188
173
|
} catch (_) {
|
|
189
|
-
|
|
174
|
+
t.push(t.shift());
|
|
190
175
|
}
|
|
191
|
-
})(
|
|
192
|
-
function
|
|
193
|
-
var
|
|
194
|
-
return
|
|
195
|
-
|
|
196
|
-
|
|
176
|
+
})(G, 580570);
|
|
177
|
+
function $(o, e) {
|
|
178
|
+
var x = G();
|
|
179
|
+
return $ = function(t, l) {
|
|
180
|
+
t = t - 483;
|
|
181
|
+
var _ = x[t];
|
|
182
|
+
return _;
|
|
183
|
+
}, $(o, e);
|
|
184
|
+
}
|
|
185
|
+
function G() {
|
|
186
|
+
var o = ["0.3.0", "toImage", "add toImage Api", "24iQPRdW", "11007271hbTDlo", "49947UjjxFt", "newPrintTemplate", "387QTsgPi", "2zygCvZ", "265770eQobHQ", "29112lgPHhd", "6MHaTrY", "595KCNjGO", "9154260WVvglp", "3678655sWyMtE", "add toImage Api to PrintTemplate", "366657VdPVVY"];
|
|
187
|
+
return G = function() {
|
|
188
|
+
return o;
|
|
189
|
+
}, G();
|
|
197
190
|
}
|
|
198
|
-
function
|
|
199
|
-
var
|
|
200
|
-
return { name:
|
|
201
|
-
var
|
|
202
|
-
Object
|
|
203
|
-
} }], leastHiprintVersion:
|
|
191
|
+
function K(o) {
|
|
192
|
+
var e = $;
|
|
193
|
+
return { name: "add toImage Api", description: e(488), hooks: [{ hook: e(492), name: "add toImage Api to PrintTemplate", description: e(484), priority: 1, run: ({ template: x, options: t }) => {
|
|
194
|
+
var l = e;
|
|
195
|
+
Object.defineProperty(x, l(487), { value: L, enumerable: ![], writable: !![], configurable: !![] });
|
|
196
|
+
} }], leastHiprintVersion: e(486) };
|
|
204
197
|
}
|
|
205
198
|
export {
|
|
206
|
-
|
|
199
|
+
K as default
|
|
207
200
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
(function(_,
|
|
1
|
+
(function(_,d){typeof exports=="object"&&typeof module!="undefined"?module.exports=d(require("@zumer/snapdom")):typeof define=="function"&&define.amd?define(["@zumer/snapdom"],d):(_=typeof globalThis!="undefined"?globalThis:_||self,_.pluginApiImage=d(_.window))})(this,function(_){"use strict";var B=(_,d,f)=>new Promise((G,T)=>{var R=e=>{try{r(f.next(e))}catch(x){T(x)}},U=e=>{try{r(f.throw(e))}catch(x){T(x)}},r=e=>e.done?G(e.value):Promise.resolve(e.value).then(R,U);r((f=f.apply(_,d)).next())});function d(r,e){const x=f();return d=function(n,h){return n=n-396,x[n]},d(r,e)}function f(){const r=["519496OYVHjR","download","total","row","panelLayoutOptions",".hiprint-printPaper","split","printPanels","url","getTempContainer","mm ","12xwNwgn","add","src","href","toCanvas","3hSbbRm","pixelRatio",`mm;
|
|
2
2
|
}
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
.hiprint-printTemplate .hiprint-printPanel-small {
|
|
4
|
+
display:inline-block;
|
|
5
|
+
padding: `,".jpg","imageSmoothingEnabled","height","devicePixelRatio","224830UVVmnU","toImage percent: ","display","find",`mm;
|
|
6
|
+
}
|
|
7
|
+
</style>`,"createTempContainer",`<div class="hiprint-printPanel">
|
|
8
|
+
<div class="hiprint-printPaper" style="width:`,"style","position:fixed","ceil","toType",`<style>
|
|
5
9
|
.hiprint-printPanel-small{
|
|
6
10
|
box-sizing: border-box;
|
|
7
11
|
border: 0px;
|
|
@@ -11,15 +15,11 @@
|
|
|
11
15
|
padding: 0;
|
|
12
16
|
}
|
|
13
17
|
.hiprint-printTemplate .hiprint-printPaper{
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
.hiprint-printTemplate .hiprint-printPanel-small {
|
|
21
|
-
display:inline-block;
|
|
22
|
-
padding: `+(Number(p[x(134)])||0)/2+"mm "+(Number(p.layoutColumnGap)||0)/2+x(184)):C[x(158)](`<style>
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-wrap: wrap;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
align-content: flex-start;
|
|
22
|
+
margin: -`,"7312329NdMtzj","dpr","html","pop","clone","limit","toDataURL","resolve","143tAVkhe","remove","css","click","addClass","length","image/jpeg","removeTempContainer","hinnn","blob","svg2canvas","append","layoutType","mm;height:","error","133055WUqvIp","end","isDownload","getContext","min","toImage \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ","name","replace","body","layoutRowGap","onload",".hiprint-printPanel","quality","1727644XyJEVd","hiprint-printPaper-small start-","3358922mzoRlj","mm -","clearRect","231706BJrlBQ","queue","drawImage","removeClass","loadAllImages",".hiprint-printPanel .hiprint-printPaper","push","createElement","promise","1FEeAYo","log","paperWidth","clear","floor","layoutColumnGap","width","paperHeight","hiprint-printPaper","setAttribute","onProgress"];return f=function(){return r},f()}(function(r,e){const x=d,n=r();for(;[];)try{if(parseInt(x(402))/1*(parseInt(x(489))/2)+-parseInt(x(429))/3*(parseInt(x(484))/4)+-parseInt(x(471))/5*(-parseInt(x(424))/6)+-parseInt(x(486))/7+parseInt(x(413))/8+parseInt(x(448))/9+-parseInt(x(436))/10*(-parseInt(x(456))/11)===e)break;n.push(n.shift())}catch(h){n.push(n.shift())}})(f,427015);const G=function(r,e){return B(this,null,function*(){const x=d;let n=this,h=globalThis.$.Deferred(),j=!![],y=10,Q=(l,I)=>{const u=d,D=Math.floor(l/I*100);console[u(403)]("cur",l,u(415),I),console.log(u(437),D+"%")};if(this[x(420)].length){let l=globalThis.$.extend({},e||{}),I=yield this.getHtml(r,e);e&&(e[x(430)]&&(l[x(449)]=e[x(430)],l.scale=e.pixelRatio),e[x(473)]!=null&&(j=e[x(473)]),e.onProgress!=null&&(Q=e[x(412)]),e[x(453)]!=null&&(y=e[x(453)])),globalThis.$(I)[x(458)](x(408),"")[x(458)](x(434),""),this[x(441)]();let u=this[x(422)](),D=this[x(420)][0][x(408)],L=this.printPanels[0].height;const o=this.printPanels[0][x(417)];if(o&&(o[x(480)]>0||o[x(407)]>0)&&e[x(404)]&&e[x(409)]){let a=Math[x(406)](e.paperWidth/(D+o[x(480)]/2)),m=Math[x(406)](e[x(409)]/(L+o[x(407)]/2));const N=a*m,E=I[x(439)](x(398)),p=E.length,M=Math[x(445)](p/N);let P=globalThis.$('<div class="hiprint-printTemplate"></div>');o[x(468)]==x(416)?P[x(467)](`<style>
|
|
23
23
|
.hiprint-printPanel-small{
|
|
24
24
|
box-sizing: border-box;
|
|
25
25
|
border: 0px;
|
|
@@ -29,9 +29,5 @@
|
|
|
29
29
|
padding: 0;
|
|
30
30
|
}
|
|
31
31
|
.hiprint-printTemplate .hiprint-printPaper{
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
flex-direction: column;
|
|
35
|
-
align-content: flex-start;
|
|
36
|
-
margin: -`+(Number(p.layoutRowGap)||0)/2+"mm -"+(Number(p[x(183)])||0)/2+x(173)+(Number(p[x(134)])||0)/2+x(227)+(Number(p.layoutColumnGap)||0)/2+x(184));for(let k=0;k<G;k++){const g=globalThis.$(`<div class="hiprint-printPanel">
|
|
37
|
-
<div class="hiprint-printPaper" style="width:`+e[x(225)]+x(152)+e.paperHeight+x(125)),R=k*M,$=Math[x(224)]((k+1)*M,s);for(let y=R;y<$;y++){const b=D.eq(y)[x(228)]();b[x(215)]("hiprint-printPaper"),b.addClass("hiprint-printPaper-small start-"+y);const o=globalThis.$(x(137));o.append(b),g[x(237)](x(203))[x(158)](o)}C.append(g)}this[x(154)](C,h),u[x(160)](C[0])}else this.svg2canvas(f,h),u[x(160)](f[0]);let S=u[x(237)](x(236))[x(159)];globalThis.$(f)[x(222)](x(229)),this.loadAllImages(f,function(){const t=x;try{let n=[],M=Math[t(233)](S/w),D=S%w||1;const s=document[t(205)](t(126)),G=s[t(200)]("2d"),C=u[t(237)](t(155)).eq(0).width(),k=C*(h[t(232)]||globalThis[t(206)]);for(let g=0;g<M;g++){G[t(231)](0,0,s[t(140)],s[t(217)]);const R=g==M-1;let $=0,y=R?D:w;for(let b=0;b<y;b++){G[t(231)](0,0,s.width,s[t(217)]);const o=g*w+b,U=u[t(237)](".hiprint-printPanel .hiprint-printPaper")[o];globalThis[t(129)].queue.add(function(B){const O=t;q.toCanvas(U,h)[O(199)](function(N){const l=O;let I=N.getContext("2d");I.imageSmoothingEnabled=![];let V=N.toDataURL(l(157),h[l(223)]||.92),i=new Image;i[l(135)]=V,i[l(149)]=function(){const c=l;b===0&&(s[c(140)]=k,s[c(217)]=i[c(217)]*y),$+=i[c(217)],G[c(172)](i,0,$-i[c(217)],k,i.height),z(o+1,S),B()}})})}globalThis[t(129)][t(168)][t(230)](function(b){const o=t;let U=h[o(213)]||o(157),B=h.toType||"url",O=h.quality||.8;if(E){let N=s[o(169)](U,O),l=new Image;l[o(135)]=N,l[o(149)]=function(){const I=o;n.push({url:N,start:g*w+1,end:g*w+y}),R&&(globalThis[I(129)][I(168)][I(191)](),r[I(166)](),n[I(146)](V=>{const i=I;let c=document.createElement("a"),L=e.name||i(198);L[i(142)](".")==-1&&(L+=".jpg");let X=L[i(179)](".").pop(),W=L[i(240)]("."+X,"")+"_"+V[i(197)]+"-"+V[i(234)]+"."+X;c[i(144)][i(196)]=i(164),c[i(132)](i(127),W),c[i(132)](i(208),V[i(218)]),document[i(211)][i(170)](c),c[i(128)](),c[i(193)]()})),b()};return}if(B==o(218)){n[o(180)](s[o(169)](U,O)),R&&(globalThis.hinnn.queue.clear(),r[o(166)](),d.resolve(n)),b();return}B==o(171)&&s[o(143)](function(N){const l=o;n[l(180)](N),R&&(globalThis[l(129)][l(168)][l(191)](),r[l(166)](),d[l(150)](n)),b()},U,O)})}globalThis[t(129)].queue[t(165)]()}catch(n){console[t(186)](t(139)),console[t(177)](n)}})}return d[x(185)]()})};function A(a,e){var x=v();return A=function(r,d){r=r-439;var E=x[r];return E},A(a,e)}(function(a,e){for(var x=A,r=a();[];)try{var d=-parseInt(x(449))/1+-parseInt(x(450))/2+-parseInt(x(441))/3*(-parseInt(x(451))/4)+-parseInt(x(440))/5+-parseInt(x(448))/6+-parseInt(x(445))/7*(parseInt(x(444))/8)+parseInt(x(452))/9;if(d===e)break;r.push(r.shift())}catch(E){r.push(r.shift())}})(v,672242);function v(){var a=["toImage","newPrintTemplate","5735748wEEXNA","866176wrVrBA","2662854EUUogl","124DeyVZy","40837464ixUXSs","defineProperty","add toImage Api to PrintTemplate","478835hEHDBX","53187kqUhVY","0.3.0","add toImage Api","40AVZCZk","1631735VNBrko"];return v=function(){return a},v()}function m(a){var e=A;return{name:e(443),description:e(443),hooks:[{hook:e(447),name:e(439),description:e(439),priority:1,run:({template:x,options:r})=>{var d=e;Object[d(453)](x,d(446),{value:H,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:e(442)}}return m});
|
|
32
|
+
margin: -`+(Number(o[x(480)])||0)/2+x(487)+(Number(o.layoutColumnGap)||0)/2+x(431)+(Number(o.layoutRowGap)||0)/2+x(423)+(Number(o[x(407)])||0)/2+x(440)):P.append(x(447)+(Number(o[x(480)])||0)/2+x(487)+(Number(o[x(407)])||0)/2+x(431)+(Number(o[x(480)])||0)/2+x(423)+(Number(o.layoutColumnGap)||0)/2+x(440));for(let w=0;w<M;w++){const g=globalThis.$(x(442)+e.paperWidth+x(469)+e[x(409)]+`mm;"></div>
|
|
33
|
+
</div>`),q=w*N,H=Math[x(475)]((w+1)*N,p);for(let v=q;v<H;v++){const c=E.eq(v)[x(452)]();c[x(396)](x(410)),c[x(460)](x(485)+v);const i=globalThis.$('<div class="hiprint-printPanel-small"></div>');i.append(c),g[x(439)](x(418))[x(467)](i)}P[x(467)](g)}this[x(466)](P,l),u[x(450)](P[0])}else this[x(466)](I,l),u[x(450)](I[0]);let O=u[x(439)](x(398))[x(461)];globalThis.$(I)[x(458)](x(444)),this[x(397)](u,function(){const a=x;try{let m=[],N=Math[a(445)](O/y),E=O%y||1;const p=document.createElement("canvas"),M=p[a(474)]("2d"),P=u[a(439)](a(482)).eq(0)[a(408)](),w=P*(l.pixelRatio||globalThis[a(435)]);for(let g=0;g<N;g++){M[a(488)](0,0,p[a(408)],p[a(434)]);const q=g==N-1;let H=0,v=q?E:y;for(let c=0;c<v;c++){M[a(488)](0,0,p[a(408)],p[a(434)]);const i=g*y+c,k=u[a(439)](a(398))[i];globalThis.hinnn.queue[a(425)](function(W){const V=a;_.snapdom[V(428)](k,l).then(function(C){const s=V;let A=C[s(474)]("2d");A[s(433)]=![];let z=C.toDataURL(s(462),l[s(483)]||.92),t=new Image;t.src=z,t.onload=function(){const b=s;c===0&&(p[b(408)]=w,p.height=t.height*v),H+=t[b(434)],M[b(491)](t,0,H-t[b(434)],w,t.height),Q(i+1,O),W()}})})}globalThis[a(464)].queue[a(425)](function(c){const i=a;let k=l.type||i(462),W=l[i(446)]||i(421),V=l[i(483)]||.8;if(j){let C=p[i(454)](k,V),s=new Image;s[i(426)]=C,s[i(481)]=function(){const A=i;m[A(399)]({url:C,start:g*y+1,end:g*y+v}),q&&(globalThis[A(464)].queue[A(405)](),n.removeTempContainer(),m.forEach(z=>{const t=A;let b=document[t(400)]("a"),$=e[t(477)]||"download.jpg";$.indexOf(".")==-1&&($+=t(432));let Y=$[t(419)](".")[t(451)](),F=$[t(478)]("."+Y,"")+"_"+z.start+"-"+z[t(472)]+"."+Y;b[t(443)][t(438)]="none",b[t(411)](t(414),F),b[t(411)](t(427),z.url),document[t(479)].appendChild(b),b[t(459)](),b[t(457)]()})),c()};return}if(W=="url"){m[i(399)](p[i(454)](k,V)),q&&(globalThis.hinnn[i(490)][i(405)](),n.removeTempContainer(),h[i(455)](m)),c();return}W==i(465)&&p.toBlob(function(C){const s=i;m.push(C),q&&(globalThis[s(464)].queue[s(405)](),n[s(463)](),h[s(455)](m)),c()},k,V)})}globalThis[a(464)][a(490)].run()}catch(m){console[a(470)](a(476)),console[a(403)](m)}})}return h[x(401)]()})};(function(r,e){for(var x=T,n=r();[];)try{var h=parseInt(x(485))/1*(-parseInt(x(494))/2)+parseInt(x(491))/3*(-parseInt(x(489))/4)+parseInt(x(483))/5*(parseInt(x(497))/6)+parseInt(x(498))/7*(-parseInt(x(496))/8)+-parseInt(x(493))/9*(parseInt(x(495))/10)+parseInt(x(490))/11+parseInt(x(499))/12;if(h===e)break;n.push(n.shift())}catch(j){n.push(n.shift())}})(R,580570);function T(r,e){var x=R();return T=function(n,h){n=n-483;var j=x[n];return j},T(r,e)}function R(){var r=["0.3.0","toImage","add toImage Api","24iQPRdW","11007271hbTDlo","49947UjjxFt","newPrintTemplate","387QTsgPi","2zygCvZ","265770eQobHQ","29112lgPHhd","6MHaTrY","595KCNjGO","9154260WVvglp","3678655sWyMtE","add toImage Api to PrintTemplate","366657VdPVVY"];return R=function(){return r},R()}function U(r){var e=T;return{name:"add toImage Api",description:e(488),hooks:[{hook:e(492),name:"add toImage Api to PrintTemplate",description:e(484),priority:1,run:({template:x,options:n})=>{var h=e;Object.defineProperty(x,h(487),{value:G,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:e(486)}}return U});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sv-print/plugin-api-image",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "add image api to print template",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -32,15 +32,14 @@
|
|
|
32
32
|
"author": "",
|
|
33
33
|
"license": "MIT",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"html-to-image": "^1.11.13"
|
|
35
|
+
"@zumer/snapdom": "^2.0.1",
|
|
36
|
+
"sv-print": "^0.2.0"
|
|
38
37
|
},
|
|
39
38
|
"devDependencies": {
|
|
40
39
|
"vite-plugin-javascript-obfuscator": "^3.1.0"
|
|
41
40
|
},
|
|
42
41
|
"peerDependencies": {
|
|
43
|
-
"
|
|
44
|
-
"
|
|
42
|
+
"@zumer/snapdom": "^2.0.1",
|
|
43
|
+
"sv-print": "^0.2.0"
|
|
45
44
|
}
|
|
46
45
|
}
|