Skip to content

Commit 46b452a

Browse files
Remove remaining deprecations
1 parent 8d20002 commit 46b452a

File tree

3 files changed

+10
-22
lines changed

3 files changed

+10
-22
lines changed

src/config.ts

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,7 @@ export interface UserOptions {
7676
headStyles?: Partial<Styles>
7777
footStyles?: Partial<Styles>
7878
alternateRowStyles?: Partial<Styles>
79-
columnStyles?: {
80-
[key: string]: Partial<Styles>
81-
}
79+
columnStyles?: { [key: string]: Partial<Styles> }
8280

8381
// Hooks
8482
/** Called when the plugin finished parsing cell content. Can be used to override content or styles for a specific cell. */
@@ -96,13 +94,7 @@ export interface UserOptions {
9694
export type ColumnInput =
9795
| string
9896
| number
99-
| {
100-
header?: CellInput
101-
title?: CellInput // deprecated (same as header)
102-
footer?: CellInput
103-
dataKey?: string | number
104-
key?: string | number // deprecated (same as dataKey)
105-
}
97+
| { header?: CellInput; footer?: CellInput; dataKey?: string | number }
10698

10799
export type Color = [number, number, number] | number | string | false
108100
export type MarginPaddingInput =
@@ -122,7 +114,6 @@ export interface CellDef {
122114
colSpan?: number
123115
styles?: Partial<Styles>
124116
content?: string | string[] | number
125-
title?: string // Deprecated, same as content
126117
_element?: HTMLTableCellElement
127118
}
128119

@@ -193,10 +184,7 @@ export function getTheme(name: ThemeName): { [key: string]: Partial<Styles> } {
193184
},
194185
alternateRow: {},
195186
},
196-
plain: {
197-
head: { fontStyle: 'bold' },
198-
foot: { fontStyle: 'bold' },
199-
},
187+
plain: { head: { fontStyle: 'bold' }, foot: { fontStyle: 'bold' } },
200188
}
201189
return themes[name]
202190
}

src/models.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ export class Cell {
248248
if (raw != null && typeof raw === 'object' && !Array.isArray(raw)) {
249249
this.rowSpan = raw.rowSpan || 1
250250
this.colSpan = raw.colSpan || 1
251-
content = raw.content ?? raw.title ?? raw
251+
content = raw.content ?? raw
252252
if (raw._element) {
253253
this.raw = raw._element
254254
}

src/tableCalculator.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
import { DocHandler, jsPDFDocument } from './documentHandler'
2-
import { Cell, Column, Row, Section, StylesProps, Table } from './models'
3-
import { calculateWidths } from './widthCalculator'
41
import {
52
CellInput,
63
ColumnInput,
@@ -10,8 +7,11 @@ import {
107
Styles,
118
ThemeName,
129
} from './config'
13-
import { assign } from './polyfills'
10+
import { DocHandler, jsPDFDocument } from './documentHandler'
1411
import { TableInput } from './inputParser'
12+
import { Cell, Column, Row, Section, StylesProps, Table } from './models'
13+
import { assign } from './polyfills'
14+
import { calculateWidths } from './widthCalculator'
1515

1616
export function createTable(jsPDFDoc: jsPDFDocument, input: TableInput) {
1717
const doc = new DocHandler(jsPDFDoc)
@@ -137,7 +137,7 @@ function generateSectionRow(
137137
function getSectionTitle(section: Section, column: ColumnInput) {
138138
if (section === 'head') {
139139
if (typeof column === 'object') {
140-
return column.header || column.title || null
140+
return column.header || null
141141
} else if (typeof column === 'string' || typeof column === 'number') {
142142
return column
143143
}
@@ -151,7 +151,7 @@ function createColumns(columns: ColumnInput[]) {
151151
return columns.map((input, index) => {
152152
let key
153153
if (typeof input === 'object') {
154-
key = input.dataKey ?? input.key ?? index
154+
key = input.dataKey ?? index
155155
} else {
156156
key = index
157157
}

0 commit comments

Comments
 (0)