@silurus/ooxml 0.56.0 → 0.58.0
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/README.md +24 -18
- package/dist/docx-BBTq20zc.js +1811 -0
- package/dist/docx.mjs +3 -3
- package/dist/index.mjs +3 -3
- package/dist/pptx-B6H-We19.js +1760 -0
- package/dist/pptx.mjs +2 -2
- package/dist/src-B06n2_Dm.js +29675 -0
- package/dist/types/docx.d.ts +89 -28
- package/dist/types/index.d.ts +816 -19
- package/dist/types/pptx.d.ts +465 -25
- package/dist/types/xlsx.d.ts +243 -38
- package/dist/xlsx-DWmV5sAA.js +3818 -0
- package/dist/xlsx.mjs +2 -2
- package/package.json +1 -1
- package/dist/docx-g-cBdnSQ.js +0 -1661
- package/dist/pptx-DkKGg5bQ.js +0 -23667
- package/dist/src-CFPOemuW.js +0 -6810
- package/dist/xlsx-Bx216pgL.js +0 -3483
package/dist/types/xlsx.d.ts
CHANGED
|
@@ -131,12 +131,12 @@ export declare interface CellXf {
|
|
|
131
131
|
readingOrder?: number;
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
declare interface CfIcon {
|
|
134
|
+
export declare interface CfIcon {
|
|
135
135
|
iconSet: string;
|
|
136
136
|
iconId: number;
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
declare type CfRule = {
|
|
139
|
+
export declare type CfRule = {
|
|
140
140
|
type: 'cellIs';
|
|
141
141
|
operator: string;
|
|
142
142
|
formulas: string[];
|
|
@@ -169,6 +169,8 @@ declare type CfRule = {
|
|
|
169
169
|
} | {
|
|
170
170
|
type: 'aboveAverage';
|
|
171
171
|
aboveAverage: boolean;
|
|
172
|
+
equalAverage?: boolean;
|
|
173
|
+
stdDev?: number;
|
|
172
174
|
dxfId: number | null;
|
|
173
175
|
priority: number;
|
|
174
176
|
} | {
|
|
@@ -184,18 +186,18 @@ declare type CfRule = {
|
|
|
184
186
|
priority: number;
|
|
185
187
|
};
|
|
186
188
|
|
|
187
|
-
declare interface CfStop {
|
|
189
|
+
export declare interface CfStop {
|
|
188
190
|
kind: string;
|
|
189
191
|
value: string | null;
|
|
190
192
|
color: string;
|
|
191
193
|
}
|
|
192
194
|
|
|
193
|
-
declare interface CfValue {
|
|
195
|
+
export declare interface CfValue {
|
|
194
196
|
kind: string;
|
|
195
197
|
value: string | null;
|
|
196
198
|
}
|
|
197
199
|
|
|
198
|
-
declare interface ChartAnchor {
|
|
200
|
+
export declare interface ChartAnchor {
|
|
199
201
|
fromCol: number;
|
|
200
202
|
fromColOff: number;
|
|
201
203
|
fromRow: number;
|
|
@@ -212,7 +214,7 @@ declare interface ChartAnchor {
|
|
|
212
214
|
* which the renderer combines into a canonical `ChartModel.chartType` (e.g.
|
|
213
215
|
* `clusteredBarH`, `stackedBarPct`) at render time.
|
|
214
216
|
*/
|
|
215
|
-
declare interface ChartData {
|
|
217
|
+
export declare interface ChartData {
|
|
216
218
|
/** Primary chart type: "bar"|"line"|"area"|"pie"|"doughnut"|"radar"|"scatter" */
|
|
217
219
|
chartType: string;
|
|
218
220
|
/** "col" (vertical bars) | "row" (horizontal bars) */
|
|
@@ -321,12 +323,12 @@ declare interface ChartData {
|
|
|
321
323
|
plotAreaManualLayout?: ManualLayout;
|
|
322
324
|
}
|
|
323
325
|
|
|
324
|
-
declare interface ConditionalFormat {
|
|
326
|
+
export declare interface ConditionalFormat {
|
|
325
327
|
sqref: CellRange_2[];
|
|
326
328
|
rules: CfRule[];
|
|
327
329
|
}
|
|
328
330
|
|
|
329
|
-
declare interface DataLabelOverride {
|
|
331
|
+
export declare interface DataLabelOverride {
|
|
330
332
|
idx: number;
|
|
331
333
|
text: string;
|
|
332
334
|
/** "l"|"r"|"t"|"b"|"ctr"|"outEnd"|"bestFit" or undefined → inherit. */
|
|
@@ -336,7 +338,7 @@ declare interface DataLabelOverride {
|
|
|
336
338
|
fontBold?: boolean;
|
|
337
339
|
}
|
|
338
340
|
|
|
339
|
-
declare interface DataPointOverride {
|
|
341
|
+
export declare interface DataPointOverride {
|
|
340
342
|
idx: number;
|
|
341
343
|
color?: string;
|
|
342
344
|
markerSymbol?: string;
|
|
@@ -345,12 +347,34 @@ declare interface DataPointOverride {
|
|
|
345
347
|
markerLine?: string;
|
|
346
348
|
}
|
|
347
349
|
|
|
348
|
-
|
|
350
|
+
/** One `<dataValidation>` rule (ECMA-376 §18.3.1.33). `type` is the constraint
|
|
351
|
+
* class (`list` | `whole` | `decimal` | `date` | `time` | `textLength` |
|
|
352
|
+
* `custom`); `operator` qualifies it (`between` | `notBetween` | `equal` | …).
|
|
353
|
+
* `formula1` / `formula2` are the operands (for `list`, `formula1` is the
|
|
354
|
+
* comma-separated literal list or a range/named reference). 1:1 with the Rust
|
|
355
|
+
* `DataValidation` (serde camelCase). */
|
|
356
|
+
export declare interface DataValidation {
|
|
357
|
+
/** Affected cell ranges, verbatim from `@sqref` (space-separated A1 refs). */
|
|
358
|
+
sqref: string;
|
|
359
|
+
/** Constraint class. Absent means the spec default (`none`, no constraint). */
|
|
360
|
+
validationType?: string;
|
|
361
|
+
operator?: string;
|
|
362
|
+
formula1?: string;
|
|
363
|
+
formula2?: string;
|
|
364
|
+
/** `@allowBlank` — empty input is permitted. */
|
|
365
|
+
allowBlank?: boolean;
|
|
366
|
+
promptTitle?: string;
|
|
367
|
+
prompt?: string;
|
|
368
|
+
errorTitle?: string;
|
|
369
|
+
errorMessage?: string;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
export declare interface DefinedName {
|
|
349
373
|
name: string;
|
|
350
374
|
formula: string;
|
|
351
375
|
}
|
|
352
376
|
|
|
353
|
-
declare interface Dxf {
|
|
377
|
+
export declare interface Dxf {
|
|
354
378
|
font: CellFont | null;
|
|
355
379
|
fill: CellFill | null;
|
|
356
380
|
border: Border | null;
|
|
@@ -361,7 +385,7 @@ declare interface Dxf {
|
|
|
361
385
|
numFmt?: NumFmt | null;
|
|
362
386
|
}
|
|
363
387
|
|
|
364
|
-
declare interface ErrBars {
|
|
388
|
+
export declare interface ErrBars {
|
|
365
389
|
/** "x" | "y". */
|
|
366
390
|
dir: string;
|
|
367
391
|
/** "plus" | "minus" | "both". */
|
|
@@ -375,7 +399,7 @@ declare interface ErrBars {
|
|
|
375
399
|
dash?: string;
|
|
376
400
|
}
|
|
377
401
|
|
|
378
|
-
declare interface GradientFillSpec {
|
|
402
|
+
export declare interface GradientFillSpec {
|
|
379
403
|
/** "linear" (default) or "path". */
|
|
380
404
|
gradientType: string;
|
|
381
405
|
/** Rotation in degrees for linear gradients (0 = left→right). */
|
|
@@ -391,7 +415,7 @@ declare interface GradientFillSpec {
|
|
|
391
415
|
}[];
|
|
392
416
|
}
|
|
393
417
|
|
|
394
|
-
declare interface Hyperlink {
|
|
418
|
+
export declare interface Hyperlink {
|
|
395
419
|
col: number;
|
|
396
420
|
row: number;
|
|
397
421
|
url: string | null;
|
|
@@ -401,7 +425,7 @@ declare interface Hyperlink {
|
|
|
401
425
|
* Image anchored to a rectangle of cells (EMU offsets within the anchor cells).
|
|
402
426
|
* 914400 EMU = 1 inch, 9525 EMU = 1 px @ 96 DPI.
|
|
403
427
|
*/
|
|
404
|
-
declare interface ImageAnchor {
|
|
428
|
+
export declare interface ImageAnchor {
|
|
405
429
|
fromCol: number;
|
|
406
430
|
fromColOff: number;
|
|
407
431
|
fromRow: number;
|
|
@@ -423,7 +447,7 @@ declare interface ImageAnchor {
|
|
|
423
447
|
dataUrl: string;
|
|
424
448
|
}
|
|
425
449
|
|
|
426
|
-
declare interface LegendManualLayout {
|
|
450
|
+
export declare interface LegendManualLayout {
|
|
427
451
|
xMode: string;
|
|
428
452
|
yMode: string;
|
|
429
453
|
x: number;
|
|
@@ -476,7 +500,7 @@ declare interface LoadOptions_2 {
|
|
|
476
500
|
math?: MathRenderer;
|
|
477
501
|
}
|
|
478
502
|
|
|
479
|
-
declare interface ManualLayout {
|
|
503
|
+
export declare interface ManualLayout {
|
|
480
504
|
xMode: string;
|
|
481
505
|
yMode: string;
|
|
482
506
|
layoutTarget?: string;
|
|
@@ -637,7 +661,7 @@ export declare interface ParsedWorkbook {
|
|
|
637
661
|
sharedStrings: SharedString[];
|
|
638
662
|
}
|
|
639
663
|
|
|
640
|
-
declare type PathCmd = {
|
|
664
|
+
export declare type PathCmd = {
|
|
641
665
|
op: 'moveTo';
|
|
642
666
|
x: number;
|
|
643
667
|
y: number;
|
|
@@ -672,7 +696,7 @@ declare type PathCmd = {
|
|
|
672
696
|
op: 'close';
|
|
673
697
|
};
|
|
674
698
|
|
|
675
|
-
declare interface PathInfo {
|
|
699
|
+
export declare interface PathInfo {
|
|
676
700
|
w: number;
|
|
677
701
|
h: number;
|
|
678
702
|
commands: PathCmd[];
|
|
@@ -710,18 +734,32 @@ export declare interface RenderViewportOptions {
|
|
|
710
734
|
} | null;
|
|
711
735
|
}
|
|
712
736
|
|
|
737
|
+
/**
|
|
738
|
+
* Resolved allowed-value set for a list validation. Either concrete display
|
|
739
|
+
* `values` (inline list or expanded range), or — when the operand is a defined
|
|
740
|
+
* name / complex formula we cannot expand — the raw `formula` text so the panel
|
|
741
|
+
* can disclose it instead of showing nothing.
|
|
742
|
+
*/
|
|
743
|
+
export declare type ResolvedList = {
|
|
744
|
+
kind: 'values';
|
|
745
|
+
values: string[];
|
|
746
|
+
} | {
|
|
747
|
+
kind: 'formula';
|
|
748
|
+
formula: string;
|
|
749
|
+
};
|
|
750
|
+
|
|
713
751
|
export declare interface Row {
|
|
714
752
|
index: number;
|
|
715
753
|
height: number | null;
|
|
716
754
|
cells: Cell[];
|
|
717
755
|
}
|
|
718
756
|
|
|
719
|
-
declare interface Run {
|
|
757
|
+
export declare interface Run {
|
|
720
758
|
text: string;
|
|
721
759
|
font?: RunFont;
|
|
722
760
|
}
|
|
723
761
|
|
|
724
|
-
declare interface RunFont {
|
|
762
|
+
export declare interface RunFont {
|
|
725
763
|
bold: boolean;
|
|
726
764
|
italic: boolean;
|
|
727
765
|
underline: boolean;
|
|
@@ -745,7 +783,7 @@ declare interface RunFont {
|
|
|
745
783
|
declare type SelectionMode_2 = 'cells' | 'rows' | 'cols' | 'all';
|
|
746
784
|
export { SelectionMode_2 as SelectionMode }
|
|
747
785
|
|
|
748
|
-
declare interface SeriesDataLabels {
|
|
786
|
+
export declare interface SeriesDataLabels {
|
|
749
787
|
showVal: boolean;
|
|
750
788
|
showCatName: boolean;
|
|
751
789
|
showSerName: boolean;
|
|
@@ -757,7 +795,7 @@ declare interface SeriesDataLabels {
|
|
|
757
795
|
fontSizeHpt?: number;
|
|
758
796
|
}
|
|
759
797
|
|
|
760
|
-
declare interface ShapeAnchor {
|
|
798
|
+
export declare interface ShapeAnchor {
|
|
761
799
|
fromCol: number;
|
|
762
800
|
fromColOff: number;
|
|
763
801
|
fromRow: number;
|
|
@@ -778,9 +816,14 @@ declare interface ShapeAnchor {
|
|
|
778
816
|
shapes: ShapeInfo[];
|
|
779
817
|
}
|
|
780
818
|
|
|
781
|
-
declare type ShapeGeom = {
|
|
819
|
+
export declare type ShapeGeom = {
|
|
782
820
|
type: 'preset';
|
|
783
821
|
name: string;
|
|
822
|
+
/** Adjust handles from `<a:avLst><a:gd>` in `adj1..adj8` order
|
|
823
|
+
* (ECMA-376 §19.5.31.3 / §20.1.9.5). `null` entries mean "use the
|
|
824
|
+
* preset's declared default". Omitted entirely when the shape has no
|
|
825
|
+
* `<a:avLst>`. Consumed by the shared `renderPresetShape` engine. */
|
|
826
|
+
adj?: (number | null)[];
|
|
784
827
|
} | {
|
|
785
828
|
type: 'custom';
|
|
786
829
|
paths: PathInfo[];
|
|
@@ -793,7 +836,7 @@ declare type ShapeGeom = {
|
|
|
793
836
|
dataUrl: string;
|
|
794
837
|
};
|
|
795
838
|
|
|
796
|
-
declare interface ShapeInfo {
|
|
839
|
+
export declare interface ShapeInfo {
|
|
797
840
|
/** Normalized [0,1] position/size relative to the anchor rect. */
|
|
798
841
|
x: number;
|
|
799
842
|
y: number;
|
|
@@ -811,7 +854,7 @@ declare interface ShapeInfo {
|
|
|
811
854
|
text?: ShapeText;
|
|
812
855
|
}
|
|
813
856
|
|
|
814
|
-
declare interface ShapeParagraph {
|
|
857
|
+
export declare interface ShapeParagraph {
|
|
815
858
|
/** `<a:pPr@algn>` — `l` (default) | `ctr` | `r` | `just` | `dist`. */
|
|
816
859
|
align: string;
|
|
817
860
|
/** `<a:pPr@rtl>` — whether the paragraph reads right-to-left
|
|
@@ -820,7 +863,7 @@ declare interface ShapeParagraph {
|
|
|
820
863
|
runs: ShapeTextRun[];
|
|
821
864
|
}
|
|
822
865
|
|
|
823
|
-
declare interface ShapeText {
|
|
866
|
+
export declare interface ShapeText {
|
|
824
867
|
/** `<a:bodyPr@anchor>` — vertical alignment of the text block within the
|
|
825
868
|
* shape rect. `t` (top, default), `ctr` (middle), `b` (bottom). */
|
|
826
869
|
anchor: string;
|
|
@@ -833,7 +876,7 @@ declare interface ShapeText {
|
|
|
833
876
|
* (matches the pptx `TextRun` shape): styled text, a soft line break, or an
|
|
834
877
|
* OMML equation. Excel stores "Insert > Equation" as OMML inside the shared
|
|
835
878
|
* DrawingML `<xdr:txBody>` grammar (ECMA-376 §22.1), like PowerPoint. */
|
|
836
|
-
declare type ShapeTextRun = {
|
|
879
|
+
export declare type ShapeTextRun = {
|
|
837
880
|
type: 'text';
|
|
838
881
|
text: string;
|
|
839
882
|
bold: boolean;
|
|
@@ -856,7 +899,7 @@ declare type ShapeTextRun = {
|
|
|
856
899
|
color?: string;
|
|
857
900
|
};
|
|
858
901
|
|
|
859
|
-
declare interface SharedString {
|
|
902
|
+
export declare interface SharedString {
|
|
860
903
|
text: string;
|
|
861
904
|
runs?: Run[];
|
|
862
905
|
}
|
|
@@ -871,7 +914,7 @@ export declare interface SheetMeta {
|
|
|
871
914
|
tabColor?: string | null;
|
|
872
915
|
}
|
|
873
916
|
|
|
874
|
-
declare interface SlicerAnchor {
|
|
917
|
+
export declare interface SlicerAnchor {
|
|
875
918
|
fromCol: number;
|
|
876
919
|
fromColOff: number;
|
|
877
920
|
fromRow: number;
|
|
@@ -884,12 +927,12 @@ declare interface SlicerAnchor {
|
|
|
884
927
|
items: SlicerItem[];
|
|
885
928
|
}
|
|
886
929
|
|
|
887
|
-
declare interface SlicerItem {
|
|
930
|
+
export declare interface SlicerItem {
|
|
888
931
|
name: string;
|
|
889
932
|
selected: boolean;
|
|
890
933
|
}
|
|
891
934
|
|
|
892
|
-
declare interface Sparkline {
|
|
935
|
+
export declare interface Sparkline {
|
|
893
936
|
/** 1-based row of the destination cell (`<xm:sqref>`). */
|
|
894
937
|
row: number;
|
|
895
938
|
/** 1-based column of the destination cell. */
|
|
@@ -899,7 +942,7 @@ declare interface Sparkline {
|
|
|
899
942
|
values: (number | null)[];
|
|
900
943
|
}
|
|
901
944
|
|
|
902
|
-
declare interface SparklineGroup {
|
|
945
|
+
export declare interface SparklineGroup {
|
|
903
946
|
/** `line` (default) | `column` | `stem` (win-loss). */
|
|
904
947
|
kind: 'line' | 'column' | 'stem';
|
|
905
948
|
markers: boolean;
|
|
@@ -942,7 +985,7 @@ export declare interface Styles {
|
|
|
942
985
|
|
|
943
986
|
/** Per-column DXF references inside a `<table>` element
|
|
944
987
|
* (ECMA-376 §18.5.1.3 `tableColumn`). */
|
|
945
|
-
declare interface TableColumnInfo {
|
|
988
|
+
export declare interface TableColumnInfo {
|
|
946
989
|
/** `<tableColumn dataDxfId>` — applied to data cells in this column. */
|
|
947
990
|
dataDxfId?: number;
|
|
948
991
|
/** `<tableColumn headerRowDxfId>` — applied to the header cell of this column. */
|
|
@@ -951,7 +994,7 @@ declare interface TableColumnInfo {
|
|
|
951
994
|
totalsRowDxfId?: number;
|
|
952
995
|
}
|
|
953
996
|
|
|
954
|
-
declare interface TableInfo {
|
|
997
|
+
export declare interface TableInfo {
|
|
955
998
|
range: CellRange_2;
|
|
956
999
|
styleName: string;
|
|
957
1000
|
headerRowCount: number;
|
|
@@ -963,13 +1006,29 @@ declare interface TableInfo {
|
|
|
963
1006
|
/** Accent color resolved by the parser from the built-in style name against
|
|
964
1007
|
* the file's theme accents (e.g. `TableStyleLight18` → accent3). */
|
|
965
1008
|
accentColor: string;
|
|
1009
|
+
/** `true` when `styleName` is defined in the file's `<tableStyles>` block,
|
|
1010
|
+
* i.e. a *custom* style (ECMA-376 §18.5.1.2). The renderer draws such tables
|
|
1011
|
+
* strictly from their declared element dxfs and must NOT apply the accent
|
|
1012
|
+
* approximation (banding / synthesized rules / header) reserved for built-in
|
|
1013
|
+
* style names whose definitions are absent from the file. */
|
|
1014
|
+
isCustom?: boolean;
|
|
966
1015
|
/** Dxf index for the `wholeTable` element of a custom `<tableStyle>`
|
|
967
|
-
* (ECMA-376 §18.8.
|
|
1016
|
+
* (ECMA-376 §18.8.83). When set, its border/fill apply to every cell of
|
|
968
1017
|
* the table as a base layer. Undefined for built-in style names. */
|
|
969
1018
|
wholeTableDxf?: number;
|
|
970
1019
|
/** Dxf index for the `headerRow` element of a custom `<tableStyle>` —
|
|
971
1020
|
* provides header background, font color/weight, and vertical separators. */
|
|
972
1021
|
headerRowDxf?: number;
|
|
1022
|
+
/** Dxf index for the `totalRow` element (ECMA-376 §18.18.93). */
|
|
1023
|
+
totalRowDxf?: number;
|
|
1024
|
+
/** Dxf index for the `firstColumn` element. */
|
|
1025
|
+
firstColumnDxf?: number;
|
|
1026
|
+
/** Dxf index for the `lastColumn` element. */
|
|
1027
|
+
lastColumnDxf?: number;
|
|
1028
|
+
/** Dxf index for `firstRowStripe` (band1 horizontal) — odd banded-row stripe. */
|
|
1029
|
+
band1HorizontalDxf?: number;
|
|
1030
|
+
/** Dxf index for `secondRowStripe` (band2 horizontal) — even banded-row stripe. */
|
|
1031
|
+
band2HorizontalDxf?: number;
|
|
973
1032
|
/** Per-column DXF references (ECMA-376 §18.5.1.3 `tableColumn`). Index by
|
|
974
1033
|
* `cellCol - range.left`. The renderer can use these to apply column-level
|
|
975
1034
|
* overlays for named-style tables; for files where Excel pre-bakes the
|
|
@@ -1025,6 +1084,17 @@ export declare interface Worksheet {
|
|
|
1025
1084
|
/** A1-style cell refs of commented cells (ECMA-376 §18.7.3). Rendered as a
|
|
1026
1085
|
* small red triangle in each cell's top-right corner. */
|
|
1027
1086
|
commentRefs?: string[];
|
|
1087
|
+
/** Full-fidelity comment bodies (cell ref + author + plain text) for every
|
|
1088
|
+
* `<comment>` in `xl/commentsN.xml` (ECMA-376 §18.7). Parallel to
|
|
1089
|
+
* {@link commentRefs} (one entry per ref). Consume this to read the note
|
|
1090
|
+
* text; the renderer uses {@link commentRefs} for the red indicator and the
|
|
1091
|
+
* viewer surfaces these bodies in an Excel-style hover popup. */
|
|
1092
|
+
comments?: XlsxComment[];
|
|
1093
|
+
/** Data-validation rules on this sheet (ECMA-376 §18.3.1.32–33). Exposed for
|
|
1094
|
+
* tooling. The viewer draws a list-dropdown arrow on the active cell when the
|
|
1095
|
+
* selection intersects a `list`-type rule's `sqref` (display only — opening
|
|
1096
|
+
* the list / picking a value is out of scope for a viewer). */
|
|
1097
|
+
dataValidations?: DataValidation[];
|
|
1028
1098
|
/** Defined names in scope for this sheet (ECMA-376 §18.2.5). Used by
|
|
1029
1099
|
* conditional-formatting `expression` rules that call named ranges
|
|
1030
1100
|
* (e.g. `task_start`, `today`). */
|
|
@@ -1054,7 +1124,7 @@ export declare interface Worksheet {
|
|
|
1054
1124
|
* XLSX parser's raw chart series (includes XLSX-only `seriesType` for mixed
|
|
1055
1125
|
* charts). Adapted to `ChartSeries` from @silurus/ooxml-core before rendering.
|
|
1056
1126
|
*/
|
|
1057
|
-
declare interface XlsxChartSeries {
|
|
1127
|
+
export declare interface XlsxChartSeries {
|
|
1058
1128
|
name: string;
|
|
1059
1129
|
/** Chart sub-type for this series (allows mixed charts). */
|
|
1060
1130
|
seriesType: string;
|
|
@@ -1097,6 +1167,24 @@ declare interface XlsxChartSeries {
|
|
|
1097
1167
|
errBars?: ErrBars[];
|
|
1098
1168
|
}
|
|
1099
1169
|
|
|
1170
|
+
/** One cell comment. Sourced from the classic notes file `xl/commentsN.xml`
|
|
1171
|
+
* (ECMA-376 §18.7) when present, otherwise from the Office-365 threaded
|
|
1172
|
+
* comments part `xl/threadedComments/` (MS-XLSX schema
|
|
1173
|
+
* `…/spreadsheetml/2018/threadedcomments`, `personId` resolved via
|
|
1174
|
+
* `xl/persons/`). `text` is the joined plain text — every `<r><t>` run for
|
|
1175
|
+
* classic notes, every reply in the thread (newline-joined) for threaded
|
|
1176
|
+
* comments; rich-text formatting is dropped. 1:1 with the Rust `XlsxComment`
|
|
1177
|
+
* (serde camelCase). */
|
|
1178
|
+
export declare interface XlsxComment {
|
|
1179
|
+
/** A1-style cell reference (`@ref` on the comment element). */
|
|
1180
|
+
cellRef: string;
|
|
1181
|
+
/** Resolved author name — the `<authors>` entry (classic) or the `<person>`
|
|
1182
|
+
* `displayName` (threaded). Absent when unresolved. */
|
|
1183
|
+
author?: string;
|
|
1184
|
+
/** Concatenated plain text of every run / threaded reply. */
|
|
1185
|
+
text: string;
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1100
1188
|
/** Emitted once per cell that has text, with the cell's canvas-pixel bounds. */
|
|
1101
1189
|
export declare interface XlsxTextRunInfo {
|
|
1102
1190
|
text: string;
|
|
@@ -1132,6 +1220,17 @@ export declare class XlsxViewer {
|
|
|
1132
1220
|
private currentWorksheet;
|
|
1133
1221
|
private opts;
|
|
1134
1222
|
private resizeObserver;
|
|
1223
|
+
/**
|
|
1224
|
+
* Start-anchored horizontal scroll position (the {@link effectiveScrollLeft}
|
|
1225
|
+
* value last produced by a real user scroll or a programmatic reset), kept
|
|
1226
|
+
* as the source of truth across container size changes. The native
|
|
1227
|
+
* `scrollLeft` cannot serve that role for RTL sheets (ECMA-376 §18.3.1.87):
|
|
1228
|
+
* it is the *inverse* of the start-anchored offset, and the browser clamps
|
|
1229
|
+
* any assignment to 0 while the host is unlaid-out (`display:none` mount —
|
|
1230
|
+
* e.g. a host revealed only after `load()` resolves), which would otherwise
|
|
1231
|
+
* strand the view at the sheet's far end once the host gains its real size.
|
|
1232
|
+
*/
|
|
1233
|
+
private effectiveH;
|
|
1135
1234
|
private anchorCell;
|
|
1136
1235
|
private activeCell;
|
|
1137
1236
|
private selectionMode;
|
|
@@ -1139,6 +1238,32 @@ export declare class XlsxViewer {
|
|
|
1139
1238
|
private selectionOverlay;
|
|
1140
1239
|
private keydownHandler;
|
|
1141
1240
|
private pendingTap;
|
|
1241
|
+
/** DOM overlay element that shows the hovered cell's comment. Lives in
|
|
1242
|
+
* canvasArea above the scrollHost; `pointer-events:none` so it never blocks
|
|
1243
|
+
* cell interaction. */
|
|
1244
|
+
private commentPopup;
|
|
1245
|
+
/** `"row:col"` → comment for the current sheet, rebuilt on every showSheet. */
|
|
1246
|
+
private commentMap;
|
|
1247
|
+
/** `"row:col"` of the cell whose popup is currently shown (or pending), so a
|
|
1248
|
+
* pointermove within the same cell doesn't restart the show timer. */
|
|
1249
|
+
private commentPopupKey;
|
|
1250
|
+
/** Pending show timer (see {@link COMMENT_POPUP_DELAY_MS}). */
|
|
1251
|
+
private commentPopupTimer;
|
|
1252
|
+
/** DOM overlay listing a list-validated cell's allowed values. Lives in
|
|
1253
|
+
* canvasArea above the scrollHost; unlike the comment popup this is a click
|
|
1254
|
+
* target (`pointer-events:auto`). Read-only: hovering an item highlights it
|
|
1255
|
+
* but selecting does NOT change the cell. */
|
|
1256
|
+
private validationPanel;
|
|
1257
|
+
/** `"row:col"` of the cell whose panel is currently open, or null. Lets a
|
|
1258
|
+
* re-click on the same arrow toggle the panel closed. */
|
|
1259
|
+
private validationPanelKey;
|
|
1260
|
+
/** Screen rect (canvasArea CSS px) of the dropdown arrow button last drawn by
|
|
1261
|
+
* {@link maybeDrawValidationDropdown}, so pointerdown can hit-test it. Null
|
|
1262
|
+
* when no arrow is currently visible. */
|
|
1263
|
+
private validationArrowRect;
|
|
1264
|
+
/** Document-level pointerdown listener that closes the panel on an outside
|
|
1265
|
+
* click; installed only while the panel is open. */
|
|
1266
|
+
private validationOutsideHandler;
|
|
1142
1267
|
constructor(container: HTMLElement, opts?: XlsxViewerOptions);
|
|
1143
1268
|
/**
|
|
1144
1269
|
* Load an XLSX from URL or ArrayBuffer and render the first sheet.
|
|
@@ -1185,6 +1310,11 @@ export declare class XlsxViewer {
|
|
|
1185
1310
|
/** Park the scrollbar at the sheet's natural start: scrollLeft=0 for LTR,
|
|
1186
1311
|
* the right end for RTL (so col A shows first). */
|
|
1187
1312
|
private resetHorizontalScroll;
|
|
1313
|
+
/** Re-derive the native scrollLeft from the tracked start-anchored
|
|
1314
|
+
* position after the scroll host's size changes. Only RTL needs this:
|
|
1315
|
+
* for LTR the native scrollLeft *is* start-anchored and the browser
|
|
1316
|
+
* already clamps it sensibly on resize. */
|
|
1317
|
+
private reanchorHorizontalScroll;
|
|
1188
1318
|
/** 0-based index of the currently displayed sheet. */
|
|
1189
1319
|
get sheetIndex(): number;
|
|
1190
1320
|
/** Total number of sheets in the loaded workbook. */
|
|
@@ -1208,6 +1338,14 @@ export declare class XlsxViewer {
|
|
|
1208
1338
|
private getCellRect;
|
|
1209
1339
|
/** Returns the current selection, including mode. */
|
|
1210
1340
|
get selection(): CellRange | null;
|
|
1341
|
+
/**
|
|
1342
|
+
* Programmatically select a single cell by A1 reference (e.g. `"B2"`), as if
|
|
1343
|
+
* the user had clicked it: updates the active/anchor cell, redraws the
|
|
1344
|
+
* selection overlay (including any list-validation dropdown arrow), and fires
|
|
1345
|
+
* `onSelectionChange`. A no-op for malformed refs. Closes any open validation
|
|
1346
|
+
* panel, matching the click path.
|
|
1347
|
+
*/
|
|
1348
|
+
select(ref: string): void;
|
|
1211
1349
|
/**
|
|
1212
1350
|
* Returns what the header area contains at the given client coordinates.
|
|
1213
1351
|
* Returns null when the point is in the cell grid (not a header).
|
|
@@ -1216,6 +1354,49 @@ export declare class XlsxViewer {
|
|
|
1216
1354
|
/** Copy the selected cell range as tab-separated text to the clipboard. */
|
|
1217
1355
|
private copySelection;
|
|
1218
1356
|
private updateSelectionOverlay;
|
|
1357
|
+
/** Draw the Excel list-validation dropdown button just outside the
|
|
1358
|
+
* bottom-right corner of the *active* cell when that cell is covered by a
|
|
1359
|
+
* `list` data-validation rule. Anchored to the single active cell (not the
|
|
1360
|
+
* whole range) to mirror Excel, which attaches the button to the active
|
|
1361
|
+
* cell of the selection. */
|
|
1362
|
+
private maybeDrawValidationDropdown;
|
|
1363
|
+
/** Toggle the dropdown panel for the active cell's list validation. Called
|
|
1364
|
+
* from pointerdown when the arrow rect is hit. Re-clicking the same arrow
|
|
1365
|
+
* closes it. */
|
|
1366
|
+
private toggleValidationPanel;
|
|
1367
|
+
/** Resolve the allowed values for `formula1` (relative to the current sheet)
|
|
1368
|
+
* and render them in the panel anchored below the active cell. Async because
|
|
1369
|
+
* cross-sheet range references may need a lazily-parsed worksheet. */
|
|
1370
|
+
private openValidationPanel;
|
|
1371
|
+
/** Build the panel's children. Uses textContent throughout (no HTML injection
|
|
1372
|
+
* from cell values). Items highlight on hover but are NOT selectable —
|
|
1373
|
+
* this is a read-only viewer, so clicking a value must not change the cell. */
|
|
1374
|
+
private renderValidationPanel;
|
|
1375
|
+
/** Position the (already-populated, visible-or-becoming-visible) panel below
|
|
1376
|
+
* the dropdown arrow / active cell using the pure geometry calculator. */
|
|
1377
|
+
private positionValidationPanel;
|
|
1378
|
+
/** Install a document-level pointerdown listener that closes the panel on a
|
|
1379
|
+
* click outside it (and outside the arrow, which toggles via its own path).
|
|
1380
|
+
* Removed by {@link hideValidationPanel}. */
|
|
1381
|
+
private installValidationOutsideHandler;
|
|
1382
|
+
/** Hide the panel and detach its outside-click listener. Called on re-click,
|
|
1383
|
+
* outside click, Esc, scroll, selection change, sheet switch and destroy. */
|
|
1384
|
+
private hideValidationPanel;
|
|
1385
|
+
/** Build the `"row:col"` → comment index for the given sheet. Parses each
|
|
1386
|
+
* `XlsxComment.cellRef` with the shared {@link parseA1}; later refs win on a
|
|
1387
|
+
* collision (Excel allows at most one note per cell, so this is moot in
|
|
1388
|
+
* practice). */
|
|
1389
|
+
private buildCommentMap;
|
|
1390
|
+
/** Show the popup for the comment on `cell` after the hover dwell, anchored to
|
|
1391
|
+
* the cell's current on-screen rect. No-op when the cell carries no comment.
|
|
1392
|
+
* Re-hovering the same cell does not restart the timer. */
|
|
1393
|
+
private scheduleCommentPopup;
|
|
1394
|
+
/** Immediately render the popup for `comment` anchored to `cell` (used by the
|
|
1395
|
+
* hover-dwell timer and by touch selection, which has no hover). */
|
|
1396
|
+
private renderCommentPopup;
|
|
1397
|
+
/** Hide the popup and cancel any pending show. Called on cell-out, scroll,
|
|
1398
|
+
* sheet switch and destroy. */
|
|
1399
|
+
private hideCommentPopup;
|
|
1219
1400
|
private applyPointerSelection;
|
|
1220
1401
|
private setupSelectionEvents;
|
|
1221
1402
|
private buildTabs;
|
|
@@ -1258,7 +1439,15 @@ export declare interface XlsxViewerOptions {
|
|
|
1258
1439
|
zoomMin?: number;
|
|
1259
1440
|
zoomMax?: number;
|
|
1260
1441
|
onReady?: (sheetNames: string[]) => void;
|
|
1261
|
-
|
|
1442
|
+
/**
|
|
1443
|
+
* Called when the active sheet changes, with the new sheet's zero-based
|
|
1444
|
+
* `index` and the `total` number of sheets in the workbook. This mirrors the
|
|
1445
|
+
* docx `onPageChange` and pptx `onSlideChange` contracts so all three viewers
|
|
1446
|
+
* share one callback shape. To get the sheet *name*, look it up by index from
|
|
1447
|
+
* `viewer.sheetNames[index]` (or the `sheetNames` array delivered to
|
|
1448
|
+
* `onReady`).
|
|
1449
|
+
*/
|
|
1450
|
+
onSheetChange?: (index: number, total: number) => void;
|
|
1262
1451
|
onError?: (err: Error) => void;
|
|
1263
1452
|
/** Called when the selected cell range changes. null means no selection. */
|
|
1264
1453
|
onSelectionChange?: (selection: CellRange | null) => void;
|
|
@@ -1309,6 +1498,22 @@ export declare class XlsxWorkbook {
|
|
|
1309
1498
|
* `null` for sheets that declare no tab color. */
|
|
1310
1499
|
get tabColors(): (string | null)[];
|
|
1311
1500
|
getWorksheet(sheetIndex: number): Promise<Worksheet>;
|
|
1501
|
+
/**
|
|
1502
|
+
* Resolve a `list`-type data-validation `formula1` (ECMA-376 §18.3.1.32) into
|
|
1503
|
+
* the set of allowed values to display, evaluated relative to `sheetIndex`
|
|
1504
|
+
* (the sheet that owns the validation, used to resolve unqualified ranges):
|
|
1505
|
+
*
|
|
1506
|
+
* - Inline quoted list `"A,B,C"` → the literal values.
|
|
1507
|
+
* - Range ref `$B$2:$B$5` → each non-empty cell's *display
|
|
1508
|
+
* string* (the same formatted text the grid shows, via {@link formatCellValue}),
|
|
1509
|
+
* walked row-major. `Sheet2!$A$1:$A$9` resolves against the named sheet
|
|
1510
|
+
* (lazily parsed via {@link getWorksheet}, hence async).
|
|
1511
|
+
* - Named range / complex formula → `{ kind: 'formula' }` carrying the
|
|
1512
|
+
* raw text so the caller can disclose it rather than blanking it.
|
|
1513
|
+
*
|
|
1514
|
+
* Read-only: this only reads cell values for display; it never writes.
|
|
1515
|
+
*/
|
|
1516
|
+
resolveValidationList(sheetIndex: number, formula1: string | undefined): Promise<ResolvedList>;
|
|
1312
1517
|
renderViewport(target: HTMLCanvasElement | OffscreenCanvas, sheetIndex: number, viewport: ViewportRange, opts?: RenderViewportOptions): Promise<void>;
|
|
1313
1518
|
destroy(): void;
|
|
1314
1519
|
}
|