@extend-ai/react-xlsx 0.13.4 → 0.14.1
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 +47 -0
- package/dist/duke_sheets_wasm_bg.wasm +0 -0
- package/dist/index.cjs +1060 -212
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +173 -1
- package/dist/index.d.ts +173 -1
- package/dist/index.js +1060 -212
- package/dist/index.js.map +1 -1
- package/dist/xlsx-worker.js +187 -0
- package/dist/xlsx-worker.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -439,23 +439,171 @@ interface XlsxShape {
|
|
|
439
439
|
zIndex: number;
|
|
440
440
|
}
|
|
441
441
|
type XlsxFormControlKind = "button" | "checkbox" | "dropdown" | "editbox" | "group-box" | "label" | "listbox" | "radio" | "scrollbar" | "spinner" | "unknown";
|
|
442
|
+
type XlsxFormControlState = "unchecked" | "checked" | "mixed";
|
|
443
|
+
type XlsxFormControlSelectionMode = "single" | "multi" | "extend";
|
|
444
|
+
/** Duke Sheets' flat worksheet anchor used when creating or updating form controls. */
|
|
445
|
+
interface XlsxFormControlAnchor {
|
|
446
|
+
editAs: "twoCell" | "oneCell" | "absolute";
|
|
447
|
+
fromCol: number;
|
|
448
|
+
fromColOffset: number;
|
|
449
|
+
fromRow: number;
|
|
450
|
+
fromRowOffset: number;
|
|
451
|
+
toCol: number;
|
|
452
|
+
toColOffset: number;
|
|
453
|
+
toRow: number;
|
|
454
|
+
toRowOffset: number;
|
|
455
|
+
}
|
|
456
|
+
/** Kind-specific input accepted by Duke Sheets for form-control mutations. */
|
|
457
|
+
type XlsxFormControlKindInput = {
|
|
458
|
+
kind: "button";
|
|
459
|
+
caption: string;
|
|
460
|
+
} | {
|
|
461
|
+
kind: "checkbox";
|
|
462
|
+
caption: string;
|
|
463
|
+
state: XlsxFormControlState;
|
|
464
|
+
cellLink?: string;
|
|
465
|
+
no3D: boolean;
|
|
466
|
+
} | {
|
|
467
|
+
kind: "optionButton";
|
|
468
|
+
caption: string;
|
|
469
|
+
state: Exclude<XlsxFormControlState, "mixed">;
|
|
470
|
+
cellLink?: string;
|
|
471
|
+
firstInGroup?: boolean;
|
|
472
|
+
no3D: boolean;
|
|
473
|
+
} | {
|
|
474
|
+
kind: "label";
|
|
475
|
+
caption: string;
|
|
476
|
+
} | {
|
|
477
|
+
kind: "groupBox";
|
|
478
|
+
caption: string;
|
|
479
|
+
no3D: boolean;
|
|
480
|
+
} | {
|
|
481
|
+
kind: "listBox";
|
|
482
|
+
inputRange?: string;
|
|
483
|
+
cellLink?: string;
|
|
484
|
+
selection: XlsxFormControlSelectionMode;
|
|
485
|
+
selected: number[];
|
|
486
|
+
no3D: boolean;
|
|
487
|
+
} | {
|
|
488
|
+
kind: "dropdown";
|
|
489
|
+
inputRange?: string;
|
|
490
|
+
cellLink?: string;
|
|
491
|
+
selected?: number;
|
|
492
|
+
lines: number;
|
|
493
|
+
no3D: boolean;
|
|
494
|
+
} | {
|
|
495
|
+
kind: "scrollbar";
|
|
496
|
+
value: number;
|
|
497
|
+
min: number;
|
|
498
|
+
max: number;
|
|
499
|
+
increment: number;
|
|
500
|
+
page: number;
|
|
501
|
+
horizontal: boolean;
|
|
502
|
+
cellLink?: string;
|
|
503
|
+
} | {
|
|
504
|
+
kind: "spinner";
|
|
505
|
+
value: number;
|
|
506
|
+
min: number;
|
|
507
|
+
max: number;
|
|
508
|
+
increment: number;
|
|
509
|
+
cellLink?: string;
|
|
510
|
+
};
|
|
511
|
+
/** Complete Duke Sheets input for adding a worksheet form control. */
|
|
512
|
+
interface XlsxFormControlInput {
|
|
513
|
+
anchor: XlsxFormControlAnchor;
|
|
514
|
+
kind: XlsxFormControlKindInput;
|
|
515
|
+
locked?: boolean;
|
|
516
|
+
name?: string;
|
|
517
|
+
printable?: boolean;
|
|
518
|
+
}
|
|
519
|
+
/** Partial Duke Sheets input for changing an existing worksheet form control. */
|
|
520
|
+
type XlsxFormControlPatch = Partial<Omit<XlsxFormControlInput, "kind">> & {
|
|
521
|
+
kind?: XlsxFormControlKindInput;
|
|
522
|
+
};
|
|
442
523
|
interface XlsxFormControl {
|
|
443
524
|
anchor: XlsxImageAnchor;
|
|
525
|
+
/** Original Excel caption reported by Duke Sheets. */
|
|
526
|
+
caption?: string;
|
|
444
527
|
checked?: boolean;
|
|
528
|
+
/** Duke Sheets' stable zero-based index for this worksheet load. */
|
|
529
|
+
controlIndex?: number;
|
|
530
|
+
/** Original anchor behavior when Duke has flattened the anchor to two-cell coordinates. */
|
|
531
|
+
editAs?: "twoCell" | "oneCell" | "absolute";
|
|
532
|
+
/** Exact Duke Sheets anchor. Use this when cloning or updating the control through the controller. */
|
|
533
|
+
dukeAnchor?: XlsxFormControlAnchor;
|
|
534
|
+
firstInGroup?: boolean;
|
|
445
535
|
fontFamily?: string;
|
|
446
536
|
fontSizePt?: number;
|
|
447
537
|
hidden?: boolean;
|
|
538
|
+
horizontal?: boolean;
|
|
448
539
|
id: string;
|
|
540
|
+
increment?: number;
|
|
541
|
+
inputRange?: string;
|
|
542
|
+
/** Current formatted labels resolved from a dropdown or list box input range. */
|
|
543
|
+
items?: string[];
|
|
449
544
|
kind: XlsxFormControlKind;
|
|
450
545
|
label?: string;
|
|
546
|
+
lines?: number;
|
|
451
547
|
linkedCell?: string;
|
|
548
|
+
locked?: boolean;
|
|
549
|
+
max?: number;
|
|
550
|
+
min?: number;
|
|
452
551
|
name?: string;
|
|
552
|
+
no3D?: boolean;
|
|
553
|
+
page?: number;
|
|
554
|
+
printable?: boolean;
|
|
555
|
+
/** Zero-based selected item index or indexes, matching Duke Sheets. */
|
|
556
|
+
selected?: number | number[];
|
|
557
|
+
selection?: XlsxFormControlSelectionMode;
|
|
453
558
|
sheetIndex: number;
|
|
559
|
+
state?: XlsxFormControlState;
|
|
454
560
|
textAlign?: "center" | "left" | "right";
|
|
455
561
|
textColor?: string;
|
|
562
|
+
value?: number;
|
|
456
563
|
workbookSheetIndex: number;
|
|
457
564
|
zIndex: number;
|
|
458
565
|
}
|
|
566
|
+
interface XlsxFormControlActionEvent {
|
|
567
|
+
control: XlsxFormControl;
|
|
568
|
+
type: "activate";
|
|
569
|
+
}
|
|
570
|
+
interface XlsxFormControlChangeEvent {
|
|
571
|
+
control: XlsxFormControl;
|
|
572
|
+
previousControl: XlsxFormControl;
|
|
573
|
+
type: "change";
|
|
574
|
+
}
|
|
575
|
+
interface XlsxFormControlRenderProps {
|
|
576
|
+
/** Activates a button control. No-ops in read-only mode. */
|
|
577
|
+
activate: () => void;
|
|
578
|
+
/** Current checked state for checkbox and radio controls. */
|
|
579
|
+
checked: boolean;
|
|
580
|
+
/** Full parsed control metadata. Switch on `control.kind` to render a kind-specific component. */
|
|
581
|
+
control: XlsxFormControl;
|
|
582
|
+
/** True when this control cannot be changed through the viewer. */
|
|
583
|
+
disabled: boolean;
|
|
584
|
+
/** Current formatted dropdown or list box items resolved from the control input range. */
|
|
585
|
+
items: string[];
|
|
586
|
+
/** Display label after placeholder Excel names have been removed. */
|
|
587
|
+
label: string;
|
|
588
|
+
/** True when a checkbox is in Excel's indeterminate state. */
|
|
589
|
+
mixed: boolean;
|
|
590
|
+
/** True when the viewer is rendering without workbook mutation support. */
|
|
591
|
+
readOnly: boolean;
|
|
592
|
+
/** Calculated worksheet-relative control rectangle in CSS pixels. */
|
|
593
|
+
rect: XlsxImageRect;
|
|
594
|
+
/** Persists a dropdown or list box selection. No-ops for other control kinds or in read-only mode. */
|
|
595
|
+
setSelected: (selected: number | number[] | undefined) => boolean;
|
|
596
|
+
/** Persists a checkbox or radio state. No-ops for other control kinds or in read-only mode. */
|
|
597
|
+
setState: (state: XlsxFormControlState) => boolean;
|
|
598
|
+
/** Persists a scrollbar or spinner value. No-ops for other control kinds or in read-only mode. */
|
|
599
|
+
setValue: (value: number) => boolean;
|
|
600
|
+
/** Stops an event from leaking into worksheet selection. */
|
|
601
|
+
stopPropagation: (event: React.SyntheticEvent) => void;
|
|
602
|
+
/** Apply this style to the custom control root to preserve worksheet positioning and sizing. */
|
|
603
|
+
style: React.CSSProperties;
|
|
604
|
+
/** Current worksheet zoom multiplier, where `1` is 100%. */
|
|
605
|
+
zoomFactor: number;
|
|
606
|
+
}
|
|
459
607
|
interface XlsxChartReference {
|
|
460
608
|
formula?: string;
|
|
461
609
|
refType?: string;
|
|
@@ -831,6 +979,8 @@ interface XlsxViewerController {
|
|
|
831
979
|
canUndo: boolean;
|
|
832
980
|
canZoomIn: boolean;
|
|
833
981
|
canZoomOut: boolean;
|
|
982
|
+
/** Adds a Duke-supported form control to a visible worksheet and returns its worksheet-local index. */
|
|
983
|
+
addFormControl: (input: XlsxFormControlInput, sheetIndex?: number) => number | null;
|
|
834
984
|
clearSelectedCells: () => void;
|
|
835
985
|
clearSelection: () => void;
|
|
836
986
|
continueDeferredLoad: () => void;
|
|
@@ -856,6 +1006,8 @@ interface XlsxViewerController {
|
|
|
856
1006
|
formControls: XlsxFormControl[];
|
|
857
1007
|
getSheetCharts: (sheetIndex?: number) => XlsxChart[];
|
|
858
1008
|
getSheetFormControls: (sheetIndex?: number) => XlsxFormControl[];
|
|
1009
|
+
/** Resolves a list/dropdown input range to its current formatted item labels. */
|
|
1010
|
+
getFormControlItems: (controlIndex: number, sheetIndex?: number) => string[];
|
|
859
1011
|
getImageById: (id: string) => XlsxImage | null;
|
|
860
1012
|
getSheetImages: (sheetIndex?: number) => XlsxImage[];
|
|
861
1013
|
getSheetShapes: (sheetIndex?: number) => XlsxShape[];
|
|
@@ -878,6 +1030,8 @@ interface XlsxViewerController {
|
|
|
878
1030
|
minZoomScale: number;
|
|
879
1031
|
moveImageBy: (id: string, deltaX: number, deltaY: number) => void;
|
|
880
1032
|
removeActiveSheet: () => void;
|
|
1033
|
+
/** Removes a Duke-supported control by its worksheet-local index. */
|
|
1034
|
+
removeFormControl: (controlIndex: number, sheetIndex?: number) => boolean;
|
|
881
1035
|
readOnly: boolean;
|
|
882
1036
|
recalculate: () => void;
|
|
883
1037
|
revision: number;
|
|
@@ -980,6 +1134,8 @@ interface XlsxViewerController {
|
|
|
980
1134
|
undo: () => void;
|
|
981
1135
|
unmergeSelection: () => void;
|
|
982
1136
|
updateChart: (id: string, patch: Partial<XlsxChart>) => void;
|
|
1137
|
+
/** Updates a Duke-supported control and participates in undo/redo and export. */
|
|
1138
|
+
updateFormControl: (controlIndex: number, patch: XlsxFormControlPatch, sheetIndex?: number) => boolean;
|
|
983
1139
|
workbook: Workbook | null;
|
|
984
1140
|
zoomIn: () => void;
|
|
985
1141
|
zoomOut: () => void;
|
|
@@ -1012,20 +1168,25 @@ interface XlsxViewerZoom {
|
|
|
1012
1168
|
}
|
|
1013
1169
|
interface XlsxViewerEditing {
|
|
1014
1170
|
addSheet: (name?: string) => void;
|
|
1171
|
+
addFormControl: (input: XlsxFormControlInput, sheetIndex?: number) => number | null;
|
|
1015
1172
|
canRedo: boolean;
|
|
1016
1173
|
canUndo: boolean;
|
|
1017
1174
|
clearSelectedCells: () => void;
|
|
1018
1175
|
copySelectionToClipboard: () => Promise<boolean>;
|
|
1019
1176
|
defineNamedRange: (name: string, range?: XlsxCellRange | null) => void;
|
|
1020
1177
|
fillSelection: (targetRange: XlsxCellRange) => void;
|
|
1178
|
+
formControls: XlsxFormControl[];
|
|
1021
1179
|
getClipboardData: () => XlsxClipboardData | null;
|
|
1022
1180
|
getCellDisplayValue: (cell?: XlsxCellAddress | null) => string;
|
|
1023
1181
|
getCellFormula: (cell?: XlsxCellAddress | null) => string;
|
|
1182
|
+
getFormControlItems: (controlIndex: number, sheetIndex?: number) => string[];
|
|
1183
|
+
getSheetFormControls: (sheetIndex?: number) => XlsxFormControl[];
|
|
1024
1184
|
mergeSelection: () => void;
|
|
1025
1185
|
pasteFromClipboard: () => Promise<boolean>;
|
|
1026
1186
|
pasteStructuredClipboardData: (payload: string) => boolean;
|
|
1027
1187
|
pasteText: (text: string) => boolean;
|
|
1028
1188
|
removeActiveSheet: () => void;
|
|
1189
|
+
removeFormControl: (controlIndex: number, sheetIndex?: number) => boolean;
|
|
1029
1190
|
readOnly: boolean;
|
|
1030
1191
|
redo: () => void;
|
|
1031
1192
|
selectedCellFormula: string;
|
|
@@ -1075,6 +1236,7 @@ interface XlsxViewerEditing {
|
|
|
1075
1236
|
setSelectedCellValue: (value: string) => void;
|
|
1076
1237
|
undo: () => void;
|
|
1077
1238
|
unmergeSelection: () => void;
|
|
1239
|
+
updateFormControl: (controlIndex: number, patch: XlsxFormControlPatch, sheetIndex?: number) => boolean;
|
|
1078
1240
|
}
|
|
1079
1241
|
interface XlsxViewerTables {
|
|
1080
1242
|
sortState: XlsxTableSortState | null;
|
|
@@ -1322,8 +1484,18 @@ interface XlsxViewerProps extends UseXlsxViewerControllerOptions {
|
|
|
1322
1484
|
loadingComponent?: React.ReactElement;
|
|
1323
1485
|
/** Content shown while the workbook is being parsed. */
|
|
1324
1486
|
loadingState?: React.ReactNode;
|
|
1487
|
+
/** Called when an editable button form control is activated. Duke preserves buttons but does not execute macros. */
|
|
1488
|
+
onFormControlAction?: (event: XlsxFormControlActionEvent) => void;
|
|
1489
|
+
/** Called after the built-in editor persists a checkbox, radio, list, dropdown, scrollbar, or spinner change. */
|
|
1490
|
+
onFormControlChange?: (event: XlsxFormControlChangeEvent) => void;
|
|
1325
1491
|
/** Replaces the chart loading placeholder. */
|
|
1326
1492
|
renderChartLoading?: (props: XlsxChartLoadingRenderProps) => React.ReactNode;
|
|
1493
|
+
/**
|
|
1494
|
+
* Replaces built-in worksheet form-control rendering.
|
|
1495
|
+
* Apply `style` to the custom root and use `stopPropagation` on pointer/click handlers.
|
|
1496
|
+
* The supplied setters preserve Duke mutation, linked-cell, undo/redo, and change-event behavior.
|
|
1497
|
+
*/
|
|
1498
|
+
renderFormControl?: (props: XlsxFormControlRenderProps) => React.ReactNode;
|
|
1327
1499
|
/**
|
|
1328
1500
|
* Replaces worksheet images while preserving their calculated rect and style.
|
|
1329
1501
|
*
|
|
@@ -1428,4 +1600,4 @@ declare function useXlsxViewerThumbnails(options?: UseXlsxViewerThumbnailsOption
|
|
|
1428
1600
|
declare function XlsxViewer(props: XlsxViewerProps): react_jsx_runtime.JSX.Element;
|
|
1429
1601
|
declare function DefaultXlsxToolbar(): react_jsx_runtime.JSX.Element;
|
|
1430
1602
|
|
|
1431
|
-
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 XlsxChartElementSelection, type XlsxChartLoadingRenderProps, type XlsxChartReference, type XlsxChartSeries, type XlsxChartsheet, XlsxFileSizeLimitExceededError, type XlsxFileTooLargeRenderProps, type XlsxFormulaTarget, 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 };
|
|
1603
|
+
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 XlsxChartElementSelection, type XlsxChartLoadingRenderProps, type XlsxChartReference, type XlsxChartSeries, type XlsxChartsheet, XlsxFileSizeLimitExceededError, type XlsxFileTooLargeRenderProps, type XlsxFormControl, type XlsxFormControlActionEvent, type XlsxFormControlAnchor, type XlsxFormControlChangeEvent, type XlsxFormControlInput, type XlsxFormControlKind, type XlsxFormControlKindInput, type XlsxFormControlPatch, type XlsxFormControlRenderProps, type XlsxFormControlSelectionMode, type XlsxFormControlState, type XlsxFormulaTarget, 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
|
@@ -439,23 +439,171 @@ interface XlsxShape {
|
|
|
439
439
|
zIndex: number;
|
|
440
440
|
}
|
|
441
441
|
type XlsxFormControlKind = "button" | "checkbox" | "dropdown" | "editbox" | "group-box" | "label" | "listbox" | "radio" | "scrollbar" | "spinner" | "unknown";
|
|
442
|
+
type XlsxFormControlState = "unchecked" | "checked" | "mixed";
|
|
443
|
+
type XlsxFormControlSelectionMode = "single" | "multi" | "extend";
|
|
444
|
+
/** Duke Sheets' flat worksheet anchor used when creating or updating form controls. */
|
|
445
|
+
interface XlsxFormControlAnchor {
|
|
446
|
+
editAs: "twoCell" | "oneCell" | "absolute";
|
|
447
|
+
fromCol: number;
|
|
448
|
+
fromColOffset: number;
|
|
449
|
+
fromRow: number;
|
|
450
|
+
fromRowOffset: number;
|
|
451
|
+
toCol: number;
|
|
452
|
+
toColOffset: number;
|
|
453
|
+
toRow: number;
|
|
454
|
+
toRowOffset: number;
|
|
455
|
+
}
|
|
456
|
+
/** Kind-specific input accepted by Duke Sheets for form-control mutations. */
|
|
457
|
+
type XlsxFormControlKindInput = {
|
|
458
|
+
kind: "button";
|
|
459
|
+
caption: string;
|
|
460
|
+
} | {
|
|
461
|
+
kind: "checkbox";
|
|
462
|
+
caption: string;
|
|
463
|
+
state: XlsxFormControlState;
|
|
464
|
+
cellLink?: string;
|
|
465
|
+
no3D: boolean;
|
|
466
|
+
} | {
|
|
467
|
+
kind: "optionButton";
|
|
468
|
+
caption: string;
|
|
469
|
+
state: Exclude<XlsxFormControlState, "mixed">;
|
|
470
|
+
cellLink?: string;
|
|
471
|
+
firstInGroup?: boolean;
|
|
472
|
+
no3D: boolean;
|
|
473
|
+
} | {
|
|
474
|
+
kind: "label";
|
|
475
|
+
caption: string;
|
|
476
|
+
} | {
|
|
477
|
+
kind: "groupBox";
|
|
478
|
+
caption: string;
|
|
479
|
+
no3D: boolean;
|
|
480
|
+
} | {
|
|
481
|
+
kind: "listBox";
|
|
482
|
+
inputRange?: string;
|
|
483
|
+
cellLink?: string;
|
|
484
|
+
selection: XlsxFormControlSelectionMode;
|
|
485
|
+
selected: number[];
|
|
486
|
+
no3D: boolean;
|
|
487
|
+
} | {
|
|
488
|
+
kind: "dropdown";
|
|
489
|
+
inputRange?: string;
|
|
490
|
+
cellLink?: string;
|
|
491
|
+
selected?: number;
|
|
492
|
+
lines: number;
|
|
493
|
+
no3D: boolean;
|
|
494
|
+
} | {
|
|
495
|
+
kind: "scrollbar";
|
|
496
|
+
value: number;
|
|
497
|
+
min: number;
|
|
498
|
+
max: number;
|
|
499
|
+
increment: number;
|
|
500
|
+
page: number;
|
|
501
|
+
horizontal: boolean;
|
|
502
|
+
cellLink?: string;
|
|
503
|
+
} | {
|
|
504
|
+
kind: "spinner";
|
|
505
|
+
value: number;
|
|
506
|
+
min: number;
|
|
507
|
+
max: number;
|
|
508
|
+
increment: number;
|
|
509
|
+
cellLink?: string;
|
|
510
|
+
};
|
|
511
|
+
/** Complete Duke Sheets input for adding a worksheet form control. */
|
|
512
|
+
interface XlsxFormControlInput {
|
|
513
|
+
anchor: XlsxFormControlAnchor;
|
|
514
|
+
kind: XlsxFormControlKindInput;
|
|
515
|
+
locked?: boolean;
|
|
516
|
+
name?: string;
|
|
517
|
+
printable?: boolean;
|
|
518
|
+
}
|
|
519
|
+
/** Partial Duke Sheets input for changing an existing worksheet form control. */
|
|
520
|
+
type XlsxFormControlPatch = Partial<Omit<XlsxFormControlInput, "kind">> & {
|
|
521
|
+
kind?: XlsxFormControlKindInput;
|
|
522
|
+
};
|
|
442
523
|
interface XlsxFormControl {
|
|
443
524
|
anchor: XlsxImageAnchor;
|
|
525
|
+
/** Original Excel caption reported by Duke Sheets. */
|
|
526
|
+
caption?: string;
|
|
444
527
|
checked?: boolean;
|
|
528
|
+
/** Duke Sheets' stable zero-based index for this worksheet load. */
|
|
529
|
+
controlIndex?: number;
|
|
530
|
+
/** Original anchor behavior when Duke has flattened the anchor to two-cell coordinates. */
|
|
531
|
+
editAs?: "twoCell" | "oneCell" | "absolute";
|
|
532
|
+
/** Exact Duke Sheets anchor. Use this when cloning or updating the control through the controller. */
|
|
533
|
+
dukeAnchor?: XlsxFormControlAnchor;
|
|
534
|
+
firstInGroup?: boolean;
|
|
445
535
|
fontFamily?: string;
|
|
446
536
|
fontSizePt?: number;
|
|
447
537
|
hidden?: boolean;
|
|
538
|
+
horizontal?: boolean;
|
|
448
539
|
id: string;
|
|
540
|
+
increment?: number;
|
|
541
|
+
inputRange?: string;
|
|
542
|
+
/** Current formatted labels resolved from a dropdown or list box input range. */
|
|
543
|
+
items?: string[];
|
|
449
544
|
kind: XlsxFormControlKind;
|
|
450
545
|
label?: string;
|
|
546
|
+
lines?: number;
|
|
451
547
|
linkedCell?: string;
|
|
548
|
+
locked?: boolean;
|
|
549
|
+
max?: number;
|
|
550
|
+
min?: number;
|
|
452
551
|
name?: string;
|
|
552
|
+
no3D?: boolean;
|
|
553
|
+
page?: number;
|
|
554
|
+
printable?: boolean;
|
|
555
|
+
/** Zero-based selected item index or indexes, matching Duke Sheets. */
|
|
556
|
+
selected?: number | number[];
|
|
557
|
+
selection?: XlsxFormControlSelectionMode;
|
|
453
558
|
sheetIndex: number;
|
|
559
|
+
state?: XlsxFormControlState;
|
|
454
560
|
textAlign?: "center" | "left" | "right";
|
|
455
561
|
textColor?: string;
|
|
562
|
+
value?: number;
|
|
456
563
|
workbookSheetIndex: number;
|
|
457
564
|
zIndex: number;
|
|
458
565
|
}
|
|
566
|
+
interface XlsxFormControlActionEvent {
|
|
567
|
+
control: XlsxFormControl;
|
|
568
|
+
type: "activate";
|
|
569
|
+
}
|
|
570
|
+
interface XlsxFormControlChangeEvent {
|
|
571
|
+
control: XlsxFormControl;
|
|
572
|
+
previousControl: XlsxFormControl;
|
|
573
|
+
type: "change";
|
|
574
|
+
}
|
|
575
|
+
interface XlsxFormControlRenderProps {
|
|
576
|
+
/** Activates a button control. No-ops in read-only mode. */
|
|
577
|
+
activate: () => void;
|
|
578
|
+
/** Current checked state for checkbox and radio controls. */
|
|
579
|
+
checked: boolean;
|
|
580
|
+
/** Full parsed control metadata. Switch on `control.kind` to render a kind-specific component. */
|
|
581
|
+
control: XlsxFormControl;
|
|
582
|
+
/** True when this control cannot be changed through the viewer. */
|
|
583
|
+
disabled: boolean;
|
|
584
|
+
/** Current formatted dropdown or list box items resolved from the control input range. */
|
|
585
|
+
items: string[];
|
|
586
|
+
/** Display label after placeholder Excel names have been removed. */
|
|
587
|
+
label: string;
|
|
588
|
+
/** True when a checkbox is in Excel's indeterminate state. */
|
|
589
|
+
mixed: boolean;
|
|
590
|
+
/** True when the viewer is rendering without workbook mutation support. */
|
|
591
|
+
readOnly: boolean;
|
|
592
|
+
/** Calculated worksheet-relative control rectangle in CSS pixels. */
|
|
593
|
+
rect: XlsxImageRect;
|
|
594
|
+
/** Persists a dropdown or list box selection. No-ops for other control kinds or in read-only mode. */
|
|
595
|
+
setSelected: (selected: number | number[] | undefined) => boolean;
|
|
596
|
+
/** Persists a checkbox or radio state. No-ops for other control kinds or in read-only mode. */
|
|
597
|
+
setState: (state: XlsxFormControlState) => boolean;
|
|
598
|
+
/** Persists a scrollbar or spinner value. No-ops for other control kinds or in read-only mode. */
|
|
599
|
+
setValue: (value: number) => boolean;
|
|
600
|
+
/** Stops an event from leaking into worksheet selection. */
|
|
601
|
+
stopPropagation: (event: React.SyntheticEvent) => void;
|
|
602
|
+
/** Apply this style to the custom control root to preserve worksheet positioning and sizing. */
|
|
603
|
+
style: React.CSSProperties;
|
|
604
|
+
/** Current worksheet zoom multiplier, where `1` is 100%. */
|
|
605
|
+
zoomFactor: number;
|
|
606
|
+
}
|
|
459
607
|
interface XlsxChartReference {
|
|
460
608
|
formula?: string;
|
|
461
609
|
refType?: string;
|
|
@@ -831,6 +979,8 @@ interface XlsxViewerController {
|
|
|
831
979
|
canUndo: boolean;
|
|
832
980
|
canZoomIn: boolean;
|
|
833
981
|
canZoomOut: boolean;
|
|
982
|
+
/** Adds a Duke-supported form control to a visible worksheet and returns its worksheet-local index. */
|
|
983
|
+
addFormControl: (input: XlsxFormControlInput, sheetIndex?: number) => number | null;
|
|
834
984
|
clearSelectedCells: () => void;
|
|
835
985
|
clearSelection: () => void;
|
|
836
986
|
continueDeferredLoad: () => void;
|
|
@@ -856,6 +1006,8 @@ interface XlsxViewerController {
|
|
|
856
1006
|
formControls: XlsxFormControl[];
|
|
857
1007
|
getSheetCharts: (sheetIndex?: number) => XlsxChart[];
|
|
858
1008
|
getSheetFormControls: (sheetIndex?: number) => XlsxFormControl[];
|
|
1009
|
+
/** Resolves a list/dropdown input range to its current formatted item labels. */
|
|
1010
|
+
getFormControlItems: (controlIndex: number, sheetIndex?: number) => string[];
|
|
859
1011
|
getImageById: (id: string) => XlsxImage | null;
|
|
860
1012
|
getSheetImages: (sheetIndex?: number) => XlsxImage[];
|
|
861
1013
|
getSheetShapes: (sheetIndex?: number) => XlsxShape[];
|
|
@@ -878,6 +1030,8 @@ interface XlsxViewerController {
|
|
|
878
1030
|
minZoomScale: number;
|
|
879
1031
|
moveImageBy: (id: string, deltaX: number, deltaY: number) => void;
|
|
880
1032
|
removeActiveSheet: () => void;
|
|
1033
|
+
/** Removes a Duke-supported control by its worksheet-local index. */
|
|
1034
|
+
removeFormControl: (controlIndex: number, sheetIndex?: number) => boolean;
|
|
881
1035
|
readOnly: boolean;
|
|
882
1036
|
recalculate: () => void;
|
|
883
1037
|
revision: number;
|
|
@@ -980,6 +1134,8 @@ interface XlsxViewerController {
|
|
|
980
1134
|
undo: () => void;
|
|
981
1135
|
unmergeSelection: () => void;
|
|
982
1136
|
updateChart: (id: string, patch: Partial<XlsxChart>) => void;
|
|
1137
|
+
/** Updates a Duke-supported control and participates in undo/redo and export. */
|
|
1138
|
+
updateFormControl: (controlIndex: number, patch: XlsxFormControlPatch, sheetIndex?: number) => boolean;
|
|
983
1139
|
workbook: Workbook | null;
|
|
984
1140
|
zoomIn: () => void;
|
|
985
1141
|
zoomOut: () => void;
|
|
@@ -1012,20 +1168,25 @@ interface XlsxViewerZoom {
|
|
|
1012
1168
|
}
|
|
1013
1169
|
interface XlsxViewerEditing {
|
|
1014
1170
|
addSheet: (name?: string) => void;
|
|
1171
|
+
addFormControl: (input: XlsxFormControlInput, sheetIndex?: number) => number | null;
|
|
1015
1172
|
canRedo: boolean;
|
|
1016
1173
|
canUndo: boolean;
|
|
1017
1174
|
clearSelectedCells: () => void;
|
|
1018
1175
|
copySelectionToClipboard: () => Promise<boolean>;
|
|
1019
1176
|
defineNamedRange: (name: string, range?: XlsxCellRange | null) => void;
|
|
1020
1177
|
fillSelection: (targetRange: XlsxCellRange) => void;
|
|
1178
|
+
formControls: XlsxFormControl[];
|
|
1021
1179
|
getClipboardData: () => XlsxClipboardData | null;
|
|
1022
1180
|
getCellDisplayValue: (cell?: XlsxCellAddress | null) => string;
|
|
1023
1181
|
getCellFormula: (cell?: XlsxCellAddress | null) => string;
|
|
1182
|
+
getFormControlItems: (controlIndex: number, sheetIndex?: number) => string[];
|
|
1183
|
+
getSheetFormControls: (sheetIndex?: number) => XlsxFormControl[];
|
|
1024
1184
|
mergeSelection: () => void;
|
|
1025
1185
|
pasteFromClipboard: () => Promise<boolean>;
|
|
1026
1186
|
pasteStructuredClipboardData: (payload: string) => boolean;
|
|
1027
1187
|
pasteText: (text: string) => boolean;
|
|
1028
1188
|
removeActiveSheet: () => void;
|
|
1189
|
+
removeFormControl: (controlIndex: number, sheetIndex?: number) => boolean;
|
|
1029
1190
|
readOnly: boolean;
|
|
1030
1191
|
redo: () => void;
|
|
1031
1192
|
selectedCellFormula: string;
|
|
@@ -1075,6 +1236,7 @@ interface XlsxViewerEditing {
|
|
|
1075
1236
|
setSelectedCellValue: (value: string) => void;
|
|
1076
1237
|
undo: () => void;
|
|
1077
1238
|
unmergeSelection: () => void;
|
|
1239
|
+
updateFormControl: (controlIndex: number, patch: XlsxFormControlPatch, sheetIndex?: number) => boolean;
|
|
1078
1240
|
}
|
|
1079
1241
|
interface XlsxViewerTables {
|
|
1080
1242
|
sortState: XlsxTableSortState | null;
|
|
@@ -1322,8 +1484,18 @@ interface XlsxViewerProps extends UseXlsxViewerControllerOptions {
|
|
|
1322
1484
|
loadingComponent?: React.ReactElement;
|
|
1323
1485
|
/** Content shown while the workbook is being parsed. */
|
|
1324
1486
|
loadingState?: React.ReactNode;
|
|
1487
|
+
/** Called when an editable button form control is activated. Duke preserves buttons but does not execute macros. */
|
|
1488
|
+
onFormControlAction?: (event: XlsxFormControlActionEvent) => void;
|
|
1489
|
+
/** Called after the built-in editor persists a checkbox, radio, list, dropdown, scrollbar, or spinner change. */
|
|
1490
|
+
onFormControlChange?: (event: XlsxFormControlChangeEvent) => void;
|
|
1325
1491
|
/** Replaces the chart loading placeholder. */
|
|
1326
1492
|
renderChartLoading?: (props: XlsxChartLoadingRenderProps) => React.ReactNode;
|
|
1493
|
+
/**
|
|
1494
|
+
* Replaces built-in worksheet form-control rendering.
|
|
1495
|
+
* Apply `style` to the custom root and use `stopPropagation` on pointer/click handlers.
|
|
1496
|
+
* The supplied setters preserve Duke mutation, linked-cell, undo/redo, and change-event behavior.
|
|
1497
|
+
*/
|
|
1498
|
+
renderFormControl?: (props: XlsxFormControlRenderProps) => React.ReactNode;
|
|
1327
1499
|
/**
|
|
1328
1500
|
* Replaces worksheet images while preserving their calculated rect and style.
|
|
1329
1501
|
*
|
|
@@ -1428,4 +1600,4 @@ declare function useXlsxViewerThumbnails(options?: UseXlsxViewerThumbnailsOption
|
|
|
1428
1600
|
declare function XlsxViewer(props: XlsxViewerProps): react_jsx_runtime.JSX.Element;
|
|
1429
1601
|
declare function DefaultXlsxToolbar(): react_jsx_runtime.JSX.Element;
|
|
1430
1602
|
|
|
1431
|
-
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 XlsxChartElementSelection, type XlsxChartLoadingRenderProps, type XlsxChartReference, type XlsxChartSeries, type XlsxChartsheet, XlsxFileSizeLimitExceededError, type XlsxFileTooLargeRenderProps, type XlsxFormulaTarget, 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 };
|
|
1603
|
+
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 XlsxChartElementSelection, type XlsxChartLoadingRenderProps, type XlsxChartReference, type XlsxChartSeries, type XlsxChartsheet, XlsxFileSizeLimitExceededError, type XlsxFileTooLargeRenderProps, type XlsxFormControl, type XlsxFormControlActionEvent, type XlsxFormControlAnchor, type XlsxFormControlChangeEvent, type XlsxFormControlInput, type XlsxFormControlKind, type XlsxFormControlKindInput, type XlsxFormControlPatch, type XlsxFormControlRenderProps, type XlsxFormControlSelectionMode, type XlsxFormControlState, type XlsxFormulaTarget, 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 };
|