@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
package/dist/lib/cell.d.ts
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
-
import { CellType } from '../types';
|
|
1
|
+
import { AsyncCache, CellType, System } from '../types';
|
|
2
2
|
export declare const filterCellFields: (cell: CellType, ignoreFields: (keyof CellType)[]) => CellType;
|
|
3
|
+
/**
|
|
4
|
+
* Ensure that `cell._sys` exists, initialising it with sensible defaults
|
|
5
|
+
* when missing. Any keys present in `defaults` that are absent on the
|
|
6
|
+
* existing `_sys` object are filled in.
|
|
7
|
+
* Returns the (possibly freshly-created) `System` object.
|
|
8
|
+
*/
|
|
9
|
+
export declare const ensureSys: (cell: CellType, defaults?: Partial<System>) => System;
|
|
10
|
+
/**
|
|
11
|
+
* Write an `AsyncCache` entry into `cell.asyncCaches[key]`, creating the
|
|
12
|
+
* `asyncCaches` record if it does not yet exist.
|
|
13
|
+
*/
|
|
14
|
+
export declare const setAsyncCache: (cell: CellType, key: string, ac: AsyncCache) => void;
|
|
3
15
|
//# sourceMappingURL=cell.d.ts.map
|
package/dist/lib/clipboard.d.ts
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
-
import { StoreType, AreaType } from '../types';
|
|
1
|
+
import { StoreType, AreaType, PointType } from '../types';
|
|
2
|
+
import { UserTable } from './table';
|
|
2
3
|
export declare const clip: (store: StoreType) => AreaType;
|
|
4
|
+
export type TableCSVProps = {
|
|
5
|
+
getter?: (table: UserTable, point: PointType) => string;
|
|
6
|
+
filteredRowsIncluded?: boolean;
|
|
7
|
+
trailingEmptyRowsOmitted?: boolean;
|
|
8
|
+
separator?: string;
|
|
9
|
+
newline?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const table2csv: (table: UserTable, { getter, filteredRowsIncluded, trailingEmptyRowsOmitted, separator, newline, }?: TableCSVProps) => string;
|
|
12
|
+
export type TableHTMLProps = {
|
|
13
|
+
getter?: (table: UserTable, point: PointType) => string;
|
|
14
|
+
filteredRowsIncluded?: boolean;
|
|
15
|
+
trailingEmptyRowsOmitted?: boolean;
|
|
16
|
+
};
|
|
17
|
+
export declare const table2html: (table: UserTable, { getter, filteredRowsIncluded, trailingEmptyRowsOmitted, }?: TableHTMLProps) => string;
|
|
3
18
|
//# sourceMappingURL=clipboard.d.ts.map
|
package/dist/lib/coords.d.ts
CHANGED
|
@@ -5,6 +5,6 @@ export declare const y2r: (y: number) => string;
|
|
|
5
5
|
export declare const r2y: (row: number | string, absolute?: boolean) => number;
|
|
6
6
|
export declare const p2a: ({ y, x, absX, absY }: ExtraPointType) => string;
|
|
7
7
|
export declare const a2p: (address: Address) => ExtraPointType;
|
|
8
|
-
export declare const grantAddressAbsolute: (address: Address, absCol: boolean, absRow: boolean) => string
|
|
8
|
+
export declare const grantAddressAbsolute: (address: Address, absCol: boolean, absRow: boolean) => string;
|
|
9
9
|
export declare const stripAddressAbsolute: (address: Address) => string;
|
|
10
10
|
//# sourceMappingURL=coords.d.ts.map
|
package/dist/lib/hub.d.ts
CHANGED
|
@@ -1,22 +1,11 @@
|
|
|
1
|
-
import { Pending } from '../
|
|
2
|
-
import { HistoryType, RefPaletteType, SheetIdsByName, ContextsBySheetId, ZoneType, CellsByIdType, Id,
|
|
3
|
-
import { UserTable
|
|
1
|
+
import { Pending } from '../sentinels';
|
|
2
|
+
import { HistoryType, RefPaletteType, SheetIdsByName, ContextsBySheetId, ZoneType, CellsByIdType, Id, FeedbackType, EditorEvent, CursorStateType } from '../types';
|
|
3
|
+
import { UserTable } from './table';
|
|
4
4
|
import { FunctionMapping } from '../formula/functions/__base';
|
|
5
5
|
import { PolicyType } from '../policy/core';
|
|
6
|
-
import { RendererType } from '../renderers/core';
|
|
7
|
-
import { ParserType } from '../parsers/core';
|
|
8
6
|
export type WireProps = {
|
|
9
7
|
historyLimit?: number;
|
|
10
8
|
additionalFunctions?: FunctionMapping;
|
|
11
|
-
renderers?: {
|
|
12
|
-
[rendererName: string]: RendererType | null;
|
|
13
|
-
};
|
|
14
|
-
parsers?: {
|
|
15
|
-
[parserName: string]: ParserType | null;
|
|
16
|
-
};
|
|
17
|
-
labelers?: {
|
|
18
|
-
[labelerName: string]: ((n: number) => string) | null;
|
|
19
|
-
};
|
|
20
9
|
policies?: {
|
|
21
10
|
[policyName: string]: PolicyType | null;
|
|
22
11
|
};
|
|
@@ -65,8 +54,17 @@ export declare class Wire {
|
|
|
65
54
|
};
|
|
66
55
|
lastFocused: HTMLTextAreaElement | null;
|
|
67
56
|
solvedCaches: Map<Id, any>;
|
|
57
|
+
/** Maps each cell id to the set of cell ids whose formula depends on it. */
|
|
58
|
+
dependents: Map<Id, Set<Id>>;
|
|
59
|
+
/** IDs of non-origin cells that received spilled values (populated in spill(), cleared in clearSolvedCaches()). */
|
|
60
|
+
lastSpilledTargetIds: Set<Id>;
|
|
68
61
|
/** Currently in-flight async formula Pending sentinels (keyed by cell ID). */
|
|
69
62
|
asyncPending: Map<string, Pending>;
|
|
63
|
+
/** In-flight async formulas shared by cache key (for useInflight). */
|
|
64
|
+
asyncInflight?: Map<string, {
|
|
65
|
+
pending: Pending;
|
|
66
|
+
expireTime?: number;
|
|
67
|
+
}>;
|
|
70
68
|
copyingSheetId: number;
|
|
71
69
|
copyingZone: ZoneType;
|
|
72
70
|
cutting: boolean;
|
|
@@ -77,15 +75,6 @@ export declare class Wire {
|
|
|
77
75
|
currentHistory?: HistoryType;
|
|
78
76
|
ready: boolean;
|
|
79
77
|
functions: FunctionMapping;
|
|
80
|
-
renderers: {
|
|
81
|
-
[rendererName: string]: RendererType | null;
|
|
82
|
-
};
|
|
83
|
-
parsers: {
|
|
84
|
-
[parserName: string]: ParserType | null;
|
|
85
|
-
};
|
|
86
|
-
labelers: {
|
|
87
|
-
[labelerName: string]: ((n: number) => string) | null;
|
|
88
|
-
};
|
|
89
78
|
policies: {
|
|
90
79
|
[policyName: string]: PolicyType | null;
|
|
91
80
|
};
|
|
@@ -119,8 +108,7 @@ export declare class Wire {
|
|
|
119
108
|
}) => void;
|
|
120
109
|
transmit: (newHub?: TransmitProps) => void;
|
|
121
110
|
identifyFormula(): void;
|
|
122
|
-
|
|
123
|
-
constructor({ historyLimit, additionalFunctions, renderers, parsers, labelers, policies, onSave, onChange, onRemoveRows, onRemoveCols, onInsertRows, onInsertCols, onSelect, onKeyUp, onInit, }?: WireProps);
|
|
111
|
+
constructor({ historyLimit, additionalFunctions, policies, onSave, onChange, onRemoveRows, onRemoveCols, onInsertRows, onInsertCols, onSelect, onKeyUp, onInit, }?: WireProps);
|
|
124
112
|
}
|
|
125
113
|
export type TransmitProps = Partial<Wire>;
|
|
126
114
|
export declare const createWire: (props?: WireProps) => Wire;
|
package/dist/lib/input.d.ts
CHANGED
|
@@ -11,5 +11,14 @@ export declare const isRefInsertable: (input: HTMLTextAreaElement | null) => boo
|
|
|
11
11
|
export declare const expandInput: (input: HTMLTextAreaElement | null) => void;
|
|
12
12
|
export declare const resetInput: (input: HTMLTextAreaElement | null, table: Table, point: PointType) => void;
|
|
13
13
|
export declare const isFocus: (input: HTMLTextAreaElement | null) => boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Handles auto-close behavior for double quotes in formula editing.
|
|
16
|
+
* - Typing `"` inserts `""` and places cursor between them.
|
|
17
|
+
* - Typing `"` when cursor is right before an auto-closed `"` skips over it.
|
|
18
|
+
* - Backspace between empty `""` deletes both quotes.
|
|
19
|
+
*
|
|
20
|
+
* Returns true if the event was handled (caller should preventDefault), false otherwise.
|
|
21
|
+
*/
|
|
22
|
+
export declare const handleFormulaQuoteAutoClose: (e: React.KeyboardEvent<HTMLTextAreaElement>, inputting: string) => boolean;
|
|
14
23
|
export {};
|
|
15
24
|
//# sourceMappingURL=input.d.ts.map
|
package/dist/lib/operation.d.ts
CHANGED
|
@@ -11,13 +11,10 @@ export declare const Write: operations;
|
|
|
11
11
|
export declare const Style: operations;
|
|
12
12
|
export declare const Copy: operations;
|
|
13
13
|
export declare const Resize: operations;
|
|
14
|
-
export declare const SetRenderer: operations;
|
|
15
|
-
export declare const SetParser: operations;
|
|
16
14
|
export declare const SetPolicy: operations;
|
|
17
15
|
export declare const Sort: operations;
|
|
18
16
|
export declare const Filter: operations;
|
|
19
17
|
export declare const SetLabel: operations;
|
|
20
|
-
export declare const SetLabeler: operations;
|
|
21
18
|
export declare const NoOperation: operations;
|
|
22
19
|
export declare const Move: operations;
|
|
23
20
|
export declare const Update: operations;
|
package/dist/lib/spatial.d.ts
CHANGED
|
@@ -88,5 +88,7 @@ export declare const addressesToCols: (addresses: Address[], asc?: boolean | nul
|
|
|
88
88
|
* @param asc - true: ascending, false: descending, null: insertion order
|
|
89
89
|
*/
|
|
90
90
|
export declare const addressesToRows: (addresses: Address[], asc?: boolean | null) => number[];
|
|
91
|
+
export declare const isAreaNotSelected: (area: AreaType) => boolean;
|
|
92
|
+
export declare const isZoneNotSelected: (zone: ZoneType) => boolean;
|
|
91
93
|
export {};
|
|
92
94
|
//# sourceMappingURL=spatial.d.ts.map
|
package/dist/lib/table.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Id, AreaType, CellsByIdType, CellsByAddressType, PointType, Address, CellFilter, MatrixType, CellType, FilterConfig, HistoryType, StorePatchType, ShapeType, OperatorType, OperationType, RawCellType, ExtraPointType, StoreType, RefEvaluation } from '../types';
|
|
1
|
+
import { Id, AreaType, CellsByIdType, CellsByAddressType, PointType, Address, CellFilter, MatrixType, CellType, FilterConfig, HistoryType, StorePatchType, ShapeType, RectType, OperatorType, OperationType, RawCellType, ExtraPointType, StoreType, RefEvaluation } from '../types';
|
|
3
2
|
import { FunctionMapping } from '../formula/functions/__base';
|
|
4
3
|
import { Wire } from './hub';
|
|
5
|
-
import { PolicyType } from '../policy/core';
|
|
4
|
+
import { PolicyType, RenderProps } from '../policy/core';
|
|
6
5
|
type Props = {
|
|
7
6
|
minNumRows?: number;
|
|
8
7
|
maxNumRows?: number;
|
|
@@ -16,6 +15,7 @@ type GetProps = {
|
|
|
16
15
|
refEvaluation?: RefEvaluation;
|
|
17
16
|
raise?: boolean;
|
|
18
17
|
filter?: CellFilter;
|
|
18
|
+
asScalar?: boolean;
|
|
19
19
|
};
|
|
20
20
|
type MoveProps = {
|
|
21
21
|
srcTable?: UserTable;
|
|
@@ -30,31 +30,28 @@ type CellField = keyof CellType;
|
|
|
30
30
|
type GetCellProps = GetProps & {
|
|
31
31
|
ignoreFields?: CellField[];
|
|
32
32
|
};
|
|
33
|
-
type
|
|
34
|
-
field?: keyof CellType;
|
|
35
|
-
};
|
|
36
|
-
type GetCellMatrixProps = GetCellProps & {
|
|
33
|
+
type ToCellMatrixProps = GetCellProps & {
|
|
37
34
|
area?: AreaType;
|
|
38
35
|
};
|
|
39
|
-
type
|
|
36
|
+
type ToValueMatrixProps = GetProps & {
|
|
40
37
|
area?: AreaType;
|
|
41
38
|
};
|
|
42
|
-
type
|
|
39
|
+
type ToCellObjectProps = GetCellProps & {
|
|
43
40
|
addresses?: Address[];
|
|
44
41
|
};
|
|
45
|
-
type
|
|
42
|
+
type ToValueObjectProps = GetProps & {
|
|
46
43
|
addresses?: Address[];
|
|
47
44
|
};
|
|
48
|
-
type
|
|
45
|
+
type ToCellRowsProps = GetCellProps & {
|
|
49
46
|
rows?: number[];
|
|
50
47
|
};
|
|
51
|
-
type
|
|
48
|
+
type ToValueRowsProps = GetProps & {
|
|
52
49
|
rows?: number[];
|
|
53
50
|
};
|
|
54
|
-
type
|
|
51
|
+
type ToCellColsProps = GetCellProps & {
|
|
55
52
|
cols?: (number | string)[];
|
|
56
53
|
};
|
|
57
|
-
type
|
|
54
|
+
type ToValueColsProps = GetProps & {
|
|
58
55
|
cols?: (number | string)[];
|
|
59
56
|
};
|
|
60
57
|
export interface UserTable {
|
|
@@ -76,25 +73,26 @@ export interface UserTable {
|
|
|
76
73
|
* This is not intended for public use and may change in future versions.
|
|
77
74
|
*/
|
|
78
75
|
__raw__: Table;
|
|
79
|
-
getRectSize(area: AreaType):
|
|
76
|
+
getRectSize(area: AreaType): RectType;
|
|
80
77
|
getCellByPoint(point: PointType, refEvaluation?: RefEvaluation, raise?: boolean): CellType | undefined;
|
|
81
78
|
getCellByAddress(address: Address, refEvaluation?: RefEvaluation, raise?: boolean): CellType | undefined;
|
|
79
|
+
getPolicyByPoint(point: PointType): PolicyType;
|
|
82
80
|
getNumRows(base?: number): number;
|
|
83
81
|
getNumCols(base?: number): number;
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
toValueMatrix(args?: ToValueMatrixProps): any[][];
|
|
83
|
+
toValueObject(args?: ToValueObjectProps): {
|
|
86
84
|
[address: Address]: any;
|
|
87
85
|
};
|
|
88
|
-
|
|
86
|
+
toValueRows(args?: ToValueRowsProps): {
|
|
89
87
|
[address: Address]: any;
|
|
90
88
|
}[];
|
|
91
|
-
|
|
89
|
+
toValueCols(args?: ToValueColsProps): {
|
|
92
90
|
[address: Address]: any;
|
|
93
91
|
}[];
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
92
|
+
toCellMatrix(args?: ToCellMatrixProps): (CellType | null)[][];
|
|
93
|
+
toCellObject(args?: ToCellObjectProps): CellsByAddressType;
|
|
94
|
+
toCellRows(args?: ToCellRowsProps): CellsByAddressType[];
|
|
95
|
+
toCellCols(args?: ToCellColsProps): CellsByAddressType[];
|
|
98
96
|
getHistories(): HistoryType[];
|
|
99
97
|
move(args: MoveProps): UserTable;
|
|
100
98
|
copy(args: MoveProps & {
|
|
@@ -176,8 +174,13 @@ export interface UserTable {
|
|
|
176
174
|
cell?: CellType;
|
|
177
175
|
refEvaluation?: RefEvaluation;
|
|
178
176
|
}): string;
|
|
177
|
+
get shape(): {
|
|
178
|
+
rows: number;
|
|
179
|
+
cols: number;
|
|
180
|
+
};
|
|
179
181
|
}
|
|
180
182
|
export declare class Table implements UserTable {
|
|
183
|
+
__isTable: boolean;
|
|
181
184
|
changedTime: number;
|
|
182
185
|
lastChangedTime?: number;
|
|
183
186
|
minNumRows: number;
|
|
@@ -199,6 +202,8 @@ export declare class Table implements UserTable {
|
|
|
199
202
|
private addressCaches;
|
|
200
203
|
private lastChangedAddresses;
|
|
201
204
|
constructor({ minNumRows, maxNumRows, minNumCols, maxNumCols, sheetName, hub, }: Props);
|
|
205
|
+
static is(obj: any): obj is Table;
|
|
206
|
+
toString(): string;
|
|
202
207
|
get headerHeight(): number;
|
|
203
208
|
setHeaderHeight(height: number, historicize?: boolean): Table;
|
|
204
209
|
get headerWidth(): number;
|
|
@@ -239,15 +244,6 @@ export declare class Table implements UserTable {
|
|
|
239
244
|
private _sortRowMapping;
|
|
240
245
|
get isInitialized(): boolean;
|
|
241
246
|
get functions(): FunctionMapping;
|
|
242
|
-
get parsers(): {
|
|
243
|
-
[parserName: string]: import('../parsers/core').Parser | null;
|
|
244
|
-
};
|
|
245
|
-
get renderers(): {
|
|
246
|
-
[rendererName: string]: import('../renderers/core').Renderer | null;
|
|
247
|
-
};
|
|
248
|
-
get labelers(): {
|
|
249
|
-
[labelerName: string]: ((n: number) => string) | null;
|
|
250
|
-
};
|
|
251
247
|
get policies(): {
|
|
252
248
|
[policyName: string]: import('../policy/core').Policy | null;
|
|
253
249
|
};
|
|
@@ -255,13 +251,12 @@ export declare class Table implements UserTable {
|
|
|
255
251
|
getSheetId(): number;
|
|
256
252
|
getTableBySheetName(sheetName: string): Table | null;
|
|
257
253
|
getTableBySheetId(sheetId: number): Table | null;
|
|
254
|
+
private static _stack;
|
|
258
255
|
initialize(cells: CellsByAddressType): void;
|
|
259
256
|
incrementVersion(): void;
|
|
257
|
+
xsheetDispatch(otherTable: Table): void;
|
|
260
258
|
private generateId;
|
|
261
|
-
getRectSize({ top, left, bottom, right }: AreaType):
|
|
262
|
-
width: number;
|
|
263
|
-
height: number;
|
|
264
|
-
};
|
|
259
|
+
getRectSize({ top, left, bottom, right }: AreaType): RectType;
|
|
265
260
|
setTotalSize(): void;
|
|
266
261
|
refresh(relocate?: boolean, resize?: boolean): Table;
|
|
267
262
|
clone(relocate?: boolean): Table;
|
|
@@ -287,21 +282,24 @@ export declare class Table implements UserTable {
|
|
|
287
282
|
get bottom(): number;
|
|
288
283
|
get right(): number;
|
|
289
284
|
getFullRef(ref: Address): string;
|
|
290
|
-
|
|
291
|
-
|
|
285
|
+
_toValueMatrix({ area, at, refEvaluation, raise, filter, asScalar, }?: ToValueMatrixProps & {
|
|
286
|
+
at?: Id;
|
|
287
|
+
}): any[][];
|
|
288
|
+
toValueMatrix(props?: ToValueMatrixProps): any[][];
|
|
289
|
+
toValueObject({ refEvaluation, raise, filter, addresses, asScalar, }?: ToValueObjectProps): {
|
|
292
290
|
[Address: string]: any;
|
|
293
291
|
};
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
292
|
+
toValueRows({ refEvaluation, raise, filter, rows, asScalar, }?: ToValueRowsProps): CellsByAddressType[];
|
|
293
|
+
toValueCols({ refEvaluation, raise, filter, cols, asScalar, }?: ToValueColsProps): CellsByAddressType[];
|
|
294
|
+
toCellMatrix({ area, refEvaluation, raise, filter, ignoreFields, }?: ToCellMatrixProps): (CellType | null)[][];
|
|
295
|
+
toCellObject({ refEvaluation, raise, filter, addresses, ignoreFields, }?: ToCellObjectProps): CellsByAddressType;
|
|
296
|
+
toCellRows({ refEvaluation, raise, filter, rows, ignoreFields, }?: ToCellRowsProps): CellsByAddressType[];
|
|
297
|
+
toCellCols({ refEvaluation, raise, filter, cols, ignoreFields, }?: ToCellColsProps): CellsByAddressType[];
|
|
300
298
|
private pushHistory;
|
|
301
299
|
private cleanObsolete;
|
|
302
300
|
private cleanStrayed;
|
|
303
|
-
|
|
304
|
-
private
|
|
301
|
+
/** Remove an id from wire.data and wire.dependents entirely. */
|
|
302
|
+
private deleteOrphanedId;
|
|
305
303
|
private setChangedTime;
|
|
306
304
|
private copyCellLayout;
|
|
307
305
|
move({ srcTable, src, dst, historicize, operator, undoReflection, redoReflection, }: MoveProps): Table;
|
|
@@ -315,6 +313,7 @@ export declare class Table implements UserTable {
|
|
|
315
313
|
* is no longer addressable; on forward pass they are skipped; on reverse pass the ID is written back.
|
|
316
314
|
*/
|
|
317
315
|
private _createMoveRelations;
|
|
316
|
+
get defaultPolicy(): PolicyType;
|
|
318
317
|
/**
|
|
319
318
|
* Apply (or reverse) a MoveRelations list.
|
|
320
319
|
*
|
|
@@ -412,14 +411,25 @@ export declare class Table implements UserTable {
|
|
|
412
411
|
getHistorySize(): number;
|
|
413
412
|
getHistoryLimit(): number;
|
|
414
413
|
getArea(): AreaType;
|
|
415
|
-
parse(point: PointType, value:
|
|
416
|
-
render(props:
|
|
414
|
+
parse(point: PointType, value: any): CellType;
|
|
415
|
+
render(props: RenderProps): any;
|
|
417
416
|
stringify({ point, cell, refEvaluation, }: {
|
|
418
417
|
point: PointType;
|
|
419
418
|
cell?: CellType;
|
|
420
419
|
refEvaluation?: RefEvaluation;
|
|
421
420
|
}): string;
|
|
422
421
|
trim(area: AreaType): Table;
|
|
422
|
+
/**
|
|
423
|
+
* Solve all formulas in this table and return a 2D matrix of resolved values.
|
|
424
|
+
*/
|
|
425
|
+
solve({ raise, at }: {
|
|
426
|
+
raise?: boolean;
|
|
427
|
+
at: Id;
|
|
428
|
+
}): any[][];
|
|
429
|
+
/**
|
|
430
|
+
* Collapse this table to a scalar (top-left cell value).
|
|
431
|
+
*/
|
|
432
|
+
strip(): any;
|
|
423
433
|
private applyDiff;
|
|
424
434
|
undo(): {
|
|
425
435
|
history: null;
|
|
@@ -440,11 +450,24 @@ export declare class Table implements UserTable {
|
|
|
440
450
|
newTable?: undefined;
|
|
441
451
|
};
|
|
442
452
|
getFunction(name: string): typeof import('../formula/functions/__base').BaseFunction;
|
|
443
|
-
getLabel(label: string | undefined,
|
|
453
|
+
getLabel(label: string | undefined, point: PointType, n: number): string | null;
|
|
444
454
|
getBase(): this;
|
|
445
|
-
|
|
446
|
-
|
|
455
|
+
addDependents(id: Id, dependency: string): void;
|
|
456
|
+
getSolvedCache(point: PointType): [boolean, any];
|
|
457
|
+
setSolvingCache(point: PointType): void;
|
|
458
|
+
finishSolvedCache(point: PointType, value: any): void;
|
|
447
459
|
clearSolvedCaches(): void;
|
|
460
|
+
/**
|
|
461
|
+
* Spill a 2D matrix of values starting from the origin cell.
|
|
462
|
+
* The origin cell receives matrix[0][0] and adjacent cells receive spill values in solvedCaches.
|
|
463
|
+
* For a 1×1 matrix, no spill occurs — the single value is cached directly.
|
|
464
|
+
* Throws FormulaError('#REF!') if the spill range is obstructed.
|
|
465
|
+
*
|
|
466
|
+
* @param origin The anchor cell that produced the spill.
|
|
467
|
+
* @param matrix The 2D array of resolved scalar values.
|
|
468
|
+
* @returns The top-left value (matrix[0][0]).
|
|
469
|
+
*/
|
|
470
|
+
spill(origin: PointType, matrix: any[][]): any;
|
|
448
471
|
sheetPrefix(omit?: boolean): string;
|
|
449
472
|
rangeToArea(range: string): {
|
|
450
473
|
top: number;
|
|
@@ -453,6 +476,9 @@ export declare class Table implements UserTable {
|
|
|
453
476
|
right: number;
|
|
454
477
|
};
|
|
455
478
|
get __raw__(): Table;
|
|
479
|
+
get shape(): ShapeType;
|
|
480
|
+
get hasSingleCell(): boolean;
|
|
481
|
+
get currentVersion(): number;
|
|
456
482
|
}
|
|
457
483
|
export {};
|
|
458
484
|
//# sourceMappingURL=table.d.ts.map
|
package/dist/lib/time.d.ts
CHANGED
|
@@ -1,25 +1,29 @@
|
|
|
1
|
-
export declare
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export declare class TimeDelta {
|
|
5
|
-
gsType: string;
|
|
6
|
-
protected diff: Diff;
|
|
7
|
-
private date1;
|
|
8
|
-
private date2;
|
|
1
|
+
export declare class Time {
|
|
2
|
+
readonly __gsType: "Time";
|
|
3
|
+
readonly days: number;
|
|
9
4
|
format: string;
|
|
10
|
-
constructor(
|
|
5
|
+
constructor(days: number, format?: string);
|
|
11
6
|
add(date: Date): Date;
|
|
12
7
|
sub(date: Date): Date;
|
|
13
8
|
stringify(format?: string): string;
|
|
14
9
|
toMilliseconds(): number;
|
|
15
|
-
|
|
10
|
+
toDate(): Date;
|
|
11
|
+
toJSON(): {
|
|
12
|
+
__gsType: 'Time';
|
|
13
|
+
days: number;
|
|
14
|
+
format: string;
|
|
15
|
+
};
|
|
16
16
|
toString(): string;
|
|
17
|
-
static create(hours?: number, minutes?: number, seconds?: number, milliseconds?: number):
|
|
17
|
+
static create(hours?: number, minutes?: number, seconds?: number, milliseconds?: number): Time;
|
|
18
|
+
static fromDate(date: Date): Time;
|
|
19
|
+
static fromDates(date1: Date, date2: Date): Time;
|
|
20
|
+
static fromObject(obj: {
|
|
21
|
+
days: number;
|
|
22
|
+
format?: string;
|
|
23
|
+
}): Time;
|
|
18
24
|
static is(obj: any): boolean;
|
|
19
|
-
static ensure(obj: any):
|
|
20
|
-
static
|
|
21
|
-
static parse(value: string, format?: string, strict?: boolean): TimeDelta | undefined;
|
|
25
|
+
static ensure(obj: any): Time;
|
|
26
|
+
static parse(value: string, format?: string, strict?: boolean): Time | undefined;
|
|
22
27
|
}
|
|
23
28
|
export declare const safeQueueMicrotask: typeof queueMicrotask;
|
|
24
|
-
export {};
|
|
25
29
|
//# sourceMappingURL=time.d.ts.map
|
package/dist/policy/core.d.ts
CHANGED
|
@@ -1,47 +1,164 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
2
|
import { CellPatchType, CellType, OperationType, PointType } from '../types';
|
|
3
|
-
|
|
3
|
+
import { Table, UserTable } from '../lib/table';
|
|
4
|
+
import { FormulaError } from '../formula/formula-error';
|
|
5
|
+
import { Time } from '../lib/time';
|
|
6
|
+
export type AutocompleteOption = {
|
|
4
7
|
value: any;
|
|
5
8
|
label?: any;
|
|
6
9
|
keywords?: string[];
|
|
10
|
+
tooltip?: ReactNode | FC<{
|
|
11
|
+
value?: any;
|
|
12
|
+
}>;
|
|
7
13
|
};
|
|
8
|
-
export type
|
|
14
|
+
export type SelectProps = {
|
|
9
15
|
table: UserTable;
|
|
10
16
|
point: PointType;
|
|
11
|
-
|
|
12
|
-
|
|
17
|
+
current?: CellType;
|
|
18
|
+
next?: CellType;
|
|
13
19
|
operation: OperationType;
|
|
14
20
|
};
|
|
15
|
-
export type
|
|
21
|
+
export type SerializeForClipboardProps = {
|
|
16
22
|
table: UserTable;
|
|
17
23
|
point: PointType;
|
|
18
24
|
};
|
|
19
|
-
export type
|
|
25
|
+
export type SelectFallbackProps = {
|
|
20
26
|
table: UserTable;
|
|
21
27
|
point: PointType;
|
|
22
28
|
value: any;
|
|
23
29
|
};
|
|
30
|
+
export type Scalar = string | number | boolean | null | undefined;
|
|
31
|
+
export type ScalarProps<T = any> = {
|
|
32
|
+
value?: T;
|
|
33
|
+
cell?: CellType<T>;
|
|
34
|
+
table: Table;
|
|
35
|
+
point: PointType;
|
|
36
|
+
};
|
|
37
|
+
export type RenderProps<T = any> = {
|
|
38
|
+
value?: T;
|
|
39
|
+
cell?: CellType<T>;
|
|
40
|
+
table: Table;
|
|
41
|
+
point: PointType;
|
|
42
|
+
sync?: (table: UserTable) => void;
|
|
43
|
+
};
|
|
44
|
+
export type SerializeProps<T = any> = {
|
|
45
|
+
value: T;
|
|
46
|
+
cell?: CellType<T>;
|
|
47
|
+
table: Table;
|
|
48
|
+
point: PointType;
|
|
49
|
+
};
|
|
24
50
|
export type PolicyMixinType = {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
51
|
+
datetimeFormat?: string;
|
|
52
|
+
dateFormat?: string;
|
|
53
|
+
timeFormat?: string;
|
|
54
|
+
decimalPrecision?: number;
|
|
55
|
+
render?: (props: RenderProps) => any;
|
|
56
|
+
renderCallback?: (rendered: any, props: RenderProps) => any;
|
|
57
|
+
renderString?: (props: RenderProps<string>) => any;
|
|
58
|
+
renderNumber?: (props: RenderProps<number>) => any;
|
|
59
|
+
renderBool?: (props: RenderProps<boolean>) => any;
|
|
60
|
+
renderDate?: (props: RenderProps<Date>) => any;
|
|
61
|
+
renderTime?: (props: RenderProps<Time>) => any;
|
|
62
|
+
renderArray?: (props: RenderProps<any[]>) => any;
|
|
63
|
+
renderObject?: (props: RenderProps<any>) => any;
|
|
64
|
+
renderNull?: (props: RenderProps<null | undefined>) => any;
|
|
65
|
+
renderTable?: (props: RenderProps<Table>) => any;
|
|
66
|
+
renderRowHeaderLabel?: (n: number) => string | null;
|
|
67
|
+
renderColHeaderLabel?: (n: number) => string | null;
|
|
68
|
+
serialize?: (props: SerializeProps) => string;
|
|
69
|
+
serializeString?: (props: SerializeProps<string>) => string;
|
|
70
|
+
serializeNumber?: (props: SerializeProps<number>) => string;
|
|
71
|
+
serializeBool?: (props: SerializeProps<boolean>) => string;
|
|
72
|
+
serializeDate?: (props: SerializeProps<Date>) => string;
|
|
73
|
+
serializeTime?: (props: SerializeProps<Time>) => string;
|
|
74
|
+
serializeArray?: (props: SerializeProps<any[]>) => string;
|
|
75
|
+
serializeNull?: (props: SerializeProps<null | undefined>) => string;
|
|
76
|
+
serializeFormulaError?: (props: SerializeProps<FormulaError>) => string;
|
|
77
|
+
serializeError?: (props: SerializeProps<Error>) => string;
|
|
78
|
+
deserialize?: (value: string, cell?: CellType) => CellType;
|
|
79
|
+
deserializeRaw?: (value: any, cell?: CellType) => CellType;
|
|
80
|
+
deserializeCallback?: (parsed: any, cell?: CellType) => CellType;
|
|
81
|
+
deserializeFirst?: (value: string, cell?: CellType) => CellPatchType<any>;
|
|
82
|
+
deserializeNumber?: (value: string, cell?: CellType) => CellPatchType<number | undefined>;
|
|
83
|
+
deserializeBool?: (value: string, cell?: CellType) => CellPatchType<boolean | undefined>;
|
|
84
|
+
deserializeDate?: (value: string, cell?: CellType) => CellPatchType<Date | undefined>;
|
|
85
|
+
deserializeTime?: (value: string, cell?: CellType) => CellPatchType<Time | undefined>;
|
|
86
|
+
deserializeAny?: (value: string, cell?: CellType) => CellPatchType<string | undefined>;
|
|
87
|
+
toScalar?: (props: ScalarProps) => Scalar;
|
|
88
|
+
toScalarString?: (props: ScalarProps<string>) => Scalar;
|
|
89
|
+
toScalarNumber?: (props: ScalarProps<number>) => Scalar;
|
|
90
|
+
toScalarBool?: (props: ScalarProps<boolean>) => Scalar;
|
|
91
|
+
toScalarDate?: (props: ScalarProps<Date>) => Scalar;
|
|
92
|
+
toScalarTime?: (props: ScalarProps<Time>) => Scalar;
|
|
93
|
+
toScalarArray?: (props: ScalarProps<any[]>) => Scalar;
|
|
94
|
+
toScalarNull?: (props: ScalarProps<null | undefined>) => Scalar;
|
|
95
|
+
getSelectOptions?: () => AutocompleteOption[];
|
|
96
|
+
getSelectFallback?: (props: SelectFallbackProps) => CellType | undefined;
|
|
97
|
+
select?: (props: SelectProps) => CellType | undefined;
|
|
98
|
+
serializeForClipboard?: (props: SerializeForClipboardProps) => string;
|
|
30
99
|
};
|
|
31
100
|
type PolicyProps = {
|
|
32
101
|
mixins?: PolicyMixinType[];
|
|
102
|
+
priority?: number;
|
|
33
103
|
};
|
|
34
104
|
export declare class Policy implements PolicyMixinType {
|
|
105
|
+
priority: number;
|
|
106
|
+
datetimeFormat: string;
|
|
107
|
+
dateFormat: string;
|
|
108
|
+
timeFormat: string;
|
|
109
|
+
decimalPrecision: number;
|
|
110
|
+
deserializeFunctions: ((value: string, cell?: CellType) => CellPatchType<any>)[];
|
|
111
|
+
deserializeCallback?: (parsed: any, cell?: CellType) => CellType;
|
|
112
|
+
deserializeFirst?: (value: string, cell?: CellType) => CellPatchType<any>;
|
|
113
|
+
renderCallback?: (rendered: any, props: RenderProps) => any;
|
|
35
114
|
constructor(props?: PolicyProps);
|
|
115
|
+
private registerDeserializeFunctions;
|
|
36
116
|
private applyMixins;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
117
|
+
render(props: RenderProps): any;
|
|
118
|
+
renderString({ value }: RenderProps<string>): any;
|
|
119
|
+
renderBool({ value }: RenderProps<boolean>): any;
|
|
120
|
+
renderNumber({ value }: RenderProps<number>): any;
|
|
121
|
+
renderDate({ value }: RenderProps<Date>): any;
|
|
122
|
+
renderTime({ value }: RenderProps<Time>): any;
|
|
123
|
+
renderArray(props: RenderProps<any[]>): any;
|
|
124
|
+
renderObject({ value }: RenderProps<any>): any;
|
|
125
|
+
renderNull(_props: RenderProps<null | undefined>): any;
|
|
126
|
+
renderTable({ value }: RenderProps<Table>): any;
|
|
127
|
+
renderRowHeaderLabel(_n: number): string | null;
|
|
128
|
+
renderColHeaderLabel(_n: number): string | null;
|
|
129
|
+
toScalar(props: ScalarProps): Scalar;
|
|
130
|
+
toScalarString({ value }: ScalarProps<string>): Scalar;
|
|
131
|
+
toScalarNumber({ value }: ScalarProps<number>): Scalar;
|
|
132
|
+
toScalarBool({ value }: ScalarProps<boolean>): Scalar;
|
|
133
|
+
toScalarDate({ value }: ScalarProps<Date>): Scalar;
|
|
134
|
+
toScalarTime({ value }: ScalarProps<Time>): Scalar;
|
|
135
|
+
toScalarArray({ value, cell, table, point }: ScalarProps<any[]>): Scalar;
|
|
136
|
+
toScalarNull(_props: ScalarProps<null | undefined>): Scalar;
|
|
137
|
+
serialize({ value, cell, table, point }: SerializeProps): string;
|
|
138
|
+
serializeString({ value }: SerializeProps<string>): string;
|
|
139
|
+
serializeBool({ value }: SerializeProps<boolean>): string;
|
|
140
|
+
serializeNumber({ value }: SerializeProps<number>): string;
|
|
141
|
+
serializeDate({ value }: SerializeProps<Date>): string;
|
|
142
|
+
serializeTime({ value }: SerializeProps<Time>): string;
|
|
143
|
+
serializeArray(props: SerializeProps<any[]>): string;
|
|
144
|
+
serializeNull(_props: SerializeProps<null | undefined>): string;
|
|
145
|
+
serializeFormulaError({ value }: SerializeProps<FormulaError>): string;
|
|
146
|
+
serializeError(_props: SerializeProps<Error>): string;
|
|
147
|
+
serializeForClipboard(props: SerializeForClipboardProps): string;
|
|
148
|
+
deserializeValue(value: any, cell: CellType): CellType;
|
|
149
|
+
deserializeRaw(value: any, cell?: CellType): CellType;
|
|
150
|
+
deserialize(value: string, cell?: CellType): CellPatchType<any>;
|
|
151
|
+
deserializeAny(value: string, _cell?: CellType): CellPatchType<string | undefined>;
|
|
152
|
+
deserializeBool(value: string, _cell?: CellType): CellPatchType<boolean | undefined>;
|
|
153
|
+
deserializeNumber(value: string, _cell?: CellType): CellPatchType<number | undefined>;
|
|
154
|
+
deserializeTime(value: string, _cell?: CellType): CellPatchType<Time | undefined>;
|
|
155
|
+
deserializeDate(value: string, _cell?: CellType): CellPatchType<Date | undefined>;
|
|
156
|
+
getSelectFallback(_props: SelectFallbackProps): any;
|
|
157
|
+
getSelectOptions(): AutocompleteOption[];
|
|
158
|
+
select(props: SelectProps): CellType | undefined;
|
|
43
159
|
}
|
|
44
160
|
export type PolicyType = Policy;
|
|
45
|
-
export declare const
|
|
161
|
+
export declare const DEFAULT_POLICY_NAME = "default";
|
|
162
|
+
export declare const nonePolicy: Policy;
|
|
46
163
|
export {};
|
|
47
164
|
//# sourceMappingURL=core.d.ts.map
|