@cj-tech-master/excelts 4.2.3-canary.20260115111903.b80904d → 4.2.3-canary.20260122073152.a9bb6b0
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.
- package/dist/browser/modules/csv/csv-core.d.ts +0 -9
- package/dist/browser/modules/csv/csv.browser.js +3 -3
- package/dist/browser/modules/excel/utils/passthrough-manager.d.ts +77 -0
- package/dist/browser/modules/excel/utils/passthrough-manager.js +129 -0
- package/dist/browser/modules/excel/workbook.d.ts +8 -0
- package/dist/browser/modules/excel/workbook.js +9 -1
- package/dist/browser/modules/excel/worksheet.d.ts +4 -0
- package/dist/browser/modules/excel/worksheet.js +4 -1
- package/dist/browser/modules/excel/xlsx/xform/core/content-types-xform.js +16 -10
- package/dist/browser/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.d.ts +34 -11
- package/dist/browser/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.js +256 -86
- package/dist/browser/modules/excel/xlsx/xform/sheet/worksheet-xform.js +38 -11
- package/dist/browser/modules/excel/xlsx/xlsx.browser.d.ts +36 -1
- package/dist/browser/modules/excel/xlsx/xlsx.browser.js +213 -131
- package/dist/cjs/modules/csv/csv.browser.js +3 -3
- package/dist/cjs/modules/excel/utils/passthrough-manager.js +133 -0
- package/dist/cjs/modules/excel/workbook.js +9 -1
- package/dist/cjs/modules/excel/worksheet.js +4 -1
- package/dist/cjs/modules/excel/xlsx/xform/core/content-types-xform.js +16 -10
- package/dist/cjs/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.js +256 -86
- package/dist/cjs/modules/excel/xlsx/xform/sheet/worksheet-xform.js +38 -11
- package/dist/cjs/modules/excel/xlsx/xlsx.browser.js +213 -131
- package/dist/esm/modules/csv/csv.browser.js +3 -3
- package/dist/esm/modules/excel/utils/passthrough-manager.js +129 -0
- package/dist/esm/modules/excel/workbook.js +9 -1
- package/dist/esm/modules/excel/worksheet.js +4 -1
- package/dist/esm/modules/excel/xlsx/xform/core/content-types-xform.js +16 -10
- package/dist/esm/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.js +256 -86
- package/dist/esm/modules/excel/xlsx/xform/sheet/worksheet-xform.js +38 -11
- package/dist/esm/modules/excel/xlsx/xlsx.browser.js +213 -131
- package/dist/iife/excelts.iife.js +512 -241
- package/dist/iife/excelts.iife.js.map +1 -1
- package/dist/iife/excelts.iife.min.js +24 -51
- package/dist/types/modules/csv/csv-core.d.ts +0 -9
- package/dist/types/modules/excel/utils/passthrough-manager.d.ts +77 -0
- package/dist/types/modules/excel/workbook.d.ts +8 -0
- package/dist/types/modules/excel/worksheet.d.ts +4 -0
- package/dist/types/modules/excel/xlsx/xform/pivot-table/pivot-table-xform.d.ts +34 -11
- package/dist/types/modules/excel/xlsx/xlsx.browser.d.ts +36 -1
- package/package.json +2 -2
|
@@ -58,15 +58,6 @@ export interface CsvParseOptions {
|
|
|
58
58
|
renameHeaders?: boolean;
|
|
59
59
|
/** Comment character - lines starting with this are ignored */
|
|
60
60
|
comment?: string;
|
|
61
|
-
/**
|
|
62
|
-
* Decimal separator used when parsing numbers from CSV (default: ".").
|
|
63
|
-
*
|
|
64
|
-
* Note: core CSV parsing returns strings; number conversion is handled by higher-level
|
|
65
|
-
* consumers (e.g. the default value mapper in the CSV module).
|
|
66
|
-
*
|
|
67
|
-
* @deprecated Use CsvReadOptions.valueMapperOptions.decimalSeparator instead.
|
|
68
|
-
*/
|
|
69
|
-
decimalSeparator?: "." | ",";
|
|
70
61
|
/** Maximum number of data rows to parse (excluding header) */
|
|
71
62
|
maxRows?: number;
|
|
72
63
|
/** Number of lines to skip at the beginning (before header detection) */
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PassthroughManager - Manages passthrough files for round-trip preservation
|
|
3
|
+
*
|
|
4
|
+
* This module handles files that are not fully parsed by the library but need to be
|
|
5
|
+
* preserved during read/write cycles (e.g., charts, sparklines, slicers).
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Content type entry for ZIP content types
|
|
9
|
+
*/
|
|
10
|
+
export interface PassthroughContentType {
|
|
11
|
+
partName: string;
|
|
12
|
+
contentType: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* ZIP writer interface for passthrough files
|
|
16
|
+
*/
|
|
17
|
+
export interface IPassthroughZipWriter {
|
|
18
|
+
append(data: Uint8Array, options: {
|
|
19
|
+
name: string;
|
|
20
|
+
}): void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* PassthroughManager handles storage and retrieval of passthrough files
|
|
24
|
+
* that need to be preserved during Excel read/write cycles.
|
|
25
|
+
*/
|
|
26
|
+
export declare class PassthroughManager {
|
|
27
|
+
private files;
|
|
28
|
+
/**
|
|
29
|
+
* Check if a path should be treated as passthrough
|
|
30
|
+
*/
|
|
31
|
+
static isPassthroughPath(path: string): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Get the content type for a passthrough file path
|
|
34
|
+
* @returns Content type string or undefined if unknown
|
|
35
|
+
*/
|
|
36
|
+
static getContentType(path: string): string | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Add a file to passthrough storage
|
|
39
|
+
*/
|
|
40
|
+
add(path: string, data: Uint8Array): void;
|
|
41
|
+
/**
|
|
42
|
+
* Get a file from passthrough storage
|
|
43
|
+
*/
|
|
44
|
+
get(path: string): Uint8Array | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Check if a file exists in passthrough storage
|
|
47
|
+
*/
|
|
48
|
+
has(path: string): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Get all stored paths
|
|
51
|
+
*/
|
|
52
|
+
getPaths(): string[];
|
|
53
|
+
/**
|
|
54
|
+
* Get all files as a record (for serialization)
|
|
55
|
+
*/
|
|
56
|
+
toRecord(): Record<string, Uint8Array>;
|
|
57
|
+
/**
|
|
58
|
+
* Load files from a record (for deserialization)
|
|
59
|
+
*/
|
|
60
|
+
fromRecord(record: Record<string, Uint8Array>): void;
|
|
61
|
+
/**
|
|
62
|
+
* Get content types for all stored files that have known types
|
|
63
|
+
*/
|
|
64
|
+
getContentTypes(): PassthroughContentType[];
|
|
65
|
+
/**
|
|
66
|
+
* Write all passthrough files to a ZIP writer
|
|
67
|
+
*/
|
|
68
|
+
writeToZip(zip: IPassthroughZipWriter): void;
|
|
69
|
+
/**
|
|
70
|
+
* Clear all stored files
|
|
71
|
+
*/
|
|
72
|
+
clear(): void;
|
|
73
|
+
/**
|
|
74
|
+
* Get the number of stored files
|
|
75
|
+
*/
|
|
76
|
+
get size(): number;
|
|
77
|
+
}
|
|
@@ -55,6 +55,10 @@ export interface WorkbookModel {
|
|
|
55
55
|
/** Loaded pivot tables from file - used during reconciliation */
|
|
56
56
|
loadedPivotTables?: any[];
|
|
57
57
|
calcProperties: Partial<CalculationProperties>;
|
|
58
|
+
/** Passthrough files (charts, etc.) preserved for round-trip */
|
|
59
|
+
passthrough?: Record<string, Uint8Array>;
|
|
60
|
+
/** Raw drawing XML data for passthrough (when drawing contains chart references) */
|
|
61
|
+
rawDrawings?: Record<string, Uint8Array>;
|
|
58
62
|
}
|
|
59
63
|
declare class Workbook {
|
|
60
64
|
/**
|
|
@@ -94,6 +98,10 @@ declare class Workbook {
|
|
|
94
98
|
private _worksheets;
|
|
95
99
|
private _definedNames;
|
|
96
100
|
private _themes?;
|
|
101
|
+
/** Passthrough files (charts, etc.) preserved for round-trip */
|
|
102
|
+
private _passthrough;
|
|
103
|
+
/** Raw drawing XML data for passthrough (when drawing contains chart references) */
|
|
104
|
+
private _rawDrawings;
|
|
97
105
|
private _xlsx?;
|
|
98
106
|
private _csv?;
|
|
99
107
|
constructor();
|
|
@@ -111,6 +111,8 @@ interface WorksheetModel {
|
|
|
111
111
|
dimensions?: Range;
|
|
112
112
|
merges?: string[];
|
|
113
113
|
mergeCells?: string[];
|
|
114
|
+
/** Loaded drawing data (for charts, etc.) - preserved for round-trip */
|
|
115
|
+
drawing?: any;
|
|
114
116
|
}
|
|
115
117
|
declare class Worksheet {
|
|
116
118
|
private _workbook;
|
|
@@ -139,6 +141,8 @@ declare class Worksheet {
|
|
|
139
141
|
conditionalFormattings: ConditionalFormattingOptions[];
|
|
140
142
|
formControls: FormCheckbox[];
|
|
141
143
|
private _headerRowCount?;
|
|
144
|
+
/** Loaded drawing data (for charts, etc.) - preserved for round-trip */
|
|
145
|
+
private _drawing;
|
|
142
146
|
constructor(options: WorksheetOptions);
|
|
143
147
|
get name(): string;
|
|
144
148
|
set name(name: string | undefined);
|
|
@@ -67,26 +67,45 @@ interface ParsedPivotTableModel {
|
|
|
67
67
|
compact?: boolean;
|
|
68
68
|
compactData?: boolean;
|
|
69
69
|
multipleFieldFilters?: boolean;
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
outline?: boolean;
|
|
71
|
+
outlineData?: boolean;
|
|
72
|
+
chartFormat?: number;
|
|
73
|
+
rowItems?: RowColItem[];
|
|
74
|
+
colItems?: RowColItem[];
|
|
75
|
+
chartFormats?: ChartFormatItem[];
|
|
72
76
|
isLoaded?: boolean;
|
|
73
77
|
extensions?: any[];
|
|
74
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* Row or column item in pivot table
|
|
81
|
+
*/
|
|
82
|
+
interface RowColItem {
|
|
83
|
+
t?: string;
|
|
84
|
+
x: Array<{
|
|
85
|
+
v: number;
|
|
86
|
+
}>;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Chart format item for pivot charts
|
|
90
|
+
*/
|
|
91
|
+
interface ChartFormatItem {
|
|
92
|
+
chart: number;
|
|
93
|
+
format: number;
|
|
94
|
+
series?: boolean;
|
|
95
|
+
pivotAreaXml?: string;
|
|
96
|
+
}
|
|
75
97
|
declare class PivotTableXform extends BaseXform {
|
|
76
98
|
map: {
|
|
77
99
|
[key: string]: any;
|
|
78
100
|
};
|
|
79
101
|
model: ParsedPivotTableModel | null;
|
|
80
|
-
private
|
|
81
|
-
private inRowFields;
|
|
82
|
-
private inColFields;
|
|
83
|
-
private inDataFields;
|
|
84
|
-
private inRowItems;
|
|
85
|
-
private inColItems;
|
|
86
|
-
private inLocation;
|
|
102
|
+
private state;
|
|
87
103
|
private currentPivotField;
|
|
88
|
-
private
|
|
89
|
-
private
|
|
104
|
+
private currentRowItem;
|
|
105
|
+
private currentColItem;
|
|
106
|
+
private currentChartFormat;
|
|
107
|
+
private pivotAreaXmlBuffer;
|
|
108
|
+
private pivotAreaDepth;
|
|
90
109
|
constructor();
|
|
91
110
|
prepare(_model: any): void;
|
|
92
111
|
get tag(): string;
|
|
@@ -104,6 +123,10 @@ declare class PivotTableXform extends BaseXform {
|
|
|
104
123
|
* Render loaded pivot table (preserving original structure)
|
|
105
124
|
*/
|
|
106
125
|
private renderLoaded;
|
|
126
|
+
/**
|
|
127
|
+
* Render a row or column item element
|
|
128
|
+
*/
|
|
129
|
+
private renderRowColItem;
|
|
107
130
|
/**
|
|
108
131
|
* Render a loaded pivot field
|
|
109
132
|
*/
|
|
@@ -144,6 +144,30 @@ declare class XLSX {
|
|
|
144
144
|
* This is the foundation for TRUE streaming reads on platforms that have a
|
|
145
145
|
* streaming ZIP parser (e.g. Node.js `modules/archive` Parse).
|
|
146
146
|
*/
|
|
147
|
+
/**
|
|
148
|
+
* Create an empty model for parsing XLSX files.
|
|
149
|
+
* Shared by loadFromZipEntries and loadFromFiles.
|
|
150
|
+
*/
|
|
151
|
+
private createEmptyModel;
|
|
152
|
+
/**
|
|
153
|
+
* Collect all data from a stream into a single Uint8Array.
|
|
154
|
+
* Reusable helper for passthrough and drawing processing.
|
|
155
|
+
*/
|
|
156
|
+
protected collectStreamData(stream: IParseStream): Promise<Uint8Array>;
|
|
157
|
+
/**
|
|
158
|
+
* Check if a drawing has chart references in its relationships
|
|
159
|
+
*/
|
|
160
|
+
private drawingHasChartReference;
|
|
161
|
+
/**
|
|
162
|
+
* Check if a drawing rels list references charts.
|
|
163
|
+
* Used to decide whether we need to keep raw drawing XML for passthrough.
|
|
164
|
+
*/
|
|
165
|
+
private drawingRelsHasChartReference;
|
|
166
|
+
/**
|
|
167
|
+
* Process a known OOXML entry (workbook, styles, shared strings, etc.)
|
|
168
|
+
* Returns true if handled, false if should be passed to _processDefaultEntry
|
|
169
|
+
*/
|
|
170
|
+
protected _processKnownEntry(stream: IParseStream, model: any, entryName: string, options?: XlsxOptions): Promise<boolean>;
|
|
147
171
|
protected loadFromZipEntries(entries: AsyncIterable<ZipEntryLike>, options?: XlsxOptions): Promise<any>;
|
|
148
172
|
/**
|
|
149
173
|
* Write workbook to buffer
|
|
@@ -189,8 +213,14 @@ declare class XLSX {
|
|
|
189
213
|
loadFromFiles(zipData: Record<string, Uint8Array>, options?: any): Promise<any>;
|
|
190
214
|
/**
|
|
191
215
|
* Process default entries (drawings, comments, tables, etc.)
|
|
216
|
+
* @param rawData Optional raw entry data for passthrough preservation (used by loadFromFiles)
|
|
192
217
|
*/
|
|
193
|
-
protected _processDefaultEntry(stream: IParseStream, model: any, entryName: string): Promise<boolean>;
|
|
218
|
+
protected _processDefaultEntry(stream: IParseStream, model: any, entryName: string, rawData?: Uint8Array): Promise<boolean>;
|
|
219
|
+
/**
|
|
220
|
+
* Store a passthrough file for preservation during read/write cycles.
|
|
221
|
+
* These files are not parsed but stored as raw bytes to be written back unchanged.
|
|
222
|
+
*/
|
|
223
|
+
_processPassthroughEntry(stream: IParseStream, model: any, entryName: string): Promise<void>;
|
|
194
224
|
addContentTypes(zip: IZipWriter, model: any): Promise<void>;
|
|
195
225
|
addApp(zip: IZipWriter, model: any): Promise<void>;
|
|
196
226
|
addCore(zip: IZipWriter, model: any): Promise<void>;
|
|
@@ -204,6 +234,11 @@ declare class XLSX {
|
|
|
204
234
|
addWorksheets(zip: IZipWriter, model: any): Promise<void>;
|
|
205
235
|
addDrawings(zip: IZipWriter, model: any): void;
|
|
206
236
|
addTables(zip: IZipWriter, model: any): void;
|
|
237
|
+
/**
|
|
238
|
+
* Write passthrough files (charts, etc.) that were preserved during read.
|
|
239
|
+
* These files are written back unchanged to preserve unsupported features.
|
|
240
|
+
*/
|
|
241
|
+
addPassthrough(zip: IZipWriter, model: any): void;
|
|
207
242
|
addPivotTables(zip: IZipWriter, model: any): void;
|
|
208
243
|
_finalize(zip: IZipWriter): Promise<this>;
|
|
209
244
|
prepareModel(model: any, options: any): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cj-tech-master/excelts",
|
|
3
|
-
"version": "4.2.3-canary.
|
|
3
|
+
"version": "4.2.3-canary.20260122073152.a9bb6b0",
|
|
4
4
|
"description": "TypeScript Excel Workbook Manager - Read and Write xlsx and csv Files.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
"scripts": {
|
|
121
121
|
"example": "node scripts/run-examples.ts",
|
|
122
122
|
"check": "concurrently --raw \"npm run type\" \"npm run lint\"",
|
|
123
|
-
"test": "vitest run && npm run test:browser",
|
|
123
|
+
"test": "vitest run && npm run test:browser --",
|
|
124
124
|
"test:browser": "rimraf dist && npm run build:browser:bundle && vitest run --config vitest.browser.config.ts",
|
|
125
125
|
"test:watch": "vitest",
|
|
126
126
|
"build": "rimraf dist && concurrently \"npm run build:esm\" \"npm run build:cjs\" \"npm run build:browser\" \"npm run build:browser:bundle\" && npm run build:verify",
|