@sheetxl/sdk 0.8.0-beta.17 → 0.8.0-beta.18
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/{CAjITJT3eLst9Rhi.mjs → -P0fym6eh9hn9row.mjs} +2 -2
- package/browser/esm/{CFywn1iiD35nNNUP.mjs → -nOfWMHdlTb9ShjF.mjs} +9 -9
- package/browser/esm/{Byp_bvP9G-tN6hcz.mjs → 0Mw5Ew_7tAiWgc5J.mjs} +14 -14
- package/browser/esm/{CHByUyHFA3ESf7DX.mjs → 1ktaHvjuYL6stU4C.mjs} +1 -1
- package/browser/esm/{CVV4xqwD8gIjYj1E.mjs → B3ifnlsuky2L9HmB.mjs} +33 -33
- package/browser/esm/{WR3-xqcK1gF3ewAR.mjs → B67q5ZrwyKvm3d6W.mjs} +3 -3
- package/browser/esm/{DTXsi--x2wgqgwtf.mjs → BQSd_URWugiyNoNj.mjs} +2 -2
- package/browser/esm/{C0o6WpBojS7XhV5m.mjs → BWHHWC6H2JgG11Kq.mjs} +2 -2
- package/browser/esm/{BlkstmZEklk6Y1QD.mjs → BYbb2weYQCb_7KI3.mjs} +21 -21
- package/browser/esm/{DJTEQZiR9IFTuN_4.mjs → B_hrmyuWaH5VIFpV.mjs} +2 -2
- package/browser/esm/{O970I8lbI7okqG7N.mjs → Bql31KGUYo0SCMwZ.mjs} +392 -392
- package/browser/esm/{YwDdO4YwcIE4OB0D.mjs → BtVpErObXYKJCwHG.mjs} +1 -1
- package/browser/esm/{B-Q1-7RgSnA75J32.mjs → By7_c19Kv2YQaDVF.mjs} +475 -475
- package/browser/esm/{taTjDyUIIxq2eClH.mjs → C6M_XM08QtHuaInQ.mjs} +3 -3
- package/browser/esm/{DDNerAeet8uDYKhf.mjs → CBHwju4PYiv85_jD.mjs} +2 -2
- package/browser/esm/{Dx_dZ7jrw5Hxeoot.mjs → CJhYhZtsey3OnWKd.mjs} +1 -1
- package/browser/esm/{DnMFW_oKYQxRjP1l.mjs → CQlxAbhdxgfu0ERF.mjs} +1 -1
- package/browser/esm/{CLT3qGy_brDIwbYd.mjs → CVXOtvee4oFImGyR.mjs} +504 -504
- package/browser/esm/{Dlk1kRgkiBIpUxd9.mjs → CXQLYHAhE5MLKxZ4.mjs} +37 -37
- package/browser/esm/{jotvQFBWO2jXAhWx.mjs → CZiJYw94Yt7xslXS.mjs} +1 -1
- package/browser/esm/{aYpwVCDSwMUuz147.mjs → ChRUNekYurtOtrP1.mjs} +113 -113
- package/browser/esm/{JmmPE8Vsj85wdV8H.mjs → CnobgPLHEsTPTFY5.mjs} +1 -1
- package/browser/esm/{DGUOlgm1_WFmf_xO.mjs → CxNnMvwtOf76r7yY.mjs} +1 -1
- package/browser/esm/{DW3kFc5t4Wnh5E9S.mjs → CzmmdfrOYDUGx-Yh.mjs} +1 -1
- package/browser/esm/{XHhDDWrJiZJgWxPM.mjs → D2P43UD6TGSXErhr.mjs} +2 -2
- package/browser/esm/{DrmOaEx6CQ91zBsP.mjs → DH8NuKmZAC9EaqwP.mjs} +18 -18
- package/browser/esm/{DUB6Oj_aiV3f8s5_.mjs → DJuiV0Y8olnwuqB-.mjs} +21 -21
- package/browser/esm/{DkmqFp_-iUIy_l3D.mjs → DKFaQ2QOyUPCk0sD.mjs} +3 -3
- package/browser/esm/{BI6NwRrdLCbPdz6f.mjs → DLR8g1DkooIBl8S1.mjs} +2 -2
- package/browser/esm/{DsWDvmky7CgzX_7W.mjs → DNAXbbB8DGE2xeHy.mjs} +2 -2
- package/browser/esm/{BY_-BTa5h6HnnZ1W.mjs → DQTUUXcERWI4l0to.mjs} +2 -2
- package/browser/esm/{DJrnSjYjFxJvpQiH.mjs → DpFowFtk9AeU-89B.mjs} +1 -1
- package/browser/esm/{Dy0TAi9WafVT8eke.mjs → DyRVg5YJn7voOO6z.mjs} +2 -2
- package/browser/esm/{qNv1x-Ny9TPbvZzj.mjs → Pn5Jc-47dk16sYQ4.mjs} +1 -1
- package/browser/esm/{CWkaF7gYWCkW7vDA.mjs → _WWjW2f-YW-AVqAL.mjs} +1 -1
- package/browser/esm/{gQzj95vSMXdKhpWf.mjs → _lh_Rr5SwLthmbmu.mjs} +7797 -5857
- package/browser/esm/index.mjs +367 -366
- package/browser/esm/{yudASWe8CWXYcGt3.mjs → mecFApGwMvcIzlpd.mjs} +36 -36
- package/browser/esm/{mufbL88lyIKJEWyP.mjs → n4LOSiYtWTzqQa4w.mjs} +661 -661
- package/{node/esm/Cle-_21jebWv_-D4.mjs → browser/esm/tJB0V8fKbukOYt9U.mjs} +2 -2
- package/browser/esm/{BWNQcQyx8wt6huOq.mjs → yRhetuEQfV7moa4B.mjs} +1 -1
- package/browser/esm/{BuKA3E-Ev8Dp5W2I.mjs → ybFoQ6IijUJnBeCF.mjs} +1 -1
- package/node/esm/{Yo7_havHbr9VL8R4.mjs → 0313aQKBU4DE3v2j.mjs} +1 -1
- package/node/esm/{DfrxGbxxowFmm3SF.mjs → 3gjEEXV2aSt7cKeD.mjs} +1 -1
- package/node/esm/{NnrDjio_xwTBs05n.mjs → 3smtwEJ0ASF0tKBY.mjs} +2 -2
- package/node/esm/{cRz94rkuvDrA8mr9.mjs → 4k3KKByrUw2Wr2TX.mjs} +1 -1
- package/node/esm/{jqBKdf9DG54xqpaw.mjs → 90jp-mCVEr43zZTj.mjs} +2 -2
- package/node/esm/{OCrS6pBT6lGRu82d.mjs → BAEmzj0gb8Cbgz7p.mjs} +3293 -3293
- package/node/esm/{CIxb44vA81H9lRip.mjs → BBC5dL9bXzOrQDGY.mjs} +1 -1
- package/node/esm/{7ZwdVIsOdcziHpMD.mjs → BV0cJ_YP_0qzJuPt.mjs} +180 -180
- package/node/esm/{DxnBYzOueAKEqaQT.mjs → BcxcYoF_4GFL7Zkl.mjs} +15 -15
- package/node/esm/{BwyoLlHutolJw7OW.mjs → BesaVk0x7UyfLDk2.mjs} +1 -1
- package/node/esm/{ClJJC8tBpgsqHwdn.mjs → C-LmDC9oNcbENOK1.mjs} +1 -1
- package/node/esm/{BSlFO0_8UZ38gfeE.mjs → CDkUQn5AwYGomlsT.mjs} +36 -36
- package/node/esm/{CjCqcGyCYGkaMQI9.mjs → CE4I5qfVmUBf7mED.mjs} +1 -1
- package/node/esm/{DgsBYF3xbjgx9Mzp.mjs → CO0UDgbkHGwyTfev.mjs} +1 -1
- package/node/esm/{DfbVTAhNutxM74E8.mjs → CTWihjVB5uFX7U4j.mjs} +2 -2
- package/node/esm/{-q1xF3_2jmk3QHIY.mjs → CUNaLYCntlclipWu.mjs} +497 -497
- package/node/esm/{BhosJbKOPgbJSZMY.mjs → CY9JqXFJTt5pGhC3.mjs} +1 -1
- package/node/esm/{B6BQYUDRxbRnzca4.mjs → C_Sqy290v4uzyi1E.mjs} +3 -3
- package/node/esm/{BoLecFnIxhYKGor-.mjs → Cf-cK3yPe9bjK6o2.mjs} +561 -561
- package/node/esm/{Cb1-r2RCxcJZB6fM.mjs → CpvUwhAeDmdEpdR-.mjs} +10018 -8039
- package/{browser/esm/DCs7bk-yx0UhCvQ4.mjs → node/esm/Crhg3srH-O5sJERh.mjs} +2 -2
- package/node/esm/{M3jahkTgfUxGyeZv.mjs → Cx2U91jhiTDz600y.mjs} +116 -116
- package/node/esm/{BQko-9y6mf2oQK7u.mjs → CyWWKan_uk4dHZ6P.mjs} +1 -1
- package/node/esm/{Bgy7uWJVGwkN7AlD.mjs → D48MjKzkj37XsVm1.mjs} +2 -2
- package/node/esm/{XhDjStxKy-dd3WKa.mjs → D7c0zfLVoG7EEln5.mjs} +43 -43
- package/node/esm/{CIlH2fSEpdYBZwUA.mjs → D8J4JmOPwG_Yr2GD.mjs} +1 -1
- package/node/esm/{oGGVbqahqfK45-Uz.mjs → D91qb21TrJX98Rw8.mjs} +3 -3
- package/node/esm/{btVWSwUwMjM0J5fS.mjs → D9D2NyyKbWXpTj5I.mjs} +2 -2
- package/node/esm/{DCSJKgcCQzOV-dMJ.mjs → DBF7pIpitcmhi65H.mjs} +2 -2
- package/node/esm/{CDgUHRW6vSASfqNr.mjs → DLPVrV723TSxkXqL.mjs} +1 -1
- package/node/esm/{DTkV7IK2_ODMJAP5.mjs → DWsnb-a-9dfRn5jJ.mjs} +24 -24
- package/node/esm/{DCaLNIs-_4Y6hJ8S.mjs → Dj1pybJRqeZiP1Z6.mjs} +1 -1
- package/node/esm/{BBUVvO9Ma1RzbKux.mjs → DtNJOImWtsXVrQps.mjs} +2 -2
- package/node/esm/{zh6vcRzFqdV1aYh5.mjs → DxROQlX1KHLb9tHS.mjs} +1 -1
- package/node/esm/{B8MYgBe4XICBSROW.mjs → dp4LxzOEkfTbVX_1.mjs} +21 -21
- package/node/esm/{CHS84ZGEoH6aeHsZ.mjs → ee_DgHTffiVTOiU2.mjs} +21 -21
- package/node/esm/{fwfAgq8qIADcHmY4.mjs → fMFapG4AGMQKX8c5.mjs} +33 -33
- package/node/esm/index.mjs +545 -544
- package/node/esm/{nxxwAZZF8NsdErJW.mjs → jmElgIMAkpc2Ab1m.mjs} +1 -1
- package/node/esm/{D51xu0rubo34Ppeg.mjs → yVJ2lEYZob1gwiRZ.mjs} +14 -14
- package/package.json +6 -6
- package/resources/locales/de/model.msg.json +15 -0
- package/resources/locales/en/model.msg.json +15 -0
- package/types/scripting-api.json +11445 -11299
- package/types/scripting-enums.json +22 -1
- package/types/scripting.d.ts +623 -0
- package/types/src/address/index.d.ts +2 -0
- package/types/src/anomalies/_Anomalies.d.ts +34 -0
- package/types/src/anomalies/_CompletenessChecks.d.ts +32 -0
- package/types/src/cell/ICell.d.ts +36 -1
- package/types/src/cellRange/ICellRange.d.ts +106 -0
- package/types/src/index.d.ts +1 -0
- package/types/src/license/runtime.browser.d.ts +3 -1
- package/types/src/sheet/IWorksheet.d.ts +17 -0
- package/types/src/sheet/SheetCell.d.ts +3 -0
- package/types/src/sheet/SheetRange.d.ts +6 -0
- package/types/src/sheet/Worksheet.d.ts +103 -1
- package/types/src/sheet/_ListenerAnchor.d.ts +14 -0
- package/types/src/sheet/_SheetStateTypes.d.ts +13 -0
- package/types/src/sparkline/ISparklineGroup.d.ts +338 -0
- package/types/src/sparkline/ISparklineGroupCollection.d.ts +68 -0
- package/types/src/sparkline/SparklineGroup.d.ts +271 -0
- package/types/src/sparkline/SparklineGroupCollection.d.ts +25 -0
- package/types/src/sparkline/SparklineRanges.d.ts +195 -0
- package/types/src/sparkline/index.d.ts +4 -0
- package/types/src/sparkline/layout/SparklineLayout.d.ts +71 -0
- package/types/src/sparkline/layout/_layoutSparkline.d.ts +42 -0
- package/types/src/sparkline/layout/index.d.ts +2 -0
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import { IRange, Scalar } from '@sheetxl/primitives';
|
|
2
|
+
import { IListener } from '../listener';
|
|
3
|
+
import { ITransaction } from '../transaction';
|
|
4
|
+
import { ICellRange, ICellRanges } from '../cellRange';
|
|
5
|
+
import { IWorksheet } from '../sheet';
|
|
6
|
+
import { IStyleCollection } from '../style';
|
|
7
|
+
import { IColor } from '../color';
|
|
8
|
+
import { Anchored } from '../anchored/Anchored';
|
|
9
|
+
import { AbstractAnchored } from '../anchored/AbstractAnchored';
|
|
10
|
+
import { ISparklineGroup } from './ISparklineGroup';
|
|
11
|
+
import * as SparklineRanges from './SparklineRanges';
|
|
12
|
+
type SparklineRange = SparklineRanges.SparklineRange;
|
|
13
|
+
/**
|
|
14
|
+
* Implementation of {@link ISparklineGroup}.
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* The map anchors the group to its ranges' cells; the group keeps each range's location itself
|
|
18
|
+
* too, paired by position with the map's ranges, and the data each cell of it reads as an offset
|
|
19
|
+
* from that cell (`SparklineRanges`). A structural edit on the group's sheet, a cut of the data
|
|
20
|
+
* and a paste or fill rewrite the ranges here, a block at a time. Data on another sheet is
|
|
21
|
+
* listened to there (one range listener per sheet, over the cells the group reads on it, asking
|
|
22
|
+
* for the edits), which tells the group of each edit that reaches those cells.
|
|
23
|
+
*/
|
|
24
|
+
export declare class SparklineGroup extends AbstractAnchored<State, ISparklineGroup.Events> implements ISparklineGroup {
|
|
25
|
+
/** Per-entry moves of the shift in progress, read once the map makes its one write. */
|
|
26
|
+
private _pendingMoves;
|
|
27
|
+
/** The ranges once the structural edit in progress has gone through; `null` when it reaches none. */
|
|
28
|
+
private _plannedShift;
|
|
29
|
+
/** One listener per other sheet the data is on, over the cells the group reads there. */
|
|
30
|
+
private _dataListeners;
|
|
31
|
+
/** A sheet the data names that was not loaded yet when the group was made is looked for once more. */
|
|
32
|
+
private _lookedAgain;
|
|
33
|
+
constructor(options: SparklineGroup.ConstructorOptions);
|
|
34
|
+
/** @internal */
|
|
35
|
+
protected _initialize(options: SparklineGroup.ConstructorOptions): void;
|
|
36
|
+
/** Each of `coords` paired by position with the data its first cell reads, as the JSON states them. */
|
|
37
|
+
private _parseRanges;
|
|
38
|
+
/**
|
|
39
|
+
* Gives the group new ranges, each of `coords` reading `data` (its first cell's, paired by
|
|
40
|
+
* position as the JSON states them). The cells must not be another group's.
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
43
|
+
_restate(coords: readonly IRange.Coords[], data: readonly string[]): void;
|
|
44
|
+
/** @internal */
|
|
45
|
+
protected _getActionDescription(action: 'delete' | 'initialize' | 'updateListener'): string | null;
|
|
46
|
+
/**
|
|
47
|
+
* Always: a sparkline is the cell's, as a cell control is.
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
|
+
protected _isAnchorAbsolute(): boolean;
|
|
51
|
+
private get _sparklineRanges();
|
|
52
|
+
private get _properties();
|
|
53
|
+
/** Puts `ranges` in the state, the map's ranges with them when they are not already. */
|
|
54
|
+
private _setRanges;
|
|
55
|
+
/** The worksheet a range's data names, when it is another sheet that is there. */
|
|
56
|
+
private _worksheetOf;
|
|
57
|
+
/** Listens to each other sheet the data is on, over the cells read there; lets go of the rest. */
|
|
58
|
+
private _syncDataListeners;
|
|
59
|
+
private _releaseDataListeners;
|
|
60
|
+
/** Each edit on `sheet` that reached the data read there, a sparkline at a time. */
|
|
61
|
+
private _onDataEdits;
|
|
62
|
+
/** How many listeners want `onLayoutChange`. */
|
|
63
|
+
private _layoutListeners;
|
|
64
|
+
/** What the layouts depend on, listened to only while something listens for `onLayoutChange`. */
|
|
65
|
+
private _layoutSources;
|
|
66
|
+
/** The cells the group reads, per sheet (its own included), listened to for their values. */
|
|
67
|
+
private _layoutCells;
|
|
68
|
+
/** The sheets those cells are on, listened to for their hidden rows and columns. */
|
|
69
|
+
private _layoutSheets;
|
|
70
|
+
/** An `onLayoutChange` is queued: one per commit, however many cells it reached. */
|
|
71
|
+
private _layoutQueued;
|
|
72
|
+
/**
|
|
73
|
+
* The extent of the group's values, for a `'group'` axis; `undefined` until read. Kept only while
|
|
74
|
+
* the layout is watched: nothing else says when it is stale.
|
|
75
|
+
*/
|
|
76
|
+
private _extent;
|
|
77
|
+
/**
|
|
78
|
+
* Listens to the group, its theme, and the cells and sheets it reads while `onLayoutChange` has
|
|
79
|
+
* listeners.
|
|
80
|
+
*/
|
|
81
|
+
private _watchLayout;
|
|
82
|
+
private _releaseLayoutSources;
|
|
83
|
+
/**
|
|
84
|
+
* What a layout reads may now read differently. The extent is dropped at once; listeners are
|
|
85
|
+
* told once the commit has landed every cell.
|
|
86
|
+
*/
|
|
87
|
+
private _layoutChanged;
|
|
88
|
+
/**
|
|
89
|
+
* Listens to the cells the group reads on each sheet (a block per sheet: the union of its ranges'
|
|
90
|
+
* data there, and the date range), and to each such sheet's hidden rows and columns.
|
|
91
|
+
*/
|
|
92
|
+
private _syncLayoutCells;
|
|
93
|
+
/** @internal */
|
|
94
|
+
protected _processDelete(): void;
|
|
95
|
+
/** @internal */
|
|
96
|
+
protected _processAfterStateChange(state: State, commit: ITransaction.ICommit, isRevert?: boolean, isRestore?: boolean): void;
|
|
97
|
+
/** @internal */
|
|
98
|
+
protected _isAnyChangeFromState(): boolean;
|
|
99
|
+
/** @internal */
|
|
100
|
+
protected _processRestoreOrRevert(state: State, commit: ITransaction.ICommit): void;
|
|
101
|
+
/** @internal */
|
|
102
|
+
protected _processClose(): void;
|
|
103
|
+
/** @internal */
|
|
104
|
+
protected _processContainerShift(options: Anchored.ShiftOptions): IRange.Coords | null | void;
|
|
105
|
+
/** @internal */
|
|
106
|
+
protected _processAfterContainerShift(before: IRange.Coords[] | null, after: IRange.Coords[] | null): void;
|
|
107
|
+
/**
|
|
108
|
+
* The group's sparklines within `coords` as ranges: each the part of one range there, reading as
|
|
109
|
+
* it does. A copy, a cut and a fill carry these.
|
|
110
|
+
* @internal
|
|
111
|
+
*/
|
|
112
|
+
_rangesWithin(coords: IRange.Coords): SparklineRange[];
|
|
113
|
+
/**
|
|
114
|
+
* Adds `ranges` to the group, each joined to a range it continues (a fill down a range's column
|
|
115
|
+
* extends that range). The cells must not be the group's already.
|
|
116
|
+
* @internal
|
|
117
|
+
*/
|
|
118
|
+
_addRanges(ranges: readonly SparklineRange[]): void;
|
|
119
|
+
/** The group's ranges as they are now, for a cut to put its own back in order. @internal */
|
|
120
|
+
_rangesNow(): readonly SparklineRange[];
|
|
121
|
+
/**
|
|
122
|
+
* Puts back the ranges a cut on the group's sheet moved `rows` down and `cols` across, each where
|
|
123
|
+
* its cells stood in `order` (the group's ranges when the cut was marked), as Excel keeps a cut
|
|
124
|
+
* sparkline's place in its group.
|
|
125
|
+
* @internal
|
|
126
|
+
*/
|
|
127
|
+
_putBackCut(ranges: readonly SparklineRange[], order: readonly SparklineRange[], rows: number, cols: number): void;
|
|
128
|
+
/**
|
|
129
|
+
* Takes the ranges through a structural edit on the group's sheet, before the map applies it;
|
|
130
|
+
* {@link _settleShift} puts them in place once it has.
|
|
131
|
+
* @internal
|
|
132
|
+
*/
|
|
133
|
+
_planShift(edits: readonly SparklineRanges.Edit[]): void;
|
|
134
|
+
/**
|
|
135
|
+
* The ranges {@link _planShift} planned, in place of the map's own shift of them.
|
|
136
|
+
*
|
|
137
|
+
* @returns The group's ranges when the edit reached it, for the map to take; `null` otherwise.
|
|
138
|
+
* @internal
|
|
139
|
+
*/
|
|
140
|
+
_settleShift(): IRange.Coords[] | null;
|
|
141
|
+
/** `sheet` as a range's data names it: `null` for the group's own sheet. */
|
|
142
|
+
private _dataSheetOf;
|
|
143
|
+
/**
|
|
144
|
+
* After a cut on the group's sheet that left the group's cells where they are: each cell whose
|
|
145
|
+
* data the cut enclosed reads it where it went, on `toSheet` when it went to another sheet.
|
|
146
|
+
* @internal
|
|
147
|
+
*/
|
|
148
|
+
_moveData(from: IRange.Coords, to: IRange.Coords, toSheet?: IWorksheet): void;
|
|
149
|
+
/** {@inheritDoc ISparklineGroup.getType} */
|
|
150
|
+
getType(): ISparklineGroup.Type;
|
|
151
|
+
/** {@inheritDoc ISparklineGroup.getProperties} */
|
|
152
|
+
getProperties(): Readonly<ISparklineGroup.Properties>;
|
|
153
|
+
/** {@inheritDoc ISparklineGroup.update} */
|
|
154
|
+
update(properties: ISparklineGroup.Modifiers, options?: ITransaction.OperationOptions): this;
|
|
155
|
+
/** {@inheritDoc ISparklineGroup.getDataRange} */
|
|
156
|
+
getDataRange(): ICellRange;
|
|
157
|
+
/** {@inheritDoc ISparklineGroup.getDataRanges} */
|
|
158
|
+
getDataRanges(): readonly ICellRange[];
|
|
159
|
+
/** Every cell `range`'s sparklines read: the union of their data, as one block. */
|
|
160
|
+
private _dataRangeOf;
|
|
161
|
+
/** {@inheritDoc ISparklineGroup.setDataRanges} */
|
|
162
|
+
setDataRanges(data: ICellRanges.Address, options?: ITransaction.OperationOptions): this;
|
|
163
|
+
/** {@inheritDoc ISparklineGroup.setRanges} */
|
|
164
|
+
setRanges(address: ICellRanges.Address, data?: ICellRanges.Address | null, options?: ITransaction.OperationOptions): this;
|
|
165
|
+
private _modify;
|
|
166
|
+
/** {@inheritDoc ISparklineGroup.getSparklines} */
|
|
167
|
+
getSparklines(): readonly ISparklineGroup.ISparkline[];
|
|
168
|
+
/** {@inheritDoc ISparklineGroup.getSparklineAt} */
|
|
169
|
+
getSparklineAt(index: number): ISparklineGroup.ISparkline | null;
|
|
170
|
+
/** {@inheritDoc ISparklineGroup.getSparkline} */
|
|
171
|
+
getSparkline(cell: ICellRange.Address): ISparklineGroup.ISparkline | null;
|
|
172
|
+
private _sparklineOf;
|
|
173
|
+
/** The cells of `coords` on the sheet `range`'s data is on; `null` when that sheet is gone. */
|
|
174
|
+
private _dataCells;
|
|
175
|
+
/** An address the group states (its `dateRange`): bare on its own sheet. */
|
|
176
|
+
private _resolve;
|
|
177
|
+
/**
|
|
178
|
+
* The extent of every value the group draws, for an axis whose type is `'group'`: one read of each
|
|
179
|
+
* range's data block, never one per sparkline. A range's block is exactly the cells its
|
|
180
|
+
* sparklines read, since each reads the same shape moved a cell at a time.
|
|
181
|
+
*/
|
|
182
|
+
private _groupExtent;
|
|
183
|
+
/** The group's extent: kept while the layout is watched, read afresh otherwise. */
|
|
184
|
+
private _watchedExtent;
|
|
185
|
+
private _layoutOf;
|
|
186
|
+
/** {@inheritDoc IListener.ISource.addListeners} */
|
|
187
|
+
addListeners(listeners: ISparklineGroup.IListeners, options?: IListener.Options): IListener.Remove;
|
|
188
|
+
/** {@inheritDoc ISparklineGroup.toJSON} */
|
|
189
|
+
toJSON(): ISparklineGroup.JSON;
|
|
190
|
+
get [Symbol.toStringTag](): string;
|
|
191
|
+
toString(): string;
|
|
192
|
+
/** {@inheritDoc ISparklineGroup.isISparklineGroup} */
|
|
193
|
+
get isISparklineGroup(): true;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Interfaces for creating a {@link SparklineGroup}.
|
|
197
|
+
*/
|
|
198
|
+
export declare namespace SparklineGroup {
|
|
199
|
+
interface ConstructorOptions extends Anchored.ConstructorOptions<ISparklineGroup.JSON> {
|
|
200
|
+
/** The group's sheet's name: data naming it is the group's own, and saved bare. */
|
|
201
|
+
getSheetName?: () => string;
|
|
202
|
+
/** The sheet a data area's prefix names, for data on another sheet. */
|
|
203
|
+
resolveSheet?: (name: string) => IWorksheet | null;
|
|
204
|
+
/** Resolves a data area against the workbook, for data on another sheet. */
|
|
205
|
+
resolveRange?: (address: string) => ICellRange | null;
|
|
206
|
+
/** The workbook's styles, whose theme the group's colors resolve against. */
|
|
207
|
+
getStyles?: () => IStyleCollection | null;
|
|
208
|
+
/**
|
|
209
|
+
* The sheet's write behind {@link ISparklineGroup.setRanges}: it pairs the cells with the
|
|
210
|
+
* data and takes them out of the sheet's other groups.
|
|
211
|
+
*/
|
|
212
|
+
modify?: (group: SparklineGroup, location: ICellRanges.Address | null, data: ICellRanges.Address | null, options?: ITransaction.OperationOptions) => void;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* The values in `cells`, row by row, as a sparkline draws them: hidden rows and columns left out
|
|
216
|
+
* unless the group shows them; each cell as a chart plots it ({@link plotValue}).
|
|
217
|
+
*/
|
|
218
|
+
function readValues(cells: ICellRange, properties: Readonly<ISparklineGroup.Properties>): (number | null)[];
|
|
219
|
+
/**
|
|
220
|
+
* A cell as a point, as a chart plots it (measured for charts, 2026-10-16): a blank and `#N/A` are
|
|
221
|
+
* empty cells, drawn by the group's empty-cell rule; `TRUE` is 1; text and any other error are 0.
|
|
222
|
+
* Text as 0 is measured for sparklines too (a group over `a, 1` draws a line up from 0, whatever
|
|
223
|
+
* the empty-cell rule, Michael 2026-11-07).
|
|
224
|
+
*/
|
|
225
|
+
function plotValue(cell: Scalar): number | null;
|
|
226
|
+
/**
|
|
227
|
+
* What Excel's `SparklineGroups.Add` writes for a new group (measured, DESIGN-SPARKLINES §1):
|
|
228
|
+
* empty cells as gaps, its eight colors, and negative points colored for win/loss.
|
|
229
|
+
*/
|
|
230
|
+
function freshProperties(type?: ISparklineGroup.Type): Readonly<ISparklineGroup.Properties>;
|
|
231
|
+
/**
|
|
232
|
+
* `properties` with `modifiers` applied: a property named is set, `null` removes it (back to its
|
|
233
|
+
* default), a color is kept as its string. Refuses a value the property cannot take.
|
|
234
|
+
*/
|
|
235
|
+
function applyModifiers(properties: Readonly<ISparklineGroup.Properties>, modifiers: ISparklineGroup.Modifiers): Readonly<ISparklineGroup.Properties>;
|
|
236
|
+
/** A color as the group states it, resolved against the theme; an unreadable one is black. */
|
|
237
|
+
function toColor(color: string, styles: IStyleCollection | null): IColor;
|
|
238
|
+
/**
|
|
239
|
+
* A group's JSON as its frozen properties and the data of each range.
|
|
240
|
+
*
|
|
241
|
+
* @throws when `json` has no data.
|
|
242
|
+
*/
|
|
243
|
+
function splitJSON(json: ISparklineGroup.JSON | null | undefined): {
|
|
244
|
+
properties: Readonly<ISparklineGroup.Properties>;
|
|
245
|
+
data: readonly string[];
|
|
246
|
+
};
|
|
247
|
+
/** @internal */
|
|
248
|
+
function locationsOf(ranges: readonly SparklineRange[]): IRange.Coords[];
|
|
249
|
+
/**
|
|
250
|
+
* The ranges once the map has replaced the group's ranges with a part of themselves: each piece
|
|
251
|
+
* reads as the range it is a piece of. A range with no piece left is gone.
|
|
252
|
+
* @internal
|
|
253
|
+
*/
|
|
254
|
+
function followTrim(ranges: readonly SparklineRange[], after: readonly IRange.Coords[]): readonly SparklineRange[];
|
|
255
|
+
/**
|
|
256
|
+
* The ranges once a shift has moved their cells: each found by its location in `moves`. When the
|
|
257
|
+
* result does not account for every range, the ranges pair with `after` by position instead.
|
|
258
|
+
* @internal
|
|
259
|
+
*/
|
|
260
|
+
function followShift(ranges: readonly SparklineRange[], moves: readonly {
|
|
261
|
+
before: IRange.Coords;
|
|
262
|
+
after: IRange.Coords | null;
|
|
263
|
+
}[], after: readonly IRange.Coords[]): readonly SparklineRange[];
|
|
264
|
+
}
|
|
265
|
+
/** @internal */
|
|
266
|
+
interface State extends AbstractAnchored.State {
|
|
267
|
+
json: Readonly<ISparklineGroup.Properties>;
|
|
268
|
+
ranges: readonly SparklineRange[];
|
|
269
|
+
}
|
|
270
|
+
export {};
|
|
271
|
+
//# sourceMappingURL=SparklineGroup.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ICellRange, ICellRanges } from '../cellRange';
|
|
2
|
+
import { ICollection, AbstractCollection } from '../type';
|
|
3
|
+
import { IListener } from '../listener';
|
|
4
|
+
import { ITransaction } from '../transaction';
|
|
5
|
+
import { ISparklineGroupCollection } from './ISparklineGroupCollection';
|
|
6
|
+
import { ISparklineGroup } from './ISparklineGroup';
|
|
7
|
+
/**
|
|
8
|
+
* Implementation for {@link ISparklineGroupCollection}: a front over the sheet's own state, as
|
|
9
|
+
* the cell-control collection is.
|
|
10
|
+
*/
|
|
11
|
+
export declare class SparklineGroupCollection extends AbstractCollection<ISparklineGroup, ISparklineGroupCollection.GetItemsOptions> implements ISparklineGroupCollection {
|
|
12
|
+
private _add;
|
|
13
|
+
private _get;
|
|
14
|
+
private _addListeners;
|
|
15
|
+
constructor(add: (location: ICellRanges.Address, data: ICellRange.Address, properties?: ISparklineGroup.Modifiers, options?: ITransaction.OperationOptions) => ISparklineGroup, get: (address: ICellRanges.Address | null | undefined, ignoreHidden?: boolean, fullyContained?: boolean) => ISparklineGroup[], addListeners: (listeners: ICollection.IListeners, options?: IListener.Options) => IListener.Remove);
|
|
16
|
+
/** {@inheritDoc ISparklineGroupCollection.add} */
|
|
17
|
+
add(location: ICellRanges.Address, data: ICellRange.Address, properties?: ISparklineGroup.Modifiers, options?: ITransaction.OperationOptions): ISparklineGroup;
|
|
18
|
+
/** {@inheritDoc AbstractCollection._getItems} */
|
|
19
|
+
protected _getItems(options?: ISparklineGroupCollection.GetItemsOptions): ISparklineGroup[];
|
|
20
|
+
/** {@inheritDoc ICollection.addListeners} */
|
|
21
|
+
addListeners(listeners: ICollection.IListeners, options?: IListener.Options): IListener.Remove;
|
|
22
|
+
/** {@inheritDoc ISparklineGroupCollection.isISparklineGroupCollection} */
|
|
23
|
+
get isISparklineGroupCollection(): true;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=SparklineGroupCollection.d.ts.map
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { IRange } from '@sheetxl/primitives';
|
|
2
|
+
/**
|
|
3
|
+
* A group's ranges and the data each cell of them reads.
|
|
4
|
+
*
|
|
5
|
+
* A range is a block of sparkline cells - a column, a row or 2D - and its data is an offset from
|
|
6
|
+
* the cell: F2 reading `A2:E2` reads rows `+0..+0` and columns `-5..-1` of itself, and so does
|
|
7
|
+
* every other cell of its range. What a cell reads is its position plus the offset, so nothing
|
|
8
|
+
* absolute is kept per cell, and every operation here costs the number of ranges and edits, never
|
|
9
|
+
* the number of cells.
|
|
10
|
+
*/
|
|
11
|
+
/** The sheet a range's data is on, when it is not the group's own. */
|
|
12
|
+
export interface DataSheet {
|
|
13
|
+
getName(): string;
|
|
14
|
+
isDeleted?(): boolean;
|
|
15
|
+
}
|
|
16
|
+
/** Data each cell finds at its own position plus `offset`; `sheet` is `null` for the group's own sheet. */
|
|
17
|
+
export interface OffsetData {
|
|
18
|
+
offset: IRange.Coords;
|
|
19
|
+
sheet: DataSheet | null;
|
|
20
|
+
}
|
|
21
|
+
/** Data that is not a plain area (a name, `#REF!`): every cell reads `text`. */
|
|
22
|
+
export interface TextData {
|
|
23
|
+
text: string;
|
|
24
|
+
}
|
|
25
|
+
export type Data = OffsetData | TextData;
|
|
26
|
+
/** A block of sparkline cells and the data each of them reads. */
|
|
27
|
+
export interface SparklineRange {
|
|
28
|
+
location: IRange.Coords;
|
|
29
|
+
data: Data;
|
|
30
|
+
}
|
|
31
|
+
/** A plain area as text: the sheet prefix as written (`'Q1 Data'!`, or empty) and the area. */
|
|
32
|
+
export interface Area {
|
|
33
|
+
/** The text before the area, its `!` included; empty when the area names no sheet. */
|
|
34
|
+
prefix: string;
|
|
35
|
+
coords: IRange.FixableCoords;
|
|
36
|
+
}
|
|
37
|
+
/** One band of a structural edit, as the sheet's shift applies it. */
|
|
38
|
+
export interface Edit {
|
|
39
|
+
range: IRange.Coords;
|
|
40
|
+
direction: IRange.Direction;
|
|
41
|
+
}
|
|
42
|
+
export declare const isOffsetData: (data: Data) => data is OffsetData;
|
|
43
|
+
/** `text` as one plain area, or `null` for anything else: a name, a union, a function, `#REF!`. */
|
|
44
|
+
export declare function parseArea(text: string | null | undefined): Area | null;
|
|
45
|
+
/** The sheet name a prefix (`'Q1 ''Data'''!`, `Sheet1!`) spells, unquoted; `null` for none. */
|
|
46
|
+
export declare function sheetNameOf(prefix: string): string | null;
|
|
47
|
+
/**
|
|
48
|
+
* The data `text` names, read at the cell `at`.
|
|
49
|
+
*
|
|
50
|
+
* @param sheetOf The sheet a prefix names: `null` for the group's own, so own data is bare.
|
|
51
|
+
*/
|
|
52
|
+
export declare function toData(text: string, at: IRange.CellCoords, sheetOf: (name: string) => DataSheet | null): Data;
|
|
53
|
+
/** The cells `data` names for the cell `at`; `null` when they are off the sheet. */
|
|
54
|
+
export declare function dataCoordsAt(data: OffsetData, at: IRange.CellCoords): IRange.Coords | null;
|
|
55
|
+
/** What the cell `at` reads, as text: bare on the group's own sheet, as Excel's dialog shows it. */
|
|
56
|
+
export declare function dataText(data: Data, at: IRange.CellCoords): string;
|
|
57
|
+
/** What the range's first cell reads: the range's data as the JSON spells it. */
|
|
58
|
+
export declare function firstText(range: SparklineRange): string;
|
|
59
|
+
/** How many sparklines a range holds. */
|
|
60
|
+
export declare function cellCount(location: IRange.Coords): number;
|
|
61
|
+
/** The cell `index` names within `location`, row by row. */
|
|
62
|
+
export declare function cellAt(location: IRange.Coords, index: number): IRange.CellCoords;
|
|
63
|
+
/** The position of `cell` within `location`, row by row. */
|
|
64
|
+
export declare function indexOf(location: IRange.Coords, cell: IRange.CellCoords): number;
|
|
65
|
+
/** Whether every cell reads the same way under `a` as under `b`. */
|
|
66
|
+
export declare function isSameData(a: Data, b: Data): boolean;
|
|
67
|
+
/** `a` and `b` as one range: their cells make one block and read alike. `null` otherwise. */
|
|
68
|
+
export declare function joinRanges(a: SparklineRange, b: SparklineRange): SparklineRange | null;
|
|
69
|
+
/** `ranges` with each joined to the one before it where they make one range; in order. */
|
|
70
|
+
export declare function fold(ranges: readonly SparklineRange[]): SparklineRange[];
|
|
71
|
+
/** `existing` with `added` appended, each joined to a range it continues (a fill down a column). */
|
|
72
|
+
export declare function addRanges(existing: readonly SparklineRange[], added: readonly SparklineRange[]): SparklineRange[];
|
|
73
|
+
/**
|
|
74
|
+
* Where `cell` stands in the order of `ranges`' sparklines (ranges in order, row by row within
|
|
75
|
+
* each); `Infinity` when no range holds it.
|
|
76
|
+
*/
|
|
77
|
+
export declare function orderOf(ranges: readonly SparklineRange[], cell: IRange.CellCoords): number;
|
|
78
|
+
/**
|
|
79
|
+
* `current` with `moved` put back where their cells stood in `order`, as Excel keeps a cut
|
|
80
|
+
* sparkline's place in its group. `rows` and `cols` are how far the cut moved them.
|
|
81
|
+
*/
|
|
82
|
+
export declare function putBack(current: readonly SparklineRange[], moved: readonly SparklineRange[], order: readonly SparklineRange[], rows: number, cols: number): SparklineRange[];
|
|
83
|
+
/** `range` clipped to `within`; `null` when none of its cells are there. */
|
|
84
|
+
export declare function clipRange(range: SparklineRange, within: IRange.Coords): SparklineRange | null;
|
|
85
|
+
/** The ranges within `coords`: each the part of one range there, reading as it does. */
|
|
86
|
+
export declare function rangesWithin(ranges: readonly SparklineRange[], coords: IRange.Coords): SparklineRange[];
|
|
87
|
+
/**
|
|
88
|
+
* Copies `first` through `first + count - 1` of `range`, each `step` cells further along `axis`;
|
|
89
|
+
* the data reads the same way from each copy, as a copied formula's relative references do. One
|
|
90
|
+
* range when the copies abut - a column repeated down its own column - however many there are;
|
|
91
|
+
* one per copy otherwise, each its own range as it is in `getRanges()`.
|
|
92
|
+
*/
|
|
93
|
+
export declare function repeatRange(range: SparklineRange, first: number, count: number, step: number, axis: 'row' | 'col'): SparklineRange[];
|
|
94
|
+
/**
|
|
95
|
+
* `ranges`, marked within `from`, pasted over `to`.
|
|
96
|
+
*
|
|
97
|
+
* @remarks
|
|
98
|
+
* A copy tiles with the source's period and is clipped to `to`, as a paste tiles cells; each cell
|
|
99
|
+
* reads relative to itself, as a copied formula does, so the data offset is unchanged. A cut lands
|
|
100
|
+
* once and keeps each cell's data where it was, unless the cut encloses that data on the source
|
|
101
|
+
* sheet: then the data goes with the cut.
|
|
102
|
+
*
|
|
103
|
+
* @param options.sourceSheet The source sheet, for a paste onto another sheet: data on the
|
|
104
|
+
* source's own sheet names it there.
|
|
105
|
+
*/
|
|
106
|
+
export declare function pasteRanges(ranges: readonly SparklineRange[], from: IRange.Coords, to: IRange.Coords, options: {
|
|
107
|
+
isCut: boolean;
|
|
108
|
+
sourceSheet: DataSheet | null;
|
|
109
|
+
}): SparklineRange[];
|
|
110
|
+
/**
|
|
111
|
+
* `range` once a cut on the sheet its data is on has moved the cells `from` to `to` and left the
|
|
112
|
+
* range's own cells where they are: a cell whose data the cut encloses reads it where it went.
|
|
113
|
+
* `null` when the cut encloses none of its data.
|
|
114
|
+
*
|
|
115
|
+
* @param toSheet The sheet the cells went to, when the cut took them to another sheet: `null`
|
|
116
|
+
* for the group's own sheet.
|
|
117
|
+
*/
|
|
118
|
+
export declare function moveData(range: SparklineRange, from: IRange.Coords, to: IRange.Coords, toSheet?: DataSheet | null): SparklineRange[] | null;
|
|
119
|
+
/**
|
|
120
|
+
* `coords` through `edit` as the engine rewrites a reference to them: moved, grown or trimmed on
|
|
121
|
+
* the shifted axis, `null` when the delete takes all of it, the same object when the edit does not
|
|
122
|
+
* reach it. The edit reaches a reference that meets the band's span across and lies at or past
|
|
123
|
+
* the band along the shift.
|
|
124
|
+
*/
|
|
125
|
+
export declare function shiftCoords(coords: IRange.Coords, edit: Edit): IRange.Coords | null;
|
|
126
|
+
/**
|
|
127
|
+
* `range` through `edits` on its own sheet, as Excel takes each sparkline through them - its cell
|
|
128
|
+
* moves with the cell, its data is rewritten on its own (`#REF!` when the edit deletes it) - as
|
|
129
|
+
* ranges again, joined where they read alike. `null` when the edits reach neither its cells nor
|
|
130
|
+
* its data. Data on another sheet is not rewritten by them.
|
|
131
|
+
*/
|
|
132
|
+
export declare function followEdits(range: SparklineRange, edits: readonly Edit[]): SparklineRange[] | null;
|
|
133
|
+
/**
|
|
134
|
+
* `range` through `edits` on the other sheet its data is on: its cells stay, each cell's data is
|
|
135
|
+
* rewritten on its own. `null` when the edits reach none of its data.
|
|
136
|
+
*/
|
|
137
|
+
export declare function followDataEdits(range: SparklineRange, edits: readonly Edit[]): SparklineRange[] | null;
|
|
138
|
+
/** The cells every cell of `range` reads, as one block; `null` for data that is not an area. */
|
|
139
|
+
export declare function dataBlock(range: SparklineRange): IRange.Coords | null;
|
|
140
|
+
/** Why a location and its data do not make sparklines, as {@link pairData} answers. */
|
|
141
|
+
export type PairRefusal =
|
|
142
|
+
/** The location is more than one row and more than one column. */
|
|
143
|
+
'location2D'
|
|
144
|
+
/** One sparkline over data that is more than one row and more than one column. */
|
|
145
|
+
| 'data2D'
|
|
146
|
+
/** Neither the data's rows nor its columns number the location's cells. */
|
|
147
|
+
| 'count'
|
|
148
|
+
/** Excel pairs each sparkline with a row of the data across a row of cells (or a column down a column): no one offset. */
|
|
149
|
+
| 'transposed';
|
|
150
|
+
/**
|
|
151
|
+
* The cells `location`'s first cell reads when `data` is given to the whole location, as Excel's
|
|
152
|
+
* `SparklineGroups.Add` pairs them (measured, DESIGN-SPARKLINES §1); each other cell reads it moved
|
|
153
|
+
* by its offset from the first. Or why they do not pair.
|
|
154
|
+
*
|
|
155
|
+
* @remarks
|
|
156
|
+
* One sparkline reads all of a one-row or one-column `data`. Several pair with the data's rows
|
|
157
|
+
* when they are as many, else with its columns, so a square block pairs by rows. One column longer
|
|
158
|
+
* than a column of cells gives each a window of it, one row further down per cell (`A1:A7` over
|
|
159
|
+
* `F2:F4` reads `A1:A5`, `A2:A6`, `A3:A7`), and a row across a row of cells likewise: what Excel
|
|
160
|
+
* refuses, and what a group of such windows reads back as.
|
|
161
|
+
*/
|
|
162
|
+
export declare function pairData(location: IRange.Coords, data: IRange.Coords): {
|
|
163
|
+
first: IRange.Coords;
|
|
164
|
+
} | {
|
|
165
|
+
refused: PairRefusal;
|
|
166
|
+
};
|
|
167
|
+
/** A location paired with its data: the cells its first cell reads, in `data[dataIndex]`'s sheet. */
|
|
168
|
+
export interface AreaPair {
|
|
169
|
+
location: IRange.Coords;
|
|
170
|
+
first: IRange.Coords;
|
|
171
|
+
dataIndex: number;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Pairs a list of location areas with a list of data areas, as Excel's Edit Sparklines dialog
|
|
175
|
+
* (`SparklineGroup.Modify`) does where it answers (measured, DESIGN-SPARKLINES §1):
|
|
176
|
+
*
|
|
177
|
+
* * **One data area** is given to all the location cells together, in order, by {@link pairData}'s
|
|
178
|
+
* rule: `F2:F3,G5` with `A2:E4` reads a row each.
|
|
179
|
+
* * **As many data areas as location areas** pair area by area: `F2:F4,H6` with `A2:E4,A6:E6`
|
|
180
|
+
* (Excel crashes on this one).
|
|
181
|
+
* * **As many data areas as location cells** give one to each: `F2:F4` with
|
|
182
|
+
* `A2:E2,A9:E9,A4:E4`.
|
|
183
|
+
*
|
|
184
|
+
* Anything else is refused as `count`, where Excel drops the extra data areas without a word.
|
|
185
|
+
*
|
|
186
|
+
* @remarks
|
|
187
|
+
* Costs the areas given, never the cells: a location area that the data names cell by cell is
|
|
188
|
+
* split, but then the data lists every one of its cells already.
|
|
189
|
+
*/
|
|
190
|
+
export declare function pairAreas(locations: readonly IRange.Coords[], data: readonly IRange.Coords[]): {
|
|
191
|
+
pairs: AreaPair[];
|
|
192
|
+
} | {
|
|
193
|
+
refused: PairRefusal;
|
|
194
|
+
};
|
|
195
|
+
//# sourceMappingURL=SparklineRanges.d.ts.map
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Bounds, Point } from '@sheetxl/utils';
|
|
2
|
+
import { IColor } from '../../color';
|
|
3
|
+
import { ISparklineGroup } from '../ISparklineGroup';
|
|
4
|
+
/**
|
|
5
|
+
* A sparkline laid out: its line, columns, markers and axis, in px from the cell's top-left. A
|
|
6
|
+
* painter translates it and decides nothing.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* Plain data, never stored on the model: it is computed from the sparkline's values, its group's
|
|
10
|
+
* properties, the theme and a size.
|
|
11
|
+
*
|
|
12
|
+
* - Every color is an {@link IColor} resolved against the workbook's theme. A painter draws it for
|
|
13
|
+
* its mode, as cells are drawn: `color.toCSS()`, or `color.toRGBA(darkMode)` for a dark grid.
|
|
14
|
+
* - Every length is in px, a line's width included, which the group states in points.
|
|
15
|
+
* - What is drawn later is drawn over what is drawn earlier: the axis, then the columns or the
|
|
16
|
+
* line, then the markers.
|
|
17
|
+
*/
|
|
18
|
+
export interface SparklineLayout {
|
|
19
|
+
/** The cell's box in px. */
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
type: ISparklineGroup.Type;
|
|
23
|
+
/** Where the points are drawn: the box less its margins. */
|
|
24
|
+
plot: Bounds;
|
|
25
|
+
/** The axis at zero, when the group shows one and zero is within the vertical range. */
|
|
26
|
+
axis: SparklineLayout.Line | null;
|
|
27
|
+
/**
|
|
28
|
+
* The line through the points, broken where an empty cell is a gap: one array of points per
|
|
29
|
+
* unbroken run. `null` for columns and win/loss.
|
|
30
|
+
*/
|
|
31
|
+
line: SparklineLayout.Polyline | null;
|
|
32
|
+
/** One per point drawn, for columns and win/loss; empty for a line. */
|
|
33
|
+
columns: SparklineLayout.Column[];
|
|
34
|
+
/** The line's markers and its highlighted points; empty for columns and win/loss. */
|
|
35
|
+
markers: SparklineLayout.Marker[];
|
|
36
|
+
/** The vertical range the values were scaled to; `null` when there is nothing to draw. */
|
|
37
|
+
min: number | null;
|
|
38
|
+
max: number | null;
|
|
39
|
+
}
|
|
40
|
+
export declare namespace SparklineLayout {
|
|
41
|
+
/** A straight line. */
|
|
42
|
+
interface Line {
|
|
43
|
+
from: Point;
|
|
44
|
+
to: Point;
|
|
45
|
+
color: IColor;
|
|
46
|
+
width: number;
|
|
47
|
+
}
|
|
48
|
+
/** A line through runs of points. */
|
|
49
|
+
interface Polyline {
|
|
50
|
+
/** Each unbroken run, in drawing order (left to right, or right to left). */
|
|
51
|
+
runs: Point[][];
|
|
52
|
+
color: IColor;
|
|
53
|
+
width: number;
|
|
54
|
+
}
|
|
55
|
+
/** A column (or a win/loss block). */
|
|
56
|
+
interface Column {
|
|
57
|
+
/** Which value of the sparkline's data it draws, in data order. */
|
|
58
|
+
index: number;
|
|
59
|
+
rect: Bounds;
|
|
60
|
+
color: IColor;
|
|
61
|
+
}
|
|
62
|
+
/** A marker on a point of a line. */
|
|
63
|
+
interface Marker {
|
|
64
|
+
/** Which value of the sparkline's data it marks, in data order. */
|
|
65
|
+
index: number;
|
|
66
|
+
center: Point;
|
|
67
|
+
radius: number;
|
|
68
|
+
color: IColor;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=SparklineLayout.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { IColor } from '../../color';
|
|
2
|
+
import { ISparklineGroup } from '../ISparklineGroup';
|
|
3
|
+
import { SparklineLayout } from './SparklineLayout';
|
|
4
|
+
/** What a sparkline draws: its values, in data order. */
|
|
5
|
+
export interface SparklineData {
|
|
6
|
+
/**
|
|
7
|
+
* A number per cell of the data, hidden cells already left out unless the group shows them;
|
|
8
|
+
* `null` for an empty cell (a blank, `#N/A`), which the empty-cell rule draws.
|
|
9
|
+
*/
|
|
10
|
+
values: readonly (number | null)[];
|
|
11
|
+
/** Per value, its date when the group spaces points by date. Absent: evenly spaced. */
|
|
12
|
+
dates?: readonly (number | null)[] | null;
|
|
13
|
+
}
|
|
14
|
+
export interface SparklineLayoutOptions {
|
|
15
|
+
/** The cell's box in px. */
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
properties: Readonly<ISparklineGroup.Properties>;
|
|
19
|
+
/** A color as the group states it (`accent1 tint 0.4`, `#376092`), resolved against the theme. */
|
|
20
|
+
color: (color: string) => IColor;
|
|
21
|
+
/**
|
|
22
|
+
* The extent of the group's values, used for an axis whose type is `'group'`; see
|
|
23
|
+
* {@link sparklineExtent}. Absent, such an axis scales to the sparkline's own values.
|
|
24
|
+
*/
|
|
25
|
+
groupExtent?: {
|
|
26
|
+
min: number;
|
|
27
|
+
max: number;
|
|
28
|
+
} | null;
|
|
29
|
+
}
|
|
30
|
+
/** The colors Excel's fresh group writes, for a group that states none. */
|
|
31
|
+
export declare const DEFAULT_SPARKLINE_COLORS: Readonly<Record<'colorSeries' | 'colorNegative' | 'colorAxis' | 'colorMarkers' | 'colorFirst' | 'colorLast' | 'colorHigh' | 'colorLow', string>>;
|
|
32
|
+
/**
|
|
33
|
+
* The min and max of the values a sparkline draws, `null` when it draws none: what a group whose
|
|
34
|
+
* axis type is `'group'` folds over its sparklines.
|
|
35
|
+
*/
|
|
36
|
+
export declare function sparklineExtent(data: SparklineData, properties: Readonly<ISparklineGroup.Properties>): {
|
|
37
|
+
min: number;
|
|
38
|
+
max: number;
|
|
39
|
+
} | null;
|
|
40
|
+
/** Lays out one sparkline. */
|
|
41
|
+
export declare function layoutSparkline(data: SparklineData, options: SparklineLayoutOptions): SparklineLayout;
|
|
42
|
+
//# sourceMappingURL=_layoutSparkline.d.ts.map
|