@sv-print/plugin-api-pdf 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var S=(a,n,x)=>new Promise((e,o)=>{var d=t=>{try{p(x.next(t))}catch(f){o(f)}},m=t=>{try{p(x.throw(t))}catch(f){o(f)}},p=t=>t.done?e(t.value):Promise.resolve(t.value).then(d,m);p((x=x.apply(a,n)).next())});const U=require("@zumer/snapdom"),W=require("jspdf");(function(a,n){const x=y,e=a();for(;;)try{if(-parseInt(x(181))/1*(-parseInt(x(219))/2)+parseInt(x(213))/3+-parseInt(x(220))/4*(parseInt(x(212))/5)+-parseInt(x(200))/6*(parseInt(x(182))/7)+parseInt(x(227))/8+parseInt(x(203))/9+-parseInt(x(184))/10===n)break;e.push(e.shift())}catch(o){e.push(e.shift())}})(w,998909);function w(){const a=["3358983pLJjpl","paperHeight","pixelRatio","Deferred","extend","each","108cpHUHk","152tMUSqg","getOrient","addImage","createTempContainer","JPEG","printPanels","height","2738168EjIhWV","getHtml","add","#fff","自定义","name","paperWidth",".pdf","toPdf percent: ","floor",".hiprint-printPanel .hiprint-printPaper","resolve","hinnn","output","position:fixed","image/jpeg","message","indexOf","blob","toPdf 失败(可能您的图片资源无法正常加载): ","toCanvas","portrait","removeTempContainer","25766FaCiRS","455518znuvMt","clear","29328650AEjNPL","promise","queue","error","toLocaleLowerCase","toDataURL","length","catch","quality","onProgress","css","width","paperType","isDownload","find","then","12OdchtS","loadAllImages","html","11243232ZnkyFS","scale","run","toPt","imageSmoothingEnabled","now","log","svg2canvas","landscape","5345BKGGqa"];return w=function(){return a},w()}const F=function(a,n,x){return S(this,null,function*(){const e=y;var o=this,d=globalThis.$[e(216)](),m=!0;let p=(I,T)=>{const l=e,b=Math[l(236)](I/T*100);console[l(209)]("cur",I,"total",T),console.log(l(235),b+"%")},t=x||{};if(this[e(225)].length){if(typeof n=="string"){const s=n[e(175)](e(234))>-1?n:n+e(234);t[e(232)]=s}else t=n||{},!t.name&&(t.name="sv-print-"+Date[e(208)]()+e(234));let I=this[e(225)][0][e(195)],T=this[e(225)][0][e(226)];const l=t[e(233)]&&t[e(214)];var f=globalThis.hinnn.mm[e(206)](t[e(233)]||I),q=globalThis.hinnn.mm[e(206)](t[e(214)]||T),u=globalThis.$[e(217)]({backgroundColor:e(230)},t||{});const b=this[e(225)][0][e(196)],D=b!=null&&b!=""&&b!=e(231),O=this[e(221)](0)==1||l?e(179):e(211),E=D&&!l?b[e(188)]():[f,q];var v=new W.jsPDF({orientation:O,unit:"pt",format:E}),_=yield this[e(228)](a,t);t&&(t[e(215)]&&(u.dpr=t[e(215)],u[e(204)]=t.pixelRatio),t.isDownload!=null&&(m=t[e(197)]),t[e(193)]!=null&&(p=t[e(193)])),globalThis.$(_).css(e(195),"")[e(194)](e(226),""),this[e(223)]();var P=this.getTempContainer();this[e(210)](_,u),P[e(202)](_[0]),globalThis.$(_).css(e(241));let j=P[e(198)](e(237))[e(190)];this[e(201)](P,function(){const s=e;try{P[s(198)](s(237))[s(218)](function(g,H){const c=s;globalThis[c(239)].queue.add(function(A){const r=c;U.snapdom[r(178)](H,u)[r(199)](function(h){const i=r;var L=h.getContext("2d");L[i(207)]=!1;var R=h[i(189)](i(242),u[i(192)]||.92);v[i(222)](R,i(224),0,0,f,q),g<j-1&&v.addPage(),p(g+1,j),A()})[r(191)](h=>{const i=r;throw new Error(h[i(243)])})}),g==j-1&&(globalThis[c(239)][c(186)][c(229)](function(A){const r=c;if(m)o[r(180)](),v.save(t[r(232)]);else{o[r(180)]();let h=t.type||r(176),i=v[r(240)](h);d[r(238)](i)}globalThis.hinnn[r(186)][r(183)]()}),globalThis[c(239)][c(186)][c(205)]())})}catch(g){console[s(187)](s(177)),console[s(209)](g)}})}return d[e(185)]()})};function y(a,n){const x=w();return y=function(e,o){return e=e-175,x[e]},y(a,n)}(function(a,n){for(var x=k,e=a();;)try{var o=parseInt(x(110))/1+-parseInt(x(108))/2*(parseInt(x(113))/3)+parseInt(x(115))/4*(-parseInt(x(114))/5)+-parseInt(x(112))/6+parseInt(x(109))/7+-parseInt(x(111))/8*(parseInt(x(119))/9)+parseInt(x(121))/10;if(o===n)break;e.push(e.shift())}catch(d){e.push(e.shift())}})(C,452171);function k(a,n){var x=C();return k=function(e,o){e=e-107;var d=x[e];return d},k(a,n)}function J(a){var n=k;return{name:n(120),description:"add toPdf Api",hooks:[{hook:"newPrintTemplate",name:"add toPdf Api to PrintTemplate",description:n(118),priority:1,run:({template:x,options:e})=>{var o=n;Object[o(107)](x,o(116),{value:F,enumerable:!1,writable:!0,configurable:!0})}}],leastHiprintVersion:n(117)}}function C(){var a=["add toPdf Api","9333550RwXQdP","defineProperty","312718ZVTmse","539938NUAttv","824089SpfuXz","40TnvvPr","1473846SJXJZg","6WFTWOY","161065QkcmVK","44xZTOUo","toPdf","0.3.0","add toPdf Api to PrintTemplate","845469rygPpW"];return C=function(){return a},C()}module.exports=J;
1
+ "use strict";var k=(a,n,x)=>new Promise((t,o)=>{var s=e=>{try{d(x.next(e))}catch(f){o(f)}},m=e=>{try{d(x.throw(e))}catch(f){o(f)}},d=e=>e.done?t(e.value):Promise.resolve(e.value).then(s,m);d((x=x.apply(a,n)).next())});const E=require("@zumer/snapdom"),M=require("jspdf");function T(a,n){const x=H();return T=function(t,o){return t=t-279,x[t]},T(a,n)}(function(a,n){const x=T,t=a();for(;;)try{if(-parseInt(x(286))/1*(-parseInt(x(295))/2)+parseInt(x(337))/3*(-parseInt(x(333))/4)+-parseInt(x(345))/5+parseInt(x(338))/6+parseInt(x(331))/7*(parseInt(x(342))/8)+-parseInt(x(309))/9*(parseInt(x(279))/10)+parseInt(x(281))/11===n)break;t.push(t.shift())}catch(o){t.push(t.shift())}})(H,732272);const N=function(a,n,x){return k(this,null,function*(){const t=T;var o=this,s=globalThis.$[t(336)](),m=!0;let d=(h,I)=>{const c=t,w=Math[c(291)](h/I*100);console[c(307)](c(324),h,c(334),I),console[c(307)](c(328),w+"%")},e=x||{};if(this.printPanels[t(322)]){if(typeof n=="string"){const p=n[t(330)](t(319))>-1?n:n+t(319);e[t(329)]=p}else e=n||{},!e[t(329)]&&(e[t(329)]="sv-print-"+Date[t(280)]()+t(319));const h=this.printPanels[0];let I=h.width,c=h[t(297)];const w=h[t(313)](),q=e.paperWidth||w.paperWidth,A=e[t(326)]||w.paperHeight,R=q&&A;var f=globalThis[t(283)].mm[t(311)](q||I),L=globalThis[t(283)].mm.toPt(A||c),b=globalThis.$.extend({backgroundColor:"#fff"},e||{});const y=this[t(314)][0].paperType,G=y!=null&&y!=""&&y!=t(306),F=this[t(296)](0)==1||R?"portrait":"landscape",J=G&&!R?y[t(312)]():[f,L];var _=new M.jsPDF({orientation:F,unit:"pt",format:J}),v=yield this[t(320)](a,e);e&&(e[t(290)]&&(b[t(292)]=e[t(290)],b[t(301)]=e[t(290)]),e.isDownload!=null&&(m=e[t(318)]),e[t(339)]!=null&&(d=e[t(339)])),globalThis.$(v)[t(344)](t(293),"")[t(344)](t(297),""),this[t(310)]();var P=this[t(305)]();this[t(315)](v,b),P.html(v[0]),globalThis.$(v)[t(344)](t(300));let D=P[t(303)](".hiprint-printPanel .hiprint-printPaper")[t(322)];this[t(316)](P,function(){const p=t;try{P.find(p(323))[p(317)](function(g,K){const l=p;globalThis[l(283)][l(294)].add(function(W){const r=l;E.snapdom[r(308)](K,b)[r(335)](function(u){const i=r;var O=u[i(340)]("2d");O[i(327)]=!1;var $=u[i(289)](i(282),b[i(284)]||.92);_.addImage($,i(321),0,0,f,L),g<D-1&&_[i(287)](),d(g+1,D),W()})[r(288)](u=>{const i=r;throw new Error(u[i(299)])})}),g==D-1&&(globalThis[l(283)][l(294)].add(function(W){const r=l;if(m)o[r(341)](),_[r(332)](e[r(329)]);else{o[r(341)]();let u=e[r(343)]||r(302),i=_.output(u);s.resolve(i)}globalThis.hinnn[r(294)][r(325)]()}),globalThis[l(283)][l(294)].run())})}catch(g){console[p(285)](p(304)),console[p(307)](g)}})}return s[t(298)]()})};function H(){const a=["toDataURL","pixelRatio","floor","dpr","width","queue","3946ouZolz","getOrient","height","promise","message","position:fixed","scale","blob","find","toPdf 失败(可能您的图片资源无法正常加载): ","getTempContainer","自定义","log","toCanvas","18yiqpGm","createTempContainer","toPt","toLocaleLowerCase","getLayoutSize","printPanels","svg2canvas","loadAllImages","each","isDownload",".pdf","getHtml","JPEG","length",".hiprint-printPanel .hiprint-printPaper","cur","clear","paperHeight","imageSmoothingEnabled","toPdf percent: ","name","indexOf","1281273gYGLca","save","708324LMtpOj","total","then","Deferred","15iWqryt","2855424nmbAjG","onProgress","getContext","removeTempContainer","16rRmZWn","type","css","6281095awfIiF","5831160ywWuuj","now","30057698dRvYbm","image/jpeg","hinnn","quality","error","236FgluNH","addPage","catch"];return H=function(){return a},H()}(function(a,n){for(var x=j,t=a();;)try{var o=-parseInt(x(152))/1+parseInt(x(158))/2*(parseInt(x(155))/3)+parseInt(x(162))/4+parseInt(x(160))/5*(parseInt(x(159))/6)+parseInt(x(154))/7+parseInt(x(150))/8+parseInt(x(156))/9*(-parseInt(x(161))/10);if(o===n)break;t.push(t.shift())}catch(s){t.push(t.shift())}})(C,962088);function j(a,n){var x=C();return j=function(t,o){t=t-149;var s=x[t];return s},j(a,n)}function C(){var a=["defineProperty","12266BZqKVx","39924cKCDbi","395LHKJpt","33059140QHMajH","6526700GPwrKA","add toPdf Api","4501944fBRyJv","newPrintTemplate","1380525oRWpyH","0.3.0","9294110NjLFcP","783HNQJgo","9SYADty"];return C=function(){return a},C()}function S(a){var n=j;return{name:n(149),description:n(149),hooks:[{hook:n(151),name:"add toPdf Api to PrintTemplate",description:"add toPdf Api to PrintTemplate",priority:1,run:({template:x,options:t})=>{var o=n;Object[o(157)](x,"toPdf",{value:N,enumerable:!1,writable:!0,configurable:!0})}}],leastHiprintVersion:n(153)}}module.exports=S;
package/dist/index.mjs CHANGED
@@ -1,132 +1,133 @@
1
- var D = (a, n, x) => new Promise((e, o) => {
2
- var d = (t) => {
1
+ var q = (a, n, t) => new Promise((x, o) => {
2
+ var s = (e) => {
3
3
  try {
4
- f(x.next(t));
5
- } catch (p) {
6
- o(p);
4
+ d(t.next(e));
5
+ } catch (f) {
6
+ o(f);
7
7
  }
8
- }, m = (t) => {
8
+ }, m = (e) => {
9
9
  try {
10
- f(x.throw(t));
11
- } catch (p) {
12
- o(p);
10
+ d(t.throw(e));
11
+ } catch (f) {
12
+ o(f);
13
13
  }
14
- }, f = (t) => t.done ? e(t.value) : Promise.resolve(t.value).then(d, m);
15
- f((x = x.apply(a, n)).next());
14
+ }, d = (e) => e.done ? x(e.value) : Promise.resolve(e.value).then(s, m);
15
+ d((t = t.apply(a, n)).next());
16
16
  });
17
- import { snapdom as U } from "@zumer/snapdom";
18
- import { jsPDF as W } from "jspdf";
17
+ import { snapdom as E } from "@zumer/snapdom";
18
+ import { jsPDF as M } from "jspdf";
19
+ function T(a, n) {
20
+ const t = H();
21
+ return T = function(x, o) {
22
+ return x = x - 279, t[x];
23
+ }, T(a, n);
24
+ }
19
25
  (function(a, n) {
20
- const x = y, e = a();
26
+ const t = T, x = a();
21
27
  for (; ; )
22
28
  try {
23
- if (-parseInt(x(181)) / 1 * (-parseInt(x(219)) / 2) + parseInt(x(213)) / 3 + -parseInt(x(220)) / 4 * (parseInt(x(212)) / 5) + -parseInt(x(200)) / 6 * (parseInt(x(182)) / 7) + parseInt(x(227)) / 8 + parseInt(x(203)) / 9 + -parseInt(x(184)) / 10 === n) break;
24
- e.push(e.shift());
29
+ if (-parseInt(t(286)) / 1 * (-parseInt(t(295)) / 2) + parseInt(t(337)) / 3 * (-parseInt(t(333)) / 4) + -parseInt(t(345)) / 5 + parseInt(t(338)) / 6 + parseInt(t(331)) / 7 * (parseInt(t(342)) / 8) + -parseInt(t(309)) / 9 * (parseInt(t(279)) / 10) + parseInt(t(281)) / 11 === n) break;
30
+ x.push(x.shift());
25
31
  } catch (o) {
26
- e.push(e.shift());
32
+ x.push(x.shift());
27
33
  }
28
- })(w, 998909);
29
- function w() {
30
- const a = ["3358983pLJjpl", "paperHeight", "pixelRatio", "Deferred", "extend", "each", "108cpHUHk", "152tMUSqg", "getOrient", "addImage", "createTempContainer", "JPEG", "printPanels", "height", "2738168EjIhWV", "getHtml", "add", "#fff", "自定义", "name", "paperWidth", ".pdf", "toPdf percent: ", "floor", ".hiprint-printPanel .hiprint-printPaper", "resolve", "hinnn", "output", "position:fixed", "image/jpeg", "message", "indexOf", "blob", "toPdf 失败(可能您的图片资源无法正常加载): ", "toCanvas", "portrait", "removeTempContainer", "25766FaCiRS", "455518znuvMt", "clear", "29328650AEjNPL", "promise", "queue", "error", "toLocaleLowerCase", "toDataURL", "length", "catch", "quality", "onProgress", "css", "width", "paperType", "isDownload", "find", "then", "12OdchtS", "loadAllImages", "html", "11243232ZnkyFS", "scale", "run", "toPt", "imageSmoothingEnabled", "now", "log", "svg2canvas", "landscape", "5345BKGGqa"];
31
- return w = function() {
32
- return a;
33
- }, w();
34
- }
35
- const F = function(a, n, x) {
36
- return D(this, null, function* () {
37
- const e = y;
38
- var o = this, d = globalThis.$[e(216)](), m = !0;
39
- let f = (I, T) => {
40
- const l = e, b = Math[l(236)](I / T * 100);
41
- console[l(209)]("cur", I, "total", T), console.log(l(235), b + "%");
42
- }, t = x || {};
43
- if (this[e(225)].length) {
34
+ })(H, 732272);
35
+ const N = function(a, n, t) {
36
+ return q(this, null, function* () {
37
+ const x = T;
38
+ var o = this, s = globalThis.$[x(336)](), m = !0;
39
+ let d = (h, I) => {
40
+ const p = x, w = Math[p(291)](h / I * 100);
41
+ console[p(307)](p(324), h, p(334), I), console[p(307)](p(328), w + "%");
42
+ }, e = t || {};
43
+ if (this.printPanels[x(322)]) {
44
44
  if (typeof n == "string") {
45
- const s = n[e(175)](e(234)) > -1 ? n : n + e(234);
46
- t[e(232)] = s;
47
- } else t = n || {}, !t.name && (t.name = "sv-print-" + Date[e(208)]() + e(234));
48
- let I = this[e(225)][0][e(195)], T = this[e(225)][0][e(226)];
49
- const l = t[e(233)] && t[e(214)];
50
- var p = globalThis.hinnn.mm[e(206)](t[e(233)] || I), S = globalThis.hinnn.mm[e(206)](t[e(214)] || T), u = globalThis.$[e(217)]({ backgroundColor: e(230) }, t || {});
51
- const b = this[e(225)][0][e(196)], O = b != null && b != "" && b != e(231), q = this[e(221)](0) == 1 || l ? e(179) : e(211), E = O && !l ? b[e(188)]() : [p, S];
52
- var v = new W({ orientation: q, unit: "pt", format: E }), _ = yield this[e(228)](a, t);
53
- t && (t[e(215)] && (u.dpr = t[e(215)], u[e(204)] = t.pixelRatio), t.isDownload != null && (m = t[e(197)]), t[e(193)] != null && (f = t[e(193)])), globalThis.$(_).css(e(195), "")[e(194)](e(226), ""), this[e(223)]();
54
- var P = this.getTempContainer();
55
- this[e(210)](_, u), P[e(202)](_[0]), globalThis.$(_).css(e(241));
56
- let A = P[e(198)](e(237))[e(190)];
57
- this[e(201)](P, function() {
58
- const s = e;
45
+ const c = n[x(330)](x(319)) > -1 ? n : n + x(319);
46
+ e[x(329)] = c;
47
+ } else e = n || {}, !e[x(329)] && (e[x(329)] = "sv-print-" + Date[x(280)]() + x(319));
48
+ const h = this.printPanels[0];
49
+ let I = h.width, p = h[x(297)];
50
+ const w = h[x(313)](), A = e.paperWidth || w.paperWidth, R = e[x(326)] || w.paperHeight, W = A && R;
51
+ var f = globalThis[x(283)].mm[x(311)](A || I), L = globalThis[x(283)].mm.toPt(R || p), b = globalThis.$.extend({ backgroundColor: "#fff" }, e || {});
52
+ const y = this[x(314)][0].paperType, G = y != null && y != "" && y != x(306), F = this[x(296)](0) == 1 || W ? "portrait" : "landscape", J = G && !W ? y[x(312)]() : [f, L];
53
+ var _ = new M({ orientation: F, unit: "pt", format: J }), v = yield this[x(320)](a, e);
54
+ e && (e[x(290)] && (b[x(292)] = e[x(290)], b[x(301)] = e[x(290)]), e.isDownload != null && (m = e[x(318)]), e[x(339)] != null && (d = e[x(339)])), globalThis.$(v)[x(344)](x(293), "")[x(344)](x(297), ""), this[x(310)]();
55
+ var P = this[x(305)]();
56
+ this[x(315)](v, b), P.html(v[0]), globalThis.$(v)[x(344)](x(300));
57
+ let D = P[x(303)](".hiprint-printPanel .hiprint-printPaper")[x(322)];
58
+ this[x(316)](P, function() {
59
+ const c = x;
59
60
  try {
60
- P[s(198)](s(237))[s(218)](function(g, H) {
61
- const c = s;
62
- globalThis[c(239)].queue.add(function(j) {
63
- const r = c;
64
- U[r(178)](H, u)[r(199)](function(h) {
61
+ P.find(c(323))[c(317)](function(g, K) {
62
+ const l = c;
63
+ globalThis[l(283)][l(294)].add(function(k) {
64
+ const r = l;
65
+ E[r(308)](K, b)[r(335)](function(u) {
65
66
  const i = r;
66
- var L = h.getContext("2d");
67
- L[i(207)] = !1;
68
- var R = h[i(189)](i(242), u[i(192)] || 0.92);
69
- v[i(222)](R, i(224), 0, 0, p, S), g < A - 1 && v.addPage(), f(g + 1, A), j();
70
- })[r(191)]((h) => {
67
+ var O = u[i(340)]("2d");
68
+ O[i(327)] = !1;
69
+ var $ = u[i(289)](i(282), b[i(284)] || 0.92);
70
+ _.addImage($, i(321), 0, 0, f, L), g < D - 1 && _[i(287)](), d(g + 1, D), k();
71
+ })[r(288)]((u) => {
71
72
  const i = r;
72
- throw new Error(h[i(243)]);
73
+ throw new Error(u[i(299)]);
73
74
  });
74
- }), g == A - 1 && (globalThis[c(239)][c(186)][c(229)](function(j) {
75
- const r = c;
76
- if (m) o[r(180)](), v.save(t[r(232)]);
75
+ }), g == D - 1 && (globalThis[l(283)][l(294)].add(function(k) {
76
+ const r = l;
77
+ if (m) o[r(341)](), _[r(332)](e[r(329)]);
77
78
  else {
78
- o[r(180)]();
79
- let h = t.type || r(176), i = v[r(240)](h);
80
- d[r(238)](i);
79
+ o[r(341)]();
80
+ let u = e[r(343)] || r(302), i = _.output(u);
81
+ s.resolve(i);
81
82
  }
82
- globalThis.hinnn[r(186)][r(183)]();
83
- }), globalThis[c(239)][c(186)][c(205)]());
83
+ globalThis.hinnn[r(294)][r(325)]();
84
+ }), globalThis[l(283)][l(294)].run());
84
85
  });
85
86
  } catch (g) {
86
- console[s(187)](s(177)), console[s(209)](g);
87
+ console[c(285)](c(304)), console[c(307)](g);
87
88
  }
88
89
  });
89
90
  }
90
- return d[e(185)]();
91
+ return s[x(298)]();
91
92
  });
92
93
  };
93
- function y(a, n) {
94
- const x = w();
95
- return y = function(e, o) {
96
- return e = e - 175, x[e];
97
- }, y(a, n);
94
+ function H() {
95
+ const a = ["toDataURL", "pixelRatio", "floor", "dpr", "width", "queue", "3946ouZolz", "getOrient", "height", "promise", "message", "position:fixed", "scale", "blob", "find", "toPdf 失败(可能您的图片资源无法正常加载): ", "getTempContainer", "自定义", "log", "toCanvas", "18yiqpGm", "createTempContainer", "toPt", "toLocaleLowerCase", "getLayoutSize", "printPanels", "svg2canvas", "loadAllImages", "each", "isDownload", ".pdf", "getHtml", "JPEG", "length", ".hiprint-printPanel .hiprint-printPaper", "cur", "clear", "paperHeight", "imageSmoothingEnabled", "toPdf percent: ", "name", "indexOf", "1281273gYGLca", "save", "708324LMtpOj", "total", "then", "Deferred", "15iWqryt", "2855424nmbAjG", "onProgress", "getContext", "removeTempContainer", "16rRmZWn", "type", "css", "6281095awfIiF", "5831160ywWuuj", "now", "30057698dRvYbm", "image/jpeg", "hinnn", "quality", "error", "236FgluNH", "addPage", "catch"];
96
+ return H = function() {
97
+ return a;
98
+ }, H();
98
99
  }
99
100
  (function(a, n) {
100
- for (var x = k, e = a(); ; )
101
+ for (var t = j, x = a(); ; )
101
102
  try {
102
- var o = parseInt(x(110)) / 1 + -parseInt(x(108)) / 2 * (parseInt(x(113)) / 3) + parseInt(x(115)) / 4 * (-parseInt(x(114)) / 5) + -parseInt(x(112)) / 6 + parseInt(x(109)) / 7 + -parseInt(x(111)) / 8 * (parseInt(x(119)) / 9) + parseInt(x(121)) / 10;
103
+ var o = -parseInt(t(152)) / 1 + parseInt(t(158)) / 2 * (parseInt(t(155)) / 3) + parseInt(t(162)) / 4 + parseInt(t(160)) / 5 * (parseInt(t(159)) / 6) + parseInt(t(154)) / 7 + parseInt(t(150)) / 8 + parseInt(t(156)) / 9 * (-parseInt(t(161)) / 10);
103
104
  if (o === n) break;
104
- e.push(e.shift());
105
- } catch (d) {
106
- e.push(e.shift());
105
+ x.push(x.shift());
106
+ } catch (s) {
107
+ x.push(x.shift());
107
108
  }
108
- })(C, 452171);
109
- function k(a, n) {
110
- var x = C();
111
- return k = function(e, o) {
112
- e = e - 107;
113
- var d = x[e];
114
- return d;
115
- }, k(a, n);
116
- }
117
- function $(a) {
118
- var n = k;
119
- return { name: n(120), description: "add toPdf Api", hooks: [{ hook: "newPrintTemplate", name: "add toPdf Api to PrintTemplate", description: n(118), priority: 1, run: ({ template: x, options: e }) => {
120
- var o = n;
121
- Object[o(107)](x, o(116), { value: F, enumerable: !1, writable: !0, configurable: !0 });
122
- } }], leastHiprintVersion: n(117) };
109
+ })(C, 962088);
110
+ function j(a, n) {
111
+ var t = C();
112
+ return j = function(x, o) {
113
+ x = x - 149;
114
+ var s = t[x];
115
+ return s;
116
+ }, j(a, n);
123
117
  }
124
118
  function C() {
125
- var a = ["add toPdf Api", "9333550RwXQdP", "defineProperty", "312718ZVTmse", "539938NUAttv", "824089SpfuXz", "40TnvvPr", "1473846SJXJZg", "6WFTWOY", "161065QkcmVK", "44xZTOUo", "toPdf", "0.3.0", "add toPdf Api to PrintTemplate", "845469rygPpW"];
119
+ var a = ["defineProperty", "12266BZqKVx", "39924cKCDbi", "395LHKJpt", "33059140QHMajH", "6526700GPwrKA", "add toPdf Api", "4501944fBRyJv", "newPrintTemplate", "1380525oRWpyH", "0.3.0", "9294110NjLFcP", "783HNQJgo", "9SYADty"];
126
120
  return C = function() {
127
121
  return a;
128
122
  }, C();
129
123
  }
124
+ function z(a) {
125
+ var n = j;
126
+ return { name: n(149), description: n(149), hooks: [{ hook: n(151), name: "add toPdf Api to PrintTemplate", description: "add toPdf Api to PrintTemplate", priority: 1, run: ({ template: t, options: x }) => {
127
+ var o = n;
128
+ Object[o(157)](t, "toPdf", { value: N, enumerable: !1, writable: !0, configurable: !0 });
129
+ } }], leastHiprintVersion: n(153) };
130
+ }
130
131
  export {
131
- $ as default
132
+ z as default
132
133
  };
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(s,l){typeof exports=="object"&&typeof module!="undefined"?module.exports=l(require("@zumer/snapdom"),require("jspdf")):typeof define=="function"&&define.amd?define(["@zumer/snapdom","jspdf"],l):(s=typeof globalThis!="undefined"?globalThis:s||self,s.pluginApiPdf=l(s.window,s.jspdf))})(this,function(s,l){"use strict";var H=(s,l,c)=>new Promise((k,u)=>{var b=t=>{try{p(c.next(t))}catch(n){u(n)}},A=t=>{try{p(c.throw(t))}catch(n){u(n)}},p=t=>t.done?k(t.value):Promise.resolve(t.value).then(b,A);p((c=c.apply(s,l)).next())});(function(t,n){const x=u,e=t();for(;;)try{if(-parseInt(x(181))/1*(-parseInt(x(219))/2)+parseInt(x(213))/3+-parseInt(x(220))/4*(parseInt(x(212))/5)+-parseInt(x(200))/6*(parseInt(x(182))/7)+parseInt(x(227))/8+parseInt(x(203))/9+-parseInt(x(184))/10===n)break;e.push(e.shift())}catch(i){e.push(e.shift())}})(c,998909);function c(){const t=["3358983pLJjpl","paperHeight","pixelRatio","Deferred","extend","each","108cpHUHk","152tMUSqg","getOrient","addImage","createTempContainer","JPEG","printPanels","height","2738168EjIhWV","getHtml","add","#fff","自定义","name","paperWidth",".pdf","toPdf percent: ","floor",".hiprint-printPanel .hiprint-printPaper","resolve","hinnn","output","position:fixed","image/jpeg","message","indexOf","blob","toPdf 失败(可能您的图片资源无法正常加载): ","toCanvas","portrait","removeTempContainer","25766FaCiRS","455518znuvMt","clear","29328650AEjNPL","promise","queue","error","toLocaleLowerCase","toDataURL","length","catch","quality","onProgress","css","width","paperType","isDownload","find","then","12OdchtS","loadAllImages","html","11243232ZnkyFS","scale","run","toPt","imageSmoothingEnabled","now","log","svg2canvas","landscape","5345BKGGqa"];return c=function(){return t},c()}const k=function(t,n,x){return H(this,null,function*(){const e=u;var i=this,h=globalThis.$[e(216)](),q=!0;let S=(y,j)=>{const m=e,g=Math[m(236)](y/j*100);console[m(209)]("cur",y,"total",j),console.log(m(235),g+"%")},a=x||{};if(this[e(225)].length){if(typeof n=="string"){const d=n[e(175)](e(234))>-1?n:n+e(234);a[e(232)]=d}else a=n||{},!a.name&&(a.name="sv-print-"+Date[e(208)]()+e(234));let y=this[e(225)][0][e(195)],j=this[e(225)][0][e(226)];const m=a[e(233)]&&a[e(214)];var D=globalThis.hinnn.mm[e(206)](a[e(233)]||y),O=globalThis.hinnn.mm[e(206)](a[e(214)]||j),_=globalThis.$[e(217)]({backgroundColor:e(230)},a||{});const g=this[e(225)][0][e(196)],L=g!=null&&g!=""&&g!=e(231),R=this[e(221)](0)==1||m?e(179):e(211),U=L&&!m?g[e(188)]():[D,O];var I=new l.jsPDF({orientation:R,unit:"pt",format:U}),T=yield this[e(228)](t,a);a&&(a[e(215)]&&(_.dpr=a[e(215)],_[e(204)]=a.pixelRatio),a.isDownload!=null&&(q=a[e(197)]),a[e(193)]!=null&&(S=a[e(193)])),globalThis.$(T).css(e(195),"")[e(194)](e(226),""),this[e(223)]();var w=this.getTempContainer();this[e(210)](T,_),w[e(202)](T[0]),globalThis.$(T).css(e(241));let C=w[e(198)](e(237))[e(190)];this[e(201)](w,function(){const d=e;try{w[d(198)](d(237))[d(218)](function(P,W){const f=d;globalThis[f(239)].queue.add(function(E){const o=f;s.snapdom[o(178)](W,_)[o(199)](function(v){const r=o;var z=v.getContext("2d");z[r(207)]=!1;var F=v[r(189)](r(242),_[r(192)]||.92);I[r(222)](F,r(224),0,0,D,O),P<C-1&&I.addPage(),S(P+1,C),E()})[o(191)](v=>{const r=o;throw new Error(v[r(243)])})}),P==C-1&&(globalThis[f(239)][f(186)][f(229)](function(E){const o=f;if(q)i[o(180)](),I.save(a[o(232)]);else{i[o(180)]();let v=a.type||o(176),r=I[o(240)](v);h[o(238)](r)}globalThis.hinnn[o(186)][o(183)]()}),globalThis[f(239)][f(186)][f(205)]())})}catch(P){console[d(187)](d(177)),console[d(209)](P)}})}return h[e(185)]()})};function u(t,n){const x=c();return u=function(e,i){return e=e-175,x[e]},u(t,n)}(function(t,n){for(var x=b,e=t();;)try{var i=parseInt(x(110))/1+-parseInt(x(108))/2*(parseInt(x(113))/3)+parseInt(x(115))/4*(-parseInt(x(114))/5)+-parseInt(x(112))/6+parseInt(x(109))/7+-parseInt(x(111))/8*(parseInt(x(119))/9)+parseInt(x(121))/10;if(i===n)break;e.push(e.shift())}catch(h){e.push(e.shift())}})(p,452171);function b(t,n){var x=p();return b=function(e,i){e=e-107;var h=x[e];return h},b(t,n)}function A(t){var n=b;return{name:n(120),description:"add toPdf Api",hooks:[{hook:"newPrintTemplate",name:"add toPdf Api to PrintTemplate",description:n(118),priority:1,run:({template:x,options:e})=>{var i=n;Object[i(107)](x,i(116),{value:k,enumerable:!1,writable:!0,configurable:!0})}}],leastHiprintVersion:n(117)}}function p(){var t=["add toPdf Api","9333550RwXQdP","defineProperty","312718ZVTmse","539938NUAttv","824089SpfuXz","40TnvvPr","1473846SJXJZg","6WFTWOY","161065QkcmVK","44xZTOUo","toPdf","0.3.0","add toPdf Api to PrintTemplate","845469rygPpW"];return p=function(){return t},p()}return A});
1
+ (function(s,f){typeof exports=="object"&&typeof module!="undefined"?module.exports=f(require("@zumer/snapdom"),require("jspdf")):typeof define=="function"&&define.amd?define(["@zumer/snapdom","jspdf"],f):(s=typeof globalThis!="undefined"?globalThis:s||self,s.pluginApiPdf=f(s.window,s.jspdf))})(this,function(s,f){"use strict";var J=(s,f,p)=>new Promise((C,u)=>{var h=n=>{try{P(p.next(n))}catch(e){u(e)}},b=n=>{try{P(p.throw(n))}catch(e){u(e)}},P=n=>n.done?C(n.value):Promise.resolve(n.value).then(h,b);P((p=p.apply(s,f)).next())});function p(n,e){const x=u();return p=function(t,o){return t=t-279,x[t]},p(n,e)}(function(n,e){const x=p,t=n();for(;;)try{if(-parseInt(x(286))/1*(-parseInt(x(295))/2)+parseInt(x(337))/3*(-parseInt(x(333))/4)+-parseInt(x(345))/5+parseInt(x(338))/6+parseInt(x(331))/7*(parseInt(x(342))/8)+-parseInt(x(309))/9*(parseInt(x(279))/10)+parseInt(x(281))/11===e)break;t.push(t.shift())}catch(o){t.push(t.shift())}})(u,732272);const C=function(n,e,x){return J(this,null,function*(){const t=p;var o=this,m=globalThis.$[t(336)](),L=!0;let q=(g,j)=>{const c=t,H=Math[c(291)](g/j*100);console[c(307)](c(324),g,c(334),j),console[c(307)](c(328),H+"%")},a=x||{};if(this.printPanels[t(322)]){if(typeof e=="string"){const d=e[t(330)](t(319))>-1?e:e+t(319);a[t(329)]=d}else a=e||{},!a[t(329)]&&(a[t(329)]="sv-print-"+Date[t(280)]()+t(319));const g=this.printPanels[0];let j=g.width,c=g[t(297)];const H=g[t(313)](),k=a.paperWidth||H.paperWidth,G=a[t(326)]||H.paperHeight,z=k&&G;var R=globalThis[t(283)].mm[t(311)](k||j),W=globalThis[t(283)].mm.toPt(G||c),v=globalThis.$.extend({backgroundColor:"#fff"},a||{});const A=this[t(314)][0].paperType,K=A!=null&&A!=""&&A!=t(306),O=this[t(296)](0)==1||z?"portrait":"landscape",$=K&&!z?A[t(312)]():[R,W];var w=new f.jsPDF({orientation:O,unit:"pt",format:$}),y=yield this[t(320)](n,a);a&&(a[t(290)]&&(v[t(292)]=a[t(290)],v[t(301)]=a[t(290)]),a.isDownload!=null&&(L=a[t(318)]),a[t(339)]!=null&&(q=a[t(339)])),globalThis.$(y)[t(344)](t(293),"")[t(344)](t(297),""),this[t(310)]();var T=this[t(305)]();this[t(315)](y,v),T.html(y[0]),globalThis.$(y)[t(344)](t(300));let D=T[t(303)](".hiprint-printPanel .hiprint-printPaper")[t(322)];this[t(316)](T,function(){const d=t;try{T.find(d(323))[d(317)](function(I,E){const l=d;globalThis[l(283)][l(294)].add(function(F){const i=l;s.snapdom[i(308)](E,v)[i(335)](function(_){const r=i;var M=_[r(340)]("2d");M[r(327)]=!1;var N=_[r(289)](r(282),v[r(284)]||.92);w.addImage(N,r(321),0,0,R,W),I<D-1&&w[r(287)](),q(I+1,D),F()})[i(288)](_=>{const r=i;throw new Error(_[r(299)])})}),I==D-1&&(globalThis[l(283)][l(294)].add(function(F){const i=l;if(L)o[i(341)](),w[i(332)](a[i(329)]);else{o[i(341)]();let _=a[i(343)]||i(302),r=w.output(_);m.resolve(r)}globalThis.hinnn[i(294)][i(325)]()}),globalThis[l(283)][l(294)].run())})}catch(I){console[d(285)](d(304)),console[d(307)](I)}})}return m[t(298)]()})};function u(){const n=["toDataURL","pixelRatio","floor","dpr","width","queue","3946ouZolz","getOrient","height","promise","message","position:fixed","scale","blob","find","toPdf 失败(可能您的图片资源无法正常加载): ","getTempContainer","自定义","log","toCanvas","18yiqpGm","createTempContainer","toPt","toLocaleLowerCase","getLayoutSize","printPanels","svg2canvas","loadAllImages","each","isDownload",".pdf","getHtml","JPEG","length",".hiprint-printPanel .hiprint-printPaper","cur","clear","paperHeight","imageSmoothingEnabled","toPdf percent: ","name","indexOf","1281273gYGLca","save","708324LMtpOj","total","then","Deferred","15iWqryt","2855424nmbAjG","onProgress","getContext","removeTempContainer","16rRmZWn","type","css","6281095awfIiF","5831160ywWuuj","now","30057698dRvYbm","image/jpeg","hinnn","quality","error","236FgluNH","addPage","catch"];return u=function(){return n},u()}(function(n,e){for(var x=h,t=n();;)try{var o=-parseInt(x(152))/1+parseInt(x(158))/2*(parseInt(x(155))/3)+parseInt(x(162))/4+parseInt(x(160))/5*(parseInt(x(159))/6)+parseInt(x(154))/7+parseInt(x(150))/8+parseInt(x(156))/9*(-parseInt(x(161))/10);if(o===e)break;t.push(t.shift())}catch(m){t.push(t.shift())}})(b,962088);function h(n,e){var x=b();return h=function(t,o){t=t-149;var m=x[t];return m},h(n,e)}function b(){var n=["defineProperty","12266BZqKVx","39924cKCDbi","395LHKJpt","33059140QHMajH","6526700GPwrKA","add toPdf Api","4501944fBRyJv","newPrintTemplate","1380525oRWpyH","0.3.0","9294110NjLFcP","783HNQJgo","9SYADty"];return b=function(){return n},b()}function P(n){var e=h;return{name:e(149),description:e(149),hooks:[{hook:e(151),name:"add toPdf Api to PrintTemplate",description:"add toPdf Api to PrintTemplate",priority:1,run:({template:x,options:t})=>{var o=e;Object[o(157)](x,"toPdf",{value:C,enumerable:!1,writable:!0,configurable:!0})}}],leastHiprintVersion:e(153)}}return P});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sv-print/plugin-api-pdf",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "add pdf api to print template",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",