@sv-print/plugin-api-image 0.2.1 → 0.2.2

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,33 +1 @@
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
- }
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>
9
- .hiprint-printPanel-small{
10
- box-sizing: border-box;
11
- border: 0px;
12
- }
13
- .hiprint-printPaper-small{
14
- position: relative;
15
- padding: 0;
16
- }
17
- .hiprint-printTemplate .hiprint-printPaper{
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
- .hiprint-printPanel-small{
24
- box-sizing: border-box;
25
- border: 0px;
26
- }
27
- .hiprint-printPaper-small{
28
- position: relative;
29
- padding: 0;
30
- }
31
- .hiprint-printTemplate .hiprint-printPaper{
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;
1
+ "use strict";var B=(r,e,x)=>new Promise((n,i)=>{var h=o=>{try{v(x.next(o))}catch(b){i(b)}},u=o=>{try{v(x.throw(o))}catch(b){i(b)}},v=o=>o.done?n(o.value):Promise.resolve(o.value).then(h,u);v((x=x.apply(r,e)).next())});const S=require("@zumer/snapdom");function j(){const r=["clearRect","log","queue","createElement","141776MXtEoF","download","5AWMeBv","quality","dpr","devicePixelRatio","pop","154JvCxXU","run","find","clear","1119465HjFNXu","#fff","push","promise","name","getTempContainer","printPanels","Deferred","ceil","style","cur","toCanvas","2GAOFeX","split",".hiprint-printPanel","loadAllImages","575400DBEefY","5477481wrLhXo","onProgress","click","createTempContainer","image/jpeg","html","pixelRatio","height","toType","toBlob","isDownload","51654DgYjVv","toDataURL","css","href","remove",".jpg","removeTempContainer","download.jpg","toImage 失败(可能您的图片资源无法正常加载): ","setAttribute","replace","svg2canvas","url","indexOf","end","forEach","type","src","resolve","add","none","canvas","start",".hiprint-printPanel .hiprint-printPaper","onload","limit","floor","2010900RmMcnx","getHtml","then","toImage percent: ","hinnn","getContext","drawImage","length","19752890QOzFkk","width"];return j=function(){return r},j()}function R(r,e){const x=j();return R=function(n,i){return n=n-381,x[n]},R(r,e)}(function(r,e){const x=R,n=r();for(;;)try{if(-parseInt(x(393))/1+parseInt(x(389))/2*(-parseInt(x(457))/3)+-parseInt(x(432))/4+-parseInt(x(448))/5*(-parseInt(x(405))/6)+parseInt(x(453))/7*(parseInt(x(446))/8)+-parseInt(x(394))/9+parseInt(x(440))/10===e)break;n.push(n.shift())}catch(i){n.push(n.shift())}})(j,313893);const $=function(r,e){return B(this,null,function*(){const x=R;let n=this,i=globalThis.$[x(384)](),h=!0,u=10,v=(o,b)=>{const p=x,w=Math[p(431)](o/b*100);console[p(443)](p(387),o,"total",b),console[p(443)](p(435),w+"%")};if(this[x(383)][x(439)]){let o=globalThis.$.extend({backgroundColor:x(458)},e||{}),b=yield this[x(433)](r,e);e&&(e[x(400)]&&(o[x(450)]=e.pixelRatio),e[x(404)]!=null&&(h=e[x(404)]),e[x(395)]!=null&&(v=e[x(395)]),e[x(430)]!=null&&(u=e[x(430)])),globalThis.$(b).css(x(441),"")[x(407)](x(401),""),this[x(397)]();let p=this[x(382)]();this[x(416)](b,o),p[x(399)](b[0]);let w=p.find(x(428))[x(439)];globalThis.$(b).css("position:fixed"),this[x(392)](p,function(){const t=x;try{let f=[],U=Math[t(385)](w/u),G=w%u||1;const d=document[t(445)](t(426)),F=d[t(437)]("2d"),O=p[t(455)](t(391)).eq(0)[t(441)](),H=O*(o[t(450)]||globalThis[t(451)]);for(let T=0;T<U;T++){F[t(442)](0,0,d[t(441)],d.height);const C=T==U-1;let M=0,D=C?G:u;for(let _=0;_<D;_++){F[t(442)](0,0,d[t(441)],d[t(401)]);const c=T*u+_,y=p.find(t(428))[c];globalThis[t(436)].queue[t(424)](function(k){const g=t;S.snapdom[g(388)](y,o)[g(434)](function(m){const s=g;let I=m[s(437)]("2d");I.imageSmoothingEnabled=!1;let A=m[s(406)](s(398),o[s(449)]||.92),a=new Image;a[s(422)]=A,a[s(429)]=function(){const l=s;_===0&&(d[l(441)]=H,d[l(401)]=a.height*D),M+=a[l(401)],F[l(438)](a,0,M-a[l(401)],H,a.height),v(c+1,w),k()}})})}globalThis[t(436)][t(444)][t(424)](function(_){const c=t;let y=o[c(421)]||c(398),k=o[c(402)]||c(417),g=o[c(449)]||.8;if(h){let m=d.toDataURL(y,g),s=new Image;s.src=m,s[c(429)]=function(){const I=c;f[I(459)]({url:m,start:T*u+1,end:T*u+D}),C&&(globalThis[I(436)].queue[I(456)](),n.removeTempContainer(),f[I(420)](A=>{const a=I;let l=document[a(445)]("a"),P=e[a(381)]||a(412);P[a(418)](".")==-1&&(P+=a(410));let X=P[a(390)](".")[a(452)](),Q=P[a(415)]("."+X,"")+"_"+A[a(427)]+"-"+A[a(419)]+"."+X;l[a(386)].display=a(425),l[a(414)](a(447),Q),l[a(414)](a(408),A.url),document.body.appendChild(l),l[a(396)](),l[a(409)]()})),_()};return}if(k==c(417)){f[c(459)](d[c(406)](y,g)),C&&(globalThis[c(436)][c(444)].clear(),n[c(411)](),i[c(423)](f)),_();return}k=="blob"&&d[c(403)](function(m){const s=c;f.push(m),C&&(globalThis.hinnn[s(444)][s(456)](),n.removeTempContainer(),i[s(423)](f)),_()},y,g)})}globalThis[t(436)][t(444)][t(454)]()}catch(f){console.error(t(413)),console[t(443)](f)}})}return i[x(460)]()})};function q(){var r=["add toImage Api to PrintTemplate","1427AkFKHQ","4119890haQGfT","6583968UtqRGZ","280941AxjpFQ","44AEhNAs","defineProperty","45677710GiUZyJ","7743750AsFHSd","7890054ESuxUt","newPrintTemplate","0.3.0","toImage","add toImage Api","9zvBpja","1958AdiniS"];return q=function(){return r},q()}(function(r,e){for(var x=E,n=r();;)try{var i=parseInt(x(490))/1*(-parseInt(x(488))/2)+-parseInt(x(493))/3*(parseInt(x(494))/4)+-parseInt(x(491))/5+parseInt(x(482))/6+-parseInt(x(481))/7+-parseInt(x(492))/8+parseInt(x(487))/9*(parseInt(x(480))/10);if(i===e)break;n.push(n.shift())}catch(h){n.push(n.shift())}})(q,702406);function E(r,e){var x=q();return E=function(n,i){n=n-479;var h=x[n];return h},E(r,e)}function L(r){var e=E;return{name:e(486),description:e(486),hooks:[{hook:e(483),name:e(489),description:e(489),priority:1,run:({template:x,options:n})=>{var i=e;Object[i(479)](x,i(485),{value:$,enumerable:!1,writable:!0,configurable:!0})}}],leastHiprintVersion:e(484)}}module.exports=L;
package/dist/index.mjs CHANGED
@@ -1,200 +1,148 @@
1
- var O = (o, e, x) => new Promise((t, l) => {
2
- var _ = (i) => {
1
+ var B = (r, e, x) => new Promise((n, i) => {
2
+ var h = (o) => {
3
3
  try {
4
- y(x.next(i));
5
- } catch (d) {
6
- l(d);
4
+ v(x.next(o));
5
+ } catch (b) {
6
+ i(b);
7
7
  }
8
- }, f = (i) => {
8
+ }, u = (o) => {
9
9
  try {
10
- y(x.throw(i));
11
- } catch (d) {
12
- l(d);
10
+ v(x.throw(o));
11
+ } catch (b) {
12
+ i(b);
13
13
  }
14
- }, y = (i) => i.done ? t(i.value) : Promise.resolve(i.value).then(_, f);
15
- y((x = x.apply(o, e)).next());
14
+ }, v = (o) => o.done ? n(o.value) : Promise.resolve(o.value).then(h, u);
15
+ v((x = x.apply(r, e)).next());
16
16
  });
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);
17
+ import { snapdom as S } from "@zumer/snapdom";
18
+ function j() {
19
+ const r = ["clearRect", "log", "queue", "createElement", "141776MXtEoF", "download", "5AWMeBv", "quality", "dpr", "devicePixelRatio", "pop", "154JvCxXU", "run", "find", "clear", "1119465HjFNXu", "#fff", "push", "promise", "name", "getTempContainer", "printPanels", "Deferred", "ceil", "style", "cur", "toCanvas", "2GAOFeX", "split", ".hiprint-printPanel", "loadAllImages", "575400DBEefY", "5477481wrLhXo", "onProgress", "click", "createTempContainer", "image/jpeg", "html", "pixelRatio", "height", "toType", "toBlob", "isDownload", "51654DgYjVv", "toDataURL", "css", "href", "remove", ".jpg", "removeTempContainer", "download.jpg", "toImage 失败(可能您的图片资源无法正常加载): ", "setAttribute", "replace", "svg2canvas", "url", "indexOf", "end", "forEach", "type", "src", "resolve", "add", "none", "canvas", "start", ".hiprint-printPanel .hiprint-printPaper", "onload", "limit", "floor", "2010900RmMcnx", "getHtml", "then", "toImage percent: ", "hinnn", "getContext", "drawImage", "length", "19752890QOzFkk", "width"];
20
+ return j = function() {
21
+ return r;
22
+ }, j();
23
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;
26
- }
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>
33
- .hiprint-printPanel-small{
34
- box-sizing: border-box;
35
- border: 0px;
36
- }
37
- .hiprint-printPaper-small{
38
- position: relative;
39
- padding: 0;
40
- }
41
- .hiprint-printTemplate .hiprint-printPaper{
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();
24
+ function R(r, e) {
25
+ const x = j();
26
+ return R = function(n, i) {
27
+ return n = n - 381, x[n];
28
+ }, R(r, e);
50
29
  }
51
- (function(o, e) {
52
- const x = M, t = o();
53
- for (; []; )
30
+ (function(r, e) {
31
+ const x = R, n = r();
32
+ for (; ; )
54
33
  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());
34
+ if (-parseInt(x(393)) / 1 + parseInt(x(389)) / 2 * (-parseInt(x(457)) / 3) + -parseInt(x(432)) / 4 + -parseInt(x(448)) / 5 * (-parseInt(x(405)) / 6) + parseInt(x(453)) / 7 * (parseInt(x(446)) / 8) + -parseInt(x(394)) / 9 + parseInt(x(440)) / 10 === e) break;
35
+ n.push(n.shift());
36
+ } catch (i) {
37
+ n.push(n.shift());
60
38
  }
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 + "%");
39
+ })(j, 313893);
40
+ const $ = function(r, e) {
41
+ return B(this, null, function* () {
42
+ const x = R;
43
+ let n = this, i = globalThis.$[x(384)](), h = !0, u = 10, v = (o, b) => {
44
+ const p = x, w = Math[p(431)](o / b * 100);
45
+ console[p(443)](p(387), o, "total", b), console[p(443)](p(435), w + "%");
68
46
  };
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>
79
- .hiprint-printPanel-small{
80
- box-sizing: border-box;
81
- border: 0px;
82
- }
83
- .hiprint-printPaper-small{
84
- position: relative;
85
- padding: 0;
86
- }
87
- .hiprint-printTemplate .hiprint-printPaper{
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);
97
- }
98
- v[x(467)](g);
99
- }
100
- this[x(466)](v, i), m[x(450)](v[0]);
101
- } else
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;
47
+ if (this[x(383)][x(439)]) {
48
+ let o = globalThis.$.extend({ backgroundColor: x(458) }, e || {}), b = yield this[x(433)](r, e);
49
+ e && (e[x(400)] && (o[x(450)] = e.pixelRatio), e[x(404)] != null && (h = e[x(404)]), e[x(395)] != null && (v = e[x(395)]), e[x(430)] != null && (u = e[x(430)])), globalThis.$(b).css(x(441), "")[x(407)](x(401), ""), this[x(397)]();
50
+ let p = this[x(382)]();
51
+ this[x(416)](b, o), p[x(399)](b[0]);
52
+ let w = p.find(x(428))[x(439)];
53
+ globalThis.$(b).css("position:fixed"), this[x(392)](p, function() {
54
+ const t = x;
106
55
  try {
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();
56
+ let f = [], U = Math[t(385)](w / u), G = w % u || 1;
57
+ const d = document[t(445)](t(426)), q = d[t(437)]("2d"), O = p[t(455)](t(391)).eq(0)[t(441)](), H = O * (o[t(450)] || globalThis[t(451)]);
58
+ for (let T = 0; T < U; T++) {
59
+ q[t(442)](0, 0, d[t(441)], d.height);
60
+ const C = T == U - 1;
61
+ let M = 0, D = C ? G : u;
62
+ for (let _ = 0; _ < D; _++) {
63
+ q[t(442)](0, 0, d[t(441)], d[t(401)]);
64
+ const c = T * u + _, y = p.find(t(428))[c];
65
+ globalThis[t(436)].queue[t(424)](function(k) {
66
+ const g = t;
67
+ S[g(388)](y, o)[g(434)](function(m) {
68
+ const s = g;
69
+ let I = m[s(437)]("2d");
70
+ I.imageSmoothingEnabled = !1;
71
+ let A = m[s(406)](s(398), o[s(449)] || 0.92), a = new Image();
72
+ a[s(422)] = A, a[s(429)] = function() {
73
+ const l = s;
74
+ _ === 0 && (d[l(441)] = H, d[l(401)] = a.height * D), M += a[l(401)], q[l(438)](a, 0, M - a[l(401)], H, a.height), v(c + 1, w), k();
126
75
  };
127
76
  });
128
77
  });
129
78
  }
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();
79
+ globalThis[t(436)][t(444)][t(424)](function(_) {
80
+ const c = t;
81
+ let y = o[c(421)] || c(398), k = o[c(402)] || c(417), g = o[c(449)] || 0.8;
82
+ if (h) {
83
+ let m = d.toDataURL(y, g), s = new Image();
84
+ s.src = m, s[c(429)] = function() {
85
+ const I = c;
86
+ f[I(459)]({ url: m, start: T * u + 1, end: T * u + D }), C && (globalThis[I(436)].queue[I(456)](), n.removeTempContainer(), f[I(420)]((A) => {
87
+ const a = I;
88
+ let l = document[a(445)]("a"), P = e[a(381)] || a(412);
89
+ P[a(418)](".") == -1 && (P += a(410));
90
+ let X = P[a(390)](".")[a(452)](), Q = P[a(415)]("." + X, "") + "_" + A[a(427)] + "-" + A[a(419)] + "." + X;
91
+ l[a(386)].display = a(425), l[a(414)](a(447), Q), l[a(414)](a(408), A.url), document.body.appendChild(l), l[a(396)](), l[a(409)]();
92
+ })), _();
144
93
  };
145
94
  return;
146
95
  }
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();
96
+ if (k == c(417)) {
97
+ f[c(459)](d[c(406)](y, g)), C && (globalThis[c(436)][c(444)].clear(), n[c(411)](), i[c(423)](f)), _();
149
98
  return;
150
99
  }
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);
100
+ k == "blob" && d[c(403)](function(m) {
101
+ const s = c;
102
+ f.push(m), C && (globalThis.hinnn[s(444)][s(456)](), n.removeTempContainer(), i[s(423)](f)), _();
103
+ }, y, g);
155
104
  });
156
105
  }
157
- globalThis[a(464)][a(490)].run();
158
- } catch (u) {
159
- console[a(470)](a(476)), console[a(403)](u);
106
+ globalThis[t(436)][t(444)][t(454)]();
107
+ } catch (f) {
108
+ console.error(t(413)), console[t(443)](f);
160
109
  }
161
110
  });
162
111
  }
163
- return l[x(401)]();
112
+ return i[x(460)]();
164
113
  });
