@pixerate/editor 0.19.0 → 0.20.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 +91 -2
- package/dist/agent/index.cjs +625 -2
- package/dist/agent/index.cjs.map +1 -1
- package/dist/agent/index.d.cts +286 -2
- package/dist/agent/index.d.ts +286 -2
- package/dist/agent/index.js +624 -1
- package/dist/agent/index.js.map +1 -1
- package/dist/canvas/index.cjs +1240 -22
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +515 -3
- package/dist/canvas/index.d.ts +515 -3
- package/dist/canvas/index.js +1219 -1
- package/dist/canvas/index.js.map +1 -1
- package/dist/chunk-3TYMNULT.js +1367 -0
- package/dist/chunk-3TYMNULT.js.map +1 -0
- package/dist/chunk-4QPLEUL2.cjs +4480 -0
- package/dist/chunk-4QPLEUL2.cjs.map +1 -0
- package/dist/chunk-4SUNJZWB.cjs +553 -0
- package/dist/chunk-4SUNJZWB.cjs.map +1 -0
- package/dist/chunk-A7DKIA72.js +2657 -0
- package/dist/chunk-A7DKIA72.js.map +1 -0
- package/dist/chunk-AXV2ZW34.cjs +118 -0
- package/dist/chunk-AXV2ZW34.cjs.map +1 -0
- package/dist/chunk-B2ZRLN4S.js +118 -0
- package/dist/chunk-B2ZRLN4S.js.map +1 -0
- package/dist/chunk-CYFJCKC4.js +4480 -0
- package/dist/chunk-CYFJCKC4.js.map +1 -0
- package/dist/chunk-GVW4P7BG.js +2706 -0
- package/dist/chunk-GVW4P7BG.js.map +1 -0
- package/dist/chunk-JACER6TE.cjs +1 -0
- package/dist/chunk-JACER6TE.cjs.map +1 -0
- package/dist/chunk-JYRIOFEN.cjs +2657 -0
- package/dist/chunk-JYRIOFEN.cjs.map +1 -0
- package/dist/chunk-KYRZDWM4.js +299 -0
- package/dist/chunk-KYRZDWM4.js.map +1 -0
- package/dist/chunk-LA7PEGU3.cjs +299 -0
- package/dist/chunk-LA7PEGU3.cjs.map +1 -0
- package/dist/chunk-N7FG6CBO.js +1 -0
- package/dist/chunk-N7FG6CBO.js.map +1 -0
- package/dist/chunk-OYXSKQFR.js +553 -0
- package/dist/chunk-OYXSKQFR.js.map +1 -0
- package/dist/chunk-TVRC4KVT.cjs +1367 -0
- package/dist/chunk-TVRC4KVT.cjs.map +1 -0
- package/dist/chunk-U6NDQFOK.cjs +2706 -0
- package/dist/chunk-U6NDQFOK.cjs.map +1 -0
- package/dist/controller-OUdxPY-X.d.cts +754 -0
- package/dist/controller-OUdxPY-X.d.ts +754 -0
- package/dist/extensions/index.cjs +144 -3
- package/dist/extensions/index.cjs.map +1 -1
- package/dist/extensions/index.d.cts +9 -144
- package/dist/extensions/index.d.ts +9 -144
- package/dist/extensions/index.js +145 -4
- package/dist/grammar/index.cjs +31 -3
- package/dist/grammar/index.cjs.map +1 -1
- package/dist/grammar/index.d.cts +239 -19
- package/dist/grammar/index.d.ts +239 -19
- package/dist/grammar/index.js +31 -3
- package/dist/history/index.d.cts +2 -41
- package/dist/history/index.d.ts +2 -41
- package/dist/index-Ng1pG7JE.d.ts +899 -0
- package/dist/index-k3mFbPx_.d.cts +899 -0
- package/dist/index.cjs +457 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +99 -12
- package/dist/index.d.ts +99 -12
- package/dist/index.js +457 -20
- package/dist/index.js.map +1 -1
- package/dist/registry-iAHbqkYt.d.cts +128 -0
- package/dist/registry-iAHbqkYt.d.ts +128 -0
- package/dist/serializers/index.cjs +26 -3
- package/dist/serializers/index.cjs.map +1 -1
- package/dist/serializers/index.d.cts +119 -6
- package/dist/serializers/index.d.ts +119 -6
- package/dist/serializers/index.js +24 -1
- package/dist/spreadsheet/index.cjs +122 -2
- package/dist/spreadsheet/index.cjs.map +1 -1
- package/dist/spreadsheet/index.d.cts +371 -313
- package/dist/spreadsheet/index.d.ts +371 -313
- package/dist/spreadsheet/index.js +127 -7
- package/dist/tokens-CyLZmIei.d.cts +76 -0
- package/dist/tokens-CyLZmIei.d.ts +76 -0
- package/dist/track-changes-G8JcWB8b.d.cts +306 -0
- package/dist/track-changes-G8JcWB8b.d.ts +306 -0
- package/dist/types-BZgcDsC5.d.cts +42 -0
- package/dist/types-BZgcDsC5.d.ts +42 -0
- package/dist/{types-JV3S8VeR.d.cts → types-DMe0vFB1.d.cts} +1 -1
- package/dist/{types-JV3S8VeR.d.ts → types-DMe0vFB1.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-7FWEWE6T.js +0 -1888
- package/dist/chunk-7FWEWE6T.js.map +0 -1
- package/dist/chunk-AIZUKWTL.js +0 -1715
- package/dist/chunk-AIZUKWTL.js.map +0 -1
- package/dist/chunk-GLSIZKOX.js +0 -17
- package/dist/chunk-GLSIZKOX.js.map +0 -1
- package/dist/chunk-LDES3EOS.cjs +0 -1888
- package/dist/chunk-LDES3EOS.cjs.map +0 -1
- package/dist/chunk-LLUAKTLW.cjs +0 -532
- package/dist/chunk-LLUAKTLW.cjs.map +0 -1
- package/dist/chunk-MPPXH7U5.cjs +0 -336
- package/dist/chunk-MPPXH7U5.cjs.map +0 -1
- package/dist/chunk-O7LOPQMH.js +0 -336
- package/dist/chunk-O7LOPQMH.js.map +0 -1
- package/dist/chunk-QGVMBCT5.js +0 -532
- package/dist/chunk-QGVMBCT5.js.map +0 -1
- package/dist/chunk-SEDR75VH.cjs +0 -17
- package/dist/chunk-SEDR75VH.cjs.map +0 -1
- package/dist/chunk-YQCI4CCN.cjs +0 -1715
- package/dist/chunk-YQCI4CCN.cjs.map +0 -1
- package/dist/mention-Dcevh3ff.d.cts +0 -32
- package/dist/mention-Dcevh3ff.d.ts +0 -32
- package/dist/tokens-7kRTEtPb.d.cts +0 -39
- package/dist/tokens-7kRTEtPb.d.ts +0 -39
|
@@ -0,0 +1,754 @@
|
|
|
1
|
+
type CellFormat = 'text' | 'number' | 'currency' | 'percentage' | 'date' | 'badge' | 'status' | 'assignee';
|
|
2
|
+
type ColumnType = 'bound' | 'freeform' | 'formula';
|
|
3
|
+
interface ColumnBinding {
|
|
4
|
+
dataSource: string;
|
|
5
|
+
field: string;
|
|
6
|
+
}
|
|
7
|
+
interface SpreadsheetColumn {
|
|
8
|
+
id: string;
|
|
9
|
+
key: string;
|
|
10
|
+
title: string;
|
|
11
|
+
width?: number;
|
|
12
|
+
type: ColumnType;
|
|
13
|
+
binding?: ColumnBinding;
|
|
14
|
+
formula?: string;
|
|
15
|
+
format?: CellFormat;
|
|
16
|
+
readOnly?: boolean;
|
|
17
|
+
hidden?: boolean;
|
|
18
|
+
}
|
|
19
|
+
type RowType = 'record' | 'freeform';
|
|
20
|
+
interface SpreadsheetRow {
|
|
21
|
+
id: string;
|
|
22
|
+
index: number;
|
|
23
|
+
height?: number;
|
|
24
|
+
recordId?: string;
|
|
25
|
+
type: RowType;
|
|
26
|
+
hidden?: boolean;
|
|
27
|
+
}
|
|
28
|
+
interface CellCoordinate {
|
|
29
|
+
row: number;
|
|
30
|
+
col: number;
|
|
31
|
+
rowId?: string;
|
|
32
|
+
colId?: string;
|
|
33
|
+
}
|
|
34
|
+
interface CellRange {
|
|
35
|
+
startRow: number;
|
|
36
|
+
startCol: number;
|
|
37
|
+
endRow: number;
|
|
38
|
+
endCol: number;
|
|
39
|
+
}
|
|
40
|
+
interface CellData {
|
|
41
|
+
raw: string;
|
|
42
|
+
value: any;
|
|
43
|
+
error?: string;
|
|
44
|
+
/** Why the formula failed, e.g. `Argument 2 of SUMIF must be a range.` Set alongside `error`. */
|
|
45
|
+
errorMessage?: string;
|
|
46
|
+
format?: CellFormat;
|
|
47
|
+
readOnly?: boolean;
|
|
48
|
+
}
|
|
49
|
+
interface SpreadsheetDocument {
|
|
50
|
+
id: string;
|
|
51
|
+
name: string;
|
|
52
|
+
columns: SpreadsheetColumn[];
|
|
53
|
+
rows: SpreadsheetRow[];
|
|
54
|
+
cells: Record<string, Record<string, CellData>>;
|
|
55
|
+
createdAt?: number;
|
|
56
|
+
updatedAt?: number;
|
|
57
|
+
table?: SpreadsheetTableSettings;
|
|
58
|
+
}
|
|
59
|
+
type SortDirection = 'asc' | 'desc';
|
|
60
|
+
interface SortKey {
|
|
61
|
+
colId: string;
|
|
62
|
+
direction?: SortDirection;
|
|
63
|
+
}
|
|
64
|
+
type FilterOperator = 'equals' | 'notEquals' | 'contains' | 'notContains' | 'greaterThan' | 'greaterThanOrEqual' | 'lessThan' | 'lessThanOrEqual' | 'between' | 'isBlank' | 'isNotBlank' | 'oneOf';
|
|
65
|
+
interface FilterRule {
|
|
66
|
+
id: string;
|
|
67
|
+
colId: string;
|
|
68
|
+
operator: FilterOperator;
|
|
69
|
+
value?: string | number;
|
|
70
|
+
value2?: string | number;
|
|
71
|
+
values?: string[];
|
|
72
|
+
}
|
|
73
|
+
interface SpreadsheetFilterState {
|
|
74
|
+
enabled: boolean;
|
|
75
|
+
rules: FilterRule[];
|
|
76
|
+
}
|
|
77
|
+
type GroupAggregate = 'sum' | 'count' | 'average' | 'min' | 'max';
|
|
78
|
+
interface GroupSummary {
|
|
79
|
+
colId: string;
|
|
80
|
+
aggregate: GroupAggregate;
|
|
81
|
+
}
|
|
82
|
+
interface SpreadsheetGrouping {
|
|
83
|
+
colId: string;
|
|
84
|
+
summaries: GroupSummary[];
|
|
85
|
+
collapsed: string[];
|
|
86
|
+
}
|
|
87
|
+
interface SpreadsheetTableSettings {
|
|
88
|
+
headerRowCount?: number;
|
|
89
|
+
footerRowCount?: number;
|
|
90
|
+
headerColumnCount?: number;
|
|
91
|
+
frozenRowCount?: number;
|
|
92
|
+
frozenColumnCount?: number;
|
|
93
|
+
merges?: CellRange[];
|
|
94
|
+
filter?: SpreadsheetFilterState;
|
|
95
|
+
grouping?: SpreadsheetGrouping;
|
|
96
|
+
}
|
|
97
|
+
interface SpreadsheetDataSourceField {
|
|
98
|
+
key: string;
|
|
99
|
+
label: string;
|
|
100
|
+
type: 'string' | 'number' | 'date' | 'boolean' | 'enum';
|
|
101
|
+
options?: Array<{
|
|
102
|
+
key: string;
|
|
103
|
+
label: string;
|
|
104
|
+
color?: string;
|
|
105
|
+
}>;
|
|
106
|
+
}
|
|
107
|
+
interface SpreadsheetDataSource {
|
|
108
|
+
id: string;
|
|
109
|
+
name: string;
|
|
110
|
+
getRecords(): Array<{
|
|
111
|
+
id: string;
|
|
112
|
+
[key: string]: any;
|
|
113
|
+
}>;
|
|
114
|
+
getFields(): SpreadsheetDataSourceField[];
|
|
115
|
+
updateRecord(recordId: string, field: string, value: any): Promise<void> | void;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
type FormulaTokenType = 'NUMBER' | 'STRING' | 'BOOLEAN' | 'ERROR' | 'CELL_REF' | 'RANGE' | 'PROPERTY_REF' | 'IDENTIFIER' | 'OPERATOR' | 'LPAREN' | 'RPAREN' | 'COMMA' | 'EOF';
|
|
119
|
+
interface FormulaToken {
|
|
120
|
+
type: FormulaTokenType;
|
|
121
|
+
value: string;
|
|
122
|
+
position: number;
|
|
123
|
+
}
|
|
124
|
+
declare function tokenizeFormula(formula: string): FormulaToken[];
|
|
125
|
+
|
|
126
|
+
/** Row number used for the open end of whole-column ranges such as `A:A`. */
|
|
127
|
+
declare const WHOLE_COLUMN_END_ROW = 1048576;
|
|
128
|
+
type ASTNode = LiteralNode | CellRefNode | RangeNode | PropertyRefNode | BinaryOpNode | UnaryOpNode | FunctionCallNode;
|
|
129
|
+
interface LiteralNode {
|
|
130
|
+
type: 'Literal';
|
|
131
|
+
value: number | string | boolean;
|
|
132
|
+
}
|
|
133
|
+
interface CellRefNode {
|
|
134
|
+
type: 'CellRef';
|
|
135
|
+
ref: string;
|
|
136
|
+
col: string;
|
|
137
|
+
row: number;
|
|
138
|
+
}
|
|
139
|
+
interface RangeNode {
|
|
140
|
+
type: 'Range';
|
|
141
|
+
raw: string;
|
|
142
|
+
startCol: string;
|
|
143
|
+
startRow: number;
|
|
144
|
+
endCol: string;
|
|
145
|
+
endRow: number;
|
|
146
|
+
}
|
|
147
|
+
interface PropertyRefNode {
|
|
148
|
+
type: 'PropertyRef';
|
|
149
|
+
property: string;
|
|
150
|
+
}
|
|
151
|
+
interface BinaryOpNode {
|
|
152
|
+
type: 'BinaryOp';
|
|
153
|
+
op: string;
|
|
154
|
+
left: ASTNode;
|
|
155
|
+
right: ASTNode;
|
|
156
|
+
}
|
|
157
|
+
interface UnaryOpNode {
|
|
158
|
+
type: 'UnaryOp';
|
|
159
|
+
op: string;
|
|
160
|
+
argument: ASTNode;
|
|
161
|
+
}
|
|
162
|
+
interface FunctionCallNode {
|
|
163
|
+
type: 'FunctionCall';
|
|
164
|
+
name: string;
|
|
165
|
+
args: ASTNode[];
|
|
166
|
+
}
|
|
167
|
+
declare function parseCellReference(ref: string): {
|
|
168
|
+
col: string;
|
|
169
|
+
row: number;
|
|
170
|
+
};
|
|
171
|
+
declare function parseRange(rangeStr: string): RangeNode;
|
|
172
|
+
declare class FormulaParser {
|
|
173
|
+
private tokens;
|
|
174
|
+
private current;
|
|
175
|
+
constructor(tokens: FormulaToken[]);
|
|
176
|
+
parse(): ASTNode;
|
|
177
|
+
private expression;
|
|
178
|
+
private comparison;
|
|
179
|
+
private concatenation;
|
|
180
|
+
private addition;
|
|
181
|
+
private multiplication;
|
|
182
|
+
private exponentiation;
|
|
183
|
+
private unary;
|
|
184
|
+
private primary;
|
|
185
|
+
private match;
|
|
186
|
+
private matchOperator;
|
|
187
|
+
private check;
|
|
188
|
+
private advance;
|
|
189
|
+
private isAtEnd;
|
|
190
|
+
private peek;
|
|
191
|
+
private previous;
|
|
192
|
+
private consume;
|
|
193
|
+
}
|
|
194
|
+
declare function parseFormula(formula: string): ASTNode;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Value helpers shared by the formula evaluator and the built-in functions:
|
|
198
|
+
* error values, spreadsheet coercion rules, comparisons, ranges and dates.
|
|
199
|
+
*/
|
|
200
|
+
/** Spreadsheet error values. They propagate through operators and functions. */
|
|
201
|
+
declare const FORMULA_ERRORS: Set<string>;
|
|
202
|
+
type FormulaErrorCode = '#DIV/0!' | '#VALUE!' | '#REF!' | '#NAME?' | '#N/A' | '#NUM!' | '#CYCLE!' | '#ERROR!';
|
|
203
|
+
declare function isFormulaError(value: unknown): value is string;
|
|
204
|
+
declare function colNameToIndex(col: string): number;
|
|
205
|
+
declare function indexToColName(index: number): string;
|
|
206
|
+
/**
|
|
207
|
+
* A rectangular block of values. `values` is column-major (the order in which
|
|
208
|
+
* `EvaluationContext.resolveRange` returns cells): `values[col * rows + row]`.
|
|
209
|
+
*/
|
|
210
|
+
interface FormulaRange {
|
|
211
|
+
rows: number;
|
|
212
|
+
cols: number;
|
|
213
|
+
values: any[];
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
interface EvaluationContext {
|
|
217
|
+
resolveCell?: (col: string, row: number) => any;
|
|
218
|
+
/**
|
|
219
|
+
* Values of a rectangular range, column by column (all rows of the first
|
|
220
|
+
* column, then the next column). Lookup functions rely on this order.
|
|
221
|
+
*/
|
|
222
|
+
resolveRange?: (startCol: string, startRow: number, endCol: string, endRow: number) => any[];
|
|
223
|
+
resolveProperty?: (property: string) => any;
|
|
224
|
+
}
|
|
225
|
+
/** A human-readable reason for an error value. */
|
|
226
|
+
interface FormulaDiagnostic {
|
|
227
|
+
code: FormulaErrorCode;
|
|
228
|
+
message: string;
|
|
229
|
+
}
|
|
230
|
+
interface FormulaEvaluationResult {
|
|
231
|
+
/** The computed value; an error code such as `#VALUE!` when the formula fails. */
|
|
232
|
+
value: any;
|
|
233
|
+
/** The error code when `value` is an error. */
|
|
234
|
+
error?: FormulaErrorCode;
|
|
235
|
+
/** Why the formula failed, e.g. `Argument 2 of SUMIF must be a range.` */
|
|
236
|
+
message?: string;
|
|
237
|
+
}
|
|
238
|
+
/** Generic explanation of an error code, used when no specific reason was recorded. */
|
|
239
|
+
declare function describeFormulaError(code: string): string;
|
|
240
|
+
declare class FormulaEvaluator {
|
|
241
|
+
private context;
|
|
242
|
+
private diagnostics;
|
|
243
|
+
constructor(context?: EvaluationContext);
|
|
244
|
+
/**
|
|
245
|
+
* Evaluates a formula. Errors in the formula are returned as error values
|
|
246
|
+
* (`#VALUE!` etc.); malformed formulas and missing resolvers throw.
|
|
247
|
+
*/
|
|
248
|
+
evaluate(astOrFormula: ASTNode | string): any;
|
|
249
|
+
/**
|
|
250
|
+
* Evaluates a formula and explains errors. Never throws: malformed formulas
|
|
251
|
+
* return `#ERROR!` with the parser's message. A result that is a whole range
|
|
252
|
+
* (no dynamic-array spilling) is reduced to its first value.
|
|
253
|
+
*/
|
|
254
|
+
evaluateWithDiagnostics(astOrFormula: ASTNode | string): FormulaEvaluationResult;
|
|
255
|
+
/** Records why an error happened and returns the error code. */
|
|
256
|
+
private fail;
|
|
257
|
+
private evaluateNode;
|
|
258
|
+
private evaluateRange;
|
|
259
|
+
private callFunction;
|
|
260
|
+
private createContext;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
interface CellDep {
|
|
264
|
+
col: string;
|
|
265
|
+
row: number;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Dependency key for "every cell in column `col`", used by whole-column ranges
|
|
269
|
+
* (`A:A`) instead of expanding a million cell keys.
|
|
270
|
+
*/
|
|
271
|
+
declare const columnDependencyKey: (col: string) => string;
|
|
272
|
+
declare function extractCellDependencies(node: ASTNode): CellDep[];
|
|
273
|
+
declare class DependencyGraph {
|
|
274
|
+
private dependencies;
|
|
275
|
+
private dependents;
|
|
276
|
+
setCellFormula(cellKey: string, formulaStr: string | null): void;
|
|
277
|
+
/** Removes every registered formula and dependency. */
|
|
278
|
+
clear(): void;
|
|
279
|
+
getDependencies(cellKey: string): string[];
|
|
280
|
+
getDependents(cellKey: string): string[];
|
|
281
|
+
/**
|
|
282
|
+
* Detects if there is a cycle containing cellKey.
|
|
283
|
+
*/
|
|
284
|
+
hasCycle(cellKey: string): boolean;
|
|
285
|
+
/**
|
|
286
|
+
* Returns cells affected by updating cellKey in topological order.
|
|
287
|
+
*/
|
|
288
|
+
getEvaluationOrder(startCellKey: string): {
|
|
289
|
+
order: string[];
|
|
290
|
+
hasCycle: boolean;
|
|
291
|
+
};
|
|
292
|
+
/**
|
|
293
|
+
* Plans a recalculation over `cellKeys` (and, with `includeDependents`, every
|
|
294
|
+
* cell that transitively depends on them). Returns the keys in evaluation
|
|
295
|
+
* order (dependencies first) and the set of keys that are part of a cycle,
|
|
296
|
+
* which must be marked `#CYCLE!` instead of evaluated. Every member of a
|
|
297
|
+
* cycle is reported, not just the cell that closed it.
|
|
298
|
+
*/
|
|
299
|
+
getEvaluationPlan(cellKeys: Iterable<string>, options?: {
|
|
300
|
+
includeDependents?: boolean;
|
|
301
|
+
}): {
|
|
302
|
+
order: string[];
|
|
303
|
+
cyclic: Set<string>;
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* A row or column insertion/deletion. `index` is the 0-based position of the
|
|
309
|
+
* inserted or deleted row/column.
|
|
310
|
+
*/
|
|
311
|
+
interface StructuralChange {
|
|
312
|
+
axis: 'row' | 'col';
|
|
313
|
+
index: number;
|
|
314
|
+
type: 'insert' | 'delete';
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Rewrites the cell and range references in `formula` after a row or column
|
|
318
|
+
* is inserted or deleted, the way spreadsheet apps do: references after the
|
|
319
|
+
* change shift, ranges grow or shrink, and references to a deleted row/column
|
|
320
|
+
* become `#REF!`. Absolute (`$`) markers are kept. String literals, property
|
|
321
|
+
* references and function names are left untouched.
|
|
322
|
+
*/
|
|
323
|
+
declare function shiftFormulaReferences(formula: string, change: StructuralChange): string;
|
|
324
|
+
/**
|
|
325
|
+
* Calls `rewrite` with the source text of every cell or range reference in
|
|
326
|
+
* `formula` (e.g. `"$A1"`, `"B2:C10"`, `"A:A"`) and splices in its result.
|
|
327
|
+
* String literals, property references and function names (e.g. `LOG10(`)
|
|
328
|
+
* are skipped. Formulas that fail to tokenize are returned unchanged.
|
|
329
|
+
*/
|
|
330
|
+
declare function mapFormulaReferences(formula: string, rewrite: (reference: string) => string): string;
|
|
331
|
+
/**
|
|
332
|
+
* Moves a formula by (`rowOffset`, `colOffset`), as copy/paste and autofill
|
|
333
|
+
* do: relative row/column parts shift, `$`-absolute parts stay. A reference
|
|
334
|
+
* pushed above row 1 or left of column A becomes `#REF!`.
|
|
335
|
+
*/
|
|
336
|
+
declare function offsetFormulaReferences(formula: string, rowOffset: number, colOffset: number): string;
|
|
337
|
+
/** A 0-based cell position. */
|
|
338
|
+
interface CellPosition {
|
|
339
|
+
row: number;
|
|
340
|
+
col: number;
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Rewrites references when cells *move* (sort, transpose): references follow
|
|
344
|
+
* the cell they point at, whether relative or absolute. `moveCell` returns a
|
|
345
|
+
* cell's new position, or null when it did not move. A range is remapped only
|
|
346
|
+
* when its cells moved together as a rectangle of the same size (e.g. a
|
|
347
|
+
* one-row range inside a sorted row, or a range inside a transposed block);
|
|
348
|
+
* otherwise it is kept, since it still covers the same rows and columns.
|
|
349
|
+
*/
|
|
350
|
+
declare function remapFormulaReferences(formula: string, moveCell: (position: CellPosition) => CellPosition | null): string;
|
|
351
|
+
|
|
352
|
+
declare class DataSourceBinder {
|
|
353
|
+
private dataSources;
|
|
354
|
+
register(dataSource: SpreadsheetDataSource): void;
|
|
355
|
+
unregister(dataSourceId: string): void;
|
|
356
|
+
getDataSource(id: string): SpreadsheetDataSource | undefined;
|
|
357
|
+
/**
|
|
358
|
+
* Generates or reconciles spreadsheet rows from a primary data source.
|
|
359
|
+
*/
|
|
360
|
+
syncRows(currentRows: SpreadsheetRow[], dataSourceId: string): SpreadsheetRow[];
|
|
361
|
+
/**
|
|
362
|
+
* Resolves a record's bound field value.
|
|
363
|
+
*/
|
|
364
|
+
resolveBoundValue(dataSourceId: string, recordId: string, field: string): any;
|
|
365
|
+
/**
|
|
366
|
+
* Dispatches an update to the underlying data source.
|
|
367
|
+
*/
|
|
368
|
+
commitBoundValue(dataSourceId: string, recordId: string, field: string, value: any): Promise<void>;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* Spreadsheet clipboard formats. Copying writes three representations:
|
|
373
|
+
*
|
|
374
|
+
* - `text/plain`: TSV of the displayed values (pastes into any app)
|
|
375
|
+
* - `text/html`: an HTML `<table>` (pastes into docs, mail, other sheets)
|
|
376
|
+
* - `application/x.pixerate.spreadsheet+json`: raw inputs and formulas, so a
|
|
377
|
+
* paste into a pixerate spreadsheet is lossless; formulas are re-based to
|
|
378
|
+
* the paste position like a spreadsheet copy/paste
|
|
379
|
+
*
|
|
380
|
+
* Pasting prefers the custom format, then an HTML table, then TSV. All
|
|
381
|
+
* functions here are pure and DOM-free.
|
|
382
|
+
*/
|
|
383
|
+
|
|
384
|
+
declare const SPREADSHEET_CLIPBOARD_MIME = "application/x.pixerate.spreadsheet+json";
|
|
385
|
+
interface SpreadsheetClipboardCell {
|
|
386
|
+
raw: string;
|
|
387
|
+
value: unknown;
|
|
388
|
+
}
|
|
389
|
+
interface SpreadsheetClipboardPayload {
|
|
390
|
+
type: 'pixerate-spreadsheet';
|
|
391
|
+
version: 1;
|
|
392
|
+
/** Position of the copied block's top-left cell, used to re-base formulas. */
|
|
393
|
+
origin: CellPosition;
|
|
394
|
+
cells: SpreadsheetClipboardCell[][];
|
|
395
|
+
}
|
|
396
|
+
/** MIME type -> data, as written to `DataTransfer.setData`. */
|
|
397
|
+
type SpreadsheetClipboardData = Record<string, string>;
|
|
398
|
+
/** Anything clipboard data can be read from: a `DataTransfer` or a plain record. */
|
|
399
|
+
type SpreadsheetClipboardSource = {
|
|
400
|
+
getData(format: string): string;
|
|
401
|
+
} | Record<string, string | undefined>;
|
|
402
|
+
interface ParsedSpreadsheetClipboard {
|
|
403
|
+
format: 'internal' | 'html' | 'text';
|
|
404
|
+
/** Raw inputs to write, row by row. */
|
|
405
|
+
rows: string[][];
|
|
406
|
+
/** For internal pastes: where the block was copied from. */
|
|
407
|
+
origin?: CellPosition;
|
|
408
|
+
}
|
|
409
|
+
/** Serializes displayed values as an HTML table. Line breaks become `<br>`. */
|
|
410
|
+
declare function serializeHtmlTable(values: ReadonlyArray<ReadonlyArray<unknown>>): string;
|
|
411
|
+
/**
|
|
412
|
+
* Extracts cell texts from the first `<table>` in `html` (as written by
|
|
413
|
+
* spreadsheet apps and browsers). `colspan`/`rowspan` cells are expanded with
|
|
414
|
+
* blank cells so positions line up. Returns null when there is no table.
|
|
415
|
+
*/
|
|
416
|
+
declare function parseHtmlTable(html: string): string[][] | null;
|
|
417
|
+
/** Builds the three clipboard representations of a copied block. */
|
|
418
|
+
declare function createSpreadsheetClipboardData(cells: SpreadsheetClipboardCell[][], origin: CellPosition): SpreadsheetClipboardData;
|
|
419
|
+
/**
|
|
420
|
+
* Reads clipboard data, preferring the lossless internal format, then an
|
|
421
|
+
* HTML table, then TSV text. Returns null when there is nothing to paste.
|
|
422
|
+
*/
|
|
423
|
+
declare function readSpreadsheetClipboard(source: SpreadsheetClipboardSource): ParsedSpreadsheetClipboard | null;
|
|
424
|
+
/**
|
|
425
|
+
* Moves formulas copied from `origin` so they keep their relative references
|
|
426
|
+
* when pasted at `target`. Non-formula inputs are returned unchanged.
|
|
427
|
+
*/
|
|
428
|
+
declare function rebaseClipboardRows(rows: string[][], origin: CellPosition, target: CellPosition): string[][];
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* The render model of a spreadsheet: which rows and columns are shown, in
|
|
432
|
+
* which order, with group header rows, frozen (sticky) offsets and merged
|
|
433
|
+
* cell spans. Filters, hidden rows/columns and collapsed groups only affect
|
|
434
|
+
* this view; the document keeps every row.
|
|
435
|
+
*/
|
|
436
|
+
|
|
437
|
+
declare const DEFAULT_ROW_HEIGHT = 32;
|
|
438
|
+
declare const DEFAULT_COLUMN_WIDTH = 130;
|
|
439
|
+
type SpreadsheetRowSection = 'header' | 'body' | 'footer';
|
|
440
|
+
interface SpreadsheetRowGroup {
|
|
441
|
+
key: string;
|
|
442
|
+
label: string;
|
|
443
|
+
rowIndices: number[];
|
|
444
|
+
collapsed: boolean;
|
|
445
|
+
summaries: Record<string, number | null>;
|
|
446
|
+
}
|
|
447
|
+
type SpreadsheetViewRow = {
|
|
448
|
+
kind: 'row';
|
|
449
|
+
row: SpreadsheetRow;
|
|
450
|
+
index: number;
|
|
451
|
+
section: SpreadsheetRowSection;
|
|
452
|
+
frozen: boolean;
|
|
453
|
+
stickyTop: number;
|
|
454
|
+
groupKey?: string;
|
|
455
|
+
} | {
|
|
456
|
+
kind: 'group';
|
|
457
|
+
group: SpreadsheetRowGroup;
|
|
458
|
+
};
|
|
459
|
+
interface SpreadsheetViewColumn {
|
|
460
|
+
column: SpreadsheetColumn;
|
|
461
|
+
index: number;
|
|
462
|
+
header: boolean;
|
|
463
|
+
frozen: boolean;
|
|
464
|
+
stickyLeft: number;
|
|
465
|
+
}
|
|
466
|
+
interface SpreadsheetCellSpan {
|
|
467
|
+
rowSpan: number;
|
|
468
|
+
colSpan: number;
|
|
469
|
+
/** The cell whose content is shown (a merge's top-left cell). */
|
|
470
|
+
source: CellPosition;
|
|
471
|
+
merge?: CellRange;
|
|
472
|
+
}
|
|
473
|
+
interface SpreadsheetViewModel {
|
|
474
|
+
rows: SpreadsheetViewRow[];
|
|
475
|
+
columns: SpreadsheetViewColumn[];
|
|
476
|
+
groups: SpreadsheetRowGroup[];
|
|
477
|
+
/** Visible document row indices in display order (for keyboard navigation). */
|
|
478
|
+
rowOrder: number[];
|
|
479
|
+
/** Visible document column indices in display order. */
|
|
480
|
+
columnOrder: number[];
|
|
481
|
+
filteredOutCount: number;
|
|
482
|
+
hiddenRowCount: number;
|
|
483
|
+
hiddenColumnCount: number;
|
|
484
|
+
/**
|
|
485
|
+
* Span of the cell rendered at (row, col): `{ rowSpan: 1, colSpan: 1 }` for
|
|
486
|
+
* an ordinary cell, the visible extent for a merge's first visible cell, and
|
|
487
|
+
* null for cells covered by a merge (render nothing).
|
|
488
|
+
*/
|
|
489
|
+
getCellSpan(row: number, col: number): SpreadsheetCellSpan | null;
|
|
490
|
+
}
|
|
491
|
+
type CellValueReader = (rowIndex: number, colIndex: number) => unknown;
|
|
492
|
+
/** Header and footer row counts, clamped so they never overlap. */
|
|
493
|
+
declare function getTableSections(doc: SpreadsheetDocument): {
|
|
494
|
+
headerRows: number;
|
|
495
|
+
footerRows: number;
|
|
496
|
+
};
|
|
497
|
+
declare function getRowSection(doc: SpreadsheetDocument, rowIndex: number): SpreadsheetRowSection;
|
|
498
|
+
/** Whether a body row passes the active filters. Header/footer rows always do. */
|
|
499
|
+
declare function rowPassesFilters(doc: SpreadsheetDocument, rowIndex: number, getValue: CellValueReader): boolean;
|
|
500
|
+
/** Category groups of the (unhidden, unfiltered) body rows. */
|
|
501
|
+
declare function computeRowGroups(doc: SpreadsheetDocument, getValue: CellValueReader): SpreadsheetRowGroup[];
|
|
502
|
+
declare function buildSpreadsheetView(doc: SpreadsheetDocument, getValue: CellValueReader): SpreadsheetViewModel;
|
|
503
|
+
|
|
504
|
+
interface CsvExportOptions {
|
|
505
|
+
range?: CellRange | null;
|
|
506
|
+
delimiter?: string;
|
|
507
|
+
lineEnding?: string;
|
|
508
|
+
bom?: boolean;
|
|
509
|
+
/** Export formulas as typed (`=SUM(A1:A3)`) instead of their values. */
|
|
510
|
+
formulas?: boolean;
|
|
511
|
+
}
|
|
512
|
+
interface CsvImportOptions {
|
|
513
|
+
startRow?: number;
|
|
514
|
+
startCol?: number;
|
|
515
|
+
delimiter?: string;
|
|
516
|
+
}
|
|
517
|
+
type NewFilterRule = Omit<FilterRule, 'id'> & {
|
|
518
|
+
id?: string;
|
|
519
|
+
};
|
|
520
|
+
interface SpreadsheetControllerOptions {
|
|
521
|
+
document?: Partial<SpreadsheetDocument>;
|
|
522
|
+
dataSources?: SpreadsheetDataSource[];
|
|
523
|
+
primaryDataSourceId?: string;
|
|
524
|
+
onDocumentChange?: (doc: SpreadsheetDocument) => void;
|
|
525
|
+
onSelectionChange?: (activeCell: CellCoordinate | null, range: CellRange | null) => void;
|
|
526
|
+
onCellCommit?: (rowId: string, colId: string, raw: string, value: any) => void;
|
|
527
|
+
}
|
|
528
|
+
declare class SpreadsheetController {
|
|
529
|
+
document: SpreadsheetDocument;
|
|
530
|
+
activeCell: CellCoordinate | null;
|
|
531
|
+
selectedRange: CellRange | null;
|
|
532
|
+
editingCell: CellCoordinate | null;
|
|
533
|
+
draftValue: string;
|
|
534
|
+
readonly binder: DataSourceBinder;
|
|
535
|
+
readonly depGraph: DependencyGraph;
|
|
536
|
+
readonly evaluator: FormulaEvaluator;
|
|
537
|
+
private primaryDataSourceId?;
|
|
538
|
+
private onDocumentChange?;
|
|
539
|
+
private onSelectionChange?;
|
|
540
|
+
private onCellCommit?;
|
|
541
|
+
private undoStack;
|
|
542
|
+
private redoStack;
|
|
543
|
+
private isApplyingHistory;
|
|
544
|
+
private batching;
|
|
545
|
+
private pendingCommits;
|
|
546
|
+
private evaluatingRowIndex;
|
|
547
|
+
constructor(options?: SpreadsheetControllerOptions);
|
|
548
|
+
loadDocument(document: SpreadsheetDocument): void;
|
|
549
|
+
registerDataSource(ds: SpreadsheetDataSource): void;
|
|
550
|
+
setPrimaryDataSource(dataSourceId: string | undefined): void;
|
|
551
|
+
syncWithDataSource(): void;
|
|
552
|
+
private recomputeRowIndices;
|
|
553
|
+
getColumn(colIdOrKey: string): SpreadsheetColumn | undefined;
|
|
554
|
+
getRow(rowIdOrIndex: string | number): SpreadsheetRow | undefined;
|
|
555
|
+
getCell(rowId: string, colId: string): CellData;
|
|
556
|
+
/** Value of a cell with no stored data: bound record value, column formula, or blank. */
|
|
557
|
+
private getDerivedCell;
|
|
558
|
+
setCellValue(rowId: string, colId: string, raw: string): void;
|
|
559
|
+
private getCellKey;
|
|
560
|
+
/**
|
|
561
|
+
* Recalculates a cell and everything that depends on it, in dependency
|
|
562
|
+
* order. Every cell in a reference cycle is marked `#CYCLE!`.
|
|
563
|
+
*/
|
|
564
|
+
recalculateCell(rowId: string, colId: string): void;
|
|
565
|
+
/**
|
|
566
|
+
* Rebuilds the dependency graph from scratch and recalculates every formula
|
|
567
|
+
* in dependency order.
|
|
568
|
+
*/
|
|
569
|
+
recalculateAll(): void;
|
|
570
|
+
private runEvaluationPlan;
|
|
571
|
+
private locateCellKey;
|
|
572
|
+
private markCycle;
|
|
573
|
+
private evalSingleCellByKey;
|
|
574
|
+
private resolveCellByCoord;
|
|
575
|
+
private resolveRangeByCoords;
|
|
576
|
+
private resolveCurrentRowProperty;
|
|
577
|
+
selectCell(row: number, col: number, extendSelection?: boolean): void;
|
|
578
|
+
selectRange(range: CellRange): void;
|
|
579
|
+
startEditing(row?: number, col?: number, initialValue?: string): void;
|
|
580
|
+
commitEditing(valueToCommit?: string): void;
|
|
581
|
+
cancelEditing(): void;
|
|
582
|
+
moveCursor(direction: 'up' | 'down' | 'left' | 'right', extendSelection?: boolean): void;
|
|
583
|
+
insertColumn(index: number, config?: Partial<SpreadsheetColumn>): void;
|
|
584
|
+
deleteColumn(colId: string): void;
|
|
585
|
+
insertRow(index: number, config?: Partial<SpreadsheetRow>): void;
|
|
586
|
+
deleteRow(rowId: string): void;
|
|
587
|
+
private generateId;
|
|
588
|
+
/**
|
|
589
|
+
* Rewrites references in every cell formula (and, for column changes, every
|
|
590
|
+
* column formula) so they keep pointing at the same cells.
|
|
591
|
+
*/
|
|
592
|
+
private shiftReferences;
|
|
593
|
+
setColumnWidth(colId: string, width: number): void;
|
|
594
|
+
autoFitColumnWidth(colId: string, customWidth?: number): void;
|
|
595
|
+
/**
|
|
596
|
+
* Exports cell values as TSV: the whole sheet, or only `range` (e.g. the
|
|
597
|
+
* current selection) when given.
|
|
598
|
+
*/
|
|
599
|
+
exportToTsv(range?: CellRange | null): string;
|
|
600
|
+
/**
|
|
601
|
+
* Pastes tab-separated values starting at (startRow, startCol), adding rows
|
|
602
|
+
* and columns as needed. The whole paste is a single undo step.
|
|
603
|
+
*/
|
|
604
|
+
importFromTsv(tsvData: string, startRow?: number, startCol?: number): void;
|
|
605
|
+
/** Adds rows/columns at the end until (rowIndex, colIndex) exists. */
|
|
606
|
+
private growGrid;
|
|
607
|
+
/**
|
|
608
|
+
* Writes raw inputs starting at (startRow, startCol), growing the grid as
|
|
609
|
+
* needed, as a single undo step with one recalculation.
|
|
610
|
+
*/
|
|
611
|
+
private writeMatrix;
|
|
612
|
+
/**
|
|
613
|
+
* Runs `fn` as one undo step: cell writes inside it are batched and
|
|
614
|
+
* recalculated once, then listeners are notified.
|
|
615
|
+
*/
|
|
616
|
+
private runBatch;
|
|
617
|
+
/**
|
|
618
|
+
* Exports the sheet (or `range`) as RFC 4180 CSV. Values are exported as
|
|
619
|
+
* displayed unless `formulas` is set.
|
|
620
|
+
*/
|
|
621
|
+
exportToCsv(options?: CsvExportOptions): string;
|
|
622
|
+
/**
|
|
623
|
+
* Imports CSV text at (startRow, startCol) (default A1), growing the grid
|
|
624
|
+
* as needed. The whole import is a single undo step.
|
|
625
|
+
*/
|
|
626
|
+
importFromCsv(csv: string, options?: CsvImportOptions): void;
|
|
627
|
+
/**
|
|
628
|
+
* Writes already-parsed rows of raw inputs (e.g. from an import adapter)
|
|
629
|
+
* starting at (startRow, startCol), as a single undo step.
|
|
630
|
+
*/
|
|
631
|
+
importRows(rows: string[][], options?: Omit<CsvImportOptions, 'delimiter'>): void;
|
|
632
|
+
/** The cells of `range` (or the whole sheet), row by row. */
|
|
633
|
+
private readMatrix;
|
|
634
|
+
/**
|
|
635
|
+
* Builds clipboard data for `range` (default: the selection) as TSV,
|
|
636
|
+
* an HTML table and the lossless internal JSON format. Write every entry
|
|
637
|
+
* with `clipboardData.setData(type, data)` in a `copy` event.
|
|
638
|
+
*/
|
|
639
|
+
copyToClipboardData(range?: CellRange | null): SpreadsheetClipboardData;
|
|
640
|
+
/**
|
|
641
|
+
* Pastes clipboard data at `target` (default: the selection's top-left).
|
|
642
|
+
* Prefers the internal format (formulas re-based to the target), then an
|
|
643
|
+
* HTML table, then TSV. Returns false when there was nothing to paste.
|
|
644
|
+
*/
|
|
645
|
+
pasteClipboardData(source: SpreadsheetClipboardSource, target?: CellPosition): boolean;
|
|
646
|
+
private getSelectionTopLeft;
|
|
647
|
+
/** The table settings object, created on first use. */
|
|
648
|
+
private get table();
|
|
649
|
+
/** Records an undo step, applies `fn`, then notifies listeners. */
|
|
650
|
+
private applyTableChange;
|
|
651
|
+
/** First and last (inclusive) body row: rows between header and footer rows. */
|
|
652
|
+
private getBodyRowBounds;
|
|
653
|
+
private getCellValueAt;
|
|
654
|
+
/** Rewrites every formula so references follow cells that moved. */
|
|
655
|
+
private remapAllFormulas;
|
|
656
|
+
/**
|
|
657
|
+
* Keeps merges in place when rows/columns are inserted or deleted:
|
|
658
|
+
* merges after the change shift, merges across it grow or shrink, and
|
|
659
|
+
* merges reduced to a single cell are dropped.
|
|
660
|
+
*/
|
|
661
|
+
private adjustTableForStructuralChange;
|
|
662
|
+
/**
|
|
663
|
+
* Sorts rows by one or more columns (stable; numbers before text, blanks
|
|
664
|
+
* last). Without a range (or with a range spanning every column) whole rows
|
|
665
|
+
* move; with a range only the cells inside it move. Header and footer rows
|
|
666
|
+
* never move. References follow the moved cells. Returns false when the
|
|
667
|
+
* sort is rejected (no valid keys, a key outside the range, or merged
|
|
668
|
+
* cells in the sorted area).
|
|
669
|
+
*/
|
|
670
|
+
sortRows(keys: SortKey[], options?: {
|
|
671
|
+
range?: CellRange | null;
|
|
672
|
+
}): boolean;
|
|
673
|
+
getFilterState(): SpreadsheetFilterState;
|
|
674
|
+
/** Replaces all filter rules (and turns filters on when there are any). */
|
|
675
|
+
setFilterRules(rules: NewFilterRule[]): void;
|
|
676
|
+
/** Adds a filter rule (AND-combined with the others) and turns filters on. Returns its id. */
|
|
677
|
+
addFilterRule(rule: NewFilterRule): string;
|
|
678
|
+
updateFilterRule(ruleId: string, changes: Partial<Omit<FilterRule, 'id'>>): void;
|
|
679
|
+
removeFilterRule(ruleId: string): void;
|
|
680
|
+
clearFilters(): void;
|
|
681
|
+
/** Turns filtering on or off, keeping the rules. */
|
|
682
|
+
setFiltersEnabled(enabled: boolean): void;
|
|
683
|
+
toggleFilters(): void;
|
|
684
|
+
private generateFilterId;
|
|
685
|
+
setHeaderRowCount(count: number): void;
|
|
686
|
+
setFooterRowCount(count: number): void;
|
|
687
|
+
setHeaderColumnCount(count: number): void;
|
|
688
|
+
/** Keeps the first `count` rows visible while scrolling. 0 unfreezes. */
|
|
689
|
+
setFrozenRowCount(count: number): void;
|
|
690
|
+
/** Keeps the first `count` columns visible while scrolling. 0 unfreezes. */
|
|
691
|
+
setFrozenColumnCount(count: number): void;
|
|
692
|
+
private setTableCount;
|
|
693
|
+
hideRows(indices: number[]): void;
|
|
694
|
+
unhideRows(indices: number[]): void;
|
|
695
|
+
hideColumns(indices: number[]): void;
|
|
696
|
+
unhideColumns(indices: number[]): void;
|
|
697
|
+
/** Unhides every hidden row and column (filters are unaffected). */
|
|
698
|
+
unhideAll(): void;
|
|
699
|
+
private setHidden;
|
|
700
|
+
getMerges(): CellRange[];
|
|
701
|
+
/** The merge containing (row, col), or null. */
|
|
702
|
+
getMergeAt(row: number, col: number): CellRange | null;
|
|
703
|
+
/** Grows `range` until no merge crosses its edge. Keeps the drag direction. */
|
|
704
|
+
expandRangeToMerges(range: CellRange): CellRange;
|
|
705
|
+
/**
|
|
706
|
+
* Merges `range` (default: the selection) into one cell anchored on its
|
|
707
|
+
* top-left cell; the other cells are cleared. Merges fully inside the range
|
|
708
|
+
* are absorbed. Returns false for single cells and for ranges that
|
|
709
|
+
* partially overlap an existing merge.
|
|
710
|
+
*/
|
|
711
|
+
mergeCells(range?: CellRange | null): boolean;
|
|
712
|
+
/** Removes every merge intersecting `range` (default: the selection). */
|
|
713
|
+
unmergeCells(range?: CellRange | null): boolean;
|
|
714
|
+
/**
|
|
715
|
+
* Fills `target` from `source` like dragging the fill handle. `target` is
|
|
716
|
+
* the extended range (source included) and must extend `source` down, up,
|
|
717
|
+
* right or left. Numbers and dates continue their series, text ending in a
|
|
718
|
+
* number counts up, other text repeats, and formulas are copied with
|
|
719
|
+
* their relative references shifted (`$` parts stay). Returns false when
|
|
720
|
+
* the ranges don't line up.
|
|
721
|
+
*/
|
|
722
|
+
autofill(source: CellRange, target: CellRange): boolean;
|
|
723
|
+
/**
|
|
724
|
+
* Groups body rows by the value in `colId`, with optional per-group
|
|
725
|
+
* summaries (e.g. `[{ colId, aggregate: 'sum' }]`).
|
|
726
|
+
*/
|
|
727
|
+
groupRowsBy(colId: string, summaries?: GroupSummary[]): void;
|
|
728
|
+
ungroupRows(): void;
|
|
729
|
+
/** Sets (or with `null`, removes) the group summary for a column. */
|
|
730
|
+
setGroupSummary(colId: string, aggregate: GroupAggregate | null): void;
|
|
731
|
+
setGroupCollapsed(key: string, collapsed: boolean): void;
|
|
732
|
+
toggleGroupCollapsed(key: string): void;
|
|
733
|
+
/** The current row groups with their summaries (empty when not grouped). */
|
|
734
|
+
getGroups(): SpreadsheetRowGroup[];
|
|
735
|
+
/**
|
|
736
|
+
* Transposes `range` (default: the selection) in place around its top-left
|
|
737
|
+
* cell: rows become columns. Cells left uncovered are cleared, the grid
|
|
738
|
+
* grows if needed, and references follow the moved cells. Returns false
|
|
739
|
+
* for single cells or when merged cells are involved.
|
|
740
|
+
*/
|
|
741
|
+
transposeRange(range?: CellRange | null): boolean;
|
|
742
|
+
/**
|
|
743
|
+
* What to render: visible rows (with group headers) and columns in display
|
|
744
|
+
* order, frozen offsets and merged-cell spans. Filters, hidden rows/columns
|
|
745
|
+
* and collapsed groups only affect this view, never the document.
|
|
746
|
+
*/
|
|
747
|
+
getViewModel(): SpreadsheetViewModel;
|
|
748
|
+
private recordSnapshot;
|
|
749
|
+
undo(): void;
|
|
750
|
+
redo(): void;
|
|
751
|
+
private notifyChange;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
export { type SpreadsheetFilterState as $, type ASTNode as A, type BinaryOpNode as B, type CellCoordinate as C, DEFAULT_COLUMN_WIDTH as D, type EvaluationContext as E, FORMULA_ERRORS as F, type GroupAggregate as G, type PropertyRefNode as H, type RowType as I, type SortDirection as J, type SortKey as K, type LiteralNode as L, type SpreadsheetCellSpan as M, type NewFilterRule as N, type SpreadsheetClipboardCell as O, type ParsedSpreadsheetClipboard as P, type SpreadsheetClipboardData as Q, type RangeNode as R, SPREADSHEET_CLIPBOARD_MIME as S, type SpreadsheetClipboardPayload as T, type SpreadsheetClipboardSource as U, type SpreadsheetColumn as V, SpreadsheetController as W, type SpreadsheetControllerOptions as X, type SpreadsheetDataSource as Y, type SpreadsheetDataSourceField as Z, type SpreadsheetDocument as _, type CellData as a, type SpreadsheetGrouping as a0, type SpreadsheetRow as a1, type SpreadsheetRowGroup as a2, type SpreadsheetRowSection as a3, type SpreadsheetTableSettings as a4, type SpreadsheetViewColumn as a5, type SpreadsheetViewModel as a6, type SpreadsheetViewRow as a7, type StructuralChange as a8, type UnaryOpNode as a9, WHOLE_COLUMN_END_ROW as aa, buildSpreadsheetView as ab, colNameToIndex as ac, columnDependencyKey as ad, computeRowGroups as ae, createSpreadsheetClipboardData as af, describeFormulaError as ag, extractCellDependencies as ah, getRowSection as ai, getTableSections as aj, indexToColName as ak, isFormulaError as al, mapFormulaReferences as am, offsetFormulaReferences as an, parseCellReference as ao, parseFormula as ap, parseHtmlTable as aq, parseRange as ar, readSpreadsheetClipboard as as, rebaseClipboardRows as at, remapFormulaReferences as au, rowPassesFilters as av, serializeHtmlTable as aw, shiftFormulaReferences as ax, tokenizeFormula as ay, type CellDep as b, type CellFormat as c, type CellPosition as d, type CellRange as e, type CellRefNode as f, type CellValueReader as g, type ColumnBinding as h, type ColumnType as i, type CsvExportOptions as j, type CsvImportOptions as k, DEFAULT_ROW_HEIGHT as l, DataSourceBinder as m, DependencyGraph as n, type FilterOperator as o, type FilterRule as p, type FormulaDiagnostic as q, type FormulaErrorCode as r, type FormulaEvaluationResult as s, FormulaEvaluator as t, FormulaParser as u, type FormulaRange as v, type FormulaToken as w, type FormulaTokenType as x, type FunctionCallNode as y, type GroupSummary as z };
|