react-pdf-levelup 1.0.4
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 +40 -0
- package/fn/aggAlias.js +21 -0
- package/fn/moveComponents.js +129 -0
- package/fn/postinstall.js +66 -0
- package/fn/upVersion.js +12 -0
- package/fn/updateTsconfig.js +10 -0
- package/next.config.mjs +6 -0
- package/package.json +39 -0
- package/public/bg-login.jpg +0 -0
- package/public/codigo_guardado.js +1 -0
- package/public/css/style.css +751 -0
- package/public/dboard/logo.png +0 -0
- package/public/favicon.ico +0 -0
- package/public/fonts/TimesNewerRoman-Bold.otf +0 -0
- package/public/fonts/TimesNewerRoman-BoldItalic.otf +0 -0
- package/public/fonts/TimesNewerRoman-Italic.otf +0 -0
- package/public/fonts/TimesNewerRoman-Regular.otf +0 -0
- package/public/header-pdf.jpg +0 -0
- package/public/home/bgHome.jpg +0 -0
- package/public/home/bgHome2.jpg +0 -0
- package/public/home/download.jpg +0 -0
- package/public/home/undraw_elements_re_25t9.svg +1 -0
- package/public/home/undraw_project_completed_re_jr7u.svg +1 -0
- package/public/home/undraw_shared_goals_re_jvqd.svg +1 -0
- package/public/home/undraw_spread_love_re_v3cl.svg +1 -0
- package/public/home/undraw_target_re_fi8j.svg +1 -0
- package/public/home/undraw_visionary_technology_re_jfp7.svg +1 -0
- package/public/logo.png +0 -0
- package/public/marca/logo.svg +1 -0
- package/src/components/PDF/components/DocumentoTemplate.tsx +140 -0
- package/src/components/PDF/components/PDFContent.tsx +192 -0
- package/src/components/PDF/core/Etiquetas.tsx +152 -0
- package/src/components/PDF/core/Grid.tsx +101 -0
- package/src/components/PDF/core/Img.tsx +22 -0
- package/src/components/PDF/core/LayoutPDF.tsx +186 -0
- package/src/components/PDF/core/Listas.tsx +10 -0
- package/src/components/PDF/core/MakePDF.tsx +50 -0
- package/src/components/PDF/core/PageElements.tsx +50 -0
- package/src/components/PDF/core/Position.tsx +33 -0
- package/src/components/PDF/core/Tablet.tsx +121 -0
- package/src/components/PDF/core/index.tsx +56 -0
- package/src/components/PDF/lib/pdfParser.ts +620 -0
- package/src/components/PDF/services/apiService.ts +17 -0
- package/src/components/PDF/templates/AllTemplate.tsx +134 -0
- package/src/components/PDF/templates/BusinessCardTemplate.tsx +139 -0
- package/src/components/PDF/templates/CertificateTemplate.tsx +31 -0
- package/src/components/PDF/templates/HeaderFooterTemplate.tsx +61 -0
- package/src/components/PDF/templates/InvoiceTemplate.tsx +53 -0
- package/src/components/PDF/templates/ProposalTemplate.tsx +246 -0
- package/src/components/PDF/templates/ReportTemplate.tsx +57 -0
- package/src/components/PDF/templates/ResumeTemplate.tsx +170 -0
- package/src/components/PDF/templates/TablasTemplate.tsx +307 -0
- package/src/components/PDF/templates/index.ts +9 -0
- package/src/components/PDF/view/ColorPicker.tsx +147 -0
- package/src/components/PDF/view/Header.tsx +102 -0
- package/src/components/PDF/view/HomePDF.tsx +177 -0
- package/src/components/PDF/view/SettingsPanel.tsx +703 -0
- package/src/pages/AllTemplate.tsx +53 -0
- package/src/pages/Documento2.tsx +45 -0
- package/src/pages/_app.tsx +6 -0
- package/src/pages/_document.tsx +13 -0
- package/src/pages/api/generatePDF.ts +74 -0
- package/src/pages/api/hello.ts +13 -0
- package/src/pages/api/readFile.ts +18 -0
- package/src/pages/api/readTemplateFile.ts +26 -0
- package/src/pages/api/save.ts +22 -0
- package/src/pages/api/saveFile.ts +20 -0
- package/src/pages/index.tsx +13 -0
- package/src/pages/template/[template].tsx +250 -0
- package/tsconfig.json +63 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import type React from "react"
|
|
2
|
+
import { View, Text, StyleSheet } from "@react-pdf/renderer"
|
|
3
|
+
|
|
4
|
+
interface TableProps {
|
|
5
|
+
children: React.ReactNode
|
|
6
|
+
style?: any
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface CellProps {
|
|
10
|
+
children?: React.ReactNode
|
|
11
|
+
style?: any
|
|
12
|
+
cellSize?: "small" | "medium" | "large"
|
|
13
|
+
width?: string | number
|
|
14
|
+
height?: string | number
|
|
15
|
+
colSpan?: number
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const styles = StyleSheet.create({
|
|
19
|
+
table: {
|
|
20
|
+
width: "100%",
|
|
21
|
+
borderWidth: 1,
|
|
22
|
+
borderColor: "#000",
|
|
23
|
+
|
|
24
|
+
overflow: "hidden",
|
|
25
|
+
marginBottom: 20,
|
|
26
|
+
},
|
|
27
|
+
thead: {
|
|
28
|
+
backgroundColor: "#f0f0f0",
|
|
29
|
+
|
|
30
|
+
},
|
|
31
|
+
tbody: {},
|
|
32
|
+
tr: {
|
|
33
|
+
flexDirection: "row",
|
|
34
|
+
borderBottomWidth: 1,
|
|
35
|
+
borderColor: "#000",
|
|
36
|
+
},
|
|
37
|
+
th: {
|
|
38
|
+
paddingTop: 4,
|
|
39
|
+
fontSize: 10,
|
|
40
|
+
fontFamily: "Helvetica",
|
|
41
|
+
fontWeight: "bold",
|
|
42
|
+
borderRight: 1,
|
|
43
|
+
borderColor: "#000",
|
|
44
|
+
textAlign: "center",
|
|
45
|
+
},
|
|
46
|
+
td: {
|
|
47
|
+
paddingTop: 4,
|
|
48
|
+
paddingLeft: 8,
|
|
49
|
+
paddingRight: 8,
|
|
50
|
+
fontSize: 10,
|
|
51
|
+
fontFamily: "Helvetica",
|
|
52
|
+
borderRight: 1,
|
|
53
|
+
borderColor: "#000",
|
|
54
|
+
},
|
|
55
|
+
cellSmall: {
|
|
56
|
+
width: "25%",
|
|
57
|
+
},
|
|
58
|
+
cellMedium: {
|
|
59
|
+
width: "33.33%",
|
|
60
|
+
},
|
|
61
|
+
cellLarge: {
|
|
62
|
+
width: "50%",
|
|
63
|
+
},
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
// Mapeo explícito de cellSize a su estilo correspondiente
|
|
67
|
+
const cellSizeMapping = {
|
|
68
|
+
small: styles.cellSmall,
|
|
69
|
+
medium: styles.cellMedium,
|
|
70
|
+
large: styles.cellLarge,
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const Table: React.FC<TableProps> = ({ children, style }) => {
|
|
74
|
+
return <View style={[styles.table, style]}>{children}</View>
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const Thead: React.FC<TableProps> = ({ children, style }) => {
|
|
78
|
+
return <View style={[styles.thead, style]}>{children}</View>
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const Tbody: React.FC<TableProps> = ({ children, style }) => {
|
|
82
|
+
return <View style={[styles.tbody, style]}>{children}</View>
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const Tr: React.FC<TableProps> = ({ children, style }) => {
|
|
86
|
+
return <View style={[styles.tr, style]}>{children}</View>
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const Th: React.FC<CellProps> = ({ children, style, cellSize = "medium", width, height, colSpan }) => {
|
|
90
|
+
const spanWidth = colSpan ? `${(100 / 3) * colSpan}%` : undefined
|
|
91
|
+
const sizeStyle = cellSizeMapping[cellSize]
|
|
92
|
+
|
|
93
|
+
const customStyle = {
|
|
94
|
+
width: width || spanWidth || sizeStyle?.width,
|
|
95
|
+
...(height !== undefined && { height }),
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<View style={[styles.th, customStyle, style]}>
|
|
100
|
+
<Text>{children}</Text>
|
|
101
|
+
</View>
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const Td: React.FC<CellProps> = ({ children, style, cellSize = "medium", width, height, colSpan }) => {
|
|
106
|
+
const spanWidth = colSpan ? `${(100 / 3) * colSpan}%` : undefined
|
|
107
|
+
const sizeStyle = cellSizeMapping[cellSize]
|
|
108
|
+
|
|
109
|
+
const customStyle = {
|
|
110
|
+
width: width || spanWidth || sizeStyle?.width,
|
|
111
|
+
...(height !== undefined && { height }),
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return (
|
|
115
|
+
<View style={[styles.td, customStyle, style]}>
|
|
116
|
+
<Text>{children}</Text>
|
|
117
|
+
</View>
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export { Table, Thead, Tbody, Tr, Th, Td }
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import LayoutPDF from "./LayoutPDF"
|
|
2
|
+
import MakePDF from "./MakePDF"
|
|
3
|
+
import Img from "./Img"
|
|
4
|
+
import { Left, Right, Center } from "./Position"
|
|
5
|
+
import { P, A, H1, H2, H3, H4, H5, H6, Strong, Em, U, Small, Blockquote, Mark, Span, BR } from "./Etiquetas"
|
|
6
|
+
import { Table, Thead, Tbody, Tr, Th, Td } from "./Tablet"
|
|
7
|
+
import { Container, Row, Col1, Col2, Col3, Col4, Col5, Col6, Col7, Col8, Col9, Col10, Col11, Col12 } from "./Grid"
|
|
8
|
+
import { Header, Footer } from "./PageElements"
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
LayoutPDF,
|
|
12
|
+
MakePDF,
|
|
13
|
+
Img,
|
|
14
|
+
Left,
|
|
15
|
+
Right,
|
|
16
|
+
Center,
|
|
17
|
+
P,
|
|
18
|
+
A,
|
|
19
|
+
H1,
|
|
20
|
+
H2,
|
|
21
|
+
H3,
|
|
22
|
+
H4,
|
|
23
|
+
H5,
|
|
24
|
+
H6,
|
|
25
|
+
Strong,
|
|
26
|
+
Em,
|
|
27
|
+
U,
|
|
28
|
+
Small,
|
|
29
|
+
Blockquote,
|
|
30
|
+
Mark,
|
|
31
|
+
Span,
|
|
32
|
+
BR,
|
|
33
|
+
Table,
|
|
34
|
+
Thead,
|
|
35
|
+
Tbody,
|
|
36
|
+
Tr,
|
|
37
|
+
Th,
|
|
38
|
+
Td,
|
|
39
|
+
Container,
|
|
40
|
+
Row,
|
|
41
|
+
Col1,
|
|
42
|
+
Col2,
|
|
43
|
+
Col3,
|
|
44
|
+
Col4,
|
|
45
|
+
Col5,
|
|
46
|
+
Col6,
|
|
47
|
+
Col7,
|
|
48
|
+
Col8,
|
|
49
|
+
Col9,
|
|
50
|
+
Col10,
|
|
51
|
+
Col11,
|
|
52
|
+
Col12,
|
|
53
|
+
Header,
|
|
54
|
+
Footer,
|
|
55
|
+
}
|
|
56
|
+
|