@niicojs/excel 0.2.4 → 0.2.5
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/LICENSE +20 -20
- package/README.md +8 -232
- package/dist/index.cjs +54 -421
- package/dist/index.d.cts +3 -116
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +3 -116
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +55 -418
- package/package.json +1 -1
- package/src/index.ts +1 -15
- package/src/pivot-cache.ts +30 -17
- package/src/pivot-table.ts +12 -122
- package/src/range.ts +2 -15
- package/src/styles.ts +1 -60
- package/src/types.ts +0 -23
- package/src/utils/address.ts +1 -4
- package/src/utils/xml.ts +7 -0
- package/src/workbook.ts +0 -18
- package/src/worksheet.ts +7 -235
package/dist/index.d.cts
CHANGED
|
@@ -13,10 +13,6 @@ type ErrorType = '#NULL!' | '#DIV/0!' | '#VALUE!' | '#REF!' | '#NAME?' | '#NUM!'
|
|
|
13
13
|
* Discriminator for cell content type
|
|
14
14
|
*/
|
|
15
15
|
type CellType = 'number' | 'string' | 'boolean' | 'date' | 'error' | 'empty';
|
|
16
|
-
/**
|
|
17
|
-
* Date handling strategy when serializing cell values.
|
|
18
|
-
*/
|
|
19
|
-
type DateHandling = 'jsDate' | 'excelSerial' | 'isoString';
|
|
20
16
|
/**
|
|
21
17
|
* Style definition for cells
|
|
22
18
|
*/
|
|
@@ -87,17 +83,6 @@ interface CellData {
|
|
|
87
83
|
* Pivot table aggregation functions
|
|
88
84
|
*/
|
|
89
85
|
type AggregationType = 'sum' | 'count' | 'average' | 'min' | 'max';
|
|
90
|
-
/**
|
|
91
|
-
* Sort order for pivot fields.
|
|
92
|
-
*/
|
|
93
|
-
type PivotSortOrder = 'asc' | 'desc';
|
|
94
|
-
/**
|
|
95
|
-
* Filter configuration for pivot fields.
|
|
96
|
-
*/
|
|
97
|
-
interface PivotFieldFilter {
|
|
98
|
-
include?: string[];
|
|
99
|
-
exclude?: string[];
|
|
100
|
-
}
|
|
101
86
|
/**
|
|
102
87
|
* Configuration for a value field in a pivot table
|
|
103
88
|
*/
|
|
@@ -215,10 +200,6 @@ interface SheetToJsonConfig {
|
|
|
215
200
|
* If true, stop reading when an empty row is encountered. Defaults to true.
|
|
216
201
|
*/
|
|
217
202
|
stopOnEmptyRow?: boolean;
|
|
218
|
-
/**
|
|
219
|
-
* How to serialize Date values. Defaults to 'jsDate'.
|
|
220
|
-
*/
|
|
221
|
-
dateHandling?: DateHandling;
|
|
222
203
|
}
|
|
223
204
|
|
|
224
205
|
/**
|
|
@@ -334,12 +315,6 @@ declare class Range {
|
|
|
334
315
|
* Get all values in the range as a 2D array
|
|
335
316
|
*/
|
|
336
317
|
get values(): CellValue[][];
|
|
337
|
-
/**
|
|
338
|
-
* Get all values in the range as a 2D array with options
|
|
339
|
-
*/
|
|
340
|
-
getValues(options?: {
|
|
341
|
-
createMissing?: boolean;
|
|
342
|
-
}): CellValue[][];
|
|
343
318
|
/**
|
|
344
319
|
* Set values in the range from a 2D array
|
|
345
320
|
*/
|
|
@@ -381,11 +356,6 @@ declare class Worksheet {
|
|
|
381
356
|
private _dirty;
|
|
382
357
|
private _mergedCells;
|
|
383
358
|
private _sheetData;
|
|
384
|
-
private _columnWidths;
|
|
385
|
-
private _rowHeights;
|
|
386
|
-
private _frozenPane;
|
|
387
|
-
private _dataBoundsCache;
|
|
388
|
-
private _boundsDirty;
|
|
389
359
|
constructor(workbook: Workbook, name: string);
|
|
390
360
|
/**
|
|
391
361
|
* Get the workbook this sheet belongs to
|
|
@@ -415,10 +385,6 @@ declare class Worksheet {
|
|
|
415
385
|
* Get a cell by address or row/col
|
|
416
386
|
*/
|
|
417
387
|
cell(rowOrAddress: number | string, col?: number): Cell;
|
|
418
|
-
/**
|
|
419
|
-
* Get an existing cell without creating it.
|
|
420
|
-
*/
|
|
421
|
-
getCellIfExists(rowOrAddress: number | string, col?: number): Cell | undefined;
|
|
422
388
|
/**
|
|
423
389
|
* Get a range of cells
|
|
424
390
|
*/
|
|
@@ -444,33 +410,6 @@ declare class Worksheet {
|
|
|
444
410
|
* Get all cells in the worksheet
|
|
445
411
|
*/
|
|
446
412
|
get cells(): Map<string, Cell>;
|
|
447
|
-
/**
|
|
448
|
-
* Set a column width (0-based index or column letter)
|
|
449
|
-
*/
|
|
450
|
-
setColumnWidth(col: number | string, width: number): void;
|
|
451
|
-
/**
|
|
452
|
-
* Get a column width if set
|
|
453
|
-
*/
|
|
454
|
-
getColumnWidth(col: number | string): number | undefined;
|
|
455
|
-
/**
|
|
456
|
-
* Set a row height (0-based index)
|
|
457
|
-
*/
|
|
458
|
-
setRowHeight(row: number, height: number): void;
|
|
459
|
-
/**
|
|
460
|
-
* Get a row height if set
|
|
461
|
-
*/
|
|
462
|
-
getRowHeight(row: number): number | undefined;
|
|
463
|
-
/**
|
|
464
|
-
* Freeze panes at a given row/column split (counts from top-left)
|
|
465
|
-
*/
|
|
466
|
-
freezePane(rowSplit: number, colSplit: number): void;
|
|
467
|
-
/**
|
|
468
|
-
* Get current frozen pane configuration
|
|
469
|
-
*/
|
|
470
|
-
getFrozenPane(): {
|
|
471
|
-
row: number;
|
|
472
|
-
col: number;
|
|
473
|
-
} | null;
|
|
474
413
|
/**
|
|
475
414
|
* Convert sheet data to an array of JSON objects.
|
|
476
415
|
*
|
|
@@ -490,7 +429,6 @@ declare class Worksheet {
|
|
|
490
429
|
* ```
|
|
491
430
|
*/
|
|
492
431
|
toJson<T = Record<string, CellValue>>(config?: SheetToJsonConfig): T[];
|
|
493
|
-
private _serializeDate;
|
|
494
432
|
/**
|
|
495
433
|
* Get the bounds of data in the sheet (min/max row and column with data)
|
|
496
434
|
*/
|
|
@@ -557,14 +495,6 @@ declare class Styles {
|
|
|
557
495
|
private _xmlNodes;
|
|
558
496
|
private _dirty;
|
|
559
497
|
private _styleCache;
|
|
560
|
-
private _styleObjectCache;
|
|
561
|
-
/**
|
|
562
|
-
* Generate a deterministic cache key for a style object.
|
|
563
|
-
* More efficient than JSON.stringify as it avoids the overhead of
|
|
564
|
-
* full JSON serialization and produces a consistent key regardless
|
|
565
|
-
* of property order.
|
|
566
|
-
*/
|
|
567
|
-
private _getStyleKey;
|
|
568
498
|
/**
|
|
569
499
|
* Parse styles from XML content
|
|
570
500
|
*/
|
|
@@ -587,10 +517,6 @@ declare class Styles {
|
|
|
587
517
|
* Uses caching to deduplicate identical styles
|
|
588
518
|
*/
|
|
589
519
|
createStyle(style: CellStyle): number;
|
|
590
|
-
/**
|
|
591
|
-
* Clone an existing style by index, optionally overriding fields.
|
|
592
|
-
*/
|
|
593
|
-
cloneStyle(index: number, overrides?: Partial<CellStyle>): number;
|
|
594
520
|
private _findOrCreateFont;
|
|
595
521
|
private _findOrCreateFill;
|
|
596
522
|
private _findOrCreateBorder;
|
|
@@ -621,7 +547,7 @@ declare class PivotCache {
|
|
|
621
547
|
private _records;
|
|
622
548
|
private _recordCount;
|
|
623
549
|
private _refreshOnLoad;
|
|
624
|
-
private
|
|
550
|
+
private _sharedItemsIndexMap;
|
|
625
551
|
constructor(cacheId: number, sourceSheet: string, sourceRange: string);
|
|
626
552
|
/**
|
|
627
553
|
* Get the cache ID
|
|
@@ -693,7 +619,6 @@ declare class PivotTable {
|
|
|
693
619
|
private _columnFields;
|
|
694
620
|
private _valueFields;
|
|
695
621
|
private _filterFields;
|
|
696
|
-
private _fieldAssignments;
|
|
697
622
|
private _pivotTableIndex;
|
|
698
623
|
constructor(name: string, cache: PivotCache, targetSheet: string, targetCell: string, targetRow: number, targetCol: number, pivotTableIndex: number);
|
|
699
624
|
/**
|
|
@@ -738,14 +663,6 @@ declare class PivotTable {
|
|
|
738
663
|
* @param fieldName - Name of the source field (column header)
|
|
739
664
|
*/
|
|
740
665
|
addFilterField(fieldName: string): this;
|
|
741
|
-
/**
|
|
742
|
-
* Set a sort order for a row/column field
|
|
743
|
-
*/
|
|
744
|
-
sortField(fieldName: string, order: PivotSortOrder): this;
|
|
745
|
-
/**
|
|
746
|
-
* Filter items for a field (include or exclude list)
|
|
747
|
-
*/
|
|
748
|
-
filterField(fieldName: string, filter: PivotFieldFilter): this;
|
|
749
666
|
/**
|
|
750
667
|
* Generate the pivotTableDefinition XML
|
|
751
668
|
*/
|
|
@@ -754,7 +671,6 @@ declare class PivotTable {
|
|
|
754
671
|
* Build a pivotField node for a given field index
|
|
755
672
|
*/
|
|
756
673
|
private _buildPivotFieldNode;
|
|
757
|
-
private _resolveItemFilter;
|
|
758
674
|
/**
|
|
759
675
|
* Build row items based on unique values in row fields
|
|
760
676
|
*/
|
|
@@ -795,7 +711,6 @@ declare class Workbook {
|
|
|
795
711
|
private _pivotTables;
|
|
796
712
|
private _pivotCaches;
|
|
797
713
|
private _nextCacheId;
|
|
798
|
-
private _dateHandling;
|
|
799
714
|
private constructor();
|
|
800
715
|
/**
|
|
801
716
|
* Load a workbook from a file path
|
|
@@ -825,14 +740,6 @@ declare class Workbook {
|
|
|
825
740
|
* Get styles
|
|
826
741
|
*/
|
|
827
742
|
get styles(): Styles;
|
|
828
|
-
/**
|
|
829
|
-
* Get the workbook date handling strategy.
|
|
830
|
-
*/
|
|
831
|
-
get dateHandling(): DateHandling;
|
|
832
|
-
/**
|
|
833
|
-
* Set the workbook date handling strategy.
|
|
834
|
-
*/
|
|
835
|
-
set dateHandling(value: DateHandling);
|
|
836
743
|
/**
|
|
837
744
|
* Get a worksheet by name or index
|
|
838
745
|
*/
|
|
@@ -959,18 +866,6 @@ declare class Workbook {
|
|
|
959
866
|
private _updatePivotTableFiles;
|
|
960
867
|
}
|
|
961
868
|
|
|
962
|
-
/**
|
|
963
|
-
* Converts a column index (0-based) to Excel column letters (A, B, ..., Z, AA, AB, ...)
|
|
964
|
-
* @param col - 0-based column index
|
|
965
|
-
* @returns Column letter(s)
|
|
966
|
-
*/
|
|
967
|
-
declare const colToLetter: (col: number) => string;
|
|
968
|
-
/**
|
|
969
|
-
* Converts Excel column letters to a 0-based column index
|
|
970
|
-
* @param letters - Column letter(s) like 'A', 'B', 'AA'
|
|
971
|
-
* @returns 0-based column index
|
|
972
|
-
*/
|
|
973
|
-
declare const letterToCol: (letters: string) => number;
|
|
974
869
|
/**
|
|
975
870
|
* Parses an Excel cell address (e.g., 'A1', '$B$2') to row/col indices
|
|
976
871
|
* @param address - Cell address string
|
|
@@ -996,15 +891,7 @@ declare const parseRange: (range: string) => RangeAddress;
|
|
|
996
891
|
* @returns Range string like 'A1:B10'
|
|
997
892
|
*/
|
|
998
893
|
declare const toRange: (range: RangeAddress) => string;
|
|
999
|
-
/**
|
|
1000
|
-
* Normalizes a range so start is always top-left and end is bottom-right
|
|
1001
|
-
*/
|
|
1002
|
-
declare const normalizeRange: (range: RangeAddress) => RangeAddress;
|
|
1003
|
-
/**
|
|
1004
|
-
* Checks if an address is within a range
|
|
1005
|
-
*/
|
|
1006
|
-
declare const isInRange: (addr: CellAddress, range: RangeAddress) => boolean;
|
|
1007
894
|
|
|
1008
|
-
export { Cell, PivotCache, PivotTable, Range, SharedStrings, Styles, Workbook, Worksheet,
|
|
1009
|
-
export type { AggregationType, Alignment, BorderStyle, BorderType, CellAddress, CellError, CellStyle, CellType, CellValue, ColumnConfig,
|
|
895
|
+
export { Cell, PivotCache, PivotTable, Range, SharedStrings, Styles, Workbook, Worksheet, parseAddress, parseRange, toAddress, toRange };
|
|
896
|
+
export type { AggregationType, Alignment, BorderStyle, BorderType, CellAddress, CellError, CellStyle, CellType, CellValue, ColumnConfig, ErrorType, PivotFieldAxis, PivotTableConfig, PivotValueConfig, RangeAddress, RichCellValue, SheetFromDataConfig, SheetToJsonConfig };
|
|
1010
897
|
//# sourceMappingURL=index.d.cts.map
|