165
114
  };
166
- (function(o, e) {
167
- for (var x = $, t = o(); []; )
115
+ function E() {
116
+ var r = ["add toImage Api to PrintTemplate", "1427AkFKHQ", "4119890haQGfT", "6583968UtqRGZ", "280941AxjpFQ", "44AEhNAs", "defineProperty", "45677710GiUZyJ", "7743750AsFHSd", "7890054ESuxUt", "newPrintTemplate", "0.3.0", "toImage", "add toImage Api", "9zvBpja", "1958AdiniS"];
117
+ return E = function() {
118
+ return r;
119
+ }, E();
120
+ }
121
+ (function(r, e) {
122
+ for (var x = F, n = r(); ; )
168
123
  try {
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)
171
- break;
172
- t.push(t.shift());
173
- } catch (_) {
174
- t.push(t.shift());
124
+ var i = parseInt(x(490)) / 1 * (-parseInt(x(488)) / 2) + -parseInt(x(493)) / 3 * (parseInt(x(494)) / 4) + -parseInt(x(491)) / 5 + parseInt(x(482)) / 6 + -parseInt(x(481)) / 7 + -parseInt(x(492)) / 8 + parseInt(x(487)) / 9 * (parseInt(x(480)) / 10);
125
+ if (i === e) break;
126
+ n.push(n.shift());
127
+ } catch (h) {
128
+ n.push(n.shift());
175
129
  }
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();
130
+ })(E, 702406);
131
+ function F(r, e) {
132
+ var x = E();
133
+ return F = function(n, i) {
134
+ n = n - 479;
135
+ var h = x[n];
136
+ return h;
137
+ }, F(r, e);
190
138
  }
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) };
139
+ function J(r) {
140
+ var e = F;
141
+ return { name: e(486), description: e(486), hooks: [{ hook: e(483), name: e(489), description: e(489), priority: 1, run: ({ template: x, options: n }) => {
142
+ var i = e;
143
+ Object[i(479)](x, i(485), { value: $, enumerable: !1, writable: !0, configurable: !0 });
144
+ } }], leastHiprintVersion: e(484) };
197
145
  }
