From 8241cf91b1d954175ce4bc5faaa598c782437098 Mon Sep 17 00:00:00 2001 From: motinados <69296148+motinados@users.noreply.github.com> Date: Sat, 30 Mar 2024 14:01:07 +0900 Subject: [PATCH] refactor: rename props to opts (#96) * rename ColProps to ColOpts * rename RowProps to RowOpts * rename WorksheetProps to WorksheetOpts --- README.md | 6 +- src/index.ts | 8 +- src/workbook.ts | 10 +-- src/worksheet.ts | 86 +++++++++---------- src/xml/worksheetXml.ts | 49 +++++------ tests/integration/alignment.test.ts | 8 +- tests/integration/colStyle.test.ts | 8 +- tests/integration/colStyle1.test.ts | 4 +- tests/integration/cols.test.ts | 8 +- .../conditionalFormatting6.test.ts | 2 +- tests/integration/rowStyle.test.ts | 6 +- tests/integration/rows.test.ts | 8 +- tests/row.test.ts | 20 ++--- tests/worksheet.test.ts | 6 +- tests/xml/worksheetXml.test.ts | 27 +++--- 15 files changed, 125 insertions(+), 131 deletions(-) diff --git a/README.md b/README.md index 71100e8..bb0022c 100644 --- a/README.md +++ b/README.md @@ -152,7 +152,7 @@ import { Workbook } from "xlsx-kaku"; const wb = new Workbook(); const ws = wb.addWorksheet("Sheet1"); -ws.setColProps({ +ws.setColOpts({ index: 0, width: 12, style: { fill: { patternType: "solid", fgColor: "FFFFFF00" } }, @@ -169,9 +169,9 @@ import { Workbook } from "xlsx-kaku"; const wb = new Workbook(); const ws = wb.addWorksheet("Sheet1"); -// Currently, RowProps do not work without a value in the cell. +// Currently, RowOpts do not work without a value in the cell. ws.setCell(0, 0, { type: "number", value: 1 }); -ws.setRowProps({ +ws.setRowOpts({ index: 0, height: 20, style: { fill: { patternType: "solid", fgColor: "FFFFFF00" } }, diff --git a/src/index.ts b/src/index.ts index 52082e0..301363d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,12 +5,12 @@ import { NumberFormat } from "./numberFormats"; import { Cell, NullableCell, RowData, SheetData } from "./sheetData"; import { Workbook, WorkbookS } from "./workbook"; import { - ColProps, + ColOpts, Worksheet, WorksheetS, MergeCell, FreezePane, - RowProps, + RowOpts, ConditionalFormatting, } from "./worksheet"; import { genXlsx, genXlsxSync } from "./writer"; @@ -22,12 +22,12 @@ export { NumberFormat }; export { Cell, NullableCell, RowData, SheetData }; export { Workbook, WorkbookS }; export { - ColProps, + ColOpts, Worksheet, WorksheetS, MergeCell, FreezePane, - RowProps, + RowOpts, ConditionalFormatting, }; export { genXlsx, genXlsxSync }; diff --git a/src/workbook.ts b/src/workbook.ts index 86f1898..a2c40a4 100644 --- a/src/workbook.ts +++ b/src/workbook.ts @@ -1,7 +1,7 @@ import { genXlsx, genXlsxSync } from "./writer"; import { Worksheet, - WorksheetProps, + WorksheetOpts, WorksheetS, WorksheetType, } from "./worksheet"; @@ -14,12 +14,12 @@ export class Workbook { private _worksheets: WorksheetType[] = []; private _imageStore: ImageStore = new ImageStore(); - addWorksheet(sheetName: string, props?: WorksheetProps) { + addWorksheet(sheetName: string, opts?: WorksheetOpts) { if (this._worksheets.some((ws) => ws.name === sheetName)) { throw new Error(`Worksheet name "${sheetName}" is already used.`); } - const ws = new Worksheet(sheetName, this._imageStore, props); + const ws = new Worksheet(sheetName, this._imageStore, opts); this._worksheets.push(ws); return ws; } @@ -43,12 +43,12 @@ export class Workbook { export class WorkbookS { private _worksheets: WorksheetType[] = []; - addWorksheet(sheetName: string, props?: WorksheetProps) { + addWorksheet(sheetName: string, opts?: WorksheetOpts) { if (this._worksheets.some((ws) => ws.name === sheetName)) { throw new Error(`Worksheet name "${sheetName}" is already used.`); } - const ws = new WorksheetS(sheetName, props); + const ws = new WorksheetS(sheetName, opts); this._worksheets.push(ws); return ws; } diff --git a/src/worksheet.ts b/src/worksheet.ts index 4f9f66e..b1a54dd 100644 --- a/src/worksheet.ts +++ b/src/worksheet.ts @@ -15,13 +15,13 @@ import { CellStyle, NullableCell, SheetData } from "./sheetData"; export const DEFAULT_COL_WIDTH = 9; export const DEFAULT_ROW_HEIGHT = 13.5; -export type ColProps = { +export type ColOpts = { index: number; width?: number; style?: CellStyle; }; -export type RowProps = { +export type RowOpts = { index: number; height?: number; style?: CellStyle; @@ -159,19 +159,19 @@ export type Image = { export type ImageInfo = Omit; -export type WorksheetProps = { +export type WorksheetOpts = { defaultColWidth?: number; defaultRowHeight?: number; }; -type RequiredWorksheetProps = Required; +type RequiredWorksheetOpts = Required; export type WorksheetType = { name: string; - props: RequiredWorksheetProps; + opts: RequiredWorksheetOpts; sheetData: SheetData; - cols: Map; - rows: Map; + colOptsMap: Map; + rowOptsMap: Map; mergeCells: MergeCell[]; freezePane: FreezePane | null; mergeCellsModule: MergeCellsModule | null; @@ -181,8 +181,8 @@ export type WorksheetType = { imageModule: ImageModule | null; getCell(rowIndex: number, colIndex: number): NullableCell; setCell(rowIndex: number, colIndex: number, cell: NullableCell): void; - setColProps(col: ColProps): void; - setRowProps(row: RowProps): void; + setColOpts(col: ColOpts): void; + setRowOpts(row: RowOpts): void; setFreezePane(freezePane: FreezePane): void; }; @@ -191,10 +191,10 @@ export type WorksheetType = { */ export class Worksheet implements WorksheetType { private _name: string; - private _props: RequiredWorksheetProps; + private _opts: RequiredWorksheetOpts; private _sheetData: SheetData = []; - private _cols = new Map(); - private _rows = new Map(); + private _colOptsMap = new Map(); + private _rowOptsMap = new Map(); private _mergeCellsModule: MergeCellsModule = mergeCellsModule(); private _freezePane: FreezePane | null = null; private _conditionalFormattingModule: ConditionalFormattingModule = @@ -206,13 +206,13 @@ export class Worksheet implements WorksheetType { constructor( name: string, imageStore?: ImageStore, - props: WorksheetProps | undefined = {} + opts: WorksheetOpts | undefined = {} ) { this._name = name; - this._props = { - defaultColWidth: props.defaultColWidth ?? DEFAULT_COL_WIDTH, - defaultRowHeight: props.defaultRowHeight ?? DEFAULT_ROW_HEIGHT, + this._opts = { + defaultColWidth: opts.defaultColWidth ?? DEFAULT_COL_WIDTH, + defaultRowHeight: opts.defaultRowHeight ?? DEFAULT_ROW_HEIGHT, }; this._imageStore = imageStore || new ImageStore(); @@ -222,8 +222,8 @@ export class Worksheet implements WorksheetType { return this._name; } - get props() { - return this._props; + get opts() { + return this._opts; } set sheetData(sheetData: SheetData) { @@ -234,12 +234,12 @@ export class Worksheet implements WorksheetType { return this._sheetData; } - get cols() { - return this._cols; + get colOptsMap() { + return this._colOptsMap; } - get rows() { - return this._rows; + get rowOptsMap() { + return this._rowOptsMap; } get mergeCells() { @@ -304,12 +304,12 @@ export class Worksheet implements WorksheetType { rows[colIndex] = cell; } - setColProps(colProps: ColProps) { - this._cols.set(colProps.index, colProps); + setColOpts(colOpts: ColOpts) { + this._colOptsMap.set(colOpts.index, colOpts); } - setRowProps(row: RowProps) { - this._rows.set(row.index, row); + setRowOpts(rowOpts: RowOpts) { + this._rowOptsMap.set(rowOpts.index, rowOpts); } setMergeCell(mergeCell: MergeCell) { @@ -335,10 +335,10 @@ export class Worksheet implements WorksheetType { */ export class WorksheetS implements WorksheetType { private _name: string; - private _props: RequiredWorksheetProps; + private _opts: RequiredWorksheetOpts; private _sheetData: SheetData = []; - private _cols = new Map(); - private _rows = new Map(); + private _colOptsMap = new Map(); + private _rowOptsMap = new Map(); private _mergeCellsModule = null; private _freezePane: FreezePane | null = null; private _conditionalFormattingModule = null; @@ -346,12 +346,12 @@ export class WorksheetS implements WorksheetType { private _imageStore = null; private _imageModule = null; - constructor(name: string, props: WorksheetProps | undefined = {}) { + constructor(name: string, opts: WorksheetOpts | undefined = {}) { this._name = name; - this._props = { - defaultColWidth: props.defaultColWidth ?? DEFAULT_COL_WIDTH, - defaultRowHeight: props.defaultRowHeight ?? DEFAULT_ROW_HEIGHT, + this._opts = { + defaultColWidth: opts.defaultColWidth ?? DEFAULT_COL_WIDTH, + defaultRowHeight: opts.defaultRowHeight ?? DEFAULT_ROW_HEIGHT, }; } @@ -359,8 +359,8 @@ export class WorksheetS implements WorksheetType { return this._name; } - get props() { - return this._props; + get opts() { + return this._opts; } set sheetData(sheetData: SheetData) { @@ -371,12 +371,12 @@ export class WorksheetS implements WorksheetType { return this._sheetData; } - get cols() { - return this._cols; + get colOptsMap() { + return this._colOptsMap; } - get rows() { - return this._rows; + get rowOptsMap() { + return this._rowOptsMap; } get mergeCells() { @@ -441,12 +441,12 @@ export class WorksheetS implements WorksheetType { rows[colIndex] = cell; } - setColProps(colProps: ColProps) { - this._cols.set(colProps.index, colProps); + setColOpts(colOpts: ColOpts) { + this._colOptsMap.set(colOpts.index, colOpts); } - setRowProps(row: RowProps) { - this._rows.set(row.index, row); + setRowOpts(rowOpts: RowOpts) { + this._rowOptsMap.set(rowOpts.index, rowOpts); } setFreezePane(freezePane: FreezePane) { diff --git a/src/xml/worksheetXml.ts b/src/xml/worksheetXml.ts index 6334851..5d69989 100644 --- a/src/xml/worksheetXml.ts +++ b/src/xml/worksheetXml.ts @@ -6,10 +6,10 @@ import { convColIndexToColName, convColNameToColIndex } from "../utils"; import { Alignment, CellXf } from "../cellXfs"; import { Hyperlinks } from "../hyperlinks"; import { - ColProps, + ColOpts, DEFAULT_COL_WIDTH, DEFAULT_ROW_HEIGHT, - RowProps, + RowOpts, } from "../worksheet"; import { Dxf } from "../dxf"; import { DrawingRels } from "../drawingRels"; @@ -255,23 +255,19 @@ export function makeWorksheetXml( styleMappers.worksheetRels.reset(); drawingRels.reset(); - const defaultColWidth = worksheet.props.defaultColWidth; - const defaultRowHeight = worksheet.props.defaultRowHeight; + const defaultColWidth = worksheet.opts.defaultColWidth; + const defaultRowHeight = worksheet.opts.defaultRowHeight; const sheetData = worksheet.sheetData; const xlsxCols = new Map(); - for (const col of worksheet.cols.values()) { - const xlsxCol = createXlsxColFromColProps( - col, - styleMappers, - defaultColWidth - ); + for (const col of worksheet.colOptsMap.values()) { + const xlsxCol = createXlsxCol(col, styleMappers, defaultColWidth); xlsxCols.set(xlsxCol.index, xlsxCol); } const xlsxRows = new Map(); - for (const row of worksheet.rows.values()) { - const xlsxRow = createXlsxRowFromRowProps(row, styleMappers); + for (const row of worksheet.rowOptsMap.values()) { + const xlsxRow = createXlsxRow(row, styleMappers); xlsxRows.set(xlsxRow.index, xlsxRow); } @@ -375,14 +371,14 @@ export function makeWorksheetXml( }; } -export function createXlsxColFromColProps( - col: ColProps, +export function createXlsxCol( + colOpts: ColOpts, mappers: StyleMappers, defaultWidth: number ): XlsxCol { let cellXfId: number | null = null; - if (col.style) { - const style = composeXlsxCellStyle(col.style, mappers); + if (colOpts.style) { + const style = composeXlsxCellStyle(colOpts.style, mappers); if (style === null) { throw new Error("style is null"); } @@ -390,9 +386,9 @@ export function createXlsxColFromColProps( } return { - index: col.index, - width: col.width ?? defaultWidth, - customWidth: col.width !== undefined && col.width !== defaultWidth, + index: colOpts.index, + width: colOpts.width ?? defaultWidth, + customWidth: colOpts.width !== undefined && colOpts.width !== defaultWidth, cellXfId: cellXfId, }; } @@ -421,13 +417,13 @@ export function composeXlsxCellStyle( return null; } -export function createXlsxRowFromRowProps( - row: RowProps, +export function createXlsxRow( + rowOpts: RowOpts, styleMappers: StyleMappers ): XlsxRow { let cellXfId: number | null = null; - if (row.style) { - const style = composeXlsxCellStyle(row.style, styleMappers); + if (rowOpts.style) { + const style = composeXlsxCellStyle(rowOpts.style, styleMappers); if (style === null) { throw new Error("style is null"); } @@ -435,9 +431,10 @@ export function createXlsxRowFromRowProps( } return { - index: row.index, - height: row.height ?? DEFAULT_ROW_HEIGHT, - customHeight: row.height !== undefined && row.height !== DEFAULT_ROW_HEIGHT, + index: rowOpts.index, + height: rowOpts.height ?? DEFAULT_ROW_HEIGHT, + customHeight: + rowOpts.height !== undefined && rowOpts.height !== DEFAULT_ROW_HEIGHT, cellXfId: cellXfId, }; } diff --git a/tests/integration/alignment.test.ts b/tests/integration/alignment.test.ts index 0bc95c7..9ca215c 100644 --- a/tests/integration/alignment.test.ts +++ b/tests/integration/alignment.test.ts @@ -101,10 +101,10 @@ describe("alignment", () => { }, }); - ws.setRowProps({ index: 0, height: 39.75 }); - ws.setRowProps({ index: 1, height: 39.75 }); - ws.setRowProps({ index: 2, height: 39.75 }); - ws.setRowProps({ index: 3, height: 39.75 }); + ws.setRowOpts({ index: 0, height: 39.75 }); + ws.setRowOpts({ index: 1, height: 39.75 }); + ws.setRowOpts({ index: 2, height: 39.75 }); + ws.setRowOpts({ index: 3, height: 39.75 }); const xlsx = await wb.generateXlsx(); writeFile(actualXlsxPath, xlsx); diff --git a/tests/integration/colStyle.test.ts b/tests/integration/colStyle.test.ts index 13f3e70..2116dd4 100644 --- a/tests/integration/colStyle.test.ts +++ b/tests/integration/colStyle.test.ts @@ -34,25 +34,25 @@ describe("col style", () => { const wb = new Workbook(); const ws = wb.addWorksheet("Sheet1"); - ws.setColProps({ + ws.setColOpts({ index: 0, style: { fill: { patternType: "solid", fgColor: "FFFFFF00" }, }, }); - ws.setColProps({ + ws.setColOpts({ index: 2, style: { fill: { patternType: "solid", fgColor: "FFFF0000" }, }, }); - ws.setColProps({ + ws.setColOpts({ index: 3, style: { fill: { patternType: "solid", fgColor: "FFFF0000" }, }, }); - ws.setColProps({ + ws.setColOpts({ index: 4, style: { fill: { patternType: "solid", fgColor: "FFFF0000" }, diff --git a/tests/integration/colStyle1.test.ts b/tests/integration/colStyle1.test.ts index 57eb264..6ff70c4 100644 --- a/tests/integration/colStyle1.test.ts +++ b/tests/integration/colStyle1.test.ts @@ -34,13 +34,13 @@ describe("col style with cell value", () => { const wb = new Workbook(); const ws = wb.addWorksheet("Sheet1"); - ws.setColProps({ + ws.setColOpts({ index: 0, style: { fill: { patternType: "solid", fgColor: "FFFFFF00" }, }, }); - ws.setColProps({ + ws.setColOpts({ index: 2, style: { fill: { patternType: "solid", fgColor: "FFFF0000" }, diff --git a/tests/integration/cols.test.ts b/tests/integration/cols.test.ts index 4a4f14c..8d1d54e 100644 --- a/tests/integration/cols.test.ts +++ b/tests/integration/cols.test.ts @@ -40,19 +40,19 @@ describe("cols", () => { ws.setCell(0, 4, { type: "number", value: 5 }); ws.setCell(0, 5, { type: "number", value: 6 }); - ws.setColProps({ + ws.setColOpts({ index: 1, width: 25.625, }); - ws.setColProps({ + ws.setColOpts({ index: 2, width: 6.625, }); - ws.setColProps({ + ws.setColOpts({ index: 3, width: 6.625, }); - ws.setColProps({ + ws.setColOpts({ index: 4, width: 6.625, }); diff --git a/tests/integration/conditionalFormatting6.test.ts b/tests/integration/conditionalFormatting6.test.ts index 8b70e38..9ea4e97 100644 --- a/tests/integration/conditionalFormatting6.test.ts +++ b/tests/integration/conditionalFormatting6.test.ts @@ -279,7 +279,7 @@ describe("conditional formatting for date", () => { // FIXME: bgColors are different for (let i = 0; i < 10; i++) { - ws.setColProps({ + ws.setColOpts({ index: i, width: 11, }); diff --git a/tests/integration/rowStyle.test.ts b/tests/integration/rowStyle.test.ts index 1e7c2e2..71fe62e 100644 --- a/tests/integration/rowStyle.test.ts +++ b/tests/integration/rowStyle.test.ts @@ -40,17 +40,17 @@ describe("row style", () => { ws.setCell(3, 0, { type: "number", value: 4 }); ws.setCell(4, 0, { type: "number", value: 5 }); - ws.setRowProps({ + ws.setRowOpts({ index: 1, style: { fill: { patternType: "solid", fgColor: "FFFF0000" } }, }); - ws.setRowProps({ + ws.setRowOpts({ index: 2, style: { fill: { patternType: "solid", fgColor: "FFFFFF00" } }, }); - ws.setRowProps({ + ws.setRowOpts({ index: 3, height: 20.25, style: { fill: { patternType: "solid", fgColor: "FFFF0000" } }, diff --git a/tests/integration/rows.test.ts b/tests/integration/rows.test.ts index dfc2f86..cf64e0a 100644 --- a/tests/integration/rows.test.ts +++ b/tests/integration/rows.test.ts @@ -39,10 +39,10 @@ describe("rows", () => { ws.setCell(4, 0, { type: "number", value: 5 }); ws.setCell(5, 0, { type: "number", value: 6 }); - ws.setRowProps({ index: 1, height: 20.25 }); - ws.setRowProps({ index: 2, height: 39.75 }); - ws.setRowProps({ index: 3, height: 39.75 }); - ws.setRowProps({ index: 4, height: 39.75 }); + ws.setRowOpts({ index: 1, height: 20.25 }); + ws.setRowOpts({ index: 2, height: 39.75 }); + ws.setRowOpts({ index: 3, height: 39.75 }); + ws.setRowOpts({ index: 4, height: 39.75 }); const xlsx = await wb.generateXlsx(); writeFile(actualXlsxPath, xlsx); diff --git a/tests/row.test.ts b/tests/row.test.ts index 7cbf721..8b14f40 100644 --- a/tests/row.test.ts +++ b/tests/row.test.ts @@ -1,11 +1,11 @@ import { Worksheet } from "../src"; describe("row", () => { - test("setRowProps", () => { + test("setRowOpts", () => { const ws = new Worksheet("Sheet1"); - ws.setRowProps({ index: 0, height: 10 }); - expect(ws.rows).toStrictEqual( + ws.setRowOpts({ index: 0, height: 10 }); + expect(ws.rowOptsMap).toStrictEqual( new Map([ [ 0, @@ -17,8 +17,8 @@ describe("row", () => { ]) ); - ws.setRowProps({ index: 1, height: 20 }); - expect(ws.rows).toStrictEqual( + ws.setRowOpts({ index: 1, height: 20 }); + expect(ws.rowOptsMap).toStrictEqual( new Map([ [ 0, @@ -37,12 +37,12 @@ describe("row", () => { ]) ); - // setRowProps overwrite existing props - ws.setRowProps({ + // setRowOpts overwrite existing opts + ws.setRowOpts({ index: 0, style: { alignment: { horizontal: "center" } }, }); - expect(ws.rows).toStrictEqual( + expect(ws.rowOptsMap).toStrictEqual( new Map([ [ 0, @@ -61,8 +61,8 @@ describe("row", () => { ]) ); - ws.setRowProps({ index: 1, style: { alignment: { vertical: "top" } } }); - expect(ws.rows).toStrictEqual( + ws.setRowOpts({ index: 1, style: { alignment: { vertical: "top" } } }); + expect(ws.rowOptsMap).toStrictEqual( new Map([ [ 0, diff --git a/tests/worksheet.test.ts b/tests/worksheet.test.ts index 8b1e11a..e060708 100644 --- a/tests/worksheet.test.ts +++ b/tests/worksheet.test.ts @@ -16,9 +16,9 @@ describe("worksheet", () => { expect(ws.name).toBe("Sheet1"); }); - test("get props", () => { + test("get opts", () => { const ws = new Worksheet("Sheet1"); - expect(ws.props).toStrictEqual({ + expect(ws.opts).toStrictEqual({ defaultColWidth: DEFAULT_COL_WIDTH, defaultRowHeight: DEFAULT_ROW_HEIGHT, }); @@ -26,7 +26,7 @@ describe("worksheet", () => { const ws2 = new Worksheet("Sheet2", new ImageStore(), { defaultColWidth: 10, }); - expect(ws2.props).toStrictEqual({ + expect(ws2.opts).toStrictEqual({ defaultColWidth: 10, defaultRowHeight: DEFAULT_ROW_HEIGHT, }); diff --git a/tests/xml/worksheetXml.test.ts b/tests/xml/worksheetXml.test.ts index 634d957..179f373 100644 --- a/tests/xml/worksheetXml.test.ts +++ b/tests/xml/worksheetXml.test.ts @@ -3,8 +3,8 @@ import { SharedStrings } from "../../src/sharedStrings"; import { convertCellToXlsxCell, convertIsoStringToSerialValue, - createXlsxColFromColProps, - createXlsxRowFromRowProps, + createXlsxCol, + createXlsxRow, findFirstNonNullCell, findLastNonNullCell, getDimension, @@ -31,7 +31,7 @@ import { CellStyles } from "../../src/cellStyles"; import { Hyperlinks } from "../../src/hyperlinks"; import { WorksheetRels } from "../../src/worksheetRels"; import { - ColProps, + ColOpts, DEFAULT_COL_WIDTH, DEFAULT_ROW_HEIGHT, FreezePane, @@ -254,10 +254,7 @@ describe("Writer", () => { test("makeRowXml with height", () => { const styleMappers = getStyleMappers(); const row: RowData = [{ type: "number", value: 10 }]; - const xlsxRow = createXlsxRowFromRowProps( - { index: 0, height: 30 }, - styleMappers - ); + const xlsxRow = createXlsxRow({ index: 0, height: 30 }, styleMappers); const result = makeRowElm( row, 0, @@ -275,7 +272,7 @@ describe("Writer", () => { test("makeRowXml with style", () => { const styleMappers = getStyleMappers(); const row: RowData = [{ type: "number", value: 10 }]; - const xlsxRow = createXlsxRowFromRowProps( + const xlsxRow = createXlsxRow( { index: 0, style: { alignment: { horizontal: "center" } } }, styleMappers ); @@ -296,7 +293,7 @@ describe("Writer", () => { test("makeRowXml with style and height", () => { const styleMappers = getStyleMappers(); const row: RowData = [{ type: "number", value: 10 }]; - const xlsxRow = createXlsxRowFromRowProps( + const xlsxRow = createXlsxRow( { index: 0, height: 30, @@ -367,7 +364,7 @@ describe("Writer", () => { test("makeColsXml for width", () => { const styleMappers = getStyleMappers(); - const cols: ColProps[] = [ + const cols: ColOpts[] = [ { index: 0, width: 10 }, { index: 1, width: 75 }, { index: 2, width: 25 }, @@ -380,7 +377,7 @@ describe("Writer", () => { cols.forEach((col) => { xlsxCols.set( col.index, - createXlsxColFromColProps(col, styleMappers, DEFAULT_COL_WIDTH) + createXlsxCol(col, styleMappers, DEFAULT_COL_WIDTH) ); }); const groupedXlsxCols = groupXlsxCols(xlsxCols); @@ -391,13 +388,13 @@ describe("Writer", () => { test("makeColsXml for default width", () => { const styleMappers = getStyleMappers(); - const cols: ColProps[] = [{ index: 0, width: DEFAULT_COL_WIDTH }]; + const cols: ColOpts[] = [{ index: 0, width: DEFAULT_COL_WIDTH }]; const xlsxCols = new Map(); cols.forEach((col) => { xlsxCols.set( col.index, - createXlsxColFromColProps(col, styleMappers, DEFAULT_COL_WIDTH) + createXlsxCol(col, styleMappers, DEFAULT_COL_WIDTH) ); }); const groupedXlsxCols = groupXlsxCols(xlsxCols); @@ -410,7 +407,7 @@ describe("Writer", () => { test("makeColsXml for style", () => { const styleMappers = getStyleMappers(); - const cols: ColProps[] = [ + const cols: ColOpts[] = [ { index: 0, style: { alignment: { horizontal: "center" } }, @@ -435,7 +432,7 @@ describe("Writer", () => { cols.forEach((col) => { xlsxCols.set( col.index, - createXlsxColFromColProps(col, styleMappers, DEFAULT_COL_WIDTH) + createXlsxCol(col, styleMappers, DEFAULT_COL_WIDTH) ); }); const groupedXlsxCols = groupXlsxCols(xlsxCols);