@extend-ai/react-xlsx 0.13.3 → 0.14.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 +20 -0
- package/dist/duke_sheets_wasm_bg.wasm +0 -0
- package/dist/index.cjs +874 -84
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +133 -1
- package/dist/index.d.ts +133 -1
- package/dist/index.js +874 -84
- package/dist/index.js.map +1 -1
- package/dist/xlsx-worker.js +128 -0
- package/dist/xlsx-worker.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -439,23 +439,137 @@ 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;
|
|
449
542
|
kind: XlsxFormControlKind;
|
|
450
543
|
label?: string;
|
|
544
|
+
lines?: number;
|
|
451
545
|
linkedCell?: string;
|
|
546
|
+
locked?: boolean;
|
|
547
|
+
max?: number;
|
|
548
|
+
min?: number;
|
|
452
549
|
name?: string;
|
|
550
|
+
no3D?: boolean;
|
|
551
|
+
page?: number;
|
|
552
|
+
printable?: boolean;
|
|
553
|
+
/** Zero-based selected item index or indexes, matching Duke Sheets. */
|
|
554
|
+
selected?: number | number[];
|
|
555
|
+
selection?: XlsxFormControlSelectionMode;
|
|
453
556
|
sheetIndex: number;
|
|
557
|
+
state?: XlsxFormControlState;
|
|
454
558
|
textAlign?: "center" | "left" | "right";
|
|
455
559
|
textColor?: string;
|
|
560
|
+
value?: number;
|
|
456
561
|
workbookSheetIndex: number;
|
|
457
562
|
zIndex: number;
|
|
458
563
|
}
|
|
564
|
+
interface XlsxFormControlActionEvent {
|
|
565
|
+
control: XlsxFormControl;
|
|
566
|
+
type: "activate";
|
|
567
|
+
}
|
|
568
|
+
interface XlsxFormControlChangeEvent {
|
|
569
|
+
control: XlsxFormControl;
|
|
570
|
+
previousControl: XlsxFormControl;
|
|
571
|
+
type: "change";
|
|
572
|
+
}
|
|
459
573
|
interface XlsxChartReference {
|
|
460
574
|
formula?: string;
|
|
461
575
|
refType?: string;
|
|
@@ -831,6 +945,8 @@ interface XlsxViewerController {
|
|
|
831
945
|
canUndo: boolean;
|
|
832
946
|
canZoomIn: boolean;
|
|
833
947
|
canZoomOut: boolean;
|
|
948
|
+
/** Adds a Duke-supported form control to a visible worksheet and returns its worksheet-local index. */
|
|
949
|
+
addFormControl: (input: XlsxFormControlInput, sheetIndex?: number) => number | null;
|
|
834
950
|
clearSelectedCells: () => void;
|
|
835
951
|
clearSelection: () => void;
|
|
836
952
|
continueDeferredLoad: () => void;
|
|
@@ -856,6 +972,8 @@ interface XlsxViewerController {
|
|
|
856
972
|
formControls: XlsxFormControl[];
|
|
857
973
|
getSheetCharts: (sheetIndex?: number) => XlsxChart[];
|
|
858
974
|
getSheetFormControls: (sheetIndex?: number) => XlsxFormControl[];
|
|
975
|
+
/** Resolves a list/dropdown input range to its current formatted item labels. */
|
|
976
|
+
getFormControlItems: (controlIndex: number, sheetIndex?: number) => string[];
|
|
859
977
|
getImageById: (id: string) => XlsxImage | null;
|
|
860
978
|
getSheetImages: (sheetIndex?: number) => XlsxImage[];
|
|
861
979
|
getSheetShapes: (sheetIndex?: number) => XlsxShape[];
|
|
@@ -878,6 +996,8 @@ interface XlsxViewerController {
|
|
|
878
996
|
minZoomScale: number;
|
|
879
997
|
moveImageBy: (id: string, deltaX: number, deltaY: number) => void;
|
|
880
998
|
removeActiveSheet: () => void;
|
|
999
|
+
/** Removes a Duke-supported control by its worksheet-local index. */
|
|
1000
|
+
removeFormControl: (controlIndex: number, sheetIndex?: number) => boolean;
|
|
881
1001
|
readOnly: boolean;
|
|
882
1002
|
recalculate: () => void;
|
|
883
1003
|
revision: number;
|
|
@@ -980,6 +1100,8 @@ interface XlsxViewerController {
|
|
|
980
1100
|
undo: () => void;
|
|
981
1101
|
unmergeSelection: () => void;
|
|
982
1102
|
updateChart: (id: string, patch: Partial<XlsxChart>) => void;
|
|
1103
|
+
/** Updates a Duke-supported control and participates in undo/redo and export. */
|
|
1104
|
+
updateFormControl: (controlIndex: number, patch: XlsxFormControlPatch, sheetIndex?: number) => boolean;
|
|
983
1105
|
workbook: Workbook | null;
|
|
984
1106
|
zoomIn: () => void;
|
|
985
1107
|
zoomOut: () => void;
|
|
@@ -1012,20 +1134,25 @@ interface XlsxViewerZoom {
|
|
|
1012
1134
|
}
|
|
1013
1135
|
interface XlsxViewerEditing {
|
|
1014
1136
|
addSheet: (name?: string) => void;
|
|
1137
|
+
addFormControl: (input: XlsxFormControlInput, sheetIndex?: number) => number | null;
|
|
1015
1138
|
canRedo: boolean;
|
|
1016
1139
|
canUndo: boolean;
|
|
1017
1140
|
clearSelectedCells: () => void;
|
|
1018
1141
|
copySelectionToClipboard: () => Promise<boolean>;
|
|
1019
1142
|
defineNamedRange: (name: string, range?: XlsxCellRange | null) => void;
|
|
1020
1143
|
fillSelection: (targetRange: XlsxCellRange) => void;
|
|
1144
|
+
formControls: XlsxFormControl[];
|
|
1021
1145
|
getClipboardData: () => XlsxClipboardData | null;
|
|
1022
1146
|
getCellDisplayValue: (cell?: XlsxCellAddress | null) => string;
|
|
1023
1147
|
getCellFormula: (cell?: XlsxCellAddress | null) => string;
|
|
1148
|
+
getFormControlItems: (controlIndex: number, sheetIndex?: number) => string[];
|
|
1149
|
+
getSheetFormControls: (sheetIndex?: number) => XlsxFormControl[];
|
|
1024
1150
|
mergeSelection: () => void;
|
|
1025
1151
|
pasteFromClipboard: () => Promise<boolean>;
|
|
1026
1152
|
pasteStructuredClipboardData: (payload: string) => boolean;
|
|
1027
1153
|
pasteText: (text: string) => boolean;
|
|
1028
1154
|
removeActiveSheet: () => void;
|
|
1155
|
+
removeFormControl: (controlIndex: number, sheetIndex?: number) => boolean;
|
|
1029
1156
|
readOnly: boolean;
|
|
1030
1157
|
redo: () => void;
|
|
1031
1158
|
selectedCellFormula: string;
|
|
@@ -1075,6 +1202,7 @@ interface XlsxViewerEditing {
|
|
|
1075
1202
|
setSelectedCellValue: (value: string) => void;
|
|
1076
1203
|
undo: () => void;
|
|
1077
1204
|
unmergeSelection: () => void;
|
|
1205
|
+
updateFormControl: (controlIndex: number, patch: XlsxFormControlPatch, sheetIndex?: number) => boolean;
|
|
1078
1206
|
}
|
|
1079
1207
|
interface XlsxViewerTables {
|
|
1080
1208
|
sortState: XlsxTableSortState | null;
|
|
@@ -1322,6 +1450,10 @@ interface XlsxViewerProps extends UseXlsxViewerControllerOptions {
|
|
|
1322
1450
|
loadingComponent?: React.ReactElement;
|
|
1323
1451
|
/** Content shown while the workbook is being parsed. */
|
|
1324
1452
|
loadingState?: React.ReactNode;
|
|
1453
|
+
/** Called when an editable button form control is activated. Duke preserves buttons but does not execute macros. */
|
|
1454
|
+
onFormControlAction?: (event: XlsxFormControlActionEvent) => void;
|
|
1455
|
+
/** Called after the built-in editor persists a checkbox, radio, list, dropdown, scrollbar, or spinner change. */
|
|
1456
|
+
onFormControlChange?: (event: XlsxFormControlChangeEvent) => void;
|
|
1325
1457
|
/** Replaces the chart loading placeholder. */
|
|
1326
1458
|
renderChartLoading?: (props: XlsxChartLoadingRenderProps) => React.ReactNode;
|
|
1327
1459
|
/**
|
|
@@ -1428,4 +1560,4 @@ declare function useXlsxViewerThumbnails(options?: UseXlsxViewerThumbnailsOption
|
|
|
1428
1560
|
declare function XlsxViewer(props: XlsxViewerProps): react_jsx_runtime.JSX.Element;
|
|
1429
1561
|
declare function DefaultXlsxToolbar(): react_jsx_runtime.JSX.Element;
|
|
1430
1562
|
|
|
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 };
|
|
1563
|
+
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 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,137 @@ 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;
|
|
449
542
|
kind: XlsxFormControlKind;
|
|
450
543
|
label?: string;
|
|
544
|
+
lines?: number;
|
|
451
545
|
linkedCell?: string;
|
|
546
|
+
locked?: boolean;
|
|
547
|
+
max?: number;
|
|
548
|
+
min?: number;
|
|
452
549
|
name?: string;
|
|
550
|
+
no3D?: boolean;
|
|
551
|
+
page?: number;
|
|
552
|
+
printable?: boolean;
|
|
553
|
+
/** Zero-based selected item index or indexes, matching Duke Sheets. */
|
|
554
|
+
selected?: number | number[];
|
|
555
|
+
selection?: XlsxFormControlSelectionMode;
|
|
453
556
|
sheetIndex: number;
|
|
557
|
+
state?: XlsxFormControlState;
|
|
454
558
|
textAlign?: "center" | "left" | "right";
|
|
455
559
|
textColor?: string;
|
|
560
|
+
value?: number;
|
|
456
561
|
workbookSheetIndex: number;
|
|
457
562
|
zIndex: number;
|
|
458
563
|
}
|
|
564
|
+
interface XlsxFormControlActionEvent {
|
|
565
|
+
control: XlsxFormControl;
|
|
566
|
+
type: "activate";
|
|
567
|
+
}
|
|
568
|
+
interface XlsxFormControlChangeEvent {
|
|
569
|
+
control: XlsxFormControl;
|
|
570
|
+
previousControl: XlsxFormControl;
|
|
571
|
+
type: "change";
|
|
572
|
+
}
|
|
459
573
|
interface XlsxChartReference {
|
|
460
574
|
formula?: string;
|
|
461
575
|
refType?: string;
|
|
@@ -831,6 +945,8 @@ interface XlsxViewerController {
|
|
|
831
945
|
canUndo: boolean;
|
|
832
946
|
canZoomIn: boolean;
|
|
833
947
|
canZoomOut: boolean;
|
|
948
|
+
/** Adds a Duke-supported form control to a visible worksheet and returns its worksheet-local index. */
|
|
949
|
+
addFormControl: (input: XlsxFormControlInput, sheetIndex?: number) => number | null;
|
|
834
950
|
clearSelectedCells: () => void;
|
|
835
951
|
clearSelection: () => void;
|
|
836
952
|
continueDeferredLoad: () => void;
|
|
@@ -856,6 +972,8 @@ interface XlsxViewerController {
|
|
|
856
972
|
formControls: XlsxFormControl[];
|
|
857
973
|
getSheetCharts: (sheetIndex?: number) => XlsxChart[];
|
|
858
974
|
getSheetFormControls: (sheetIndex?: number) => XlsxFormControl[];
|
|
975
|
+
/** Resolves a list/dropdown input range to its current formatted item labels. */
|
|
976
|
+
getFormControlItems: (controlIndex: number, sheetIndex?: number) => string[];
|
|
859
977
|
getImageById: (id: string) => XlsxImage | null;
|
|
860
978
|
getSheetImages: (sheetIndex?: number) => XlsxImage[];
|
|
861
979
|
getSheetShapes: (sheetIndex?: number) => XlsxShape[];
|
|
@@ -878,6 +996,8 @@ interface XlsxViewerController {
|
|
|
878
996
|
minZoomScale: number;
|
|
879
997
|
moveImageBy: (id: string, deltaX: number, deltaY: number) => void;
|
|
880
998
|
removeActiveSheet: () => void;
|
|
999
|
+
/** Removes a Duke-supported control by its worksheet-local index. */
|
|
1000
|
+
removeFormControl: (controlIndex: number, sheetIndex?: number) => boolean;
|
|
881
1001
|
readOnly: boolean;
|
|
882
1002
|
recalculate: () => void;
|
|
883
1003
|
revision: number;
|
|
@@ -980,6 +1100,8 @@ interface XlsxViewerController {
|
|
|
980
1100
|
undo: () => void;
|
|
981
1101
|
unmergeSelection: () => void;
|
|
982
1102
|
updateChart: (id: string, patch: Partial<XlsxChart>) => void;
|
|
1103
|
+
/** Updates a Duke-supported control and participates in undo/redo and export. */
|
|
1104
|
+
updateFormControl: (controlIndex: number, patch: XlsxFormControlPatch, sheetIndex?: number) => boolean;
|
|
983
1105
|
workbook: Workbook | null;
|
|
984
1106
|
zoomIn: () => void;
|
|
985
1107
|
zoomOut: () => void;
|
|
@@ -1012,20 +1134,25 @@ interface XlsxViewerZoom {
|
|
|
1012
1134
|
}
|
|
1013
1135
|
interface XlsxViewerEditing {
|
|
1014
1136
|
addSheet: (name?: string) => void;
|
|
1137
|
+
addFormControl: (input: XlsxFormControlInput, sheetIndex?: number) => number | null;
|
|
1015
1138
|
canRedo: boolean;
|
|
1016
1139
|
canUndo: boolean;
|
|
1017
1140
|
clearSelectedCells: () => void;
|
|
1018
1141
|
copySelectionToClipboard: () => Promise<boolean>;
|
|
1019
1142
|
defineNamedRange: (name: string, range?: XlsxCellRange | null) => void;
|
|
1020
1143
|
fillSelection: (targetRange: XlsxCellRange) => void;
|
|
1144
|
+
formControls: XlsxFormControl[];
|
|
1021
1145
|
getClipboardData: () => XlsxClipboardData | null;
|
|
1022
1146
|
getCellDisplayValue: (cell?: XlsxCellAddress | null) => string;
|
|
1023
1147
|
getCellFormula: (cell?: XlsxCellAddress | null) => string;
|
|
1148
|
+
getFormControlItems: (controlIndex: number, sheetIndex?: number) => string[];
|
|
1149
|
+
getSheetFormControls: (sheetIndex?: number) => XlsxFormControl[];
|
|
1024
1150
|
mergeSelection: () => void;
|
|
1025
1151
|
pasteFromClipboard: () => Promise<boolean>;
|
|
1026
1152
|
pasteStructuredClipboardData: (payload: string) => boolean;
|
|
1027
1153
|
pasteText: (text: string) => boolean;
|
|
1028
1154
|
removeActiveSheet: () => void;
|
|
1155
|
+
removeFormControl: (controlIndex: number, sheetIndex?: number) => boolean;
|
|
1029
1156
|
readOnly: boolean;
|
|
1030
1157
|
redo: () => void;
|
|
1031
1158
|
selectedCellFormula: string;
|
|
@@ -1075,6 +1202,7 @@ interface XlsxViewerEditing {
|
|
|
1075
1202
|
setSelectedCellValue: (value: string) => void;
|
|
1076
1203
|
undo: () => void;
|
|
1077
1204
|
unmergeSelection: () => void;
|
|
1205
|
+
updateFormControl: (controlIndex: number, patch: XlsxFormControlPatch, sheetIndex?: number) => boolean;
|
|
1078
1206
|
}
|
|
1079
1207
|
interface XlsxViewerTables {
|
|
1080
1208
|
sortState: XlsxTableSortState | null;
|
|
@@ -1322,6 +1450,10 @@ interface XlsxViewerProps extends UseXlsxViewerControllerOptions {
|
|
|
1322
1450
|
loadingComponent?: React.ReactElement;
|
|
1323
1451
|
/** Content shown while the workbook is being parsed. */
|
|
1324
1452
|
loadingState?: React.ReactNode;
|
|
1453
|
+
/** Called when an editable button form control is activated. Duke preserves buttons but does not execute macros. */
|
|
1454
|
+
onFormControlAction?: (event: XlsxFormControlActionEvent) => void;
|
|
1455
|
+
/** Called after the built-in editor persists a checkbox, radio, list, dropdown, scrollbar, or spinner change. */
|
|
1456
|
+
onFormControlChange?: (event: XlsxFormControlChangeEvent) => void;
|
|
1325
1457
|
/** Replaces the chart loading placeholder. */
|
|
1326
1458
|
renderChartLoading?: (props: XlsxChartLoadingRenderProps) => React.ReactNode;
|
|
1327
1459
|
/**
|
|
@@ -1428,4 +1560,4 @@ declare function useXlsxViewerThumbnails(options?: UseXlsxViewerThumbnailsOption
|
|
|
1428
1560
|
declare function XlsxViewer(props: XlsxViewerProps): react_jsx_runtime.JSX.Element;
|
|
1429
1561
|
declare function DefaultXlsxToolbar(): react_jsx_runtime.JSX.Element;
|
|
1430
1562
|
|
|
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 };
|
|
1563
|
+
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 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 };
|