198
146
  export {
199
- K as default
147
+ J as default
200
148
  };
package/dist/index.umd.js CHANGED
@@ -1,33 +1 @@
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
- }
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>
9
- .hiprint-printPanel-small{
10
- box-sizing: border-box;
11
- border: 0px;
12
- }
13
- .hiprint-printPaper-small{
14
- position: relative;
15
- padding: 0;
16
- }
17
- .hiprint-printTemplate .hiprint-printPaper{
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
- .hiprint-printPanel-small{
24
- box-sizing: border-box;
25
- border: 0px;
26
- }
27
- .hiprint-printPaper-small{
28
- position: relative;
29
- padding: 0;
30
- }
31
- .hiprint-printTemplate .hiprint-printPaper{
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});
1
+ (function(f,p){typeof exports=="object"&&typeof module!="undefined"?module.exports=p(require("@zumer/snapdom")):typeof define=="function"&&define.amd?define(["@zumer/snapdom"],p):(f=typeof globalThis!="undefined"?globalThis:f||self,f.pluginApiImage=p(f.window))})(this,function(f){"use strict";var O=(f,p,u)=>new Promise((F,m)=>{var y=x=>{try{i(u.next(x))}catch(e){m(e)}},D=x=>{try{i(u.throw(x))}catch(e){m(e)}},i=x=>x.done?F(x.value):Promise.resolve(x.value).then(y,D);i((u=u.apply(f,p)).next())});function p(){const i=["clearRect","log","queue","createElement","141776MXtEoF","download","5AWMeBv","quality","dpr","devicePixelRatio","pop","154JvCxXU","run","find","clear","1119465HjFNXu","#fff","push","promise","name","getTempContainer","printPanels","Deferred","ceil","style","cur","toCanvas","2GAOFeX","split",".hiprint-printPanel","loadAllImages","575400DBEefY","5477481wrLhXo","onProgress","click","createTempContainer","image/jpeg","html","pixelRatio","height","toType","toBlob","isDownload","51654DgYjVv","toDataURL","css","href","remove",".jpg","removeTempContainer","download.jpg","toImage 失败(可能您的图片资源无法正常加载): ","setAttribute","replace","svg2canvas","url","indexOf","end","forEach","type","src","resolve","add","none","canvas","start",".hiprint-printPanel .hiprint-printPaper","onload","limit","floor","2010900RmMcnx","getHtml","then","toImage percent: ","hinnn","getContext","drawImage","length","19752890QOzFkk","width"];return p=function(){return i},p()}function u(i,x){const e=p();return u=function(a,r){return a=a-381,e[a]},u(i,x)}(function(i,x){const e=u,a=i();for(;;)try{if(-parseInt(e(393))/1+parseInt(e(389))/2*(-parseInt(e(457))/3)+-parseInt(e(432))/4+-parseInt(e(448))/5*(-parseInt(e(405))/6)+parseInt(e(453))/7*(parseInt(e(446))/8)+-parseInt(e(394))/9+parseInt(e(440))/10===x)break;a.push(a.shift())}catch(r){a.push(a.shift())}})(p,313893);const F=function(i,x){return O(this,null,function*(){const e=u;let a=this,r=globalThis.$[e(384)](),A=!0,g=10,M=(l,I)=>{const d=e,j=Math[d(431)](l/I*100);console[d(443)](d(387),l,"total",I),console[d(443)](d(435),j+"%")};if(this[e(383)][e(439)]){let l=globalThis.$.extend({backgroundColor:e(458)},x||{}),I=yield this[e(433)](i,x);x&&(x[e(400)]&&(l[e(450)]=x.pixelRatio),x[e(404)]!=null&&(A=x[e(404)]),x[e(395)]!=null&&(M=x[e(395)]),x[e(430)]!=null&&(g=x[e(430)])),globalThis.$(I).css(e(441),"")[e(407)](e(401),""),this[e(397)]();let d=this[e(382)]();this[e(416)](I,l),d[e(399)](I[0]);let j=d.find(e(428))[e(439)];globalThis.$(I).css("position:fixed"),this[e(392)](d,function(){const t=e;try{let h=[],X=Math[t(385)](j/g),Q=j%g||1;const b=document[t(445)](t(426)),U=b[t(437)]("2d"),S=d[t(455)](t(391)).eq(0)[t(441)](),z=S*(l[t(450)]||globalThis[t(451)]);for(let C=0;C<X;C++){U[t(442)](0,0,b[t(441)],b.height);const R=C==X-1;let B=0,H=R?Q:g;for(let _=0;_<H;_++){U[t(442)](0,0,b[t(441)],b[t(401)]);const o=C*g+_,k=d.find(t(428))[o];globalThis[t(436)].queue[t(424)](function(q){const v=t;f.snapdom[v(388)](k,l)[v(434)](function(T){const c=v;let w=T[c(437)]("2d");w.imageSmoothingEnabled=!1;let P=T[c(406)](c(398),l[c(449)]||.92),n=new Image;n[c(422)]=P,n[c(429)]=function(){const s=c;_===0&&(b[s(441)]=z,b[s(401)]=n.height*H),B+=n[s(401)],U[s(438)](n,0,B-n[s(401)],z,n.height),M(o+1,j),q()}})})}globalThis[t(436)][t(444)][t(424)](function(_){const o=t;let k=l[o(421)]||o(398),q=l[o(402)]||o(417),v=l[o(449)]||.8;if(A){let T=b.toDataURL(k,v),c=new Image;c.src=T,c[o(429)]=function(){const w=o;h[w(459)]({url:T,start:C*g+1,end:C*g+H}),R&&(globalThis[w(436)].queue[w(456)](),a.removeTempContainer(),h[w(420)](P=>{const n=w;let s=document[n(445)]("a"),E=x[n(381)]||n(412);E[n(418)](".")==-1&&(E+=n(410));let G=E[n(390)](".")[n(452)](),$=E[n(415)]("."+G,"")+"_"+P[n(427)]+"-"+P[n(419)]+"."+G;s[n(386)].display=n(425),s[n(414)](n(447),$),s[n(414)](n(408),P.url),document.body.appendChild(s),s[n(396)](),s[n(409)]()})),_()};return}if(q==o(417)){h[o(459)](b[o(406)](k,v)),R&&(globalThis[o(436)][o(444)].clear(),a[o(411)](),r[o(423)](h)),_();return}q=="blob"&&b[o(403)](function(T){const c=o;h.push(T),R&&(globalThis.hinnn[c(444)][c(456)](),a.removeTempContainer(),r[c(423)](h)),_()},k,v)})}globalThis[t(436)][t(444)][t(454)]()}catch(h){console.error(t(413)),console[t(443)](h)}})}return r[e(460)]()})};function m(){var i=["add toImage Api to PrintTemplate","1427AkFKHQ","4119890haQGfT","6583968UtqRGZ","280941AxjpFQ","44AEhNAs","defineProperty","45677710GiUZyJ","7743750AsFHSd","7890054ESuxUt","newPrintTemplate","0.3.0","toImage","add toImage Api","9zvBpja","1958AdiniS"];return m=function(){return i},m()}(function(i,x){for(var e=y,a=i();;)try{var r=parseInt(e(490))/1*(-parseInt(e(488))/2)+-parseInt(e(493))/3*(parseInt(e(494))/4)+-parseInt(e(491))/5+parseInt(e(482))/6+-parseInt(e(481))/7+-parseInt(e(492))/8+parseInt(e(487))/9*(parseInt(e(480))/10);if(r===x)break;a.push(a.shift())}catch(A){a.push(a.shift())}})(m,702406);function y(i,x){var e=m();return y=function(a,r){a=a-479;var A=e[a];return A},y(i,x)}function D(i){var x=y;return{name:x(486),description:x(486),hooks:[{hook:x(483),name:x(489),description:x(489),priority:1,run:({template:e,options:a})=>{var r=x;Object[r(479)](e,r(485),{value:F,enumerable:!1,writable:!0,configurable:!0})}}],leastHiprintVersion:x(484)}}return D});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sv-print/plugin-api-image",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "add image api to print template",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",