@cj-tech-master/excelts 1.6.1 → 1.6.2-canary.20251223042142.4d33ec6

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.
@@ -1,85 +1,119 @@
1
- import type { RowBreak } from "../../types.js";
1
+ import { Dimensions } from "../../doc/range.js";
2
+ import { StringBuf } from "../../utils/string-buf.js";
3
+ import { Row } from "../../doc/row.js";
4
+ import { Column } from "../../doc/column.js";
5
+ import { SheetRelsWriter } from "./sheet-rels-writer.js";
6
+ import { SheetCommentsWriter } from "./sheet-comments-writer.js";
7
+ import { DataValidations } from "../../doc/data-validations.js";
8
+ import type { StreamBuf } from "../../utils/stream-buf.js";
9
+ import type { RowBreak, PageSetup, HeaderFooter, WorksheetProperties, WorksheetView, WorksheetState, AutoFilter, WorksheetProtection, ConditionalFormattingOptions } from "../../types.js";
2
10
  interface WorksheetWriterOptions {
3
11
  id: number;
4
12
  name?: string;
5
13
  workbook: any;
6
14
  useSharedStrings?: boolean;
7
- properties?: any;
8
- state?: string;
9
- pageSetup?: any;
10
- views?: any[];
11
- autoFilter?: any;
12
- headerFooter?: any;
15
+ properties?: Partial<WorksheetProperties>;
16
+ state?: WorksheetState;
17
+ pageSetup?: Partial<PageSetup>;
18
+ views?: Partial<WorksheetView>[];
19
+ autoFilter?: AutoFilter;
20
+ headerFooter?: Partial<HeaderFooter>;
13
21
  }
