@pixerate/editor-react 0.16.0 → 0.17.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 +2 -2
- package/dist/canvas/index.cjs +406 -142
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +66 -3
- package/dist/canvas/index.d.ts +66 -3
- package/dist/canvas/index.js +277 -0
- package/dist/canvas/index.js.map +1 -1
- package/dist/chunk-I3E4KSA2.js +515 -0
- package/dist/chunk-I3E4KSA2.js.map +1 -0
- package/dist/chunk-JR5ZBDR7.js +2012 -0
- package/dist/chunk-JR5ZBDR7.js.map +1 -0
- package/dist/{chunk-XTFR3IMK.js → chunk-ZU54BMDC.js} +473 -160
- package/dist/chunk-ZU54BMDC.js.map +1 -0
- package/dist/generation/index.cjs +290 -0
- package/dist/generation/index.cjs.map +1 -1
- package/dist/generation/index.d.cts +66 -2
- package/dist/generation/index.d.ts +66 -2
- package/dist/generation/index.js +7 -1
- package/dist/image-editor/index.cjs +490 -187
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +34 -2
- package/dist/image-editor/index.d.ts +34 -2
- package/dist/image-editor/index.js +5 -1
- package/dist/index.cjs +2372 -731
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +88 -6
- package/dist/index.d.ts +88 -6
- package/dist/index.js +334 -96
- package/dist/index.js.map +1 -1
- package/dist/spreadsheet/index.cjs +943 -112
- package/dist/spreadsheet/index.cjs.map +1 -1
- package/dist/spreadsheet/index.d.cts +119 -7
- package/dist/spreadsheet/index.d.ts +119 -7
- package/dist/spreadsheet/index.js +11 -1
- package/dist/tokens/index.cjs +395 -0
- package/dist/tokens/index.cjs.map +1 -0
- package/dist/tokens/index.d.cts +54 -0
- package/dist/tokens/index.d.ts +54 -0
- package/dist/tokens/index.js +375 -0
- package/dist/tokens/index.js.map +1 -0
- package/package.json +10 -2
- package/dist/chunk-7SPRQZ6H.js +0 -216
- package/dist/chunk-7SPRQZ6H.js.map +0 -1
- package/dist/chunk-FYIPXHAE.js +0 -1169
- package/dist/chunk-FYIPXHAE.js.map +0 -1
- package/dist/chunk-XTFR3IMK.js.map +0 -1
|
@@ -1,11 +1,37 @@
|
|
|
1
1
|
import * as _pixerate_editor from '@pixerate/editor';
|
|
2
|
-
import { SpreadsheetControllerOptions,
|
|
2
|
+
import { SpreadsheetControllerOptions, SpreadsheetDocument, SpreadsheetNameScope, CellRange, CellCoordinate, SpreadsheetValidationPrompt, SpreadsheetValidationAction, SpreadsheetCommitResult, SpreadsheetController, SpreadsheetColumn, SpreadsheetRow, SpreadsheetDataSource, CellData, SpreadsheetMenuItem, SpreadsheetPanelId, SpreadsheetRowGroup, SpreadsheetViewColumn, FormulaNameSuggestionSource } from '@pixerate/editor/spreadsheet';
|
|
3
3
|
import React__default, { RefObject } from 'react';
|
|
4
4
|
|
|
5
5
|
declare function useSpreadsheetEditor(options?: SpreadsheetControllerOptions): {
|
|
6
|
-
|
|
6
|
+
conditionalFormatOverlay: _pixerate_editor.ConditionalFormatOverlay;
|
|
7
7
|
undo: () => void;
|
|
8
8
|
redo: () => void;
|
|
9
|
+
setActiveSheet: (idOrName: string) => boolean;
|
|
10
|
+
addSheet: (options?: {
|
|
11
|
+
name?: string;
|
|
12
|
+
index?: number;
|
|
13
|
+
document?: Partial<SpreadsheetDocument>;
|
|
14
|
+
activate?: boolean;
|
|
15
|
+
}) => string;
|
|
16
|
+
renameSheet: (idOrName: string, newName: string) => void;
|
|
17
|
+
moveSheet: (idOrName: string, toIndex: number) => boolean;
|
|
18
|
+
deleteSheet: (idOrName: string) => boolean;
|
|
19
|
+
duplicateSheet: (idOrName: string, options?: {
|
|
20
|
+
name?: string;
|
|
21
|
+
index?: number;
|
|
22
|
+
activate?: boolean;
|
|
23
|
+
}) => string | null;
|
|
24
|
+
defineName: (name: string, refersTo: string, options?: SpreadsheetNameScope & {
|
|
25
|
+
comment?: string;
|
|
26
|
+
}) => void;
|
|
27
|
+
renameName: (oldName: string, newName: string, options?: SpreadsheetNameScope) => void;
|
|
28
|
+
deleteName: (name: string, options?: SpreadsheetNameScope) => boolean;
|
|
29
|
+
viewModel: _pixerate_editor.SpreadsheetViewModel;
|
|
30
|
+
/** The sheets in tab order (see `SpreadsheetController.getSheets`). */
|
|
31
|
+
sheets: _pixerate_editor.SpreadsheetSheetInfo[];
|
|
32
|
+
activeSheetId: string;
|
|
33
|
+
/** Defined names (see `SpreadsheetController.getNames`). */
|
|
34
|
+
names: _pixerate_editor.SpreadsheetNameInfo[];
|
|
9
35
|
sortRows: (keys: _pixerate_editor.SortKey[], options?: {
|
|
10
36
|
range?: CellRange | null;
|
|
11
37
|
}) => boolean;
|
|
@@ -45,19 +71,46 @@ declare function useSpreadsheetEditor(options?: SpreadsheetControllerOptions): {
|
|
|
45
71
|
importFromCsv: (csv: string, options?: _pixerate_editor.CsvImportOptions) => void;
|
|
46
72
|
copyToClipboardData: (range?: CellRange | null) => _pixerate_editor.SpreadsheetClipboardData;
|
|
47
73
|
pasteClipboardData: (source: _pixerate_editor.SpreadsheetClipboardSource, target?: _pixerate_editor.CellPosition) => boolean;
|
|
74
|
+
getConditionalFormats: () => _pixerate_editor.ConditionalFormatRule[];
|
|
75
|
+
addConditionalFormat: (rule: _pixerate_editor.NewConditionalFormatRule, options?: {
|
|
76
|
+
priority?: "first" | "last";
|
|
77
|
+
}) => string;
|
|
78
|
+
updateConditionalFormat: (id: string, changes: Partial<_pixerate_editor.NewConditionalFormatRule>) => boolean;
|
|
79
|
+
deleteConditionalFormat: (id: string) => boolean;
|
|
80
|
+
moveConditionalFormat: (id: string, to: number | {
|
|
81
|
+
by: number;
|
|
82
|
+
}) => boolean;
|
|
83
|
+
clearConditionalFormats: (range?: CellRange | null) => void;
|
|
84
|
+
getConditionalFormatOverlay: () => _pixerate_editor.ConditionalFormatOverlay;
|
|
85
|
+
getConditionalFormat: (row: number, col: number) => _pixerate_editor.ConditionalCellFormat | undefined;
|
|
86
|
+
getDataValidations: () => _pixerate_editor.DataValidationRule[];
|
|
87
|
+
getDataValidationAt: (row: number, col: number) => _pixerate_editor.DataValidationRule | undefined;
|
|
88
|
+
addDataValidation: (rule: _pixerate_editor.NewDataValidationRule) => string;
|
|
89
|
+
updateDataValidation: (id: string, changes: Partial<_pixerate_editor.NewDataValidationRule>) => boolean;
|
|
90
|
+
deleteDataValidation: (id: string) => boolean;
|
|
91
|
+
clearDataValidation: (range?: CellRange | null) => void;
|
|
92
|
+
validateCellInput: (row: number, col: number, raw: string) => _pixerate_editor.DataValidationResult;
|
|
93
|
+
getValidationListValues: (row: number, col: number) => string[] | null;
|
|
94
|
+
findInvalidCells: () => _pixerate_editor.CellPosition[];
|
|
95
|
+
setInvalidDataCircles: (show: boolean) => void;
|
|
96
|
+
getInvalidDataCircles: () => boolean;
|
|
97
|
+
isInvalidDataCircled: (row: number, col: number) => boolean;
|
|
48
98
|
document: SpreadsheetDocument;
|
|
49
99
|
activeCell: CellCoordinate | null;
|
|
50
100
|
selectedRange: CellRange | null;
|
|
51
101
|
editingCell: CellCoordinate | null;
|
|
52
102
|
draftValue: string;
|
|
53
103
|
setDraftValue: (value: string) => void;
|
|
104
|
+
validationPrompt: SpreadsheetValidationPrompt | null;
|
|
105
|
+
resolveValidationPrompt: (action: SpreadsheetValidationAction) => void;
|
|
106
|
+
commitCellInput: (rowId: string, colId: string, raw: string) => SpreadsheetCommitResult;
|
|
54
107
|
controller: SpreadsheetController;
|
|
55
108
|
getCell: (rowId: string, colId: string) => _pixerate_editor.CellData;
|
|
56
109
|
setCellValue: (rowId: string, colId: string, raw: string) => void;
|
|
57
110
|
selectCell: (row: number, col: number, extendSelection?: boolean) => void;
|
|
58
111
|
selectRange: (range: CellRange) => void;
|
|
59
112
|
startEditing: (row?: number, col?: number, initialVal?: string) => void;
|
|
60
|
-
commitEditing: (val?: string) =>
|
|
113
|
+
commitEditing: (val?: string) => SpreadsheetCommitResult;
|
|
61
114
|
cancelEditing: () => void;
|
|
62
115
|
moveCursor: (dir: "up" | "down" | "left" | "right", extend?: boolean) => void;
|
|
63
116
|
insertColumn: (index: number, config?: Partial<SpreadsheetColumn>) => void;
|
|
@@ -86,6 +139,8 @@ interface SpreadsheetEditorProps {
|
|
|
86
139
|
onAddColumnClick?: () => void;
|
|
87
140
|
onColumnHeaderClick?: (col: SpreadsheetColumn) => void;
|
|
88
141
|
onColumnResize?: (colId: string, width: number) => void;
|
|
142
|
+
/** Show the sheet tabs bar under the grid (add, switch, rename, reorder, delete sheets). */
|
|
143
|
+
showSheetTabs?: boolean;
|
|
89
144
|
}
|
|
90
145
|
declare const SpreadsheetEditor: React__default.FC<SpreadsheetEditorProps>;
|
|
91
146
|
|
|
@@ -94,6 +149,10 @@ interface SpreadsheetContextMenuProps {
|
|
|
94
149
|
x: number;
|
|
95
150
|
y: number;
|
|
96
151
|
onClose: () => void;
|
|
152
|
+
/** Accessible name of the menu (default "Table actions"). */
|
|
153
|
+
ariaLabel?: string;
|
|
154
|
+
/** Opens a panel for items with `panel` (conditional formatting, data validation). */
|
|
155
|
+
onOpenPanel?: (panel: SpreadsheetPanelId) => void;
|
|
97
156
|
}
|
|
98
157
|
/** The table context menu (sort, filter, freeze, hide, merge, categories, transpose). */
|
|
99
158
|
declare const SpreadsheetContextMenu: React__default.FC<SpreadsheetContextMenuProps>;
|
|
@@ -110,7 +169,7 @@ interface SpreadsheetGroupRowProps {
|
|
|
110
169
|
/** A category header row: collapse toggle, label, row count and per-column summaries. */
|
|
111
170
|
declare const SpreadsheetGroupRow: React__default.FC<SpreadsheetGroupRowProps>;
|
|
112
171
|
|
|
113
|
-
type SpreadsheetState = ReturnType<typeof useSpreadsheetEditor>;
|
|
172
|
+
type SpreadsheetState$1 = ReturnType<typeof useSpreadsheetEditor>;
|
|
114
173
|
/**
|
|
115
174
|
* Copy and paste for the grid. Copy writes TSV, an HTML table and the
|
|
116
175
|
* lossless `application/x.pixerate.spreadsheet+json` format; paste prefers
|
|
@@ -120,14 +179,14 @@ type SpreadsheetState = ReturnType<typeof useSpreadsheetEditor>;
|
|
|
120
179
|
* `copy`/`paste` at `<body>`, not at the focused grid. Text inputs inside the
|
|
121
180
|
* grid keep native copy/paste.
|
|
122
181
|
*/
|
|
123
|
-
declare function useSpreadsheetClipboard(gridRef: RefObject<HTMLElement | null>, state: SpreadsheetState, readOnly: boolean): {
|
|
182
|
+
declare function useSpreadsheetClipboard(gridRef: RefObject<HTMLElement | null>, state: SpreadsheetState$1, readOnly: boolean): {
|
|
124
183
|
copyShortcutFallback: () => void;
|
|
125
184
|
};
|
|
126
185
|
/**
|
|
127
186
|
* Fill handle dragging: press on the handle, move over cells, release to
|
|
128
187
|
* autofill from the selection into the dragged range (one undo step).
|
|
129
188
|
*/
|
|
130
|
-
declare function useFillHandle(state: SpreadsheetState): {
|
|
189
|
+
declare function useFillHandle(state: SpreadsheetState$1): {
|
|
131
190
|
fillTarget: CellRange | null;
|
|
132
191
|
isFilling: boolean;
|
|
133
192
|
startFill: (e: {
|
|
@@ -146,6 +205,8 @@ interface FormulaHintsProps {
|
|
|
146
205
|
onAccept: (value: string) => void;
|
|
147
206
|
/** Maximum number of function suggestions (default 8). */
|
|
148
207
|
limit?: number;
|
|
208
|
+
/** Defined names to suggest too (e.g. `controller.getNameSuggestions()`). */
|
|
209
|
+
names?: readonly FormulaNameSuggestionSource[];
|
|
149
210
|
}
|
|
150
211
|
/**
|
|
151
212
|
* Formula autocomplete for an input: while the value starts with `=`, lists
|
|
@@ -158,4 +219,55 @@ interface FormulaHintsProps {
|
|
|
158
219
|
*/
|
|
159
220
|
declare const FormulaHints: React__default.FC<FormulaHintsProps>;
|
|
160
221
|
|
|
161
|
-
|
|
222
|
+
interface SheetTabsProps {
|
|
223
|
+
state: ReturnType<typeof useSpreadsheetEditor>;
|
|
224
|
+
readOnly?: boolean;
|
|
225
|
+
className?: string;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* The workbook's sheet tabs: click to switch, double-click to rename, drag
|
|
229
|
+
* to reorder, right-click for insert / rename / duplicate / move / delete
|
|
230
|
+
* (delete asks to confirm), and a `+` button to add a sheet.
|
|
231
|
+
*/
|
|
232
|
+
declare const SheetTabs: React__default.FC<SheetTabsProps>;
|
|
233
|
+
|
|
234
|
+
interface NameManagerProps {
|
|
235
|
+
state: ReturnType<typeof useSpreadsheetEditor>;
|
|
236
|
+
readOnly?: boolean;
|
|
237
|
+
onClose?: () => void;
|
|
238
|
+
className?: string;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* A simple Name Manager: lists defined names (name, current value, formula,
|
|
242
|
+
* scope) and adds, edits, renames and deletes them. Renaming a name rewrites
|
|
243
|
+
* the formulas that use it; deleting one leaves them showing `#NAME?`.
|
|
244
|
+
*/
|
|
245
|
+
declare const NameManager: React__default.FC<NameManagerProps>;
|
|
246
|
+
|
|
247
|
+
interface SpreadsheetValidationDialogProps {
|
|
248
|
+
prompt: SpreadsheetValidationPrompt;
|
|
249
|
+
onResolve: (action: SpreadsheetValidationAction) => void;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* The data validation alert: Stop (Retry / Cancel), Warning ("Continue?"
|
|
253
|
+
* Yes / No / Cancel) or Information (OK / Cancel), as in Excel.
|
|
254
|
+
*/
|
|
255
|
+
declare const SpreadsheetValidationDialog: React__default.FC<SpreadsheetValidationDialogProps>;
|
|
256
|
+
|
|
257
|
+
type SpreadsheetState = ReturnType<typeof useSpreadsheetEditor>;
|
|
258
|
+
interface SpreadsheetRulePanelProps {
|
|
259
|
+
state: SpreadsheetState;
|
|
260
|
+
onClose: () => void;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Conditional formatting manager: the sheet's rules in priority order (move,
|
|
264
|
+
* stop if true, delete) and a form to add a rule to a range.
|
|
265
|
+
*/
|
|
266
|
+
declare const SpreadsheetConditionalFormatPanel: React__default.FC<SpreadsheetRulePanelProps>;
|
|
267
|
+
/**
|
|
268
|
+
* Data validation manager: the sheet's rules (delete), a form to validate a
|
|
269
|
+
* range, and "circle invalid data".
|
|
270
|
+
*/
|
|
271
|
+
declare const SpreadsheetDataValidationPanel: React__default.FC<SpreadsheetRulePanelProps>;
|
|
272
|
+
|
|
273
|
+
export { FormulaHints, type FormulaHintsProps, NameManager, type NameManagerProps, SheetTabs, type SheetTabsProps, SpreadsheetConditionalFormatPanel, SpreadsheetContextMenu, type SpreadsheetContextMenuProps, SpreadsheetDataValidationPanel, SpreadsheetEditor, type SpreadsheetEditorProps, SpreadsheetGroupRow, type SpreadsheetGroupRowProps, type SpreadsheetRulePanelProps, SpreadsheetValidationDialog, type SpreadsheetValidationDialogProps, useFillHandle, useSpreadsheetClipboard, useSpreadsheetEditor };
|
|
@@ -1,11 +1,37 @@
|
|
|
1
1
|
import * as _pixerate_editor from '@pixerate/editor';
|
|
2
|
-
import { SpreadsheetControllerOptions,
|
|
2
|
+
import { SpreadsheetControllerOptions, SpreadsheetDocument, SpreadsheetNameScope, CellRange, CellCoordinate, SpreadsheetValidationPrompt, SpreadsheetValidationAction, SpreadsheetCommitResult, SpreadsheetController, SpreadsheetColumn, SpreadsheetRow, SpreadsheetDataSource, CellData, SpreadsheetMenuItem, SpreadsheetPanelId, SpreadsheetRowGroup, SpreadsheetViewColumn, FormulaNameSuggestionSource } from '@pixerate/editor/spreadsheet';
|
|
3
3
|
import React__default, { RefObject } from 'react';
|
|
4
4
|
|
|
5
5
|
declare function useSpreadsheetEditor(options?: SpreadsheetControllerOptions): {
|
|
6
|
-
|
|
6
|
+
conditionalFormatOverlay: _pixerate_editor.ConditionalFormatOverlay;
|
|
7
7
|
undo: () => void;
|
|
8
8
|
redo: () => void;
|
|
9
|
+
setActiveSheet: (idOrName: string) => boolean;
|
|
10
|
+
addSheet: (options?: {
|
|
11
|
+
name?: string;
|
|
12
|
+
index?: number;
|
|
13
|
+
document?: Partial<SpreadsheetDocument>;
|
|
14
|
+
activate?: boolean;
|
|
15
|
+
}) => string;
|
|
16
|
+
renameSheet: (idOrName: string, newName: string) => void;
|
|
17
|
+
moveSheet: (idOrName: string, toIndex: number) => boolean;
|
|
18
|
+
deleteSheet: (idOrName: string) => boolean;
|
|
19
|
+
duplicateSheet: (idOrName: string, options?: {
|
|
20
|
+
name?: string;
|
|
21
|
+
index?: number;
|
|
22
|
+
activate?: boolean;
|
|
23
|
+
}) => string | null;
|
|
24
|
+
defineName: (name: string, refersTo: string, options?: SpreadsheetNameScope & {
|
|
25
|
+
comment?: string;
|
|
26
|
+
}) => void;
|
|
27
|
+
renameName: (oldName: string, newName: string, options?: SpreadsheetNameScope) => void;
|
|
28
|
+
deleteName: (name: string, options?: SpreadsheetNameScope) => boolean;
|
|
29
|
+
viewModel: _pixerate_editor.SpreadsheetViewModel;
|
|
30
|
+
/** The sheets in tab order (see `SpreadsheetController.getSheets`). */
|
|
31
|
+
sheets: _pixerate_editor.SpreadsheetSheetInfo[];
|
|
32
|
+
activeSheetId: string;
|
|
33
|
+
/** Defined names (see `SpreadsheetController.getNames`). */
|
|
34
|
+
names: _pixerate_editor.SpreadsheetNameInfo[];
|
|
9
35
|
sortRows: (keys: _pixerate_editor.SortKey[], options?: {
|
|
10
36
|
range?: CellRange | null;
|
|
11
37
|
}) => boolean;
|
|
@@ -45,19 +71,46 @@ declare function useSpreadsheetEditor(options?: SpreadsheetControllerOptions): {
|
|
|
45
71
|
importFromCsv: (csv: string, options?: _pixerate_editor.CsvImportOptions) => void;
|
|
46
72
|
copyToClipboardData: (range?: CellRange | null) => _pixerate_editor.SpreadsheetClipboardData;
|
|
47
73
|
pasteClipboardData: (source: _pixerate_editor.SpreadsheetClipboardSource, target?: _pixerate_editor.CellPosition) => boolean;
|
|
74
|
+
getConditionalFormats: () => _pixerate_editor.ConditionalFormatRule[];
|
|
75
|
+
addConditionalFormat: (rule: _pixerate_editor.NewConditionalFormatRule, options?: {
|
|
76
|
+
priority?: "first" | "last";
|
|
77
|
+
}) => string;
|
|
78
|
+
updateConditionalFormat: (id: string, changes: Partial<_pixerate_editor.NewConditionalFormatRule>) => boolean;
|
|
79
|
+
deleteConditionalFormat: (id: string) => boolean;
|
|
80
|
+
moveConditionalFormat: (id: string, to: number | {
|
|
81
|
+
by: number;
|
|
82
|
+
}) => boolean;
|
|
83
|
+
clearConditionalFormats: (range?: CellRange | null) => void;
|
|
84
|
+
getConditionalFormatOverlay: () => _pixerate_editor.ConditionalFormatOverlay;
|
|
85
|
+
getConditionalFormat: (row: number, col: number) => _pixerate_editor.ConditionalCellFormat | undefined;
|
|
86
|
+
getDataValidations: () => _pixerate_editor.DataValidationRule[];
|
|
87
|
+
getDataValidationAt: (row: number, col: number) => _pixerate_editor.DataValidationRule | undefined;
|
|
88
|
+
addDataValidation: (rule: _pixerate_editor.NewDataValidationRule) => string;
|
|
89
|
+
updateDataValidation: (id: string, changes: Partial<_pixerate_editor.NewDataValidationRule>) => boolean;
|
|
90
|
+
deleteDataValidation: (id: string) => boolean;
|
|
91
|
+
clearDataValidation: (range?: CellRange | null) => void;
|
|
92
|
+
validateCellInput: (row: number, col: number, raw: string) => _pixerate_editor.DataValidationResult;
|
|
93
|
+
getValidationListValues: (row: number, col: number) => string[] | null;
|
|
94
|
+
findInvalidCells: () => _pixerate_editor.CellPosition[];
|
|
95
|
+
setInvalidDataCircles: (show: boolean) => void;
|
|
96
|
+
getInvalidDataCircles: () => boolean;
|
|
97
|
+
isInvalidDataCircled: (row: number, col: number) => boolean;
|
|
48
98
|
document: SpreadsheetDocument;
|
|
49
99
|
activeCell: CellCoordinate | null;
|
|
50
100
|
selectedRange: CellRange | null;
|
|
51
101
|
editingCell: CellCoordinate | null;
|
|
52
102
|
draftValue: string;
|
|
53
103
|
setDraftValue: (value: string) => void;
|
|
104
|
+
validationPrompt: SpreadsheetValidationPrompt | null;
|
|
105
|
+
resolveValidationPrompt: (action: SpreadsheetValidationAction) => void;
|
|
106
|
+
commitCellInput: (rowId: string, colId: string, raw: string) => SpreadsheetCommitResult;
|
|
54
107
|
controller: SpreadsheetController;
|
|
55
108
|
getCell: (rowId: string, colId: string) => _pixerate_editor.CellData;
|
|
56
109
|
setCellValue: (rowId: string, colId: string, raw: string) => void;
|
|
57
110
|
selectCell: (row: number, col: number, extendSelection?: boolean) => void;
|
|
58
111
|
selectRange: (range: CellRange) => void;
|
|
59
112
|
startEditing: (row?: number, col?: number, initialVal?: string) => void;
|
|
60
|
-
commitEditing: (val?: string) =>
|
|
113
|
+
commitEditing: (val?: string) => SpreadsheetCommitResult;
|
|
61
114
|
cancelEditing: () => void;
|
|
62
115
|
moveCursor: (dir: "up" | "down" | "left" | "right", extend?: boolean) => void;
|
|
63
116
|
insertColumn: (index: number, config?: Partial<SpreadsheetColumn>) => void;
|
|
@@ -86,6 +139,8 @@ interface SpreadsheetEditorProps {
|
|
|
86
139
|
onAddColumnClick?: () => void;
|
|
87
140
|
onColumnHeaderClick?: (col: SpreadsheetColumn) => void;
|
|
88
141
|
onColumnResize?: (colId: string, width: number) => void;
|
|
142
|
+
/** Show the sheet tabs bar under the grid (add, switch, rename, reorder, delete sheets). */
|
|
143
|
+
showSheetTabs?: boolean;
|
|
89
144
|
}
|
|
90
145
|
declare const SpreadsheetEditor: React__default.FC<SpreadsheetEditorProps>;
|
|
91
146
|
|
|
@@ -94,6 +149,10 @@ interface SpreadsheetContextMenuProps {
|
|
|
94
149
|
x: number;
|
|
95
150
|
y: number;
|
|
96
151
|
onClose: () => void;
|
|
152
|
+
/** Accessible name of the menu (default "Table actions"). */
|
|
153
|
+
ariaLabel?: string;
|
|
154
|
+
/** Opens a panel for items with `panel` (conditional formatting, data validation). */
|
|
155
|
+
onOpenPanel?: (panel: SpreadsheetPanelId) => void;
|
|
97
156
|
}
|
|
98
157
|
/** The table context menu (sort, filter, freeze, hide, merge, categories, transpose). */
|
|
99
158
|
declare const SpreadsheetContextMenu: React__default.FC<SpreadsheetContextMenuProps>;
|
|
@@ -110,7 +169,7 @@ interface SpreadsheetGroupRowProps {
|
|
|
110
169
|
/** A category header row: collapse toggle, label, row count and per-column summaries. */
|
|
111
170
|
declare const SpreadsheetGroupRow: React__default.FC<SpreadsheetGroupRowProps>;
|
|
112
171
|
|
|
113
|
-
type SpreadsheetState = ReturnType<typeof useSpreadsheetEditor>;
|
|
172
|
+
type SpreadsheetState$1 = ReturnType<typeof useSpreadsheetEditor>;
|
|
114
173
|
/**
|
|
115
174
|
* Copy and paste for the grid. Copy writes TSV, an HTML table and the
|
|
116
175
|
* lossless `application/x.pixerate.spreadsheet+json` format; paste prefers
|
|
@@ -120,14 +179,14 @@ type SpreadsheetState = ReturnType<typeof useSpreadsheetEditor>;
|
|
|
120
179
|
* `copy`/`paste` at `<body>`, not at the focused grid. Text inputs inside the
|
|
121
180
|
* grid keep native copy/paste.
|
|
122
181
|
*/
|
|
123
|
-
declare function useSpreadsheetClipboard(gridRef: RefObject<HTMLElement | null>, state: SpreadsheetState, readOnly: boolean): {
|
|
182
|
+
declare function useSpreadsheetClipboard(gridRef: RefObject<HTMLElement | null>, state: SpreadsheetState$1, readOnly: boolean): {
|
|
124
183
|
copyShortcutFallback: () => void;
|
|
125
184
|
};
|
|
126
185
|
/**
|
|
127
186
|
* Fill handle dragging: press on the handle, move over cells, release to
|
|
128
187
|
* autofill from the selection into the dragged range (one undo step).
|
|
129
188
|
*/
|
|
130
|
-
declare function useFillHandle(state: SpreadsheetState): {
|
|
189
|
+
declare function useFillHandle(state: SpreadsheetState$1): {
|
|
131
190
|
fillTarget: CellRange | null;
|
|
132
191
|
isFilling: boolean;
|
|
133
192
|
startFill: (e: {
|
|
@@ -146,6 +205,8 @@ interface FormulaHintsProps {
|
|
|
146
205
|
onAccept: (value: string) => void;
|
|
147
206
|
/** Maximum number of function suggestions (default 8). */
|
|
148
207
|
limit?: number;
|
|
208
|
+
/** Defined names to suggest too (e.g. `controller.getNameSuggestions()`). */
|
|
209
|
+
names?: readonly FormulaNameSuggestionSource[];
|
|
149
210
|
}
|
|
150
211
|
/**
|
|
151
212
|
* Formula autocomplete for an input: while the value starts with `=`, lists
|
|
@@ -158,4 +219,55 @@ interface FormulaHintsProps {
|
|
|
158
219
|
*/
|
|
159
220
|
declare const FormulaHints: React__default.FC<FormulaHintsProps>;
|
|
160
221
|
|
|
161
|
-
|
|
222
|
+
interface SheetTabsProps {
|
|
223
|
+
state: ReturnType<typeof useSpreadsheetEditor>;
|
|
224
|
+
readOnly?: boolean;
|
|
225
|
+
className?: string;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* The workbook's sheet tabs: click to switch, double-click to rename, drag
|
|
229
|
+
* to reorder, right-click for insert / rename / duplicate / move / delete
|
|
230
|
+
* (delete asks to confirm), and a `+` button to add a sheet.
|
|
231
|
+
*/
|
|
232
|
+
declare const SheetTabs: React__default.FC<SheetTabsProps>;
|
|
233
|
+
|
|
234
|
+
interface NameManagerProps {
|
|
235
|
+
state: ReturnType<typeof useSpreadsheetEditor>;
|
|
236
|
+
readOnly?: boolean;
|
|
237
|
+
onClose?: () => void;
|
|
238
|
+
className?: string;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* A simple Name Manager: lists defined names (name, current value, formula,
|
|
242
|
+
* scope) and adds, edits, renames and deletes them. Renaming a name rewrites
|
|
243
|
+
* the formulas that use it; deleting one leaves them showing `#NAME?`.
|
|
244
|
+
*/
|
|
245
|
+
declare const NameManager: React__default.FC<NameManagerProps>;
|
|
246
|
+
|
|
247
|
+
interface SpreadsheetValidationDialogProps {
|
|
248
|
+
prompt: SpreadsheetValidationPrompt;
|
|
249
|
+
onResolve: (action: SpreadsheetValidationAction) => void;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* The data validation alert: Stop (Retry / Cancel), Warning ("Continue?"
|
|
253
|
+
* Yes / No / Cancel) or Information (OK / Cancel), as in Excel.
|
|
254
|
+
*/
|
|
255
|
+
declare const SpreadsheetValidationDialog: React__default.FC<SpreadsheetValidationDialogProps>;
|
|
256
|
+
|
|
257
|
+
type SpreadsheetState = ReturnType<typeof useSpreadsheetEditor>;
|
|
258
|
+
interface SpreadsheetRulePanelProps {
|
|
259
|
+
state: SpreadsheetState;
|
|
260
|
+
onClose: () => void;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Conditional formatting manager: the sheet's rules in priority order (move,
|
|
264
|
+
* stop if true, delete) and a form to add a rule to a range.
|
|
265
|
+
*/
|
|
266
|
+
declare const SpreadsheetConditionalFormatPanel: React__default.FC<SpreadsheetRulePanelProps>;
|
|
267
|
+
/**
|
|
268
|
+
* Data validation manager: the sheet's rules (delete), a form to validate a
|
|
269
|
+
* range, and "circle invalid data".
|
|
270
|
+
*/
|
|
271
|
+
declare const SpreadsheetDataValidationPanel: React__default.FC<SpreadsheetRulePanelProps>;
|
|
272
|
+
|
|
273
|
+
export { FormulaHints, type FormulaHintsProps, NameManager, type NameManagerProps, SheetTabs, type SheetTabsProps, SpreadsheetConditionalFormatPanel, SpreadsheetContextMenu, type SpreadsheetContextMenuProps, SpreadsheetDataValidationPanel, SpreadsheetEditor, type SpreadsheetEditorProps, SpreadsheetGroupRow, type SpreadsheetGroupRowProps, type SpreadsheetRulePanelProps, SpreadsheetValidationDialog, type SpreadsheetValidationDialogProps, useFillHandle, useSpreadsheetClipboard, useSpreadsheetEditor };
|
|
@@ -1,17 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FormulaHints,
|
|
3
|
+
NameManager,
|
|
4
|
+
SheetTabs,
|
|
5
|
+
SpreadsheetConditionalFormatPanel,
|
|
3
6
|
SpreadsheetContextMenu,
|
|
7
|
+
SpreadsheetDataValidationPanel,
|
|
4
8
|
SpreadsheetEditor,
|
|
5
9
|
SpreadsheetGroupRow,
|
|
10
|
+
SpreadsheetValidationDialog,
|
|
6
11
|
useFillHandle,
|
|
7
12
|
useSpreadsheetClipboard,
|
|
8
13
|
useSpreadsheetEditor
|
|
9
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-JR5ZBDR7.js";
|
|
10
15
|
export {
|
|
11
16
|
FormulaHints,
|
|
17
|
+
NameManager,
|
|
18
|
+
SheetTabs,
|
|
19
|
+
SpreadsheetConditionalFormatPanel,
|
|
12
20
|
SpreadsheetContextMenu,
|
|
21
|
+
SpreadsheetDataValidationPanel,
|
|
13
22
|
SpreadsheetEditor,
|
|
14
23
|
SpreadsheetGroupRow,
|
|
24
|
+
SpreadsheetValidationDialog,
|
|
15
25
|
useFillHandle,
|
|
16
26
|
useSpreadsheetClipboard,
|
|
17
27
|
useSpreadsheetEditor
|