@pixerate/editor-react 0.16.0 → 0.18.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 +4 -2
- package/dist/canvas/index.cjs +1094 -143
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +277 -3
- package/dist/canvas/index.d.ts +277 -3
- package/dist/canvas/index.js +976 -0
- package/dist/canvas/index.js.map +1 -1
- package/dist/chunk-34HEZX7J.js +2144 -0
- package/dist/chunk-34HEZX7J.js.map +1 -0
- package/dist/chunk-I3E4KSA2.js +515 -0
- package/dist/chunk-I3E4KSA2.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 +2792 -823
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +188 -7
- package/dist/index.d.ts +188 -7
- package/dist/index.js +600 -158
- package/dist/index.js.map +1 -1
- package/dist/spreadsheet/index.cjs +1099 -142
- package/dist/spreadsheet/index.cjs.map +1 -1
- package/dist/spreadsheet/index.d.cts +156 -8
- package/dist/spreadsheet/index.d.ts +156 -8
- package/dist/spreadsheet/index.js +15 -3
- 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,38 @@
|
|
|
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, SpreadsheetViewMetrics, SpreadsheetViewWindow, SpreadsheetViewModel } 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[];
|
|
35
|
+
mergeCells: (range?: CellRange | null) => boolean;
|
|
9
36
|
sortRows: (keys: _pixerate_editor.SortKey[], options?: {
|
|
10
37
|
range?: CellRange | null;
|
|
11
38
|
}) => boolean;
|
|
@@ -29,7 +56,6 @@ declare function useSpreadsheetEditor(options?: SpreadsheetControllerOptions): {
|
|
|
29
56
|
unhideAll: () => void;
|
|
30
57
|
getMerges: () => CellRange[];
|
|
31
58
|
getMergeAt: (row: number, col: number) => CellRange | null;
|
|
32
|
-
mergeCells: (range?: CellRange | null) => boolean;
|
|
33
59
|
unmergeCells: (range?: CellRange | null) => boolean;
|
|
34
60
|
autofill: (source: CellRange, target: CellRange) => boolean;
|
|
35
61
|
groupRowsBy: (colId: string, summaries?: _pixerate_editor.GroupSummary[]) => void;
|
|
@@ -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,14 @@ 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;
|
|
144
|
+
/**
|
|
145
|
+
* Render only the rows and columns in (or near) view. `'auto'` (default)
|
|
146
|
+
* virtualises sheets with more than 200 displayed rows or 60 columns;
|
|
147
|
+
* `true` / `false` force it.
|
|
148
|
+
*/
|
|
149
|
+
virtualize?: boolean | 'auto';
|
|
89
150
|
}
|
|
90
151
|
declare const SpreadsheetEditor: React__default.FC<SpreadsheetEditorProps>;
|
|
91
152
|
|
|
@@ -94,6 +155,10 @@ interface SpreadsheetContextMenuProps {
|
|
|
94
155
|
x: number;
|
|
95
156
|
y: number;
|
|
96
157
|
onClose: () => void;
|
|
158
|
+
/** Accessible name of the menu (default "Table actions"). */
|
|
159
|
+
ariaLabel?: string;
|
|
160
|
+
/** Opens a panel for items with `panel` (conditional formatting, data validation). */
|
|
161
|
+
onOpenPanel?: (panel: SpreadsheetPanelId) => void;
|
|
97
162
|
}
|
|
98
163
|
/** The table context menu (sort, filter, freeze, hide, merge, categories, transpose). */
|
|
99
164
|
declare const SpreadsheetContextMenu: React__default.FC<SpreadsheetContextMenuProps>;
|
|
@@ -106,11 +171,17 @@ interface SpreadsheetGroupRowProps {
|
|
|
106
171
|
onToggle: (key: string) => void;
|
|
107
172
|
/** Render a trailing cell for the "add column" column. */
|
|
108
173
|
trailingCell?: boolean;
|
|
174
|
+
/** Every displayed column, when `columns` is a virtualised window of them (picks the label column). */
|
|
175
|
+
labelColumns?: SpreadsheetViewColumn[];
|
|
176
|
+
/** Virtualised: columns before the left spacer (the frozen ones), and the spacers' widths. */
|
|
177
|
+
leadingColumns?: number;
|
|
178
|
+
leftSpace?: number;
|
|
179
|
+
rightSpace?: number;
|
|
109
180
|
}
|
|
110
181
|
/** A category header row: collapse toggle, label, row count and per-column summaries. */
|
|
111
182
|
declare const SpreadsheetGroupRow: React__default.FC<SpreadsheetGroupRowProps>;
|
|
112
183
|
|
|
113
|
-
type SpreadsheetState = ReturnType<typeof useSpreadsheetEditor>;
|
|
184
|
+
type SpreadsheetState$1 = ReturnType<typeof useSpreadsheetEditor>;
|
|
114
185
|
/**
|
|
115
186
|
* Copy and paste for the grid. Copy writes TSV, an HTML table and the
|
|
116
187
|
* lossless `application/x.pixerate.spreadsheet+json` format; paste prefers
|
|
@@ -120,14 +191,14 @@ type SpreadsheetState = ReturnType<typeof useSpreadsheetEditor>;
|
|
|
120
191
|
* `copy`/`paste` at `<body>`, not at the focused grid. Text inputs inside the
|
|
121
192
|
* grid keep native copy/paste.
|
|
122
193
|
*/
|
|
123
|
-
declare function useSpreadsheetClipboard(gridRef: RefObject<HTMLElement | null>, state: SpreadsheetState, readOnly: boolean): {
|
|
194
|
+
declare function useSpreadsheetClipboard(gridRef: RefObject<HTMLElement | null>, state: SpreadsheetState$1, readOnly: boolean): {
|
|
124
195
|
copyShortcutFallback: () => void;
|
|
125
196
|
};
|
|
126
197
|
/**
|
|
127
198
|
* Fill handle dragging: press on the handle, move over cells, release to
|
|
128
199
|
* autofill from the selection into the dragged range (one undo step).
|
|
129
200
|
*/
|
|
130
|
-
declare function useFillHandle(state: SpreadsheetState): {
|
|
201
|
+
declare function useFillHandle(state: SpreadsheetState$1): {
|
|
131
202
|
fillTarget: CellRange | null;
|
|
132
203
|
isFilling: boolean;
|
|
133
204
|
startFill: (e: {
|
|
@@ -146,6 +217,8 @@ interface FormulaHintsProps {
|
|
|
146
217
|
onAccept: (value: string) => void;
|
|
147
218
|
/** Maximum number of function suggestions (default 8). */
|
|
148
219
|
limit?: number;
|
|
220
|
+
/** Defined names to suggest too (e.g. `controller.getNameSuggestions()`). */
|
|
221
|
+
names?: readonly FormulaNameSuggestionSource[];
|
|
149
222
|
}
|
|
150
223
|
/**
|
|
151
224
|
* Formula autocomplete for an input: while the value starts with `=`, lists
|
|
@@ -158,4 +231,79 @@ interface FormulaHintsProps {
|
|
|
158
231
|
*/
|
|
159
232
|
declare const FormulaHints: React__default.FC<FormulaHintsProps>;
|
|
160
233
|
|
|
161
|
-
|
|
234
|
+
interface SheetTabsProps {
|
|
235
|
+
state: ReturnType<typeof useSpreadsheetEditor>;
|
|
236
|
+
readOnly?: boolean;
|
|
237
|
+
className?: string;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* The workbook's sheet tabs: click to switch, double-click to rename, drag
|
|
241
|
+
* to reorder, right-click for insert / rename / duplicate / move / delete
|
|
242
|
+
* (delete asks to confirm), and a `+` button to add a sheet.
|
|
243
|
+
*/
|
|
244
|
+
declare const SheetTabs: React__default.FC<SheetTabsProps>;
|
|
245
|
+
|
|
246
|
+
interface NameManagerProps {
|
|
247
|
+
state: ReturnType<typeof useSpreadsheetEditor>;
|
|
248
|
+
readOnly?: boolean;
|
|
249
|
+
onClose?: () => void;
|
|
250
|
+
className?: string;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* A simple Name Manager: lists defined names (name, current value, formula,
|
|
254
|
+
* scope) and adds, edits, renames and deletes them. Renaming a name rewrites
|
|
255
|
+
* the formulas that use it; deleting one leaves them showing `#NAME?`.
|
|
256
|
+
*/
|
|
257
|
+
declare const NameManager: React__default.FC<NameManagerProps>;
|
|
258
|
+
|
|
259
|
+
interface SpreadsheetValidationDialogProps {
|
|
260
|
+
prompt: SpreadsheetValidationPrompt;
|
|
261
|
+
onResolve: (action: SpreadsheetValidationAction) => void;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* The data validation alert: Stop (Retry / Cancel), Warning ("Continue?"
|
|
265
|
+
* Yes / No / Cancel) or Information (OK / Cancel), as in Excel.
|
|
266
|
+
*/
|
|
267
|
+
declare const SpreadsheetValidationDialog: React__default.FC<SpreadsheetValidationDialogProps>;
|
|
268
|
+
|
|
269
|
+
type SpreadsheetState = ReturnType<typeof useSpreadsheetEditor>;
|
|
270
|
+
interface SpreadsheetRulePanelProps {
|
|
271
|
+
state: SpreadsheetState;
|
|
272
|
+
onClose: () => void;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Conditional formatting manager: the sheet's rules in priority order (move,
|
|
276
|
+
* stop if true, delete) and a form to add a rule to a range.
|
|
277
|
+
*/
|
|
278
|
+
declare const SpreadsheetConditionalFormatPanel: React__default.FC<SpreadsheetRulePanelProps>;
|
|
279
|
+
/**
|
|
280
|
+
* Data validation manager: the sheet's rules (delete), a form to validate a
|
|
281
|
+
* range, and "circle invalid data".
|
|
282
|
+
*/
|
|
283
|
+
declare const SpreadsheetDataValidationPanel: React__default.FC<SpreadsheetRulePanelProps>;
|
|
284
|
+
|
|
285
|
+
interface SpreadsheetViewportOptions {
|
|
286
|
+
/** `'auto'` (default): virtualise large views only; `true` / `false` force it. */
|
|
287
|
+
virtualize?: boolean | 'auto';
|
|
288
|
+
/** Merged ranges, rendered whole when they cross the window's edge. */
|
|
289
|
+
merges?: readonly CellRange[];
|
|
290
|
+
/** Scrolled into view when it changes (virtualised views only). */
|
|
291
|
+
activeCell?: CellCoordinate | null;
|
|
292
|
+
overscanRows?: number;
|
|
293
|
+
overscanColumns?: number;
|
|
294
|
+
}
|
|
295
|
+
interface SpreadsheetViewportState {
|
|
296
|
+
metrics: SpreadsheetViewMetrics;
|
|
297
|
+
/** What to render; `virtual: false` renders every row and column. */
|
|
298
|
+
window: SpreadsheetViewWindow;
|
|
299
|
+
/** Attach to the scroll container's `onScroll`. */
|
|
300
|
+
onScroll: () => void;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Virtualised rendering for `SpreadsheetEditor`: tracks the scroll
|
|
304
|
+
* container (`scrollRef`), works out the window of rows and columns to
|
|
305
|
+
* render, and scrolls the active cell into view.
|
|
306
|
+
*/
|
|
307
|
+
declare function useSpreadsheetViewport(scrollRef: RefObject<HTMLElement | null>, view: SpreadsheetViewModel, options?: SpreadsheetViewportOptions): SpreadsheetViewportState;
|
|
308
|
+
|
|
309
|
+
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, type SpreadsheetViewportOptions, type SpreadsheetViewportState, useFillHandle, useSpreadsheetClipboard, useSpreadsheetEditor, useSpreadsheetViewport };
|
|
@@ -1,11 +1,38 @@
|
|
|
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, SpreadsheetViewMetrics, SpreadsheetViewWindow, SpreadsheetViewModel } 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[];
|
|
35
|
+
mergeCells: (range?: CellRange | null) => boolean;
|
|
9
36
|
sortRows: (keys: _pixerate_editor.SortKey[], options?: {
|
|
10
37
|
range?: CellRange | null;
|
|
11
38
|
}) => boolean;
|
|
@@ -29,7 +56,6 @@ declare function useSpreadsheetEditor(options?: SpreadsheetControllerOptions): {
|
|
|
29
56
|
unhideAll: () => void;
|
|
30
57
|
getMerges: () => CellRange[];
|
|
31
58
|
getMergeAt: (row: number, col: number) => CellRange | null;
|
|
32
|
-
mergeCells: (range?: CellRange | null) => boolean;
|
|
33
59
|
unmergeCells: (range?: CellRange | null) => boolean;
|
|
34
60
|
autofill: (source: CellRange, target: CellRange) => boolean;
|
|
35
61
|
groupRowsBy: (colId: string, summaries?: _pixerate_editor.GroupSummary[]) => void;
|
|
@@ -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,14 @@ 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;
|
|
144
|
+
/**
|
|
145
|
+
* Render only the rows and columns in (or near) view. `'auto'` (default)
|
|
146
|
+
* virtualises sheets with more than 200 displayed rows or 60 columns;
|
|
147
|
+
* `true` / `false` force it.
|
|
148
|
+
*/
|
|
149
|
+
virtualize?: boolean | 'auto';
|
|
89
150
|
}
|
|
90
151
|
declare const SpreadsheetEditor: React__default.FC<SpreadsheetEditorProps>;
|
|
91
152
|
|
|
@@ -94,6 +155,10 @@ interface SpreadsheetContextMenuProps {
|
|
|
94
155
|
x: number;
|
|
95
156
|
y: number;
|
|
96
157
|
onClose: () => void;
|
|
158
|
+
/** Accessible name of the menu (default "Table actions"). */
|
|
159
|
+
ariaLabel?: string;
|
|
160
|
+
/** Opens a panel for items with `panel` (conditional formatting, data validation). */
|
|
161
|
+
onOpenPanel?: (panel: SpreadsheetPanelId) => void;
|
|
97
162
|
}
|
|
98
163
|
/** The table context menu (sort, filter, freeze, hide, merge, categories, transpose). */
|
|
99
164
|
declare const SpreadsheetContextMenu: React__default.FC<SpreadsheetContextMenuProps>;
|
|
@@ -106,11 +171,17 @@ interface SpreadsheetGroupRowProps {
|
|
|
106
171
|
onToggle: (key: string) => void;
|
|
107
172
|
/** Render a trailing cell for the "add column" column. */
|
|
108
173
|
trailingCell?: boolean;
|
|
174
|
+
/** Every displayed column, when `columns` is a virtualised window of them (picks the label column). */
|
|
175
|
+
labelColumns?: SpreadsheetViewColumn[];
|
|
176
|
+
/** Virtualised: columns before the left spacer (the frozen ones), and the spacers' widths. */
|
|
177
|
+
leadingColumns?: number;
|
|
178
|
+
leftSpace?: number;
|
|
179
|
+
rightSpace?: number;
|
|
109
180
|
}
|
|
110
181
|
/** A category header row: collapse toggle, label, row count and per-column summaries. */
|
|
111
182
|
declare const SpreadsheetGroupRow: React__default.FC<SpreadsheetGroupRowProps>;
|
|
112
183
|
|
|
113
|
-
type SpreadsheetState = ReturnType<typeof useSpreadsheetEditor>;
|
|
184
|
+
type SpreadsheetState$1 = ReturnType<typeof useSpreadsheetEditor>;
|
|
114
185
|
/**
|
|
115
186
|
* Copy and paste for the grid. Copy writes TSV, an HTML table and the
|
|
116
187
|
* lossless `application/x.pixerate.spreadsheet+json` format; paste prefers
|
|
@@ -120,14 +191,14 @@ type SpreadsheetState = ReturnType<typeof useSpreadsheetEditor>;
|
|
|
120
191
|
* `copy`/`paste` at `<body>`, not at the focused grid. Text inputs inside the
|
|
121
192
|
* grid keep native copy/paste.
|
|
122
193
|
*/
|
|
123
|
-
declare function useSpreadsheetClipboard(gridRef: RefObject<HTMLElement | null>, state: SpreadsheetState, readOnly: boolean): {
|
|
194
|
+
declare function useSpreadsheetClipboard(gridRef: RefObject<HTMLElement | null>, state: SpreadsheetState$1, readOnly: boolean): {
|
|
124
195
|
copyShortcutFallback: () => void;
|
|
125
196
|
};
|
|
126
197
|
/**
|
|
127
198
|
* Fill handle dragging: press on the handle, move over cells, release to
|
|
128
199
|
* autofill from the selection into the dragged range (one undo step).
|
|
129
200
|
*/
|
|
130
|
-
declare function useFillHandle(state: SpreadsheetState): {
|
|
201
|
+
declare function useFillHandle(state: SpreadsheetState$1): {
|
|
131
202
|
fillTarget: CellRange | null;
|
|
132
203
|
isFilling: boolean;
|
|
133
204
|
startFill: (e: {
|
|
@@ -146,6 +217,8 @@ interface FormulaHintsProps {
|
|
|
146
217
|
onAccept: (value: string) => void;
|
|
147
218
|
/** Maximum number of function suggestions (default 8). */
|
|
148
219
|
limit?: number;
|
|
220
|
+
/** Defined names to suggest too (e.g. `controller.getNameSuggestions()`). */
|
|
221
|
+
names?: readonly FormulaNameSuggestionSource[];
|
|
149
222
|
}
|
|
150
223
|
/**
|
|
151
224
|
* Formula autocomplete for an input: while the value starts with `=`, lists
|
|
@@ -158,4 +231,79 @@ interface FormulaHintsProps {
|
|
|
158
231
|
*/
|
|
159
232
|
declare const FormulaHints: React__default.FC<FormulaHintsProps>;
|
|
160
233
|
|
|
161
|
-
|
|
234
|
+
interface SheetTabsProps {
|
|
235
|
+
state: ReturnType<typeof useSpreadsheetEditor>;
|
|
236
|
+
readOnly?: boolean;
|
|
237
|
+
className?: string;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* The workbook's sheet tabs: click to switch, double-click to rename, drag
|
|
241
|
+
* to reorder, right-click for insert / rename / duplicate / move / delete
|
|
242
|
+
* (delete asks to confirm), and a `+` button to add a sheet.
|
|
243
|
+
*/
|
|
244
|
+
declare const SheetTabs: React__default.FC<SheetTabsProps>;
|
|
245
|
+
|
|
246
|
+
interface NameManagerProps {
|
|
247
|
+
state: ReturnType<typeof useSpreadsheetEditor>;
|
|
248
|
+
readOnly?: boolean;
|
|
249
|
+
onClose?: () => void;
|
|
250
|
+
className?: string;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* A simple Name Manager: lists defined names (name, current value, formula,
|
|
254
|
+
* scope) and adds, edits, renames and deletes them. Renaming a name rewrites
|
|
255
|
+
* the formulas that use it; deleting one leaves them showing `#NAME?`.
|
|
256
|
+
*/
|
|
257
|
+
declare const NameManager: React__default.FC<NameManagerProps>;
|
|
258
|
+
|
|
259
|
+
interface SpreadsheetValidationDialogProps {
|
|
260
|
+
prompt: SpreadsheetValidationPrompt;
|
|
261
|
+
onResolve: (action: SpreadsheetValidationAction) => void;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* The data validation alert: Stop (Retry / Cancel), Warning ("Continue?"
|
|
265
|
+
* Yes / No / Cancel) or Information (OK / Cancel), as in Excel.
|
|
266
|
+
*/
|
|
267
|
+
declare const SpreadsheetValidationDialog: React__default.FC<SpreadsheetValidationDialogProps>;
|
|
268
|
+
|
|
269
|
+
type SpreadsheetState = ReturnType<typeof useSpreadsheetEditor>;
|
|
270
|
+
interface SpreadsheetRulePanelProps {
|
|
271
|
+
state: SpreadsheetState;
|
|
272
|
+
onClose: () => void;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Conditional formatting manager: the sheet's rules in priority order (move,
|
|
276
|
+
* stop if true, delete) and a form to add a rule to a range.
|
|
277
|
+
*/
|
|
278
|
+
declare const SpreadsheetConditionalFormatPanel: React__default.FC<SpreadsheetRulePanelProps>;
|
|
279
|
+
/**
|
|
280
|
+
* Data validation manager: the sheet's rules (delete), a form to validate a
|
|
281
|
+
* range, and "circle invalid data".
|
|
282
|
+
*/
|
|
283
|
+
declare const SpreadsheetDataValidationPanel: React__default.FC<SpreadsheetRulePanelProps>;
|
|
284
|
+
|
|
285
|
+
interface SpreadsheetViewportOptions {
|
|
286
|
+
/** `'auto'` (default): virtualise large views only; `true` / `false` force it. */
|
|
287
|
+
virtualize?: boolean | 'auto';
|
|
288
|
+
/** Merged ranges, rendered whole when they cross the window's edge. */
|
|
289
|
+
merges?: readonly CellRange[];
|
|
290
|
+
/** Scrolled into view when it changes (virtualised views only). */
|
|
291
|
+
activeCell?: CellCoordinate | null;
|
|
292
|
+
overscanRows?: number;
|
|
293
|
+
overscanColumns?: number;
|
|
294
|
+
}
|
|
295
|
+
interface SpreadsheetViewportState {
|
|
296
|
+
metrics: SpreadsheetViewMetrics;
|
|
297
|
+
/** What to render; `virtual: false` renders every row and column. */
|
|
298
|
+
window: SpreadsheetViewWindow;
|
|
299
|
+
/** Attach to the scroll container's `onScroll`. */
|
|
300
|
+
onScroll: () => void;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Virtualised rendering for `SpreadsheetEditor`: tracks the scroll
|
|
304
|
+
* container (`scrollRef`), works out the window of rows and columns to
|
|
305
|
+
* render, and scrolls the active cell into view.
|
|
306
|
+
*/
|
|
307
|
+
declare function useSpreadsheetViewport(scrollRef: RefObject<HTMLElement | null>, view: SpreadsheetViewModel, options?: SpreadsheetViewportOptions): SpreadsheetViewportState;
|
|
308
|
+
|
|
309
|
+
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, type SpreadsheetViewportOptions, type SpreadsheetViewportState, useFillHandle, useSpreadsheetClipboard, useSpreadsheetEditor, useSpreadsheetViewport };
|
|
@@ -1,19 +1,31 @@
|
|
|
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
|
-
useSpreadsheetEditor
|
|
9
|
-
|
|
13
|
+
useSpreadsheetEditor,
|
|
14
|
+
useSpreadsheetViewport
|
|
15
|
+
} from "../chunk-34HEZX7J.js";
|
|
10
16
|
export {
|
|
11
17
|
FormulaHints,
|
|
18
|
+
NameManager,
|
|
19
|
+
SheetTabs,
|
|
20
|
+
SpreadsheetConditionalFormatPanel,
|
|
12
21
|
SpreadsheetContextMenu,
|
|
22
|
+
SpreadsheetDataValidationPanel,
|
|
13
23
|
SpreadsheetEditor,
|
|
14
24
|
SpreadsheetGroupRow,
|
|
25
|
+
SpreadsheetValidationDialog,
|
|
15
26
|
useFillHandle,
|
|
16
27
|
useSpreadsheetClipboard,
|
|
17
|
-
useSpreadsheetEditor
|
|
28
|
+
useSpreadsheetEditor,
|
|
29
|
+
useSpreadsheetViewport
|
|
18
30
|
};
|
|
19
31
|
//# sourceMappingURL=index.js.map
|