@pixerate/editor-react 0.15.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 +6 -2
- package/dist/canvas/index.cjs +484 -119
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +122 -3
- package/dist/canvas/index.d.ts +122 -3
- package/dist/canvas/index.js +380 -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-XWFU2CSG.js +167 -0
- package/dist/chunk-XWFU2CSG.js.map +1 -0
- package/dist/chunk-ZU54BMDC.js +2128 -0
- package/dist/chunk-ZU54BMDC.js.map +1 -0
- package/dist/generation/index.cjs +525 -0
- package/dist/generation/index.cjs.map +1 -0
- package/dist/generation/index.d.cts +124 -0
- package/dist/generation/index.d.ts +124 -0
- package/dist/generation/index.js +19 -0
- package/dist/generation/index.js.map +1 -0
- package/dist/image-editor/index.cjs +988 -337
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +92 -2
- package/dist/image-editor/index.d.ts +92 -2
- package/dist/image-editor/index.js +17 -3
- package/dist/index.cjs +3628 -754
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +226 -5
- package/dist/index.d.ts +226 -5
- package/dist/index.js +868 -77
- package/dist/index.js.map +1 -1
- package/dist/persistence/index.cjs +191 -0
- package/dist/persistence/index.cjs.map +1 -0
- package/dist/persistence/index.d.cts +77 -0
- package/dist/persistence/index.d.ts +77 -0
- package/dist/persistence/index.js +9 -0
- package/dist/persistence/index.js.map +1 -0
- package/dist/spreadsheet/index.cjs +949 -111
- package/dist/spreadsheet/index.cjs.map +1 -1
- package/dist/spreadsheet/index.d.cts +121 -7
- package/dist/spreadsheet/index.d.ts +121 -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 +26 -2
- package/dist/chunk-LPFZMZ3L.js +0 -1461
- package/dist/chunk-LPFZMZ3L.js.map +0 -1
- package/dist/chunk-QVQYYHJ5.js +0 -1161
- package/dist/chunk-QVQYYHJ5.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;
|
|
@@ -39,23 +65,52 @@ declare function useSpreadsheetEditor(options?: SpreadsheetControllerOptions): {
|
|
|
39
65
|
toggleGroupCollapsed: (key: string) => void;
|
|
40
66
|
getGroups: () => _pixerate_editor.SpreadsheetRowGroup[];
|
|
41
67
|
transposeRange: (range?: CellRange | null) => boolean;
|
|
68
|
+
setCellNumberFormat: (range: CellRange | null, code: string | null) => boolean;
|
|
69
|
+
setColumnNumberFormat: (colId: string, code: string | null) => void;
|
|
42
70
|
exportToCsv: (options?: _pixerate_editor.CsvExportOptions) => string;
|
|
43
71
|
importFromCsv: (csv: string, options?: _pixerate_editor.CsvImportOptions) => void;
|
|
44
72
|
copyToClipboardData: (range?: CellRange | null) => _pixerate_editor.SpreadsheetClipboardData;
|
|
45
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;
|
|
46
98
|
document: SpreadsheetDocument;
|
|
47
99
|
activeCell: CellCoordinate | null;
|
|
48
100
|
selectedRange: CellRange | null;
|
|
49
101
|
editingCell: CellCoordinate | null;
|
|
50
102
|
draftValue: string;
|
|
51
103
|
setDraftValue: (value: string) => void;
|
|
104
|
+
validationPrompt: SpreadsheetValidationPrompt | null;
|
|
105
|
+
resolveValidationPrompt: (action: SpreadsheetValidationAction) => void;
|
|
106
|
+
commitCellInput: (rowId: string, colId: string, raw: string) => SpreadsheetCommitResult;
|
|
52
107
|
controller: SpreadsheetController;
|
|
53
108
|
getCell: (rowId: string, colId: string) => _pixerate_editor.CellData;
|
|
54
109
|
setCellValue: (rowId: string, colId: string, raw: string) => void;
|
|
55
110
|
selectCell: (row: number, col: number, extendSelection?: boolean) => void;
|
|
56
111
|
selectRange: (range: CellRange) => void;
|
|
57
112
|
startEditing: (row?: number, col?: number, initialVal?: string) => void;
|
|
58
|
-
commitEditing: (val?: string) =>
|
|
113
|
+
commitEditing: (val?: string) => SpreadsheetCommitResult;
|
|
59
114
|
cancelEditing: () => void;
|
|
60
115
|
moveCursor: (dir: "up" | "down" | "left" | "right", extend?: boolean) => void;
|
|
61
116
|
insertColumn: (index: number, config?: Partial<SpreadsheetColumn>) => void;
|
|
@@ -84,6 +139,8 @@ interface SpreadsheetEditorProps {
|
|
|
84
139
|
onAddColumnClick?: () => void;
|
|
85
140
|
onColumnHeaderClick?: (col: SpreadsheetColumn) => void;
|
|
86
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;
|
|
87
144
|
}
|
|
88
145
|
declare const SpreadsheetEditor: React__default.FC<SpreadsheetEditorProps>;
|
|
89
146
|
|
|
@@ -92,6 +149,10 @@ interface SpreadsheetContextMenuProps {
|
|
|
92
149
|
x: number;
|
|
93
150
|
y: number;
|
|
94
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;
|
|
95
156
|
}
|
|
96
157
|
/** The table context menu (sort, filter, freeze, hide, merge, categories, transpose). */
|
|
97
158
|
declare const SpreadsheetContextMenu: React__default.FC<SpreadsheetContextMenuProps>;
|
|
@@ -108,7 +169,7 @@ interface SpreadsheetGroupRowProps {
|
|
|
108
169
|
/** A category header row: collapse toggle, label, row count and per-column summaries. */
|
|
109
170
|
declare const SpreadsheetGroupRow: React__default.FC<SpreadsheetGroupRowProps>;
|
|
110
171
|
|
|
111
|
-
type SpreadsheetState = ReturnType<typeof useSpreadsheetEditor>;
|
|
172
|
+
type SpreadsheetState$1 = ReturnType<typeof useSpreadsheetEditor>;
|
|
112
173
|
/**
|
|
113
174
|
* Copy and paste for the grid. Copy writes TSV, an HTML table and the
|
|
114
175
|
* lossless `application/x.pixerate.spreadsheet+json` format; paste prefers
|
|
@@ -118,14 +179,14 @@ type SpreadsheetState = ReturnType<typeof useSpreadsheetEditor>;
|
|
|
118
179
|
* `copy`/`paste` at `<body>`, not at the focused grid. Text inputs inside the
|
|
119
180
|
* grid keep native copy/paste.
|
|
120
181
|
*/
|
|
121
|
-
declare function useSpreadsheetClipboard(gridRef: RefObject<HTMLElement | null>, state: SpreadsheetState, readOnly: boolean): {
|
|
182
|
+
declare function useSpreadsheetClipboard(gridRef: RefObject<HTMLElement | null>, state: SpreadsheetState$1, readOnly: boolean): {
|
|
122
183
|
copyShortcutFallback: () => void;
|
|
123
184
|
};
|
|
124
185
|
/**
|
|
125
186
|
* Fill handle dragging: press on the handle, move over cells, release to
|
|
126
187
|
* autofill from the selection into the dragged range (one undo step).
|
|
127
188
|
*/
|
|
128
|
-
declare function useFillHandle(state: SpreadsheetState): {
|
|
189
|
+
declare function useFillHandle(state: SpreadsheetState$1): {
|
|
129
190
|
fillTarget: CellRange | null;
|
|
130
191
|
isFilling: boolean;
|
|
131
192
|
startFill: (e: {
|
|
@@ -144,6 +205,8 @@ interface FormulaHintsProps {
|
|
|
144
205
|
onAccept: (value: string) => void;
|
|
145
206
|
/** Maximum number of function suggestions (default 8). */
|
|
146
207
|
limit?: number;
|
|
208
|
+
/** Defined names to suggest too (e.g. `controller.getNameSuggestions()`). */
|
|
209
|
+
names?: readonly FormulaNameSuggestionSource[];
|
|
147
210
|
}
|
|
148
211
|
/**
|
|
149
212
|
* Formula autocomplete for an input: while the value starts with `=`, lists
|
|
@@ -156,4 +219,55 @@ interface FormulaHintsProps {
|
|
|
156
219
|
*/
|
|
157
220
|
declare const FormulaHints: React__default.FC<FormulaHintsProps>;
|
|
158
221
|
|
|
159
|
-
|
|
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;
|
|
@@ -39,23 +65,52 @@ declare function useSpreadsheetEditor(options?: SpreadsheetControllerOptions): {
|
|
|
39
65
|
toggleGroupCollapsed: (key: string) => void;
|
|
40
66
|
getGroups: () => _pixerate_editor.SpreadsheetRowGroup[];
|
|
41
67
|
transposeRange: (range?: CellRange | null) => boolean;
|
|
68
|
+
setCellNumberFormat: (range: CellRange | null, code: string | null) => boolean;
|
|
69
|
+
setColumnNumberFormat: (colId: string, code: string | null) => void;
|
|
42
70
|
exportToCsv: (options?: _pixerate_editor.CsvExportOptions) => string;
|
|
43
71
|
importFromCsv: (csv: string, options?: _pixerate_editor.CsvImportOptions) => void;
|
|
44
72
|
copyToClipboardData: (range?: CellRange | null) => _pixerate_editor.SpreadsheetClipboardData;
|
|
45
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;
|
|
46
98
|
document: SpreadsheetDocument;
|
|
47
99
|
activeCell: CellCoordinate | null;
|
|
48
100
|
selectedRange: CellRange | null;
|
|
49
101
|
editingCell: CellCoordinate | null;
|
|
50
102
|
draftValue: string;
|
|
51
103
|
setDraftValue: (value: string) => void;
|
|
104
|
+
validationPrompt: SpreadsheetValidationPrompt | null;
|
|
105
|
+
resolveValidationPrompt: (action: SpreadsheetValidationAction) => void;
|
|
106
|
+
commitCellInput: (rowId: string, colId: string, raw: string) => SpreadsheetCommitResult;
|
|
52
107
|
controller: SpreadsheetController;
|
|
53
108
|
getCell: (rowId: string, colId: string) => _pixerate_editor.CellData;
|
|
54
109
|
setCellValue: (rowId: string, colId: string, raw: string) => void;
|
|
55
110
|
selectCell: (row: number, col: number, extendSelection?: boolean) => void;
|
|
56
111
|
selectRange: (range: CellRange) => void;
|
|
57
112
|
startEditing: (row?: number, col?: number, initialVal?: string) => void;
|
|
58
|
-
commitEditing: (val?: string) =>
|
|
113
|
+
commitEditing: (val?: string) => SpreadsheetCommitResult;
|
|
59
114
|
cancelEditing: () => void;
|
|
60
115
|
moveCursor: (dir: "up" | "down" | "left" | "right", extend?: boolean) => void;
|
|
61
116
|
insertColumn: (index: number, config?: Partial<SpreadsheetColumn>) => void;
|
|
@@ -84,6 +139,8 @@ interface SpreadsheetEditorProps {
|
|
|
84
139
|
onAddColumnClick?: () => void;
|
|
85
140
|
onColumnHeaderClick?: (col: SpreadsheetColumn) => void;
|
|
86
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;
|
|
87
144
|
}
|
|
88
145
|
declare const SpreadsheetEditor: React__default.FC<SpreadsheetEditorProps>;
|
|
89
146
|
|
|
@@ -92,6 +149,10 @@ interface SpreadsheetContextMenuProps {
|
|
|
92
149
|
x: number;
|
|
93
150
|
y: number;
|
|
94
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;
|
|
95
156
|
}
|
|
96
157
|
/** The table context menu (sort, filter, freeze, hide, merge, categories, transpose). */
|
|
97
158
|
declare const SpreadsheetContextMenu: React__default.FC<SpreadsheetContextMenuProps>;
|
|
@@ -108,7 +169,7 @@ interface SpreadsheetGroupRowProps {
|
|
|
108
169
|
/** A category header row: collapse toggle, label, row count and per-column summaries. */
|
|
109
170
|
declare const SpreadsheetGroupRow: React__default.FC<SpreadsheetGroupRowProps>;
|
|
110
171
|
|
|
111
|
-
type SpreadsheetState = ReturnType<typeof useSpreadsheetEditor>;
|
|
172
|
+
type SpreadsheetState$1 = ReturnType<typeof useSpreadsheetEditor>;
|
|
112
173
|
/**
|
|
113
174
|
* Copy and paste for the grid. Copy writes TSV, an HTML table and the
|
|
114
175
|
* lossless `application/x.pixerate.spreadsheet+json` format; paste prefers
|
|
@@ -118,14 +179,14 @@ type SpreadsheetState = ReturnType<typeof useSpreadsheetEditor>;
|
|
|
118
179
|
* `copy`/`paste` at `<body>`, not at the focused grid. Text inputs inside the
|
|
119
180
|
* grid keep native copy/paste.
|
|
120
181
|
*/
|
|
121
|
-
declare function useSpreadsheetClipboard(gridRef: RefObject<HTMLElement | null>, state: SpreadsheetState, readOnly: boolean): {
|
|
182
|
+
declare function useSpreadsheetClipboard(gridRef: RefObject<HTMLElement | null>, state: SpreadsheetState$1, readOnly: boolean): {
|
|
122
183
|
copyShortcutFallback: () => void;
|
|
123
184
|
};
|
|
124
185
|
/**
|
|
125
186
|
* Fill handle dragging: press on the handle, move over cells, release to
|
|
126
187
|
* autofill from the selection into the dragged range (one undo step).
|
|
127
188
|
*/
|
|
128
|
-
declare function useFillHandle(state: SpreadsheetState): {
|
|
189
|
+
declare function useFillHandle(state: SpreadsheetState$1): {
|
|
129
190
|
fillTarget: CellRange | null;
|
|
130
191
|
isFilling: boolean;
|
|
131
192
|
startFill: (e: {
|
|
@@ -144,6 +205,8 @@ interface FormulaHintsProps {
|
|
|
144
205
|
onAccept: (value: string) => void;
|
|
145
206
|
/** Maximum number of function suggestions (default 8). */
|
|
146
207
|
limit?: number;
|
|
208
|
+
/** Defined names to suggest too (e.g. `controller.getNameSuggestions()`). */
|
|
209
|
+
names?: readonly FormulaNameSuggestionSource[];
|
|
147
210
|
}
|
|
148
211
|
/**
|
|
149
212
|
* Formula autocomplete for an input: while the value starts with `=`, lists
|
|
@@ -156,4 +219,55 @@ interface FormulaHintsProps {
|
|
|
156
219
|
*/
|
|
157
220
|
declare const FormulaHints: React__default.FC<FormulaHintsProps>;
|
|
158
221
|
|
|
159
|
-
|
|
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
|