@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,47 @@
|
|
|
1
|
+
import { Scalar } from '@sheetxl/primitives';
|
|
2
|
+
/**
|
|
3
|
+
* What a control type does to the cells it covers: which values it draws.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* The SDK half of a control type. How it looks and how it responds to the pointer and keys belong
|
|
7
|
+
* to the UI, which registers its own renderer under the same `type`.
|
|
8
|
+
*/
|
|
9
|
+
export interface ICellControlKind {
|
|
10
|
+
/**
|
|
11
|
+
* The type this kind is registered under, such as `'checkbox'`.
|
|
12
|
+
*/
|
|
13
|
+
readonly type: string;
|
|
14
|
+
/**
|
|
15
|
+
* The kind's name where a UI lists the kinds that can be inserted, such as `'Rating'`. Plain
|
|
16
|
+
* text; the built-in checkbox takes its name from the command catalog instead.
|
|
17
|
+
*/
|
|
18
|
+
readonly label?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Whether the control draws a cell holding `value`. Any other value draws as text.
|
|
21
|
+
*/
|
|
22
|
+
accepts(value: Scalar): boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Excel's checkbox: draws a boolean or a blank cell, in place of its text.
|
|
26
|
+
*/
|
|
27
|
+
export declare const CheckboxKind: ICellControlKind;
|
|
28
|
+
/**
|
|
29
|
+
* The control types a cell control can have, by type.
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* The built-in types are registered before the registry is first used; a host registers its own
|
|
33
|
+
* the same way. A type nobody has registered still loads and saves, and accepts no value, so its
|
|
34
|
+
* cells draw as text.
|
|
35
|
+
*/
|
|
36
|
+
export declare namespace CellControlRegistry {
|
|
37
|
+
/**
|
|
38
|
+
* Registers a kind. A kind registered again under the same type replaces the earlier one,
|
|
39
|
+
* a built-in included.
|
|
40
|
+
*/
|
|
41
|
+
function register(kind: ICellControlKind): void;
|
|
42
|
+
/** The kind registered for `type`, or `null`. */
|
|
43
|
+
function get(type: string): ICellControlKind | null;
|
|
44
|
+
/** The registered types. */
|
|
45
|
+
function getTypes(): string[];
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=CellControlRegistry.d.ts.map
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { Scalar } from '@sheetxl/primitives';
|
|
2
|
+
import { IAnchored } from '../anchored';
|
|
3
|
+
import { ICellRange } from '../cellRange';
|
|
4
|
+
import { IListener } from '../listener';
|
|
5
|
+
/**
|
|
6
|
+
* A control drawn in the cells of a range, such as a checkbox.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* A cell control decorates the cell's value; it never holds one. A checkbox draws `TRUE` as
|
|
10
|
+
* checked and `FALSE` or blank as unchecked, and a click writes the boolean into the cell, where
|
|
11
|
+
* formulas read it as any other value. Excel's model is the same: the checkbox is a cell
|
|
12
|
+
* *format*, and *Clear Formats* removes it while the value stays.
|
|
13
|
+
*
|
|
14
|
+
* * A cell has at most one control. One control covers any number of cells, and its ranges
|
|
15
|
+
* shift, split, copy and fill with them.
|
|
16
|
+
* * A control draws only the values its type accepts ({@link isAccepted}). Any other value draws
|
|
17
|
+
* as plain text: a checkbox over `2` or `"true"` draws `2` or `true`, as in Excel.
|
|
18
|
+
* * Most code never needs this interface: {@link ICellRange.setControl} and
|
|
19
|
+
* {@link ICellRange.getControls} stand in for Office Scripts' `Range.setControl` /
|
|
20
|
+
* `getControl`.
|
|
21
|
+
*/
|
|
22
|
+
export interface ICellControl extends IAnchored {
|
|
23
|
+
/**
|
|
24
|
+
* The control's type, such as `'checkbox'`.
|
|
25
|
+
*
|
|
26
|
+
* @remarks
|
|
27
|
+
* A type nobody has registered (`CellControlRegistry`) is kept and saved as it was read; it
|
|
28
|
+
* accepts no value, so its cells draw as text.
|
|
29
|
+
*/
|
|
30
|
+
getType(): string;
|
|
31
|
+
/**
|
|
32
|
+
* Returns the first range the control covers.
|
|
33
|
+
*
|
|
34
|
+
* @remarks
|
|
35
|
+
* See {@link IAnchored.getRanges} for all of them. To change where a control is, use
|
|
36
|
+
* {@link ICellRange.setControl}.
|
|
37
|
+
*/
|
|
38
|
+
getRange(): ICellRange;
|
|
39
|
+
/**
|
|
40
|
+
* Whether the control draws a cell holding `value`.
|
|
41
|
+
*
|
|
42
|
+
* @remarks
|
|
43
|
+
* A checkbox accepts a boolean or a blank cell. A value it does not accept draws as the cell
|
|
44
|
+
* would without the control.
|
|
45
|
+
*/
|
|
46
|
+
isAccepted(value: Scalar): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Add Listeners.
|
|
49
|
+
*
|
|
50
|
+
* @see
|
|
51
|
+
* {@link IListener.ISource.addListeners}
|
|
52
|
+
*/
|
|
53
|
+
addListeners(listeners: ICellControl.IListeners, options?: IListener.Options): IListener.Remove;
|
|
54
|
+
/**
|
|
55
|
+
* The control as JSON: its `type` and any properties of that type.
|
|
56
|
+
*/
|
|
57
|
+
toJSON(): ICellControl.JSON;
|
|
58
|
+
/**
|
|
59
|
+
* For runtime type checking.
|
|
60
|
+
*/
|
|
61
|
+
readonly isICellControl: true;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* {@inheritDoc ICellControl}
|
|
65
|
+
* @see
|
|
66
|
+
* ### **Interface**
|
|
67
|
+
*
|
|
68
|
+
* {@link ICellControl}
|
|
69
|
+
*
|
|
70
|
+
* **Additional Interfaces**
|
|
71
|
+
* * {@link ICellControlCollection}
|
|
72
|
+
*/
|
|
73
|
+
export declare namespace ICellControl {
|
|
74
|
+
/**
|
|
75
|
+
* A control as JSON: its `type`, and any properties that type defines.
|
|
76
|
+
*
|
|
77
|
+
* @remarks
|
|
78
|
+
* Office Scripts' `CellControl`: `{ type: 'checkbox' }`. A checkbox has no other properties.
|
|
79
|
+
* Office Scripts' `EmptyCellControl` is `null` here.
|
|
80
|
+
*/
|
|
81
|
+
interface JSON {
|
|
82
|
+
/**
|
|
83
|
+
* The control's type, such as `'checkbox'`.
|
|
84
|
+
*/
|
|
85
|
+
type: string;
|
|
86
|
+
/**
|
|
87
|
+
* Properties of the type.
|
|
88
|
+
*/
|
|
89
|
+
[property: string]: unknown;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* IListener for {@link ICellControl} events.
|
|
93
|
+
*/
|
|
94
|
+
interface Events extends IAnchored.Events<ICellControl> {
|
|
95
|
+
}
|
|
96
|
+
interface IListeners extends IListener.Callbacks<ICellControl, ICellControl.Events> {
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=ICellControl.d.ts.map
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { ICellRange, ICellRanges } from '../cellRange';
|
|
2
|
+
import { ICollection } from '../type';
|
|
3
|
+
import { ITransaction } from '../transaction';
|
|
4
|
+
import { ICellControl } from './ICellControl';
|
|
5
|
+
/**
|
|
6
|
+
* Holds a sheet's {@link ICellControl}s.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* Most code reaches controls through the range instead: {@link ICellRange.setControl} puts a
|
|
10
|
+
* control on cells and {@link ICellRange.getControls} reads it back. The collection is for listing
|
|
11
|
+
* every control, as a task pane does.
|
|
12
|
+
*/
|
|
13
|
+
export interface ICellControlCollection extends ICollection<ICellControl> {
|
|
14
|
+
/**
|
|
15
|
+
* Puts a control on the cells of `address`, replacing their controls, and returns it.
|
|
16
|
+
*
|
|
17
|
+
* @param address The address of the cells. May name several discontiguous ranges.
|
|
18
|
+
* @param control The control, such as `{ type: 'checkbox' }`.
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* The same write as {@link ICellRange.setControl}, over any address. A cell has at most one
|
|
22
|
+
* control, so the cells leave whatever control they had, and join a control of the same
|
|
23
|
+
* definition when the sheet already has one.
|
|
24
|
+
*/
|
|
25
|
+
add(address: ICellRanges.Address, control: ICellControl.JSON, options?: ITransaction.OperationOptions): ICellControl;
|
|
26
|
+
/**
|
|
27
|
+
* Returns items that match the filter criteria.
|
|
28
|
+
*
|
|
29
|
+
* If no filter criteria is provided, all items will be returned.
|
|
30
|
+
*
|
|
31
|
+
* @param options {@link ICellControlCollection.GetItemsOptions}
|
|
32
|
+
*/
|
|
33
|
+
getItems(options?: ICellControlCollection.GetItemsOptions): ICellControl[];
|
|
34
|
+
/** For runtime type checking. */
|
|
35
|
+
readonly isICellControlCollection: true;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* {@inheritDoc ICellControlCollection}
|
|
39
|
+
* @see
|
|
40
|
+
* ### **Interface**
|
|
41
|
+
*
|
|
42
|
+
* {@link ICellControlCollection}
|
|
43
|
+
*/
|
|
44
|
+
export declare namespace ICellControlCollection {
|
|
45
|
+
/**
|
|
46
|
+
* Options for searching for {@link ICellControl}s.
|
|
47
|
+
*/
|
|
48
|
+
interface GetItemsOptions extends ICollection.GetItemsOptions {
|
|
49
|
+
/**
|
|
50
|
+
* If provided, the search will be limited to items that intersect the range.
|
|
51
|
+
*/
|
|
52
|
+
address?: ICellRange.Address;
|
|
53
|
+
/**
|
|
54
|
+
* Indicate if items that are in hidden headers or marked as hidden should be returned.
|
|
55
|
+
*
|
|
56
|
+
* @defaultValue false
|
|
57
|
+
*/
|
|
58
|
+
ignoreHidden?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Only return items that are completely contained with the search bounds.
|
|
61
|
+
*
|
|
62
|
+
* @defaultValue false
|
|
63
|
+
*/
|
|
64
|
+
fullyContained?: boolean;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=ICellControlCollection.d.ts.map
|
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
import { FormulaError, IRange, Scalar, InteropScalar, IRangeStats } from '@sheetxl/primitives';
|
|
1
|
+
import { FormulaError, IRange, Scalar, InteropScalar, IRangeStats, IRichData } from '@sheetxl/primitives';
|
|
2
2
|
import { Bounds, Size, ReferenceableClipboard } from '@sheetxl/utils';
|
|
3
3
|
import { ITypes } from '../type';
|
|
4
4
|
import { IListener } from '../listener';
|
|
5
5
|
import { ITransaction } from '../transaction';
|
|
6
|
+
import { IAnchored } from '../anchored/IAnchored';
|
|
6
7
|
import { IHyperlink } from '../hyperlink';
|
|
7
8
|
import { IRichText } from '../text';
|
|
8
|
-
import { IComment, ICommentCollection } from '../comment';
|
|
9
9
|
import { ISort } from '../sort';
|
|
10
10
|
import { ICondition } from '../condition';
|
|
11
11
|
import { IAutoFill } from '../autoFill';
|
|
12
12
|
import { ICellStyle } from '../style';
|
|
13
13
|
import { ICalculation } from '../calculation';
|
|
14
|
+
import { IWorksheet } from '../sheet';
|
|
15
|
+
import { ICell } from '../cell';
|
|
16
|
+
import { IComment, ICommentCollection } from '../comment';
|
|
14
17
|
import { ITable, ITableCollection } from '../table';
|
|
15
18
|
import { IMovable, IMovableCollection } from '../movable';
|
|
16
19
|
import { IDataValidation, IDataValidationCollection } from '../dataValidation';
|
|
17
|
-
import { IConditionalFormat } from '../conditionalFormat
|
|
18
|
-
import { IConditionalFormatCollection } from '../conditionalFormat/IConditionalFormatCollection';
|
|
20
|
+
import { IConditionalFormat, IConditionalFormatCollection } from '../conditionalFormat';
|
|
19
21
|
import { IProtectedRange, IProtectedRangeCollection } from '../protectedRange';
|
|
20
|
-
import {
|
|
21
|
-
import { ICell } from '../cell';
|
|
22
|
+
import { ICellControl, ICellControlCollection } from '../cellControl';
|
|
22
23
|
import { ICellRanges } from './ICellRanges';
|
|
23
24
|
import { ICellRegions } from './ICellRegion';
|
|
24
25
|
import { ICellHeaderRange } from './ICellHeaderRange';
|
|
@@ -96,6 +97,39 @@ export interface ICellRange {
|
|
|
96
97
|
* {@link IConditionalFormat.getRanges}.
|
|
97
98
|
*/
|
|
98
99
|
getConditionalFormats(options?: ICellRange.GetItemsOptions<IConditionalFormatCollection.GetItemsOptions>): IConditionalFormat[];
|
|
100
|
+
/**
|
|
101
|
+
* Returns the {@link ICellControl}s on cells within the range, such as checkboxes.
|
|
102
|
+
*
|
|
103
|
+
* @param options The filters of {@link ICellControlCollection.getItems} without `address` —
|
|
104
|
+
* this range is the address.
|
|
105
|
+
*
|
|
106
|
+
* @remarks
|
|
107
|
+
* See {@link getConditionalFormats} for the overlap and one-entry-per-item rules, which are the
|
|
108
|
+
* same for every ranged item lookup. A cell has at most one control; ask a cell for its own with
|
|
109
|
+
* {@link ICell.getControl}.
|
|
110
|
+
*
|
|
111
|
+
* Office Scripts' `Range.getControl()` answers one `CellControl` for the whole range; here
|
|
112
|
+
* `getControls()[0]?.getType()` reads a single cell's, and `toJSON()` gives the
|
|
113
|
+
* `{ type: 'checkbox' }` shape. A control is about the cell, not its value: a checkbox cell
|
|
114
|
+
* holding `2` still has one, though it draws `2` ({@link ICellControl.isAccepted}). A type
|
|
115
|
+
* SheetXL does not know answers with its own name, where Excel answers `unknown`.
|
|
116
|
+
*/
|
|
117
|
+
getControls(options?: ICellRange.GetItemsOptions<ICellControlCollection.GetItemsOptions>): ICellControl[];
|
|
118
|
+
/**
|
|
119
|
+
* Puts `control` on every cell of the range, replacing the control each had; `null` removes
|
|
120
|
+
* them.
|
|
121
|
+
*
|
|
122
|
+
* @param control The control, such as `{ type: 'checkbox' }`, or `null`.
|
|
123
|
+
*
|
|
124
|
+
* @remarks
|
|
125
|
+
* Office Scripts' `Range.setControl`, with `null` for its `{ type: 'empty' }`. A cell has at most
|
|
126
|
+
* one control. The values stay as they are: a checkbox draws `TRUE` as checked and `FALSE` or a
|
|
127
|
+
* blank cell as unchecked, and any other value as text.
|
|
128
|
+
*
|
|
129
|
+
* A control is a format: refused on a protected sheet unless formatting cells is allowed, removed
|
|
130
|
+
* by {@link clear} of formats, and carried by a paste of formats.
|
|
131
|
+
*/
|
|
132
|
+
setControl(control: ICellControl.JSON | null, options?: ITransaction.OperationOptions): this;
|
|
99
133
|
/**
|
|
100
134
|
* Returns the {@link IDataValidation}s that overlap the range.
|
|
101
135
|
*
|
|
@@ -768,7 +802,7 @@ export interface ICellRange {
|
|
|
768
802
|
getRegions(features?: ICellRange.Feature | readonly ICellRange.Feature[], options?: ICellRange.GetRegionsOptions): ICellRegions;
|
|
769
803
|
/**
|
|
770
804
|
* Returns the regions of the `anomalies` feature in reading order: the named checks first, then
|
|
771
|
-
* the rest, each by rank.
|
|
805
|
+
* the rest, each by the named focus or by rank.
|
|
772
806
|
*
|
|
773
807
|
* @param options {@link ICellRange.GetAnomaliesOptions}
|
|
774
808
|
*
|
|
@@ -777,6 +811,8 @@ export interface ICellRange {
|
|
|
777
811
|
* // Hunting an embedded hardcode: read its checks' findings first, 25 regions at a time.
|
|
778
812
|
* sheet.getAnomalies({ checks: ['hardcodeInRun', 'styleRole'], limit: 25 });
|
|
779
813
|
* sheet.getAnomalies({ checks: ['hardcodeInRun', 'styleRole'], limit: 25, offset: 25 });
|
|
814
|
+
* // Or name the kind of defect and let the measured order decide.
|
|
815
|
+
* sheet.getAnomalies({ focus: 'unitMismatch', limit: 25 });
|
|
780
816
|
* ```
|
|
781
817
|
*
|
|
782
818
|
* @remarks
|
|
@@ -787,6 +823,13 @@ export interface ICellRange {
|
|
|
787
823
|
* region two named checks fire on lists once, under the first. An ignored check
|
|
788
824
|
* ({@link setErrorIgnored}) is not there to list.
|
|
789
825
|
*
|
|
826
|
+
* `focus` names the kind of defect being looked for ({@link ICellRange.AnomalyFocus}). Each
|
|
827
|
+
* finding then weighs as the share of findings like it — the same check, the same kind of
|
|
828
|
+
* evidence, about as often repeated in the listing — that were that kind of defect in audited
|
|
829
|
+
* models, and a region lists by its best finding, by rank where that is equal. Several kinds
|
|
830
|
+
* merge into one order by the best of them. It reorders; it neither adds nor drops a region, and
|
|
831
|
+
* the findings' own ranks are unchanged.
|
|
832
|
+
*
|
|
790
833
|
* `offset` and `limit` page through that one order, so successive windows neither skip nor
|
|
791
834
|
* repeat a region; a window shorter than `limit` is the last. `getRegions('anomalies').getCount()`
|
|
792
835
|
* is the length of the whole list.
|
|
@@ -1289,12 +1332,23 @@ export interface ICellRange {
|
|
|
1289
1332
|
*/
|
|
1290
1333
|
select(options?: ICellRange.SelectOptions): Promise<this>;
|
|
1291
1334
|
/**
|
|
1292
|
-
*
|
|
1335
|
+
* Listen for changes at this range: its cells written, recalculated or undone, and the range
|
|
1336
|
+
* itself moved by rows or columns inserted or deleted around it.
|
|
1293
1337
|
*
|
|
1294
|
-
* @returns A callback
|
|
1338
|
+
* @returns A callback that removes the listener. {@link IListener.Remove}
|
|
1295
1339
|
*
|
|
1296
1340
|
* @remarks
|
|
1297
|
-
*
|
|
1341
|
+
* The listener is handed an {@link ICellRange.Event} whose source is the listened range where
|
|
1342
|
+
* it is now. Which events it hears, how it follows inserts and deletes, and whether it takes
|
|
1343
|
+
* part in the change or observes it afterwards are {@link ICellRange.ListenerOptions}.
|
|
1344
|
+
*
|
|
1345
|
+
* @example
|
|
1346
|
+
* ```ts
|
|
1347
|
+
* const remove = sheet.getRange('A1:C3').addListener((event) => {
|
|
1348
|
+
* if (event.getTrigger() === 'data') console.log('changed:', event.getRanges()!.getAddress());
|
|
1349
|
+
* else console.log('now at:', event.getSource().getAddress());
|
|
1350
|
+
* });
|
|
1351
|
+
* ```
|
|
1298
1352
|
*/
|
|
1299
1353
|
addListener(listener: ICellRange.Listener, options?: ICellRange.ListenerOptions): IListener.Remove;
|
|
1300
1354
|
/**
|
|
@@ -1576,15 +1630,20 @@ export declare namespace ICellRange {
|
|
|
1576
1630
|
*/
|
|
1577
1631
|
type ScalarUpdate = Scalar | null | undefined;
|
|
1578
1632
|
/**
|
|
1579
|
-
* Represents an update to a cell's value in JavaScript, allowing `Date
|
|
1633
|
+
* Represents an update to a cell's value in JavaScript, allowing `Date`, a rich value's JSON
|
|
1634
|
+
* and `null`.
|
|
1580
1635
|
*
|
|
1581
1636
|
* @remarks
|
|
1582
1637
|
* This type allows for updating a cell's value, including `Date` for convenience.
|
|
1583
1638
|
* As with `ScalarUpdate`, `null` can be used to clear the cell's value.
|
|
1584
1639
|
*
|
|
1640
|
+
* A rich value may be given as its JSON (`{ type, data }`, what {@link IRichData.toJSON}
|
|
1641
|
+
* returns); it is made by the kind registered for `type`, and an unregistered type is kept
|
|
1642
|
+
* as it was given.
|
|
1643
|
+
*
|
|
1585
1644
|
* * See {@link InteropScalar} for more details on JavaScript scalar values.
|
|
1586
1645
|
*/
|
|
1587
|
-
type InteropScalarUpdate = InteropScalar | null | undefined;
|
|
1646
|
+
type InteropScalarUpdate = InteropScalar | IRichData.JSON | null | undefined;
|
|
1588
1647
|
/**
|
|
1589
1648
|
* Single or 2D.
|
|
1590
1649
|
*/
|
|
@@ -2715,6 +2774,14 @@ export declare namespace ICellRange {
|
|
|
2715
2774
|
* failure — its cells evaluate, to `0` — and is {@link Feature.Circular}.
|
|
2716
2775
|
*/
|
|
2717
2776
|
readonly CalcError: "calcError";
|
|
2777
|
+
/**
|
|
2778
|
+
* Evaluated state: cells whose result has not settled. Regions group by status — a cell whose
|
|
2779
|
+
* own function has not answered yet ({@link ICalculation.ResultStatus.Pending}), or one
|
|
2780
|
+
* calculated from such a value and calculated again when it arrives
|
|
2781
|
+
* ({@link ICalculation.ResultStatus.Waiting}). The anchor's `getCalculationStatus()` is the
|
|
2782
|
+
* payload. Empty once every answer has landed.
|
|
2783
|
+
*/
|
|
2784
|
+
readonly CalcStatus: "calcStatus";
|
|
2718
2785
|
/**
|
|
2719
2786
|
* Evaluated state: cells in a reference cycle, or downstream of one. Both evaluate to `0`
|
|
2720
2787
|
* (Excel, iterative calculation off) with nothing else to show for it — this is the marker.
|
|
@@ -2762,6 +2829,14 @@ export declare namespace ICellRange {
|
|
|
2762
2829
|
readonly Conditionals: "conditionals";
|
|
2763
2830
|
/** Cells under data-validation rules. */
|
|
2764
2831
|
readonly DataValidations: "dataValidations";
|
|
2832
|
+
/**
|
|
2833
|
+
* Cells under a cell control ({@link ICellRange.setControl}). Regions group by the control's
|
|
2834
|
+
* definition (its type and properties), so adjacent checkboxes set in two strokes are one
|
|
2835
|
+
* region and a checkbox beside a rating are two; the anchor cell's {@link ICell.getControl} is
|
|
2836
|
+
* the payload. Whether a cell draws its control depends on its value, which is a `Kind`
|
|
2837
|
+
* question: ask for both to split a column of checkboxes from the text cells among them.
|
|
2838
|
+
*/
|
|
2839
|
+
readonly CellControl: "cellControl";
|
|
2765
2840
|
/**
|
|
2766
2841
|
* Cells where an error check fires — what breaks the pattern around it. Regions group by the
|
|
2767
2842
|
* check and its evidence, so a filled row that breaks the same way is one region; the anchor
|
|
@@ -2783,7 +2858,11 @@ export declare namespace ICellRange {
|
|
|
2783
2858
|
* a reference outside the workbook (`externalReference`); and from labels: a link whose target
|
|
2784
2859
|
* row is labeled otherwise (`linkLabelMismatch`), a lookup key that is not the row's or
|
|
2785
2860
|
* column's label (`keyLabelMismatch`), a link with the other sign from its siblings
|
|
2786
|
-
* (`signVsSiblings`)
|
|
2861
|
+
* (`signVsSiblings`); and from the numbers: a typed number in a formula equal to an input
|
|
2862
|
+
* nothing reads (`literalMatchesInput`), twin formulas that differ in a unit literal or a sign
|
|
2863
|
+
* (`twinBlockDivergence`), a percent typed as a whole number (`scaleOutlier`), every constant a
|
|
2864
|
+
* formula types with how often the workbook types it (`constantFrequency`). An ignored check
|
|
2865
|
+
* ({@link ICellRange.setErrorIgnored}) does not fire.
|
|
2787
2866
|
*
|
|
2788
2867
|
* Regions list highest rank first ({@link ICell.Anomaly.rank}), unless an `axis` is asked for.
|
|
2789
2868
|
*
|
|
@@ -2847,6 +2926,33 @@ export declare namespace ICellRange {
|
|
|
2847
2926
|
*/
|
|
2848
2927
|
containment?: 'intersects' | 'fullyContained';
|
|
2849
2928
|
}
|
|
2929
|
+
/**
|
|
2930
|
+
* A kind of defect a reader is looking for, which {@link ICellRange.getAnomalies} can order its
|
|
2931
|
+
* findings by ({@link GetAnomaliesOptions.focus}).
|
|
2932
|
+
*/
|
|
2933
|
+
const AnomalyFocus: {
|
|
2934
|
+
/** A cell or a subtotal counted twice in a sum. */
|
|
2935
|
+
readonly DoubleCounting: "doubleCounting";
|
|
2936
|
+
/** A typed number where a reference belongs. */
|
|
2937
|
+
readonly EmbeddedHardcode: "embeddedHardcode";
|
|
2938
|
+
/** A cell whose font color is not its role's (inputs, links, calculations). */
|
|
2939
|
+
readonly ColorCoding: "colorCoding";
|
|
2940
|
+
/** An average over the wrong cells. */
|
|
2941
|
+
readonly Average: "average";
|
|
2942
|
+
/** A link to another sheet that reads the wrong row or column. */
|
|
2943
|
+
readonly CrossSheetReference: "crossSheetReference";
|
|
2944
|
+
/** A term added that should be taken away, or the reverse. */
|
|
2945
|
+
readonly SignConvention: "signConvention";
|
|
2946
|
+
/** A lookup that matches approximately, or reads arrays that do not line up. */
|
|
2947
|
+
readonly Lookup: "lookup";
|
|
2948
|
+
/** A reference relative where it should be absolute, or the reverse. */
|
|
2949
|
+
readonly ReferenceAnchoring: "referenceAnchoring";
|
|
2950
|
+
/** A value in the wrong unit: a monthly figure in a daily formula, a percent typed as a whole number. */
|
|
2951
|
+
readonly UnitMismatch: "unitMismatch";
|
|
2952
|
+
/** Rows deleted from a model, which leaves references shifted and `#REF!`. */
|
|
2953
|
+
readonly DeletedRows: "deletedRows";
|
|
2954
|
+
};
|
|
2955
|
+
type AnomalyFocus = typeof AnomalyFocus[keyof typeof AnomalyFocus];
|
|
2850
2956
|
/**
|
|
2851
2957
|
* Options for {@link ICellRange.getAnomalies}.
|
|
2852
2958
|
*/
|
|
@@ -2857,6 +2963,15 @@ export declare namespace ICellRange {
|
|
|
2857
2963
|
* @defaultValue none — every region by rank
|
|
2858
2964
|
*/
|
|
2859
2965
|
checks?: readonly ICell.ErrorCheck[];
|
|
2966
|
+
/**
|
|
2967
|
+
* The kind of defect being looked for, or several: regions are ordered by how often findings
|
|
2968
|
+
* like theirs have been that kind of defect, measured on audited models, and by rank where
|
|
2969
|
+
* that is equal. With `checks` too, the named checks still list first and `focus` orders
|
|
2970
|
+
* within each. An unknown name throws.
|
|
2971
|
+
*
|
|
2972
|
+
* @defaultValue none — by rank
|
|
2973
|
+
*/
|
|
2974
|
+
focus?: AnomalyFocus | readonly AnomalyFocus[];
|
|
2860
2975
|
/**
|
|
2861
2976
|
* At most this many regions.
|
|
2862
2977
|
*
|
|
@@ -3009,85 +3124,101 @@ export declare namespace ICellRange {
|
|
|
3009
3124
|
*/
|
|
3010
3125
|
injectReferences?: IRange.JSONReference<any>[][];
|
|
3011
3126
|
}
|
|
3012
|
-
|
|
3127
|
+
/**
|
|
3128
|
+
* What a range listener is told. See {@link ICellRange.addListener}.
|
|
3129
|
+
*
|
|
3130
|
+
* @typeParam S The source the listener registered on: an `ICellRange` from
|
|
3131
|
+
* {@link ICellRange.addListener}, an `ICellRanges` from {@link ICellRanges.addListener}.
|
|
3132
|
+
*/
|
|
3133
|
+
interface Event<S extends ICellRange | ICellRanges = ICellRange> {
|
|
3013
3134
|
/**
|
|
3014
3135
|
* The range that was listened to, where it is now.
|
|
3015
3136
|
*
|
|
3016
3137
|
* @remarks
|
|
3017
|
-
* After
|
|
3138
|
+
* After an `'address'` or `'restore'` event this is the range at its new address or extent: rows
|
|
3018
3139
|
* or columns inserted or deleted around it, or an undo that moved it back. The range
|
|
3019
3140
|
* `addListener` was called on keeps the address it was made with, so this is where to read
|
|
3020
3141
|
* the range from.
|
|
3142
|
+
*
|
|
3143
|
+
* A range whose cells were deleted is invalid ({@link ICellRange.isInvalid}) and spells
|
|
3144
|
+
* `#REF!`; one restored to a revision from before the listener was added is invalid and
|
|
3145
|
+
* spells `#N/A`.
|
|
3021
3146
|
*/
|
|
3022
|
-
getSource
|
|
3147
|
+
getSource(): S;
|
|
3023
3148
|
/**
|
|
3024
|
-
*
|
|
3149
|
+
* The cells that changed within the source, for a `'data'` event; `null` for any other.
|
|
3025
3150
|
*
|
|
3026
3151
|
* @remarks
|
|
3027
|
-
*
|
|
3152
|
+
* A batch is one change: every range of it that reached the listener arrives in one event.
|
|
3028
3153
|
*/
|
|
3029
|
-
|
|
3154
|
+
getRanges(): ICellRanges | null;
|
|
3030
3155
|
/**
|
|
3031
|
-
*
|
|
3156
|
+
* Where the source was before an `'address'` event moved it; `null` for any other event, and
|
|
3157
|
+
* for a sheet rename, which moves no cells.
|
|
3158
|
+
*
|
|
3159
|
+
* @remarks
|
|
3160
|
+
* An address rather than a range, because the cells at it now are other cells.
|
|
3032
3161
|
*/
|
|
3162
|
+
getPreviousAddress(): string | null;
|
|
3033
3163
|
/**
|
|
3034
|
-
*
|
|
3164
|
+
* What happened to the range.
|
|
3035
3165
|
*
|
|
3036
3166
|
* @remarks
|
|
3037
|
-
* * `'data'`:
|
|
3038
|
-
*
|
|
3039
|
-
*
|
|
3040
|
-
*
|
|
3041
|
-
*
|
|
3042
|
-
*
|
|
3043
|
-
*
|
|
3044
|
-
*
|
|
3045
|
-
*
|
|
3167
|
+
* * `'data'`: Cells within the range changed: written, recalculated, or undone. The range's
|
|
3168
|
+
* address and extent are as they were. {@link getCommit} is `null` for a recalculation,
|
|
3169
|
+
* which belongs to no commit; {@link isUndo} tells an undo from a write.
|
|
3170
|
+
* * `'address'`: The range's address or extent changed: rows or columns inserted or deleted,
|
|
3171
|
+
* cells moved, its cells deleted (the source spells `#REF!`), or, for a sheet-qualified
|
|
3172
|
+
* range (one from {@link IWorkbook.getRange}, or a sheet's range naming another sheet), a
|
|
3173
|
+
* rename of the sheet it names. A bare range on its own sheet has no qualifier, so a rename
|
|
3174
|
+
* is not a change to it. A listener anchored {@link IAnchored.Type.Absolute} never moves and
|
|
3175
|
+
* never has one.
|
|
3176
|
+
* * `'restore'`: The workbook was restored to a revision from before the listener was added,
|
|
3177
|
+
* so the range is not in it (the source spells `#N/A`). Never delivered to a transactional
|
|
3178
|
+
* listener.
|
|
3046
3179
|
*/
|
|
3047
|
-
|
|
3048
|
-
readonly trigger: string;
|
|
3180
|
+
getTrigger(): Event.Trigger;
|
|
3049
3181
|
/**
|
|
3050
|
-
*
|
|
3182
|
+
* `true` when the change is an undo. A redo is not an undo: it is told as the forward change
|
|
3183
|
+
* was.
|
|
3051
3184
|
*/
|
|
3052
|
-
|
|
3185
|
+
isUndo(): boolean;
|
|
3053
3186
|
/**
|
|
3054
|
-
*
|
|
3187
|
+
* The commit that made the change, or `null` when none did: a recalculation landing.
|
|
3055
3188
|
*
|
|
3056
|
-
* @
|
|
3057
|
-
*
|
|
3189
|
+
* @remarks
|
|
3190
|
+
* A transactional listener is told before the commit is sealed, so this is the commit it is
|
|
3191
|
+
* writing into ({@link ListenerOptions.transactional}).
|
|
3058
3192
|
*/
|
|
3059
|
-
|
|
3193
|
+
getCommit(): ITransaction.ICommit | null;
|
|
3060
3194
|
/**
|
|
3061
|
-
*
|
|
3062
|
-
*
|
|
3063
|
-
* @see
|
|
3064
|
-
* {@link ListenerOptions.ignoreDataChanges}
|
|
3195
|
+
* The trigger and the source, for logging.
|
|
3065
3196
|
*/
|
|
3066
|
-
|
|
3197
|
+
toString(): string;
|
|
3067
3198
|
/**
|
|
3068
|
-
*
|
|
3199
|
+
* When the event was made, in milliseconds since the epoch.
|
|
3069
3200
|
*/
|
|
3070
|
-
|
|
3201
|
+
getTimeStamp(): number;
|
|
3202
|
+
}
|
|
3203
|
+
namespace Event {
|
|
3071
3204
|
/**
|
|
3072
|
-
*
|
|
3205
|
+
* What happened to a listened range. See {@link ICellRange.Event.getTrigger}.
|
|
3073
3206
|
*/
|
|
3074
|
-
|
|
3207
|
+
type Trigger = 'data' | 'address' | 'restore';
|
|
3075
3208
|
}
|
|
3076
3209
|
/**
|
|
3077
|
-
*
|
|
3078
|
-
* data, address, or restore state changes, subject to the provided options.
|
|
3210
|
+
* Called with what changed at a listened range. See {@link ICellRange.addListener}.
|
|
3079
3211
|
*
|
|
3080
|
-
* @
|
|
3081
|
-
* If the range is deleted (rows/columns removed), the trigger will be `'address'`
|
|
3082
|
-
* `trigger` of `'address'` and `getRange().getError()`
|
|
3083
|
-
* returning `"#REF!"`.
|
|
3212
|
+
* @typeParam S The source the listener registered on; see {@link ICellRange.Event}.
|
|
3084
3213
|
*
|
|
3085
|
-
*
|
|
3086
|
-
*
|
|
3087
|
-
*
|
|
3214
|
+
* @remarks
|
|
3215
|
+
* Read the range from {@link Event.getSource}, which is where the listened cells are now. It is
|
|
3216
|
+
* invalid ({@link ICellRange.isInvalid}) when the cells were deleted (`#REF!`) or the workbook
|
|
3217
|
+
* was restored to a revision from before the listener was added (`#N/A`); the listener stays
|
|
3218
|
+
* registered through both, and hears the range come back.
|
|
3088
3219
|
*/
|
|
3089
|
-
interface Listener {
|
|
3090
|
-
(event: ICellRange.Event): void;
|
|
3220
|
+
interface Listener<S extends ICellRange | ICellRanges = ICellRange> {
|
|
3221
|
+
(event: ICellRange.Event<S>): void;
|
|
3091
3222
|
}
|
|
3092
3223
|
/**
|
|
3093
3224
|
* Receives a watch's results — one value per cell of the watched range, read with LOCAL
|
|
@@ -3133,11 +3264,28 @@ export declare namespace ICellRange {
|
|
|
3133
3264
|
/**
|
|
3134
3265
|
* If `true`, the listener will *not* be called when the range's
|
|
3135
3266
|
* address changes (due to row/column insert/delete, moves, or a rename of
|
|
3136
|
-
* the sheet a qualified range names)
|
|
3267
|
+
* the sheet a qualified range names). The range still follows its cells; see {@link anchor}
|
|
3268
|
+
* for a range that should not.
|
|
3137
3269
|
*
|
|
3138
3270
|
* @defaultValue false
|
|
3139
3271
|
*/
|
|
3140
3272
|
ignoreAddressChanges?: boolean;
|
|
3273
|
+
/**
|
|
3274
|
+
* How the listened range follows rows and columns inserted or deleted around it.
|
|
3275
|
+
*
|
|
3276
|
+
* @defaultValue {@link IAnchored.Type.TwoCell}
|
|
3277
|
+
*
|
|
3278
|
+
* @remarks
|
|
3279
|
+
* * `TwoCell`: the range follows its cells, as a formula reference does. An insert above it
|
|
3280
|
+
* moves it down, a delete inside it shrinks it, and deleting all of its cells makes it
|
|
3281
|
+
* `#REF!`. Each move is an `'address'` event.
|
|
3282
|
+
* * `OneCell`: the top-left follows its cell and the extent is kept, as a picture anchored to
|
|
3283
|
+
* one cell. Deleting the top-left cell leaves the range where it is.
|
|
3284
|
+
* * `Absolute`: the range never moves. It names the same addresses whatever is inserted or
|
|
3285
|
+
* deleted, so it never has an `'address'` event. This is what a view listening to the rows
|
|
3286
|
+
* it shows wants: the cells on screen, not the cells that were there when it subscribed.
|
|
3287
|
+
*/
|
|
3288
|
+
anchor?: IAnchored.Type;
|
|
3141
3289
|
/**
|
|
3142
3290
|
* Whether the listener takes part in the operations that change its range.
|
|
3143
3291
|
*
|