@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.
- package/LICENSE +202 -0
- package/index.d.ts +2282 -0
- package/index.js +865 -0
- package/lexax.darwin-arm64.node +0 -0
- package/lexax.darwin-x64.node +0 -0
- package/lexax.linux-arm64-gnu.node +0 -0
- package/lexax.linux-x64-gnu.node +0 -0
- package/package.json +29 -4
- package/types/calc.d.ts +260 -0
- package/types/chart.d.ts +479 -0
- package/types/chart_ex.d.ts +379 -0
- package/types/chart_format.d.ts +440 -0
- package/types/chart_series.d.ts +336 -0
- package/types/drawings.d.ts +383 -0
- package/types/files.d.ts +367 -0
- package/types/formats.d.ts +380 -0
- package/types/page.d.ts +352 -0
- package/types/render.d.ts +137 -0
- package/types/sheet.d.ts +432 -0
- package/types/styles.d.ts +383 -0
- package/types/tables.d.ts +420 -0
- package/types/validation.d.ts +151 -0
- package/types/values.d.ts +280 -0
- package/README.md +0 -3
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
// Tables, their styles, PivotTables, and the slicers and timelines that
|
|
2
|
+
// filter them.
|
|
3
|
+
|
|
4
|
+
import type { ImagePosition, ImageRange } from './drawings';
|
|
5
|
+
import type { Border, Borders, Fill, Font, Style } from './styles';
|
|
6
|
+
import type { CellValue } from './values';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The style of a table: its colour theme, and whether the first and last columns are bold and the rows and
|
|
10
|
+
* columns are striped.
|
|
11
|
+
*/
|
|
12
|
+
export interface TableStyleProperties {
|
|
13
|
+
/**
|
|
14
|
+
* The table style: one of Excel's, `TableStyleLight1` to `21`, `TableStyleMedium1` to `28` and
|
|
15
|
+
* `TableStyleDark1` to `11`, or one of the workbook's own.
|
|
16
|
+
* @default 'TableStyleMedium2'
|
|
17
|
+
*/
|
|
18
|
+
theme?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Highlight the first column (bold)
|
|
21
|
+
* @default false
|
|
22
|
+
*/
|
|
23
|
+
showFirstColumn?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Highlight the last column (bold)
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
28
|
+
showLastColumn?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Alternate rows shown with background colour
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
showRowStripes?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Alternate columns shown with background colour
|
|
36
|
+
* @default false
|
|
37
|
+
*/
|
|
38
|
+
showColumnStripes?: boolean;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* A column of a table, as `addTable` and `Table.addColumn` take it.
|
|
43
|
+
*/
|
|
44
|
+
export interface TableColumnProperties {
|
|
45
|
+
/**
|
|
46
|
+
* The name of the column, also used in the header
|
|
47
|
+
*/
|
|
48
|
+
name: string;
|
|
49
|
+
/**
|
|
50
|
+
* Switches the filter control in the header; false hides it
|
|
51
|
+
* @default true
|
|
52
|
+
*/
|
|
53
|
+
filterButton?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Label to describe the totals row (first column)
|
|
56
|
+
* @default 'Total'
|
|
57
|
+
*/
|
|
58
|
+
totalsRowLabel?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Name of the totals function
|
|
61
|
+
* @default 'none'
|
|
62
|
+
*/
|
|
63
|
+
totalsRowFunction?: 'none' | 'average' | 'countNums' | 'count' | 'max' | 'min' | 'stdDev' | 'var' | 'sum' | 'custom';
|
|
64
|
+
/**
|
|
65
|
+
* Optional formula for custom functions
|
|
66
|
+
*/
|
|
67
|
+
totalsRowFormula?: string;
|
|
68
|
+
/**
|
|
69
|
+
* The formula a calculated column's data cells hold, which an empty cell
|
|
70
|
+
* of a row added takes
|
|
71
|
+
*/
|
|
72
|
+
calculatedColumnFormula?: string;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Styles applied to the column
|
|
76
|
+
*/
|
|
77
|
+
style?: Partial<Style>;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* The properties of a table, as `Worksheet.addTable` takes them: its name, range, rows, columns and style.
|
|
82
|
+
*/
|
|
83
|
+
export interface TableProperties {
|
|
84
|
+
/**
|
|
85
|
+
* The name of the table
|
|
86
|
+
*/
|
|
87
|
+
name: string;
|
|
88
|
+
/**
|
|
89
|
+
* The display name of the table, which formulas name it by. Without one,
|
|
90
|
+
* the name as Excel shows it: "Sales Data" as Sales_Data, T1 as T1_
|
|
91
|
+
*/
|
|
92
|
+
displayName?: string;
|
|
93
|
+
/**
|
|
94
|
+
* Top left cell of the table
|
|
95
|
+
*/
|
|
96
|
+
ref: string;
|
|
97
|
+
/**
|
|
98
|
+
* Show headers at top of table
|
|
99
|
+
* @default true
|
|
100
|
+
*/
|
|
101
|
+
headerRow?: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Show totals at bottom of table
|
|
104
|
+
* @default false
|
|
105
|
+
*/
|
|
106
|
+
totalsRow?: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Extra style properties
|
|
109
|
+
* @default {}
|
|
110
|
+
*/
|
|
111
|
+
style?: TableStyleProperties;
|
|
112
|
+
/**
|
|
113
|
+
* Column definitions
|
|
114
|
+
*/
|
|
115
|
+
columns: TableColumnProperties[];
|
|
116
|
+
/**
|
|
117
|
+
* Rows of data
|
|
118
|
+
*/
|
|
119
|
+
rows: any[][];
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* An element of a table, PivotTable, slicer or timeline style: the part of the table a format applies to,
|
|
124
|
+
* such as `headerRow` or `firstRowStripe`.
|
|
125
|
+
*/
|
|
126
|
+
export type TableStyleElementType =
|
|
127
|
+
| 'wholeTable' | 'headerRow' | 'totalRow' | 'firstColumn' | 'lastColumn'
|
|
128
|
+
| 'firstRowStripe' | 'secondRowStripe' | 'firstColumnStripe' | 'secondColumnStripe'
|
|
129
|
+
| 'firstHeaderCell' | 'lastHeaderCell' | 'firstTotalCell' | 'lastTotalCell'
|
|
130
|
+
| 'firstSubtotalColumn' | 'secondSubtotalColumn' | 'thirdSubtotalColumn'
|
|
131
|
+
| 'firstSubtotalRow' | 'secondSubtotalRow' | 'thirdSubtotalRow' | 'blankRow'
|
|
132
|
+
| 'firstColumnSubheading' | 'secondColumnSubheading' | 'thirdColumnSubheading'
|
|
133
|
+
| 'firstRowSubheading' | 'secondRowSubheading' | 'thirdRowSubheading'
|
|
134
|
+
| 'pageFieldLabels' | 'pageFieldValues'
|
|
135
|
+
/** a slicer style's ([MS-XLSX] ST_SlicerStyleType) */
|
|
136
|
+
| 'unselectedItemWithData' | 'selectedItemWithData' | 'unselectedItemWithNoData' | 'selectedItemWithNoData'
|
|
137
|
+
| 'hoveredUnselectedItemWithData' | 'hoveredSelectedItemWithData'
|
|
138
|
+
| 'hoveredUnselectedItemWithNoData' | 'hoveredSelectedItemWithNoData'
|
|
139
|
+
/** a timeline style's ([MS-XLSX] ST_TimelineStyleType) */
|
|
140
|
+
| 'selectionLabel' | 'timeLevel' | 'periodLabel1' | 'periodLabel2'
|
|
141
|
+
| 'selectedTimeBlock' | 'unselectedTimeBlock' | 'selectedTimeBlockSpace';
|
|
142
|
+
|
|
143
|
+
/** an element's format: the parts of a cell's style a table style sets */
|
|
144
|
+
export interface TableStyleFormat {
|
|
145
|
+
/**
|
|
146
|
+
* The font the element sets, in part.
|
|
147
|
+
*/
|
|
148
|
+
font?: Partial<Font>;
|
|
149
|
+
/**
|
|
150
|
+
* The fill the element sets.
|
|
151
|
+
*/
|
|
152
|
+
fill?: Fill;
|
|
153
|
+
/** with `vertical` and `horizontal`, the lines between the cells of the element */
|
|
154
|
+
border?: Partial<Borders> & {vertical?: Partial<Border>; horizontal?: Partial<Border>};
|
|
155
|
+
/**
|
|
156
|
+
* The number format the element sets.
|
|
157
|
+
*/
|
|
158
|
+
numFmt?: string;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* A table style, as `Workbook.getTableStyle` returns it: one of Excel's, or one of the workbook's own.
|
|
163
|
+
*/
|
|
164
|
+
export interface TableStyleDefinition {
|
|
165
|
+
/**
|
|
166
|
+
* The style's name.
|
|
167
|
+
*/
|
|
168
|
+
name: string;
|
|
169
|
+
/** one of Excel's, written by its name alone */
|
|
170
|
+
builtIn: boolean;
|
|
171
|
+
/** whether a table can take it */
|
|
172
|
+
table: boolean;
|
|
173
|
+
/** whether a PivotTable can take it */
|
|
174
|
+
pivot: boolean;
|
|
175
|
+
/** whether a slicer can take it; a built-in table or PivotTable style's has no such flag */
|
|
176
|
+
slicer?: boolean;
|
|
177
|
+
/** whether a timeline can take it */
|
|
178
|
+
timeline?: boolean;
|
|
179
|
+
/**
|
|
180
|
+
* The format of each element of the style, and for a stripe its size in rows or columns.
|
|
181
|
+
*/
|
|
182
|
+
elements: {[type in TableStyleElementType]?: {format: TableStyleFormat; size?: number}};
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* The options of `addTableStyle`: the format of each element, and what the style can be applied to.
|
|
187
|
+
*/
|
|
188
|
+
export interface TableStyleOptions {
|
|
189
|
+
/** each element's format; a stripe's `size`, 1 to 9 rows or columns */
|
|
190
|
+
elements: {[type in TableStyleElementType]?: TableStyleFormat & {size?: number}};
|
|
191
|
+
/** a table can take it; true unless false, or unless a slicer or timeline style */
|
|
192
|
+
table?: boolean;
|
|
193
|
+
/** a PivotTable can take it; false unless true */
|
|
194
|
+
pivot?: boolean;
|
|
195
|
+
/** a slicer can take it: its elements wholeTable, headerRow and a slicer's (selectedItemWithData, ...) */
|
|
196
|
+
slicer?: boolean;
|
|
197
|
+
/** a timeline can take it: its elements wholeTable, headerRow and a timeline's (selectedTimeBlock, ...) */
|
|
198
|
+
timeline?: boolean;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/** How a PivotTable's value summarises its field (Excel's dataField subtotal) */
|
|
202
|
+
export type PivotFunction =
|
|
203
|
+
| 'sum' | 'count' | 'average' | 'max' | 'min' | 'product' | 'countNums'
|
|
204
|
+
| 'stdDev' | 'stdDevp' | 'var' | 'varp';
|
|
205
|
+
|
|
206
|
+
/** How a PivotTable shows a value; the last six are [MS-XLSX]'s */
|
|
207
|
+
export type PivotShowAs =
|
|
208
|
+
| 'normal' | 'difference' | 'percent' | 'percentDiff' | 'runTotal' | 'percentOfRow'
|
|
209
|
+
| 'percentOfCol' | 'percentOfTotal' | 'index' | 'percentOfParentRow' | 'percentOfParentCol'
|
|
210
|
+
| 'percentOfParent' | 'percentOfRunningTotal' | 'rankAscending' | 'rankDescending';
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* A value of a PivotTable: a field summarised by a function, as `addValue` and `PivotTableOptions.values`
|
|
214
|
+
* take it.
|
|
215
|
+
*/
|
|
216
|
+
export interface PivotValueOptions {
|
|
217
|
+
/** the source's field, by its header */
|
|
218
|
+
field: string;
|
|
219
|
+
/** sum by default */
|
|
220
|
+
function?: PivotFunction;
|
|
221
|
+
/** Sum of Revenue and the like by default; no field's name */
|
|
222
|
+
name?: string;
|
|
223
|
+
/**
|
|
224
|
+
* How the value is shown: `normal`, or one of Excel's ways of showing a value, such as `percentOfTotal` or
|
|
225
|
+
* `rankDescending`.
|
|
226
|
+
*/
|
|
227
|
+
showAs?: PivotShowAs;
|
|
228
|
+
/** the field a difference, share, running total or rank is against */
|
|
229
|
+
baseField?: string;
|
|
230
|
+
/** the item of baseField a difference or share is against */
|
|
231
|
+
baseItem?: string | number | Date | 'previous' | 'next';
|
|
232
|
+
/** the values' number format */
|
|
233
|
+
numFmt?: string;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* The options of `Worksheet.addPivotTable`: its source, fields, values, layout, position and style.
|
|
238
|
+
*/
|
|
239
|
+
export interface PivotTableOptions {
|
|
240
|
+
/** a range with its sheet (Data!A1:E100), a sheet by name and a range of it, a table or a defined name */
|
|
241
|
+
source?: string | {sheet: string; ref: string} | {table: string} | {name: string};
|
|
242
|
+
/** the fields down the rows; 'Values' places the values among them */
|
|
243
|
+
rows?: string[];
|
|
244
|
+
/** the fields across the columns; 'Values' places the values among them */
|
|
245
|
+
columns?: string[];
|
|
246
|
+
/** the page fields above the table, each with all its items or one */
|
|
247
|
+
filters?: Array<string | {field: string; item?: string | number | Date | boolean}>;
|
|
248
|
+
/**
|
|
249
|
+
* The values the table summarises, each by a field's name or by its options.
|
|
250
|
+
*/
|
|
251
|
+
values?: Array<string | PivotValueOptions>;
|
|
252
|
+
/** with several values, where they go unless placed: columns by default */
|
|
253
|
+
valuesOn?: 'rows' | 'columns';
|
|
254
|
+
/** the table's top left, page fields above it; A3 by default */
|
|
255
|
+
ref?: string;
|
|
256
|
+
/** PivotTable1, the lowest number free, by default */
|
|
257
|
+
name?: string;
|
|
258
|
+
/**
|
|
259
|
+
* The report layout: `compact`, `outline` or `tabular`.
|
|
260
|
+
*/
|
|
261
|
+
layout?: 'compact' | 'outline' | 'tabular';
|
|
262
|
+
/** each field's subtotals: at the top of its group (compact and outline), below it, or none */
|
|
263
|
+
subtotals?: 'top' | 'bottom' | false;
|
|
264
|
+
/**
|
|
265
|
+
* Whether the table shows grand totals: `rows` for the column of totals at the right, `columns` for the row
|
|
266
|
+
* under the table.
|
|
267
|
+
*/
|
|
268
|
+
grandTotals?: {rows?: boolean; columns?: boolean};
|
|
269
|
+
/** each item's label on every row of its group, in outline and tabular form */
|
|
270
|
+
repeatLabels?: boolean;
|
|
271
|
+
/** one of Excel's pivot styles; PivotStyleLight16 by default */
|
|
272
|
+
style?: string;
|
|
273
|
+
/** the old form's function, sum */
|
|
274
|
+
metric?: 'sum';
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* The options of `Worksheet.addSlicer` for a slicer on a table's column.
|
|
279
|
+
*/
|
|
280
|
+
export interface TableSlicerOptions {
|
|
281
|
+
/** the table, by its displayName */
|
|
282
|
+
table: string;
|
|
283
|
+
/** the column whose values the slicer's buttons are */
|
|
284
|
+
column: string;
|
|
285
|
+
/** where its frame sits: the same forms a chart's range takes */
|
|
286
|
+
range: string | ({editAs?: string} & ImageRange) | ({editAs?: string} & ImagePosition);
|
|
287
|
+
/** unique in the workbook; the column's name by default, with a number after it where taken */
|
|
288
|
+
name?: string;
|
|
289
|
+
/** the heading shown; the column's name by default */
|
|
290
|
+
caption?: string;
|
|
291
|
+
/** one of Excel's: SlicerStyleLight1-6, SlicerStyleOther1-2, SlicerStyleDark1-6 */
|
|
292
|
+
style?: string;
|
|
293
|
+
/** the columns of buttons, 1 by default */
|
|
294
|
+
columns?: number;
|
|
295
|
+
/**
|
|
296
|
+
* Slicer Settings: items with no data not marked ('none'), marked where
|
|
297
|
+
* they are ('showItemsWithNoData'), or marked and listed last
|
|
298
|
+
* ('showItemsWithDataAtTop', the default)
|
|
299
|
+
*/
|
|
300
|
+
crossFilter?: 'none' | 'showItemsWithDataAtTop' | 'showItemsWithNoData';
|
|
301
|
+
/** Slicer Settings: hide items with no data; crossFilter then keeps its default */
|
|
302
|
+
hideItemsWithNoData?: boolean;
|
|
303
|
+
/** Slicer Settings: the items' order, ascending by default */
|
|
304
|
+
sort?: 'ascending' | 'descending';
|
|
305
|
+
/** Slicer Settings: false to order the items without Excel's custom lists (Jan, Feb, ...) */
|
|
306
|
+
customListSort?: boolean;
|
|
307
|
+
/** Slicer Settings: false to hide the header (Display header) */
|
|
308
|
+
header?: boolean;
|
|
309
|
+
/** Size and Properties: true to disable resizing and moving */
|
|
310
|
+
lockedPosition?: boolean;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/** a PivotTable's slicer: TableSlicerOptions but the PivotTable and its field for the table and column */
|
|
314
|
+
export type PivotSlicerOptions = Omit<TableSlicerOptions, 'table' | 'column'> & {
|
|
315
|
+
/** the PivotTable, by its name */
|
|
316
|
+
pivotTable: string;
|
|
317
|
+
/** a field of its source, by its name */
|
|
318
|
+
field: string;
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
/** a PivotTable's timeline: a pivot slicer's options but its buttons', and a time level and what it shows */
|
|
322
|
+
export type PivotTimelineOptions = Omit<PivotSlicerOptions, 'style' | 'columns'> & {
|
|
323
|
+
/** one of Excel's: TimeSlicerStyleLight1-6, TimeSlicerStyleDark1-6 */
|
|
324
|
+
style?: string;
|
|
325
|
+
/** the time level it shows and selects at, months by default */
|
|
326
|
+
level?: 'years' | 'quarters' | 'months' | 'days';
|
|
327
|
+
/** false hides the header, as Timeline Options > Show does */
|
|
328
|
+
header?: boolean;
|
|
329
|
+
/** false hides the selection label */
|
|
330
|
+
selectionLabel?: boolean;
|
|
331
|
+
/** false hides the time level */
|
|
332
|
+
timeLevel?: boolean;
|
|
333
|
+
/** false hides the scrollbar */
|
|
334
|
+
scrollbar?: boolean;
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* The areas of a PivotTable `PivotTable.setFields` sets, each a list of fields by name or place; an area left
|
|
339
|
+
* out stays as it is.
|
|
340
|
+
*/
|
|
341
|
+
export interface PivotFields {
|
|
342
|
+
/**
|
|
343
|
+
* The row fields, outermost first.
|
|
344
|
+
*/
|
|
345
|
+
rows?: Array<string | number>;
|
|
346
|
+
/**
|
|
347
|
+
* The column fields, outermost first.
|
|
348
|
+
*/
|
|
349
|
+
columns?: Array<string | number>;
|
|
350
|
+
/**
|
|
351
|
+
* The page fields, which filter the whole table.
|
|
352
|
+
*/
|
|
353
|
+
filters?: Array<string | number>;
|
|
354
|
+
/**
|
|
355
|
+
* The values: a field, summed, or a value's options.
|
|
356
|
+
*/
|
|
357
|
+
values?: Array<string | PivotValueOptions>;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* How `PivotTable.groupField` groups a field's items: numbers by a size, dates by units of time.
|
|
362
|
+
*/
|
|
363
|
+
export interface PivotGroupOptions {
|
|
364
|
+
/**
|
|
365
|
+
* The size of each group of numbers, or the units of time (`days`, `months`, `quarters`, `years`, ...)
|
|
366
|
+
* dates are grouped by; `months` where none is given.
|
|
367
|
+
*/
|
|
368
|
+
by?: number | string | string[];
|
|
369
|
+
/**
|
|
370
|
+
* The first value grouped; the smallest item where none is given.
|
|
371
|
+
*/
|
|
372
|
+
start?: number | Date;
|
|
373
|
+
/**
|
|
374
|
+
* The last value grouped; the largest item where none is given.
|
|
375
|
+
*/
|
|
376
|
+
end?: number | Date;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* A Label Filter of a PivotTable field, by its name in ST_PivotFilterType less the `caption` prefix.
|
|
381
|
+
*/
|
|
382
|
+
export type PivotLabelFilter =
|
|
383
|
+
| 'equal' | 'notEqual' | 'beginsWith' | 'notBeginsWith' | 'endsWith' | 'notEndsWith' | 'contains'
|
|
384
|
+
| 'notContains' | 'greaterThan' | 'greaterThanOrEqual' | 'lessThan' | 'lessThanOrEqual' | 'between'
|
|
385
|
+
| 'notBetween';
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* A Value Filter of a PivotTable field, by its name in ST_PivotFilterType less the `value` prefix.
|
|
389
|
+
*/
|
|
390
|
+
export type PivotValueFilter =
|
|
391
|
+
| 'equal' | 'notEqual' | 'greaterThan' | 'greaterThanOrEqual' | 'lessThan' | 'lessThanOrEqual' | 'between'
|
|
392
|
+
| 'notBetween';
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* A page field of a PivotTable, as `PivotTable.filters` gives it.
|
|
396
|
+
*/
|
|
397
|
+
export interface PivotFilter {
|
|
398
|
+
/**
|
|
399
|
+
* The field's name.
|
|
400
|
+
*/
|
|
401
|
+
field: string;
|
|
402
|
+
/**
|
|
403
|
+
* The item it shows; absent where it shows all.
|
|
404
|
+
*/
|
|
405
|
+
item?: CellValue;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* A cell a PivotTable shows, as `PivotTable.cells` gives it.
|
|
410
|
+
*/
|
|
411
|
+
export interface PivotCell {
|
|
412
|
+
/**
|
|
413
|
+
* The cell's address.
|
|
414
|
+
*/
|
|
415
|
+
address: string;
|
|
416
|
+
/**
|
|
417
|
+
* The value it shows.
|
|
418
|
+
*/
|
|
419
|
+
value: CellValue;
|
|
420
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
// Data validation: a cell's rule as the file holds it, and what
|
|
2
|
+
// addValidation, addConditionalFormat and setNumberFormat apply to.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The comparison a data validation rule makes: `between` or `notBetween` two values, or `equal`, `notEqual`,
|
|
6
|
+
* `greaterThan`, `lessThan`, `greaterThanOrEqual` or `lessThanOrEqual` a value. Used by `DataValidation`.
|
|
7
|
+
*/
|
|
8
|
+
export type DataValidationOperator =
|
|
9
|
+
| 'between' | 'notBetween' | 'equal' | 'notEqual' | 'greaterThan' | 'lessThan'
|
|
10
|
+
| 'greaterThanOrEqual' | 'lessThanOrEqual';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* A data validation rule for a cell: the type of value it accepts, and the messages shown with it. Set with
|
|
14
|
+
* `Cell.dataValidation`.
|
|
15
|
+
*/
|
|
16
|
+
export interface DataValidation {
|
|
17
|
+
/**
|
|
18
|
+
* The type of value the rule accepts: `any` value, a `list` of values, a `whole` number, a `decimal`, a
|
|
19
|
+
* `date`, a `time`, the length of text (`textLength`), or a value that a formula accepts (`custom`).
|
|
20
|
+
*/
|
|
21
|
+
type: 'any' | 'list' | 'whole' | 'decimal' | 'date' | 'time' | 'textLength' | 'custom';
|
|
22
|
+
/**
|
|
23
|
+
* The values the rule compares with, in order: one for most operators, and two for `between` and
|
|
24
|
+
* `notBetween`. A list gives its items as one quoted, comma-separated text, or as a range. A custom rule
|
|
25
|
+
* gives a formula that returns true or false.
|
|
26
|
+
*/
|
|
27
|
+
formulae: any[];
|
|
28
|
+
/** Excel's "Ignore blank" */
|
|
29
|
+
allowBlank?: boolean;
|
|
30
|
+
/** true hides a list's in-cell arrow */
|
|
31
|
+
showDropDown?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* The input method editor mode for the cell, for East Asian text input.
|
|
34
|
+
*/
|
|
35
|
+
imeMode?: 'noControl' | 'off' | 'on' | 'disabled' | 'hiragana' | 'fullKatakana' | 'halfKatakana'
|
|
36
|
+
| 'fullAlpha' | 'halfAlpha' | 'fullHangul' | 'halfHangul';
|
|
37
|
+
/** Excel's revision id, kept as read */
|
|
38
|
+
uid?: string;
|
|
39
|
+
/**
|
|
40
|
+
* The comparison the rule makes, for the `whole`, `decimal`, `date`, `time` and `textLength` kinds.
|
|
41
|
+
*/
|
|
42
|
+
operator?: DataValidationOperator;
|
|
43
|
+
/**
|
|
44
|
+
* The text of the message shown when a value is refused.
|
|
45
|
+
*/
|
|
46
|
+
error?: string;
|
|
47
|
+
/**
|
|
48
|
+
* The title of the message shown when a value is refused.
|
|
49
|
+
*/
|
|
50
|
+
errorTitle?: string;
|
|
51
|
+
/**
|
|
52
|
+
* The type of error message: `stop`, `warning` or `information`.
|
|
53
|
+
*/
|
|
54
|
+
errorStyle?: string;
|
|
55
|
+
/**
|
|
56
|
+
* The text of the input message shown when the cell is selected.
|
|
57
|
+
*/
|
|
58
|
+
prompt?: string;
|
|
59
|
+
/**
|
|
60
|
+
* The title of the input message shown when the cell is selected.
|
|
61
|
+
*/
|
|
62
|
+
promptTitle?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Whether an error message is shown when a value is refused.
|
|
65
|
+
*/
|
|
66
|
+
showErrorMessage?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Whether the input message is shown when the cell is selected.
|
|
69
|
+
*/
|
|
70
|
+
showInputMessage?: boolean;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* A table's column, which setNumberFormat, addConditionalFormat and addValidation may apply to.
|
|
75
|
+
*/
|
|
76
|
+
export interface TableColumnTarget {
|
|
77
|
+
/**
|
|
78
|
+
* The table's name.
|
|
79
|
+
*/
|
|
80
|
+
table: string;
|
|
81
|
+
/**
|
|
82
|
+
* The column's header.
|
|
83
|
+
*/
|
|
84
|
+
column?: string;
|
|
85
|
+
/**
|
|
86
|
+
* The column's header, where `column` is not given.
|
|
87
|
+
*/
|
|
88
|
+
header?: string;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** What setNumberFormat, addConditionalFormat and addValidation apply to: a range such as `B2:B20`, or a table's column */
|
|
92
|
+
export type IntentTarget = string | TableColumnTarget;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* The type of data validation rule `addValidation` adds: `list`, `wholeNumber`, `decimal`, `date`,
|
|
96
|
+
* `textLength` or `custom`.
|
|
97
|
+
*/
|
|
98
|
+
export type ValidationIntent = 'list' | 'wholeNumber' | 'decimal' | 'date' | 'textLength' | 'custom';
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* The options of `addValidation`, which apply to the type of rule given.
|
|
102
|
+
*/
|
|
103
|
+
export interface ValidationOptions {
|
|
104
|
+
/** a list's values, typed into the validation (255 characters at most, no commas) */
|
|
105
|
+
values?: Array<string | number>;
|
|
106
|
+
/** a list's range */
|
|
107
|
+
range?: string;
|
|
108
|
+
/** a list of a table's column, which follows the table */
|
|
109
|
+
table?: string;
|
|
110
|
+
/**
|
|
111
|
+
* The column of the `table` that a `list` rule reads its values from.
|
|
112
|
+
*/
|
|
113
|
+
column?: string;
|
|
114
|
+
/** false hides a list's in-cell arrow */
|
|
115
|
+
dropdown?: boolean;
|
|
116
|
+
/**
|
|
117
|
+
* The lowest value a `wholeNumber`, `decimal` or `textLength` rule allows.
|
|
118
|
+
*/
|
|
119
|
+
min?: number;
|
|
120
|
+
/**
|
|
121
|
+
* The highest value a `wholeNumber`, `decimal` or `textLength` rule allows.
|
|
122
|
+
*/
|
|
123
|
+
max?: number;
|
|
124
|
+
/** a date's first and last allowed, a Date or an ISO date: Excel's Start date and End date, included */
|
|
125
|
+
start?: Date | string;
|
|
126
|
+
/**
|
|
127
|
+
* The last date a `date` rule allows, that day included, as a Date or an ISO date.
|
|
128
|
+
*/
|
|
129
|
+
end?: Date | string;
|
|
130
|
+
/** a date the value must be after, or before, that day itself refused (greaterThan, lessThan); one of them, not with start or end */
|
|
131
|
+
after?: Date | string;
|
|
132
|
+
/**
|
|
133
|
+
* The date a `date` rule's value must come before, with that day itself refused.
|
|
134
|
+
*/
|
|
135
|
+
before?: Date | string;
|
|
136
|
+
/**
|
|
137
|
+
* The formula a `custom` rule tests, such as `=COUNTIF(Sales[Region],H2)=1`.
|
|
138
|
+
*/
|
|
139
|
+
formula?: string;
|
|
140
|
+
/**
|
|
141
|
+
* The message shown when the cell is selected: a title and its text.
|
|
142
|
+
*/
|
|
143
|
+
prompt?: {title?: string; text: string};
|
|
144
|
+
/**
|
|
145
|
+
* The message shown when a value is refused: a title, its text, and its `style`, `stop`, `warning` or
|
|
146
|
+
* `information`.
|
|
147
|
+
*/
|
|
148
|
+
error?: {title?: string; text: string; style?: 'stop' | 'warning' | 'information'};
|
|
149
|
+
/** Excel's "Ignore blank", true by default */
|
|
150
|
+
allowBlank?: boolean;
|
|
151
|
+
}
|