@paprize/core 0.0.5 → 0.0.6
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 +1 -1
- package/dist/paprize-core.d.ts +290 -131
- package/dist/paprize-core.js +317 -258
- package/dist/paprize-core.js.map +1 -1
- package/dist/paprize-core.umd.cjs +7 -7
- package/dist/paprize-core.umd.cjs.map +1 -1
- package/package.json +1 -1
package/dist/paprize-core.js
CHANGED
|
@@ -1,95 +1,82 @@
|
|
|
1
|
-
const he = "paprize", me = "pz-temp-container",
|
|
2
|
-
let
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
}, _e = () =>
|
|
6
|
-
function
|
|
1
|
+
const he = "paprize", me = "pz-temp-container", et = "pz-current-element", tt = "pz-current-text", nt = "pz-ignored-element", it = "pz-ignored-text", X = "paprize-global-style", U = "pz-page", fe = "pz-section", T = "pz-preview", C = "data-pz-";
|
|
2
|
+
let ie = !1;
|
|
3
|
+
const ot = () => {
|
|
4
|
+
ie = !0;
|
|
5
|
+
}, _e = () => ie;
|
|
6
|
+
function oe(i) {
|
|
7
7
|
return i.nodeType === Node.ELEMENT_NODE;
|
|
8
8
|
}
|
|
9
9
|
function ve(i) {
|
|
10
10
|
return i.nodeType === Node.TEXT_NODE;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function $(i) {
|
|
13
13
|
const e = i.getBoundingClientRect(), t = getComputedStyle(i), n = parseFloat(t.marginTop) || 0, o = parseFloat(t.marginBottom) || 0;
|
|
14
14
|
return e.height + n + o;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function rt(i) {
|
|
17
17
|
i.style.visibility = "hidden", i.style.position = "absolute", i.style.left = "-9999px", i.style.top = "-9999px";
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
(n) => n === "true",
|
|
36
|
-
t
|
|
37
|
-
);
|
|
19
|
+
const re = {
|
|
20
|
+
hyphen: "-",
|
|
21
|
+
keepOnSamePage: !1,
|
|
22
|
+
hyphenationDisabled: !1
|
|
23
|
+
}, se = {
|
|
24
|
+
hyphen: {
|
|
25
|
+
key: `${C}hyphen`,
|
|
26
|
+
reader: (i) => String(i)
|
|
27
|
+
},
|
|
28
|
+
keepOnSamePage: {
|
|
29
|
+
key: `${C}keep-on-same-page`,
|
|
30
|
+
reader: (i) => i === "true"
|
|
31
|
+
},
|
|
32
|
+
hyphenationDisabled: {
|
|
33
|
+
key: `${C}hyphenation-disabled`,
|
|
34
|
+
reader: (i) => i === "true"
|
|
38
35
|
}
|
|
39
|
-
}
|
|
40
|
-
const B = {
|
|
41
|
-
hyphen: C.createStr("hyphen", "-"),
|
|
42
|
-
keepOnSamePage: C.createBool("keep-on-same-page", !1),
|
|
43
|
-
hyphenationEnabled: C.createBool(
|
|
44
|
-
"hyphenation-enabled",
|
|
45
|
-
!0
|
|
46
|
-
)
|
|
47
36
|
};
|
|
48
|
-
function
|
|
37
|
+
function st(i) {
|
|
49
38
|
const e = {};
|
|
50
|
-
for (const t
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
const o = B[t];
|
|
54
|
-
e[`${F}${o.name}`] = String(n);
|
|
55
|
-
}
|
|
39
|
+
for (const [t, n] of Object.entries(i)) {
|
|
40
|
+
const o = se[t];
|
|
41
|
+
o !== void 0 && n !== void 0 && (e[o.key] = String(n));
|
|
56
42
|
}
|
|
57
43
|
return e;
|
|
58
44
|
}
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
45
|
+
const K = /* @__PURE__ */ new WeakMap();
|
|
46
|
+
function be(i, e, t, n) {
|
|
47
|
+
if (t == null)
|
|
48
|
+
return;
|
|
49
|
+
const o = e(t);
|
|
50
|
+
o !== void 0 && (n[i] = o);
|
|
51
|
+
}
|
|
65
52
|
function ae(i) {
|
|
66
53
|
if (!i)
|
|
67
54
|
return {};
|
|
68
55
|
if (!(i instanceof Element))
|
|
69
56
|
return ae(i?.parentNode);
|
|
70
57
|
const e = {};
|
|
71
|
-
for (const o
|
|
72
|
-
const r =
|
|
73
|
-
|
|
58
|
+
for (const o of Object.keys(re)) {
|
|
59
|
+
const r = o, s = se[r], d = i.getAttribute(s.key);
|
|
60
|
+
be(r, s.reader, d, e);
|
|
74
61
|
}
|
|
75
|
-
const n = { ...i.parentNode ?
|
|
76
|
-
return
|
|
62
|
+
const n = { ...i.parentNode ? K.get(i.parentNode) : void 0, ...e };
|
|
63
|
+
return K.set(i, n), n;
|
|
77
64
|
}
|
|
78
65
|
const le = {
|
|
79
66
|
id: "default",
|
|
80
67
|
plugins: [],
|
|
81
|
-
...
|
|
68
|
+
...re
|
|
82
69
|
};
|
|
83
|
-
function
|
|
70
|
+
function ye(i, e) {
|
|
84
71
|
const t = ae(i);
|
|
85
72
|
return { ...le, ...e, ...t };
|
|
86
73
|
}
|
|
87
|
-
function
|
|
74
|
+
function we(i) {
|
|
88
75
|
return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
|
|
89
76
|
}
|
|
90
|
-
var O = { exports: {} }, Se = O.exports,
|
|
77
|
+
var O = { exports: {} }, Se = O.exports, Y;
|
|
91
78
|
function Ce() {
|
|
92
|
-
return
|
|
79
|
+
return Y || (Y = 1, (function(i) {
|
|
93
80
|
(function(e, t) {
|
|
94
81
|
i.exports ? i.exports = t() : e.log = t();
|
|
95
82
|
})(Se, function() {
|
|
@@ -101,7 +88,7 @@ function Ce() {
|
|
|
101
88
|
"warn",
|
|
102
89
|
"error"
|
|
103
90
|
], r = {}, s = null;
|
|
104
|
-
function
|
|
91
|
+
function d(l, p) {
|
|
105
92
|
var a = l[p];
|
|
106
93
|
if (typeof a.bind == "function")
|
|
107
94
|
return a.bind(l);
|
|
@@ -117,7 +104,7 @@ function Ce() {
|
|
|
117
104
|
console.log && (console.log.apply ? console.log.apply(console, arguments) : Function.prototype.apply.apply(console.log, [console, arguments])), console.trace && console.trace();
|
|
118
105
|
}
|
|
119
106
|
function b(l) {
|
|
120
|
-
return l === "debug" && (l = "log"), typeof console === t ? !1 : l === "trace" && n ? P : console[l] !== void 0 ?
|
|
107
|
+
return l === "debug" && (l = "log"), typeof console === t ? !1 : l === "trace" && n ? P : console[l] !== void 0 ? d(console, l) : console.log !== void 0 ? d(console, "log") : e;
|
|
121
108
|
}
|
|
122
109
|
function f() {
|
|
123
110
|
for (var l = this.getLevel(), p = 0; p < o.length; p++) {
|
|
@@ -132,14 +119,14 @@ function Ce() {
|
|
|
132
119
|
typeof console !== t && (f.call(this), this[l].apply(this, arguments));
|
|
133
120
|
};
|
|
134
121
|
}
|
|
135
|
-
function
|
|
122
|
+
function W(l, p, a) {
|
|
136
123
|
return b(l) || _.apply(this, arguments);
|
|
137
124
|
}
|
|
138
|
-
function
|
|
139
|
-
var a = this,
|
|
125
|
+
function q(l, p) {
|
|
126
|
+
var a = this, R, M, y, m = "loglevel";
|
|
140
127
|
typeof l == "string" ? m += ":" + l : typeof l == "symbol" && (m = void 0);
|
|
141
|
-
function ge(
|
|
142
|
-
var u = (o[
|
|
128
|
+
function ge(c) {
|
|
129
|
+
var u = (o[c] || "silent").toUpperCase();
|
|
143
130
|
if (!(typeof window === t || !m)) {
|
|
144
131
|
try {
|
|
145
132
|
window.localStorage[m] = u;
|
|
@@ -152,22 +139,22 @@ function Ce() {
|
|
|
152
139
|
}
|
|
153
140
|
}
|
|
154
141
|
}
|
|
155
|
-
function
|
|
156
|
-
var
|
|
142
|
+
function G() {
|
|
143
|
+
var c;
|
|
157
144
|
if (!(typeof window === t || !m)) {
|
|
158
145
|
try {
|
|
159
|
-
|
|
146
|
+
c = window.localStorage[m];
|
|
160
147
|
} catch {
|
|
161
148
|
}
|
|
162
|
-
if (typeof
|
|
149
|
+
if (typeof c === t)
|
|
163
150
|
try {
|
|
164
|
-
var u = window.document.cookie,
|
|
165
|
-
|
|
166
|
-
u.slice(
|
|
151
|
+
var u = window.document.cookie, H = encodeURIComponent(m), J = u.indexOf(H + "=");
|
|
152
|
+
J !== -1 && (c = /^([^;]+)/.exec(
|
|
153
|
+
u.slice(J + H.length + 1)
|
|
167
154
|
)[1]);
|
|
168
155
|
} catch {
|
|
169
156
|
}
|
|
170
|
-
return a.levels[
|
|
157
|
+
return a.levels[c] === void 0 && (c = void 0), c;
|
|
171
158
|
}
|
|
172
159
|
}
|
|
173
160
|
function pe() {
|
|
@@ -182,11 +169,11 @@ function Ce() {
|
|
|
182
169
|
}
|
|
183
170
|
}
|
|
184
171
|
}
|
|
185
|
-
function E(
|
|
186
|
-
var u =
|
|
172
|
+
function E(c) {
|
|
173
|
+
var u = c;
|
|
187
174
|
if (typeof u == "string" && a.levels[u.toUpperCase()] !== void 0 && (u = a.levels[u.toUpperCase()]), typeof u == "number" && u >= 0 && u <= a.levels.SILENT)
|
|
188
175
|
return u;
|
|
189
|
-
throw new TypeError("log.setLevel() called with invalid level: " +
|
|
176
|
+
throw new TypeError("log.setLevel() called with invalid level: " + c);
|
|
190
177
|
}
|
|
191
178
|
a.name = l, a.levels = {
|
|
192
179
|
TRACE: 0,
|
|
@@ -195,33 +182,33 @@ function Ce() {
|
|
|
195
182
|
WARN: 3,
|
|
196
183
|
ERROR: 4,
|
|
197
184
|
SILENT: 5
|
|
198
|
-
}, a.methodFactory = p ||
|
|
199
|
-
return
|
|
200
|
-
}, a.setLevel = function(
|
|
201
|
-
return
|
|
202
|
-
}, a.setDefaultLevel = function(
|
|
203
|
-
|
|
185
|
+
}, a.methodFactory = p || W, a.getLevel = function() {
|
|
186
|
+
return y ?? M ?? R;
|
|
187
|
+
}, a.setLevel = function(c, u) {
|
|
188
|
+
return y = E(c), u !== !1 && ge(y), f.call(a);
|
|
189
|
+
}, a.setDefaultLevel = function(c) {
|
|
190
|
+
M = E(c), G() || a.setLevel(c, !1);
|
|
204
191
|
}, a.resetLevel = function() {
|
|
205
|
-
|
|
206
|
-
}, a.enableAll = function(
|
|
207
|
-
a.setLevel(a.levels.TRACE,
|
|
208
|
-
}, a.disableAll = function(
|
|
209
|
-
a.setLevel(a.levels.SILENT,
|
|
192
|
+
y = null, pe(), f.call(a);
|
|
193
|
+
}, a.enableAll = function(c) {
|
|
194
|
+
a.setLevel(a.levels.TRACE, c);
|
|
195
|
+
}, a.disableAll = function(c) {
|
|
196
|
+
a.setLevel(a.levels.SILENT, c);
|
|
210
197
|
}, a.rebuild = function() {
|
|
211
|
-
if (s !== a && (
|
|
212
|
-
for (var
|
|
213
|
-
r[
|
|
214
|
-
},
|
|
198
|
+
if (s !== a && (R = E(s.getLevel())), f.call(a), s === a)
|
|
199
|
+
for (var c in r)
|
|
200
|
+
r[c].rebuild();
|
|
201
|
+
}, R = E(
|
|
215
202
|
s ? s.getLevel() : "WARN"
|
|
216
203
|
);
|
|
217
|
-
var
|
|
218
|
-
|
|
204
|
+
var Z = G();
|
|
205
|
+
Z != null && (y = E(Z)), f.call(a);
|
|
219
206
|
}
|
|
220
|
-
s = new
|
|
207
|
+
s = new q(), s.getLogger = function(p) {
|
|
221
208
|
if (typeof p != "symbol" && typeof p != "string" || p === "")
|
|
222
209
|
throw new TypeError("You must supply a name when creating a logger.");
|
|
223
210
|
var a = r[p];
|
|
224
|
-
return a || (a = r[p] = new
|
|
211
|
+
return a || (a = r[p] = new q(
|
|
225
212
|
p,
|
|
226
213
|
s.methodFactory
|
|
227
214
|
)), a;
|
|
@@ -236,27 +223,27 @@ function Ce() {
|
|
|
236
223
|
})(O)), O.exports;
|
|
237
224
|
}
|
|
238
225
|
var Ne = Ce();
|
|
239
|
-
const S = /* @__PURE__ */
|
|
226
|
+
const S = /* @__PURE__ */ we(Ne), g = S.getLogger(he);
|
|
240
227
|
g.setDefaultLevel("info");
|
|
241
|
-
const
|
|
228
|
+
const j = "\x1B[46mPLUGIN\x1B[0m";
|
|
242
229
|
function N(i, e, ...t) {
|
|
243
230
|
i.sort((n, o) => n.order - o.order).forEach((n) => {
|
|
244
231
|
const o = n[e];
|
|
245
232
|
if (o) {
|
|
246
233
|
g.debug(
|
|
247
|
-
|
|
234
|
+
j,
|
|
248
235
|
`executing plugin ${n.name}:${String(e)} ()`,
|
|
249
236
|
t
|
|
250
237
|
);
|
|
251
238
|
try {
|
|
252
239
|
o(...t), g.debug(
|
|
253
|
-
|
|
240
|
+
j,
|
|
254
241
|
`plugin ${n.name}:${String(e)} executed`,
|
|
255
242
|
t
|
|
256
243
|
);
|
|
257
244
|
} catch (r) {
|
|
258
245
|
g.debug(
|
|
259
|
-
|
|
246
|
+
j,
|
|
260
247
|
`plugin ${n.name}:${String(e)} failed`,
|
|
261
248
|
r
|
|
262
249
|
);
|
|
@@ -268,7 +255,7 @@ const x = {
|
|
|
268
255
|
Element: "element",
|
|
269
256
|
Text: "text"
|
|
270
257
|
};
|
|
271
|
-
class
|
|
258
|
+
class F {
|
|
272
259
|
_node;
|
|
273
260
|
config;
|
|
274
261
|
type = x.Element;
|
|
@@ -290,7 +277,7 @@ class I {
|
|
|
290
277
|
}), this._node.appendChild(e.getNode());
|
|
291
278
|
}
|
|
292
279
|
clone(e) {
|
|
293
|
-
const t = this._node.cloneNode(e), n = new
|
|
280
|
+
const t = this._node.cloneNode(e), n = new F(
|
|
294
281
|
t,
|
|
295
282
|
this.transaction,
|
|
296
283
|
this.config,
|
|
@@ -305,7 +292,7 @@ class I {
|
|
|
305
292
|
), n;
|
|
306
293
|
}
|
|
307
294
|
getHeight() {
|
|
308
|
-
return
|
|
295
|
+
return $(this._node);
|
|
309
296
|
}
|
|
310
297
|
remove() {
|
|
311
298
|
this.transaction.addCommitCallback(() => {
|
|
@@ -345,11 +332,11 @@ class xe {
|
|
|
345
332
|
return this._node;
|
|
346
333
|
}
|
|
347
334
|
}
|
|
348
|
-
function
|
|
335
|
+
function z(i, e, t) {
|
|
349
336
|
if (ve(i))
|
|
350
337
|
return new xe(i, e, t);
|
|
351
|
-
if (
|
|
352
|
-
return new
|
|
338
|
+
if (oe(i))
|
|
339
|
+
return new F(i, e, t);
|
|
353
340
|
throw new Error("Unsupported node type");
|
|
354
341
|
}
|
|
355
342
|
const k = "\x1B[106mDOM\x1B[0m";
|
|
@@ -395,10 +382,10 @@ class Pe {
|
|
|
395
382
|
return this._treeWalker.firstChild() ? (g.debug(k, "moving to first child node"), this.setState(), { parentsTraversed: 1 }) : (this.goToNextNode(), { parentsTraversed: 0 });
|
|
396
383
|
}
|
|
397
384
|
setState() {
|
|
398
|
-
this._previousNode = this._currentNode, this._currentNode =
|
|
385
|
+
this._previousNode = this._currentNode, this._currentNode = z(
|
|
399
386
|
this._treeWalker.currentNode,
|
|
400
387
|
this._transaction,
|
|
401
|
-
|
|
388
|
+
ye(this._treeWalker.currentNode, this._config)
|
|
402
389
|
), g.debug(k, "moved to node", {
|
|
403
390
|
currentNode: this._currentNode,
|
|
404
391
|
previousNode: this._previousNode
|
|
@@ -434,8 +421,8 @@ class Ee {
|
|
|
434
421
|
this.isActive && (this.isActive = !1, this._onCommit.forEach((e) => e()));
|
|
435
422
|
};
|
|
436
423
|
}
|
|
437
|
-
const
|
|
438
|
-
class
|
|
424
|
+
const Q = "\x1B[102mPAGE\x1B[0m";
|
|
425
|
+
class I {
|
|
439
426
|
currentPage;
|
|
440
427
|
activeElement;
|
|
441
428
|
currentElement;
|
|
@@ -443,11 +430,11 @@ class R {
|
|
|
443
430
|
pageIsFull;
|
|
444
431
|
pageIndex;
|
|
445
432
|
pageHeight;
|
|
446
|
-
constructor(e, t, n, o, r, s,
|
|
447
|
-
this.currentPage = e, this.activeElement = t, this.currentElement = n, this.parentStack = o, this.pageIsFull = r, this.pageIndex = s, this.pageHeight =
|
|
433
|
+
constructor(e, t, n, o, r, s, d) {
|
|
434
|
+
this.currentPage = e, this.activeElement = t, this.currentElement = n, this.parentStack = o, this.pageIsFull = r, this.pageIndex = s, this.pageHeight = d;
|
|
448
435
|
}
|
|
449
436
|
static create(e, t, n, o) {
|
|
450
|
-
return new
|
|
437
|
+
return new I(
|
|
451
438
|
e,
|
|
452
439
|
null,
|
|
453
440
|
e,
|
|
@@ -457,7 +444,7 @@ class R {
|
|
|
457
444
|
o
|
|
458
445
|
);
|
|
459
446
|
}
|
|
460
|
-
clone = () => new
|
|
447
|
+
clone = () => new I(
|
|
461
448
|
this.currentPage,
|
|
462
449
|
this.activeElement,
|
|
463
450
|
this.currentElement,
|
|
@@ -467,22 +454,22 @@ class R {
|
|
|
467
454
|
this.pageHeight
|
|
468
455
|
);
|
|
469
456
|
}
|
|
470
|
-
class
|
|
457
|
+
class V {
|
|
471
458
|
_pageState;
|
|
472
459
|
_transaction;
|
|
473
460
|
_tempContainer;
|
|
474
461
|
_config;
|
|
475
462
|
constructor(e, t, n, o) {
|
|
476
463
|
this._tempContainer = e, this._config = o, this._transaction = n;
|
|
477
|
-
const r =
|
|
464
|
+
const r = V.createPageHtmlElement(
|
|
478
465
|
t.width
|
|
479
466
|
), s = this.createNewPage(r);
|
|
480
|
-
this._pageState =
|
|
467
|
+
this._pageState = I.create(s, [], 0, t.height), N(this._config.plugins, "onNewPage", o.id, this);
|
|
481
468
|
}
|
|
482
469
|
nextPage() {
|
|
483
470
|
const e = this.createNewPage(
|
|
484
471
|
this._pageState.currentPage.getNode().cloneNode(!1)
|
|
485
|
-
), t =
|
|
472
|
+
), t = I.create(
|
|
486
473
|
e,
|
|
487
474
|
[],
|
|
488
475
|
this._pageState.pageIndex + 1,
|
|
@@ -514,7 +501,7 @@ class G {
|
|
|
514
501
|
if (!this._pageState.activeElement || this._pageState.activeElement.type !== x.Element)
|
|
515
502
|
throw new Error("Invalid state: activeElement is not an Element");
|
|
516
503
|
g.debug(
|
|
517
|
-
|
|
504
|
+
Q,
|
|
518
505
|
"entering an element",
|
|
519
506
|
this._pageState.activeElement
|
|
520
507
|
), this._pageState.currentElement = this._pageState.activeElement, this._pageState.parentStack.push(this._pageState.activeElement);
|
|
@@ -522,7 +509,7 @@ class G {
|
|
|
522
509
|
leaveElement() {
|
|
523
510
|
this._pageState.activeElement = null;
|
|
524
511
|
const e = this._pageState.parentStack.pop();
|
|
525
|
-
g.debug(
|
|
512
|
+
g.debug(Q, "leaving a parent element", e);
|
|
526
513
|
const t = this._pageState.parentStack.at(-1);
|
|
527
514
|
this._pageState.currentElement = t ?? this._pageState.currentPage;
|
|
528
515
|
}
|
|
@@ -533,7 +520,7 @@ class G {
|
|
|
533
520
|
createNewPage(e) {
|
|
534
521
|
return this._tempContainer.appendChild(e), this._transaction.isActive && this._transaction.addRollbackCallback(() => {
|
|
535
522
|
this._tempContainer.removeChild(e);
|
|
536
|
-
}),
|
|
523
|
+
}), z(e, this._transaction, this._config);
|
|
537
524
|
}
|
|
538
525
|
startTransaction() {
|
|
539
526
|
this._transaction.start();
|
|
@@ -558,7 +545,7 @@ class G {
|
|
|
558
545
|
addTextNode(e) {
|
|
559
546
|
if (this._pageState.activeElement?.type === x.Text)
|
|
560
547
|
return this._pageState.activeElement;
|
|
561
|
-
const t = document.createTextNode(e), n =
|
|
548
|
+
const t = document.createTextNode(e), n = z(
|
|
562
549
|
t,
|
|
563
550
|
this._transaction,
|
|
564
551
|
this._config
|
|
@@ -578,15 +565,15 @@ const h = {
|
|
|
578
565
|
// The node is too large for the page, and its children must be paginated individually.
|
|
579
566
|
};
|
|
580
567
|
function Te(i, e) {
|
|
581
|
-
const t =
|
|
568
|
+
const t = ee(i, e);
|
|
582
569
|
if (t !== h.None)
|
|
583
570
|
return t;
|
|
584
571
|
const { rollback: n, commit: o } = e.startTransaction();
|
|
585
572
|
e.nextPage();
|
|
586
|
-
const r =
|
|
573
|
+
const r = ee(i, e);
|
|
587
574
|
return r !== h.None ? (o(), r) : (n(), g.debug("Element is too big to fit on a page", i), h.None);
|
|
588
575
|
}
|
|
589
|
-
function
|
|
576
|
+
function ee(i, e) {
|
|
590
577
|
if (e.hasEmptySpace(i.getHeight())) {
|
|
591
578
|
const n = e.appendChild(i, !0);
|
|
592
579
|
if (e.isOverFlow())
|
|
@@ -604,8 +591,8 @@ function ke(i, e) {
|
|
|
604
591
|
const n = i.textContent.split(/(\s+)/).filter((s) => s !== "");
|
|
605
592
|
let o, r = 0;
|
|
606
593
|
for (; o || r < n.length; ) {
|
|
607
|
-
const s = o ?? n[r],
|
|
608
|
-
|
|
594
|
+
const s = o ?? n[r], d = Ae(s, e, i.config);
|
|
595
|
+
d.completed || (t = h.None), d.pendingToken ? o = d.pendingToken : (o = void 0, r++);
|
|
609
596
|
}
|
|
610
597
|
return t;
|
|
611
598
|
}
|
|
@@ -629,7 +616,7 @@ function Le(i, e, t) {
|
|
|
629
616
|
return o(), {
|
|
630
617
|
completed: !0
|
|
631
618
|
};
|
|
632
|
-
if (n(),
|
|
619
|
+
if (n(), t.hyphenationDisabled)
|
|
633
620
|
return g.warn("Hyphenation disabled, skipping oversized token:", i), {
|
|
634
621
|
completed: !1
|
|
635
622
|
};
|
|
@@ -643,22 +630,22 @@ function Fe(i, e, t) {
|
|
|
643
630
|
const n = t.addTextNode("");
|
|
644
631
|
let o = "";
|
|
645
632
|
for (let r = 0; r < i.length; r++) {
|
|
646
|
-
const s = i[r],
|
|
647
|
-
if (n.textContent =
|
|
633
|
+
const s = i[r], d = o + s;
|
|
634
|
+
if (n.textContent = d + e, !t.hasEmptySpace())
|
|
648
635
|
return n.textContent = o ? o + e : "", t.markPageAsFull(), i.slice(r);
|
|
649
|
-
o =
|
|
636
|
+
o = d;
|
|
650
637
|
}
|
|
651
638
|
return null;
|
|
652
639
|
}
|
|
653
640
|
const A = "\x1B[103mPAGINATOR\x1B[0m";
|
|
654
|
-
class
|
|
641
|
+
class B {
|
|
655
642
|
_domState;
|
|
656
643
|
_pageManager;
|
|
657
644
|
_transaction;
|
|
658
645
|
_tempContainer;
|
|
659
646
|
_config;
|
|
660
647
|
constructor(e, t, n) {
|
|
661
|
-
this._config = { ...le, ...n }, this._tempContainer =
|
|
648
|
+
this._config = { ...le, ...n }, this._tempContainer = B.createTempContainer(this._config.id), this._transaction = new Ee(), this._domState = new Pe(e, this._transaction, this._config), this._pageManager = new V(
|
|
662
649
|
this._tempContainer,
|
|
663
650
|
t,
|
|
664
651
|
this._transaction,
|
|
@@ -667,11 +654,11 @@ class M {
|
|
|
667
654
|
}
|
|
668
655
|
static createTempContainer(e) {
|
|
669
656
|
const t = document.createElement("div");
|
|
670
|
-
return t.style.display = "flex", t.style.flexDirection = "column", t.style.gap = "20px", t.setAttribute(`${
|
|
657
|
+
return t.style.display = "flex", t.style.flexDirection = "column", t.style.gap = "20px", t.setAttribute(`${C}-section-id`, e), t.classList.add(me), document.body.appendChild(t), t;
|
|
671
658
|
}
|
|
672
659
|
static paginate(e, t, n) {
|
|
673
|
-
const o = new
|
|
674
|
-
return o.processAllNodes(), Array.from(o._tempContainer.childNodes).filter((s) =>
|
|
660
|
+
const o = new B(e, t, n);
|
|
661
|
+
return o.processAllNodes(), Array.from(o._tempContainer.childNodes).filter((s) => oe(s)).map((s) => s.innerHTML);
|
|
675
662
|
}
|
|
676
663
|
processAllNodes() {
|
|
677
664
|
this._domState.goToNextNode();
|
|
@@ -767,37 +754,73 @@ class ce {
|
|
|
767
754
|
r(...t);
|
|
768
755
|
}
|
|
769
756
|
}
|
|
770
|
-
const
|
|
757
|
+
const at = {
|
|
758
|
+
/** 841mm x 594mm */
|
|
771
759
|
A1: { height: "841mm", width: "594mm" },
|
|
760
|
+
/** 594mm x 420mm */
|
|
772
761
|
A2: { height: "594mm", width: "420mm" },
|
|
762
|
+
/** 420mm x 297mm */
|
|
773
763
|
A3: { height: "420mm", width: "297mm" },
|
|
764
|
+
/** 297mm x 210mm */
|
|
774
765
|
A4: { height: "297mm", width: "210mm" },
|
|
766
|
+
/** 210mm x 148mm */
|
|
775
767
|
A5: { height: "210mm", width: "148mm" },
|
|
768
|
+
/** 148mm x 105mm */
|
|
776
769
|
A6: { height: "148mm", width: "105mm" },
|
|
770
|
+
/** 500mm x 353mm */
|
|
777
771
|
B3: { height: "500mm", width: "353mm" },
|
|
772
|
+
/** 353mm x 250mm */
|
|
778
773
|
B4: { height: "353mm", width: "250mm" },
|
|
774
|
+
/** 250mm x 176mm */
|
|
779
775
|
B5: { height: "250mm", width: "176mm" },
|
|
776
|
+
/** 8.5in x 11in */
|
|
780
777
|
Letter: { height: "8.5in", width: "11in" },
|
|
778
|
+
/** 11in x 8.5in */
|
|
781
779
|
Legal: { height: "11in", width: "8.5in" },
|
|
780
|
+
/** 11in x 17in */
|
|
782
781
|
Tabloid: { height: "11in", width: "17in" }
|
|
783
|
-
},
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
782
|
+
}, Ie = {
|
|
783
|
+
/** Top, Right, Bottom, Left: 1in */
|
|
784
|
+
Normal: {
|
|
785
|
+
top: "1in",
|
|
786
|
+
right: "1in",
|
|
787
|
+
bottom: "1in",
|
|
788
|
+
left: "1in"
|
|
789
|
+
},
|
|
790
|
+
/** Top: 0.4in, Right, Bottom, Left: 0.6in */
|
|
791
|
+
Narrow: {
|
|
792
|
+
top: "0.4in",
|
|
793
|
+
right: "0.6in",
|
|
794
|
+
bottom: "0.6in",
|
|
795
|
+
left: "0.6in"
|
|
796
|
+
},
|
|
797
|
+
/** Top, Bottom: 0.5in, Right, Left: 2in */
|
|
798
|
+
Wide: {
|
|
799
|
+
top: "0.5in",
|
|
800
|
+
right: "2in",
|
|
801
|
+
bottom: "0.5in",
|
|
802
|
+
left: "2in"
|
|
803
|
+
},
|
|
804
|
+
/** Top, Right, Bottom, Left: 0 */
|
|
805
|
+
None: {
|
|
806
|
+
top: "0in",
|
|
807
|
+
right: "0in",
|
|
808
|
+
bottom: "0in",
|
|
809
|
+
left: "0in"
|
|
810
|
+
}
|
|
811
|
+
};
|
|
812
|
+
function Re(i) {
|
|
790
813
|
const e = i.getBoundingClientRect(), t = getComputedStyle(i), n = parseFloat(t.marginLeft) || 0, o = parseFloat(t.marginRight) || 0;
|
|
791
814
|
return {
|
|
792
|
-
height:
|
|
815
|
+
height: $(i),
|
|
793
816
|
width: e.width + n + o
|
|
794
817
|
};
|
|
795
818
|
}
|
|
796
|
-
function
|
|
797
|
-
const { height: n, width: o } =
|
|
819
|
+
function He(i, e, t) {
|
|
820
|
+
const { height: n, width: o } = Re(i), r = e ? $(e) : 0, s = t ? $(t) : 0;
|
|
798
821
|
return { height: n, width: o, sectionHeaderHeight: r, sectionFooterHeight: s };
|
|
799
822
|
}
|
|
800
|
-
function
|
|
823
|
+
function Oe(i, e, t) {
|
|
801
824
|
return {
|
|
802
825
|
name: "sectionPageHeight",
|
|
803
826
|
order: 1,
|
|
@@ -810,10 +833,10 @@ function ze(i, e, t) {
|
|
|
810
833
|
}
|
|
811
834
|
};
|
|
812
835
|
}
|
|
813
|
-
function
|
|
836
|
+
function $e(i) {
|
|
814
837
|
return i ? `${i.top} ${i.right} ${i.bottom} ${i.left}` : "0";
|
|
815
838
|
}
|
|
816
|
-
const
|
|
839
|
+
const ze = `
|
|
817
840
|
html {
|
|
818
841
|
box-sizing: border-box;
|
|
819
842
|
}
|
|
@@ -847,7 +870,7 @@ const De = `
|
|
|
847
870
|
padding: var(--paprize-preview-padding);
|
|
848
871
|
}
|
|
849
872
|
|
|
850
|
-
.${
|
|
873
|
+
.${U} {
|
|
851
874
|
box-shadow: var(--paprize-page-box-shadow);
|
|
852
875
|
margin-bottom: var(--paprize-page-margin-bottom);
|
|
853
876
|
background-color: var(--paprize-page-background-color);
|
|
@@ -863,37 +886,37 @@ const De = `
|
|
|
863
886
|
display: none !important;
|
|
864
887
|
}
|
|
865
888
|
}
|
|
866
|
-
`,
|
|
889
|
+
`, Be = {
|
|
867
890
|
display: "flex",
|
|
868
891
|
flexDirection: "column"
|
|
869
|
-
},
|
|
892
|
+
}, De = {
|
|
870
893
|
position: "absolute",
|
|
871
894
|
left: "-9999px",
|
|
872
895
|
top: "-9999px",
|
|
873
896
|
visibility: "hidden"
|
|
874
|
-
},
|
|
897
|
+
}, We = (i, e) => ({
|
|
875
898
|
display: "flex",
|
|
876
899
|
flexDirection: "column",
|
|
877
900
|
width: i.width,
|
|
878
901
|
height: i.height,
|
|
879
902
|
maxHeight: i.height,
|
|
880
903
|
position: "relative",
|
|
881
|
-
padding:
|
|
904
|
+
padding: $e(e),
|
|
882
905
|
zIndex: "1"
|
|
883
|
-
}),
|
|
906
|
+
}), Me = {
|
|
884
907
|
overflow: "hidden",
|
|
885
908
|
width: "100%",
|
|
886
909
|
height: "100%"
|
|
887
|
-
},
|
|
910
|
+
}, je = {
|
|
888
911
|
position: "absolute",
|
|
889
912
|
width: "100%",
|
|
890
913
|
height: "100%",
|
|
891
914
|
left: 0,
|
|
892
915
|
top: 0
|
|
893
|
-
},
|
|
916
|
+
}, Ue = (i) => ({
|
|
894
917
|
page: `section-${i}`
|
|
895
918
|
});
|
|
896
|
-
function
|
|
919
|
+
function Ve(i, e) {
|
|
897
920
|
return `@page section-${i} {
|
|
898
921
|
margin: none;
|
|
899
922
|
size:${e.width} ${e.height};
|
|
@@ -902,19 +925,19 @@ function Ge(i, e) {
|
|
|
902
925
|
}`;
|
|
903
926
|
}
|
|
904
927
|
const v = {
|
|
905
|
-
globalStyle:
|
|
906
|
-
component:
|
|
907
|
-
outOfScreen:
|
|
908
|
-
page:
|
|
909
|
-
overlay:
|
|
910
|
-
pageContent:
|
|
911
|
-
sectionPageMedia:
|
|
912
|
-
section:
|
|
928
|
+
globalStyle: ze,
|
|
929
|
+
component: Be,
|
|
930
|
+
outOfScreen: De,
|
|
931
|
+
page: We,
|
|
932
|
+
overlay: je,
|
|
933
|
+
pageContent: Me,
|
|
934
|
+
sectionPageMedia: Ve,
|
|
935
|
+
section: Ue
|
|
913
936
|
};
|
|
914
937
|
function L(i) {
|
|
915
938
|
return i?.cloneNode(!0) ?? null;
|
|
916
939
|
}
|
|
917
|
-
function
|
|
940
|
+
function qe(i) {
|
|
918
941
|
return {
|
|
919
942
|
sectionHeader: L(i.sectionHeader),
|
|
920
943
|
sectionFooter: L(i.sectionFooter),
|
|
@@ -923,15 +946,15 @@ function Ze(i) {
|
|
|
923
946
|
pageContent: L(i.pageContent)
|
|
924
947
|
};
|
|
925
948
|
}
|
|
926
|
-
const
|
|
927
|
-
class
|
|
949
|
+
const Ge = "data-pz-page-break";
|
|
950
|
+
class Ze {
|
|
928
951
|
name = "pageBreak";
|
|
929
952
|
order = 1;
|
|
930
953
|
onVisitElement = (e, t, n, o) => {
|
|
931
|
-
t.currentNode.getNode().getAttribute(
|
|
954
|
+
t.currentNode.getNode().getAttribute(Ge) === "true" && (n.markPageAsFull(), o.result = h.FullNodePlaced);
|
|
932
955
|
};
|
|
933
956
|
}
|
|
934
|
-
class
|
|
957
|
+
class Je {
|
|
935
958
|
_options = {};
|
|
936
959
|
name = "table";
|
|
937
960
|
order = 1;
|
|
@@ -946,15 +969,15 @@ class Ye {
|
|
|
946
969
|
);
|
|
947
970
|
if (!o || !o.clonedFrom)
|
|
948
971
|
return;
|
|
949
|
-
const r = o.clonedFrom, s = r.getNode(),
|
|
950
|
-
if (!(
|
|
972
|
+
const r = o.clonedFrom, s = r.getNode(), d = s.tHead;
|
|
973
|
+
if (!(d !== null))
|
|
951
974
|
return;
|
|
952
975
|
const b = s.tBodies;
|
|
953
976
|
if (!this._isTableBodyEmpty(b))
|
|
954
977
|
return;
|
|
955
978
|
if (r.remove(), o.getNode().tHead === null) {
|
|
956
|
-
const _ =
|
|
957
|
-
|
|
979
|
+
const _ = z(
|
|
980
|
+
d.cloneNode(!0),
|
|
958
981
|
o.transaction,
|
|
959
982
|
o.config
|
|
960
983
|
);
|
|
@@ -970,21 +993,21 @@ class Ye {
|
|
|
970
993
|
return;
|
|
971
994
|
const o = n.getOriginalNode(), r = o.tHead;
|
|
972
995
|
if (r && this._options.cloneHeader === !0) {
|
|
973
|
-
const
|
|
996
|
+
const d = new F(
|
|
974
997
|
r.cloneNode(!0),
|
|
975
998
|
n.transaction,
|
|
976
999
|
n.config
|
|
977
1000
|
);
|
|
978
|
-
n.appendChild(
|
|
1001
|
+
n.appendChild(d);
|
|
979
1002
|
}
|
|
980
1003
|
const s = o.tFoot;
|
|
981
1004
|
if (s && this._options.cloneFooter === !0) {
|
|
982
|
-
const
|
|
1005
|
+
const d = new F(
|
|
983
1006
|
s.cloneNode(!0),
|
|
984
1007
|
n.transaction,
|
|
985
1008
|
n.config
|
|
986
1009
|
);
|
|
987
|
-
n.appendChild(
|
|
1010
|
+
n.appendChild(d);
|
|
988
1011
|
}
|
|
989
1012
|
};
|
|
990
1013
|
_isTable(e) {
|
|
@@ -998,22 +1021,22 @@ class Ye {
|
|
|
998
1021
|
return n.cells.length !== 1 ? !1 : n.cells[0].textContent.trim() === "";
|
|
999
1022
|
}
|
|
1000
1023
|
}
|
|
1001
|
-
const
|
|
1002
|
-
new
|
|
1003
|
-
new
|
|
1004
|
-
],
|
|
1024
|
+
const Xe = [
|
|
1025
|
+
new Ze(),
|
|
1026
|
+
new Je()
|
|
1027
|
+
], lt = {
|
|
1005
1028
|
name: "debug",
|
|
1006
1029
|
order: Number.MAX_SAFE_INTEGER,
|
|
1007
1030
|
onNewPage: (i, e) => {
|
|
1008
1031
|
const t = e.getPageState().currentPage.getNode();
|
|
1009
|
-
t.classList.contains(
|
|
1010
|
-
`${
|
|
1032
|
+
t.classList.contains(U) || t.classList.add(U), t.setAttribute(`${C}-element`, "page"), t.setAttribute(
|
|
1033
|
+
`${C}-height`,
|
|
1011
1034
|
e.getPageState().pageHeight.toString()
|
|
1012
1035
|
);
|
|
1013
1036
|
}
|
|
1014
|
-
},
|
|
1015
|
-
class
|
|
1016
|
-
name =
|
|
1037
|
+
}, Ke = "sectionToc";
|
|
1038
|
+
class ct {
|
|
1039
|
+
name = Ke;
|
|
1017
1040
|
order = 1;
|
|
1018
1041
|
_state = /* @__PURE__ */ new Map();
|
|
1019
1042
|
getContentList = () => Array.from(this._state.values()).flat();
|
|
@@ -1035,8 +1058,8 @@ class dt {
|
|
|
1035
1058
|
return /^H[1-6]$/.test(t) ? parseInt(t.charAt(1), 10) : null;
|
|
1036
1059
|
}
|
|
1037
1060
|
}
|
|
1038
|
-
const
|
|
1039
|
-
class
|
|
1061
|
+
const Ye = "__PAPRIZE_IS_INITIALIZED", te = "__PAPRIZE_IS_READY", dt = "__PAPRIZE_READ_JSON_DATA_FILE";
|
|
1062
|
+
class D {
|
|
1040
1063
|
_promises;
|
|
1041
1064
|
monitor;
|
|
1042
1065
|
get promise() {
|
|
@@ -1049,7 +1072,7 @@ class W {
|
|
|
1049
1072
|
this._promises = [], this.monitor = new ce();
|
|
1050
1073
|
}
|
|
1051
1074
|
async add(e = []) {
|
|
1052
|
-
if (this._promises.push(...e.map(
|
|
1075
|
+
if (this._promises.push(...e.map(D.toTracked)), await new Promise((t) => setTimeout(t, 0)), this.getPending().length === 0) {
|
|
1053
1076
|
this.monitor.dispatch("onChange", 0);
|
|
1054
1077
|
return;
|
|
1055
1078
|
}
|
|
@@ -1076,7 +1099,13 @@ class W {
|
|
|
1076
1099
|
);
|
|
1077
1100
|
}
|
|
1078
1101
|
}
|
|
1079
|
-
|
|
1102
|
+
function gt(i, e) {
|
|
1103
|
+
return `${i}-${e + 1}`;
|
|
1104
|
+
}
|
|
1105
|
+
function Qe(i, e) {
|
|
1106
|
+
return e === "landscape" ? { height: i.width, width: i.height } : i;
|
|
1107
|
+
}
|
|
1108
|
+
const w = "\x1B[43mREPORT\x1B[0m";
|
|
1080
1109
|
class pt {
|
|
1081
1110
|
_sections;
|
|
1082
1111
|
_monitor;
|
|
@@ -1084,19 +1113,34 @@ class pt {
|
|
|
1084
1113
|
_pendingPaginateResolvers;
|
|
1085
1114
|
_currentAbortController;
|
|
1086
1115
|
constructor() {
|
|
1087
|
-
this._sections = /* @__PURE__ */ new Map(), this._monitor = new ce(), this._paginationInProgress = !1, this._pendingPaginateResolvers = [], this._currentAbortController = null, window[
|
|
1116
|
+
this._sections = /* @__PURE__ */ new Map(), this._monitor = new ce(), this._paginationInProgress = !1, this._pendingPaginateResolvers = [], this._currentAbortController = null, window[Ye] = !0, this._injectStyle(v.globalStyle);
|
|
1088
1117
|
}
|
|
1118
|
+
/**
|
|
1119
|
+
* Monitor instance used to subscribe to pagination events.
|
|
1120
|
+
* See {@link ReportBuilderEvents} for available event types.
|
|
1121
|
+
*/
|
|
1089
1122
|
get monitor() {
|
|
1090
1123
|
return this._monitor;
|
|
1091
1124
|
}
|
|
1125
|
+
/**
|
|
1126
|
+
* Removes a section from the registered sections, if it has already been registered in the report.
|
|
1127
|
+
*/
|
|
1092
1128
|
removeSection(e) {
|
|
1093
1129
|
this._sections.delete(e);
|
|
1094
1130
|
}
|
|
1131
|
+
/**
|
|
1132
|
+
* Registers a section by its ID, specifying the page size, margins, and other options.
|
|
1133
|
+
*
|
|
1134
|
+
* @param options - Configuration options for the section.
|
|
1135
|
+
* @param components - The DOM components associated with the section.
|
|
1136
|
+
* @param onPaginationCompleted - Callback invoked when pagination for the section is completed.
|
|
1137
|
+
* @returns `true` if the section was added to the report’s section list, or `false` if it already exists.
|
|
1138
|
+
*/
|
|
1095
1139
|
tryAddSection(e, t, n) {
|
|
1096
1140
|
if (this._sections.has(e.id))
|
|
1097
1141
|
return !1;
|
|
1098
1142
|
const o = {
|
|
1099
|
-
|
|
1143
|
+
sectionIndex: this._sections.size,
|
|
1100
1144
|
sectionId: e.id,
|
|
1101
1145
|
isPaginated: !1,
|
|
1102
1146
|
isSuspended: !!e.suspense?.length,
|
|
@@ -1104,19 +1148,40 @@ class pt {
|
|
|
1104
1148
|
};
|
|
1105
1149
|
return this._sections.set(e.id, {
|
|
1106
1150
|
context: o,
|
|
1107
|
-
options:
|
|
1151
|
+
options: {
|
|
1152
|
+
...e,
|
|
1153
|
+
size: Qe(
|
|
1154
|
+
e.size,
|
|
1155
|
+
e.orientation ?? "portrait"
|
|
1156
|
+
)
|
|
1157
|
+
},
|
|
1108
1158
|
components: t,
|
|
1109
1159
|
onPaginationCompleted: n
|
|
1110
1160
|
}), this._injectStyle(
|
|
1111
|
-
v.sectionPageMedia(e.id, e.
|
|
1161
|
+
v.sectionPageMedia(e.id, e.size)
|
|
1112
1162
|
), this._monitor.dispatch("sectionCreated", o), !0;
|
|
1113
1163
|
}
|
|
1114
|
-
|
|
1115
|
-
|
|
1164
|
+
/**
|
|
1165
|
+
* Schedules a pagination operation.
|
|
1166
|
+
*
|
|
1167
|
+
* It is not possible to schedule multiple pagination operations in parallel,
|
|
1168
|
+
* as the process involves DOM manipulation, and concurrent modifications
|
|
1169
|
+
* could cause conflicts and unexpected results.
|
|
1170
|
+
* Each newly scheduled operation is queued and executed sequentially.
|
|
1171
|
+
* When a new pagination is scheduled, any ongoing or pending operations
|
|
1172
|
+
* will be aborted, and the new pagination will start immediately afterward.
|
|
1173
|
+
*
|
|
1174
|
+
* @returns A promise that resolves when the first pagination cycle is completed.
|
|
1175
|
+
* It does not wait for suspended sections to resolve and be paginated.
|
|
1176
|
+
* To wait for all sections to complete pagination, use the
|
|
1177
|
+
* `suspension` property of the returned result object.
|
|
1178
|
+
*/
|
|
1179
|
+
async schedulePagination() {
|
|
1180
|
+
return this._sections.size === 0 ? (window[te] = !0, {
|
|
1116
1181
|
sections: [],
|
|
1117
1182
|
suspension: Promise.resolve()
|
|
1118
1183
|
}) : (this._paginationInProgress && this._currentAbortController && (g.debug(
|
|
1119
|
-
|
|
1184
|
+
w,
|
|
1120
1185
|
"Cancelling previous pagination operation."
|
|
1121
1186
|
), this._currentAbortController.abort(
|
|
1122
1187
|
"Cancelled by new paginate call"
|
|
@@ -1128,29 +1193,29 @@ class pt {
|
|
|
1128
1193
|
this._paginationInProgress = !0, this._currentAbortController = new AbortController();
|
|
1129
1194
|
const e = this._currentAbortController.signal;
|
|
1130
1195
|
try {
|
|
1131
|
-
if (g.debug(
|
|
1196
|
+
if (g.debug(w, "Schedule paginate."), await document.fonts.ready, e.aborted)
|
|
1132
1197
|
return new Promise((o, r) => {
|
|
1133
1198
|
this._pendingPaginateResolvers.push({ resolve: o, reject: r });
|
|
1134
1199
|
});
|
|
1135
1200
|
const t = [];
|
|
1136
1201
|
for (const o of this._sections.values()) {
|
|
1137
1202
|
o.context.isPaginated = !1;
|
|
1138
|
-
const r = new
|
|
1203
|
+
const r = new D();
|
|
1139
1204
|
await r.add(o.options.suspense), r.monitor.addEventListener("onChange", (s) => {
|
|
1140
1205
|
g.debug(
|
|
1141
|
-
|
|
1206
|
+
w,
|
|
1142
1207
|
`${s} pending promises in section '${o.options.id}'.`
|
|
1143
1208
|
);
|
|
1144
1209
|
}), r.promise.then(async () => {
|
|
1145
1210
|
e.aborted || (g.debug(
|
|
1146
|
-
|
|
1211
|
+
w,
|
|
1147
1212
|
`Start paginating section '${o.options.id}'.`
|
|
1148
1213
|
), o.context.isSuspended = !1, this._paginateSection(o));
|
|
1149
1214
|
}), t.push(r);
|
|
1150
1215
|
}
|
|
1151
|
-
const n = new
|
|
1216
|
+
const n = new D();
|
|
1152
1217
|
return n.monitor.addEventListener("onChange", () => {
|
|
1153
|
-
g.debug(
|
|
1218
|
+
g.debug(w, "Report pagination completed."), this._monitor.dispatch("paginationCycleCompleted", {
|
|
1154
1219
|
sections: [...this._sections.values()].map(
|
|
1155
1220
|
(o) => o.context
|
|
1156
1221
|
)
|
|
@@ -1160,7 +1225,7 @@ class pt {
|
|
|
1160
1225
|
}) : (await n.add(t.map((o) => o.promise)), {
|
|
1161
1226
|
sections: [...this._sections.values()].map((o) => o.context),
|
|
1162
1227
|
suspension: n.promise.then(() => {
|
|
1163
|
-
window[
|
|
1228
|
+
window[te] = !0;
|
|
1164
1229
|
})
|
|
1165
1230
|
});
|
|
1166
1231
|
} finally {
|
|
@@ -1171,7 +1236,7 @@ class pt {
|
|
|
1171
1236
|
if (this._pendingPaginateResolvers.length === 0)
|
|
1172
1237
|
return;
|
|
1173
1238
|
g.debug(
|
|
1174
|
-
|
|
1239
|
+
w,
|
|
1175
1240
|
`Processing ${this._pendingPaginateResolvers.length} pending paginate calls.`
|
|
1176
1241
|
);
|
|
1177
1242
|
const e = [...this._pendingPaginateResolvers];
|
|
@@ -1182,20 +1247,20 @@ class pt {
|
|
|
1182
1247
|
}
|
|
1183
1248
|
_injectStyle(e) {
|
|
1184
1249
|
let t = document.getElementById(
|
|
1185
|
-
|
|
1250
|
+
X
|
|
1186
1251
|
);
|
|
1187
|
-
t || (t = document.createElement("style"), t.id =
|
|
1252
|
+
t || (t = document.createElement("style"), t.id = X, t.textContent = "", document.head.appendChild(t)), t.textContent = (t.textContent + e).replace(/\s+/g, " ").replace(/\s*([:;{}])\s*/g, "$1").trim();
|
|
1188
1253
|
}
|
|
1189
1254
|
async _paginateSection(e) {
|
|
1190
1255
|
const t = document.createElement("div");
|
|
1191
1256
|
Object.assign(
|
|
1192
1257
|
t.style,
|
|
1193
1258
|
v.page(
|
|
1194
|
-
e.options.
|
|
1195
|
-
e.options.margin ??
|
|
1259
|
+
e.options.size,
|
|
1260
|
+
e.options.margin ?? Ie.None
|
|
1196
1261
|
)
|
|
1197
1262
|
), _e() || Object.assign(t.style, v.outOfScreen);
|
|
1198
|
-
const n =
|
|
1263
|
+
const n = qe(e.components);
|
|
1199
1264
|
n.sectionHeader && (Object.assign(
|
|
1200
1265
|
n.sectionHeader.style,
|
|
1201
1266
|
v.component
|
|
@@ -1203,28 +1268,28 @@ class pt {
|
|
|
1203
1268
|
n.sectionFooter.style,
|
|
1204
1269
|
v.component
|
|
1205
1270
|
), t.appendChild(n.sectionFooter)), document.body.appendChild(t);
|
|
1206
|
-
const { height: o, width: r, sectionHeaderHeight: s, sectionFooterHeight:
|
|
1271
|
+
const { height: o, width: r, sectionHeaderHeight: s, sectionFooterHeight: d } = He(
|
|
1207
1272
|
n.pageContent,
|
|
1208
1273
|
n.sectionHeader,
|
|
1209
1274
|
n.sectionFooter
|
|
1210
|
-
), P =
|
|
1275
|
+
), P = B.paginate(
|
|
1211
1276
|
n.pageContent,
|
|
1212
1277
|
{ height: o, width: r },
|
|
1213
1278
|
{
|
|
1214
1279
|
id: e.options.id,
|
|
1215
1280
|
plugins: [
|
|
1216
|
-
...e.options.plugins ??
|
|
1217
|
-
|
|
1281
|
+
...e.options.plugins ?? Xe,
|
|
1282
|
+
Oe(
|
|
1218
1283
|
o,
|
|
1219
1284
|
s,
|
|
1220
|
-
|
|
1285
|
+
d
|
|
1221
1286
|
)
|
|
1222
1287
|
]
|
|
1223
1288
|
}
|
|
1224
1289
|
);
|
|
1225
1290
|
t.remove();
|
|
1226
|
-
const b = P.map((_,
|
|
1227
|
-
|
|
1291
|
+
const b = P.map((_, W) => ({
|
|
1292
|
+
pageIndex: W,
|
|
1228
1293
|
totalPages: P.length,
|
|
1229
1294
|
sectionId: e.options.id,
|
|
1230
1295
|
pageContentHtml: _
|
|
@@ -1244,7 +1309,7 @@ class pt {
|
|
|
1244
1309
|
}), this._monitor.dispatch("sectionCompleted", f);
|
|
1245
1310
|
}
|
|
1246
1311
|
}
|
|
1247
|
-
const
|
|
1312
|
+
const ne = [
|
|
1248
1313
|
"ad",
|
|
1249
1314
|
"adipisicing",
|
|
1250
1315
|
"aliqua",
|
|
@@ -1314,59 +1379,53 @@ function ut(i, e) {
|
|
|
1314
1379
|
const t = [], n = Math.floor(e * 982451653);
|
|
1315
1380
|
for (let o = 0; o < i; o++) {
|
|
1316
1381
|
const r = (n + o * 2654435761) % Math.pow(2, 32), s = Math.floor(
|
|
1317
|
-
r / Math.pow(2, 32) *
|
|
1382
|
+
r / Math.pow(2, 32) * ne.length
|
|
1318
1383
|
);
|
|
1319
|
-
t.push(
|
|
1384
|
+
t.push(ne[s]);
|
|
1320
1385
|
}
|
|
1321
1386
|
return t.length > 0 && (t[0] = t[0].charAt(0).toUpperCase() + t[0].slice(1)), t.join(" ") + ".";
|
|
1322
1387
|
}
|
|
1323
|
-
function ht(i, e) {
|
|
1324
|
-
return `${i}-${e + 1}`;
|
|
1325
|
-
}
|
|
1326
|
-
function mt(i, e) {
|
|
1327
|
-
return e === "landscape" ? { height: i.width, width: i.height } : i;
|
|
1328
|
-
}
|
|
1329
1388
|
export {
|
|
1330
1389
|
ce as EventDispatcher,
|
|
1331
|
-
|
|
1332
|
-
|
|
1390
|
+
Ze as PageBreakPlugin,
|
|
1391
|
+
B as Paginator,
|
|
1333
1392
|
pt as ReportBuilder,
|
|
1334
|
-
|
|
1393
|
+
ct as SectionTocPlugin,
|
|
1335
1394
|
h as SplitResult,
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
at as configToAttributeMap,
|
|
1395
|
+
Je as TablePlugin,
|
|
1396
|
+
Qe as adjustPageSize,
|
|
1397
|
+
C as attributePrefix,
|
|
1398
|
+
gt as buildPageId,
|
|
1399
|
+
qe as cloneComponents,
|
|
1342
1400
|
ut as createLoremIpsumParagraph,
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1401
|
+
et as currentElementClassName,
|
|
1402
|
+
tt as currentTextClassName,
|
|
1403
|
+
lt as debugPlugin,
|
|
1404
|
+
Xe as defaultPlugins,
|
|
1405
|
+
ot as enableDebugMode,
|
|
1406
|
+
$ as getVisibleHeight,
|
|
1407
|
+
ze as globalStyle,
|
|
1408
|
+
X as globalStyleId,
|
|
1409
|
+
nt as ignoredElementClassName,
|
|
1410
|
+
it as ignoredTextClassName,
|
|
1353
1411
|
_e as isDebugMode,
|
|
1354
|
-
|
|
1412
|
+
oe as isElement,
|
|
1355
1413
|
ve as isTextNode,
|
|
1414
|
+
st as layoutOptionsToAttributes,
|
|
1356
1415
|
g as logger,
|
|
1357
1416
|
he as loggerName,
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1417
|
+
rt as moveOffscreen,
|
|
1418
|
+
Ge as pageBreakAttributeName,
|
|
1419
|
+
U as pageClassName,
|
|
1420
|
+
Ie as pageMargin,
|
|
1421
|
+
at as pageSize,
|
|
1422
|
+
Ye as paprize_isInitialized,
|
|
1423
|
+
te as paprize_isReady,
|
|
1424
|
+
dt as paprize_readJsonDataFile,
|
|
1366
1425
|
T as previewClassName,
|
|
1367
1426
|
v as reportStyles,
|
|
1368
1427
|
fe as sectionClassName,
|
|
1369
|
-
|
|
1428
|
+
Ke as sectionTocName,
|
|
1370
1429
|
me as tempContainerClassName
|
|
1371
1430
|
};
|
|
1372
1431
|
//# sourceMappingURL=paprize-core.js.map
|