@canvas-components/react-xlsx-table 0.1.13 → 0.1.15
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 +95 -26
- package/dist/index.cjs +3604 -203
- package/dist/index.d.cts +93 -11
- package/dist/index.d.ts +93 -11
- package/dist/index.js +3606 -205
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,30 @@
|
|
|
1
|
+
import { XlsxCommandId, WorkBook, XlsxDocumentStamp, XlsxSelectionState, XlsxContextMenuRequest, XlsxCommandState, XlsxCellStyle, XlsxCellType, XlsxTableExportFormat, XlsxCellBorderPreset, XlsxCellBorderLine, XlsxTableOptions, XlsxFeatureOptions, XlsxCleaningWorkerFactory, XlsxTable, XlsxTableExportOptions, XlsxFormulaDependencyDebugSnapshot, XlsxNamedRange, XlsxFormulaBarState, CreateSheetOptions, DuplicateSheetOptions, XlsxRemoteSelection, XlsxFrozenPane, XlsxSortDirection, XlsxHeaderActionType, XlsxFilterOptionItem, XlsxFilterValue, XlsxFilterOptionValue, XlsxFilterCondition, XlsxFilterConditionRelation, XlsxEditorRequest, WorkSheet } from '@canvas-components/xlsx-table';
|
|
2
|
+
export { CellObject, CreateSheetOptions, WorkBook, WorkSheet, XlsxCellAddress, XlsxCellRange, XlsxCleaningPlan, XlsxCleaningRequest, XlsxCleaningWorkerFactory, XlsxCommandDefinition, XlsxCommandId, XlsxCommandState, XlsxEditorRequest, XlsxFeatureOptions, XlsxFormulaBarState, XlsxFormulaDependencyDebugSnapshot, XlsxNamedRange, XlsxPrintOptions, XlsxPrintPlan, XlsxRemoteSelection, XlsxSearchQuery, XlsxSearchSnapshot, XlsxSelectionState, XlsxTableExportFormat, XlsxTableExportOptions, XlsxTableOptions, XlsxTableTheme } from '@canvas-components/xlsx-table';
|
|
1
3
|
import * as react from 'react';
|
|
2
4
|
import { CSSProperties, ForwardedRef } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
+
import { XlsxFileWorkerFactory } from '@canvas-components/xlsx-table/file';
|
|
6
|
+
|
|
7
|
+
/** 宿主动作得到原生只读快照与可取消的实例上下文。 */
|
|
8
|
+
interface XlsxHostCommandContext {
|
|
9
|
+
workbook: WorkBook;
|
|
10
|
+
stamp: XlsxDocumentStamp;
|
|
11
|
+
selection: XlsxSelectionState;
|
|
12
|
+
signal: AbortSignal;
|
|
13
|
+
isCurrent(): boolean;
|
|
14
|
+
invocation?: {
|
|
15
|
+
source: "context-menu";
|
|
16
|
+
target: XlsxContextMenuRequest["target"];
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
type XlsxCommandHandler = (context: XlsxHostCommandContext) => void | Promise<void>;
|
|
20
|
+
type XlsxCommandHandlers = Partial<Record<XlsxCommandId, XlsxCommandHandler>>;
|
|
21
|
+
interface XlsxDocumentMetadata {
|
|
22
|
+
owner?: string;
|
|
23
|
+
createdAt?: string;
|
|
24
|
+
updatedAt?: string;
|
|
25
|
+
permissionLabel?: string;
|
|
26
|
+
}
|
|
27
|
+
type XlsxDocumentInfoProvider = (context: XlsxHostCommandContext) => XlsxDocumentMetadata | Promise<XlsxDocumentMetadata>;
|
|
5
28
|
|
|
6
29
|
type XlsxToolbarIconName = "menu" | "undo" | "redo" | "paint-format" | "clear-format" | "insert" | "font-family" | "font-size" | "bold" | "italic" | "underline" | "strikethrough" | "text-color" | "fill-color" | "border" | "vertical-align" | "vertical-align-top" | "vertical-align-bottom" | "align-left" | "align-center" | "align-right" | "merge-cells" | "number-format" | "currency" | "percent" | "decrease-decimal" | "increase-decimal" | "freeze" | "filter" | "sort" | "conditional-format" | "data-validation" | "formula" | "multidimensional-table" | "find-replace" | "comment" | "ai-formula" | "chevron-down" | "more";
|
|
7
30
|
declare function XlsxToolbarIcon(props: {
|
|
@@ -9,7 +32,8 @@ declare function XlsxToolbarIcon(props: {
|
|
|
9
32
|
size?: number;
|
|
10
33
|
}): react.JSX.Element | null;
|
|
11
34
|
|
|
12
|
-
|
|
35
|
+
/** 旧名称转接统一 ID,保留原有配置接入。 */
|
|
36
|
+
type XlsxToolbarCommand = XlsxCommandId;
|
|
13
37
|
type XlsxToolbarDensity = "compact" | "comfortable";
|
|
14
38
|
interface XlsxToolbarOptions {
|
|
15
39
|
/** 工具栏密度。@default "comfortable" */
|
|
@@ -38,8 +62,13 @@ interface XlsxToolbarState {
|
|
|
38
62
|
sorted?: boolean;
|
|
39
63
|
merged?: boolean;
|
|
40
64
|
canMerge?: boolean;
|
|
65
|
+
hasSelection?: boolean;
|
|
41
66
|
}
|
|
42
67
|
interface XlsxToolbarProps {
|
|
68
|
+
commandStates?: Record<string, XlsxCommandState>;
|
|
69
|
+
commandOverrides?: ReadonlySet<XlsxToolbarCommand>;
|
|
70
|
+
actionLabels?: Record<string, string>;
|
|
71
|
+
onAction?: (action: string) => void;
|
|
43
72
|
historyState: XlsxToolbarHistoryState;
|
|
44
73
|
state?: XlsxToolbarState;
|
|
45
74
|
readonly?: boolean;
|
|
@@ -48,6 +77,7 @@ interface XlsxToolbarProps {
|
|
|
48
77
|
onRedo: () => void;
|
|
49
78
|
onCreateSheet?: () => void;
|
|
50
79
|
onDuplicateSheet?: () => void;
|
|
80
|
+
onOpenFile?: () => void;
|
|
51
81
|
onExport?: (format: XlsxTableExportFormat) => void;
|
|
52
82
|
onApplyStyle?: (style: Partial<XlsxCellStyle>) => void;
|
|
53
83
|
onApplyBorder?: (preset: XlsxCellBorderPreset, line: XlsxCellBorderLine) => void;
|
|
@@ -77,6 +107,17 @@ interface XlsxToolbarProps {
|
|
|
77
107
|
declare function XlsxToolbar(props: XlsxToolbarProps): react.JSX.Element;
|
|
78
108
|
|
|
79
109
|
interface ReactXlsxTableProps extends XlsxTableOptions {
|
|
110
|
+
features?: XlsxFeatureOptions;
|
|
111
|
+
commandHandlers?: XlsxCommandHandlers;
|
|
112
|
+
documentInfoProvider?: XlsxDocumentInfoProvider;
|
|
113
|
+
/** 注入可取消的文件 worker;默认加载发布包 ESM worker。 */
|
|
114
|
+
fileWorkerFactory?: XlsxFileWorkerFactory;
|
|
115
|
+
/** 注入数据清洗预检 worker。 */
|
|
116
|
+
cleaningWorkerFactory?: XlsxCleaningWorkerFactory;
|
|
117
|
+
/** 应用打印权限,显式 false 优先于宿主 handler。 */
|
|
118
|
+
permissions?: {
|
|
119
|
+
print?: boolean;
|
|
120
|
+
};
|
|
80
121
|
className?: string;
|
|
81
122
|
style?: CSSProperties;
|
|
82
123
|
/** 是否显示公式栏。@default true */
|
|
@@ -99,8 +140,41 @@ interface ReactXlsxTableProps extends XlsxTableOptions {
|
|
|
99
140
|
onToolbarCommand?: (command: XlsxToolbarCommand) => void;
|
|
100
141
|
}
|
|
101
142
|
interface ReactXlsxTableRef {
|
|
143
|
+
getDocumentStamp: XlsxTable["getDocumentStamp"];
|
|
144
|
+
getNativePartsState: XlsxTable["getNativePartsState"];
|
|
145
|
+
commitNativeTransaction: XlsxTable["commitNativeTransaction"];
|
|
146
|
+
previewCleaning: XlsxTable["previewCleaning"];
|
|
147
|
+
applyCleaning: XlsxTable["applyCleaning"];
|
|
148
|
+
getNativeSourceInitializationState: XlsxTable["getNativeSourceInitializationState"];
|
|
149
|
+
initializeNativeSource: XlsxTable["initializeNativeSource"];
|
|
150
|
+
getSheetSettings: XlsxTable["getSheetSettings"];
|
|
151
|
+
updateSheetSettings: XlsxTable["updateSheetSettings"];
|
|
152
|
+
createPrintPlan: XlsxTable["createPrintPlan"];
|
|
153
|
+
getViewState: XlsxTable["getViewState"];
|
|
154
|
+
setViewState: XlsxTable["setViewState"];
|
|
155
|
+
setZoom: XlsxTable["setZoom"];
|
|
156
|
+
zoomToSelection: XlsxTable["zoomToSelection"];
|
|
157
|
+
setSelectionNumberFormat: XlsxTable["setSelectionNumberFormat"];
|
|
158
|
+
captureSelectionClipboard: XlsxTable["captureSelectionClipboard"];
|
|
159
|
+
getSelectionClipboard: XlsxTable["getSelectionClipboard"];
|
|
160
|
+
pasteSpecial: XlsxTable["pasteSpecial"];
|
|
161
|
+
setRowHeights: XlsxTable["setRowHeights"];
|
|
162
|
+
setColumnWidths: XlsxTable["setColumnWidths"];
|
|
163
|
+
autoFitRows: XlsxTable["autoFitRows"];
|
|
164
|
+
autoFitColumns: XlsxTable["autoFitColumns"];
|
|
165
|
+
executeCommand(action: string): Promise<boolean>;
|
|
166
|
+
getCommandState(action: string): XlsxCommandState;
|
|
167
|
+
adjustSelectionDecimals: XlsxTable["adjustSelectionDecimals"];
|
|
168
|
+
search: XlsxTable["search"];
|
|
169
|
+
navigateSearchMatch: XlsxTable["navigateSearchMatch"];
|
|
170
|
+
replaceSearchMatches: XlsxTable["replaceSearchMatches"];
|
|
171
|
+
copySelectionText: XlsxTable["copySelectionText"];
|
|
172
|
+
pasteText: XlsxTable["pasteText"];
|
|
173
|
+
openXlsxFile(file: File): Promise<boolean>;
|
|
174
|
+
exportWorkbookXlsx(fileName?: string): Promise<boolean>;
|
|
175
|
+
cancelFileTask(): void;
|
|
102
176
|
getSelection: () => XlsxSelectionState;
|
|
103
|
-
getWorkbook: () =>
|
|
177
|
+
getWorkbook: () => WorkBook;
|
|
104
178
|
exportActiveSheet: (format: XlsxTableExportFormat, options?: XlsxTableExportOptions) => Promise<boolean>;
|
|
105
179
|
getFormulaDependencyDebugSnapshot: () => XlsxFormulaDependencyDebugSnapshot;
|
|
106
180
|
getNamedRanges: () => XlsxNamedRange[];
|
|
@@ -194,7 +268,7 @@ declare function XlsxFormulaDependencyDebugPanel({ snapshot, }: XlsxFormulaDepen
|
|
|
194
268
|
declare function XlsxFormulaBar(props: {
|
|
195
269
|
state: XlsxFormulaBarState;
|
|
196
270
|
onCommit: (text: string) => void;
|
|
197
|
-
workbook?:
|
|
271
|
+
workbook?: WorkBook;
|
|
198
272
|
autocomplete?: boolean;
|
|
199
273
|
rowHeaderWidth?: number;
|
|
200
274
|
style?: CSSProperties;
|
|
@@ -203,6 +277,8 @@ declare function XlsxFormulaBar(props: {
|
|
|
203
277
|
type XlsxContextMenuItemKind = "item" | "separator" | "label";
|
|
204
278
|
interface XlsxContextMenuItem {
|
|
205
279
|
key: string;
|
|
280
|
+
commandId?: XlsxCommandId;
|
|
281
|
+
disabledReason?: string;
|
|
206
282
|
kind: XlsxContextMenuItemKind;
|
|
207
283
|
label?: string;
|
|
208
284
|
disabled?: boolean;
|
|
@@ -248,7 +324,10 @@ interface XlsxContextMenuAnchorRect {
|
|
|
248
324
|
/**
|
|
249
325
|
* 构建 xlsx-table 右键菜单项。
|
|
250
326
|
*/
|
|
251
|
-
declare function buildXlsxContextMenuItems(params:
|
|
327
|
+
declare function buildXlsxContextMenuItems(params: Parameters<typeof buildNativeContextMenuItems>[0]): XlsxContextMenuItem[];
|
|
328
|
+
declare function buildNativeContextMenuItems(params: {
|
|
329
|
+
commandStates?: Record<string, XlsxCommandState>;
|
|
330
|
+
onCommand?: (id: XlsxCommandId, runNative: () => void) => void;
|
|
252
331
|
request: XlsxContextMenuRequest;
|
|
253
332
|
readonly?: boolean;
|
|
254
333
|
mergeState?: {
|
|
@@ -259,8 +338,10 @@ declare function buildXlsxContextMenuItems(params: {
|
|
|
259
338
|
}): XlsxContextMenuItem[];
|
|
260
339
|
|
|
261
340
|
interface XlsxContextMenuProps {
|
|
341
|
+
commandStates?: Record<string, XlsxCommandState>;
|
|
342
|
+
onCommand?: (id: XlsxCommandId, runNative: () => void) => void;
|
|
262
343
|
request: XlsxContextMenuRequest | null;
|
|
263
|
-
workbook:
|
|
344
|
+
workbook: WorkBook;
|
|
264
345
|
readonly?: boolean;
|
|
265
346
|
mergeState?: {
|
|
266
347
|
canMerge?: boolean;
|
|
@@ -272,10 +353,10 @@ interface XlsxContextMenuProps {
|
|
|
272
353
|
/**
|
|
273
354
|
* xlsx-table 右键菜单。
|
|
274
355
|
*/
|
|
275
|
-
declare function XlsxContextMenu({ request, workbook, readonly, mergeState, onClose, actions, }: XlsxContextMenuProps): react.JSX.Element | null;
|
|
356
|
+
declare function XlsxContextMenu({ request, workbook, readonly, mergeState, onClose, commandStates, onCommand, actions, }: XlsxContextMenuProps): react.JSX.Element | null;
|
|
276
357
|
|
|
277
358
|
interface XlsxNamedRangeManagerProps {
|
|
278
|
-
workbook:
|
|
359
|
+
workbook: WorkBook;
|
|
279
360
|
readonly?: boolean;
|
|
280
361
|
onUpsert: (named: XlsxNamedRange) => boolean;
|
|
281
362
|
onRemove: (name: string) => boolean;
|
|
@@ -289,7 +370,8 @@ declare function XlsxNamedRangeManager(props: XlsxNamedRangeManagerProps): react
|
|
|
289
370
|
* Sheet 标签栏。
|
|
290
371
|
*/
|
|
291
372
|
declare function XlsxSheetTabs(props: {
|
|
292
|
-
|
|
373
|
+
commandStates?: Record<string, XlsxCommandState>;
|
|
374
|
+
sheets: WorkSheet[];
|
|
293
375
|
activeSheetId: string | null;
|
|
294
376
|
readonly?: boolean;
|
|
295
377
|
onActivate: (sheetId: string) => void;
|
|
@@ -302,4 +384,4 @@ declare function XlsxSheetTabs(props: {
|
|
|
302
384
|
style?: CSSProperties;
|
|
303
385
|
}): react.JSX.Element;
|
|
304
386
|
|
|
305
|
-
export { ReactXlsxTable, type ReactXlsxTableProps, type ReactXlsxTableRef, XlsxContextMenu, type XlsxContextMenuActions, type XlsxContextMenuItem, type XlsxContextMenuItemKind, type XlsxContextMenuProps, XlsxEditorOverlay, XlsxFormulaBar, XlsxFormulaDependencyDebugPanel, type XlsxFormulaDependencyDebugPanelProps, XlsxNamedRangeManager, type XlsxNamedRangeManagerProps, XlsxSheetTabs, XlsxToolbar, type XlsxToolbarCommand, type XlsxToolbarHistoryState, XlsxToolbarIcon, type XlsxToolbarIconName, type XlsxToolbarNumberFormat, type XlsxToolbarOptions, type XlsxToolbarProps, type XlsxToolbarState, buildXlsxContextMenuItems };
|
|
387
|
+
export { ReactXlsxTable, type ReactXlsxTableProps, type ReactXlsxTableRef, type XlsxCommandHandlers, XlsxContextMenu, type XlsxContextMenuActions, type XlsxContextMenuItem, type XlsxContextMenuItemKind, type XlsxContextMenuProps, type XlsxDocumentInfoProvider, type XlsxDocumentMetadata, XlsxEditorOverlay, XlsxFormulaBar, XlsxFormulaDependencyDebugPanel, type XlsxFormulaDependencyDebugPanelProps, type XlsxHostCommandContext, XlsxNamedRangeManager, type XlsxNamedRangeManagerProps, XlsxSheetTabs, XlsxToolbar, type XlsxToolbarCommand, type XlsxToolbarHistoryState, XlsxToolbarIcon, type XlsxToolbarIconName, type XlsxToolbarNumberFormat, type XlsxToolbarOptions, type XlsxToolbarProps, type XlsxToolbarState, buildXlsxContextMenuItems };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,30 @@
|
|
|
1
|
+
import { XlsxCommandId, WorkBook, XlsxDocumentStamp, XlsxSelectionState, XlsxContextMenuRequest, XlsxCommandState, XlsxCellStyle, XlsxCellType, XlsxTableExportFormat, XlsxCellBorderPreset, XlsxCellBorderLine, XlsxTableOptions, XlsxFeatureOptions, XlsxCleaningWorkerFactory, XlsxTable, XlsxTableExportOptions, XlsxFormulaDependencyDebugSnapshot, XlsxNamedRange, XlsxFormulaBarState, CreateSheetOptions, DuplicateSheetOptions, XlsxRemoteSelection, XlsxFrozenPane, XlsxSortDirection, XlsxHeaderActionType, XlsxFilterOptionItem, XlsxFilterValue, XlsxFilterOptionValue, XlsxFilterCondition, XlsxFilterConditionRelation, XlsxEditorRequest, WorkSheet } from '@canvas-components/xlsx-table';
|
|
2
|
+
export { CellObject, CreateSheetOptions, WorkBook, WorkSheet, XlsxCellAddress, XlsxCellRange, XlsxCleaningPlan, XlsxCleaningRequest, XlsxCleaningWorkerFactory, XlsxCommandDefinition, XlsxCommandId, XlsxCommandState, XlsxEditorRequest, XlsxFeatureOptions, XlsxFormulaBarState, XlsxFormulaDependencyDebugSnapshot, XlsxNamedRange, XlsxPrintOptions, XlsxPrintPlan, XlsxRemoteSelection, XlsxSearchQuery, XlsxSearchSnapshot, XlsxSelectionState, XlsxTableExportFormat, XlsxTableExportOptions, XlsxTableOptions, XlsxTableTheme } from '@canvas-components/xlsx-table';
|
|
1
3
|
import * as react from 'react';
|
|
2
4
|
import { CSSProperties, ForwardedRef } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
+
import { XlsxFileWorkerFactory } from '@canvas-components/xlsx-table/file';
|
|
6
|
+
|
|
7
|
+
/** 宿主动作得到原生只读快照与可取消的实例上下文。 */
|
|
8
|
+
interface XlsxHostCommandContext {
|
|
9
|
+
workbook: WorkBook;
|
|
10
|
+
stamp: XlsxDocumentStamp;
|
|
11
|
+
selection: XlsxSelectionState;
|
|
12
|
+
signal: AbortSignal;
|
|
13
|
+
isCurrent(): boolean;
|
|
14
|
+
invocation?: {
|
|
15
|
+
source: "context-menu";
|
|
16
|
+
target: XlsxContextMenuRequest["target"];
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
type XlsxCommandHandler = (context: XlsxHostCommandContext) => void | Promise<void>;
|
|
20
|
+
type XlsxCommandHandlers = Partial<Record<XlsxCommandId, XlsxCommandHandler>>;
|
|
21
|
+
interface XlsxDocumentMetadata {
|
|
22
|
+
owner?: string;
|
|
23
|
+
createdAt?: string;
|
|
24
|
+
updatedAt?: string;
|
|
25
|
+
permissionLabel?: string;
|
|
26
|
+
}
|
|
27
|
+
type XlsxDocumentInfoProvider = (context: XlsxHostCommandContext) => XlsxDocumentMetadata | Promise<XlsxDocumentMetadata>;
|
|
5
28
|
|
|
6
29
|
type XlsxToolbarIconName = "menu" | "undo" | "redo" | "paint-format" | "clear-format" | "insert" | "font-family" | "font-size" | "bold" | "italic" | "underline" | "strikethrough" | "text-color" | "fill-color" | "border" | "vertical-align" | "vertical-align-top" | "vertical-align-bottom" | "align-left" | "align-center" | "align-right" | "merge-cells" | "number-format" | "currency" | "percent" | "decrease-decimal" | "increase-decimal" | "freeze" | "filter" | "sort" | "conditional-format" | "data-validation" | "formula" | "multidimensional-table" | "find-replace" | "comment" | "ai-formula" | "chevron-down" | "more";
|
|
7
30
|
declare function XlsxToolbarIcon(props: {
|
|
@@ -9,7 +32,8 @@ declare function XlsxToolbarIcon(props: {
|
|
|
9
32
|
size?: number;
|
|
10
33
|
}): react.JSX.Element | null;
|
|
11
34
|
|
|
12
|
-
|
|
35
|
+
/** 旧名称转接统一 ID,保留原有配置接入。 */
|
|
36
|
+
type XlsxToolbarCommand = XlsxCommandId;
|
|
13
37
|
type XlsxToolbarDensity = "compact" | "comfortable";
|
|
14
38
|
interface XlsxToolbarOptions {
|
|
15
39
|
/** 工具栏密度。@default "comfortable" */
|
|
@@ -38,8 +62,13 @@ interface XlsxToolbarState {
|
|
|
38
62
|
sorted?: boolean;
|
|
39
63
|
merged?: boolean;
|
|
40
64
|
canMerge?: boolean;
|
|
65
|
+
hasSelection?: boolean;
|
|
41
66
|
}
|
|
42
67
|
interface XlsxToolbarProps {
|
|
68
|
+
commandStates?: Record<string, XlsxCommandState>;
|
|
69
|
+
commandOverrides?: ReadonlySet<XlsxToolbarCommand>;
|
|
70
|
+
actionLabels?: Record<string, string>;
|
|
71
|
+
onAction?: (action: string) => void;
|
|
43
72
|
historyState: XlsxToolbarHistoryState;
|
|
44
73
|
state?: XlsxToolbarState;
|
|
45
74
|
readonly?: boolean;
|
|
@@ -48,6 +77,7 @@ interface XlsxToolbarProps {
|
|
|
48
77
|
onRedo: () => void;
|
|
49
78
|
onCreateSheet?: () => void;
|
|
50
79
|
onDuplicateSheet?: () => void;
|
|
80
|
+
onOpenFile?: () => void;
|
|
51
81
|
onExport?: (format: XlsxTableExportFormat) => void;
|
|
52
82
|
onApplyStyle?: (style: Partial<XlsxCellStyle>) => void;
|
|
53
83
|
onApplyBorder?: (preset: XlsxCellBorderPreset, line: XlsxCellBorderLine) => void;
|
|
@@ -77,6 +107,17 @@ interface XlsxToolbarProps {
|
|
|
77
107
|
declare function XlsxToolbar(props: XlsxToolbarProps): react.JSX.Element;
|
|
78
108
|
|
|
79
109
|
interface ReactXlsxTableProps extends XlsxTableOptions {
|
|
110
|
+
features?: XlsxFeatureOptions;
|
|
111
|
+
commandHandlers?: XlsxCommandHandlers;
|
|
112
|
+
documentInfoProvider?: XlsxDocumentInfoProvider;
|
|
113
|
+
/** 注入可取消的文件 worker;默认加载发布包 ESM worker。 */
|
|
114
|
+
fileWorkerFactory?: XlsxFileWorkerFactory;
|
|
115
|
+
/** 注入数据清洗预检 worker。 */
|
|
116
|
+
cleaningWorkerFactory?: XlsxCleaningWorkerFactory;
|
|
117
|
+
/** 应用打印权限,显式 false 优先于宿主 handler。 */
|
|
118
|
+
permissions?: {
|
|
119
|
+
print?: boolean;
|
|
120
|
+
};
|
|
80
121
|
className?: string;
|
|
81
122
|
style?: CSSProperties;
|
|
82
123
|
/** 是否显示公式栏。@default true */
|
|
@@ -99,8 +140,41 @@ interface ReactXlsxTableProps extends XlsxTableOptions {
|
|
|
99
140
|
onToolbarCommand?: (command: XlsxToolbarCommand) => void;
|
|
100
141
|
}
|
|
101
142
|
interface ReactXlsxTableRef {
|
|
143
|
+
getDocumentStamp: XlsxTable["getDocumentStamp"];
|
|
144
|
+
getNativePartsState: XlsxTable["getNativePartsState"];
|
|
145
|
+
commitNativeTransaction: XlsxTable["commitNativeTransaction"];
|
|
146
|
+
previewCleaning: XlsxTable["previewCleaning"];
|
|
147
|
+
applyCleaning: XlsxTable["applyCleaning"];
|
|
148
|
+
getNativeSourceInitializationState: XlsxTable["getNativeSourceInitializationState"];
|
|
149
|
+
initializeNativeSource: XlsxTable["initializeNativeSource"];
|
|
150
|
+
getSheetSettings: XlsxTable["getSheetSettings"];
|
|
151
|
+
updateSheetSettings: XlsxTable["updateSheetSettings"];
|
|
152
|
+
createPrintPlan: XlsxTable["createPrintPlan"];
|
|
153
|
+
getViewState: XlsxTable["getViewState"];
|
|
154
|
+
setViewState: XlsxTable["setViewState"];
|
|
155
|
+
setZoom: XlsxTable["setZoom"];
|
|
156
|
+
zoomToSelection: XlsxTable["zoomToSelection"];
|
|
157
|
+
setSelectionNumberFormat: XlsxTable["setSelectionNumberFormat"];
|
|
158
|
+
captureSelectionClipboard: XlsxTable["captureSelectionClipboard"];
|
|
159
|
+
getSelectionClipboard: XlsxTable["getSelectionClipboard"];
|
|
160
|
+
pasteSpecial: XlsxTable["pasteSpecial"];
|
|
161
|
+
setRowHeights: XlsxTable["setRowHeights"];
|
|
162
|
+
setColumnWidths: XlsxTable["setColumnWidths"];
|
|
163
|
+
autoFitRows: XlsxTable["autoFitRows"];
|
|
164
|
+
autoFitColumns: XlsxTable["autoFitColumns"];
|
|
165
|
+
executeCommand(action: string): Promise<boolean>;
|
|
166
|
+
getCommandState(action: string): XlsxCommandState;
|
|
167
|
+
adjustSelectionDecimals: XlsxTable["adjustSelectionDecimals"];
|
|
168
|
+
search: XlsxTable["search"];
|
|
169
|
+
navigateSearchMatch: XlsxTable["navigateSearchMatch"];
|
|
170
|
+
replaceSearchMatches: XlsxTable["replaceSearchMatches"];
|
|
171
|
+
copySelectionText: XlsxTable["copySelectionText"];
|
|
172
|
+
pasteText: XlsxTable["pasteText"];
|
|
173
|
+
openXlsxFile(file: File): Promise<boolean>;
|
|
174
|
+
exportWorkbookXlsx(fileName?: string): Promise<boolean>;
|
|
175
|
+
cancelFileTask(): void;
|
|
102
176
|
getSelection: () => XlsxSelectionState;
|
|
103
|
-
getWorkbook: () =>
|
|
177
|
+
getWorkbook: () => WorkBook;
|
|
104
178
|
exportActiveSheet: (format: XlsxTableExportFormat, options?: XlsxTableExportOptions) => Promise<boolean>;
|
|
105
179
|
getFormulaDependencyDebugSnapshot: () => XlsxFormulaDependencyDebugSnapshot;
|
|
106
180
|
getNamedRanges: () => XlsxNamedRange[];
|
|
@@ -194,7 +268,7 @@ declare function XlsxFormulaDependencyDebugPanel({ snapshot, }: XlsxFormulaDepen
|
|
|
194
268
|
declare function XlsxFormulaBar(props: {
|
|
195
269
|
state: XlsxFormulaBarState;
|
|
196
270
|
onCommit: (text: string) => void;
|
|
197
|
-
workbook?:
|
|
271
|
+
workbook?: WorkBook;
|
|
198
272
|
autocomplete?: boolean;
|
|
199
273
|
rowHeaderWidth?: number;
|
|
200
274
|
style?: CSSProperties;
|
|
@@ -203,6 +277,8 @@ declare function XlsxFormulaBar(props: {
|
|
|
203
277
|
type XlsxContextMenuItemKind = "item" | "separator" | "label";
|
|
204
278
|
interface XlsxContextMenuItem {
|
|
205
279
|
key: string;
|
|
280
|
+
commandId?: XlsxCommandId;
|
|
281
|
+
disabledReason?: string;
|
|
206
282
|
kind: XlsxContextMenuItemKind;
|
|
207
283
|
label?: string;
|
|
208
284
|
disabled?: boolean;
|
|
@@ -248,7 +324,10 @@ interface XlsxContextMenuAnchorRect {
|
|
|
248
324
|
/**
|
|
249
325
|
* 构建 xlsx-table 右键菜单项。
|
|
250
326
|
*/
|
|
251
|
-
declare function buildXlsxContextMenuItems(params:
|
|
327
|
+
declare function buildXlsxContextMenuItems(params: Parameters<typeof buildNativeContextMenuItems>[0]): XlsxContextMenuItem[];
|
|
328
|
+
declare function buildNativeContextMenuItems(params: {
|
|
329
|
+
commandStates?: Record<string, XlsxCommandState>;
|
|
330
|
+
onCommand?: (id: XlsxCommandId, runNative: () => void) => void;
|
|
252
331
|
request: XlsxContextMenuRequest;
|
|
253
332
|
readonly?: boolean;
|
|
254
333
|
mergeState?: {
|
|
@@ -259,8 +338,10 @@ declare function buildXlsxContextMenuItems(params: {
|
|
|
259
338
|
}): XlsxContextMenuItem[];
|
|
260
339
|
|
|
261
340
|
interface XlsxContextMenuProps {
|
|
341
|
+
commandStates?: Record<string, XlsxCommandState>;
|
|
342
|
+
onCommand?: (id: XlsxCommandId, runNative: () => void) => void;
|
|
262
343
|
request: XlsxContextMenuRequest | null;
|
|
263
|
-
workbook:
|
|
344
|
+
workbook: WorkBook;
|
|
264
345
|
readonly?: boolean;
|
|
265
346
|
mergeState?: {
|
|
266
347
|
canMerge?: boolean;
|
|
@@ -272,10 +353,10 @@ interface XlsxContextMenuProps {
|
|
|
272
353
|
/**
|
|
273
354
|
* xlsx-table 右键菜单。
|
|
274
355
|
*/
|
|
275
|
-
declare function XlsxContextMenu({ request, workbook, readonly, mergeState, onClose, actions, }: XlsxContextMenuProps): react.JSX.Element | null;
|
|
356
|
+
declare function XlsxContextMenu({ request, workbook, readonly, mergeState, onClose, commandStates, onCommand, actions, }: XlsxContextMenuProps): react.JSX.Element | null;
|
|
276
357
|
|
|
277
358
|
interface XlsxNamedRangeManagerProps {
|
|
278
|
-
workbook:
|
|
359
|
+
workbook: WorkBook;
|
|
279
360
|
readonly?: boolean;
|
|
280
361
|
onUpsert: (named: XlsxNamedRange) => boolean;
|
|
281
362
|
onRemove: (name: string) => boolean;
|
|
@@ -289,7 +370,8 @@ declare function XlsxNamedRangeManager(props: XlsxNamedRangeManagerProps): react
|
|
|
289
370
|
* Sheet 标签栏。
|
|
290
371
|
*/
|
|
291
372
|
declare function XlsxSheetTabs(props: {
|
|
292
|
-
|
|
373
|
+
commandStates?: Record<string, XlsxCommandState>;
|
|
374
|
+
sheets: WorkSheet[];
|
|
293
375
|
activeSheetId: string | null;
|
|
294
376
|
readonly?: boolean;
|
|
295
377
|
onActivate: (sheetId: string) => void;
|
|
@@ -302,4 +384,4 @@ declare function XlsxSheetTabs(props: {
|
|
|
302
384
|
style?: CSSProperties;
|
|
303
385
|
}): react.JSX.Element;
|
|
304
386
|
|
|
305
|
-
export { ReactXlsxTable, type ReactXlsxTableProps, type ReactXlsxTableRef, XlsxContextMenu, type XlsxContextMenuActions, type XlsxContextMenuItem, type XlsxContextMenuItemKind, type XlsxContextMenuProps, XlsxEditorOverlay, XlsxFormulaBar, XlsxFormulaDependencyDebugPanel, type XlsxFormulaDependencyDebugPanelProps, XlsxNamedRangeManager, type XlsxNamedRangeManagerProps, XlsxSheetTabs, XlsxToolbar, type XlsxToolbarCommand, type XlsxToolbarHistoryState, XlsxToolbarIcon, type XlsxToolbarIconName, type XlsxToolbarNumberFormat, type XlsxToolbarOptions, type XlsxToolbarProps, type XlsxToolbarState, buildXlsxContextMenuItems };
|
|
387
|
+
export { ReactXlsxTable, type ReactXlsxTableProps, type ReactXlsxTableRef, type XlsxCommandHandlers, XlsxContextMenu, type XlsxContextMenuActions, type XlsxContextMenuItem, type XlsxContextMenuItemKind, type XlsxContextMenuProps, type XlsxDocumentInfoProvider, type XlsxDocumentMetadata, XlsxEditorOverlay, XlsxFormulaBar, XlsxFormulaDependencyDebugPanel, type XlsxFormulaDependencyDebugPanelProps, type XlsxHostCommandContext, XlsxNamedRangeManager, type XlsxNamedRangeManagerProps, XlsxSheetTabs, XlsxToolbar, type XlsxToolbarCommand, type XlsxToolbarHistoryState, XlsxToolbarIcon, type XlsxToolbarIconName, type XlsxToolbarNumberFormat, type XlsxToolbarOptions, type XlsxToolbarProps, type XlsxToolbarState, buildXlsxContextMenuItems };
|