@sheetxl/query 0.8.0-beta.11 → 0.8.0-beta.13
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/browser/esm/index.mjs +1529 -1325
- package/node/esm/index.mjs +1648 -1437
- package/package.json +3 -3
- package/types/src/grep/GrepTypes.d.ts +13 -7
- package/types/src/grep/grep.d.ts +3 -2
- package/types/src/markdown/appendDataTables.d.ts +39 -0
- package/types/src/markdown/appendSections.d.ts +11 -0
- package/types/src/markdown/describeAnomaly.d.ts +10 -1
- package/types/src/markdown/renderRegions.d.ts +8 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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.
|
|
4
|
+
"version": "0.8.0-beta.13",
|
|
5
5
|
"license": "SEE LICENSE IN <LICENSE>",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"query"
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@sheetxl/primitives": "^0.8.0-beta.
|
|
46
|
-
"@sheetxl/sdk": "^0.8.0-beta.
|
|
45
|
+
"@sheetxl/primitives": "^0.8.0-beta.13",
|
|
46
|
+
"@sheetxl/sdk": "^0.8.0-beta.13"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/node": "^26.6.4"
|
|
@@ -61,8 +61,9 @@ export type GrepField =
|
|
|
61
61
|
*
|
|
62
62
|
* Authored text (it is literally what was typed into Format Cells), canonical, and regex
|
|
63
63
|
* is its native matcher. `--fields numberFormat "%"` is the well-posed form of "which
|
|
64
|
-
* cells are percentages" — the rendered `40%` is not. Matches
|
|
65
|
-
*
|
|
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).
|
|
66
67
|
*/
|
|
67
68
|
| 'numberFormat'
|
|
68
69
|
/**
|
|
@@ -238,7 +239,8 @@ export interface GrepArgs {
|
|
|
238
239
|
*
|
|
239
240
|
* @remarks
|
|
240
241
|
* Counts **cells and objects**, not match rows — a cell matching in two fields is one unit of
|
|
241
|
-
* 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.
|
|
242
244
|
* The search looks one match past the cap, so a result that ends exactly at `maxCount` is
|
|
243
245
|
* only reported truncated when a further match actually exists.
|
|
244
246
|
*/
|
|
@@ -290,8 +292,9 @@ export interface GrepMatch {
|
|
|
290
292
|
*/
|
|
291
293
|
sheet: string;
|
|
292
294
|
/**
|
|
293
|
-
* A1 cell address within the sheet; the
|
|
294
|
-
*
|
|
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.
|
|
295
298
|
*/
|
|
296
299
|
address: string;
|
|
297
300
|
/**
|
|
@@ -312,7 +315,7 @@ export interface GrepMatch {
|
|
|
312
315
|
export interface GrepSheetMatches {
|
|
313
316
|
/** Sheet name. */
|
|
314
317
|
sheet: string;
|
|
315
|
-
/**
|
|
318
|
+
/** Cells that produced a match in this sheet, counted as {@link GrepResult.cellCount} is. */
|
|
316
319
|
cells: number;
|
|
317
320
|
/** Shapes and charts on this sheet that produced at least one match. */
|
|
318
321
|
objects: number;
|
|
@@ -325,7 +328,10 @@ export interface GrepResult {
|
|
|
325
328
|
/** Resolved human-readable scope, e.g. `Sheet1!A1:D847` or `workbook`. */
|
|
326
329
|
scope: string;
|
|
327
330
|
matches: readonly GrepMatch[];
|
|
328
|
-
/**
|
|
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
|
+
*/
|
|
329
335
|
cellCount: number;
|
|
330
336
|
/** Shapes, charts and names that produced at least one match. */
|
|
331
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.
|
|
@@ -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
|
|
@@ -207,6 +207,17 @@ export interface AppendNamesOptions {
|
|
|
207
207
|
* since a bare `Sales` in an expression is a `named` token that resolves to a table.
|
|
208
208
|
*/
|
|
209
209
|
symbols?: readonly INamed[];
|
|
210
|
+
/**
|
|
211
|
+
* Gives rows only to the names some formula reads; the rest are one count on the closing line.
|
|
212
|
+
*
|
|
213
|
+
* @defaultValue `false` — every name gets a row (a name manager must be complete)
|
|
214
|
+
*
|
|
215
|
+
* @remarks
|
|
216
|
+
* For a report whose job is routing. A name nothing reads changes no value and breaks no cell,
|
|
217
|
+
* and a decades-old model carries them by the ten thousand (macro-sheet constants, dead
|
|
218
|
+
* `#REF!`s): listed, they are the whole section; counted, the section is the names that matter.
|
|
219
|
+
*/
|
|
220
|
+
omitUnread?: boolean;
|
|
210
221
|
}
|
|
211
222
|
/**
|
|
212
223
|
* A name's spelling as a formula would write it — qualified when it is scoped to one sheet.
|
|
@@ -13,7 +13,16 @@ export declare const anomalyLabel: (check: string) => string;
|
|
|
13
13
|
*/
|
|
14
14
|
export declare function describeAnomaly(anomaly: ICell.Anomaly, cell: ICell): string;
|
|
15
15
|
/** Every finding at `cell`, `;`-joined; `null` when none fires. */
|
|
16
|
-
export declare function describeAnomalies(cell: ICell
|
|
16
|
+
export declare function describeAnomalies(cell: ICell, options?: {
|
|
17
|
+
constants?: boolean;
|
|
18
|
+
}): string | null;
|
|
19
|
+
/** A `constantFrequency` finding's constant as a formula types it: `12`, `"Total"`, `FALSE`. */
|
|
20
|
+
export declare const describeConstant: (evidence: ICell.Anomaly["evidence"]) => string;
|
|
21
|
+
/**
|
|
22
|
+
* Whether a region's findings are constants alone: the reports count those in the `Constants`
|
|
23
|
+
* census rather than listing each region among the breaks.
|
|
24
|
+
*/
|
|
25
|
+
export declare const isConstantOnly: (anomalies: readonly ICell.Anomaly[]) => boolean;
|
|
17
26
|
/**
|
|
18
27
|
* R1C1 references in `text` as A1, read from `at`: `=R[-1]C*2` at `B3` is `=B2*2`. Absolute
|
|
19
28
|
* parts take a `$`, as Excel writes them.
|
|
@@ -50,7 +50,15 @@ export declare function appendRegionList(md: MarkdownBuilder, regions: readonly
|
|
|
50
50
|
payload?: RegionPayload;
|
|
51
51
|
profile?: boolean;
|
|
52
52
|
series?: boolean;
|
|
53
|
+
collapse?: RegionKey;
|
|
53
54
|
}): void;
|
|
55
|
+
/** What a region says, as a key two regions saying the same thing share; `null` keeps it on its own. */
|
|
56
|
+
export type RegionKey = (region: ICellRegion) => string | null;
|
|
57
|
+
/**
|
|
58
|
+
* An `anomalies` region's key: its findings, check and evidence, without the rank. Two regions
|
|
59
|
+
* with the same findings are one line of the listing.
|
|
60
|
+
*/
|
|
61
|
+
export declare const anomalyRegionKey: RegionKey;
|
|
54
62
|
/**
|
|
55
63
|
* Renders a partition — the unit `getRegions` returns, so an agent addresses structure instead
|
|
56
64
|
* of guessing ranges.
|