@jsfkit/types 1.0.1 → 1.2.0
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/dist/index.d.ts +388 -85
- package/package.json +6 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,41 +1,22 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A whole number without a fractional value.
|
|
3
|
-
*/
|
|
4
|
-
type integer = number;
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Directions on how formulas should be recalculated in the workbook.
|
|
8
|
-
*/
|
|
9
|
-
type CalcProps = {
|
|
10
|
-
/**
|
|
11
|
-
* Specifies whether an attempt should be made to calculate formulas that contain circular
|
|
12
|
-
* references. Defaults to `false` in Excel.
|
|
13
|
-
*/
|
|
14
|
-
iterate: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* The maximum number of calculation iterations, when `iterate` is `true`. Defaults to `100` in
|
|
17
|
-
* Excel.
|
|
18
|
-
*/
|
|
19
|
-
iterateCount: integer;
|
|
20
|
-
/**
|
|
21
|
-
* When a calculation iteration results in an absolute change that is less than iterateDelta,
|
|
22
|
-
* then no further iterations should be attempted. Defaults to `0.001` in Excel.
|
|
23
|
-
*/
|
|
24
|
-
iterateDelta: number;
|
|
25
|
-
/**
|
|
26
|
-
* Which of the two date systems the workbook uses. 1900 is the default.
|
|
27
|
-
*
|
|
28
|
-
* @see {@link https://support.microsoft.com/office/e7fe7167-48a9-4b96-bb53-5612a800b487}
|
|
29
|
-
*/
|
|
30
|
-
epoch?: 1900 | 1904;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
1
|
/**
|
|
34
2
|
* Defines the type of a value contained within a cell.
|
|
3
|
+
*
|
|
4
|
+
* | Value | Type | Notes |
|
|
5
|
+
* |-------|---------|--------------------------------------------------------------------------|
|
|
6
|
+
* | `b` | Boolean | |
|
|
7
|
+
* | `e` | Error | Formula error (cell value is the error code as a string) |
|
|
8
|
+
* | `n` | Number | Either integer or float |
|
|
9
|
+
* | `d` | Date | The {@link Cell.s | cell style} formats the integer cell value as a date |
|
|
10
|
+
* | `s` | Text | |
|
|
11
|
+
* | `z` | Empty | Cell is empty |
|
|
35
12
|
*/
|
|
36
13
|
type CellValueType = 'b' | 'e' | 'n' | 'd' | 's' | 'z';
|
|
37
14
|
|
|
38
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* A cell comment.
|
|
17
|
+
*
|
|
18
|
+
* @deprecated Use {@link Note | notes} and {@link ThreadedComment | threaded comments} instead.
|
|
19
|
+
*/
|
|
39
20
|
type Comment = {
|
|
40
21
|
/** Author of the comment. */
|
|
41
22
|
a: string;
|
|
@@ -45,6 +26,11 @@ type Comment = {
|
|
|
45
26
|
t: string;
|
|
46
27
|
};
|
|
47
28
|
|
|
29
|
+
/**
|
|
30
|
+
* A whole number without a fractional value.
|
|
31
|
+
*/
|
|
32
|
+
type integer = number;
|
|
33
|
+
|
|
48
34
|
/**
|
|
49
35
|
* A spreadsheet cell.
|
|
50
36
|
*/
|
|
@@ -60,6 +46,8 @@ type Cell = {
|
|
|
60
46
|
* Cell formula expression. When the value is a string it will be a formula with A1-style
|
|
61
47
|
* references. When the value is a number is an index to a formula in the workbook's `formulas`
|
|
62
48
|
* array.
|
|
49
|
+
*
|
|
50
|
+
* @see {@link Workbook.formulas}
|
|
63
51
|
*/
|
|
64
52
|
f?: string | integer;
|
|
65
53
|
/** The range of enclosing array if the formula is an array formula. */
|
|
@@ -71,16 +59,20 @@ type Cell = {
|
|
|
71
59
|
/**
|
|
72
60
|
* An index to a style in the workbook's `styles`.
|
|
73
61
|
*
|
|
62
|
+
* @see {@link Workbook.styles}
|
|
74
63
|
* @default 0
|
|
75
64
|
*/
|
|
76
65
|
s?: integer;
|
|
77
66
|
/**
|
|
78
67
|
* Comments associated with the cell.
|
|
68
|
+
*
|
|
69
|
+
* @deprecated Use a worksheet's {@link Worksheet.notes | notes} and {@link Worksheet.comments | threaded comments} instead.
|
|
79
70
|
*/
|
|
80
71
|
c?: Comment[];
|
|
81
72
|
/**
|
|
82
73
|
* The type of the value contained in the cell. Cells with errors or dates must include this
|
|
83
|
-
* property, but it's otherwise optional (the type can be inferred from the
|
|
74
|
+
* property, but it's otherwise optional (the type can be inferred from the {@link Cell.v}
|
|
75
|
+
* property).
|
|
84
76
|
*/
|
|
85
77
|
t?: CellValueType;
|
|
86
78
|
};
|
|
@@ -98,7 +90,7 @@ type CellId = string;
|
|
|
98
90
|
/**
|
|
99
91
|
* A cell coordinate range in an uppercase A1-style reference format (e.g. `H6:J36`).
|
|
100
92
|
*
|
|
101
|
-
* The range consists of two {@link CellId}
|
|
93
|
+
* The range consists of two {@link CellId | CellIds} separated by a colon (`:`) character.
|
|
102
94
|
*
|
|
103
95
|
* @pattern ^([A-Z]{1,3}[0-9]{1,3}):([A-Z]{1,3}[0-9]{1,3})$
|
|
104
96
|
*/
|
|
@@ -148,10 +140,15 @@ type ExternalWorksheet = {
|
|
|
148
140
|
/**
|
|
149
141
|
* The cells belonging to the worksheet that have any data attached.
|
|
150
142
|
*
|
|
151
|
-
* Typically, these will have only values
|
|
152
|
-
*
|
|
143
|
+
* Typically, these will have only values attached, as external worksheet cells serve purely as
|
|
144
|
+
* inputs to formulas in other sheets.
|
|
153
145
|
*/
|
|
154
146
|
cells: Record<CellId, Cell>;
|
|
147
|
+
/**
|
|
148
|
+
* Indicates that the sheet data could not be refreshed/fetched from the external workbook.
|
|
149
|
+
* In XLSX, this corresponds to the refreshError="1" attribute on sheetData.
|
|
150
|
+
*/
|
|
151
|
+
refreshError?: boolean;
|
|
155
152
|
};
|
|
156
153
|
|
|
157
154
|
/**
|
|
@@ -169,6 +166,11 @@ type External = {
|
|
|
169
166
|
sheets: ExternalWorksheet[];
|
|
170
167
|
/** Relevant defined names from an external workbook. */
|
|
171
168
|
names: DefinedName[];
|
|
169
|
+
/**
|
|
170
|
+
* Indicates that the path to the external workbook file is unknown or missing.
|
|
171
|
+
* In XLSX, this corresponds to the xlPathMissing relationship type.
|
|
172
|
+
*/
|
|
173
|
+
pathMissing?: boolean;
|
|
172
174
|
};
|
|
173
175
|
|
|
174
176
|
/**
|
|
@@ -182,11 +184,12 @@ type PixelValue = number;
|
|
|
182
184
|
* A size of a UI-grid measure over a range of items.
|
|
183
185
|
*
|
|
184
186
|
* GridSize information is run-length encoded. The start and end attributes indicate the range of
|
|
185
|
-
* items that the
|
|
186
|
-
* 1 corresponds to column A or row 1.
|
|
187
|
+
* items that the {@link GridSize.size} and {@link GridSize.s} attributes affect. The range is
|
|
188
|
+
* expressed using integers, where 1 corresponds to column A or row 1.
|
|
187
189
|
*
|
|
188
|
-
* GridSize may have a style-index (
|
|
189
|
-
* the column should be used for all cells that are not present in the sheet's cell
|
|
190
|
+
* GridSize may have a style-index ({@link GridSize.s}) attribute like individual cells. The styling
|
|
191
|
+
* information on the column should be used for all cells that are not present in the sheet's cell
|
|
192
|
+
* collection.
|
|
190
193
|
*/
|
|
191
194
|
type GridSize = {
|
|
192
195
|
/** A 1-based inclusive start index. */
|
|
@@ -199,54 +202,99 @@ type GridSize = {
|
|
|
199
202
|
s?: integer;
|
|
200
203
|
};
|
|
201
204
|
|
|
205
|
+
/**
|
|
206
|
+
* An annotation associated with a cell.
|
|
207
|
+
*
|
|
208
|
+
* There is a maximum of one note per cell, and there is no way to reply to a note. For cell
|
|
209
|
+
* annotations with replies, see {@link ThreadedComment} and {@link Worksheet.comments}.
|
|
210
|
+
*/
|
|
211
|
+
type Note = {
|
|
212
|
+
/** Cell to which the note is attached (e.g. A1, E24). */
|
|
213
|
+
ref: CellId;
|
|
214
|
+
/** Name of the person who originally made this note. */
|
|
215
|
+
author: string;
|
|
216
|
+
/** Body text of the note. */
|
|
217
|
+
text: string;
|
|
218
|
+
};
|
|
219
|
+
|
|
202
220
|
/**
|
|
203
221
|
* The style to use when drawing a cell border. If the worksheet's zoom factor is changed the width
|
|
204
222
|
* of the border is expected to stay the same.
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
+
*/
|
|
224
|
+
type BorderStyle =
|
|
225
|
+
/** No border is drawn.*/
|
|
226
|
+
'none' |
|
|
227
|
+
/** Equivalent to SVG `stroke-dasharray="4 1 2 1"`, at a 1px width.*/
|
|
228
|
+
'dashDot' |
|
|
229
|
+
/** Equivalent to SVG `stroke-dasharray="4 1 2 1 2 1"`, at a 1px width.*/
|
|
230
|
+
'dashDotDot' |
|
|
231
|
+
/** Equivalent to SVG `stroke-dasharray=""3 1`, at a 1px width.*/
|
|
232
|
+
'dashed' |
|
|
233
|
+
/** Equivalent to SVG `stroke-dasharray="1"`, at a 1px width.*/
|
|
234
|
+
'dotted' |
|
|
235
|
+
/** Draw two 1px wide continuous parallel lines with a 1px gap between them.*/
|
|
236
|
+
'double' |
|
|
237
|
+
/** Draw a 1px wide pixel continuous hairline.*/
|
|
238
|
+
'hair' |
|
|
239
|
+
/** Draw a 2px wide pixel continuous line.*/
|
|
240
|
+
'medium' |
|
|
241
|
+
/** Equivalent to SVG `stroke-dasharray="4 1 2 1"`, at a 2px width.*/
|
|
242
|
+
'mediumDashDot' |
|
|
243
|
+
/** Equivalent to SVG `stroke-dasharray="4 1 2 1 2 1"`, at a 2px width.*/
|
|
244
|
+
'mediumDashDotDot' |
|
|
245
|
+
/** Equivalent to SVG `stroke-dasharray=""3 1`, at a 2px width.*/
|
|
246
|
+
'mediumDashed' |
|
|
247
|
+
/**
|
|
248
|
+
* Draw two 1px parallel dashed lines where the lower/left line 1px "behind" the other, creating
|
|
249
|
+
* a slant.
|
|
250
|
+
*/
|
|
251
|
+
'slantDashDot' |
|
|
252
|
+
/** Draw a 3px wide pixel continuous line.*/
|
|
253
|
+
'thick' |
|
|
254
|
+
/** Draw a 1px wide pixel continuous line.*/
|
|
255
|
+
'thin';
|
|
223
256
|
|
|
224
257
|
/**
|
|
225
258
|
* A hex-encoded RGB or RGBA value that conforms to the CSS4 color specification (e.g. `"#3cb371"`).
|
|
226
259
|
*
|
|
227
|
-
* @see {@link https://www.w3.org/TR/css-color-4/#hex-notation|CSS spec}
|
|
260
|
+
* @see {@link https://www.w3.org/TR/css-color-4/#hex-notation | CSS hexadecimal notation spec}
|
|
228
261
|
* @pattern ^#([a-fA-F0-9]{3,4}|([a-fA-F0-9][a-fA-F0-9]){3,4})$
|
|
229
262
|
*/
|
|
230
263
|
type Color = `#${string}`;
|
|
231
264
|
|
|
232
265
|
/**
|
|
233
266
|
* Specifies the horizontal alignment of content (text) within a container (cell).
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
267
|
+
*/
|
|
268
|
+
type HAlign =
|
|
269
|
+
/**
|
|
270
|
+
* The horizontal alignment is general-aligned. Text data is left-aligned. Numbers, dates, and
|
|
271
|
+
* times are right- aligned. Boolean types are centered.
|
|
272
|
+
*/
|
|
273
|
+
'general' |
|
|
274
|
+
/** Aligns content at the left edge of the cell (even in RTL mode). */
|
|
275
|
+
'left' |
|
|
276
|
+
/** The horizontal alignment is centered, meaning the text is centered across the cell. */
|
|
277
|
+
'center' |
|
|
278
|
+
/** Aligns content at the right edge of the cell (even in RTL mode). */
|
|
279
|
+
'right' |
|
|
280
|
+
/**
|
|
281
|
+
* Indicates that the value of the cell should be filled across the entire width of the cell. If
|
|
282
|
+
* blank cells to the right also have the fill alignment, they are also filled with the value,
|
|
283
|
+
* using a convention similar to `centerContinuous`.
|
|
284
|
+
*/
|
|
285
|
+
'fill' |
|
|
286
|
+
/**
|
|
287
|
+
* For each line of text, aligns each line of the wrapped text in a cell to the right and left
|
|
288
|
+
* (except the last line).
|
|
289
|
+
*/
|
|
290
|
+
'justify' |
|
|
291
|
+
/** The horizontal alignment is centered across multiple cells. */
|
|
292
|
+
'centerContinuous' |
|
|
293
|
+
/**
|
|
294
|
+
* Indicates that each 'word' in each line of text inside the cell is evenly distributed across
|
|
295
|
+
* the width of the cell, with flush right and left margins.
|
|
296
|
+
*/
|
|
297
|
+
'distributed';
|
|
250
298
|
|
|
251
299
|
/**
|
|
252
300
|
* The style of fill pattern used for a cell background. If the worksheets zoom factor is changed
|
|
@@ -506,11 +554,157 @@ type Table = {
|
|
|
506
554
|
headerRowCount?: integer;
|
|
507
555
|
/**
|
|
508
556
|
* Presentation information for the table. When not present tables should be rendered using
|
|
509
|
-
* `"TableStyleMedium2"` style with
|
|
557
|
+
* `"TableStyleMedium2"` style with {@link TableStyle.showRowStripes} set to `true`.
|
|
510
558
|
*/
|
|
511
559
|
style?: TableStyle;
|
|
512
560
|
};
|
|
513
561
|
|
|
562
|
+
/**
|
|
563
|
+
* Base type for text runs that annotate ranges within threaded comment text.
|
|
564
|
+
*
|
|
565
|
+
* A text run identifies a contiguous range of characters in the comment text, specified by
|
|
566
|
+
* zero-indexed start and end positions. Text runs allow metadata to be attached to specific
|
|
567
|
+
* portions of text, enabling features such as hyperlinks, mentions, and formatting.
|
|
568
|
+
*
|
|
569
|
+
* ## How text runs work
|
|
570
|
+
*
|
|
571
|
+
* Each text run specifies a range within the comment text using `start` (inclusive) and `end`
|
|
572
|
+
* (exclusive) character positions. For example, in the text "Hello @foo", a mention text run
|
|
573
|
+
* for "@foo" would have `start: 6` and `end: 10`.
|
|
574
|
+
*
|
|
575
|
+
* Multiple text runs can exist within a single comment, allowing different types of annotations
|
|
576
|
+
* to coexist (a mention and a hyperlink in the same text, for example).
|
|
577
|
+
*
|
|
578
|
+
* @see {@link MentionTextRun} for mentions of people
|
|
579
|
+
* @see {@link HyperlinkTextRun} for hyperlinks
|
|
580
|
+
*/
|
|
581
|
+
type TextRun = {
|
|
582
|
+
/** Starting character position of the run in the text (zero-indexed). */
|
|
583
|
+
start: integer;
|
|
584
|
+
/** Ending character position of the run in the text (zero-indexed, exclusive). */
|
|
585
|
+
end: integer;
|
|
586
|
+
};
|
|
587
|
+
|
|
588
|
+
/**
|
|
589
|
+
* A {@link TextRun | text run} representing a hyperlink within a threaded comment's text.
|
|
590
|
+
*/
|
|
591
|
+
type HyperlinkTextRun = TextRun & {
|
|
592
|
+
/** Discriminator to identify this as a hyperlink text run. */
|
|
593
|
+
type: 'hyperlink';
|
|
594
|
+
/** The URL that the hyperlink points to. */
|
|
595
|
+
url: string;
|
|
596
|
+
};
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* A {@link TextRun | text run} representing a mention of a person within a threaded comment's text.
|
|
600
|
+
*/
|
|
601
|
+
type MentionTextRun = TextRun & {
|
|
602
|
+
/** Discriminator to identify this as a mention text run. */
|
|
603
|
+
type: 'mention';
|
|
604
|
+
/**
|
|
605
|
+
* Unique identifier of the person being mentioned. Use this to find the person's details in a
|
|
606
|
+
* {@link Workbook.people | workbook's list of people}.
|
|
607
|
+
*
|
|
608
|
+
* Excel always uses a UUID in the format `{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}`, but JSF makes
|
|
609
|
+
* no strict requirement.
|
|
610
|
+
*/
|
|
611
|
+
personId: string;
|
|
612
|
+
};
|
|
613
|
+
|
|
614
|
+
/**
|
|
615
|
+
* An author of a threaded comment, or a person mentioned in a threaded comment.
|
|
616
|
+
*/
|
|
617
|
+
type Person = {
|
|
618
|
+
/**
|
|
619
|
+
* A unique id for the person.
|
|
620
|
+
*
|
|
621
|
+
* Excel always uses a UUID in the format `{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}`, but JSF makes
|
|
622
|
+
* no strict requirement.
|
|
623
|
+
*/
|
|
624
|
+
id: string;
|
|
625
|
+
/** The person's name as it should be shown to other users. */
|
|
626
|
+
displayName: string;
|
|
627
|
+
/**
|
|
628
|
+
* Optional provider-issued user identifier that varies in format depending on the provider. See
|
|
629
|
+
* {@link Person.providerId} for details on possible values.
|
|
630
|
+
*/
|
|
631
|
+
userId?: string;
|
|
632
|
+
/**
|
|
633
|
+
* Specifies where the person's information came from. Excel supports the following values:
|
|
634
|
+
*
|
|
635
|
+
* - `None`: no specific provider; {@link Person.userId} is expected to be the person's name.
|
|
636
|
+
* - `AD`: Active Directory; {@link Person.userId} will be Active Directory id.
|
|
637
|
+
* - `Windows Live`: Microsoft account; {@link Person.userId} will be a 64-bit signed decimal.
|
|
638
|
+
* - `PeoplePicker`: SharePoint People Picker; {@link Person.userId} will be an email address.
|
|
639
|
+
*/
|
|
640
|
+
providerId?: string;
|
|
641
|
+
};
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* A threaded comment that is attached to an individual cell.
|
|
645
|
+
*/
|
|
646
|
+
type ThreadedComment = {
|
|
647
|
+
/**
|
|
648
|
+
* Unique identifier for the comment.
|
|
649
|
+
*
|
|
650
|
+
* Excel always uses a UUID in the format `{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}`, but JSF makes
|
|
651
|
+
* no strict requirement.
|
|
652
|
+
*/
|
|
653
|
+
id: string;
|
|
654
|
+
/**
|
|
655
|
+
* Unique identifier of the parent comment, if this is a reply in a thread.
|
|
656
|
+
*
|
|
657
|
+
* Excel always uses a UUID in the format `{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}`, but JSF makes
|
|
658
|
+
* no strict requirement.
|
|
659
|
+
*/
|
|
660
|
+
parentId?: string;
|
|
661
|
+
/** A1-style reference to the cell this comment is attached to. */
|
|
662
|
+
ref: CellId;
|
|
663
|
+
/** Date and time the comment was written, as an ISO formatted string. */
|
|
664
|
+
datetime?: string;
|
|
665
|
+
/**
|
|
666
|
+
* Unique identifier of the person who authored this comment. Use this to find the person's
|
|
667
|
+
* details in a {@link Workbook.people | workbook's list of people}.
|
|
668
|
+
*
|
|
669
|
+
* Excel always uses a UUID in the format `{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}`, but JSF makes
|
|
670
|
+
* no strict requirement.
|
|
671
|
+
*/
|
|
672
|
+
personId: string;
|
|
673
|
+
/** The comment text content. */
|
|
674
|
+
text: string;
|
|
675
|
+
/** Whether the comment has been marked as resolved. */
|
|
676
|
+
resolved?: boolean;
|
|
677
|
+
/** {@link TextRun | Text runs} that annotate ranges within the comment text. */
|
|
678
|
+
runs?: (MentionTextRun | HyperlinkTextRun)[];
|
|
679
|
+
};
|
|
680
|
+
|
|
681
|
+
/**
|
|
682
|
+
* Directions on how formulas should be recalculated in the workbook.
|
|
683
|
+
*/
|
|
684
|
+
type CalcProps = {
|
|
685
|
+
/**
|
|
686
|
+
* Specifies whether an attempt should be made to calculate formulas that contain circular
|
|
687
|
+
* references. Defaults to `false` in Excel.
|
|
688
|
+
*/
|
|
689
|
+
iterate: boolean;
|
|
690
|
+
/**
|
|
691
|
+
* The maximum number of calculation iterations, when {@link CalcProps.iterate} is `true`.
|
|
692
|
+
* Defaults to `100` in Excel.
|
|
693
|
+
*/
|
|
694
|
+
iterateCount: integer;
|
|
695
|
+
/**
|
|
696
|
+
* When a calculation iteration results in an absolute change that is less than iterateDelta,
|
|
697
|
+
* then no further iterations should be attempted. Defaults to `0.001` in Excel.
|
|
698
|
+
*/
|
|
699
|
+
iterateDelta: number;
|
|
700
|
+
/**
|
|
701
|
+
* Which of the two date systems the workbook uses. 1900 is the default.
|
|
702
|
+
*
|
|
703
|
+
* @see {@link https://support.microsoft.com/office/e7fe7167-48a9-4b96-bb53-5612a800b487 | Date systems in Excel}
|
|
704
|
+
*/
|
|
705
|
+
epoch?: 1900 | 1904;
|
|
706
|
+
};
|
|
707
|
+
|
|
514
708
|
/**
|
|
515
709
|
* A collection of default properties that apply to cells, rows, or columns in the worksheet.
|
|
516
710
|
*/
|
|
@@ -521,6 +715,80 @@ type WorksheetDefaults = {
|
|
|
521
715
|
rowHeight: PixelValue;
|
|
522
716
|
};
|
|
523
717
|
|
|
718
|
+
/**
|
|
719
|
+
* Visual scale (aka zoom level, aka magnification) applied when displaying a worksheet.
|
|
720
|
+
*
|
|
721
|
+
* Each of the three layouts has its own scale. A scale is represented as a percentage, with `100`
|
|
722
|
+
* (100%) being the default 1:1 scale. When a layout has no explicit scale, use 100%.
|
|
723
|
+
*/
|
|
724
|
+
type WorksheetLayoutScales = {
|
|
725
|
+
/**
|
|
726
|
+
* Zoom level for normal view.
|
|
727
|
+
*
|
|
728
|
+
* @min 10
|
|
729
|
+
* @max 400
|
|
730
|
+
* @defaultValue 100
|
|
731
|
+
* */
|
|
732
|
+
normal?: integer;
|
|
733
|
+
/**
|
|
734
|
+
* Zoom level for page layout view.
|
|
735
|
+
*
|
|
736
|
+
* @min 10
|
|
737
|
+
* @max 400
|
|
738
|
+
* @defaultValue 100
|
|
739
|
+
*/
|
|
740
|
+
pageLayout?: integer;
|
|
741
|
+
/**
|
|
742
|
+
* Zoom level for page break preview (aka sheet layout view).
|
|
743
|
+
*
|
|
744
|
+
* @min 10
|
|
745
|
+
* @max 400
|
|
746
|
+
* @defaultValue 100
|
|
747
|
+
*/
|
|
748
|
+
pageBreakPreview?: integer;
|
|
749
|
+
};
|
|
750
|
+
|
|
751
|
+
/**
|
|
752
|
+
* A worksheet view.
|
|
753
|
+
*
|
|
754
|
+
* A worksheet view is a display configuration for a particular worksheet. Worksheet view settings
|
|
755
|
+
* can include:
|
|
756
|
+
*
|
|
757
|
+
* - Active cell
|
|
758
|
+
* - Selected ranges
|
|
759
|
+
* - View type (normal, page layout, or page break layout)
|
|
760
|
+
* - Zoom level
|
|
761
|
+
*
|
|
762
|
+
* Currently JSF does not include all available settings for a worksheet.
|
|
763
|
+
*/
|
|
764
|
+
type WorksheetView = {
|
|
765
|
+
/**
|
|
766
|
+
* The id of the workbook view this worksheet view belongs to.
|
|
767
|
+
*
|
|
768
|
+
* This is a zero-based index of the workbook view, as stored in the {@link Workbook.views} array.
|
|
769
|
+
*
|
|
770
|
+
* Within a single worksheet, each view must reference a distinct workbook view (i.e. no two views
|
|
771
|
+
* in the same worksheet can share the same `workbookView` id). However, views from different
|
|
772
|
+
* worksheets may reference the same workbook view.
|
|
773
|
+
*/
|
|
774
|
+
workbookView: integer;
|
|
775
|
+
/** Cell that is selected by default when the sheet is visible. */
|
|
776
|
+
activeCell?: CellId;
|
|
777
|
+
/** Ranges of cells that are selected by default when the sheet is visible. */
|
|
778
|
+
activeRanges?: CellRange[];
|
|
779
|
+
/**
|
|
780
|
+
* The layout used to display the worksheet.
|
|
781
|
+
*
|
|
782
|
+
* @defaultValue "normal"
|
|
783
|
+
*/
|
|
784
|
+
activeLayout?: 'normal' | 'pageLayout' | 'pageBreakPreview';
|
|
785
|
+
/**
|
|
786
|
+
* Scale (aka zoom level, aka magnification) applied when displaying a worksheet. Each different
|
|
787
|
+
* layout has its own scale.
|
|
788
|
+
*/
|
|
789
|
+
layoutScales?: WorksheetLayoutScales;
|
|
790
|
+
};
|
|
791
|
+
|
|
524
792
|
/**
|
|
525
793
|
* A rectangle of cells. A sheet within a spreadsheet.
|
|
526
794
|
*/
|
|
@@ -529,14 +797,16 @@ type Worksheet = {
|
|
|
529
797
|
name: string;
|
|
530
798
|
/** The cells belonging to the worksheet that have some data attached. */
|
|
531
799
|
cells: Record<CellId, Cell>;
|
|
800
|
+
comments?: ThreadedComment[];
|
|
801
|
+
notes?: Note[];
|
|
532
802
|
/** Widths and styles of the columns in the worksheet. */
|
|
533
|
-
columns
|
|
803
|
+
columns?: GridSize[];
|
|
534
804
|
/** Heights and styles of the rows in the worksheet. */
|
|
535
|
-
rows
|
|
805
|
+
rows?: GridSize[];
|
|
536
806
|
/** Ranges that capture which cells have been merged. */
|
|
537
|
-
merges
|
|
807
|
+
merges?: string[];
|
|
538
808
|
/** A collection of default properties that apply to cells, rows, or columns in the worksheet. */
|
|
539
|
-
defaults
|
|
809
|
+
defaults?: WorksheetDefaults;
|
|
540
810
|
/**
|
|
541
811
|
* Whether or not the sheet should be shown to a user in a UI displaying the workbook.
|
|
542
812
|
*
|
|
@@ -549,6 +819,30 @@ type Worksheet = {
|
|
|
549
819
|
hidden?: 0 | 1 | 2;
|
|
550
820
|
/** Indicates whether a hairline-grid should be drawn when displaying the sheet. */
|
|
551
821
|
showGridLines?: boolean;
|
|
822
|
+
/** The different display configurations saved for the worksheet. */
|
|
823
|
+
views?: WorksheetView[];
|
|
824
|
+
};
|
|
825
|
+
|
|
826
|
+
/**
|
|
827
|
+
* A workbook view.
|
|
828
|
+
*
|
|
829
|
+
* A workbook view is the display settings that apply to the entire workbook. Workbook view settings
|
|
830
|
+
* include:
|
|
831
|
+
*
|
|
832
|
+
* - Active sheet
|
|
833
|
+
* - Window size and position
|
|
834
|
+
* - Window state (whether the window is maximised, minimised, etc)
|
|
835
|
+
* - Scroll bar visibility
|
|
836
|
+
*
|
|
837
|
+
* Currently JSF does not include all available settings for a workbook.
|
|
838
|
+
*/
|
|
839
|
+
type WorkbookView = {
|
|
840
|
+
/**
|
|
841
|
+
* Index to the active sheet in this workbook view. The default value is 0 (first sheet).
|
|
842
|
+
*
|
|
843
|
+
* @defaultValue 0
|
|
844
|
+
*/
|
|
845
|
+
activeSheet?: integer;
|
|
552
846
|
};
|
|
553
847
|
|
|
554
848
|
/**
|
|
@@ -561,13 +855,13 @@ type Workbook = {
|
|
|
561
855
|
/** An ordered array of the worksheets in the workbook. */
|
|
562
856
|
sheets: Worksheet[];
|
|
563
857
|
/** An array of the workbook's defined names. */
|
|
564
|
-
names
|
|
858
|
+
names?: DefinedName[];
|
|
565
859
|
/** Metadata on the workbook's tables. */
|
|
566
|
-
tables
|
|
860
|
+
tables?: Table[];
|
|
567
861
|
/** Directions on how formulas should be recalculated in the workbook. */
|
|
568
862
|
calculationProperties?: CalcProps;
|
|
569
863
|
/** Styles for cells in the workbook. */
|
|
570
|
-
styles
|
|
864
|
+
styles?: Style[];
|
|
571
865
|
/** External cells referenced by the workbook. An external cell is a cell in another workbook. */
|
|
572
866
|
externals?: External[];
|
|
573
867
|
/**
|
|
@@ -576,6 +870,15 @@ type Workbook = {
|
|
|
576
870
|
* identical.
|
|
577
871
|
*/
|
|
578
872
|
formulas?: string[];
|
|
873
|
+
/** The different display configurations saved for the workbook. */
|
|
874
|
+
views?: WorkbookView[];
|
|
875
|
+
/**
|
|
876
|
+
* Individuals who have written a threaded comment in this workbook, or who have been mentioned in
|
|
877
|
+
* one.
|
|
878
|
+
*
|
|
879
|
+
* @see {@link ThreadedComment}
|
|
880
|
+
*/
|
|
881
|
+
people?: Person[];
|
|
579
882
|
};
|
|
580
883
|
|
|
581
|
-
export type { BorderStyle, CalcProps, Cell, CellId, CellRange, CellValueType, Color, Comment, DefinedName, External, ExternalWorksheet, GridSize, HAlign, PatternStyle, PixelValue, Style, Table, TableColumn, TableColumnDataType, TableStyle, TableStyleName, Underline, VAlign, Workbook, Worksheet, WorksheetDefaults };
|
|
884
|
+
export type { BorderStyle, CalcProps, Cell, CellId, CellRange, CellValueType, Color, Comment, DefinedName, External, ExternalWorksheet, GridSize, HAlign, HyperlinkTextRun, MentionTextRun, Note, PatternStyle, Person, PixelValue, Style, Table, TableColumn, TableColumnDataType, TableStyle, TableStyleName, TextRun, ThreadedComment, Underline, VAlign, Workbook, WorkbookView, Worksheet, WorksheetDefaults, WorksheetLayoutScales, WorksheetView };
|
package/package.json
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsfkit/types",
|
|
3
|
-
"version": "1.0
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "TypeScript types for JSF: a JSON spreadsheet representation",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "git+https://github.com/jsfkit/types.git"
|
|
10
10
|
},
|
|
11
|
+
"homepage": "https://jsfkit.github.io/types/",
|
|
12
|
+
"bugs": "https://github.com/jsfkit/types/issues",
|
|
11
13
|
"keywords": [
|
|
12
14
|
"excel",
|
|
13
15
|
"json",
|
|
@@ -31,6 +33,7 @@
|
|
|
31
33
|
],
|
|
32
34
|
"scripts": {
|
|
33
35
|
"build": "tsup",
|
|
36
|
+
"build:docs": "typedoc",
|
|
34
37
|
"check": "npm run lint && npm run typecheck",
|
|
35
38
|
"lint": "eslint src",
|
|
36
39
|
"format": "eslint src --fix",
|
|
@@ -43,6 +46,7 @@
|
|
|
43
46
|
"eslint": "^9.38.0",
|
|
44
47
|
"globals": "^16.4.0",
|
|
45
48
|
"tsup": "^8.5.0",
|
|
49
|
+
"typedoc": "^0.28.14",
|
|
46
50
|
"typescript": "^5.9.3",
|
|
47
51
|
"typescript-eslint": "^8.46.1"
|
|
48
52
|
}
|