@sv-print/plugin-api-image 0.2.0 → 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 CHANGED
@@ -1,8 +1,11 @@
1
- "use strict";var V=(o,e,x)=>new Promise((a,s)=>{var g=i=>{try{k(x.next(i))}catch(c){s(c)}},u=i=>{try{k(x.throw(i))}catch(c){s(c)}},k=i=>i.done?a(i.value):Promise.resolve(i.value).then(g,u);k((x=x.apply(o,e)).next())});const J=require("@zumer/snapdom");(function(o,e){const x=j,a=o();for(;[];)try{if(parseInt(x(211))/1*(-parseInt(x(251))/2)+parseInt(x(245))/3*(-parseInt(x(242))/4)+parseInt(x(256))/5+-parseInt(x(265))/6*(parseInt(x(179))/7)+parseInt(x(194))/8+parseInt(x(192))/9+-parseInt(x(234))/10*(-parseInt(x(178))/11)===e)break;a.push(a.shift())}catch(s){a.push(a.shift())}})(E,991907);function E(){const o=["limit","indexOf",'<div class="hiprint-printTemplate"></div>',"toBlob","devicePixelRatio","floor","getContext","extend","replace","cur",`<div class="hiprint-printPanel">
2
- <div class="hiprint-printPaper" style="width:`,"push","10YnsMhd","mm ","printPanels","total","src","paperHeight","mm;height:","getTempContainer","8eDbbnX","css","setAttribute","594483XRowmQ","min","layoutRowGap","clearRect","name","removeTempContainer","932ygrPYT",`mm;
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;
3
2
  }
4
- </style>`,"none","createElement","removeClass","408110KjYHgg","toDataURL","isDownload","start","loadAllImages","layoutColumnGap","panelLayoutOptions","clone","append","120CMfTqq","log","resolve","then","quality",".hiprint-printPanel .hiprint-printPaper","svg2canvas","height","find","20157643HusFlM","323043sVZSoM","pixelRatio","onProgress","html","createTempContainer","end","width","promise","add","download","image/jpeg","clear","pop","7153794EyDTgg",".hiprint-printPanel","6171216rQnmMY","hinnn","onload","url","paperWidth","getHtml","row","toImage \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ","canvas","length","imageSmoothingEnabled","forEach","toImage percent: ",`mm;"></div>
5
- </div>`,"toCanvas","style",`<style>
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>
6
9
  .hiprint-printPanel-small{
7
10
  box-sizing: border-box;
8
11
  border: 0px;
@@ -16,7 +19,7 @@
16
19
  flex-wrap: wrap;
17
20
  flex-direction: column;
18
21
  align-content: flex-start;
19
- margin: -`,"2509IkPvtf","drawImage",".hiprint-printPaper","download.jpg","toType","href","queue","display","mm -",'<div class="hiprint-printPanel-small"></div>',"addClass"];return E=function(){return o},E()}function j(o,e){const x=E();return j=function(a,s){return a=a-171,x[a]},j(o,e)}const K=function(o,e){return V(this,null,function*(){const x=j;let a=this,s=globalThis.$.Deferred(),g=!![],u=10,k=(i,c)=>{const h=j,z=Math.floor(i/c*100);console[h(266)](h(231),i,h(237),c),console.log(h(206),z+"%")};if(this[x(236)][x(203)]){let i=globalThis.$[x(229)]({},e||{}),c=yield this[x(199)](o,e);e&&(e.pixelRatio&&(i.dpr=e.pixelRatio,i.scale=e[x(180)]),e[x(258)]!=null&&(g=e[x(258)]),e[x(181)]!=null&&(k=e[x(181)]),e.limit!=null&&(u=e[x(222)])),globalThis.$(c)[x(243)](x(185),"").css("height",""),this[x(183)]();let h=this[x(241)](),z=this[x(236)][0][x(185)],X=this[x(236)][0][x(176)];const p=this[x(236)][0][x(262)];if(p&&(p[x(247)]>0||p[x(261)]>0)&&e.paperWidth&&e[x(239)]){let t=Math.floor(e[x(198)]/(z+p[x(247)]/2)),m=Math[x(227)](e[x(239)]/(X+p[x(261)]/2));const q=t*m,A=c[x(177)](x(174)),d=A[x(203)],M=Math.ceil(d/q);let v=globalThis.$(x(224));p.layoutType==x(200)?v[x(264)](`<style>
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>
20
23
  .hiprint-printPanel-small{
21
24
  box-sizing: border-box;
22
25
  border: 0px;
@@ -26,12 +29,5 @@
26
29
  padding: 0;
27
30
  }
28
31
  .hiprint-printTemplate .hiprint-printPaper{
29
- margin: -`+(Number(p[x(247)])||0)/2+x(219)+(Number(p[x(261)])||0)/2+`mm;
30
- }
31
- .hiprint-printTemplate .hiprint-printPanel-small {
32
- display:inline-block;
33
- padding: `+(Number(p[x(247)])||0)/2+x(235)+(Number(p[x(261)])||0)/2+x(252)):v.append(x(210)+(Number(p[x(247)])||0)/2+x(219)+(Number(p[x(261)])||0)/2+`mm;
34
- }
35
- .hiprint-printTemplate .hiprint-printPanel-small {
36
- display:inline-block;
37
- padding: `+(Number(p[x(247)])||0)/2+x(235)+(Number(p[x(261)])||0)/2+x(252));for(let T=0;T<M;T++){const _=globalThis.$(x(232)+e[x(198)]+x(240)+e[x(239)]+x(207)),C=T*q,H=Math[x(246)]((T+1)*q,d);for(let I=C;I<H;I++){const f=A.eq(I)[x(263)]();f[x(255)]("hiprint-printPaper"),f[x(221)]("hiprint-printPaper-small start-"+I);const r=globalThis.$(x(220));r[x(264)](f),_[x(177)](x(213))[x(264)](r)}v[x(264)](_)}this[x(175)](v,i),h[x(182)](v[0])}else this[x(175)](c,i),h[x(182)](c[0]);let O=h[x(177)](".hiprint-printPanel .hiprint-printPaper")[x(203)];globalThis.$(c)[x(243)]("position:fixed"),this[x(260)](c,function(){const t=x;try{let m=[],q=Math.ceil(O/u),A=O%u||1;const d=document.createElement(t(202)),M=d[t(228)]("2d"),v=h.find(t(193)).eq(0)[t(185)](),T=v*(i[t(180)]||globalThis[t(226)]);for(let _=0;_<q;_++){M[t(248)](0,0,d[t(185)],d[t(176)]);const C=_==q-1;let H=0,I=C?A:u;for(let f=0;f<I;f++){M[t(248)](0,0,d[t(185)],d[t(176)]);const r=_*u+f,N=h[t(177)](t(174))[r];globalThis[t(195)][t(217)].add(function($){const y=t;J.snapdom[y(208)](N,i)[y(172)](function(P){const l=y;let w=P[l(228)]("2d");w[l(204)]=![];let R=P[l(257)](l(189),i[l(173)]||.92),n=new Image;n.src=R,n[l(196)]=function(){const b=l;f===0&&(d[b(185)]=T,d[b(176)]=n[b(176)]*I),H+=n.height,M[b(212)](n,0,H-n[b(176)],T,n[b(176)]),k(r+1,O),$()}})})}globalThis[t(195)][t(217)][t(187)](function(f){const r=t;let N=i.type||r(189),$=i[r(215)]||r(197),y=i.quality||.8;if(g){let P=d.toDataURL(N,y),l=new Image;l[r(238)]=P,l[r(196)]=function(){const w=r;m.push({url:P,start:_*u+1,end:_*u+I}),C&&(globalThis.hinnn[w(217)][w(190)](),a[w(250)](),m[w(205)](R=>{const n=w;let b=document[n(254)]("a"),D=e[n(249)]||n(214);D[n(223)](".")==-1&&(D+=".jpg");let S=D.split(".")[n(191)](),G=D[n(230)]("."+S,"")+"_"+R[n(259)]+"-"+R[n(184)]+"."+S;b[n(209)][n(218)]=n(253),b[n(244)](n(188),G),b[n(244)](n(216),R[n(197)]),document.body.appendChild(b),b.click(),b.remove()})),f()};return}if($==r(197)){m[r(233)](d[r(257)](N,y)),C&&(globalThis[r(195)].queue[r(190)](),a[r(250)](),s[r(171)](m)),f();return}$=="blob"&&d[r(225)](function(P){const l=r;m[l(233)](P),C&&(globalThis[l(195)].queue[l(190)](),a[l(250)](),s[l(171)](m)),f()},N,y)})}globalThis[t(195)].queue.run()}catch(m){console.error(t(201)),console.log(m)}})}return s[x(186)]()})};function L(o,e){var x=Y();return L=function(a,s){a=a-189;var g=x[a];return g},L(o,e)}(function(o,e){for(var x=L,a=o();[];)try{var s=-parseInt(x(192))/1*(-parseInt(x(201))/2)+parseInt(x(205))/3*(parseInt(x(202))/4)+parseInt(x(193))/5*(parseInt(x(200))/6)+-parseInt(x(194))/7+-parseInt(x(191))/8+-parseInt(x(197))/9+-parseInt(x(204))/10*(-parseInt(x(199))/11);if(s===e)break;a.push(a.shift())}catch(g){a.push(a.shift())}})(Y,366221);function Y(){var o=["1AAkkjv","5iZCkmS","1428861dHMliN","add toImage Api to PrintTemplate","newPrintTemplate","3767040CnkuaJ","defineProperty","161579nyztyv","3916518ELckIf","556158oTrJKg","49976snTHLq","toImage","20SifjYv","162dOYxiV","add toImage Api","0.3.0","5167856XwNzPL"];return Y=function(){return o},Y()}function Q(o){var e=L;return{name:e(189),description:"add toImage Api",hooks:[{hook:e(196),name:e(195),description:e(195),priority:1,run:({template:x,options:a})=>{var s=e;Object[s(198)](x,s(203),{value:K,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:e(190)}}module.exports=Q;
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,37 +1,35 @@
1
- var V = (o, e, x) => new Promise((a, s) => {
2
- var g = (i) => {
1
+ var O = (o, e, x) => new Promise((t, l) => {
2
+ var _ = (i) => {
3
3
  try {
4
- k(x.next(i));
5
- } catch (c) {
6
- s(c);
4
+ y(x.next(i));
5
+ } catch (d) {
6
+ l(d);
7
7
  }
8
- }, u = (i) => {
8
+ }, f = (i) => {
9
9
  try {
10
- k(x.throw(i));
11
- } catch (c) {
12
- s(c);
10
+ y(x.throw(i));
11
+ } catch (d) {
12
+ l(d);
13
13
  }
14
- }, k = (i) => i.done ? a(i.value) : Promise.resolve(i.value).then(g, u);
15
- k((x = x.apply(o, e)).next());
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 { snapdom as J } from "@zumer/snapdom";
18
- (function(o, e) {
19
- const x = j, a = o();
20
- for (; []; )
21
- try {
22
- if (parseInt(x(211)) / 1 * (-parseInt(x(251)) / 2) + parseInt(x(245)) / 3 * (-parseInt(x(242)) / 4) + parseInt(x(256)) / 5 + -parseInt(x(265)) / 6 * (parseInt(x(179)) / 7) + parseInt(x(194)) / 8 + parseInt(x(192)) / 9 + -parseInt(x(234)) / 10 * (-parseInt(x(178)) / 11) === e)
23
- break;
24
- a.push(a.shift());
25
- } catch (s) {
26
- a.push(a.shift());
27
- }
28
- })(E, 991907);
29
- function E() {
30
- const o = ["limit", "indexOf", '<div class="hiprint-printTemplate"></div>', "toBlob", "devicePixelRatio", "floor", "getContext", "extend", "replace", "cur", `<div class="hiprint-printPanel">
31
- <div class="hiprint-printPaper" style="width:`, "push", "10YnsMhd", "mm ", "printPanels", "total", "src", "paperHeight", "mm;height:", "getTempContainer", "8eDbbnX", "css", "setAttribute", "594483XRowmQ", "min", "layoutRowGap", "clearRect", "name", "removeTempContainer", "932ygrPYT", `mm;
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);
23
+ }
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;
32
26
  }
33
- </style>`, "none", "createElement", "removeClass", "408110KjYHgg", "toDataURL", "isDownload", "start", "loadAllImages", "layoutColumnGap", "panelLayoutOptions", "clone", "append", "120CMfTqq", "log", "resolve", "then", "quality", ".hiprint-printPanel .hiprint-printPaper", "svg2canvas", "height", "find", "20157643HusFlM", "323043sVZSoM", "pixelRatio", "onProgress", "html", "createTempContainer", "end", "width", "promise", "add", "download", "image/jpeg", "clear", "pop", "7153794EyDTgg", ".hiprint-printPanel", "6171216rQnmMY", "hinnn", "onload", "url", "paperWidth", "getHtml", "row", "toImage \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ", "canvas", "length", "imageSmoothingEnabled", "forEach", "toImage percent: ", `mm;"></div>
34
- </div>`, "toCanvas", "style", `<style>
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>
35
33
  .hiprint-printPanel-small{
36
34
  box-sizing: border-box;
37
35
  border: 0px;
@@ -45,34 +43,39 @@ function E() {
45
43
  flex-wrap: wrap;
46
44
  flex-direction: column;
47
45
  align-content: flex-start;
48
- margin: -`, "2509IkPvtf", "drawImage", ".hiprint-printPaper", "download.jpg", "toType", "href", "queue", "display", "mm -", '<div class="hiprint-printPanel-small"></div>', "addClass"];
49
- return E = function() {
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() {
50
48
  return o;
51
- }, E();
49
+ }, W();
52
50
  }
53
- function j(o, e) {
54
- const x = E();
55
- return j = function(a, s) {
56
- return a = a - 171, x[a];
57
- }, j(o, e);
58
- }
59
- const K = function(o, e) {
60
- return V(this, null, function* () {
61
- const x = j;
62
- let a = this, s = globalThis.$.Deferred(), g = !![], u = 10, k = (i, c) => {
63
- const h = j, z = Math.floor(i / c * 100);
64
- console[h(266)](h(231), i, h(237), c), console.log(h(206), z + "%");
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 + "%");
65
68
  };
66
- if (this[x(236)][x(203)]) {
67
- let i = globalThis.$[x(229)]({}, e || {}), c = yield this[x(199)](o, e);
68
- e && (e.pixelRatio && (i.dpr = e.pixelRatio, i.scale = e[x(180)]), e[x(258)] != null && (g = e[x(258)]), e[x(181)] != null && (k = e[x(181)]), e.limit != null && (u = e[x(222)])), globalThis.$(c)[x(243)](x(185), "").css("height", ""), this[x(183)]();
69
- let h = this[x(241)](), z = this[x(236)][0][x(185)], X = this[x(236)][0][x(176)];
70
- const p = this[x(236)][0][x(262)];
71
- if (p && (p[x(247)] > 0 || p[x(261)] > 0) && e.paperWidth && e[x(239)]) {
72
- let t = Math.floor(e[x(198)] / (z + p[x(247)] / 2)), m = Math[x(227)](e[x(239)] / (X + p[x(261)] / 2));
73
- const C = t * m, A = c[x(177)](x(174)), d = A[x(203)], q = Math.ceil(d / C);
74
- let v = globalThis.$(x(224));
75
- p.layoutType == x(200) ? v[x(264)](`<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>
76
79
  .hiprint-printPanel-small{
77
80
  box-sizing: border-box;
78
81
  border: 0px;
@@ -82,123 +85,116 @@ const K = function(o, e) {
82
85
  padding: 0;
83
86
  }
84
87
  .hiprint-printTemplate .hiprint-printPaper{
85
- margin: -` + (Number(p[x(247)]) || 0) / 2 + x(219) + (Number(p[x(261)]) || 0) / 2 + `mm;
86
- }
87
- .hiprint-printTemplate .hiprint-printPanel-small {
88
- display:inline-block;
89
- padding: ` + (Number(p[x(247)]) || 0) / 2 + x(235) + (Number(p[x(261)]) || 0) / 2 + x(252)) : v.append(x(210) + (Number(p[x(247)]) || 0) / 2 + x(219) + (Number(p[x(261)]) || 0) / 2 + `mm;
90
- }
91
- .hiprint-printTemplate .hiprint-printPanel-small {
92
- display:inline-block;
93
- padding: ` + (Number(p[x(247)]) || 0) / 2 + x(235) + (Number(p[x(261)]) || 0) / 2 + x(252));
94
- for (let T = 0; T < q; T++) {
95
- const _ = globalThis.$(x(232) + e[x(198)] + x(240) + e[x(239)] + x(207)), M = T * C, H = Math[x(246)]((T + 1) * C, d);
96
- for (let I = M; I < H; I++) {
97
- const f = A.eq(I)[x(263)]();
98
- f[x(255)]("hiprint-printPaper"), f[x(221)]("hiprint-printPaper-small start-" + I);
99
- const r = globalThis.$(x(220));
100
- r[x(264)](f), _[x(177)](x(213))[x(264)](r);
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);
101
97
  }
102
- v[x(264)](_);
98
+ v[x(467)](g);
103
99
  }
104
- this[x(175)](v, i), h[x(182)](v[0]);
100
+ this[x(466)](v, i), m[x(450)](v[0]);
105
101
  } else
106
- this[x(175)](c, i), h[x(182)](c[0]);
107
- let O = h[x(177)](".hiprint-printPanel .hiprint-printPaper")[x(203)];
108
- globalThis.$(c)[x(243)]("position:fixed"), this[x(260)](c, function() {
109
- const t = x;
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;
110
106
  try {
111
- let m = [], C = Math.ceil(O / u), A = O % u || 1;
112
- const d = document.createElement(t(202)), q = d[t(228)]("2d"), v = h.find(t(193)).eq(0)[t(185)](), T = v * (i[t(180)] || globalThis[t(226)]);
113
- for (let _ = 0; _ < C; _++) {
114
- q[t(248)](0, 0, d[t(185)], d[t(176)]);
115
- const M = _ == C - 1;
116
- let H = 0, I = M ? A : u;
117
- for (let f = 0; f < I; f++) {
118
- q[t(248)](0, 0, d[t(185)], d[t(176)]);
119
- const r = _ * u + f, N = h[t(177)](t(174))[r];
120
- globalThis[t(195)][t(217)].add(function($) {
121
- const y = t;
122
- J[y(208)](N, i)[y(172)](function(P) {
123
- const l = y;
124
- let w = P[l(228)]("2d");
125
- w[l(204)] = ![];
126
- let R = P[l(257)](l(189), i[l(173)] || 0.92), n = new Image();
127
- n.src = R, n[l(196)] = function() {
128
- const b = l;
129
- f === 0 && (d[b(185)] = T, d[b(176)] = n[b(176)] * I), H += n.height, q[b(212)](n, 0, H - n[b(176)], T, n[b(176)]), k(r + 1, O), $();
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();
130
126
  };
131
127
  });
132
128
  });
133
129
  }
134
- globalThis[t(195)][t(217)][t(187)](function(f) {
135
- const r = t;
136
- let N = i.type || r(189), $ = i[r(215)] || r(197), y = i.quality || 0.8;
137
- if (g) {
138
- let P = d.toDataURL(N, y), l = new Image();
139
- l[r(238)] = P, l[r(196)] = function() {
140
- const w = r;
141
- m.push({ url: P, start: _ * u + 1, end: _ * u + I }), M && (globalThis.hinnn[w(217)][w(190)](), a[w(250)](), m[w(205)]((R) => {
142
- const n = w;
143
- let b = document[n(254)]("a"), D = e[n(249)] || n(214);
144
- D[n(223)](".") == -1 && (D += ".jpg");
145
- let S = D.split(".")[n(191)](), G = D[n(230)]("." + S, "") + "_" + R[n(259)] + "-" + R[n(184)] + "." + S;
146
- b[n(209)][n(218)] = n(253), b[n(244)](n(188), G), b[n(244)](n(216), R[n(197)]), document.body.appendChild(b), b.click(), b.remove();
147
- })), f();
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;
133
+ if (_) {
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();
148
144
  };
149
145
  return;
150
146
  }
151
- if ($ == r(197)) {
152
- m[r(233)](d[r(257)](N, y)), M && (globalThis[r(195)].queue[r(190)](), a[r(250)](), s[r(171)](m)), f();
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();
153
149
  return;
154
150
  }
155
- $ == "blob" && d[r(225)](function(P) {
156
- const l = r;
157
- m[l(233)](P), M && (globalThis[l(195)].queue[l(190)](), a[l(250)](), s[l(171)](m)), f();
158
- }, N, y);
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);
159
155
  });
160
156
  }
161
- globalThis[t(195)].queue.run();
162
- } catch (m) {
163
- console.error(t(201)), console.log(m);
157
+ globalThis[a(464)][a(490)].run();
158
+ } catch (u) {
159
+ console[a(470)](a(476)), console[a(403)](u);
164
160
  }
165
161
  });
166
162
  }
167
- return s[x(186)]();
163
+ return l[x(401)]();
168
164
  });
169
165
  };
170
- function L(o, e) {
171
- var x = Y();
172
- return L = function(a, s) {
173
- a = a - 189;
174
- var g = x[a];
175
- return g;
176
- }, L(o, e);
177
- }
178
166
  (function(o, e) {
179
- for (var x = L, a = o(); []; )
167
+ for (var x = $, t = o(); []; )
180
168
  try {
181
- var s = -parseInt(x(192)) / 1 * (-parseInt(x(201)) / 2) + parseInt(x(205)) / 3 * (parseInt(x(202)) / 4) + parseInt(x(193)) / 5 * (parseInt(x(200)) / 6) + -parseInt(x(194)) / 7 + -parseInt(x(191)) / 8 + -parseInt(x(197)) / 9 + -parseInt(x(204)) / 10 * (-parseInt(x(199)) / 11);
182
- if (s === e)
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)
183
171
  break;
184
- a.push(a.shift());
185
- } catch (g) {
186
- a.push(a.shift());
172
+ t.push(t.shift());
173
+ } catch (_) {
174
+ t.push(t.shift());
187
175
  }
188
- })(Y, 366221);
189
- function Y() {
190
- var o = ["1AAkkjv", "5iZCkmS", "1428861dHMliN", "add toImage Api to PrintTemplate", "newPrintTemplate", "3767040CnkuaJ", "defineProperty", "161579nyztyv", "3916518ELckIf", "556158oTrJKg", "49976snTHLq", "toImage", "20SifjYv", "162dOYxiV", "add toImage Api", "0.3.0", "5167856XwNzPL"];
191
- return Y = function() {
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() {
192
188
  return o;
193
- }, Y();
189
+ }, G();
194
190
  }
195
- function Z(o) {
196
- var e = L;
197
- return { name: e(189), description: "add toImage Api", hooks: [{ hook: e(196), name: e(195), description: e(195), priority: 1, run: ({ template: x, options: a }) => {
198
- var s = e;
199
- Object[s(198)](x, s(203), { value: K, enumerable: ![], writable: !![], configurable: !![] });
200
- } }], leastHiprintVersion: e(190) };
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) };
201
197
  }
202
198
  export {
203
- Z as default
199
+ K as default
204
200
  };
package/dist/index.umd.js CHANGED
@@ -1,8 +1,11 @@
1
- (function(I,b){typeof exports=="object"&&typeof module!="undefined"?module.exports=b(require("@zumer/snapdom")):typeof define=="function"&&define.amd?define(["@zumer/snapdom"],b):(I=typeof globalThis!="undefined"?globalThis:I||self,I.pluginApiImage=b(I.snapdom))})(this,function(I){"use strict";var J=(I,b,h)=>new Promise((Y,T)=>{var M=e=>{try{r(h.next(e))}catch(x){T(x)}},O=e=>{try{r(h.throw(e))}catch(x){T(x)}},r=e=>e.done?Y(e.value):Promise.resolve(e.value).then(M,O);r((h=h.apply(I,b)).next())});(function(r,e){const x=h,n=r();for(;[];)try{if(parseInt(x(211))/1*(-parseInt(x(251))/2)+parseInt(x(245))/3*(-parseInt(x(242))/4)+parseInt(x(256))/5+-parseInt(x(265))/6*(parseInt(x(179))/7)+parseInt(x(194))/8+parseInt(x(192))/9+-parseInt(x(234))/10*(-parseInt(x(178))/11)===e)break;n.push(n.shift())}catch(d){n.push(n.shift())}})(b,991907);function b(){const r=["limit","indexOf",'<div class="hiprint-printTemplate"></div>',"toBlob","devicePixelRatio","floor","getContext","extend","replace","cur",`<div class="hiprint-printPanel">
2
- <div class="hiprint-printPaper" style="width:`,"push","10YnsMhd","mm ","printPanels","total","src","paperHeight","mm;height:","getTempContainer","8eDbbnX","css","setAttribute","594483XRowmQ","min","layoutRowGap","clearRect","name","removeTempContainer","932ygrPYT",`mm;
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;
3
2
  }
4
- </style>`,"none","createElement","removeClass","408110KjYHgg","toDataURL","isDownload","start","loadAllImages","layoutColumnGap","panelLayoutOptions","clone","append","120CMfTqq","log","resolve","then","quality",".hiprint-printPanel .hiprint-printPaper","svg2canvas","height","find","20157643HusFlM","323043sVZSoM","pixelRatio","onProgress","html","createTempContainer","end","width","promise","add","download","image/jpeg","clear","pop","7153794EyDTgg",".hiprint-printPanel","6171216rQnmMY","hinnn","onload","url","paperWidth","getHtml","row","toImage \u5931\u8D25(\u53EF\u80FD\u60A8\u7684\u56FE\u7247\u8D44\u6E90\u65E0\u6CD5\u6B63\u5E38\u52A0\u8F7D): ","canvas","length","imageSmoothingEnabled","forEach","toImage percent: ",`mm;"></div>
5
- </div>`,"toCanvas","style",`<style>
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>
6
9
  .hiprint-printPanel-small{
7
10
  box-sizing: border-box;
8
11
  border: 0px;
@@ -16,7 +19,7 @@
16
19
  flex-wrap: wrap;
17
20
  flex-direction: column;
18
21
  align-content: flex-start;
19
- margin: -`,"2509IkPvtf","drawImage",".hiprint-printPaper","download.jpg","toType","href","queue","display","mm -",'<div class="hiprint-printPanel-small"></div>',"addClass"];return b=function(){return r},b()}function h(r,e){const x=b();return h=function(n,d){return n=n-171,x[n]},h(r,e)}const Y=function(r,e){return J(this,null,function*(){const x=h;let n=this,d=globalThis.$.Deferred(),N=!![],y=10,X=(s,g)=>{const m=h,S=Math.floor(s/g*100);console[m(266)](m(231),s,m(237),g),console.log(m(206),S+"%")};if(this[x(236)][x(203)]){let s=globalThis.$[x(229)]({},e||{}),g=yield this[x(199)](r,e);e&&(e.pixelRatio&&(s.dpr=e.pixelRatio,s.scale=e[x(180)]),e[x(258)]!=null&&(N=e[x(258)]),e[x(181)]!=null&&(X=e[x(181)]),e.limit!=null&&(y=e[x(222)])),globalThis.$(g)[x(243)](x(185),"").css("height",""),this[x(183)]();let m=this[x(241)](),S=this[x(236)][0][x(185)],K=this[x(236)][0][x(176)];const l=this[x(236)][0][x(262)];if(l&&(l[x(247)]>0||l[x(261)]>0)&&e.paperWidth&&e[x(239)]){let t=Math.floor(e[x(198)]/(S+l[x(247)]/2)),u=Math[x(227)](e[x(239)]/(K+l[x(261)]/2));const R=t*u,z=g[x(177)](x(174)),p=z[x(203)],A=Math.ceil(p/R);let P=globalThis.$(x(224));l.layoutType==x(200)?P[x(264)](`<style>
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>
20
23
  .hiprint-printPanel-small{
21
24
  box-sizing: border-box;
22
25
  border: 0px;
@@ -26,12 +29,5 @@
26
29
  padding: 0;
27
30
  }
28
31
  .hiprint-printTemplate .hiprint-printPaper{
29
- margin: -`+(Number(l[x(247)])||0)/2+x(219)+(Number(l[x(261)])||0)/2+`mm;
30
- }
31
- .hiprint-printTemplate .hiprint-printPanel-small {
32
- display:inline-block;
33
- padding: `+(Number(l[x(247)])||0)/2+x(235)+(Number(l[x(261)])||0)/2+x(252)):P.append(x(210)+(Number(l[x(247)])||0)/2+x(219)+(Number(l[x(261)])||0)/2+`mm;
34
- }
35
- .hiprint-printTemplate .hiprint-printPanel-small {
36
- display:inline-block;
37
- padding: `+(Number(l[x(247)])||0)/2+x(235)+(Number(l[x(261)])||0)/2+x(252));for(let w=0;w<A;w++){const _=globalThis.$(x(232)+e[x(198)]+x(240)+e[x(239)]+x(207)),j=w*R,D=Math[x(246)]((w+1)*R,p);for(let v=j;v<D;v++){const f=z.eq(v)[x(263)]();f[x(255)]("hiprint-printPaper"),f[x(221)]("hiprint-printPaper-small start-"+v);const i=globalThis.$(x(220));i[x(264)](f),_[x(177)](x(213))[x(264)](i)}P[x(264)](_)}this[x(175)](P,s),m[x(182)](P[0])}else this[x(175)](g,s),m[x(182)](g[0]);let V=m[x(177)](".hiprint-printPanel .hiprint-printPaper")[x(203)];globalThis.$(g)[x(243)]("position:fixed"),this[x(260)](g,function(){const t=x;try{let u=[],R=Math.ceil(V/y),z=V%y||1;const p=document.createElement(t(202)),A=p[t(228)]("2d"),P=m.find(t(193)).eq(0)[t(185)](),w=P*(s[t(180)]||globalThis[t(226)]);for(let _=0;_<R;_++){A[t(248)](0,0,p[t(185)],p[t(176)]);const j=_==R-1;let D=0,v=j?z:y;for(let f=0;f<v;f++){A[t(248)](0,0,p[t(185)],p[t(176)]);const i=_*y+f,H=m[t(177)](t(174))[i];globalThis[t(195)][t(217)].add(function(E){const k=t;I.snapdom[k(208)](H,s)[k(172)](function(q){const o=k;let C=q[o(228)]("2d");C[o(204)]=![];let $=q[o(257)](o(189),s[o(173)]||.92),a=new Image;a.src=$,a[o(196)]=function(){const c=o;f===0&&(p[c(185)]=w,p[c(176)]=a[c(176)]*v),D+=a.height,A[c(212)](a,0,D-a[c(176)],w,a[c(176)]),X(i+1,V),E()}})})}globalThis[t(195)][t(217)][t(187)](function(f){const i=t;let H=s.type||i(189),E=s[i(215)]||i(197),k=s.quality||.8;if(N){let q=p.toDataURL(H,k),o=new Image;o[i(238)]=q,o[i(196)]=function(){const C=i;u.push({url:q,start:_*y+1,end:_*y+v}),j&&(globalThis.hinnn[C(217)][C(190)](),n[C(250)](),u[C(205)]($=>{const a=C;let c=document[a(254)]("a"),L=e[a(249)]||a(214);L[a(223)](".")==-1&&(L+=".jpg");let G=L.split(".")[a(191)](),Q=L[a(230)]("."+G,"")+"_"+$[a(259)]+"-"+$[a(184)]+"."+G;c[a(209)][a(218)]=a(253),c[a(244)](a(188),Q),c[a(244)](a(216),$[a(197)]),document.body.appendChild(c),c.click(),c.remove()})),f()};return}if(E==i(197)){u[i(233)](p[i(257)](H,k)),j&&(globalThis[i(195)].queue[i(190)](),n[i(250)](),d[i(171)](u)),f();return}E=="blob"&&p[i(225)](function(q){const o=i;u[o(233)](q),j&&(globalThis[o(195)].queue[o(190)](),n[o(250)](),d[o(171)](u)),f()},H,k)})}globalThis[t(195)].queue.run()}catch(u){console.error(t(201)),console.log(u)}})}return d[x(186)]()})};function T(r,e){var x=M();return T=function(n,d){n=n-189;var N=x[n];return N},T(r,e)}(function(r,e){for(var x=T,n=r();[];)try{var d=-parseInt(x(192))/1*(-parseInt(x(201))/2)+parseInt(x(205))/3*(parseInt(x(202))/4)+parseInt(x(193))/5*(parseInt(x(200))/6)+-parseInt(x(194))/7+-parseInt(x(191))/8+-parseInt(x(197))/9+-parseInt(x(204))/10*(-parseInt(x(199))/11);if(d===e)break;n.push(n.shift())}catch(N){n.push(n.shift())}})(M,366221);function M(){var r=["1AAkkjv","5iZCkmS","1428861dHMliN","add toImage Api to PrintTemplate","newPrintTemplate","3767040CnkuaJ","defineProperty","161579nyztyv","3916518ELckIf","556158oTrJKg","49976snTHLq","toImage","20SifjYv","162dOYxiV","add toImage Api","0.3.0","5167856XwNzPL"];return M=function(){return r},M()}function O(r){var e=T;return{name:e(189),description:"add toImage Api",hooks:[{hook:e(196),name:e(195),description:e(195),priority:1,run:({template:x,options:n})=>{var d=e;Object[d(198)](x,d(203),{value:Y,enumerable:![],writable:!![],configurable:!![]})}}],leastHiprintVersion:e(190)}}return O});
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.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "add image api to print template",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",