@pixerate/editor 0.24.0 → 0.26.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 +101 -1
- package/THIRD_PARTY_NOTICES.md +40 -0
- package/dist/agent/index.cjs +175 -11
- package/dist/agent/index.cjs.map +1 -1
- package/dist/agent/index.d.cts +18 -4
- package/dist/agent/index.d.ts +18 -4
- package/dist/agent/index.js +168 -4
- package/dist/agent/index.js.map +1 -1
- package/dist/{arrangeShortcuts-B8O3f8-P.d.cts → arrange-BICutYPk.d.cts} +243 -29
- package/dist/{arrangeShortcuts-sLlD2rSX.d.ts → arrange-BICutYPk.d.ts} +243 -29
- package/dist/builtins-CdPcLwwF.d.cts +176 -0
- package/dist/builtins-Chj6zv_O.d.ts +176 -0
- package/dist/canvas/index.cjs +8588 -1857
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +1847 -9
- package/dist/canvas/index.d.ts +1847 -9
- package/dist/canvas/index.js +8577 -1846
- package/dist/canvas/index.js.map +1 -1
- package/dist/chunk-3CC7OPUQ.cjs +831 -0
- package/dist/chunk-3CC7OPUQ.cjs.map +1 -0
- package/dist/chunk-4BVP64JJ.cjs +1406 -0
- package/dist/chunk-4BVP64JJ.cjs.map +1 -0
- package/dist/chunk-BVP3TSLH.cjs +69 -0
- package/dist/chunk-BVP3TSLH.cjs.map +1 -0
- package/dist/{chunk-OLZJXL4R.cjs → chunk-CS6NZWWA.cjs} +59 -25
- package/dist/chunk-CS6NZWWA.cjs.map +1 -0
- package/dist/{chunk-MCSJFWAO.cjs → chunk-EWCOFSCQ.cjs} +685 -100
- package/dist/chunk-EWCOFSCQ.cjs.map +1 -0
- package/dist/chunk-HDYMLS3X.cjs +409 -0
- package/dist/chunk-HDYMLS3X.cjs.map +1 -0
- package/dist/chunk-HRMEDT2L.js +1406 -0
- package/dist/chunk-HRMEDT2L.js.map +1 -0
- package/dist/{chunk-D27YFC46.cjs → chunk-IFHKKVXH.cjs} +382 -63
- package/dist/chunk-IFHKKVXH.cjs.map +1 -0
- package/dist/{chunk-PGNZKFQS.js → chunk-JOIREKL7.js} +137 -58
- package/dist/chunk-JOIREKL7.js.map +1 -0
- package/dist/chunk-KRGXUQ2Y.js +1696 -0
- package/dist/chunk-KRGXUQ2Y.js.map +1 -0
- package/dist/{chunk-3LV6RRPH.js → chunk-MHEPLBFB.js} +2 -2
- package/dist/chunk-MR2764X2.js +831 -0
- package/dist/chunk-MR2764X2.js.map +1 -0
- package/dist/{chunk-XNORY7M6.cjs → chunk-NFVBT3UZ.cjs} +166 -87
- package/dist/chunk-NFVBT3UZ.cjs.map +1 -0
- package/dist/chunk-NQF32I6Z.cjs +6478 -0
- package/dist/chunk-NQF32I6Z.cjs.map +1 -0
- package/dist/chunk-O5RYH2PG.js +69 -0
- package/dist/chunk-O5RYH2PG.js.map +1 -0
- package/dist/{chunk-ITBSKI26.js → chunk-Q2OHWD2A.js} +1064 -360
- package/dist/chunk-Q2OHWD2A.js.map +1 -0
- package/dist/{chunk-FODNLX5N.js → chunk-QJSOZFCZ.js} +38 -4
- package/dist/chunk-QJSOZFCZ.js.map +1 -0
- package/dist/{chunk-SML64VJG.cjs → chunk-RRREAOVM.cjs} +4 -4
- package/dist/{chunk-SML64VJG.cjs.map → chunk-RRREAOVM.cjs.map} +1 -1
- package/dist/{chunk-5S3Z4PPF.js → chunk-SWE3NPOU.js} +347 -28
- package/dist/chunk-SWE3NPOU.js.map +1 -0
- package/dist/chunk-TXXNBDQX.cjs +1696 -0
- package/dist/chunk-TXXNBDQX.cjs.map +1 -0
- package/dist/chunk-UBCFIABU.js +409 -0
- package/dist/chunk-UBCFIABU.js.map +1 -0
- package/dist/chunk-X7HXL2SB.js +6478 -0
- package/dist/chunk-X7HXL2SB.js.map +1 -0
- package/dist/{chunk-SBCZ6RN5.cjs → chunk-YOMYSFJU.cjs} +1163 -459
- package/dist/chunk-YOMYSFJU.cjs.map +1 -0
- package/dist/{chunk-3CN2WD3X.js → chunk-ZRNHGAQT.js} +661 -76
- package/dist/chunk-ZRNHGAQT.js.map +1 -0
- package/dist/commands/index.cjs +425 -4
- package/dist/commands/index.cjs.map +1 -1
- package/dist/commands/index.d.cts +39 -77
- package/dist/commands/index.d.ts +39 -77
- package/dist/commands/index.js +424 -3
- package/dist/commands/index.js.map +1 -1
- package/dist/compare/index.cjs +3 -3
- package/dist/compare/index.d.cts +1 -1
- package/dist/compare/index.d.ts +1 -1
- package/dist/compare/index.js +2 -2
- package/dist/controller-CxXGOEmy.d.cts +2038 -0
- package/dist/controller-CxXGOEmy.d.ts +2038 -0
- package/dist/{documents-BQjzJNe2.d.ts → documents-CHT1U5Vs.d.ts} +10 -0
- package/dist/{documents-KRTPhvst.d.cts → documents-Gp7wb0Me.d.cts} +10 -0
- package/dist/export/index.cjs +36 -0
- package/dist/export/index.cjs.map +1 -0
- package/dist/export/index.d.cts +243 -0
- package/dist/export/index.d.ts +243 -0
- package/dist/export/index.js +36 -0
- package/dist/export/index.js.map +1 -0
- package/dist/extensions/index.cjs +101 -6
- package/dist/extensions/index.cjs.map +1 -1
- package/dist/extensions/index.d.cts +18 -5
- package/dist/extensions/index.d.ts +18 -5
- package/dist/extensions/index.js +101 -6
- package/dist/generation/index.cjs +1013 -69
- package/dist/generation/index.cjs.map +1 -1
- package/dist/generation/index.d.cts +474 -13
- package/dist/generation/index.d.ts +474 -13
- package/dist/generation/index.js +976 -32
- package/dist/generation/index.js.map +1 -1
- package/dist/image-editor/index.cjs +3385 -1275
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +693 -128
- package/dist/image-editor/index.d.ts +693 -128
- package/dist/image-editor/index.js +3325 -1215
- package/dist/image-editor/index.js.map +1 -1
- package/dist/{index-fJrlkJCd.d.ts → index-B273Zllk.d.ts} +500 -7
- package/dist/{index-BhJBSm2d.d.cts → index-jcJwmBYt.d.cts} +500 -7
- package/dist/index.cjs +1603 -45
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +154 -27
- package/dist/index.d.ts +154 -27
- package/dist/index.js +1584 -26
- package/dist/index.js.map +1 -1
- package/dist/mention-text-CDnCFd3c.d.cts +53 -0
- package/dist/mention-text-CDnCFd3c.d.ts +53 -0
- package/dist/model-C1zApQM8.d.cts +219 -0
- package/dist/model-C1zApQM8.d.ts +219 -0
- package/dist/persistence/index.d.cts +3 -120
- package/dist/persistence/index.d.ts +3 -120
- package/dist/registry-CED5C0lA.d.cts +204 -0
- package/dist/registry-CED5C0lA.d.ts +204 -0
- package/dist/{registry-GJI4gToU.d.cts → registry-CEgwXED1.d.cts} +12 -1
- package/dist/{registry-GJI4gToU.d.ts → registry-CEgwXED1.d.ts} +12 -1
- package/dist/{registry-D32LpIc4.d.cts → registry-D0GADKc7.d.cts} +1 -1
- package/dist/{registry-evKTP4ls.d.ts → registry-DhVUZioj.d.ts} +1 -1
- package/dist/serializers/index.cjs +12 -4
- package/dist/serializers/index.cjs.map +1 -1
- package/dist/serializers/index.d.cts +41 -13
- package/dist/serializers/index.d.ts +41 -13
- package/dist/serializers/index.js +12 -4
- package/dist/spreadsheet/index.cjs +157 -3
- package/dist/spreadsheet/index.cjs.map +1 -1
- package/dist/spreadsheet/index.d.cts +534 -11
- package/dist/spreadsheet/index.d.ts +534 -11
- package/dist/spreadsheet/index.js +157 -3
- package/dist/storage-BpFfspHm.d.cts +120 -0
- package/dist/storage-BpFfspHm.d.ts +120 -0
- package/dist/tokens/index.cjs +115 -0
- package/dist/tokens/index.cjs.map +1 -0
- package/dist/tokens/index.d.cts +212 -0
- package/dist/tokens/index.d.ts +212 -0
- package/dist/tokens/index.js +115 -0
- package/dist/tokens/index.js.map +1 -0
- package/dist/{track-changes-BK5sVf4_.d.cts → track-changes-D_VAPELi.d.cts} +95 -11
- package/dist/{track-changes-CDjCrwKe.d.ts → track-changes-Db_fGEvx.d.ts} +95 -11
- package/package.json +15 -1
- package/dist/chunk-3CN2WD3X.js.map +0 -1
- package/dist/chunk-5S3Z4PPF.js.map +0 -1
- package/dist/chunk-D27YFC46.cjs.map +0 -1
- package/dist/chunk-FODNLX5N.js.map +0 -1
- package/dist/chunk-ITBSKI26.js.map +0 -1
- package/dist/chunk-MA2F5KHF.cjs +0 -3223
- package/dist/chunk-MA2F5KHF.cjs.map +0 -1
- package/dist/chunk-MCSJFWAO.cjs.map +0 -1
- package/dist/chunk-OLZJXL4R.cjs.map +0 -1
- package/dist/chunk-PGNZKFQS.js.map +0 -1
- package/dist/chunk-SBCZ6RN5.cjs.map +0 -1
- package/dist/chunk-U5KWZU4X.js +0 -3223
- package/dist/chunk-U5KWZU4X.js.map +0 -1
- package/dist/chunk-XNORY7M6.cjs.map +0 -1
- package/dist/controller-BhLLAoi8.d.cts +0 -1000
- package/dist/controller-BhLLAoi8.d.ts +0 -1000
- package/dist/types-DX4Mh4SL.d.cts +0 -217
- package/dist/types-DX4Mh4SL.d.ts +0 -217
- /package/dist/{chunk-3LV6RRPH.js.map → chunk-MHEPLBFB.js.map} +0 -0
|
@@ -1,6 +1,64 @@
|
|
|
1
|
-
import { A as ASTNode,
|
|
2
|
-
export { B as BinaryOpNode, C as CellCoordinate, b as CellDep, f as CellRefNode, g as CellValueReader, h as ColumnBinding, i as ColumnType,
|
|
3
|
-
import { I as ImportAdapterRegistry,
|
|
1
|
+
import { A as ASTNode, P as FormulaErrorCode, V as FormulaRange, a as CellData, c as CellFormat, p as ConditionalFormatSheet, n as ConditionalFormatOverlay, o as ConditionalFormatRule, j as ConditionalCellFormat, t as ConditionalFormatValue, l as ConditionalFormatIconSet, F as DataValidationRule, q as ConditionalFormatStyle, r as ConditionalFormatTimePeriod, e as CellRange, y as DataValidationErrorStyle, z as DataValidationOperator, H as DataValidationType, a8 as NewConditionalFormatRule, G as DataValidationSheet, d as CellPosition, E as DataValidationResult, $ as GroupAggregate, aj as SortDirection, N as FilterRule, S as SpreadsheetController, aw as SpreadsheetDefinedName, aP as StructuralChange, aM as SpreadsheetViewModel } from '../controller-CxXGOEmy.cjs';
|
|
2
|
+
export { B as BinaryOpNode, C as CellCoordinate, b as CellDep, f as CellRefNode, g as CellValueReader, h as ColumnBinding, i as ColumnType, k as ConditionalFormatCondition, m as ConditionalFormatOperator, s as ConditionalFormatType, u as CsvExportOptions, v as CsvImportOptions, D as DEFAULT_COLUMN_WIDTH, w as DEFAULT_ROW_HEIGHT, x as DataSourceBinder, I as DependencyGraph, J as DependencyIndexStats, K as EvaluationContext, L as FORMULA_ERRORS, M as FilterOperator, O as FormulaDiagnostic, Q as FormulaEvaluationResult, R as FormulaEvaluator, T as FormulaNameDefinition, U as FormulaParser, W as FormulaReferenceFilter, X as FormulaReferenceInfo, Y as FormulaToken, Z as FormulaTokenType, _ as FunctionCallNode, a0 as GroupSummary, a1 as IntervalIndex, a2 as InvokeNode, a3 as LiteralNode, a4 as MAX_FORMULA_ARRAY_SIZE, a5 as MissingNode, a6 as NameDep, a7 as NameNode, a9 as NewDataValidationRule, aa as NewFilterRule, ab as ParsedSpreadsheetClipboard, ac as PropertyRefNode, ad as RangeNode, ae as RangeResolveOptions, af as ReferenceDep, ag as RowType, ah as SPREADSHEET_CLIPBOARD_MIME, ai as SheetQualifier, ak as SortKey, al as SpillRefNode, am as SpreadsheetCellSpan, an as SpreadsheetClipboardCell, ao as SpreadsheetClipboardData, ap as SpreadsheetClipboardPayload, aq as SpreadsheetClipboardSource, ar as SpreadsheetColumn, as as SpreadsheetCommitResult, at as SpreadsheetControllerOptions, au as SpreadsheetDataSource, av as SpreadsheetDataSourceField, ax as SpreadsheetDocument, ay as SpreadsheetFilterState, az as SpreadsheetGrouping, aA as SpreadsheetNameInfo, aB as SpreadsheetNameScope, aC as SpreadsheetRecalculationStats, aD as SpreadsheetRow, aE as SpreadsheetRowGroup, aF as SpreadsheetRowSection, aG as SpreadsheetSheetInfo, aH as SpreadsheetSpill, aI as SpreadsheetTableSettings, aJ as SpreadsheetValidationAction, aK as SpreadsheetValidationPrompt, aL as SpreadsheetViewColumn, aN as SpreadsheetViewRow, aO as SpreadsheetWorkbook, aQ as UnaryOpNode, aR as WHOLE_COLUMN_END_ROW, aS as buildSpreadsheetView, aT as colNameToIndex, aU as columnDependencyKey, aV as compareNumbers, aW as compareValues, aX as computeRowGroups, aY as createSpreadsheetClipboardData, aZ as deleteSheetInFormula, a_ as describeFormulaError, a$ as extractCellDependencies, b0 as extractNameDependencies, b1 as extractReferenceDependencies, b2 as formatSheetPrefix, b3 as formulaIdentifiers, b4 as getRowSection, b5 as getTableSections, b6 as indexToColName, b7 as isFormulaError, b8 as mapFormulaReferences, b9 as numberToText, ba as offsetFormulaReferences, bb as parseCellReference, bc as parseFormula, bd as parseHtmlTable, be as parseRange, bf as quoteSheetName, bg as rangeDependencyKey, bh as readSpreadsheetClipboard, bi as rebaseClipboardRows, bj as remapFormulaReferences, bk as renameNameInFormula, bl as renameSheetInFormula, bm as rowPassesFilters, bn as serializeHtmlTable, bo as sheetNameNeedsQuotes, bp as shiftFormulaReferences, bq as sortCompareValues, br as tokenizeFormula } from '../controller-CxXGOEmy.cjs';
|
|
3
|
+
import { I as ImportAdapterRegistry, b as ImportAdapter, h as ImportInput, a as ImportOutcome } from '../registry-CEgwXED1.cjs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* LAMBDA values and the lexical environments of LET and LAMBDA variables.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Variables of one LET or LAMBDA call. Environments form a chain: a lambda
|
|
11
|
+
* keeps the environment it was created in (a closure), so its body sees the
|
|
12
|
+
* LET variables around its definition, not those of its caller.
|
|
13
|
+
*/
|
|
14
|
+
interface FormulaEnvironment {
|
|
15
|
+
/** Upper-case variable name → value. */
|
|
16
|
+
readonly vars: Map<string, any>;
|
|
17
|
+
/** LAMBDA parameters whose argument was left out (for ISOMITTED). */
|
|
18
|
+
readonly omitted?: Set<string>;
|
|
19
|
+
readonly parent: FormulaEnvironment | null;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A function value created by `LAMBDA(params…, body)`, or a built-in function
|
|
23
|
+
* passed by name (`BYROW(A1:C3, SUM)`). Lambdas can be stored in LET
|
|
24
|
+
* variables and defined names and passed to MAP, REDUCE, SCAN, BYROW, BYCOL
|
|
25
|
+
* and MAKEARRAY; a cell whose result is an uncalled lambda shows `#CALC!`.
|
|
26
|
+
*/
|
|
27
|
+
declare class FormulaLambda {
|
|
28
|
+
/** Upper-case parameter names. */
|
|
29
|
+
readonly params: readonly string[];
|
|
30
|
+
/** The calculation; null for a native (built-in) function. */
|
|
31
|
+
readonly body: ASTNode | null;
|
|
32
|
+
/** The environment the lambda was created in. */
|
|
33
|
+
readonly env: FormulaEnvironment | null;
|
|
34
|
+
/** The sheet unqualified references in the body refer to (a sheet-scoped name's sheet). */
|
|
35
|
+
readonly sheet?: string | undefined;
|
|
36
|
+
/** Implementation of a built-in function passed by name. */
|
|
37
|
+
readonly native?: ((args: any[]) => any) | undefined;
|
|
38
|
+
/** Display name, e.g. `SUM` or `LAMBDA`. */
|
|
39
|
+
readonly label: string;
|
|
40
|
+
constructor(
|
|
41
|
+
/** Upper-case parameter names. */
|
|
42
|
+
params: readonly string[],
|
|
43
|
+
/** The calculation; null for a native (built-in) function. */
|
|
44
|
+
body: ASTNode | null,
|
|
45
|
+
/** The environment the lambda was created in. */
|
|
46
|
+
env: FormulaEnvironment | null,
|
|
47
|
+
/** The sheet unqualified references in the body refer to (a sheet-scoped name's sheet). */
|
|
48
|
+
sheet?: string | undefined,
|
|
49
|
+
/** Implementation of a built-in function passed by name. */
|
|
50
|
+
native?: ((args: any[]) => any) | undefined,
|
|
51
|
+
/** Display name, e.g. `SUM` or `LAMBDA`. */
|
|
52
|
+
label?: string);
|
|
53
|
+
toString(): string;
|
|
54
|
+
}
|
|
55
|
+
declare const isFormulaLambda: (value: unknown) => value is FormulaLambda;
|
|
56
|
+
/**
|
|
57
|
+
* Deepest nesting of LAMBDA calls (recursion through named lambdas). Deeper
|
|
58
|
+
* calls return `#NUM!`, as in Excel. The JavaScript stack may run out first
|
|
59
|
+
* on small stacks; that is reported as `#NUM!` too.
|
|
60
|
+
*/
|
|
61
|
+
declare const MAX_LAMBDA_DEPTH = 1000;
|
|
4
62
|
|
|
5
63
|
type FormulaFunctionCategory = 'math' | 'statistical' | 'logical' | 'text' | 'lookup' | 'date' | 'information';
|
|
6
64
|
/** What an argument expects. Used for documentation, hints and messages. */
|
|
@@ -158,6 +216,20 @@ interface FormulaFunctionSuggestion {
|
|
|
158
216
|
signature: string;
|
|
159
217
|
description: string;
|
|
160
218
|
category: FormulaFunctionDefinition['category'];
|
|
219
|
+
/**
|
|
220
|
+
* `name` for a defined name (accepting it inserts the name as defined,
|
|
221
|
+
* followed by `(` only for a LAMBDA name); unset for functions.
|
|
222
|
+
*/
|
|
223
|
+
kind?: 'name';
|
|
224
|
+
/** For a defined name: it holds a LAMBDA, so it is called like a function. */
|
|
225
|
+
isLambda?: boolean;
|
|
226
|
+
}
|
|
227
|
+
/** A defined name offered by autocomplete (see `SpreadsheetController.getNameSuggestions`). */
|
|
228
|
+
interface FormulaNameSuggestionSource {
|
|
229
|
+
name: string;
|
|
230
|
+
description?: string;
|
|
231
|
+
/** A LAMBDA name is called like a function. */
|
|
232
|
+
isLambda?: boolean;
|
|
161
233
|
}
|
|
162
234
|
interface FormulaActiveCall {
|
|
163
235
|
name: string;
|
|
@@ -180,12 +252,17 @@ interface FormulaHints {
|
|
|
180
252
|
/** Everything formula autocomplete UIs need for `input` with the caret at `caret`. */
|
|
181
253
|
declare function getFormulaHints(input: string, caret?: number, options?: {
|
|
182
254
|
limit?: number;
|
|
255
|
+
names?: readonly FormulaNameSuggestionSource[];
|
|
183
256
|
}): FormulaHints;
|
|
184
257
|
/**
|
|
185
258
|
* Replaces the name prefix at the caret with `NAME(`, returning the new input
|
|
186
|
-
* and caret position (just inside the parenthesis).
|
|
259
|
+
* and caret position (just inside the parenthesis). Given a defined-name
|
|
260
|
+
* suggestion (`kind: 'name'`), the name keeps its case and gets a `(` only
|
|
261
|
+
* when it holds a LAMBDA; `call: false` inserts any name without `(`.
|
|
187
262
|
*/
|
|
188
|
-
declare function applyFormulaSuggestion(input: string, caret: number,
|
|
263
|
+
declare function applyFormulaSuggestion(input: string, caret: number, suggestion: string | Pick<FormulaFunctionSuggestion, 'name' | 'kind' | 'isLambda'>, options?: {
|
|
264
|
+
call?: boolean;
|
|
265
|
+
}): {
|
|
189
266
|
value: string;
|
|
190
267
|
caret: number;
|
|
191
268
|
};
|
|
@@ -402,6 +479,214 @@ declare function parseCellInput(input: string): ParsedCellInput;
|
|
|
402
479
|
*/
|
|
403
480
|
declare function parseNumberText(text: string): number | null;
|
|
404
481
|
|
|
482
|
+
/**
|
|
483
|
+
* The number a value counts as for scales, bars, icons, top/bottom and
|
|
484
|
+
* averages: numbers, and dates (ISO text) as their serial number. Text,
|
|
485
|
+
* booleans, blanks and errors are not numbers.
|
|
486
|
+
*/
|
|
487
|
+
declare function conditionalFormatNumber(value: unknown): number | null;
|
|
488
|
+
/** Blends two colours: `t` 0 is `a`, 1 is `b`. */
|
|
489
|
+
declare function blendConditionalFormatColors(a: string, b: string, t: number): string;
|
|
490
|
+
/** Excel's default icon thresholds: percent 0, 33, 67 for three icons. */
|
|
491
|
+
declare function defaultIconThresholds(set: string): ConditionalFormatValue[];
|
|
492
|
+
/** An overlay with no formatted cells. */
|
|
493
|
+
declare const EMPTY_CONDITIONAL_FORMAT_OVERLAY: ConditionalFormatOverlay;
|
|
494
|
+
/**
|
|
495
|
+
* Evaluates conditional formats and keeps what it needs to re-evaluate only
|
|
496
|
+
* the affected cells after an edit (`update`). Rules are applied in order
|
|
497
|
+
* (the first has the highest priority): every matching rule adds the parts
|
|
498
|
+
* of its style that higher-priority rules left unset, and a matching rule
|
|
499
|
+
* with `stopIfTrue` hides lower-priority rules. Colour scales, data bars and
|
|
500
|
+
* icon sets apply to numbers only and never stop other rules.
|
|
501
|
+
*/
|
|
502
|
+
declare class ConditionalFormatEngine {
|
|
503
|
+
private sheet;
|
|
504
|
+
private cells;
|
|
505
|
+
private stats;
|
|
506
|
+
private rulesKey;
|
|
507
|
+
private current;
|
|
508
|
+
constructor(sheet: ConditionalFormatSheet);
|
|
509
|
+
/** Replaces the sheet accessor (e.g. after rows or columns were added). */
|
|
510
|
+
setSheet(sheet: ConditionalFormatSheet): void;
|
|
511
|
+
/** The last evaluated overlay. */
|
|
512
|
+
get overlay(): ConditionalFormatOverlay;
|
|
513
|
+
/** Evaluates every rule over every cell it applies to. */
|
|
514
|
+
evaluate(rules: ConditionalFormatRule[]): ConditionalFormatOverlay;
|
|
515
|
+
/**
|
|
516
|
+
* Re-evaluates after the values of `changed` cells changed (the edited
|
|
517
|
+
* cells and the formulas that depend on them). Rules that look at the whole
|
|
518
|
+
* range (scales, bars, icons, top/bottom, average, duplicates) are
|
|
519
|
+
* re-evaluated over their range when a changed cell is inside it; formula
|
|
520
|
+
* rules always are, since their formulas may read any cell; other rules
|
|
521
|
+
* only at the changed cells. Falls back to `evaluate` when the rules
|
|
522
|
+
* changed.
|
|
523
|
+
*/
|
|
524
|
+
update(rules: ConditionalFormatRule[], changed: Iterable<{
|
|
525
|
+
row: number;
|
|
526
|
+
col: number;
|
|
527
|
+
}>): ConditionalFormatOverlay;
|
|
528
|
+
private statsFor;
|
|
529
|
+
private evalFormula;
|
|
530
|
+
private threshold;
|
|
531
|
+
/** The operand of a `cellIs` rule: a formula result, or typed input. */
|
|
532
|
+
private operand;
|
|
533
|
+
/** Combines every rule that applies to (row, col). */
|
|
534
|
+
computeLook(rules: ConditionalFormatRule[], row: number, col: number): ConditionalCellFormat | undefined;
|
|
535
|
+
/**
|
|
536
|
+
* Checks one rule: returns its style when it matches, 'look' when it set a
|
|
537
|
+
* scale fill, bar or icon on `out`, or null.
|
|
538
|
+
*/
|
|
539
|
+
private matchRule;
|
|
540
|
+
}
|
|
541
|
+
/** Whether serial day `d` falls in `period` relative to `today`. */
|
|
542
|
+
declare function matchesTimePeriod(period: string, d: number, today: Date): boolean;
|
|
543
|
+
/** Evaluates `rules` over a sheet: the conditional look of every formatted cell. */
|
|
544
|
+
declare function evaluateConditionalFormats(sheet: ConditionalFormatSheet, rules: ConditionalFormatRule[]): ConditionalFormatOverlay;
|
|
545
|
+
|
|
546
|
+
/**
|
|
547
|
+
* Glyphs for conditional-format icon sets, so React and Svelte draw the same
|
|
548
|
+
* icons without image assets. Index 0 is the lowest icon.
|
|
549
|
+
*/
|
|
550
|
+
|
|
551
|
+
interface ConditionalFormatIconGlyph {
|
|
552
|
+
/** Text glyph to draw. */
|
|
553
|
+
glyph: string;
|
|
554
|
+
/** CSS colour of the glyph. */
|
|
555
|
+
color: string;
|
|
556
|
+
/** Accessible name, e.g. "Up arrow". */
|
|
557
|
+
label: string;
|
|
558
|
+
}
|
|
559
|
+
/** Names of the built-in icon sets. */
|
|
560
|
+
declare const CONDITIONAL_FORMAT_ICON_SETS: ConditionalFormatIconSet[];
|
|
561
|
+
/** Number of icons in a set (`3Arrows` → 3), always 3 to 5. */
|
|
562
|
+
declare function conditionalFormatIconCount(set: string): number;
|
|
563
|
+
/** The glyph of icon `index` of `set` (unknown sets use traffic lights). */
|
|
564
|
+
declare function getConditionalFormatIcon(set: string, index: number): ConditionalFormatIconGlyph;
|
|
565
|
+
|
|
566
|
+
/**
|
|
567
|
+
* One-line descriptions of rules for the conditional formatting and data
|
|
568
|
+
* validation managers, shared by React and Svelte.
|
|
569
|
+
*/
|
|
570
|
+
|
|
571
|
+
/** E.g. `Cell value > 100`, `Color scale (min → P50 → max)`, `Formula: =$B2>10`. */
|
|
572
|
+
declare function describeConditionalFormat(rule: ConditionalFormatRule): string;
|
|
573
|
+
/** E.g. `Whole number between 1 and 10`, `List: Low,Medium,High`, `Custom: =A1>0`. */
|
|
574
|
+
declare function describeDataValidation(rule: DataValidationRule): string;
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* Ready-made rules for the conditional formatting and data validation
|
|
578
|
+
* managers and the context menu, so React and Svelte offer the same choices.
|
|
579
|
+
*/
|
|
580
|
+
|
|
581
|
+
/** Excel's highlight styles. */
|
|
582
|
+
declare const CONDITIONAL_FORMAT_STYLE_PRESETS: Array<{
|
|
583
|
+
id: string;
|
|
584
|
+
label: string;
|
|
585
|
+
style: ConditionalFormatStyle;
|
|
586
|
+
}>;
|
|
587
|
+
declare const DEFAULT_CONDITIONAL_FORMAT_STYLE: ConditionalFormatStyle;
|
|
588
|
+
type ConditionalFormatPresetKind = 'greaterThan' | 'lessThan' | 'between' | 'equal' | 'textContains' | 'dateOccurring' | 'duplicate' | 'unique' | 'top10' | 'bottom10' | 'aboveAverage' | 'belowAverage' | 'blanks' | 'errors' | 'formula' | 'colorScale2' | 'colorScale3' | 'dataBar' | 'iconSet';
|
|
589
|
+
/** Inputs a preset needs, besides the ranges. */
|
|
590
|
+
type ConditionalFormatPresetField = 'value' | 'value2' | 'text' | 'formula' | 'rank' | 'period' | 'iconSet' | 'color';
|
|
591
|
+
interface ConditionalFormatPresetInfo {
|
|
592
|
+
kind: ConditionalFormatPresetKind;
|
|
593
|
+
label: string;
|
|
594
|
+
fields: ConditionalFormatPresetField[];
|
|
595
|
+
/** Whether the rule takes a highlight style (scales, bars and icons don't). */
|
|
596
|
+
usesStyle: boolean;
|
|
597
|
+
}
|
|
598
|
+
declare const CONDITIONAL_FORMAT_PRESETS: ConditionalFormatPresetInfo[];
|
|
599
|
+
declare const CONDITIONAL_FORMAT_TIME_PERIODS: Array<{
|
|
600
|
+
period: ConditionalFormatTimePeriod;
|
|
601
|
+
label: string;
|
|
602
|
+
}>;
|
|
603
|
+
interface ConditionalFormatPresetInput {
|
|
604
|
+
kind: ConditionalFormatPresetKind;
|
|
605
|
+
ranges: CellRange[];
|
|
606
|
+
value?: string;
|
|
607
|
+
value2?: string;
|
|
608
|
+
text?: string;
|
|
609
|
+
formula?: string;
|
|
610
|
+
rank?: number;
|
|
611
|
+
period?: ConditionalFormatTimePeriod;
|
|
612
|
+
iconSet?: ConditionalFormatIconSet;
|
|
613
|
+
/** Data bar colour. */
|
|
614
|
+
color?: string;
|
|
615
|
+
/** Highlight style (default light red fill, dark red text). */
|
|
616
|
+
style?: ConditionalFormatStyle;
|
|
617
|
+
stopIfTrue?: boolean;
|
|
618
|
+
}
|
|
619
|
+
/** Builds a rule from a preset and its inputs. */
|
|
620
|
+
declare function createConditionalFormatRule(input: ConditionalFormatPresetInput): NewConditionalFormatRule;
|
|
621
|
+
declare const DATA_VALIDATION_TYPE_OPTIONS: Array<{
|
|
622
|
+
type: DataValidationType;
|
|
623
|
+
label: string;
|
|
624
|
+
}>;
|
|
625
|
+
declare const DATA_VALIDATION_OPERATOR_OPTIONS: Array<{
|
|
626
|
+
operator: DataValidationOperator;
|
|
627
|
+
label: string;
|
|
628
|
+
}>;
|
|
629
|
+
declare const DATA_VALIDATION_ERROR_STYLE_OPTIONS: Array<{
|
|
630
|
+
style: DataValidationErrorStyle;
|
|
631
|
+
label: string;
|
|
632
|
+
}>;
|
|
633
|
+
|
|
634
|
+
/**
|
|
635
|
+
* CSS for the conditional look of a cell, shared by the React and Svelte
|
|
636
|
+
* grids (React uses the objects, Svelte the `style` strings).
|
|
637
|
+
*/
|
|
638
|
+
|
|
639
|
+
interface ConditionalFormatCss {
|
|
640
|
+
background?: string;
|
|
641
|
+
color?: string;
|
|
642
|
+
fontWeight?: string;
|
|
643
|
+
fontStyle?: string;
|
|
644
|
+
textDecoration?: string;
|
|
645
|
+
}
|
|
646
|
+
/**
|
|
647
|
+
* Black or white, whichever reads better on `fill` (`#rgb` / `#rrggbb`), or
|
|
648
|
+
* undefined for other colour syntaxes.
|
|
649
|
+
*/
|
|
650
|
+
declare function conditionalFormatContrastColor(fill: string): string | undefined;
|
|
651
|
+
/**
|
|
652
|
+
* Fill, font colour and emphasis of a cell (no data bar or icon). A fill
|
|
653
|
+
* without a font colour of its own gets black or white text, so the value
|
|
654
|
+
* stays readable whatever the theme's text colour (Excel's fills assume
|
|
655
|
+
* dark text).
|
|
656
|
+
*/
|
|
657
|
+
declare function getConditionalFormatCss(format: ConditionalCellFormat | undefined): ConditionalFormatCss;
|
|
658
|
+
/** The bar element of a data bar: absolutely placed from the cell's left edge. */
|
|
659
|
+
declare function getDataBarCss(bar: NonNullable<ConditionalCellFormat['dataBar']>): Record<string, string>;
|
|
660
|
+
/** `{ fontWeight: '700' }` → `font-weight: 700;` for `style` attributes. */
|
|
661
|
+
declare function conditionalFormatStyleString(css: Record<string, string | undefined> | ConditionalFormatCss): string;
|
|
662
|
+
|
|
663
|
+
/** Excel's message when a rule has no error message of its own. */
|
|
664
|
+
declare const DEFAULT_DATA_VALIDATION_MESSAGE = "This value doesn't match the data validation restrictions defined for this cell.";
|
|
665
|
+
declare const DEFAULT_DATA_VALIDATION_TITLE = "Invalid value";
|
|
666
|
+
/** The rule that applies to (row, col): the first one containing it. */
|
|
667
|
+
declare function findDataValidation(rules: DataValidationRule[] | undefined, row: number, col: number): DataValidationRule | undefined;
|
|
668
|
+
/**
|
|
669
|
+
* The items of a list rule: literal (`Low, Medium, High`, optionally in
|
|
670
|
+
* quotes) or read from a range or formula (`=$H$1:$H$5`), blanks skipped.
|
|
671
|
+
* Formulas are evaluated at the range's top-left cell.
|
|
672
|
+
*/
|
|
673
|
+
declare function getValidationListValues(sheet: DataValidationSheet, rule: DataValidationRule): string[];
|
|
674
|
+
/**
|
|
675
|
+
* Checks `input` typed into (row, col) against the cell's rule. Typed input
|
|
676
|
+
* is parsed like a cell commit (`10%` is 0.1, `3/4/2026` a date); a formula
|
|
677
|
+
* is checked through its result. Custom and bound formulas are relative to
|
|
678
|
+
* the range's top-left cell and see the value being entered. Blank input is
|
|
679
|
+
* valid unless `ignoreBlank` is false; rules with `showErrorAlert: false`
|
|
680
|
+
* accept anything.
|
|
681
|
+
*/
|
|
682
|
+
declare function validateCellInput(sheet: DataValidationSheet, rules: DataValidationRule[] | undefined, row: number, col: number, input: string): DataValidationResult;
|
|
683
|
+
/**
|
|
684
|
+
* Cells whose current value breaks their rule ("circle invalid data").
|
|
685
|
+
* Blank cells are skipped, as are `any` rules. Alerts being off does not
|
|
686
|
+
* matter here. Each cell is listed once, rule by rule, in row-major order.
|
|
687
|
+
*/
|
|
688
|
+
declare function findInvalidCells(sheet: DataValidationSheet, rules: DataValidationRule[] | undefined): CellPosition[];
|
|
689
|
+
|
|
405
690
|
/**
|
|
406
691
|
* Common number formats offered by the "Format cells" menu, and the mapping
|
|
407
692
|
* between format codes and the coarser `CellFormat` kinds.
|
|
@@ -566,14 +851,24 @@ interface SpreadsheetMenuItem {
|
|
|
566
851
|
label: string;
|
|
567
852
|
defaultValue?: string;
|
|
568
853
|
};
|
|
854
|
+
/** Ask the user to confirm before running (e.g. deleting a sheet); the message to show. */
|
|
855
|
+
confirm?: string;
|
|
856
|
+
/**
|
|
857
|
+
* Opens one of the editor's panels instead of running an action: the
|
|
858
|
+
* editors open it (`run` does nothing).
|
|
859
|
+
*/
|
|
860
|
+
panel?: SpreadsheetPanelId;
|
|
569
861
|
run: (input?: string) => void;
|
|
570
862
|
}
|
|
863
|
+
/** Panels the spreadsheet editors can open from the context menu. */
|
|
864
|
+
type SpreadsheetPanelId = 'conditionalFormatting' | 'dataValidation';
|
|
571
865
|
/**
|
|
572
|
-
* Runs a menu item the way the editors do: an item with `
|
|
573
|
-
* for
|
|
574
|
-
*
|
|
866
|
+
* Runs a menu item the way the editors do: an item with `confirm` first asks
|
|
867
|
+
* for confirmation with `confirm` (default `window.confirm`), an item with
|
|
868
|
+
* `input` asks for text with `ask` (default `window.prompt`); either is
|
|
869
|
+
* skipped when cancelled. Returns whether `run` was called.
|
|
575
870
|
*/
|
|
576
|
-
declare function runSpreadsheetMenuItem(item: SpreadsheetMenuItem, ask?: (label: string, defaultValue: string) => string | null | undefined): boolean;
|
|
871
|
+
declare function runSpreadsheetMenuItem(item: SpreadsheetMenuItem, ask?: (label: string, defaultValue: string) => string | null | undefined, confirm?: (message: string) => boolean): boolean;
|
|
577
872
|
/**
|
|
578
873
|
* Where to place a `position: fixed` menu opened at `point` so it stays inside
|
|
579
874
|
* the viewport: it flips to the left of / above the pointer when it would
|
|
@@ -608,7 +903,7 @@ declare function getSpreadsheetMenuItems(controller: SpreadsheetController, cell
|
|
|
608
903
|
* state syncing: the controller reports changes through `onDocumentChange`
|
|
609
904
|
* and `onSelectionChange`.
|
|
610
905
|
*/
|
|
611
|
-
declare const SPREADSHEET_TABLE_ACTIONS: readonly ["sortRows", "getFilterState", "setFilterRules", "addFilterRule", "updateFilterRule", "removeFilterRule", "clearFilters", "setFiltersEnabled", "toggleFilters", "setHeaderRowCount", "setFooterRowCount", "setHeaderColumnCount", "setFrozenRowCount", "setFrozenColumnCount", "hideRows", "unhideRows", "hideColumns", "unhideColumns", "unhideAll", "getMerges", "getMergeAt", "mergeCells", "unmergeCells", "autofill", "groupRowsBy", "ungroupRows", "setGroupSummary", "setGroupCollapsed", "toggleGroupCollapsed", "getGroups", "transposeRange", "setCellNumberFormat", "setColumnNumberFormat", "exportToCsv", "importFromCsv", "copyToClipboardData", "pasteClipboardData"];
|
|
906
|
+
declare const SPREADSHEET_TABLE_ACTIONS: readonly ["sortRows", "getFilterState", "setFilterRules", "addFilterRule", "updateFilterRule", "removeFilterRule", "clearFilters", "setFiltersEnabled", "toggleFilters", "setHeaderRowCount", "setFooterRowCount", "setHeaderColumnCount", "setFrozenRowCount", "setFrozenColumnCount", "hideRows", "unhideRows", "hideColumns", "unhideColumns", "unhideAll", "getMerges", "getMergeAt", "mergeCells", "unmergeCells", "autofill", "groupRowsBy", "ungroupRows", "setGroupSummary", "setGroupCollapsed", "toggleGroupCollapsed", "getGroups", "transposeRange", "setCellNumberFormat", "setColumnNumberFormat", "exportToCsv", "importFromCsv", "copyToClipboardData", "pasteClipboardData", "getConditionalFormats", "addConditionalFormat", "updateConditionalFormat", "deleteConditionalFormat", "moveConditionalFormat", "clearConditionalFormats", "getConditionalFormatOverlay", "getConditionalFormat", "getDataValidations", "getDataValidationAt", "addDataValidation", "updateDataValidation", "deleteDataValidation", "clearDataValidation", "validateCellInput", "getValidationListValues", "findInvalidCells", "setInvalidDataCircles", "getInvalidDataCircles", "isInvalidDataCircled"];
|
|
612
907
|
type SpreadsheetTableActionName = (typeof SPREADSHEET_TABLE_ACTIONS)[number];
|
|
613
908
|
type SpreadsheetTableActions = Pick<SpreadsheetController, SpreadsheetTableActionName>;
|
|
614
909
|
/** The table operations of `controller`, bound so they can be passed around. */
|
|
@@ -649,6 +944,8 @@ interface ImportFileIntoSpreadsheetOptions {
|
|
|
649
944
|
/** Top-left cell to write to (0-based). Default A1. */
|
|
650
945
|
startRow?: number;
|
|
651
946
|
startCol?: number;
|
|
947
|
+
/** Sheet (id or name) to import into; default the active sheet. */
|
|
948
|
+
sheet?: string;
|
|
652
949
|
}
|
|
653
950
|
/**
|
|
654
951
|
* Imports a CSV/TSV file (or any registered `spreadsheet` adapter that
|
|
@@ -656,4 +953,230 @@ interface ImportFileIntoSpreadsheetOptions {
|
|
|
656
953
|
*/
|
|
657
954
|
declare function importFileIntoSpreadsheet(controller: SpreadsheetController, input: ImportInput, options: ImportFileIntoSpreadsheetOptions): Promise<ImportOutcome<SpreadsheetImport>>;
|
|
658
955
|
|
|
659
|
-
|
|
956
|
+
/**
|
|
957
|
+
* Workbook rules shared by the controller and the framework bindings: sheet
|
|
958
|
+
* and defined-name validation, and default sheet names.
|
|
959
|
+
*/
|
|
960
|
+
|
|
961
|
+
/** Longest sheet name Excel accepts. */
|
|
962
|
+
declare const MAX_SHEET_NAME_LENGTH = 31;
|
|
963
|
+
/** Longest defined name Excel accepts. */
|
|
964
|
+
declare const MAX_DEFINED_NAME_LENGTH = 255;
|
|
965
|
+
/**
|
|
966
|
+
* Checks a sheet name like Excel: 1–31 characters, none of `: \ / ? * [ ]`,
|
|
967
|
+
* not starting or ending with `'`, not the reserved `History`, and not used
|
|
968
|
+
* by another sheet (case-insensitively). Returns why it is invalid, or null.
|
|
969
|
+
*/
|
|
970
|
+
declare function validateSheetName(name: string, existingNames?: readonly string[]): string | null;
|
|
971
|
+
/** The first `Sheet N` not used by `existingNames`. */
|
|
972
|
+
declare function nextSheetName(existingNames: readonly string[], base?: string): string;
|
|
973
|
+
/**
|
|
974
|
+
* A name for a copy of the sheet `name`: `Name (2)`, `Name (3)`, …, shortened
|
|
975
|
+
* so the suffix fits in 31 characters.
|
|
976
|
+
*/
|
|
977
|
+
declare function copySheetName(name: string, existingNames: readonly string[]): string;
|
|
978
|
+
/**
|
|
979
|
+
* Checks a defined name like Excel: starts with a letter, `_` or `\`;
|
|
980
|
+
* continues with letters, digits, `_`, `.`, `\` or `?`; at most 255
|
|
981
|
+
* characters; and must not look like a cell reference (`A1`, `TAX2024`), an
|
|
982
|
+
* R1C1 reference (`R1C1`, `R`, `C3`) or a boolean. Returns why it is invalid,
|
|
983
|
+
* or null.
|
|
984
|
+
*/
|
|
985
|
+
declare function validateDefinedName(name: string): string | null;
|
|
986
|
+
/** Whether a defined name holds a LAMBDA (and so is called like a function). */
|
|
987
|
+
declare function isLambdaDefinition(definition: Pick<SpreadsheetDefinedName, 'refersTo'>): boolean;
|
|
988
|
+
|
|
989
|
+
/**
|
|
990
|
+
* Sheet-tab and Name Manager behaviour shared by the React and Svelte
|
|
991
|
+
* bindings: the tab context menu, drag-to-reorder targets and the rows a
|
|
992
|
+
* Name Manager panel lists.
|
|
993
|
+
*/
|
|
994
|
+
|
|
995
|
+
/**
|
|
996
|
+
* Context-menu items for a sheet tab: insert, rename (asks for the name),
|
|
997
|
+
* duplicate, move left/right and delete (asks to confirm; disabled for the
|
|
998
|
+
* last sheet). Run them with `runSpreadsheetMenuItem`. A rename to an
|
|
999
|
+
* invalid name throws; pass `onError` to report it instead.
|
|
1000
|
+
*/
|
|
1001
|
+
declare function getSheetTabMenuItems(controller: SpreadsheetController, sheetId: string, options?: {
|
|
1002
|
+
onError?: (message: string) => void;
|
|
1003
|
+
}): SpreadsheetMenuItem[];
|
|
1004
|
+
/**
|
|
1005
|
+
* The tab index a dragged tab should move to when dropped on the tab at
|
|
1006
|
+
* `targetIndex`: dropping on the left half of a tab places it before that
|
|
1007
|
+
* tab, on the right half after it.
|
|
1008
|
+
*/
|
|
1009
|
+
declare function sheetDropIndex(fromIndex: number, targetIndex: number, dropAfter: boolean): number;
|
|
1010
|
+
/** A row of a Name Manager panel. */
|
|
1011
|
+
interface SpreadsheetNameRow {
|
|
1012
|
+
name: string;
|
|
1013
|
+
refersTo: string;
|
|
1014
|
+
/** `Workbook` or the sheet's name. */
|
|
1015
|
+
scopeLabel: string;
|
|
1016
|
+
/** Sheet id for a sheet-scoped name. */
|
|
1017
|
+
sheetId?: string;
|
|
1018
|
+
/** The name's current value, as displayed (`#REF!`, `[LAMBDA]`, `{3×1 array}`). */
|
|
1019
|
+
value: string;
|
|
1020
|
+
comment?: string;
|
|
1021
|
+
isLambda: boolean;
|
|
1022
|
+
}
|
|
1023
|
+
/** Every defined name with its scope and current value, sorted by name then scope. */
|
|
1024
|
+
declare function getNameManagerRows(controller: SpreadsheetController): SpreadsheetNameRow[];
|
|
1025
|
+
|
|
1026
|
+
/**
|
|
1027
|
+
* Range helpers shared by conditional formatting and data validation: rules
|
|
1028
|
+
* apply to a list of rectangular ranges ("applies to") that follow row and
|
|
1029
|
+
* column insertions/deletions, and can be cut out of a selection.
|
|
1030
|
+
*
|
|
1031
|
+
* Portions ported from gridcraft/crates/engine/src/cmd/sheet.rs and
|
|
1032
|
+
* gridcraft/crates/engine/src/cmd/data.rs (MIT OR Apache-2.0, © ArtCraft Team
|
|
1033
|
+
* and contributors). See THIRD_PARTY_NOTICES.md.
|
|
1034
|
+
*/
|
|
1035
|
+
|
|
1036
|
+
/**
|
|
1037
|
+
* Adjusts one range for an inserted or deleted row/column, the way merges
|
|
1038
|
+
* and formula ranges move: ranges after the change shift, ranges across it
|
|
1039
|
+
* grow or shrink, and a range whose rows (or columns) are all deleted is
|
|
1040
|
+
* gone (null).
|
|
1041
|
+
*/
|
|
1042
|
+
declare function adjustRangeForStructuralChange(range: CellRange, change: StructuralChange): CellRange | null;
|
|
1043
|
+
/** `adjustRangeForStructuralChange` over a list, dropping ranges that are gone. */
|
|
1044
|
+
declare function adjustRangesForStructuralChange(ranges: CellRange[], change: StructuralChange): CellRange[];
|
|
1045
|
+
/** The parts of `range` outside `cut` (up to four rectangles). */
|
|
1046
|
+
declare function subtractRange(range: CellRange, cut: CellRange): CellRange[];
|
|
1047
|
+
/** Removes the cells of `cut` from every range of the list. */
|
|
1048
|
+
declare function subtractRangeFromRanges(ranges: CellRange[], cut: CellRange): CellRange[];
|
|
1049
|
+
/** Whether any range of the list contains (row, col). */
|
|
1050
|
+
declare function rangesContain(ranges: CellRange[], row: number, col: number): boolean;
|
|
1051
|
+
/** The top-left cell of the first range: rule formulas are written for it. */
|
|
1052
|
+
declare function ruleAnchor(ranges: CellRange[]): {
|
|
1053
|
+
row: number;
|
|
1054
|
+
col: number;
|
|
1055
|
+
};
|
|
1056
|
+
/**
|
|
1057
|
+
* A rule formula written for `anchor`, as seen from (row, col): relative
|
|
1058
|
+
* references shift by the distance, `$` parts stay (Excel's conditional
|
|
1059
|
+
* formatting and validation formulas work this way). Returned with a
|
|
1060
|
+
* leading `=`.
|
|
1061
|
+
*/
|
|
1062
|
+
declare function ruleFormulaAt(formula: string, anchor: {
|
|
1063
|
+
row: number;
|
|
1064
|
+
col: number;
|
|
1065
|
+
}, row: number, col: number): string;
|
|
1066
|
+
/**
|
|
1067
|
+
* Rewrites a rule formula after a row/column insertion or deletion so it
|
|
1068
|
+
* keeps pointing at the same cells. Keeps the caller's leading `=` (or its
|
|
1069
|
+
* absence).
|
|
1070
|
+
*/
|
|
1071
|
+
declare function shiftRuleFormula(formula: string, change: StructuralChange): string;
|
|
1072
|
+
/** Every cell of a list of ranges, clamped to the sheet, each once, in row-major order per range. */
|
|
1073
|
+
declare function forEachRangeCell(ranges: CellRange[], rowCount: number, colCount: number, fn: (row: number, col: number) => void): void;
|
|
1074
|
+
/** A1 text of a list of ranges: `A1:B5, D2`. */
|
|
1075
|
+
declare function formatRuleRanges(ranges: CellRange[]): string;
|
|
1076
|
+
/** Parses `A1:B5, D2` (commas, semicolons or spaces between ranges; `$` ignored). Null when any part is not a cell or range. */
|
|
1077
|
+
declare function parseRuleRanges(text: string): CellRange[] | null;
|
|
1078
|
+
|
|
1079
|
+
/**
|
|
1080
|
+
* Virtualised rendering of large sheets: which displayed rows and columns
|
|
1081
|
+
* are inside (or near) the scrolled viewport, the space taken by the ones
|
|
1082
|
+
* left out, and how far to scroll to bring a cell into view. Framework
|
|
1083
|
+
* bindings render the frozen rows/columns, a spacer, the window and another
|
|
1084
|
+
* spacer; small sheets render everything (`shouldVirtualizeSpreadsheet`).
|
|
1085
|
+
*/
|
|
1086
|
+
|
|
1087
|
+
/** Height of the sticky column-header row, in pixels. */
|
|
1088
|
+
declare const SPREADSHEET_COLUMN_HEADER_HEIGHT = 28;
|
|
1089
|
+
/** Width of the sticky row-number column, in pixels. */
|
|
1090
|
+
declare const SPREADSHEET_ROW_HEADER_WIDTH = 48;
|
|
1091
|
+
/** Height of a category (group) header row, in pixels. */
|
|
1092
|
+
declare const SPREADSHEET_GROUP_ROW_HEIGHT = 28;
|
|
1093
|
+
/** Displayed rows above which `shouldVirtualizeSpreadsheet` turns virtualisation on. */
|
|
1094
|
+
declare const SPREADSHEET_VIRTUAL_ROW_THRESHOLD = 200;
|
|
1095
|
+
/** Displayed columns above which `shouldVirtualizeSpreadsheet` turns virtualisation on. */
|
|
1096
|
+
declare const SPREADSHEET_VIRTUAL_COLUMN_THRESHOLD = 60;
|
|
1097
|
+
/** Viewport assumed before the grid has been measured (server rendering, jsdom). */
|
|
1098
|
+
declare const SPREADSHEET_DEFAULT_VIEWPORT: {
|
|
1099
|
+
width: number;
|
|
1100
|
+
height: number;
|
|
1101
|
+
};
|
|
1102
|
+
/** Pixel positions of a view model's rows and columns (see `measureSpreadsheetView`). */
|
|
1103
|
+
interface SpreadsheetViewMetrics {
|
|
1104
|
+
/** Top of each entry of `view.rows`, below the column header; the last entry is the total height. */
|
|
1105
|
+
rowTops: Float64Array;
|
|
1106
|
+
/** Left of each entry of `view.columns`, after the row header; the last entry is the total width. */
|
|
1107
|
+
columnLefts: Float64Array;
|
|
1108
|
+
/** Leading frozen entries of `view.rows` (always rendered, sticky). */
|
|
1109
|
+
frozenRows: number;
|
|
1110
|
+
/** Leading frozen entries of `view.columns`. */
|
|
1111
|
+
frozenColumns: number;
|
|
1112
|
+
/** Position in `view.rows` of each displayed document row. */
|
|
1113
|
+
rowPosition: Map<number, number>;
|
|
1114
|
+
/** Position in `view.columns` of each displayed document column. */
|
|
1115
|
+
columnPosition: Map<number, number>;
|
|
1116
|
+
}
|
|
1117
|
+
/** The scroll container: its scroll offsets and client size, in pixels. */
|
|
1118
|
+
interface SpreadsheetViewport {
|
|
1119
|
+
scrollTop: number;
|
|
1120
|
+
scrollLeft: number;
|
|
1121
|
+
width: number;
|
|
1122
|
+
height: number;
|
|
1123
|
+
}
|
|
1124
|
+
/**
|
|
1125
|
+
* The part of a view model to render: frozen rows `[0, frozenRows)`, then
|
|
1126
|
+
* `topSpace` pixels of rows left out, then rows `[rowStart, rowEnd)`, then
|
|
1127
|
+
* `bottomSpace`; columns likewise (indices into `view.rows` / `view.columns`).
|
|
1128
|
+
*/
|
|
1129
|
+
interface SpreadsheetViewWindow {
|
|
1130
|
+
virtual: boolean;
|
|
1131
|
+
frozenRows: number;
|
|
1132
|
+
rowStart: number;
|
|
1133
|
+
rowEnd: number;
|
|
1134
|
+
topSpace: number;
|
|
1135
|
+
bottomSpace: number;
|
|
1136
|
+
frozenColumns: number;
|
|
1137
|
+
colStart: number;
|
|
1138
|
+
colEnd: number;
|
|
1139
|
+
leftSpace: number;
|
|
1140
|
+
rightSpace: number;
|
|
1141
|
+
}
|
|
1142
|
+
interface SpreadsheetViewWindowOptions {
|
|
1143
|
+
/** Extra rows rendered above and below the viewport. Default 8. */
|
|
1144
|
+
overscanRows?: number;
|
|
1145
|
+
/** Extra columns rendered left and right of the viewport. Default 2. */
|
|
1146
|
+
overscanColumns?: number;
|
|
1147
|
+
/** Merged ranges (document indices): a merge crossing the window's edge is rendered whole. */
|
|
1148
|
+
merges?: readonly CellRange[];
|
|
1149
|
+
}
|
|
1150
|
+
/** Measures the rows (row height, or the group row height) and columns (width) of a view model. */
|
|
1151
|
+
declare function measureSpreadsheetView(view: SpreadsheetViewModel): SpreadsheetViewMetrics;
|
|
1152
|
+
/**
|
|
1153
|
+
* Whether to virtualise: `true` / `false` force it; `'auto'` (the default)
|
|
1154
|
+
* virtualises views with more than `SPREADSHEET_VIRTUAL_ROW_THRESHOLD` rows
|
|
1155
|
+
* or `SPREADSHEET_VIRTUAL_COLUMN_THRESHOLD` columns, so small sheets render
|
|
1156
|
+
* every cell exactly as before.
|
|
1157
|
+
*/
|
|
1158
|
+
declare function shouldVirtualizeSpreadsheet(view: SpreadsheetViewModel, mode?: boolean | 'auto'): boolean;
|
|
1159
|
+
/** A window holding every row and column (no spacers). */
|
|
1160
|
+
declare function fullSpreadsheetViewWindow(metrics: SpreadsheetViewMetrics): SpreadsheetViewWindow;
|
|
1161
|
+
/**
|
|
1162
|
+
* The rows and columns to render for a viewport. Frozen rows and columns are
|
|
1163
|
+
* always rendered; the rest are limited to the viewport plus overscan, and
|
|
1164
|
+
* widened so no merge is cut by the window's edge.
|
|
1165
|
+
*/
|
|
1166
|
+
declare function getSpreadsheetViewWindow(metrics: SpreadsheetViewMetrics, viewport: SpreadsheetViewport, options?: SpreadsheetViewWindowOptions): SpreadsheetViewWindow;
|
|
1167
|
+
/**
|
|
1168
|
+
* Scroll offsets that bring the cell at document (row, col) fully into view
|
|
1169
|
+
* (below the frozen rows, right of the frozen columns), or null when it
|
|
1170
|
+
* already is (or isn't displayed). Only the axes that must move are set.
|
|
1171
|
+
*/
|
|
1172
|
+
declare function getSpreadsheetScrollToCell(metrics: SpreadsheetViewMetrics, viewport: SpreadsheetViewport, cell: {
|
|
1173
|
+
row: number;
|
|
1174
|
+
col: number;
|
|
1175
|
+
}): {
|
|
1176
|
+
scrollTop?: number;
|
|
1177
|
+
scrollLeft?: number;
|
|
1178
|
+
} | null;
|
|
1179
|
+
/** Whether two windows render the same rows and columns. */
|
|
1180
|
+
declare function sameSpreadsheetViewWindow(a: SpreadsheetViewWindow, b: SpreadsheetViewWindow): boolean;
|
|
1181
|
+
|
|
1182
|
+
export { ASTNode, CONDITIONAL_FORMAT_ICON_SETS, CONDITIONAL_FORMAT_PRESETS, CONDITIONAL_FORMAT_STYLE_PRESETS, CONDITIONAL_FORMAT_TIME_PERIODS, CellData, CellFormat, type CellInputFormatKind, CellPosition, CellRange, ConditionalCellFormat, type ConditionalFormatCss, ConditionalFormatEngine, type ConditionalFormatIconGlyph, ConditionalFormatIconSet, ConditionalFormatOverlay, type ConditionalFormatPresetField, type ConditionalFormatPresetInfo, type ConditionalFormatPresetInput, type ConditionalFormatPresetKind, ConditionalFormatRule, ConditionalFormatSheet, ConditionalFormatStyle, ConditionalFormatTimePeriod, ConditionalFormatValue, type CsvParseOptions, type CsvSerializeOptions, DATA_VALIDATION_ERROR_STYLE_OPTIONS, DATA_VALIDATION_OPERATOR_OPTIONS, DATA_VALIDATION_TYPE_OPTIONS, DEFAULT_CONDITIONAL_FORMAT_STYLE, DEFAULT_DATA_VALIDATION_MESSAGE, DEFAULT_DATA_VALIDATION_TITLE, DataValidationErrorStyle, DataValidationOperator, DataValidationResult, DataValidationRule, DataValidationSheet, DataValidationType, EMPTY_CONDITIONAL_FORMAT_OVERLAY, type FillDirection, FilterRule, type FormattedNumberValue, type FormulaActiveCall, type FormulaArgument, type FormulaArgumentSpec, type FormulaArgumentType, type FormulaCaretContext, type FormulaCriteriaPredicate, type FormulaEnvironment, FormulaErrorCode, type FormulaFunctionCategory, type FormulaFunctionContext, type FormulaFunctionDefinition, type FormulaFunctionSuggestion, type FormulaHints, FormulaLambda, type FormulaNameSuggestionSource, FormulaRange, type FormulaSignaturePart, GroupAggregate, type ImportFileIntoSpreadsheetOptions, MAX_DEFINED_NAME_LENGTH, MAX_LAMBDA_DEPTH, MAX_NUMBER_FORMAT_CODE_CHARS, MAX_SHEET_NAME_LENGTH, NUMBER_FORMAT_PRESETS, NewConditionalFormatRule, NumberFormat, type NumberFormatColor, type NumberFormatKind, type NumberFormatPreset, type ParsedCellInput, SPREADSHEET_COLUMN_HEADER_HEIGHT, SPREADSHEET_DEFAULT_VIEWPORT, SPREADSHEET_GROUP_ROW_HEIGHT, SPREADSHEET_IMPORT_ADAPTERS, SPREADSHEET_ROW_HEADER_WIDTH, SPREADSHEET_TABLE_ACTIONS, SPREADSHEET_VIRTUAL_COLUMN_THRESHOLD, SPREADSHEET_VIRTUAL_ROW_THRESHOLD, SortDirection, SpreadsheetController, SpreadsheetDefinedName, type SpreadsheetImport, type SpreadsheetImportAdapter, type SpreadsheetMenuItem, type SpreadsheetNameRow, type SpreadsheetPanelId, type SpreadsheetTableActionName, type SpreadsheetTableActions, type SpreadsheetViewMetrics, SpreadsheetViewModel, type SpreadsheetViewWindow, type SpreadsheetViewWindowOptions, type SpreadsheetViewport, StructuralChange, adjustRangeForStructuralChange, adjustRangesForStructuralChange, aggregateValues, applyFormulaSuggestion, bindSpreadsheetTableActions, blendConditionalFormatColors, builtinNumberFormat, builtinNumberFormatId, cellFormatForNumberFormat, checkFormulaArgumentCount, clampMenuPosition, clearNumberFormatCache, compareCellValues, computeFillTarget, conditionalFormatContrastColor, conditionalFormatIconCount, conditionalFormatNumber, conditionalFormatStyleString, copySheetName, createConditionalFormatRule, csvImportAdapter, dateValueToSerial, defaultIconThresholds, describeConditionalFormat, describeDataValidation, escapeCsvField, evaluateConditionalFormats, fillSeries, findDataValidation, findInvalidCells, forEachRangeCell, formatCellDisplay, formatCellForDisplay, formatGeneralFit, formatNumberFormatValue, formatRuleRanges, formatTextFunction, formatValueWithCode, fullSpreadsheetViewWindow, getConditionalFormatCss, getConditionalFormatIcon, getDataBarCss, getFillDirection, getFormulaArgumentSpecIndex, getFormulaCaretContext, getFormulaFunction, getFormulaHints, getFormulaSignature, getFormulaSignatureParts, getNameManagerRows, getSheetTabMenuItems, getSpreadsheetMenuItems, getSpreadsheetScrollToCell, getSpreadsheetViewWindow, getValidationListValues, importFileIntoSpreadsheet, isBlankValue, isFormulaLambda, isGeneralNumberFormat, isLambdaDefinition, isSingleCellRange, listFormulaFunctions, matchesFilterRule, matchesTimePeriod, measureSpreadsheetView, nextSheetName, normalizeRange, numberFormatColorToCss, numberFormatForCellFormat, parseCellInput, parseCriteria, parseCsv, parseNumberText, parseRuleRanges, parseTsv, rangeContains, rangeContainsRange, rangesContain, rangesIntersect, registerFormulaFunction, registerSpreadsheetImportAdapters, roundFloat, ruleAnchor, ruleFormulaAt, runSpreadsheetMenuItem, sameSpreadsheetViewWindow, searchFormulaFunctions, serialFromYmd, serializeCsv, serializeTsv, sheetDropIndex, shiftRuleFormula, shouldVirtualizeSpreadsheet, subtractRange, subtractRangeFromRanges, toNumber, tsvImportAdapter, unregisterFormulaFunction, validateCellInput, validateDefinedName, validateSheetName, wildcardToRegExp };
|