@gridsheet/preact-core 3.0.0-rc.1 → 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/FunctionGuide.d.ts +3 -2
- package/dist/constants.d.ts +1 -0
- package/dist/formula/evaluator.d.ts +8 -15
- package/dist/formula/formula-error.d.ts +10 -0
- package/dist/formula/functions/__async.d.ts +9 -4
- package/dist/formula/functions/__base.d.ts +80 -14
- package/dist/formula/functions/__utils.d.ts +4 -0
- package/dist/formula/functions/abs.d.ts +5 -5
- package/dist/formula/functions/add.d.ts +6 -6
- package/dist/formula/functions/and.d.ts +5 -5
- package/dist/formula/functions/arrayformula.d.ts +12 -0
- package/dist/formula/functions/average.d.ts +5 -5
- package/dist/formula/functions/concat.d.ts +5 -5
- package/dist/formula/functions/count.d.ts +4 -4
- package/dist/formula/functions/counta.d.ts +4 -4
- package/dist/formula/functions/divide.d.ts +5 -4
- package/dist/formula/functions/eq.d.ts +4 -4
- package/dist/formula/functions/gt.d.ts +5 -5
- package/dist/formula/functions/gte.d.ts +5 -5
- package/dist/formula/functions/if.d.ts +5 -5
- package/dist/formula/functions/iferror.d.ts +7 -9
- package/dist/formula/functions/len.d.ts +5 -5
- package/dist/formula/functions/lt.d.ts +5 -5
- package/dist/formula/functions/lte.d.ts +5 -5
- package/dist/formula/functions/max.d.ts +5 -5
- package/dist/formula/functions/min.d.ts +5 -5
- package/dist/formula/functions/minus.d.ts +7 -6
- package/dist/formula/functions/multiply.d.ts +5 -5
- package/dist/formula/functions/ne.d.ts +4 -4
- package/dist/formula/functions/not.d.ts +5 -5
- package/dist/formula/functions/now.d.ts +4 -4
- package/dist/formula/functions/or.d.ts +5 -5
- package/dist/formula/functions/power.d.ts +5 -5
- package/dist/formula/functions/sum.d.ts +5 -5
- package/dist/formula/functions/uminus.d.ts +5 -5
- package/dist/formula/mapping.d.ts +4 -3
- package/dist/formula/solver.d.ts +6 -4
- package/dist/index.d.ts +12 -13
- package/dist/index.js +2412 -2726
- package/dist/index.js.map +1 -1
- package/dist/lib/clipboard.d.ts +16 -1
- package/dist/lib/dom.d.ts +2 -0
- package/dist/lib/hub.d.ts +5 -21
- package/dist/lib/input.d.ts +9 -0
- package/dist/lib/operation.d.ts +0 -3
- package/dist/lib/table.d.ts +71 -50
- package/dist/lib/time.d.ts +19 -15
- package/dist/policy/checkbox.d.ts +3 -0
- package/dist/policy/core.d.ts +125 -15
- package/dist/policy/thousand_separator.d.ts +4 -0
- package/dist/sentinels.d.ts +20 -4
- package/dist/store/helpers.d.ts +4 -0
- package/dist/styles/minified.d.ts +2 -2
- package/dist/types.d.ts +8 -20
- package/package.json +1 -1
- package/dist/formula/functions/acos.d.ts +0 -9
- package/dist/formula/functions/asin.d.ts +0 -9
- package/dist/formula/functions/atan.d.ts +0 -9
- package/dist/formula/functions/atan2.d.ts +0 -9
- package/dist/formula/functions/col.d.ts +0 -9
- package/dist/formula/functions/concatenate.d.ts +0 -9
- package/dist/formula/functions/cos.d.ts +0 -9
- package/dist/formula/functions/countif.d.ts +0 -10
- package/dist/formula/functions/exp.d.ts +0 -9
- package/dist/formula/functions/hlookup.d.ts +0 -10
- package/dist/formula/functions/index.d.ts +0 -10
- package/dist/formula/functions/lenb.d.ts +0 -9
- package/dist/formula/functions/ln.d.ts +0 -9
- package/dist/formula/functions/log.d.ts +0 -9
- package/dist/formula/functions/log10.d.ts +0 -9
- package/dist/formula/functions/match.d.ts +0 -10
- package/dist/formula/functions/match.test.d.ts +0 -2
- package/dist/formula/functions/mod.d.ts +0 -9
- package/dist/formula/functions/pi.d.ts +0 -9
- package/dist/formula/functions/product.d.ts +0 -9
- package/dist/formula/functions/radians.d.ts +0 -9
- package/dist/formula/functions/rand.d.ts +0 -9
- package/dist/formula/functions/round.d.ts +0 -9
- package/dist/formula/functions/rounddown.d.ts +0 -9
- package/dist/formula/functions/roundup.d.ts +0 -9
- package/dist/formula/functions/row.d.ts +0 -9
- package/dist/formula/functions/sin.d.ts +0 -9
- package/dist/formula/functions/sqrt.d.ts +0 -9
- package/dist/formula/functions/sumif.d.ts +0 -10
- package/dist/formula/functions/tan.d.ts +0 -9
- package/dist/formula/functions/vlookup.d.ts +0 -10
- 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/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/hub.d.ts
CHANGED
|
@@ -3,20 +3,9 @@ import { HistoryType, RefPaletteType, SheetIdsByName, ContextsBySheetId, ZoneTyp
|
|
|
3
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,6 +54,10 @@ 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>;
|
|
70
63
|
/** In-flight async formulas shared by cache key (for useInflight). */
|
|
@@ -82,15 +75,6 @@ export declare class Wire {
|
|
|
82
75
|
currentHistory?: HistoryType;
|
|
83
76
|
ready: boolean;
|
|
84
77
|
functions: FunctionMapping;
|
|
85
|
-
renderers: {
|
|
86
|
-
[rendererName: string]: RendererType | null;
|
|
87
|
-
};
|
|
88
|
-
parsers: {
|
|
89
|
-
[parserName: string]: ParserType | null;
|
|
90
|
-
};
|
|
91
|
-
labelers: {
|
|
92
|
-
[labelerName: string]: ((n: number) => string) | null;
|
|
93
|
-
};
|
|
94
78
|
policies: {
|
|
95
79
|
[policyName: string]: PolicyType | null;
|
|
96
80
|
};
|
|
@@ -124,7 +108,7 @@ export declare class Wire {
|
|
|
124
108
|
}) => void;
|
|
125
109
|
transmit: (newHub?: TransmitProps) => void;
|
|
126
110
|
identifyFormula(): void;
|
|
127
|
-
constructor({ historyLimit, additionalFunctions,
|
|
111
|
+
constructor({ historyLimit, additionalFunctions, policies, onSave, onChange, onRemoveRows, onRemoveCols, onInsertRows, onInsertCols, onSelect, onKeyUp, onInit, }?: WireProps);
|
|
128
112
|
}
|
|
129
113
|
export type TransmitProps = Partial<Wire>;
|
|
130
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/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,26 +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;
|
|
82
79
|
getPolicyByPoint(point: PointType): PolicyType;
|
|
83
80
|
getNumRows(base?: number): number;
|
|
84
81
|
getNumCols(base?: number): number;
|
|
85
|
-
|
|
86
|
-
|
|
82
|
+
toValueMatrix(args?: ToValueMatrixProps): any[][];
|
|
83
|
+
toValueObject(args?: ToValueObjectProps): {
|
|
87
84
|
[address: Address]: any;
|
|
88
85
|
};
|
|
89
|
-
|
|
86
|
+
toValueRows(args?: ToValueRowsProps): {
|
|
90
87
|
[address: Address]: any;
|
|
91
88
|
}[];
|
|
92
|
-
|
|
89
|
+
toValueCols(args?: ToValueColsProps): {
|
|
93
90
|
[address: Address]: any;
|
|
94
91
|
}[];
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
92
|
+
toCellMatrix(args?: ToCellMatrixProps): (CellType | null)[][];
|
|
93
|
+
toCellObject(args?: ToCellObjectProps): CellsByAddressType;
|
|
94
|
+
toCellRows(args?: ToCellRowsProps): CellsByAddressType[];
|
|
95
|
+
toCellCols(args?: ToCellColsProps): CellsByAddressType[];
|
|
99
96
|
getHistories(): HistoryType[];
|
|
100
97
|
move(args: MoveProps): UserTable;
|
|
101
98
|
copy(args: MoveProps & {
|
|
@@ -177,8 +174,13 @@ export interface UserTable {
|
|
|
177
174
|
cell?: CellType;
|
|
178
175
|
refEvaluation?: RefEvaluation;
|
|
179
176
|
}): string;
|
|
177
|
+
get shape(): {
|
|
178
|
+
rows: number;
|
|
179
|
+
cols: number;
|
|
180
|
+
};
|
|
180
181
|
}
|
|
181
182
|
export declare class Table implements UserTable {
|
|
183
|
+
__isTable: boolean;
|
|
182
184
|
changedTime: number;
|
|
183
185
|
lastChangedTime?: number;
|
|
184
186
|
minNumRows: number;
|
|
@@ -200,6 +202,8 @@ export declare class Table implements UserTable {
|
|
|
200
202
|
private addressCaches;
|
|
201
203
|
private lastChangedAddresses;
|
|
202
204
|
constructor({ minNumRows, maxNumRows, minNumCols, maxNumCols, sheetName, hub, }: Props);
|
|
205
|
+
static is(obj: any): obj is Table;
|
|
206
|
+
toString(): string;
|
|
203
207
|
get headerHeight(): number;
|
|
204
208
|
setHeaderHeight(height: number, historicize?: boolean): Table;
|
|
205
209
|
get headerWidth(): number;
|
|
@@ -240,15 +244,6 @@ export declare class Table implements UserTable {
|
|
|
240
244
|
private _sortRowMapping;
|
|
241
245
|
get isInitialized(): boolean;
|
|
242
246
|
get functions(): FunctionMapping;
|
|
243
|
-
get parsers(): {
|
|
244
|
-
[parserName: string]: import('../parsers/core').Parser | null;
|
|
245
|
-
};
|
|
246
|
-
get renderers(): {
|
|
247
|
-
[rendererName: string]: import('../renderers/core').Renderer | null;
|
|
248
|
-
};
|
|
249
|
-
get labelers(): {
|
|
250
|
-
[labelerName: string]: ((n: number) => string) | null;
|
|
251
|
-
};
|
|
252
247
|
get policies(): {
|
|
253
248
|
[policyName: string]: import('../policy/core').Policy | null;
|
|
254
249
|
};
|
|
@@ -259,11 +254,9 @@ export declare class Table implements UserTable {
|
|
|
259
254
|
private static _stack;
|
|
260
255
|
initialize(cells: CellsByAddressType): void;
|
|
261
256
|
incrementVersion(): void;
|
|
257
|
+
xsheetDispatch(otherTable: Table): void;
|
|
262
258
|
private generateId;
|
|
263
|
-
getRectSize({ top, left, bottom, right }: AreaType):
|
|
264
|
-
width: number;
|
|
265
|
-
height: number;
|
|
266
|
-
};
|
|
259
|
+
getRectSize({ top, left, bottom, right }: AreaType): RectType;
|
|
267
260
|
setTotalSize(): void;
|
|
268
261
|
refresh(relocate?: boolean, resize?: boolean): Table;
|
|
269
262
|
clone(relocate?: boolean): Table;
|
|
@@ -289,21 +282,24 @@ export declare class Table implements UserTable {
|
|
|
289
282
|
get bottom(): number;
|
|
290
283
|
get right(): number;
|
|
291
284
|
getFullRef(ref: Address): string;
|
|
292
|
-
|
|
293
|
-
|
|
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): {
|
|
294
290
|
[Address: string]: any;
|
|
295
291
|
};
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
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[];
|
|
302
298
|
private pushHistory;
|
|
303
299
|
private cleanObsolete;
|
|
304
300
|
private cleanStrayed;
|
|
305
|
-
|
|
306
|
-
private
|
|
301
|
+
/** Remove an id from wire.data and wire.dependents entirely. */
|
|
302
|
+
private deleteOrphanedId;
|
|
307
303
|
private setChangedTime;
|
|
308
304
|
private copyCellLayout;
|
|
309
305
|
move({ srcTable, src, dst, historicize, operator, undoReflection, redoReflection, }: MoveProps): Table;
|
|
@@ -415,14 +411,25 @@ export declare class Table implements UserTable {
|
|
|
415
411
|
getHistorySize(): number;
|
|
416
412
|
getHistoryLimit(): number;
|
|
417
413
|
getArea(): AreaType;
|
|
418
|
-
parse(point: PointType, value:
|
|
419
|
-
render(props:
|
|
414
|
+
parse(point: PointType, value: any): CellType;
|
|
415
|
+
render(props: RenderProps): any;
|
|
420
416
|
stringify({ point, cell, refEvaluation, }: {
|
|
421
417
|
point: PointType;
|
|
422
418
|
cell?: CellType;
|
|
423
419
|
refEvaluation?: RefEvaluation;
|
|
424
420
|
}): string;
|
|
425
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;
|
|
426
433
|
private applyDiff;
|
|
427
434
|
undo(): {
|
|
428
435
|
history: null;
|
|
@@ -443,13 +450,24 @@ export declare class Table implements UserTable {
|
|
|
443
450
|
newTable?: undefined;
|
|
444
451
|
};
|
|
445
452
|
getFunction(name: string): typeof import('../formula/functions/__base').BaseFunction;
|
|
446
|
-
getLabel(label: string | undefined,
|
|
453
|
+
getLabel(label: string | undefined, point: PointType, n: number): string | null;
|
|
447
454
|
getBase(): this;
|
|
448
455
|
addDependents(id: Id, dependency: string): void;
|
|
449
|
-
getSolvedCache(point: PointType): any;
|
|
456
|
+
getSolvedCache(point: PointType): [boolean, any];
|
|
450
457
|
setSolvingCache(point: PointType): void;
|
|
451
458
|
finishSolvedCache(point: PointType, value: any): void;
|
|
452
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;
|
|
453
471
|
sheetPrefix(omit?: boolean): string;
|
|
454
472
|
rangeToArea(range: string): {
|
|
455
473
|
top: number;
|
|
@@ -458,6 +476,9 @@ export declare class Table implements UserTable {
|
|
|
458
476
|
right: number;
|
|
459
477
|
};
|
|
460
478
|
get __raw__(): Table;
|
|
479
|
+
get shape(): ShapeType;
|
|
480
|
+
get hasSingleCell(): boolean;
|
|
481
|
+
get currentVersion(): number;
|
|
461
482
|
}
|
|
462
483
|
export {};
|
|
463
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,6 +1,8 @@
|
|
|
1
1
|
import { FC, ReactNode } from 'react';
|
|
2
|
-
import { UserTable } from '../lib/table';
|
|
3
2
|
import { CellPatchType, CellType, OperationType, PointType } from '../types';
|
|
3
|
+
import { Table, UserTable } from '../lib/table';
|
|
4
|
+
import { FormulaError } from '../formula/formula-error';
|
|
5
|
+
import { Time } from '../lib/time';
|
|
4
6
|
export type AutocompleteOption = {
|
|
5
7
|
value: any;
|
|
6
8
|
label?: any;
|
|
@@ -9,28 +11,91 @@ export type AutocompleteOption = {
|
|
|
9
11
|
value?: any;
|
|
10
12
|
}>;
|
|
11
13
|
};
|
|
12
|
-
export type
|
|
14
|
+
export type SelectProps = {
|
|
13
15
|
table: UserTable;
|
|
14
16
|
point: PointType;
|
|
15
17
|
current?: CellType;
|
|
16
18
|
next?: CellType;
|
|
17
19
|
operation: OperationType;
|
|
18
20
|
};
|
|
19
|
-
export type
|
|
21
|
+
export type SerializeForClipboardProps = {
|
|
20
22
|
table: UserTable;
|
|
21
23
|
point: PointType;
|
|
22
24
|
};
|
|
23
|
-
export type
|
|
25
|
+
export type SelectFallbackProps = {
|
|
24
26
|
table: UserTable;
|
|
25
27
|
point: PointType;
|
|
26
28
|
value: any;
|
|
27
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
|
+
};
|
|
28
50
|
export type PolicyMixinType = {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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;
|
|
34
99
|
};
|
|
35
100
|
type PolicyProps = {
|
|
36
101
|
mixins?: PolicyMixinType[];
|
|
@@ -38,14 +103,59 @@ type PolicyProps = {
|
|
|
38
103
|
};
|
|
39
104
|
export declare class Policy implements PolicyMixinType {
|
|
40
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;
|
|
41
114
|
constructor(props?: PolicyProps);
|
|
115
|
+
private registerDeserializeFunctions;
|
|
42
116
|
private applyMixins;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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;
|
|
49
159
|
}
|
|
50
160
|
export type PolicyType = Policy;
|
|
51
161
|
export declare const DEFAULT_POLICY_NAME = "default";
|
package/dist/sentinels.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare class Sentinel {
|
|
2
2
|
readonly code: string;
|
|
3
|
-
readonly
|
|
3
|
+
readonly __gsType: "Sentinel";
|
|
4
4
|
constructor(code: string);
|
|
5
5
|
is(obj: any): obj is this;
|
|
6
6
|
static is(obj: any, code?: string): obj is Sentinel;
|
|
@@ -12,12 +12,28 @@ export declare const SOLVING: Sentinel;
|
|
|
12
12
|
* Dependent cells that encounter a Pending value also become pending.
|
|
13
13
|
*/
|
|
14
14
|
export declare class Pending<T = unknown> {
|
|
15
|
-
private
|
|
16
|
-
private readonly id;
|
|
15
|
+
private readonly timestamp;
|
|
17
16
|
readonly promise: Promise<T>;
|
|
18
|
-
readonly
|
|
17
|
+
readonly __gsType: "Pending";
|
|
19
18
|
constructor(promise: Promise<T>);
|
|
20
19
|
static is(obj: any): obj is Pending;
|
|
21
20
|
toString(): string;
|
|
22
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Returned by functions that want to spill a 2D result into adjacent cells.
|
|
24
|
+
*
|
|
25
|
+
* Usage in a function:
|
|
26
|
+
* return new Spilling([[1, 2], [3, 4]]);
|
|
27
|
+
*
|
|
28
|
+
* The solver detects Spilling via `Spilling.is()` and calls
|
|
29
|
+
* `table.spill(origin, result.matrix)` to perform obstruction checks
|
|
30
|
+
* and write values into the solvedCaches.
|
|
31
|
+
*/
|
|
32
|
+
export declare class Spilling {
|
|
33
|
+
readonly __gsType: "Spilling";
|
|
34
|
+
/** The 2D matrix of resolved values. matrix[row][col] */
|
|
35
|
+
readonly matrix: any[][];
|
|
36
|
+
constructor(matrix: any[][]);
|
|
37
|
+
static is(obj: any): obj is Spilling;
|
|
38
|
+
}
|
|
23
39
|
//# sourceMappingURL=sentinels.d.ts.map
|
package/dist/store/helpers.d.ts
CHANGED
|
@@ -9,6 +9,10 @@ export declare const restrictPoints: (store: StoreType, table: Table) => {
|
|
|
9
9
|
endX: number;
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
|
+
export declare const flashSheet: (el: HTMLElement | null) => void;
|
|
13
|
+
export declare const flashWithCallback: (store: StoreType, table: Table, callback: ((s: StoreType) => void) | undefined) => StoreType & {
|
|
14
|
+
callback?: (store: StoreType) => void;
|
|
15
|
+
};
|
|
12
16
|
export declare const shouldTracking: (operation: string) => boolean;
|
|
13
17
|
export declare const initSearchStatement: (table: Table, store: StoreType) => {
|
|
14
18
|
matchingCells: never[];
|