forked from bpampuch/pdfmake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtableLayouts.js
100 lines (97 loc) · 1.61 KB
/
tableLayouts.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/*eslint no-unused-vars: ["error", {"args": "none"}]*/
export {
tableLayouts,
defaultTableLayout
};
const tableLayouts = {
noBorders: {
hLineWidth(i) {
return 0;
},
vLineWidth(i) {
return 0;
},
paddingLeft(i) {
return i && 4 || 0;
},
paddingRight(i, node) {
return (i < node.table.widths.length - 1) ? 4 : 0;
}
},
headerLineOnly: {
hLineWidth(i, node) {
if (i === 0 || i === node.table.body.length) {
return 0;
}
return (i === node.table.headerRows) ? 2 : 0;
},
vLineWidth(i) {
return 0;
},
paddingLeft(i) {
return i === 0 ? 0 : 8;
},
paddingRight(i, node) {
return (i === node.table.widths.length - 1) ? 0 : 8;
}
},
lightHorizontalLines: {
hLineWidth(i, node) {
if (i === 0 || i === node.table.body.length) {
return 0;
}
return (i === node.table.headerRows) ? 2 : 1;
},
vLineWidth(i) {
return 0;
},
hLineColor(i) {
return i === 1 ? 'black' : '#aaa';
},
paddingLeft(i) {
return i === 0 ? 0 : 8;
},
paddingRight(i, node) {
return (i === node.table.widths.length - 1) ? 0 : 8;
}
}
};
const defaultTableLayout = {
hLineWidth(i, node) {
return 1;
},
vLineWidth(i, node) {
return 1;
},
hLineColor(i, node) {
return 'black';
},
vLineColor(i, node) {
return 'black';
},
hLineStyle(i, node) {
return null;
},
vLineStyle(i, node) {
return null;
},
paddingLeft(i, node) {
return 4;
},
paddingRight(i, node) {
return 4;
},
paddingTop(i, node) {
return 2;
},
paddingBottom(i, node) {
return 2;
},
fillColor(i, node) {
return null;
},
fillOpacity(i, node) {
return 1;
},
defaultBorder: true
};