react-vector-pdf 0.3.7 → 0.5.0
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/README.md +8 -9
- package/dist/index.d.ts +21 -10
- package/dist/react-vector-pdf.js +632 -554
- package/package.json +5 -2
package/dist/react-vector-pdf.js
CHANGED
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { jsPDF as
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
function
|
|
6
|
-
if (
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
function r(
|
|
10
|
-
var
|
|
11
|
-
if (
|
|
12
|
-
|
|
13
|
-
for (var
|
|
14
|
-
|
|
15
|
-
} else
|
|
16
|
-
return o =
|
|
17
|
-
$$typeof:
|
|
18
|
-
type:
|
|
19
|
-
key:
|
|
1
|
+
import H, { createContext as ft, useContext as ct, useState as lt } from "react";
|
|
2
|
+
import { jsPDF as et } from "jspdf";
|
|
3
|
+
var K = { exports: {} }, J = {};
|
|
4
|
+
var rt;
|
|
5
|
+
function ut() {
|
|
6
|
+
if (rt) return J;
|
|
7
|
+
rt = 1;
|
|
8
|
+
var n = /* @__PURE__ */ Symbol.for("react.transitional.element"), t = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
9
|
+
function r(i, o, f) {
|
|
10
|
+
var s = null;
|
|
11
|
+
if (f !== void 0 && (s = "" + f), o.key !== void 0 && (s = "" + o.key), "key" in o) {
|
|
12
|
+
f = {};
|
|
13
|
+
for (var a in o)
|
|
14
|
+
a !== "key" && (f[a] = o[a]);
|
|
15
|
+
} else f = o;
|
|
16
|
+
return o = f.ref, {
|
|
17
|
+
$$typeof: n,
|
|
18
|
+
type: i,
|
|
19
|
+
key: s,
|
|
20
20
|
ref: o !== void 0 ? o : null,
|
|
21
|
-
props:
|
|
21
|
+
props: f
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
return
|
|
24
|
+
return J.Fragment = t, J.jsx = r, J.jsxs = r, J;
|
|
25
25
|
}
|
|
26
|
-
var
|
|
27
|
-
var
|
|
28
|
-
function
|
|
29
|
-
return
|
|
30
|
-
function
|
|
26
|
+
var Q = {};
|
|
27
|
+
var ot;
|
|
28
|
+
function ht() {
|
|
29
|
+
return ot || (ot = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
30
|
+
function n(e) {
|
|
31
31
|
if (e == null) return null;
|
|
32
32
|
if (typeof e == "function")
|
|
33
|
-
return e.$$typeof ===
|
|
33
|
+
return e.$$typeof === A ? null : e.displayName || e.name || null;
|
|
34
34
|
if (typeof e == "string") return e;
|
|
35
35
|
switch (e) {
|
|
36
|
-
case
|
|
36
|
+
case d:
|
|
37
37
|
return "Fragment";
|
|
38
38
|
case X:
|
|
39
39
|
return "Profiler";
|
|
40
|
-
case
|
|
40
|
+
case F:
|
|
41
41
|
return "StrictMode";
|
|
42
|
-
case
|
|
42
|
+
case B:
|
|
43
43
|
return "Suspense";
|
|
44
|
-
case
|
|
44
|
+
case G:
|
|
45
45
|
return "SuspenseList";
|
|
46
|
-
case
|
|
46
|
+
case T:
|
|
47
47
|
return "Activity";
|
|
48
48
|
}
|
|
49
49
|
if (typeof e == "object")
|
|
50
50
|
switch (typeof e.tag == "number" && console.error(
|
|
51
51
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
52
52
|
), e.$$typeof) {
|
|
53
|
-
case
|
|
53
|
+
case x:
|
|
54
54
|
return "Portal";
|
|
55
|
-
case U:
|
|
56
|
-
return e.displayName || "Context";
|
|
57
55
|
case N:
|
|
56
|
+
return e.displayName || "Context";
|
|
57
|
+
case j:
|
|
58
58
|
return (e._context.displayName || "Context") + ".Consumer";
|
|
59
|
-
case
|
|
60
|
-
var
|
|
61
|
-
return e = e.displayName, e || (e =
|
|
62
|
-
case
|
|
63
|
-
return
|
|
64
|
-
case
|
|
65
|
-
|
|
59
|
+
case z:
|
|
60
|
+
var u = e.render;
|
|
61
|
+
return e = e.displayName, e || (e = u.displayName || u.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
62
|
+
case q:
|
|
63
|
+
return u = e.displayName || null, u !== null ? u : n(e.type) || "Memo";
|
|
64
|
+
case v:
|
|
65
|
+
u = e._payload, e = e._init;
|
|
66
66
|
try {
|
|
67
|
-
return
|
|
67
|
+
return n(e(u));
|
|
68
68
|
} catch {
|
|
69
69
|
}
|
|
70
70
|
}
|
|
@@ -76,74 +76,74 @@ function ut() {
|
|
|
76
76
|
function r(e) {
|
|
77
77
|
try {
|
|
78
78
|
t(e);
|
|
79
|
-
var
|
|
79
|
+
var u = !1;
|
|
80
80
|
} catch {
|
|
81
|
-
|
|
81
|
+
u = !0;
|
|
82
82
|
}
|
|
83
|
-
if (
|
|
84
|
-
|
|
85
|
-
var
|
|
86
|
-
return
|
|
87
|
-
|
|
83
|
+
if (u) {
|
|
84
|
+
u = console;
|
|
85
|
+
var h = u.error, g = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
86
|
+
return h.call(
|
|
87
|
+
u,
|
|
88
88
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
89
|
-
|
|
89
|
+
g
|
|
90
90
|
), t(e);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
if (e ===
|
|
95
|
-
if (typeof e == "object" && e !== null && e.$$typeof ===
|
|
93
|
+
function i(e) {
|
|
94
|
+
if (e === d) return "<>";
|
|
95
|
+
if (typeof e == "object" && e !== null && e.$$typeof === v)
|
|
96
96
|
return "<...>";
|
|
97
97
|
try {
|
|
98
|
-
var
|
|
99
|
-
return
|
|
98
|
+
var u = n(e);
|
|
99
|
+
return u ? "<" + u + ">" : "<...>";
|
|
100
100
|
} catch {
|
|
101
101
|
return "<...>";
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
function o() {
|
|
105
|
-
var e =
|
|
105
|
+
var e = O.A;
|
|
106
106
|
return e === null ? null : e.getOwner();
|
|
107
107
|
}
|
|
108
|
-
function
|
|
108
|
+
function f() {
|
|
109
109
|
return Error("react-stack-top-frame");
|
|
110
110
|
}
|
|
111
|
-
function
|
|
112
|
-
if (
|
|
113
|
-
var
|
|
114
|
-
if (
|
|
111
|
+
function s(e) {
|
|
112
|
+
if (E.call(e, "key")) {
|
|
113
|
+
var u = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
114
|
+
if (u && u.isReactWarning) return !1;
|
|
115
115
|
}
|
|
116
116
|
return e.key !== void 0;
|
|
117
117
|
}
|
|
118
|
-
function
|
|
119
|
-
function
|
|
120
|
-
|
|
118
|
+
function a(e, u) {
|
|
119
|
+
function h() {
|
|
120
|
+
Y || (Y = !0, console.error(
|
|
121
121
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
122
|
-
|
|
122
|
+
u
|
|
123
123
|
));
|
|
124
124
|
}
|
|
125
|
-
|
|
126
|
-
get:
|
|
125
|
+
h.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
126
|
+
get: h,
|
|
127
127
|
configurable: !0
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
|
-
function
|
|
131
|
-
var e =
|
|
132
|
-
return
|
|
130
|
+
function b() {
|
|
131
|
+
var e = n(this.type);
|
|
132
|
+
return D[e] || (D[e] = !0, console.error(
|
|
133
133
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
134
134
|
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
135
135
|
}
|
|
136
|
-
function
|
|
137
|
-
var
|
|
136
|
+
function p(e, u, h, g, W, M) {
|
|
137
|
+
var C = h.ref;
|
|
138
138
|
return e = {
|
|
139
|
-
$$typeof:
|
|
139
|
+
$$typeof: w,
|
|
140
140
|
type: e,
|
|
141
|
-
key:
|
|
142
|
-
props:
|
|
143
|
-
_owner:
|
|
144
|
-
}, (
|
|
141
|
+
key: u,
|
|
142
|
+
props: h,
|
|
143
|
+
_owner: g
|
|
144
|
+
}, (C !== void 0 ? C : null) !== null ? Object.defineProperty(e, "ref", {
|
|
145
145
|
enumerable: !1,
|
|
146
|
-
get:
|
|
146
|
+
get: b
|
|
147
147
|
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
148
148
|
configurable: !1,
|
|
149
149
|
enumerable: !1,
|
|
@@ -158,125 +158,134 @@ function ut() {
|
|
|
158
158
|
configurable: !1,
|
|
159
159
|
enumerable: !1,
|
|
160
160
|
writable: !0,
|
|
161
|
-
value:
|
|
161
|
+
value: W
|
|
162
162
|
}), Object.defineProperty(e, "_debugTask", {
|
|
163
163
|
configurable: !1,
|
|
164
164
|
enumerable: !1,
|
|
165
165
|
writable: !0,
|
|
166
|
-
value:
|
|
166
|
+
value: M
|
|
167
167
|
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
168
168
|
}
|
|
169
|
-
function
|
|
170
|
-
var
|
|
171
|
-
if (
|
|
172
|
-
if (
|
|
173
|
-
if (
|
|
174
|
-
for (
|
|
175
|
-
|
|
176
|
-
Object.freeze && Object.freeze(
|
|
169
|
+
function l(e, u, h, g, W, M) {
|
|
170
|
+
var C = u.children;
|
|
171
|
+
if (C !== void 0)
|
|
172
|
+
if (g)
|
|
173
|
+
if (R(C)) {
|
|
174
|
+
for (g = 0; g < C.length; g++)
|
|
175
|
+
m(C[g]);
|
|
176
|
+
Object.freeze && Object.freeze(C);
|
|
177
177
|
} else
|
|
178
178
|
console.error(
|
|
179
179
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
180
180
|
);
|
|
181
|
-
else
|
|
182
|
-
if (
|
|
183
|
-
|
|
184
|
-
var
|
|
185
|
-
return
|
|
181
|
+
else m(C);
|
|
182
|
+
if (E.call(u, "key")) {
|
|
183
|
+
C = n(e);
|
|
184
|
+
var L = Object.keys(u).filter(function(V) {
|
|
185
|
+
return V !== "key";
|
|
186
186
|
});
|
|
187
|
-
|
|
187
|
+
g = 0 < L.length ? "{key: someKey, " + L.join(": ..., ") + ": ...}" : "{key: someKey}", _[C + g] || (L = 0 < L.length ? "{" + L.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
188
188
|
`A props object containing a "key" prop is being spread into JSX:
|
|
189
189
|
let props = %s;
|
|
190
190
|
<%s {...props} />
|
|
191
191
|
React keys must be passed directly to JSX without using spread:
|
|
192
192
|
let props = %s;
|
|
193
193
|
<%s key={someKey} {...props} />`,
|
|
194
|
+
g,
|
|
194
195
|
C,
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
), F[y + C] = !0);
|
|
196
|
+
L,
|
|
197
|
+
C
|
|
198
|
+
), _[C + g] = !0);
|
|
199
199
|
}
|
|
200
|
-
if (
|
|
201
|
-
|
|
202
|
-
for (var
|
|
203
|
-
|
|
204
|
-
} else
|
|
205
|
-
return
|
|
206
|
-
|
|
200
|
+
if (C = null, h !== void 0 && (r(h), C = "" + h), s(u) && (r(u.key), C = "" + u.key), "key" in u) {
|
|
201
|
+
h = {};
|
|
202
|
+
for (var k in u)
|
|
203
|
+
k !== "key" && (h[k] = u[k]);
|
|
204
|
+
} else h = u;
|
|
205
|
+
return C && a(
|
|
206
|
+
h,
|
|
207
207
|
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
208
|
-
),
|
|
208
|
+
), p(
|
|
209
209
|
e,
|
|
210
|
-
|
|
211
|
-
|
|
210
|
+
C,
|
|
211
|
+
h,
|
|
212
212
|
o(),
|
|
213
|
-
|
|
214
|
-
|
|
213
|
+
W,
|
|
214
|
+
M
|
|
215
215
|
);
|
|
216
216
|
}
|
|
217
|
-
function
|
|
218
|
-
|
|
217
|
+
function m(e) {
|
|
218
|
+
c(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === v && (e._payload.status === "fulfilled" ? c(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
219
219
|
}
|
|
220
|
-
function
|
|
221
|
-
return typeof e == "object" && e !== null && e.$$typeof ===
|
|
220
|
+
function c(e) {
|
|
221
|
+
return typeof e == "object" && e !== null && e.$$typeof === w;
|
|
222
222
|
}
|
|
223
|
-
var
|
|
223
|
+
var y = H, w = /* @__PURE__ */ Symbol.for("react.transitional.element"), x = /* @__PURE__ */ Symbol.for("react.portal"), d = /* @__PURE__ */ Symbol.for("react.fragment"), F = /* @__PURE__ */ Symbol.for("react.strict_mode"), X = /* @__PURE__ */ Symbol.for("react.profiler"), j = /* @__PURE__ */ Symbol.for("react.consumer"), N = /* @__PURE__ */ Symbol.for("react.context"), z = /* @__PURE__ */ Symbol.for("react.forward_ref"), B = /* @__PURE__ */ Symbol.for("react.suspense"), G = /* @__PURE__ */ Symbol.for("react.suspense_list"), q = /* @__PURE__ */ Symbol.for("react.memo"), v = /* @__PURE__ */ Symbol.for("react.lazy"), T = /* @__PURE__ */ Symbol.for("react.activity"), A = /* @__PURE__ */ Symbol.for("react.client.reference"), O = y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, E = Object.prototype.hasOwnProperty, R = Array.isArray, I = console.createTask ? console.createTask : function() {
|
|
224
224
|
return null;
|
|
225
225
|
};
|
|
226
|
-
|
|
226
|
+
y = {
|
|
227
227
|
react_stack_bottom_frame: function(e) {
|
|
228
228
|
return e();
|
|
229
229
|
}
|
|
230
230
|
};
|
|
231
|
-
var
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
)(),
|
|
235
|
-
|
|
236
|
-
var
|
|
237
|
-
return
|
|
231
|
+
var Y, D = {}, P = y.react_stack_bottom_frame.bind(
|
|
232
|
+
y,
|
|
233
|
+
f
|
|
234
|
+
)(), S = I(i(f)), _ = {};
|
|
235
|
+
Q.Fragment = d, Q.jsx = function(e, u, h) {
|
|
236
|
+
var g = 1e4 > O.recentlyCreatedOwnerStacks++;
|
|
237
|
+
return l(
|
|
238
238
|
e,
|
|
239
|
-
|
|
240
|
-
|
|
239
|
+
u,
|
|
240
|
+
h,
|
|
241
241
|
!1,
|
|
242
|
-
|
|
243
|
-
|
|
242
|
+
g ? Error("react-stack-top-frame") : P,
|
|
243
|
+
g ? I(i(e)) : S
|
|
244
244
|
);
|
|
245
|
-
},
|
|
246
|
-
var
|
|
247
|
-
return
|
|
245
|
+
}, Q.jsxs = function(e, u, h) {
|
|
246
|
+
var g = 1e4 > O.recentlyCreatedOwnerStacks++;
|
|
247
|
+
return l(
|
|
248
248
|
e,
|
|
249
|
-
|
|
250
|
-
|
|
249
|
+
u,
|
|
250
|
+
h,
|
|
251
251
|
!0,
|
|
252
|
-
|
|
253
|
-
|
|
252
|
+
g ? Error("react-stack-top-frame") : P,
|
|
253
|
+
g ? I(i(e)) : S
|
|
254
254
|
);
|
|
255
255
|
};
|
|
256
|
-
})()),
|
|
256
|
+
})()), Q;
|
|
257
257
|
}
|
|
258
|
-
var
|
|
259
|
-
function
|
|
260
|
-
return
|
|
258
|
+
var nt;
|
|
259
|
+
function dt() {
|
|
260
|
+
return nt || (nt = 1, process.env.NODE_ENV === "production" ? K.exports = ut() : K.exports = ht()), K.exports;
|
|
261
261
|
}
|
|
262
|
-
var
|
|
263
|
-
function
|
|
264
|
-
return !
|
|
262
|
+
var U = dt();
|
|
263
|
+
function tt(n) {
|
|
264
|
+
return !n && n !== 0 ? { top: 0, right: 0, bottom: 0, left: 0 } : typeof n == "number" ? { top: n, right: n, bottom: n, left: n } : {
|
|
265
|
+
top: n.top ?? 0,
|
|
266
|
+
right: n.right ?? 0,
|
|
267
|
+
bottom: n.bottom ?? 0,
|
|
268
|
+
left: n.left ?? 0
|
|
269
|
+
};
|
|
265
270
|
}
|
|
266
|
-
function
|
|
267
|
-
const t =
|
|
271
|
+
function Z(n) {
|
|
272
|
+
const t = n.replace("#", "");
|
|
268
273
|
if (t.length === 3) {
|
|
269
|
-
const r = parseInt(t[0] + t[0], 16),
|
|
270
|
-
return [r,
|
|
274
|
+
const r = parseInt(t[0] + t[0], 16), i = parseInt(t[1] + t[1], 16), o = parseInt(t[2] + t[2], 16);
|
|
275
|
+
return [r, i, o];
|
|
271
276
|
}
|
|
272
277
|
if (t.length === 6) {
|
|
273
|
-
const r = parseInt(t.slice(0, 2), 16),
|
|
274
|
-
return [r,
|
|
278
|
+
const r = parseInt(t.slice(0, 2), 16), i = parseInt(t.slice(2, 4), 16), o = parseInt(t.slice(4, 6), 16);
|
|
279
|
+
return [r, i, o];
|
|
280
|
+
}
|
|
281
|
+
if (t.length === 8) {
|
|
282
|
+
const r = parseInt(t.slice(0, 2), 16), i = parseInt(t.slice(2, 4), 16), o = parseInt(t.slice(4, 6), 16), f = parseInt(t.slice(6, 8), 16) / 255;
|
|
283
|
+
return [r, i, o, f];
|
|
275
284
|
}
|
|
276
285
|
return null;
|
|
277
286
|
}
|
|
278
|
-
function
|
|
279
|
-
if (
|
|
287
|
+
function it(n, t = !0) {
|
|
288
|
+
if (n <= 0) return String(n);
|
|
280
289
|
const r = [
|
|
281
290
|
[1e3, "M"],
|
|
282
291
|
[900, "CM"],
|
|
@@ -292,23 +301,26 @@ function nt(i, t = !0) {
|
|
|
292
301
|
[4, "IV"],
|
|
293
302
|
[1, "I"]
|
|
294
303
|
];
|
|
295
|
-
let
|
|
296
|
-
for (const [
|
|
297
|
-
for (;
|
|
298
|
-
o +=
|
|
304
|
+
let i = n, o = "";
|
|
305
|
+
for (const [f, s] of r)
|
|
306
|
+
for (; i >= f; )
|
|
307
|
+
o += s, i -= f;
|
|
299
308
|
return t ? o : o.toLowerCase();
|
|
300
309
|
}
|
|
301
|
-
|
|
310
|
+
function st(n, t) {
|
|
311
|
+
return !t || t === "all" ? !0 : t === "first-only" ? n === 1 : t === "except-first" ? n > 1 : Array.isArray(t) ? t.includes(n) : !0;
|
|
312
|
+
}
|
|
313
|
+
class gt {
|
|
302
314
|
constructor(t = {}) {
|
|
303
315
|
this.cursorX = 0, this.cursorY = 0, this.contentWidth = 0, this.margin = { top: 15, right: 15, bottom: 15, left: 15 }, this.defaultFont = {
|
|
304
316
|
name: void 0,
|
|
305
317
|
style: "normal",
|
|
306
318
|
size: 12
|
|
307
|
-
}, this.defaultColor = "#111827", this.defaultLineHeight = 1.25, this.pendingTasks = /* @__PURE__ */ new Set(), this.opQueue = Promise.resolve(), this.generation = 0, this.options = t, this.margin = t.margin ?? this.margin, this.defaultFont = {
|
|
319
|
+
}, this.defaultColor = "#111827", this.defaultLineHeight = 1.25, this.pendingTasks = /* @__PURE__ */ new Set(), this.opQueue = Promise.resolve(), this.generation = 0, this.recurringItems = [], this.options = t, this.margin = t.margin ?? this.margin, this.defaultFont = {
|
|
308
320
|
name: t.font?.name,
|
|
309
321
|
style: t.font?.style ?? "normal",
|
|
310
322
|
size: t.font?.size ?? 12
|
|
311
|
-
}, this.defaultColor = t.color ?? this.defaultColor, this.defaultLineHeight = t.lineHeight ?? this.defaultLineHeight, this.pdf = new
|
|
323
|
+
}, this.defaultColor = t.color ?? this.defaultColor, this.defaultLineHeight = t.lineHeight ?? this.defaultLineHeight, this.pdf = new et({
|
|
312
324
|
unit: t.unit ?? "mm",
|
|
313
325
|
format: t.format ?? "a4",
|
|
314
326
|
orientation: t.orientation ?? "p"
|
|
@@ -351,14 +363,15 @@ class dt {
|
|
|
351
363
|
this.cursorX = this.margin.left, this.cursorY = this.margin.top, this.contentWidth = this.pageWidth - this.margin.left - this.margin.right;
|
|
352
364
|
}
|
|
353
365
|
reset() {
|
|
354
|
-
if (this.pdf = new
|
|
366
|
+
if (this.pdf = new et({
|
|
355
367
|
unit: this.options.unit ?? "mm",
|
|
356
368
|
format: this.options.format ?? "a4",
|
|
357
369
|
orientation: this.options.orientation ?? "p"
|
|
358
370
|
}), this.generation++, this.cursorX = 0, this.cursorY = 0, this.pendingTasks = /* @__PURE__ */ new Set(), this.opQueue = Promise.resolve(), this.resetFlowCursor(), this.applyBaseFont(), this.options.color) {
|
|
359
|
-
const t =
|
|
371
|
+
const t = Z(this.options.color);
|
|
360
372
|
t && this.pdf.setTextColor(...t);
|
|
361
373
|
}
|
|
374
|
+
this.recurringItems = [];
|
|
362
375
|
}
|
|
363
376
|
setHeaderFooter(t, r) {
|
|
364
377
|
this.headerDrawer = t, this.footerDrawer = r;
|
|
@@ -366,14 +379,30 @@ class dt {
|
|
|
366
379
|
applyBaseFont() {
|
|
367
380
|
const t = this.defaultFont.name ?? this.pdf.getFont().fontName;
|
|
368
381
|
this.pdf.setFont(t, this.defaultFont.style), this.pdf.setFontSize(this.defaultFont.size);
|
|
369
|
-
const r =
|
|
382
|
+
const r = Z(this.defaultColor);
|
|
370
383
|
r && this.pdf.setTextColor(...r);
|
|
371
384
|
}
|
|
372
385
|
addPage() {
|
|
373
386
|
this.pdf.addPage(), this.resetFlowCursor();
|
|
387
|
+
const t = this.getPageCount();
|
|
388
|
+
for (const r of this.recurringItems)
|
|
389
|
+
st(t, r.scope) && (r.draw(), r.y + r.height > this.cursorY && (this.cursorY = r.y + r.height));
|
|
374
390
|
}
|
|
375
391
|
ensureSpace(t) {
|
|
376
|
-
this.cursorY + t > this.contentBottom
|
|
392
|
+
if (this.cursorY + t > this.contentBottom) {
|
|
393
|
+
this.addPage();
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
const r = this.getPageCount();
|
|
397
|
+
let i = !0;
|
|
398
|
+
for (; i; ) {
|
|
399
|
+
i = !1;
|
|
400
|
+
for (const o of this.recurringItems)
|
|
401
|
+
if (st(r, o.scope) && this.cursorY < o.y + o.height && this.cursorY + t > o.y && (this.cursorY = o.y + o.height, i = !0, this.cursorY + t > this.contentBottom)) {
|
|
402
|
+
this.addPage();
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
377
406
|
}
|
|
378
407
|
setTextStyle(t) {
|
|
379
408
|
if (t) {
|
|
@@ -382,61 +411,67 @@ class dt {
|
|
|
382
411
|
this.pdf.setFont(r, t.fontStyle);
|
|
383
412
|
}
|
|
384
413
|
if (t.color) {
|
|
385
|
-
const r =
|
|
386
|
-
r && this.pdf.setTextColor(
|
|
414
|
+
const r = Z(t.color);
|
|
415
|
+
r && (this.pdf.setTextColor(r[0], r[1], r[2]), r[3] !== void 0 ? this.pdf.setGState(
|
|
416
|
+
new this.pdf.GState({ opacity: r[3] })
|
|
417
|
+
) : this.pdf.setGState(new this.pdf.GState({ opacity: 1 })));
|
|
387
418
|
}
|
|
388
419
|
}
|
|
389
420
|
}
|
|
390
|
-
textRaw(t, r,
|
|
421
|
+
textRaw(t, r, i, o, f, s = "left") {
|
|
391
422
|
this.setTextStyle(o);
|
|
392
|
-
const
|
|
393
|
-
typeof
|
|
394
|
-
}
|
|
395
|
-
box(t, r,
|
|
396
|
-
const
|
|
397
|
-
if (
|
|
398
|
-
const
|
|
399
|
-
|
|
423
|
+
const a = { align: s };
|
|
424
|
+
typeof f == "number" && (a.maxWidth = f), this.pdf.text(t, r, i, a), this.applyBaseFont();
|
|
425
|
+
}
|
|
426
|
+
box(t, r, i, o, f) {
|
|
427
|
+
const s = f ?? {};
|
|
428
|
+
if (s.fillColor) {
|
|
429
|
+
const a = Z(s.fillColor);
|
|
430
|
+
a && (a[3] !== void 0 && this.pdf.setGState(
|
|
431
|
+
new this.pdf.GState({ opacity: a[3] })
|
|
432
|
+
), this.pdf.setFillColor(a[0], a[1], a[2]), this.pdf.rect(t, r, i, o, "F"), a[3] !== void 0 && this.pdf.setGState(new this.pdf.GState({ opacity: 1 })));
|
|
400
433
|
}
|
|
401
|
-
if (
|
|
402
|
-
if (
|
|
403
|
-
const
|
|
404
|
-
|
|
434
|
+
if (s.borderWidth || s.borderColor) {
|
|
435
|
+
if (s.borderWidth && this.pdf.setLineWidth(s.borderWidth), s.borderColor) {
|
|
436
|
+
const a = Z(s.borderColor);
|
|
437
|
+
a && (a[3] !== void 0 && this.pdf.setGState(
|
|
438
|
+
new this.pdf.GState({ opacity: a[3] })
|
|
439
|
+
), this.pdf.setDrawColor(a[0], a[1], a[2]));
|
|
405
440
|
}
|
|
406
|
-
this.pdf.rect(t, r,
|
|
441
|
+
this.pdf.rect(t, r, i, o), this.pdf.setLineWidth(0.2), this.pdf.setDrawColor(0, 0, 0), this.pdf.setGState(new this.pdf.GState({ opacity: 1 }));
|
|
407
442
|
}
|
|
408
443
|
}
|
|
409
|
-
line(t, r,
|
|
410
|
-
this.pdf.line(t, r,
|
|
444
|
+
line(t, r, i, o) {
|
|
445
|
+
this.pdf.line(t, r, i, o);
|
|
411
446
|
}
|
|
412
447
|
async imageFromUrl(t, r = {}) {
|
|
413
|
-
const
|
|
448
|
+
const i = (async () => {
|
|
414
449
|
try {
|
|
415
|
-
const { dataUrl: o, width:
|
|
416
|
-
let
|
|
417
|
-
|
|
418
|
-
const
|
|
419
|
-
let
|
|
420
|
-
if (r.y === void 0 &&
|
|
421
|
-
const
|
|
422
|
-
|
|
450
|
+
const { dataUrl: o, width: f, height: s } = await this.loadImageAsDataURL(t), a = 0.264583, b = f * a, p = s * a;
|
|
451
|
+
let l = r.w, m = r.h;
|
|
452
|
+
l === void 0 && m === void 0 ? (l = b, m = p) : l === void 0 && m !== void 0 ? l = m * (b / p) : m === void 0 && l !== void 0 && (m = l * (p / b));
|
|
453
|
+
const c = l ?? b, y = m ?? p;
|
|
454
|
+
let w = r.x, x = r.y ?? this.cursorY;
|
|
455
|
+
if (r.y === void 0 && x + y > this.contentBottom && (this.addPage(), x = this.cursorY), w === void 0) {
|
|
456
|
+
const d = r.align ?? "left";
|
|
457
|
+
d === "left" ? w = this.contentLeft : d === "center" ? w = (this.contentLeft + this.contentRight) / 2 - c / 2 : d === "right" && (w = this.contentRight - c);
|
|
423
458
|
}
|
|
424
459
|
return this.pdf.addImage(
|
|
425
460
|
o,
|
|
426
461
|
r.mime ?? "PNG",
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
), { width:
|
|
462
|
+
w,
|
|
463
|
+
x,
|
|
464
|
+
c,
|
|
465
|
+
y
|
|
466
|
+
), { width: c, height: y, x: w, y: x };
|
|
432
467
|
} catch (o) {
|
|
433
468
|
return console.error("Failed to load image", t, o), { width: 0, height: 0, x: 0, y: 0 };
|
|
434
469
|
}
|
|
435
470
|
})();
|
|
436
|
-
return this.registerTask(
|
|
471
|
+
return this.registerTask(i), i;
|
|
437
472
|
}
|
|
438
473
|
queueOperation(t) {
|
|
439
|
-
const r = this.generation,
|
|
474
|
+
const r = this.generation, i = this.opQueue.then(async () => {
|
|
440
475
|
if (this.generation === r)
|
|
441
476
|
try {
|
|
442
477
|
await t();
|
|
@@ -444,7 +479,7 @@ class dt {
|
|
|
444
479
|
console.error("Operation failed", o);
|
|
445
480
|
}
|
|
446
481
|
});
|
|
447
|
-
this.opQueue =
|
|
482
|
+
this.opQueue = i, this.registerTask(i);
|
|
448
483
|
}
|
|
449
484
|
registerTask(t) {
|
|
450
485
|
this.pendingTasks.add(t), t.finally(() => {
|
|
@@ -455,31 +490,31 @@ class dt {
|
|
|
455
490
|
await Promise.all(this.pendingTasks), await this.opQueue;
|
|
456
491
|
}
|
|
457
492
|
loadImageAsDataURL(t) {
|
|
458
|
-
return new Promise((r,
|
|
493
|
+
return new Promise((r, i) => {
|
|
459
494
|
const o = new Image();
|
|
460
495
|
o.crossOrigin = "anonymous", o.onload = () => {
|
|
461
|
-
const
|
|
462
|
-
|
|
463
|
-
const
|
|
464
|
-
if (!
|
|
465
|
-
|
|
466
|
-
dataUrl:
|
|
496
|
+
const f = document.createElement("canvas");
|
|
497
|
+
f.width = o.width, f.height = o.height;
|
|
498
|
+
const s = f.getContext("2d");
|
|
499
|
+
if (!s) return i(new Error("Canvas 2D context not available"));
|
|
500
|
+
s.drawImage(o, 0, 0), r({
|
|
501
|
+
dataUrl: f.toDataURL("image/png"),
|
|
467
502
|
width: o.width,
|
|
468
503
|
height: o.height
|
|
469
504
|
});
|
|
470
|
-
}, o.onerror = (
|
|
505
|
+
}, o.onerror = (f) => i(f), o.src = t;
|
|
471
506
|
});
|
|
472
507
|
}
|
|
473
|
-
paragraph(t, r,
|
|
474
|
-
const o =
|
|
508
|
+
paragraph(t, r, i) {
|
|
509
|
+
const o = i ?? this.contentWidth;
|
|
475
510
|
this.setTextStyle(r);
|
|
476
|
-
const
|
|
477
|
-
let
|
|
478
|
-
return
|
|
479
|
-
this.cursorY +
|
|
480
|
-
const
|
|
481
|
-
this.pdf.text(
|
|
482
|
-
}), this.cursorY += 1, this.applyBaseFont(),
|
|
511
|
+
const f = r?.lineHeight ?? this.defaultLineHeight, s = r?.fontSize ?? this.defaultFont.size, a = s * f * 0.3528, b = this.pdf.splitTextToSize(t, o), p = r?.align ?? "left";
|
|
512
|
+
let l = 0;
|
|
513
|
+
return b.forEach((m) => {
|
|
514
|
+
this.cursorY + a > this.contentBottom && this.addPage();
|
|
515
|
+
const c = this.cursorY + s * 0.3528;
|
|
516
|
+
this.pdf.text(m, this.cursorX, c, { align: p, maxWidth: o }), this.cursorY += a, l += a;
|
|
517
|
+
}), this.cursorY += 1, this.applyBaseFont(), l;
|
|
483
518
|
}
|
|
484
519
|
moveCursor(t, r) {
|
|
485
520
|
this.cursorX += t, this.cursorY += r;
|
|
@@ -493,6 +528,9 @@ class dt {
|
|
|
493
528
|
getPageCount() {
|
|
494
529
|
return this.pdf.getNumberOfPages();
|
|
495
530
|
}
|
|
531
|
+
registerRecurringItem(t) {
|
|
532
|
+
this.recurringItems.push(t);
|
|
533
|
+
}
|
|
496
534
|
applyHeaderFooter() {
|
|
497
535
|
const t = this.getPageCount();
|
|
498
536
|
if (!(!this.headerDrawer && !this.footerDrawer)) {
|
|
@@ -501,18 +539,18 @@ class dt {
|
|
|
501
539
|
this.pdf.setPage(t);
|
|
502
540
|
}
|
|
503
541
|
}
|
|
504
|
-
measureText(t, r,
|
|
542
|
+
measureText(t, r, i) {
|
|
505
543
|
this.setTextStyle(r);
|
|
506
|
-
const o = r?.fontSize ?? this.defaultFont.size,
|
|
507
|
-
if (
|
|
508
|
-
const
|
|
544
|
+
const o = r?.fontSize ?? this.defaultFont.size, f = r?.lineHeight ?? this.defaultLineHeight, s = o * f * 0.3528;
|
|
545
|
+
if (i) {
|
|
546
|
+
const a = this.pdf.splitTextToSize(t, i);
|
|
509
547
|
return {
|
|
510
|
-
width:
|
|
511
|
-
height:
|
|
548
|
+
width: i,
|
|
549
|
+
height: a.length * s
|
|
512
550
|
};
|
|
513
551
|
} else {
|
|
514
|
-
const
|
|
515
|
-
return { width:
|
|
552
|
+
const a = this.pdf.getTextDimensions(t);
|
|
553
|
+
return { width: a.w, height: a.h };
|
|
516
554
|
}
|
|
517
555
|
}
|
|
518
556
|
setMetadata(t) {
|
|
@@ -527,177 +565,176 @@ class dt {
|
|
|
527
565
|
return this.applyHeaderFooter(), this.pdf.output("bloburl");
|
|
528
566
|
}
|
|
529
567
|
}
|
|
530
|
-
const
|
|
531
|
-
const
|
|
532
|
-
if (!
|
|
533
|
-
return
|
|
534
|
-
},
|
|
535
|
-
options:
|
|
568
|
+
const at = ft(null), $ = () => {
|
|
569
|
+
const n = ct(at);
|
|
570
|
+
if (!n) throw new Error("usePdf must be used within <PdfDocument>");
|
|
571
|
+
return n;
|
|
572
|
+
}, pt = ({
|
|
573
|
+
options: n,
|
|
536
574
|
header: t,
|
|
537
575
|
footer: r,
|
|
538
|
-
pageNumbers:
|
|
576
|
+
pageNumbers: i,
|
|
539
577
|
centerLabel: o,
|
|
540
|
-
metadata:
|
|
541
|
-
children:
|
|
542
|
-
onReady:
|
|
543
|
-
filename:
|
|
544
|
-
autoSave:
|
|
578
|
+
metadata: f,
|
|
579
|
+
children: s,
|
|
580
|
+
onReady: a,
|
|
581
|
+
filename: b,
|
|
582
|
+
autoSave: p = !1
|
|
545
583
|
}) => {
|
|
546
|
-
const
|
|
547
|
-
return
|
|
548
|
-
|
|
549
|
-
}, [
|
|
550
|
-
const
|
|
551
|
-
if (!
|
|
552
|
-
const X =
|
|
553
|
-
|
|
554
|
-
},
|
|
555
|
-
if (!o?.enabled || !
|
|
556
|
-
const X = "center",
|
|
557
|
-
|
|
584
|
+
const l = H.useMemo(() => new gt(n), [n]);
|
|
585
|
+
return H.useEffect(() => {
|
|
586
|
+
f && l.setMetadata(f);
|
|
587
|
+
}, [l, f]), H.useEffect(() => {
|
|
588
|
+
const m = (x, d) => !d || d === "all" ? !0 : d === "first-only" ? x === 1 : d === "except-first" ? x > 1 : Array.isArray(d) ? d.includes(x) : !0, c = (x, d) => d === "roman-upper" ? it(x, !0) : d === "roman-lower" ? it(x, !1) : String(x), y = (x, d, F) => {
|
|
589
|
+
if (!i?.enabled || !m(d, i.scope)) return;
|
|
590
|
+
const X = i.preset ?? "page-slash-total", N = (i.template ?? (X === "page-slash-total" ? "Page {page}/{total}" : X === "page-of-total" ? "Page {page} of {total}" : "{page}/{total}")).replace("{page}", c(d, i.format)).replace("{total}", c(F, i.format)), z = i.align ?? "right", B = z === "left" ? l.contentLeft + (i.offsetX ?? 0) : z === "right" ? l.contentRight - (i.offsetX ?? 0) : (l.contentLeft + l.contentRight) / 2 + (i.offsetX ?? 0), G = x === "header" ? 10 : l.height - 7, q = typeof i.y == "number" ? i.y : G;
|
|
591
|
+
l.textRaw(N, B, q, i.style, void 0, z);
|
|
592
|
+
}, w = (x, d, F) => {
|
|
593
|
+
if (!o?.enabled || !m(d, o.scope)) return;
|
|
594
|
+
const X = "center", j = (l.contentLeft + l.contentRight) / 2 + (o.offsetX ?? 0), N = x === "header" ? 10 : l.height - 7, z = typeof o.y == "number" ? o.y : N;
|
|
595
|
+
l.textRaw(
|
|
558
596
|
o.text,
|
|
559
|
-
|
|
560
|
-
|
|
597
|
+
j,
|
|
598
|
+
z,
|
|
561
599
|
o.style,
|
|
562
600
|
void 0,
|
|
563
601
|
X
|
|
564
602
|
);
|
|
565
603
|
};
|
|
566
|
-
return
|
|
567
|
-
(
|
|
568
|
-
t && t(
|
|
604
|
+
return l.setHeaderFooter(
|
|
605
|
+
(x, d, F) => {
|
|
606
|
+
t && t(l, d, F), i?.position === "header" && y("header", d, F), o?.position === "header" && w("header", d);
|
|
569
607
|
},
|
|
570
|
-
(
|
|
571
|
-
|
|
608
|
+
(x, d, F) => {
|
|
609
|
+
i?.position === "footer" && y("footer", d, F), r && r(l, d, F), o?.position === "footer" && w("footer", d);
|
|
572
610
|
}
|
|
573
|
-
),
|
|
574
|
-
|
|
611
|
+
), l.waitForTasks().then(() => {
|
|
612
|
+
a?.(l);
|
|
575
613
|
}), () => {
|
|
576
|
-
|
|
614
|
+
l.reset();
|
|
577
615
|
};
|
|
578
|
-
}, [
|
|
579
|
-
|
|
580
|
-
}, [
|
|
581
|
-
},
|
|
582
|
-
|
|
583
|
-
y: t,
|
|
584
|
-
w: r,
|
|
585
|
-
h: n,
|
|
586
|
-
children: o,
|
|
587
|
-
...s
|
|
588
|
-
}) => {
|
|
589
|
-
const a = q(), c = Z(s.padding), u = {
|
|
590
|
-
top: s.paddingTop ?? c.top,
|
|
591
|
-
right: s.paddingRight ?? c.right,
|
|
592
|
-
bottom: s.paddingBottom ?? c.bottom,
|
|
593
|
-
left: s.paddingLeft ?? c.left
|
|
594
|
-
}, m = A.useRef(
|
|
595
|
-
{}
|
|
596
|
-
).current;
|
|
597
|
-
return typeof i == "number" && typeof t == "number" && typeof r == "number" && typeof n == "number" ? (A.useEffect(() => {
|
|
598
|
-
a.queueOperation(() => {
|
|
599
|
-
a.box(i, t, r, n, s);
|
|
600
|
-
});
|
|
601
|
-
}, [a, i, t, r, n]), /* @__PURE__ */ I.jsx(A.Fragment, { children: o })) : (A.useEffect(() => {
|
|
602
|
-
a.queueOperation(() => {
|
|
603
|
-
const f = a.getCursor();
|
|
604
|
-
m.start = { ...f };
|
|
605
|
-
const x = f.x + u.left, d = f.y + u.top;
|
|
606
|
-
a.setCursor(x, d);
|
|
607
|
-
});
|
|
608
|
-
}, [a]), /* @__PURE__ */ I.jsxs(A.Fragment, { children: [
|
|
609
|
-
o,
|
|
610
|
-
/* @__PURE__ */ I.jsx(pt, { boxState: m, pad: u, style: s })
|
|
611
|
-
] }));
|
|
612
|
-
}, pt = ({ boxState: i, style: t, pad: r }) => {
|
|
613
|
-
const n = q();
|
|
614
|
-
return A.useEffect(() => {
|
|
615
|
-
n.queueOperation(() => {
|
|
616
|
-
const o = i.start;
|
|
617
|
-
if (!o) return;
|
|
618
|
-
const s = n.getCursor(), c = Math.max(s.y - o.y - r.top, 0) + r.top + r.bottom;
|
|
619
|
-
n.box(o.x, o.y, n.contentAreaWidth, c, t), n.setCursor(o.x, o.y + c);
|
|
620
|
-
});
|
|
621
|
-
}, [n]), null;
|
|
622
|
-
}, Rt = ({
|
|
623
|
-
src: i,
|
|
616
|
+
}, [l]), H.useEffect(() => {
|
|
617
|
+
p && b && l.save(b);
|
|
618
|
+
}, [p, b]), /* @__PURE__ */ U.jsx(at.Provider, { value: l, children: s });
|
|
619
|
+
}, St = ({
|
|
620
|
+
src: n,
|
|
624
621
|
x: t,
|
|
625
622
|
y: r,
|
|
626
|
-
w:
|
|
623
|
+
w: i,
|
|
627
624
|
h: o,
|
|
628
|
-
mime:
|
|
629
|
-
flow:
|
|
630
|
-
|
|
625
|
+
mime: f = "PNG",
|
|
626
|
+
flow: s,
|
|
627
|
+
layout: a,
|
|
628
|
+
sizing: b,
|
|
629
|
+
align: p = "left",
|
|
630
|
+
showInAllPages: l,
|
|
631
|
+
scope: m
|
|
631
632
|
}) => {
|
|
632
|
-
const
|
|
633
|
-
return
|
|
634
|
-
const
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
633
|
+
const c = $();
|
|
634
|
+
return H.useEffect(() => {
|
|
635
|
+
const y = a === "flow" || s === !0 || t === void 0 && r === void 0 && a !== "fixed";
|
|
636
|
+
let w = i;
|
|
637
|
+
b === "fill" && (w = c.contentAreaWidth);
|
|
638
|
+
const x = t, d = r;
|
|
639
|
+
c.queueOperation(async () => {
|
|
640
|
+
const F = c.getCursor(), j = await (async (N, z) => {
|
|
641
|
+
const B = x, G = d;
|
|
642
|
+
return await c.imageFromUrl(n, {
|
|
643
|
+
x: B,
|
|
644
|
+
y: G,
|
|
645
|
+
w,
|
|
646
|
+
h: o,
|
|
647
|
+
mime: f,
|
|
648
|
+
align: p
|
|
649
|
+
});
|
|
650
|
+
})();
|
|
651
|
+
y && j && c.moveCursor(0, j.height + 2), l && j && c.registerRecurringItem({
|
|
652
|
+
draw: () => {
|
|
653
|
+
c.queueOperation(async () => {
|
|
654
|
+
y && c.setCursor(F.x, F.y), await c.imageFromUrl(n, {
|
|
655
|
+
x,
|
|
656
|
+
y: y ? F.y : d,
|
|
657
|
+
w,
|
|
658
|
+
h: o,
|
|
659
|
+
mime: f,
|
|
660
|
+
align: p
|
|
661
|
+
});
|
|
662
|
+
});
|
|
663
|
+
},
|
|
664
|
+
scope: m ?? "all",
|
|
665
|
+
y: y ? F.y : d ?? 0,
|
|
666
|
+
height: j.height + 2
|
|
643
667
|
});
|
|
644
|
-
m && d && u.moveCursor(0, d.height + 2);
|
|
645
668
|
});
|
|
646
|
-
}, [
|
|
647
|
-
|
|
648
|
-
|
|
669
|
+
}, [
|
|
670
|
+
c,
|
|
671
|
+
n,
|
|
672
|
+
t,
|
|
673
|
+
r,
|
|
674
|
+
i,
|
|
675
|
+
o,
|
|
676
|
+
f,
|
|
677
|
+
s,
|
|
678
|
+
a,
|
|
679
|
+
b,
|
|
680
|
+
p,
|
|
681
|
+
l,
|
|
682
|
+
m
|
|
683
|
+
]), null;
|
|
684
|
+
}, Rt = ({
|
|
685
|
+
items: n,
|
|
649
686
|
ordered: t = !1,
|
|
650
687
|
style: r,
|
|
651
|
-
indent:
|
|
688
|
+
indent: i = 5,
|
|
652
689
|
markerWidth: o = 5,
|
|
653
|
-
spacing:
|
|
690
|
+
spacing: f = 2
|
|
654
691
|
}) => {
|
|
655
|
-
const
|
|
656
|
-
return
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
const
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
692
|
+
const s = $();
|
|
693
|
+
return H.useEffect(() => {
|
|
694
|
+
s.queueOperation(() => {
|
|
695
|
+
n.forEach((a, b) => {
|
|
696
|
+
const p = t ? `${b + 1}.` : "•", l = s.getCursor().y, m = s.getCursor().x, c = m + i + o, y = r?.fontSize ?? s.baseFont.size, w = l + y * 0.3528;
|
|
697
|
+
s.textRaw(
|
|
698
|
+
p,
|
|
699
|
+
m + i,
|
|
700
|
+
w,
|
|
664
701
|
r,
|
|
665
702
|
o,
|
|
666
703
|
"right"
|
|
667
|
-
),
|
|
668
|
-
const
|
|
669
|
-
|
|
670
|
-
const
|
|
671
|
-
|
|
704
|
+
), s.setCursor(c, l);
|
|
705
|
+
const x = s.contentRight - c;
|
|
706
|
+
s.paragraph(a, r, x);
|
|
707
|
+
const d = s.getCursor().y;
|
|
708
|
+
s.setCursor(m, d + f);
|
|
672
709
|
});
|
|
673
710
|
});
|
|
674
|
-
}, [
|
|
675
|
-
},
|
|
676
|
-
width:
|
|
677
|
-
height: t = "
|
|
711
|
+
}, [s, n, t, r, i, o, f]), null;
|
|
712
|
+
}, xt = ({
|
|
713
|
+
width: n = "inherit",
|
|
714
|
+
height: t = "inherit",
|
|
678
715
|
className: r,
|
|
679
|
-
style:
|
|
716
|
+
style: i,
|
|
680
717
|
iframeClassName: o,
|
|
681
|
-
iframeStyle:
|
|
682
|
-
...
|
|
718
|
+
iframeStyle: f,
|
|
719
|
+
...s
|
|
683
720
|
}) => {
|
|
684
|
-
const [
|
|
685
|
-
const
|
|
686
|
-
|
|
721
|
+
const [a, b] = lt(null), p = (l) => {
|
|
722
|
+
const m = l.getBlobUrl();
|
|
723
|
+
b(m.toString());
|
|
687
724
|
};
|
|
688
|
-
return /* @__PURE__ */
|
|
689
|
-
/* @__PURE__ */
|
|
690
|
-
|
|
725
|
+
return /* @__PURE__ */ U.jsxs("div", { className: r, style: { width: n, height: t, ...i }, children: [
|
|
726
|
+
/* @__PURE__ */ U.jsx("div", { style: { display: "none" }, children: /* @__PURE__ */ U.jsx(pt, { ...s, onReady: p, autoSave: !1, children: s.children }) }),
|
|
727
|
+
a ? /* @__PURE__ */ U.jsx(
|
|
691
728
|
"iframe",
|
|
692
729
|
{
|
|
693
|
-
src:
|
|
730
|
+
src: a,
|
|
694
731
|
width: "100%",
|
|
695
732
|
height: "100%",
|
|
696
733
|
className: o,
|
|
697
|
-
style: { border: "none", ...
|
|
734
|
+
style: { border: "none", ...f },
|
|
698
735
|
title: "PDF Preview"
|
|
699
736
|
}
|
|
700
|
-
) : /* @__PURE__ */
|
|
737
|
+
) : /* @__PURE__ */ U.jsx(
|
|
701
738
|
"div",
|
|
702
739
|
{
|
|
703
740
|
style: {
|
|
@@ -713,256 +750,297 @@ const it = at(null), q = () => {
|
|
|
713
750
|
}
|
|
714
751
|
)
|
|
715
752
|
] });
|
|
716
|
-
},
|
|
717
|
-
data:
|
|
753
|
+
}, Ct = ({
|
|
754
|
+
data: n,
|
|
718
755
|
columns: t,
|
|
719
756
|
width: r = "100%",
|
|
720
|
-
borderWidth:
|
|
757
|
+
borderWidth: i = 0.1,
|
|
721
758
|
borderColor: o = "#000000",
|
|
722
|
-
cellPadding:
|
|
723
|
-
headerStyle:
|
|
724
|
-
rowStyle:
|
|
725
|
-
alternateRowStyle:
|
|
726
|
-
headerHeight:
|
|
759
|
+
cellPadding: f = 2,
|
|
760
|
+
headerStyle: s,
|
|
761
|
+
rowStyle: a,
|
|
762
|
+
alternateRowStyle: b,
|
|
763
|
+
headerHeight: p,
|
|
764
|
+
repeatHeader: l = !0,
|
|
765
|
+
striped: m = !1
|
|
727
766
|
}) => {
|
|
728
|
-
const
|
|
729
|
-
return
|
|
730
|
-
|
|
731
|
-
const
|
|
732
|
-
if (
|
|
733
|
-
const
|
|
734
|
-
for (let
|
|
735
|
-
|
|
767
|
+
const c = $();
|
|
768
|
+
return H.useEffect(() => {
|
|
769
|
+
c.queueOperation(() => {
|
|
770
|
+
const y = typeof r == "number" ? r : parseFloat(r) / 100 * c.contentAreaWidth, w = t.map((v) => typeof v.width == "number" ? v.width : typeof v.width == "string" && v.width.endsWith("%") ? parseFloat(v.width) / 100 * y : 0), x = w.reduce((v, T) => v + T, 0), d = Math.max(0, y - x), F = w.filter((v) => v === 0).length;
|
|
771
|
+
if (F > 0) {
|
|
772
|
+
const v = d / F;
|
|
773
|
+
for (let T = 0; T < w.length; T++)
|
|
774
|
+
w[T] === 0 && (w[T] = v);
|
|
736
775
|
}
|
|
737
|
-
const
|
|
738
|
-
Y &&
|
|
739
|
-
borderColor:
|
|
740
|
-
borderWidth:
|
|
741
|
-
fillColor:
|
|
776
|
+
const X = (v, T, A, O, E, R, I = "left", Y = !0) => {
|
|
777
|
+
Y && c.box(T, A, O, E, {
|
|
778
|
+
borderColor: R.borderColor ?? o,
|
|
779
|
+
borderWidth: R.borderWidth ?? i,
|
|
780
|
+
fillColor: R.fillColor
|
|
742
781
|
});
|
|
743
|
-
const
|
|
744
|
-
top:
|
|
745
|
-
right:
|
|
746
|
-
bottom:
|
|
747
|
-
left:
|
|
748
|
-
},
|
|
749
|
-
let
|
|
750
|
-
|
|
751
|
-
let
|
|
752
|
-
const
|
|
753
|
-
|
|
754
|
-
let
|
|
755
|
-
|
|
756
|
-
}),
|
|
782
|
+
const D = tt(R.padding ?? f), P = {
|
|
783
|
+
top: R.paddingTop ?? D.top,
|
|
784
|
+
right: R.paddingRight ?? D.right,
|
|
785
|
+
bottom: R.paddingBottom ?? D.bottom,
|
|
786
|
+
left: R.paddingLeft ?? D.left
|
|
787
|
+
}, S = O - P.left - P.right, _ = c.instance.splitTextToSize(v, S, R), e = (R.fontSize ?? c.baseFont.size) * (R.lineHeight ?? c.baseLineHeight) * 0.3528, u = (R.fontSize ?? c.baseFont.size) * 0.3528, h = _.length * e, g = E - P.top - P.bottom;
|
|
788
|
+
let W = 0;
|
|
789
|
+
R.verticalAlign === "middle" ? W = Math.max(0, (g - h) / 2) : R.verticalAlign === "bottom" && (W = Math.max(0, g - h));
|
|
790
|
+
let M = A + P.top + W + u;
|
|
791
|
+
const C = R.align ?? I, L = c.getCursor();
|
|
792
|
+
_.forEach((k) => {
|
|
793
|
+
let V = T + P.left;
|
|
794
|
+
C === "center" ? V = T + O / 2 : C === "right" && (V = T + O - P.right), c.textRaw(k, V, M, R, void 0, C), M += e;
|
|
795
|
+
}), c.setCursor(L.x, L.y);
|
|
757
796
|
};
|
|
758
|
-
let
|
|
759
|
-
const
|
|
760
|
-
|
|
761
|
-
let
|
|
762
|
-
t.forEach((
|
|
763
|
-
const
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
),
|
|
773
|
-
}),
|
|
774
|
-
const
|
|
775
|
-
const
|
|
776
|
-
top:
|
|
777
|
-
right:
|
|
778
|
-
bottom:
|
|
779
|
-
left:
|
|
780
|
-
},
|
|
781
|
-
return
|
|
797
|
+
let j = c.getCursor().y;
|
|
798
|
+
const N = c.getCursor().x, z = p ?? 10;
|
|
799
|
+
j + z > c.contentBottom && (c.addPage(), j = c.getCursor().y);
|
|
800
|
+
let B = N;
|
|
801
|
+
t.forEach((v, T) => {
|
|
802
|
+
const A = w[T];
|
|
803
|
+
X(
|
|
804
|
+
v.header ?? "",
|
|
805
|
+
B,
|
|
806
|
+
j,
|
|
807
|
+
A,
|
|
808
|
+
z,
|
|
809
|
+
s ?? { fontStyle: "bold" },
|
|
810
|
+
v.align ?? "left"
|
|
811
|
+
), B += A;
|
|
812
|
+
}), j += z, c.setCursor(N, j);
|
|
813
|
+
const G = (v, T, A) => {
|
|
814
|
+
const O = tt(f), E = {
|
|
815
|
+
top: A.paddingTop ?? O.top,
|
|
816
|
+
right: A.paddingRight ?? O.right,
|
|
817
|
+
bottom: A.paddingBottom ?? O.bottom,
|
|
818
|
+
left: A.paddingLeft ?? O.left
|
|
819
|
+
}, R = T - E.left - E.right;
|
|
820
|
+
return c.measureText(v, A, R).height + E.top + E.bottom;
|
|
782
821
|
};
|
|
783
822
|
new Array(t.length).fill(0), (() => {
|
|
784
|
-
const
|
|
785
|
-
for (let
|
|
786
|
-
const
|
|
787
|
-
let
|
|
823
|
+
const v = new Array(n.length).fill(0);
|
|
824
|
+
for (let E = 0; E < n.length; E++) {
|
|
825
|
+
const R = n[E];
|
|
826
|
+
let I = 0;
|
|
788
827
|
for (let Y = 0; Y < t.length; Y++) {
|
|
789
|
-
const
|
|
790
|
-
let
|
|
791
|
-
if (
|
|
792
|
-
Y +=
|
|
828
|
+
const D = t[Y], P = typeof D.accessor == "function" ? D.accessor(R) : R[D.accessor];
|
|
829
|
+
let S = "", _ = a, e = 1, u = 1;
|
|
830
|
+
if (P && typeof P == "object" && P.content !== void 0 ? (S = String(P.content), P.style && (_ = P.style), P.colSpan && (e = P.colSpan), P.rowSpan && (u = P.rowSpan)) : S = String(P ?? ""), u > 1) {
|
|
831
|
+
Y += e - 1;
|
|
793
832
|
continue;
|
|
794
833
|
}
|
|
795
|
-
let
|
|
796
|
-
for (let
|
|
797
|
-
Y +
|
|
798
|
-
const
|
|
799
|
-
|
|
834
|
+
let h = w[Y];
|
|
835
|
+
for (let W = 1; W < e; W++)
|
|
836
|
+
Y + W < w.length && (h += w[Y + W]);
|
|
837
|
+
const g = G(S, h, _ ?? {});
|
|
838
|
+
g > I && (I = g), Y += e - 1;
|
|
800
839
|
}
|
|
801
|
-
|
|
840
|
+
I < 8 && (I = 8), v[E] = I;
|
|
802
841
|
}
|
|
803
|
-
let
|
|
804
|
-
const
|
|
805
|
-
for (let
|
|
806
|
-
const
|
|
807
|
-
let Y =
|
|
808
|
-
for (let
|
|
809
|
-
const
|
|
810
|
-
let
|
|
811
|
-
if (
|
|
812
|
-
let
|
|
813
|
-
for (let
|
|
814
|
-
|
|
815
|
-
|
|
842
|
+
let T = j;
|
|
843
|
+
const A = new Array(t.length).fill(0), O = c.getCursor().x;
|
|
844
|
+
for (let E = 0; E < n.length; E++) {
|
|
845
|
+
const R = n[E], I = v[E];
|
|
846
|
+
let Y = I;
|
|
847
|
+
for (let S = 0; S < t.length; S++) {
|
|
848
|
+
const _ = t[S], e = typeof _.accessor == "function" ? _.accessor(R) : R[_.accessor];
|
|
849
|
+
let u = 1;
|
|
850
|
+
if (e && typeof e == "object" && e.rowSpan && (u = e.rowSpan), u > 1) {
|
|
851
|
+
let h = 0;
|
|
852
|
+
for (let g = 0; g < u; g++)
|
|
853
|
+
E + g < v.length && (h += v[E + g]);
|
|
854
|
+
h > Y && (Y = h);
|
|
816
855
|
}
|
|
817
856
|
}
|
|
818
|
-
const
|
|
819
|
-
if (
|
|
820
|
-
let
|
|
821
|
-
t.forEach((
|
|
822
|
-
const
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
),
|
|
832
|
-
}),
|
|
857
|
+
const D = Math.abs(T - (c.contentTop + (p ?? 10))) < 1;
|
|
858
|
+
if (T + Y > c.contentBottom && !D && (c.addPage(), T = c.getCursor().y, l && (p ?? 10) !== 0)) {
|
|
859
|
+
let S = O;
|
|
860
|
+
t.forEach((_, e) => {
|
|
861
|
+
const u = w[e];
|
|
862
|
+
X(
|
|
863
|
+
_.header ?? "",
|
|
864
|
+
S,
|
|
865
|
+
T,
|
|
866
|
+
u,
|
|
867
|
+
p ?? 10,
|
|
868
|
+
s ?? { fontStyle: "bold" },
|
|
869
|
+
_.align ?? "left"
|
|
870
|
+
), S += u;
|
|
871
|
+
}), T += p ?? 10;
|
|
833
872
|
}
|
|
834
|
-
let
|
|
835
|
-
for (let
|
|
836
|
-
if (
|
|
837
|
-
|
|
873
|
+
let P = O;
|
|
874
|
+
for (let S = 0; S < t.length; S++) {
|
|
875
|
+
if (A[S] > 0) {
|
|
876
|
+
A[S]--, P += w[S];
|
|
838
877
|
continue;
|
|
839
878
|
}
|
|
840
|
-
const
|
|
841
|
-
let
|
|
842
|
-
|
|
843
|
-
let
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
let
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
879
|
+
const _ = t[S], e = typeof _.accessor == "function" ? _.accessor(R) : R[_.accessor];
|
|
880
|
+
let u = 1, h = 1, g = a;
|
|
881
|
+
E % 2 === 1 && (b ? g = b : m && (g = { ...a, fillColor: "#F9FAFB" }));
|
|
882
|
+
let M = "";
|
|
883
|
+
e && typeof e == "object" && e.content !== void 0 ? (M = String(e.content), e.colSpan && (u = e.colSpan), e.rowSpan && (h = e.rowSpan), e.style && (g = { ...g, ...e.style })) : M = String(e ?? "");
|
|
884
|
+
let C = w[S];
|
|
885
|
+
for (let k = 1; k < u; k++)
|
|
886
|
+
S + k < w.length && (C += w[S + k]);
|
|
887
|
+
let L = I;
|
|
888
|
+
if (h > 1)
|
|
889
|
+
for (let k = 1; k < h; k++)
|
|
890
|
+
E + k < v.length && (L += v[E + k]);
|
|
891
|
+
if (X(
|
|
892
|
+
M,
|
|
893
|
+
P,
|
|
852
894
|
T,
|
|
853
|
-
R,
|
|
854
895
|
C,
|
|
855
896
|
L,
|
|
856
|
-
|
|
857
|
-
|
|
897
|
+
g ?? {},
|
|
898
|
+
_.align ?? "left",
|
|
858
899
|
!0
|
|
859
|
-
),
|
|
860
|
-
|
|
861
|
-
for (let
|
|
862
|
-
|
|
900
|
+
), h > 1) {
|
|
901
|
+
A[S] = h - 1;
|
|
902
|
+
for (let k = 1; k < u; k++)
|
|
903
|
+
S + k < A.length && (A[S + k] = h - 1);
|
|
863
904
|
}
|
|
864
|
-
|
|
905
|
+
P += C, S += u - 1;
|
|
865
906
|
}
|
|
866
|
-
|
|
907
|
+
T += I;
|
|
867
908
|
}
|
|
868
|
-
|
|
909
|
+
c.setCursor(O, T);
|
|
869
910
|
})();
|
|
870
911
|
});
|
|
871
|
-
}, [
|
|
872
|
-
},
|
|
873
|
-
children:
|
|
912
|
+
}, [c, n, t, r]), null;
|
|
913
|
+
}, Tt = ({
|
|
914
|
+
children: n,
|
|
874
915
|
x: t,
|
|
875
916
|
y: r,
|
|
876
|
-
maxWidth:
|
|
917
|
+
maxWidth: i,
|
|
877
918
|
spacingBelow: o = 2,
|
|
878
|
-
...
|
|
919
|
+
...f
|
|
879
920
|
}) => {
|
|
880
|
-
const
|
|
881
|
-
return
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
921
|
+
const s = $();
|
|
922
|
+
return H.useEffect(() => {
|
|
923
|
+
s.queueOperation(() => {
|
|
924
|
+
const a = s.getCursor();
|
|
925
|
+
let b = 0;
|
|
926
|
+
const p = () => {
|
|
927
|
+
if (typeof t == "number" && typeof r == "number")
|
|
928
|
+
s.textRaw(n, t, r, f, i, f.align);
|
|
929
|
+
else {
|
|
930
|
+
s.setCursor(a.x, a.y), b = s.paragraph(n, f, i);
|
|
931
|
+
const l = s.getCursor();
|
|
932
|
+
s.setCursor(l.x, l.y + o);
|
|
933
|
+
}
|
|
934
|
+
};
|
|
935
|
+
p(), f.showInAllPages && s.registerRecurringItem({
|
|
936
|
+
draw: p,
|
|
937
|
+
scope: f.scope ?? "all",
|
|
938
|
+
y: a.y,
|
|
939
|
+
height: b + o
|
|
940
|
+
});
|
|
890
941
|
});
|
|
891
942
|
}, [
|
|
892
|
-
|
|
893
|
-
|
|
943
|
+
s,
|
|
944
|
+
n,
|
|
894
945
|
t,
|
|
895
946
|
r,
|
|
896
|
-
|
|
947
|
+
i,
|
|
897
948
|
o,
|
|
898
|
-
|
|
899
|
-
|
|
949
|
+
f.fontSize,
|
|
950
|
+
f.align
|
|
900
951
|
]), null;
|
|
952
|
+
}, mt = ({
|
|
953
|
+
viewState: n,
|
|
954
|
+
style: t,
|
|
955
|
+
pad: r,
|
|
956
|
+
margin: i,
|
|
957
|
+
w: o,
|
|
958
|
+
h: f
|
|
959
|
+
}) => {
|
|
960
|
+
const s = $();
|
|
961
|
+
return H.useEffect(() => {
|
|
962
|
+
s.queueOperation(() => {
|
|
963
|
+
const a = n.start;
|
|
964
|
+
if (!a) return;
|
|
965
|
+
const b = s.getCursor(), p = Math.max(b.y - a.y - r.top, 0);
|
|
966
|
+
let l = f ?? p + r.top + r.bottom;
|
|
967
|
+
t.height && (l = t.height);
|
|
968
|
+
let m = o ?? s.contentAreaWidth;
|
|
969
|
+
typeof t.width == "number" && (m = t.width);
|
|
970
|
+
const c = () => {
|
|
971
|
+
(t.borderColor || t.fillColor || t.borderWidth) && s.box(a.x, a.y, m, l, t);
|
|
972
|
+
};
|
|
973
|
+
if (c(), t.showInAllPages && s.registerRecurringItem({
|
|
974
|
+
draw: c,
|
|
975
|
+
scope: t.scope ?? "all",
|
|
976
|
+
y: a.y,
|
|
977
|
+
height: l
|
|
978
|
+
}), !n.isAbsolute) {
|
|
979
|
+
const y = a.y + l + i.bottom;
|
|
980
|
+
s.setCursor(a.x, y);
|
|
981
|
+
}
|
|
982
|
+
});
|
|
983
|
+
}, [s, t.showInAllPages, t.scope, o, f]), null;
|
|
901
984
|
};
|
|
902
|
-
function
|
|
903
|
-
return typeof
|
|
904
|
-
top:
|
|
905
|
-
right:
|
|
906
|
-
bottom:
|
|
907
|
-
left:
|
|
985
|
+
function bt(n) {
|
|
986
|
+
return typeof n == "number" ? { top: n, right: n, bottom: n, left: n } : {
|
|
987
|
+
top: n?.top ?? 0,
|
|
988
|
+
right: n?.right ?? 0,
|
|
989
|
+
bottom: n?.bottom ?? 0,
|
|
990
|
+
left: n?.left ?? 0
|
|
908
991
|
};
|
|
909
992
|
}
|
|
910
|
-
const Pt = ({
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
)
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
993
|
+
const Pt = ({
|
|
994
|
+
style: n = {},
|
|
995
|
+
children: t,
|
|
996
|
+
x: r,
|
|
997
|
+
y: i,
|
|
998
|
+
w: o,
|
|
999
|
+
h: f
|
|
1000
|
+
}) => {
|
|
1001
|
+
const s = $(), a = tt(n.padding), b = {
|
|
1002
|
+
top: n.paddingTop ?? a.top,
|
|
1003
|
+
right: n.paddingRight ?? a.right,
|
|
1004
|
+
bottom: n.paddingBottom ?? a.bottom,
|
|
1005
|
+
left: n.paddingLeft ?? a.left
|
|
1006
|
+
}, p = bt(n.margin), l = {
|
|
1007
|
+
top: n.marginTop ?? p.top,
|
|
1008
|
+
right: n.marginRight ?? p.right,
|
|
1009
|
+
bottom: n.marginBottom ?? p.bottom,
|
|
1010
|
+
left: n.marginLeft ?? p.left
|
|
1011
|
+
}, m = H.useRef({}).current;
|
|
1012
|
+
return H.useEffect(() => {
|
|
1013
|
+
s.queueOperation(() => {
|
|
1014
|
+
if (typeof r == "number" && typeof i == "number" && typeof o == "number" && typeof f == "number")
|
|
1015
|
+
m.isAbsolute = !0, m.start = { x: r, y: i }, s.setCursor(r + b.left, i + b.top);
|
|
1016
|
+
else {
|
|
1017
|
+
m.isAbsolute = !1, l.top > 0 && s.moveCursor(0, l.top);
|
|
1018
|
+
const c = s.getCursor();
|
|
1019
|
+
m.start = { ...c }, s.setCursor(c.x + b.left, c.y + b.top);
|
|
1020
|
+
}
|
|
929
1021
|
});
|
|
930
|
-
}, [r]), /* @__PURE__ */
|
|
1022
|
+
}, [s, r, i, o, f]), /* @__PURE__ */ U.jsxs(H.Fragment, { children: [
|
|
931
1023
|
t,
|
|
932
|
-
/* @__PURE__ */
|
|
933
|
-
|
|
1024
|
+
/* @__PURE__ */ U.jsx(
|
|
1025
|
+
mt,
|
|
934
1026
|
{
|
|
935
|
-
viewState:
|
|
936
|
-
style:
|
|
937
|
-
pad:
|
|
938
|
-
margin:
|
|
1027
|
+
viewState: m,
|
|
1028
|
+
style: n,
|
|
1029
|
+
pad: b,
|
|
1030
|
+
margin: l,
|
|
1031
|
+
w: o,
|
|
1032
|
+
h: f
|
|
939
1033
|
}
|
|
940
1034
|
)
|
|
941
1035
|
] });
|
|
942
|
-
}, bt = ({ viewState: i, style: t, pad: r, margin: n }) => {
|
|
943
|
-
const o = q();
|
|
944
|
-
return A.useEffect(() => {
|
|
945
|
-
o.queueOperation(() => {
|
|
946
|
-
const s = i.start;
|
|
947
|
-
if (!s) return;
|
|
948
|
-
const a = o.getCursor();
|
|
949
|
-
let u = Math.max(a.y - s.y - r.top, 0) + r.top + r.bottom;
|
|
950
|
-
t.height && (u = t.height);
|
|
951
|
-
let m = o.contentAreaWidth;
|
|
952
|
-
typeof t.width == "number" && (m = t.width), (t.borderColor || t.fillColor || t.borderWidth) && o.box(s.x, s.y, m, u, t);
|
|
953
|
-
const f = s.y + u + n.bottom;
|
|
954
|
-
o.setCursor(s.x, f);
|
|
955
|
-
});
|
|
956
|
-
}, [o]), null;
|
|
957
1036
|
};
|
|
958
1037
|
export {
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
Rt as
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
St as PdfText,
|
|
1038
|
+
pt as PdfDocument,
|
|
1039
|
+
St as PdfImage,
|
|
1040
|
+
Rt as PdfList,
|
|
1041
|
+
xt as PdfPreview,
|
|
1042
|
+
gt as PdfRenderer,
|
|
1043
|
+
Ct as PdfTable,
|
|
1044
|
+
Tt as PdfText,
|
|
967
1045
|
Pt as PdfView
|
|
968
1046
|
};
|