@sheetxl/primitives 0.7.22 → 0.7.23-beta.2
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/cjs/index.cjs +1 -6
- package/browser/esm/index.mjs +683 -307
- package/node/esm/index.mjs +684 -307
- package/package.json +1 -1
- package/types/index.d.ts +2 -1622
- package/types/src/ErrorPolicy.d.ts +78 -0
- package/types/src/ErrorPolicy.d.ts.map +1 -0
- package/types/src/Flatten.d.ts +34 -0
- package/types/src/Flatten.d.ts.map +1 -0
- package/types/src/FormulaContext.d.ts +227 -0
- package/types/src/FormulaContext.d.ts.map +1 -0
- package/types/src/FormulaError.d.ts +328 -0
- package/types/src/FormulaError.d.ts.map +1 -0
- package/types/src/IFormulaContext.d.ts +533 -0
- package/types/src/IFormulaContext.d.ts.map +1 -0
- package/types/src/IFunction.d.ts +608 -0
- package/types/src/IFunction.d.ts.map +1 -0
- package/types/src/IRange.d.ts +1091 -0
- package/types/src/IRange.d.ts.map +1 -0
- package/types/src/IRangeStats.d.ts +478 -0
- package/types/src/IRangeStats.d.ts.map +1 -0
- package/types/src/IReferenceRange.d.ts +22 -0
- package/types/src/IReferenceRange.d.ts.map +1 -0
- package/types/src/IRichData.d.ts +37 -0
- package/types/src/IRichData.d.ts.map +1 -0
- package/types/src/IRuntime.d.ts +65 -0
- package/types/src/IRuntime.d.ts.map +1 -0
- package/types/src/Lambda.d.ts +17 -0
- package/types/src/Lambda.d.ts.map +1 -0
- package/types/src/LocaleProfile.d.ts +79 -0
- package/types/src/LocaleProfile.d.ts.map +1 -0
- package/types/src/Observable.d.ts +46 -0
- package/types/src/Observable.d.ts.map +1 -0
- package/types/src/Omittable.d.ts +50 -0
- package/types/src/Omittable.d.ts.map +1 -0
- package/types/src/Repeating.d.ts +66 -0
- package/types/src/Repeating.d.ts.map +1 -0
- package/types/src/Scalar.d.ts +67 -0
- package/types/src/Scalar.d.ts.map +1 -0
- package/types/src/ScalarType.d.ts +109 -0
- package/types/src/ScalarType.d.ts.map +1 -0
- package/types/src/WildCard.d.ts +26 -0
- package/types/src/WildCard.d.ts.map +1 -0
- package/types/src/index.d.ts +20 -0
- package/types/src/index.d.ts.map +1 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parameter markers that declare how the engine handles `FormulaError` values *before* a
|
|
3
|
+
* function body runs. At the type level they are identity aliases — the body sees plain `T` —
|
|
4
|
+
* but the declaration records the policy for the engine.
|
|
5
|
+
*
|
|
6
|
+
* **ONE default, every position: errors reject.** Scalar arguments, lifted members,
|
|
7
|
+
* flattened members, and range parameters alike propagate the first error — preserving its
|
|
8
|
+
* identity (`#N/A` stays `#N/A`) — and the body never runs. Opt out with {@link AcceptError}.
|
|
9
|
+
* The single exception needs no marker: a `FormulaError.Known`-typed parameter receives
|
|
10
|
+
* errors because the type declares it.
|
|
11
|
+
*
|
|
12
|
+
* > *Errors propagate unless your function opts in to seeing them.*
|
|
13
|
+
*
|
|
14
|
+
* | position | default | opt-out |
|
|
15
|
+
* | --- | --- | --- |
|
|
16
|
+
* | scalar argument | reject — propagate with identity, body never runs | `AcceptError<T>` — body receives raw |
|
|
17
|
+
* | lifted member | reject — error becomes an error **member** of the output | `AcceptError<T>` |
|
|
18
|
+
* | flattened member (`Scalar[]`, rest) | reject — first error wins, argument order, row-major | `AcceptError<T>` |
|
|
19
|
+
* | range parameter | reject — first error (row-major) outranks everything | `AcceptError<IRange>` — members arrive raw |
|
|
20
|
+
* | `FormulaError.Known` parameter | receive (the type declares it) | — |
|
|
21
|
+
*
|
|
22
|
+
* One parameter splits the two by ARGUMENT SHAPE rather than picking one:
|
|
23
|
+
* {@link AcceptRefError} rejects a direct/computed error and accepts a reference-shaped one.
|
|
24
|
+
*
|
|
25
|
+
* There is no marker for the default. A `RejectError<T>` alias existed and declared nothing the
|
|
26
|
+
* engine did not already do, so it was removed rather than left as a second way to say nothing.
|
|
27
|
+
*
|
|
28
|
+
* Which-error-wins is ARGUMENT ORDER: the whole of argument N is scanned before argument
|
|
29
|
+
* N+1, row-major within each. The engine's range scan rides `IRange.errors()` /
|
|
30
|
+
* `IRange.hasError()` — raw stored members only, same definition as
|
|
31
|
+
* `getStats().getTypedCounts([ScalarType.Error])`.
|
|
32
|
+
*
|
|
33
|
+
* The tolerant set — parameters that declare `AcceptError` — is finite and documented
|
|
34
|
+
* (RANGE-ERROR-PROP.md §6.3): operators (broadcast is per-member), reshapers / dynamic
|
|
35
|
+
* arrays (error members pass through to the output), lookups (errors in never-consumed
|
|
36
|
+
* cells are tolerated), shape-only reference params (ROWS, COLUMNS, INDEX, OFFSET…),
|
|
37
|
+
* conditional consumers (SUMIF-family; the database family and SUBTOTAL/AGGREGATE keep
|
|
38
|
+
* their in-body, data-dependent policy), counters (COUNT, COUNTA), and the error handlers
|
|
39
|
+
* themselves (IS*, IFERROR…).
|
|
40
|
+
*/
|
|
41
|
+
/**
|
|
42
|
+
* Opts a parameter out of the reject default: the body receives `FormulaError` values raw.
|
|
43
|
+
* Use this for functions whose job is to inspect, replace, or render errors (the IS*
|
|
44
|
+
* family, IFERROR, ERROR.TYPE, VALUETOTEXT…), that remap errors rather than propagate
|
|
45
|
+
* them, or that legitimately tolerate error members they may never consume (lookups,
|
|
46
|
+
* reshapers, conditional consumers — the §6.3 tolerant set).
|
|
47
|
+
*
|
|
48
|
+
* On a TYPED parameter (`IRange<number>`), `AcceptError` means errors and failed coercions
|
|
49
|
+
* arrive as raw MEMBERS instead of propagating — COUNT ignores them, COUNTA counts them.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* export function ISERROR(value: AcceptError<Scalar>): Scalar { ... }
|
|
54
|
+
* export function IFERROR(value: AcceptError<Scalar>, valueIfError: AcceptError<Scalar>): Scalar { ... }
|
|
55
|
+
* // Both parameters: an unused error fallback must pass through untouched (IFERROR(5,NA()) → 5).
|
|
56
|
+
* export function ROWS(array: AcceptError<IRange>): number { ... }
|
|
57
|
+
* // Shape-only: ROWS(A1:A2) is 2 even if A1 is #REF!.
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export type AcceptError<T> = T;
|
|
61
|
+
/**
|
|
62
|
+
* Splits the policy by the ARGUMENT'S SHAPE: a **direct or computed** error rejects (propagates
|
|
63
|
+
* with its identity, exactly the default), while a **reference-shaped** one is accepted and the
|
|
64
|
+
* body receives it raw. "Direct" is the same runtime-shape test the coercion uses — a scalar,
|
|
65
|
+
* typed or computed; a reference or a computed array is not (`isDirectArg` in `TypedFunction`).
|
|
66
|
+
*
|
|
67
|
+
* ```
|
|
68
|
+
* =DSUM(A1:B3,NA(),G1:G2) #N/A direct — rejects, identity preserved
|
|
69
|
+
* =DSUM(A1:B3,NA()+0,G1:G2) #N/A computed — still direct
|
|
70
|
+
* =DSUM(A1:B3,E1,G1:G2) #VALUE! E1=#N/A — reference: body remaps
|
|
71
|
+
* =DSUM(A1:B3,E2,G1:G2) #VALUE! E2=#DIV/0!
|
|
72
|
+
* ```
|
|
73
|
+
*
|
|
74
|
+
* A body under this marker MUST handle the error it may now receive; a `FormulaError` reaching
|
|
75
|
+
* an unguarded body is the item 18 hazard.
|
|
76
|
+
*/
|
|
77
|
+
export type AcceptRefError<T> = T;
|
|
78
|
+
//# sourceMappingURL=ErrorPolicy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorPolicy.d.ts","sourceRoot":"","sources":["../../../src/ErrorPolicy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC;AAE/B;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Declares that a parameter takes ONE argument and receives it UNPACKED into a list.
|
|
3
|
+
*
|
|
4
|
+
* The length comes from the argument's CONTENTS, which is what separates it from every repeating
|
|
5
|
+
* form — there the length comes from the argument COUNT:
|
|
6
|
+
*
|
|
7
|
+
* ```
|
|
8
|
+
* IRR(values: Flatten<number>, guess?: number) IRR(A1:A5) → values is [1,2,3,4,5] ONE argument
|
|
9
|
+
* SUM(number: IRange<number>[]) SUM(A1:A5) → number is [IRange] ONE argument
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* ### What "unpacked" means depends on the element type
|
|
13
|
+
*
|
|
14
|
+
* | `T` | the list holds | example |
|
|
15
|
+
* | --- | --- | --- |
|
|
16
|
+
* | a scalar (`number`, `string`, `Scalar`) | the argument's MEMBERS, blanks skipped | `NETWORKDAYS`'s holidays |
|
|
17
|
+
* | a range (`IRange`, `IReferenceRange`) | the argument's AREAS | `INDEX((A1:B2,C3:D4),…)` |
|
|
18
|
+
*
|
|
19
|
+
* Both are the same mechanism at different granularity — the marshaller picks the unit from the
|
|
20
|
+
* element type — and a blank drops out of either. The scalar case is the common one; the range case
|
|
21
|
+
* exists because a reference UNION is a single argument holding several areas, and a parameter that
|
|
22
|
+
* does not declare `Flatten` refuses one outright (`#REF!` — `ROWS((A1:A3,C1:C5))` in Excel).
|
|
23
|
+
*
|
|
24
|
+
* At the type level it is `T[]`, so the body reads the list directly.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* export function IRR(values: Flatten<number>, guess?: number): number { ... }
|
|
29
|
+
* export function NETWORKDAYS(start: Date, end: Date, holidays?: Flatten<Scalar>): number { ... }
|
|
30
|
+
* export function INDEX(array: Flatten<AcceptError<IRange>>, rowNum?: number, ...): any { ... }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export type Flatten<T> = T[];
|
|
34
|
+
//# sourceMappingURL=Flatten.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Flatten.d.ts","sourceRoot":"","sources":["../../../src/Flatten.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC"}
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { Scalar } from './Scalar';
|
|
2
|
+
import { FormulaError } from './FormulaError';
|
|
3
|
+
import { IRange } from './IRange';
|
|
4
|
+
import { IReferenceRange } from './IReferenceRange';
|
|
5
|
+
import { IFunction } from './IFunction';
|
|
6
|
+
import { IFormulaContext } from './IFormulaContext';
|
|
7
|
+
import { IRuntime } from './IRuntime';
|
|
8
|
+
import { LocaleProfile } from './LocaleProfile';
|
|
9
|
+
/**
|
|
10
|
+
* Default implementation of the IFormulaContext interface.
|
|
11
|
+
*
|
|
12
|
+
* @see IFormulaContext
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* This is a stubbed implementation of the IFormulaContext interface.
|
|
16
|
+
* Runtime engines should provide a complete implementation.
|
|
17
|
+
* @internal
|
|
18
|
+
* @hidden
|
|
19
|
+
*/
|
|
20
|
+
export declare class StubbedFormulaContext implements IFormulaContext {
|
|
21
|
+
/** @inheritdoc IFormulaContext.createRange */
|
|
22
|
+
createRange<TS extends Scalar = Scalar>(rows?: number, columns?: number, values?: Scalar | Scalar[][] | ((value: TS, coords: IRange.CellCoords, range: IRange<TS>) => TS)): IRange;
|
|
23
|
+
/** @inheritdoc IFormulaContext.getReference */
|
|
24
|
+
getReference(coords?: Readonly<IRange.Coords>, r1c1?: boolean): IReferenceRange;
|
|
25
|
+
/** @inheritdoc IFormulaContext.getResizedReference */
|
|
26
|
+
getResizedReference(anchor: Readonly<IRange.Coords>, rowCount: number, colCount: number): IReferenceRange;
|
|
27
|
+
/** @inheritdoc IFormulaContext.getNumberFormat */
|
|
28
|
+
getNumberFormat(formatText: string, value: Scalar): string;
|
|
29
|
+
/** @inheritdoc IFormulaContext.fromSerialDate */
|
|
30
|
+
fromSerialDate(serialDate: number, dateOnly?: boolean): Date;
|
|
31
|
+
/** @inheritdoc IFormulaContext.toSerialDate */
|
|
32
|
+
toSerialDate(date: Date, dateOnly?: boolean): number;
|
|
33
|
+
/** @inheritdoc IFormulaContext.getDateParts */
|
|
34
|
+
getDateParts(serialDate: number, reuseParts?: IFormulaContext.DateParts | boolean): IFormulaContext.DateParts;
|
|
35
|
+
/** @inheritdoc IFormulaContext.getSerialDate */
|
|
36
|
+
getSerialDate(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millis?: number): number;
|
|
37
|
+
/** @inheritdoc IFormulaContext.getNow */
|
|
38
|
+
getNow(): number;
|
|
39
|
+
/** @inheritdoc IFormulaContext.getValueAt */
|
|
40
|
+
getValueAt(row: number, column: number, sheetName?: string, options?: IRange.ValueOptions): Scalar | null;
|
|
41
|
+
/** @inheritdoc IFormulaContext.getEntireCoords */
|
|
42
|
+
getEntireCoords(): IRange.Coords;
|
|
43
|
+
/** @inheritdoc IFormulaContext.isValidDate */
|
|
44
|
+
isValidDate(value: any, jsDateOnly?: boolean): boolean;
|
|
45
|
+
/** @inheritdoc IFormulaContext.getRow */
|
|
46
|
+
getRow(): number;
|
|
47
|
+
/** @inheritdoc IFormulaContext.getColumn */
|
|
48
|
+
getColumn(): number;
|
|
49
|
+
/** @inheritdoc IFormulaContext.getFormulaAt */
|
|
50
|
+
getFormulaAt(row: number, column: number, sheetName?: string): string | null;
|
|
51
|
+
/** @inheritdoc IFormulaContext.getSpillAt */
|
|
52
|
+
getSpillAt(row: number, column: number, sheetName?: string): IReferenceRange | null;
|
|
53
|
+
/** @inheritdoc IFormulaContext.getSheetIndex */
|
|
54
|
+
getSheetIndex(sheet?: string | IReferenceRange): number;
|
|
55
|
+
/** @inheritdoc IFormulaContext.getSheetCount */
|
|
56
|
+
getSheetCount(): number | null;
|
|
57
|
+
/** @inheritdoc IFormulaContext.markVolatile */
|
|
58
|
+
markVolatile(): void;
|
|
59
|
+
/** @inheritdoc IFormulaContext.formatResults */
|
|
60
|
+
formatResults(numFmt: string): void;
|
|
61
|
+
/** @inheritdoc IFormulaContext.filterHidden */
|
|
62
|
+
filterHidden(range: IRange, axes?: IRange.AxisSelection): IRange;
|
|
63
|
+
/** @inheritdoc IFormulaContext.filterTotals */
|
|
64
|
+
filterTotals(range: IRange): IRange;
|
|
65
|
+
/** @inheritdoc IFormulaContext.getFunction */
|
|
66
|
+
getFunction(name: string): IFunction | null;
|
|
67
|
+
/** @inheritdoc IFormulaContext.getAddress */
|
|
68
|
+
getAddress(coords?: Readonly<IRange.FixableCoords | IRange.FixableCellCoords>, r1c1?: boolean): string;
|
|
69
|
+
/** @inheritdoc IFormulaContext.parseAsSerialDate */
|
|
70
|
+
parseAsSerialDate(textOrNumber: string | number, requireDate?: boolean): number;
|
|
71
|
+
/** @inheritdoc IFormulaContext.parseAsDate */
|
|
72
|
+
parseAsDate(serialOrString: string | number | Date | any, requireDate?: boolean): Date;
|
|
73
|
+
/** @inheritdoc IFormulaContext.parseAsNumber */
|
|
74
|
+
parseAsNumber(textOrNumber: Scalar, options?: IFormulaContext.ParseNumberOptions): number;
|
|
75
|
+
parseAsNumber(textOrNumber: Scalar | undefined, options?: IFormulaContext.ParseNumberOptions): number | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Unimplemented. See {@link IFormulaContext.createCriteria}.
|
|
78
|
+
*
|
|
79
|
+
* @remarks
|
|
80
|
+
* Unimplemented rather than approximated. Criteria parsing is the one rule that needs all three
|
|
81
|
+
* localization planes at once, and this stub has none of them — a "basic" version would answer
|
|
82
|
+
* plausibly and wrongly, where throwing names the actual mistake (evaluating criteria outside an
|
|
83
|
+
* installed scope).
|
|
84
|
+
*/
|
|
85
|
+
createCriteria(criteria: Scalar): IFormulaContext.CriteriaEvaluator;
|
|
86
|
+
/**
|
|
87
|
+
* Parses the canonical English boolean and error literals.
|
|
88
|
+
* See {@link IFormulaContext.parseAsLiteral}.
|
|
89
|
+
*
|
|
90
|
+
* @remarks
|
|
91
|
+
* CANONICAL English only, deliberately. The localized spellings live in a language pack, which
|
|
92
|
+
* `@sheetxl/sdk` resolves and this package cannot see — the engine reaches `parseBooleanLocal` /
|
|
93
|
+
* `parseErrorLocal` through the calculation context and never lands here. Canonical is always
|
|
94
|
+
* accepted there too, so this stub is that rule with the localized alternates missing.
|
|
95
|
+
*/
|
|
96
|
+
parseAsLiteral(text: string): boolean | FormulaError.Known | undefined;
|
|
97
|
+
/**
|
|
98
|
+
* Renders a scalar as text. See {@link IFormulaContext.toText}.
|
|
99
|
+
*
|
|
100
|
+
* @remarks
|
|
101
|
+
* A BASIC rendering, deliberately NOT Excel's. Excel's rule -- coercion General (15
|
|
102
|
+
* significant digits, plain decimal while the rendering fits 20 characters, else
|
|
103
|
+
* scientific) written with the workbook LOCALE's decimal separator -- is
|
|
104
|
+
* `formatNumberGeneral` in `@sheetxl/sdk`, and every evaluation path reaches it through
|
|
105
|
+
* the calculation context rather than through this stub. Numbers here get the plain JS
|
|
106
|
+
* rendering, which diverges from Excel on both precision and separator.
|
|
107
|
+
*
|
|
108
|
+
* This exists so authoring, type defs and other non-runtime access get usable text
|
|
109
|
+
* instead of throwing. Anything that needs Excel parity is running in the engine, and
|
|
110
|
+
* the engine never lands here.
|
|
111
|
+
*/
|
|
112
|
+
toText(value: Scalar | undefined): string;
|
|
113
|
+
/**
|
|
114
|
+
* Orders two scalars. See {@link IFormulaContext.compare}.
|
|
115
|
+
*
|
|
116
|
+
* @remarks
|
|
117
|
+
* A BASIC total order, deliberately NOT Excel's. Excel's rule -- locale collation, the word
|
|
118
|
+
* sort, a blank taking the other operand's type, 11-decimal numeric normalization -- is
|
|
119
|
+
* `ScalarCollation` in `@sheetxl/sdk`, and every evaluation path reaches it through the
|
|
120
|
+
* calculation context rather than through this stub. `options` is ignored: strength is a
|
|
121
|
+
* collation concept and nothing here collates.
|
|
122
|
+
*
|
|
123
|
+
* This exists so authoring, type defs and other non-runtime access get a usable ordering
|
|
124
|
+
* instead of throwing. Anything that needs Excel parity is running in the engine, and the
|
|
125
|
+
* engine never lands here.
|
|
126
|
+
*/
|
|
127
|
+
compare(a: Scalar, b: Scalar, options?: Intl.CollatorOptions): number;
|
|
128
|
+
/** @inheritdoc IFormulaContext.getRuntime */
|
|
129
|
+
getRuntime(): IRuntime;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* The single, shared {@link IFormulaContext} that formula implementations use (via
|
|
133
|
+
* `import { FormulaContext } from '@sheetxl/primitives'`).
|
|
134
|
+
*
|
|
135
|
+
* @remarks
|
|
136
|
+
* A thin delegate: every method forwards to the currently-installed scope. The runtime (the
|
|
137
|
+
* calculation engine) installs the active per-evaluation scope; outside a calculation it falls back
|
|
138
|
+
* to {@link StubbedFormulaContext}. `@sheetxl/primitives` owns the interface and a default; the
|
|
139
|
+
* runtime supplies the implementation.
|
|
140
|
+
*/
|
|
141
|
+
export declare class ScopedFormulaContext implements IFormulaContext {
|
|
142
|
+
protected _scope: Partial<IFormulaContext>;
|
|
143
|
+
/** @hidden Installed by the runtime around each evaluation; `null` restores the stub. */
|
|
144
|
+
_setScope(scope: Partial<IFormulaContext> | null): void;
|
|
145
|
+
/** @hidden */
|
|
146
|
+
_getScope(): Partial<IFormulaContext>;
|
|
147
|
+
/** @inheritdoc IFormulaContext.getNumberFormat */
|
|
148
|
+
getNumberFormat(formatText: string, value: Scalar): string | null;
|
|
149
|
+
/** @inheritdoc IFormulaContext.getEntireCoords */
|
|
150
|
+
getEntireCoords(): IRange.Coords;
|
|
151
|
+
/** @inheritdoc IFormulaContext.parseAsSerialDate */
|
|
152
|
+
parseAsSerialDate(textOrNumber: Scalar, requireDate?: boolean): number;
|
|
153
|
+
/** @inheritdoc IFormulaContext.parseAsDate */
|
|
154
|
+
parseAsDate(serialOrString: string | number | Date | any, requireDate?: boolean): Date;
|
|
155
|
+
/** @inheritdoc IFormulaContext.parseAsNumber */
|
|
156
|
+
parseAsNumber(textOrNumber: Scalar, options?: IFormulaContext.ParseNumberOptions): number;
|
|
157
|
+
parseAsNumber(textOrNumber: Scalar | undefined, options?: IFormulaContext.ParseNumberOptions): number | undefined;
|
|
158
|
+
/** @inheritdoc IFormulaContext.createCriteria */
|
|
159
|
+
createCriteria(criteria: Scalar): IFormulaContext.CriteriaEvaluator;
|
|
160
|
+
/** @inheritdoc IFormulaContext.parseAsLiteral */
|
|
161
|
+
parseAsLiteral(text: string): boolean | FormulaError.Known | undefined;
|
|
162
|
+
/** @inheritdoc IFormulaContext.toText */
|
|
163
|
+
toText(value: Scalar | undefined): string;
|
|
164
|
+
/** @inheritdoc IFormulaContext.isValidDate */
|
|
165
|
+
isValidDate(value: any, jsDateOnly?: boolean): boolean;
|
|
166
|
+
/** @inheritdoc IFormulaContext.fromSerialDate */
|
|
167
|
+
fromSerialDate(serialDate: number, dateOnly?: boolean): Date;
|
|
168
|
+
/** @inheritdoc IFormulaContext.toSerialDate */
|
|
169
|
+
toSerialDate(date: Date, dateOnly?: boolean): number;
|
|
170
|
+
/** @inheritdoc IFormulaContext.getDateParts */
|
|
171
|
+
getDateParts(serialDate: number, reuseParts?: IFormulaContext.DateParts | boolean): IFormulaContext.DateParts;
|
|
172
|
+
/** @inheritdoc IFormulaContext.getSerialDate */
|
|
173
|
+
getSerialDate(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millis?: number): number;
|
|
174
|
+
/** @inheritdoc IFormulaContext.getNow */
|
|
175
|
+
getNow(): number;
|
|
176
|
+
/** @inheritdoc IFormulaContext.createRange */
|
|
177
|
+
createRange<TS extends Scalar = Scalar>(rows?: number, columns?: number, values?: Scalar | Scalar[][] | ((value: TS, coords: IRange.CellCoords, range: IRange<TS>) => TS)): IRange;
|
|
178
|
+
/** @inheritdoc IFormulaContext.getRow */
|
|
179
|
+
getRow(): number;
|
|
180
|
+
/** @inheritdoc IFormulaContext.getColumn */
|
|
181
|
+
getColumn(): number;
|
|
182
|
+
/** @inheritdoc IFormulaContext.getReference */
|
|
183
|
+
getReference(coords?: Readonly<IRange.Coords>, r1c1?: boolean): IReferenceRange;
|
|
184
|
+
/** @inheritdoc IFormulaContext.getResizedReference */
|
|
185
|
+
getResizedReference(anchor: Readonly<IRange.Coords>, rowCount: number, colCount: number): IReferenceRange;
|
|
186
|
+
/** @inheritdoc IFormulaContext.getValueAt */
|
|
187
|
+
getValueAt(row: number, column: number, scope: string): Scalar | null;
|
|
188
|
+
/** @inheritdoc IFormulaContext.getFormulaAt */
|
|
189
|
+
getFormulaAt(row: number, column: number, scope: string): string | null;
|
|
190
|
+
/** @inheritdoc IFormulaContext.getSpillAt */
|
|
191
|
+
getSpillAt(row: number, column: number, scope: string): IReferenceRange | null;
|
|
192
|
+
/** @inheritdoc IFormulaContext.getSheetIndex */
|
|
193
|
+
getSheetIndex(sheet?: string | IReferenceRange): number;
|
|
194
|
+
/** @inheritdoc IFormulaContext.getSheetCount */
|
|
195
|
+
getSheetCount(): number | null;
|
|
196
|
+
/** @inheritdoc IFormulaContext.markVolatile */
|
|
197
|
+
markVolatile(): void;
|
|
198
|
+
/** @inheritdoc IFormulaContext.formatResults */
|
|
199
|
+
formatResults(numFmt: string): void;
|
|
200
|
+
/** @inheritdoc IFormulaContext.filterHidden */
|
|
201
|
+
filterHidden(range: IRange, axes?: IRange.AxisSelection): IRange;
|
|
202
|
+
/** @inheritdoc IFormulaContext.filterTotals */
|
|
203
|
+
filterTotals(range: IRange): IRange;
|
|
204
|
+
/** @inheritdoc IFormulaContext.getFunction */
|
|
205
|
+
getFunction(fnName: string): IFunction | null;
|
|
206
|
+
/** @inheritdoc IFormulaContext.getAddress */
|
|
207
|
+
getAddress(coords?: Readonly<IRange.FixableCoords | IRange.FixableCellCoords>, r1c1?: boolean): string;
|
|
208
|
+
/** @inheritdoc IFormulaContext.compare */
|
|
209
|
+
compare(a: Scalar, b: Scalar, options?: Intl.CollatorOptions): number;
|
|
210
|
+
/** @inheritdoc IFormulaContext.getRuntime */
|
|
211
|
+
getRuntime(): IRuntime;
|
|
212
|
+
get [Symbol.toStringTag](): string;
|
|
213
|
+
toString(): string;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* A plain en-US profile, for stubs and for environments without `Intl`.
|
|
217
|
+
*
|
|
218
|
+
* @remarks
|
|
219
|
+
* Deliberately static data -- no probing. Real profiles come from
|
|
220
|
+
* `makeLocaleProfile` in `@sheetxl/sdk`.
|
|
221
|
+
*/
|
|
222
|
+
export declare const DEFAULT_LOCALE_PROFILE: LocaleProfile;
|
|
223
|
+
/**
|
|
224
|
+
* The shared {@link IFormulaContext} for formula implementations. See {@link ScopedFormulaContext}.
|
|
225
|
+
*/
|
|
226
|
+
export declare const FormulaContext: IFormulaContext;
|
|
227
|
+
//# sourceMappingURL=FormulaContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormulaContext.d.ts","sourceRoot":"","sources":["../../../src/FormulaContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,UAAU,CAAC;AAGvC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD;;;;;;;;;;GAUG;AACH,qBAAa,qBAAsB,YAAW,eAAe;IAE3D,8CAA8C;IAC9C,WAAW,CAAC,EAAE,SAAS,MAAM,GAAC,MAAM,EAClC,IAAI,CAAC,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,MAAM,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