@lexaxai/spreadsheet-engine 0.0.0-stage → 0.1.0-dryrun.1

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.
@@ -0,0 +1,280 @@
1
+ // What a cell holds: its value in each of its forms, a row's values, a
2
+ // note's format, a defined name's ranges, a sheet's links and a range.
3
+
4
+ import type { Font } from './styles';
5
+
6
+ /**
7
+ * An error held by a cell, such as `#DIV/0!`, as the value of a cell or the result of a formula. Used by
8
+ * `CellValue`.
9
+ */
10
+ export interface CellErrorValue {
11
+ /**
12
+ * The error, as its text, such as `#N/A`.
13
+ */
14
+ error: '#N/A' | '#REF!' | '#NAME?' | '#DIV/0!' | '#NULL!' | '#VALUE!' | '#NUM!';
15
+ }
16
+
17
+ /**
18
+ * A run of text in a rich text cell, with its own font. Used by `CellRichTextValue`.
19
+ */
20
+ export interface RichText {
21
+ /**
22
+ * The text of the run.
23
+ */
24
+ text: string;
25
+ /**
26
+ * The font of the run.
27
+ */
28
+ font?: Partial<Font>;
29
+ }
30
+
31
+ /**
32
+ * The value of a cell holding rich text: its runs of text, each with its own font.
33
+ */
34
+ export interface CellRichTextValue {
35
+ /**
36
+ * The runs of text, in order.
37
+ */
38
+ richText: RichText[];
39
+ }
40
+
41
+ /**
42
+ * The value of a cell that is a hyperlink: the text it shows and the address it links to.
43
+ */
44
+ export interface CellHyperlinkValue {
45
+ /**
46
+ * The text the cell shows.
47
+ */
48
+ text: string;
49
+ /** '' for a link with no target, which a sheet's macros act on */
50
+ hyperlink: string;
51
+ /**
52
+ * The text shown when the pointer rests on the link.
53
+ */
54
+ tooltip?: string;
55
+ /** the link's own display text, as the file had it */
56
+ display?: string;
57
+ /** the cells the link covers, held by its top-left cell */
58
+ range?: string;
59
+ }
60
+
61
+ /**
62
+ * The value of a cell holding a formula, with the result it last calculated.
63
+ */
64
+ export interface CellFormulaValue {
65
+ /**
66
+ * The formula, as typed, with or without its leading `=`.
67
+ */
68
+ formula: string;
69
+ /**
70
+ * The result of the formula, as last calculated.
71
+ */
72
+ result?: number | string | boolean | Date | CellErrorValue;
73
+ /**
74
+ * Whether the result's dates are counted in the 1904 date system.
75
+ */
76
+ date1904?: boolean;
77
+ /**
78
+ * an array formula filling the block ref, or a data table whose block of
79
+ * results is ref, its formula TABLE(row input, column input) as Excel
80
+ * shows it: TABLE(,D1), TABLE(D1,) or TABLE(D1,D2)
81
+ */
82
+ shareType?: 'array' | 'dataTable';
83
+ /**
84
+ * The range an array formula fills, or the block of results a data table holds, such as `B2:B9`.
85
+ */
86
+ ref?: string;
87
+ /**
88
+ * a dynamic array: an array formula whose range a calculation sets,
89
+ * spilling over as many cells as its result has. Written by
90
+ * workbook.xlsx only; the streaming writer refuses it.
91
+ */
92
+ dynamicArray?: boolean;
93
+ /** a link on the formula's cell, as on a CellHyperlinkValue */
94
+ hyperlink?: string;
95
+ /**
96
+ * The text shown when the pointer rests on the link on the formula's cell.
97
+ */
98
+ tooltip?: string;
99
+ /**
100
+ * The text of the link on the formula's cell, as the file had it.
101
+ */
102
+ display?: string;
103
+ /**
104
+ * The cells the link on the formula's cell covers, held by its top-left cell.
105
+ */
106
+ range?: string;
107
+ }
108
+
109
+ /**
110
+ * The value of a cell that shares the formula of a master cell, as Excel writes a formula filled across a
111
+ * range.
112
+ */
113
+ export interface CellSharedFormulaValue {
114
+ /**
115
+ * The address of the master cell that holds the formula, such as `A1`.
116
+ */
117
+ sharedFormula: string;
118
+ /**
119
+ * The formula of the cell, translated from the master cell's formula. Read only.
120
+ */
121
+ readonly formula?: string;
122
+ /**
123
+ * The result of the formula, as last calculated.
124
+ */
125
+ result?: number | string | boolean | Date | CellErrorValue;
126
+ /**
127
+ * Whether the result's dates are counted in the 1904 date system.
128
+ */
129
+ date1904?: boolean;
130
+ }
131
+
132
+ /**
133
+ * The value a cell can hold: empty, a number, text, a logical value, a date, an error, rich text, a hyperlink
134
+ * or a formula.
135
+ */
136
+ export type CellValue =
137
+ | null | number | string | boolean | Date | undefined
138
+ | CellErrorValue
139
+ | CellRichTextValue | CellHyperlinkValue
140
+ | CellFormulaValue | CellSharedFormulaValue;
141
+
142
+ /**
143
+ * The values of one row, as Worksheet.getSheetValues gives them: an array by column number, or an object by
144
+ * column key.
145
+ */
146
+ export type RowValues = CellValue[] | { [key: string]: CellValue } | undefined | null;
147
+
148
+ /**
149
+ * The margins of a note's box, and how its text is inset. Used by `Comment`.
150
+ */
151
+ export interface CommentMargins {
152
+ /**
153
+ * How the text is inset in the box: `auto` lets Excel set the inset, and `custom` takes it from `inset`.
154
+ */
155
+ insetmode: 'auto' | 'custom';
156
+ inset: number[];
157
+ }
158
+
159
+ /**
160
+ * Whether a note, and the text of a note, is locked when the worksheet is protected. Used by `Comment`.
161
+ */
162
+ export interface CommentProtection {
163
+ /**
164
+ * Whether the note is locked when the worksheet is protected, as `'True'` or `'False'`.
165
+ */
166
+ locked: 'True' | 'False';
167
+ /**
168
+ * Whether the text of the note is locked when the worksheet is protected, as `'True'` or `'False'`.
169
+ */
170
+ lockText: 'True' | 'False';
171
+ }
172
+
173
+ /**
174
+ * How a note moves and resizes with its cells: `twoCells` moves and resizes it, `oneCells` moves it without
175
+ * resizing it, and `absolute` does neither.
176
+ */
177
+ export type CommentEditAs = 'twoCells' | 'oneCells' | 'absolute';
178
+
179
+ /**
180
+ * The format of a note: its text, the margins of its box, its protection and how it moves with its cells.
181
+ * Used by `Cell.note`.
182
+ */
183
+ export interface Comment {
184
+ /**
185
+ * The text of the note, as runs of rich text.
186
+ */
187
+ texts?: RichText[];
188
+ /**
189
+ * The margins of the note's box.
190
+ */
191
+ margins?: Partial<CommentMargins>;
192
+ /**
193
+ * Whether the note is locked when the worksheet is protected.
194
+ */
195
+ protection?: Partial<CommentProtection>;
196
+ /**
197
+ * How the note moves and resizes with its cells.
198
+ */
199
+ editAs?: CommentEditAs;
200
+ }
201
+
202
+ /**
203
+ * The ranges one defined name refers to, as `DefinedNames.getRanges` gives them.
204
+ */
205
+ export interface DefinedNamesRanges {
206
+ /**
207
+ * The name, as the workbook spells it.
208
+ */
209
+ name: string;
210
+ /**
211
+ * The ranges the name refers to, each as text such as `Sheet1!$A$1:$B$2`.
212
+ */
213
+ ranges: string[];
214
+ }
215
+
216
+ /**
217
+ * The defined names of a workbook as a list, one entry for each name, as `WorkbookModel.definedNames` holds
218
+ * them.
219
+ */
220
+ export type DefinedNamesModel = DefinedNamesRanges[];
221
+
222
+ /**
223
+ * A hyperlink on a worksheet, as `Worksheet.getHyperlinks` lists it.
224
+ */
225
+ export interface SheetHyperlink {
226
+ /** the cell holding it */
227
+ address: string;
228
+ /** the cells it covers, its address for a link on one cell */
229
+ range: string;
230
+ /** an address out, or '#' and a place in the workbook */
231
+ target: string;
232
+ /**
233
+ * The text shown when the pointer rests on the link.
234
+ */
235
+ tooltip?: string;
236
+ /** the holding cell's value, a formula's result */
237
+ text: CellValue;
238
+ }
239
+
240
+ /**
241
+ * A range of cells by its edges and its addresses, as `Worksheet.dimensions` gives one.
242
+ */
243
+ export interface CellRange {
244
+ /**
245
+ * The number of its first row, from 1.
246
+ */
247
+ top: number;
248
+ /**
249
+ * The number of its first column, from 1.
250
+ */
251
+ left: number;
252
+ /**
253
+ * The number of its last row.
254
+ */
255
+ bottom: number;
256
+ /**
257
+ * The number of its last column.
258
+ */
259
+ right: number;
260
+ /**
261
+ * Its top-left cell, such as `A1`.
262
+ */
263
+ tl: string;
264
+ /**
265
+ * Its bottom-right cell.
266
+ */
267
+ br: string;
268
+ /**
269
+ * Its address, such as `A1:D9`.
270
+ */
271
+ range: string;
272
+ /**
273
+ * Its address, one cell's alone where it is one cell.
274
+ */
275
+ shortRange: string;
276
+ /**
277
+ * The number of its cells.
278
+ */
279
+ count: number;
280
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.