abstract-sheet
Advanced tools
Comparing version 0.0.25 to 0.0.26
@@ -1,4 +0,4 @@ | ||
import { WorkSheet } from "xlsx-js-style"; | ||
import * as Xlsx from "xlsx-js-style"; | ||
import { Sheet } from "../abstract-sheet/abstract-sheet.js"; | ||
export declare function xlsxWorkSheet(sheet: Sheet, styles: Record<string, any>): WorkSheet; | ||
export declare function xlsxWorkSheet(sheet: Sheet, styles: Record<string, any>): Xlsx.WorkSheet; | ||
//# sourceMappingURL=_xlsx-sheet.d.ts.map |
@@ -1,2 +0,2 @@ | ||
import { utils } from "xlsx-js-style"; | ||
import * as Xlsx from "xlsx-js-style"; | ||
export function xlsxWorkSheet(sheet, styles) { | ||
@@ -16,3 +16,3 @@ let colMax = -1; | ||
} | ||
const key = sheet.direction === "col" ? `${utils.encode_col(ri)}${ci + 1}` : `${utils.encode_col(ci)}${ri + 1}`; | ||
const key = sheet.direction === "col" ? `${Xlsx.utils.encode_col(ri)}${ci + 1}` : `${Xlsx.utils.encode_col(ci)}${ri + 1}`; | ||
cells[key] = { v: c.value, t: cellObject(c.type), s }; | ||
@@ -24,4 +24,4 @@ } | ||
"!ref": `A1:${sheet.direction === "col" | ||
? `${utils.encode_col(sheet.cells.length)}${colMax}` | ||
: `${utils.encode_col(colMax)}${sheet.cells.length}`}`, | ||
? `${Xlsx.utils.encode_col(sheet.cells.length)}${colMax}` | ||
: `${Xlsx.utils.encode_col(colMax)}${sheet.cells.length}`}`, | ||
"!cols": sheet.colInfo?.map((i) => ({ wpx: i.widthPixels ?? 64, hidden: i.hidden })), | ||
@@ -28,0 +28,0 @@ "!rows": sheet.rowInfo?.map((i) => ({ hpx: i.heightPixels ?? 15, hidden: i.hidden })), |
{ | ||
"name": "abstract-sheet", | ||
"version": "0.0.25", | ||
"version": "0.0.26", | ||
"description": "Abstract sheet", | ||
@@ -36,3 +36,3 @@ "author": "Divid AB <info@divid.se>", | ||
}, | ||
"gitHead": "34553bbe1a377f1d69ec7491334cb7728bb4564b" | ||
"gitHead": "dbaddc00567309138aba3bce4ba4a17cfc943637" | ||
} |
@@ -1,7 +0,7 @@ | ||
import { WorkSheet, CellObject, utils, ColInfo, RowInfo } from "xlsx-js-style"; | ||
import * as Xlsx from "xlsx-js-style"; | ||
import { CellType, Sheet } from "../abstract-sheet/abstract-sheet.js"; | ||
export function xlsxWorkSheet(sheet: Sheet, styles: Record<string, any>): WorkSheet { | ||
export function xlsxWorkSheet(sheet: Sheet, styles: Record<string, any>): Xlsx.WorkSheet { | ||
let colMax = -1; | ||
const cells: Record<string, CellObject> = {}; | ||
const cells: Record<string, Xlsx.CellObject> = {}; | ||
for (let ri = 0; ri < sheet.cells.length; ri++) { | ||
@@ -18,3 +18,4 @@ const r = sheet.cells[ri]!; | ||
} | ||
const key = sheet.direction === "col" ? `${utils.encode_col(ri)}${ci + 1}` : `${utils.encode_col(ci)}${ri + 1}`; | ||
const key = | ||
sheet.direction === "col" ? `${Xlsx.utils.encode_col(ri)}${ci + 1}` : `${Xlsx.utils.encode_col(ci)}${ri + 1}`; | ||
cells[key] = { v: c.value, t: cellObject(c.type), s }; | ||
@@ -28,7 +29,7 @@ } | ||
sheet.direction === "col" | ||
? `${utils.encode_col(sheet.cells.length)}${colMax}` | ||
: `${utils.encode_col(colMax)}${sheet.cells.length}` | ||
? `${Xlsx.utils.encode_col(sheet.cells.length)}${colMax}` | ||
: `${Xlsx.utils.encode_col(colMax)}${sheet.cells.length}` | ||
}`, | ||
"!cols": sheet.colInfo?.map((i): ColInfo => ({ wpx: i.widthPixels ?? 64, hidden: i.hidden })), | ||
"!rows": sheet.rowInfo?.map((i): RowInfo => ({ hpx: i.heightPixels ?? 15, hidden: i.hidden })), | ||
"!cols": sheet.colInfo?.map((i): Xlsx.ColInfo => ({ wpx: i.widthPixels ?? 64, hidden: i.hidden })), | ||
"!rows": sheet.rowInfo?.map((i): Xlsx.RowInfo => ({ hpx: i.heightPixels ?? 15, hidden: i.hidden })), | ||
...cells, | ||
@@ -38,3 +39,3 @@ }; | ||
const cellObject = (colType: CellType | undefined): CellObject["t"] => { | ||
const cellObject = (colType: CellType | undefined): Xlsx.CellObject["t"] => { | ||
switch (colType) { | ||
@@ -41,0 +42,0 @@ case "number": |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
139126
2174