react-pdf-levelup 2.0.20 → 2.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -54
- package/dist/index.d.mts +28 -9
- package/dist/index.d.ts +28 -9
- package/dist/index.js +256 -195
- package/dist/index.mjs +254 -193
- package/package.json +13 -8
package/dist/index.js
CHANGED
|
@@ -325,81 +325,100 @@ var styles5 = import_renderer5.StyleSheet.create({
|
|
|
325
325
|
width: "100%",
|
|
326
326
|
borderWidth: 1,
|
|
327
327
|
borderColor: "#000",
|
|
328
|
-
overflow: "hidden",
|
|
329
328
|
marginBottom: 20
|
|
330
329
|
},
|
|
331
330
|
thead: {
|
|
332
|
-
backgroundColor: "#
|
|
331
|
+
backgroundColor: "#ccc"
|
|
333
332
|
},
|
|
334
|
-
tbody: {},
|
|
335
333
|
tr: {
|
|
336
|
-
flexDirection: "row"
|
|
337
|
-
borderBottomWidth: 1,
|
|
338
|
-
borderColor: "#000"
|
|
334
|
+
flexDirection: "row"
|
|
339
335
|
},
|
|
340
|
-
|
|
341
|
-
paddingTop: 4,
|
|
336
|
+
textBold: {
|
|
342
337
|
fontSize: 10,
|
|
343
338
|
fontFamily: "Helvetica",
|
|
344
339
|
fontWeight: "bold",
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
textAlign: "center"
|
|
340
|
+
textAlign: "center",
|
|
341
|
+
paddingTop: 4
|
|
348
342
|
},
|
|
349
|
-
|
|
350
|
-
paddingTop: 4,
|
|
351
|
-
paddingLeft: 8,
|
|
352
|
-
paddingRight: 8,
|
|
343
|
+
text: {
|
|
353
344
|
fontSize: 10,
|
|
354
345
|
fontFamily: "Helvetica",
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
},
|
|
359
|
-
cellSmall: {
|
|
360
|
-
width: "25%"
|
|
361
|
-
},
|
|
362
|
-
cellMedium: {
|
|
363
|
-
width: "33.33%"
|
|
346
|
+
paddingTop: 4,
|
|
347
|
+
paddingLeft: 8,
|
|
348
|
+
paddingRight: 8
|
|
364
349
|
},
|
|
365
|
-
|
|
366
|
-
|
|
350
|
+
zebraOdd: {
|
|
351
|
+
backgroundColor: "#eeeeee"
|
|
367
352
|
}
|
|
368
353
|
});
|
|
369
|
-
var
|
|
370
|
-
|
|
371
|
-
medium: styles5.cellMedium,
|
|
372
|
-
large: styles5.cellLarge
|
|
373
|
-
};
|
|
374
|
-
var Table = ({ children, style }) => {
|
|
375
|
-
return /* @__PURE__ */ import_react5.default.createElement(import_renderer5.View, { style: [styles5.table, style] }, children);
|
|
376
|
-
};
|
|
377
|
-
var Thead = ({ children, style }) => {
|
|
378
|
-
return /* @__PURE__ */ import_react5.default.createElement(import_renderer5.View, { style: [styles5.thead, style] }, children);
|
|
379
|
-
};
|
|
354
|
+
var Table = ({ children, style }) => /* @__PURE__ */ import_react5.default.createElement(import_renderer5.View, { style: [styles5.table, style] }, children);
|
|
355
|
+
var Thead = ({ children, style }) => /* @__PURE__ */ import_react5.default.createElement(import_renderer5.View, { style: [styles5.thead, style] }, children);
|
|
380
356
|
var Tbody = ({ children, style }) => {
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
357
|
+
const rows = import_react5.default.Children.toArray(children);
|
|
358
|
+
const count = rows.length;
|
|
359
|
+
return /* @__PURE__ */ import_react5.default.createElement(import_react5.default.Fragment, null, rows.map(
|
|
360
|
+
(row, idx) => import_react5.default.cloneElement(row, {
|
|
361
|
+
isLastRow: idx === count - 1,
|
|
362
|
+
isOdd: idx % 2 === 1
|
|
363
|
+
})
|
|
364
|
+
));
|
|
365
|
+
};
|
|
366
|
+
var Tr = ({
|
|
367
|
+
children,
|
|
368
|
+
style,
|
|
369
|
+
isLastRow = false,
|
|
370
|
+
isOdd = false
|
|
371
|
+
}) => {
|
|
372
|
+
const elements = import_react5.default.Children.toArray(children);
|
|
373
|
+
const count = elements.length;
|
|
374
|
+
return /* @__PURE__ */ import_react5.default.createElement(import_renderer5.View, { style: [styles5.tr, style] }, elements.map((child, idx) => {
|
|
375
|
+
const isLast = idx === count - 1;
|
|
376
|
+
const width = `${(100 / count).toFixed(2)}%`;
|
|
377
|
+
return import_react5.default.cloneElement(child, { width, isLast, isLastRow, isOdd });
|
|
378
|
+
}));
|
|
379
|
+
};
|
|
380
|
+
var Th = ({
|
|
381
|
+
children,
|
|
382
|
+
style,
|
|
383
|
+
width,
|
|
384
|
+
height,
|
|
385
|
+
colSpan,
|
|
386
|
+
isLast = false,
|
|
387
|
+
isLastRow = false
|
|
388
|
+
}) => {
|
|
389
|
+
const baseWidth = typeof width === "string" && colSpan ? `${(parseFloat(width) * colSpan).toFixed(2)}%` : width;
|
|
390
|
+
const borders = {
|
|
391
|
+
borderRightWidth: isLast ? 0 : 1,
|
|
392
|
+
borderBottomWidth: isLastRow ? 0 : 1,
|
|
393
|
+
borderColor: "#000",
|
|
391
394
|
...height !== void 0 && { height }
|
|
392
395
|
};
|
|
393
|
-
return /* @__PURE__ */ import_react5.default.createElement(import_renderer5.View, { style: [styles5.
|
|
396
|
+
return /* @__PURE__ */ import_react5.default.createElement(import_renderer5.View, { style: [styles5.textBold, { width: baseWidth }, borders, style] }, /* @__PURE__ */ import_react5.default.createElement(import_renderer5.Text, null, children));
|
|
394
397
|
};
|
|
395
|
-
var Td = ({
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
398
|
+
var Td = ({
|
|
399
|
+
children,
|
|
400
|
+
style,
|
|
401
|
+
width,
|
|
402
|
+
height,
|
|
403
|
+
colSpan,
|
|
404
|
+
isLast = false,
|
|
405
|
+
isLastRow = false,
|
|
406
|
+
isOdd = false
|
|
407
|
+
}) => {
|
|
408
|
+
const baseWidth = typeof width === "string" && colSpan ? `${(parseFloat(width) * colSpan).toFixed(2)}%` : width;
|
|
409
|
+
const borders = {
|
|
410
|
+
borderRightWidth: isLast ? 0 : 1,
|
|
411
|
+
borderBottomWidth: isLastRow ? 0 : 1,
|
|
412
|
+
borderColor: "#000",
|
|
400
413
|
...height !== void 0 && { height }
|
|
401
414
|
};
|
|
402
|
-
return /* @__PURE__ */ import_react5.default.createElement(import_renderer5.View, { style: [
|
|
415
|
+
return /* @__PURE__ */ import_react5.default.createElement(import_renderer5.View, { style: [
|
|
416
|
+
styles5.text,
|
|
417
|
+
isOdd && styles5.zebraOdd,
|
|
418
|
+
{ width: baseWidth },
|
|
419
|
+
borders,
|
|
420
|
+
style
|
|
421
|
+
] }, /* @__PURE__ */ import_react5.default.createElement(import_renderer5.Text, null, children));
|
|
403
422
|
};
|
|
404
423
|
|
|
405
424
|
// src/components/core/Grid.tsx
|
|
@@ -509,153 +528,195 @@ var Footer = ({ children, style, fixed = false }) => {
|
|
|
509
528
|
// src/components/core/QR.tsx
|
|
510
529
|
var import_react8 = __toESM(require("react"));
|
|
511
530
|
var import_renderer8 = require("@react-pdf/renderer");
|
|
512
|
-
var
|
|
513
|
-
|
|
514
|
-
// src/components/core/QRGenerator.tsx
|
|
515
|
-
var import_qrcode = __toESM(require("qrcode"));
|
|
516
|
-
var generateQRAsBase64 = async ({
|
|
517
|
-
value,
|
|
518
|
-
size = 150,
|
|
519
|
-
colorDark = "#282828",
|
|
520
|
-
colorLight = "#ffffff",
|
|
521
|
-
margin = 0,
|
|
522
|
-
errorCorrectionLevel = "M"
|
|
523
|
-
}) => {
|
|
531
|
+
var import_qr_code_styling = __toESM(require("qr-code-styling"));
|
|
532
|
+
if (typeof window === "undefined" && typeof process !== "undefined") {
|
|
524
533
|
try {
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
534
|
+
import("jsdom").then((jsdom) => {
|
|
535
|
+
const { JSDOM } = jsdom;
|
|
536
|
+
import("canvas").then((canvas) => {
|
|
537
|
+
const { Canvas, Image: CanvasImage } = canvas;
|
|
538
|
+
const { window: domWindow } = new JSDOM("<!DOCTYPE html><html><body></body></html>");
|
|
539
|
+
global.window = domWindow;
|
|
540
|
+
global.document = domWindow.document;
|
|
541
|
+
global.HTMLElement = domWindow.HTMLElement;
|
|
542
|
+
global.HTMLCanvasElement = Canvas;
|
|
543
|
+
global.CanvasRenderingContext2D = Canvas;
|
|
544
|
+
global.Image = CanvasImage;
|
|
545
|
+
}).catch((err) => {
|
|
546
|
+
console.error("Error loading canvas:", err);
|
|
547
|
+
});
|
|
548
|
+
}).catch((err) => {
|
|
549
|
+
console.error("Error loading jsdom:", err);
|
|
550
|
+
});
|
|
538
551
|
} catch (error) {
|
|
539
|
-
console.error("Error
|
|
540
|
-
return "";
|
|
541
|
-
}
|
|
542
|
-
};
|
|
543
|
-
var addLogoToQR = async (qrDataUrl, logoUrl, logoWidth, logoHeight) => {
|
|
544
|
-
return new Promise((resolve) => {
|
|
545
|
-
if (!qrDataUrl || !logoUrl) {
|
|
546
|
-
resolve(qrDataUrl);
|
|
547
|
-
return;
|
|
548
|
-
}
|
|
549
|
-
try {
|
|
550
|
-
const canvas = document.createElement("canvas");
|
|
551
|
-
const ctx = canvas.getContext("2d");
|
|
552
|
-
if (!ctx) {
|
|
553
|
-
resolve(qrDataUrl);
|
|
554
|
-
return;
|
|
555
|
-
}
|
|
556
|
-
const qrImage = new Image();
|
|
557
|
-
qrImage.crossOrigin = "anonymous";
|
|
558
|
-
qrImage.onload = () => {
|
|
559
|
-
canvas.width = qrImage.width;
|
|
560
|
-
canvas.height = qrImage.height;
|
|
561
|
-
ctx.drawImage(qrImage, 0, 0, canvas.width, canvas.height);
|
|
562
|
-
const logoImage = new Image();
|
|
563
|
-
logoImage.crossOrigin = "anonymous";
|
|
564
|
-
logoImage.onload = () => {
|
|
565
|
-
const x = (canvas.width - logoWidth) / 2;
|
|
566
|
-
const y = (canvas.height - logoHeight) / 2;
|
|
567
|
-
ctx.fillStyle = "#FFFFFF";
|
|
568
|
-
ctx.fillRect(x - 5, y - 5, logoWidth + 10, logoHeight + 10);
|
|
569
|
-
ctx.drawImage(logoImage, x, y, logoWidth, logoHeight);
|
|
570
|
-
const finalQrDataUrl = canvas.toDataURL("image/png");
|
|
571
|
-
resolve(finalQrDataUrl);
|
|
572
|
-
};
|
|
573
|
-
logoImage.onerror = () => {
|
|
574
|
-
console.error("Error cargando el logo");
|
|
575
|
-
resolve(qrDataUrl);
|
|
576
|
-
};
|
|
577
|
-
logoImage.src = logoUrl;
|
|
578
|
-
};
|
|
579
|
-
qrImage.onerror = () => {
|
|
580
|
-
console.error("Error cargando el QR");
|
|
581
|
-
resolve("");
|
|
582
|
-
};
|
|
583
|
-
qrImage.src = qrDataUrl;
|
|
584
|
-
} catch (error) {
|
|
585
|
-
console.error("Error procesando el QR con logo:", error);
|
|
586
|
-
resolve(qrDataUrl);
|
|
587
|
-
}
|
|
588
|
-
});
|
|
589
|
-
};
|
|
590
|
-
|
|
591
|
-
// src/components/core/QR.tsx
|
|
592
|
-
var styles8 = import_renderer8.StyleSheet.create({
|
|
593
|
-
qrContainer: {
|
|
594
|
-
display: "flex",
|
|
595
|
-
alignItems: "center",
|
|
596
|
-
justifyContent: "center",
|
|
597
|
-
margin: 10
|
|
552
|
+
console.error("Error setting up Node.js environment:", error);
|
|
598
553
|
}
|
|
599
|
-
}
|
|
600
|
-
var errorLevelMap = {
|
|
601
|
-
0: "L",
|
|
602
|
-
1: "M",
|
|
603
|
-
2: "Q",
|
|
604
|
-
3: "H"
|
|
605
|
-
};
|
|
554
|
+
}
|
|
606
555
|
var QR = ({
|
|
607
|
-
|
|
608
|
-
size =
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
margin = 0,
|
|
613
|
-
logo = "",
|
|
556
|
+
url,
|
|
557
|
+
size = 200,
|
|
558
|
+
colorData = "#000000",
|
|
559
|
+
colorDataBG = "#ffffff",
|
|
560
|
+
logo,
|
|
614
561
|
logoWidth = 30,
|
|
615
|
-
logoHeight
|
|
616
|
-
|
|
562
|
+
logoHeight,
|
|
563
|
+
margin = 0,
|
|
564
|
+
errorCorrectionLevel = "H",
|
|
565
|
+
style,
|
|
566
|
+
dotType = "square",
|
|
567
|
+
cornerSquareType = "square",
|
|
568
|
+
cornerDotType = "square",
|
|
569
|
+
cornerSquareColor,
|
|
570
|
+
cornerDotColor,
|
|
571
|
+
logoBG = colorDataBG,
|
|
572
|
+
logoText,
|
|
573
|
+
moveText = 0,
|
|
574
|
+
textColor = colorData,
|
|
575
|
+
fontSize = 12,
|
|
576
|
+
fontFamily = "Helvetica",
|
|
577
|
+
textBackgroundColor = colorDataBG,
|
|
578
|
+
textPadding = 1,
|
|
579
|
+
textBold = true
|
|
617
580
|
}) => {
|
|
618
|
-
const [
|
|
619
|
-
|
|
620
|
-
|
|
581
|
+
const [qrDataURL, setQrDataURL] = (0, import_react8.useState)(null);
|
|
582
|
+
const actualLogoWidth = logoWidth || Math.floor(size * 0.2);
|
|
583
|
+
const actualLogoHeight = logoHeight || actualLogoWidth;
|
|
584
|
+
(0, import_react8.useEffect)(() => {
|
|
585
|
+
if (typeof window === "undefined") {
|
|
586
|
+
return;
|
|
587
|
+
}
|
|
588
|
+
const generateQRCode = async () => {
|
|
621
589
|
try {
|
|
622
|
-
const
|
|
623
|
-
|
|
624
|
-
size,
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
590
|
+
const qrCode = new import_qr_code_styling.default({
|
|
591
|
+
width: size,
|
|
592
|
+
height: size,
|
|
593
|
+
type: "canvas",
|
|
594
|
+
data: url,
|
|
595
|
+
dotsOptions: {
|
|
596
|
+
color: colorData,
|
|
597
|
+
type: dotType
|
|
598
|
+
},
|
|
599
|
+
cornersSquareOptions: {
|
|
600
|
+
color: cornerSquareColor || colorData,
|
|
601
|
+
type: cornerSquareType
|
|
602
|
+
},
|
|
603
|
+
cornersDotOptions: {
|
|
604
|
+
color: cornerDotColor || colorData,
|
|
605
|
+
type: cornerDotType
|
|
606
|
+
},
|
|
607
|
+
backgroundOptions: {
|
|
608
|
+
color: colorDataBG
|
|
609
|
+
},
|
|
610
|
+
qrOptions: {
|
|
611
|
+
errorCorrectionLevel
|
|
612
|
+
},
|
|
613
|
+
margin
|
|
629
614
|
});
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
615
|
+
const container = document.createElement("div");
|
|
616
|
+
container.style.position = "absolute";
|
|
617
|
+
container.style.top = "-9999px";
|
|
618
|
+
container.style.left = "-9999px";
|
|
619
|
+
document.body.appendChild(container);
|
|
620
|
+
qrCode.append(container);
|
|
621
|
+
setTimeout(() => {
|
|
622
|
+
try {
|
|
623
|
+
const qrCanvas = container.querySelector("canvas");
|
|
624
|
+
if (qrCanvas) {
|
|
625
|
+
const canvas = document.createElement("canvas");
|
|
626
|
+
canvas.width = size;
|
|
627
|
+
canvas.height = size;
|
|
628
|
+
const ctx = canvas.getContext("2d");
|
|
629
|
+
if (ctx) {
|
|
630
|
+
ctx.drawImage(qrCanvas, 0, 0);
|
|
631
|
+
const dataURL = canvas.toDataURL("image/png");
|
|
632
|
+
setQrDataURL(dataURL);
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
document.body.removeChild(container);
|
|
636
|
+
} catch (error) {
|
|
637
|
+
console.error("Error capturando QR:", error);
|
|
638
|
+
}
|
|
639
|
+
}, 100);
|
|
636
640
|
} catch (error) {
|
|
637
641
|
console.error("Error generando QR:", error);
|
|
638
|
-
const fallbackUrl2 = `https://api.qrserver.com/v1/create-qr-code/?data=${encodeURIComponent(
|
|
639
|
-
value
|
|
640
|
-
)}&size=${size}x${size}&color=${encodeURIComponent(colorDark.replace("#", ""))}&bgcolor=${encodeURIComponent(
|
|
641
|
-
colorLight.replace("#", "")
|
|
642
|
-
)}`;
|
|
643
|
-
setQrDataUrl(fallbackUrl2);
|
|
644
642
|
}
|
|
645
643
|
};
|
|
646
|
-
|
|
647
|
-
}, [
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
644
|
+
generateQRCode();
|
|
645
|
+
}, [
|
|
646
|
+
url,
|
|
647
|
+
size,
|
|
648
|
+
colorData,
|
|
649
|
+
colorDataBG,
|
|
650
|
+
margin,
|
|
651
|
+
errorCorrectionLevel,
|
|
652
|
+
dotType,
|
|
653
|
+
cornerSquareType,
|
|
654
|
+
cornerDotType,
|
|
655
|
+
cornerSquareColor,
|
|
656
|
+
cornerDotColor,
|
|
657
|
+
logoBG
|
|
658
|
+
]);
|
|
659
|
+
if (!qrDataURL) return null;
|
|
660
|
+
const centerPosition = size / 2;
|
|
661
|
+
const logoContainerSize = Math.max(actualLogoWidth, actualLogoHeight) + 10;
|
|
662
|
+
return /* @__PURE__ */ import_react8.default.createElement(import_renderer8.View, { style: { width: size, height: size, position: "relative", ...style } }, /* @__PURE__ */ import_react8.default.createElement(import_renderer8.Image, { src: qrDataURL, style: { width: size, height: size } }), logo && /* @__PURE__ */ import_react8.default.createElement(
|
|
663
|
+
import_renderer8.View,
|
|
664
|
+
{
|
|
665
|
+
style: {
|
|
666
|
+
position: "absolute",
|
|
667
|
+
width: logoContainerSize,
|
|
668
|
+
height: logoContainerSize,
|
|
669
|
+
backgroundColor: logoBG,
|
|
670
|
+
left: centerPosition - logoContainerSize / 2,
|
|
671
|
+
top: centerPosition - logoContainerSize / 2,
|
|
672
|
+
borderRadius: 100,
|
|
673
|
+
border: `5px solid ${colorData}`,
|
|
674
|
+
padding: 0
|
|
675
|
+
}
|
|
676
|
+
},
|
|
677
|
+
/* @__PURE__ */ import_react8.default.createElement(
|
|
678
|
+
import_renderer8.Image,
|
|
679
|
+
{
|
|
680
|
+
src: logo,
|
|
681
|
+
style: {
|
|
682
|
+
objectFit: "contain",
|
|
683
|
+
width: actualLogoWidth,
|
|
684
|
+
height: actualLogoHeight
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
)
|
|
688
|
+
), !logo && logoText && /* @__PURE__ */ import_react8.default.createElement(
|
|
689
|
+
import_renderer8.View,
|
|
690
|
+
{
|
|
691
|
+
style: {
|
|
692
|
+
position: "absolute",
|
|
693
|
+
backgroundColor: textBackgroundColor,
|
|
694
|
+
padding: textPadding,
|
|
695
|
+
borderRadius: 4,
|
|
696
|
+
left: moveText + centerPosition - 20,
|
|
697
|
+
top: centerPosition - 10
|
|
698
|
+
}
|
|
699
|
+
},
|
|
700
|
+
/* @__PURE__ */ import_react8.default.createElement(
|
|
701
|
+
import_renderer8.Text,
|
|
702
|
+
{
|
|
703
|
+
style: {
|
|
704
|
+
color: textColor,
|
|
705
|
+
fontSize,
|
|
706
|
+
fontFamily,
|
|
707
|
+
fontWeight: textBold ? "bold" : "normal"
|
|
708
|
+
}
|
|
709
|
+
},
|
|
710
|
+
logoText
|
|
711
|
+
)
|
|
712
|
+
));
|
|
652
713
|
};
|
|
653
714
|
var QR_default = QR;
|
|
654
715
|
|
|
655
716
|
// src/components/core/Lista.tsx
|
|
656
|
-
var
|
|
717
|
+
var import_react9 = __toESM(require("react"));
|
|
657
718
|
var import_renderer9 = require("@react-pdf/renderer");
|
|
658
|
-
var
|
|
719
|
+
var styles8 = import_renderer9.StyleSheet.create({
|
|
659
720
|
ul: {
|
|
660
721
|
marginBottom: 10,
|
|
661
722
|
paddingLeft: 15
|
|
@@ -715,9 +776,9 @@ var toRoman = (num) => {
|
|
|
715
776
|
return romanNumerals[3][Math.floor(num / 1e3)] + romanNumerals[2][Math.floor(num % 1e3 / 100)] + romanNumerals[1][Math.floor(num % 100 / 10)] + romanNumerals[0][num % 10];
|
|
716
777
|
};
|
|
717
778
|
var UL = ({ children, style, type = "disc" }) => {
|
|
718
|
-
const childrenWithBullets =
|
|
719
|
-
if (
|
|
720
|
-
return
|
|
779
|
+
const childrenWithBullets = import_react9.default.Children.map(children, (child, index) => {
|
|
780
|
+
if (import_react9.default.isValidElement(child)) {
|
|
781
|
+
return import_react9.default.cloneElement(child, {
|
|
721
782
|
bulletType: type,
|
|
722
783
|
isOrdered: false,
|
|
723
784
|
index: index + 1
|
|
@@ -725,12 +786,12 @@ var UL = ({ children, style, type = "disc" }) => {
|
|
|
725
786
|
}
|
|
726
787
|
return child;
|
|
727
788
|
});
|
|
728
|
-
return /* @__PURE__ */
|
|
789
|
+
return /* @__PURE__ */ import_react9.default.createElement(import_renderer9.View, { style: [styles8.ul, style] }, childrenWithBullets);
|
|
729
790
|
};
|
|
730
791
|
var OL = ({ children, style, type = "decimal", start = 1 }) => {
|
|
731
|
-
const childrenWithNumbers =
|
|
732
|
-
if (
|
|
733
|
-
return
|
|
792
|
+
const childrenWithNumbers = import_react9.default.Children.map(children, (child, index) => {
|
|
793
|
+
if (import_react9.default.isValidElement(child)) {
|
|
794
|
+
return import_react9.default.cloneElement(child, {
|
|
734
795
|
bulletType: type,
|
|
735
796
|
isOrdered: true,
|
|
736
797
|
index: index + 1,
|
|
@@ -739,7 +800,7 @@ var OL = ({ children, style, type = "decimal", start = 1 }) => {
|
|
|
739
800
|
}
|
|
740
801
|
return child;
|
|
741
802
|
});
|
|
742
|
-
return /* @__PURE__ */
|
|
803
|
+
return /* @__PURE__ */ import_react9.default.createElement(import_renderer9.View, { style: [styles8.ol, style] }, childrenWithNumbers);
|
|
743
804
|
};
|
|
744
805
|
var LI = ({ children, style, bulletType = "disc", isOrdered = false, index = 1, start = 1, value }) => {
|
|
745
806
|
let marker;
|
|
@@ -749,7 +810,7 @@ var LI = ({ children, style, bulletType = "disc", isOrdered = false, index = 1,
|
|
|
749
810
|
} else {
|
|
750
811
|
marker = getBulletPoint(bulletType);
|
|
751
812
|
}
|
|
752
|
-
return /* @__PURE__ */
|
|
813
|
+
return /* @__PURE__ */ import_react9.default.createElement(import_renderer9.View, { style: [styles8.li, style] }, /* @__PURE__ */ import_react9.default.createElement(import_renderer9.Text, { style: styles8.bulletPoint }, marker), /* @__PURE__ */ import_react9.default.createElement(import_renderer9.View, { style: styles8.itemContent }, typeof children === "string" ? /* @__PURE__ */ import_react9.default.createElement(import_renderer9.Text, null, children) : children));
|
|
753
814
|
};
|
|
754
815
|
|
|
755
816
|
// src/components/core/index.tsx
|
|
@@ -784,13 +845,13 @@ var decodeBase64Pdf_default = decodeBase64Pdf;
|
|
|
784
845
|
|
|
785
846
|
// src/functions/generatePDF.ts
|
|
786
847
|
var import_renderer10 = require("@react-pdf/renderer");
|
|
787
|
-
var
|
|
848
|
+
var import_react10 = require("react");
|
|
788
849
|
var generatePDF = async ({ template: Template, data }) => {
|
|
789
850
|
try {
|
|
790
851
|
if (!Template) {
|
|
791
852
|
throw new Error("Template not provided");
|
|
792
853
|
}
|
|
793
|
-
const MyDocument = (0,
|
|
854
|
+
const MyDocument = (0, import_react10.createElement)(Template, { data });
|
|
794
855
|
const stream = await (0, import_renderer10.renderToStream)(MyDocument);
|
|
795
856
|
const base64String = await new Promise((resolve, reject) => {
|
|
796
857
|
const chunks = [];
|