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