@extend-ai/react-xlsx 0.20.11 → 0.21.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.
Files changed (50) hide show
  1. package/README.md +171 -4
  2. package/dist/{chunk-VSM7WKLM.js → chunk-2UFSVI5Z.js} +565 -142
  3. package/dist/chunk-2UFSVI5Z.js.map +1 -0
  4. package/dist/{chunk-SXHHFUXA.cjs → chunk-7IL4KLCD.cjs} +1729 -1306
  5. package/dist/chunk-7IL4KLCD.cjs.map +1 -0
  6. package/dist/{chunk-OGZ6ROZC.cjs → chunk-A3S3QKJN.cjs} +445 -3
  7. package/dist/chunk-A3S3QKJN.cjs.map +1 -0
  8. package/dist/chunk-IRC7BQ6E.js +538 -0
  9. package/dist/chunk-IRC7BQ6E.js.map +1 -0
  10. package/dist/{chunk-CVMHJO5H.js → chunk-WHTV6N6S.js} +443 -1
  11. package/dist/chunk-WHTV6N6S.js.map +1 -0
  12. package/dist/chunk-ZPDHTVL6.cjs +538 -0
  13. package/dist/chunk-ZPDHTVL6.cjs.map +1 -0
  14. package/dist/index.cjs +245 -159
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.cts +135 -2
  17. package/dist/index.d.ts +135 -2
  18. package/dist/index.js +203 -117
  19. package/dist/index.js.map +1 -1
  20. package/dist/{internal-BBaC9yCh.d.cts → internal-BO70EPFy.d.cts} +130 -2
  21. package/dist/{internal-BBaC9yCh.d.ts → internal-BO70EPFy.d.ts} +130 -2
  22. package/dist/internal.cjs +3 -3
  23. package/dist/internal.d.cts +1 -1
  24. package/dist/internal.d.ts +1 -1
  25. package/dist/internal.js +2 -2
  26. package/dist/{shared-chart-XOCTF7KQ.js → shared-chart-7RUN5IKZ.js} +6 -4
  27. package/dist/shared-chart-7RUN5IKZ.js.map +1 -0
  28. package/dist/{shared-chart-CIRSCWTO.cjs → shared-chart-P3KU6TQR.cjs} +15 -13
  29. package/dist/shared-chart-P3KU6TQR.cjs.map +1 -0
  30. package/dist/{shared-chart-BLOOGI7S.js → shared-chart-UTUK46E4.js} +6 -4
  31. package/dist/shared-chart-UTUK46E4.js.map +1 -0
  32. package/dist/{shared-chart-4LUQQI2B.cjs → shared-chart-VRXD57MU.cjs} +6 -4
  33. package/dist/shared-chart-VRXD57MU.cjs.map +1 -0
  34. package/dist/vanilla.cjs +3 -3
  35. package/dist/vanilla.d.cts +2 -2
  36. package/dist/vanilla.d.ts +2 -2
  37. package/dist/vanilla.js +2 -2
  38. package/package.json +1 -1
  39. package/dist/chunk-7GBCRNGO.js +0 -94
  40. package/dist/chunk-7GBCRNGO.js.map +0 -1
  41. package/dist/chunk-CVMHJO5H.js.map +0 -1
  42. package/dist/chunk-MFOGLSFJ.cjs +0 -94
  43. package/dist/chunk-MFOGLSFJ.cjs.map +0 -1
  44. package/dist/chunk-OGZ6ROZC.cjs.map +0 -1
  45. package/dist/chunk-SXHHFUXA.cjs.map +0 -1
  46. package/dist/chunk-VSM7WKLM.js.map +0 -1
  47. package/dist/shared-chart-4LUQQI2B.cjs.map +0 -1
  48. package/dist/shared-chart-BLOOGI7S.js.map +0 -1
  49. package/dist/shared-chart-CIRSCWTO.cjs.map +0 -1
  50. package/dist/shared-chart-XOCTF7KQ.js.map +0 -1
@@ -44,6 +44,60 @@ interface OfficeCharts {
44
44
  renderChart(xml: string, options?: RenderOptions): string | null;
45
45
  }
46
46
 
