report-studio 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{designer-Dj330bWd.js → designer-_sWqzOj8.js} +1361 -999
- package/dist/designer.js +1 -1
- package/dist/index.js +1 -1
- package/dist/react-designer.js +1 -1
- package/dist/react.js +1 -1
- package/dist/{viewer-BewnkhfP.js → viewer-4I7C1Rnd.js} +1053 -998
- package/package.json +1 -1
- package/src/designer/choice.js +368 -0
- package/src/designer/designer.js +30 -1
- package/src/designer/dialog.js +49 -25
- package/src/designer/fields.js +219 -27
- package/src/designer/icons.js +13 -0
- package/src/designer/panel.js +419 -56
- package/src/designer/select.js +21 -1
- package/src/designer/styles.css +1196 -545
- package/src/engine/validate.js +39 -0
- package/src/preview/chrome.css +302 -84
- package/src/preview/chrome.js +70 -58
- package/src/preview/viewer.js +137 -85
- package/src/shared/dropdown.css +78 -45
- package/src/shared/dropdown.js +105 -5
- package/src/shared/modal.css +78 -13
- package/types/index.d.ts +8 -1
- package/types/layout.d.ts +8 -0
|
@@ -212,7 +212,7 @@ var v = Object.freeze({
|
|
|
212
212
|
"number",
|
|
213
213
|
"currency",
|
|
214
214
|
"percent"
|
|
215
|
-
],
|
|
215
|
+
], k = ["date", "datetime"], ee = [
|
|
216
216
|
"January",
|
|
217
217
|
"February",
|
|
218
218
|
"March",
|
|
@@ -225,8 +225,8 @@ var v = Object.freeze({
|
|
|
225
225
|
"October",
|
|
226
226
|
"November",
|
|
227
227
|
"December"
|
|
228
|
-
],
|
|
229
|
-
function
|
|
228
|
+
], te = /yyyy|yy|MMMM|MMM|MM|M|dd|d|HH|H|hh|h|mm|ss|a/g, ne = /^-?\d+(\.\d+)?$/, re = /^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?)?(Z|[+-]\d{2}:?\d{2})?$/;
|
|
229
|
+
function A(e, t) {
|
|
230
230
|
if (typeof e != "object" || !e || !b.includes(e.type) || e.type === "text") return null;
|
|
231
231
|
let n = t && typeof t == "object" ? t : {}, r = {
|
|
232
232
|
...v,
|
|
@@ -235,30 +235,30 @@ function k(e, t) {
|
|
|
235
235
|
};
|
|
236
236
|
return r.decimals = ce(r.decimals), x.includes(r.grouping) || (r.grouping = v.grouping), S.includes(r.negative) || (r.negative = v.negative), C.includes(r.zero) || (r.zero = v.zero), w.includes(r.symbolPosition) || (r.symbolPosition = v.symbolPosition), typeof r.symbol != "string" && (r.symbol = ""), (typeof r.pattern != "string" || r.pattern === "") && (r.pattern = r.type === "datetime" ? "yyyy-MM-dd HH:mm" : v.pattern), r;
|
|
237
237
|
}
|
|
238
|
-
function
|
|
238
|
+
function j(e) {
|
|
239
239
|
return e?.type === "percent" ? e : {
|
|
240
240
|
type: "percent",
|
|
241
241
|
decimals: 2
|
|
242
242
|
};
|
|
243
243
|
}
|
|
244
|
-
function
|
|
244
|
+
function M(e, t, n) {
|
|
245
245
|
if (e == null) return "";
|
|
246
|
-
let r =
|
|
246
|
+
let r = A(t, n);
|
|
247
247
|
if (!r) return String(e);
|
|
248
248
|
if (O.includes(r.type)) {
|
|
249
|
-
let t =
|
|
250
|
-
return t === null ? String(e) :
|
|
249
|
+
let t = N(e);
|
|
250
|
+
return t === null ? String(e) : ae(t, r);
|
|
251
251
|
}
|
|
252
|
-
let i =
|
|
252
|
+
let i = P(e);
|
|
253
253
|
return i === null ? String(e) : ue(i, r.pattern);
|
|
254
254
|
}
|
|
255
|
-
function
|
|
255
|
+
function N(e) {
|
|
256
256
|
if (typeof e == "number") return Number.isFinite(e) ? e : null;
|
|
257
257
|
if (typeof e != "string") return null;
|
|
258
258
|
let t = e.trim();
|
|
259
|
-
return
|
|
259
|
+
return ne.test(t) ? Number(t) : null;
|
|
260
260
|
}
|
|
261
|
-
function
|
|
261
|
+
function P(e) {
|
|
262
262
|
if (e instanceof Date) return Number.isNaN(e.getTime()) ? null : {
|
|
263
263
|
year: e.getFullYear(),
|
|
264
264
|
month: e.getMonth() + 1,
|
|
@@ -268,7 +268,7 @@ function N(e) {
|
|
|
268
268
|
second: e.getSeconds()
|
|
269
269
|
};
|
|
270
270
|
if (typeof e != "string") return null;
|
|
271
|
-
let t = e.trim().match(
|
|
271
|
+
let t = e.trim().match(re);
|
|
272
272
|
if (!t) return null;
|
|
273
273
|
let [, n, r, i, a = "0", o = "0", s = "0"] = t, c = {
|
|
274
274
|
year: Number(n),
|
|
@@ -280,16 +280,16 @@ function N(e) {
|
|
|
280
280
|
}, l = new Date(Date.UTC(c.year, c.month - 1, c.day));
|
|
281
281
|
return l.getUTCMonth() !== c.month - 1 || l.getUTCDate() !== c.day || c.hour > 23 || c.minute > 59 || c.second > 59 ? null : c;
|
|
282
282
|
}
|
|
283
|
-
function
|
|
284
|
-
let n =
|
|
285
|
-
return n ?
|
|
283
|
+
function ie(e, t) {
|
|
284
|
+
let n = A(e, t);
|
|
285
|
+
return n ? k.includes(n.type) ? `${n.type === "date" ? "Date" : "Date & time"} · ${n.pattern}` : `${{
|
|
286
286
|
number: "Number",
|
|
287
287
|
currency: "Currency",
|
|
288
288
|
percent: "Percent"
|
|
289
|
-
}[n.type]} · ${
|
|
289
|
+
}[n.type]} · ${M(n.type === "percent" ? 1234.5678 : 1234567.891, n)}` : "As it comes";
|
|
290
290
|
}
|
|
291
|
-
function
|
|
292
|
-
let n = t.type === "percent" ? e * 100 : e, r =
|
|
291
|
+
function ae(e, t) {
|
|
292
|
+
let n = t.type === "percent" ? e * 100 : e, r = oe(Math.abs(n), t.decimals), i = /^[0.]*$/.test(r);
|
|
293
293
|
if (i && t.zero === "blank") return "";
|
|
294
294
|
if (i && t.zero === "dash") return "-";
|
|
295
295
|
let [a, o] = r.split("."), s = se(a, t.grouping) + (o ? `.${o}` : "");
|
|
@@ -300,13 +300,13 @@ function oe(e, t) {
|
|
|
300
300
|
default: return `-${s}`;
|
|
301
301
|
}
|
|
302
302
|
}
|
|
303
|
-
var
|
|
304
|
-
function
|
|
305
|
-
return
|
|
303
|
+
var F = /* @__PURE__ */ new Map();
|
|
304
|
+
function oe(e, t) {
|
|
305
|
+
return F.has(t) || F.set(t, new Intl.NumberFormat("en-US", {
|
|
306
306
|
minimumFractionDigits: t,
|
|
307
307
|
maximumFractionDigits: t,
|
|
308
308
|
useGrouping: !1
|
|
309
|
-
})),
|
|
309
|
+
})), F.get(t).format(e);
|
|
310
310
|
}
|
|
311
311
|
function se(e, t) {
|
|
312
312
|
if (t === "none" || e.length <= 3) return e;
|
|
@@ -326,12 +326,12 @@ function le(e) {
|
|
|
326
326
|
}
|
|
327
327
|
function ue(e, t) {
|
|
328
328
|
let n = (e) => String(e).padStart(2, "0"), r = e.hour % 12 == 0 ? 12 : e.hour % 12;
|
|
329
|
-
return t.replace(
|
|
329
|
+
return t.replace(te, (t) => {
|
|
330
330
|
switch (t) {
|
|
331
331
|
case "yyyy": return String(e.year).padStart(4, "0");
|
|
332
332
|
case "yy": return n(e.year % 100);
|
|
333
|
-
case "MMMM": return
|
|
334
|
-
case "MMM": return
|
|
333
|
+
case "MMMM": return ee[e.month - 1];
|
|
334
|
+
case "MMM": return ee[e.month - 1].slice(0, 3);
|
|
335
335
|
case "MM": return n(e.month);
|
|
336
336
|
case "M": return String(e.month);
|
|
337
337
|
case "dd": return n(e.day);
|
|
@@ -348,12 +348,12 @@ function ue(e, t) {
|
|
|
348
348
|
});
|
|
349
349
|
}
|
|
350
350
|
function de(e, t) {
|
|
351
|
-
let n =
|
|
351
|
+
let n = A(e, t);
|
|
352
352
|
if (!n) return null;
|
|
353
|
-
if (
|
|
354
|
-
let r = n.decimals > 0 ? `.${"0".repeat(n.decimals)}` : "", i = n.type === "percent" ? "%" : "", a = n.type === "currency" && n.symbol ?
|
|
353
|
+
if (k.includes(n.type)) return fe(n.pattern);
|
|
354
|
+
let r = n.decimals > 0 ? `.${"0".repeat(n.decimals)}` : "", i = n.type === "percent" ? "%" : "", a = n.type === "currency" && n.symbol ? me(n.symbol) : "", o = (e) => {
|
|
355
355
|
let t = `${e}${r}${i}`;
|
|
356
|
-
return a ? n.symbolPosition === "after" ? `${t}${
|
|
356
|
+
return a ? n.symbolPosition === "after" ? `${t}${me(" ")}${a}` : `${a}${t}` : t;
|
|
357
357
|
};
|
|
358
358
|
if (n.grouping === "indian") return [
|
|
359
359
|
`[>=10000000]${o("##\\,##\\,##\\,##0")}`,
|
|
@@ -367,13 +367,13 @@ function de(e, t) {
|
|
|
367
367
|
trailing: `${s}-`
|
|
368
368
|
}[n.negative]};${{
|
|
369
369
|
zero: s,
|
|
370
|
-
dash:
|
|
370
|
+
dash: me("-"),
|
|
371
371
|
blank: ""
|
|
372
372
|
}[n.zero]}`;
|
|
373
373
|
}
|
|
374
374
|
function fe(e) {
|
|
375
375
|
let t = "", n = 0;
|
|
376
|
-
for (let r of e.matchAll(
|
|
376
|
+
for (let r of e.matchAll(te)) t += pe(e.slice(n, r.index)), t += {
|
|
377
377
|
yyyy: "yyyy",
|
|
378
378
|
yy: "yy",
|
|
379
379
|
MMMM: "mmmm",
|
|
@@ -395,21 +395,21 @@ function fe(e) {
|
|
|
395
395
|
function pe(e) {
|
|
396
396
|
return [...e].map((e) => e === " " ? " " : `\\${e}`).join("");
|
|
397
397
|
}
|
|
398
|
-
function
|
|
398
|
+
function me(e) {
|
|
399
399
|
return `"${String(e).replace(/"/g, "")}"`;
|
|
400
400
|
}
|
|
401
|
-
function
|
|
402
|
-
let r =
|
|
401
|
+
function he(e, t, n) {
|
|
402
|
+
let r = A(t, n);
|
|
403
403
|
if (!r) return null;
|
|
404
|
-
if (O.includes(r.type)) return
|
|
405
|
-
let i =
|
|
404
|
+
if (O.includes(r.type)) return N(e);
|
|
405
|
+
let i = P(e);
|
|
406
406
|
if (!i) return null;
|
|
407
407
|
let a = Date.UTC(i.year, i.month - 1, i.day) / 864e5 + 25569, o = (i.hour * 3600 + i.minute * 60 + i.second) / 86400;
|
|
408
408
|
return r.type === "date" ? a : a + o;
|
|
409
409
|
}
|
|
410
410
|
//#endregion
|
|
411
411
|
//#region src/engine/highlight.js
|
|
412
|
-
var
|
|
412
|
+
var ge = [
|
|
413
413
|
"=",
|
|
414
414
|
"!=",
|
|
415
415
|
"<",
|
|
@@ -421,43 +421,43 @@ var he = [
|
|
|
421
421
|
"startsWith",
|
|
422
422
|
"empty",
|
|
423
423
|
"notEmpty"
|
|
424
|
-
],
|
|
424
|
+
], _e = ["empty", "notEmpty"], ve = [
|
|
425
425
|
"color",
|
|
426
426
|
"background",
|
|
427
427
|
"fontWeight",
|
|
428
428
|
"fontStyle"
|
|
429
429
|
];
|
|
430
|
-
function
|
|
430
|
+
function ye(e, t, n = null) {
|
|
431
431
|
if (!Array.isArray(e)) return null;
|
|
432
432
|
for (let r of e) {
|
|
433
433
|
let e = r?.when;
|
|
434
|
-
if (!(!e || !
|
|
434
|
+
if (!(!e || !ge.includes(e.op)) && Se(typeof e.field == "string" && e.field !== "" ? De(n, e.field) : t, e)) return Oe(r.style);
|
|
435
435
|
}
|
|
436
436
|
return null;
|
|
437
437
|
}
|
|
438
|
-
function
|
|
439
|
-
let r =
|
|
438
|
+
function be(e, t, n) {
|
|
439
|
+
let r = ye(e?.rowHighlight, null, n), i = ye(t?.highlight, n?.[t?.field], n);
|
|
440
440
|
return !r && !i ? null : {
|
|
441
441
|
...r ?? {},
|
|
442
442
|
...i ?? {}
|
|
443
443
|
};
|
|
444
444
|
}
|
|
445
|
-
function
|
|
445
|
+
function xe(e) {
|
|
446
446
|
let t = Array.isArray(e) ? e.length : 0;
|
|
447
447
|
return t === 0 ? "None" : t === 1 ? "1 rule" : `${t} rules`;
|
|
448
448
|
}
|
|
449
|
-
function
|
|
449
|
+
function Se(e, t) {
|
|
450
450
|
let { op: n } = t;
|
|
451
|
-
if (n === "empty") return
|
|
452
|
-
if (n === "notEmpty") return !
|
|
453
|
-
if (
|
|
454
|
-
if (n === "contains") return
|
|
455
|
-
if (n === "startsWith") return
|
|
451
|
+
if (n === "empty") return Ee(e);
|
|
452
|
+
if (n === "notEmpty") return !Ee(e);
|
|
453
|
+
if (Ee(e)) return n === "!=" && !Ee(t.value);
|
|
454
|
+
if (n === "contains") return I(e).includes(I(t.value));
|
|
455
|
+
if (n === "startsWith") return I(e).startsWith(I(t.value));
|
|
456
456
|
if (n === "between") {
|
|
457
|
-
let n =
|
|
457
|
+
let n = Ce(e, t.value), r = Ce(e, t.to);
|
|
458
458
|
return n !== null && r !== null && n >= 0 && r <= 0;
|
|
459
459
|
}
|
|
460
|
-
let r =
|
|
460
|
+
let r = Ce(e, t.value);
|
|
461
461
|
if (r === null) return n === "!=";
|
|
462
462
|
switch (n) {
|
|
463
463
|
case "=": return r === 0;
|
|
@@ -469,31 +469,31 @@ function be(e, t) {
|
|
|
469
469
|
default: return !1;
|
|
470
470
|
}
|
|
471
471
|
}
|
|
472
|
-
function
|
|
472
|
+
function Ce(e, t) {
|
|
473
473
|
if (t == null || t === "") return null;
|
|
474
|
-
let n =
|
|
474
|
+
let n = N(e), r = N(t);
|
|
475
475
|
if (n !== null && r !== null) return Math.sign(n - r);
|
|
476
|
-
let i =
|
|
477
|
-
return i && a ? Math.sign(
|
|
476
|
+
let i = P(e), a = P(t);
|
|
477
|
+
return i && a ? Math.sign(Te(i) - Te(a)) : we(e) === we(t) ? Math.sign(I(e).localeCompare(I(t))) : null;
|
|
478
478
|
}
|
|
479
|
-
function
|
|
480
|
-
return
|
|
479
|
+
function we(e) {
|
|
480
|
+
return N(e) === null ? P(e) ? "date" : "text" : "number";
|
|
481
481
|
}
|
|
482
|
-
function
|
|
482
|
+
function Te(e) {
|
|
483
483
|
return ((((e.year * 100 + e.month) * 100 + e.day) * 100 + e.hour) * 100 + e.minute) * 100 + e.second;
|
|
484
484
|
}
|
|
485
|
-
function
|
|
485
|
+
function Ee(e) {
|
|
486
486
|
return e == null || String(e).trim() === "";
|
|
487
487
|
}
|
|
488
|
-
function
|
|
488
|
+
function I(e) {
|
|
489
489
|
return String(e ?? "").trim().toLowerCase();
|
|
490
490
|
}
|
|
491
|
-
function
|
|
491
|
+
function De(e, t) {
|
|
492
492
|
return t.split(".").reduce((e, t) => e?.[t], e ?? void 0);
|
|
493
493
|
}
|
|
494
|
-
function
|
|
494
|
+
function Oe(e) {
|
|
495
495
|
let t = {};
|
|
496
|
-
for (let n of
|
|
496
|
+
for (let n of ve) {
|
|
497
497
|
let r = e?.[n];
|
|
498
498
|
typeof r == "string" && r !== "" && (t[n] = r);
|
|
499
499
|
}
|
|
@@ -501,54 +501,54 @@ function Ee(e) {
|
|
|
501
501
|
}
|
|
502
502
|
//#endregion
|
|
503
503
|
//#region src/engine/calculate.js
|
|
504
|
-
var
|
|
504
|
+
var ke = [
|
|
505
505
|
"sum",
|
|
506
506
|
"avg",
|
|
507
507
|
"count",
|
|
508
508
|
"min",
|
|
509
509
|
"max"
|
|
510
|
-
],
|
|
510
|
+
], Ae = [
|
|
511
511
|
"round",
|
|
512
512
|
"abs",
|
|
513
513
|
"min",
|
|
514
514
|
"max",
|
|
515
515
|
"percentage"
|
|
516
516
|
];
|
|
517
|
-
function
|
|
517
|
+
function je(e) {
|
|
518
518
|
if (typeof e != "string" || e.trim() === "") return { error: "is empty" };
|
|
519
519
|
try {
|
|
520
|
-
let t =
|
|
520
|
+
let t = Ie(Fe(e)), n = t.expression();
|
|
521
521
|
return t.end(), { ast: n };
|
|
522
522
|
} catch (e) {
|
|
523
523
|
return { error: e.message };
|
|
524
524
|
}
|
|
525
525
|
}
|
|
526
|
-
function
|
|
526
|
+
function Me(e) {
|
|
527
527
|
let t = /* @__PURE__ */ new Set();
|
|
528
528
|
for (let [, n] of String(e ?? "").matchAll(/\{([^{}]+)\}/g)) t.add(n.trim());
|
|
529
529
|
return [...t];
|
|
530
530
|
}
|
|
531
|
-
function
|
|
531
|
+
function Ne(e) {
|
|
532
532
|
return typeof e?.expression == "string" && e.expression.trim() !== "";
|
|
533
533
|
}
|
|
534
|
-
function
|
|
535
|
-
let n = (Array.isArray(e?.columns) ? e.columns : []).filter(
|
|
534
|
+
function Pe(e, t) {
|
|
535
|
+
let n = (Array.isArray(e?.columns) ? e.columns : []).filter(Ne);
|
|
536
536
|
if (n.length === 0 || !Array.isArray(t)) return t;
|
|
537
537
|
let r = t.map((e) => ({ ...e }));
|
|
538
538
|
for (let t of n) {
|
|
539
|
-
let n =
|
|
539
|
+
let n = je(t.expression);
|
|
540
540
|
if (n.error) {
|
|
541
541
|
for (let e of r) e[t.field] = null;
|
|
542
542
|
continue;
|
|
543
543
|
}
|
|
544
|
-
let i =
|
|
544
|
+
let i = Le(e, r), a = r.map((e) => L(n.ast, e, i));
|
|
545
545
|
r.forEach((e, n) => {
|
|
546
546
|
e[t.field] = a[n];
|
|
547
547
|
}), r = [...r];
|
|
548
548
|
}
|
|
549
549
|
return r;
|
|
550
550
|
}
|
|
551
|
-
function
|
|
551
|
+
function Fe(e) {
|
|
552
552
|
let t = [], n = 0;
|
|
553
553
|
for (; n < e.length;) {
|
|
554
554
|
let r = e[n];
|
|
@@ -598,7 +598,7 @@ function Ne(e) {
|
|
|
598
598
|
}
|
|
599
599
|
return t;
|
|
600
600
|
}
|
|
601
|
-
function
|
|
601
|
+
function Ie(e) {
|
|
602
602
|
let t = 0, n = () => e[t], r = (r) => n()?.type === r ? e[t++] : null, i = (e, t) => {
|
|
603
603
|
let n = r(e);
|
|
604
604
|
if (!n) throw Error(`expects ${t}${a()}`);
|
|
@@ -648,7 +648,7 @@ function Pe(e) {
|
|
|
648
648
|
if (r("name")) {
|
|
649
649
|
let a = e.value;
|
|
650
650
|
if (a === "group") throw Error(`uses "group" at ${e.at + 1}, which only means anything in percentage(x, group)`);
|
|
651
|
-
if (!
|
|
651
|
+
if (!Ae.includes(a) && !ke.includes(a)) throw Error(`has no function called "${a}" - it knows ${[.../* @__PURE__ */ new Set([...Ae, ...ke])].join(", ")}`);
|
|
652
652
|
i("(", `a ( after ${a}`);
|
|
653
653
|
let s = [];
|
|
654
654
|
if (!r(")")) {
|
|
@@ -676,7 +676,7 @@ function Pe(e) {
|
|
|
676
676
|
fn: e,
|
|
677
677
|
args: t
|
|
678
678
|
};
|
|
679
|
-
if (
|
|
679
|
+
if (ke.includes(e)) {
|
|
680
680
|
if (r !== 1) throw Error(`gives ${e}() one value${i}`);
|
|
681
681
|
return {
|
|
682
682
|
kind: "aggregate",
|
|
@@ -700,7 +700,7 @@ function Pe(e) {
|
|
|
700
700
|
}
|
|
701
701
|
};
|
|
702
702
|
}
|
|
703
|
-
function
|
|
703
|
+
function Le(e, t) {
|
|
704
704
|
let n = o(e).map((e) => e?.by).filter(Boolean), r = (e) => n.map((t) => String(e?.[t])).join("\0"), i = /* @__PURE__ */ new Map();
|
|
705
705
|
if (n.length) for (let e of t) {
|
|
706
706
|
let t = r(e);
|
|
@@ -713,53 +713,53 @@ function Fe(e, t) {
|
|
|
713
713
|
cache: /* @__PURE__ */ new Map()
|
|
714
714
|
};
|
|
715
715
|
}
|
|
716
|
-
function
|
|
716
|
+
function L(e, t, n) {
|
|
717
717
|
switch (e.kind) {
|
|
718
718
|
case "number": return e.value;
|
|
719
|
-
case "field": return
|
|
719
|
+
case "field": return N(He(t, e.name));
|
|
720
720
|
case "negate": {
|
|
721
|
-
let r =
|
|
721
|
+
let r = L(e.value, t, n);
|
|
722
722
|
return r === null ? null : -r;
|
|
723
723
|
}
|
|
724
724
|
case "binary": {
|
|
725
|
-
let r =
|
|
725
|
+
let r = L(e.left, t, n), i = L(e.right, t, n);
|
|
726
726
|
if (r === null || i === null) return null;
|
|
727
727
|
switch (e.op) {
|
|
728
|
-
case "+": return
|
|
729
|
-
case "-": return
|
|
730
|
-
case "*": return
|
|
731
|
-
case "/": return i === 0 ? null :
|
|
732
|
-
case "%": return i === 0 ? null :
|
|
728
|
+
case "+": return R(r + i);
|
|
729
|
+
case "-": return R(r - i);
|
|
730
|
+
case "*": return R(r * i);
|
|
731
|
+
case "/": return i === 0 ? null : R(r / i);
|
|
732
|
+
case "%": return i === 0 ? null : R(r % i);
|
|
733
733
|
}
|
|
734
734
|
return null;
|
|
735
735
|
}
|
|
736
|
-
case "aggregate": return
|
|
737
|
-
case "call": return
|
|
736
|
+
case "aggregate": return Re(e, n.rows, n, "all");
|
|
737
|
+
case "call": return Ve(e, t, n);
|
|
738
738
|
default: return null;
|
|
739
739
|
}
|
|
740
740
|
}
|
|
741
|
-
function
|
|
741
|
+
function Re(e, t, n, r) {
|
|
742
742
|
n.cache.has(e) || n.cache.set(e, /* @__PURE__ */ new Map());
|
|
743
743
|
let i = n.cache.get(e);
|
|
744
744
|
if (i.has(r)) return i.get(r);
|
|
745
745
|
let a;
|
|
746
746
|
if (e.fn === "count") a = t.length;
|
|
747
747
|
else {
|
|
748
|
-
let r = t.map((t) =>
|
|
749
|
-
a = r.length ? e.fn === "sum" ?
|
|
748
|
+
let r = t.map((t) => L(e.value, t, n)).filter((e) => e !== null);
|
|
749
|
+
a = r.length ? e.fn === "sum" ? R(r.reduce((e, t) => e + t, 0)) : e.fn === "avg" ? R(r.reduce((e, t) => e + t, 0) / r.length) : e.fn === "min" ? Math.min(...r) : e.fn === "max" ? Math.max(...r) : null : null;
|
|
750
750
|
}
|
|
751
751
|
return i.set(r, a), a;
|
|
752
752
|
}
|
|
753
|
-
var
|
|
754
|
-
function
|
|
755
|
-
return
|
|
753
|
+
var ze = /* @__PURE__ */ new WeakMap();
|
|
754
|
+
function Be(e) {
|
|
755
|
+
return ze.has(e) || ze.set(e, {
|
|
756
756
|
kind: "aggregate",
|
|
757
757
|
fn: "sum",
|
|
758
758
|
value: e.args[0]
|
|
759
|
-
}),
|
|
759
|
+
}), ze.get(e);
|
|
760
760
|
}
|
|
761
|
-
function
|
|
762
|
-
let r = (r) =>
|
|
761
|
+
function Ve(e, t, n) {
|
|
762
|
+
let r = (r) => L(e.args[r], t, n);
|
|
763
763
|
switch (e.fn) {
|
|
764
764
|
case "abs": {
|
|
765
765
|
let e = r(0);
|
|
@@ -780,42 +780,42 @@ function ze(e, t, n) {
|
|
|
780
780
|
let i = r(0);
|
|
781
781
|
if (i === null) return null;
|
|
782
782
|
let a = e.args[1], o;
|
|
783
|
-
return o = a ? a.kind === "group" ?
|
|
783
|
+
return o = a ? a.kind === "group" ? Re(Be(e), n.groupOf(t), n, `group:${n.groupKey(t)}`) : r(1) : Re(Be(e), n.rows, n, "all"), o === null || o === 0 ? null : R(i / o);
|
|
784
784
|
}
|
|
785
785
|
default: return null;
|
|
786
786
|
}
|
|
787
787
|
}
|
|
788
|
-
function
|
|
788
|
+
function He(e, t) {
|
|
789
789
|
return t.split(".").reduce((e, t) => e?.[t], e);
|
|
790
790
|
}
|
|
791
|
-
function
|
|
791
|
+
function R(e) {
|
|
792
792
|
return Number.isFinite(e) ? Number(e.toPrecision(12)) : null;
|
|
793
793
|
}
|
|
794
794
|
//#endregion
|
|
795
795
|
//#region src/engine/text-metrics.js
|
|
796
|
-
var
|
|
797
|
-
function
|
|
798
|
-
if (
|
|
799
|
-
|
|
796
|
+
var Ue = 1.3, We = /* @__PURE__ */ new Map(), Ge = 1e4, Ke, qe = !1;
|
|
797
|
+
function Je() {
|
|
798
|
+
if (qe) return Ke;
|
|
799
|
+
qe = !0;
|
|
800
800
|
try {
|
|
801
|
-
|
|
801
|
+
Ke = typeof OffscreenCanvas < "u" ? new OffscreenCanvas(1, 1).getContext("2d") : typeof document < "u" ? document.createElement("canvas").getContext("2d") : null;
|
|
802
802
|
} catch {
|
|
803
|
-
|
|
803
|
+
Ke = null;
|
|
804
804
|
}
|
|
805
|
-
return
|
|
805
|
+
return Ke;
|
|
806
806
|
}
|
|
807
|
-
function
|
|
807
|
+
function Ye(e = {}) {
|
|
808
808
|
return `${e.fontStyle || "normal"} ${e.fontWeight || "normal"} ${e.fontSize ?? 12}px ${e.fontFamily || "Helvetica, Arial, sans-serif"}`;
|
|
809
809
|
}
|
|
810
|
-
function
|
|
810
|
+
function Xe(e, t) {
|
|
811
811
|
let n = String(e ?? "");
|
|
812
812
|
if (n === "") return 0;
|
|
813
|
-
let r =
|
|
813
|
+
let r = Ye(t), i = `${r}\u0000${n}`, a = We.get(i);
|
|
814
814
|
if (a !== void 0) return a;
|
|
815
|
-
let o =
|
|
816
|
-
return o ? (o.font = r, s = o.measureText(n).width) : s =
|
|
815
|
+
let o = Je(), s;
|
|
816
|
+
return o ? (o.font = r, s = o.measureText(n).width) : s = Ze(n, t), We.size >= Ge && We.clear(), We.set(i, s), s;
|
|
817
817
|
}
|
|
818
|
-
function
|
|
818
|
+
function Ze(e, t = {}) {
|
|
819
819
|
let n = t.fontSize ?? 12, r = String(t.fontWeight) === "bold" || Number(t.fontWeight) >= 600, i = /mono|courier|consolas/i.test(t.fontFamily || ""), a = 0;
|
|
820
820
|
for (let t of e) {
|
|
821
821
|
if (i) {
|
|
@@ -826,7 +826,7 @@ function Ye(e, t = {}) {
|
|
|
826
826
|
}
|
|
827
827
|
return a * n * (r ? 1.06 : 1);
|
|
828
828
|
}
|
|
829
|
-
function
|
|
829
|
+
function Qe(e, t, n) {
|
|
830
830
|
let r = String(e ?? "").split("\n");
|
|
831
831
|
if (!(t > 0)) return r;
|
|
832
832
|
let i = [];
|
|
@@ -839,9 +839,9 @@ function Xe(e, t, n) {
|
|
|
839
839
|
let a = "";
|
|
840
840
|
for (let e of r) {
|
|
841
841
|
let r = a + e;
|
|
842
|
-
for (a !== "" &&
|
|
842
|
+
for (a !== "" && Xe(r, n) > t ? (i.push(a.trimEnd()), a = e.trimStart()) : a = r; Xe(a, n) > t && a.trim().length > 1;) {
|
|
843
843
|
let e = a.length;
|
|
844
|
-
for (; e > 1 &&
|
|
844
|
+
for (; e > 1 && Xe(a.slice(0, e), n) > t;) e--;
|
|
845
845
|
if (e >= a.length) break;
|
|
846
846
|
i.push(a.slice(0, e)), a = a.slice(e);
|
|
847
847
|
}
|
|
@@ -850,11 +850,11 @@ function Xe(e, t, n) {
|
|
|
850
850
|
}
|
|
851
851
|
return i;
|
|
852
852
|
}
|
|
853
|
-
function
|
|
854
|
-
let r = Math.ceil((n?.fontSize ?? 12) *
|
|
855
|
-
return
|
|
853
|
+
function $e(e, t, n) {
|
|
854
|
+
let r = Math.ceil((n?.fontSize ?? 12) * Ue);
|
|
855
|
+
return Qe(e, t, n).length * r;
|
|
856
856
|
}
|
|
857
|
-
function
|
|
857
|
+
function et(e) {
|
|
858
858
|
return {
|
|
859
859
|
fontSize: e.style?.fontSize ?? 12,
|
|
860
860
|
fontFamily: e.style?.fontFamily,
|
|
@@ -862,116 +862,116 @@ function Qe(e) {
|
|
|
862
862
|
fontStyle: "normal"
|
|
863
863
|
};
|
|
864
864
|
}
|
|
865
|
-
function
|
|
865
|
+
function tt(e) {
|
|
866
866
|
let t = (e.columns ?? []).map((e) => e.width ?? 0), n = t.reduce((e, t) => e + t, 0), r = e.w ?? n, i = n > 0 && r > n ? r / n : 1;
|
|
867
867
|
return t.map((e) => e * i);
|
|
868
868
|
}
|
|
869
|
-
function
|
|
869
|
+
function nt(e) {
|
|
870
870
|
if (e.style?.borderStyle === "none") return 0;
|
|
871
871
|
let t = Number(e.style?.borderWidth);
|
|
872
872
|
return Number.isFinite(t) && t > 0 ? t : 1;
|
|
873
873
|
}
|
|
874
|
-
function
|
|
875
|
-
let t =
|
|
874
|
+
function rt(e) {
|
|
875
|
+
let t = tt(e), n = nt(e), r = t.length - 1;
|
|
876
876
|
return t.map((e, t) => e - 16 - n * (t === r ? 2 : 1));
|
|
877
877
|
}
|
|
878
|
-
function
|
|
878
|
+
function it(e, t) {
|
|
879
879
|
let n = e.rowHeight ?? 0, r = t ?? [];
|
|
880
880
|
if (e.wrap === !1) return r.map(() => n);
|
|
881
|
-
let i =
|
|
881
|
+
let i = et(e), a = e.columns ?? [], o = rt(e);
|
|
882
882
|
return r.map((t) => {
|
|
883
883
|
let r = n;
|
|
884
884
|
for (let [n, s] of a.entries()) {
|
|
885
885
|
let a = o[n];
|
|
886
886
|
if (!(a > 0)) continue;
|
|
887
|
-
let c =
|
|
887
|
+
let c = M(t?.[s.field], s.format);
|
|
888
888
|
if (c === "") continue;
|
|
889
|
-
let l =
|
|
889
|
+
let l = be(e, s, t), u = l?.fontWeight || l?.fontStyle ? {
|
|
890
890
|
...i,
|
|
891
891
|
fontWeight: l.fontWeight ?? i.fontWeight,
|
|
892
892
|
fontStyle: l.fontStyle ?? i.fontStyle
|
|
893
893
|
} : i;
|
|
894
|
-
r = Math.max(r,
|
|
894
|
+
r = Math.max(r, $e(String(c), a, u));
|
|
895
895
|
}
|
|
896
896
|
return r;
|
|
897
897
|
});
|
|
898
898
|
}
|
|
899
|
-
function
|
|
899
|
+
function at(e) {
|
|
900
900
|
if (!e.showHeader) return 0;
|
|
901
901
|
let t = e.headerHeight ?? e.rowHeight ?? 0;
|
|
902
902
|
if (e.wrap === !1) return t;
|
|
903
903
|
let n = (e.columns ?? []).map((e, t) => ({
|
|
904
904
|
...e,
|
|
905
905
|
field: `label${t}`
|
|
906
|
-
})), r = Object.fromEntries((e.columns ?? []).map((e, t) => [`label${t}`, e.label])), [i] =
|
|
906
|
+
})), r = Object.fromEntries((e.columns ?? []).map((e, t) => [`label${t}`, e.label])), [i] = it({
|
|
907
907
|
...e,
|
|
908
908
|
rowHeight: t,
|
|
909
909
|
columns: n
|
|
910
910
|
}, [r]);
|
|
911
911
|
return i ?? t;
|
|
912
912
|
}
|
|
913
|
-
function
|
|
913
|
+
function ot(e) {
|
|
914
914
|
if (e.type !== "table") return e.h ?? 0;
|
|
915
915
|
let t = e.rowHeight ?? 0;
|
|
916
916
|
return (e.showHeader ? e.headerHeight ?? t : 0) + 3 * t;
|
|
917
917
|
}
|
|
918
|
-
function
|
|
918
|
+
function st(e) {
|
|
919
919
|
let t = structuredClone(e);
|
|
920
|
-
for (let e of t.bands) e.items &&
|
|
920
|
+
for (let e of t.bands) e.items && ct(e, t);
|
|
921
921
|
return t;
|
|
922
922
|
}
|
|
923
|
-
function
|
|
923
|
+
function ct(e, t) {
|
|
924
924
|
let n = 0;
|
|
925
|
-
for (let r of e.items) r.measuredHeight =
|
|
926
|
-
return e.contentHeight = n, e.measuredHeight =
|
|
925
|
+
for (let r of e.items) r.measuredHeight = ut(r, t), n = Math.max(n, (r.y ?? 0) + r.measuredHeight);
|
|
926
|
+
return e.contentHeight = n, e.measuredHeight = lt(e) ? n : Math.max(e.height ?? 0, n), e;
|
|
927
927
|
}
|
|
928
|
-
function
|
|
928
|
+
function lt(e) {
|
|
929
929
|
return e.items.some((e) => e.type === "table");
|
|
930
930
|
}
|
|
931
|
-
function
|
|
931
|
+
function ut(e, t) {
|
|
932
932
|
switch (e.type) {
|
|
933
|
-
case "text": return
|
|
934
|
-
case "table": return
|
|
935
|
-
case "line": return
|
|
933
|
+
case "text": return dt(e);
|
|
934
|
+
case "table": return pt(e, t);
|
|
935
|
+
case "line": return ft(e);
|
|
936
936
|
case "box":
|
|
937
937
|
case "image": return e.h ?? 0;
|
|
938
938
|
default: return console.warn(`Unknown item type "${e.type}" on item "${e.id}"; treating as zero height.`), 0;
|
|
939
939
|
}
|
|
940
940
|
}
|
|
941
|
-
function
|
|
942
|
-
let t = e.h ?? 0, n =
|
|
941
|
+
function dt(e) {
|
|
942
|
+
let t = e.h ?? 0, n = $e(e.text ?? e.value ?? "", e.w ?? 0, e.highlighted ? {
|
|
943
943
|
...e.style ?? {},
|
|
944
944
|
...e.highlighted
|
|
945
945
|
} : e.style);
|
|
946
946
|
return Math.max(t, n);
|
|
947
947
|
}
|
|
948
|
-
function
|
|
948
|
+
function ft(e) {
|
|
949
949
|
let t = e.h ?? 0;
|
|
950
950
|
return e.orientation === "vertical" ? t : Math.max(t, e.style?.thickness ?? 0);
|
|
951
951
|
}
|
|
952
|
-
function
|
|
953
|
-
let n =
|
|
954
|
-
if (e.headerMeasured = n, !Array.isArray(e.groups)) return e.rowHeights =
|
|
955
|
-
for (let n of o(e))
|
|
952
|
+
function pt(e, t) {
|
|
953
|
+
let n = at(e);
|
|
954
|
+
if (e.headerMeasured = n, !Array.isArray(e.groups)) return e.rowHeights = it(e, e.row), n + z(e.rowHeights);
|
|
955
|
+
for (let n of o(e)) ht(n?.header, t), ht(n?.footer, t);
|
|
956
956
|
let r = 0;
|
|
957
957
|
return e.groups.forEach((t, i) => {
|
|
958
|
-
t.rowHeights =
|
|
958
|
+
t.rowHeights = it(e, t.rows);
|
|
959
959
|
let a = l(e, t, i === 0, !0);
|
|
960
|
-
r += (a.columnHeader ? n : 0) +
|
|
960
|
+
r += (a.columnHeader ? n : 0) + mt(a.headers) + z(t.rowHeights) + mt(a.footers);
|
|
961
961
|
}), r;
|
|
962
962
|
}
|
|
963
|
-
function
|
|
963
|
+
function z(e) {
|
|
964
964
|
return (e ?? []).reduce((e, t) => e + t, 0);
|
|
965
965
|
}
|
|
966
|
-
function
|
|
967
|
-
return
|
|
966
|
+
function mt(e) {
|
|
967
|
+
return z(e.map(({ band: e }) => e?.measuredHeight ?? 0));
|
|
968
968
|
}
|
|
969
|
-
function
|
|
970
|
-
return Array.isArray(e?.items) ?
|
|
969
|
+
function ht(e, t) {
|
|
970
|
+
return Array.isArray(e?.items) ? ct(e, t).measuredHeight : 0;
|
|
971
971
|
}
|
|
972
972
|
//#endregion
|
|
973
973
|
//#region src/engine/validate.js
|
|
974
|
-
var
|
|
974
|
+
var gt = [
|
|
975
975
|
"reportHeader",
|
|
976
976
|
"pageHeader",
|
|
977
977
|
"groupHeader",
|
|
@@ -979,31 +979,31 @@ var mt = [
|
|
|
979
979
|
"groupFooter",
|
|
980
980
|
"reportFooter",
|
|
981
981
|
"pageFooter"
|
|
982
|
-
],
|
|
982
|
+
], _t = [
|
|
983
983
|
"text",
|
|
984
984
|
"table",
|
|
985
985
|
"line",
|
|
986
986
|
"box",
|
|
987
987
|
"image"
|
|
988
|
-
],
|
|
988
|
+
], vt = ["horizontal", "vertical"], yt = [
|
|
989
989
|
"solid",
|
|
990
990
|
"dashed",
|
|
991
991
|
"dotted",
|
|
992
992
|
"double"
|
|
993
|
-
],
|
|
993
|
+
], bt = [...yt, "none"], xt = [
|
|
994
994
|
"contain",
|
|
995
995
|
"cover",
|
|
996
996
|
"fill"
|
|
997
|
-
],
|
|
997
|
+
], B = class extends Error {
|
|
998
998
|
constructor(e, t = []) {
|
|
999
999
|
super(t.length ? `${e}\n - ${t.join("\n - ")}` : e), this.name = "ReportError", this.issues = t;
|
|
1000
1000
|
}
|
|
1001
1001
|
};
|
|
1002
|
-
function
|
|
1002
|
+
function St(e) {
|
|
1003
1003
|
let t = [];
|
|
1004
1004
|
if (typeof e != "object" || !e || Array.isArray(e)) return ["layout must be an object"];
|
|
1005
|
-
if (
|
|
1006
|
-
e.bands.length === 0 && t.push("layout.bands is empty - there is nothing to render"), e.groupBy != null && typeof e.groupBy != "string" && t.push("layout.groupBy must be a field name or null"),
|
|
1005
|
+
if (Et(e.page, t), !Array.isArray(e.bands)) return t.push("layout.bands must be an array"), t;
|
|
1006
|
+
e.bands.length === 0 && t.push("layout.bands is empty - there is nothing to render"), e.groupBy != null && typeof e.groupBy != "string" && t.push("layout.groupBy must be a field name or null"), At(e.format, "layout.format", t, !1);
|
|
1007
1007
|
let n = /* @__PURE__ */ new Set();
|
|
1008
1008
|
return e.bands.forEach((e, r) => {
|
|
1009
1009
|
let i = `bands[${r}]`;
|
|
@@ -1011,16 +1011,16 @@ function bt(e) {
|
|
|
1011
1011
|
t.push(`${i} must be an object`);
|
|
1012
1012
|
return;
|
|
1013
1013
|
}
|
|
1014
|
-
if (
|
|
1014
|
+
if (gt.includes(e.type) ? n.has(e.type) ? t.push(`${i}.type "${e.type}" appears more than once; the engine places one band of each type`) : n.add(e.type) : t.push(`${i}.type "${e.type}" is not one of: ${gt.join(", ")}`), !Array.isArray(e.items)) {
|
|
1015
1015
|
t.push(`${i}.items must be an array`);
|
|
1016
1016
|
return;
|
|
1017
1017
|
}
|
|
1018
|
-
e.items.forEach((e, n) =>
|
|
1019
|
-
}), e.groupBy != null && !n.has("groupHeader") && !n.has("groupFooter") && t.push("layout.groupBy is set but there is no groupHeader or groupFooter band to show it"),
|
|
1018
|
+
e.items.forEach((e, n) => Ot(e, `${i}.items[${n}]`, t));
|
|
1019
|
+
}), e.groupBy != null && !n.has("groupHeader") && !n.has("groupFooter") && t.push("layout.groupBy is set but there is no groupHeader or groupFooter band to show it"), Ct(e, e.bands, t), t;
|
|
1020
1020
|
}
|
|
1021
|
-
function
|
|
1021
|
+
function Ct(t, n, r) {
|
|
1022
1022
|
let i = e(t);
|
|
1023
|
-
for (let e of i) e.groupBy != null && typeof e.groupBy != "string" && r.push(`table "${e.id}".groupBy must be a field name or null`), e.dataset != null && typeof e.dataset != "string" && r.push(`table "${e.id}".dataset must be a dataset name or null`),
|
|
1023
|
+
for (let e of i) e.groupBy != null && typeof e.groupBy != "string" && r.push(`table "${e.id}".groupBy must be a field name or null`), e.dataset != null && typeof e.dataset != "string" && r.push(`table "${e.id}".dataset must be a dataset name or null`), wt(e, r);
|
|
1024
1024
|
let s = i.filter(a);
|
|
1025
1025
|
s.length > 1 && r.push(`${s.length} tables are grouped by groupBy (${s.map((e) => `"${e.id}"`).join(", ")}); only one can use the report's groupHeader and groupFooter - give the others a grouping of their own`), s.length > 0 && t.groupBy == null && !n.some((e) => e?.type === "groupHeader" || e?.type === "groupFooter") && r.push(`table "${s[0].id}" is grouped by "${s[0].groupBy}" but there is no groupHeader or groupFooter band to show it`);
|
|
1026
1026
|
let c = i[0];
|
|
@@ -1030,7 +1030,7 @@ function xt(t, n, r) {
|
|
|
1030
1030
|
let t = e.items.filter((e) => e?.type === "table").map((e) => ({
|
|
1031
1031
|
item: e,
|
|
1032
1032
|
top: Number(e.y) || 0,
|
|
1033
|
-
bottom: (Number(e.y) || 0) +
|
|
1033
|
+
bottom: (Number(e.y) || 0) + ot(e)
|
|
1034
1034
|
})).sort((e, t) => e.top - t.top);
|
|
1035
1035
|
for (let n = 1; n < t.length; n++) {
|
|
1036
1036
|
let i = t[n - 1], a = t[n];
|
|
@@ -1038,7 +1038,7 @@ function xt(t, n, r) {
|
|
|
1038
1038
|
}
|
|
1039
1039
|
}
|
|
1040
1040
|
}
|
|
1041
|
-
function
|
|
1041
|
+
function wt(e, t) {
|
|
1042
1042
|
if (e.grouping == null) return;
|
|
1043
1043
|
let n = `table "${e.id}".grouping`;
|
|
1044
1044
|
if (!Array.isArray(e.grouping)) {
|
|
@@ -1053,10 +1053,10 @@ function St(e, t) {
|
|
|
1053
1053
|
t.push(`${o} must be an object with by, header and footer`);
|
|
1054
1054
|
return;
|
|
1055
1055
|
}
|
|
1056
|
-
typeof e.by != "string" || e.by === "" ? t.push(`${o}.by must be the name of the field to group by`) : r.has(e.by) ? t.push(`${o} groups by "${e.by}" again, as ${n}[${r.get(e.by)}] already does; group each level by a different field`) : r.set(e.by, a), e.sort != null && !i.includes(e.sort) && t.push(`${o}.sort must be ${i.map((e) => `"${e}"`).join(" or ")}, or null to keep the groups in the order they are first seen`), e.newPage != null && typeof e.newPage != "boolean" && t.push(`${o}.newPage must be true or false`),
|
|
1056
|
+
typeof e.by != "string" || e.by === "" ? t.push(`${o}.by must be the name of the field to group by`) : r.has(e.by) ? t.push(`${o} groups by "${e.by}" again, as ${n}[${r.get(e.by)}] already does; group each level by a different field`) : r.set(e.by, a), e.sort != null && !i.includes(e.sort) && t.push(`${o}.sort must be ${i.map((e) => `"${e}"`).join(" or ")}, or null to keep the groups in the order they are first seen`), e.newPage != null && typeof e.newPage != "boolean" && t.push(`${o}.newPage must be true or false`), Tt(e.header, `${o}.header`, t), Tt(e.footer, `${o}.footer`, t), e.header == null && e.footer == null && t.push(`${o} has neither a header nor a footer to show its groups`);
|
|
1057
1057
|
});
|
|
1058
1058
|
}
|
|
1059
|
-
function
|
|
1059
|
+
function Tt(e, t, n) {
|
|
1060
1060
|
if (e != null) {
|
|
1061
1061
|
if (typeof e != "object" || Array.isArray(e)) {
|
|
1062
1062
|
n.push(`${t} must be a band with items, or null`);
|
|
@@ -1071,11 +1071,11 @@ function Ct(e, t, n) {
|
|
|
1071
1071
|
n.push(`${t}.items[${r}] is a table; a group band cannot hold one`);
|
|
1072
1072
|
return;
|
|
1073
1073
|
}
|
|
1074
|
-
|
|
1074
|
+
Ot(e, `${t}.items[${r}]`, n);
|
|
1075
1075
|
});
|
|
1076
1076
|
}
|
|
1077
1077
|
}
|
|
1078
|
-
function
|
|
1078
|
+
function Et(e, t) {
|
|
1079
1079
|
if (typeof e != "object" || !e) {
|
|
1080
1080
|
t.push("layout.page must be an object with width, height and margin");
|
|
1081
1081
|
return;
|
|
@@ -1092,46 +1092,66 @@ function wt(e, t) {
|
|
|
1092
1092
|
"left"
|
|
1093
1093
|
]) typeof e.margin[n] == "number" && e.margin[n] >= 0 || t.push(`layout.page.margin.${n} must be a number of pixels`);
|
|
1094
1094
|
let n = e.height - (e.margin.top + e.margin.bottom);
|
|
1095
|
-
n <= 0 && t.push(`layout.page margins leave no printable height (${n}px)`);
|
|
1095
|
+
n <= 0 && t.push(`layout.page margins leave no printable height (${n}px)`), Dt(e, t);
|
|
1096
1096
|
}
|
|
1097
|
-
function
|
|
1097
|
+
function Dt(e, t) {
|
|
1098
|
+
if (e.marginLinked != null && typeof e.marginLinked != "boolean" && t.push("layout.page.marginLinked must be true or false"), e.marginOff != null) {
|
|
1099
|
+
if (typeof e.marginOff != "object" || Array.isArray(e.marginOff)) {
|
|
1100
|
+
t.push("layout.page.marginOff must be an object of the margins switched off");
|
|
1101
|
+
return;
|
|
1102
|
+
}
|
|
1103
|
+
for (let [n, r] of Object.entries(e.marginOff)) {
|
|
1104
|
+
if (![
|
|
1105
|
+
"top",
|
|
1106
|
+
"right",
|
|
1107
|
+
"bottom",
|
|
1108
|
+
"left"
|
|
1109
|
+
].includes(n)) {
|
|
1110
|
+
t.push(`layout.page.marginOff.${n} is not a side - use top, right, bottom or left`);
|
|
1111
|
+
continue;
|
|
1112
|
+
}
|
|
1113
|
+
typeof r == "number" && r >= 0 || t.push(`layout.page.marginOff.${n} must be a number of pixels`), e.margin[n] !== 0 && t.push(`layout.page.margin.${n} must be 0 while that margin is switched off (it is listed in layout.page.marginOff)`);
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
function Ot(e, t, n) {
|
|
1098
1118
|
if (typeof e != "object" || !e) {
|
|
1099
1119
|
n.push(`${t} must be an object`);
|
|
1100
1120
|
return;
|
|
1101
1121
|
}
|
|
1102
|
-
if (!
|
|
1103
|
-
n.push(`${t}.type "${e.type}" is not one of: ${
|
|
1122
|
+
if (!_t.includes(e.type)) {
|
|
1123
|
+
n.push(`${t}.type "${e.type}" is not one of: ${_t.join(", ")}`);
|
|
1104
1124
|
return;
|
|
1105
1125
|
}
|
|
1106
1126
|
if ((typeof e.id != "string" || e.id === "") && n.push(`${t}.id must be a non-empty string`), e.type === "text") {
|
|
1107
|
-
typeof e.value != "string" && n.push(`${t}.value must be a string`),
|
|
1127
|
+
typeof e.value != "string" && n.push(`${t}.value must be a string`), At(e.format, `${t}.format`, n, !0), kt(e.highlight, `${t}.highlight`, n, !1);
|
|
1108
1128
|
return;
|
|
1109
1129
|
}
|
|
1110
1130
|
if (e.type === "line") {
|
|
1111
|
-
|
|
1131
|
+
Nt(e, t, n);
|
|
1112
1132
|
return;
|
|
1113
1133
|
}
|
|
1114
1134
|
if (e.type === "box") {
|
|
1115
|
-
|
|
1135
|
+
jt(e, t, n);
|
|
1116
1136
|
return;
|
|
1117
1137
|
}
|
|
1118
1138
|
if (e.type === "image") {
|
|
1119
|
-
|
|
1139
|
+
Mt(e, t, n);
|
|
1120
1140
|
return;
|
|
1121
1141
|
}
|
|
1122
|
-
if (typeof e.rowHeight == "number" && e.rowHeight > 0 || n.push(`${t}.rowHeight must be a positive number`), e.style?.borderStyle != null && !
|
|
1142
|
+
if (typeof e.rowHeight == "number" && e.rowHeight > 0 || n.push(`${t}.rowHeight must be a positive number`), e.style?.borderStyle != null && !bt.includes(e.style.borderStyle) && n.push(`${t}.style.borderStyle "${e.style.borderStyle}" is not one of: ` + bt.join(", ")), e.style?.borderWidth != null && !(typeof e.style.borderWidth == "number" && e.style.borderWidth > 0) && n.push(`${t}.style.borderWidth must be a positive number of pixels`), !Array.isArray(e.columns) || e.columns.length === 0) {
|
|
1123
1143
|
n.push(`${t}.columns must be a non-empty array`);
|
|
1124
1144
|
return;
|
|
1125
1145
|
}
|
|
1126
1146
|
e.columns.forEach((e, r) => {
|
|
1127
|
-
if ((e == null || typeof e.field != "string" || e.field === "") && n.push(`${t}.columns[${r}].field must be a non-empty string`),
|
|
1128
|
-
let i = typeof e.expression == "string" ?
|
|
1147
|
+
if ((e == null || typeof e.field != "string" || e.field === "") && n.push(`${t}.columns[${r}].field must be a non-empty string`), At(e?.format, `${t}.columns[${r}].format`, n, !0), e?.expression != null && e.expression !== "") {
|
|
1148
|
+
let i = typeof e.expression == "string" ? je(e.expression) : { error: "must be text" };
|
|
1129
1149
|
i.error && n.push(`${t}.columns[${r}].expression ${i.error}`);
|
|
1130
1150
|
}
|
|
1131
|
-
|
|
1132
|
-
}),
|
|
1151
|
+
kt(e?.highlight, `${t}.columns[${r}].highlight`, n, !1);
|
|
1152
|
+
}), kt(e.rowHighlight, `${t}.rowHighlight`, n, !0);
|
|
1133
1153
|
}
|
|
1134
|
-
function
|
|
1154
|
+
function kt(e, t, n, r) {
|
|
1135
1155
|
if (e != null) {
|
|
1136
1156
|
if (!Array.isArray(e)) {
|
|
1137
1157
|
n.push(`${t} must be a list of rules, or null`);
|
|
@@ -1143,17 +1163,17 @@ function Et(e, t, n, r) {
|
|
|
1143
1163
|
n.push(`${a}.when must say what to test`);
|
|
1144
1164
|
return;
|
|
1145
1165
|
}
|
|
1146
|
-
|
|
1166
|
+
ge.includes(o.op) || n.push(`${a}.when.op "${o.op}" is not one of: ${ge.join(", ")}`), o.field != null && (typeof o.field != "string" || o.field === "") ? n.push(`${a}.when.field must be the name of a field`) : r && o.field == null && n.push(`${a}.when.field must name the field of the row to test`), o.op === "between" && (o.value == null || o.to == null) && n.push(`${a}.when needs both value and to for between`);
|
|
1147
1167
|
let s = e.style;
|
|
1148
1168
|
if (typeof s != "object" || !s || Array.isArray(s)) {
|
|
1149
1169
|
n.push(`${a}.style must be an object`);
|
|
1150
1170
|
return;
|
|
1151
1171
|
}
|
|
1152
|
-
for (let e of Object.keys(s))
|
|
1172
|
+
for (let e of Object.keys(s)) ve.includes(e) || n.push(`${a}.style.${e} is not one of: ${ve.join(", ")}`);
|
|
1153
1173
|
});
|
|
1154
1174
|
}
|
|
1155
1175
|
}
|
|
1156
|
-
function
|
|
1176
|
+
function At(e, t, n, r) {
|
|
1157
1177
|
if (e == null) return;
|
|
1158
1178
|
if (typeof e != "object" || Array.isArray(e)) {
|
|
1159
1179
|
n.push(`${t} must be an object, or null`);
|
|
@@ -1165,57 +1185,57 @@ function Dt(e, t, n, r) {
|
|
|
1165
1185
|
r ? i("type", b) : e.type != null && n.push(`${t}.type is an item's or a column's to say, not the report's`), i("grouping", x), i("negative", S), i("zero", C), i("symbolPosition", w), e.decimals != null && !(Number.isInteger(e.decimals) && e.decimals >= 0 && e.decimals <= 6) && n.push(`${t}.decimals must be a whole number from 0 to 6`);
|
|
1166
1186
|
for (let r of ["symbol", "pattern"]) e[r] != null && typeof e[r] != "string" && n.push(`${t}.${r} must be text`);
|
|
1167
1187
|
}
|
|
1168
|
-
function
|
|
1188
|
+
function jt(e, t, n) {
|
|
1169
1189
|
let r = e.style;
|
|
1170
1190
|
if (r != null) {
|
|
1171
1191
|
if (typeof r != "object" || Array.isArray(r)) {
|
|
1172
1192
|
n.push(`${t}.style must be an object`);
|
|
1173
1193
|
return;
|
|
1174
1194
|
}
|
|
1175
|
-
r.borderStyle != null && !
|
|
1195
|
+
r.borderStyle != null && !bt.includes(r.borderStyle) && n.push(`${t}.style.borderStyle "${r.borderStyle}" is not one of: ` + bt.join(", "));
|
|
1176
1196
|
for (let e of ["borderWidth", "radius"]) {
|
|
1177
1197
|
let i = r[e], a = e === "radius" ? 0 : 1;
|
|
1178
1198
|
i != null && !(typeof i == "number" && i >= a) && n.push(`${t}.style.${e} must be a number of pixels` + (a ? " greater than zero" : " of zero or more"));
|
|
1179
1199
|
}
|
|
1180
1200
|
}
|
|
1181
1201
|
}
|
|
1182
|
-
function
|
|
1183
|
-
e.src != null && typeof e.src != "string" && n.push(`${t}.src must be a string - a URL or a data: URI`), e.field != null && typeof e.field != "string" && n.push(`${t}.field must be a data path such as "company.logo"`), e.fit != null && !
|
|
1202
|
+
function Mt(e, t, n) {
|
|
1203
|
+
e.src != null && typeof e.src != "string" && n.push(`${t}.src must be a string - a URL or a data: URI`), e.field != null && typeof e.field != "string" && n.push(`${t}.field must be a data path such as "company.logo"`), e.fit != null && !xt.includes(e.fit) && n.push(`${t}.fit "${e.fit}" is not one of: ${xt.join(", ")}`), e.alt != null && typeof e.alt != "string" && n.push(`${t}.alt must be a string`);
|
|
1184
1204
|
}
|
|
1185
|
-
function
|
|
1186
|
-
e.orientation != null && !
|
|
1205
|
+
function Nt(e, t, n) {
|
|
1206
|
+
e.orientation != null && !vt.includes(e.orientation) && n.push(`${t}.orientation "${e.orientation}" is not one of: ` + vt.join(", "));
|
|
1187
1207
|
let r = e.style;
|
|
1188
1208
|
if (r != null) {
|
|
1189
1209
|
if (typeof r != "object" || Array.isArray(r)) {
|
|
1190
1210
|
n.push(`${t}.style must be an object`);
|
|
1191
1211
|
return;
|
|
1192
1212
|
}
|
|
1193
|
-
r.thickness != null && !(typeof r.thickness == "number" && r.thickness > 0) && n.push(`${t}.style.thickness must be a positive number of pixels`), r.lineStyle != null && !
|
|
1213
|
+
r.thickness != null && !(typeof r.thickness == "number" && r.thickness > 0) && n.push(`${t}.style.thickness must be a positive number of pixels`), r.lineStyle != null && !yt.includes(r.lineStyle) && n.push(`${t}.style.lineStyle "${r.lineStyle}" is not one of: ` + yt.join(", "));
|
|
1194
1214
|
}
|
|
1195
1215
|
}
|
|
1196
|
-
function
|
|
1197
|
-
let n =
|
|
1198
|
-
if (n.length) throw new
|
|
1216
|
+
function Pt(e, t) {
|
|
1217
|
+
let n = St(e);
|
|
1218
|
+
if (n.length) throw new B(`${t}: the layout file is not usable`, n);
|
|
1199
1219
|
}
|
|
1200
|
-
function
|
|
1201
|
-
if (typeof e != "object" || !e || Array.isArray(e)) throw new
|
|
1220
|
+
function Ft(e, t) {
|
|
1221
|
+
if (typeof e != "object" || !e || Array.isArray(e)) throw new B(`${t}: data must be an object keyed by dataset name`);
|
|
1202
1222
|
}
|
|
1203
1223
|
//#endregion
|
|
1204
1224
|
//#region src/engine/resolve.js
|
|
1205
|
-
var
|
|
1206
|
-
function
|
|
1207
|
-
return
|
|
1225
|
+
var It = /\{([^{}]+)\}/g, Lt = /^\w+\(.*\)$/, Rt = ["page", "totalPages"], zt = ["groupHeader", "groupFooter"], Bt = It;
|
|
1226
|
+
function Vt(e) {
|
|
1227
|
+
return Lt.test(e) || Rt.includes(e) || e === "today";
|
|
1208
1228
|
}
|
|
1209
|
-
function
|
|
1210
|
-
return
|
|
1229
|
+
function Ht(e) {
|
|
1230
|
+
return zt.includes(e);
|
|
1211
1231
|
}
|
|
1212
|
-
function
|
|
1232
|
+
function Ut(e) {
|
|
1213
1233
|
let t = typeof e == "string" ? e.trim().match(/^{([^{}]+)}$/) : null;
|
|
1214
1234
|
return t ? t[1].trim() : null;
|
|
1215
1235
|
}
|
|
1216
|
-
function
|
|
1236
|
+
function Wt(t) {
|
|
1217
1237
|
let n = t.format, r = (e) => {
|
|
1218
|
-
let t =
|
|
1238
|
+
let t = A(e?.format, n);
|
|
1219
1239
|
t && (e.format = t);
|
|
1220
1240
|
}, i = (e) => (Array.isArray(e?.items) ? e.items : []).filter((e) => e?.type === "text");
|
|
1221
1241
|
for (let e of t.bands) i(e).forEach(r);
|
|
@@ -1224,57 +1244,57 @@ function Vt(t) {
|
|
|
1224
1244
|
for (let e of o(n)) i(e?.header).forEach(r), i(e?.footer).forEach(r);
|
|
1225
1245
|
}
|
|
1226
1246
|
}
|
|
1227
|
-
function
|
|
1228
|
-
|
|
1247
|
+
function Gt(e, t) {
|
|
1248
|
+
Pt(e, "resolve"), Ft(t, "resolve");
|
|
1229
1249
|
let n = structuredClone(e);
|
|
1230
|
-
|
|
1250
|
+
Wt(n);
|
|
1231
1251
|
for (let e of n.bands) {
|
|
1232
|
-
|
|
1233
|
-
for (let r of e.items) if (r.type === "table") for (let e of o(r)) for (let r of [e?.header, e?.footer]) Array.isArray(r?.items) &&
|
|
1252
|
+
Kt(e, t, zt.includes(e.type), n.format);
|
|
1253
|
+
for (let r of e.items) if (r.type === "table") for (let e of o(r)) for (let r of [e?.header, e?.footer]) Array.isArray(r?.items) && Kt(r, t, !0, n.format);
|
|
1234
1254
|
}
|
|
1235
1255
|
return n;
|
|
1236
1256
|
}
|
|
1237
|
-
function
|
|
1238
|
-
for (let i of e.items) i.type == "text" && (i.text =
|
|
1257
|
+
function Kt(e, t, n, r) {
|
|
1258
|
+
for (let i of e.items) i.type == "text" && (i.text = Jt(i, t, n, r)), i.type == "image" && (i.resolvedSrc = qt(i, t));
|
|
1239
1259
|
}
|
|
1240
|
-
function
|
|
1260
|
+
function qt(e, t) {
|
|
1241
1261
|
let n = typeof e.field == "string" ? e.field.trim() : "";
|
|
1242
1262
|
if (n) {
|
|
1243
|
-
let r =
|
|
1263
|
+
let r = Zt(n, t);
|
|
1244
1264
|
if (typeof r == "string" && r !== "") return r;
|
|
1245
1265
|
e.src || console.warn(`Unresolved image field "${n}" on item "${e.id}".`);
|
|
1246
1266
|
}
|
|
1247
1267
|
return typeof e.src == "string" ? e.src : "";
|
|
1248
1268
|
}
|
|
1249
|
-
function
|
|
1250
|
-
let i =
|
|
1251
|
-
return e.value.replace(
|
|
1252
|
-
let s =
|
|
1253
|
-
return i === o.trim() && s !== a && (e.raw = i === "today" ? /* @__PURE__ */ new Date() :
|
|
1269
|
+
function Jt(e, t, n, r) {
|
|
1270
|
+
let i = Ut(e.value);
|
|
1271
|
+
return e.value.replace(It, (a, o) => {
|
|
1272
|
+
let s = Yt(a, o.trim(), t, e, n, r);
|
|
1273
|
+
return i === o.trim() && s !== a && (e.raw = i === "today" ? /* @__PURE__ */ new Date() : Zt(i, t) ?? null), s;
|
|
1254
1274
|
});
|
|
1255
1275
|
}
|
|
1256
|
-
function
|
|
1257
|
-
if (
|
|
1258
|
-
if (t == "today") return
|
|
1259
|
-
let o =
|
|
1260
|
-
return o == null ? i ? e : (console.warn(`Unresolved placeholder "{${t}}" on item "${r.id}".`), "") :
|
|
1276
|
+
function Yt(e, t, n, r, i, a) {
|
|
1277
|
+
if (Lt.test(t) || Rt.includes(t)) return e;
|
|
1278
|
+
if (t == "today") return M(/* @__PURE__ */ new Date(), Xt(r.format, a));
|
|
1279
|
+
let o = Zt(t, n);
|
|
1280
|
+
return o == null ? i ? e : (console.warn(`Unresolved placeholder "{${t}}" on item "${r.id}".`), "") : M(o, r.format);
|
|
1261
1281
|
}
|
|
1262
|
-
function
|
|
1282
|
+
function Xt(e, t) {
|
|
1263
1283
|
return e?.type === "date" || e?.type === "datetime" ? e : {
|
|
1264
1284
|
type: "date",
|
|
1265
1285
|
pattern: e?.pattern ?? t?.pattern ?? "yyyy-MM-dd"
|
|
1266
1286
|
};
|
|
1267
1287
|
}
|
|
1268
|
-
function
|
|
1288
|
+
function Zt(e, t) {
|
|
1269
1289
|
return e.replace(/\[(\d+)\]/g, ".$1").split(".").filter((e) => e !== "").reduce((e, t) => e?.[t], t);
|
|
1270
1290
|
}
|
|
1271
1291
|
//#endregion
|
|
1272
1292
|
//#region src/engine/group.js
|
|
1273
|
-
var
|
|
1274
|
-
function
|
|
1275
|
-
if (n.groupBy != null && e(n).length === 0) throw new
|
|
1276
|
-
let i = g(n), a = i.bands, o = e(i), s = new Map(m(i).map((e) => [e.table, e])), c =
|
|
1277
|
-
let n =
|
|
1293
|
+
var Qt = /\{([^{}]+)\}/g;
|
|
1294
|
+
function $t(n, r) {
|
|
1295
|
+
if (n.groupBy != null && e(n).length === 0) throw new B(`group: layout.groupBy is "${n.groupBy}" but no band contains a table to group`);
|
|
1296
|
+
let i = g(n), a = i.bands, o = e(i), s = new Map(m(i).map((e) => [e.table, e])), c = nn(r), l = o.map((e) => {
|
|
1297
|
+
let n = Pe(e, rn(e, i, r));
|
|
1278
1298
|
return c.set(t(e, i), n), {
|
|
1279
1299
|
table: e,
|
|
1280
1300
|
rows: n
|
|
@@ -1282,23 +1302,23 @@ function Xt(n, r) {
|
|
|
1282
1302
|
});
|
|
1283
1303
|
for (let { table: e, rows: n } of l) {
|
|
1284
1304
|
let r = s.get(e);
|
|
1285
|
-
r ?
|
|
1305
|
+
r ? en(e, n, r, t(e, i)) : e.row = n;
|
|
1286
1306
|
}
|
|
1287
|
-
return
|
|
1307
|
+
return on(a, {
|
|
1288
1308
|
rows: l[0]?.rows ?? [],
|
|
1289
1309
|
table: l[0]?.table ?? null,
|
|
1290
1310
|
named: c,
|
|
1291
1311
|
data: r
|
|
1292
1312
|
}), i;
|
|
1293
1313
|
}
|
|
1294
|
-
function
|
|
1314
|
+
function en(e, t, n, r) {
|
|
1295
1315
|
let i = n.levels, a = [], o = t, s = (t, n, c) => {
|
|
1296
1316
|
let l = i[n], u = [l.header, l.footer].filter(Boolean);
|
|
1297
|
-
for (let [d, f] of
|
|
1317
|
+
for (let [d, f] of xn(yn(t, l.by), l.sort)) {
|
|
1298
1318
|
let p = {
|
|
1299
1319
|
by: l.by,
|
|
1300
1320
|
key: d,
|
|
1301
|
-
aggregates:
|
|
1321
|
+
aggregates: gn(u, f, r, {
|
|
1302
1322
|
all: o,
|
|
1303
1323
|
parent: t,
|
|
1304
1324
|
table: e
|
|
@@ -1318,58 +1338,58 @@ function Zt(e, t, n, r) {
|
|
|
1318
1338
|
}
|
|
1319
1339
|
};
|
|
1320
1340
|
s(t, 0, []), a.forEach((e, t) => {
|
|
1321
|
-
e.opens =
|
|
1341
|
+
e.opens = tn(a[t - 1], e), e.closes = tn(a[t + 1], e);
|
|
1322
1342
|
}), e.groups = a;
|
|
1323
1343
|
}
|
|
1324
|
-
function
|
|
1344
|
+
function tn(e, t) {
|
|
1325
1345
|
if (!e) return 0;
|
|
1326
1346
|
let n = t.levels.findIndex((t, n) => e.levels[n] !== t);
|
|
1327
1347
|
return n === -1 ? t.levels.length - 1 : n;
|
|
1328
1348
|
}
|
|
1329
|
-
function
|
|
1349
|
+
function nn(e) {
|
|
1330
1350
|
let t = /* @__PURE__ */ new Map();
|
|
1331
1351
|
for (let [n, r] of Object.entries(e ?? {})) Array.isArray(r) && t.set(n, r);
|
|
1332
1352
|
return t;
|
|
1333
1353
|
}
|
|
1334
|
-
function
|
|
1354
|
+
function rn(e, n, r) {
|
|
1335
1355
|
let i = t(e, n), a = i == null ? void 0 : r[i];
|
|
1336
|
-
if (a === void 0) throw new
|
|
1337
|
-
if (!Array.isArray(a)) throw new
|
|
1356
|
+
if (a === void 0) throw new B(`group: table "${e.id}" is bound to dataset "${i}", which is not present in the data`);
|
|
1357
|
+
if (!Array.isArray(a)) throw new B(`group: dataset "${i}" must be an array of rows, got ${typeof a}`);
|
|
1338
1358
|
return a;
|
|
1339
1359
|
}
|
|
1340
|
-
var
|
|
1341
|
-
function
|
|
1342
|
-
for (let n of e) if (!
|
|
1360
|
+
var an = ["groupHeader", "groupFooter"];
|
|
1361
|
+
function on(e, t) {
|
|
1362
|
+
for (let n of e) if (!an.includes(n.type)) for (let e of n.items) {
|
|
1343
1363
|
if (e.type != "text") continue;
|
|
1344
|
-
e.text =
|
|
1345
|
-
let n =
|
|
1364
|
+
e.text = sn(e.text ?? e.value, t, e);
|
|
1365
|
+
let n = ye(e.highlight, mn(e), t.data);
|
|
1346
1366
|
n && (e.highlighted = n);
|
|
1347
1367
|
}
|
|
1348
1368
|
}
|
|
1349
|
-
function
|
|
1350
|
-
let r =
|
|
1351
|
-
return e.replace(
|
|
1352
|
-
let a =
|
|
1369
|
+
function sn(e, t, n) {
|
|
1370
|
+
let r = Ut(n.value);
|
|
1371
|
+
return e.replace(Qt, (e, i) => {
|
|
1372
|
+
let a = hn(i.trim());
|
|
1353
1373
|
if (!a) return e;
|
|
1354
|
-
let o = a.key ===
|
|
1355
|
-
if (o) s =
|
|
1356
|
-
let i =
|
|
1357
|
-
return
|
|
1374
|
+
let o = a.key === ln, s;
|
|
1375
|
+
if (o) s = un(a.field, (e, n, r) => {
|
|
1376
|
+
let i = cn(r, t);
|
|
1377
|
+
return Sn({
|
|
1358
1378
|
key: n,
|
|
1359
1379
|
field: i.field
|
|
1360
1380
|
}, i.rows);
|
|
1361
|
-
}, () =>
|
|
1381
|
+
}, () => pn(t.table, t.rows));
|
|
1362
1382
|
else {
|
|
1363
|
-
let { rows: e, field: n } =
|
|
1364
|
-
s =
|
|
1383
|
+
let { rows: e, field: n } = cn(a.field, t);
|
|
1384
|
+
s = Sn({
|
|
1365
1385
|
key: a.key,
|
|
1366
1386
|
field: n
|
|
1367
1387
|
}, e);
|
|
1368
1388
|
}
|
|
1369
|
-
return r === i.trim() && (n.raw = s, o && (n.rawFormat =
|
|
1389
|
+
return r === i.trim() && (n.raw = s, o && (n.rawFormat = j(n.format))), s == null ? "" : o ? M(s, j(n.format)) : M(s, a.key === "count" ? null : n.format);
|
|
1370
1390
|
});
|
|
1371
1391
|
}
|
|
1372
|
-
function
|
|
1392
|
+
function cn(e, t) {
|
|
1373
1393
|
if (t.named.has(e)) return {
|
|
1374
1394
|
rows: t.named.get(e),
|
|
1375
1395
|
field: ""
|
|
@@ -1387,9 +1407,9 @@ function an(e, t) {
|
|
|
1387
1407
|
field: e
|
|
1388
1408
|
};
|
|
1389
1409
|
}
|
|
1390
|
-
var
|
|
1391
|
-
function
|
|
1392
|
-
let [r, i] =
|
|
1410
|
+
var ln = "percentage";
|
|
1411
|
+
function un(e, t, n) {
|
|
1412
|
+
let [r, i] = fn(e), a = dn(r);
|
|
1393
1413
|
if (!a || a.kind === "parent") return null;
|
|
1394
1414
|
let o = a.kind === "aggregate" ? {
|
|
1395
1415
|
fn: a.fn,
|
|
@@ -1397,84 +1417,84 @@ function sn(e, t, n) {
|
|
|
1397
1417
|
} : {
|
|
1398
1418
|
fn: "sum",
|
|
1399
1419
|
field: n()
|
|
1400
|
-
}, s = a.kind === "number" ? a.value : t("part", a.fn, a.field), c = i === void 0 ? { kind: "all" } :
|
|
1420
|
+
}, s = a.kind === "number" ? a.value : t("part", a.fn, a.field), c = i === void 0 ? { kind: "all" } : dn(i);
|
|
1401
1421
|
if (!c) return null;
|
|
1402
1422
|
let l = null;
|
|
1403
|
-
return c.kind === "number" ? l = c.value : c.kind === "aggregate" ? l = t("all", c.fn, c.field) : (o.fn === "count" || o.field) && (l = t(c.kind === "parent" ? "parent" : "all", o.fn, o.field)), s == null || l == null || l === 0 ? null :
|
|
1423
|
+
return c.kind === "number" ? l = c.value : c.kind === "aggregate" ? l = t("all", c.fn, c.field) : (o.fn === "count" || o.field) && (l = t(c.kind === "parent" ? "parent" : "all", o.fn, o.field)), s == null || l == null || l === 0 ? null : Cn(s / l);
|
|
1404
1424
|
}
|
|
1405
|
-
function
|
|
1425
|
+
function dn(e) {
|
|
1406
1426
|
let t = (e ?? "").trim();
|
|
1407
1427
|
if (t === "") return null;
|
|
1408
1428
|
if (t === "parent") return { kind: "parent" };
|
|
1409
|
-
let n =
|
|
1429
|
+
let n = N(t);
|
|
1410
1430
|
if (n !== null) return {
|
|
1411
1431
|
kind: "number",
|
|
1412
1432
|
value: n
|
|
1413
1433
|
};
|
|
1414
|
-
let r =
|
|
1434
|
+
let r = hn(t);
|
|
1415
1435
|
return !r || r.key === "percentage" ? null : {
|
|
1416
1436
|
kind: "aggregate",
|
|
1417
1437
|
fn: r.key,
|
|
1418
1438
|
field: r.field
|
|
1419
1439
|
};
|
|
1420
1440
|
}
|
|
1421
|
-
function
|
|
1441
|
+
function fn(e) {
|
|
1422
1442
|
let t = 0;
|
|
1423
1443
|
for (let n = 0; n < e.length; n++) if (e[n] === "(") t++;
|
|
1424
1444
|
else if (e[n] === ")") t--;
|
|
1425
1445
|
else if (e[n] === "," && t === 0) return [e.slice(0, n), e.slice(n + 1)];
|
|
1426
1446
|
return [e, void 0];
|
|
1427
1447
|
}
|
|
1428
|
-
function
|
|
1429
|
-
let n = Array.isArray(e?.columns) ? e.columns : [], r = (e) => n.find((t) => t?.format?.type === e)?.field, i = [...n].reverse().find((e) => (t ?? []).some((t) =>
|
|
1448
|
+
function pn(e, t) {
|
|
1449
|
+
let n = Array.isArray(e?.columns) ? e.columns : [], r = (e) => n.find((t) => t?.format?.type === e)?.field, i = [...n].reverse().find((e) => (t ?? []).some((t) => N(t?.[e?.field]) !== null));
|
|
1430
1450
|
return r("currency") ?? r("number") ?? i?.field ?? null;
|
|
1431
1451
|
}
|
|
1432
|
-
function
|
|
1433
|
-
return e.rawFormat?.type === "percent" && typeof e.raw == "number" ?
|
|
1452
|
+
function mn(e) {
|
|
1453
|
+
return e.rawFormat?.type === "percent" && typeof e.raw == "number" ? Cn(e.raw * 100) : e.raw;
|
|
1434
1454
|
}
|
|
1435
|
-
function
|
|
1455
|
+
function hn(e) {
|
|
1436
1456
|
let t = e.match(/^(\w+)\((.*?)\)$/);
|
|
1437
1457
|
return t ? {
|
|
1438
1458
|
key: t[1],
|
|
1439
1459
|
field: t[2].trim()
|
|
1440
1460
|
} : null;
|
|
1441
1461
|
}
|
|
1442
|
-
function
|
|
1462
|
+
function gn(e, t, n, r = {}) {
|
|
1443
1463
|
let i = {}, a = {
|
|
1444
1464
|
part: t,
|
|
1445
1465
|
all: r.all ?? t,
|
|
1446
1466
|
parent: r.parent ?? r.all ?? t
|
|
1447
|
-
}, o = (e, t, r) =>
|
|
1467
|
+
}, o = (e, t, r) => Sn({
|
|
1448
1468
|
key: t,
|
|
1449
|
-
field:
|
|
1469
|
+
field: _n(r, n)
|
|
1450
1470
|
}, a[e]);
|
|
1451
|
-
for (let s of e) for (let e of s.items ?? []) if (e.type == "text") for (let s of
|
|
1452
|
-
let e =
|
|
1471
|
+
for (let s of e) for (let e of s.items ?? []) if (e.type == "text") for (let s of vn(e.value)) {
|
|
1472
|
+
let e = _n(s.field, n);
|
|
1453
1473
|
i[s.field] ??= {
|
|
1454
1474
|
count: null,
|
|
1455
1475
|
sum: null,
|
|
1456
1476
|
avg: null,
|
|
1457
1477
|
min: null,
|
|
1458
1478
|
max: null
|
|
1459
|
-
}, i[s.field][s.key] = s.key === "percentage" ?
|
|
1479
|
+
}, i[s.field][s.key] = s.key === "percentage" ? un(s.field, o, () => pn(r.table, a.all)) : Sn({
|
|
1460
1480
|
key: s.key,
|
|
1461
1481
|
field: e
|
|
1462
1482
|
}, t);
|
|
1463
1483
|
}
|
|
1464
1484
|
return i;
|
|
1465
1485
|
}
|
|
1466
|
-
function
|
|
1486
|
+
function _n(e, t) {
|
|
1467
1487
|
return t == null ? e : e === t ? "" : e.startsWith(`${t}.`) ? e.slice(t.length + 1) : e;
|
|
1468
1488
|
}
|
|
1469
|
-
function
|
|
1489
|
+
function vn(e) {
|
|
1470
1490
|
let t = [];
|
|
1471
|
-
for (let [, n] of e.matchAll(
|
|
1472
|
-
let e =
|
|
1491
|
+
for (let [, n] of e.matchAll(Qt)) {
|
|
1492
|
+
let e = hn(n.trim());
|
|
1473
1493
|
e && t.push(e);
|
|
1474
1494
|
}
|
|
1475
1495
|
return t;
|
|
1476
1496
|
}
|
|
1477
|
-
function
|
|
1497
|
+
function yn(e, t) {
|
|
1478
1498
|
let n = /* @__PURE__ */ new Map();
|
|
1479
1499
|
for (let r of e) {
|
|
1480
1500
|
let e = String(r?.[t]);
|
|
@@ -1482,42 +1502,42 @@ function gn(e, t) {
|
|
|
1482
1502
|
}
|
|
1483
1503
|
return n;
|
|
1484
1504
|
}
|
|
1485
|
-
var
|
|
1505
|
+
var bn = new Intl.Collator(void 0, {
|
|
1486
1506
|
numeric: !0,
|
|
1487
1507
|
sensitivity: "base"
|
|
1488
1508
|
});
|
|
1489
|
-
function
|
|
1509
|
+
function xn(e, t) {
|
|
1490
1510
|
if (t !== "asc" && t !== "desc") return e;
|
|
1491
1511
|
let n = t === "desc" ? -1 : 1, r = (e) => e.trim() !== "" && Number.isFinite(Number(e));
|
|
1492
|
-
return [...e].sort(([e], [t]) => n * (r(e) && r(t) ? Number(e) - Number(t) :
|
|
1512
|
+
return [...e].sort(([e], [t]) => n * (r(e) && r(t) ? Number(e) - Number(t) : bn.compare(e, t)));
|
|
1493
1513
|
}
|
|
1494
|
-
function
|
|
1514
|
+
function Sn(e, t) {
|
|
1495
1515
|
if (e.key === "count") return t.length;
|
|
1496
1516
|
let n = t.map((t) => t?.[e.field]).filter((e) => e != null && e !== "").map(Number).filter((e) => Number.isFinite(e));
|
|
1497
1517
|
switch (e.key) {
|
|
1498
|
-
case "sum": return n.length ?
|
|
1499
|
-
case "avg": return n.length ?
|
|
1518
|
+
case "sum": return n.length ? Cn(n.reduce((e, t) => e + t, 0)) : null;
|
|
1519
|
+
case "avg": return n.length ? Cn(n.reduce((e, t) => e + t, 0) / n.length) : null;
|
|
1500
1520
|
case "max": return n.length ? Math.max(...n) : null;
|
|
1501
1521
|
case "min": return n.length ? Math.min(...n) : null;
|
|
1502
1522
|
default: return console.warn(`Unknown aggregate "${e.key}()"; it has no value.`), null;
|
|
1503
1523
|
}
|
|
1504
1524
|
}
|
|
1505
|
-
function
|
|
1525
|
+
function Cn(e) {
|
|
1506
1526
|
return Number(e.toPrecision(12));
|
|
1507
1527
|
}
|
|
1508
1528
|
//#endregion
|
|
1509
1529
|
//#region src/engine/regions.js
|
|
1510
|
-
var
|
|
1530
|
+
var wn = {
|
|
1511
1531
|
pageHeader: "10%",
|
|
1512
1532
|
reportHeader: "10%",
|
|
1513
1533
|
reportFooter: "10%",
|
|
1514
1534
|
pageFooter: "10%"
|
|
1515
|
-
},
|
|
1516
|
-
function
|
|
1517
|
-
let r =
|
|
1518
|
-
return r === null ?
|
|
1535
|
+
}, Tn = ["pageHeader", "reportHeader"], En = ["reportFooter", "pageFooter"];
|
|
1536
|
+
function Dn(e, t, n) {
|
|
1537
|
+
let r = On(e, t);
|
|
1538
|
+
return r === null ? On(n, t) ?? 0 : r;
|
|
1519
1539
|
}
|
|
1520
|
-
function
|
|
1540
|
+
function On(e, t) {
|
|
1521
1541
|
if (typeof e == "number" && Number.isFinite(e) && e >= 0) return e;
|
|
1522
1542
|
if (typeof e == "string") {
|
|
1523
1543
|
let n = e.trim().match(/^(-?[\d.]+)\s*%$/);
|
|
@@ -1530,27 +1550,27 @@ function Tn(e, t) {
|
|
|
1530
1550
|
}
|
|
1531
1551
|
return null;
|
|
1532
1552
|
}
|
|
1533
|
-
function
|
|
1553
|
+
function kn(e, t) {
|
|
1534
1554
|
if (!e) return 0;
|
|
1535
|
-
let n =
|
|
1555
|
+
let n = Dn(e.height, t, wn[e.type]), r = e.measuredHeight ?? 0;
|
|
1536
1556
|
return r > n ? (console.warn(`Band "${e.type}" needs ${Math.ceil(r)}px but its zone is ${Math.round(n)}px; the zone has been grown to fit.`), r) : n;
|
|
1537
1557
|
}
|
|
1538
|
-
function
|
|
1558
|
+
function An({ bands: e, contentHeight: t, isFirstPage: n, isLastPage: r }) {
|
|
1539
1559
|
let i = {}, a = (e) => e === "reportHeader" ? n : e !== "reportFooter" || r, o = 0;
|
|
1540
|
-
for (let n of
|
|
1560
|
+
for (let n of Tn) {
|
|
1541
1561
|
let r = e[n];
|
|
1542
1562
|
if (!r || !a(n)) continue;
|
|
1543
|
-
let s =
|
|
1563
|
+
let s = kn(r, t);
|
|
1544
1564
|
i[n] = {
|
|
1545
1565
|
top: o,
|
|
1546
1566
|
height: s
|
|
1547
1567
|
}, o += s;
|
|
1548
1568
|
}
|
|
1549
1569
|
let s = o, c = t;
|
|
1550
|
-
for (let n of [...
|
|
1570
|
+
for (let n of [...En].reverse()) {
|
|
1551
1571
|
let r = e[n];
|
|
1552
1572
|
if (!r || !a(n)) continue;
|
|
1553
|
-
let o =
|
|
1573
|
+
let o = kn(r, t);
|
|
1554
1574
|
c -= o, i[n] = {
|
|
1555
1575
|
top: c,
|
|
1556
1576
|
height: o
|
|
@@ -1563,8 +1583,8 @@ function Dn({ bands: e, contentHeight: t, isFirstPage: n, isLastPage: r }) {
|
|
|
1563
1583
|
}
|
|
1564
1584
|
//#endregion
|
|
1565
1585
|
//#region src/engine/paginate.js
|
|
1566
|
-
var
|
|
1567
|
-
function
|
|
1586
|
+
var jn = /\{([^{}]+)\}/g, Mn = ["page", "totalPages"];
|
|
1587
|
+
function Nn(e) {
|
|
1568
1588
|
let t = structuredClone(e), n = {
|
|
1569
1589
|
page: t.page,
|
|
1570
1590
|
bands: t.bands,
|
|
@@ -1576,12 +1596,12 @@ function An(e) {
|
|
|
1576
1596
|
detail: t.bands.find((e) => e.type === "detail")
|
|
1577
1597
|
}
|
|
1578
1598
|
};
|
|
1579
|
-
return n.availableHeight =
|
|
1599
|
+
return n.availableHeight = Gn(t.page), n.regionsFor = (e, t) => An({
|
|
1580
1600
|
bands: n.assignedBands,
|
|
1581
1601
|
contentHeight: n.availableHeight,
|
|
1582
1602
|
isFirstPage: e === 1,
|
|
1583
1603
|
isLastPage: t
|
|
1584
|
-
}), t.pages =
|
|
1604
|
+
}), t.pages = Kn(Ln(t.bands.filter((e) => ![
|
|
1585
1605
|
"reportHeader",
|
|
1586
1606
|
"reportFooter",
|
|
1587
1607
|
"pageHeader",
|
|
@@ -1590,7 +1610,7 @@ function An(e) {
|
|
|
1590
1610
|
"groupFooter"
|
|
1591
1611
|
].includes(e.type)), n)), t;
|
|
1592
1612
|
}
|
|
1593
|
-
function
|
|
1613
|
+
function Pn(e, t, n, r = Infinity) {
|
|
1594
1614
|
let i = 0, a = 0;
|
|
1595
1615
|
for (; t + a < e.length && a < r;) {
|
|
1596
1616
|
let r = i + e[t + a];
|
|
@@ -1599,18 +1619,18 @@ function jn(e, t, n, r = Infinity) {
|
|
|
1599
1619
|
}
|
|
1600
1620
|
return a;
|
|
1601
1621
|
}
|
|
1602
|
-
function
|
|
1603
|
-
return
|
|
1622
|
+
function Fn(e, t, n) {
|
|
1623
|
+
return z(e.slice(t, t + n));
|
|
1604
1624
|
}
|
|
1605
|
-
function
|
|
1625
|
+
function In(e, t, n) {
|
|
1606
1626
|
return Array.isArray(n) && n.length === (t ?? []).length ? n : (t ?? []).map(() => e.rowHeight ?? 0);
|
|
1607
1627
|
}
|
|
1608
|
-
function
|
|
1609
|
-
let n = [], r =
|
|
1628
|
+
function Ln(e, t) {
|
|
1629
|
+
let n = [], r = Wn(1, t);
|
|
1610
1630
|
n.push(r);
|
|
1611
1631
|
let { assignedBands: i, availableHeight: a } = t, { reportFooter: s, reportHeader: c, pageHeader: d, pageFooter: f } = i, p = t.regionsFor(2, !1).detail.height;
|
|
1612
1632
|
c && r.regions.detail.height <= 0 && console.warn("The header zones leave no room for detail on page 1. Reduce the reportHeader or pageHeader height.");
|
|
1613
|
-
let m = 0, h = 0, g = [], _ = () => r.regions.detail.height, v = (e, i, a) => (e.items.length > 0 && r.bands.push(e), r =
|
|
1633
|
+
let m = 0, h = 0, g = [], _ = () => r.regions.detail.height, v = (e, i, a) => (e.items.length > 0 && r.bands.push(e), r = Wn(n.length + 1, t), n.push(r), m = 0, h = a, g = [], {
|
|
1614
1634
|
...i,
|
|
1615
1635
|
items: []
|
|
1616
1636
|
}), y = (e, t) => {
|
|
@@ -1636,28 +1656,28 @@ function Pn(e, t) {
|
|
|
1636
1656
|
...structuredClone(r),
|
|
1637
1657
|
y: x(n)
|
|
1638
1658
|
});
|
|
1639
|
-
else if (r.type == "table" && (i > _() ||
|
|
1659
|
+
else if (r.type == "table" && (i > _() || zn(r))) {
|
|
1640
1660
|
let i = x(n);
|
|
1641
1661
|
if (r.groups) {
|
|
1642
|
-
let a = r.headerMeasured ??
|
|
1662
|
+
let a = r.headerMeasured ?? at(r), s = o(r), c = (e, t, n) => {
|
|
1643
1663
|
let i = l(r, e, t, n);
|
|
1644
1664
|
return {
|
|
1645
1665
|
frame: i,
|
|
1646
|
-
above: (i.columnHeader ? a : 0) +
|
|
1647
|
-
below:
|
|
1666
|
+
above: (i.columnHeader ? a : 0) + mt(i.headers),
|
|
1667
|
+
below: mt(i.footers)
|
|
1648
1668
|
};
|
|
1649
|
-
}, d = a + Math.max(r.rowHeight ?? 0, ...(r.groups ?? []).flatMap((e) =>
|
|
1669
|
+
}, d = a + Math.max(r.rowHeight ?? 0, ...(r.groups ?? []).flatMap((e) => In(r, e.rows, e.rowHeights))) + z(s.map((e) => e?.header?.measuredHeight ?? 0)) + z(s.map((e) => e?.footer?.measuredHeight ?? 0));
|
|
1650
1670
|
d <= p || console.warn(`Table "${r.id}": table header + group headers + one row + group footers (${d}px) exceeds the ${p}px printable page. Falling back to one row per page; rows will overflow their page.`);
|
|
1651
1671
|
let f = (e, t, n, r, i, a) => {
|
|
1652
1672
|
let o = n - i;
|
|
1653
|
-
return r <=
|
|
1673
|
+
return r <= Pn(e, t, o - a, r) ? r : Math.min(Pn(e, t, o, r), r - 1);
|
|
1654
1674
|
}, m = [], h = 0;
|
|
1655
1675
|
for (let [a, o] of r.groups.entries()) {
|
|
1656
1676
|
if (u(r, o, a) && m.length > 0) {
|
|
1657
1677
|
let a = structuredClone(r);
|
|
1658
1678
|
a.groups = m, a.y = i, a.measuredHeight = h, y(e, a), e = v(e, t, n), m = [], h = 0, i = 0;
|
|
1659
1679
|
}
|
|
1660
|
-
let s = 0, l = o.rows.length, d =
|
|
1680
|
+
let s = 0, l = o.rows.length, d = In(r, o.rows, o.rowHeights);
|
|
1661
1681
|
for (; s < l;) {
|
|
1662
1682
|
let a = _() - i - h, u = m.length === 0, g = u && e.items.length === 0 && i === 0 && _() >= p, { above: b } = c(o, u, !1), { below: x } = c(o, u, !0), S = f(d, s, a, l - s, b, x);
|
|
1663
1683
|
if (S < 1 && g && (S = 1), S < 1) {
|
|
@@ -1671,7 +1691,7 @@ function Pn(e, t) {
|
|
|
1671
1691
|
let C = o.rows.slice(s, s + S), w = d.slice(s, s + S);
|
|
1672
1692
|
s += C.length;
|
|
1673
1693
|
let T = s < l, { frame: E, above: D, below: O } = c(o, u, !T);
|
|
1674
|
-
h +=
|
|
1694
|
+
h += z(w) + D + O, m.push(Vn(o, E, C, w, !T));
|
|
1675
1695
|
}
|
|
1676
1696
|
}
|
|
1677
1697
|
if (m.length > 0) {
|
|
@@ -1679,22 +1699,22 @@ function Pn(e, t) {
|
|
|
1679
1699
|
t.groups = m, t.y = i, t.measuredHeight = h, y(e, t), m = [];
|
|
1680
1700
|
}
|
|
1681
1701
|
} else {
|
|
1682
|
-
let a = r.row.length, o = 0, s = r.headerMeasured ??
|
|
1702
|
+
let a = r.row.length, o = 0, s = r.headerMeasured ?? at(r), c = In(r, r.row, r.rowHeights), l = Math.max(r.rowHeight ?? 0, ...c);
|
|
1683
1703
|
for (p - s >= l || console.warn(`Table "${r.id}": its tallest row is ${Math.ceil(l)}px, which with the ${s}px header exceeds the ${p}px printable page. Falling back to one row per page; rows will overflow their page.`); o < a;) {
|
|
1684
|
-
let l = _() - i, u =
|
|
1704
|
+
let l = _() - i, u = Pn(c, o, l - s, a - o), d = e.items.length === 0 && i === 0 && _() >= p;
|
|
1685
1705
|
if (u < 1 && d && (u = 1), u < 1) {
|
|
1686
1706
|
e = v(e, t, n), i = 0;
|
|
1687
1707
|
continue;
|
|
1688
1708
|
}
|
|
1689
1709
|
u = Math.min(u, a - o);
|
|
1690
|
-
let f = structuredClone(r), m = r.row.slice(o, o + u), h =
|
|
1710
|
+
let f = structuredClone(r), m = r.row.slice(o, o + u), h = Fn(c, o, u) + s;
|
|
1691
1711
|
f.row = m, f.rowHeights = c.slice(o, o + u), f.y = i, f.measuredHeight = h, y(e, f), o += m.length, o < a && (e = v(e, t, n), i = 0);
|
|
1692
1712
|
}
|
|
1693
1713
|
}
|
|
1694
1714
|
} else {
|
|
1695
1715
|
let t = r.type === "table" && r.groups ? {
|
|
1696
1716
|
...r,
|
|
1697
|
-
groups:
|
|
1717
|
+
groups: Bn(r)
|
|
1698
1718
|
} : r;
|
|
1699
1719
|
y(e, {
|
|
1700
1720
|
...structuredClone(t),
|
|
@@ -1703,7 +1723,7 @@ function Pn(e, t) {
|
|
|
1703
1723
|
}
|
|
1704
1724
|
let a = [...e.items].reverse().find((e) => e.id === r.id);
|
|
1705
1725
|
a && g.push({
|
|
1706
|
-
designBottom: n - h +
|
|
1726
|
+
designBottom: n - h + ot(r),
|
|
1707
1727
|
actualBottom: (a.y ?? 0) + (a.measuredHeight ?? 0)
|
|
1708
1728
|
});
|
|
1709
1729
|
}
|
|
@@ -1713,26 +1733,26 @@ function Pn(e, t) {
|
|
|
1713
1733
|
});
|
|
1714
1734
|
}
|
|
1715
1735
|
if (s) {
|
|
1716
|
-
let e =
|
|
1717
|
-
r.usedHeight + e > a && (r =
|
|
1736
|
+
let e = kn(s, a);
|
|
1737
|
+
r.usedHeight + e > a && (r = Wn(n.length + 1, t), n.push(r)), r.bands.push(structuredClone(s)), r.usedHeight += e;
|
|
1718
1738
|
}
|
|
1719
1739
|
let S = n[n.length - 1];
|
|
1720
|
-
return S.regions = t.regionsFor(S.pageNO, !!s),
|
|
1740
|
+
return S.regions = t.regionsFor(S.pageNO, !!s), Rn(n), n;
|
|
1721
1741
|
}
|
|
1722
|
-
function
|
|
1742
|
+
function Rn(e) {
|
|
1723
1743
|
for (let t of e) for (let e of t.bands) {
|
|
1724
1744
|
let n = t.regions[e.type] ?? t.regions.detail;
|
|
1725
1745
|
e.top = n.top, e.zoneHeight = n.height;
|
|
1726
1746
|
}
|
|
1727
1747
|
}
|
|
1728
|
-
function
|
|
1748
|
+
function zn(e) {
|
|
1729
1749
|
return Array.isArray(e.groups) && e.groups.some((t, n) => u(e, t, n));
|
|
1730
1750
|
}
|
|
1731
|
-
function
|
|
1732
|
-
return e.groups.map((t, n) =>
|
|
1751
|
+
function Bn(e) {
|
|
1752
|
+
return e.groups.map((t, n) => Vn(t, l(e, t, n === 0, !0), t.rows, t.rowHeights, !0));
|
|
1733
1753
|
}
|
|
1734
|
-
function
|
|
1735
|
-
let a = (e.levels?.length ?? 1) - 1, o = ({ level: t, band: r }) =>
|
|
1754
|
+
function Vn(e, t, n, r, i) {
|
|
1755
|
+
let a = (e.levels?.length ?? 1) - 1, o = ({ level: t, band: r }) => Hn(r, e.levels?.[t] ?? e, n[0], t), s = t.headers.map(o), c = t.footers.map(o);
|
|
1736
1756
|
return {
|
|
1737
1757
|
key: e.key,
|
|
1738
1758
|
path: e.path ?? [e.key],
|
|
@@ -1747,36 +1767,36 @@ function Rn(e, t, n, r, i) {
|
|
|
1747
1767
|
footerBand: c.find((e) => e.level === a) ?? null
|
|
1748
1768
|
};
|
|
1749
1769
|
}
|
|
1750
|
-
function
|
|
1770
|
+
function Hn(e, t, n, r = 0) {
|
|
1751
1771
|
if (!e) return null;
|
|
1752
1772
|
let i = structuredClone(e);
|
|
1753
1773
|
i.level = r;
|
|
1754
1774
|
for (let e of i.items) {
|
|
1755
1775
|
if (e.type !== "text") continue;
|
|
1756
|
-
let r =
|
|
1757
|
-
e.text = (e.text ?? e.value).replace(
|
|
1758
|
-
let o =
|
|
1759
|
-
return r === a.trim() && o.value !== void 0 && (e.raw = o.value, o.share && (e.rawFormat =
|
|
1776
|
+
let r = Ut(e.value);
|
|
1777
|
+
e.text = (e.text ?? e.value).replace(jn, (i, a) => {
|
|
1778
|
+
let o = Un(i, a.trim(), t, n);
|
|
1779
|
+
return r === a.trim() && o.value !== void 0 && (e.raw = o.value, o.share && (e.rawFormat = j(e.format))), o.value === void 0 ? o.text : o.value == null ? "" : o.share ? M(o.value, j(e.format)) : M(o.value, o.count ? null : e.format);
|
|
1760
1780
|
});
|
|
1761
|
-
let i =
|
|
1781
|
+
let i = ye(e.highlight, mn(e), n);
|
|
1762
1782
|
i && (e.highlighted = i);
|
|
1763
1783
|
}
|
|
1764
1784
|
return i;
|
|
1765
1785
|
}
|
|
1766
|
-
function
|
|
1767
|
-
if (
|
|
1786
|
+
function Un(e, t, n, r) {
|
|
1787
|
+
if (Mn.includes(t)) return { text: e };
|
|
1768
1788
|
let i = t.match(/^(\w+)\((.*?)\)$/);
|
|
1769
1789
|
if (i) {
|
|
1770
1790
|
let [, e, t] = i;
|
|
1771
1791
|
return {
|
|
1772
1792
|
value: n.aggregates?.[t]?.[e.trim()] ?? null,
|
|
1773
1793
|
count: e.trim() === "count",
|
|
1774
|
-
share: e.trim() ===
|
|
1794
|
+
share: e.trim() === ln
|
|
1775
1795
|
};
|
|
1776
1796
|
}
|
|
1777
1797
|
return { value: r?.[t] ?? null };
|
|
1778
1798
|
}
|
|
1779
|
-
function
|
|
1799
|
+
function Wn(e, t) {
|
|
1780
1800
|
let { pageHeader: n, pageFooter: r, reportHeader: i } = t.assignedBands, a = t.regionsFor(e, !1), o = [];
|
|
1781
1801
|
return n && o.push(structuredClone(n)), r && o.push(structuredClone(r)), i && e === 1 && o.push(structuredClone(i)), {
|
|
1782
1802
|
pageNO: e,
|
|
@@ -1785,19 +1805,19 @@ function Vn(e, t) {
|
|
|
1785
1805
|
usedHeight: t.availableHeight - a.detail.height
|
|
1786
1806
|
};
|
|
1787
1807
|
}
|
|
1788
|
-
function
|
|
1808
|
+
function Gn(e) {
|
|
1789
1809
|
return e.height - (e.margin.top + e.margin.bottom);
|
|
1790
1810
|
}
|
|
1791
|
-
function
|
|
1792
|
-
for (let t of e) for (let n of t.bands)
|
|
1811
|
+
function Kn(e) {
|
|
1812
|
+
for (let t of e) for (let n of t.bands) qn(n, t.pageNO, e.length);
|
|
1793
1813
|
return e;
|
|
1794
1814
|
}
|
|
1795
|
-
function
|
|
1815
|
+
function qn(e, t, n) {
|
|
1796
1816
|
for (let r of e?.items ?? []) {
|
|
1797
1817
|
if (r.type === "text") {
|
|
1798
1818
|
let e = r.text ?? r.value ?? "";
|
|
1799
1819
|
if (!e.includes("{")) continue;
|
|
1800
|
-
r.text = e.replace(
|
|
1820
|
+
r.text = e.replace(jn, (e, r) => {
|
|
1801
1821
|
switch (r.trim()) {
|
|
1802
1822
|
case "page": return t;
|
|
1803
1823
|
case "totalPages": return n;
|
|
@@ -1808,26 +1828,26 @@ function Wn(e, t, n) {
|
|
|
1808
1828
|
}
|
|
1809
1829
|
if (r.type === "table" && r.groups) for (let e of r.groups) {
|
|
1810
1830
|
let { headers: r, footers: i } = d(e);
|
|
1811
|
-
for (let e of [...r, ...i])
|
|
1831
|
+
for (let e of [...r, ...i]) qn(e, t, n);
|
|
1812
1832
|
}
|
|
1813
1833
|
}
|
|
1814
1834
|
}
|
|
1815
1835
|
//#endregion
|
|
1816
1836
|
//#region src/engine/search.js
|
|
1817
|
-
function
|
|
1837
|
+
function Jn(e, t, { caseSensitive: n = !1 } = {}) {
|
|
1818
1838
|
let r = String(t ?? "");
|
|
1819
1839
|
if (r === "") return [];
|
|
1820
1840
|
let i = [];
|
|
1821
|
-
for (let t of e ?? []) for (let e of t.bands ?? [])
|
|
1841
|
+
for (let t of e ?? []) for (let e of t.bands ?? []) Xn(e, t.pageNO, e.type, r, n, i);
|
|
1822
1842
|
return i;
|
|
1823
1843
|
}
|
|
1824
|
-
function
|
|
1825
|
-
return [...new Set(
|
|
1844
|
+
function Yn(e, t, n) {
|
|
1845
|
+
return [...new Set(Jn(e, t, n).map((e) => e.pageNO))];
|
|
1826
1846
|
}
|
|
1827
|
-
function
|
|
1847
|
+
function Xn(e, t, n, r, i, a) {
|
|
1828
1848
|
for (let o of e?.items ?? []) {
|
|
1829
1849
|
if (o.type === "text") {
|
|
1830
|
-
|
|
1850
|
+
$n(a, o.text, {
|
|
1831
1851
|
pageNO: t,
|
|
1832
1852
|
bandType: n,
|
|
1833
1853
|
itemId: o.id,
|
|
@@ -1835,37 +1855,37 @@ function qn(e, t, n, r, i, a) {
|
|
|
1835
1855
|
}, r, i);
|
|
1836
1856
|
continue;
|
|
1837
1857
|
}
|
|
1838
|
-
o.type === "table" &&
|
|
1858
|
+
o.type === "table" && Zn(o, t, n, r, i, a);
|
|
1839
1859
|
}
|
|
1840
1860
|
}
|
|
1841
|
-
function
|
|
1861
|
+
function Zn(e, t, n, r, i, a) {
|
|
1842
1862
|
let o = e.columns ?? [];
|
|
1843
|
-
if (e.showHeader) for (let s of o)
|
|
1863
|
+
if (e.showHeader) for (let s of o) $n(a, s.label, {
|
|
1844
1864
|
pageNO: t,
|
|
1845
1865
|
bandType: n,
|
|
1846
1866
|
itemId: e.id,
|
|
1847
1867
|
field: s.field
|
|
1848
1868
|
}, r, i);
|
|
1849
1869
|
if (e.row) {
|
|
1850
|
-
|
|
1870
|
+
Qn(e.row, o, e.id, t, n, r, i, a);
|
|
1851
1871
|
return;
|
|
1852
1872
|
}
|
|
1853
1873
|
for (let s of e.groups ?? []) {
|
|
1854
1874
|
let { headers: c, footers: l } = d(s);
|
|
1855
|
-
for (let e of c)
|
|
1856
|
-
|
|
1857
|
-
for (let e of l)
|
|
1875
|
+
for (let e of c) Xn(e, t, "groupHeader", r, i, a);
|
|
1876
|
+
Qn(s.rows, o, e.id, t, n, r, i, a);
|
|
1877
|
+
for (let e of l) Xn(e, t, "groupFooter", r, i, a);
|
|
1858
1878
|
}
|
|
1859
1879
|
}
|
|
1860
|
-
function
|
|
1861
|
-
for (let c of e ?? []) for (let e of t)
|
|
1880
|
+
function Qn(e, t, n, r, i, a, o, s) {
|
|
1881
|
+
for (let c of e ?? []) for (let e of t) $n(s, M(c?.[e.field], e.format), {
|
|
1862
1882
|
pageNO: r,
|
|
1863
1883
|
bandType: i,
|
|
1864
1884
|
itemId: n,
|
|
1865
1885
|
field: e.field
|
|
1866
1886
|
}, a, o);
|
|
1867
1887
|
}
|
|
1868
|
-
function
|
|
1888
|
+
function $n(e, t, n, r, i) {
|
|
1869
1889
|
if (t == null) return;
|
|
1870
1890
|
let a = String(t), o = i ? a : a.toLowerCase(), s = i ? r : r.toLowerCase(), c = 0;
|
|
1871
1891
|
for (; c <= o.length - s.length;) {
|
|
@@ -1881,18 +1901,18 @@ function Xn(e, t, n, r, i) {
|
|
|
1881
1901
|
}
|
|
1882
1902
|
//#endregion
|
|
1883
1903
|
//#region src/engine/rows.js
|
|
1884
|
-
var
|
|
1904
|
+
var er = [
|
|
1885
1905
|
"image",
|
|
1886
1906
|
"line",
|
|
1887
1907
|
"box"
|
|
1888
1908
|
];
|
|
1889
|
-
function
|
|
1890
|
-
return
|
|
1909
|
+
function tr(e) {
|
|
1910
|
+
return nr(e).rows.filter((e) => !e.spacer);
|
|
1891
1911
|
}
|
|
1892
|
-
function
|
|
1912
|
+
function nr(e) {
|
|
1893
1913
|
let t = [], n = [];
|
|
1894
1914
|
return (e ?? []).forEach((e, r) => {
|
|
1895
|
-
for (let i of
|
|
1915
|
+
for (let i of ur(e?.bands)) dr(i, t, {
|
|
1896
1916
|
page: r,
|
|
1897
1917
|
origin: Number(i?.top) || 0,
|
|
1898
1918
|
graphics: n
|
|
@@ -1902,7 +1922,7 @@ function $n(e) {
|
|
|
1902
1922
|
graphics: n
|
|
1903
1923
|
};
|
|
1904
1924
|
}
|
|
1905
|
-
function
|
|
1925
|
+
function rr(e, t = null) {
|
|
1906
1926
|
let n = null, r = t, i = null, a = [];
|
|
1907
1927
|
for (let t of e ?? []) for (let e of t.bands ?? []) for (let t of e.items ?? []) if (t.type === "table" && !(r !== null && t.id !== r)) {
|
|
1908
1928
|
if (n === null && (r = t.id, n = t.columns ?? [], i = t), t.row) {
|
|
@@ -1910,7 +1930,7 @@ function er(e, t = null) {
|
|
|
1910
1930
|
a.push({
|
|
1911
1931
|
group: null,
|
|
1912
1932
|
row: e,
|
|
1913
|
-
height:
|
|
1933
|
+
height: cr(t, t.rowHeights, n)
|
|
1914
1934
|
});
|
|
1915
1935
|
});
|
|
1916
1936
|
continue;
|
|
@@ -1922,7 +1942,7 @@ function er(e, t = null) {
|
|
|
1922
1942
|
group: e.key,
|
|
1923
1943
|
groups: n,
|
|
1924
1944
|
row: r,
|
|
1925
|
-
height:
|
|
1945
|
+
height: cr(t, e.rowHeights, i)
|
|
1926
1946
|
});
|
|
1927
1947
|
});
|
|
1928
1948
|
}
|
|
@@ -1930,16 +1950,16 @@ function er(e, t = null) {
|
|
|
1930
1950
|
return n === null ? null : {
|
|
1931
1951
|
id: r,
|
|
1932
1952
|
columns: n,
|
|
1933
|
-
table:
|
|
1934
|
-
headerHeight:
|
|
1953
|
+
table: or(i),
|
|
1954
|
+
headerHeight: sr(i),
|
|
1935
1955
|
rows: a,
|
|
1936
1956
|
groupBy: o(i).map((e) => e?.by ?? null)
|
|
1937
1957
|
};
|
|
1938
1958
|
}
|
|
1939
|
-
function
|
|
1959
|
+
function ir(e, t = "Group") {
|
|
1940
1960
|
let n = (e) => e.groups ?? (e.group == null ? [] : [e.group]), r = Math.max(0, ...e.rows.map((e) => n(e).length)), i = (t) => {
|
|
1941
1961
|
let n = e.groupBy?.[t], r = e.columns.find((e) => n != null && e.field === n);
|
|
1942
|
-
return r ?
|
|
1962
|
+
return r ? V(r) : n ?? `Group ${t + 1}`;
|
|
1943
1963
|
};
|
|
1944
1964
|
return {
|
|
1945
1965
|
labels: Array.from({ length: r }, (e, n) => Array.isArray(t) ? t[n] ?? i(n) : r === 1 ? t : i(n)),
|
|
@@ -1949,38 +1969,38 @@ function tr(e, t = "Group") {
|
|
|
1949
1969
|
}
|
|
1950
1970
|
};
|
|
1951
1971
|
}
|
|
1952
|
-
function
|
|
1972
|
+
function ar(e) {
|
|
1953
1973
|
let t = /* @__PURE__ */ new Map();
|
|
1954
1974
|
for (let n of e ?? []) for (let e of n.bands ?? []) for (let n of e.items ?? []) n.type !== "table" || t.has(n.id) || t.set(n.id, {
|
|
1955
1975
|
id: n.id,
|
|
1956
|
-
columns: (n.columns ?? []).map(
|
|
1976
|
+
columns: (n.columns ?? []).map(V)
|
|
1957
1977
|
});
|
|
1958
1978
|
return [...t.values()];
|
|
1959
1979
|
}
|
|
1960
|
-
function
|
|
1980
|
+
function or(e) {
|
|
1961
1981
|
return {
|
|
1962
1982
|
style: e.style ?? {},
|
|
1963
1983
|
wrap: e.wrap !== !1,
|
|
1964
1984
|
rowHighlight: e.rowHighlight ?? null
|
|
1965
1985
|
};
|
|
1966
1986
|
}
|
|
1967
|
-
function
|
|
1987
|
+
function sr(e) {
|
|
1968
1988
|
return e.headerMeasured ?? e.headerHeight ?? e.rowHeight ?? null;
|
|
1969
1989
|
}
|
|
1970
|
-
function
|
|
1990
|
+
function cr(e, t, n) {
|
|
1971
1991
|
return t?.[n] ?? e.rowHeight ?? null;
|
|
1972
1992
|
}
|
|
1973
|
-
function
|
|
1993
|
+
function lr(e) {
|
|
1974
1994
|
return Number(e?.measuredHeight ?? e?.height) || 0;
|
|
1975
1995
|
}
|
|
1976
|
-
function
|
|
1996
|
+
function V(e) {
|
|
1977
1997
|
return e.label ?? e.field;
|
|
1978
1998
|
}
|
|
1979
|
-
function
|
|
1999
|
+
function ur(e) {
|
|
1980
2000
|
return [...e ?? []].sort((e, t) => (e?.top ?? 0) - (t?.top ?? 0));
|
|
1981
2001
|
}
|
|
1982
|
-
function
|
|
1983
|
-
let { page: r, origin: i } = n, a = t.length, o = [...e?.items ?? []].sort((e, t) => (e?.y ?? 0) - (t?.y ?? 0) || (e?.x ?? 0) - (t?.x ?? 0)), s = o.filter((e) =>
|
|
2002
|
+
function dr(e, t, n) {
|
|
2003
|
+
let { page: r, origin: i } = n, a = t.length, o = [...e?.items ?? []].sort((e, t) => (e?.y ?? 0) - (t?.y ?? 0) || (e?.x ?? 0) - (t?.x ?? 0)), s = o.filter((e) => er.includes(e?.type)).map((e) => ({
|
|
1984
2004
|
kind: e.type,
|
|
1985
2005
|
page: r,
|
|
1986
2006
|
x: Number(e.x) || 0,
|
|
@@ -2011,7 +2031,7 @@ function lr(e, t, n) {
|
|
|
2011
2031
|
});
|
|
2012
2032
|
for (let e of o) {
|
|
2013
2033
|
if (e?.type === "table") {
|
|
2014
|
-
l(),
|
|
2034
|
+
l(), gr(e, t, {
|
|
2015
2035
|
...n,
|
|
2016
2036
|
origin: i + (Number(e.y) || 0)
|
|
2017
2037
|
});
|
|
@@ -2019,7 +2039,7 @@ function lr(e, t, n) {
|
|
|
2019
2039
|
}
|
|
2020
2040
|
if (e?.type !== "text") continue;
|
|
2021
2041
|
let r = u(e);
|
|
2022
|
-
if (c &&
|
|
2042
|
+
if (c && hr(c.anchor, e)) {
|
|
2023
2043
|
c.cells.push(e.text), c.design.push(r), c.top = Math.min(c.top, r.y), c.bottom = Math.max(c.bottom, r.y + r.h);
|
|
2024
2044
|
continue;
|
|
2025
2045
|
}
|
|
@@ -2031,14 +2051,14 @@ function lr(e, t, n) {
|
|
|
2031
2051
|
bottom: r.y + r.h
|
|
2032
2052
|
};
|
|
2033
2053
|
}
|
|
2034
|
-
l(),
|
|
2054
|
+
l(), pr(t, a, s, r), n.graphics.push(...s);
|
|
2035
2055
|
}
|
|
2036
|
-
var
|
|
2037
|
-
function
|
|
2056
|
+
var fr = 4;
|
|
2057
|
+
function pr(e, t, n, r) {
|
|
2038
2058
|
let i = e.slice(t).map((e) => [e.top, e.top + (e.height ?? 0)]), a = [];
|
|
2039
2059
|
for (let e of n) {
|
|
2040
|
-
let t = [e.y, e.y + Math.max(e.h, 1)], n =
|
|
2041
|
-
for (let e of n) (r || e[1] - e[0] >=
|
|
2060
|
+
let t = [e.y, e.y + Math.max(e.h, 1)], n = mr(t, i), r = n.length === 1 && n[0][0] === t[0] && n[0][1] === t[1];
|
|
2061
|
+
for (let e of n) (r || e[1] - e[0] >= fr) && a.push(e);
|
|
2042
2062
|
}
|
|
2043
2063
|
let o = [];
|
|
2044
2064
|
for (let [e, t] of a.sort((e, t) => e[0] - t[0])) {
|
|
@@ -2063,7 +2083,7 @@ function dr(e, t, n, r) {
|
|
|
2063
2083
|
e.splice(r, 0, n);
|
|
2064
2084
|
}
|
|
2065
2085
|
}
|
|
2066
|
-
function
|
|
2086
|
+
function mr([e, t], n) {
|
|
2067
2087
|
let r = [[e, t]];
|
|
2068
2088
|
for (let [e, t] of n) t > e && (r = r.flatMap(([n, r]) => {
|
|
2069
2089
|
if (t <= n || e >= r) return [[n, r]];
|
|
@@ -2072,18 +2092,18 @@ function fr([e, t], n) {
|
|
|
2072
2092
|
}));
|
|
2073
2093
|
return r;
|
|
2074
2094
|
}
|
|
2075
|
-
function
|
|
2095
|
+
function hr(e, t) {
|
|
2076
2096
|
let n = (e) => {
|
|
2077
2097
|
let t = e.y ?? 0;
|
|
2078
2098
|
return [t, t + (e.measuredHeight ?? e.h ?? 0)];
|
|
2079
2099
|
}, [r, i] = n(e), [a, o] = n(t);
|
|
2080
2100
|
return Math.min(i, o) - Math.max(r, a) >= Math.min(i - r, o - a) / 2;
|
|
2081
2101
|
}
|
|
2082
|
-
function
|
|
2083
|
-
let r =
|
|
2084
|
-
let n =
|
|
2102
|
+
function gr(e, t, n) {
|
|
2103
|
+
let r = or(e), { page: i } = n, a = n.origin, o = () => {
|
|
2104
|
+
let n = sr(e);
|
|
2085
2105
|
t.push({
|
|
2086
|
-
cells: e.columns.map(
|
|
2106
|
+
cells: e.columns.map(V),
|
|
2087
2107
|
header: !0,
|
|
2088
2108
|
design: e.columns.map((e) => ({
|
|
2089
2109
|
kind: "head",
|
|
@@ -2102,62 +2122,62 @@ function mr(e, t, n) {
|
|
|
2102
2122
|
kind: "cell",
|
|
2103
2123
|
column: t,
|
|
2104
2124
|
table: r,
|
|
2105
|
-
highlight:
|
|
2125
|
+
highlight: be(e, t, n)
|
|
2106
2126
|
})),
|
|
2107
2127
|
page: i,
|
|
2108
2128
|
top: a,
|
|
2109
2129
|
height: o
|
|
2110
2130
|
}), a += Number(o) || 0;
|
|
2111
2131
|
}, c = (e) => {
|
|
2112
|
-
|
|
2132
|
+
dr(e, t, {
|
|
2113
2133
|
...n,
|
|
2114
2134
|
origin: a
|
|
2115
|
-
}), a +=
|
|
2135
|
+
}), a += lr(e);
|
|
2116
2136
|
};
|
|
2117
2137
|
if (!e.groups) {
|
|
2118
|
-
e.showHeader && o(), (e.row ?? []).forEach((t, n) => s(t,
|
|
2138
|
+
e.showHeader && o(), (e.row ?? []).forEach((t, n) => s(t, cr(e, e.rowHeights, n)));
|
|
2119
2139
|
return;
|
|
2120
2140
|
}
|
|
2121
2141
|
for (let t of e.groups) {
|
|
2122
2142
|
let { headers: n, footers: r } = d(t);
|
|
2123
|
-
t.showHeader && e.showHeader && o(), n.forEach((e) => c(e)), t.rows.forEach((n, r) => s(n,
|
|
2143
|
+
t.showHeader && e.showHeader && o(), n.forEach((e) => c(e)), t.rows.forEach((n, r) => s(n, cr(e, t.rowHeights, r))), r.forEach((e) => c(e));
|
|
2124
2144
|
}
|
|
2125
2145
|
}
|
|
2126
2146
|
//#endregion
|
|
2127
2147
|
//#region src/engine/csv.js
|
|
2128
|
-
var
|
|
2129
|
-
function
|
|
2130
|
-
let { delimiter: n = ",", newline: r = "\r\n", header: i = !0, groupColumn: a = !0, groupLabel: o = "Group", neutraliseFormulas: s = !0, formatted: c = !1, table: l = null } = t, u =
|
|
2148
|
+
var _r = /^[=+\-@\t\r]/;
|
|
2149
|
+
function vr(e, t = {}) {
|
|
2150
|
+
let { delimiter: n = ",", newline: r = "\r\n", header: i = !0, groupColumn: a = !0, groupLabel: o = "Group", neutraliseFormulas: s = !0, formatted: c = !1, table: l = null } = t, u = rr(e, l);
|
|
2131
2151
|
if (!u) return "";
|
|
2132
|
-
let d = a ?
|
|
2152
|
+
let d = a ? ir(u, o) : {
|
|
2133
2153
|
labels: [],
|
|
2134
2154
|
cells: () => []
|
|
2135
|
-
}, f = u.columns.map(
|
|
2136
|
-
i && p.push(
|
|
2155
|
+
}, f = u.columns.map(V), p = [];
|
|
2156
|
+
i && p.push(br([...d.labels, ...f], n, s));
|
|
2137
2157
|
for (let e of u.rows) {
|
|
2138
|
-
let t = u.columns.map((t) => c ?
|
|
2139
|
-
p.push(
|
|
2158
|
+
let t = u.columns.map((t) => c ? M(e.row?.[t.field], t.format) : e.row?.[t.field]);
|
|
2159
|
+
p.push(br([...d.cells(e), ...t], n, s));
|
|
2140
2160
|
}
|
|
2141
2161
|
return p.join(r);
|
|
2142
2162
|
}
|
|
2143
|
-
function
|
|
2144
|
-
let { delimiter: n = ",", newline: r = "\r\n", neutraliseFormulas: i = !0 } = t, a =
|
|
2145
|
-
return a.length === 0 ? "" : a.map(({ cells: e }) =>
|
|
2163
|
+
function yr(e, t = {}) {
|
|
2164
|
+
let { delimiter: n = ",", newline: r = "\r\n", neutraliseFormulas: i = !0 } = t, a = tr(e);
|
|
2165
|
+
return a.length === 0 ? "" : a.map(({ cells: e }) => br(e, n, i)).join(r);
|
|
2146
2166
|
}
|
|
2147
|
-
function
|
|
2167
|
+
function H(e, t = "csv") {
|
|
2148
2168
|
return `${String(e?.name ?? "report").replace(/[\\/:*?"<>|]+/g, "-").replace(/\s+/g, " ").trim() || "report"}.${t}`;
|
|
2149
2169
|
}
|
|
2150
|
-
function
|
|
2151
|
-
return e.map((e) =>
|
|
2170
|
+
function br(e, t, n) {
|
|
2171
|
+
return e.map((e) => xr(e, t, n)).join(t);
|
|
2152
2172
|
}
|
|
2153
|
-
function
|
|
2173
|
+
function xr(e, t, n) {
|
|
2154
2174
|
if (e == null) return "";
|
|
2155
2175
|
let r = String(e);
|
|
2156
|
-
return n &&
|
|
2176
|
+
return n && _r.test(r) && (r = `\t${r}`), r.includes(t) || r.includes("\"") || r.includes("\n") || r.includes("\r") ? `"${r.replace(/"/g, "\"\"")}"` : r;
|
|
2157
2177
|
}
|
|
2158
2178
|
//#endregion
|
|
2159
2179
|
//#region src/engine/xlsx-style.js
|
|
2160
|
-
var
|
|
2180
|
+
var U = Object.freeze({
|
|
2161
2181
|
fontFamily: "Helvetica, Arial, sans-serif",
|
|
2162
2182
|
fontSize: 12,
|
|
2163
2183
|
headerWeight: 600,
|
|
@@ -2166,7 +2186,7 @@ var W = Object.freeze({
|
|
|
2166
2186
|
ruleWidth: 1,
|
|
2167
2187
|
ruleStyle: "solid",
|
|
2168
2188
|
cellPadding: 8
|
|
2169
|
-
}),
|
|
2189
|
+
}), Sr = [
|
|
2170
2190
|
"aptos",
|
|
2171
2191
|
"arial",
|
|
2172
2192
|
"calibri",
|
|
@@ -2182,7 +2202,7 @@ var W = Object.freeze({
|
|
|
2182
2202
|
"times new roman",
|
|
2183
2203
|
"trebuchet ms",
|
|
2184
2204
|
"verdana"
|
|
2185
|
-
],
|
|
2205
|
+
], Cr = {
|
|
2186
2206
|
"sans-serif": "Arial",
|
|
2187
2207
|
serif: "Times New Roman",
|
|
2188
2208
|
monospace: "Courier New",
|
|
@@ -2193,7 +2213,7 @@ var W = Object.freeze({
|
|
|
2193
2213
|
"ui-monospace": "Courier New",
|
|
2194
2214
|
cursive: "Comic Sans MS",
|
|
2195
2215
|
fantasy: "Impact"
|
|
2196
|
-
},
|
|
2216
|
+
}, wr = 31, Tr = {
|
|
2197
2217
|
black: "000000",
|
|
2198
2218
|
white: "FFFFFF",
|
|
2199
2219
|
red: "FF0000",
|
|
@@ -2218,25 +2238,25 @@ var W = Object.freeze({
|
|
|
2218
2238
|
darkgrey: "A9A9A9",
|
|
2219
2239
|
lightgray: "D3D3D3",
|
|
2220
2240
|
lightgrey: "D3D3D3"
|
|
2221
|
-
},
|
|
2241
|
+
}, Er = [
|
|
2222
2242
|
"solid",
|
|
2223
2243
|
"dashed",
|
|
2224
2244
|
"dotted",
|
|
2225
2245
|
"double"
|
|
2226
|
-
],
|
|
2246
|
+
], Dr = [
|
|
2227
2247
|
"left",
|
|
2228
2248
|
"center",
|
|
2229
2249
|
"right"
|
|
2230
|
-
],
|
|
2231
|
-
function
|
|
2250
|
+
], Or = 15;
|
|
2251
|
+
function kr(e) {
|
|
2232
2252
|
let t = Math.round((Number(e) || 0) / 9);
|
|
2233
|
-
return Math.max(0, Math.min(
|
|
2253
|
+
return Math.max(0, Math.min(Or, t));
|
|
2234
2254
|
}
|
|
2235
|
-
function
|
|
2255
|
+
function W(e) {
|
|
2236
2256
|
if (typeof e != "string") return null;
|
|
2237
2257
|
let t = e.trim().toLowerCase();
|
|
2238
2258
|
if (t === "" || t === "transparent" || t === "none" || t === "inherit") return null;
|
|
2239
|
-
if (
|
|
2259
|
+
if (Tr[t]) return `FF${Tr[t]}`;
|
|
2240
2260
|
let n = t.match(/^#([0-9a-f]{3,8})$/);
|
|
2241
2261
|
if (n) {
|
|
2242
2262
|
let e = n[1];
|
|
@@ -2260,24 +2280,24 @@ function G(e) {
|
|
|
2260
2280
|
}
|
|
2261
2281
|
return null;
|
|
2262
2282
|
}
|
|
2263
|
-
function
|
|
2283
|
+
function Ar(e) {
|
|
2264
2284
|
let t = String(e ?? "").split(",").map((e) => e.trim().replace(/^['"]|['"]$/g, "").trim()).filter(Boolean);
|
|
2265
|
-
return t.length === 0 ? "Arial" : (t.find((e) =>
|
|
2285
|
+
return t.length === 0 ? "Arial" : (t.find((e) => Sr.includes(e.toLowerCase())) ?? Cr[t[0].toLowerCase()] ?? t[0]).slice(0, wr);
|
|
2266
2286
|
}
|
|
2267
|
-
function
|
|
2287
|
+
function jr(e) {
|
|
2268
2288
|
return Math.round(e * .75 * 2) / 2;
|
|
2269
2289
|
}
|
|
2270
|
-
function
|
|
2290
|
+
function Mr(e) {
|
|
2271
2291
|
return Math.max(1, Math.round((e - 5) / 7 * 100) / 100);
|
|
2272
2292
|
}
|
|
2273
|
-
function
|
|
2293
|
+
function Nr(e) {
|
|
2274
2294
|
if (e === "bold" || e === "bolder") return !0;
|
|
2275
2295
|
let t = Number(e);
|
|
2276
2296
|
return Number.isFinite(t) && t >= 600;
|
|
2277
2297
|
}
|
|
2278
|
-
function
|
|
2298
|
+
function Pr({ style: e = "solid", width: t = 1, color: n = null } = {}) {
|
|
2279
2299
|
if (e === "none" || e === "hidden") return null;
|
|
2280
|
-
let r =
|
|
2300
|
+
let r = Er.includes(e) ? e : "solid", i = Number(t);
|
|
2281
2301
|
return !Number.isFinite(i) || i <= 0 ? null : {
|
|
2282
2302
|
style: {
|
|
2283
2303
|
solid: i <= 1 ? "thin" : i <= 2 ? "medium" : "thick",
|
|
@@ -2285,68 +2305,68 @@ function Mr({ style: e = "solid", width: t = 1, color: n = null } = {}) {
|
|
|
2285
2305
|
dotted: "dotted",
|
|
2286
2306
|
double: "double"
|
|
2287
2307
|
}[r],
|
|
2288
|
-
color:
|
|
2308
|
+
color: W(n)
|
|
2289
2309
|
};
|
|
2290
2310
|
}
|
|
2291
|
-
function
|
|
2292
|
-
return e ? e.kind === "text" ?
|
|
2311
|
+
function G(e) {
|
|
2312
|
+
return e ? e.kind === "text" ? Fr(Ir(e.style ?? {}), e.highlight) : e.kind === "head" || e.kind === "cell" ? Fr(Lr(e.kind === "head", e.column ?? {}, e.table ?? {}), e.highlight) : null : null;
|
|
2293
2313
|
}
|
|
2294
|
-
function
|
|
2314
|
+
function Fr(e, t) {
|
|
2295
2315
|
if (!t) return e;
|
|
2296
2316
|
let n = { ...e.font };
|
|
2297
|
-
return t.color && (n.color =
|
|
2317
|
+
return t.color && (n.color = W(t.color) ?? n.color), t.fontWeight && (n.bold = Nr(t.fontWeight)), t.fontStyle && (n.italic = t.fontStyle === "italic" || t.fontStyle === "oblique"), {
|
|
2298
2318
|
...e,
|
|
2299
2319
|
font: n,
|
|
2300
|
-
fill: t.background ?
|
|
2320
|
+
fill: t.background ? W(t.background) ?? e.fill : e.fill
|
|
2301
2321
|
};
|
|
2302
2322
|
}
|
|
2303
|
-
function
|
|
2323
|
+
function Ir(e) {
|
|
2304
2324
|
return {
|
|
2305
2325
|
font: {
|
|
2306
|
-
name:
|
|
2307
|
-
size:
|
|
2308
|
-
bold:
|
|
2326
|
+
name: Ar(e.fontFamily ?? U.fontFamily),
|
|
2327
|
+
size: jr(Rr(e.fontSize) ?? U.fontSize),
|
|
2328
|
+
bold: Nr(e.fontWeight),
|
|
2309
2329
|
italic: e.fontStyle === "italic" || e.fontStyle === "oblique",
|
|
2310
|
-
color:
|
|
2330
|
+
color: W(e.color)
|
|
2311
2331
|
},
|
|
2312
2332
|
fill: null,
|
|
2313
2333
|
border: null,
|
|
2314
2334
|
alignment: {
|
|
2315
|
-
horizontal:
|
|
2335
|
+
horizontal: Dr.includes(e.align) ? e.align : "left",
|
|
2316
2336
|
vertical: "top",
|
|
2317
2337
|
wrapText: !1
|
|
2318
2338
|
}
|
|
2319
2339
|
};
|
|
2320
2340
|
}
|
|
2321
|
-
function
|
|
2322
|
-
let r = n.style ?? {}, i = e ?
|
|
2341
|
+
function Lr(e, t, n) {
|
|
2342
|
+
let r = n.style ?? {}, i = e ? W(r.headerColor) ?? W(r.color) : W(r.color);
|
|
2323
2343
|
return {
|
|
2324
2344
|
font: {
|
|
2325
|
-
name:
|
|
2326
|
-
size:
|
|
2327
|
-
bold:
|
|
2345
|
+
name: Ar(r.fontFamily ?? U.fontFamily),
|
|
2346
|
+
size: jr(Rr(r.fontSize) ?? U.fontSize),
|
|
2347
|
+
bold: Nr(e ? r.fontWeight ?? U.headerWeight : r.fontWeight),
|
|
2328
2348
|
italic: r.fontStyle === "italic" || r.fontStyle === "oblique",
|
|
2329
2349
|
color: i
|
|
2330
2350
|
},
|
|
2331
|
-
fill: e ? r.headerBackground === null ? null :
|
|
2332
|
-
border:
|
|
2333
|
-
style: r.borderStyle ??
|
|
2334
|
-
width: r.borderWidth ??
|
|
2335
|
-
color: r.borderColor ??
|
|
2351
|
+
fill: e ? r.headerBackground === null ? null : W(r.headerBackground ?? U.headerBackground) : W(r.background),
|
|
2352
|
+
border: Pr({
|
|
2353
|
+
style: r.borderStyle ?? U.ruleStyle,
|
|
2354
|
+
width: r.borderWidth ?? U.ruleWidth,
|
|
2355
|
+
color: r.borderColor ?? U.ruleColor
|
|
2336
2356
|
}),
|
|
2337
2357
|
alignment: {
|
|
2338
|
-
horizontal:
|
|
2358
|
+
horizontal: Dr.includes(t.align) ? t.align : "left",
|
|
2339
2359
|
vertical: "center",
|
|
2340
2360
|
wrapText: n.wrap !== !1,
|
|
2341
|
-
indent: t.align === "center" ? 0 :
|
|
2361
|
+
indent: t.align === "center" ? 0 : kr(U.cellPadding)
|
|
2342
2362
|
}
|
|
2343
2363
|
};
|
|
2344
2364
|
}
|
|
2345
|
-
function
|
|
2365
|
+
function Rr(e) {
|
|
2346
2366
|
let t = Number(e);
|
|
2347
2367
|
return Number.isFinite(t) && t > 0 ? t : null;
|
|
2348
2368
|
}
|
|
2349
|
-
function
|
|
2369
|
+
function zr() {
|
|
2350
2370
|
let e = ["<font><sz val=\"11\"/><name val=\"Calibri\"/><family val=\"2\"/></font>"], t = ["<fill><patternFill patternType=\"none\"/></fill>", "<fill><patternFill patternType=\"gray125\"/></fill>"], n = ["<border><left/><right/><top/><bottom/><diagonal/></border>"], r = ["<xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"0\" xfId=\"0\"/>"], i = /* @__PURE__ */ new Map();
|
|
2351
2371
|
function a(e) {
|
|
2352
2372
|
return i.has(e) || i.set(e, 164 + i.size), i.get(e);
|
|
@@ -2358,7 +2378,7 @@ function Lr() {
|
|
|
2358
2378
|
...r.map((e, t) => [e, t])
|
|
2359
2379
|
]), s = (e, t) => o.has(t) ? o.get(t) : (e.push(t), o.set(t, e.length - 1), e.length - 1);
|
|
2360
2380
|
function c(e) {
|
|
2361
|
-
return e ? "<font>" + (e.bold ? "<b/>" : "") + (e.italic ? "<i/>" : "") + `<sz val="${e.size ?? 11}"/>` + (e.color ? `<color rgb="${e.color}"/>` : "") + `<name val="${
|
|
2381
|
+
return e ? "<font>" + (e.bold ? "<b/>" : "") + (e.italic ? "<i/>" : "") + `<sz val="${e.size ?? 11}"/>` + (e.color ? `<color rgb="${e.color}"/>` : "") + `<name val="${Br(e.name ?? "Calibri")}"/></font>` : null;
|
|
2362
2382
|
}
|
|
2363
2383
|
function l(e) {
|
|
2364
2384
|
return e ? `<fill><patternFill patternType="solid"><fgColor rgb="${e}"/><bgColor indexed="64"/></patternFill></fill>` : null;
|
|
@@ -2393,7 +2413,7 @@ function Lr() {
|
|
|
2393
2413
|
return s(r, v);
|
|
2394
2414
|
}
|
|
2395
2415
|
function p() {
|
|
2396
|
-
return "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<styleSheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\">" + (i.size ? `<numFmts count="${i.size}">${[...i].map(([e, t]) => `<numFmt numFmtId="${t}" formatCode="${
|
|
2416
|
+
return "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<styleSheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\">" + (i.size ? `<numFmts count="${i.size}">${[...i].map(([e, t]) => `<numFmt numFmtId="${t}" formatCode="${Br(e)}"/>`).join("")}</numFmts>` : "") + `<fonts count="${e.length}">${e.join("")}</fonts><fills count="${t.length}">${t.join("")}</fills><borders count="${n.length}">${n.join("")}</borders><cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs><cellXfs count="${r.length}">${r.join("")}</cellXfs><cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles></styleSheet>`;
|
|
2397
2417
|
}
|
|
2398
2418
|
return {
|
|
2399
2419
|
xf: f,
|
|
@@ -2404,23 +2424,23 @@ function Lr() {
|
|
|
2404
2424
|
}
|
|
2405
2425
|
};
|
|
2406
2426
|
}
|
|
2407
|
-
function
|
|
2427
|
+
function Br(e) {
|
|
2408
2428
|
return String(e).replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]/g, "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
2409
2429
|
}
|
|
2410
2430
|
//#endregion
|
|
2411
2431
|
//#region src/engine/xlsx-drawing.js
|
|
2412
|
-
var
|
|
2432
|
+
var Vr = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing", Hr = "http://schemas.openxmlformats.org/drawingml/2006/main", Ur = "http://schemas.openxmlformats.org/officeDocument/2006/relationships", Wr = 9525, Gr = "application/vnd.openxmlformats-officedocument.drawing+xml", Kr = `${Ur}/drawing`, qr = `${Ur}/image`, Jr = Object.freeze({
|
|
2413
2433
|
png: "image/png",
|
|
2414
2434
|
jpeg: "image/jpeg",
|
|
2415
2435
|
gif: "image/gif",
|
|
2416
2436
|
bmp: "image/bmp"
|
|
2417
|
-
}),
|
|
2418
|
-
function
|
|
2419
|
-
return Math.max(0, Math.round((Number(e) || 0) *
|
|
2437
|
+
}), Yr = /^data:image\/[a-z0-9.+-]+;base64,([a-z0-9+/=\s]*)$/i;
|
|
2438
|
+
function K(e) {
|
|
2439
|
+
return Math.max(0, Math.round((Number(e) || 0) * Wr));
|
|
2420
2440
|
}
|
|
2421
|
-
function
|
|
2441
|
+
function Xr(e) {
|
|
2422
2442
|
if (typeof e != "string") return null;
|
|
2423
|
-
let t = e.trim().match(
|
|
2443
|
+
let t = e.trim().match(Yr);
|
|
2424
2444
|
if (!t) return null;
|
|
2425
2445
|
try {
|
|
2426
2446
|
let e = atob(t[1].replace(/\s+/g, "")), n = new Uint8Array(e.length);
|
|
@@ -2430,7 +2450,7 @@ function Jr(e) {
|
|
|
2430
2450
|
return null;
|
|
2431
2451
|
}
|
|
2432
2452
|
}
|
|
2433
|
-
function
|
|
2453
|
+
function Zr(e) {
|
|
2434
2454
|
if (!(e instanceof Uint8Array) || e.length < 10) return null;
|
|
2435
2455
|
let t = new DataView(e.buffer, e.byteOffset, e.byteLength), n = (t, ...n) => n.every((n, r) => e[t + r] === n);
|
|
2436
2456
|
return n(0, 137, 80, 78, 71, 13, 10, 26, 10) && e.length >= 24 ? {
|
|
@@ -2447,10 +2467,10 @@ function Yr(e) {
|
|
|
2447
2467
|
height: Math.abs(t.getInt32(22, !0))
|
|
2448
2468
|
} : n(0, 255, 216) ? {
|
|
2449
2469
|
ext: "jpeg",
|
|
2450
|
-
...
|
|
2470
|
+
...Qr(e, t)
|
|
2451
2471
|
} : null;
|
|
2452
2472
|
}
|
|
2453
|
-
function
|
|
2473
|
+
function Qr(e, t) {
|
|
2454
2474
|
let n = 2;
|
|
2455
2475
|
for (; n + 9 < e.length;) {
|
|
2456
2476
|
if (e[n] !== 255) {
|
|
@@ -2478,7 +2498,7 @@ function Xr(e, t) {
|
|
|
2478
2498
|
height: null
|
|
2479
2499
|
};
|
|
2480
2500
|
}
|
|
2481
|
-
function
|
|
2501
|
+
function $r(e, t, n) {
|
|
2482
2502
|
let { width: r, height: i } = n ?? {}, a = {
|
|
2483
2503
|
x: 0,
|
|
2484
2504
|
y: 0,
|
|
@@ -2508,27 +2528,27 @@ function Zr(e, t, n) {
|
|
|
2508
2528
|
crop: null
|
|
2509
2529
|
};
|
|
2510
2530
|
}
|
|
2511
|
-
function
|
|
2531
|
+
function ei(e) {
|
|
2512
2532
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
2513
|
-
<xdr:wsDr xmlns:xdr="${
|
|
2533
|
+
<xdr:wsDr xmlns:xdr="${Vr}" xmlns:a="${Hr}" xmlns:r="${Ur}">${e.map((e, t) => {
|
|
2514
2534
|
let n = t + 2;
|
|
2515
|
-
return `<xdr:oneCellAnchor><xdr:from><xdr:col>${e.col}</xdr:col><xdr:colOff>${
|
|
2535
|
+
return `<xdr:oneCellAnchor><xdr:from><xdr:col>${e.col}</xdr:col><xdr:colOff>${K(e.colOff)}</xdr:colOff><xdr:row>${e.row}</xdr:row><xdr:rowOff>${K(e.rowOff)}</xdr:rowOff></xdr:from><xdr:ext cx="${K(e.cx)}" cy="${K(e.cy)}"/>` + e.shape(n, K(e.cx), K(e.cy)) + "<xdr:clientData/></xdr:oneCellAnchor>";
|
|
2516
2536
|
}).join("")}</xdr:wsDr>`;
|
|
2517
2537
|
}
|
|
2518
|
-
function
|
|
2519
|
-
return "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">" + e.map((e) => `<Relationship Id="${e.rId}" Type="${
|
|
2538
|
+
function ti(e) {
|
|
2539
|
+
return "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">" + e.map((e) => `<Relationship Id="${e.rId}" Type="${qr}" Target="../media/${e.file}"/>`).join("") + "</Relationships>";
|
|
2520
2540
|
}
|
|
2521
|
-
function
|
|
2522
|
-
return (r, i, a) => `<xdr:pic><xdr:nvPicPr><xdr:cNvPr id="${r}" name="Picture ${r - 1}" descr="${
|
|
2541
|
+
function ni({ rId: e, alt: t = "", crop: n = null }) {
|
|
2542
|
+
return (r, i, a) => `<xdr:pic><xdr:nvPicPr><xdr:cNvPr id="${r}" name="Picture ${r - 1}" descr="${li(t)}"/><xdr:cNvPicPr><a:picLocks noChangeAspect="1"/></xdr:cNvPicPr></xdr:nvPicPr><xdr:blipFill><a:blip r:embed="${e}"/>` + (n ? `<a:srcRect l="${n.l}" t="${n.t}" r="${n.r}" b="${n.b}"/>` : "") + `<a:stretch><a:fillRect/></a:stretch></xdr:blipFill><xdr:spPr>${ci(i, a)}<a:prstGeom prst="rect"><a:avLst/></a:prstGeom></xdr:spPr></xdr:pic>`;
|
|
2523
2543
|
}
|
|
2524
|
-
function
|
|
2544
|
+
function ri({ fill: e = null, outline: t = null, radius: n = 0, w: r, h: i }) {
|
|
2525
2545
|
let a = Math.min(r, i), o = n > 0 && a > 0 ? Math.min(5e4, Math.round(n / a * 1e5)) : 0, s = o > 0 ? `<a:prstGeom prst="roundRect"><a:avLst><a:gd name="adj" fmla="val ${o}"/></a:avLst></a:prstGeom>` : "<a:prstGeom prst=\"rect\"><a:avLst/></a:prstGeom>";
|
|
2526
|
-
return (n, r, i) => `<xdr:sp macro="" textlink=""><xdr:nvSpPr><xdr:cNvPr id="${n}" name="Box ${n - 1}"/><xdr:cNvSpPr/></xdr:nvSpPr><xdr:spPr>${
|
|
2546
|
+
return (n, r, i) => `<xdr:sp macro="" textlink=""><xdr:nvSpPr><xdr:cNvPr id="${n}" name="Box ${n - 1}"/><xdr:cNvSpPr/></xdr:nvSpPr><xdr:spPr>${ci(r, i)}${s}` + (e ? si(e) : "<a:noFill/>") + oi(t) + "</xdr:spPr></xdr:sp>";
|
|
2527
2547
|
}
|
|
2528
|
-
function
|
|
2529
|
-
return (t, n, r) => `<xdr:cxnSp macro=""><xdr:nvCxnSpPr><xdr:cNvPr id="${t}" name="Line ${t - 1}"/><xdr:cNvCxnSpPr/></xdr:nvCxnSpPr><xdr:spPr>${
|
|
2548
|
+
function ii(e) {
|
|
2549
|
+
return (t, n, r) => `<xdr:cxnSp macro=""><xdr:nvCxnSpPr><xdr:cNvPr id="${t}" name="Line ${t - 1}"/><xdr:cNvCxnSpPr/></xdr:nvCxnSpPr><xdr:spPr>${ci(n, r)}<a:prstGeom prst="line"><a:avLst/></a:prstGeom>${oi(e)}</xdr:spPr></xdr:cxnSp>`;
|
|
2530
2550
|
}
|
|
2531
|
-
function
|
|
2551
|
+
function ai({ style: e = "solid", width: t = 1, color: n = null } = {}) {
|
|
2532
2552
|
if (e === "none" || e === "hidden") return null;
|
|
2533
2553
|
let r = Number(t);
|
|
2534
2554
|
return !Number.isFinite(r) || r <= 0 ? null : {
|
|
@@ -2541,209 +2561,209 @@ function ri({ style: e = "solid", width: t = 1, color: n = null } = {}) {
|
|
|
2541
2561
|
double: e === "double"
|
|
2542
2562
|
};
|
|
2543
2563
|
}
|
|
2544
|
-
function
|
|
2545
|
-
return e ? `<a:ln w="${
|
|
2564
|
+
function oi(e) {
|
|
2565
|
+
return e ? `<a:ln w="${K(e.width)}"${e.double ? " cmpd=\"dbl\"" : ""}>` + si(e.color) + (e.dash ? `<a:prstDash val="${e.dash}"/>` : "") + "</a:ln>" : "<a:ln><a:noFill/></a:ln>";
|
|
2546
2566
|
}
|
|
2547
|
-
function
|
|
2567
|
+
function si(e) {
|
|
2548
2568
|
return `<a:solidFill><a:srgbClr val="${e.slice(-6)}"/></a:solidFill>`;
|
|
2549
2569
|
}
|
|
2550
|
-
function
|
|
2570
|
+
function ci(e, t) {
|
|
2551
2571
|
return `<a:xfrm><a:off x="0" y="0"/><a:ext cx="${e}" cy="${t}"/></a:xfrm>`;
|
|
2552
2572
|
}
|
|
2553
|
-
function
|
|
2573
|
+
function li(e) {
|
|
2554
2574
|
return String(e ?? "").replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]/g, "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
2555
2575
|
}
|
|
2556
2576
|
//#endregion
|
|
2557
2577
|
//#region src/render/items.js
|
|
2558
|
-
var
|
|
2559
|
-
function
|
|
2578
|
+
var ui = (e) => `position:absolute;top:${q(e?.y)}px;left:${q(e?.x)}px;`;
|
|
2579
|
+
function q(e, t = 0) {
|
|
2560
2580
|
let n = Number(e);
|
|
2561
2581
|
return Number.isFinite(n) ? n : t;
|
|
2562
2582
|
}
|
|
2563
|
-
function
|
|
2583
|
+
function J(e, t = "") {
|
|
2564
2584
|
if (e == null) return t;
|
|
2565
2585
|
let n = String(e).replace(/[<>"'`&;{}\\]/g, "").replace(/url\s*\(/gi, "").replace(/\s+/g, " ").trim();
|
|
2566
2586
|
return n === "" ? t : n;
|
|
2567
2587
|
}
|
|
2568
|
-
function
|
|
2588
|
+
function Y(e) {
|
|
2569
2589
|
return e == null ? "" : String(e).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
2570
2590
|
}
|
|
2571
|
-
function
|
|
2591
|
+
function di(e) {
|
|
2572
2592
|
return (e || []).map((e) => {
|
|
2573
2593
|
switch (e.type) {
|
|
2574
|
-
case "text": return
|
|
2575
|
-
case "table": return
|
|
2576
|
-
case "line": return
|
|
2577
|
-
case "box": return
|
|
2578
|
-
case "image": return
|
|
2594
|
+
case "text": return fi(e);
|
|
2595
|
+
case "table": return Ti(e);
|
|
2596
|
+
case "line": return bi(e);
|
|
2597
|
+
case "box": return pi(e);
|
|
2598
|
+
case "image": return vi(e);
|
|
2579
2599
|
default: return console.warn(`Unknown item type "${e?.type}"; it is not drawn.`), "";
|
|
2580
2600
|
}
|
|
2581
2601
|
}).join("");
|
|
2582
2602
|
}
|
|
2583
|
-
function
|
|
2603
|
+
function fi(e) {
|
|
2584
2604
|
let t = e.highlighted ?? null, n = {
|
|
2585
2605
|
...e.style ?? {},
|
|
2586
2606
|
...t ?? {}
|
|
2587
2607
|
};
|
|
2588
2608
|
return `
|
|
2589
|
-
<p id="${
|
|
2590
|
-
${t?.background ? `background:${
|
|
2591
|
-
width:${
|
|
2592
|
-
height:${
|
|
2593
|
-
${
|
|
2594
|
-
font-size:${
|
|
2595
|
-
font-family:${
|
|
2596
|
-
font-weight:${
|
|
2597
|
-
font-style:${
|
|
2598
|
-
text-align:${
|
|
2599
|
-
color:${
|
|
2600
|
-
" data-item-id="${
|
|
2609
|
+
<p id="${Y(e.id)}" style="
|
|
2610
|
+
${t?.background ? `background:${J(t.background)};` : ""}
|
|
2611
|
+
width:${q(e.w)}px;
|
|
2612
|
+
height:${q(e.h)}px;
|
|
2613
|
+
${ui(e)}
|
|
2614
|
+
font-size:${q(n.fontSize, 12)}px;
|
|
2615
|
+
font-family:${J(n.fontFamily, "inherit")};
|
|
2616
|
+
font-weight:${J(n.fontWeight, "normal")};
|
|
2617
|
+
font-style:${J(n.fontStyle, "normal")};
|
|
2618
|
+
text-align:${J(n.align, "left")};
|
|
2619
|
+
color:${J(n.color, "inherit")};
|
|
2620
|
+
" data-item-id="${Y(e.id)}" data-item-type="text">${Y(e.text)}</p>
|
|
2601
2621
|
`;
|
|
2602
2622
|
}
|
|
2603
|
-
function
|
|
2604
|
-
let t = e.style ?? {}, n = `${Math.max(0, Number(t.borderWidth ?? 1)) || 1}px ${
|
|
2623
|
+
function pi(e) {
|
|
2624
|
+
let t = e.style ?? {}, n = `${Math.max(0, Number(t.borderWidth ?? 1)) || 1}px ${Si.includes(t.borderStyle) ? t.borderStyle : "solid"} ${J(t.borderColor, "#000000")}`, r = Math.max(0, Number(t.radius ?? 0)) || 0, i = J(t.background);
|
|
2605
2625
|
return `
|
|
2606
|
-
<div id="${
|
|
2607
|
-
width:${
|
|
2608
|
-
height:${
|
|
2609
|
-
${
|
|
2626
|
+
<div id="${Y(e.id)}" class="box" style="
|
|
2627
|
+
width:${q(e.w)}px;
|
|
2628
|
+
height:${q(e.h)}px;
|
|
2629
|
+
${ui(e)}
|
|
2610
2630
|
border:${n};
|
|
2611
2631
|
${r ? `border-radius:${r}px;` : ""}
|
|
2612
2632
|
${i ? `background:${i};` : ""}
|
|
2613
|
-
" data-item-id="${
|
|
2633
|
+
" data-item-id="${Y(e.id)}" data-item-type="box"></div>
|
|
2614
2634
|
`;
|
|
2615
2635
|
}
|
|
2616
|
-
var
|
|
2636
|
+
var mi = [
|
|
2617
2637
|
"contain",
|
|
2618
2638
|
"cover",
|
|
2619
2639
|
"fill"
|
|
2620
|
-
],
|
|
2640
|
+
], hi = /^data:image\/(png|jpe?g|gif|webp|avif|bmp);base64,[a-z0-9+/=\s]*$/i, gi = [
|
|
2621
2641
|
"http:",
|
|
2622
2642
|
"https:",
|
|
2623
2643
|
"blob:"
|
|
2624
2644
|
];
|
|
2625
|
-
function
|
|
2645
|
+
function _i(e) {
|
|
2626
2646
|
if (typeof e != "string") return "";
|
|
2627
2647
|
let t = e.trim();
|
|
2628
2648
|
if (t === "") return "";
|
|
2629
2649
|
let n = t.replace(/[\u0000-\u0020\u007f]+/g, "");
|
|
2630
|
-
if (/^data:/i.test(n)) return
|
|
2650
|
+
if (/^data:/i.test(n)) return hi.test(n) ? n : "";
|
|
2631
2651
|
let r = n.match(/^([a-z][a-z0-9+.-]*:)/i)?.[1]?.toLowerCase();
|
|
2632
|
-
return r == null ||
|
|
2652
|
+
return r == null || gi.includes(r) ? t : "";
|
|
2633
2653
|
}
|
|
2634
|
-
function
|
|
2635
|
-
let t = Object.prototype.hasOwnProperty.call(e, "resolvedSrc"), n =
|
|
2636
|
-
if (n) i = `<img src="${
|
|
2654
|
+
function vi(e) {
|
|
2655
|
+
let t = Object.prototype.hasOwnProperty.call(e, "resolvedSrc"), n = _i(t ? e.resolvedSrc : e.src), r = mi.includes(e.fit) ? e.fit : "contain", i = "";
|
|
2656
|
+
if (n) i = `<img src="${Y(n)}" alt="${Y(e.alt ?? "")}" style="object-fit:${r}" draggable="false">`;
|
|
2637
2657
|
else if (!t) {
|
|
2638
2658
|
let t = typeof e.field == "string" ? e.field.trim() : "";
|
|
2639
|
-
i = `<span class="image-empty">${t ?
|
|
2659
|
+
i = `<span class="image-empty">${t ? Y(`{${t}}`) : "Image"}</span>`;
|
|
2640
2660
|
}
|
|
2641
2661
|
return `
|
|
2642
|
-
<div id="${
|
|
2643
|
-
width:${
|
|
2644
|
-
height:${
|
|
2645
|
-
${
|
|
2646
|
-
" data-item-id="${
|
|
2662
|
+
<div id="${Y(e.id)}" class="image" style="
|
|
2663
|
+
width:${q(e.w)}px;
|
|
2664
|
+
height:${q(e.h)}px;
|
|
2665
|
+
${ui(e)}
|
|
2666
|
+
" data-item-id="${Y(e.id)}" data-item-type="image">${i}</div>
|
|
2647
2667
|
`;
|
|
2648
2668
|
}
|
|
2649
|
-
function
|
|
2650
|
-
return `${Math.max(0, Number(e?.thickness ?? 1)) || 1}px ${
|
|
2669
|
+
function yi(e) {
|
|
2670
|
+
return `${Math.max(0, Number(e?.thickness ?? 1)) || 1}px ${xi.includes(e?.lineStyle) ? e.lineStyle : "solid"} ${J(e?.color, "#000000")}`;
|
|
2651
2671
|
}
|
|
2652
|
-
function
|
|
2653
|
-
let t = e.orientation === "vertical", n =
|
|
2672
|
+
function bi(e) {
|
|
2673
|
+
let t = e.orientation === "vertical", n = yi(e.style);
|
|
2654
2674
|
return `
|
|
2655
|
-
<div id="${
|
|
2656
|
-
width:${
|
|
2657
|
-
height:${
|
|
2658
|
-
${
|
|
2659
|
-
" data-item-id="${
|
|
2675
|
+
<div id="${Y(e.id)}" class="line${t ? " is-vertical" : ""}" style="
|
|
2676
|
+
width:${q(e.w)}px;
|
|
2677
|
+
height:${q(e.h)}px;
|
|
2678
|
+
${ui(e)}
|
|
2679
|
+
" data-item-id="${Y(e.id)}" data-item-type="line"><span class="line-mark"
|
|
2660
2680
|
style="${t ? `border-left:${n}` : `border-top:${n}`}"></span></div>
|
|
2661
2681
|
`;
|
|
2662
2682
|
}
|
|
2663
|
-
var
|
|
2683
|
+
var xi = [
|
|
2664
2684
|
"solid",
|
|
2665
2685
|
"dashed",
|
|
2666
2686
|
"dotted",
|
|
2667
2687
|
"double"
|
|
2668
|
-
],
|
|
2669
|
-
function
|
|
2688
|
+
], Si = [...xi, "none"];
|
|
2689
|
+
function Ci(e) {
|
|
2670
2690
|
let t = e.rowHeight ?? 0, n = e.showHeader ? e.headerHeight ?? t : t, r = Math.min(t || Infinity, n || Infinity);
|
|
2671
2691
|
return Number.isFinite(r) ? Math.max(1, Math.floor(r / 2)) : 1;
|
|
2672
2692
|
}
|
|
2673
|
-
function
|
|
2693
|
+
function wi(e) {
|
|
2674
2694
|
let t = e.style ?? {}, n = [];
|
|
2675
|
-
|
|
2695
|
+
Si.includes(t.borderStyle) && n.push(`--rs-rule-style:${t.borderStyle}`), t.borderColor && n.push(`--rs-rule-color:${J(t.borderColor)}`), t.headerBackground && n.push(`--rs-head-bg:${J(t.headerBackground)}`), t.headerColor && n.push(`--rs-head-color:${J(t.headerColor)}`), t.fontFamily && n.push(`--rs-cell-family:${J(t.fontFamily)}`);
|
|
2676
2696
|
let r = Number(t.fontSize);
|
|
2677
|
-
Number.isFinite(r) && r > 0 && n.push(`--rs-cell-size:${r}px`), t.color && n.push(`--rs-cell-color:${
|
|
2697
|
+
Number.isFinite(r) && r > 0 && n.push(`--rs-cell-size:${r}px`), t.color && n.push(`--rs-cell-color:${J(t.color)}`), e.wrap === !1 && n.push("--rs-cell-wrap:nowrap");
|
|
2678
2698
|
let i = Number(t.borderWidth);
|
|
2679
|
-
return Number.isFinite(i) && i > 0 && n.push(`--rs-rule-width:${Math.min(i,
|
|
2699
|
+
return Number.isFinite(i) && i > 0 && n.push(`--rs-rule-width:${Math.min(i, Ci(e))}px`), n.length ? `${n.join(";")};` : "";
|
|
2680
2700
|
}
|
|
2681
|
-
function
|
|
2701
|
+
function Ti(e) {
|
|
2682
2702
|
return `
|
|
2683
|
-
<table id="${
|
|
2684
|
-
${e.groups ?
|
|
2703
|
+
<table id="${Y(e.id)}" style="width:${q(e.w)}px;height:${q(e.measuredHeight)}px;${ui(e)}${wi(e)}" data-item-id="${Y(e.id)}" data-item-type="table">
|
|
2704
|
+
${e.groups ? ji(e) : Ai(e)}
|
|
2685
2705
|
</table>
|
|
2686
2706
|
`;
|
|
2687
2707
|
}
|
|
2688
|
-
function
|
|
2708
|
+
function Ei(e, t, n, r = null) {
|
|
2689
2709
|
let i = r ? [
|
|
2690
|
-
r.color ? `color:${
|
|
2691
|
-
r.fontWeight ? `font-weight:${
|
|
2692
|
-
r.fontStyle ? `font-style:${
|
|
2710
|
+
r.color ? `color:${J(r.color)};` : "",
|
|
2711
|
+
r.fontWeight ? `font-weight:${J(r.fontWeight)};` : "",
|
|
2712
|
+
r.fontStyle ? `font-style:${J(r.fontStyle)};` : ""
|
|
2693
2713
|
].join("") : "";
|
|
2694
|
-
return `<div class="cell" style="height:${
|
|
2714
|
+
return `<div class="cell" style="height:${q(e)}px;text-align:${J(t, "left")};${i}">${Y(n)}</div>`;
|
|
2695
2715
|
}
|
|
2696
|
-
function
|
|
2716
|
+
function Di(e) {
|
|
2697
2717
|
let t = e.headerMeasured ?? e.headerHeight ?? e.rowHeight;
|
|
2698
2718
|
return `<thead>
|
|
2699
|
-
<tr style="height:${
|
|
2700
|
-
${e.columns.map((e) => `<th style="width:${
|
|
2719
|
+
<tr style="height:${q(t)}px">
|
|
2720
|
+
${e.columns.map((e) => `<th style="width:${q(e.width)}px;">${Ei(t, e.align, e.label)}</th>`).join("")}
|
|
2701
2721
|
</tr>
|
|
2702
2722
|
</thead>`;
|
|
2703
2723
|
}
|
|
2704
|
-
function
|
|
2724
|
+
function Oi(e, t, n) {
|
|
2705
2725
|
return (t || []).map((t, r) => {
|
|
2706
2726
|
let i = n?.[r] ?? e.rowHeight;
|
|
2707
|
-
return `<tr style="height:${
|
|
2727
|
+
return `<tr style="height:${q(i)}px">
|
|
2708
2728
|
${e.columns.map((n) => {
|
|
2709
|
-
let r =
|
|
2710
|
-
return `<td style="width:${
|
|
2729
|
+
let r = be(e, n, t), a = r?.background ? `background:${J(r.background)};` : "";
|
|
2730
|
+
return `<td style="width:${q(n.width)}px;${a}">${Ei(i, n.align, M(t[n.field], n.format), r)}</td>`;
|
|
2711
2731
|
}).join("")}
|
|
2712
2732
|
</tr>`;
|
|
2713
2733
|
}).join("");
|
|
2714
2734
|
}
|
|
2715
|
-
function
|
|
2735
|
+
function ki(e, t, n) {
|
|
2716
2736
|
if (!e) return "";
|
|
2717
2737
|
let r = e.measuredHeight > 0 ? e.measuredHeight : e.height ?? 0;
|
|
2718
2738
|
return `<tr class="${n}"${Number.isInteger(e.level) ? ` data-group-level="${e.level}"` : ""}>
|
|
2719
|
-
<td colspan="${t}" class="group-band-cell"${e.background ? ` style="background:${
|
|
2720
|
-
<div class="band" style="position:relative;height:${
|
|
2739
|
+
<td colspan="${t}" class="group-band-cell"${e.background ? ` style="background:${J(e.background)}"` : ""}>
|
|
2740
|
+
<div class="band" style="position:relative;height:${q(r)}px">${di(e.items)}</div>
|
|
2721
2741
|
</td>
|
|
2722
2742
|
</tr>`;
|
|
2723
2743
|
}
|
|
2724
|
-
function
|
|
2744
|
+
function Ai(e) {
|
|
2725
2745
|
return `
|
|
2726
|
-
${e.showHeader ?
|
|
2746
|
+
${e.showHeader ? Di(e) : ""}
|
|
2727
2747
|
<tbody>
|
|
2728
|
-
${
|
|
2748
|
+
${Oi(e, e.row, e.rowHeights)}
|
|
2729
2749
|
</tbody>
|
|
2730
2750
|
`;
|
|
2731
2751
|
}
|
|
2732
|
-
function
|
|
2752
|
+
function ji(e) {
|
|
2733
2753
|
let t = e.columns.length;
|
|
2734
2754
|
return e.groups.map((n) => {
|
|
2735
|
-
let { headers: r, footers: i } =
|
|
2755
|
+
let { headers: r, footers: i } = Mi(n);
|
|
2736
2756
|
return `
|
|
2737
|
-
${n.showHeader && e.showHeader ?
|
|
2757
|
+
${n.showHeader && e.showHeader ? Di(e) : ""}
|
|
2738
2758
|
<tbody>
|
|
2739
|
-
${r.map((e) =>
|
|
2740
|
-
${
|
|
2741
|
-
${i.map((e) =>
|
|
2759
|
+
${r.map((e) => ki(e, t, "group-header")).join("")}
|
|
2760
|
+
${Oi(e, n.rows, n.rowHeights)}
|
|
2761
|
+
${i.map((e) => ki(e, t, "group-footer")).join("")}
|
|
2742
2762
|
</tbody>
|
|
2743
2763
|
`;
|
|
2744
2764
|
}).join("");
|
|
2745
2765
|
}
|
|
2746
|
-
function
|
|
2766
|
+
function Mi(e) {
|
|
2747
2767
|
let t = Array.isArray(e.headerBands) ? e.headerBands : [e.headerBand], n = Array.isArray(e.footerBands) ? e.footerBands : [e.showFooter ? e.footerBand : null];
|
|
2748
2768
|
return {
|
|
2749
2769
|
headers: t.filter(Boolean),
|
|
@@ -2752,29 +2772,29 @@ function ki(e) {
|
|
|
2752
2772
|
}
|
|
2753
2773
|
//#endregion
|
|
2754
2774
|
//#region src/engine/zip.js
|
|
2755
|
-
var
|
|
2756
|
-
function
|
|
2757
|
-
if (
|
|
2758
|
-
|
|
2775
|
+
var Ni = 0, Pi = 33, Fi = 2048, Ii = 20, Li = null;
|
|
2776
|
+
function Ri() {
|
|
2777
|
+
if (Li) return Li;
|
|
2778
|
+
Li = /* @__PURE__ */ new Uint32Array(256);
|
|
2759
2779
|
for (let e = 0; e < 256; e++) {
|
|
2760
2780
|
let t = e;
|
|
2761
2781
|
for (let e = 0; e < 8; e++) t = t & 1 ? 3988292384 ^ t >>> 1 : t >>> 1;
|
|
2762
|
-
|
|
2782
|
+
Li[e] = t >>> 0;
|
|
2763
2783
|
}
|
|
2764
|
-
return
|
|
2784
|
+
return Li;
|
|
2765
2785
|
}
|
|
2766
|
-
function
|
|
2767
|
-
let t =
|
|
2786
|
+
function zi(e) {
|
|
2787
|
+
let t = Ri(), n = 4294967295;
|
|
2768
2788
|
for (let r = 0; r < e.length; r++) n = t[(n ^ e[r]) & 255] ^ n >>> 8;
|
|
2769
2789
|
return (n ^ 4294967295) >>> 0;
|
|
2770
2790
|
}
|
|
2771
|
-
function
|
|
2791
|
+
function Bi(e) {
|
|
2772
2792
|
let t = new TextEncoder(), n = e.map(({ name: e, data: n }) => {
|
|
2773
2793
|
let r = typeof n == "string" ? t.encode(n) : n;
|
|
2774
2794
|
return {
|
|
2775
2795
|
name: t.encode(e),
|
|
2776
2796
|
bytes: r,
|
|
2777
|
-
crc:
|
|
2797
|
+
crc: zi(r),
|
|
2778
2798
|
offset: 0
|
|
2779
2799
|
};
|
|
2780
2800
|
}), r = n.reduce((e, t) => e + 30 + t.name.length + t.bytes.length, 0), i = n.reduce((e, t) => e + 46 + t.name.length, 0), a = new Uint8Array(r + i + 22), o = new DataView(a.buffer), s = 0, c = (e) => {
|
|
@@ -2784,51 +2804,51 @@ function Li(e) {
|
|
|
2784
2804
|
}, u = (e) => {
|
|
2785
2805
|
a.set(e, s), s += e.length;
|
|
2786
2806
|
};
|
|
2787
|
-
for (let e of n) e.offset = s, l(67324752), c(
|
|
2807
|
+
for (let e of n) e.offset = s, l(67324752), c(Ii), c(Fi), c(0), c(Ni), c(Pi), l(e.crc), l(e.bytes.length), l(e.bytes.length), c(e.name.length), c(0), u(e.name), u(e.bytes);
|
|
2788
2808
|
let d = s;
|
|
2789
|
-
for (let e of n) l(33639248), c(
|
|
2809
|
+
for (let e of n) l(33639248), c(Ii), c(Ii), c(Fi), c(0), c(Ni), c(Pi), l(e.crc), l(e.bytes.length), l(e.bytes.length), c(e.name.length), c(0), c(0), c(0), c(0), l(0), l(e.offset), u(e.name);
|
|
2790
2810
|
let f = s - d;
|
|
2791
2811
|
return l(101010256), c(0), c(0), c(n.length), c(n.length), l(f), l(d), c(0), a;
|
|
2792
2812
|
}
|
|
2793
2813
|
//#endregion
|
|
2794
2814
|
//#region src/engine/xlsx.js
|
|
2795
|
-
var
|
|
2815
|
+
var X = Object.freeze({
|
|
2796
2816
|
rows: 1048576,
|
|
2797
2817
|
columns: 16384,
|
|
2798
2818
|
cellText: 32767,
|
|
2799
2819
|
sheetName: 31
|
|
2800
|
-
}),
|
|
2801
|
-
function
|
|
2820
|
+
}), Vi = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", Hi = "http://schemas.openxmlformats.org/spreadsheetml/2006/main", Ui = "http://schemas.openxmlformats.org/officeDocument/2006/relationships", Wi = "http://schemas.openxmlformats.org/package/2006/relationships", Gi = "http://schemas.openxmlformats.org/package/2006/content-types", Ki = `${Ui}/officeDocument`, qi = `${Ui}/worksheet`, Ji = `${Ui}/styles`, Yi = "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml", Xi = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml", Zi = "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml", Qi = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n", $i = Object.freeze({ font: Object.freeze({ bold: !0 }) }), ea = 14, ta = 22, na = /[\x00-\x08\x0B\x0C\x0E-\x1F]/g, ra = /_(x[0-9A-Fa-f]{4}_)/g, ia = /[\[\]:*?\/\\\x00-\x1F]/g, aa = 8, oa = 60, sa = 50, ca = 2.5, la = 2, ua = 24, da = 20, fa = /^-?(0|[1-9]\d*)(\.\d+)?$/, pa = /\{[^{}]+\}/;
|
|
2821
|
+
function ma(e, t = {}) {
|
|
2802
2822
|
let { report: n = !0, tables: r = !0, styled: i = !0, reportSheetName: a = "Report", groupColumn: o = !0, groupLabel: s = "Group", images: c = null } = t, l = [];
|
|
2803
|
-
if (n &&
|
|
2823
|
+
if (n && tr(e).length > 0 && l.push(_a(e, a, i, c)), r) for (let { id: t } of ar(e)) l.push(va(rr(e, t), i, o, s));
|
|
2804
2824
|
if (l.length === 0) return /* @__PURE__ */ new Uint8Array();
|
|
2805
|
-
let u =
|
|
2825
|
+
let u = za(l.map((e) => e.name));
|
|
2806
2826
|
l.forEach((e, t) => {
|
|
2807
2827
|
e.name = u[t], e.width = e.rows.reduce((e, t) => Math.max(e, t.cells.length), 0);
|
|
2808
2828
|
});
|
|
2809
|
-
let d =
|
|
2829
|
+
let d = zr(), f = l.map((e) => Ma(e, d)), p = [], m = [];
|
|
2810
2830
|
return l.forEach((e, t) => {
|
|
2811
2831
|
e.drawing && (p.push({
|
|
2812
2832
|
sheet: t + 1,
|
|
2813
2833
|
n: p.length + 1,
|
|
2814
2834
|
...e.drawing
|
|
2815
2835
|
}), m.push(...e.drawing.media));
|
|
2816
|
-
}),
|
|
2836
|
+
}), Bi([
|
|
2817
2837
|
{
|
|
2818
2838
|
name: "[Content_Types].xml",
|
|
2819
|
-
data:
|
|
2839
|
+
data: Va(l.length, p, m)
|
|
2820
2840
|
},
|
|
2821
2841
|
{
|
|
2822
2842
|
name: "_rels/.rels",
|
|
2823
|
-
data:
|
|
2843
|
+
data: Ha()
|
|
2824
2844
|
},
|
|
2825
2845
|
{
|
|
2826
2846
|
name: "xl/workbook.xml",
|
|
2827
|
-
data:
|
|
2847
|
+
data: Wa(l)
|
|
2828
2848
|
},
|
|
2829
2849
|
{
|
|
2830
2850
|
name: "xl/_rels/workbook.xml.rels",
|
|
2831
|
-
data:
|
|
2851
|
+
data: Ga(l.length)
|
|
2832
2852
|
},
|
|
2833
2853
|
{
|
|
2834
2854
|
name: "xl/styles.xml",
|
|
@@ -2841,15 +2861,15 @@ function da(e, t = {}) {
|
|
|
2841
2861
|
...p.flatMap((e) => [
|
|
2842
2862
|
{
|
|
2843
2863
|
name: `xl/worksheets/_rels/sheet${e.sheet}.xml.rels`,
|
|
2844
|
-
data:
|
|
2864
|
+
data: Ua(e.n)
|
|
2845
2865
|
},
|
|
2846
2866
|
{
|
|
2847
2867
|
name: `xl/drawings/drawing${e.n}.xml`,
|
|
2848
|
-
data:
|
|
2868
|
+
data: ei(e.anchors)
|
|
2849
2869
|
},
|
|
2850
2870
|
...e.media.length ? [{
|
|
2851
2871
|
name: `xl/drawings/_rels/drawing${e.n}.xml.rels`,
|
|
2852
|
-
data:
|
|
2872
|
+
data: ti(e.media)
|
|
2853
2873
|
}] : []
|
|
2854
2874
|
]),
|
|
2855
2875
|
...m.map((e) => ({
|
|
@@ -2858,34 +2878,34 @@ function da(e, t = {}) {
|
|
|
2858
2878
|
}))
|
|
2859
2879
|
]);
|
|
2860
2880
|
}
|
|
2861
|
-
async function
|
|
2881
|
+
async function ha(e, t = {}) {
|
|
2862
2882
|
let n = t.fetch ?? globalThis.fetch, r = new Map(t.images instanceof Map ? t.images : Object.entries(t.images ?? {}));
|
|
2863
|
-
return typeof n == "function" && await Promise.all(
|
|
2883
|
+
return typeof n == "function" && await Promise.all(ga(e).filter((e) => !r.has(e)).map(async (e) => {
|
|
2864
2884
|
try {
|
|
2865
2885
|
let t = await n(e);
|
|
2866
2886
|
t?.ok && r.set(e, new Uint8Array(await t.arrayBuffer()));
|
|
2867
2887
|
} catch {}
|
|
2868
|
-
})),
|
|
2888
|
+
})), ma(e, {
|
|
2869
2889
|
...t,
|
|
2870
2890
|
images: r
|
|
2871
2891
|
});
|
|
2872
2892
|
}
|
|
2873
|
-
function
|
|
2893
|
+
function ga(e) {
|
|
2874
2894
|
let t = /* @__PURE__ */ new Set();
|
|
2875
|
-
for (let n of
|
|
2895
|
+
for (let n of nr(e).graphics) {
|
|
2876
2896
|
if (n.kind !== "image") continue;
|
|
2877
|
-
let e =
|
|
2897
|
+
let e = _i(n.item.resolvedSrc);
|
|
2878
2898
|
e && !/^data:/i.test(e) && t.add(e);
|
|
2879
2899
|
}
|
|
2880
2900
|
return [...t];
|
|
2881
2901
|
}
|
|
2882
|
-
function
|
|
2883
|
-
let { rows: i, graphics: a } =
|
|
2902
|
+
function _a(e, t, n, r) {
|
|
2903
|
+
let { rows: i, graphics: a } = nr(e);
|
|
2884
2904
|
if (!n) {
|
|
2885
2905
|
let e = i.filter((e) => !e.spacer).map(({ cells: e, header: t }) => ({
|
|
2886
2906
|
cells: e.map((e) => ({
|
|
2887
2907
|
value: e,
|
|
2888
|
-
format: t ?
|
|
2908
|
+
format: t ? $i : null
|
|
2889
2909
|
})),
|
|
2890
2910
|
height: null
|
|
2891
2911
|
}));
|
|
@@ -2894,25 +2914,25 @@ function ma(e, t, n, r) {
|
|
|
2894
2914
|
rows: e,
|
|
2895
2915
|
frozen: !1,
|
|
2896
2916
|
gridLines: !0,
|
|
2897
|
-
widths:
|
|
2917
|
+
widths: ja(e)
|
|
2898
2918
|
};
|
|
2899
2919
|
}
|
|
2900
|
-
let o =
|
|
2920
|
+
let o = ya(i), s = Aa(), c = i.flatMap((e) => e.spacer ? [{
|
|
2901
2921
|
cells: [],
|
|
2902
2922
|
page: e.page,
|
|
2903
2923
|
top: e.top,
|
|
2904
2924
|
own: e.height
|
|
2905
|
-
}] : e.design?.length > 0 && e.design.every((e) => e?.kind === "text") ?
|
|
2925
|
+
}] : e.design?.length > 0 && e.design.every((e) => e?.kind === "text") ? ba(e, o, s) : [{
|
|
2906
2926
|
cells: e.cells.map((t, n) => ({
|
|
2907
|
-
...
|
|
2927
|
+
...xa(t, e.design?.[n]),
|
|
2908
2928
|
format: s(e.design?.[n])
|
|
2909
2929
|
})),
|
|
2910
2930
|
page: e.page,
|
|
2911
2931
|
top: e.top,
|
|
2912
2932
|
own: e.height
|
|
2913
2933
|
}]);
|
|
2914
|
-
|
|
2915
|
-
let l =
|
|
2934
|
+
Ca(c);
|
|
2935
|
+
let l = Ta(a, c, o, r), u = c.reduce((e, t) => Math.max(e, t.cells.length), o.px.length), d = Array.from({ length: u }, (e, t) => Mr(o.px[t] ?? 64));
|
|
2916
2936
|
return {
|
|
2917
2937
|
name: t,
|
|
2918
2938
|
rows: c.map((e) => ({
|
|
@@ -2925,16 +2945,16 @@ function ma(e, t, n, r) {
|
|
|
2925
2945
|
drawing: l.anchors.length ? l : null
|
|
2926
2946
|
};
|
|
2927
2947
|
}
|
|
2928
|
-
function
|
|
2929
|
-
let i = n ?
|
|
2948
|
+
function va(e, t, n, r) {
|
|
2949
|
+
let i = n ? ir(e, r) : {
|
|
2930
2950
|
labels: [],
|
|
2931
2951
|
cells: () => []
|
|
2932
2952
|
}, a = [...i.labels.map(() => ({
|
|
2933
2953
|
field: null,
|
|
2934
2954
|
align: "left"
|
|
2935
|
-
})), ...e.columns], o = [...i.labels, ...e.columns.map(
|
|
2936
|
-
if (!t) return
|
|
2937
|
-
let r =
|
|
2955
|
+
})), ...e.columns], o = [...i.labels, ...e.columns.map(V)], s = a.map((n) => {
|
|
2956
|
+
if (!t) return $i;
|
|
2957
|
+
let r = G({
|
|
2938
2958
|
kind: "head",
|
|
2939
2959
|
column: n,
|
|
2940
2960
|
table: e.table
|
|
@@ -2943,17 +2963,17 @@ function ha(e, t, n, r) {
|
|
|
2943
2963
|
...r,
|
|
2944
2964
|
alignment: {
|
|
2945
2965
|
...r.alignment,
|
|
2946
|
-
indent: Math.max(r.alignment.indent ?? 0,
|
|
2966
|
+
indent: Math.max(r.alignment.indent ?? 0, la)
|
|
2947
2967
|
}
|
|
2948
2968
|
} : r;
|
|
2949
|
-
}), c = a.map((n) => t ?
|
|
2969
|
+
}), c = a.map((n) => t ? G({
|
|
2950
2970
|
kind: "cell",
|
|
2951
2971
|
column: n,
|
|
2952
2972
|
table: e.table
|
|
2953
2973
|
}) : null), l = /* @__PURE__ */ new Map(), u = (n, r) => {
|
|
2954
2974
|
if (!t || !r) return c[n];
|
|
2955
2975
|
let i = `${n}|${JSON.stringify(r)}`;
|
|
2956
|
-
return l.has(i) || l.set(i,
|
|
2976
|
+
return l.has(i) || l.set(i, G({
|
|
2957
2977
|
kind: "cell",
|
|
2958
2978
|
column: a[n],
|
|
2959
2979
|
table: e.table,
|
|
@@ -2970,16 +2990,16 @@ function ha(e, t, n, r) {
|
|
|
2970
2990
|
let { row: r, height: o } = n, s = e.columns.map((e) => r?.[e.field]), l = [...i.cells(n), ...s];
|
|
2971
2991
|
f.push({
|
|
2972
2992
|
cells: l.map((t, n) => ({
|
|
2973
|
-
...
|
|
2993
|
+
...xa(t, {
|
|
2974
2994
|
kind: "cell",
|
|
2975
2995
|
column: a[n]
|
|
2976
2996
|
}),
|
|
2977
|
-
format: n < d ? c[n] : u(n,
|
|
2997
|
+
format: n < d ? c[n] : u(n, be(e.table, a[n], r))
|
|
2978
2998
|
})),
|
|
2979
2999
|
height: t ? o : null
|
|
2980
3000
|
});
|
|
2981
3001
|
}
|
|
2982
|
-
let p =
|
|
3002
|
+
let p = ja(f), m = t ? a.map((e, t) => (Number(e.width) > 0 ? Mr(Number(e.width)) : p[t]) + ca) : p.map((e) => e + ca);
|
|
2983
3003
|
return {
|
|
2984
3004
|
name: e.id,
|
|
2985
3005
|
rows: f,
|
|
@@ -2988,7 +3008,7 @@ function ha(e, t, n, r) {
|
|
|
2988
3008
|
widths: m
|
|
2989
3009
|
};
|
|
2990
3010
|
}
|
|
2991
|
-
function
|
|
3011
|
+
function ya(e) {
|
|
2992
3012
|
let t = [];
|
|
2993
3013
|
for (let n of e) n.design?.forEach((e, n) => {
|
|
2994
3014
|
if (!e || e.kind === "text") return;
|
|
@@ -3000,7 +3020,7 @@ function ga(e) {
|
|
|
3000
3020
|
let n = 0;
|
|
3001
3021
|
for (let r = 0;; r++) {
|
|
3002
3022
|
if (r === t.length) {
|
|
3003
|
-
if (t.length >=
|
|
3023
|
+
if (t.length >= sa) return t.length - 1;
|
|
3004
3024
|
t.push(64);
|
|
3005
3025
|
}
|
|
3006
3026
|
if (n += t[r], e < n) return r;
|
|
@@ -3014,7 +3034,7 @@ function ga(e) {
|
|
|
3014
3034
|
right: (e) => r(e) + t[e]
|
|
3015
3035
|
};
|
|
3016
3036
|
}
|
|
3017
|
-
function
|
|
3037
|
+
function ba(e, t, n) {
|
|
3018
3038
|
let r = [], i = (e) => {
|
|
3019
3039
|
let t = r.find((t) => e.every((e) => t.cells[e] === void 0));
|
|
3020
3040
|
return t || (t = {
|
|
@@ -3024,7 +3044,7 @@ function _a(e, t, n) {
|
|
|
3024
3044
|
}, r.push(t)), t;
|
|
3025
3045
|
};
|
|
3026
3046
|
return e.cells.forEach((r, a) => {
|
|
3027
|
-
let o = e.design[a], s = n(o)?.alignment?.horizontal ?? "left", c =
|
|
3047
|
+
let o = e.design[a], s = n(o)?.alignment?.horizontal ?? "left", c = xa(r, o), l = c.numFmt ? c.value : Sa(r, o.template), u = c.numFmt, d = Math.max(0, Number(o.x) || 0), f = Math.max(1, Number(o.w) || 1), p = t.at(d), m = Math.max(p, t.at(d + f - 1)), h;
|
|
3028
3048
|
if (s === "center" && m > p) {
|
|
3029
3049
|
let e = Array.from({ length: m - p + 1 }, (e, t) => p + t), t = n.text(o, { centred: !0 });
|
|
3030
3050
|
h = i(e), h.cells[p] = {
|
|
@@ -3040,7 +3060,7 @@ function _a(e, t, n) {
|
|
|
3040
3060
|
let e = s === "right" ? m : p, r = s === "right" ? t.right(e) - (d + f) : d - t.left(e);
|
|
3041
3061
|
h = i([e]), h.cells[e] = {
|
|
3042
3062
|
value: l,
|
|
3043
|
-
format: n.text(o, { indent:
|
|
3063
|
+
format: n.text(o, { indent: kr(r) }),
|
|
3044
3064
|
numFmt: u
|
|
3045
3065
|
};
|
|
3046
3066
|
}
|
|
@@ -3052,36 +3072,36 @@ function _a(e, t, n) {
|
|
|
3052
3072
|
own: t.bottom - t.top
|
|
3053
3073
|
}));
|
|
3054
3074
|
}
|
|
3055
|
-
function
|
|
3075
|
+
function xa(e, t) {
|
|
3056
3076
|
let n = t?.kind === "cell" ? t.column?.format : t?.kind === "text" ? t.format : null, r = de(n);
|
|
3057
3077
|
if (!r) return { value: e };
|
|
3058
3078
|
let i = t.kind === "text" ? t.raw : e;
|
|
3059
3079
|
if (i === void 0) return { value: e };
|
|
3060
|
-
let a =
|
|
3080
|
+
let a = he(i, n);
|
|
3061
3081
|
return a === null ? { value: e } : {
|
|
3062
3082
|
value: a,
|
|
3063
3083
|
numFmt: r
|
|
3064
3084
|
};
|
|
3065
3085
|
}
|
|
3066
|
-
function
|
|
3067
|
-
if (typeof e != "string" || typeof t != "string" || !
|
|
3086
|
+
function Sa(e, t) {
|
|
3087
|
+
if (typeof e != "string" || typeof t != "string" || !pa.test(t)) return e;
|
|
3068
3088
|
let n = e.trim();
|
|
3069
|
-
if (!
|
|
3089
|
+
if (!fa.test(n)) return e;
|
|
3070
3090
|
let r = n.replace(/^-/, "").split(".")[0], i = n.replace(/[-.]/g, "");
|
|
3071
3091
|
return r.length > 11 || i.length > 15 ? e : Number(n);
|
|
3072
3092
|
}
|
|
3073
|
-
function
|
|
3093
|
+
function Ca(e) {
|
|
3074
3094
|
let t = 0;
|
|
3075
3095
|
e.forEach((n, r) => {
|
|
3076
|
-
let i = n.own > 0 ? n.own :
|
|
3096
|
+
let i = n.own > 0 ? n.own : da, a = e[r + 1], o = i;
|
|
3077
3097
|
if (a && a.page === n.page) {
|
|
3078
3098
|
let e = a.top - n.top;
|
|
3079
|
-
e > i && (o = Math.min(e, i +
|
|
3099
|
+
e > i && (o = Math.min(e, i + ua));
|
|
3080
3100
|
}
|
|
3081
|
-
n.height =
|
|
3101
|
+
n.height = jr(o) / .75, n.sheetTop = t, t += n.height;
|
|
3082
3102
|
});
|
|
3083
3103
|
}
|
|
3084
|
-
function
|
|
3104
|
+
function wa(e, t) {
|
|
3085
3105
|
let n = /* @__PURE__ */ new Map();
|
|
3086
3106
|
e.forEach((e, t) => {
|
|
3087
3107
|
n.has(e.page) || n.set(e.page, []), n.get(e.page).push(t);
|
|
@@ -3109,8 +3129,8 @@ function xa(e, t) {
|
|
|
3109
3129
|
y: r
|
|
3110
3130
|
};
|
|
3111
3131
|
}
|
|
3112
|
-
function
|
|
3113
|
-
let i =
|
|
3132
|
+
function Ta(e, t, n, r) {
|
|
3133
|
+
let i = wa(t, n), a = [], o = Ea(r), s = (e, t, n, r, a) => {
|
|
3114
3134
|
let o = i.x(t), s = i.y(e, n), c = i.x(t + r), l = i.y(e, n + a);
|
|
3115
3135
|
return {
|
|
3116
3136
|
anchor: {
|
|
@@ -3129,9 +3149,9 @@ function Sa(e, t, n, r) {
|
|
|
3129
3149
|
};
|
|
3130
3150
|
for (let r of e) {
|
|
3131
3151
|
if (r.kind === "image") {
|
|
3132
|
-
let e = o.get(
|
|
3152
|
+
let e = o.get(_i(r.item.resolvedSrc));
|
|
3133
3153
|
if (!e) continue;
|
|
3134
|
-
let t =
|
|
3154
|
+
let t = $r(r.item.fit, {
|
|
3135
3155
|
w: r.w,
|
|
3136
3156
|
h: r.h
|
|
3137
3157
|
}, e.natural), { anchor: n } = s(r.page, r.x + t.x, r.y + t.y, t.w, t.h);
|
|
@@ -3139,7 +3159,7 @@ function Sa(e, t, n, r) {
|
|
|
3139
3159
|
...n,
|
|
3140
3160
|
cx: t.w,
|
|
3141
3161
|
cy: t.h,
|
|
3142
|
-
shape:
|
|
3162
|
+
shape: ni({
|
|
3143
3163
|
rId: e.rId,
|
|
3144
3164
|
alt: r.item.alt,
|
|
3145
3165
|
crop: t.crop
|
|
@@ -3148,7 +3168,7 @@ function Sa(e, t, n, r) {
|
|
|
3148
3168
|
continue;
|
|
3149
3169
|
}
|
|
3150
3170
|
if (r.kind === "line") {
|
|
3151
|
-
let e = r.item.style ?? {}, t = Math.max(0, Number(e.thickness ?? 1)) || 1, n =
|
|
3171
|
+
let e = r.item.style ?? {}, t = Math.max(0, Number(e.thickness ?? 1)) || 1, n = ai({
|
|
3152
3172
|
style: [
|
|
3153
3173
|
"solid",
|
|
3154
3174
|
"dashed",
|
|
@@ -3156,18 +3176,18 @@ function Sa(e, t, n, r) {
|
|
|
3156
3176
|
"double"
|
|
3157
3177
|
].includes(e.lineStyle) ? e.lineStyle : "solid",
|
|
3158
3178
|
width: t,
|
|
3159
|
-
color:
|
|
3179
|
+
color: W(e.color) ?? "FF000000"
|
|
3160
3180
|
}), i = r.item.orientation === "vertical", o = i ? s(r.page, r.x + r.w / 2, r.y, 0, r.h) : s(r.page, r.x, r.y + r.h / 2, r.w, 0);
|
|
3161
3181
|
a.push({
|
|
3162
3182
|
...o.anchor,
|
|
3163
3183
|
cx: i ? 0 : o.sheet.x2 - o.sheet.x1,
|
|
3164
3184
|
cy: i ? o.sheet.y2 - o.sheet.y1 : 0,
|
|
3165
|
-
shape:
|
|
3185
|
+
shape: ii(n)
|
|
3166
3186
|
});
|
|
3167
3187
|
continue;
|
|
3168
3188
|
}
|
|
3169
3189
|
if (r.kind === "box") {
|
|
3170
|
-
let e = r.item.style ?? {}, i =
|
|
3190
|
+
let e = r.item.style ?? {}, i = W(e.background), o = Math.max(0, Number(e.borderWidth ?? 1)) || 1, c = e.borderStyle === "none" ? null : ai({
|
|
3171
3191
|
style: [
|
|
3172
3192
|
"solid",
|
|
3173
3193
|
"dashed",
|
|
@@ -3175,15 +3195,15 @@ function Sa(e, t, n, r) {
|
|
|
3175
3195
|
"double"
|
|
3176
3196
|
].includes(e.borderStyle) ? e.borderStyle : "solid",
|
|
3177
3197
|
width: o,
|
|
3178
|
-
color:
|
|
3179
|
-
}), l = s(r.page, r.x, r.y, r.w, r.h), u = i &&
|
|
3180
|
-
if (u &&
|
|
3198
|
+
color: W(e.borderColor) ?? "FF000000"
|
|
3199
|
+
}), l = s(r.page, r.x, r.y, r.w, r.h), u = i && Oa(t, n, l.sheet);
|
|
3200
|
+
if (u && ka(t, n, l.sheet, i), !c && (u || !i)) continue;
|
|
3181
3201
|
let d = c ? c.width / 2 : 0, f = s(r.page, r.x + d, r.y + d, r.w - 2 * d, r.h - 2 * d), p = Math.max(0, f.sheet.x2 - f.sheet.x1), m = Math.max(0, f.sheet.y2 - f.sheet.y1);
|
|
3182
3202
|
a.push({
|
|
3183
3203
|
...f.anchor,
|
|
3184
3204
|
cx: p,
|
|
3185
3205
|
cy: m,
|
|
3186
|
-
shape:
|
|
3206
|
+
shape: ri({
|
|
3187
3207
|
fill: u ? null : i,
|
|
3188
3208
|
outline: c,
|
|
3189
3209
|
radius: Math.max(0, (Number(e.radius) || 0) - d),
|
|
@@ -3198,18 +3218,18 @@ function Sa(e, t, n, r) {
|
|
|
3198
3218
|
media: o.list
|
|
3199
3219
|
};
|
|
3200
3220
|
}
|
|
3201
|
-
function
|
|
3221
|
+
function Ea(e) {
|
|
3202
3222
|
let t = e instanceof Map ? e : new Map(Object.entries(e ?? {})), n = /* @__PURE__ */ new Map(), r = [];
|
|
3203
3223
|
function i(e) {
|
|
3204
3224
|
if (!e) return null;
|
|
3205
3225
|
if (n.has(e)) return n.get(e);
|
|
3206
|
-
let i =
|
|
3226
|
+
let i = Xr(e);
|
|
3207
3227
|
if (!i) {
|
|
3208
3228
|
let n = t.get(e);
|
|
3209
3229
|
i = n instanceof ArrayBuffer ? new Uint8Array(n) : n instanceof Uint8Array ? n : null;
|
|
3210
3230
|
}
|
|
3211
|
-
let a = i ?
|
|
3212
|
-
if (!a || !
|
|
3231
|
+
let a = i ? Zr(i) : null;
|
|
3232
|
+
if (!a || !Jr[a.ext]) return n.set(e, null), null;
|
|
3213
3233
|
let o = r.length + 1, s = {
|
|
3214
3234
|
rId: `rId${o}`,
|
|
3215
3235
|
file: `image${o}.${a.ext}`,
|
|
@@ -3227,7 +3247,7 @@ function Ca(e) {
|
|
|
3227
3247
|
list: r
|
|
3228
3248
|
};
|
|
3229
3249
|
}
|
|
3230
|
-
function
|
|
3250
|
+
function Da(e, t, n) {
|
|
3231
3251
|
let r = (e, t, n, r) => Math.min(t, r) - Math.max(e, n) >= (r - n) / 2, i = [];
|
|
3232
3252
|
e.forEach((e, t) => {
|
|
3233
3253
|
e.height > 0 && r(n.y1, n.y2, e.sheetTop, e.sheetTop + e.height) && i.push(t);
|
|
@@ -3247,11 +3267,11 @@ function wa(e, t, n) {
|
|
|
3247
3267
|
colIndexes: [c]
|
|
3248
3268
|
};
|
|
3249
3269
|
}
|
|
3250
|
-
function
|
|
3270
|
+
function Oa(e, t, n) {
|
|
3251
3271
|
return e.some((e, r) => e.sheetTop >= n.y2 || e.sheetTop + e.height <= n.y1 ? !1 : e.cells.some((e, r) => !e || e.value === null || e.value === void 0 || e.value === "" ? !1 : t.left(r) < n.x2 && t.right(r) > n.x1));
|
|
3252
3272
|
}
|
|
3253
|
-
function
|
|
3254
|
-
let { rowIndexes: i, colIndexes: a } =
|
|
3273
|
+
function ka(e, t, n, r) {
|
|
3274
|
+
let { rowIndexes: i, colIndexes: a } = Da(e, t, n), o = /* @__PURE__ */ new Map(), s = (e) => e?.fill ? e : (o.has(e) || o.set(e, {
|
|
3255
3275
|
...e ?? {},
|
|
3256
3276
|
fill: r
|
|
3257
3277
|
}), o.get(e));
|
|
@@ -3266,7 +3286,7 @@ function Ea(e, t, n, r) {
|
|
|
3266
3286
|
};
|
|
3267
3287
|
}
|
|
3268
3288
|
}
|
|
3269
|
-
function
|
|
3289
|
+
function Aa() {
|
|
3270
3290
|
let e = /* @__PURE__ */ new WeakMap(), t = /* @__PURE__ */ new WeakMap();
|
|
3271
3291
|
function n(t) {
|
|
3272
3292
|
if (!t) return null;
|
|
@@ -3274,14 +3294,14 @@ function Da() {
|
|
|
3274
3294
|
let r = t.column ?? t;
|
|
3275
3295
|
e.has(r) || e.set(r, {});
|
|
3276
3296
|
let i = e.get(r), a = t.highlight ? `${t.kind}|${JSON.stringify(t.highlight)}` : t.kind;
|
|
3277
|
-
return i[a] ??=
|
|
3297
|
+
return i[a] ??= G(t), i[a];
|
|
3278
3298
|
}
|
|
3279
3299
|
return n.text = (e, { centred: n = !1, indent: r = 0 } = {}) => {
|
|
3280
3300
|
let i = e.style ?? e;
|
|
3281
3301
|
t.has(i) || t.set(i, /* @__PURE__ */ new Map());
|
|
3282
3302
|
let a = t.get(i), o = `${n}|${r}|${e.highlight ? JSON.stringify(e.highlight) : ""}`;
|
|
3283
3303
|
if (!a.has(o)) {
|
|
3284
|
-
let t =
|
|
3304
|
+
let t = G(e);
|
|
3285
3305
|
a.set(o, {
|
|
3286
3306
|
...t,
|
|
3287
3307
|
alignment: {
|
|
@@ -3294,26 +3314,26 @@ function Da() {
|
|
|
3294
3314
|
return a.get(o);
|
|
3295
3315
|
}, n;
|
|
3296
3316
|
}
|
|
3297
|
-
function
|
|
3317
|
+
function ja(e) {
|
|
3298
3318
|
let t = [];
|
|
3299
3319
|
for (let { cells: n } of e) n.forEach((e, n) => {
|
|
3300
|
-
t[n] ??=
|
|
3320
|
+
t[n] ??= aa;
|
|
3301
3321
|
let r = e?.value;
|
|
3302
3322
|
if (r == null) return;
|
|
3303
3323
|
let i = r instanceof Date ? 18 : String(r).split("\n").reduce((e, t) => Math.max(e, t.length), 0);
|
|
3304
|
-
t[n] = Math.max(t[n], Math.min(
|
|
3324
|
+
t[n] = Math.max(t[n], Math.min(oa, i + 2));
|
|
3305
3325
|
});
|
|
3306
|
-
for (let e = 0; e < t.length; e++) t[e] ??=
|
|
3326
|
+
for (let e = 0; e < t.length; e++) t[e] ??= aa;
|
|
3307
3327
|
return t;
|
|
3308
3328
|
}
|
|
3309
|
-
function
|
|
3310
|
-
if (t.length >
|
|
3311
|
-
if (a >
|
|
3312
|
-
let c =
|
|
3329
|
+
function Ma({ name: e, rows: t, frozen: n, gridLines: r, widths: i, width: a, drawing: o }, s) {
|
|
3330
|
+
if (t.length > X.rows) throw RangeError(`Sheet "${e}" has ${t.length} rows; Excel allows ${X.rows}.`);
|
|
3331
|
+
if (a > X.columns) throw RangeError(`Sheet "${e}" has ${a} columns; Excel allows ${X.columns}.`);
|
|
3332
|
+
let c = Na(a, t.length), l = Pa(s), u = [Qi, `<worksheet xmlns="${Hi}" xmlns:r="${Ui}">`];
|
|
3313
3333
|
if (u.push(`<dimension ref="${c}"/>`), u.push(`<sheetViews><sheetView${r ? "" : " showGridLines=\"0\""} workbookViewId="0">`), n && t.length > 1 && u.push("<pane ySplit=\"1\" topLeftCell=\"A2\" activePane=\"bottomLeft\" state=\"frozen\"/><selection pane=\"bottomLeft\" activeCell=\"A2\" sqref=\"A2\"/>"), u.push("</sheetView></sheetViews>"), a > 0) {
|
|
3314
3334
|
u.push("<cols>");
|
|
3315
3335
|
for (let e = 0; e < a; e++) {
|
|
3316
|
-
let t = i?.[e] ??
|
|
3336
|
+
let t = i?.[e] ?? aa;
|
|
3317
3337
|
u.push(`<col min="${e + 1}" max="${e + 1}" width="${t}" customWidth="1"/>`);
|
|
3318
3338
|
}
|
|
3319
3339
|
u.push("</cols>");
|
|
@@ -3321,18 +3341,18 @@ function ka({ name: e, rows: t, frozen: n, gridLines: r, widths: i, width: a, dr
|
|
|
3321
3341
|
return u.push("<sheetData>"), t.forEach((e, t) => {
|
|
3322
3342
|
let n = "";
|
|
3323
3343
|
e.cells.forEach((e, r) => {
|
|
3324
|
-
e && (n +=
|
|
3344
|
+
e && (n += Fa(`${Ra(r)}${t + 1}`, e.value, e.format, l, e.numFmt));
|
|
3325
3345
|
});
|
|
3326
|
-
let r = Number(e.height) > 0 ? ` ht="${
|
|
3346
|
+
let r = Number(e.height) > 0 ? ` ht="${jr(Number(e.height))}" customHeight="1"` : "";
|
|
3327
3347
|
u.push(`<row r="${t + 1}"${r}>${n}</row>`);
|
|
3328
3348
|
}), u.push("</sheetData>"), n && a > 0 && u.push(`<autoFilter ref="${c}"/>`), a > 0 && u.push(`<ignoredErrors><ignoredError sqref="${c}" numberStoredAsText="1"/></ignoredErrors>`), o && u.push("<drawing r:id=\"rId1\"/>"), u.push("</worksheet>"), u.join("");
|
|
3329
3349
|
}
|
|
3330
|
-
function
|
|
3350
|
+
function Na(e, t) {
|
|
3331
3351
|
if (e === 0 || t === 0) return "A1";
|
|
3332
|
-
let n = `${
|
|
3352
|
+
let n = `${Ra(e - 1)}${t}`;
|
|
3333
3353
|
return n === "A1" ? "A1" : `A1:${n}`;
|
|
3334
3354
|
}
|
|
3335
|
-
function
|
|
3355
|
+
function Pa(e) {
|
|
3336
3356
|
let t = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new Map();
|
|
3337
3357
|
return (r, i) => {
|
|
3338
3358
|
let a = typeof i == "string" ? e.numFmt(i) : i;
|
|
@@ -3342,20 +3362,20 @@ function ja(e) {
|
|
|
3342
3362
|
return o.has(a) || o.set(a, e.xf(r, a)), o.get(a);
|
|
3343
3363
|
};
|
|
3344
3364
|
}
|
|
3345
|
-
function
|
|
3365
|
+
function Fa(e, t, n, r, i) {
|
|
3346
3366
|
let a = t == null || t === "", o = t instanceof Date && !Number.isNaN(t.getTime()), s = 0, c = null;
|
|
3347
|
-
o && (c =
|
|
3367
|
+
o && (c = La(t), s = Number.isInteger(c) ? ea : ta), i && typeof t == "number" && (s = i), i && o && (s = i);
|
|
3348
3368
|
let l = r(n, s), u = l ? ` s="${l}"` : "";
|
|
3349
|
-
return a ? l ? `<c r="${e}"${u}/>` : "" : o ? `<c r="${e}"${u}><v>${c}</v></c>` : typeof t == "number" ? Number.isFinite(t) ? `<c r="${e}"${u}><v>${t}</v></c>` :
|
|
3369
|
+
return a ? l ? `<c r="${e}"${u}/>` : "" : o ? `<c r="${e}"${u}><v>${c}</v></c>` : typeof t == "number" ? Number.isFinite(t) ? `<c r="${e}"${u}><v>${t}</v></c>` : Ia(e, String(t), u) : typeof t == "boolean" ? `<c r="${e}"${u} t="b"><v>${+!!t}</v></c>` : Ia(e, String(t), u);
|
|
3350
3370
|
}
|
|
3351
|
-
function
|
|
3352
|
-
let r = t.replace(
|
|
3353
|
-
return r.length >
|
|
3371
|
+
function Ia(e, t, n) {
|
|
3372
|
+
let r = t.replace(na, "");
|
|
3373
|
+
return r.length > X.cellText && (r = r.slice(0, X.cellText), /[\uD800-\uDBFF]$/.test(r) && (r = r.slice(0, -1))), `<c r="${e}"${n} t="inlineStr"><is><t${/^\s|\s$|\n/.test(r) ? " xml:space=\"preserve\"" : ""}>${Ka(r.replace(ra, "_x005F_$1"))}</t></is></c>`;
|
|
3354
3374
|
}
|
|
3355
|
-
function
|
|
3375
|
+
function La(e) {
|
|
3356
3376
|
return Date.UTC(e.getFullYear(), e.getMonth(), e.getDate(), e.getHours(), e.getMinutes(), e.getSeconds(), e.getMilliseconds()) / 864e5 + 25569;
|
|
3357
3377
|
}
|
|
3358
|
-
function
|
|
3378
|
+
function Ra(e) {
|
|
3359
3379
|
let t = "", n = e + 1;
|
|
3360
3380
|
for (; n > 0;) {
|
|
3361
3381
|
let e = (n - 1) % 26;
|
|
@@ -3363,103 +3383,103 @@ function Fa(e) {
|
|
|
3363
3383
|
}
|
|
3364
3384
|
return t;
|
|
3365
3385
|
}
|
|
3366
|
-
function
|
|
3386
|
+
function za(e) {
|
|
3367
3387
|
let t = /* @__PURE__ */ new Set(["history"]);
|
|
3368
3388
|
return e.map((e) => {
|
|
3369
|
-
let n = String(e ?? "").replace(
|
|
3370
|
-
n =
|
|
3389
|
+
let n = String(e ?? "").replace(ia, "-").trim().replace(/^'+|'+$/g, "").trim() || "Sheet";
|
|
3390
|
+
n = Ba(n, X.sheetName);
|
|
3371
3391
|
let r = n;
|
|
3372
3392
|
for (let e = 2; t.has(r.toLowerCase()); e++) {
|
|
3373
3393
|
let t = ` (${e})`;
|
|
3374
|
-
r =
|
|
3394
|
+
r = Ba(n, X.sheetName - t.length) + t;
|
|
3375
3395
|
}
|
|
3376
3396
|
return t.add(r.toLowerCase()), r;
|
|
3377
3397
|
});
|
|
3378
3398
|
}
|
|
3379
|
-
function
|
|
3399
|
+
function Ba(e, t) {
|
|
3380
3400
|
if (e.length <= t) return e;
|
|
3381
3401
|
let n = e.slice(0, t);
|
|
3382
3402
|
return /[\uD800-\uDBFF]$/.test(n) ? n.slice(0, -1) : n;
|
|
3383
3403
|
}
|
|
3384
|
-
function
|
|
3385
|
-
let r = Array.from({ length: e }, (e, t) => `<Override PartName="/xl/worksheets/sheet${t + 1}.xml" ContentType="${
|
|
3404
|
+
function Va(e, t = [], n = []) {
|
|
3405
|
+
let r = Array.from({ length: e }, (e, t) => `<Override PartName="/xl/worksheets/sheet${t + 1}.xml" ContentType="${Yi}"/>`).join(""), i = t.map((e) => `<Override PartName="/xl/drawings/drawing${e.n}.xml" ContentType="${Gr}"/>`).join(""), a = [...new Set(n.map((e) => e.ext))].map((e) => `<Default Extension="${e}" ContentType="${Jr[e]}"/>`).join("");
|
|
3386
3406
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
3387
|
-
<Types xmlns="${
|
|
3407
|
+
<Types xmlns="${Gi}"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/>` + a + `<Override PartName="/xl/workbook.xml" ContentType="${Xi}"/><Override PartName="/xl/styles.xml" ContentType="${Zi}"/>` + r + i + "</Types>";
|
|
3388
3408
|
}
|
|
3389
|
-
function
|
|
3409
|
+
function Ha() {
|
|
3390
3410
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
3391
|
-
<Relationships xmlns="${
|
|
3411
|
+
<Relationships xmlns="${Wi}"><Relationship Id="rId1" Type="${Ki}" Target="xl/workbook.xml"/></Relationships>`;
|
|
3392
3412
|
}
|
|
3393
|
-
function
|
|
3413
|
+
function Ua(e) {
|
|
3394
3414
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
3395
|
-
<Relationships xmlns="${
|
|
3415
|
+
<Relationships xmlns="${Wi}"><Relationship Id="rId1" Type="${Kr}" Target="../drawings/drawing${e}.xml"/></Relationships>`;
|
|
3396
3416
|
}
|
|
3397
|
-
function
|
|
3398
|
-
let t = e.map((e, t) => `<sheet name="${
|
|
3417
|
+
function Wa(e) {
|
|
3418
|
+
let t = e.map((e, t) => `<sheet name="${qa(e.name)}" sheetId="${t + 1}" r:id="rId${t + 1}"/>`).join(""), n = e.map((e, t) => !e.frozen || e.width === 0 ? "" : `<definedName name="_xlnm._FilterDatabase" localSheetId="${t}" hidden="1">${Ka(`${`'${e.name.replace(/'/g, "''")}'`}!$A$1:$${Ra(e.width - 1)}$${e.rows.length}`)}</definedName>`).join("");
|
|
3399
3419
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
3400
|
-
<workbook xmlns="${
|
|
3420
|
+
<workbook xmlns="${Hi}" xmlns:r="${Ui}"><bookViews><workbookView/></bookViews><sheets>${t}</sheets>` + (n ? `<definedNames>${n}</definedNames>` : "") + "</workbook>";
|
|
3401
3421
|
}
|
|
3402
|
-
function
|
|
3403
|
-
let t = Array.from({ length: e }, (e, t) => `<Relationship Id="rId${t + 1}" Type="${
|
|
3422
|
+
function Ga(e) {
|
|
3423
|
+
let t = Array.from({ length: e }, (e, t) => `<Relationship Id="rId${t + 1}" Type="${qi}" Target="worksheets/sheet${t + 1}.xml"/>`).join("");
|
|
3404
3424
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
3405
|
-
<Relationships xmlns="${
|
|
3425
|
+
<Relationships xmlns="${Wi}">` + t + `<Relationship Id="rId${e + 1}" Type="${Ji}" Target="styles.xml"/></Relationships>`;
|
|
3406
3426
|
}
|
|
3407
|
-
function
|
|
3427
|
+
function Ka(e) {
|
|
3408
3428
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
3409
3429
|
}
|
|
3410
|
-
function
|
|
3411
|
-
return
|
|
3430
|
+
function qa(e) {
|
|
3431
|
+
return Ka(e.replace(na, "")).replace(/"/g, """);
|
|
3412
3432
|
}
|
|
3413
3433
|
//#endregion
|
|
3414
3434
|
//#region src/engine/index.js
|
|
3415
|
-
function
|
|
3416
|
-
return
|
|
3435
|
+
function Ja(e, t) {
|
|
3436
|
+
return Nn(st($t(Gt(e, t), t)));
|
|
3417
3437
|
}
|
|
3418
3438
|
//#endregion
|
|
3419
3439
|
//#region src/render/render.js
|
|
3420
|
-
var
|
|
3440
|
+
var Ya = (e) => `padding-top:${q(e?.top)}px;padding-left:${q(e?.left)}px;padding-bottom:${q(e?.bottom)}px;padding-right:${q(e?.right)}px;`, Xa = [
|
|
3421
3441
|
"pageHeader",
|
|
3422
3442
|
"reportHeader",
|
|
3423
3443
|
"detail",
|
|
3424
3444
|
"reportFooter",
|
|
3425
3445
|
"pageFooter"
|
|
3426
3446
|
];
|
|
3427
|
-
function
|
|
3447
|
+
function Za(e) {
|
|
3428
3448
|
let t = e.page;
|
|
3429
3449
|
return `
|
|
3430
3450
|
<main id="main-page">
|
|
3431
3451
|
${e.pages.map((e) => `
|
|
3432
|
-
<section id="page-${
|
|
3433
|
-
${
|
|
3452
|
+
<section id="page-${Y(e.pageNO)}" class="page" style="height:${q(t.height)}px; width:${q(t.width)}px; ${Ya(t.margin)};position:relative">
|
|
3453
|
+
${Qa(e, t)}
|
|
3434
3454
|
</section>
|
|
3435
3455
|
`).join("")}
|
|
3436
3456
|
</main>
|
|
3437
3457
|
`;
|
|
3438
3458
|
}
|
|
3439
|
-
function
|
|
3459
|
+
function Qa(e, t) {
|
|
3440
3460
|
let n = (e) => {
|
|
3441
|
-
let t =
|
|
3442
|
-
return t === -1 ?
|
|
3461
|
+
let t = Xa.indexOf(e);
|
|
3462
|
+
return t === -1 ? Xa.length : t;
|
|
3443
3463
|
}, r = [...e.bands].sort(({ type: e }, { type: t }) => n(e) - n(t)), i = [];
|
|
3444
|
-
for (let n of r) i.push(
|
|
3464
|
+
for (let n of r) i.push($a(n, e.pageNO, t));
|
|
3445
3465
|
return i.join("");
|
|
3446
3466
|
}
|
|
3447
|
-
function
|
|
3467
|
+
function $a(e, t, n) {
|
|
3448
3468
|
let r = Number.isFinite(e.top), i = n?.margin ?? {
|
|
3449
3469
|
top: 0,
|
|
3450
3470
|
left: 0,
|
|
3451
3471
|
right: 0
|
|
3452
|
-
}, a = r ? `position:absolute;top:${
|
|
3472
|
+
}, a = r ? `position:absolute;top:${q(e.top) + q(i.top)}px;left:${q(i.left)}px;right:${q(i.right)}px;` : "position:relative;", o = Math.max(e.zoneHeight ?? 0, e.measuredHeight ?? 0);
|
|
3453
3473
|
return `
|
|
3454
|
-
<div class="band" id="${
|
|
3455
|
-
${
|
|
3474
|
+
<div class="band" id="${Y(e.type)}-${Y(t)}" style="${a}${o > 0 ? `height:${q(o)}px` : ""}" data-band-type="${Y(e.type)}">
|
|
3475
|
+
${di(e.items)}
|
|
3456
3476
|
</div>
|
|
3457
3477
|
`;
|
|
3458
3478
|
}
|
|
3459
3479
|
//#endregion
|
|
3460
3480
|
//#region src/shared/window.js
|
|
3461
|
-
var
|
|
3462
|
-
function
|
|
3481
|
+
var eo = 1280, to = 900;
|
|
3482
|
+
function no(e, t) {
|
|
3463
3483
|
for (let n of e.querySelectorAll("link[rel=\"stylesheet\"], style")) {
|
|
3464
3484
|
if (n.tagName === "LINK") {
|
|
3465
3485
|
let e = t.createElement("link");
|
|
@@ -3470,11 +3490,11 @@ function $a(e, t) {
|
|
|
3470
3490
|
e.textContent = n.textContent, t.head.appendChild(e);
|
|
3471
3491
|
}
|
|
3472
3492
|
}
|
|
3473
|
-
function
|
|
3493
|
+
function ro({ title: e = "Report Studio", width: t = eo, height: n = to, features: r, opener: i = globalThis } = {}) {
|
|
3474
3494
|
let a = r ?? `width=${t},height=${n},resizable=yes,scrollbars=yes`, o = i.open?.("", "_blank", a);
|
|
3475
3495
|
if (!o || !o.document) return null;
|
|
3476
3496
|
let s = o.document;
|
|
3477
|
-
s.open(), s.write("<!doctype html><html><head><meta charset=\"utf-8\"></head><body></body></html>"), s.close(), s.title = e,
|
|
3497
|
+
s.open(), s.write("<!doctype html><html><head><meta charset=\"utf-8\"></head><body></body></html>"), s.close(), s.title = e, no(i.document, s);
|
|
3478
3498
|
let c = s.createElement("div");
|
|
3479
3499
|
return c.id = "report-studio", c.style.height = "100vh", s.body.style.margin = "0", s.body.appendChild(c), {
|
|
3480
3500
|
window: o,
|
|
@@ -3483,7 +3503,7 @@ function eo({ title: e = "Report Studio", width: t = Za, height: n = Qa, feature
|
|
|
3483
3503
|
close: () => o.close()
|
|
3484
3504
|
};
|
|
3485
3505
|
}
|
|
3486
|
-
function
|
|
3506
|
+
function io(e, t, n = () => {}) {
|
|
3487
3507
|
let r = () => {
|
|
3488
3508
|
n(), t.close();
|
|
3489
3509
|
};
|
|
@@ -3491,87 +3511,139 @@ function to(e, t, n = () => {}) {
|
|
|
3491
3511
|
}
|
|
3492
3512
|
//#endregion
|
|
3493
3513
|
//#region src/shared/dropdown.js
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3514
|
+
var ao = 8, oo = 4;
|
|
3515
|
+
function so(e) {
|
|
3516
|
+
let t = e.querySelector(".dropdown-trigger"), n = e.querySelector(".dropdown-value"), r = e.querySelector(".dropdown-menu"), i = [...r.querySelectorAll(".dropdown-item")], a = /* @__PURE__ */ new Set(), o = () => t.ownerDocument, s = () => o().defaultView, c = i.find((e) => e.dataset.selected === "true")?.dataset.value ?? i[0]?.dataset.value ?? "", l = Math.max(i.findIndex((e) => e.dataset.value === c), 0);
|
|
3517
|
+
function u() {
|
|
3497
3518
|
i.forEach((e, t) => {
|
|
3498
|
-
let n = e.dataset.value ===
|
|
3499
|
-
e.setAttribute("aria-selected", String(n)), e.classList.toggle("is-active", t ===
|
|
3519
|
+
let n = e.dataset.value === c;
|
|
3520
|
+
e.setAttribute("aria-selected", String(n)), e.classList.toggle("is-active", t === l);
|
|
3500
3521
|
});
|
|
3501
|
-
let e = i.find((e) => e.dataset.value ===
|
|
3522
|
+
let e = i.find((e) => e.dataset.value === c);
|
|
3502
3523
|
e && (n.textContent = e.textContent.trim());
|
|
3503
3524
|
}
|
|
3504
|
-
function
|
|
3525
|
+
function d(e, { notify: t = !1 } = {}) {
|
|
3505
3526
|
let n = i.find((t) => t.dataset.value === String(e));
|
|
3506
3527
|
if (!n) return;
|
|
3507
|
-
let r = n.dataset.value !==
|
|
3508
|
-
if (
|
|
3528
|
+
let r = n.dataset.value !== c;
|
|
3529
|
+
if (c = n.dataset.value, l = i.indexOf(n), u(), t && r) for (let e of a) e();
|
|
3509
3530
|
}
|
|
3510
|
-
let d = () => !r.hidden;
|
|
3511
3531
|
function f() {
|
|
3512
|
-
|
|
3532
|
+
let e = t.getBoundingClientRect(), n = s(), { style: i } = r;
|
|
3533
|
+
i.top = "0px", i.left = "0px", i.maxHeight = "", i.setProperty("--dropdown-trigger-width", `${e.width}px`);
|
|
3534
|
+
let a = r.getBoundingClientRect(), o = r.offsetHeight, c = r.offsetWidth, l = n.innerHeight - e.bottom - oo - ao, u = e.top - oo - ao, d;
|
|
3535
|
+
o <= l || l >= u ? (d = e.bottom + oo, o > l && (i.maxHeight = `${Math.max(l, 0)}px`)) : (o > u && (i.maxHeight = `${u}px`), d = e.top - oo - Math.min(o, u));
|
|
3536
|
+
let f = Math.max(Math.min(e.left, n.innerWidth - c - ao), ao);
|
|
3537
|
+
i.top = `${Math.round(d - a.top)}px`, i.left = `${Math.round(f - a.left)}px`;
|
|
3538
|
+
}
|
|
3539
|
+
function p(e) {
|
|
3540
|
+
if (!e) return;
|
|
3541
|
+
e.focus({ preventScroll: !0 });
|
|
3542
|
+
let t = e.offsetTop, n = t + e.offsetHeight;
|
|
3543
|
+
t < r.scrollTop ? r.scrollTop = t : n > r.scrollTop + r.clientHeight && (r.scrollTop = n - r.clientHeight);
|
|
3544
|
+
}
|
|
3545
|
+
let m = () => !r.hidden;
|
|
3546
|
+
function h() {
|
|
3547
|
+
m() || (r.hidden = !1, t.setAttribute("aria-expanded", "true"), l = Math.max(i.findIndex((e) => e.dataset.value === c), 0), u(), f(), p(i[l]), setTimeout(() => {
|
|
3548
|
+
m() && o().addEventListener("pointerdown", v);
|
|
3549
|
+
}, 0), o().addEventListener("scroll", y, !0), s().addEventListener("resize", y));
|
|
3550
|
+
}
|
|
3551
|
+
function g() {
|
|
3552
|
+
o().removeEventListener("pointerdown", v), o().removeEventListener("scroll", y, !0), s()?.removeEventListener("resize", y);
|
|
3553
|
+
}
|
|
3554
|
+
function _({ focusTrigger: e = !0 } = {}) {
|
|
3555
|
+
m() && (r.hidden = !0, t.setAttribute("aria-expanded", "false"), g(), e && t.focus());
|
|
3513
3556
|
}
|
|
3514
|
-
function
|
|
3515
|
-
|
|
3557
|
+
function v(t) {
|
|
3558
|
+
e.contains(t.target) || _({ focusTrigger: !1 });
|
|
3516
3559
|
}
|
|
3517
|
-
function
|
|
3518
|
-
e.contains(
|
|
3560
|
+
function y(e) {
|
|
3561
|
+
e.type === "scroll" && r.contains(e.target) || _({ focusTrigger: !1 });
|
|
3519
3562
|
}
|
|
3520
|
-
function
|
|
3521
|
-
|
|
3563
|
+
function b(e) {
|
|
3564
|
+
l = (e + i.length) % i.length, u(), p(i[l]);
|
|
3522
3565
|
}
|
|
3523
|
-
function
|
|
3566
|
+
function x(e) {
|
|
3524
3567
|
[
|
|
3525
3568
|
"ArrowDown",
|
|
3526
3569
|
"ArrowUp",
|
|
3527
3570
|
"Enter",
|
|
3528
3571
|
" "
|
|
3529
|
-
].includes(e.key) && (e.preventDefault(), e.stopPropagation(),
|
|
3572
|
+
].includes(e.key) && (e.preventDefault(), e.stopPropagation(), h());
|
|
3530
3573
|
}
|
|
3531
|
-
function
|
|
3574
|
+
function S(e) {
|
|
3532
3575
|
let t = {
|
|
3533
|
-
ArrowDown: () =>
|
|
3534
|
-
ArrowUp: () =>
|
|
3535
|
-
Home: () =>
|
|
3536
|
-
End: () =>
|
|
3537
|
-
Escape: () =>
|
|
3576
|
+
ArrowDown: () => b(l + 1),
|
|
3577
|
+
ArrowUp: () => b(l - 1),
|
|
3578
|
+
Home: () => b(0),
|
|
3579
|
+
End: () => b(i.length - 1),
|
|
3580
|
+
Escape: () => _(),
|
|
3538
3581
|
Enter: () => {
|
|
3539
|
-
|
|
3582
|
+
d(i[l].dataset.value, { notify: !0 }), _();
|
|
3540
3583
|
},
|
|
3541
3584
|
" ": () => {
|
|
3542
|
-
|
|
3585
|
+
d(i[l].dataset.value, { notify: !0 }), _();
|
|
3543
3586
|
},
|
|
3544
|
-
Tab: () =>
|
|
3587
|
+
Tab: () => _({ focusTrigger: !1 })
|
|
3545
3588
|
}[e.key];
|
|
3546
3589
|
t && (e.key !== "Tab" && (e.preventDefault(), e.stopPropagation()), t());
|
|
3547
3590
|
}
|
|
3548
|
-
t.addEventListener("click", () =>
|
|
3591
|
+
t.addEventListener("click", () => m() ? _() : h()), t.addEventListener("keydown", x), r.addEventListener("keydown", S);
|
|
3549
3592
|
for (let e of i) e.addEventListener("click", () => {
|
|
3550
|
-
|
|
3593
|
+
d(e.dataset.value, { notify: !0 }), _();
|
|
3551
3594
|
});
|
|
3552
|
-
return
|
|
3595
|
+
return u(), {
|
|
3553
3596
|
get value() {
|
|
3554
|
-
return
|
|
3597
|
+
return c;
|
|
3555
3598
|
},
|
|
3556
3599
|
set value(e) {
|
|
3557
|
-
|
|
3600
|
+
d(e);
|
|
3558
3601
|
},
|
|
3559
3602
|
addEventListener(e, t) {
|
|
3560
3603
|
e === "change" && a.add(t);
|
|
3561
3604
|
},
|
|
3562
|
-
open:
|
|
3563
|
-
close:
|
|
3605
|
+
open: h,
|
|
3606
|
+
close: _,
|
|
3564
3607
|
get isOpen() {
|
|
3565
|
-
return
|
|
3608
|
+
return m();
|
|
3566
3609
|
},
|
|
3567
3610
|
destroy() {
|
|
3568
|
-
|
|
3611
|
+
g(), a.clear();
|
|
3569
3612
|
}
|
|
3570
3613
|
};
|
|
3571
3614
|
}
|
|
3572
3615
|
//#endregion
|
|
3573
3616
|
//#region src/preview/chrome.js
|
|
3574
|
-
|
|
3617
|
+
var Z = (e, t = 16) => `<svg viewBox="0 0 16 16" width="${t}" height="${t}"
|
|
3618
|
+
fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"
|
|
3619
|
+
stroke-linejoin="round" aria-hidden="true" focusable="false">${e}</svg>`, Q = {
|
|
3620
|
+
up: Z("<path d=\"M4.5 10 8 6.5l3.5 3.5\"/>", 14),
|
|
3621
|
+
down: Z("<path d=\"M4.5 6 8 9.5 11.5 6\"/>", 14),
|
|
3622
|
+
left: Z("<path d=\"M9.5 4.5 6 8l3.5 3.5\"/>"),
|
|
3623
|
+
right: Z("<path d=\"M6.5 4.5 10 8l-3.5 3.5\"/>"),
|
|
3624
|
+
minus: Z("<path d=\"M4 8h8\"/>"),
|
|
3625
|
+
plus: Z("<path d=\"M8 4v8M4 8h8\"/>"),
|
|
3626
|
+
print: Z("<path d=\"M4.5 6V2.75h7V6\"/><rect x=\"2.25\" y=\"6\" width=\"11.5\" height=\"5.5\" rx=\"1\"/><path d=\"M4.5 9.5h7v3.75h-7z\"/>"),
|
|
3627
|
+
caret: Z("<path d=\"M5 6.5 8 9.5l3-3\"/>", 14),
|
|
3628
|
+
file: Z("<path d=\"M4 2.25h5.25L12 5v8.75H4z\"/><path d=\"M9 2.25V5.25h3\"/>")
|
|
3629
|
+
}, co = [
|
|
3630
|
+
{
|
|
3631
|
+
value: "pdf",
|
|
3632
|
+
name: "PDF",
|
|
3633
|
+
keys: "Ctrl P"
|
|
3634
|
+
},
|
|
3635
|
+
{
|
|
3636
|
+
value: "csv",
|
|
3637
|
+
name: "CSV",
|
|
3638
|
+
keys: ""
|
|
3639
|
+
},
|
|
3640
|
+
{
|
|
3641
|
+
value: "xlsx",
|
|
3642
|
+
name: "Excel",
|
|
3643
|
+
keys: ""
|
|
3644
|
+
}
|
|
3645
|
+
];
|
|
3646
|
+
function lo({ title: e = "Report Studio" } = {}) {
|
|
3575
3647
|
return `
|
|
3576
3648
|
<!--
|
|
3577
3649
|
A header, not role="toolbar": that role promises arrow-key roving focus
|
|
@@ -3597,15 +3669,15 @@ function ro({ title: e = "Report Studio" } = {}) {
|
|
|
3597
3669
|
aria-label="Search the report" spellcheck="false">
|
|
3598
3670
|
<span class="hits" data-role="hits" data-state="idle" aria-live="polite"></span>
|
|
3599
3671
|
<button type="button" data-role="hit-prev" title="Previous match (shift+enter)"
|
|
3600
|
-
aria-label="Previous match"
|
|
3672
|
+
aria-label="Previous match">${Q.up}</button>
|
|
3601
3673
|
<button type="button" data-role="hit-next" title="Next match (enter)"
|
|
3602
|
-
aria-label="Next match"
|
|
3674
|
+
aria-label="Next match">${Q.down}</button>
|
|
3603
3675
|
</div>
|
|
3604
3676
|
</div>
|
|
3605
3677
|
|
|
3606
3678
|
<div class="toolbar-group toolbar-zoom">
|
|
3607
3679
|
<button type="button" data-role="zoom-out" title="Zoom out (ctrl+-)"
|
|
3608
|
-
aria-label="Zoom out"
|
|
3680
|
+
aria-label="Zoom out">${Q.minus}</button>
|
|
3609
3681
|
|
|
3610
3682
|
<!--
|
|
3611
3683
|
A listbox rather than a <select>: option items are drawn by
|
|
@@ -3633,15 +3705,39 @@ function ro({ title: e = "Report Studio" } = {}) {
|
|
|
3633
3705
|
</div>
|
|
3634
3706
|
|
|
3635
3707
|
<button type="button" data-role="zoom-in" title="Zoom in (ctrl++)"
|
|
3636
|
-
aria-label="Zoom in"
|
|
3708
|
+
aria-label="Zoom in">${Q.plus}</button>
|
|
3637
3709
|
</div>
|
|
3638
3710
|
</div>
|
|
3639
3711
|
|
|
3640
3712
|
<div class="toolbar-group toolbar-save">
|
|
3641
3713
|
<button type="button" data-role="print" title="Print or save as PDF (ctrl+P)">
|
|
3642
|
-
Print</button>
|
|
3643
|
-
|
|
3644
|
-
|
|
3714
|
+
${Q.print}<span>Print</span></button>
|
|
3715
|
+
<!--
|
|
3716
|
+
A menu rather than a dialog: choosing a format is the whole
|
|
3717
|
+
of the decision, so it is made where the button is, in one
|
|
3718
|
+
click - as a design tool's export menu does it. Each item
|
|
3719
|
+
acts at once; there is no confirm step to come back to.
|
|
3720
|
+
-->
|
|
3721
|
+
<div class="export-menu">
|
|
3722
|
+
<button type="button" data-role="export" title="Export the report (ctrl+X)"
|
|
3723
|
+
aria-haspopup="menu" aria-expanded="false">
|
|
3724
|
+
<span>Export</span>${Q.caret}</button>
|
|
3725
|
+
|
|
3726
|
+
<div class="export-list" data-role="export-menu" role="menu"
|
|
3727
|
+
aria-label="Export as" hidden>
|
|
3728
|
+
<p class="export-heading" aria-hidden="true">Export as</p>
|
|
3729
|
+
${co.map((e) => `
|
|
3730
|
+
<button type="button" class="format" role="menuitem" tabindex="-1"
|
|
3731
|
+
data-format="${e.value}">
|
|
3732
|
+
<span class="format-icon">${Q.file}</span>
|
|
3733
|
+
<span class="format-body">
|
|
3734
|
+
<span class="format-name">${e.name}</span>
|
|
3735
|
+
<span class="format-note" data-role="export-note-${e.value}"></span>
|
|
3736
|
+
</span>
|
|
3737
|
+
${e.keys ? `<kbd class="format-keys">${e.keys}</kbd>` : ""}
|
|
3738
|
+
</button>`).join("")}
|
|
3739
|
+
</div>
|
|
3740
|
+
</div>
|
|
3645
3741
|
</div>
|
|
3646
3742
|
</div>
|
|
3647
3743
|
</header>
|
|
@@ -3651,7 +3747,7 @@ function ro({ title: e = "Report Studio" } = {}) {
|
|
|
3651
3747
|
<!-- paging floats over the report rather than taking a strip of it -->
|
|
3652
3748
|
<div class="pager" data-role="pager" role="toolbar" aria-label="Page navigation">
|
|
3653
3749
|
<button type="button" data-role="prev" title="Previous page (left arrow)"
|
|
3654
|
-
aria-label="Previous page"
|
|
3750
|
+
aria-label="Previous page">${Q.left}</button>
|
|
3655
3751
|
|
|
3656
3752
|
<label class="page-of">
|
|
3657
3753
|
<input type="number" data-role="current" min="1" value="1" aria-label="Current page">
|
|
@@ -3660,55 +3756,7 @@ function ro({ title: e = "Report Studio" } = {}) {
|
|
|
3660
3756
|
</label>
|
|
3661
3757
|
|
|
3662
3758
|
<button type="button" data-role="next" title="Next page (right arrow)"
|
|
3663
|
-
aria-label="Next page"
|
|
3664
|
-
</div>
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
<!--
|
|
3669
|
-
Hand-written rather than a <dialog>: the element is still unimplemented
|
|
3670
|
-
in the environment the specs run in, and a stubbed showModal would test
|
|
3671
|
-
the stub instead of the behaviour.
|
|
3672
|
-
-->
|
|
3673
|
-
<div class="modal" data-role="export-modal" hidden>
|
|
3674
|
-
<div class="modal-backdrop" data-role="export-backdrop"></div>
|
|
3675
|
-
|
|
3676
|
-
<div class="modal-card" role="dialog" aria-modal="true" aria-labelledby="export-title">
|
|
3677
|
-
<h2 id="export-title">Export report</h2>
|
|
3678
|
-
|
|
3679
|
-
<div class="modal-formats" role="radiogroup" aria-labelledby="export-title">
|
|
3680
|
-
<label class="format">
|
|
3681
|
-
<input type="radio" name="export-format" value="pdf" checked>
|
|
3682
|
-
<span class="format-body">
|
|
3683
|
-
<span class="format-name">PDF</span>
|
|
3684
|
-
<span class="format-note">Opens the print dialog - choose "Save as PDF"</span>
|
|
3685
|
-
</span>
|
|
3686
|
-
</label>
|
|
3687
|
-
|
|
3688
|
-
<label class="format">
|
|
3689
|
-
<input type="radio" name="export-format" value="csv">
|
|
3690
|
-
<span class="format-body">
|
|
3691
|
-
<span class="format-name">CSV</span>
|
|
3692
|
-
<span class="format-note">Every text line and table row, in report order</span>
|
|
3693
|
-
</span>
|
|
3694
|
-
</label>
|
|
3695
|
-
|
|
3696
|
-
<label class="format">
|
|
3697
|
-
<input type="radio" name="export-format" value="xlsx">
|
|
3698
|
-
<span class="format-body">
|
|
3699
|
-
<span class="format-name">Excel</span>
|
|
3700
|
-
<span class="format-note">The report as it reads, plus a sheet per table</span>
|
|
3701
|
-
</span>
|
|
3702
|
-
</label>
|
|
3703
|
-
</div>
|
|
3704
|
-
|
|
3705
|
-
<p class="modal-summary" data-role="export-summary" aria-live="polite"></p>
|
|
3706
|
-
|
|
3707
|
-
<div class="modal-actions">
|
|
3708
|
-
<button type="button" data-role="export-cancel">Cancel</button>
|
|
3709
|
-
<button type="button" class="is-primary" data-role="export-confirm">Export</button>
|
|
3710
|
-
</div>
|
|
3711
|
-
</div>
|
|
3759
|
+
aria-label="Next page">${Q.right}</button>
|
|
3712
3760
|
</div>
|
|
3713
3761
|
`;
|
|
3714
3762
|
}
|
|
@@ -3722,21 +3770,21 @@ var $ = [
|
|
|
3722
3770
|
1.5,
|
|
3723
3771
|
2,
|
|
3724
3772
|
3
|
|
3725
|
-
],
|
|
3726
|
-
function
|
|
3727
|
-
let o =
|
|
3773
|
+
], uo = $[0], fo = $[$.length - 1];
|
|
3774
|
+
function po({ paginated: e, title: t, width: n, height: r, features: i, ...a } = {}) {
|
|
3775
|
+
let o = ro({
|
|
3728
3776
|
title: t ?? "Report",
|
|
3729
3777
|
width: n,
|
|
3730
3778
|
height: r,
|
|
3731
3779
|
features: i
|
|
3732
3780
|
});
|
|
3733
3781
|
if (!o) return null;
|
|
3734
|
-
let s =
|
|
3782
|
+
let s = mo({
|
|
3735
3783
|
...a,
|
|
3736
3784
|
mount: o.mount,
|
|
3737
3785
|
paginated: e,
|
|
3738
3786
|
title: t
|
|
3739
|
-
}), c =
|
|
3787
|
+
}), c = io(globalThis, o.window, s.destroy);
|
|
3740
3788
|
return {
|
|
3741
3789
|
...s,
|
|
3742
3790
|
window: o.window,
|
|
@@ -3745,175 +3793,174 @@ function oo({ paginated: e, title: t, width: n, height: r, features: i, ...a } =
|
|
|
3745
3793
|
}
|
|
3746
3794
|
};
|
|
3747
3795
|
}
|
|
3748
|
-
function
|
|
3796
|
+
function mo({ mount: e, paginated: t, title: n } = {}) {
|
|
3749
3797
|
let r = typeof e == "string" ? document.querySelector(e) : e;
|
|
3750
3798
|
if (!r) throw Error(`createViewer: no element for mount ${JSON.stringify(e)}. Add <div id="report"></div> to the page first.`);
|
|
3751
3799
|
let i = r.ownerDocument, a = i.defaultView ?? globalThis;
|
|
3752
3800
|
if (!t?.pages) throw Error("createViewer: paginated must be a buildPages(layout, data) result.");
|
|
3753
|
-
r.classList.add("report-viewer"), r.innerHTML =
|
|
3801
|
+
r.classList.add("report-viewer"), r.innerHTML = lo({ title: n });
|
|
3754
3802
|
let o = r.querySelector("[data-role=\"viewport\"]");
|
|
3755
|
-
o.innerHTML =
|
|
3756
|
-
let s = [...o.querySelectorAll(".page")], c = s.length, l = o.querySelector("#main-page"), u = o, d =
|
|
3757
|
-
prev:
|
|
3758
|
-
next:
|
|
3759
|
-
current:
|
|
3760
|
-
total:
|
|
3761
|
-
zoom:
|
|
3762
|
-
zoomIn:
|
|
3763
|
-
zoomOut:
|
|
3764
|
-
print:
|
|
3765
|
-
exportOpen:
|
|
3766
|
-
query:
|
|
3767
|
-
hits:
|
|
3768
|
-
hitPrev:
|
|
3769
|
-
hitNext:
|
|
3770
|
-
},
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
confirm: d.querySelector("[data-role=\"export-confirm\"]"),
|
|
3777
|
-
formats: [...d.querySelectorAll("input[name=\"export-format\"]")]
|
|
3778
|
-
} : null, h = 0, g = [], _ = -1, v = 1, y = !1, b = null, x = a.onafterprint !== void 0;
|
|
3779
|
-
p.total.textContent = String(c), p.current.max = String(c);
|
|
3780
|
-
function S(e) {
|
|
3781
|
-
h = Math.min(Math.max(e, 0), c - 1), s.forEach((e, t) => e.classList.toggle("is-current", t === h)), p.current.value = String(h + 1), p.prev.disabled = h === 0, p.next.disabled = h === c - 1, le(), u.scrollTo?.({ top: 0 });
|
|
3782
|
-
}
|
|
3783
|
-
function C() {
|
|
3803
|
+
o.innerHTML = Za(t);
|
|
3804
|
+
let s = [...o.querySelectorAll(".page")], c = s.length, l = o.querySelector("#main-page"), u = o, d = (e) => r.querySelector(`[data-role="${e}"]`), f = {
|
|
3805
|
+
prev: d("prev"),
|
|
3806
|
+
next: d("next"),
|
|
3807
|
+
current: d("current"),
|
|
3808
|
+
total: d("total"),
|
|
3809
|
+
zoom: so(d("zoom-dropdown")),
|
|
3810
|
+
zoomIn: d("zoom-in"),
|
|
3811
|
+
zoomOut: d("zoom-out"),
|
|
3812
|
+
print: d("print"),
|
|
3813
|
+
exportOpen: d("export"),
|
|
3814
|
+
query: d("query"),
|
|
3815
|
+
hits: d("hits"),
|
|
3816
|
+
hitPrev: d("hit-prev"),
|
|
3817
|
+
hitNext: d("hit-next")
|
|
3818
|
+
}, p = d("export-menu"), m = p ? [...p.querySelectorAll("[data-format]")] : [], h = 0, g = [], _ = -1, v = 1, y = !1, b = a.onafterprint !== void 0;
|
|
3819
|
+
f.total.textContent = String(c), f.current.max = String(c);
|
|
3820
|
+
function x(e) {
|
|
3821
|
+
h = Math.min(Math.max(e, 0), c - 1), s.forEach((e, t) => e.classList.toggle("is-current", t === h)), f.current.value = String(h + 1), f.prev.disabled = h === 0, f.next.disabled = h === c - 1, le(), u.scrollTo?.({ top: 0 });
|
|
3822
|
+
}
|
|
3823
|
+
function S() {
|
|
3784
3824
|
if (u.style.setProperty("--zoom", String(v)), l && (l.style.width = `${t.page.width * v}px`, l.style.height = `${t.page.height * v}px`), !y) {
|
|
3785
3825
|
let e = $.find((e) => Math.abs(e - v) < 1e-9);
|
|
3786
|
-
|
|
3826
|
+
f.zoom.value = e === void 0 ? "fit" : String(e);
|
|
3787
3827
|
}
|
|
3788
|
-
|
|
3828
|
+
f.zoomOut.disabled = !y && v <= uo, f.zoomIn.disabled = !y && v >= fo;
|
|
3789
3829
|
}
|
|
3790
|
-
function
|
|
3791
|
-
y = !1, v = Math.min(Math.max(e,
|
|
3830
|
+
function C(e) {
|
|
3831
|
+
y = !1, v = Math.min(Math.max(e, uo), fo), S();
|
|
3792
3832
|
}
|
|
3793
|
-
function
|
|
3794
|
-
y = !0,
|
|
3833
|
+
function w() {
|
|
3834
|
+
y = !0, f.zoom.value = "fit";
|
|
3795
3835
|
let e = u.clientWidth - 48;
|
|
3796
|
-
e > 0 && (v = Math.min(Math.max(e / t.page.width,
|
|
3836
|
+
e > 0 && (v = Math.min(Math.max(e / t.page.width, uo), fo)), S();
|
|
3797
3837
|
}
|
|
3798
|
-
function
|
|
3838
|
+
function T(e) {
|
|
3799
3839
|
let t = v;
|
|
3800
|
-
|
|
3840
|
+
C((e > 0 ? $.find((e) => e > t + 1e-9) : [...$].reverse().find((e) => e < t - 1e-9)) ?? t);
|
|
3801
3841
|
}
|
|
3802
|
-
let
|
|
3842
|
+
let E = {
|
|
3803
3843
|
pdf: {
|
|
3804
3844
|
available: () => !0,
|
|
3805
3845
|
summary: () => `${c} page${c === 1 ? "" : "s"}, ${t.page.width}×${t.page.height}px each.`,
|
|
3806
|
-
run: () =>
|
|
3846
|
+
run: () => D()
|
|
3807
3847
|
},
|
|
3808
3848
|
csv: {
|
|
3809
|
-
available: () =>
|
|
3810
|
-
summary: () =>
|
|
3811
|
-
run: () =>
|
|
3849
|
+
available: () => yr(t.pages) !== "",
|
|
3850
|
+
summary: () => E.csv.available() ? `Downloads ${H(t, "csv")}.` : "This report has nothing to write out.",
|
|
3851
|
+
run: () => te()
|
|
3812
3852
|
},
|
|
3813
3853
|
xlsx: {
|
|
3814
|
-
available: () =>
|
|
3815
|
-
summary: () =>
|
|
3816
|
-
run: () =>
|
|
3854
|
+
available: () => E.csv.available() || ar(t.pages).length > 0,
|
|
3855
|
+
summary: () => E.xlsx.available() ? `Downloads ${H(t, "xlsx")}.` : "This report has nothing to write out.",
|
|
3856
|
+
run: () => ne()
|
|
3817
3857
|
}
|
|
3818
3858
|
};
|
|
3819
|
-
function
|
|
3859
|
+
function D() {
|
|
3820
3860
|
let e = [...o.querySelectorAll("img")].filter((e) => !e.complete);
|
|
3821
3861
|
if (e.length > 0) {
|
|
3822
|
-
Promise.all(e.map((e) => e.decode().catch(() => {}))).then(
|
|
3862
|
+
Promise.all(e.map((e) => e.decode().catch(() => {}))).then(O);
|
|
3823
3863
|
return;
|
|
3824
3864
|
}
|
|
3825
|
-
|
|
3865
|
+
O();
|
|
3826
3866
|
}
|
|
3827
|
-
function
|
|
3828
|
-
ce(), a.print(),
|
|
3867
|
+
function O() {
|
|
3868
|
+
ce(), a.print(), b || k();
|
|
3829
3869
|
}
|
|
3830
|
-
function
|
|
3831
|
-
|
|
3870
|
+
function k() {
|
|
3871
|
+
f.query.value.trim() !== "" && le();
|
|
3832
3872
|
}
|
|
3833
|
-
function
|
|
3873
|
+
function ee() {
|
|
3834
3874
|
let { width: e, height: n } = t.page, r = i.getElementById("report-page-size");
|
|
3835
3875
|
r || (r = i.createElement("style"), r.id = "report-page-size", i.head.appendChild(r)), r.textContent = `@page { size: ${e}px ${n}px; margin: 0; }`;
|
|
3836
3876
|
}
|
|
3837
|
-
function
|
|
3838
|
-
let e =
|
|
3839
|
-
return e === "" ? !1 : (
|
|
3877
|
+
function te() {
|
|
3878
|
+
let e = yr(t.pages);
|
|
3879
|
+
return e === "" ? !1 : (re(new Blob(["", e], { type: "text/csv;charset=utf-8" }), H(t, "csv")), !0);
|
|
3840
3880
|
}
|
|
3841
|
-
function
|
|
3842
|
-
if (!
|
|
3881
|
+
function ne() {
|
|
3882
|
+
if (!E.xlsx.available()) return !1;
|
|
3843
3883
|
let e = (e) => {
|
|
3844
|
-
e.length > 0 &&
|
|
3884
|
+
e.length > 0 && re(new Blob([e], { type: Vi }), H(t, "xlsx"));
|
|
3845
3885
|
};
|
|
3846
|
-
if (
|
|
3847
|
-
let n =
|
|
3886
|
+
if (ga(t.pages).length > 0) return ha(t.pages).then(e, () => e(ma(t.pages))), !0;
|
|
3887
|
+
let n = ma(t.pages);
|
|
3848
3888
|
return n.length === 0 ? !1 : (e(n), !0);
|
|
3849
3889
|
}
|
|
3850
|
-
function
|
|
3890
|
+
function re(e, t) {
|
|
3851
3891
|
let n = URL.createObjectURL(e), r = i.createElement("a");
|
|
3852
3892
|
r.href = n, r.download = t, i.body.appendChild(r), r.click(), r.remove(), setTimeout(() => URL.revokeObjectURL(n), 0);
|
|
3853
3893
|
}
|
|
3854
3894
|
function A() {
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
let t = D[e.value];
|
|
3861
|
-
e.disabled = !t || !t.available(), e.closest(".format")?.classList.toggle("is-unavailable", e.disabled);
|
|
3862
|
-
}
|
|
3863
|
-
if (m.formats.find((e) => e.checked)?.disabled) {
|
|
3864
|
-
let e = m.formats.find((e) => !e.disabled);
|
|
3865
|
-
e && (e.checked = !0);
|
|
3895
|
+
for (let e of m) {
|
|
3896
|
+
let t = E[e.dataset.format], n = !!t?.available();
|
|
3897
|
+
e.disabled = !n, e.setAttribute("aria-disabled", String(!n)), e.classList.toggle("is-unavailable", !n);
|
|
3898
|
+
let r = e.querySelector(".format-note");
|
|
3899
|
+
r && (r.textContent = t ? t.summary() : "");
|
|
3866
3900
|
}
|
|
3867
|
-
let e = D[A()];
|
|
3868
|
-
m.summary.textContent = e ? e.summary() : "", m.confirm.disabled = !e || !e.available();
|
|
3869
3901
|
}
|
|
3902
|
+
let j = () => m.filter((e) => !e.disabled);
|
|
3870
3903
|
function M() {
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
}
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3904
|
+
!p || !p.hidden || (A(), p.hidden = !1, f.exportOpen.setAttribute("aria-expanded", "true"), j()[0]?.focus(), a.setTimeout(() => {
|
|
3905
|
+
p.hidden || i.addEventListener("pointerdown", ie, !0);
|
|
3906
|
+
}, 0));
|
|
3907
|
+
}
|
|
3908
|
+
function N({ refocus: e = !0 } = {}) {
|
|
3909
|
+
!p || p.hidden || (p.hidden = !0, f.exportOpen.setAttribute("aria-expanded", "false"), i.removeEventListener("pointerdown", ie, !0), (e && p.contains(i.activeElement) || e && i.activeElement === i.body) && f.exportOpen.focus());
|
|
3910
|
+
}
|
|
3911
|
+
function P(e) {
|
|
3912
|
+
let t = m.find((e) => e === i.activeElement), n = typeof e == "string" ? e : t?.dataset.format ?? "pdf", r = E[n];
|
|
3913
|
+
r?.available() && (N(), r.run());
|
|
3914
|
+
}
|
|
3915
|
+
function ie(e) {
|
|
3916
|
+
p.contains(e.target) || f.exportOpen.contains(e.target) || N({ refocus: !1 });
|
|
3917
|
+
}
|
|
3918
|
+
function ae(e) {
|
|
3919
|
+
let t = j(), n = t.indexOf(i.activeElement), r = {
|
|
3920
|
+
ArrowDown: () => t[(n + 1) % t.length]?.focus(),
|
|
3921
|
+
ArrowUp: () => t[(n - 1 + t.length) % t.length]?.focus(),
|
|
3922
|
+
Home: () => t[0]?.focus(),
|
|
3923
|
+
End: () => t.at(-1)?.focus(),
|
|
3924
|
+
Escape: () => N(),
|
|
3925
|
+
Tab: () => N({ refocus: !1 })
|
|
3926
|
+
}[e.key];
|
|
3927
|
+
r && (e.key !== "Tab" && e.preventDefault(), e.stopPropagation(), r());
|
|
3885
3928
|
}
|
|
3886
|
-
function
|
|
3887
|
-
let e =
|
|
3929
|
+
function F() {
|
|
3930
|
+
let e = f.query.value.trim();
|
|
3888
3931
|
if (ce(), e === "") {
|
|
3889
|
-
g = [], _ = -1,
|
|
3932
|
+
g = [], _ = -1, f.hits.textContent = "", f.hits.dataset.state = "idle", se();
|
|
3890
3933
|
return;
|
|
3891
3934
|
}
|
|
3892
|
-
if (g =
|
|
3893
|
-
|
|
3935
|
+
if (g = Jn(t.pages, e), _ = g.length ? 0 : -1, f.hits.dataset.state = g.length ? "found" : "empty", se(), !g.length) {
|
|
3936
|
+
f.hits.textContent = "no matches";
|
|
3894
3937
|
return;
|
|
3895
3938
|
}
|
|
3896
|
-
let n =
|
|
3897
|
-
|
|
3939
|
+
let n = Yn(t.pages, e).length;
|
|
3940
|
+
f.hits.textContent = `${g.length} on ${n} page${n === 1 ? "" : "s"}`, oe(0);
|
|
3898
3941
|
}
|
|
3899
|
-
function
|
|
3942
|
+
function oe(e) {
|
|
3900
3943
|
if (!g.length) return;
|
|
3901
3944
|
_ = (e + g.length) % g.length;
|
|
3902
3945
|
let t = g[_].pageNO - 1;
|
|
3903
|
-
t === h ? le() :
|
|
3946
|
+
t === h ? le() : x(t), f.hits.textContent = `${_ + 1} of ${g.length}`, de();
|
|
3904
3947
|
}
|
|
3905
3948
|
function se() {
|
|
3906
|
-
|
|
3949
|
+
f.hitPrev.disabled = g.length === 0, f.hitNext.disabled = g.length === 0;
|
|
3907
3950
|
}
|
|
3908
3951
|
function ce() {
|
|
3909
3952
|
for (let e of u.querySelectorAll("mark.hit")) {
|
|
3910
3953
|
let t = e.parentNode;
|
|
3911
3954
|
t.replaceChild(i.createTextNode(e.textContent), e), t.normalize();
|
|
3912
3955
|
}
|
|
3956
|
+
for (let e of u.querySelectorAll("span.hit-run")) {
|
|
3957
|
+
let t = e.parentNode;
|
|
3958
|
+
t.replaceChild(i.createTextNode(e.textContent), e), t.normalize();
|
|
3959
|
+
}
|
|
3913
3960
|
}
|
|
3914
3961
|
function le() {
|
|
3915
3962
|
ce();
|
|
3916
|
-
let e =
|
|
3963
|
+
let e = f.query.value.trim();
|
|
3917
3964
|
if (e === "") return;
|
|
3918
3965
|
let t = s[h];
|
|
3919
3966
|
if (!t) return;
|
|
@@ -3933,7 +3980,14 @@ function so({ mount: e, paginated: t, title: n } = {}) {
|
|
|
3933
3980
|
let o = i.createElement("mark");
|
|
3934
3981
|
o.className = "hit", o.textContent = n.slice(e, e + t.length), r.appendChild(o), a = e + t.length;
|
|
3935
3982
|
}
|
|
3936
|
-
a < n.length && r.appendChild(i.createTextNode(n.slice(a)))
|
|
3983
|
+
a < n.length && r.appendChild(i.createTextNode(n.slice(a)));
|
|
3984
|
+
let o = e.parentNode;
|
|
3985
|
+
if (o.classList?.contains("cell")) {
|
|
3986
|
+
let t = i.createElement("span");
|
|
3987
|
+
t.className = "hit-run", t.appendChild(r), o.replaceChild(t, e);
|
|
3988
|
+
return;
|
|
3989
|
+
}
|
|
3990
|
+
o.replaceChild(r, e);
|
|
3937
3991
|
}
|
|
3938
3992
|
function de() {
|
|
3939
3993
|
let e = [...u.querySelectorAll("mark.hit")];
|
|
@@ -3944,75 +3998,76 @@ function so({ mount: e, paginated: t, title: n } = {}) {
|
|
|
3944
3998
|
behavior: "smooth"
|
|
3945
3999
|
});
|
|
3946
4000
|
}
|
|
3947
|
-
if (
|
|
3948
|
-
let e = Number(
|
|
3949
|
-
Number.isFinite(e) ?
|
|
3950
|
-
}),
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
4001
|
+
if (f.prev.addEventListener("click", () => x(h - 1)), f.next.addEventListener("click", () => x(h + 1)), f.current.addEventListener("change", () => {
|
|
4002
|
+
let e = Number(f.current.value);
|
|
4003
|
+
Number.isFinite(e) ? x(e - 1) : f.current.value = String(h + 1);
|
|
4004
|
+
}), f.print?.addEventListener("click", D), f.exportOpen.addEventListener("click", () => {
|
|
4005
|
+
p && !p.hidden ? N() : M();
|
|
4006
|
+
}), f.exportOpen.addEventListener("keydown", (e) => {
|
|
4007
|
+
e.key !== "ArrowDown" && e.key !== "ArrowUp" || (e.preventDefault(), e.stopPropagation(), M());
|
|
4008
|
+
}), p) {
|
|
4009
|
+
p.addEventListener("keydown", ae);
|
|
4010
|
+
for (let e of m) e.addEventListener("click", () => P(e.dataset.format));
|
|
4011
|
+
}
|
|
4012
|
+
f.zoomIn.addEventListener("click", () => T(1)), f.zoomOut.addEventListener("click", () => T(-1)), f.zoom.addEventListener("change", () => {
|
|
4013
|
+
f.zoom.value === "fit" ? w() : C(Number(f.zoom.value));
|
|
3959
4014
|
});
|
|
3960
4015
|
let fe = () => {
|
|
3961
|
-
y &&
|
|
4016
|
+
y && w();
|
|
3962
4017
|
};
|
|
3963
|
-
a.addEventListener("resize", fe),
|
|
4018
|
+
a.addEventListener("resize", fe), f.hitPrev.addEventListener("click", () => oe(_ - 1)), f.hitNext.addEventListener("click", () => oe(_ + 1));
|
|
3964
4019
|
let pe;
|
|
3965
|
-
|
|
3966
|
-
clearTimeout(pe), pe = setTimeout(
|
|
3967
|
-
}),
|
|
3968
|
-
e.key === "Enter" && (e.preventDefault(), g.length ?
|
|
4020
|
+
f.query.addEventListener("input", () => {
|
|
4021
|
+
clearTimeout(pe), pe = setTimeout(F, 150);
|
|
4022
|
+
}), f.query.addEventListener("keydown", (e) => {
|
|
4023
|
+
e.key === "Enter" && (e.preventDefault(), g.length ? oe(_ + (e.shiftKey ? -1 : 1)) : F());
|
|
3969
4024
|
});
|
|
3970
|
-
let
|
|
3971
|
-
if (
|
|
4025
|
+
let me = (e) => {
|
|
4026
|
+
if (p && !p.hidden) {
|
|
3972
4027
|
e.key === "Escape" && (e.preventDefault(), N());
|
|
3973
4028
|
return;
|
|
3974
4029
|
}
|
|
3975
4030
|
if ((e.ctrlKey || e.metaKey) && ["k", "f"].includes(e.key.toLowerCase())) {
|
|
3976
|
-
e.preventDefault(),
|
|
4031
|
+
e.preventDefault(), f.query.focus(), f.query.select();
|
|
3977
4032
|
return;
|
|
3978
4033
|
}
|
|
3979
4034
|
if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "p") {
|
|
3980
|
-
e.preventDefault(),
|
|
4035
|
+
e.preventDefault(), D();
|
|
3981
4036
|
return;
|
|
3982
4037
|
}
|
|
3983
|
-
if (!(e.target ===
|
|
4038
|
+
if (!(e.target === f.query || e.target === f.current)) {
|
|
3984
4039
|
if ((e.ctrlKey || e.metaKey) && ["x", "s"].includes(e.key.toLowerCase())) {
|
|
3985
4040
|
e.preventDefault(), M();
|
|
3986
4041
|
return;
|
|
3987
4042
|
}
|
|
3988
|
-
(e.key === "ArrowRight" || e.key === "PageDown") &&
|
|
4043
|
+
(e.key === "ArrowRight" || e.key === "PageDown") && x(h + 1), (e.key === "ArrowLeft" || e.key === "PageUp") && x(h - 1), e.key === "Home" && x(0), e.key === "End" && x(c - 1), (e.ctrlKey || e.metaKey) && ((e.key === "+" || e.key === "=") && (e.preventDefault(), T(1)), e.key === "-" && (e.preventDefault(), T(-1)), e.key === "0" && (e.preventDefault(), C(1)));
|
|
3989
4044
|
}
|
|
3990
4045
|
};
|
|
3991
|
-
i.addEventListener("keydown",
|
|
3992
|
-
function
|
|
3993
|
-
|
|
3994
|
-
}
|
|
3995
|
-
return
|
|
3996
|
-
show:
|
|
3997
|
-
next: () =>
|
|
3998
|
-
prev: () =>
|
|
4046
|
+
i.addEventListener("keydown", me), b && a.addEventListener("afterprint", k);
|
|
4047
|
+
function he() {
|
|
4048
|
+
f.zoom.destroy(), i.removeEventListener("pointerdown", ie, !0), i.removeEventListener("keydown", me), a.removeEventListener("resize", fe), a.removeEventListener("afterprint", k), r.innerHTML = "", r.classList.remove("report-viewer");
|
|
4049
|
+
}
|
|
4050
|
+
return ee(), S(), x(0), se(), {
|
|
4051
|
+
show: x,
|
|
4052
|
+
next: () => x(h + 1),
|
|
4053
|
+
prev: () => x(h - 1),
|
|
3999
4054
|
find: (e) => {
|
|
4000
|
-
|
|
4055
|
+
f.query.value = e, F();
|
|
4001
4056
|
},
|
|
4002
|
-
print:
|
|
4003
|
-
downloadCSV:
|
|
4004
|
-
downloadXLSX:
|
|
4057
|
+
print: D,
|
|
4058
|
+
downloadCSV: te,
|
|
4059
|
+
downloadXLSX: ne,
|
|
4005
4060
|
openExport: M,
|
|
4006
4061
|
closeExport: N,
|
|
4007
|
-
confirmExport:
|
|
4008
|
-
destroy:
|
|
4062
|
+
confirmExport: P,
|
|
4063
|
+
destroy: he,
|
|
4009
4064
|
get exportOpen() {
|
|
4010
|
-
return
|
|
4065
|
+
return p ? !p.hidden : !1;
|
|
4011
4066
|
},
|
|
4012
|
-
setZoom:
|
|
4013
|
-
zoomIn: () =>
|
|
4014
|
-
zoomOut: () =>
|
|
4015
|
-
fitWidth:
|
|
4067
|
+
setZoom: C,
|
|
4068
|
+
zoomIn: () => T(1),
|
|
4069
|
+
zoomOut: () => T(-1),
|
|
4070
|
+
fitWidth: w,
|
|
4016
4071
|
get zoom() {
|
|
4017
4072
|
return v;
|
|
4018
4073
|
},
|
|
@@ -4025,4 +4080,4 @@ function so({ mount: e, paginated: t, title: n } = {}) {
|
|
|
4025
4080
|
};
|
|
4026
4081
|
}
|
|
4027
4082
|
//#endregion
|
|
4028
|
-
export { de as $,
|
|
4083
|
+
export { de as $, Ht as A, Me as B, Yn as C, $t as D, An as E, st as F, ye as G, _e as H, Ue as I, E as J, T as K, Xe as L, B as M, St as N, Bt as O, ot as P, A as Q, $e as R, Jn as S, kn as T, be as U, Ne as V, xe as W, y as X, v as Y, ie as Z, di as _, po as a, t as at, yr as b, ro as c, h as ct, Vi as d, s as dt, M as et, ga as f, o as ft, _i as g, Y as h, mo as i, r as it, Gt as j, Vt as k, Za as l, m as lt, ha as m, e as mt, uo as n, n as nt, so as o, d as ot, ma as p, g as pt, D as q, $ as r, i as rt, io as s, c as st, fo as t, N as tt, Ja as u, a as ut, H as v, Nn as w, ar as x, vr as y, Qe as z };
|