@sheetxl/sdk 0.8.0-beta.11 → 0.8.0-beta.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/esm/{BpgskG1Er_lGQ_yS.mjs → -Jx-jNHmtIQQfLvK.mjs} +1 -1
- package/browser/esm/{BLoUBId2xZpXAK_H.mjs → 2WuhYrIpYmOR5H73.mjs} +15 -15
- package/browser/esm/{Ctjb0SsxV4K4MMqG.mjs → 2mIwPy2D2JUX-9wx.mjs} +2 -2
- package/browser/esm/{CkxWugaJFjDGZNZ-.mjs → B3wf5vZCsWfWsDbj.mjs} +1 -1
- package/browser/esm/{BjkCiv5Jz6WYKZeu.mjs → BIHrHjRGWVlJglcp.mjs} +2 -2
- package/browser/esm/{BtvLTTfSBdAKplVG.mjs → BTFBedJMRWGvZyCE.mjs} +1 -1
- package/browser/esm/{C4MqfLn9Dm-l3OIk.mjs → BdCJNawfifyPupCP.mjs} +1 -1
- package/browser/esm/{CV5EGEjG5_-CPpP0.mjs → Bg5Di9GLNAkbqQ1P.mjs} +3 -3
- package/browser/esm/{C2VbEI_XVAoseAwa.mjs → BnC4-27Igwb8oDf2.mjs} +2 -2
- package/browser/esm/{CQYjO777cmAznUzK.mjs → Bt8_m94tBdks209L.mjs} +1 -1
- package/browser/esm/{C16ycKja6zG0crV_.mjs → BudSIfXBAsTxvu-K.mjs} +17836 -15712
- package/browser/esm/{DvAaxH6z_tGvrRzl.mjs → C9u8FUewte5ugUjH.mjs} +686 -686
- package/browser/esm/{DEiPS3Dr-s4fPbVZ.mjs → CBYMTDzMf1Vh7pkw.mjs} +1 -1
- package/browser/esm/{Dyq_ivuHvlXLwPCl.mjs → CNdjyofiRu6CYOrr.mjs} +1106 -1102
- package/browser/esm/{PcHFjNzQsE54POri.mjs → CRkYR-siY2C994KV.mjs} +1 -1
- package/browser/esm/{C5E6zSGAALWf61n4.mjs → CTe2qfmIUEad6FJv.mjs} +2 -2
- package/browser/esm/{BoV6zPBnfqCBCqZ7.mjs → CUzYuYTTGsChC_kZ.mjs} +3841 -3148
- package/browser/esm/CdEO8CEee6lEhabA.mjs +117 -0
- package/browser/esm/{S2dNNx1a5ydRnARM.mjs → CfRqiPDg6RBTg1EN.mjs} +2 -2
- package/browser/esm/{ClbvFbFzFzXLBKNN.mjs → CndRBvVfQUJIYRRj.mjs} +50 -50
- package/browser/esm/{BnG31I6Oj_HEtSPS.mjs → CwOPLXU3-9ZHGyOT.mjs} +1 -1
- package/browser/esm/{CHU6iu_WGlm7fLET.mjs → Cxjxk0ncRKx80I-w.mjs} +1 -1
- package/browser/esm/D2RZh0O9neOsyLAE.mjs +281 -0
- package/browser/esm/{BkBhLS0l6z8sxI6D.mjs → D64dM68B1pKYFzdP.mjs} +2 -2
- package/browser/esm/{BVDiOXGMc5_FMGfy.mjs → D9xNz46kAfXMZzp4.mjs} +2 -2
- package/browser/esm/{zlLuW405RSguy4Kn.mjs → DK899HhWX1HINMC1.mjs} +53 -53
- package/browser/esm/{B7aUIvgUjncMMD_i.mjs → DPhGQLNGmDZwODwJ.mjs} +5 -4
- package/browser/esm/{gssVX_FH1XFN-twD.mjs → DVroRnhi-5IDXNgM.mjs} +1 -1
- package/{node/esm/CZICGK_ss0HoGHCP.mjs → browser/esm/DZiivy0NmO1Vnyzk.mjs} +2 -2
- package/browser/esm/{ClPfI4lODvCece29.mjs → DgrAuRD2qr2DvFeJ.mjs} +61 -61
- package/browser/esm/{CU3DmJ-YnVVrC1_k.mjs → DobHLF6VjHr7Xi40.mjs} +1 -1
- package/browser/esm/{CaB7J-xgfKO2uAkG.mjs → DwZCT7DZiiXoTweg.mjs} +2 -2
- package/browser/esm/{BMyDRQ716j79h_bH.mjs → DwwR3O2sEZApPSTF.mjs} +6 -6
- package/browser/esm/{DLLE0FZNsKxbBzRn.mjs → Tah7cnFb_HNZdLtj.mjs} +45 -45
- package/browser/esm/{Dlmig06rIo7cInRk.mjs → fXWUMDhZ5yMSO629.mjs} +1 -1
- package/browser/esm/{DWNzqw7DUKwoxjri.mjs → hCQJcmIzPDxDEv2q.mjs} +2 -2
- package/browser/esm/index.mjs +679 -542
- package/browser/esm/{BFagR2JeWs74iAG3.mjs → qO-ujUrgq6H3TQix.mjs} +1 -1
- package/browser/esm/w6Jea0TiclPrYZ2M.mjs +1703 -0
- package/browser/esm/yuhcOYw6SHQ-RCm3.mjs +114 -0
- package/node/esm/-TA0MneBDKdGhsib.mjs +8668 -0
- package/node/esm/{B21JjOLghRoDOrkx.mjs → B-HUPAcqvK0eeeCz.mjs} +1 -1
- package/node/esm/{DNRhGK-8Tr9xcRyc.mjs → BL2iiEoqxDEV2Xrg.mjs} +3 -3
- package/node/esm/{D1TKBVmoKGAXf37B.mjs → BNXLOEddJ6O9gYws.mjs} +2 -2
- package/node/esm/{BrCKGFRsX_ezFJ4B.mjs → BSvOluusoDM4z_dx.mjs} +15 -15
- package/node/esm/{BIwObuhTJYf0jpUa.mjs → BskP3b8vUoIOGLY6.mjs} +2 -2
- package/node/esm/{2Kihw_-5lVTEnwMa.mjs → Btw4148Ot8ifhNc1.mjs} +1 -1
- package/node/esm/{BqiexuA89caYnAPz.mjs → C14-R6tifRh7pc0p.mjs} +1 -1
- package/node/esm/{DUTskXCXref-IJnI.mjs → C99zzq8DImQXi4BQ.mjs} +47 -47
- package/node/esm/{D8zEN-6ZdDqDvTxM.mjs → CBuEu5Jk-LfaDy-H.mjs} +61 -61
- package/node/esm/{yavzZOiZW_EjG9lE.mjs → CG-qBU5BAaVz7e-P.mjs} +1 -1
- package/node/esm/CPI58duc0j0a-HpJ.mjs +115 -0
- package/node/esm/{CCN5vD410obwdz38.mjs → CRt3vXe6YmXzqk3H.mjs} +15 -14
- package/node/esm/{CzXT00vrQa1_gvW9.mjs → C_aL7CGS1lrNn1Ng.mjs} +1 -1
- package/node/esm/{CZiqiay42tFTrLI4.mjs → C_xf5Bz30VqiJjXn.mjs} +1 -1
- package/node/esm/{BIRq1kT7lLRzns9t.mjs → CiIymQN6aJCul62g.mjs} +9 -9
- package/node/esm/{CNCNJNg890KdgkWh.mjs → Ci_zLYmCD7e-C79O.mjs} +1 -1
- package/{browser/esm/D5np__Jb1euAyaLw.mjs → node/esm/CkRYLed8Mmn3giNg.mjs} +2 -2
- package/node/esm/D3ptRKzASqBut1DE.mjs +117 -0
- package/node/esm/{cGwrLA1RCE-WhJ7w.mjs → D4ROK9UwDpS6jO3Z.mjs} +1 -1
- package/node/esm/{mFiBSM7XgBHV9AY7.mjs → D8hO07ToAibIuniw.mjs} +1535 -1531
- package/node/esm/{CDHdgJXH2vS71WMc.mjs → DUTmDHbFbhLDT4F3.mjs} +1 -1
- package/node/esm/{CGp6VZL-gZa9Uezx.mjs → DV5CU37aEbFbWFL0.mjs} +1 -1
- package/node/esm/{De2IONBxQhz-Qbyh.mjs → DdoiuKg9BKubtF1V.mjs} +1 -1
- package/node/esm/{Db0v7zXNnyjBIjjI.mjs → DggQ23jKMpwhENfa.mjs} +2 -2
- package/node/esm/{CwePQwTILHHjGDkZ.mjs → DhS6yWjrrSNIJMsn.mjs} +204 -204
- package/node/esm/{D_t5AUxSm7_icjzq.mjs → DhTya_mhmN53vskv.mjs} +1 -1
- package/node/esm/{DOU54VsOjG-m-NyQ.mjs → Dn1M7YWi25DeeYUb.mjs} +1 -1
- package/node/esm/{DkwIPzKc3UwdUIfM.mjs → DrCf6ITcBhVOFpRj.mjs} +6 -6
- package/node/esm/{D2KBymQJd1XhpeQD.mjs → DxazKtROyaI51dWl.mjs} +1 -1
- package/node/esm/{D6e2z7eZpxOJXHc7.mjs → Q_S1g46ZOTrdhTae.mjs} +1 -1
- package/node/esm/{OVfaSb506tNSIvbv.mjs → Vocy-I9dKzZMr0Ct.mjs} +19038 -16822
- package/node/esm/ZXPFcsT2zrALCZux.mjs +289 -0
- package/node/esm/{857CIBgQgGpnqrXk.mjs → eimUGjiIP-b8HiM6.mjs} +55 -55
- package/node/esm/{Bbf1Pm9Gk7YpLTvg.mjs → icn2nX5Z8e_3mNAv.mjs} +1 -1
- package/node/esm/index.mjs +740 -603
- package/node/esm/{Ct3h15sCus4Tgt6M.mjs → lGJ42sHqg5if2bba.mjs} +624 -616
- package/node/esm/{CdJHUJSBRHZoryPe.mjs → pYtP7wPyS96NQyXS.mjs} +59 -59
- package/package.json +6 -6
- package/resources/locales/de/model.msg.json +8 -2
- package/resources/locales/en/model.msg.json +9 -2
- package/types/scripting-api.json +10619 -10446
- package/types/scripting-enums.json +20 -1
- package/types/scripting.d.ts +1233 -296
- package/types/src/{sheet → anomalies}/_Anomalies.d.ts +3 -3
- package/types/src/anomalies/_FocusTable.d.ts +11 -0
- package/types/src/{sheet/_AnomalyFormulaChecks.d.ts → anomalies/_FormulaChecks.d.ts} +10 -2
- package/types/src/{sheet/_AnomalyLabelChecks.d.ts → anomalies/_LabelChecks.d.ts} +1 -1
- package/types/src/anomalies/_LiteralChecks.d.ts +35 -0
- package/types/src/anomalies/_SeriesChecks.d.ts +13 -0
- package/types/src/calculation/Calculation.d.ts +47 -9
- package/types/src/calculation/ExternalBookBindings.d.ts +2 -3
- package/types/src/calculation/ICalculation.d.ts +96 -9
- package/types/src/calculation/NamedFormulaCollection.d.ts +104 -8
- package/types/src/calculation/_CloneBoundary.d.ts +1 -1
- package/types/src/calculation/compiler/ASTTypes.d.ts +6 -2
- package/types/src/calculation/compiler/Types.d.ts +8 -0
- package/types/src/calculation/engine/CalcBackend.d.ts +104 -6
- package/types/src/calculation/executor/CalcExecutor.d.ts +73 -22
- package/types/src/calculation/executor/CalcExecutorUtils.d.ts +17 -1
- package/types/src/calculation/executor/_WhatIf.d.ts +50 -0
- package/types/src/calculation/formula/FormulaBlock.d.ts +4 -3
- package/types/src/calculation/formula/IFormulaBlock.d.ts +5 -0
- package/types/src/calculation/functions/_DataTableFunction.d.ts +14 -0
- package/types/src/calculation/grid/CalcGrid.d.ts +4 -6
- package/types/src/calculation/grid/CalcGridBackend.d.ts +5 -27
- package/types/src/calculation/grid/CalcGridProxy.d.ts +0 -2
- package/types/src/calculation/grid/CalcGridUtils.d.ts +4 -2
- package/types/src/calculation/grid/ICalcGrid.d.ts +16 -12
- package/types/src/calculation/grid/_CalcRequest.d.ts +17 -5
- package/types/src/calculation/spatial/FormulaSpatialValue.d.ts +2 -0
- package/types/src/calculation/spatial/SpillEntry.d.ts +16 -2
- package/types/src/calculation/state/CalcNode.d.ts +0 -1
- package/types/src/calculation/state/CalcScope.d.ts +29 -0
- package/types/src/calculation/state/CalcState.d.ts +26 -4
- package/types/src/calculation/state/CalculationContext.d.ts +28 -1
- package/types/src/calculation/state/DeferredCalls.d.ts +260 -0
- package/types/src/calculation/state/IContextContainer.d.ts +20 -0
- package/types/src/calculation/state/_PendingOverlayGrid.d.ts +6 -0
- package/types/src/calculation/state/_WhatIfLayer.d.ts +91 -0
- package/types/src/cell/ICell.d.ts +53 -34
- package/types/src/cellControl/CellControl.d.ts +67 -0
- package/types/src/cellControl/CellControlCollection.d.ts +29 -0
- package/types/src/cellControl/CellControlRegistry.d.ts +47 -0
- package/types/src/cellControl/ICellControl.d.ts +99 -0
- package/types/src/cellControl/ICellControlCollection.d.ts +67 -0
- package/types/src/cellControl/index.d.ts +4 -0
- package/types/src/cellRange/ICellRange.d.ts +207 -59
- package/types/src/cellRange/ICellRanges.d.ts +4 -3
- package/types/src/chart/layout/ChartLayout.d.ts +5 -1
- package/types/src/chart/resolve/_Resolve.d.ts +10 -0
- package/types/src/chart/resolve/_ResolvedChart.d.ts +5 -2
- package/types/src/collections/ISparseGrid.d.ts +11 -2
- package/types/src/collections/MixedTypedArrayList.d.ts +8 -2
- package/types/src/collections/SparseGrid.d.ts +3 -8
- package/types/src/condition/AnchoredConditional.d.ts +2 -2
- package/types/src/externalBook/IExternalBook.d.ts +3 -4
- package/types/src/fetch/Fetcher.d.ts +15 -0
- package/types/src/fetch/IFetcher.d.ts +47 -0
- package/types/src/fetch/_WorkbookFetch.d.ts +43 -0
- package/types/src/fetch/index.d.ts +3 -0
- package/types/src/fill/PaintUtils.d.ts +3 -1
- package/types/src/hyperlink/IHyperlink.d.ts +10 -0
- package/types/src/hyperlink/_Hyperlink.d.ts +4 -1
- package/types/src/index.d.ts +2 -1
- package/types/src/named/INamedCollection.d.ts +36 -0
- package/types/src/named/NamedCollection.d.ts +18 -0
- package/types/src/primitives/AsyncValue.d.ts +58 -0
- package/types/src/resource/IResource.d.ts +9 -0
- package/types/src/resource/IResourceCollection.d.ts +4 -0
- package/types/src/resource/Resource.d.ts +2 -0
- package/types/src/resource/_AddResource.d.ts +13 -0
- package/types/src/richData/CellImage.d.ts +95 -0
- package/types/src/richData/Hyperlink.d.ts +49 -0
- package/types/src/richData/IRichDataCollection.d.ts +76 -0
- package/types/src/richData/IRichDataKind.d.ts +55 -11
- package/types/src/richData/RichArray.d.ts +42 -0
- package/types/src/richData/RichDataCollection.d.ts +23 -0
- package/types/src/richData/RichDataRegistry.d.ts +46 -14
- package/types/src/richData/RichDataValues.d.ts +20 -0
- package/types/src/richData/RichRecord.d.ts +68 -0
- package/types/src/richData/RichText.d.ts +5 -5
- package/types/src/richData/index.d.ts +6 -0
- package/types/src/scripting/FunctionArguments.d.ts +17 -1
- package/types/src/scripting/FunctionCollection.d.ts +8 -0
- package/types/src/scripting/Scripts.d.ts +10 -0
- package/types/src/scripting/TypedFunction.d.ts +2 -0
- package/types/src/sheet/ICellContainerOptions.d.ts +6 -0
- package/types/src/sheet/IWorksheet.d.ts +24 -17
- package/types/src/sheet/SheetCell.d.ts +17 -1
- package/types/src/sheet/SheetRange.d.ts +8 -2
- package/types/src/sheet/SheetRanges.d.ts +2 -2
- package/types/src/sheet/Worksheet.d.ts +110 -56
- package/types/src/sheet/_ListenerAnchor.d.ts +7 -1
- package/types/src/sheet/_ScalarListFactory.d.ts +54 -6
- package/types/src/sheet/_SheetMutations.d.ts +4 -1
- package/types/src/sheet/_SheetStateTypes.d.ts +23 -11
- package/types/src/workbook/IWorkbook.d.ts +40 -1
- package/types/src/workbook/Workbook.d.ts +25 -3
- package/types/src/workbook/WorkbookRanges.d.ts +1 -1
- package/browser/esm/BGOFfpxr2jPIdqmV.mjs +0 -40
- package/browser/esm/f1IoRb7tEb0QmCSt.mjs +0 -110
- package/browser/esm/nvU0ClAbf0g94YBK.mjs +0 -1695
- package/node/esm/B084DssTcdBheTp_.mjs +0 -7966
- package/node/esm/Df1bL6VFvrqIdSLB.mjs +0 -40
- package/node/esm/DrTZbfemSLq2mseG.mjs +0 -111
- package/types/src/dataTable/DataTable.d.ts +0 -67
- package/types/src/dataTable/DataTableCollection.d.ts +0 -19
- package/types/src/dataTable/IDataTable.d.ts +0 -99
- package/types/src/dataTable/IDataTableCollection.d.ts +0 -18
- package/types/src/dataTable/index.d.ts +0 -6
|
@@ -260,6 +260,14 @@ export interface CompiledFormula {
|
|
|
260
260
|
* `_xlfn.`-prefixed one both answer correctly.
|
|
261
261
|
*/
|
|
262
262
|
hasTotals: boolean;
|
|
263
|
+
/**
|
|
264
|
+
* Whether the formula calls `TABLE`, the what-if data table, anywhere in its tree.
|
|
265
|
+
*
|
|
266
|
+
* @remarks
|
|
267
|
+
* What a reactive pass under `AutomaticExceptTables` skips (DESIGN-DATA-TABLES §4.4). Resolved
|
|
268
|
+
* through `getFunction`, like {@link hasTotals}.
|
|
269
|
+
*/
|
|
270
|
+
hasDataTable: boolean;
|
|
263
271
|
/**
|
|
264
272
|
* Whether the formula names a VOLATILE function anywhere in its tree — the cell recalculates on
|
|
265
273
|
* every pass, whether or not that call is ever reached.
|
|
@@ -2,6 +2,7 @@ import { IRange, IFormulaContext, IRuntime, Scalar } from '@sheetxl/primitives';
|
|
|
2
2
|
import { FunctionProvider } from '@sheetxl/scripting';
|
|
3
3
|
import { AbstractModel, IModel } from '../../model';
|
|
4
4
|
import { ITransaction } from '../../transaction';
|
|
5
|
+
import { IRichDataKind } from '../../richData/IRichDataKind';
|
|
5
6
|
import { ISpatialMap, ISpatialQuery, ISpatialMap3D, ISparseGrid } from '../../collections';
|
|
6
7
|
import { IExternalBookCollection } from '../../externalBook';
|
|
7
8
|
import { ICalculation } from '../ICalculation';
|
|
@@ -11,9 +12,12 @@ import { IFormulaCompiler } from '../compiler';
|
|
|
11
12
|
import { FormulaBlockResolvers, IFormulaBlock, FormulaImager } from '../formula';
|
|
12
13
|
import { CalculationContext } from '../state/CalculationContext';
|
|
13
14
|
import { IContextContainer, CalcNode, CalcScope } from '../state';
|
|
15
|
+
import { DeferredCalls, DeferredCall } from '../state/DeferredCalls';
|
|
16
|
+
import { AsyncValue } from '../../primitives/AsyncValue';
|
|
14
17
|
import { PrecedentSpatialValue, PrecedentKind } from '../spatial';
|
|
15
18
|
import { FormulaSpatialValue } from '../spatial/FormulaSpatialValue';
|
|
16
19
|
import { CalcExecutor } from '../executor/CalcExecutor';
|
|
20
|
+
import { WhatIfTable } from '../executor/_WhatIf';
|
|
17
21
|
import { CalcGridBackend } from '../grid/CalcGridBackend';
|
|
18
22
|
import { ICalcGrid, FormulaHost } from '../grid';
|
|
19
23
|
import { CalcRequest, CalcResponse, CalcGridSpec, TableSymbols, NameSymbols } from '../grid/_CalcRequest';
|
|
@@ -34,6 +38,7 @@ import { ISymbolRegistry } from '../symbol';
|
|
|
34
38
|
export declare class CalcBackend extends AbstractModel<CalcBackend.State> implements IContextContainer {
|
|
35
39
|
protected _callbacks: CalcBackend.Callbacks;
|
|
36
40
|
protected _runtime: IRuntime;
|
|
41
|
+
protected _richData: IRichDataKind.Context;
|
|
37
42
|
protected _symbols: ISymbolRegistry;
|
|
38
43
|
protected _resolvers: FormulaBlockResolvers;
|
|
39
44
|
protected _getSheetIndex: ((sheetName?: string) => number) | null;
|
|
@@ -52,6 +57,7 @@ export declare class CalcBackend extends AbstractModel<CalcBackend.State> implem
|
|
|
52
57
|
protected _epochSeenPrecedents: ISpatialMap3D<PrecedentSpatialValue> | null;
|
|
53
58
|
protected _epochSeenDynamics: Map<FormulaSpatialValue, ISpatialMap.Entry<PrecedentSpatialValue>[]> | null;
|
|
54
59
|
protected _volatiles: Set<CalcNode>;
|
|
60
|
+
protected _deferred: DeferredCalls;
|
|
55
61
|
protected _calculatedCommitId: string | null;
|
|
56
62
|
protected _calculatedEngineId: string | null;
|
|
57
63
|
/** The engine holds grids: from a start's boot until a stop. */
|
|
@@ -94,8 +100,47 @@ export declare class CalcBackend extends AbstractModel<CalcBackend.State> implem
|
|
|
94
100
|
getContext(): CalculationContext & IFormulaContext;
|
|
95
101
|
/** {@inheritDoc IContextContainer.getRuntime} */
|
|
96
102
|
getRuntime(): IRuntime;
|
|
103
|
+
/** {@inheritDoc IContextContainer.getRichDataContext} */
|
|
104
|
+
getRichDataContext(): IRichDataKind.Context;
|
|
97
105
|
/** {@inheritDoc IContextContainer.getScope} */
|
|
98
106
|
getScope(): CalcScope;
|
|
107
|
+
/** {@inheritDoc IContextContainer.getDeferred} */
|
|
108
|
+
getDeferred(): DeferredCalls;
|
|
109
|
+
/**
|
|
110
|
+
* The settle pass (DESIGN-ASYNC §4.5): a change with no write, for every call whose latest
|
|
111
|
+
* moved since the last one.
|
|
112
|
+
*
|
|
113
|
+
* @remarks
|
|
114
|
+
* A cell whose formula is its one call reads the latest through its holder: the model is told
|
|
115
|
+
* the cell's value as it reads now, its pending status clears, and its dependents are marked
|
|
116
|
+
* dirty — never the cell itself. A cell whose formula is more than its call is marked dirty
|
|
117
|
+
* itself, and its next evaluation serves each site its call. One settle pass follows, seeded from
|
|
118
|
+
* what was marked and nothing else, and vends the repaints with its results.
|
|
119
|
+
*
|
|
120
|
+
* A call whose owner's cell no longer names it — the cell was edited, or its version is not the
|
|
121
|
+
* current one — settles into that version's holder and nothing here.
|
|
122
|
+
*/
|
|
123
|
+
protected _settle(): void;
|
|
124
|
+
/**
|
|
125
|
+
* Cancels every call `cover` covers (`ICalculation.cancelAsync`, DESIGN-ASYNC §4.6): each is
|
|
126
|
+
* closed and its `onCancel` runs. Each owner whose cell still names its call re-evaluates in a
|
|
127
|
+
* settle pass: served the closed call, it shows what it did and is no longer pending.
|
|
128
|
+
*
|
|
129
|
+
* @returns The settle pass, or `null` when nothing was cancelled.
|
|
130
|
+
*/
|
|
131
|
+
cancelAsync(cover: true | string | IRange.Coords): Promise<ICalculation.Status> | null;
|
|
132
|
+
/**
|
|
133
|
+
* A call's result as a cell can hold it (`DeferredCalls.Normalize`): an array becomes a range
|
|
134
|
+
* as a body's array return does, a one-cell range its scalar, a jagged array `#VALUE!`.
|
|
135
|
+
*/
|
|
136
|
+
protected _normalizeResult(value: unknown): unknown;
|
|
137
|
+
/**
|
|
138
|
+
* The holder at a cell: the engine grid's value there, else the entry of the spill anchored
|
|
139
|
+
* there (an anchor cell holds its first element; the spill's entry carries the holder). `null`
|
|
140
|
+
* for a cell with neither.
|
|
141
|
+
*/
|
|
142
|
+
protected _holderAt(gridId: string, row: number, column: number): AsyncValue<DeferredCall> | null;
|
|
143
|
+
protected _settleNow(): void;
|
|
99
144
|
/** {@inheritDoc IContextContainer.createFormulaBlock} */
|
|
100
145
|
createFormulaBlock(gridId: string, context: IFormulaContext, expression: string, rowIndex: number, colIndex: number, editing?: ICalculation.FormulaTarget, legacyIntersect?: boolean): IFormulaBlock;
|
|
101
146
|
/** {@inheritDoc IContextContainer.getSymbols} */
|
|
@@ -129,6 +174,8 @@ export declare class CalcBackend extends AbstractModel<CalcBackend.State> implem
|
|
|
129
174
|
setDynamics(map: Map<FormulaSpatialValue, ISpatialMap.Entry<PrecedentSpatialValue>[]>): void;
|
|
130
175
|
/** {@inheritDoc IContextContainer.addDynamicPrecedent} */
|
|
131
176
|
addDynamicPrecedent(node: CalcNode, range: IRange.Coords | undefined, kind: PrecedentKind): void;
|
|
177
|
+
/** {@inheritDoc IContextContainer.evaluateWhatIf} */
|
|
178
|
+
evaluateWhatIf(table: WhatIfTable): Scalar[][];
|
|
132
179
|
/** {@inheritDoc IContextContainer.getVolatiles} */
|
|
133
180
|
getVolatiles(): Set<CalcNode>;
|
|
134
181
|
/** {@inheritDoc IContextContainer.isLegacyIntersect} */
|
|
@@ -234,6 +281,33 @@ export declare class CalcBackend extends AbstractModel<CalcBackend.State> implem
|
|
|
234
281
|
* second hop) and the diamond guard both.
|
|
235
282
|
*/
|
|
236
283
|
getNamedDependentNames(nameId: string): ReadonlySet<string>;
|
|
284
|
+
/**
|
|
285
|
+
* What a `nameGraph` request answers: a defined name's precedents or dependents, cells scoped by
|
|
286
|
+
* grid and names as nodes - ONE answer, as a cell's is.
|
|
287
|
+
*
|
|
288
|
+
* @remarks
|
|
289
|
+
* The PRECEDENTS: the cell half is the ordinary precedent graph of the name's grid - a body is a
|
|
290
|
+
* real formula there, and its references registered precedent ranges like any cell's. The name
|
|
291
|
+
* half is the body's `getNamedIds`: apply-at-eval means a name the body reads has no precedent
|
|
292
|
+
* edge, so the symbol list is the only carrier - one hop for `direct`, the downward closure
|
|
293
|
+
* (cycle-guarded) for the deep form, each member contributing its own grid's cell walk. The deep
|
|
294
|
+
* form does not take the symbol hop from UPSTREAM CELLS (`X = A1*2`, `A1 = SomeName`: `A1` is
|
|
295
|
+
* listed and `SomeName`'s inputs are not) - that hop is `A1`'s, one step of a tree walk. A name
|
|
296
|
+
* with no grid (it has not compiled) has nothing to walk.
|
|
297
|
+
*
|
|
298
|
+
* The DEPENDENTS: two graphs meet, and the walk changes vehicles between them. The symbol edge -
|
|
299
|
+
* which formulas mention this name - is not in the precedent spatial at all; it is the symbol
|
|
300
|
+
* index ({@link getNamedDependents}), keyed by the name's id, so the name's own grid is never
|
|
301
|
+
* read: a name that has not compiled is answered as one that has. The cell edge is the precedent
|
|
302
|
+
* graph, which carries everything downstream of those blocks: `direct` is one hop of the first;
|
|
303
|
+
* the deep form takes it, then hands each landing block to its grid. A block on a watch's grid
|
|
304
|
+
* (a conditional format, a validation, a chart) is the cells it is attached to, on the sheet the
|
|
305
|
+
* watch shadows. A block on any other grid that is no sheet is another NAME reading this one: a
|
|
306
|
+
* node, and the deep walk passes THROUGH it on the symbol closure (`getNamedDependentNames`), or
|
|
307
|
+
* `Base`'s dependents would stop at `Plus1`. This name is listed only when a true cycle leads
|
|
308
|
+
* back to it.
|
|
309
|
+
*/
|
|
310
|
+
protected _nameGraphNow(nameId: string, kind: 'precedents' | 'dependents', direct: boolean): ICalcGrid.GraphNeighbors;
|
|
237
311
|
/** A grid of the backend's, registered. */
|
|
238
312
|
createBackendGrid(options?: CalcGridBackend.ConstructorOptions): CalcGridBackend;
|
|
239
313
|
/**
|
|
@@ -267,7 +341,7 @@ export declare class CalcBackend extends AbstractModel<CalcBackend.State> implem
|
|
|
267
341
|
getExternalNameByScope(name: string, scopeId: string): ExternalNamedItem | null;
|
|
268
342
|
/**
|
|
269
343
|
* Applies one request from the channel: the service's own (`sheets`, `tables`, `names`,
|
|
270
|
-
* `rollback`, `create`) here, a grid's on its grid. A request for a grid the engine does not hold
|
|
344
|
+
* `nameGraph`, `rollback`, `create`) here, a grid's on its grid. A request for a grid the engine does not hold
|
|
271
345
|
* is answered with nothing.
|
|
272
346
|
*
|
|
273
347
|
* @param held The request was held while the engine came up: it lands under the engine's
|
|
@@ -649,9 +723,6 @@ export declare class CalcBackend extends AbstractModel<CalcBackend.State> implem
|
|
|
649
723
|
get [Symbol.toStringTag](): string;
|
|
650
724
|
toString(): string;
|
|
651
725
|
}
|
|
652
|
-
/**
|
|
653
|
-
* Interfaces for creating a {@link CalcBackend}.
|
|
654
|
-
*/
|
|
655
726
|
export declare namespace CalcBackend {
|
|
656
727
|
/**
|
|
657
728
|
* What the backend asks of the calculation that made it: the in-process half of the backend's
|
|
@@ -672,14 +743,19 @@ export declare namespace CalcBackend {
|
|
|
672
743
|
onRestored(): void;
|
|
673
744
|
/** Something was marked out of date: the calculation state may have changed. */
|
|
674
745
|
onDirty(): void;
|
|
746
|
+
/** The count of async calls pending may have changed. */
|
|
747
|
+
onPendingChange(): void;
|
|
675
748
|
/** A replica of tables or names changed: what its symbols resolve to now is reconciled. */
|
|
676
749
|
onSymbolsChanged(kind: 'tables' | 'names'): void;
|
|
677
750
|
/** Runs an action at the calculation's next safe point; a `priority` one ahead of the rest. */
|
|
678
751
|
whenSafe(action: () => Promise<unknown>, priority: boolean): void;
|
|
679
752
|
/** Whether the calculation is loading: draining, or starting. */
|
|
680
753
|
isLoading(): boolean;
|
|
681
|
-
/**
|
|
682
|
-
|
|
754
|
+
/**
|
|
755
|
+
* Runs a pass: explicit without `gridId`, reactive for it with one; a settle pass with
|
|
756
|
+
* `settle`, seeded from what the settle marked only (DESIGN-ASYNC §4.5).
|
|
757
|
+
*/
|
|
758
|
+
calculate(options?: ICalculation.CalculateOptions, gridId?: string, settle?: boolean): Promise<ICalculation.Status>;
|
|
683
759
|
/** Owes a reactive pass for `gridId`, run once the current flush is over. */
|
|
684
760
|
owePass(gridId: string): void;
|
|
685
761
|
/** Whether a grid id is a defined name's: its virtual grid's id is the name's. */
|
|
@@ -733,6 +809,8 @@ export declare namespace CalcBackend {
|
|
|
733
809
|
gridId: string;
|
|
734
810
|
/** Evaluates `block` - this one, or a repair of it - at the formula's cell. */
|
|
735
811
|
evaluate(block: IFormulaBlock, evalIndex: number | undefined, alwaysReturnRange: boolean): Scalar | IRange;
|
|
812
|
+
/** The calls the last evaluation made or was served; none when it did not defer. */
|
|
813
|
+
getCalls(): readonly DeferredCall[];
|
|
736
814
|
}
|
|
737
815
|
/** The three replicas, as a start seeds them. */
|
|
738
816
|
interface Replica {
|
|
@@ -750,6 +828,17 @@ export declare namespace CalcBackend {
|
|
|
750
828
|
calcCoords?: IRange.Coords;
|
|
751
829
|
/** The grid whose reactive pass this is; absent for an explicit one. */
|
|
752
830
|
gridId?: string;
|
|
831
|
+
/**
|
|
832
|
+
* The settle pass (DESIGN-ASYNC §4.5, §4.8): seeded from the regions the settle marked only.
|
|
833
|
+
* Volatiles are not collected and the dirty set is left for the pass that owes it, so a
|
|
834
|
+
* landing result neither re-rolls `RAND` nor runs the recalculation manual mode withholds.
|
|
835
|
+
*/
|
|
836
|
+
settle?: boolean;
|
|
837
|
+
/**
|
|
838
|
+
* `ICalculation.CalculateOptions.external`: the calls the pass makes fetch past the workbook's
|
|
839
|
+
* cache, to the source.
|
|
840
|
+
*/
|
|
841
|
+
external?: boolean;
|
|
753
842
|
/** Iterative calculation's limits, or `null` when it is off. */
|
|
754
843
|
iterate: {
|
|
755
844
|
maxIteration: number;
|
|
@@ -757,6 +846,11 @@ export declare namespace CalcBackend {
|
|
|
757
846
|
} | null;
|
|
758
847
|
/** The model operation open now: what the pass's results are realized under. */
|
|
759
848
|
openOperationId: string | null;
|
|
849
|
+
/**
|
|
850
|
+
* A reactive pass under `AutomaticExceptTables`: the what-if data tables (`TABLE` nodes) are
|
|
851
|
+
* skipped and stay out of date (DESIGN-DATA-TABLES §4.4). Ignored by a full pass.
|
|
852
|
+
*/
|
|
853
|
+
exceptTables?: boolean;
|
|
760
854
|
}
|
|
761
855
|
interface ConstructorOptions {
|
|
762
856
|
callbacks: Callbacks;
|
|
@@ -778,6 +872,10 @@ export declare namespace CalcBackend {
|
|
|
778
872
|
calculation: ICalculation;
|
|
779
873
|
/** The external books the bindings mirror. */
|
|
780
874
|
books: IExternalBookCollection;
|
|
875
|
+
/** What rich values a formula makes are made for; omitted, made outside any workbook. */
|
|
876
|
+
richData?: IRichDataKind.Context;
|
|
877
|
+
/** What async functions fetch through (`IBatchContext.fetch`); omitted, the global `fetch`. */
|
|
878
|
+
fetch?: (input: string, init?: RequestInit) => Promise<Response>;
|
|
781
879
|
/** The replicas as the owner holds them when the start was asked for. */
|
|
782
880
|
replica?: Replica;
|
|
783
881
|
/** The model's current commit, mirrored first. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IRange, IFormulaContext } from '@sheetxl/primitives';
|
|
1
|
+
import { IRange, Scalar, IFormulaContext } from '@sheetxl/primitives';
|
|
2
2
|
import { FixedPackedArray } from '../../primitives/PrimitiveUtils';
|
|
3
3
|
import { PendingOverlayGrid } from '../state/_PendingOverlayGrid';
|
|
4
4
|
import { ISpatialMap, ISpatialMap3D } from '../../collections';
|
|
@@ -6,21 +6,20 @@ import { FormulaSpatialValue, PrecedentSpatialValue, PrecedentKind } from '../sp
|
|
|
6
6
|
import { ICalcGrid, CalcGridBackend } from '../grid';
|
|
7
7
|
import { IContextContainer, CalcNode } from '../state';
|
|
8
8
|
import { ReadHook } from '../state/_ReadObservedGrid';
|
|
9
|
+
import { DeferredCall } from '../state/DeferredCalls';
|
|
10
|
+
import { AsyncValue } from '../../primitives/AsyncValue';
|
|
11
|
+
import { WhatIfTable } from './_WhatIf';
|
|
12
|
+
import { WhatIfLayer } from '../state/_WhatIfLayer';
|
|
9
13
|
import { CircularReference, CycleHost } from './CircularReference';
|
|
10
14
|
/**
|
|
11
15
|
* Executes a calculation cycle: collect → mark-and-plan → evaluate.
|
|
12
16
|
*
|
|
13
|
-
* Owns cycle counters
|
|
14
|
-
*
|
|
15
|
-
* state; CalcExecutor receives snapshots and returns results.
|
|
17
|
+
* Owns cycle counters and all transient per-pass state. `Calculation` is the controller that
|
|
18
|
+
* owns persistent spatial state; CalcExecutor receives snapshots and returns results.
|
|
16
19
|
*/
|
|
17
20
|
export declare class CalcExecutor {
|
|
18
21
|
protected _container: IContextContainer;
|
|
19
22
|
protected _context: IFormulaContext;
|
|
20
|
-
private readonly _requestCalculate;
|
|
21
|
-
protected _pendingCalcs: Map<CalcNode, number>;
|
|
22
|
-
/** Debounced drain of {@link _pendingCalcs} into the volatile set; one instance for the executor's lifetime. */
|
|
23
|
-
private readonly _flushPendingCalcs;
|
|
24
23
|
/**
|
|
25
24
|
* The last pass's circular roster: every node it evaluated by demand (a `doMarkAndPlan` that
|
|
26
25
|
* could not order, or the iteration guard's hand-over) plus every node whose dynamic read
|
|
@@ -91,6 +90,13 @@ export declare class CalcExecutor {
|
|
|
91
90
|
protected _deferredLength: number;
|
|
92
91
|
/** The pass the hook answers for; inert otherwise. Set by `doMarkAndPlan`, released with `_gridUpdates`. */
|
|
93
92
|
protected _passActive: boolean;
|
|
93
|
+
/** The pass in progress is a settle pass (`ExecuteOptions.settle`): its seeds are the settles' alone. */
|
|
94
|
+
protected _settlePass: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* The holder {@link _takeDeferred} made for an evaluation whose value is a range: the value keeps
|
|
97
|
+
* its shape for the spill layout, which puts the holder on the spill's entry. Taken at once.
|
|
98
|
+
*/
|
|
99
|
+
protected _spillHolder: AsyncValue<DeferredCall> | null;
|
|
94
100
|
protected _passCycleId: number;
|
|
95
101
|
protected _passMarkId: number;
|
|
96
102
|
/**
|
|
@@ -105,6 +111,19 @@ export declare class CalcExecutor {
|
|
|
105
111
|
* while a pass evaluates. Released with {@link _flush}.
|
|
106
112
|
*/
|
|
107
113
|
_overlays: Map<string, PendingOverlayGrid> | null;
|
|
114
|
+
/**
|
|
115
|
+
* The what-if layers of the data table being evaluated, per grid id (DESIGN-DATA-TABLES §4.3):
|
|
116
|
+
* what `getGridValues` hands every read while a `TABLE` node runs its substitutions. `null`
|
|
117
|
+
* otherwise.
|
|
118
|
+
*/
|
|
119
|
+
_whatIf: Map<string, WhatIfLayer> | null;
|
|
120
|
+
/**
|
|
121
|
+
* A reactive pass under `AutomaticExceptTables`: a `TABLE` node is not evaluated, and is left
|
|
122
|
+
* dirty ({@link _skippedTables}). Set for the length of `execute`.
|
|
123
|
+
*/
|
|
124
|
+
protected _exceptTables: boolean;
|
|
125
|
+
/** The `TABLE` nodes the pass in progress skipped, for `ExecuteResult.skippedTables`. */
|
|
126
|
+
protected _skippedTables: Set<CalcNode>;
|
|
108
127
|
/**
|
|
109
128
|
* The blank regions of the blocks whose representative could not stand for them this plan
|
|
110
129
|
* (PLAN-WATCHES-BLANK-AWARE §4), and the cells of the regions that WERE shared whose value the
|
|
@@ -193,20 +212,9 @@ export declare class CalcExecutor {
|
|
|
193
212
|
protected _planMemos: [CalcExecutor.PlanMemo, CalcExecutor.PlanMemo];
|
|
194
213
|
/** The memos' LRU clock. Its own counter, NOT `PlanStats.passes`: a stats reset must not reorder the slots. */
|
|
195
214
|
protected _planMemoClock: number;
|
|
196
|
-
/**
|
|
197
|
-
* Nodes with an async promise in flight. Per executor, NOT module scope — module scope would
|
|
198
|
-
* cross-pollute workbook instances (undo to 0 formulas needs to clear these; TODO - revisit
|
|
199
|
-
* how we manage promises).
|
|
200
|
-
*/
|
|
201
|
-
protected _pendingPromises: Set<CalcNode>;
|
|
202
215
|
_gridUpdates: Map<string, ICalcGrid.IncrementalUpdates> | null;
|
|
203
216
|
_addDynamicPrecedent: ((node: CalcNode, range: IRange.Coords | undefined, kind: PrecedentKind) => void) | null;
|
|
204
|
-
constructor(container: IContextContainer, context: IFormulaContext
|
|
205
|
-
/**
|
|
206
|
-
* Called when an async formula promise resolves. Adds the node to the pending
|
|
207
|
-
* queue and debounces a new calculation cycle via `requestCalculate`.
|
|
208
|
-
*/
|
|
209
|
-
scheduleRecalculation: (cycleId: number, calcNode?: CalcNode) => void;
|
|
217
|
+
constructor(container: IContextContainer, context: IFormulaContext);
|
|
210
218
|
/**
|
|
211
219
|
* Runs a full calculation pass.
|
|
212
220
|
*
|
|
@@ -216,6 +224,14 @@ export declare class CalcExecutor {
|
|
|
216
224
|
* nothing was dirty.
|
|
217
225
|
*/
|
|
218
226
|
execute(cycleId: number, options: CalcExecutor.ExecuteOptions, state: CalcExecutor.ExecuteState): CalcExecutor.ExecuteResult | null;
|
|
227
|
+
/**
|
|
228
|
+
* Takes the calls an evaluation of `node` deferred (DESIGN-ASYNC §4.4): the cell's value is an
|
|
229
|
+
* `AsyncValue` over them and what the formula calculated from their initials, and the node is
|
|
230
|
+
* pending with it while any is open.
|
|
231
|
+
*/
|
|
232
|
+
protected _takeDeferred(node: CalcNode, value: any): any;
|
|
233
|
+
/** The cells of the `TABLE` nodes the pass skipped, scoped; `undefined` for none. */
|
|
234
|
+
private _takeSkippedTables;
|
|
219
235
|
/**
|
|
220
236
|
* The read hook of a pass (DESIGN-CIRCULAR-CALC.md §4.3, §5), shared by both paths: armed for
|
|
221
237
|
* every reference while a node is evaluated by demand, and for dynamic-branch references
|
|
@@ -332,6 +348,24 @@ export declare class CalcExecutor {
|
|
|
332
348
|
* `flush` of the `doEvaluate` that made it, and only that one.
|
|
333
349
|
*/
|
|
334
350
|
private _overlayFor;
|
|
351
|
+
/**
|
|
352
|
+
* The results of a what-if data table, for the `TABLE` node being evaluated
|
|
353
|
+
* (DESIGN-DATA-TABLES §4.3): the affected nodes re-evaluated under each substitution of §2.2,
|
|
354
|
+
* through layers over what the grids read as now, the pass's uncommitted results included.
|
|
355
|
+
*
|
|
356
|
+
* @remarks
|
|
357
|
+
* The read hooks and the dynamic-edge accumulator are set aside while it runs: every member
|
|
358
|
+
* read is a plain read through the layers and registers no edge. The table's own reads of its
|
|
359
|
+
* edge, which order it and register its edges, are made before (`_DataTableFunction`). The calc
|
|
360
|
+
* scope is the table's again on return.
|
|
361
|
+
*/
|
|
362
|
+
evaluateWhatIf(table: WhatIfTable): Scalar[][];
|
|
363
|
+
/**
|
|
364
|
+
* One node evaluated where it sits, under the what-if layers (DESIGN-DATA-TABLES §4.3): its
|
|
365
|
+
* input slots are cleared so every read falls through to the funnel, as a demand evaluation's
|
|
366
|
+
* do. An async result stands as the cell's last value; so does a read that raised a signal.
|
|
367
|
+
*/
|
|
368
|
+
private _evaluateWhatIf;
|
|
335
369
|
/**
|
|
336
370
|
* A finalized result fitted to its cell when the block makes every cell its own 1x1
|
|
337
371
|
* array-entered extent (`FormulaSpatialValue.arrayFirstCell`): element `[0,0]` of a range, so the
|
|
@@ -520,7 +554,7 @@ export declare class CalcExecutor {
|
|
|
520
554
|
* A `CalcNode` is a plain graph object reachable by identity long after the grid has replaced or
|
|
521
555
|
* dropped its block — the same hazard `doCollectVolatileCalcs` guards against with `isLiveBlock`.
|
|
522
556
|
*/
|
|
523
|
-
|
|
557
|
+
isLiveNode(node: CalcNode): boolean;
|
|
524
558
|
/**
|
|
525
559
|
* @internal
|
|
526
560
|
* A copy of the last pass's circular roster — see {@link _circularNodesLength} — each node
|
|
@@ -587,7 +621,7 @@ export declare class CalcExecutor {
|
|
|
587
621
|
* one if there is one, else the least recently used.
|
|
588
622
|
*/
|
|
589
623
|
private _rememberPlan;
|
|
590
|
-
doEvaluate(cycleId: number, getUpdates: (scope: string) => ICalcGrid.IncrementalUpdates,
|
|
624
|
+
doEvaluate(cycleId: number, getUpdates: (scope: string) => ICalcGrid.IncrementalUpdates, commit: (calcNodes: CalcNode[], calcNodesLength: number) => void, forceFull: boolean, plan: FixedPackedArray<CalcNode>): ISpatialMap | undefined;
|
|
591
625
|
}
|
|
592
626
|
export declare namespace CalcExecutor {
|
|
593
627
|
/** Per-pass options derived from ICalculation.CalculateOptions */
|
|
@@ -603,10 +637,25 @@ export declare namespace CalcExecutor {
|
|
|
603
637
|
* The grid to seed the pass FROM — `ICalculation.CalculateOptions.scope`, i.e. "Calculate Sheet".
|
|
604
638
|
*/
|
|
605
639
|
scopeGridId?: string;
|
|
640
|
+
/**
|
|
641
|
+
* The settle pass (DESIGN-ASYNC §4.5): seeded from what the settles marked only; the volatiles
|
|
642
|
+
* and the dirty set are left for the pass that owes them.
|
|
643
|
+
*/
|
|
644
|
+
settle?: boolean;
|
|
645
|
+
/**
|
|
646
|
+
* `ICalculation.CalculateOptions.external`: the calls the pass makes fetch past the workbook's
|
|
647
|
+
* cache, to the source.
|
|
648
|
+
*/
|
|
649
|
+
external?: boolean;
|
|
606
650
|
/**
|
|
607
651
|
* Iterative calculation (design §6.3) for the pass; `null`/absent with it off.
|
|
608
652
|
*/
|
|
609
653
|
iterate?: IterateOptions | null;
|
|
654
|
+
/**
|
|
655
|
+
* A reactive pass under `AutomaticExceptTables`: `TABLE` nodes are skipped and left dirty
|
|
656
|
+
* (DESIGN-DATA-TABLES §4.4); they come back in {@link ExecuteResult.skippedTables}.
|
|
657
|
+
*/
|
|
658
|
+
exceptTables?: boolean;
|
|
610
659
|
}
|
|
611
660
|
/** The two limits of `ICalculation.IterativeCalculation`. */
|
|
612
661
|
interface IterateOptions {
|
|
@@ -708,6 +757,8 @@ export declare namespace CalcExecutor {
|
|
|
708
757
|
precedentSpatial: ISpatialMap3D<PrecedentSpatialValue>;
|
|
709
758
|
dynamicByBlock: Map<FormulaSpatialValue, ISpatialMap.Entry<PrecedentSpatialValue>[]>;
|
|
710
759
|
lastUpdates: Map<string, ICalcGrid.IncrementalUpdates>;
|
|
760
|
+
/** The cells of the `TABLE` nodes an `exceptTables` pass skipped, scoped: still out of date. */
|
|
761
|
+
skippedTables?: IRange.Coords[];
|
|
711
762
|
}
|
|
712
763
|
}
|
|
713
764
|
//# sourceMappingURL=CalcExecutor.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IRange, Scalar } from '@sheetxl/primitives';
|
|
2
|
-
import { Tuple, ISpatialMap } from '../../collections';
|
|
2
|
+
import { Tuple, ISpatialMap, ISpatialQuery } from '../../collections';
|
|
3
3
|
import { CalcSignal } from '../../primitives/CalcSignal';
|
|
4
4
|
import { CalcNode } from '../state';
|
|
5
5
|
import { PrecedentSpatialValue, FormulaSpatialValue } from '../spatial';
|
|
@@ -62,6 +62,22 @@ export declare function fitToExtent(value: Scalar | IRange, rowCount: number, co
|
|
|
62
62
|
* to. `null` when every fitted cell is blank.
|
|
63
63
|
*/
|
|
64
64
|
export declare function fitToTuples(value: Scalar | IRange, coords: IRange.Coords, isColumn: boolean): Tuple.Region<Scalar> | null;
|
|
65
|
+
/**
|
|
66
|
+
* Visits, for every precedent entry that reads into `region`, the window of its block whose cells
|
|
67
|
+
* can see the region - the discovery step of a dirty walk (`CalcExecutor.doCollectDirtyCalcs`)
|
|
68
|
+
* and of a data table's affected set (`_WhatIf`).
|
|
69
|
+
*
|
|
70
|
+
* @remarks
|
|
71
|
+
* An entry spans the REFERENCED region, which may be larger than the block (a relative reference
|
|
72
|
+
* is widened per block cell), so the region is mapped back through that overflow to the block's
|
|
73
|
+
* own coordinates. An anchored endpoint sits at the same coordinate for every cell of the block,
|
|
74
|
+
* so it stops bounding which cells saw the change - that side opens to the whole block. The END
|
|
75
|
+
* endpoint bounds the near side, the START endpoint the far side (see `PrecedentSpatialValue`).
|
|
76
|
+
* A dynamic entry (`index < 0`) has no extent to map: it is reported whole.
|
|
77
|
+
*
|
|
78
|
+
* @param scratch An array the search fills; the caller's, reused across calls.
|
|
79
|
+
*/
|
|
80
|
+
export declare function visitReaderWindows(precedentSpatial: ISpatialQuery<PrecedentSpatialValue>, region: IRange.Coords, scratch: ISpatialMap.Entry<PrecedentSpatialValue>[], visitWindow: (block: FormulaSpatialValue, rowFrom: number, rowTo: number, colFrom: number, colTo: number) => void, visitDynamic: (entry: ISpatialMap.Entry<PrecedentSpatialValue>, block: FormulaSpatialValue) => void): void;
|
|
65
81
|
/**
|
|
66
82
|
* TODO - document and/or rationalize with visitPrecedentBlock
|
|
67
83
|
*/
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { IRange, Scalar } from '@sheetxl/primitives';
|
|
2
|
+
import { CalcNode, IContextContainer } from '../state';
|
|
3
|
+
import { WhatIfLayer } from '../state/_WhatIfLayer';
|
|
4
|
+
/**
|
|
5
|
+
* A what-if data table as its `TABLE` formula states it (DESIGN-DATA-TABLES §1): the results'
|
|
6
|
+
* top-left cell and size, and the input cells, all on one grid.
|
|
7
|
+
*/
|
|
8
|
+
export interface WhatIfTable {
|
|
9
|
+
gridId: string;
|
|
10
|
+
/** The top-left result cell: where the `TABLE` formula sits. */
|
|
11
|
+
row: number;
|
|
12
|
+
col: number;
|
|
13
|
+
rows: number;
|
|
14
|
+
cols: number;
|
|
15
|
+
/** The cell the row axis values go into; `null` for a one-input table down a column. */
|
|
16
|
+
rowInput: IRange.CellCoords | null;
|
|
17
|
+
/** The cell the column axis values go into; `null` for a one-input table along a row. */
|
|
18
|
+
colInput: IRange.CellCoords | null;
|
|
19
|
+
}
|
|
20
|
+
/** What the what-if evaluation asks of the executor it runs inside. */
|
|
21
|
+
export interface WhatIfHost {
|
|
22
|
+
readonly container: IContextContainer;
|
|
23
|
+
/**
|
|
24
|
+
* Evaluates `node` where it sits, every read answered through the installed what-if layers: the
|
|
25
|
+
* cell's finalized value, a range for a spill.
|
|
26
|
+
*/
|
|
27
|
+
evaluate(node: CalcNode): Scalar | IRange;
|
|
28
|
+
/** The layer of a grid, made on first use over what the grid reads as now. */
|
|
29
|
+
layerFor(gridId: string): WhatIfLayer;
|
|
30
|
+
}
|
|
31
|
+
/** The rectangles of a table's edge: the formula cells, then the axes. All on the table's grid. */
|
|
32
|
+
export declare function whatIfEdge(table: WhatIfTable): IRange.Coords[];
|
|
33
|
+
/**
|
|
34
|
+
* The affected set S of a table (DESIGN-DATA-TABLES §4.3): every node downstream of an input
|
|
35
|
+
* that is upstream of a formula cell or an axis cell, in an order that evaluates a node after
|
|
36
|
+
* the nodes it reads. Widened to the whole downstream closure when a member reads through a
|
|
37
|
+
* dynamic reference, whose edges the index cannot bound.
|
|
38
|
+
*
|
|
39
|
+
* A `TABLE` node is never a member, this table's own included: another table's results are read as
|
|
40
|
+
* they stand, not re-run under this table's substitutions, as Excel reads them (design §2.2 T6).
|
|
41
|
+
* That also keeps the walk from passing through a table's own edges, which would reach the table.
|
|
42
|
+
*/
|
|
43
|
+
export declare function whatIfAffectedSet(container: IContextContainer, table: WhatIfTable): CalcNode[];
|
|
44
|
+
/**
|
|
45
|
+
* A table's results under the what-if protocol of DESIGN-DATA-TABLES §2.2, evaluating `affected`
|
|
46
|
+
* (from {@link whatIfAffectedSet}) under each substitution. The layers are the host's; nothing is
|
|
47
|
+
* restored, the caller drops them.
|
|
48
|
+
*/
|
|
49
|
+
export declare function runWhatIf(host: WhatIfHost, table: WhatIfTable, affected: readonly CalcNode[]): Scalar[][];
|
|
50
|
+
//# sourceMappingURL=_WhatIf.d.ts.map
|
|
@@ -80,6 +80,8 @@ export declare class FormulaBlock implements IFormulaBlock {
|
|
|
80
80
|
getReferencedSymbolIds(): string[];
|
|
81
81
|
/** @inheritdoc IFormulaBlock.hasTotals */
|
|
82
82
|
hasTotals(): boolean;
|
|
83
|
+
/** @inheritdoc IFormulaBlock.hasDataTable */
|
|
84
|
+
hasDataTable(): boolean;
|
|
83
85
|
/** @inheritdoc IFormulaBlock.hasVolatile */
|
|
84
86
|
hasVolatile(): boolean;
|
|
85
87
|
/** @inheritdoc IFormulaBlock.isBlankCacheable */
|
|
@@ -274,10 +276,9 @@ export declare class FormulaBlock implements IFormulaBlock {
|
|
|
274
276
|
protected _evaluateSubtree(node: ASTNode, regs: any[], frame: ReadonlyMap<number, any> | null, row: number, column: number): any;
|
|
275
277
|
/**
|
|
276
278
|
* Runs an execution list — the eager `executions` or a deferred root's list — writing each
|
|
277
|
-
* node's result into its register.
|
|
278
|
-
* case the rest of the list is queued behind it.
|
|
279
|
+
* node's result into its register.
|
|
279
280
|
*/
|
|
280
|
-
protected _runList(list: ASTNode[], regs: any[], row: number, column: number, frame: ReadonlyMap<number, any> | null):
|
|
281
|
+
protected _runList(list: ASTNode[], regs: any[], row: number, column: number, frame: ReadonlyMap<number, any> | null): void;
|
|
281
282
|
/**
|
|
282
283
|
* The execution list of a subtree that is NOT a deferred root — a partial evaluation (the
|
|
283
284
|
* editor's tooltip) pointing inside a lazy argument. The enclosing root's list restricted to
|
|
@@ -346,6 +346,11 @@ export interface IFormulaBlock extends IFormulaBlockView {
|
|
|
346
346
|
* either all of them call a total function or none do.
|
|
347
347
|
*/
|
|
348
348
|
hasTotals(): boolean;
|
|
349
|
+
/**
|
|
350
|
+
* Whether the formula calls `TABLE`, the what-if data table, anywhere in its tree. Read off the
|
|
351
|
+
* compiled cache (`CompiledFormula.hasDataTable`).
|
|
352
|
+
*/
|
|
353
|
+
hasDataTable(): boolean;
|
|
349
354
|
/**
|
|
350
355
|
* Whether the formula names a volatile function anywhere in its tree.
|
|
351
356
|
*
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IFormulaContext } from '@sheetxl/primitives';
|
|
2
|
+
import { FunctionDeclarationModule, Implementations, DescriptorModule } from '@sheetxl/scripting';
|
|
3
|
+
/**
|
|
4
|
+
* The category `TABLE` is listed under: ours, not Excel's. Excel has no `TABLE` a user may type, so
|
|
5
|
+
* the writer treats it as a function Excel does not have wherever it cannot write Excel's tag.
|
|
6
|
+
*/
|
|
7
|
+
export declare const DataTableCategory = "SheetXL";
|
|
8
|
+
/** `TABLE`'s declarations, as the declaration table and the function registry read them. */
|
|
9
|
+
export declare const DataTableDeclarations: FunctionDeclarationModule;
|
|
10
|
+
/** `TABLE`'s descriptors, loaded on demand like the built-ins'. */
|
|
11
|
+
export declare const DataTableDescriptors: () => Promise<DescriptorModule>;
|
|
12
|
+
/** The implementation the registry binds `TABLE`'s declaration to. */
|
|
13
|
+
export declare const createDataTableImplementations: (getContext: () => IFormulaContext) => Implementations;
|
|
14
|
+
//# sourceMappingURL=_DataTableFunction.d.ts.map
|
|
@@ -135,7 +135,7 @@ export declare class CalcGrid implements ICalcGrid {
|
|
|
135
135
|
/** {@inheritDoc ICalcGrid.getSpills} */
|
|
136
136
|
getSpills(transaction?: ITransaction | null): ISpatialMap<SpillEntry>;
|
|
137
137
|
/** {@inheritDoc ICalcGrid.getPending} */
|
|
138
|
-
|
|
138
|
+
getCalcStatus(transaction?: ITransaction | null): ISpatialMap<ICalcGrid.CalcStatus>;
|
|
139
139
|
/** {@inheritDoc ICalcGrid.getCalcErrors} */
|
|
140
140
|
getCalcErrors(transaction?: ITransaction | null): ISpatialMap<string>;
|
|
141
141
|
/** {@inheritDoc ICalcGrid.getCirculars} */
|
|
@@ -233,8 +233,6 @@ export declare class CalcGrid implements ICalcGrid {
|
|
|
233
233
|
_demand(rects: readonly IRange.Coords[]): void;
|
|
234
234
|
/** {@inheritDoc ICalcGrid.getGraphNeighborsAt} */
|
|
235
235
|
getGraphNeighborsAt(coords: IRange.Coords, kind: 'precedents' | 'dependents', direct: boolean): Promise<ICalcGrid.GraphNeighbors>;
|
|
236
|
-
/** {@inheritDoc ICalcGrid.Backend.getNameGraph} @internal */
|
|
237
|
-
_getNameGraph(kind: 'precedents' | 'dependents', direct: boolean): Promise<ICalcGrid.GraphNeighbors>;
|
|
238
236
|
/** {@inheritDoc ICalcGrid.evaluateAt} */
|
|
239
237
|
evaluateAt(row: number, column: number, options?: number | ICalculation.EvaluateOptions): Promise<Scalar | IRange>;
|
|
240
238
|
/** `true` once closed: its state is gone. @internal */
|
|
@@ -396,12 +394,12 @@ export declare namespace CalcGrid {
|
|
|
396
394
|
*/
|
|
397
395
|
volatile: IRange.Address[] | null;
|
|
398
396
|
/** Cells the engine has not answered for yet. */
|
|
399
|
-
|
|
397
|
+
calcStatusSpatial: ISpatialMap<ICalcGrid.CalcStatus>;
|
|
400
398
|
/** Engine FAILURES by cell, as a message. Not error values - those are in the values. */
|
|
401
399
|
calcErrorsSpatial: ISpatialMap<string>;
|
|
402
400
|
/**
|
|
403
401
|
* Cells in a reference cycle or downstream of one, by cycle (DESIGN-CIRCULAR-CALC.md §7.2).
|
|
404
|
-
* Maintained from the executor's deltas, like {@link
|
|
402
|
+
* Maintained from the executor's deltas, like {@link calcStatusSpatial}.
|
|
405
403
|
*/
|
|
406
404
|
circularSpatial: ISpatialMap<CircularEntry>;
|
|
407
405
|
/**
|
|
@@ -437,7 +435,7 @@ export declare namespace CalcGrid {
|
|
|
437
435
|
values: ISparseGrid<Scalar>;
|
|
438
436
|
contentful: ISpatialMap<ContentfulSpatialValue>;
|
|
439
437
|
spills: ISpatialMap<SpillEntry>;
|
|
440
|
-
|
|
438
|
+
calcStatus: ISpatialMap<ICalcGrid.CalcStatus>;
|
|
441
439
|
calcErrors: ISpatialMap<string>;
|
|
442
440
|
circulars: ISpatialMap<CircularEntry>;
|
|
443
441
|
errorValues: ISpatialMap<boolean>;
|