47
+ declare const englishMessages: {
48
+ sortAscending: string;
49
+ sortDescending: string;
50
+ openMenuForColumn: string;
51
+ cut: string;
52
+ copy: string;
53
+ paste: string;
54
+ editCell: string;
55
+ clearContents: string;
56
+ undo: string;
57
+ redo: string;
58
+ mergeAndCenter: string;
59
+ mergeAcross: string;
60
+ mergeCells: string;
61
+ unmergeCells: string;
62
+ selectRow: string;
63
+ selectColumn: string;
64
+ selectAll: string;
65
+ contextMenu: string;
66
+ clipboardCopyUnavailable: string;
67
+ clipboardPasteUnavailable: string;
68
+ nothingToPaste: string;
69
+ actionFailed: string;
70
+ workbookSheets: string;
71
+ downloadWorkbook: string;
72
+ zoomIn: string;
73
+ zoomOut: string;
74
+ resetZoom: string;
75
+ hiddenSheet: string;
76
+ veryHiddenSheet: string;
77
+ loadingWorkbook: string;
78
+ emptyWorkbook: string;
79
+ loadWorkbookFailed: string;
80
+ fileTooLarge: string;
81
+ largeWorkbook: string;
82
+ deferredLoadDescription: string;
83
+ loadAnyway: string;
84
+ worksheetGrid: string;
85
+ workbookGrid: string;
86
+ dropdownControl: string;
87
+ listBoxControl: string;
88
+ scrollbarControl: string;
89
+ spinnerControl: string;
90
+ chart: string;
91
+ loadingChart: string;
92
+ loadChartFailed: string;
93
+ mapUnavailable: string;
94
+ chartUnavailable: string;
95
+ chartsheetUnavailable: string;
96
+ };
97
+ type XlsxViewerMessages = {
98
+ [Key in keyof typeof englishMessages]: string;
99
+ };
100
+
47
101
  interface XlsxThemePalette {
48
102
  colorsByIndex: Record<number, string>;
49
103
  majorLatinFont?: string;
@@ -965,8 +1019,10 @@ interface XlsxDrawingLayout {
965
1019
  }
966
1020
  type XlsxImageResizeHandlePosition = "n" | "s" | "e" | "w" | "ne" | "nw" | "se" | "sw";
967
1021
  interface UseXlsxViewerControllerOptions {
968
- /** BCP 47 locale for numeric decimal and grouping separators. Defaults to en-US. */
1022
+ /** BCP 47 locale for number formatting and built-in UI text. Defaults to en-US. */
969
1023
  locale?: string;
1024
+ /** Partial overrides for localized UI text, including accessibility labels. */
1025
+ messages?: Partial<XlsxViewerMessages>;
970
1026
  /**
971
1027
  * Allows row and column resizing even while editing is disabled by `readOnly`.
972
1028
  *
@@ -1080,6 +1136,8 @@ interface XlsxViewerController {
1080
1136
  defineNamedRange: (name: string, range?: XlsxCellRange | null) => void;
1081
1137
  displayFileName: string;
1082
1138
  locale: string;
1139
+ /** Resolved UI text after applying locale defaults and message overrides. */
1140
+ messages: XlsxViewerMessages;
1083
1141
  download: () => void;
1084
1142
  charts: XlsxChart[];
1085
1143
  chartsheets: XlsxChartsheet[];
@@ -1163,6 +1221,11 @@ interface XlsxViewerController {
1163
1221
  * @param style Partial Excel style patch to apply to the target cell.
1164
1222
  */
1165
1223
  setCellStyle: (cell: XlsxCellAddress, style: XlsxCellStyleInput) => void;
1224
+ /** Applies individual cell styles as one undoable workbook edit. */
1225
+ setCellStyles: (updates: ReadonlyArray<{
1226
+ cell: XlsxCellAddress;
1227
+ style: XlsxCellStyleInput;
1228
+ }>) => void;
1166
1229
  /**
1167
1230
  * Sets the value for a cell in the active worksheet.
1168
1231
  *
@@ -1322,6 +1385,11 @@ interface XlsxViewerEditing {
1322
1385
  * @param style Partial Excel style patch to apply to the target cell.
1323
1386
  */
1324
1387
  setCellStyle: (cell: XlsxCellAddress, style: XlsxCellStyleInput) => void;
1388
+ /** Applies individual cell styles as one undoable workbook edit. */
1389
+ setCellStyles: (updates: ReadonlyArray<{
1390
+ cell: XlsxCellAddress;
1391
+ style: XlsxCellStyleInput;
1392
+ }>) => void;
1325
1393
  /**
1326
1394
  * Sets the value for a cell in the active worksheet.
1327
1395
  *
@@ -1445,6 +1513,61 @@ interface XlsxActiveCellOverlayRenderProps {
1445
1513
  */
1446
1514
  rect: XlsxImageRect;
1447
1515
  }
1516
+ interface XlsxCellEditorContext {
1517
+ cell: XlsxCellAddress;
1518
+ sheetIndex: number;
1519
+ sheetName: string;
1520
+ /** The saved cell input before editing started, including a leading equals sign for formulas. */
1521
+ originalValue: string;
1522
+ /** The interaction that opened this editing session. */
1523
+ trigger: "double-click" | "typing" | "keyboard" | "context-menu";
1524
+ }
1525
+ interface XlsxCellEditorSession {
1526
+ context: XlsxCellEditorContext;
1527
+ value: string;
1528
+ isPreview: boolean;
1529
+ /** Aborted when editing ends or the target changes. Pass to asynchronous requests. */
1530
+ signal: AbortSignal;
1531
+ /** Reads the latest draft, or null after this session ends. */
1532
+ getValue: () => string | null;
1533
+ /** Replaces the draft without writing to the workbook. Returns false after this session ends. */
1534
+ setValue: (value: string) => boolean;
1535
+ /** Replaces the draft for review. Leaving the editor cancels an unconfirmed preview. */
1536
+ preview: (value: string) => boolean;
1537
+ /** Restores the draft from before the preview and keeps editing. */
1538
+ discardPreview: () => boolean;
1539
+ /** Saves the supplied input, or the current draft, using the existing undo history. */
1540
+ commit: (value?: string) => boolean;
1541
+ /** Ends editing without saving. */
1542
+ cancel: () => boolean;
1543
+ /** Returns focus to the built-in input. */
1544
+ focus: () => boolean;
1545
+ }
1546
+ interface XlsxCellEditorOverlayRenderProps extends XlsxCellEditorSession {
1547
+ /** The live editor element, for anchoring and scoped visual effects. */
1548
+ editorElement: HTMLDivElement;
1549
+ /** The expanded editor rectangle in viewport pixels. The overlay container already fills it. */
1550
+ rect: XlsxImageRect;
1551
+ }
1552
+ interface XlsxSelectionPopoverContext {
1553
+ cell: XlsxCellAddress;
1554
+ selection: XlsxCellRange;
1555
+ sheetIndex: number;
1556
+ sheetName: string;
1557
+ readOnly: boolean;
1558
+ }
1559
+ interface XlsxSelectionPopoverRenderProps {
1560
+ context: XlsxSelectionPopoverContext;
1561
+ /** The visible selection rectangle in viewport pixels. The container already fills it. */
1562
+ rect: XlsxImageRect;
1563
+ /** Aborted when the selection changes, editing starts, or the popover closes. */
1564
+ signal: AbortSignal;
1565
+ /** Saves a formula in the active cell and closes. Returns false for stale or read-only selections. */
1566
+ applyFormula: (formula: string) => boolean;
1567
+ /** Runs a synchronous custom mutation for the current selection and closes. */
1568
+ commit: (apply: (context: XlsxSelectionPopoverContext) => void) => boolean;
1569
+ close: () => void;
1570
+ }
1448
1571
 
1449
1572
  type XlsxVanillaContent = Node | string | number | null;
1450
1573
  type XlsxVanillaStyle = Properties<string | number>;
@@ -1458,6 +1581,8 @@ interface XlsxVanillaContextMenuRenderProps {
1458
1581
  actions: XlsxContextMenuAction[];
1459
1582
  runAction: (actionId: XlsxContextMenuActionId) => Promise<boolean>;
1460
1583
  closeMenu: () => void;
1584
+ signal: AbortSignal;
1585
+ commit: (apply: (context: XlsxContextMenuContext) => void) => boolean;
1461
1586
  position: {
1462
1587
  x: number;
1463
1588
  y: number;
@@ -1540,6 +1665,9 @@ interface XlsxVanillaViewerOptions extends UseXlsxViewerControllerOptions {
1540
1665
  selectionFillColor?: string;
1541
1666
  selectionHeaderColor?: string;
1542
1667
  renderActiveCellOverlay?: (props: XlsxActiveCellOverlayRenderProps) => XlsxVanillaContent;
1668
+ cellEditorStyle?: XlsxVanillaStyle;
1669
+ renderCellEditorOverlay?: (props: XlsxCellEditorOverlayRenderProps) => XlsxVanillaContent;
1670
+ renderSelectionPopover?: (props: XlsxSelectionPopoverRenderProps) => XlsxVanillaContent;
1543
1671
  showImages?: boolean;
1544
1672
  showDefaultToolbar?: boolean;
1545
1673
  toolbar?: XlsxVanillaContent | ((controller: XlsxViewerController) => XlsxVanillaContent);
@@ -1589,4 +1717,4 @@ declare function __createContentRoot(container: Element): {
1589
1717
  destroy(): void;
1590
1718
  };
1591
1719
 
1592
- export { type XlsxFormControlState as $, type XlsxClipboardData as A, type XlsxConditionalColorScaleRule as B, type XlsxConditionalDataBarRule as C, type XlsxConditionalFormatIcon as D, type XlsxConditionalFormatRule as E, type XlsxConditionalFormatValueObject as F, type XlsxConditionalIconSetRule as G, type XlsxConditionalStyledRule as H, type XlsxContextMenuAction as I, type XlsxContextMenuActionId as J, type XlsxContextMenuContext as K, type XlsxDataValidation as L, type XlsxDrawingLayout as M, XlsxFileSizeLimitExceededError as N, type XlsxFormControl as O, type XlsxFormControlActionEvent as P, type XlsxFormControlCaption as Q, type XlsxFormControlCaptionInput as R, type XlsxFormControlCaptionRun as S, type XlsxFormControlChangeEvent as T, type UseXlsxViewerControllerOptions as U, type XlsxFormControlInput as V, type XlsxFormControlKind as W, type XlsxParsedRange as X, type XlsxFormControlKindInput as Y, type XlsxFormControlPatch as Z, type XlsxFormControlSelectionMode as _, type UseXlsxViewerThumbnailsOptions as a, type XlsxFormulaTarget as a0, type XlsxFreezePanes as a1, type XlsxHighlightRangeOptions as a2, type XlsxImage as a3, type XlsxImageAnchor as a4, type XlsxImageMarker as a5, type XlsxImageRect as a6, type XlsxImageResizeHandlePosition as a7, type XlsxMergeMode as a8, type XlsxRangeHighlight as a9, type XlsxVanillaStyle as aA, type XlsxVanillaViewer as aB, type XlsxVanillaViewerOptions as aC, XlsxViewer as aD, type XlsxViewerCharts as aE, type XlsxViewerController as aF, type XlsxViewerEditing as aG, type XlsxViewerImages as aH, type XlsxViewerSelection as aI, type XlsxViewerTables as aJ, type XlsxViewerThumbnails as aK, type XlsxViewerZoom as aL, type XlsxWasmSource as aM, type XlsxWorkbookTab as aN, createXlsxViewer as aO, initWasm as aP, setWasmSource as aQ, type WorkerWasmSource as aR, __createContentNode as aS, __createContentRoot as aT, __createControlledViewer as aU, canUseConfiguredWasmSourceInWorker as aV, formatBinaryBytes as aW, getConfiguredWorkerWasmSource as aX, getSheetsWasmModule as aY, type XlsxResolvedCellStyle as aa, type XlsxShape as ab, type XlsxShapeFill as ac, type XlsxShapeParagraph as ad, type XlsxShapeStroke as ae, type XlsxShapeTextBox as af, type XlsxShapeTextRun as ag, type XlsxSheetData as ah, type XlsxSheetThumbnail as ai, type XlsxSheetThumbnailResolution as aj, type XlsxSheetVisibility as ak, type XlsxSparkline as al, type XlsxTable as am, type XlsxTableColumn as an, type XlsxTableSortDirection as ao, type XlsxTableSortState as ap, type XlsxTableStyleDefinition as aq, type XlsxTableStyleInfo as ar, type XlsxThemePalette as as, type XlsxVanillaCellStyleContext as at, type XlsxVanillaChartLoadingRenderProps as au, type XlsxVanillaContent as av, type XlsxVanillaContextMenuRenderProps as aw, type XlsxVanillaFileTooLargeRenderProps as ax, type XlsxVanillaFormControlRenderProps as ay, type XlsxVanillaImageRenderProps as az, type XlsxActiveCellOverlayRenderProps as b, type XlsxCellAddress as c, type XlsxCellAlignmentInput as d, type XlsxCellBorderEdgeInput as e, type XlsxCellBorderStyleInput as f, type XlsxCellFillStyleInput as g, type XlsxCellFontStyleInput as h, type XlsxCellGradientStopInput as i, type XlsxCellNumberFormatInput as j, type XlsxCellProtectionInput as k, type XlsxCellRange as l, type XlsxCellStyleColorInput as m, type XlsxCellStyleInput as n, type XlsxChart as o, type XlsxChartAxis as p, type XlsxChartDataLabels as q, type XlsxChartElementSelection as r, type XlsxChartLegend as s, type XlsxChartPointDataLabel as t, type XlsxChartPointStyle as u, type XlsxChartReference as v, type XlsxChartSeries as w, type XlsxChartTypeGroup as x, type XlsxChartWall as y, type XlsxChartsheet as z };
1720
+ export { type XlsxFormControlKindInput as $, type XlsxChartTypeGroup as A, type XlsxChartWall as B, type XlsxChartsheet as C, type XlsxClipboardData as D, type XlsxConditionalColorScaleRule as E, type XlsxConditionalDataBarRule as F, type XlsxConditionalFormatIcon as G, type XlsxConditionalFormatRule as H, type XlsxConditionalFormatValueObject as I, type XlsxConditionalIconSetRule as J, type XlsxConditionalStyledRule as K, type XlsxContextMenuAction as L, type XlsxContextMenuActionId as M, type XlsxContextMenuContext as N, type XlsxDataValidation as O, type XlsxDrawingLayout as P, XlsxFileSizeLimitExceededError as Q, type XlsxFormControl as R, type XlsxFormControlActionEvent as S, type XlsxFormControlCaption as T, type UseXlsxViewerControllerOptions as U, type XlsxFormControlCaptionInput as V, type XlsxFormControlCaptionRun as W, type XlsxParsedRange as X, type XlsxFormControlChangeEvent as Y, type XlsxFormControlInput as Z, type XlsxFormControlKind as _, type UseXlsxViewerThumbnailsOptions as a, canUseConfiguredWasmSourceInWorker as a$, type XlsxFormControlPatch as a0, type XlsxFormControlSelectionMode as a1, type XlsxFormControlState as a2, type XlsxFormulaTarget as a3, type XlsxFreezePanes as a4, type XlsxHighlightRangeOptions as a5, type XlsxImage as a6, type XlsxImageAnchor as a7, type XlsxImageMarker as a8, type XlsxImageRect as a9, type XlsxVanillaContent as aA, type XlsxVanillaContextMenuRenderProps as aB, type XlsxVanillaFileTooLargeRenderProps as aC, type XlsxVanillaFormControlRenderProps as aD, type XlsxVanillaImageRenderProps as aE, type XlsxVanillaStyle as aF, type XlsxVanillaViewer as aG, type XlsxVanillaViewerOptions as aH, XlsxViewer as aI, type XlsxViewerCharts as aJ, type XlsxViewerController as aK, type XlsxViewerEditing as aL, type XlsxViewerImages as aM, type XlsxViewerMessages as aN, type XlsxViewerSelection as aO, type XlsxViewerTables as aP, type XlsxViewerThumbnails as aQ, type XlsxViewerZoom as aR, type XlsxWasmSource as aS, type XlsxWorkbookTab as aT, createXlsxViewer as aU, initWasm as aV, setWasmSource as aW, type WorkerWasmSource as aX, __createContentNode as aY, __createContentRoot as aZ, __createControlledViewer as a_, type XlsxImageResizeHandlePosition as aa, type XlsxMergeMode as ab, type XlsxRangeHighlight as ac, type XlsxResolvedCellStyle as ad, type XlsxSelectionPopoverContext as ae, type XlsxSelectionPopoverRenderProps as af, type XlsxShape as ag, type XlsxShapeFill as ah, type XlsxShapeParagraph as ai, type XlsxShapeStroke as aj, type XlsxShapeTextBox as ak, type XlsxShapeTextRun as al, type XlsxSheetData as am, type XlsxSheetThumbnail as an, type XlsxSheetThumbnailResolution as ao, type XlsxSheetVisibility as ap, type XlsxSparkline as aq, type XlsxTable as ar, type XlsxTableColumn as as, type XlsxTableSortDirection as at, type XlsxTableSortState as au, type XlsxTableStyleDefinition as av, type XlsxTableStyleInfo as aw, type XlsxThemePalette as ax, type XlsxVanillaCellStyleContext as ay, type XlsxVanillaChartLoadingRenderProps as az, type XlsxActiveCellOverlayRenderProps as b, formatBinaryBytes as b0, getConfiguredWorkerWasmSource as b1, getSheetsWasmModule as b2, type XlsxCellAddress as c, type XlsxCellAlignmentInput as d, type XlsxCellBorderEdgeInput as e, type XlsxCellBorderStyleInput as f, type XlsxCellEditorContext as g, type XlsxCellEditorOverlayRenderProps as h, type XlsxCellEditorSession as i, type XlsxCellFillStyleInput as j, type XlsxCellFontStyleInput as k, type XlsxCellGradientStopInput as l, type XlsxCellNumberFormatInput as m, type XlsxCellProtectionInput as n, type XlsxCellRange as o, type XlsxCellStyleColorInput as p, type XlsxCellStyleInput as q, type XlsxChart as r, type XlsxChartAxis as s, type XlsxChartDataLabels as t, type XlsxChartElementSelection as u, type XlsxChartLegend as v, type XlsxChartPointDataLabel as w, type XlsxChartPointStyle as x, type XlsxChartReference as y, type XlsxChartSeries as z };
@@ -44,6 +44,60 @@ interface OfficeCharts {
44
44
  renderChart(xml: string, options?: RenderOptions): string | null;
45
45
  }
46
46
 
47
+ declare const englishMessages: {
48
+ sortAscending: string;
49
+ sortDescending: string;
50
+ openMenuForColumn: string;
51
+ cut: string;
52
+ copy: string;
53
+ paste: string;
54
+ editCell: string;
55
+ clearContents: string;
56
+ undo: string;
57
+ redo: string;
58
+ mergeAndCenter: string;
59
+ mergeAcross: string;
60
+ mergeCells: string;
61
+ unmergeCells: string;
62
+ selectRow: string;
63
+ selectColumn: string;
64
+ selectAll: string;
65
+ contextMenu: string;
66
+ clipboardCopyUnavailable: string;
67
+ clipboardPasteUnavailable: string;
68
+ nothingToPaste: string;
69
+ actionFailed: string;
70
+ workbookSheets: string;
71
+ downloadWorkbook: string;
72
+ zoomIn: string;
73
+ zoomOut: string;
74
+ resetZoom: string;
75
+ hiddenSheet: string;
76
+ veryHiddenSheet: string;
77
+ loadingWorkbook: string;
78
+ emptyWorkbook: string;
79
+ loadWorkbookFailed: string;
80
+ fileTooLarge: string;
81
+ largeWorkbook: string;
82
+ deferredLoadDescription: string;
83
+ loadAnyway: string;
84
+ worksheetGrid: string;
85
+ workbookGrid: string;
86
+ dropdownControl: string;
87
+ listBoxControl: string;
88
+ scrollbarControl: string;
89
+ spinnerControl: string;
90
+ chart: string;
91
+ loadingChart: string;
92
+ loadChartFailed: string;
93
+ mapUnavailable: string;
94
+ chartUnavailable: string;
95
+ chartsheetUnavailable: string;
96
+ };
97
+ type XlsxViewerMessages = {
98
+ [Key in keyof typeof englishMessages]: string;
99
+ };
100
+
47
101
  interface XlsxThemePalette {
48
102
  colorsByIndex: Record<number, string>;
49
103
  majorLatinFont?: string;
@@ -965,8 +1019,10 @@ interface XlsxDrawingLayout {
965
1019
  }
966
1020
  type XlsxImageResizeHandlePosition = "n" | "s" | "e" | "w" | "ne" | "nw" | "se" | "sw";
967
1021
  interface UseXlsxViewerControllerOptions {
968
- /** BCP 47 locale for numeric decimal and grouping separators. Defaults to en-US. */
1022
+ /** BCP 47 locale for number formatting and built-in UI text. Defaults to en-US. */
969
1023
  locale?: string;
1024
+ /** Partial overrides for localized UI text, including accessibility labels. */
1025
+ messages?: Partial<XlsxViewerMessages>;
970
1026
  /**
971
1027
  * Allows row and column resizing even while editing is disabled by `readOnly`.
972
1028
  *
@@ -1080,6 +1136,8 @@ interface XlsxViewerController {
1080
1136
  defineNamedRange: (name: string, range?: XlsxCellRange | null) => void;
1081
1137
  displayFileName: string;
1082
1138
  locale: string;
1139
+ /** Resolved UI text after applying locale defaults and message overrides. */
1140
+ messages: XlsxViewerMessages;
1083
1141
  download: () => void;
1084
1142
  charts: XlsxChart[];
1085
1143
  chartsheets: XlsxChartsheet[];
@@ -1163,6 +1221,11 @@ interface XlsxViewerController {
1163
1221
  * @param style Partial Excel style patch to apply to the target cell.
1164
1222
  */
1165
1223
  setCellStyle: (cell: XlsxCellAddress, style: XlsxCellStyleInput) => void;
1224
+ /** Applies individual cell styles as one undoable workbook edit. */
1225
+ setCellStyles: (updates: ReadonlyArray<{
1226
+ cell: XlsxCellAddress;
1227
+ style: XlsxCellStyleInput;
1228
+ }>) => void;
1166
1229
  /**
1167
1230
  * Sets the value for a cell in the active worksheet.
1168
1231
  *
@@ -1322,6 +1385,11 @@ interface XlsxViewerEditing {
1322
1385
  * @param style Partial Excel style patch to apply to the target cell.
1323
1386
  */
1324
1387
  setCellStyle: (cell: XlsxCellAddress, style: XlsxCellStyleInput) => void;
1388
+ /** Applies individual cell styles as one undoable workbook edit. */
1389
+ setCellStyles: (updates: ReadonlyArray<{
1390
+ cell: XlsxCellAddress;
1391
+ style: XlsxCellStyleInput;
1392
+ }>) => void;
1325
1393
  /**
1326
1394
  * Sets the value for a cell in the active worksheet.
1327
1395
  *
@@ -1445,6 +1513,61 @@ interface XlsxActiveCellOverlayRenderProps {
1445
1513
  */
1446
1514
  rect: XlsxImageRect;
1447
1515
  }
1516
+ interface XlsxCellEditorContext {
1517
+ cell: XlsxCellAddress;
1518
+ sheetIndex: number;
1519
+ sheetName: string;
1520
+ /** The saved cell input before editing started, including a leading equals sign for formulas. */
1521
+ originalValue: string;
1522
+ /** The interaction that opened this editing session. */
1523
+ trigger: "double-click" | "typing" | "keyboard" | "context-menu";
1524
+ }
1525
+ interface XlsxCellEditorSession {
1526
+ context: XlsxCellEditorContext;
1527
+ value: string;
1528
+ isPreview: boolean;
1529
+ /** Aborted when editing ends or the target changes. Pass to asynchronous requests. */
1530
+ signal: AbortSignal;
1531
+ /** Reads the latest draft, or null after this session ends. */
1532
+ getValue: () => string | null;
1533
+ /** Replaces the draft without writing to the workbook. Returns false after this session ends. */
1534
+ setValue: (value: string) => boolean;
1535
+ /** Replaces the draft for review. Leaving the editor cancels an unconfirmed preview. */
1536
+ preview: (value: string) => boolean;
1537
+ /** Restores the draft from before the preview and keeps editing. */
1538
+ discardPreview: () => boolean;
1539
+ /** Saves the supplied input, or the current draft, using the existing undo history. */
1540
+ commit: (value?: string) => boolean;
1541
+ /** Ends editing without saving. */
1542
+ cancel: () => boolean;
1543
+ /** Returns focus to the built-in input. */
1544
+ focus: () => boolean;
1545
+ }
1546
+ interface XlsxCellEditorOverlayRenderProps extends XlsxCellEditorSession {
1547
+ /** The live editor element, for anchoring and scoped visual effects. */
1548
+ editorElement: HTMLDivElement;
1549
+ /** The expanded editor rectangle in viewport pixels. The overlay container already fills it. */
1550
+ rect: XlsxImageRect;
1551
+ }
1552
+ interface XlsxSelectionPopoverContext {
1553
+ cell: XlsxCellAddress;
1554
+ selection: XlsxCellRange;
1555
+ sheetIndex: number;
1556
+ sheetName: string;
1557
+ readOnly: boolean;
1558
+ }
1559
+ interface XlsxSelectionPopoverRenderProps {
1560
+ context: XlsxSelectionPopoverContext;
1561
+ /** The visible selection rectangle in viewport pixels. The container already fills it. */
1562
+ rect: XlsxImageRect;
1563
+ /** Aborted when the selection changes, editing starts, or the popover closes. */
1564
+ signal: AbortSignal;
1565
+ /** Saves a formula in the active cell and closes. Returns false for stale or read-only selections. */
1566
+ applyFormula: (formula: string) => boolean;
1567
+ /** Runs a synchronous custom mutation for the current selection and closes. */
1568
+ commit: (apply: (context: XlsxSelectionPopoverContext) => void) => boolean;
1569
+ close: () => void;
1570
+ }
1448
1571
 
1449
1572
  type XlsxVanillaContent = Node | string | number | null;
1450
1573
  type XlsxVanillaStyle = Properties<string | number>;
@@ -1458,6 +1581,8 @@ interface XlsxVanillaContextMenuRenderProps {
1458
1581
  actions: XlsxContextMenuAction[];
1459
1582
  runAction: (actionId: XlsxContextMenuActionId) => Promise<boolean>;
1460
1583
  closeMenu: () => void;
1584
+ signal: AbortSignal;
1585
+ commit: (apply: (context: XlsxContextMenuContext) => void) => boolean;
1461
1586
  position: {
1462
1587
  x: number;
1463
1588
  y: number;
@@ -1540,6 +1665,9 @@ interface XlsxVanillaViewerOptions extends UseXlsxViewerControllerOptions {
1540
1665
  selectionFillColor?: string;
1541
1666
  selectionHeaderColor?: string;
1542
1667
  renderActiveCellOverlay?: (props: XlsxActiveCellOverlayRenderProps) => XlsxVanillaContent;
1668
+ cellEditorStyle?: XlsxVanillaStyle;
1669
+ renderCellEditorOverlay?: (props: XlsxCellEditorOverlayRenderProps) => XlsxVanillaContent;
1670
+ renderSelectionPopover?: (props: XlsxSelectionPopoverRenderProps) => XlsxVanillaContent;
1543
1671
  showImages?: boolean;
1544
1672
  showDefaultToolbar?: boolean;
1545
1673
  toolbar?: XlsxVanillaContent | ((controller: XlsxViewerController) => XlsxVanillaContent);
@@ -1589,4 +1717,4 @@ declare function __createContentRoot(container: Element): {
1589
1717
  destroy(): void;
1590
1718
  };
1591
1719
 
1592
- export { type XlsxFormControlState as $, type XlsxClipboardData as A, type XlsxConditionalColorScaleRule as B, type XlsxConditionalDataBarRule as C, type XlsxConditionalFormatIcon as D, type XlsxConditionalFormatRule as E, type XlsxConditionalFormatValueObject as F, type XlsxConditionalIconSetRule as G, type XlsxConditionalStyledRule as H, type XlsxContextMenuAction as I, type XlsxContextMenuActionId as J, type XlsxContextMenuContext as K, type XlsxDataValidation as L, type XlsxDrawingLayout as M, XlsxFileSizeLimitExceededError as N, type XlsxFormControl as O, type XlsxFormControlActionEvent as P, type XlsxFormControlCaption as Q, type XlsxFormControlCaptionInput as R, type XlsxFormControlCaptionRun as S, type XlsxFormControlChangeEvent as T, type UseXlsxViewerControllerOptions as U, type XlsxFormControlInput as V, type XlsxFormControlKind as W, type XlsxParsedRange as X, type XlsxFormControlKindInput as Y, type XlsxFormControlPatch as Z, type XlsxFormControlSelectionMode as _, type UseXlsxViewerThumbnailsOptions as a, type XlsxFormulaTarget as a0, type XlsxFreezePanes as a1, type XlsxHighlightRangeOptions as a2, type XlsxImage as a3, type XlsxImageAnchor as a4, type XlsxImageMarker as a5, type XlsxImageRect as a6, type XlsxImageResizeHandlePosition as a7, type XlsxMergeMode as a8, type XlsxRangeHighlight as a9, type XlsxVanillaStyle as aA, type XlsxVanillaViewer as aB, type XlsxVanillaViewerOptions as aC, XlsxViewer as aD, type XlsxViewerCharts as aE, type XlsxViewerController as aF, type XlsxViewerEditing as aG, type XlsxViewerImages as aH, type XlsxViewerSelection as aI, type XlsxViewerTables as aJ, type XlsxViewerThumbnails as aK, type XlsxViewerZoom as aL, type XlsxWasmSource as aM, type XlsxWorkbookTab as aN, createXlsxViewer as aO, initWasm as aP, setWasmSource as aQ, type WorkerWasmSource as aR, __createContentNode as aS, __createContentRoot as aT, __createControlledViewer as aU, canUseConfiguredWasmSourceInWorker as aV, formatBinaryBytes as aW, getConfiguredWorkerWasmSource as aX, getSheetsWasmModule as aY, type XlsxResolvedCellStyle as aa, type XlsxShape as ab, type XlsxShapeFill as ac, type XlsxShapeParagraph as ad, type XlsxShapeStroke as ae, type XlsxShapeTextBox as af, type XlsxShapeTextRun as ag, type XlsxSheetData as ah, type XlsxSheetThumbnail as ai, type XlsxSheetThumbnailResolution as aj, type XlsxSheetVisibility as ak, type XlsxSparkline as al, type XlsxTable as am, type XlsxTableColumn as an, type XlsxTableSortDirection as ao, type XlsxTableSortState as ap, type XlsxTableStyleDefinition as aq, type XlsxTableStyleInfo as ar, type XlsxThemePalette as as, type XlsxVanillaCellStyleContext as at, type XlsxVanillaChartLoadingRenderProps as au, type XlsxVanillaContent as av, type XlsxVanillaContextMenuRenderProps as aw, type XlsxVanillaFileTooLargeRenderProps as ax, type XlsxVanillaFormControlRenderProps as ay, type XlsxVanillaImageRenderProps as az, type XlsxActiveCellOverlayRenderProps as b, type XlsxCellAddress as c, type XlsxCellAlignmentInput as d, type XlsxCellBorderEdgeInput as e, type XlsxCellBorderStyleInput as f, type XlsxCellFillStyleInput as g, type XlsxCellFontStyleInput as h, type XlsxCellGradientStopInput as i, type XlsxCellNumberFormatInput as j, type XlsxCellProtectionInput as k, type XlsxCellRange as l, type XlsxCellStyleColorInput as m, type XlsxCellStyleInput as n, type XlsxChart as o, type XlsxChartAxis as p, type XlsxChartDataLabels as q, type XlsxChartElementSelection as r, type XlsxChartLegend as s, type XlsxChartPointDataLabel as t, type XlsxChartPointStyle as u, type XlsxChartReference as v, type XlsxChartSeries as w, type XlsxChartTypeGroup as x, type XlsxChartWall as y, type XlsxChartsheet as z };
1720
+ export { type XlsxFormControlKindInput as $, type XlsxChartTypeGroup as A, type XlsxChartWall as B, type XlsxChartsheet as C, type XlsxClipboardData as D, type XlsxConditionalColorScaleRule as E, type XlsxConditionalDataBarRule as F, type XlsxConditionalFormatIcon as G, type XlsxConditionalFormatRule as H, type XlsxConditionalFormatValueObject as I, type XlsxConditionalIconSetRule as J, type XlsxConditionalStyledRule as K, type XlsxContextMenuAction as L, type XlsxContextMenuActionId as M, type XlsxContextMenuContext as N, type XlsxDataValidation as O, type XlsxDrawingLayout as P, XlsxFileSizeLimitExceededError as Q, type XlsxFormControl as R, type XlsxFormControlActionEvent as S, type XlsxFormControlCaption as T, type UseXlsxViewerControllerOptions as U, type XlsxFormControlCaptionInput as V, type XlsxFormControlCaptionRun as W, type XlsxParsedRange as X, type XlsxFormControlChangeEvent as Y, type XlsxFormControlInput as Z, type XlsxFormControlKind as _, type UseXlsxViewerThumbnailsOptions as a, canUseConfiguredWasmSourceInWorker as a$, type XlsxFormControlPatch as a0, type XlsxFormControlSelectionMode as a1, type XlsxFormControlState as a2, type XlsxFormulaTarget as a3, type XlsxFreezePanes as a4, type XlsxHighlightRangeOptions as a5, type XlsxImage as a6, type XlsxImageAnchor as a7, type XlsxImageMarker as a8, type XlsxImageRect as a9, type XlsxVanillaContent as aA, type XlsxVanillaContextMenuRenderProps as aB, type XlsxVanillaFileTooLargeRenderProps as aC, type XlsxVanillaFormControlRenderProps as aD, type XlsxVanillaImageRenderProps as aE, type XlsxVanillaStyle as aF, type XlsxVanillaViewer as aG, type XlsxVanillaViewerOptions as aH, XlsxViewer as aI, type XlsxViewerCharts as aJ, type XlsxViewerController as aK, type XlsxViewerEditing as aL, type XlsxViewerImages as aM, type XlsxViewerMessages as aN, type XlsxViewerSelection as aO, type XlsxViewerTables as aP, type XlsxViewerThumbnails as aQ, type XlsxViewerZoom as aR, type XlsxWasmSource as aS, type XlsxWorkbookTab as aT, createXlsxViewer as aU, initWasm as aV, setWasmSource as aW, type WorkerWasmSource as aX, __createContentNode as aY, __createContentRoot as aZ, __createControlledViewer as a_, type XlsxImageResizeHandlePosition as aa, type XlsxMergeMode as ab, type XlsxRangeHighlight as ac, type XlsxResolvedCellStyle as ad, type XlsxSelectionPopoverContext as ae, type XlsxSelectionPopoverRenderProps as af, type XlsxShape as ag, type XlsxShapeFill as ah, type XlsxShapeParagraph as ai, type XlsxShapeStroke as aj, type XlsxShapeTextBox as ak, type XlsxShapeTextRun as al, type XlsxSheetData as am, type XlsxSheetThumbnail as an, type XlsxSheetThumbnailResolution as ao, type XlsxSheetVisibility as ap, type XlsxSparkline as aq, type XlsxTable as ar, type XlsxTableColumn as as, type XlsxTableSortDirection as at, type XlsxTableSortState as au, type XlsxTableStyleDefinition as av, type XlsxTableStyleInfo as aw, type XlsxThemePalette as ax, type XlsxVanillaCellStyleContext as ay, type XlsxVanillaChartLoadingRenderProps as az, type XlsxActiveCellOverlayRenderProps as b, formatBinaryBytes as b0, getConfiguredWorkerWasmSource as b1, getSheetsWasmModule as b2, type XlsxCellAddress as c, type XlsxCellAlignmentInput as d, type XlsxCellBorderEdgeInput as e, type XlsxCellBorderStyleInput as f, type XlsxCellEditorContext as g, type XlsxCellEditorOverlayRenderProps as h, type XlsxCellEditorSession as i, type XlsxCellFillStyleInput as j, type XlsxCellFontStyleInput as k, type XlsxCellGradientStopInput as l, type XlsxCellNumberFormatInput as m, type XlsxCellProtectionInput as n, type XlsxCellRange as o, type XlsxCellStyleColorInput as p, type XlsxCellStyleInput as q, type XlsxChart as r, type XlsxChartAxis as s, type XlsxChartDataLabels as t, type XlsxChartElementSelection as u, type XlsxChartLegend as v, type XlsxChartPointDataLabel as w, type XlsxChartPointStyle as x, type XlsxChartReference as y, type XlsxChartSeries as z };
package/dist/internal.cjs CHANGED
@@ -7,8 +7,8 @@
7
7
 
8
8
 
9
9
 
10
- var _chunkSXHHFUXAcjs = require('./chunk-SXHHFUXA.cjs');
11
- require('./chunk-OGZ6ROZC.cjs');
10
+ var _chunk7IL4KLCDcjs = require('./chunk-7IL4KLCD.cjs');
11
+ require('./chunk-A3S3QKJN.cjs');
12
12
  require('./chunk-AD4CGQN2.cjs');
13
13
 
14
14
 
@@ -19,5 +19,5 @@ require('./chunk-AD4CGQN2.cjs');
19
19
 
20
20
 
21
21
 
22
- exports.XlsxFileSizeLimitExceededError = _chunkSXHHFUXAcjs.XlsxFileSizeLimitExceededError; exports.__createContentNode = _chunkSXHHFUXAcjs.__createContentNode; exports.__createContentRoot = _chunkSXHHFUXAcjs.__createContentRoot; exports.__createControlledViewer = _chunkSXHHFUXAcjs.__createControlledViewer; exports.canUseConfiguredWasmSourceInWorker = _chunkSXHHFUXAcjs.canUseConfiguredWasmSourceInWorker; exports.formatBinaryBytes = _chunkSXHHFUXAcjs.formatBinaryBytes; exports.getConfiguredWorkerWasmSource = _chunkSXHHFUXAcjs.getConfiguredWorkerWasmSource; exports.getSheetsWasmModule = _chunkSXHHFUXAcjs.getSheetsWasmModule;
22
+ exports.XlsxFileSizeLimitExceededError = _chunk7IL4KLCDcjs.XlsxFileSizeLimitExceededError; exports.__createContentNode = _chunk7IL4KLCDcjs.__createContentNode; exports.__createContentRoot = _chunk7IL4KLCDcjs.__createContentRoot; exports.__createControlledViewer = _chunk7IL4KLCDcjs.__createControlledViewer; exports.canUseConfiguredWasmSourceInWorker = _chunk7IL4KLCDcjs.canUseConfiguredWasmSourceInWorker; exports.formatBinaryBytes = _chunk7IL4KLCDcjs.formatBinaryBytes; exports.getConfiguredWorkerWasmSource = _chunk7IL4KLCDcjs.getConfiguredWorkerWasmSource; exports.getSheetsWasmModule = _chunk7IL4KLCDcjs.getSheetsWasmModule;
23
23
  //# sourceMappingURL=internal.cjs.map
@@ -1,3 +1,3 @@
1
- export { aR as WorkerWasmSource, N as XlsxFileSizeLimitExceededError, aS as __createContentNode, aT as __createContentRoot, aU as __createControlledViewer, aV as canUseConfiguredWasmSourceInWorker, aW as formatBinaryBytes, aX as getConfiguredWorkerWasmSource, aY as getSheetsWasmModule } from './internal-BBaC9yCh.cjs';
1
+ export { aX as WorkerWasmSource, Q as XlsxFileSizeLimitExceededError, aY as __createContentNode, aZ as __createContentRoot, a_ as __createControlledViewer, a$ as canUseConfiguredWasmSourceInWorker, b0 as formatBinaryBytes, b1 as getConfiguredWorkerWasmSource, b2 as getSheetsWasmModule } from './internal-BO70EPFy.cjs';
2
2
  import '@dukelib/sheets-wasm';
3
3
  import 'csstype';
@@ -1,3 +1,3 @@
1
- export { aR as WorkerWasmSource, N as XlsxFileSizeLimitExceededError, aS as __createContentNode, aT as __createContentRoot, aU as __createControlledViewer, aV as canUseConfiguredWasmSourceInWorker, aW as formatBinaryBytes, aX as getConfiguredWorkerWasmSource, aY as getSheetsWasmModule } from './internal-BBaC9yCh.js';
1
+ export { aX as WorkerWasmSource, Q as XlsxFileSizeLimitExceededError, aY as __createContentNode, aZ as __createContentRoot, a_ as __createControlledViewer, a$ as canUseConfiguredWasmSourceInWorker, b0 as formatBinaryBytes, b1 as getConfiguredWorkerWasmSource, b2 as getSheetsWasmModule } from './internal-BO70EPFy.js';
2
2
  import '@dukelib/sheets-wasm';
3
3
  import 'csstype';
package/dist/internal.js CHANGED
@@ -7,8 +7,8 @@ import {
7
7
  formatBinaryBytes,
8
8
  getConfiguredWorkerWasmSource,
9
9
  getSheetsWasmModule
10
- } from "./chunk-VSM7WKLM.js";
11
- import "./chunk-CVMHJO5H.js";
10
+ } from "./chunk-2UFSVI5Z.js";
11
+ import "./chunk-WHTV6N6S.js";
12
12
  export {
13
13
  XlsxFileSizeLimitExceededError,
14
14
  __createContentNode,
@@ -5,8 +5,9 @@ import {
5
5
  g,
6
6
  officeFontFallback,
7
7
  q,
8
- u
9
- } from "./chunk-CVMHJO5H.js";
8
+ u,
9
+ useXlsxMessages
10
+ } from "./chunk-WHTV6N6S.js";
10
11
 
11
12
  // src/chart-data-projection.ts
12
13
  var chartNamespace = "http://schemas.openxmlformats.org/drawingml/2006/chart";
@@ -824,6 +825,7 @@ function renderSharedChart(renderer, chart, source, width, height, prefix) {
824
825
  }
825
826
  }
826
827
  function SharedChartSvg(props) {
828
+ const messages = useXlsxMessages();
827
829
  const { chart, rect, renderer, source, selectedChartElement, fallback } = props;
828
830
  const id = g();
829
831
  const width = Math.max(1, rect.width);
@@ -858,7 +860,7 @@ function SharedChartSvg(props) {
858
860
  return /* @__PURE__ */ u(
859
861
  "svg",
860
862
  {
861
- "aria-label": chart.title ?? chart.name ?? "Chart",
863
+ "aria-label": chart.title ?? chart.name ?? messages.chart,
862
864
  "data-xlsx-chart-renderer": "office-charts",
863
865
  onDoubleClick: handleDoubleClick,
864
866
  onPointerDown: handlePointerDown,
@@ -872,4 +874,4 @@ function SharedChartSvg(props) {
872
874
  export {
873
875
  SharedChartSvg
874
876
  };
875
- //# sourceMappingURL=shared-chart-XOCTF7KQ.js.map
877
+ //# sourceMappingURL=shared-chart-7RUN5IKZ.js.map