@extend-ai/react-xlsx 0.17.2 → 0.18.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/dist/index.d.cts CHANGED
@@ -1245,6 +1245,39 @@ interface XlsxViewerZoom {
1245
1245
  zoomOut: () => void;
1246
1246
  zoomScale: number;
1247
1247
  }
1248
+ type XlsxContextMenuActionId = "cut" | "copy" | "paste" | "clearContents" | "editCell" | "undo" | "redo" | "mergeCells" | "unmergeCells" | "sortAscending" | "sortDescending" | "selectRow" | "selectColumn" | "selectAll";
1249
+ interface XlsxContextMenuAction {
1250
+ id: XlsxContextMenuActionId;
1251
+ label: string;
1252
+ shortcut?: string;
1253
+ disabled?: boolean;
1254
+ destructive?: boolean;
1255
+ separatorBefore?: boolean;
1256
+ }
1257
+ interface XlsxContextMenuContext {
1258
+ kind: "cell" | "row" | "column" | "sheet";
1259
+ cell: XlsxCellAddress;
1260
+ selection: XlsxCellRange;
1261
+ sheetIndex: number;
1262
+ sheetName: string;
1263
+ readOnly: boolean;
1264
+ }
1265
+ interface XlsxContextMenuRenderProps {
1266
+ context: XlsxContextMenuContext;
1267
+ actions: XlsxContextMenuAction[];
1268
+ /** Returns whether the command completed; failures remain visible in the menu. */
1269
+ runAction: (actionId: XlsxContextMenuActionId) => Promise<boolean>;
1270
+ closeMenu: () => void;
1271
+ /** Viewport coordinates. The menu container handles positioning and edge clamping. */
1272
+ position: {
1273
+ x: number;
1274
+ y: number;
1275
+ };
1276
+ isDark: boolean;
1277
+ busy: boolean;
1278
+ error: string | null;
1279
+ defaultNode: React.ReactNode;
1280
+ }
1248
1281
  interface XlsxViewerEditing {
1249
1282
  addSheet: (name?: string) => void;
1250
1283
  addFormControl: (input: XlsxFormControlInput, sheetIndex?: number) => number | null;
@@ -1588,6 +1621,16 @@ interface XlsxViewerProps extends UseXlsxViewerControllerOptions {
1588
1621
  onFormControlChange?: (event: XlsxFormControlChangeEvent) => void;
1589
1622
  /** Replaces the chart loading placeholder. */
1590
1623
  renderChartLoading?: (props: XlsxChartLoadingRenderProps) => React.ReactNode;
1624
+ /** Replaces menu contents. Use runAction for built-in commands and closeMenu after custom commands. */
1625
+ renderContextMenu?: (props: XlsxContextMenuRenderProps) => React.ReactNode;
1626
+ /** Enables worksheet right-click and keyboard context menus. Defaults to true. */
1627
+ enableContextMenu?: boolean;
1628
+ /** Class applied to the portaled menu container. */
1629
+ contextMenuClassName?: string;
1630
+ /** Styles applied to the portaled menu container. */
1631
+ contextMenuStyle?: React.CSSProperties & {
1632
+ [property: `--${string}`]: string | number | undefined;
1633
+ };
1591
1634
  /**
1592
1635
  * Replaces built-in worksheet form-control rendering.
1593
1636
  * Apply `style` to the custom root and use `stopPropagation` on pointer/click handlers.
@@ -1719,4 +1762,4 @@ declare function useXlsxViewerThumbnails(options?: UseXlsxViewerThumbnailsOption
1719
1762
  declare function XlsxViewer(props: XlsxViewerProps): react_jsx_runtime.JSX.Element;
1720
1763
  declare function DefaultXlsxToolbar(): react_jsx_runtime.JSX.Element;
1721
1764
 
1722
- export { DefaultXlsxToolbar, type UseXlsxViewerControllerOptions, type UseXlsxViewerThumbnailsOptions, type XlsxActiveCellOverlayRenderProps, 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 XlsxChartElementSelection, type XlsxChartLoadingRenderProps, type XlsxChartReference, type XlsxChartSeries, type XlsxChartsheet, type XlsxDrawingLayout, XlsxFileSizeLimitExceededError, type XlsxFileTooLargeRenderProps, type XlsxFormControl, type XlsxFormControlActionEvent, type XlsxFormControlCaption, type XlsxFormControlCaptionInput, type XlsxFormControlCaptionRun, type XlsxFormControlChangeEvent, type XlsxFormControlInput, type XlsxFormControlKind, type XlsxFormControlKindInput, type XlsxFormControlPatch, type XlsxFormControlRenderProps, type XlsxFormControlSelectionMode, type XlsxFormControlState, type XlsxFormulaTarget, type XlsxHighlightRangeOptions, type XlsxImage, type XlsxImageAnchor, type XlsxImageRect, type XlsxImageRenderProps, type XlsxImageResizeHandlePosition, type XlsxImageSelectionRenderProps, type XlsxParsedRange, type XlsxRangeHighlight, 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, parseXlsxRange, setWasmSource, useXlsxViewer, useXlsxViewerCharts, useXlsxViewerController, useXlsxViewerEditing, useXlsxViewerImages, useXlsxViewerSelection, useXlsxViewerTables, useXlsxViewerThumbnails, useXlsxViewerZoom };
1765
+ export { DefaultXlsxToolbar, type UseXlsxViewerControllerOptions, type UseXlsxViewerThumbnailsOptions, type XlsxActiveCellOverlayRenderProps, 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 XlsxChartElementSelection, type XlsxChartLoadingRenderProps, type XlsxChartReference, type XlsxChartSeries, type XlsxChartsheet, type XlsxContextMenuAction, type XlsxContextMenuActionId, type XlsxContextMenuContext, type XlsxContextMenuRenderProps, type XlsxDrawingLayout, XlsxFileSizeLimitExceededError, type XlsxFileTooLargeRenderProps, type XlsxFormControl, type XlsxFormControlActionEvent, type XlsxFormControlCaption, type XlsxFormControlCaptionInput, type XlsxFormControlCaptionRun, type XlsxFormControlChangeEvent, type XlsxFormControlInput, type XlsxFormControlKind, type XlsxFormControlKindInput, type XlsxFormControlPatch, type XlsxFormControlRenderProps, type XlsxFormControlSelectionMode, type XlsxFormControlState, type XlsxFormulaTarget, type XlsxHighlightRangeOptions, type XlsxImage, type XlsxImageAnchor, type XlsxImageRect, type XlsxImageRenderProps, type XlsxImageResizeHandlePosition, type XlsxImageSelectionRenderProps, type XlsxParsedRange, type XlsxRangeHighlight, 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, parseXlsxRange, setWasmSource, useXlsxViewer, useXlsxViewerCharts, useXlsxViewerController, useXlsxViewerEditing, useXlsxViewerImages, useXlsxViewerSelection, useXlsxViewerTables, useXlsxViewerThumbnails, useXlsxViewerZoom };
package/dist/index.d.ts CHANGED
@@ -1245,6 +1245,39 @@ interface XlsxViewerZoom {
1245
1245
  zoomOut: () => void;
1246
1246
  zoomScale: number;
1247
1247
  }
1248
+ type XlsxContextMenuActionId = "cut" | "copy" | "paste" | "clearContents" | "editCell" | "undo" | "redo" | "mergeCells" | "unmergeCells" | "sortAscending" | "sortDescending" | "selectRow" | "selectColumn" | "selectAll";
1249
+ interface XlsxContextMenuAction {
1250
+ id: XlsxContextMenuActionId;
1251
+ label: string;
1252
+ shortcut?: string;
1253
+ disabled?: boolean;
1254
+ destructive?: boolean;
1255
+ separatorBefore?: boolean;
1256
+ }
1257
+ interface XlsxContextMenuContext {
1258
+ kind: "cell" | "row" | "column" | "sheet";
1259
+ cell: XlsxCellAddress;
1260
+ selection: XlsxCellRange;
1261
+ sheetIndex: number;
1262
+ sheetName: string;
1263
+ readOnly: boolean;
1264
+ }
1265
+ interface XlsxContextMenuRenderProps {
1266
+ context: XlsxContextMenuContext;
1267
+ actions: XlsxContextMenuAction[];
1268
+ /** Returns whether the command completed; failures remain visible in the menu. */
1269
+ runAction: (actionId: XlsxContextMenuActionId) => Promise<boolean>;
1270
+ closeMenu: () => void;
1271
+ /** Viewport coordinates. The menu container handles positioning and edge clamping. */
1272
+ position: {
1273
+ x: number;
1274
+ y: number;
1275
+ };
1276
+ isDark: boolean;
1277
+ busy: boolean;
1278
+ error: string | null;
1279
+ defaultNode: React.ReactNode;
1280
+ }
1248
1281
  interface XlsxViewerEditing {
1249
1282
  addSheet: (name?: string) => void;
1250
1283
  addFormControl: (input: XlsxFormControlInput, sheetIndex?: number) => number | null;
@@ -1588,6 +1621,16 @@ interface XlsxViewerProps extends UseXlsxViewerControllerOptions {
1588
1621
  onFormControlChange?: (event: XlsxFormControlChangeEvent) => void;
1589
1622
  /** Replaces the chart loading placeholder. */
1590
1623
  renderChartLoading?: (props: XlsxChartLoadingRenderProps) => React.ReactNode;
1624
+ /** Replaces menu contents. Use runAction for built-in commands and closeMenu after custom commands. */
1625
+ renderContextMenu?: (props: XlsxContextMenuRenderProps) => React.ReactNode;
1626
+ /** Enables worksheet right-click and keyboard context menus. Defaults to true. */
1627
+ enableContextMenu?: boolean;
1628
+ /** Class applied to the portaled menu container. */
1629
+ contextMenuClassName?: string;
1630
+ /** Styles applied to the portaled menu container. */
1631
+ contextMenuStyle?: React.CSSProperties & {
1632
+ [property: `--${string}`]: string | number | undefined;
1633
+ };
1591
1634
  /**
1592
1635
  * Replaces built-in worksheet form-control rendering.
1593
1636
  * Apply `style` to the custom root and use `stopPropagation` on pointer/click handlers.
@@ -1719,4 +1762,4 @@ declare function useXlsxViewerThumbnails(options?: UseXlsxViewerThumbnailsOption
1719
1762
  declare function XlsxViewer(props: XlsxViewerProps): react_jsx_runtime.JSX.Element;
1720
1763
  declare function DefaultXlsxToolbar(): react_jsx_runtime.JSX.Element;
1721
1764
 
1722
- export { DefaultXlsxToolbar, type UseXlsxViewerControllerOptions, type UseXlsxViewerThumbnailsOptions, type XlsxActiveCellOverlayRenderProps, 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 XlsxChartElementSelection, type XlsxChartLoadingRenderProps, type XlsxChartReference, type XlsxChartSeries, type XlsxChartsheet, type XlsxDrawingLayout, XlsxFileSizeLimitExceededError, type XlsxFileTooLargeRenderProps, type XlsxFormControl, type XlsxFormControlActionEvent, type XlsxFormControlCaption, type XlsxFormControlCaptionInput, type XlsxFormControlCaptionRun, type XlsxFormControlChangeEvent, type XlsxFormControlInput, type XlsxFormControlKind, type XlsxFormControlKindInput, type XlsxFormControlPatch, type XlsxFormControlRenderProps, type XlsxFormControlSelectionMode, type XlsxFormControlState, type XlsxFormulaTarget, type XlsxHighlightRangeOptions, type XlsxImage, type XlsxImageAnchor, type XlsxImageRect, type XlsxImageRenderProps, type XlsxImageResizeHandlePosition, type XlsxImageSelectionRenderProps, type XlsxParsedRange, type XlsxRangeHighlight, 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, parseXlsxRange, setWasmSource, useXlsxViewer, useXlsxViewerCharts, useXlsxViewerController, useXlsxViewerEditing, useXlsxViewerImages, useXlsxViewerSelection, useXlsxViewerTables, useXlsxViewerThumbnails, useXlsxViewerZoom };
1765
+ export { DefaultXlsxToolbar, type UseXlsxViewerControllerOptions, type UseXlsxViewerThumbnailsOptions, type XlsxActiveCellOverlayRenderProps, 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 XlsxChartElementSelection, type XlsxChartLoadingRenderProps, type XlsxChartReference, type XlsxChartSeries, type XlsxChartsheet, type XlsxContextMenuAction, type XlsxContextMenuActionId, type XlsxContextMenuContext, type XlsxContextMenuRenderProps, type XlsxDrawingLayout, XlsxFileSizeLimitExceededError, type XlsxFileTooLargeRenderProps, type XlsxFormControl, type XlsxFormControlActionEvent, type XlsxFormControlCaption, type XlsxFormControlCaptionInput, type XlsxFormControlCaptionRun, type XlsxFormControlChangeEvent, type XlsxFormControlInput, type XlsxFormControlKind, type XlsxFormControlKindInput, type XlsxFormControlPatch, type XlsxFormControlRenderProps, type XlsxFormControlSelectionMode, type XlsxFormControlState, type XlsxFormulaTarget, type XlsxHighlightRangeOptions, type XlsxImage, type XlsxImageAnchor, type XlsxImageRect, type XlsxImageRenderProps, type XlsxImageResizeHandlePosition, type XlsxImageSelectionRenderProps, type XlsxParsedRange, type XlsxRangeHighlight, 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, parseXlsxRange, setWasmSource, useXlsxViewer, useXlsxViewerCharts, useXlsxViewerController, useXlsxViewerEditing, useXlsxViewerImages, useXlsxViewerSelection, useXlsxViewerTables, useXlsxViewerThumbnails, useXlsxViewerZoom };