@gridsheet/preact-core 3.0.0-rc.0 → 3.0.0-rc.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/dist/components/ContextMenu.d.ts +1 -0
- package/dist/components/EditorOptions.d.ts +11 -0
- package/dist/components/FunctionGuide.d.ts +20 -0
- package/dist/components/useAutocomplete.d.ts +25 -0
- package/dist/constants.d.ts +1 -13
- package/dist/formula/evaluator.d.ts +10 -15
- package/dist/formula/formula-error.d.ts +10 -0
- package/dist/formula/functions/__async.d.ts +16 -8
- package/dist/formula/functions/__base.d.ts +102 -14
- package/dist/formula/functions/__utils.d.ts +4 -0
- package/dist/formula/functions/abs.d.ts +5 -8
- package/dist/formula/functions/add.d.ts +6 -9
- package/dist/formula/functions/and.d.ts +5 -15
- package/dist/formula/functions/arrayformula.d.ts +12 -0
- package/dist/formula/functions/average.d.ts +5 -15
- package/dist/formula/functions/concat.d.ts +5 -8
- package/dist/formula/functions/count.d.ts +4 -14
- package/dist/formula/functions/counta.d.ts +4 -14
- package/dist/formula/functions/divide.d.ts +5 -7
- package/dist/formula/functions/eq.d.ts +4 -7
- package/dist/formula/functions/gt.d.ts +5 -8
- package/dist/formula/functions/gte.d.ts +5 -8
- package/dist/formula/functions/if.d.ts +5 -13
- package/dist/formula/functions/iferror.d.ts +7 -17
- package/dist/formula/functions/len.d.ts +5 -8
- package/dist/formula/functions/lt.d.ts +5 -8
- package/dist/formula/functions/lte.d.ts +5 -8
- package/dist/formula/functions/max.d.ts +5 -15
- package/dist/formula/functions/min.d.ts +5 -15
- package/dist/formula/functions/minus.d.ts +7 -9
- package/dist/formula/functions/multiply.d.ts +5 -8
- package/dist/formula/functions/ne.d.ts +4 -7
- package/dist/formula/functions/not.d.ts +5 -8
- package/dist/formula/functions/now.d.ts +4 -4
- package/dist/formula/functions/or.d.ts +5 -15
- package/dist/formula/functions/power.d.ts +5 -8
- package/dist/formula/functions/sum.d.ts +5 -15
- package/dist/formula/functions/uminus.d.ts +5 -8
- package/dist/formula/mapping.d.ts +9 -1
- package/dist/formula/solver.d.ts +6 -4
- package/dist/index.d.ts +14 -14
- package/dist/index.js +7633 -6928
- package/dist/index.js.map +1 -1
- package/dist/lib/cell.d.ts +13 -1
- package/dist/lib/clipboard.d.ts +16 -1
- package/dist/lib/coords.d.ts +1 -1
- package/dist/lib/dom.d.ts +2 -0
- package/dist/lib/hub.d.ts +13 -25
- package/dist/lib/input.d.ts +9 -0
- package/dist/lib/operation.d.ts +0 -3
- package/dist/lib/spatial.d.ts +2 -0
- package/dist/lib/table.d.ts +77 -51
- package/dist/lib/time.d.ts +19 -15
- package/dist/policy/checkbox.d.ts +3 -0
- package/dist/policy/core.d.ts +136 -19
- package/dist/policy/thousand_separator.d.ts +4 -0
- package/dist/sentinels.d.ts +39 -0
- package/dist/store/actions.d.ts +12 -0
- package/dist/store/dispatchers.d.ts +2 -0
- package/dist/store/helpers.d.ts +4 -6
- package/dist/styles/minified.d.ts +2 -2
- package/dist/types.d.ts +26 -28
- package/package.json +1 -1
- package/dist/formula/functions/acos.d.ts +0 -12
- package/dist/formula/functions/asin.d.ts +0 -12
- package/dist/formula/functions/atan.d.ts +0 -12
- package/dist/formula/functions/atan2.d.ts +0 -12
- package/dist/formula/functions/col.d.ts +0 -13
- package/dist/formula/functions/concatenate.d.ts +0 -19
- package/dist/formula/functions/cos.d.ts +0 -12
- package/dist/formula/functions/countif.d.ts +0 -13
- package/dist/formula/functions/exp.d.ts +0 -12
- package/dist/formula/functions/hlookup.d.ts +0 -18
- package/dist/formula/functions/index.d.ts +0 -18
- package/dist/formula/functions/lenb.d.ts +0 -12
- package/dist/formula/functions/ln.d.ts +0 -12
- package/dist/formula/functions/log.d.ts +0 -12
- package/dist/formula/functions/log10.d.ts +0 -12
- package/dist/formula/functions/match.d.ts +0 -18
- package/dist/formula/functions/match.test.d.ts +0 -2
- package/dist/formula/functions/mod.d.ts +0 -12
- package/dist/formula/functions/pi.d.ts +0 -9
- package/dist/formula/functions/product.d.ts +0 -19
- package/dist/formula/functions/radians.d.ts +0 -12
- package/dist/formula/functions/rand.d.ts +0 -9
- package/dist/formula/functions/round.d.ts +0 -17
- package/dist/formula/functions/rounddown.d.ts +0 -17
- package/dist/formula/functions/roundup.d.ts +0 -17
- package/dist/formula/functions/row.d.ts +0 -13
- package/dist/formula/functions/sin.d.ts +0 -12
- package/dist/formula/functions/sqrt.d.ts +0 -12
- package/dist/formula/functions/sumif.d.ts +0 -18
- package/dist/formula/functions/tan.d.ts +0 -12
- package/dist/formula/functions/vlookup.d.ts +0 -18
- package/dist/parsers/core.d.ts +0 -38
- package/dist/renderers/checkbox.d.ts +0 -5
- package/dist/renderers/core.d.ts +0 -66
- package/dist/renderers/thousand_separator.d.ts +0 -3
|
@@ -3,6 +3,7 @@ import { ContextMenuProps } from '../types';
|
|
|
3
3
|
export declare const ContextMenu: () => JSX.Element | null;
|
|
4
4
|
export declare const DividerItem: (props: ContextMenuProps) => JSX.Element;
|
|
5
5
|
export declare const CutItem: (props: ContextMenuProps) => JSX.Element;
|
|
6
|
+
export declare const SearchItem: (props: ContextMenuProps) => JSX.Element;
|
|
6
7
|
export declare const CopyItem: (props: ContextMenuProps) => JSX.Element;
|
|
7
8
|
export declare const PasteItem: (props: ContextMenuProps) => JSX.Element;
|
|
8
9
|
export declare const PasteOnlyValueItem: (props: ContextMenuProps) => JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
interface EditorOptionsProps {
|
|
3
|
+
filteredOptions: any[];
|
|
4
|
+
top: number;
|
|
5
|
+
left: number;
|
|
6
|
+
selected: number;
|
|
7
|
+
onOptionMouseDown: (e: React.MouseEvent<HTMLLIElement>, i: number) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const EditorOptions: React.FC<EditorOptionsProps>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=EditorOptions.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { FunctionHelp } from '../formula/mapping';
|
|
3
|
+
import { AutocompleteOption } from '../policy/core';
|
|
4
|
+
type OptionWithGuide = AutocompleteOption & {
|
|
5
|
+
isFunction?: boolean;
|
|
6
|
+
example?: string;
|
|
7
|
+
category?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
defs?: any[];
|
|
10
|
+
};
|
|
11
|
+
export interface FunctionGuideProps {
|
|
12
|
+
option?: OptionWithGuide;
|
|
13
|
+
activeFunctionGuide?: FunctionHelp;
|
|
14
|
+
activeArgIndex?: number;
|
|
15
|
+
top?: number;
|
|
16
|
+
left?: number;
|
|
17
|
+
}
|
|
18
|
+
export declare const FunctionGuide: React.FC<FunctionGuideProps>;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=FunctionGuide.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { FunctionHelp } from '../formula/mapping';
|
|
2
|
+
import { FunctionMapping } from '../formula/functions/__base';
|
|
3
|
+
import { AutocompleteOption } from '../policy/core';
|
|
4
|
+
type UseAutocompleteProps = {
|
|
5
|
+
inputting: string;
|
|
6
|
+
selectionStart: number;
|
|
7
|
+
optionsAll: AutocompleteOption[];
|
|
8
|
+
functions?: FunctionMapping;
|
|
9
|
+
};
|
|
10
|
+
export declare const useAutocomplete: ({ inputting, selectionStart, optionsAll, functions }: UseAutocompleteProps) => {
|
|
11
|
+
filteredOptions: any[];
|
|
12
|
+
selected: number;
|
|
13
|
+
setSelected: import('react').Dispatch<import('react').SetStateAction<number>>;
|
|
14
|
+
replaceWithOption: (option: any) => {
|
|
15
|
+
value: string;
|
|
16
|
+
selectionStart: any;
|
|
17
|
+
};
|
|
18
|
+
handleArrowUp: (e: React.KeyboardEvent<HTMLTextAreaElement>) => boolean;
|
|
19
|
+
handleArrowDown: (e: React.KeyboardEvent<HTMLTextAreaElement>) => boolean;
|
|
20
|
+
isFormula: boolean;
|
|
21
|
+
activeFunctionHelp: FunctionHelp | null;
|
|
22
|
+
activeArgIndex: number;
|
|
23
|
+
};
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=useAutocomplete.d.ts.map
|
package/dist/constants.d.ts
CHANGED
|
@@ -11,20 +11,8 @@ export declare const MIN_HEIGHT = 5;
|
|
|
11
11
|
export declare const OVERSCAN_X = 5;
|
|
12
12
|
export declare const OVERSCAN_Y = 10;
|
|
13
13
|
export declare const DEFAULT_ALPHABET_CACHE_SIZE = 1000;
|
|
14
|
-
export declare class Special {
|
|
15
|
-
name: string;
|
|
16
|
-
constructor(name: string);
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Sentinel value representing an in-flight async formula computation.
|
|
20
|
-
* Cells whose solved cache contains a Pending will render a loading indicator.
|
|
21
|
-
* Dependent cells that encounter a Pending value also become pending.
|
|
22
|
-
*/
|
|
23
|
-
export declare class Pending {
|
|
24
|
-
promise: Promise<any>;
|
|
25
|
-
constructor(promise: Promise<any>);
|
|
26
|
-
}
|
|
27
14
|
export declare const SECONDS_IN_DAY = 86400;
|
|
28
15
|
export declare const FULLDATE_FORMAT_UTC = "YYYY-MM-DDTHH:mm:ss.SSSZ";
|
|
29
16
|
export declare const RESET_ZONE: ZoneType;
|
|
17
|
+
export declare const BASE_DATE: Date;
|
|
30
18
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Table } from '../lib/table';
|
|
2
|
-
import { Id
|
|
2
|
+
import { Id } from '../types';
|
|
3
3
|
type EvaluateProps = {
|
|
4
4
|
table: Table;
|
|
5
5
|
};
|
|
@@ -18,14 +18,6 @@ export type DisplayProps = {
|
|
|
18
18
|
slideY?: number;
|
|
19
19
|
slideX?: number;
|
|
20
20
|
};
|
|
21
|
-
export declare class FormulaError {
|
|
22
|
-
code: string;
|
|
23
|
-
message: string;
|
|
24
|
-
error?: Error;
|
|
25
|
-
__isFormulaError: boolean;
|
|
26
|
-
constructor(code: string, message: string, error?: Error);
|
|
27
|
-
static is(obj: any): boolean;
|
|
28
|
-
}
|
|
29
21
|
declare class Entity<T = any> {
|
|
30
22
|
value: T;
|
|
31
23
|
constructor(value: T);
|
|
@@ -66,8 +58,8 @@ export declare class FunctionEntity {
|
|
|
66
58
|
args: Expression[];
|
|
67
59
|
name: string;
|
|
68
60
|
precedence: number;
|
|
69
|
-
private
|
|
70
|
-
constructor(name: string, precedence?: number, args?: Expression[],
|
|
61
|
+
private at?;
|
|
62
|
+
constructor(name: string, precedence?: number, args?: Expression[], at?: Id);
|
|
71
63
|
evaluate({ table }: EvaluateProps): any;
|
|
72
64
|
}
|
|
73
65
|
export type Expression = ValueEntity | RefEntity | RangeEntity | IdEntity | IdRangeEntity | FunctionEntity | UnreferencedEntity | InvalidRefEntity;
|
|
@@ -76,14 +68,15 @@ export declare class Token {
|
|
|
76
68
|
type: TokenType;
|
|
77
69
|
entity: any;
|
|
78
70
|
precedence: number;
|
|
79
|
-
|
|
80
|
-
|
|
71
|
+
closed: boolean;
|
|
72
|
+
private at?;
|
|
73
|
+
constructor(type: TokenType, entity: any, precedence?: number, at?: Id, closed?: boolean);
|
|
81
74
|
length(): number;
|
|
82
75
|
stringify(): string;
|
|
83
76
|
convert(): ValueEntity | UnreferencedEntity | InvalidRefEntity | RefEntity | RangeEntity | IdEntity | IdRangeEntity | FunctionEntity | undefined;
|
|
84
77
|
}
|
|
85
78
|
type LexerOption = {
|
|
86
|
-
|
|
79
|
+
at?: Id;
|
|
87
80
|
idMap?: {
|
|
88
81
|
[id: Id]: Id;
|
|
89
82
|
};
|
|
@@ -93,7 +86,7 @@ export declare class Lexer {
|
|
|
93
86
|
private formula;
|
|
94
87
|
tokens: Token[];
|
|
95
88
|
foreign: boolean;
|
|
96
|
-
private
|
|
89
|
+
private at?;
|
|
97
90
|
private idMap;
|
|
98
91
|
constructor(formula: string, options?: LexerOption);
|
|
99
92
|
private isWhiteSpace;
|
|
@@ -118,6 +111,8 @@ export declare class Parser {
|
|
|
118
111
|
build(): Expression | undefined;
|
|
119
112
|
private parse;
|
|
120
113
|
}
|
|
114
|
+
/** Alias for Parser, exported for external tooling (e.g. Debugger). */
|
|
115
|
+
export declare const FormulaParser: typeof Parser;
|
|
121
116
|
export declare const identifyFormula: (value: any, { idMap, ...props }: IdentifyProps) => any;
|
|
122
117
|
export declare const stripSheetName: (sheetName: string) => string;
|
|
123
118
|
export declare function splitRef(ref: string): {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class FormulaError {
|
|
2
|
+
code: string;
|
|
3
|
+
message: string;
|
|
4
|
+
error?: Error;
|
|
5
|
+
__isFormulaError: boolean;
|
|
6
|
+
constructor(code: string, message: string, error?: Error);
|
|
7
|
+
static is(obj: any): obj is FormulaError;
|
|
8
|
+
toString(): string;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=formula-error.d.ts.map
|
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
import { Pending,
|
|
1
|
+
import { Pending, Sentinel } from '../../sentinels';
|
|
2
2
|
import { Wire } from '../../lib/hub';
|
|
3
|
-
import { PointType } from '../../types';
|
|
3
|
+
import { Id, PointType } from '../../types';
|
|
4
4
|
/**
|
|
5
5
|
* Sentinel value to distinguish cache miss from user-returned undefined/null.
|
|
6
6
|
* Since user functions can return undefined or null, we need a special marker
|
|
7
7
|
* to indicate "no cache entry found" vs "cache entry is undefined".
|
|
8
8
|
*/
|
|
9
|
-
export declare const asyncCacheMiss:
|
|
9
|
+
export declare const asyncCacheMiss: Sentinel;
|
|
10
10
|
/** Returns true if any element of `args` is a Pending sentinel. */
|
|
11
11
|
export declare const hasPendingArg: (args: any[]) => boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Recursively check whether any value in the structure is a Pending sentinel.
|
|
14
|
+
* Handles flat values, nested arrays, and Table objects (via getFieldMatrix).
|
|
15
|
+
*/
|
|
16
|
+
export declare const hasDeepPending: (values: any[], at: Id) => boolean;
|
|
12
17
|
/**
|
|
13
18
|
* Build a cache key from function name + hashed serialised arguments.
|
|
14
19
|
*
|
|
@@ -20,7 +25,7 @@ export declare const hasPendingArg: (args: any[]) => boolean;
|
|
|
20
25
|
* value matrix (`any[][]`) via `getFieldMatrix()` so the key reflects the
|
|
21
26
|
* actual cell values the function will operate on.
|
|
22
27
|
*/
|
|
23
|
-
export declare const buildAsyncCacheKey: (funcName: string,
|
|
28
|
+
export declare const buildAsyncCacheKey: (funcName: string, args: any[], hashPrecision?: number) => string;
|
|
24
29
|
/**
|
|
25
30
|
* Try to retrieve a cached or pending async result for the given cache key.
|
|
26
31
|
*
|
|
@@ -32,25 +37,28 @@ export declare const buildAsyncCacheKey: (funcName: string, bareArgs: any[], has
|
|
|
32
37
|
export declare const getAsyncCache: (table: {
|
|
33
38
|
wire: Wire;
|
|
34
39
|
getId: (p: PointType) => string;
|
|
35
|
-
},
|
|
40
|
+
}, id: Id, key: string, useInflight?: boolean) => any;
|
|
36
41
|
/**
|
|
37
42
|
* Handle an async (Promise) result returned by BaseFunction.main().
|
|
38
43
|
*
|
|
39
44
|
* Cache is stored per-cell in cell.asyncCache.
|
|
40
45
|
* In-flight tracking uses Wire.asyncPending (keyed by cell ID).
|
|
46
|
+
* If useInflight is true, also tracks by cache key in Wire.asyncInflight.
|
|
41
47
|
*
|
|
42
48
|
* Flow:
|
|
43
49
|
* 1. If cell has asyncCache and the key matches (inputs unchanged) and not expired → return cached value
|
|
44
50
|
* 2. If there is already an in-flight promise for this cell → return its Pending
|
|
45
|
-
* 3.
|
|
51
|
+
* 3. If useInflight is true and there is an in-flight promise for this key → return its Pending
|
|
52
|
+
* 4. Otherwise start the async work, return a new Pending, and on completion
|
|
46
53
|
* write the result into cell.asyncCache and trigger a re-render.
|
|
47
54
|
*
|
|
48
55
|
* @param ttlMilliseconds - Cache time-to-live in **milliseconds**. undefined = never expires.
|
|
56
|
+
* @param useInflight - If true, reuse the same promise for matching cache keys across different cells.
|
|
49
57
|
*/
|
|
50
|
-
export declare const
|
|
58
|
+
export declare const awaitAndSave: (promise: Promise<any>, table: {
|
|
51
59
|
wire: Wire;
|
|
52
60
|
getId: (p: PointType) => string;
|
|
53
|
-
},
|
|
61
|
+
}, id: Id, key: string, ttlMilliseconds?: number, useInflight?: boolean) => Pending;
|
|
54
62
|
/**
|
|
55
63
|
* Create a Pending sentinel that resolves immediately.
|
|
56
64
|
* Used when an argument is already pending — the result is propagated.
|
|
@@ -1,29 +1,117 @@
|
|
|
1
1
|
import { Table } from '../../lib/table';
|
|
2
|
-
import {
|
|
2
|
+
import { Id } from '../../types';
|
|
3
3
|
import { Expression } from '../evaluator';
|
|
4
|
+
/** Duck-type check for Table instances (avoids runtime import cycle). */
|
|
5
|
+
export declare const isTable: (v: any) => v is Table;
|
|
6
|
+
export type FunctionCategory = 'math' | 'statistics' | 'text' | 'time' | 'lookup' | 'information' | 'finance' | 'engineering' | 'logical' | 'other';
|
|
4
7
|
export type FunctionProps = {
|
|
5
8
|
args: Expression[];
|
|
6
9
|
table: Table;
|
|
7
|
-
|
|
10
|
+
at?: Id;
|
|
8
11
|
};
|
|
12
|
+
export type FunctionArgumentType = 'number' | 'string' | 'boolean' | 'date' | 'time' | 'matrix' | 'reference' | 'any';
|
|
13
|
+
export type FunctionArgumentDefinition = {
|
|
14
|
+
name: string;
|
|
15
|
+
description: string;
|
|
16
|
+
optional?: boolean;
|
|
17
|
+
nullable?: boolean;
|
|
18
|
+
variadic?: boolean;
|
|
19
|
+
errorTolerant?: boolean;
|
|
20
|
+
acceptedTypes?: FunctionArgumentType[];
|
|
21
|
+
/** When true, this argument takes a range/matrix value — broadcasting is suppressed for it. */
|
|
22
|
+
takesMatrix?: boolean;
|
|
23
|
+
};
|
|
24
|
+
export declare const conditionArg: FunctionArgumentDefinition;
|
|
25
|
+
/**
|
|
26
|
+
* Check if a value is a "matrix" (Table, Spilling, or 2D array).
|
|
27
|
+
*/
|
|
28
|
+
export declare const isMatrix: (value: any) => boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Extract the scalar from a 1×1 matrix (Table, Spilling, or plain 2D array).
|
|
31
|
+
* Returns the value unchanged if it is not a matrix.
|
|
32
|
+
*/
|
|
33
|
+
export declare const stripMatrix: (value: any, at: Id) => any;
|
|
34
|
+
/**
|
|
35
|
+
* Check if a value is a matrix that is larger than 1×1.
|
|
36
|
+
*/
|
|
37
|
+
export declare const isMultiCell: (value: any) => boolean;
|
|
9
38
|
export declare class BaseFunction {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
39
|
+
defs: FunctionArgumentDefinition[];
|
|
40
|
+
example: string | undefined;
|
|
41
|
+
description: string;
|
|
42
|
+
category: FunctionCategory;
|
|
43
|
+
/** Indicates if this function is async. Override in subclass or use BaseFunctionAsync. */
|
|
44
|
+
protected isAsync: boolean;
|
|
16
45
|
/** Cache TTL in milliseconds. Override in subclass to set expiry. undefined = never expires. */
|
|
17
46
|
protected ttlMilliseconds?: number;
|
|
18
47
|
/** Hash precision for cache key generation. Higher values reduce collision risk. Default: 1 */
|
|
19
48
|
protected hashPrecision: number;
|
|
20
|
-
|
|
21
|
-
protected
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
protected
|
|
25
|
-
|
|
49
|
+
/** If true, reuse the same in-flight promise for matching cache keys across different cells. */
|
|
50
|
+
protected useInflight: boolean;
|
|
51
|
+
/** If true, broadcasting is unconditionally disabled for this function. */
|
|
52
|
+
protected broadcastDisabled: boolean;
|
|
53
|
+
protected args: any[];
|
|
54
|
+
protected autoSpilling: boolean;
|
|
55
|
+
table: Table;
|
|
56
|
+
at: Id;
|
|
57
|
+
static __name: string;
|
|
58
|
+
constructor({ args, table, at }: FunctionProps);
|
|
59
|
+
private _main;
|
|
60
|
+
/**
|
|
61
|
+
* Validate and normalise arguments before `main()` is called.
|
|
62
|
+
*
|
|
63
|
+
* Checks:
|
|
64
|
+
* 1. Argument count satisfies defs (respecting optional / variadic).
|
|
65
|
+
* 2. Each argument's runtime type matches the corresponding def's `type` list.
|
|
66
|
+
*
|
|
67
|
+
* Subclasses may override for additional coercion / spreading.
|
|
68
|
+
*/
|
|
69
|
+
protected validate(args: any[]): any[];
|
|
70
|
+
eachMatrix: (value: any, callback: (v: any) => void) => void;
|
|
71
|
+
/**
|
|
72
|
+
* Extract a 2D array from a matrix value (Spilling, Table, or nested array).
|
|
73
|
+
* Default behavior for Table is value.solve(). Functions like COL can override
|
|
74
|
+
* this to preserve Table metadata per cell.
|
|
75
|
+
*/
|
|
76
|
+
protected toMatrix(value: any): any[][];
|
|
77
|
+
/**
|
|
78
|
+
* Collapse a 1×1 matrix value (Table, Spilling, or 2D array) to a scalar.
|
|
79
|
+
* Non-matrix values pass through unchanged.
|
|
80
|
+
*
|
|
81
|
+
* Override in sub-classes that need the original Table / reference
|
|
82
|
+
* metadata (e.g. COL, ROW) — for instance, to extract position
|
|
83
|
+
* information before collapsing.
|
|
84
|
+
*/
|
|
85
|
+
protected toScalar(value: any): any;
|
|
26
86
|
call(): any;
|
|
87
|
+
/**
|
|
88
|
+
* If any broadcastable argument is a matrix (multi-cell), expand the call
|
|
89
|
+
* across all element positions and return a Spilling.
|
|
90
|
+
* Returns `undefined` when no broadcast is necessary.
|
|
91
|
+
*
|
|
92
|
+
* Rules:
|
|
93
|
+
* - broadcastDisabled = true → never broadcast
|
|
94
|
+
* - An arg is broadcastable when its corresponding args[].takesMatrix is not true
|
|
95
|
+
* - A Table/Spilling/2D-array whose size is (1,1) is treated as a scalar
|
|
96
|
+
* (not broadcast); only multi-cell matrices trigger broadcast
|
|
97
|
+
* - For variadic args, extra args are assigned round-robin
|
|
98
|
+
* across the variadic helpArg positions
|
|
99
|
+
*/
|
|
100
|
+
private broadcast;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Base class for sync functions.
|
|
104
|
+
* Extend this class to create sync functions that support caching.
|
|
105
|
+
*/
|
|
106
|
+
export declare class BaseFunctionSync extends BaseFunction {
|
|
107
|
+
protected isAsync: boolean;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Base class for async functions.
|
|
111
|
+
* Extend this class to create async functions that support caching.
|
|
112
|
+
*/
|
|
113
|
+
export declare class BaseFunctionAsync extends BaseFunction {
|
|
114
|
+
protected isAsync: boolean;
|
|
27
115
|
}
|
|
28
116
|
export type FunctionMapping = {
|
|
29
117
|
[functionName: string]: typeof BaseFunction;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Table } from '../../lib/table';
|
|
2
|
+
import { Id, PointType } from '../../types';
|
|
1
3
|
export declare const gt: (left: any, right: any) => boolean;
|
|
2
4
|
export declare const gte: (left: any, right: any) => boolean;
|
|
3
5
|
export declare const lt: (left: any, right: any) => boolean;
|
|
@@ -16,4 +18,6 @@ export declare const ensureNumber: (value: any, options?: EnsureNumberOptions) =
|
|
|
16
18
|
export declare const ensureString: (value: any) => string;
|
|
17
19
|
export declare const ensureBoolean: (value: any, options?: EnsureBooleanOptions) => boolean;
|
|
18
20
|
export declare const check: (value: any, condition: string) => boolean;
|
|
21
|
+
export declare const eachMatrix: (value: any, callback: (v: any, relativePoint: PointType) => void, at: Id) => void;
|
|
22
|
+
export declare const createBooleanMask: (tables: Table[], conditions: string[], at: Id) => boolean[][];
|
|
19
23
|
//# sourceMappingURL=__utils.d.ts.map
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { BaseFunction } from './__base';
|
|
1
|
+
import { BaseFunction, FunctionCategory, FunctionArgumentDefinition } from './__base';
|
|
2
2
|
export declare class AbsFunction extends BaseFunction {
|
|
3
3
|
example: string;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}[];
|
|
9
|
-
protected validate(): void;
|
|
10
|
-
protected main(value: number): number;
|
|
4
|
+
description: string;
|
|
5
|
+
defs: FunctionArgumentDefinition[];
|
|
6
|
+
category: FunctionCategory;
|
|
7
|
+
protected main(value: any): number;
|
|
11
8
|
}
|
|
12
9
|
//# sourceMappingURL=abs.d.ts.map
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import { BaseFunction } from './__base';
|
|
2
|
-
import {
|
|
1
|
+
import { BaseFunction, FunctionCategory, FunctionArgumentDefinition } from './__base';
|
|
2
|
+
import { Time } from '../../lib/time';
|
|
3
3
|
export declare class AddFunction extends BaseFunction {
|
|
4
4
|
example: string;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}[];
|
|
10
|
-
protected validate(): void;
|
|
11
|
-
protected main(v1: number | Date | TimeDelta, v2: number | Date | TimeDelta): number | Date;
|
|
5
|
+
description: string;
|
|
6
|
+
defs: FunctionArgumentDefinition[];
|
|
7
|
+
category: FunctionCategory;
|
|
8
|
+
protected main(v1: number | Date | Time, v2: number | Date | Time): number | Date;
|
|
12
9
|
}
|
|
13
10
|
//# sourceMappingURL=add.d.ts.map
|
|
@@ -1,19 +1,9 @@
|
|
|
1
|
-
import { BaseFunction } from './__base';
|
|
1
|
+
import { BaseFunction, FunctionCategory, FunctionArgumentDefinition } from './__base';
|
|
2
2
|
export declare class AndFunction extends BaseFunction {
|
|
3
3
|
example: string;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
optional?: undefined;
|
|
9
|
-
iterable?: undefined;
|
|
10
|
-
} | {
|
|
11
|
-
name: string;
|
|
12
|
-
description: string;
|
|
13
|
-
optional: boolean;
|
|
14
|
-
iterable: boolean;
|
|
15
|
-
})[];
|
|
16
|
-
protected validate(): void;
|
|
17
|
-
protected main(...values: boolean[]): boolean;
|
|
4
|
+
description: string;
|
|
5
|
+
defs: FunctionArgumentDefinition[];
|
|
6
|
+
category: FunctionCategory;
|
|
7
|
+
protected main(...values: any[]): boolean;
|
|
18
8
|
}
|
|
19
9
|
//# sourceMappingURL=and.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Spilling } from '../../sentinels';
|
|
2
|
+
import { BaseFunction, FunctionCategory, FunctionArgumentDefinition } from './__base';
|
|
3
|
+
export declare class ArrayformulaFunction extends BaseFunction {
|
|
4
|
+
autoSpilling: boolean;
|
|
5
|
+
example: string;
|
|
6
|
+
description: string;
|
|
7
|
+
defs: FunctionArgumentDefinition[];
|
|
8
|
+
category: FunctionCategory;
|
|
9
|
+
protected broadcastDisabled: boolean;
|
|
10
|
+
protected main(value: any): any[] | Spilling;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=arrayformula.d.ts.map
|
|
@@ -1,19 +1,9 @@
|
|
|
1
|
-
import { BaseFunction } from './__base';
|
|
1
|
+
import { BaseFunction, FunctionCategory, FunctionArgumentDefinition } from './__base';
|
|
2
2
|
export declare class AverageFunction extends BaseFunction {
|
|
3
3
|
example: string;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
optional?: undefined;
|
|
9
|
-
iterable?: undefined;
|
|
10
|
-
} | {
|
|
11
|
-
name: string;
|
|
12
|
-
description: string;
|
|
13
|
-
optional: boolean;
|
|
14
|
-
iterable: boolean;
|
|
15
|
-
})[];
|
|
16
|
-
protected validate(): void;
|
|
17
|
-
protected main(...values: number[]): number;
|
|
4
|
+
description: string;
|
|
5
|
+
defs: FunctionArgumentDefinition[];
|
|
6
|
+
category: FunctionCategory;
|
|
7
|
+
protected main(...values: any[]): number;
|
|
18
8
|
}
|
|
19
9
|
//# sourceMappingURL=average.d.ts.map
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { BaseFunction } from './__base';
|
|
1
|
+
import { BaseFunction, FunctionCategory, FunctionArgumentDefinition } from './__base';
|
|
2
2
|
export declare class ConcatFunction extends BaseFunction {
|
|
3
3
|
example: string;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}[];
|
|
9
|
-
protected validate(): void;
|
|
10
|
-
protected main(v1: string, v2: string): string;
|
|
4
|
+
description: string;
|
|
5
|
+
defs: FunctionArgumentDefinition[];
|
|
6
|
+
category: FunctionCategory;
|
|
7
|
+
protected main(v1: any, v2: any): string;
|
|
11
8
|
}
|
|
12
9
|
//# sourceMappingURL=concat.d.ts.map
|
|
@@ -1,19 +1,9 @@
|
|
|
1
|
-
import { BaseFunction } from './__base';
|
|
1
|
+
import { BaseFunction, FunctionCategory, FunctionArgumentDefinition } from './__base';
|
|
2
2
|
export declare class CountFunction extends BaseFunction {
|
|
3
3
|
example: string;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
description: string;
|
|
8
|
-
optional?: undefined;
|
|
9
|
-
iterable?: undefined;
|
|
10
|
-
} | {
|
|
11
|
-
name: string;
|
|
12
|
-
description: string;
|
|
13
|
-
optional: boolean;
|
|
14
|
-
iterable: boolean;
|
|
15
|
-
})[];
|
|
16
|
-
protected validate(): void;
|
|
4
|
+
description: string;
|
|
5
|
+
defs: FunctionArgumentDefinition[];
|
|
6
|
+
category: FunctionCategory;
|
|
17
7
|
protected main(...values: any[]): number;
|
|
18
8
|
}
|
|
19
9
|
//# sourceMappingURL=count.d.ts.map
|
|
@@ -1,19 +1,9 @@
|
|
|
1
|
-
import { BaseFunction } from './__base';
|
|
1
|
+
import { BaseFunction, FunctionCategory, FunctionArgumentDefinition } from './__base';
|
|
2
2
|
export declare class CountaFunction extends BaseFunction {
|
|
3
3
|
example: string;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
description: string;
|
|
8
|
-
optional?: undefined;
|
|
9
|
-
iterable?: undefined;
|
|
10
|
-
} | {
|
|
11
|
-
name: string;
|
|
12
|
-
description: string;
|
|
13
|
-
optional: boolean;
|
|
14
|
-
iterable: boolean;
|
|
15
|
-
})[];
|
|
16
|
-
protected validate(): void;
|
|
4
|
+
description: string;
|
|
5
|
+
defs: FunctionArgumentDefinition[];
|
|
6
|
+
category: FunctionCategory;
|
|
17
7
|
protected main(...values: any[]): number;
|
|
18
8
|
}
|
|
19
9
|
//# sourceMappingURL=counta.d.ts.map
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { BaseFunction } from './__base';
|
|
1
|
+
import { BaseFunction, FunctionCategory, FunctionArgumentDefinition } from './__base';
|
|
2
2
|
export declare class DivideFunction extends BaseFunction {
|
|
3
3
|
example: string;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}[];
|
|
9
|
-
protected validate(): void;
|
|
4
|
+
description: string;
|
|
5
|
+
defs: FunctionArgumentDefinition[];
|
|
6
|
+
category: FunctionCategory;
|
|
7
|
+
protected validate(args: any[]): any[];
|
|
10
8
|
protected main(divided: number, divisor: number): number;
|
|
11
9
|
}
|
|
12
10
|
//# sourceMappingURL=divide.d.ts.map
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { BaseFunction } from './__base';
|
|
1
|
+
import { BaseFunction, FunctionCategory, FunctionArgumentDefinition } from './__base';
|
|
2
2
|
export declare class EqFunction extends BaseFunction {
|
|
3
3
|
example: string;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
description: string;
|
|
8
|
-
}[];
|
|
9
|
-
protected validate(): void;
|
|
4
|
+
description: string;
|
|
5
|
+
defs: FunctionArgumentDefinition[];
|
|
6
|
+
category: FunctionCategory;
|
|
10
7
|
protected main(v1: any, v2: any): boolean;
|
|
11
8
|
}
|
|
12
9
|
//# sourceMappingURL=eq.d.ts.map
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { BaseFunction } from './__base';
|
|
1
|
+
import { BaseFunction, FunctionCategory, FunctionArgumentDefinition } from './__base';
|
|
2
2
|
export declare class GtFunction extends BaseFunction {
|
|
3
3
|
example: string;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}[];
|
|
9
|
-
protected validate(): void;
|
|
10
|
-
protected main(v1: number, v2: number): boolean;
|
|
4
|
+
description: string;
|
|
5
|
+
defs: FunctionArgumentDefinition[];
|
|
6
|
+
category: FunctionCategory;
|
|
7
|
+
protected main(v1: any, v2: any): boolean;
|
|
11
8
|
}
|
|
12
9
|
//# sourceMappingURL=gt.d.ts.map
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { BaseFunction } from './__base';
|
|
1
|
+
import { BaseFunction, FunctionCategory, FunctionArgumentDefinition } from './__base';
|
|
2
2
|
export declare class GteFunction extends BaseFunction {
|
|
3
3
|
example: string;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}[];
|
|
9
|
-
protected validate(): void;
|
|
10
|
-
protected main(v1: number, v2: number): boolean;
|
|
4
|
+
description: string;
|
|
5
|
+
defs: FunctionArgumentDefinition[];
|
|
6
|
+
category: FunctionCategory;
|
|
7
|
+
protected main(v1: any, v2: any): boolean;
|
|
11
8
|
}
|
|
12
9
|
//# sourceMappingURL=gte.d.ts.map
|
|
@@ -1,17 +1,9 @@
|
|
|
1
|
-
import { BaseFunction } from './__base';
|
|
1
|
+
import { BaseFunction, FunctionCategory, FunctionArgumentDefinition } from './__base';
|
|
2
2
|
export declare class IfFunction extends BaseFunction {
|
|
3
3
|
example: string;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
optional?: undefined;
|
|
9
|
-
} | {
|
|
10
|
-
name: string;
|
|
11
|
-
description: string;
|
|
12
|
-
optional: boolean;
|
|
13
|
-
})[];
|
|
14
|
-
protected validate(): void;
|
|
15
|
-
protected main(condition: boolean, v1: any, v2?: any): any;
|
|
4
|
+
description: string;
|
|
5
|
+
defs: FunctionArgumentDefinition[];
|
|
6
|
+
category: FunctionCategory;
|
|
7
|
+
protected main(condition: any, v1: any, v2?: any): any;
|
|
16
8
|
}
|
|
17
9
|
//# sourceMappingURL=if.d.ts.map
|