@sheetxl/sdk 0.7.28-beta.3 → 0.7.28-beta.4
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/cjs/{D6cjnwWR_iUSe1f6.cjs → BF14ZEAnaqxXroSj.cjs} +1 -1
- package/browser/cjs/{CWCKcp58KidyndaL.cjs → BXtvdT1Z-MsB_o5F.cjs} +1 -1
- package/browser/cjs/Bc4JjVVZfFo3R4He.cjs +33 -0
- package/browser/cjs/{BX6A6xGDOr_td9mw.cjs → CD2RXdnfqSYNc6gX.cjs} +1 -1
- package/browser/cjs/{B4PKKgaDTG9aSO-f.cjs → DcLpXGexEtOxi-dD.cjs} +1 -1
- package/browser/cjs/index.cjs +2 -2
- package/browser/esm/{CX1NO_a1QPjXDvTU.mjs → 0Mj5WKM362q6CECb.mjs} +3 -3
- package/browser/esm/{Rj8e7SashcMlcdZJ.mjs → CHSahmMFYNB0Ajkf.mjs} +2 -2
- package/browser/esm/{B1gpnr-7kLU7jTy-.mjs → CKk58ZLcrllMzfou.mjs} +2 -2
- package/browser/esm/{CPgz9_iM7xyAcytg.mjs → CPTtL2f6_4iblmFM.mjs} +2 -2
- package/browser/esm/{Dv8FyXyeygJPXoHo.mjs → CoA-sUxjiIUIpTUF.mjs} +2 -2
- package/browser/esm/{DZfds6s3ayTZrozO.mjs → DBIu6NUHIcxOOBQp.mjs} +1 -1
- package/browser/esm/{C78IaCXqwCcraBPe.mjs → Dy4Sdpju1T2icURu.mjs} +6266 -5497
- package/browser/esm/index.mjs +17 -14
- package/node/esm/{BkY99r-c3BhlT_Kv.mjs → BtGxbEbBm79YvF_k.mjs} +1 -1
- package/node/esm/{DE3eIaqkk5xzmV1c.mjs → DUYP6faJJHCaW1Xf.mjs} +1 -1
- package/node/esm/{8VtzCFSmLPKxJjOa.mjs → DqgWsVXROpSgKq6c.mjs} +1 -1
- package/node/esm/index.mjs +8589 -7804
- package/package.json +6 -6
- package/types/scripting-enums.json +2 -0
- package/types/scripting.d.ts +265 -8
- package/types/src/anchored/IAnchored.d.ts +27 -0
- package/types/src/calculation/Calculation.d.ts +21 -12
- package/types/src/calculation/ICalculation.d.ts +178 -0
- package/types/src/calculation/executor/CalcExecutor.d.ts +204 -13
- package/types/src/calculation/executor/CalcExecutorUtils.d.ts +31 -0
- package/types/src/calculation/executor/CircularReference.d.ts +81 -0
- package/types/src/calculation/grid/CalcGrid.d.ts +3 -1
- package/types/src/calculation/grid/CalcGridUtils.d.ts +3 -2
- package/types/src/calculation/grid/ICalcGrid.d.ts +12 -1
- package/types/src/calculation/spatial/CircularEntry.d.ts +18 -0
- package/types/src/calculation/spatial/index.d.ts +1 -0
- package/types/src/calculation/state/CalcNode.d.ts +24 -17
- package/types/src/calculation/state/CalcState.d.ts +78 -15
- package/types/src/calculation/state/CalculationContext.d.ts +39 -0
- package/types/src/calculation/state/_ReadObservedGrid.d.ts +90 -0
- package/types/src/cell/ICell.d.ts +16 -0
- package/types/src/cellRange/ICellRange.d.ts +12 -3
- package/types/src/condition/AnchoredConditional.d.ts +26 -6
- package/types/src/conditionalFormat/ConditionalFormat.d.ts +8 -1
- package/types/src/conditionalFormat/IConditionalFormat.d.ts +4 -1
- package/types/src/conditionalFormat/IConditionalFormatCollection.d.ts +6 -2
- package/types/src/dataValidation/IDataValidationCollection.d.ts +6 -2
- package/types/src/hyperlink/IHyperlink.d.ts +3 -1
- package/types/src/hyperlink/_Hyperlink.d.ts +6 -0
- package/types/src/lib/utils/utils.browser.d.ts +5 -0
- package/types/src/license/LicenseDetails.d.ts +5 -0
- package/types/src/primitives/CalcSignal.d.ts +20 -0
- package/types/src/protectedRange/IProtectedRangeCollection.d.ts +7 -2
- package/types/src/scripting/_ScriptUtils.d.ts +13 -0
- package/types/src/sheet/Sheet.d.ts +33 -2
- package/types/src/sheet/SheetCell.d.ts +2 -0
- package/types/src/sheet/_SheetStateTypes.d.ts +14 -1
- package/types/src/style/IStyle.d.ts +5 -0
- package/types/src/table/AnchoredTable.d.ts +17 -1
- package/types/src/text/TextUtils.d.ts +18 -0
- package/browser/cjs/1mH2uhx_Dmceu88H.cjs +0 -33
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ICellRange, ICellRanges } from '../cellRange';
|
|
2
2
|
import { ICollection } from '../type';
|
|
3
|
-
import {
|
|
3
|
+
import { IAnchored } from '../anchored';
|
|
4
4
|
import { IProtectedRange } from './IProtectedRange';
|
|
5
5
|
/**
|
|
6
6
|
* Holds a collection of {@link IProtectedRange}s.
|
|
@@ -41,8 +41,13 @@ export interface IProtectedRangeCollection extends ICollection<IProtectedRange>
|
|
|
41
41
|
export declare namespace IProtectedRangeCollection {
|
|
42
42
|
/**
|
|
43
43
|
* Options for adding an {@link IProtectedRange}.
|
|
44
|
+
*
|
|
45
|
+
* @remarks
|
|
46
|
+
* `replaceExisting` redefines the entry at `index` when it covers exactly the same ranges; the
|
|
47
|
+
* entry keeps its name unless a free one is supplied — see
|
|
48
|
+
* {@link IAnchored.AddOptions.replaceExisting}.
|
|
44
49
|
*/
|
|
45
|
-
interface AddOptions extends IProtectedRange.Properties,
|
|
50
|
+
interface AddOptions extends IProtectedRange.Properties, IAnchored.AddOptions {
|
|
46
51
|
}
|
|
47
52
|
/**
|
|
48
53
|
* Options for searching for {@link IProtectedRange}s.
|
|
@@ -13,6 +13,19 @@ export declare const _ReuseGlobalContext: {
|
|
|
13
13
|
FormulaError: typeof FormulaError;
|
|
14
14
|
Observable: typeof Observable;
|
|
15
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* Publishes the shared context on `globalThis` for bundled scripts.
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* A compiled script binds `globalThis.__SHEETXL.FormulaContext` (and `IRange`, `FormulaError`, …)
|
|
21
|
+
* ONCE, at module load — the `Bundler`'s virtual `@sheetxl/primitives` module reads them into
|
|
22
|
+
* top-level `export const`s. Every later call goes through that captured singleton, whose
|
|
23
|
+
* per-evaluation state is {@link setGlobalScope}. So the global only has to exist while a module
|
|
24
|
+
* loads. Idempotent, and never removed: nothing observes its absence, and installing it per
|
|
25
|
+
* function invocation (with a stash and a `delete` on the way out) cost ~290,000 property writes
|
|
26
|
+
* and deletes for one load of a 28K-formula workbook.
|
|
27
|
+
*/
|
|
28
|
+
export declare function installGlobalContext(): void;
|
|
16
29
|
export declare function setGlobalScope(scope: Partial<IFormulaContext> | null | undefined): void;
|
|
17
30
|
export declare function clearGlobalScope(): void;
|
|
18
31
|
//# sourceMappingURL=_ScriptUtils.d.ts.map
|
|
@@ -11,6 +11,7 @@ import { IComment } from '../comment';
|
|
|
11
11
|
import { IColor } from '../color';
|
|
12
12
|
import { IHyperlink } from '../hyperlink';
|
|
13
13
|
import { ISort } from '../sort';
|
|
14
|
+
import { IAnchored } from '../anchored';
|
|
14
15
|
import { Anchored } from '../anchored/Anchored';
|
|
15
16
|
import { IAnchoredMap } from '../anchored/IAnchoredMap';
|
|
16
17
|
import { ITable, ITableCollection } from '../table';
|
|
@@ -841,13 +842,43 @@ export declare class Sheet implements ISheet {
|
|
|
841
842
|
* @internal
|
|
842
843
|
*/
|
|
843
844
|
protected _addTable(address: ICellRange.Address, options: ITableCollection.AddOptions | boolean): ITable;
|
|
845
|
+
/**
|
|
846
|
+
* The add shared by the anchored collections — conditional formats, data validations, protected
|
|
847
|
+
* ranges. Resolves an item-or-address input, keeps the option keys out of the persisted JSON, and
|
|
848
|
+
* either redefines the item at `index` (when `replaceExisting` and the collection agrees it is the
|
|
849
|
+
* same item) or inserts there — first by default, as in Excel.
|
|
850
|
+
* @internal
|
|
851
|
+
*/
|
|
852
|
+
protected _addAnchored<T extends IAnchored & {
|
|
853
|
+
getRanges(): ICellRanges;
|
|
854
|
+
toJSON(): J | null;
|
|
855
|
+
}, J extends object>(add: ICellRanges.Address | T | null | undefined, options: (IAnchored.AddOptions & J) | undefined, spec: {
|
|
856
|
+
/** The sheet-state slot the collection lives in. */
|
|
857
|
+
key: 'conditionalFormats' | 'dataValidations' | 'protectedRanges';
|
|
858
|
+
isItem: (add: unknown) => add is T;
|
|
859
|
+
description: string;
|
|
860
|
+
/** Loads one ref into the map, handing the created model to `capture`. */
|
|
861
|
+
load: (map: IAnchoredMap<T, J>, ref: IRange.JSONReference<J>, capture: (model: T) => void) => IAnchoredMap<T, J>;
|
|
862
|
+
/**
|
|
863
|
+
* Whether the item at `index` — already known to cover exactly the same ranges — is the one
|
|
864
|
+
* `json` redefines: the per-collection half of `replaceExisting`. Omit to match on ranges alone.
|
|
865
|
+
*/
|
|
866
|
+
isSameItem?: (existing: T, json: J) => boolean;
|
|
867
|
+
/** Redefines `existing` from `json`, inside the add's commit. */
|
|
868
|
+
replace: (existing: T, json: J, options: ITransaction.OperationOptions) => void;
|
|
869
|
+
/** A last look at the JSON before it is inserted (a protected range mints its name here). */
|
|
870
|
+
prepareInsert?: (json: J) => J;
|
|
871
|
+
notify: () => void;
|
|
872
|
+
/** Widen the item's columns after an insert — a validation or format may show a dropdown. */
|
|
873
|
+
autoFit?: boolean;
|
|
874
|
+
}): T;
|
|
844
875
|
/**
|
|
845
876
|
* @internal
|
|
846
877
|
*/
|
|
847
878
|
protected _addDataValidation(add: ICellRanges.Address | IDataValidation, options?: IDataValidationCollection.AddOptions): IDataValidation;
|
|
848
879
|
/**
|
|
849
|
-
|
|
850
|
-
|
|
880
|
+
* @internal
|
|
881
|
+
*/
|
|
851
882
|
protected _addConditionalFormat(add: ICellRanges.Address | IConditionalFormat, options?: IConditionalFormatCollection.AddOptions): IConditionalFormat;
|
|
852
883
|
/**
|
|
853
884
|
* The first unused `Range<n>` name, matching Excel's default for a new Allow-Edit-Range.
|
|
@@ -292,6 +292,8 @@ export declare class SheetCell implements ICell {
|
|
|
292
292
|
getHyperlink(): IHyperlink | null;
|
|
293
293
|
/** {@inheritDoc ICell.getErrors} */
|
|
294
294
|
getErrors(): readonly string[];
|
|
295
|
+
/** {@inheritDoc ICell.getCircularReference} */
|
|
296
|
+
getCircularReference(): ICalculation.ICircularReference | null;
|
|
295
297
|
/** {@inheritDoc ICell.getWarnings} */
|
|
296
298
|
getWarnings(): readonly string[];
|
|
297
299
|
/** {@inheritDoc ICell.getSpans} */
|
|
@@ -7,7 +7,7 @@ import { IStyle } from '../style';
|
|
|
7
7
|
import { ICellRange } from '../cellRange';
|
|
8
8
|
import { OverlappingRange, ISparseGrid, ISpatialMap } from '../collections';
|
|
9
9
|
import { MergeEntry } from './spatial';
|
|
10
|
-
import { SpillEntry, ContentfulSpatialValue } from '../calculation/spatial';
|
|
10
|
+
import { SpillEntry, ContentfulSpatialValue, CircularEntry } from '../calculation/spatial';
|
|
11
11
|
import { IConditionalFormat } from '../conditionalFormat';
|
|
12
12
|
import { IDataValidation } from '../dataValidation';
|
|
13
13
|
import { IProtectedRange } from '../protectedRange';
|
|
@@ -220,6 +220,10 @@ export declare namespace RangeState {
|
|
|
220
220
|
* Errors during calculation.
|
|
221
221
|
*/
|
|
222
222
|
calcError?: string;
|
|
223
|
+
/**
|
|
224
|
+
* In a reference cycle, or downstream of one.
|
|
225
|
+
*/
|
|
226
|
+
circular?: CircularEntry;
|
|
223
227
|
/**
|
|
224
228
|
* An error VALUE lives here (the `Error` scalar kind — from the reconciled error spatial).
|
|
225
229
|
*/
|
|
@@ -263,6 +267,10 @@ export declare namespace RangeState {
|
|
|
263
267
|
readonly Spills: "spills";
|
|
264
268
|
readonly Pending: "pending";
|
|
265
269
|
readonly CalcError: "calcError";
|
|
270
|
+
/**
|
|
271
|
+
* In a reference cycle, or downstream of one — evaluates to `0` (DESIGN-CIRCULAR-CALC.md §7).
|
|
272
|
+
*/
|
|
273
|
+
readonly Circular: "circular";
|
|
266
274
|
/**
|
|
267
275
|
* Error VALUES (the `Error` scalar kind). Backed by the RECONCILED view
|
|
268
276
|
* (`SheetReadContext.getErrorSpatial`), not `state.errorSpatial` directly — resolving it may
|
|
@@ -383,6 +391,11 @@ export interface State {
|
|
|
383
391
|
spillSpatial: ISpatialMap<SpillEntry>;
|
|
384
392
|
pendingSpatial: ISpatialMap<boolean>;
|
|
385
393
|
calcErrorsSpatial: ISpatialMap<string>;
|
|
394
|
+
/**
|
|
395
|
+
* Cells in a reference cycle or downstream of one, by cycle (DESIGN-CIRCULAR-CALC.md §7.2).
|
|
396
|
+
* Maintained by calc realize from the executor's deltas, like {@link pendingSpatial}.
|
|
397
|
+
*/
|
|
398
|
+
circularSpatial: ISpatialMap<CircularEntry>;
|
|
386
399
|
/**
|
|
387
400
|
* Error VALUES (`#DIV/0!`, `#N/A`, …) — the `Error` scalar kind, NOT engine failures
|
|
388
401
|
* (those are {@link calcErrorsSpatial} / `CalcError`). Deliberately not per-type: `true`
|
|
@@ -479,6 +479,11 @@ export declare namespace IStyle {
|
|
|
479
479
|
readonly Quarters5: "5Quarters";
|
|
480
480
|
readonly Rating5: "5Rating";
|
|
481
481
|
readonly Boxes5: "5Boxes";
|
|
482
|
+
/**
|
|
483
|
+
* Not a set to apply — the x14 name Excel writes for a band whose custom icon is
|
|
484
|
+
* "No Cell Icon" (`iconSet="NoIcons" iconId="0"`). It holds zero icons.
|
|
485
|
+
*/
|
|
486
|
+
readonly NoIcons: "NoIcons";
|
|
482
487
|
};
|
|
483
488
|
type IconSet = typeof IconSet[keyof typeof IconSet];
|
|
484
489
|
}
|
|
@@ -217,11 +217,27 @@ export declare class AnchoredTable extends AbstractAnchored<State, CommitView, I
|
|
|
217
217
|
* 2. create or reused new Ids
|
|
218
218
|
*
|
|
219
219
|
* @remarks
|
|
220
|
-
*
|
|
220
|
+
* Each entry is cloned before its `index`/`id` are settled. Callers routinely build
|
|
221
|
+
* `columnPropsNews` out of the committed `orderedColumnsProps` (a slice, a spread, a splice),
|
|
222
|
+
* which shares the prop objects with the state undo restores - writing through them would
|
|
223
|
+
* rewrite history in place.
|
|
221
224
|
*
|
|
222
225
|
* @internal
|
|
223
226
|
*/
|
|
224
227
|
protected _updateColumnsState(columnPropsNews: Partial<ColumnPropertiesState>[], options?: string | ITransaction.OperationOptions): ITable.IColumn[];
|
|
228
|
+
/**
|
|
229
|
+
* Re-derives the active filter and sort levels from the column props.
|
|
230
|
+
*
|
|
231
|
+
* @remarks
|
|
232
|
+
* A level is bound to a column id, but the column props are where a filter or sort actually
|
|
233
|
+
* lives. Rebuilding the columns (a delete, a sheet sync) can therefore take a column out from
|
|
234
|
+
* under its level, and a level that outlives its column reads back as unfiltered while its rows
|
|
235
|
+
* stay hidden. Deriving the levels from the props instead of carrying them alongside keeps the
|
|
236
|
+
* two from drifting, and closes the gap in `level` left by whatever was dropped.
|
|
237
|
+
*
|
|
238
|
+
* @internal
|
|
239
|
+
*/
|
|
240
|
+
private _rebuildActiveLevels;
|
|
225
241
|
/** {@inheritDoc ITable.getVisibleRefRangeCoords} */
|
|
226
242
|
getVisibleRefRangeCoords(): IRange.Coords;
|
|
227
243
|
/** {@inheritDoc ITable.getVisibleCellCoords} */
|
|
@@ -157,6 +157,24 @@ export declare function isValidHttpUrl(value: string): boolean;
|
|
|
157
157
|
* @returns `true` if the string is a valid email, `false` otherwise.
|
|
158
158
|
*/
|
|
159
159
|
export declare function isValidEmail(text: string): boolean;
|
|
160
|
+
/**
|
|
161
|
+
* The hyperlink address for text that Excel's AutoCorrect would turn into a link, or `null`
|
|
162
|
+
* when the text is not link-shaped.
|
|
163
|
+
*
|
|
164
|
+
* @param text The text to check.
|
|
165
|
+
* @returns The address, with the scheme Excel supplies when the text omits one, or `null`.
|
|
166
|
+
*
|
|
167
|
+
* @remarks
|
|
168
|
+
* Mirrors Excel's "Internet and network paths with hyperlinks" rule, which links:
|
|
169
|
+
*
|
|
170
|
+
* * `http(s)://…` - as is.
|
|
171
|
+
* * `www.…` - as `http://www.…`.
|
|
172
|
+
* * `mailto:…` - as is.
|
|
173
|
+
* * an email address - as `mailto:…`.
|
|
174
|
+
*
|
|
175
|
+
* A bare domain (`sheetxl.com`) is left alone, as Excel leaves it.
|
|
176
|
+
*/
|
|
177
|
+
export declare function toHyperlinkAddress(text: string): string | null;
|
|
160
178
|
/**
|
|
161
179
|
* Converts a number to alphabet.
|
|
162
180
|
* @param i The number to stringify
|