@extend-ai/react-xlsx 0.11.0 → 0.12.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 +50 -2
- package/dist/duke_sheets_wasm_bg.wasm +0 -0
- package/dist/index.cjs +303 -96
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +240 -2
- package/dist/index.d.ts +240 -2
- package/dist/index.js +303 -96
- package/dist/index.js.map +1 -1
- package/dist/xlsx-worker.js +1 -1
- package/dist/xlsx-worker.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -127,6 +127,160 @@ interface XlsxCellRange {
|
|
|
127
127
|
end: XlsxCellAddress;
|
|
128
128
|
start: XlsxCellAddress;
|
|
129
129
|
}
|
|
130
|
+
/**
|
|
131
|
+
* Color value accepted by persisted workbook style mutation APIs.
|
|
132
|
+
*
|
|
133
|
+
* Use `rgb` with a six-character `hex` value such as `"2563EB"` for the
|
|
134
|
+
* simplest browser-to-Excel mapping. `argb`, `theme`, and `indexed` are
|
|
135
|
+
* available for callers that need to preserve Excel-native color references.
|
|
136
|
+
*/
|
|
137
|
+
interface XlsxCellStyleColorInput {
|
|
138
|
+
/** Excel color representation to write. Defaults are handled by the workbook engine. */
|
|
139
|
+
colorType?: "auto" | "rgb" | "argb" | "theme" | "indexed";
|
|
140
|
+
/** Hex color string, for example `"2563EB"` for RGB or `"FF2563EB"` for ARGB. */
|
|
141
|
+
hex?: string;
|
|
142
|
+
/** Red channel, 0-255. */
|
|
143
|
+
r?: number;
|
|
144
|
+
/** Green channel, 0-255. */
|
|
145
|
+
g?: number;
|
|
146
|
+
/** Blue channel, 0-255. */
|
|
147
|
+
b?: number;
|
|
148
|
+
/** Alpha channel, 0-255, used by ARGB colors. */
|
|
149
|
+
a?: number;
|
|
150
|
+
/** Theme color index for Excel theme colors. */
|
|
151
|
+
themeIndex?: number;
|
|
152
|
+
/** Theme tint/shade adjustment. */
|
|
153
|
+
tint?: number;
|
|
154
|
+
/** Indexed color palette entry. */
|
|
155
|
+
paletteIndex?: number;
|
|
156
|
+
}
|
|
157
|
+
/** Font styling to persist on a cell or range. */
|
|
158
|
+
interface XlsxCellFontStyleInput {
|
|
159
|
+
/** Font face name, such as `"Aptos"` or `"Calibri"`. */
|
|
160
|
+
name?: string;
|
|
161
|
+
/** Font size in points. */
|
|
162
|
+
size?: number;
|
|
163
|
+
/** Whether the font is bold. */
|
|
164
|
+
bold?: boolean;
|
|
165
|
+
/** Whether the font is italic. */
|
|
166
|
+
italic?: boolean;
|
|
167
|
+
/** Underline style. */
|
|
168
|
+
underline?: "none" | "single" | "double" | "singleAccounting" | "doubleAccounting";
|
|
169
|
+
/** Whether the font is struck through. */
|
|
170
|
+
strikethrough?: boolean;
|
|
171
|
+
/** Font color. */
|
|
172
|
+
color?: XlsxCellStyleColorInput;
|
|
173
|
+
/** Baseline, superscript, or subscript positioning. */
|
|
174
|
+
verticalAlign?: "baseline" | "superscript" | "subscript";
|
|
175
|
+
/** Excel font family classification. */
|
|
176
|
+
family?: number;
|
|
177
|
+
/** Font charset identifier. */
|
|
178
|
+
charset?: number;
|
|
179
|
+
/** Excel font scheme value. */
|
|
180
|
+
scheme?: string;
|
|
181
|
+
}
|
|
182
|
+
/** A color stop used by gradient fills. */
|
|
183
|
+
interface XlsxCellGradientStopInput {
|
|
184
|
+
/** Stop position from 0 to 1. */
|
|
185
|
+
position: number;
|
|
186
|
+
/** Stop color. */
|
|
187
|
+
color: XlsxCellStyleColorInput;
|
|
188
|
+
}
|
|
189
|
+
/** Fill styling to persist on a cell or range. */
|
|
190
|
+
interface XlsxCellFillStyleInput {
|
|
191
|
+
/** Fill type. Use `"solid"` with `color` for typical Excel fill color. */
|
|
192
|
+
fillType?: "none" | "solid" | "pattern" | "gradient";
|
|
193
|
+
/** Primary fill color. */
|
|
194
|
+
color?: XlsxCellStyleColorInput;
|
|
195
|
+
/** Excel pattern name for pattern fills. */
|
|
196
|
+
pattern?: string;
|
|
197
|
+
/** Foreground color for pattern fills. */
|
|
198
|
+
foreground?: XlsxCellStyleColorInput;
|
|
199
|
+
/** Background color for pattern fills. */
|
|
200
|
+
background?: XlsxCellStyleColorInput;
|
|
201
|
+
/** Gradient type for gradient fills. */
|
|
202
|
+
gradientType?: "linear" | "path";
|
|
203
|
+
/** Gradient angle in degrees. */
|
|
204
|
+
angle?: number;
|
|
205
|
+
/** Gradient color stops. */
|
|
206
|
+
stops?: XlsxCellGradientStopInput[];
|
|
207
|
+
}
|
|
208
|
+
/** A single border edge style. */
|
|
209
|
+
interface XlsxCellBorderEdgeInput {
|
|
210
|
+
/** Excel border line style. */
|
|
211
|
+
style?: "none" | "thin" | "medium" | "thick" | "dashed" | "dotted" | "double" | "hair" | "mediumDashed" | "dashDot" | "mediumDashDot" | "dashDotDot" | "mediumDashDotDot" | "slantDashDot";
|
|
212
|
+
/** Border line color. */
|
|
213
|
+
color?: XlsxCellStyleColorInput;
|
|
214
|
+
}
|
|
215
|
+
/** Border styling to persist on a cell or range. */
|
|
216
|
+
interface XlsxCellBorderStyleInput {
|
|
217
|
+
/** Left border edge. */
|
|
218
|
+
left?: XlsxCellBorderEdgeInput;
|
|
219
|
+
/** Right border edge. */
|
|
220
|
+
right?: XlsxCellBorderEdgeInput;
|
|
221
|
+
/** Top border edge. */
|
|
222
|
+
top?: XlsxCellBorderEdgeInput;
|
|
223
|
+
/** Bottom border edge. */
|
|
224
|
+
bottom?: XlsxCellBorderEdgeInput;
|
|
225
|
+
/** Diagonal border edge. */
|
|
226
|
+
diagonal?: XlsxCellBorderEdgeInput;
|
|
227
|
+
/** Diagonal border direction. */
|
|
228
|
+
diagonalDirection?: "none" | "down" | "up" | "both";
|
|
229
|
+
}
|
|
230
|
+
/** Alignment styling to persist on a cell or range. */
|
|
231
|
+
interface XlsxCellAlignmentInput {
|
|
232
|
+
/** Horizontal alignment. */
|
|
233
|
+
horizontal?: "general" | "left" | "center" | "right" | "fill" | "justify" | "centerContinuous" | "distributed";
|
|
234
|
+
/** Vertical alignment. */
|
|
235
|
+
vertical?: "top" | "center" | "bottom" | "justify" | "distributed";
|
|
236
|
+
/** Whether text wraps inside the cell. */
|
|
237
|
+
wrapText?: boolean;
|
|
238
|
+
/** Whether text shrinks to fit the cell. */
|
|
239
|
+
shrinkToFit?: boolean;
|
|
240
|
+
/** Indentation level. */
|
|
241
|
+
indent?: number;
|
|
242
|
+
/** Text rotation in degrees. */
|
|
243
|
+
rotation?: number;
|
|
244
|
+
/** Text reading order. */
|
|
245
|
+
readingOrder?: "contextDependent" | "leftToRight" | "rightToLeft";
|
|
246
|
+
}
|
|
247
|
+
/** Number format styling to persist on a cell or range. */
|
|
248
|
+
interface XlsxCellNumberFormatInput {
|
|
249
|
+
/** Number format source. Use `"custom"` with `formatString` for custom Excel formats. */
|
|
250
|
+
formatType?: "general" | "builtin" | "custom";
|
|
251
|
+
/** Built-in Excel number format id. */
|
|
252
|
+
id?: number;
|
|
253
|
+
/** Excel number format string, for example `"$#,##0.00"` or `"m/d/yyyy"`. */
|
|
254
|
+
formatString?: string;
|
|
255
|
+
}
|
|
256
|
+
/** Protection flags to persist on a cell or range. */
|
|
257
|
+
interface XlsxCellProtectionInput {
|
|
258
|
+
/** Whether the cell is locked when sheet protection is enabled. */
|
|
259
|
+
locked?: boolean;
|
|
260
|
+
/** Whether the cell formula is hidden when sheet protection is enabled. */
|
|
261
|
+
hidden?: boolean;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Persisted Excel cell style patch.
|
|
265
|
+
*
|
|
266
|
+
* Passing a partial style updates the supplied style groups on the target cell
|
|
267
|
+
* or range. Unlike the `getCellStyle` render override prop, this mutates the
|
|
268
|
+
* workbook and is included in exported XLSX bytes.
|
|
269
|
+
*/
|
|
270
|
+
interface XlsxCellStyleInput {
|
|
271
|
+
/** Font formatting such as bold, italic, size, family, and font color. */
|
|
272
|
+
font?: XlsxCellFontStyleInput;
|
|
273
|
+
/** Cell fill formatting such as background color or gradient fill. */
|
|
274
|
+
fill?: XlsxCellFillStyleInput;
|
|
275
|
+
/** Border formatting for cell edges. */
|
|
276
|
+
border?: XlsxCellBorderStyleInput;
|
|
277
|
+
/** Alignment, wrapping, indentation, rotation, and reading order. */
|
|
278
|
+
alignment?: XlsxCellAlignmentInput;
|
|
279
|
+
/** Excel number/date/currency/percent format metadata. */
|
|
280
|
+
numberFormat?: XlsxCellNumberFormatInput;
|
|
281
|
+
/** Cell protection flags. */
|
|
282
|
+
protection?: XlsxCellProtectionInput;
|
|
283
|
+
}
|
|
130
284
|
interface XlsxSparkline {
|
|
131
285
|
color?: string;
|
|
132
286
|
firstColor?: string;
|
|
@@ -545,7 +699,6 @@ interface XlsxScrollerRenderProps {
|
|
|
545
699
|
children: React.ReactNode;
|
|
546
700
|
/** Props that must be applied to the actual scrollable viewport element. */
|
|
547
701
|
viewportProps: React.HTMLAttributes<HTMLDivElement> & {
|
|
548
|
-
key: React.Key;
|
|
549
702
|
ref: React.Ref<HTMLDivElement>;
|
|
550
703
|
style: React.CSSProperties;
|
|
551
704
|
tabIndex: number;
|
|
@@ -709,8 +862,48 @@ interface XlsxViewerController {
|
|
|
709
862
|
selectedRangeAddress: string | null;
|
|
710
863
|
selectedValue: string;
|
|
711
864
|
selectedFormula: string;
|
|
865
|
+
/**
|
|
866
|
+
* Sets the formula for a cell in the active worksheet.
|
|
867
|
+
*
|
|
868
|
+
* Pass an A1-style formula body or formula string, for example `"SUM(A1:A3)"`
|
|
869
|
+
* or `"=SUM(A1:A3)"`. The mutation is recorded in undo history and is included
|
|
870
|
+
* in exported workbook bytes.
|
|
871
|
+
*
|
|
872
|
+
* @param cell Zero-based row and column address in the active worksheet.
|
|
873
|
+
* @param formula Formula text to write. Pass an empty string to clear the formula.
|
|
874
|
+
*/
|
|
712
875
|
setCellFormula: (cell: XlsxCellAddress, formula: string) => void;
|
|
876
|
+
/**
|
|
877
|
+
* Applies persisted Excel style properties to a cell in the active worksheet.
|
|
878
|
+
*
|
|
879
|
+
* This mutates workbook data, records undo history, refreshes the viewer, and
|
|
880
|
+
* is included in exported XLSX bytes. Use the `getCellStyle` viewer prop only
|
|
881
|
+
* for render-time CSS overrides that should not modify the workbook.
|
|
882
|
+
*
|
|
883
|
+
* @param cell Zero-based row and column address in the active worksheet.
|
|
884
|
+
* @param style Partial Excel style patch to apply to the target cell.
|
|
885
|
+
*/
|
|
886
|
+
setCellStyle: (cell: XlsxCellAddress, style: XlsxCellStyleInput) => void;
|
|
887
|
+
/**
|
|
888
|
+
* Sets the value for a cell in the active worksheet.
|
|
889
|
+
*
|
|
890
|
+
* User-entered strings are coerced to booleans or numbers when they match
|
|
891
|
+
* Excel-like input. Prefix text with an apostrophe to force literal text.
|
|
892
|
+
*
|
|
893
|
+
* @param cell Zero-based row and column address in the active worksheet.
|
|
894
|
+
* @param value Text entered by the user.
|
|
895
|
+
*/
|
|
713
896
|
setCellValue: (cell: XlsxCellAddress, value: string) => void;
|
|
897
|
+
/**
|
|
898
|
+
* Applies persisted Excel style properties to every cell in a range.
|
|
899
|
+
*
|
|
900
|
+
* This mutates workbook data, records undo history, refreshes the viewer, and
|
|
901
|
+
* is included in exported XLSX bytes.
|
|
902
|
+
*
|
|
903
|
+
* @param range Zero-based cell range in the active worksheet.
|
|
904
|
+
* @param style Partial Excel style patch to apply to the target range.
|
|
905
|
+
*/
|
|
906
|
+
setRangeStyle: (range: XlsxCellRange, style: XlsxCellStyleInput) => void;
|
|
714
907
|
setZoomScale: (zoomScale: number) => void;
|
|
715
908
|
selectCell: (cell: XlsxCellAddress, options?: {
|
|
716
909
|
extend?: boolean;
|
|
@@ -725,6 +918,16 @@ interface XlsxViewerController {
|
|
|
725
918
|
selectedImage: XlsxImage | null;
|
|
726
919
|
selectedImageId: string | null;
|
|
727
920
|
setSelectedCellFormula: (formula: string) => void;
|
|
921
|
+
/**
|
|
922
|
+
* Applies persisted Excel style properties to the active cell.
|
|
923
|
+
*
|
|
924
|
+
* No-ops when there is no active cell, when editing is disabled, or when no
|
|
925
|
+
* workbook is loaded. The mutation is recorded in undo history and is included
|
|
926
|
+
* in exported XLSX bytes.
|
|
927
|
+
*
|
|
928
|
+
* @param style Partial Excel style patch to apply to the active cell.
|
|
929
|
+
*/
|
|
930
|
+
setSelectedCellStyle: (style: XlsxCellStyleInput) => void;
|
|
728
931
|
setSelectedCellValue: (value: string) => void;
|
|
729
932
|
sheets: XlsxSheetData[];
|
|
730
933
|
src?: string;
|
|
@@ -789,9 +992,44 @@ interface XlsxViewerEditing {
|
|
|
789
992
|
redo: () => void;
|
|
790
993
|
selectedFormula: string;
|
|
791
994
|
selectedValue: string;
|
|
995
|
+
/**
|
|
996
|
+
* Sets the formula for a cell in the active worksheet.
|
|
997
|
+
*
|
|
998
|
+
* @param cell Zero-based row and column address in the active worksheet.
|
|
999
|
+
* @param formula Formula text to write. Pass an empty string to clear the formula.
|
|
1000
|
+
*/
|
|
792
1001
|
setCellFormula: (cell: XlsxCellAddress, formula: string) => void;
|
|
1002
|
+
/**
|
|
1003
|
+
* Applies persisted Excel style properties to a cell in the active worksheet.
|
|
1004
|
+
*
|
|
1005
|
+
* The mutation is recorded in undo history and is included in exported XLSX
|
|
1006
|
+
* bytes. This is different from the `getCellStyle` render override prop.
|
|
1007
|
+
*
|
|
1008
|
+
* @param cell Zero-based row and column address in the active worksheet.
|
|
1009
|
+
* @param style Partial Excel style patch to apply to the target cell.
|
|
1010
|
+
*/
|
|
1011
|
+
setCellStyle: (cell: XlsxCellAddress, style: XlsxCellStyleInput) => void;
|
|
1012
|
+
/**
|
|
1013
|
+
* Sets the value for a cell in the active worksheet.
|
|
1014
|
+
*
|
|
1015
|
+
* @param cell Zero-based row and column address in the active worksheet.
|
|
1016
|
+
* @param value Text entered by the user.
|
|
1017
|
+
*/
|
|
793
1018
|
setCellValue: (cell: XlsxCellAddress, value: string) => void;
|
|
1019
|
+
/**
|
|
1020
|
+
* Applies persisted Excel style properties to every cell in a range.
|
|
1021
|
+
*
|
|
1022
|
+
* @param range Zero-based cell range in the active worksheet.
|
|
1023
|
+
* @param style Partial Excel style patch to apply to the target range.
|
|
1024
|
+
*/
|
|
1025
|
+
setRangeStyle: (range: XlsxCellRange, style: XlsxCellStyleInput) => void;
|
|
794
1026
|
setSelectedCellFormula: (formula: string) => void;
|
|
1027
|
+
/**
|
|
1028
|
+
* Applies persisted Excel style properties to the active cell.
|
|
1029
|
+
*
|
|
1030
|
+
* @param style Partial Excel style patch to apply to the active cell.
|
|
1031
|
+
*/
|
|
1032
|
+
setSelectedCellStyle: (style: XlsxCellStyleInput) => void;
|
|
795
1033
|
setSelectedCellValue: (value: string) => void;
|
|
796
1034
|
undo: () => void;
|
|
797
1035
|
unmergeSelection: () => void;
|
|
@@ -1136,4 +1374,4 @@ declare function useXlsxViewerThumbnails(options?: UseXlsxViewerThumbnailsOption
|
|
|
1136
1374
|
declare function XlsxViewer(props: XlsxViewerProps): react_jsx_runtime.JSX.Element;
|
|
1137
1375
|
declare function DefaultXlsxToolbar(): react_jsx_runtime.JSX.Element;
|
|
1138
1376
|
|
|
1139
|
-
export { DefaultXlsxToolbar, type UseXlsxViewerControllerOptions, type UseXlsxViewerThumbnailsOptions, type XlsxCellAddress, type XlsxCellRange, type XlsxCellStyleContext, type XlsxChart, type XlsxChartAxis, type XlsxChartDataLabels, type XlsxChartLoadingRenderProps, type XlsxChartReference, type XlsxChartSeries, type XlsxChartsheet, XlsxFileSizeLimitExceededError, type XlsxFileTooLargeRenderProps, type XlsxImage, type XlsxImageAnchor, type XlsxImageRect, type XlsxImageRenderProps, type XlsxImageResizeHandlePosition, type XlsxImageSelectionRenderProps, type XlsxScrollerRenderProps, type XlsxShape, type XlsxShapeFill, type XlsxShapeParagraph, type XlsxShapeStroke, type XlsxShapeTextBox, type XlsxShapeTextRun, type XlsxSheetData, type XlsxSheetThumbnail, type XlsxSheetThumbnailResolution, type XlsxSheetVisibility, type XlsxTable, type XlsxTableColumn, type XlsxTableHeaderMenuRenderProps, type XlsxTableSortDirection, type XlsxTableSortState, type XlsxThemePalette, XlsxViewer, type XlsxViewerCharts, type XlsxViewerController, type XlsxViewerEditing, type XlsxViewerImages, type XlsxViewerProps, XlsxViewerProvider, type XlsxViewerProviderProps, type XlsxViewerSelection, type XlsxViewerTables, type XlsxViewerThumbnails, type XlsxViewerZoom, type XlsxWasmSource, type XlsxWorkbookTab, initWasm, setWasmSource, useXlsxViewer, useXlsxViewerCharts, useXlsxViewerController, useXlsxViewerEditing, useXlsxViewerImages, useXlsxViewerSelection, useXlsxViewerTables, useXlsxViewerThumbnails, useXlsxViewerZoom };
|
|
1377
|
+
export { DefaultXlsxToolbar, type UseXlsxViewerControllerOptions, type UseXlsxViewerThumbnailsOptions, type XlsxCellAddress, type XlsxCellAlignmentInput, type XlsxCellBorderEdgeInput, type XlsxCellBorderStyleInput, type XlsxCellFillStyleInput, type XlsxCellFontStyleInput, type XlsxCellGradientStopInput, type XlsxCellNumberFormatInput, type XlsxCellProtectionInput, type XlsxCellRange, type XlsxCellStyleColorInput, type XlsxCellStyleContext, type XlsxCellStyleInput, type XlsxChart, type XlsxChartAxis, type XlsxChartDataLabels, type XlsxChartLoadingRenderProps, type XlsxChartReference, type XlsxChartSeries, type XlsxChartsheet, XlsxFileSizeLimitExceededError, type XlsxFileTooLargeRenderProps, type XlsxImage, type XlsxImageAnchor, type XlsxImageRect, type XlsxImageRenderProps, type XlsxImageResizeHandlePosition, type XlsxImageSelectionRenderProps, type XlsxScrollerRenderProps, type XlsxShape, type XlsxShapeFill, type XlsxShapeParagraph, type XlsxShapeStroke, type XlsxShapeTextBox, type XlsxShapeTextRun, type XlsxSheetData, type XlsxSheetThumbnail, type XlsxSheetThumbnailResolution, type XlsxSheetVisibility, type XlsxTable, type XlsxTableColumn, type XlsxTableHeaderMenuRenderProps, type XlsxTableSortDirection, type XlsxTableSortState, type XlsxThemePalette, XlsxViewer, type XlsxViewerCharts, type XlsxViewerController, type XlsxViewerEditing, type XlsxViewerImages, type XlsxViewerProps, XlsxViewerProvider, type XlsxViewerProviderProps, type XlsxViewerSelection, type XlsxViewerTables, type XlsxViewerThumbnails, type XlsxViewerZoom, type XlsxWasmSource, type XlsxWorkbookTab, initWasm, setWasmSource, useXlsxViewer, useXlsxViewerCharts, useXlsxViewerController, useXlsxViewerEditing, useXlsxViewerImages, useXlsxViewerSelection, useXlsxViewerTables, useXlsxViewerThumbnails, useXlsxViewerZoom };
|
package/dist/index.d.ts
CHANGED
|
@@ -127,6 +127,160 @@ interface XlsxCellRange {
|
|
|
127
127
|
end: XlsxCellAddress;
|
|
128
128
|
start: XlsxCellAddress;
|
|
129
129
|
}
|
|
130
|
+
/**
|
|
131
|
+
* Color value accepted by persisted workbook style mutation APIs.
|
|
132
|
+
*
|
|
133
|
+
* Use `rgb` with a six-character `hex` value such as `"2563EB"` for the
|
|
134
|
+
* simplest browser-to-Excel mapping. `argb`, `theme`, and `indexed` are
|
|
135
|
+
* available for callers that need to preserve Excel-native color references.
|
|
136
|
+
*/
|
|
137
|
+
interface XlsxCellStyleColorInput {
|
|
138
|
+
/** Excel color representation to write. Defaults are handled by the workbook engine. */
|
|
139
|
+
colorType?: "auto" | "rgb" | "argb" | "theme" | "indexed";
|
|
140
|
+
/** Hex color string, for example `"2563EB"` for RGB or `"FF2563EB"` for ARGB. */
|
|
141
|
+
hex?: string;
|
|
142
|
+
/** Red channel, 0-255. */
|
|
143
|
+
r?: number;
|
|
144
|
+
/** Green channel, 0-255. */
|
|
145
|
+
g?: number;
|
|
146
|
+
/** Blue channel, 0-255. */
|
|
147
|
+
b?: number;
|
|
148
|
+
/** Alpha channel, 0-255, used by ARGB colors. */
|
|
149
|
+
a?: number;
|
|
150
|
+
/** Theme color index for Excel theme colors. */
|
|
151
|
+
themeIndex?: number;
|
|
152
|
+
/** Theme tint/shade adjustment. */
|
|
153
|
+
tint?: number;
|
|
154
|
+
/** Indexed color palette entry. */
|
|
155
|
+
paletteIndex?: number;
|
|
156
|
+
}
|
|
157
|
+
/** Font styling to persist on a cell or range. */
|
|
158
|
+
interface XlsxCellFontStyleInput {
|
|
159
|
+
/** Font face name, such as `"Aptos"` or `"Calibri"`. */
|
|
160
|
+
name?: string;
|
|
161
|
+
/** Font size in points. */
|
|
162
|
+
size?: number;
|
|
163
|
+
/** Whether the font is bold. */
|
|
164
|
+
bold?: boolean;
|
|
165
|
+
/** Whether the font is italic. */
|
|
166
|
+
italic?: boolean;
|
|
167
|
+
/** Underline style. */
|
|
168
|
+
underline?: "none" | "single" | "double" | "singleAccounting" | "doubleAccounting";
|
|
169
|
+
/** Whether the font is struck through. */
|
|
170
|
+
strikethrough?: boolean;
|
|
171
|
+
/** Font color. */
|
|
172
|
+
color?: XlsxCellStyleColorInput;
|
|
173
|
+
/** Baseline, superscript, or subscript positioning. */
|
|
174
|
+
verticalAlign?: "baseline" | "superscript" | "subscript";
|
|
175
|
+
/** Excel font family classification. */
|
|
176
|
+
family?: number;
|
|
177
|
+
/** Font charset identifier. */
|
|
178
|
+
charset?: number;
|
|
179
|
+
/** Excel font scheme value. */
|
|
180
|
+
scheme?: string;
|
|
181
|
+
}
|
|
182
|
+
/** A color stop used by gradient fills. */
|
|
183
|
+
interface XlsxCellGradientStopInput {
|
|
184
|
+
/** Stop position from 0 to 1. */
|
|
185
|
+
position: number;
|
|
186
|
+
/** Stop color. */
|
|
187
|
+
color: XlsxCellStyleColorInput;
|
|
188
|
+
}
|
|
189
|
+
/** Fill styling to persist on a cell or range. */
|
|
190
|
+
interface XlsxCellFillStyleInput {
|
|
191
|
+
/** Fill type. Use `"solid"` with `color` for typical Excel fill color. */
|
|
192
|
+
fillType?: "none" | "solid" | "pattern" | "gradient";
|
|
193
|
+
/** Primary fill color. */
|
|
194
|
+
color?: XlsxCellStyleColorInput;
|
|
195
|
+
/** Excel pattern name for pattern fills. */
|
|
196
|
+
pattern?: string;
|
|
197
|
+
/** Foreground color for pattern fills. */
|
|
198
|
+
foreground?: XlsxCellStyleColorInput;
|
|
199
|
+
/** Background color for pattern fills. */
|
|
200
|
+
background?: XlsxCellStyleColorInput;
|
|
201
|
+
/** Gradient type for gradient fills. */
|
|
202
|
+
gradientType?: "linear" | "path";
|
|
203
|
+
/** Gradient angle in degrees. */
|
|
204
|
+
angle?: number;
|
|
205
|
+
/** Gradient color stops. */
|
|
206
|
+
stops?: XlsxCellGradientStopInput[];
|
|
207
|
+
}
|
|
208
|
+
/** A single border edge style. */
|
|
209
|
+
interface XlsxCellBorderEdgeInput {
|
|
210
|
+
/** Excel border line style. */
|
|
211
|
+
style?: "none" | "thin" | "medium" | "thick" | "dashed" | "dotted" | "double" | "hair" | "mediumDashed" | "dashDot" | "mediumDashDot" | "dashDotDot" | "mediumDashDotDot" | "slantDashDot";
|
|
212
|
+
/** Border line color. */
|
|
213
|
+
color?: XlsxCellStyleColorInput;
|
|
214
|
+
}
|
|
215
|
+
/** Border styling to persist on a cell or range. */
|
|
216
|
+
interface XlsxCellBorderStyleInput {
|
|
217
|
+
/** Left border edge. */
|
|
218
|
+
left?: XlsxCellBorderEdgeInput;
|
|
219
|
+
/** Right border edge. */
|
|
220
|
+
right?: XlsxCellBorderEdgeInput;
|
|
221
|
+
/** Top border edge. */
|
|
222
|
+
top?: XlsxCellBorderEdgeInput;
|
|
223
|
+
/** Bottom border edge. */
|
|
224
|
+
bottom?: XlsxCellBorderEdgeInput;
|
|
225
|
+
/** Diagonal border edge. */
|
|
226
|
+
diagonal?: XlsxCellBorderEdgeInput;
|
|
227
|
+
/** Diagonal border direction. */
|
|
228
|
+
diagonalDirection?: "none" | "down" | "up" | "both";
|
|
229
|
+
}
|
|
230
|
+
/** Alignment styling to persist on a cell or range. */
|
|
231
|
+
interface XlsxCellAlignmentInput {
|
|
232
|
+
/** Horizontal alignment. */
|
|
233
|
+
horizontal?: "general" | "left" | "center" | "right" | "fill" | "justify" | "centerContinuous" | "distributed";
|
|
234
|
+
/** Vertical alignment. */
|
|
235
|
+
vertical?: "top" | "center" | "bottom" | "justify" | "distributed";
|
|
236
|
+
/** Whether text wraps inside the cell. */
|
|
237
|
+
wrapText?: boolean;
|
|
238
|
+
/** Whether text shrinks to fit the cell. */
|
|
239
|
+
shrinkToFit?: boolean;
|
|
240
|
+
/** Indentation level. */
|
|
241
|
+
indent?: number;
|
|
242
|
+
/** Text rotation in degrees. */
|
|
243
|
+
rotation?: number;
|
|
244
|
+
/** Text reading order. */
|
|
245
|
+
readingOrder?: "contextDependent" | "leftToRight" | "rightToLeft";
|
|
246
|
+
}
|
|
247
|
+
/** Number format styling to persist on a cell or range. */
|
|
248
|
+
interface XlsxCellNumberFormatInput {
|
|
249
|
+
/** Number format source. Use `"custom"` with `formatString` for custom Excel formats. */
|
|
250
|
+
formatType?: "general" | "builtin" | "custom";
|
|
251
|
+
/** Built-in Excel number format id. */
|
|
252
|
+
id?: number;
|
|
253
|
+
/** Excel number format string, for example `"$#,##0.00"` or `"m/d/yyyy"`. */
|
|
254
|
+
formatString?: string;
|
|
255
|
+
}
|
|
256
|
+
/** Protection flags to persist on a cell or range. */
|
|
257
|
+
interface XlsxCellProtectionInput {
|
|
258
|
+
/** Whether the cell is locked when sheet protection is enabled. */
|
|
259
|
+
locked?: boolean;
|
|
260
|
+
/** Whether the cell formula is hidden when sheet protection is enabled. */
|
|
261
|
+
hidden?: boolean;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Persisted Excel cell style patch.
|
|
265
|
+
*
|
|
266
|
+
* Passing a partial style updates the supplied style groups on the target cell
|
|
267
|
+
* or range. Unlike the `getCellStyle` render override prop, this mutates the
|
|
268
|
+
* workbook and is included in exported XLSX bytes.
|
|
269
|
+
*/
|
|
270
|
+
interface XlsxCellStyleInput {
|
|
271
|
+
/** Font formatting such as bold, italic, size, family, and font color. */
|
|
272
|
+
font?: XlsxCellFontStyleInput;
|
|
273
|
+
/** Cell fill formatting such as background color or gradient fill. */
|
|
274
|
+
fill?: XlsxCellFillStyleInput;
|
|
275
|
+
/** Border formatting for cell edges. */
|
|
276
|
+
border?: XlsxCellBorderStyleInput;
|
|
277
|
+
/** Alignment, wrapping, indentation, rotation, and reading order. */
|
|
278
|
+
alignment?: XlsxCellAlignmentInput;
|
|
279
|
+
/** Excel number/date/currency/percent format metadata. */
|
|
280
|
+
numberFormat?: XlsxCellNumberFormatInput;
|
|
281
|
+
/** Cell protection flags. */
|
|
282
|
+
protection?: XlsxCellProtectionInput;
|
|
283
|
+
}
|
|
130
284
|
interface XlsxSparkline {
|
|
131
285
|
color?: string;
|
|
132
286
|
firstColor?: string;
|
|
@@ -545,7 +699,6 @@ interface XlsxScrollerRenderProps {
|
|
|
545
699
|
children: React.ReactNode;
|
|
546
700
|
/** Props that must be applied to the actual scrollable viewport element. */
|
|
547
701
|
viewportProps: React.HTMLAttributes<HTMLDivElement> & {
|
|
548
|
-
key: React.Key;
|
|
549
702
|
ref: React.Ref<HTMLDivElement>;
|
|
550
703
|
style: React.CSSProperties;
|
|
551
704
|
tabIndex: number;
|
|
@@ -709,8 +862,48 @@ interface XlsxViewerController {
|
|
|
709
862
|
selectedRangeAddress: string | null;
|
|
710
863
|
selectedValue: string;
|
|
711
864
|
selectedFormula: string;
|
|
865
|
+
/**
|
|
866
|
+
* Sets the formula for a cell in the active worksheet.
|
|
867
|
+
*
|
|
868
|
+
* Pass an A1-style formula body or formula string, for example `"SUM(A1:A3)"`
|
|
869
|
+
* or `"=SUM(A1:A3)"`. The mutation is recorded in undo history and is included
|
|
870
|
+
* in exported workbook bytes.
|
|
871
|
+
*
|
|
872
|
+
* @param cell Zero-based row and column address in the active worksheet.
|
|
873
|
+
* @param formula Formula text to write. Pass an empty string to clear the formula.
|
|
874
|
+
*/
|
|
712
875
|
setCellFormula: (cell: XlsxCellAddress, formula: string) => void;
|
|
876
|
+
/**
|
|
877
|
+
* Applies persisted Excel style properties to a cell in the active worksheet.
|
|
878
|
+
*
|
|
879
|
+
* This mutates workbook data, records undo history, refreshes the viewer, and
|
|
880
|
+
* is included in exported XLSX bytes. Use the `getCellStyle` viewer prop only
|
|
881
|
+
* for render-time CSS overrides that should not modify the workbook.
|
|
882
|
+
*
|
|
883
|
+
* @param cell Zero-based row and column address in the active worksheet.
|
|
884
|
+
* @param style Partial Excel style patch to apply to the target cell.
|
|
885
|
+
*/
|
|
886
|
+
setCellStyle: (cell: XlsxCellAddress, style: XlsxCellStyleInput) => void;
|
|
887
|
+
/**
|
|
888
|
+
* Sets the value for a cell in the active worksheet.
|
|
889
|
+
*
|
|
890
|
+
* User-entered strings are coerced to booleans or numbers when they match
|
|
891
|
+
* Excel-like input. Prefix text with an apostrophe to force literal text.
|
|
892
|
+
*
|
|
893
|
+
* @param cell Zero-based row and column address in the active worksheet.
|
|
894
|
+
* @param value Text entered by the user.
|
|
895
|
+
*/
|
|
713
896
|
setCellValue: (cell: XlsxCellAddress, value: string) => void;
|
|
897
|
+
/**
|
|
898
|
+
* Applies persisted Excel style properties to every cell in a range.
|
|
899
|
+
*
|
|
900
|
+
* This mutates workbook data, records undo history, refreshes the viewer, and
|
|
901
|
+
* is included in exported XLSX bytes.
|
|
902
|
+
*
|
|
903
|
+
* @param range Zero-based cell range in the active worksheet.
|
|
904
|
+
* @param style Partial Excel style patch to apply to the target range.
|
|
905
|
+
*/
|
|
906
|
+
setRangeStyle: (range: XlsxCellRange, style: XlsxCellStyleInput) => void;
|
|
714
907
|
setZoomScale: (zoomScale: number) => void;
|
|
715
908
|
selectCell: (cell: XlsxCellAddress, options?: {
|
|
716
909
|
extend?: boolean;
|
|
@@ -725,6 +918,16 @@ interface XlsxViewerController {
|
|
|
725
918
|
selectedImage: XlsxImage | null;
|
|
726
919
|
selectedImageId: string | null;
|
|
727
920
|
setSelectedCellFormula: (formula: string) => void;
|
|
921
|
+
/**
|
|
922
|
+
* Applies persisted Excel style properties to the active cell.
|
|
923
|
+
*
|
|
924
|
+
* No-ops when there is no active cell, when editing is disabled, or when no
|
|
925
|
+
* workbook is loaded. The mutation is recorded in undo history and is included
|
|
926
|
+
* in exported XLSX bytes.
|
|
927
|
+
*
|
|
928
|
+
* @param style Partial Excel style patch to apply to the active cell.
|
|
929
|
+
*/
|
|
930
|
+
setSelectedCellStyle: (style: XlsxCellStyleInput) => void;
|
|
728
931
|
setSelectedCellValue: (value: string) => void;
|
|
729
932
|
sheets: XlsxSheetData[];
|
|
730
933
|
src?: string;
|
|
@@ -789,9 +992,44 @@ interface XlsxViewerEditing {
|
|
|
789
992
|
redo: () => void;
|
|
790
993
|
selectedFormula: string;
|
|
791
994
|
selectedValue: string;
|
|
995
|
+
/**
|
|
996
|
+
* Sets the formula for a cell in the active worksheet.
|
|
997
|
+
*
|
|
998
|
+
* @param cell Zero-based row and column address in the active worksheet.
|
|
999
|
+
* @param formula Formula text to write. Pass an empty string to clear the formula.
|
|
1000
|
+
*/
|
|
792
1001
|
setCellFormula: (cell: XlsxCellAddress, formula: string) => void;
|
|
1002
|
+
/**
|
|
1003
|
+
* Applies persisted Excel style properties to a cell in the active worksheet.
|
|
1004
|
+
*
|
|
1005
|
+
* The mutation is recorded in undo history and is included in exported XLSX
|
|
1006
|
+
* bytes. This is different from the `getCellStyle` render override prop.
|
|
1007
|
+
*
|
|
1008
|
+
* @param cell Zero-based row and column address in the active worksheet.
|
|
1009
|
+
* @param style Partial Excel style patch to apply to the target cell.
|
|
1010
|
+
*/
|
|
1011
|
+
setCellStyle: (cell: XlsxCellAddress, style: XlsxCellStyleInput) => void;
|
|
1012
|
+
/**
|
|
1013
|
+
* Sets the value for a cell in the active worksheet.
|
|
1014
|
+
*
|
|
1015
|
+
* @param cell Zero-based row and column address in the active worksheet.
|
|
1016
|
+
* @param value Text entered by the user.
|
|
1017
|
+
*/
|
|
793
1018
|
setCellValue: (cell: XlsxCellAddress, value: string) => void;
|
|
1019
|
+
/**
|
|
1020
|
+
* Applies persisted Excel style properties to every cell in a range.
|
|
1021
|
+
*
|
|
1022
|
+
* @param range Zero-based cell range in the active worksheet.
|
|
1023
|
+
* @param style Partial Excel style patch to apply to the target range.
|
|
1024
|
+
*/
|
|
1025
|
+
setRangeStyle: (range: XlsxCellRange, style: XlsxCellStyleInput) => void;
|
|
794
1026
|
setSelectedCellFormula: (formula: string) => void;
|
|
1027
|
+
/**
|
|
1028
|
+
* Applies persisted Excel style properties to the active cell.
|
|
1029
|
+
*
|
|
1030
|
+
* @param style Partial Excel style patch to apply to the active cell.
|
|
1031
|
+
*/
|
|
1032
|
+
setSelectedCellStyle: (style: XlsxCellStyleInput) => void;
|
|
795
1033
|
setSelectedCellValue: (value: string) => void;
|
|
796
1034
|
undo: () => void;
|
|
797
1035
|
unmergeSelection: () => void;
|
|
@@ -1136,4 +1374,4 @@ declare function useXlsxViewerThumbnails(options?: UseXlsxViewerThumbnailsOption
|
|
|
1136
1374
|
declare function XlsxViewer(props: XlsxViewerProps): react_jsx_runtime.JSX.Element;
|
|
1137
1375
|
declare function DefaultXlsxToolbar(): react_jsx_runtime.JSX.Element;
|
|
1138
1376
|
|
|
1139
|
-
export { DefaultXlsxToolbar, type UseXlsxViewerControllerOptions, type UseXlsxViewerThumbnailsOptions, type XlsxCellAddress, type XlsxCellRange, type XlsxCellStyleContext, type XlsxChart, type XlsxChartAxis, type XlsxChartDataLabels, type XlsxChartLoadingRenderProps, type XlsxChartReference, type XlsxChartSeries, type XlsxChartsheet, XlsxFileSizeLimitExceededError, type XlsxFileTooLargeRenderProps, type XlsxImage, type XlsxImageAnchor, type XlsxImageRect, type XlsxImageRenderProps, type XlsxImageResizeHandlePosition, type XlsxImageSelectionRenderProps, type XlsxScrollerRenderProps, type XlsxShape, type XlsxShapeFill, type XlsxShapeParagraph, type XlsxShapeStroke, type XlsxShapeTextBox, type XlsxShapeTextRun, type XlsxSheetData, type XlsxSheetThumbnail, type XlsxSheetThumbnailResolution, type XlsxSheetVisibility, type XlsxTable, type XlsxTableColumn, type XlsxTableHeaderMenuRenderProps, type XlsxTableSortDirection, type XlsxTableSortState, type XlsxThemePalette, XlsxViewer, type XlsxViewerCharts, type XlsxViewerController, type XlsxViewerEditing, type XlsxViewerImages, type XlsxViewerProps, XlsxViewerProvider, type XlsxViewerProviderProps, type XlsxViewerSelection, type XlsxViewerTables, type XlsxViewerThumbnails, type XlsxViewerZoom, type XlsxWasmSource, type XlsxWorkbookTab, initWasm, setWasmSource, useXlsxViewer, useXlsxViewerCharts, useXlsxViewerController, useXlsxViewerEditing, useXlsxViewerImages, useXlsxViewerSelection, useXlsxViewerTables, useXlsxViewerThumbnails, useXlsxViewerZoom };
|
|
1377
|
+
export { DefaultXlsxToolbar, type UseXlsxViewerControllerOptions, type UseXlsxViewerThumbnailsOptions, type XlsxCellAddress, type XlsxCellAlignmentInput, type XlsxCellBorderEdgeInput, type XlsxCellBorderStyleInput, type XlsxCellFillStyleInput, type XlsxCellFontStyleInput, type XlsxCellGradientStopInput, type XlsxCellNumberFormatInput, type XlsxCellProtectionInput, type XlsxCellRange, type XlsxCellStyleColorInput, type XlsxCellStyleContext, type XlsxCellStyleInput, type XlsxChart, type XlsxChartAxis, type XlsxChartDataLabels, type XlsxChartLoadingRenderProps, type XlsxChartReference, type XlsxChartSeries, type XlsxChartsheet, XlsxFileSizeLimitExceededError, type XlsxFileTooLargeRenderProps, type XlsxImage, type XlsxImageAnchor, type XlsxImageRect, type XlsxImageRenderProps, type XlsxImageResizeHandlePosition, type XlsxImageSelectionRenderProps, type XlsxScrollerRenderProps, type XlsxShape, type XlsxShapeFill, type XlsxShapeParagraph, type XlsxShapeStroke, type XlsxShapeTextBox, type XlsxShapeTextRun, type XlsxSheetData, type XlsxSheetThumbnail, type XlsxSheetThumbnailResolution, type XlsxSheetVisibility, type XlsxTable, type XlsxTableColumn, type XlsxTableHeaderMenuRenderProps, type XlsxTableSortDirection, type XlsxTableSortState, type XlsxThemePalette, XlsxViewer, type XlsxViewerCharts, type XlsxViewerController, type XlsxViewerEditing, type XlsxViewerImages, type XlsxViewerProps, XlsxViewerProvider, type XlsxViewerProviderProps, type XlsxViewerSelection, type XlsxViewerTables, type XlsxViewerThumbnails, type XlsxViewerZoom, type XlsxWasmSource, type XlsxWorkbookTab, initWasm, setWasmSource, useXlsxViewer, useXlsxViewerCharts, useXlsxViewerController, useXlsxViewerEditing, useXlsxViewerImages, useXlsxViewerSelection, useXlsxViewerTables, useXlsxViewerThumbnails, useXlsxViewerZoom };
|