@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
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { IFormulaContext, IRange, IRichData, Scalar } from '@sheetxl/primitives';
|
|
2
|
+
import { ISpatialMap } from '../../collections';
|
|
3
|
+
import { AsyncValue } from '../../primitives/AsyncValue';
|
|
4
|
+
import { CalcNode } from './CalcNode';
|
|
5
|
+
import { CalcScope } from './CalcScope';
|
|
6
|
+
/**
|
|
7
|
+
* Where a call stands: still wanted and unanswered, answered, failed, or closed.
|
|
8
|
+
*/
|
|
9
|
+
export declare const CallState: {
|
|
10
|
+
readonly Open: 0;
|
|
11
|
+
readonly Settled: 1;
|
|
12
|
+
readonly Rejected: 2;
|
|
13
|
+
readonly Closed: 3;
|
|
14
|
+
};
|
|
15
|
+
export type CallState = typeof CallState[keyof typeof CallState];
|
|
16
|
+
/**
|
|
17
|
+
* One `IFormulaContext.defer` at one site of one cell's formula (DESIGN-ASYNC §4.4): what the
|
|
18
|
+
* executor is handed, and what a later evaluation of the cell finds again by its ordinal.
|
|
19
|
+
*/
|
|
20
|
+
export declare class DeferredCall implements IFormulaContext.DeferredCall {
|
|
21
|
+
readonly id: number;
|
|
22
|
+
readonly executor: IFormulaContext.DeferExecutor;
|
|
23
|
+
readonly payload: unknown;
|
|
24
|
+
/** Which function made the call (its declaration), or `null` for one with none. */
|
|
25
|
+
readonly site: object | null;
|
|
26
|
+
/**
|
|
27
|
+
* The node whose evaluation made, last served, or now holds the call (DESIGN-ASYNC §4.5 settle
|
|
28
|
+
* step 1); `null` for an evaluation with no cell. A re-mint of the cell's node takes it over.
|
|
29
|
+
*/
|
|
30
|
+
owner: CalcNode | null;
|
|
31
|
+
state: CallState;
|
|
32
|
+
/** The most recent result; `undefined` until one arrives. */
|
|
33
|
+
latest: unknown;
|
|
34
|
+
protected _onCancel: (() => void)[] | null;
|
|
35
|
+
/** The port (DESIGN-ASYNC §4.9): told each time the latest moves. */
|
|
36
|
+
protected _onMoved: ((call: DeferredCall) => void) | null;
|
|
37
|
+
/** Told of the call's final answer: the manager, which holds the call only until then. */
|
|
38
|
+
protected _onFinal: ((call: DeferredCall) => void) | null;
|
|
39
|
+
/** Makes a result cell-ready (see {@link DeferredCalls.Normalize}). */
|
|
40
|
+
protected _normalize: DeferredCalls.Normalize;
|
|
41
|
+
constructor(id: number, executor: IFormulaContext.DeferExecutor, payload: unknown, site: object | null, owner: CalcNode | null, onMoved?: ((call: DeferredCall) => void) | null, onFinal?: ((call: DeferredCall) => void) | null, normalize?: DeferredCalls.Normalize);
|
|
42
|
+
/** @inheritdoc IFormulaContext.DeferredCall.resolve */
|
|
43
|
+
resolve(value: unknown): void;
|
|
44
|
+
/** @inheritdoc IFormulaContext.DeferredCall.reject */
|
|
45
|
+
reject(error: unknown): void;
|
|
46
|
+
/** @inheritdoc IFormulaContext.DeferredCall.onCancel */
|
|
47
|
+
onCancel(fn: () => void): void;
|
|
48
|
+
/** @inheritdoc IFormulaContext.DeferredCall.cancelled */
|
|
49
|
+
get cancelled(): boolean;
|
|
50
|
+
/** Whether the call has not answered yet: it is running, and a recalculation leaves it be. */
|
|
51
|
+
isOpen(): boolean;
|
|
52
|
+
/** Closes the call; `onCancel` runs when it had not finished. */
|
|
53
|
+
close(): void;
|
|
54
|
+
protected _moved(): void;
|
|
55
|
+
protected _final(): void;
|
|
56
|
+
}
|
|
57
|
+
/** The default settle window (DESIGN-ASYNC §4.8): at most one settle pass per window. */
|
|
58
|
+
export declare const DefaultSettleWindow = 100;
|
|
59
|
+
/** What an evaluation that deferred leaves for the cell: its calls, and whether the root is the only one. */
|
|
60
|
+
export interface DeferredEvaluation {
|
|
61
|
+
readonly calls: readonly DeferredCall[];
|
|
62
|
+
/** The formula's root is its only call: the cell's value is that call's answer. */
|
|
63
|
+
readonly direct: boolean;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The holder at a cell, if any: the engine grid's value there, or the entry of the spill anchored
|
|
67
|
+
* there when the cell is an anchor (the anchor cell itself holds the first element).
|
|
68
|
+
*/
|
|
69
|
+
export type HeldAt = (gridId: string, row: number, column: number) => AsyncValue<DeferredCall> | null;
|
|
70
|
+
/**
|
|
71
|
+
* The calls a calculation backend has made, the batch the evaluation in progress is collecting,
|
|
72
|
+
* and the state each executor keeps (DESIGN-ASYNC §4.3, §4.4).
|
|
73
|
+
*
|
|
74
|
+
* @remarks
|
|
75
|
+
* One per backend. Nothing here is touched by an evaluation that does not defer: the dispatch
|
|
76
|
+
* notices a deferral through {@link CalcScope.deferCount}, and only then asks this.
|
|
77
|
+
*/
|
|
78
|
+
export declare class DeferredCalls {
|
|
79
|
+
protected _scope: CalcScope;
|
|
80
|
+
protected _heldAt: HeldAt;
|
|
81
|
+
protected _getRandom: () => number;
|
|
82
|
+
protected _nextId: number;
|
|
83
|
+
/** The calls that have not given their final answer, by id. A holder names any other by pointer. */
|
|
84
|
+
protected _calls: Map<number, DeferredCall>;
|
|
85
|
+
protected _onFinal: (call: DeferredCall) => void;
|
|
86
|
+
/** Whether a holder has ever been written: until then no read needs to look for one. */
|
|
87
|
+
protected _holders: boolean;
|
|
88
|
+
/** The calls of the evaluation in progress, by ordinal, and which of them it made. */
|
|
89
|
+
protected _current: DeferredCall[];
|
|
90
|
+
protected _made: DeferredCall[];
|
|
91
|
+
/** The calls made since the last {@link flush}, by executor: each executor's batch. */
|
|
92
|
+
protected _batch: Map<IFormulaContext.DeferExecutor, DeferredCall[]>;
|
|
93
|
+
/** What each executor keeps between batches (`IBatchContext.getState`). */
|
|
94
|
+
protected _states: Map<IFormulaContext.DeferExecutor, unknown>;
|
|
95
|
+
protected _batchContext: IFormulaContext.IBatchContext;
|
|
96
|
+
protected _setCurrent: (executor: IFormulaContext.DeferExecutor | null) => void;
|
|
97
|
+
/**
|
|
98
|
+
* The port (DESIGN-ASYNC §4.9): the calls whose latest moved since the last settle pass took
|
|
99
|
+
* them. A set, so a bursting feed is one entry however often it posts: the latest is on the call.
|
|
100
|
+
*/
|
|
101
|
+
protected _moved: Set<DeferredCall>;
|
|
102
|
+
protected _onMoved: (call: DeferredCall) => void;
|
|
103
|
+
/** The settle pass, run on its own task at most once per window (DESIGN-ASYNC §4.8). */
|
|
104
|
+
protected _onSettle: (() => void) | null;
|
|
105
|
+
protected _settleWindow: number;
|
|
106
|
+
protected _settleTimer: ReturnType<typeof setTimeout> | null;
|
|
107
|
+
protected _settledAt: number;
|
|
108
|
+
/** The grids a settle told the model about without a write: the next pass vends their records. */
|
|
109
|
+
protected _repaintGrids: Set<string>;
|
|
110
|
+
/** The cells a settle marked for re-evaluation, scoped: the next pass's seeds, beside its own. */
|
|
111
|
+
protected _settleDirty: ISpatialMap.Entry[];
|
|
112
|
+
protected _normalize: DeferredCalls.Normalize;
|
|
113
|
+
/**
|
|
114
|
+
* Every site is served its call (a settle pass, or an evaluation waiting on its answers);
|
|
115
|
+
* otherwise only a running call is, and a stopped one is called again (DESIGN-ASYNC §4.5).
|
|
116
|
+
*/
|
|
117
|
+
protected _serving: boolean;
|
|
118
|
+
/** The batch the next {@link flush} hands out fetches past the workbook's cache (`CalculateOptions.external`). */
|
|
119
|
+
protected _external: boolean;
|
|
120
|
+
/** {@link _batchContext}, with a `fetch` that goes to the source. */
|
|
121
|
+
protected _reloadContext: IFormulaContext.IBatchContext;
|
|
122
|
+
/**
|
|
123
|
+
* The last answer the site's call gave for the same question, read by `IFormulaContext.defer`
|
|
124
|
+
* right after {@link defer}: `undefined` when there was none.
|
|
125
|
+
*/
|
|
126
|
+
previous: unknown;
|
|
127
|
+
/** The {@link whenChanged} waits in progress: woken by a final answer, a settle pass starting, a cancel. */
|
|
128
|
+
protected _waiters: Set<() => void>;
|
|
129
|
+
/**
|
|
130
|
+
* Told when the counts may have changed, at the moments they become visible: calls handed out,
|
|
131
|
+
* a settle pass starting, a cancel, a close. Never per answer: a million answers are one settle.
|
|
132
|
+
*/
|
|
133
|
+
protected _onCountsChange: (() => void) | null;
|
|
134
|
+
constructor(scope: CalcScope, heldAt: HeldAt, getRandom: () => number, onSettle?: (() => void) | null, settleWindow?: number, normalize?: DeferredCalls.Normalize, services?: DeferredCalls.Services, onCountsChange?: (() => void) | null);
|
|
135
|
+
/** How many calls have not answered. `0` lets a pass skip every pending-input check. */
|
|
136
|
+
getOpenCount(): number;
|
|
137
|
+
/** The held calls whose owner is a cell of `gridId`. */
|
|
138
|
+
getCallsOf(gridId: string): DeferredCall[];
|
|
139
|
+
/** Whether an answer that landed has yet to be applied: its settle pass is still to run. */
|
|
140
|
+
hasSettleWork(): boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Resolves at the next change a wait for answers cares about — a call's final answer, a settle
|
|
143
|
+
* pass starting, a cancel — or after `timeout` ms, whichever is first.
|
|
144
|
+
*/
|
|
145
|
+
whenChanged(timeout: number): Promise<void>;
|
|
146
|
+
protected _wake(): void;
|
|
147
|
+
/**
|
|
148
|
+
* Closes every held call whose owner `cover` covers (`ICalculation.cancelAsync`): `onCancel`
|
|
149
|
+
* runs, and a later answer is dropped. A cancelled call stays in its holders: its cell is served
|
|
150
|
+
* what it shows now, and asks again only on an external calculation.
|
|
151
|
+
*
|
|
152
|
+
* @param cover `true` for every call, a grid id for one grid's, scoped coords for a range's.
|
|
153
|
+
* @returns The calls closed, for the caller to re-evaluate their owners.
|
|
154
|
+
*/
|
|
155
|
+
cancel(cover: true | string | IRange.Coords): DeferredCall[];
|
|
156
|
+
/** Closes `calls`: those still owed an answer run `onCancel`, and a later answer is dropped. */
|
|
157
|
+
closeCalls(calls: Iterable<DeferredCall>): void;
|
|
158
|
+
/** Whether any grid of this backend may hold an {@link AsyncValue}: what gates every unwrap. */
|
|
159
|
+
hasHolders(): boolean;
|
|
160
|
+
/** The open call with `id`; `undefined` once it has given its final answer, or for one unknown. */
|
|
161
|
+
getCall(id: number): DeferredCall | undefined;
|
|
162
|
+
/** Drains the port: every call whose latest moved since the last drain. */
|
|
163
|
+
takeMoved(): DeferredCall[];
|
|
164
|
+
/** Records that a settle told the model about a cell of `gridId` without a write. */
|
|
165
|
+
noteRepaint(gridId: string): void;
|
|
166
|
+
/** Marks `cells` (scoped) for the next pass to collect: a settled composite owner, or a dependent of a direct one. */
|
|
167
|
+
addSettleDirty(cells: readonly ISpatialMap.Entry[]): void;
|
|
168
|
+
/** The cells settles marked since the last pass; empties them. */
|
|
169
|
+
takeSettleDirty(): ISpatialMap.Entry[];
|
|
170
|
+
/** The grids with a repaint since the last pass, for the pass to vend; empties them. */
|
|
171
|
+
takeRepaintGrids(): string[];
|
|
172
|
+
/**
|
|
173
|
+
* Asks for a settle pass: at once on the leading edge, else when the window since the last one
|
|
174
|
+
* ends. Always a fresh task, so an executor settling synchronously cannot re-enter the pass that
|
|
175
|
+
* ran it.
|
|
176
|
+
*/
|
|
177
|
+
protected _requestSettle(): void;
|
|
178
|
+
/**
|
|
179
|
+
* The cell's value for an evaluation that deferred; for one that spilled, what its spill entry
|
|
180
|
+
* carries. From here on reads must look for holders.
|
|
181
|
+
*/
|
|
182
|
+
newHolder(value: Scalar | IRange, evaluation: DeferredEvaluation): AsyncValue<DeferredCall>;
|
|
183
|
+
/**
|
|
184
|
+
* Takes one `defer` from the evaluation in progress: the call this site made last time when the
|
|
185
|
+
* same function made it with an equal payload and it still stands, or a new one for the batch.
|
|
186
|
+
* It stands while it runs: a recalculation leaves it be. Once it has
|
|
187
|
+
* stopped, a recalculation calls the function again; only an answer landing ({@link setServing})
|
|
188
|
+
* serves a stopped call. Same function, not same executor: an inline executor is a new closure
|
|
189
|
+
* every evaluation, and is still served.
|
|
190
|
+
*
|
|
191
|
+
* @param site Which function is deferring (its declaration); `null` compares executors instead. The site's last call is the one the
|
|
192
|
+
* holder in its cell names at this ordinal, so a version of the grid brought back by an undo,
|
|
193
|
+
* or a cell moved by a shift, is answered by the call it was given.
|
|
194
|
+
* @param volatile The function declares itself volatile: it asks again on every evaluation,
|
|
195
|
+
* payload equal or not, as `RAND()` re-rolls (DESIGN-ASYNC §4.7).
|
|
196
|
+
* @returns The call the site was served, for the dispatch around the body to answer its latest
|
|
197
|
+
* in place of the body's return; `null` for a new call.
|
|
198
|
+
*/
|
|
199
|
+
defer(executor: IFormulaContext.DeferExecutor, payload: unknown, site?: object | null, volatile?: boolean): DeferredCall | null;
|
|
200
|
+
/**
|
|
201
|
+
* Ends the deferring evaluation in progress: its calls, by ordinal. Resets the scope's
|
|
202
|
+
* per-evaluation fields.
|
|
203
|
+
*/
|
|
204
|
+
endEvaluation(): DeferredEvaluation;
|
|
205
|
+
/**
|
|
206
|
+
* Ends an evaluation that will not stand — a probe of whether an answer can be shared — without
|
|
207
|
+
* keeping its calls: what it made never reaches an executor.
|
|
208
|
+
*/
|
|
209
|
+
abandonEvaluation(): void;
|
|
210
|
+
/**
|
|
211
|
+
* Runs every executor once with the calls the batch collected for it (DESIGN-ASYNC §4.3). Each
|
|
212
|
+
* in its own try: a throw, or a promise that rejects, fails the calls it has not settled and no
|
|
213
|
+
* other executor's.
|
|
214
|
+
*/
|
|
215
|
+
flush(): void;
|
|
216
|
+
/** Closes every open call and drops every batch and state: the backend is going away. */
|
|
217
|
+
close(): void;
|
|
218
|
+
/**
|
|
219
|
+
* Whether every site is served its call until the next {@link flush}: a settle pass, whose
|
|
220
|
+
* re-evaluations are answers landing, or an evaluation waiting on its own calls.
|
|
221
|
+
*/
|
|
222
|
+
setServing(serving: boolean): void;
|
|
223
|
+
/**
|
|
224
|
+
* Whether the batch the next {@link flush} hands out fetches past the workbook's cache, to the
|
|
225
|
+
* source (`CalculateOptions.external`, `cache: 'reload'`).
|
|
226
|
+
*/
|
|
227
|
+
setExternal(external: boolean): void;
|
|
228
|
+
protected _coversCell(cover: true | string | IRange.Coords, gridId: string | null, row: number, column: number): boolean;
|
|
229
|
+
protected _batchFor(executor: IFormulaContext.DeferExecutor): DeferredCall[];
|
|
230
|
+
/**
|
|
231
|
+
* The call this site of the evaluation in progress made last time: what its cell's holder names,
|
|
232
|
+
* or, for a formula held in no cell (a temporary one), the holder its node keeps.
|
|
233
|
+
*/
|
|
234
|
+
protected _siteCall(ordinal: number): DeferredCall | undefined;
|
|
235
|
+
}
|
|
236
|
+
export declare namespace DeferredCalls {
|
|
237
|
+
/**
|
|
238
|
+
* Makes a result cell-ready as it arrives, so a holder always reads as something a cell can
|
|
239
|
+
* hold: an author's array (`[[1],[2]]`, DESIGN-ASYNC §7.3) becomes a range, and a one-cell
|
|
240
|
+
* range its scalar. The backend supplies it; a scalar or a multi-cell range passes as is.
|
|
241
|
+
*/
|
|
242
|
+
type Normalize = (value: unknown) => unknown;
|
|
243
|
+
/** What the backend lends an executor through its batch context; each omitted, a default. */
|
|
244
|
+
interface Services {
|
|
245
|
+
/** Makes rich values for the backend's workbook. Omitted, made outside any workbook. */
|
|
246
|
+
createRichData?: (type: string, data?: any) => IRichData;
|
|
247
|
+
/** Adds resources to the backend's workbook. Omitted, made outside any workbook. */
|
|
248
|
+
addResource?: (buffer: ArrayBuffer, options?: {
|
|
249
|
+
fetchedFrom?: string;
|
|
250
|
+
}) => object;
|
|
251
|
+
/** The workbook's fetch. Omitted, the global `fetch`. */
|
|
252
|
+
fetch?: (input: string, init?: RequestInit) => Promise<Response>;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Whether two payloads are the same question (DESIGN-ASYNC §4.3): `Object.is`, or for two plain
|
|
257
|
+
* objects or arrays, `Object.is` over their own enumerable values one level deep.
|
|
258
|
+
*/
|
|
259
|
+
export declare const samePayload: (a: unknown, b: unknown) => boolean;
|
|
260
|
+
//# sourceMappingURL=DeferredCalls.d.ts.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Scalar, IRange, IRuntime, IFormulaContext } from '@sheetxl/primitives';
|
|
2
2
|
import { ISparseGrid, ISpatialMap, ISpatialMap3D, ISpatialQuery } from '../../collections';
|
|
3
|
+
import { IRichDataKind } from '../../richData';
|
|
3
4
|
import { ISymbolRegistry } from '../symbol';
|
|
4
5
|
import { IFormulaBlock, FormulaImager } from '../formula';
|
|
5
6
|
import { PrecedentSpatialValue, PrecedentKind, FormulaSpatialValue } from '../spatial';
|
|
@@ -9,6 +10,8 @@ import { ICalculation } from '../ICalculation';
|
|
|
9
10
|
import { NamedNodeInfo } from '../Types';
|
|
10
11
|
import { CalcNode } from './CalcNode';
|
|
11
12
|
import { CalcScope } from './CalcScope';
|
|
13
|
+
import { DeferredCalls } from './DeferredCalls';
|
|
14
|
+
import { WhatIfTable } from '../executor/_WhatIf';
|
|
12
15
|
/**
|
|
13
16
|
* Interface to allow grids to interact with calculation container.
|
|
14
17
|
*/
|
|
@@ -62,7 +65,18 @@ export interface IContextContainer {
|
|
|
62
65
|
*/
|
|
63
66
|
isGridless?: (sheetId: string) => boolean;
|
|
64
67
|
getScope(): CalcScope;
|
|
68
|
+
/**
|
|
69
|
+
* The calls the container's evaluations deferred (`IFormulaContext.defer`), with each
|
|
70
|
+
* executor's batch. Absent, or `null`, where nothing can answer later: a deferring function's
|
|
71
|
+
* return value is then its answer.
|
|
72
|
+
*/
|
|
73
|
+
getDeferred?(): DeferredCalls | null;
|
|
65
74
|
getRuntime(): IRuntime;
|
|
75
|
+
/**
|
|
76
|
+
* What rich values a formula makes are made for: the workbook's resources and strings.
|
|
77
|
+
* Absent, they are made outside any workbook.
|
|
78
|
+
*/
|
|
79
|
+
getRichDataContext?(): IRichDataKind.Context;
|
|
66
80
|
/**
|
|
67
81
|
* Returns the current datetime in milliseconds.
|
|
68
82
|
*/
|
|
@@ -334,6 +348,12 @@ export interface IContextContainer {
|
|
|
334
348
|
* recover which is which from the coords.
|
|
335
349
|
*/
|
|
336
350
|
addDynamicPrecedent(calcNode: CalcNode, range: IRange.Coords | undefined, kind: PrecedentKind): void;
|
|
351
|
+
/**
|
|
352
|
+
* The results of a what-if data table, for the `TABLE` node being evaluated (the scope's node):
|
|
353
|
+
* its affected cells re-evaluated under each substitution, nothing written
|
|
354
|
+
* (DESIGN-DATA-TABLES §4.3). Only during a pass.
|
|
355
|
+
*/
|
|
356
|
+
evaluateWhatIf(table: WhatIfTable): Scalar[][];
|
|
337
357
|
/**
|
|
338
358
|
* Queues an action to run at the engine's next safe point, and schedules that point.
|
|
339
359
|
*
|
|
@@ -160,4 +160,10 @@ export declare class PendingOverlayGrid implements ISparseGrid<Scalar>, Referenc
|
|
|
160
160
|
protected _commitAll(): void;
|
|
161
161
|
get [Symbol.toStringTag](): string;
|
|
162
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* Whether `grid` reads an error inside the rectangle, by walking it. Shared with `WhatIfLayer`.
|
|
165
|
+
*
|
|
166
|
+
* @internal
|
|
167
|
+
*/
|
|
168
|
+
export declare function _scanHasError(grid: ISparseGrid<Scalar>, coords: IRange.Coords): boolean;
|
|
163
169
|
//# sourceMappingURL=_PendingOverlayGrid.d.ts.map
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { IRange, Scalar } from '@sheetxl/primitives';
|
|
2
|
+
import { Direction, RangeAxis, CellCoords, RangeCoords } from '@sheetxl/utils';
|
|
3
|
+
import { Tuple, IGrid, ISparseGrid, IListLike } from '../../collections';
|
|
4
|
+
import { ReferenceErrorIndex } from '../../primitives/ReferenceRange';
|
|
5
|
+
/**
|
|
6
|
+
* A grid's values with a what-if substitution laid over them (DESIGN-DATA-TABLES §4.3): the input
|
|
7
|
+
* cells a `TABLE` puts axis values into, and the results of the cells it re-evaluates under them.
|
|
8
|
+
* A point read and an iteration answer from the map first and the grid underneath otherwise (the
|
|
9
|
+
* pass's pending overlay during a pass), as `PendingOverlayGrid` does; nothing here is ever written
|
|
10
|
+
* through, so the committed values, the formula blocks and the model are untouched and there is
|
|
11
|
+
* nothing to restore. Dropped when the table is done.
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* Also the error index of the references built over it ({@link ReferenceErrorIndex}): the
|
|
15
|
+
* underlying index plus a scan of the map, taken only while the map holds an error.
|
|
16
|
+
*
|
|
17
|
+
* Every write of the grid interface is refused: a what-if evaluation reads.
|
|
18
|
+
*/
|
|
19
|
+
export declare class WhatIfLayer implements ISparseGrid<Scalar>, ReferenceErrorIndex {
|
|
20
|
+
protected readonly _inner: ISparseGrid<Scalar>;
|
|
21
|
+
protected readonly _committed: ReferenceErrorIndex;
|
|
22
|
+
protected readonly _isColumn: boolean;
|
|
23
|
+
protected _map: Map<number, Scalar>;
|
|
24
|
+
/** Substituted values that are errors — the scan in {@link hasErrorIn} runs only while > 0. */
|
|
25
|
+
protected _errors: number;
|
|
26
|
+
protected _rowStart: number;
|
|
27
|
+
protected _rowEnd: number;
|
|
28
|
+
protected _colStart: number;
|
|
29
|
+
protected _colEnd: number;
|
|
30
|
+
constructor(inner: ISparseGrid<Scalar>, committed: ReferenceErrorIndex);
|
|
31
|
+
get isWhatIfLayer(): true;
|
|
32
|
+
/** The committed grid. */
|
|
33
|
+
getInner(): ISparseGrid<Scalar>;
|
|
34
|
+
/** Substituted cells. */
|
|
35
|
+
get size(): number;
|
|
36
|
+
/** Substitutes `value` at the cell. A blank is kept as a blank (`null`), as an axis cell's is. */
|
|
37
|
+
set(row: number, col: number, value: Scalar): void;
|
|
38
|
+
/** Drops every substitution: the committed grid answers everything again. */
|
|
39
|
+
clear(): void;
|
|
40
|
+
/** Does a rectangle overlap the bounding box of the substituted cells? */
|
|
41
|
+
intersects(rowStart: number, colStart: number, rowEnd: number, colEnd: number): boolean;
|
|
42
|
+
/** {@inheritDoc ReferenceErrorIndex.hasErrorIn} */
|
|
43
|
+
hasErrorIn(coords: IRange.Coords): boolean;
|
|
44
|
+
/** Is the cell inside the substituted box? */
|
|
45
|
+
protected _inBounds(row: number, col: number): boolean;
|
|
46
|
+
/** The run with substituted values swapped in, or the run itself when none fall inside it. */
|
|
47
|
+
protected _substituteRun(major: number, minorFrom: number, run: IListLike<Scalar>): IListLike<Scalar>;
|
|
48
|
+
/** {@inheritDoc IGrid.getValueAt} */
|
|
49
|
+
getValueAt(row: number, column: number): Scalar;
|
|
50
|
+
/**
|
|
51
|
+
* {@inheritDoc ISparseGrid.getRuns}
|
|
52
|
+
*
|
|
53
|
+
* @remarks
|
|
54
|
+
* A substituted cell the committed grid does not hold at all (an input that was never written)
|
|
55
|
+
* is not shown by a run iteration: substitution only describes cells with a run under them, as
|
|
56
|
+
* the pending overlay's does. A point read answers it.
|
|
57
|
+
*/
|
|
58
|
+
getRuns(options?: ISparseGrid.RunIteratorOptions): ISparseGrid.RunIterableIterator<Scalar>;
|
|
59
|
+
/** {@inheritDoc IGrid.entries} */
|
|
60
|
+
entries(options?: IGrid.IteratorOptions): IGrid.EntryIterator<Scalar>;
|
|
61
|
+
/** {@inheritDoc IGrid.values} */
|
|
62
|
+
values(options?: IGrid.IteratorOptions): IGrid.ValueIterator;
|
|
63
|
+
/** {@inheritDoc IGrid.keys} */
|
|
64
|
+
keys(options?: IGrid.IteratorOptions): IGrid.KeyIterator;
|
|
65
|
+
/** {@inheritDoc IGrid.getValues} */
|
|
66
|
+
getValues(coords?: RangeCoords): Tuple.Region<Scalar> | null;
|
|
67
|
+
/** {@inheritDoc IGrid.copyTo} */
|
|
68
|
+
copyTo(destination: IGrid, topLeft: CellCoords, from: RangeCoords): void;
|
|
69
|
+
/** {@inheritDoc IGrid.getAxis} */
|
|
70
|
+
getAxis(): RangeAxis;
|
|
71
|
+
/** {@inheritDoc IGrid.getCount} */
|
|
72
|
+
getCount(): number;
|
|
73
|
+
/** {@inheritDoc IGrid.getCoords} */
|
|
74
|
+
getCoords(): RangeCoords | null;
|
|
75
|
+
/** {@inheritDoc IGrid.getMaxCoords} */
|
|
76
|
+
getMaxCoords(): RangeCoords | null;
|
|
77
|
+
/** {@inheritDoc IGrid.clone} */
|
|
78
|
+
clone(_cloneKey?: any): this;
|
|
79
|
+
/** {@inheritDoc IGrid.cloneEmpty} */
|
|
80
|
+
cloneEmpty(cloneKey?: any): this;
|
|
81
|
+
/** {@inheritDoc IGrid.setValues} */
|
|
82
|
+
setValues(_values: Tuple.GridTuple<Scalar>): this;
|
|
83
|
+
/** {@inheritDoc IGrid.setValueAt} */
|
|
84
|
+
setValueAt(_row: number, _column: number, _value: Scalar): void;
|
|
85
|
+
/** {@inheritDoc IGrid.delete} */
|
|
86
|
+
delete(_coords: RangeCoords | null): boolean;
|
|
87
|
+
/** {@inheritDoc IGrid.shift} */
|
|
88
|
+
shift(_coords: RangeCoords, _direction: Direction): boolean;
|
|
89
|
+
get [Symbol.toStringTag](): string;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=_WhatIfLayer.d.ts.map
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { Scalar, ScalarType, InteropScalarType, InteropScalar, IRange
|
|
1
|
+
import { Scalar, ScalarType, InteropScalarType, InteropScalar, IRange } from '@sheetxl/primitives';
|
|
2
2
|
import { Size, Rectangle, Bounds } from '@sheetxl/utils';
|
|
3
3
|
import { ITypes } from '../type';
|
|
4
4
|
import { ITextFrame, TextRotation, TextStacked, IRichText } from '../text';
|
|
5
5
|
import { NumberFormat } from '../numFmt';
|
|
6
6
|
import { ITable } from '../table';
|
|
7
7
|
import { IDataValidation } from '../dataValidation';
|
|
8
|
-
import { IConditionalFormat } from '../conditionalFormat
|
|
8
|
+
import { IConditionalFormat } from '../conditionalFormat';
|
|
9
|
+
import { ICellControl } from '../cellControl';
|
|
9
10
|
import { IHyperlink } from '../hyperlink';
|
|
10
11
|
import { IComment } from '../comment';
|
|
11
12
|
import { ICellStyle } from '../style';
|
|
@@ -143,10 +144,16 @@ export interface ICell {
|
|
|
143
144
|
*/
|
|
144
145
|
getRole(): ICell.Role | null;
|
|
145
146
|
/**
|
|
146
|
-
* Returns the hyperlink
|
|
147
|
+
* Returns the cell's link: the hyperlink set on the cell, else the link its value is.
|
|
147
148
|
*
|
|
148
149
|
* @remarks
|
|
149
|
-
* Returns `null`
|
|
150
|
+
* Returns `null` when the cell has neither.
|
|
151
|
+
*
|
|
152
|
+
* A `HYPERLINK()` result (a {@link Hyperlink} value with an address) is returned as a link with
|
|
153
|
+
* {@link IHyperlink.isReadOnly} `true`; it is not removed or edited as a link, it changes with
|
|
154
|
+
* its formula. A hyperlink set on the cell wins when the cell has both. Excel's
|
|
155
|
+
* `Range.Hyperlinks` and Office Scripts' `Range.getHyperlink()` return nothing for a
|
|
156
|
+
* `HYPERLINK()` cell.
|
|
150
157
|
*/
|
|
151
158
|
getHyperlink(): IHyperlink | null;
|
|
152
159
|
/**
|
|
@@ -363,6 +370,14 @@ export interface ICell {
|
|
|
363
370
|
* only lays out text does not need to read this at all.
|
|
364
371
|
*/
|
|
365
372
|
getConditionalDecorations(): Readonly<IConditionalFormat.Decorations>;
|
|
373
|
+
/**
|
|
374
|
+
* Returns the cell's control, such as a checkbox, or `null` when it has none.
|
|
375
|
+
*
|
|
376
|
+
* @remarks
|
|
377
|
+
* A control draws only a value it accepts: ask `getControl()?.isAccepted(getValue())`. A
|
|
378
|
+
* checkbox cell holding `2` has a control and draws `2`.
|
|
379
|
+
*/
|
|
380
|
+
getControl(): ICellControl | null;
|
|
366
381
|
/**
|
|
367
382
|
* If the cell is in a table this will return it.
|
|
368
383
|
*/
|
|
@@ -717,40 +732,10 @@ export declare namespace ICell {
|
|
|
717
732
|
*/
|
|
718
733
|
anchorBounds: Bounds;
|
|
719
734
|
}
|
|
720
|
-
/**
|
|
721
|
-
* Encodings of ScalarType for persistence
|
|
722
|
-
*/
|
|
723
|
-
type JSONScalarType = 'n' | 's' | 'b' | 'e' | 'r' | 'z';
|
|
724
|
-
/**
|
|
725
|
-
* A value encoded as a number with an associated type.
|
|
726
|
-
*/
|
|
727
|
-
interface JSONTypedValue {
|
|
728
|
-
t: JSONScalarType;
|
|
729
|
-
/**
|
|
730
|
-
* The number, string id, error code or boolean flag; for `'r'`, the rich data's own JSON
|
|
731
|
-
* (`IRichData.JSON`), which its registered kind reads back.
|
|
732
|
-
*/
|
|
733
|
-
v: number | IRichData.JSON;
|
|
734
|
-
}
|
|
735
735
|
/**
|
|
736
736
|
* Reexports the `IRange.CellCoords` type for use in cell coordinates.
|
|
737
737
|
*/
|
|
738
738
|
type Coords = IRange.CellCoords;
|
|
739
|
-
/**
|
|
740
|
-
* JSON values types that have their type embedded in the
|
|
741
|
-
* 'format'.
|
|
742
|
-
*
|
|
743
|
-
* @remarks
|
|
744
|
-
* A string value is the string id in the `IStringsCollection`.
|
|
745
|
-
*/
|
|
746
|
-
type JSONUnTypedValue = number | boolean | string;
|
|
747
|
-
/**
|
|
748
|
-
* For persisting a single Cell value and type.
|
|
749
|
-
*
|
|
750
|
-
* @remarks
|
|
751
|
-
* Styling and other advanced properties are stored as ranges.
|
|
752
|
-
*/
|
|
753
|
-
type JSON = JSONUnTypedValue | JSONTypedValue;
|
|
754
739
|
/**
|
|
755
740
|
* Represents the types of content that can be associated with a cell or range.
|
|
756
741
|
*
|
|
@@ -904,12 +889,22 @@ export declare namespace ICell {
|
|
|
904
889
|
readonly LookupShape: "lookupShape";
|
|
905
890
|
/** A reference to another workbook, a deleted reference, or a function a converter could not name. */
|
|
906
891
|
readonly ExternalReference: "externalReference";
|
|
892
|
+
/** A formula that is only an error value, such as `=#DIV/0!`: what a converter leaves when it drops a formula. */
|
|
893
|
+
readonly ErrorConstant: "errorConstant";
|
|
907
894
|
/** A link to another sheet whose target row is labeled other than its own row. */
|
|
908
895
|
readonly LinkLabelMismatch: "linkLabelMismatch";
|
|
909
896
|
/** A lookup keyed by a typed string that labels neither the formula's row nor its column. */
|
|
910
897
|
readonly KeyLabelMismatch: "keyLabelMismatch";
|
|
911
898
|
/** A link read with the other sign from the sheet's other links into the same row. */
|
|
912
899
|
readonly SignVsSiblings: "signVsSiblings";
|
|
900
|
+
/** A number typed into a formula that equals a typed number on the sheet no formula reads. */
|
|
901
|
+
readonly LiteralMatchesInput: "literalMatchesInput";
|
|
902
|
+
/** A formula that differs from its twins on the sheet, the formulas of the same shape, in a typed number. */
|
|
903
|
+
readonly TwinBlockDivergence: "twinBlockDivergence";
|
|
904
|
+
/** A typed number an order of magnitude or more off the numbers typed in its format on the sheet. */
|
|
905
|
+
readonly ScaleOutlier: "scaleOutlier";
|
|
906
|
+
/** A constant typed into a formula — a number, a string or a boolean — and how often the workbook types it. */
|
|
907
|
+
readonly ConstantFrequency: "constantFrequency";
|
|
913
908
|
};
|
|
914
909
|
type ErrorCheck = typeof ErrorCheck[keyof typeof ErrorCheck];
|
|
915
910
|
/**
|
|
@@ -940,9 +935,14 @@ export declare namespace ICell {
|
|
|
940
935
|
* | `approximateMatch` | `function`; `matchType`, `'1'`, `'-1'`, `'TRUE'` or `'omitted'` |
|
|
941
936
|
* | `lookupShape` | `array`, the range the result is read from; `vector`, the range the key is found in |
|
|
942
937
|
* | `externalReference` | `kind` (`'workbook'`, `'deleted'`, `'udf'`); `reference`, or `function` for a `'udf'` |
|
|
938
|
+
* | `errorConstant` | `error`, the error the formula is; `dataTable`, the anchor of a data table that spills less than the block it heads, and `extent`, the rectangle the two cover |
|
|
943
939
|
* | `linkLabelMismatch` | `label` / `labelAt`, the cell's row label; `target` / `targetAt`, the label of the row it links to |
|
|
944
940
|
* | `keyLabelMismatch` | `function`; `key`; `rowLabel` / `rowLabelAt` and `columnLabel` / `columnLabelAt`, where found |
|
|
945
941
|
* | `signVsSiblings` | `reference`; `sign` (`'negative'` / `'positive'`); `siblings`, how many links into that row read the other sign; `siblingAt`, one of them |
|
|
942
|
+
* | `literalMatchesInput` | `literal`, the number as the formula types it; `inputAt`, the nearest typed number of that value no formula reads; `label` / `labelAt`, that input's label, when it has one; `matches`, the places the value is typed unread |
|
|
943
|
+
* | `twinBlockDivergence` | `part` (`'literal'` / `'sign'`); for a literal, `literal` and `expected`, this formula's number and its twins'; for a sign, `term` of `terms`, the term that differs, `references`, how many the shape holds, and `sign`, how this formula adds it; `twins`, how many formulas carry the other side; `twinAt`, one of them |
|
|
944
|
+
* | `scaleOutlier` | `format` (`'percent'`); `times`, the power of ten the value is off by; `typical`, the median of the sheet's typed numbers in that format; `of`, how many there are |
|
|
945
|
+
* | `constantFrequency` | `kind` (`'number'`, `'string'`, `'boolean'`); `value`, a number without its sign; `uses`, the places in the workbook that type it; `of`, the workbook's constant uses |
|
|
946
946
|
*
|
|
947
947
|
* **Runs.** `formula`, `hardcodeInRun` and `styleBreak` are one rule over different layers of
|
|
948
948
|
* the sheet: a region thin against the run it sits in. The cells on both sides agree with each
|
|
@@ -997,6 +997,25 @@ export declare namespace ICell {
|
|
|
997
997
|
* v2 Debugging goldens and move as other measurements arrive. Regions of the `anomalies` feature
|
|
998
998
|
* list highest rank first, and so do a cell's findings, in check order within an equal rank.
|
|
999
999
|
*
|
|
1000
|
+
* **Literals and twins.** `literalMatchesInput` reads the numbers typed into a formula against
|
|
1001
|
+
* the typed numbers no formula reads: a reference replaced by its value is what left the input
|
|
1002
|
+
* unread. Small counts, calendar periods and powers of ten never fire. `twinBlockDivergence`
|
|
1003
|
+
* reads formulas of the same shape once references, literals and signs are set aside: twins that
|
|
1004
|
+
* divide by `12` and by `365`, or one that adds a term the others take away. Literals compare only
|
|
1005
|
+
* when both are a calendar period, a power of ten or a small count. Every side of a divergence is
|
|
1006
|
+
* listed, since two wrong rows can outvote the right one.
|
|
1007
|
+
*
|
|
1008
|
+
* `literalMatchesInput` ranks at `0.8 / matches`. A `twinBlockDivergence` finding ranks at `0.8`
|
|
1009
|
+
* times the share of the twins on the other side, `twins / (twins + this side's count)`, halved
|
|
1010
|
+
* for a sign: signs differ between line items by design, so a sign divergence is read when asked
|
|
1011
|
+
* for by check. `scaleOutlier` ranks at `0.8`.
|
|
1012
|
+
*
|
|
1013
|
+
* `constantFrequency` reports every constant a formula types, the common ones too, with how many
|
|
1014
|
+
* places in the workbook type it (`uses`) and of how many constant uses (`of`). It ranks at
|
|
1015
|
+
* `0.1 / uses × of / (of + 10)`: the rarer the constant, the higher, and a constant on a workbook
|
|
1016
|
+
* that types few has little to be rare against. A finding's `uses` and `of` change when another
|
|
1017
|
+
* sheet changes.
|
|
1018
|
+
*
|
|
1000
1019
|
* A label's position is absolute (`R12C3`), since it stays put whichever cell of a region reads
|
|
1001
1020
|
* it; its text is the one read at the region's first cell.
|
|
1002
1021
|
*/
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { IRange, Scalar } from '@sheetxl/primitives';
|
|
2
|
+
import { IListener } from '../listener';
|
|
3
|
+
import { Anchored } from '../anchored/Anchored';
|
|
4
|
+
import { AbstractAnchored } from '../anchored/AbstractAnchored';
|
|
5
|
+
import { ICellControl } from './ICellControl';
|
|
6
|
+
/**
|
|
7
|
+
* Implementation of {@link ICellControl}.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* Extends {@link AbstractAnchored} directly: a control has no condition and no formula, so it
|
|
11
|
+
* never subscribes to range events. Its definition is fixed at creation; a different control is a
|
|
12
|
+
* different entry.
|
|
13
|
+
*/
|
|
14
|
+
export declare class CellControl extends AbstractAnchored<State, ICellControl.Events> implements ICellControl {
|
|
15
|
+
/** @internal */
|
|
16
|
+
protected _initialize(options: CellControl.ConstructorOptions): void;
|
|
17
|
+
/** @internal */
|
|
18
|
+
protected _getActionDescription(action: 'delete' | 'initialize' | 'updateListener'): string | null;
|
|
19
|
+
/**
|
|
20
|
+
* Always: a control pins to where it was authored, as a conditional format does.
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
protected _isAnchorAbsolute(): boolean;
|
|
24
|
+
/** @internal */
|
|
25
|
+
protected _processContainerShift(options: Anchored.ShiftOptions): IRange.Coords | null | void;
|
|
26
|
+
/** {@inheritDoc ICellControl.getType} */
|
|
27
|
+
getType(): string;
|
|
28
|
+
/** {@inheritDoc ICellControl.isAccepted} */
|
|
29
|
+
isAccepted(value: Scalar): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Covers `ranges` too, coalesced with what the control already covers. Autofill uses it to grow
|
|
32
|
+
* the template's control rather than mint a twin.
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
35
|
+
_extendRanges(ranges: readonly IRange.Coords[]): void;
|
|
36
|
+
/** {@inheritDoc IListener.ISource.addListeners} */
|
|
37
|
+
addListeners(listeners: ICellControl.IListeners, options?: IListener.Options): IListener.Remove;
|
|
38
|
+
/** {@inheritDoc ICellControl.toJSON} */
|
|
39
|
+
toJSON(): ICellControl.JSON;
|
|
40
|
+
get [Symbol.toStringTag](): string;
|
|
41
|
+
toString(): string;
|
|
42
|
+
/** {@inheritDoc ICellControl.isICellControl} */
|
|
43
|
+
get isICellControl(): true;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Interfaces for creating a {@link CellControl}.
|
|
47
|
+
*/
|
|
48
|
+
export declare namespace CellControl {
|
|
49
|
+
interface ConstructorOptions extends Anchored.ConstructorOptions<ICellControl.JSON> {
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A frozen copy of `json` with a non-empty `type`.
|
|
53
|
+
*
|
|
54
|
+
* @throws when `json` names no type.
|
|
55
|
+
*/
|
|
56
|
+
function normalizeJSON(json: ICellControl.JSON | null | undefined): Readonly<ICellControl.JSON>;
|
|
57
|
+
/**
|
|
58
|
+
* Whether two controls are the same definition: the same type and the same properties.
|
|
59
|
+
*/
|
|
60
|
+
function isSameJSON(a: Readonly<ICellControl.JSON>, b: Readonly<ICellControl.JSON>): boolean;
|
|
61
|
+
}
|
|
62
|
+
/** @internal */
|
|
63
|
+
interface State extends AbstractAnchored.State {
|
|
64
|
+
json: Readonly<ICellControl.JSON>;
|
|
65
|
+
}
|
|
66
|
+
export {};
|
|
67
|
+
//# sourceMappingURL=CellControl.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ICellRanges } from '../cellRange';
|
|
2
|
+
import { ICollection, AbstractCollection } from '../type';
|
|
3
|
+
import { IListener } from '../listener';
|
|
4
|
+
import { ITransaction } from '../transaction';
|
|
5
|
+
import { ICellControlCollection } from './ICellControlCollection';
|
|
6
|
+
import { ICellControl } from './ICellControl';
|
|
7
|
+
/**
|
|
8
|
+
* Implementation for {@link ICellControlCollection}.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* A front over the sheet's own cell-control state — the sheet keeps the store and the events,
|
|
12
|
+
* this class keeps the API. `onCollectionChange` is the sheet's `onCellControlsChange`, forwarded
|
|
13
|
+
* with this collection as the source.
|
|
14
|
+
*/
|
|
15
|
+
export declare class CellControlCollection extends AbstractCollection<ICellControl, ICellControlCollection.GetItemsOptions> implements ICellControlCollection {
|
|
16
|
+
private _add;
|
|
17
|
+
private _get;
|
|
18
|
+
private _addListeners;
|
|
19
|
+
constructor(add: (address: ICellRanges.Address, control: ICellControl.JSON, options?: ITransaction.OperationOptions) => ICellControl, get: (address: ICellRanges.Address | null | undefined, ignoreHidden?: boolean, fullyContained?: boolean) => ICellControl[], addListeners: (listeners: ICollection.IListeners, options?: IListener.Options) => IListener.Remove);
|
|
20
|
+
/** {@inheritDoc ICellControlCollection.add} */
|
|
21
|
+
add(address: ICellRanges.Address, control: ICellControl.JSON, options?: ITransaction.OperationOptions): ICellControl;
|
|
22
|
+
/** {@inheritDoc AbstractCollection._getItems} */
|
|
23
|
+
protected _getItems(options?: ICellControlCollection.GetItemsOptions): ICellControl[];
|
|
24
|
+
/** {@inheritDoc ICollection.addListeners} */
|
|
25
|
+
addListeners(listeners: ICollection.IListeners, options?: IListener.Options): IListener.Remove;
|
|
26
|
+
/** {@inheritDoc ICellControlCollection.isICellControlCollection} */
|
|
27
|
+
get isICellControlCollection(): true;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=CellControlCollection.d.ts.map
|