14
22
  declare class WorksheetWriter {
15
23
  id: number;
16
24
  name: string;
17
- state: string;
18
- _rows: any[] | null;
19
- _columns: any[] | null;
25
+ state: WorksheetState;
26
+ /** Rows stored while being worked on. Set to null after commit. */
27
+ _rows: Row[] | null;
28
+ /** Column definitions */
29
+ _columns: Column[] | null;
30
+ /** Column keys mapping: key => Column */
20
31
  _keys: {
21
- [key: string]: any;
32
+ [key: string]: Column;
22
33
  };
23
- _merges: any[];
24
- _sheetRelsWriter: any;
25
- _sheetCommentsWriter: any;
26
- _dimensions: any;
34
+ /** Merged cell ranges */
35
+ _merges: Dimensions[];
36
+ _sheetRelsWriter: SheetRelsWriter;
37
+ _sheetCommentsWriter: SheetCommentsWriter;
38
+ _dimensions: Dimensions;
27
39
  _rowZero: number;
28
40
  committed: boolean;
29
- dataValidations: any;
41
+ dataValidations: DataValidations;
42
+ /** Shared formulae by address */
30
43
  _formulae: {
31
- [key: string]: any;
44
+ [key: string]: unknown;
32
45
  };
33
46
  _siFormulae: number;
34
- conditionalFormatting: any[];
47
+ conditionalFormatting: ConditionalFormattingOptions[];
35
48
  rowBreaks: RowBreak[];
36
- properties: any;
37
- headerFooter: any;
38
- pageSetup: any;
49
+ properties: Partial<WorksheetProperties> & {
50
+ defaultRowHeight: number;
51
+ dyDescent: number;
52
+ outlineLevelCol: number;
53
+ outlineLevelRow: number;
54
+ };
55
+ headerFooter: Partial<HeaderFooter>;
56
+ pageSetup: Partial<PageSetup> & {
57
+ margins: PageSetup["margins"];
58
+ };
39
59
  useSharedStrings: boolean;
40
60
  _workbook: any;
41
61
  hasComments: boolean;
42
- _views: any[];
43
- autoFilter: any;
44
- _media: any[];
45
- sheetProtection: any;
46
- _stream?: any;
62
+ _views: Partial<WorksheetView>[];
63
+ autoFilter: AutoFilter | null;
64
+ _media: unknown[];
65
+ sheetProtection: {
66
+ sheet?: boolean;
67
+ algorithmName?: string;
68
+ saltValue?: string;
69
+ spinCount?: number;
70
+ hashValue?: string;
71
+ [key: string]: unknown;
72
+ } | null;
73
+ _stream?: InstanceType<typeof StreamBuf>;
47
74
  startedData: boolean;
48
- _background?: any;
75
+ _background?: {
76
+ imageId?: number;
77
+ rId?: string;
78
+ };
49
79
  _headerRowCount?: number;
80
+ /** Relationship Id - assigned by WorkbookWriter */
81
+ rId?: string;
50
82
  constructor(options: WorksheetWriterOptions);
51
83
  get workbook(): any;
52
84
  get stream(): any;
53
85
  destroy(): void;
54
86
  commit(): void;
55
- get dimensions(): any;
56
- get views(): any[];
57
- get columns(): any[] | null;
58
- set columns(value: any[]);
59
- getColumnKey(key: string): any;
60
- setColumnKey(key: string, value: any): void;
87
+ get dimensions(): Dimensions;
88
+ get views(): Partial<WorksheetView>[];
89
+ get columns(): Column[] | null;
90
+ set columns(value: Partial<Column>[]);
91
+ getColumnKey(key: string): Column | undefined;
92
+ setColumnKey(key: string, value: Column): void;
61
93
  deleteColumnKey(key: string): void;
62
- eachColumnKey(f: (column: any, key: string) => void): void;
63
- getColumn(c: string | number): any;
94
+ eachColumnKey(f: (column: Column, key: string) => void): void;
95
+ getColumn(c: string | number): Column;
64
96
  get _nextRow(): number;
65
- eachRow(options: any, iteratee?: (row: any, rowNumber: number) => void): void;
66
- _commitRow(cRow: any): void;
67
- get lastRow(): any;
68
- findRow(rowNumber: number): any;
69
- getRow(rowNumber: number): any;
70
- addRow(value: any): any;
71
- findCell(r: any, c?: number): any;
72
- getCell(r: any, c?: number): any;
73
- mergeCells(...cells: any[]): void;
74
- addConditionalFormatting(cf: any): void;
75
- removeConditionalFormatting(filter: any): void;
97
+ eachRow(options: {
98
+ includeEmpty?: boolean;
99
+ } | ((row: Row, rowNumber: number) => void), iteratee?: (row: Row, rowNumber: number) => void): void;
100
+ _commitRow(cRow: Row): void;
101
+ get lastRow(): Row | undefined;
102
+ findRow(rowNumber: number): Row | undefined;
103
+ getRow(rowNumber: number): Row;
104
+ addRow(value: any[] | Record<string, any>): Row;
105
+ findCell(r: string | number, c?: number): any;
106
+ getCell(r: string | number, c?: number): any;
107
+ mergeCells(...cells: (string | number)[]): void;
108
+ addConditionalFormatting(cf: ConditionalFormattingOptions): void;
109
+ removeConditionalFormatting(filter?: number | ((cf: ConditionalFormattingOptions) => boolean)): void;
76
110
  addBackgroundImage(imageId: number): void;
77
111
  getBackgroundImageId(): number | undefined;
78
- protect(password?: string, options?: any): Promise<void>;
112
+ protect(password?: string, options?: Partial<WorksheetProtection>): Promise<void>;
79
113
  unprotect(): void;
80
114
  _write(text: string): void;
81
- _writeSheetProperties(xmlBuf: any, properties: any, pageSetup: any): void;
82
- _writeSheetFormatProperties(xmlBuf: any, properties: any): void;
115
+ _writeSheetProperties(xmlBuf: StringBuf, properties: Partial<WorksheetProperties> | undefined, pageSetup: Partial<PageSetup> | undefined): void;
116
+ _writeSheetFormatProperties(xmlBuf: StringBuf, properties: Partial<WorksheetProperties> | undefined): void;
83
117
  _writeOpenWorksheet(): void;
84
118
  _writeColumns(): void;
85
119
  _writeOpenSheetData(): void;
@@ -481,22 +481,6 @@ export interface TableProperties {
481
481
  rows: any[][];
482
482
  }
483
483
  export type TableColumn = Required<TableColumnProperties>;
484
- export interface JSZipGeneratorOptions {
485
- compression: "STORE" | "DEFLATE";
486
- compressionOptions: null | {
487
- level: number;
488
- };
489
- }
490
- export interface XlsxReadOptions {
491
- ignoreNodes?: string[];
492
- maxRows?: number;
493
- maxCols?: number;
494
- }
495
- export interface XlsxWriteOptions {
496
- zip?: Partial<JSZipGeneratorOptions>;
497
- useSharedStrings?: boolean;
498
- useStyles?: boolean;
499
- }
500
484
  export interface Media {
501
485
  type: string;
502
486
  name: string;
@@ -509,6 +493,10 @@ export interface AddWorksheetOptions {
509
493
  headerFooter?: Partial<HeaderFooter>;
510
494
  views?: Array<Partial<WorksheetView>>;
511
495
  state?: WorksheetState;
496
+ /** Specifies whether to use shared strings. Overrides workbook setting. */
497
+ useSharedStrings?: boolean;
498
+ /** Apply an auto filter to the worksheet */
499
+ autoFilter?: AutoFilter;
512
500
  }
513
501
  export interface DefinedNamesRanges {
514
502
  name: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cj-tech-master/excelts",
3
- "version": "1.6.1",
3
+ "version": "1.6.2-canary.20251223042142.4d33ec6",
4
4
  "description": "TypeScript Excel Workbook Manager - Read and Write xlsx and csv Files.",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -110,7 +110,7 @@
110
110
  "@types/node": "^25.0.3",
111
111
  "@typescript-eslint/eslint-plugin": "^8.50.0",
112
112
  "@typescript-eslint/parser": "^8.50.0",
113
- "@typescript/native-preview": "^7.0.0-dev.20251217.1",
113
+ "@typescript/native-preview": "^7.0.0-dev.20251219.1",
114
114
  "@vitest/browser": "^4.0.16",
115
115
  "@vitest/browser-playwright": "^4.0.16",
116
116
  "@vitest/ui": "^4.0.16",
@@ -120,14 +120,14 @@
120
120
  "eslint-config-prettier": "^10.1.8",
121
121
  "eslint-import-resolver-typescript": "^4.4.4",
122
122
  "eslint-plugin-import-x": "^4.16.1",
123
- "eslint-plugin-oxlint": "^1.33.0",
123
+ "eslint-plugin-oxlint": "^1.34.0",
124
124
  "eslint-plugin-unused-imports": "^4.3.0",
125
125
  "express": "^5.2.1",
126
126
  "fast-xml-parser": "^5.3.3",
127
127
  "husky": "^9.1.7",
128
128
  "node-stdlib-browser": "^1.3.1",
129
129
  "nodemon": "^3.1.11",
130
- "oxlint": "^1.33.0",
130
+ "oxlint": "^1.34.0",
131
131
  "playwright": "^1.57.0",
132
132
  "prettier": "^3.7.4",
133
133
  "rimraf": "^6.1.2",
@@ -136,7 +136,7 @@
136
136
  "tslib": "^2.8.1",
137
137
  "typescript": "^5.9.3",
138
138
  "typescript-eslint": "^8.50.0",
139
- "vite-tsconfig-paths": "^6.0.2",
139
+ "vite-tsconfig-paths": "^6.0.3",
140
140
  "vitest": "^4.0.16"
141
141
  },
142
142
  "scripts": {