@sheetxl/query 0.8.0-beta.2 → 0.8.0-beta.20
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/LICENSE.md +8 -7
- package/browser/esm/index.mjs +2659 -1433
- package/node/esm/index.mjs +2893 -1641
- package/package.json +7 -8
- package/types/src/api/_aliases.d.ts +16 -0
- package/types/src/api/_offered.d.ts +13 -0
- package/types/src/api/lookupApi.d.ts +45 -1
- package/types/src/delta/describeDelta.d.ts +148 -0
- package/types/src/delta/index.d.ts +4 -0
- package/types/src/delta/readRunDelta.d.ts +21 -0
- package/types/src/delta/renderDelta.d.ts +20 -0
- package/types/src/encode/encodeCell.d.ts +19 -7
- package/types/src/grep/GrepTypes.d.ts +30 -36
- package/types/src/grep/grep.d.ts +3 -2
- package/types/src/index.d.ts +1 -0
- package/types/src/markdown/appendDataTables.d.ts +39 -0
- package/types/src/markdown/appendDependencies.d.ts +2 -2
- package/types/src/markdown/appendPivotTables.d.ts +10 -9
- package/types/src/markdown/appendSections.d.ts +50 -5
- package/types/src/markdown/caps.d.ts +4 -0
- package/types/src/markdown/describeAnomaly.d.ts +31 -0
- package/types/src/markdown/describeChart.d.ts +2 -2
- package/types/src/markdown/describeExternalCitation.d.ts +27 -0
- package/types/src/markdown/describeHistogram.d.ts +3 -3
- package/types/src/markdown/describeRegionPayload.d.ts +3 -3
- package/types/src/markdown/describeRule.d.ts +5 -5
- package/types/src/markdown/describeShape.d.ts +41 -0
- package/types/src/markdown/describeSparkline.d.ts +15 -0
- package/types/src/markdown/describeStyle.d.ts +7 -7
- package/types/src/markdown/findLabels.d.ts +5 -12
- package/types/src/markdown/index.d.ts +3 -1
- package/types/src/markdown/registry.d.ts +8 -3
- package/types/src/markdown/renderCell.d.ts +2 -1
- package/types/src/markdown/renderFormula.d.ts +2 -2
- package/types/src/markdown/renderMovable.d.ts +14 -1
- package/types/src/markdown/renderPageLayout.d.ts +22 -0
- package/types/src/markdown/renderProtection.d.ts +4 -4
- package/types/src/markdown/renderRecords.d.ts +8 -0
- package/types/src/markdown/renderRegions.d.ts +8 -0
- package/types/src/markdown/renderStyle.d.ts +2 -2
- package/types/src/markdown/renderTable.d.ts +3 -1
- package/types/src/markdown/renderWorkbook.d.ts +1 -1
- package/types/src/markdown/{renderSheet.d.ts → renderWorksheet.d.ts} +5 -5
- package/browser/cjs/index.cjs +0 -45
package/package.json
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sheetxl/query",
|
|
3
3
|
"description": "SheetXL - Workbook read surface and renderers (grep, reports) — capabilities declared once, adapted by any host surface",
|
|
4
|
-
"version": "0.8.0-beta.
|
|
5
|
-
"license": "SEE LICENSE IN
|
|
4
|
+
"version": "0.8.0-beta.20",
|
|
5
|
+
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
9
|
"types": "./types/index.d.ts",
|
|
10
10
|
"browser": "./browser/esm/index.mjs",
|
|
11
11
|
"node": "./node/esm/index.mjs",
|
|
12
|
-
"
|
|
13
|
-
"require": "./browser/cjs/index.cjs"
|
|
12
|
+
"default": "./browser/esm/index.mjs"
|
|
14
13
|
}
|
|
15
14
|
},
|
|
16
15
|
"types": "./types/index.d.ts",
|
|
17
16
|
"module": "./browser/esm/index.mjs",
|
|
18
|
-
"main": "./browser/
|
|
17
|
+
"main": "./browser/esm/index.mjs",
|
|
19
18
|
"sideEffects": false,
|
|
20
19
|
"engines": {
|
|
21
20
|
"node": ">=20 <21 || >=22"
|
|
@@ -43,10 +42,10 @@
|
|
|
43
42
|
"query"
|
|
44
43
|
],
|
|
45
44
|
"dependencies": {
|
|
46
|
-
"@sheetxl/primitives": "^0.8.0-beta.
|
|
47
|
-
"@sheetxl/sdk": "^0.8.0-beta.
|
|
45
|
+
"@sheetxl/primitives": "^0.8.0-beta.20",
|
|
46
|
+
"@sheetxl/sdk": "^0.8.0-beta.20"
|
|
48
47
|
},
|
|
49
48
|
"devDependencies": {
|
|
50
|
-
"@types/node": "^26.
|
|
49
|
+
"@types/node": "^26.6.4"
|
|
51
50
|
}
|
|
52
51
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Names a script reaches for from another spreadsheet API — Excel's, Office Scripts', openpyxl's —
|
|
3
|
+
* and where SheetXL keeps that concept. Each answer names the member it relies on, and is offered
|
|
4
|
+
* only while the index still has it.
|
|
5
|
+
*/
|
|
6
|
+
export declare const API_ALIASES: readonly {
|
|
7
|
+
readonly match: RegExp;
|
|
8
|
+
readonly relies: [string, string];
|
|
9
|
+
readonly hint: string;
|
|
10
|
+
}[];
|
|
11
|
+
/**
|
|
12
|
+
* The answer to a member called on a plain array (`wb.getSheets().getAt(0)`): `getAt`/`getItems`
|
|
13
|
+
* belong to a collection, and an array is indexed.
|
|
14
|
+
*/
|
|
15
|
+
export declare const arrayReceiverHint: (elementType: string) => string;
|
|
16
|
+
//# sourceMappingURL=_aliases.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ScriptingApi } from '@sheetxl/sdk';
|
|
2
|
+
/**
|
|
3
|
+
* Whether a declaration is offered. A `@deprecated` or `@hidden` one stays declared so a script that
|
|
4
|
+
* calls it still type-checks, and a lookup of its exact name still answers with its replacement; it
|
|
5
|
+
* is left out of listings, searches and suggestions, so nothing leads a reader to it.
|
|
6
|
+
*/
|
|
7
|
+
export declare const isOffered: (declared: {
|
|
8
|
+
readonly deprecated?: true;
|
|
9
|
+
readonly hidden?: true;
|
|
10
|
+
}) => boolean;
|
|
11
|
+
/** The members of `entry` that are {@link isOffered | offered}. */
|
|
12
|
+
export declare const offeredMembers: (entry: ScriptingApi.Entry) => ScriptingApi.Member[];
|
|
13
|
+
//# sourceMappingURL=_offered.d.ts.map
|
|
@@ -60,7 +60,43 @@ export declare namespace ApiLookup {
|
|
|
60
60
|
/** Matches beyond the caps, not listed. */
|
|
61
61
|
readonly omitted: number;
|
|
62
62
|
}
|
|
63
|
-
|
|
63
|
+
/**
|
|
64
|
+
* `Type.member` where the API has no such thing — the type, the member, or both — answered
|
|
65
|
+
* with what is nearest rather than with a search for the member's name across every type.
|
|
66
|
+
*
|
|
67
|
+
* @remarks
|
|
68
|
+
* A dotted name is a claim about where something lives, and the claim is what the reader needs
|
|
69
|
+
* corrected: `ISheets.add` wants to hear that the collection is `IWorksheetCollection`, and
|
|
70
|
+
* `ICellRange.setStyle` that a range's style is reached through `getStyle()`. A bare search for
|
|
71
|
+
* `add` or `setStyle` lists every type that has one and leaves the claim standing.
|
|
72
|
+
*/
|
|
73
|
+
interface Miss {
|
|
74
|
+
readonly kind: 'miss';
|
|
75
|
+
/** The type as typed, and the index key it resolved to — `null` when no type matched. */
|
|
76
|
+
readonly owner: {
|
|
77
|
+
readonly text: string;
|
|
78
|
+
readonly key: string | null;
|
|
79
|
+
};
|
|
80
|
+
/** The member as typed. */
|
|
81
|
+
readonly text: string;
|
|
82
|
+
/** When the type is unknown: the nearest type names, those with the member first. */
|
|
83
|
+
readonly nearestTypes: readonly {
|
|
84
|
+
readonly key: string;
|
|
85
|
+
readonly hasMember: boolean;
|
|
86
|
+
}[];
|
|
87
|
+
/** When the type is known: its members nearest the name, inherited ones included. */
|
|
88
|
+
readonly nearest: readonly ScriptingApi.Member[];
|
|
89
|
+
/** Where SheetXL keeps a concept another API spells this way, when the name is one of those. */
|
|
90
|
+
readonly hints: readonly string[];
|
|
91
|
+
/** Types that do have a member of exactly this name. */
|
|
92
|
+
readonly elsewhere: readonly {
|
|
93
|
+
readonly key: string;
|
|
94
|
+
readonly member: ScriptingApi.Member;
|
|
95
|
+
}[];
|
|
96
|
+
/** `elsewhere` entries beyond the cap, not listed. */
|
|
97
|
+
readonly elsewhereOmitted: number;
|
|
98
|
+
}
|
|
99
|
+
type Result = Overview | Type | Member | Search | Miss;
|
|
64
100
|
}
|
|
65
101
|
/**
|
|
66
102
|
* The names an overview leads with — where a script's reach into a workbook starts.
|
|
@@ -108,6 +144,14 @@ export declare function apiTypeOf(index: ScriptingApi.Index, target: unknown): s
|
|
|
108
144
|
* generic or a primitive is not something the index answers for.
|
|
109
145
|
*/
|
|
110
146
|
export declare function apiPointerFor(message: string, command: string): string | null;
|
|
147
|
+
/**
|
|
148
|
+
* A compiler finding without its `Did you mean '…'?` when TypeScript means a member the index does
|
|
149
|
+
* not offer — a deprecated alias is still declared, so the compiler finds it nearest.
|
|
150
|
+
*
|
|
151
|
+
* @param message A compiler finding, e.g. `Property 'setFormat' does not exist on type 'ICellRange'.
|
|
152
|
+
* Did you mean 'getFormat'?`
|
|
153
|
+
*/
|
|
154
|
+
export declare function withoutHiddenSuggestion(index: ScriptingApi.Index, message: string): string;
|
|
111
155
|
/**
|
|
112
156
|
* The members nearest a name the script used and the API does not have — the answer an `api`
|
|
113
157
|
* lookup would be asked for next, inline.
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { IRange } from '@sheetxl/primitives';
|
|
2
|
+
import { IWorkbook, IWorksheet } from '@sheetxl/sdk';
|
|
3
|
+
/**
|
|
4
|
+
* What one commit did to a workbook, at region altitude: the structured half of the run delta.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* JSON-safe, so a host can send it as it is; {@link renderDelta} is its markdown. Every address is
|
|
8
|
+
* sheet-qualified and every list is capped, with the uncounted rest in a `more` field.
|
|
9
|
+
*/
|
|
10
|
+
export interface RunDelta {
|
|
11
|
+
/** The commit described. */
|
|
12
|
+
commitId: string;
|
|
13
|
+
/** One entry per sheet whose cells the commit changed. */
|
|
14
|
+
sheets: RunDelta.SheetChange[];
|
|
15
|
+
/** The cells downstream of the written ones, or `null` when nothing reads them. */
|
|
16
|
+
dependents: RunDelta.Dependents | null;
|
|
17
|
+
/** Errors now in the written and dependent cells, by region. */
|
|
18
|
+
errors: RunDelta.ErrorRegion[];
|
|
19
|
+
/** Error regions past {@link RunDelta.errors}. */
|
|
20
|
+
errorsMore: number;
|
|
21
|
+
/** Written cells that held an error before the commit and hold none now. */
|
|
22
|
+
errorsCleared: number;
|
|
23
|
+
/** What is not a cell, over the written or dependent cells. */
|
|
24
|
+
touches: RunDelta.Touches;
|
|
25
|
+
}
|
|
26
|
+
export declare namespace RunDelta {
|
|
27
|
+
/** What a commit did to one sheet. */
|
|
28
|
+
interface SheetChange {
|
|
29
|
+
/** The sheet, quoted as a reference would quote it. */
|
|
30
|
+
sheet: string;
|
|
31
|
+
/** The cells whose values or formulas were written, or `null` when none were. */
|
|
32
|
+
written: string | null;
|
|
33
|
+
/** Cells in {@link written}. */
|
|
34
|
+
cells: number;
|
|
35
|
+
/** Written cells that now hold a formula. */
|
|
36
|
+
formulas: number;
|
|
37
|
+
/** Written cells that now hold a value that is not a formula. */
|
|
38
|
+
values: number;
|
|
39
|
+
/** Written cells that are now empty. */
|
|
40
|
+
cleared: number;
|
|
41
|
+
/**
|
|
42
|
+
* What the write replaced, from the sheet as it was: populated cells and formulas among the
|
|
43
|
+
* written ones. `null` when it cannot be told: the commit moved cells, or the store no longer
|
|
44
|
+
* keeps the state before it.
|
|
45
|
+
*/
|
|
46
|
+
replaced: {
|
|
47
|
+
populated: number;
|
|
48
|
+
formulas: number;
|
|
49
|
+
} | null;
|
|
50
|
+
/** The inserts and deletes of cells, in the order they ran. */
|
|
51
|
+
shifts: Shift[];
|
|
52
|
+
/** Ranges whose formatting changed, or `null`. */
|
|
53
|
+
styles: string | null;
|
|
54
|
+
/** The written formulas, one per block of the same formula. */
|
|
55
|
+
blocks: FormulaBlock[];
|
|
56
|
+
/** Blocks past {@link blocks}. */
|
|
57
|
+
blocksMore: number;
|
|
58
|
+
}
|
|
59
|
+
/** One insert or delete of cells. */
|
|
60
|
+
interface Shift {
|
|
61
|
+
kind: IWorksheet.ShiftKind;
|
|
62
|
+
/** The axis the neighboring cells moved along. */
|
|
63
|
+
axis: IRange.Axis;
|
|
64
|
+
/** The cells inserted or deleted, sheet-qualified; `null` when the state before was not kept. */
|
|
65
|
+
address: string | null;
|
|
66
|
+
/** Whole rows or columns, rather than cells within them. */
|
|
67
|
+
whole: boolean;
|
|
68
|
+
}
|
|
69
|
+
/** One written formula and the results it computed. */
|
|
70
|
+
interface FormulaBlock {
|
|
71
|
+
/** The block, sheet-qualified. */
|
|
72
|
+
address: string;
|
|
73
|
+
/** The formula as its first cell shows it, `=` included. */
|
|
74
|
+
formula: string;
|
|
75
|
+
/** Cells in the block. */
|
|
76
|
+
cells: number;
|
|
77
|
+
/** Results in reading order: all of them for a small block, else the first few and the last. */
|
|
78
|
+
values: string[];
|
|
79
|
+
/** `true` when {@link values} skips some, between its last two entries. */
|
|
80
|
+
sampled: boolean;
|
|
81
|
+
}
|
|
82
|
+
/** The cells downstream of the write. */
|
|
83
|
+
interface Dependents {
|
|
84
|
+
/** Populated dependent cells. */
|
|
85
|
+
cells: number;
|
|
86
|
+
/** The sheets they are on, with their cells. */
|
|
87
|
+
sheets: {
|
|
88
|
+
sheet: string;
|
|
89
|
+
cells: number;
|
|
90
|
+
}[];
|
|
91
|
+
/** Their areas, sheet-qualified. */
|
|
92
|
+
areas: string[];
|
|
93
|
+
/** Areas past {@link areas}. */
|
|
94
|
+
areasMore: number;
|
|
95
|
+
}
|
|
96
|
+
/** A region of one error, with its count. */
|
|
97
|
+
interface ErrorRegion {
|
|
98
|
+
/** Sheet-qualified. */
|
|
99
|
+
address: string;
|
|
100
|
+
/** The error as a cell shows it: `#VALUE!`, `#REF!`, … */
|
|
101
|
+
error: string;
|
|
102
|
+
/** Cells in the region. */
|
|
103
|
+
cells: number;
|
|
104
|
+
}
|
|
105
|
+
/** Objects over the written or dependent cells: listed, never evaluated. */
|
|
106
|
+
interface Touches {
|
|
107
|
+
/** Defined names over the written or dependent cells, or read through by a dependent. */
|
|
108
|
+
names: string[];
|
|
109
|
+
/** Conditional formats over the written or dependent cells, by their anchors. */
|
|
110
|
+
conditionalFormats: string[];
|
|
111
|
+
/** Data validations over the written or dependent cells, by their anchors. */
|
|
112
|
+
dataValidations: string[];
|
|
113
|
+
/** Charts that read the written cells or their dependents. */
|
|
114
|
+
charts: string[];
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/** Options for {@link describeDelta}. */
|
|
118
|
+
export interface DescribeDeltaOptions {
|
|
119
|
+
/**
|
|
120
|
+
* How many entries a list holds before the rest is counted: formula blocks, dependent areas,
|
|
121
|
+
* error regions.
|
|
122
|
+
*
|
|
123
|
+
* @defaultValue 20
|
|
124
|
+
*/
|
|
125
|
+
maxEntries?: number;
|
|
126
|
+
/**
|
|
127
|
+
* How many results a formula block lists in full; a longer block lists its first few and its
|
|
128
|
+
* last.
|
|
129
|
+
*
|
|
130
|
+
* @defaultValue 8
|
|
131
|
+
*/
|
|
132
|
+
maxBlockValues?: number;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Describes what a commit did, read from the workbook after its calculation settled.
|
|
136
|
+
*
|
|
137
|
+
* @param workbook The workbook the commit landed on, settled.
|
|
138
|
+
* @param commitId The commit. Omit for the current one.
|
|
139
|
+
* @returns `null` when the commit changed no cells.
|
|
140
|
+
*
|
|
141
|
+
* @remarks
|
|
142
|
+
* Nothing here is collected on the write path. The written ranges come from the commit
|
|
143
|
+
* ({@link IWorkbook.getChanges}), what they replaced from the sheet as it was at the commit before
|
|
144
|
+
* ({@link IWorksheet.ChangeEvent.getPreviousRanges}), and everything else is a read of the settled
|
|
145
|
+
* workbook bounded by what was written.
|
|
146
|
+
*/
|
|
147
|
+
export declare function describeDelta(workbook: IWorkbook, commitId?: string, options?: DescribeDeltaOptions): Promise<RunDelta | null>;
|
|
148
|
+
//# sourceMappingURL=describeDelta.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { IWorkbook } from '@sheetxl/sdk';
|
|
2
|
+
import { DescribeDeltaOptions, RunDelta } from './describeDelta';
|
|
3
|
+
/** What {@link readRunDelta} hands a run report. */
|
|
4
|
+
export interface RunDeltaReport {
|
|
5
|
+
/** The delta, JSON-safe; absent when the commit changed no cells or it could not be read. */
|
|
6
|
+
delta?: RunDelta;
|
|
7
|
+
/** The report's lines: the delta rendered, or why it could not be read. */
|
|
8
|
+
markdown?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The delta of a run's commit, as a run report carries it: the structure and its lines.
|
|
12
|
+
*
|
|
13
|
+
* @param workbook The workbook the run committed to, settled.
|
|
14
|
+
* @param commitId The run's commit; nothing is read without one (a run that wrote nothing).
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* Never throws. The run has already committed, and a delta that cannot be read must not turn a
|
|
18
|
+
* write that landed into a reported failure, so the reason is reported in its place.
|
|
19
|
+
*/
|
|
20
|
+
export declare function readRunDelta(workbook: IWorkbook, commitId: string | undefined, options?: DescribeDeltaOptions): Promise<RunDeltaReport>;
|
|
21
|
+
//# sourceMappingURL=readRunDelta.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { RunDelta } from './describeDelta';
|
|
2
|
+
/**
|
|
3
|
+
* Renders a {@link RunDelta} as the lines a run report appends.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* One line per fact, labeled, so a reader scans the labels: what was written and what it
|
|
7
|
+
* replaced, the formulas with their results, what moved, what reads the write, the errors, and
|
|
8
|
+
* what sits over it that is not a cell.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```
|
|
12
|
+
* Changed: Sheet1!H7:H38 — 32 formulas, 0 populated cells replaced
|
|
13
|
+
* Sheet1!H7:H38 =B7*C7 → 12, 15, 18 … 90 (32 cells)
|
|
14
|
+
* Structure: Sheet1!5:7 rows inserted
|
|
15
|
+
* Dependents: 212 cells on 2 sheets — Sheet1!K7:K38, Summary!B4:B9
|
|
16
|
+
* Errors: Sheet1!K9:K12 #VALUE! (4)
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare function renderDelta(delta: RunDelta): string;
|
|
20
|
+
//# sourceMappingURL=renderDelta.d.ts.map
|
|
@@ -15,7 +15,7 @@ import { ICell, Scalar } from '@sheetxl/sdk';
|
|
|
15
15
|
*
|
|
16
16
|
* ---
|
|
17
17
|
*
|
|
18
|
-
* **Quarantine note.** `ICell.getText()` is the only SDK call this module makes, and it is on its
|
|
18
|
+
* **Quarantine note.** `ICell.getText()` is the only SDK text call this module makes, and it is on its
|
|
19
19
|
* way out — its contract fuses formatting, localization, csv escaping and this encoding into one
|
|
20
20
|
* method with no clear answer for large values. It is isolated to this file deliberately: when
|
|
21
21
|
* the SDK splits pure number formatting away from the encoding, exactly one file changes and no
|
|
@@ -35,14 +35,26 @@ export declare namespace CellEncoding {
|
|
|
35
35
|
*/
|
|
36
36
|
readonly Display: "display";
|
|
37
37
|
/**
|
|
38
|
-
* The
|
|
38
|
+
* The stored scalar — what `getValue()` returns, with no number format applied.
|
|
39
39
|
*
|
|
40
40
|
* @remarks
|
|
41
|
-
* `1234.5678` where {@link Mode.Display | display} shows `$1,234.57
|
|
42
|
-
*
|
|
43
|
-
*
|
|
41
|
+
* `1234.5678` where {@link Mode.Display | display} shows `$1,234.57`, `0.04` where it shows
|
|
42
|
+
* `4%`, and a date as its serial. A reader wants one of two things: what the grid shows, or
|
|
43
|
+
* what a formula computes with. There is deliberately no layer in between — the formula
|
|
44
|
+
* bar's text (`4%` at full precision, dates kept) is the stored scalar restyled by the
|
|
45
|
+
* format's category, and both of those are already reported.
|
|
44
46
|
*/
|
|
45
47
|
readonly Value: "value";
|
|
48
|
+
/**
|
|
49
|
+
* The formula text where the cell has a formula (`=SUM(B2:B9)`), else its stored
|
|
50
|
+
* {@link Mode.Value | value}.
|
|
51
|
+
*
|
|
52
|
+
* @remarks
|
|
53
|
+
* Excel's Show Formulas view: for reading a block's logic as a grid. The inputs read as the
|
|
54
|
+
* scalars the formulas compute with — `0.25`, not `25%`; a date as its serial. The text carries
|
|
55
|
+
* its leading `=`, as the formula bar shows it.
|
|
56
|
+
*/
|
|
57
|
+
readonly Formula: "formula";
|
|
46
58
|
};
|
|
47
59
|
type Mode = typeof Mode[keyof typeof Mode];
|
|
48
60
|
/**
|
|
@@ -137,8 +149,8 @@ export declare function encodeCell(cell: ICell, mode: CellEncoding.Mode): CellEn
|
|
|
137
149
|
* The counterpart to {@link encodeCell} for the stateless value layer (`IRange`, `Scalar[][]`),
|
|
138
150
|
* where there is no cell to ask for text and therefore **no number format to apply**. That is
|
|
139
151
|
* the whole difference: `0.04` encodes as `0.04` here and as `4%` through a cell that formats
|
|
140
|
-
* it. There is consequently no `mode` —
|
|
141
|
-
*
|
|
152
|
+
* it. There is consequently no `mode` — this is what {@link CellEncoding.Mode.Value} produces
|
|
153
|
+
* for a cell, and the only form a bare value has.
|
|
142
154
|
*
|
|
143
155
|
* Everything above formatting is identical, because it is the same contract: the `'` prefix on
|
|
144
156
|
* strings, `TRUE`/`FALSE`, error labels, blank elision.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* The rule, which predicts any future member:
|
|
9
9
|
* **a grep field is a layer whose text was authored by a person or is read by one.**
|
|
10
10
|
*
|
|
11
|
-
* `display
|
|
11
|
+
* `display` and `value` are read; `formula`, `hyperlink` and `numberFormat` are authored.
|
|
12
12
|
* A layer that fails the rule fails it because its payload has no canonical text — a fill's
|
|
13
13
|
* "red" may be stored as `FF0000`, a theme slot, or an indexed palette entry, so any pattern
|
|
14
14
|
* against it silently matches less than it claims: a confident wrong answer, which is worse
|
|
@@ -40,28 +40,18 @@ export type GrepField =
|
|
|
40
40
|
*/
|
|
41
41
|
'display'
|
|
42
42
|
/**
|
|
43
|
-
* The
|
|
43
|
+
* The stored scalar — what `getValue()` returns, with no number format applied.
|
|
44
44
|
*
|
|
45
|
-
* `1234.5678` where {@link GrepField | display} shows `$1,234.57`
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
45
|
+
* `1234.5678` where {@link GrepField | display} shows `$1,234.57`, `0.4` where it shows `40%`,
|
|
46
|
+
* dates as serial numbers. This is the layer a cell report's `Value` line and the `IRange` /
|
|
47
|
+
* stats reads print, so it is the field that makes *those* printed values greppable — the
|
|
48
|
+
* round-trip that `display` provides for formatted reads. Not a default: serials and
|
|
49
|
+
* unrounded floats are noise until they are the question.
|
|
50
50
|
*
|
|
51
51
|
* Identical to `display` for every cell whose format only decorates (`General`, plain
|
|
52
|
-
* text) —
|
|
52
|
+
* text) — a search of both dedupes that case per cell rather than reporting it twice.
|
|
53
53
|
*/
|
|
54
54
|
| 'value'
|
|
55
|
-
/**
|
|
56
|
-
* The stored scalar, encoded bare — what the stateless value layer prints.
|
|
57
|
-
*
|
|
58
|
-
* `0.4` where {@link GrepField | value} shows `40%`; dates as serial numbers. This is the
|
|
59
|
-
* layer `IRange` / stats reads print (they have no cell to format through), so it is the
|
|
60
|
-
* field that makes *those* printed values greppable — the round-trip that `display`
|
|
61
|
-
* provides for formatted reads. Not a default: serials and unrounded floats are noise
|
|
62
|
-
* until they are the question.
|
|
63
|
-
*/
|
|
64
|
-
| 'raw'
|
|
65
55
|
/** Formula text, A1 style (`=SUM(A1:A10)`). Cells without a formula contribute nothing. */
|
|
66
56
|
| 'formula'
|
|
67
57
|
/** Hyperlink target — the address, not the display text (which is already `display`). */
|
|
@@ -71,8 +61,9 @@ export type GrepField =
|
|
|
71
61
|
*
|
|
72
62
|
* Authored text (it is literally what was typed into Format Cells), canonical, and regex
|
|
73
63
|
* is its native matcher. `--fields numberFormat "%"` is the well-posed form of "which
|
|
74
|
-
* cells are percentages" — the rendered `40%` is not. Matches
|
|
75
|
-
*
|
|
64
|
+
* cells are percentages" — the rendered `40%` is not. Matches blocks given a format,
|
|
65
|
+
* directly or by a named style, including value-less ones (a formatted-but-empty column is
|
|
66
|
+
* a real finding).
|
|
76
67
|
*/
|
|
77
68
|
| 'numberFormat'
|
|
78
69
|
/**
|
|
@@ -109,7 +100,6 @@ export type GrepField =
|
|
|
109
100
|
export declare const GrepField: {
|
|
110
101
|
readonly Display: "display";
|
|
111
102
|
readonly Value: "value";
|
|
112
|
-
readonly Raw: "raw";
|
|
113
103
|
readonly Formula: "formula";
|
|
114
104
|
readonly Hyperlink: "hyperlink";
|
|
115
105
|
readonly NumberFormat: "numberFormat";
|
|
@@ -124,16 +114,15 @@ export declare const GREP_FIELDS: readonly GrepField[];
|
|
|
124
114
|
* The default field set.
|
|
125
115
|
*
|
|
126
116
|
* @remarks
|
|
127
|
-
* What you can see
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
* full-precision searches, which is worse.
|
|
117
|
+
* What you can see and what is structurally behind it. `value` is opt-in: a search is almost
|
|
118
|
+
* always for text as the grid shows it, and the stored scalar in a default search makes every
|
|
119
|
+
* numeric pattern hit date serials and unrounded floats nobody was looking at. The search that
|
|
120
|
+
* wants it — a full-precision number copied from a stats read or a cell report's `Value` line —
|
|
121
|
+
* knows it does, and asks with `fields: ['value']`.
|
|
133
122
|
*
|
|
134
|
-
* The layers off the grid are defaults
|
|
135
|
-
*
|
|
136
|
-
*
|
|
123
|
+
* The layers off the grid are defaults. A caller who has to ask for `shape` already knows the
|
|
124
|
+
* callout is there; the search that needs it is the one that does not. They cost one pass over a
|
|
125
|
+
* sheet's objects, not over its cells.
|
|
137
126
|
*/
|
|
138
127
|
export declare const GREP_FIELDS_DEFAULT: readonly GrepField[];
|
|
139
128
|
/** What a grep result should carry. */
|
|
@@ -178,7 +167,7 @@ export interface GrepArgs {
|
|
|
178
167
|
* Which layers to search.
|
|
179
168
|
*
|
|
180
169
|
* @defaultValue {@link GREP_FIELDS_DEFAULT} —
|
|
181
|
-
* `['display', '
|
|
170
|
+
* `['display', 'formula', 'comment', 'shape', 'chart', 'name']`
|
|
182
171
|
*/
|
|
183
172
|
fields?: readonly GrepField[];
|
|
184
173
|
/**
|
|
@@ -250,7 +239,8 @@ export interface GrepArgs {
|
|
|
250
239
|
*
|
|
251
240
|
* @remarks
|
|
252
241
|
* Counts **cells and objects**, not match rows — a cell matching in two fields is one unit of
|
|
253
|
-
* budget, and so is a chart matching in its title and an axis
|
|
242
|
+
* budget, and so is a chart matching in its title and an axis, and a block matching in its
|
|
243
|
+
* hyperlink or number format.
|
|
254
244
|
* The search looks one match past the cap, so a result that ends exactly at `maxCount` is
|
|
255
245
|
* only reported truncated when a further match actually exists.
|
|
256
246
|
*/
|
|
@@ -302,8 +292,9 @@ export interface GrepMatch {
|
|
|
302
292
|
*/
|
|
303
293
|
sheet: string;
|
|
304
294
|
/**
|
|
305
|
-
* A1 cell address within the sheet; the
|
|
306
|
-
*
|
|
295
|
+
* A1 cell address within the sheet; the block (`A:J`) for a hyperlink or number format; the
|
|
296
|
+
* anchor range (`F2:H6`) for a shape or chart; the name itself for a defined name. Qualified
|
|
297
|
+
* with `sheet`, each is something a follow-up call takes.
|
|
307
298
|
*/
|
|
308
299
|
address: string;
|
|
309
300
|
/**
|
|
@@ -324,7 +315,7 @@ export interface GrepMatch {
|
|
|
324
315
|
export interface GrepSheetMatches {
|
|
325
316
|
/** Sheet name. */
|
|
326
317
|
sheet: string;
|
|
327
|
-
/**
|
|
318
|
+
/** Cells that produced a match in this sheet, counted as {@link GrepResult.cellCount} is. */
|
|
328
319
|
cells: number;
|
|
329
320
|
/** Shapes and charts on this sheet that produced at least one match. */
|
|
330
321
|
objects: number;
|
|
@@ -337,7 +328,10 @@ export interface GrepResult {
|
|
|
337
328
|
/** Resolved human-readable scope, e.g. `Sheet1!A1:D847` or `workbook`. */
|
|
338
329
|
scope: string;
|
|
339
330
|
matches: readonly GrepMatch[];
|
|
340
|
-
/**
|
|
331
|
+
/**
|
|
332
|
+
* Cells that produced a match. A hyperlink or number format block counts all of its cells, and
|
|
333
|
+
* a cell also matching in another field is counted again.
|
|
334
|
+
*/
|
|
341
335
|
cellCount: number;
|
|
342
336
|
/** Shapes, charts and names that produced at least one match. */
|
|
343
337
|
objectCount: number;
|
package/types/src/grep/grep.d.ts
CHANGED
|
@@ -4,8 +4,9 @@ import { GrepArgs, GrepResult } from './GrepTypes';
|
|
|
4
4
|
* Searches a workbook's text by pattern — its cells, and what is written off the grid.
|
|
5
5
|
*
|
|
6
6
|
* @remarks
|
|
7
|
-
* Per sheet: the cells in reading order (a comment rides its cell), then the
|
|
8
|
-
*
|
|
7
|
+
* Per sheet: the cells in reading order (a comment rides its cell), then the blocks a hyperlink or
|
|
8
|
+
* number format is stated over, then the shapes and charts in reading order of their anchors.
|
|
9
|
+
* Defined names follow every sheet, since they belong to none.
|
|
9
10
|
*
|
|
10
11
|
* Deliberately shaped after ripgrep — args, defaults and vocabulary are pretrained, and every
|
|
11
12
|
* novel idiom is paid for in error loops.
|
package/types/src/index.d.ts
CHANGED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ICellRange, IWorksheet } from '@sheetxl/sdk';
|
|
2
|
+
import { MarkdownBuilder } from './MarkdownBuilder';
|
|
3
|
+
/** One what-if data table on a sheet: a `TABLE` formula and the results it spills. */
|
|
4
|
+
export interface DataTableListing {
|
|
5
|
+
/** The results: the spill, or what the counts state when the spill is blocked. */
|
|
6
|
+
extent: ICellRange;
|
|
7
|
+
/** The formula at the anchor, `=TABLE(...)`. */
|
|
8
|
+
formula: string;
|
|
9
|
+
/** The row input's address, `#REF!` when deleted; `null` for a one-input table down a column. */
|
|
10
|
+
rowInput: string | null;
|
|
11
|
+
/** The column input's address, `#REF!` when deleted; `null` for a one-input table along a row. */
|
|
12
|
+
columnInput: string | null;
|
|
13
|
+
/** The extent is blocked (`#SPILL!`). */
|
|
14
|
+
blocked: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The sheet's what-if data tables: every formula region whose formula is one whole `TABLE(...)`
|
|
18
|
+
* call. Read per region of the formula partition, never cell by cell.
|
|
19
|
+
*/
|
|
20
|
+
export declare function findDataTables(sheet: IWorksheet): DataTableListing[];
|
|
21
|
+
/**
|
|
22
|
+
* The formula cells of a data table, as an address: the corner of a two-input table, the row above
|
|
23
|
+
* a one-input table down a column, the column left of one along a row.
|
|
24
|
+
*/
|
|
25
|
+
export declare const describeDataTableFormula: (table: DataTableListing) => string;
|
|
26
|
+
/** `=TABLE(B1,C1,3,3) row input B1, column input C1, formula E2` - one table's listing row. */
|
|
27
|
+
export declare const describeDataTable: (table: DataTableListing) => string;
|
|
28
|
+
/**
|
|
29
|
+
* `## Data Tables (1)` over ` F3:H5 =TABLE(B1,C1,3,3) row input B1, column input C1, formula E2`
|
|
30
|
+
* rows.
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* A what-if data table is a spilling formula, so the formula and spill partitions already list it.
|
|
34
|
+
* This section is what says its results are the formula cells evaluated once per axis pair, and
|
|
35
|
+
* names the cells an edit should reach instead: the inputs, the axes beside the results and the
|
|
36
|
+
* formula.
|
|
37
|
+
*/
|
|
38
|
+
export declare function appendDataTables(md: MarkdownBuilder, tables: readonly DataTableListing[]): void;
|
|
39
|
+
//# sourceMappingURL=appendDataTables.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ICellRange, ICellRanges, IRange,
|
|
1
|
+
import { ICellRange, ICellRanges, IRange, IWorksheet } from '@sheetxl/sdk';
|
|
2
2
|
import { MarkdownBuilder } from './MarkdownBuilder';
|
|
3
3
|
/**
|
|
4
4
|
* Options for the dependency sections.
|
|
@@ -36,7 +36,7 @@ export interface DependencyContext {
|
|
|
36
36
|
/** Print `## Dependents (0)` rather than omitting the section. */
|
|
37
37
|
zeroDependents?: boolean;
|
|
38
38
|
/** The sheet the report is about; members elsewhere are listed as crossings. */
|
|
39
|
-
home?:
|
|
39
|
+
home?: IWorksheet | null;
|
|
40
40
|
/** The cells the report is about, when it is about cells: charts that plot them are dependents too. */
|
|
41
41
|
subject?: ICellRange | null;
|
|
42
42
|
}
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import { IPivotTable } from '@sheetxl/sdk';
|
|
2
2
|
import { MarkdownBuilder } from './MarkdownBuilder';
|
|
3
3
|
/**
|
|
4
|
-
* Where a pivot table is laid out, as
|
|
5
|
-
*
|
|
6
|
-
* @remarks
|
|
7
|
-
* Read from {@link IPivotTable.getXML} because the table has no model yet and that markup is the
|
|
8
|
-
* documented way to what it does not expose. The address is as the file wrote it: it does not
|
|
9
|
-
* follow rows and columns inserted since, which is the table's own stated limit and not this
|
|
10
|
-
* report's.
|
|
4
|
+
* Where a pivot table is laid out, as an address — or `''` once it is deleted.
|
|
11
5
|
*/
|
|
12
6
|
export declare const describePivotLocation: (pivot: IPivotTable) => string;
|
|
13
7
|
/**
|
|
14
|
-
*
|
|
8
|
+
* `rows: Region > Product · columns: Year · filters: Channel · values: Sum of Sales` — the
|
|
9
|
+
* fields on each axis, outermost first, or `''` for a table SheetXL does not model.
|
|
10
|
+
*/
|
|
11
|
+
export declare const describePivotFields: (pivot: IPivotTable) => string;
|
|
12
|
+
/**
|
|
13
|
+
* `## Pivot Tables (2)` over ` A3:D20 PivotTable1 from Data!A1:H500` rows, each followed by its
|
|
14
|
+
* fields. The source is written as `IPivotTableCollection.add` takes it.
|
|
15
15
|
*
|
|
16
16
|
* @remarks
|
|
17
17
|
* A pivot table's output is ordinary cells, so `Contentful` already lists the block — as numbers
|
|
18
18
|
* and labels, with nothing to say they are a summary of data held elsewhere and will be
|
|
19
|
-
* overwritten by the next refresh
|
|
19
|
+
* overwritten by the next refresh. This section is what says so, and which tables no longer match
|
|
20
|
+
* their source.
|
|
20
21
|
*/
|
|
21
22
|
export declare function appendPivotTables(md: MarkdownBuilder, pivots: readonly IPivotTable[]): void;
|
|
22
23
|
//# sourceMappingURL=appendPivotTables.d.ts.map
|