@trebco/treb 23.6.2 → 25.0.0-rc1

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.
Files changed (217) hide show
  1. package/.eslintignore +8 -0
  2. package/.eslintrc.js +164 -0
  3. package/README-shadow-DOM.md +88 -0
  4. package/README.md +37 -130
  5. package/api-config.json +29 -0
  6. package/api-generator/api-generator-types.ts +82 -0
  7. package/api-generator/api-generator.ts +1172 -0
  8. package/api-generator/package.json +3 -0
  9. package/build/treb-spreadsheet.mjs +14 -0
  10. package/{treb.d.ts → build/treb.d.ts} +293 -299
  11. package/esbuild-custom-element.mjs +336 -0
  12. package/esbuild.js +305 -0
  13. package/package.json +43 -14
  14. package/treb-base-types/package.json +5 -0
  15. package/treb-base-types/src/api_types.ts +36 -0
  16. package/treb-base-types/src/area.ts +583 -0
  17. package/treb-base-types/src/basic_types.ts +45 -0
  18. package/treb-base-types/src/cell.ts +612 -0
  19. package/treb-base-types/src/cells.ts +1066 -0
  20. package/treb-base-types/src/color.ts +124 -0
  21. package/treb-base-types/src/import.ts +71 -0
  22. package/treb-base-types/src/index-standalone.ts +29 -0
  23. package/treb-base-types/src/index.ts +42 -0
  24. package/treb-base-types/src/layout.ts +47 -0
  25. package/treb-base-types/src/localization.ts +187 -0
  26. package/treb-base-types/src/rectangle.ts +145 -0
  27. package/treb-base-types/src/render_text.ts +72 -0
  28. package/treb-base-types/src/style.ts +545 -0
  29. package/treb-base-types/src/table.ts +109 -0
  30. package/treb-base-types/src/text_part.ts +54 -0
  31. package/treb-base-types/src/theme.ts +608 -0
  32. package/treb-base-types/src/union.ts +152 -0
  33. package/treb-base-types/src/value-type.ts +164 -0
  34. package/treb-base-types/style/resizable.css +59 -0
  35. package/treb-calculator/modern.tsconfig.json +11 -0
  36. package/treb-calculator/package.json +5 -0
  37. package/treb-calculator/src/calculator.ts +2546 -0
  38. package/treb-calculator/src/complex-math.ts +558 -0
  39. package/treb-calculator/src/dag/array-vertex.ts +198 -0
  40. package/treb-calculator/src/dag/graph.ts +951 -0
  41. package/treb-calculator/src/dag/leaf_vertex.ts +118 -0
  42. package/treb-calculator/src/dag/spreadsheet_vertex.ts +327 -0
  43. package/treb-calculator/src/dag/spreadsheet_vertex_base.ts +44 -0
  44. package/treb-calculator/src/dag/vertex.ts +352 -0
  45. package/treb-calculator/src/descriptors.ts +162 -0
  46. package/treb-calculator/src/expression-calculator.ts +1069 -0
  47. package/treb-calculator/src/function-error.ts +103 -0
  48. package/treb-calculator/src/function-library.ts +103 -0
  49. package/treb-calculator/src/functions/base-functions.ts +1214 -0
  50. package/treb-calculator/src/functions/checkbox.ts +164 -0
  51. package/treb-calculator/src/functions/complex-functions.ts +253 -0
  52. package/treb-calculator/src/functions/finance-functions.ts +399 -0
  53. package/treb-calculator/src/functions/information-functions.ts +102 -0
  54. package/treb-calculator/src/functions/matrix-functions.ts +182 -0
  55. package/treb-calculator/src/functions/sparkline.ts +335 -0
  56. package/treb-calculator/src/functions/statistics-functions.ts +350 -0
  57. package/treb-calculator/src/functions/text-functions.ts +298 -0
  58. package/treb-calculator/src/index.ts +27 -0
  59. package/treb-calculator/src/notifier-types.ts +59 -0
  60. package/treb-calculator/src/primitives.ts +428 -0
  61. package/treb-calculator/src/utilities.ts +305 -0
  62. package/treb-charts/package.json +5 -0
  63. package/treb-charts/src/chart-functions.ts +156 -0
  64. package/treb-charts/src/chart-types.ts +230 -0
  65. package/treb-charts/src/chart.ts +1288 -0
  66. package/treb-charts/src/index.ts +24 -0
  67. package/treb-charts/src/main.ts +37 -0
  68. package/treb-charts/src/rectangle.ts +52 -0
  69. package/treb-charts/src/renderer.ts +1841 -0
  70. package/treb-charts/src/util.ts +122 -0
  71. package/treb-charts/style/charts.scss +221 -0
  72. package/treb-charts/style/old-charts.scss +250 -0
  73. package/treb-embed/markup/layout.html +137 -0
  74. package/treb-embed/markup/toolbar.html +175 -0
  75. package/treb-embed/modern.tsconfig.json +25 -0
  76. package/treb-embed/src/custom-element/content-types.d.ts +18 -0
  77. package/treb-embed/src/custom-element/global.d.ts +11 -0
  78. package/treb-embed/src/custom-element/spreadsheet-constructor.ts +1227 -0
  79. package/treb-embed/src/custom-element/treb-global.ts +44 -0
  80. package/treb-embed/src/custom-element/treb-spreadsheet-element.ts +52 -0
  81. package/treb-embed/src/embedded-spreadsheet.ts +5362 -0
  82. package/treb-embed/src/index.ts +16 -0
  83. package/treb-embed/src/language-model.ts +41 -0
  84. package/treb-embed/src/options.ts +320 -0
  85. package/treb-embed/src/progress-dialog.ts +228 -0
  86. package/treb-embed/src/selection-state.ts +16 -0
  87. package/treb-embed/src/spinner.ts +42 -0
  88. package/treb-embed/src/toolbar-message.ts +96 -0
  89. package/treb-embed/src/types.ts +167 -0
  90. package/treb-embed/style/autocomplete.scss +103 -0
  91. package/treb-embed/style/dark-theme.scss +114 -0
  92. package/treb-embed/style/defaults.scss +36 -0
  93. package/treb-embed/style/dialog.scss +181 -0
  94. package/treb-embed/style/dropdown-select.scss +101 -0
  95. package/treb-embed/style/formula-bar.scss +193 -0
  96. package/treb-embed/style/grid.scss +374 -0
  97. package/treb-embed/style/layout.scss +424 -0
  98. package/treb-embed/style/mouse-mask.scss +67 -0
  99. package/treb-embed/style/note.scss +92 -0
  100. package/treb-embed/style/overlay-editor.scss +102 -0
  101. package/treb-embed/style/spinner.scss +92 -0
  102. package/treb-embed/style/tab-bar.scss +228 -0
  103. package/treb-embed/style/table.scss +80 -0
  104. package/treb-embed/style/theme-defaults.scss +444 -0
  105. package/treb-embed/style/toolbar.scss +416 -0
  106. package/treb-embed/style/tooltip.scss +68 -0
  107. package/treb-embed/style/treb-icons.scss +130 -0
  108. package/treb-embed/style/treb-spreadsheet-element.scss +20 -0
  109. package/treb-embed/style/z-index.scss +43 -0
  110. package/treb-export/docs/charts.md +68 -0
  111. package/treb-export/modern.tsconfig.json +19 -0
  112. package/treb-export/package.json +4 -0
  113. package/treb-export/src/address-type.ts +77 -0
  114. package/treb-export/src/base-template.ts +22 -0
  115. package/treb-export/src/column-width.ts +85 -0
  116. package/treb-export/src/drawing2/chart-template-components2.ts +389 -0
  117. package/treb-export/src/drawing2/chart2.ts +282 -0
  118. package/treb-export/src/drawing2/column-chart-template2.ts +521 -0
  119. package/treb-export/src/drawing2/donut-chart-template2.ts +296 -0
  120. package/treb-export/src/drawing2/drawing2.ts +355 -0
  121. package/treb-export/src/drawing2/embedded-image.ts +71 -0
  122. package/treb-export/src/drawing2/scatter-chart-template2.ts +555 -0
  123. package/treb-export/src/export-worker/export-worker.ts +99 -0
  124. package/treb-export/src/export-worker/index-modern.ts +22 -0
  125. package/treb-export/src/export2.ts +2204 -0
  126. package/treb-export/src/import2.ts +882 -0
  127. package/treb-export/src/relationship.ts +36 -0
  128. package/treb-export/src/shared-strings2.ts +128 -0
  129. package/treb-export/src/template-2.ts +22 -0
  130. package/treb-export/src/unescape_xml.ts +47 -0
  131. package/treb-export/src/workbook-sheet2.ts +182 -0
  132. package/treb-export/src/workbook-style2.ts +1285 -0
  133. package/treb-export/src/workbook-theme2.ts +88 -0
  134. package/treb-export/src/workbook2.ts +491 -0
  135. package/treb-export/src/xml-utils.ts +201 -0
  136. package/treb-export/template/base/[Content_Types].xml +2 -0
  137. package/treb-export/template/base/_rels/.rels +2 -0
  138. package/treb-export/template/base/docProps/app.xml +2 -0
  139. package/treb-export/template/base/docProps/core.xml +12 -0
  140. package/treb-export/template/base/xl/_rels/workbook.xml.rels +2 -0
  141. package/treb-export/template/base/xl/sharedStrings.xml +2 -0
  142. package/treb-export/template/base/xl/styles.xml +2 -0
  143. package/treb-export/template/base/xl/theme/theme1.xml +2 -0
  144. package/treb-export/template/base/xl/workbook.xml +2 -0
  145. package/treb-export/template/base/xl/worksheets/sheet1.xml +2 -0
  146. package/treb-export/template/base.xlsx +0 -0
  147. package/treb-format/package.json +8 -0
  148. package/treb-format/src/format.test.ts +213 -0
  149. package/treb-format/src/format.ts +942 -0
  150. package/treb-format/src/format_cache.ts +199 -0
  151. package/treb-format/src/format_parser.ts +723 -0
  152. package/treb-format/src/index.ts +25 -0
  153. package/treb-format/src/number_format_section.ts +100 -0
  154. package/treb-format/src/value_parser.ts +337 -0
  155. package/treb-grid/package.json +5 -0
  156. package/treb-grid/src/editors/autocomplete.ts +394 -0
  157. package/treb-grid/src/editors/autocomplete_matcher.ts +260 -0
  158. package/treb-grid/src/editors/formula_bar.ts +473 -0
  159. package/treb-grid/src/editors/formula_editor_base.ts +910 -0
  160. package/treb-grid/src/editors/overlay_editor.ts +511 -0
  161. package/treb-grid/src/index.ts +37 -0
  162. package/treb-grid/src/layout/base_layout.ts +2618 -0
  163. package/treb-grid/src/layout/grid_layout.ts +299 -0
  164. package/treb-grid/src/layout/rectangle_cache.ts +86 -0
  165. package/treb-grid/src/render/selection-renderer.ts +414 -0
  166. package/treb-grid/src/render/svg_header_overlay.ts +93 -0
  167. package/treb-grid/src/render/svg_selection_block.ts +187 -0
  168. package/treb-grid/src/render/tile_renderer.ts +2122 -0
  169. package/treb-grid/src/types/annotation.ts +216 -0
  170. package/treb-grid/src/types/border_constants.ts +34 -0
  171. package/treb-grid/src/types/clipboard_data.ts +31 -0
  172. package/treb-grid/src/types/data_model.ts +334 -0
  173. package/treb-grid/src/types/drag_mask.ts +81 -0
  174. package/treb-grid/src/types/grid.ts +7743 -0
  175. package/treb-grid/src/types/grid_base.ts +3644 -0
  176. package/treb-grid/src/types/grid_command.ts +470 -0
  177. package/treb-grid/src/types/grid_events.ts +124 -0
  178. package/treb-grid/src/types/grid_options.ts +97 -0
  179. package/treb-grid/src/types/grid_selection.ts +60 -0
  180. package/treb-grid/src/types/named_range.ts +369 -0
  181. package/treb-grid/src/types/scale-control.ts +202 -0
  182. package/treb-grid/src/types/serialize_options.ts +72 -0
  183. package/treb-grid/src/types/set_range_options.ts +52 -0
  184. package/treb-grid/src/types/sheet.ts +3099 -0
  185. package/treb-grid/src/types/sheet_types.ts +95 -0
  186. package/treb-grid/src/types/tab_bar.ts +464 -0
  187. package/treb-grid/src/types/tile.ts +59 -0
  188. package/treb-grid/src/types/update_flags.ts +75 -0
  189. package/treb-grid/src/util/dom_utilities.ts +44 -0
  190. package/treb-grid/src/util/fontmetrics2.ts +179 -0
  191. package/treb-grid/src/util/ua.ts +104 -0
  192. package/treb-logo.svg +18 -0
  193. package/treb-parser/package.json +5 -0
  194. package/treb-parser/src/csv-parser.ts +122 -0
  195. package/treb-parser/src/index.ts +25 -0
  196. package/treb-parser/src/md-parser.ts +526 -0
  197. package/treb-parser/src/parser-types.ts +397 -0
  198. package/treb-parser/src/parser.test.ts +298 -0
  199. package/treb-parser/src/parser.ts +2673 -0
  200. package/treb-utils/package.json +5 -0
  201. package/treb-utils/src/dispatch.ts +57 -0
  202. package/treb-utils/src/event_source.ts +147 -0
  203. package/treb-utils/src/ievent_source.ts +33 -0
  204. package/treb-utils/src/index.ts +31 -0
  205. package/treb-utils/src/measurement.ts +174 -0
  206. package/treb-utils/src/resizable.ts +160 -0
  207. package/treb-utils/src/scale.ts +137 -0
  208. package/treb-utils/src/serialize_html.ts +124 -0
  209. package/treb-utils/src/template.ts +70 -0
  210. package/treb-utils/src/validate_uri.ts +61 -0
  211. package/tsconfig.json +10 -0
  212. package/tsproject.json +30 -0
  213. package/util/license-plugin-esbuild.js +86 -0
  214. package/util/list-css-vars.sh +46 -0
  215. package/README-esm.md +0 -37
  216. package/treb-bundle.css +0 -2
  217. package/treb-bundle.mjs +0 -15
@@ -1,100 +1,229 @@
1
- /*! API v23.6. Copyright 2018-2023 trebco, llc. All rights reserved. LGPL: https://treb.app/license */
1
+ /*! API v25.0.0-rc1. Copyright 2018-2023 trebco, llc. All rights reserved. LGPL: https://treb.app/license */
2
2
 
3
- /**
4
- * Global instance. In the base script, this object will be created as an
5
- * ambient global object (bound to the window object). If you instead use the
6
- * ES module, import the TREB object from the module.
3
+ /**
4
+ * add our tag to the map
7
5
  */
8
- declare const TREB: TREBGlobal;
9
-
6
+ declare global {
7
+ interface HTMLElementTagNameMap {
8
+ 'treb-spreadsheet': HTMLElement & {
9
+ sheet: EmbeddedSpreadsheet|undefined;
10
+ };
11
+ }
12
+ }
10
13
  /**
11
- * global object used to create spreadsheets
14
+ * API class for creating spreadsheets. this is intended as a singleton,
15
+ * we will export an instance of the class.
12
16
  */
13
17
  export declare class TREBGlobal {
14
18
 
15
- /** TREB version */
16
- version: string;
17
-
18
- /** create a spreadsheet */
19
- CreateSpreadsheet(options: EmbeddedSpreadsheetOptions): EmbeddedSpreadsheet;
19
+ /**
20
+ * build version
21
+ */
22
+ version: string;
20
23
 
24
+ /**
25
+ * create a spreadsheet instance
26
+ */
27
+ CreateSpreadsheet(options: EmbeddedSpreadsheetOptions): EmbeddedSpreadsheet;
21
28
  }
22
- /**
23
- * options for saving files. we add the option for JSON formatting.
24
- */
25
- export interface SaveOptions extends SerializeOptions {
26
29
 
27
- /** pretty json formatting */
28
- pretty?: boolean;
29
- }
30
+ /** single instance of factory class */
31
+ export declare const TREB: TREBGlobal;
30
32
 
31
33
  /**
32
- * options for the LoadDocument method
34
+ * options for creating spreadsheet
33
35
  */
34
- export interface LoadDocumentOptions {
36
+ export interface EmbeddedSpreadsheetOptions {
37
+
38
+ /** containing HTML element */
39
+ container?: string | HTMLElement;
40
+
41
+ /** allow drag-and-drop files */
42
+ dnd?: boolean;
43
+
44
+ /** expandable grid */
45
+ expand?: boolean;
46
+
47
+ /**
48
+ * key in localStorage for persisting document. it's possible
49
+ * to set this to boolean `true`, in which case we will generate
50
+ * a storage key based on the page URI.
51
+ *
52
+ * this can be convenient for quickly setting up a document, but don't
53
+ * use it if the page URI might change (the storage will get lost)
54
+ * or if there are multiple spreadsheets on the same page (they will
55
+ * overwrite each other).
56
+ */
57
+ storage_key?: string | boolean;
58
+
59
+ /** don't load immediately (?) */
60
+ toll_initial_load?: boolean;
61
+
62
+ /** show formula bar. default true. */
63
+ formula_bar?: boolean;
64
+
65
+ /** expand formula bar */
66
+ expand_formula_button?: boolean;
67
+
68
+ /** scroll to cell on load */
35
69
  scroll?: string | ICellAddress;
36
- flush?: boolean;
70
+
71
+ /** sheet to show on load, overrides anything in the model */
72
+ sheet?: string;
73
+
74
+ /** add resizable wrapper */
75
+ resizable?: boolean;
76
+
77
+ /** export to xlsx, now optional */
78
+ export?: boolean;
79
+
80
+ /** fill container */
81
+ auto_size?: boolean;
82
+
83
+ /** fetch network document (URI) */
84
+ network_document?: string;
85
+
86
+ /** freeze rows */
87
+ freeze_rows?: number;
88
+
89
+ /** freeze columns */
90
+ freeze_columns?: number;
91
+
92
+ /** row/column headers */
93
+ headers?: boolean;
94
+
95
+ /** recalculate on load */
37
96
  recalculate?: boolean;
38
- override_sheet?: string;
39
- }
40
97
 
41
- /**
42
- * options for the GetRange method
43
- */
44
- export interface GetRangeOptions {
98
+ /** show scrollbars */
99
+ scrollbars?: boolean;
100
+
101
+ /** show tab bar (multi sheet) */
102
+ tab_bar?: boolean | 'auto';
103
+
104
+ /** allow add tab */
105
+ add_tab?: boolean;
106
+
107
+ /** show delete tab */
108
+ delete_tab?: boolean;
109
+
110
+ /** set a reference in global (self) */
111
+ global_name?: string;
112
+
113
+ /** support undo */
114
+ undo?: boolean;
115
+
116
+ /** support in-cell editor */
117
+ in_cell_editor?: boolean;
118
+
119
+ /** prompt "you have unsaved changes" */
120
+ prompt_save?: boolean;
45
121
 
46
122
  /**
47
- * return formatted values (apply number formats and return strings)
48
- * @deprecated
123
+ * toolbar display option
49
124
  */
50
- formatted?: boolean;
125
+ toolbar?: boolean | 'show' | 'narrow' | 'show-narrow';
51
126
 
52
- /**
53
- * return formulas instead of values. formula takes precedence over
54
- * "formatted"; if you pass both, returned values will *not* be formatted.
55
- * @deprecated
56
- *
57
- **/
58
- formula?: boolean;
127
+ /** file options in the toolbar */
128
+ file_menu?: boolean;
129
+
130
+ /** font size in the toolbar */
131
+ font_scale?: boolean;
132
+
133
+ /** show insert/remove table button in toolbar */
134
+ table_button?: boolean;
135
+
136
+ /** show freeze button in toolbar */
137
+ freeze_button?: boolean;
138
+
139
+ /** chart menu in the toolbar */
140
+ chart_menu?: boolean;
141
+
142
+ /** recalculate button in the toolbar */
143
+ toolbar_recalculate_button?: boolean;
144
+
145
+ /** new option, better support for headless operations (default false) */
146
+ headless?: boolean;
147
+
148
+ /** max size for image, in bytes */
149
+ max_file_size?: number;
150
+
151
+ /** initial scale */
152
+ scale?: number;
153
+
154
+ /** show scale buttons */
155
+ scale_control?: boolean;
156
+
157
+ /** show stats panel */
158
+ stats?: boolean;
159
+
160
+ /** save/load scale. this can optionally have a string key to disambiguate */
161
+ persist_scale?: boolean | string;
162
+
163
+ /** target window for hyperlinks (default _blank); set false to disable hyperlinks altogether */
164
+ hyperlinks?: string | false;
59
165
 
60
166
  /**
61
- * optional style for returned values (replaces old flags).
167
+ * enable handling complex numbers in function calculation. turning this
168
+ * off doesn't actually disable complex numbers. it means that functions
169
+ * will not return complex numbers unless one of the arguments is complex.
62
170
  *
63
- * @remarks
171
+ * for example, if complex numbers are off, `=SQRT(-1)` will return `#VALUE`.
172
+ * if complex numbers are on, `=SQRT(-1)` will return `i`.
64
173
  *
65
- * `formatted` returns formatted values, applying number formatting and
66
- * returning strings. `formula` returns cell formulas instead of values.
174
+ * even if complex numbers are off, however, `=SQRT(-1 + 0i)` will return
175
+ * `i` because the argument is complex.
176
+ *
177
+ * currently this behavior applies to `SQRT`, `POWER` and the exponentiation
178
+ * operator `^`.
179
+ *
180
+ * in version 22, this defaults to `off`.
67
181
  */
68
- type?: 'formatted' | 'formula';
69
- }
182
+ complex?: 'on' | 'off';
70
183
 
71
- /**
72
- * options for the ScrollTo method.
73
- *
74
- * @remarks
75
- *
76
- * this method was renamed because of a conflict with a DOM type,
77
- * which was causing problems with the documentation generator.
78
- */
79
- export interface SheetScrollOptions {
184
+ /**
185
+ * for rendering the imaginary number. this is intended to support
186
+ * switching to a different character for rendering, or adding a leading
187
+ * space/half-space/hair-space.
188
+ */
189
+ imaginary_value?: string;
80
190
 
81
- /** scroll in x-direction. defaults to true. */
82
- x?: boolean;
191
+ /** support MD formatting for text */
192
+ markdown?: boolean;
83
193
 
84
- /** scroll in y-direction. defaults to true. */
85
- y?: boolean;
194
+ /**
195
+ * show tinted colors in toolbar color dropdowns. as of version 25
196
+ * this defaults to true (used to be false).
197
+ */
198
+ tint_theme_colors?: boolean;
199
+
200
+ /** show a spinner for long-running operations */
201
+ spinner?: boolean;
202
+
203
+ /** collapsed: start sidebar closed */
204
+ collapsed?: boolean;
86
205
 
87
206
  /**
88
- * smooth scrolling, if supported. we use scrollTo so support is as here:
89
- * https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollTo
207
+ * show the revert button. see the Revert method. this was renamed
208
+ * from `revert` to avoid any ambiguity.
90
209
  */
91
- smooth?: boolean;
210
+ revert_button?: boolean;
92
211
  }
93
212
 
94
213
  /**
95
- * function type used for filtering tables
214
+ * Structure represents a cell address. Note that row and column are 0-based.
96
215
  */
97
- export type TableFilterFunction = (value: CellValue, calculated_value: CellValue, style: Style.Properties) => boolean;
216
+ export interface ICellAddress {
217
+
218
+ /** 0-based row */
219
+ row: number;
220
+
221
+ /** 0-based column */
222
+ column: number;
223
+ absolute_row?: boolean;
224
+ absolute_column?: boolean;
225
+ sheet_id?: number;
226
+ }
98
227
 
99
228
  /**
100
229
  * embedded spreadsheet
@@ -472,8 +601,7 @@ export declare class EmbeddedSpreadsheet {
472
601
 
473
602
  /**
474
603
  * unserialize document from data.
475
- *
476
- **/
604
+ */
477
605
  LoadDocument(data: any, options?: LoadDocumentOptions): void;
478
606
 
479
607
  /**
@@ -716,16 +844,91 @@ export declare class EmbeddedSpreadsheet {
716
844
  */
717
845
  Cancel(token: number): void;
718
846
  }
847
+
848
+ /**
849
+ * options for saving files. we add the option for JSON formatting.
850
+ */
851
+ export interface SaveOptions extends SerializeOptions {
852
+
853
+ /** pretty json formatting */
854
+ pretty?: boolean;
855
+ }
856
+
857
+ /**
858
+ * options for the LoadDocument method
859
+ */
860
+ export interface LoadDocumentOptions {
861
+ scroll?: string | ICellAddress;
862
+ flush?: boolean;
863
+ recalculate?: boolean;
864
+ override_sheet?: string;
865
+ }
866
+
867
+ /**
868
+ * options for the GetRange method
869
+ */
870
+ export interface GetRangeOptions {
871
+
872
+ /**
873
+ * return formatted values (apply number formats and return strings)
874
+ * @deprecated
875
+ */
876
+ formatted?: boolean;
877
+
878
+ /**
879
+ * return formulas instead of values. formula takes precedence over
880
+ * "formatted"; if you pass both, returned values will *not* be formatted.
881
+ * @deprecated
882
+ */
883
+ formula?: boolean;
884
+
885
+ /**
886
+ * optional style for returned values (replaces old flags).
887
+ *
888
+ * @remarks
889
+ *
890
+ * `formatted` returns formatted values, applying number formatting and
891
+ * returning strings. `formula` returns cell formulas instead of values.
892
+ */
893
+ type?: 'formatted' | 'formula';
894
+ }
895
+
896
+ /**
897
+ * options for the ScrollTo method.
898
+ *
899
+ * @remarks
900
+ *
901
+ * this method was renamed because of a conflict with a DOM type,
902
+ * which was causing problems with the documentation generator.
903
+ */
904
+ export interface SheetScrollOptions {
905
+
906
+ /** scroll in x-direction. defaults to true. */
907
+ x?: boolean;
908
+
909
+ /** scroll in y-direction. defaults to true. */
910
+ y?: boolean;
911
+
912
+ /**
913
+ * smooth scrolling, if supported. we use scrollTo so support is as here:
914
+ * https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollTo
915
+ */
916
+ smooth?: boolean;
917
+ }
918
+
919
+ /**
920
+ * function type used for filtering tables
921
+ */
922
+ export type TableFilterFunction = (value: CellValue, calculated_value: CellValue, style: Style.Properties) => boolean;
719
923
  export interface FreezePane {
720
924
  rows: number;
721
925
  columns: number;
722
926
  }
723
- export declare type BorderConstants = "none" | "all" | "outside" | "top" | "bottom" | "left" | "right" | "double-top" | "double-bottom";
927
+ export declare type BorderConstants = "none" | "all" | "outside" | "top" | "bottom" | "left" | "right";
724
928
 
725
929
  /**
726
930
  * options for serializing data
727
- *
728
- **/
931
+ */
729
932
  export interface SerializeOptions {
730
933
 
731
934
  /** optimize for size */
@@ -771,46 +974,22 @@ export interface SetRangeOptions {
771
974
  spill?: boolean;
772
975
 
773
976
  /**
774
- * argument separator to use when parsing the input formula. by default,
775
- * parsing uses the current locale. that is not optimal, because you
776
- * do not necessarily know ahead of time where a spreadsheet may be viewed.
777
- *
778
- * set this option to call SetRange with a consistent argument separator.
779
- * the decimal separator is implied; if the argument separator is set to
780
- * comma (',') the decimal mark will be a dot ('.'); and if the argument
781
- * separator is set to semicolon (';') the decimal mark will be set to
782
- * comma (','). you cannot mix and match these values.
783
- *
784
- * @see EvaluateOptions for more discussion of this option.
977
+ * argument separator to use when parsing the input formula. set this
978
+ * option to call SetRange with a consistent argument separator,
979
+ * independent of current locale.
785
980
  */
786
981
  argument_separator?: ',' | ';';
787
982
 
788
983
  /**
789
- * allow R1C1-style references; these can be either
790
- * direct (e.g. R2C4) or offset (e.g. R[-3]C[0]).
984
+ * allow R1C1-style references; these can be either absolute
985
+ * addresses (e.g. R2C4) or relative to the cell (e.g. R[-3]C[0]).
791
986
  */
792
987
  r1c1?: boolean;
793
988
  }
794
989
 
795
- /**
796
- * Structure represents a cell address. Note that row and column are 0-based.
797
- */
798
- export interface ICellAddress {
799
-
800
- /** 0-based row */
801
- row: number;
802
-
803
- /** 0-based column */
804
- column: number;
805
- absolute_row?: boolean;
806
- absolute_column?: boolean;
807
- sheet_id?: number;
808
- }
809
-
810
990
  /**
811
991
  * Structure represents a 2d range of cells.
812
- *
813
- **/
992
+ */
814
993
  export interface IArea {
815
994
  start: ICellAddress;
816
995
  end: ICellAddress;
@@ -835,8 +1014,7 @@ export declare namespace Style {
835
1014
 
836
1015
  /**
837
1016
  * vertical align constants
838
- *
839
- **/ type VerticalAlign = "" | "top" | "bottom" | "middle";
1017
+ */ type VerticalAlign = "" | "top" | "bottom" | "middle";
840
1018
 
841
1019
  /** composite font size */
842
1020
  interface FontSize {
@@ -846,8 +1024,7 @@ export declare namespace Style {
846
1024
 
847
1025
  /**
848
1026
  * color is either a theme color (theme index plus tint), or CSS text
849
- *
850
- **/
1027
+ */
851
1028
  interface Color {
852
1029
  theme?: number;
853
1030
  tint?: number;
@@ -950,8 +1127,7 @@ export interface DimensionedQuantity {
950
1127
 
951
1128
  /**
952
1129
  * composite styling for tables.
953
- *
954
- **/
1130
+ */
955
1131
  export interface TableTheme {
956
1132
 
957
1133
  /** the first row in a table, showing column titles. */
@@ -1012,7 +1188,7 @@ export declare type LoadSource = "drag-and-drop" | "local-file" | "network-file"
1012
1188
  * EmbeddedSheetEvent is a discriminated union. Switch on the `type` field
1013
1189
  * of the event.
1014
1190
  */
1015
- export type EmbeddedSheetEvent = DocumentChangeEvent | DocumentResetEvent | DocumentLoadEvent | DataChangeEvent | SelectionEvent | ResizeEvent;
1191
+ export type EmbeddedSheetEvent = DocumentChangeEvent | DocumentResetEvent | DocumentLoadEvent | DataChangeEvent | FocusViewEvent | SelectionEvent | ResizeEvent;
1016
1192
 
1017
1193
  /**
1018
1194
  * options when inserting a table into a sheet
@@ -1054,8 +1230,7 @@ export interface DocumentLoadEvent {
1054
1230
 
1055
1231
  /**
1056
1232
  * This event is sent when the document is reset.
1057
- *
1058
- **/
1233
+ */
1059
1234
  export interface DocumentResetEvent {
1060
1235
  type: 'reset';
1061
1236
  }
@@ -1086,6 +1261,14 @@ export interface SelectionEvent {
1086
1261
  type: 'selection';
1087
1262
  }
1088
1263
 
1264
+ /**
1265
+ * This event is sent when the focused view changes, if you have more
1266
+ * than one view.
1267
+ */
1268
+ export interface FocusViewEvent {
1269
+ type: 'focus-view';
1270
+ }
1271
+
1089
1272
  /**
1090
1273
  * options for exporting CSV/TSV
1091
1274
  */
@@ -1104,209 +1287,20 @@ export interface ExportOptions {
1104
1287
  formatted?: boolean;
1105
1288
  }
1106
1289
 
1107
- /**
1108
- * options for creating spreadsheet
1109
- */
1110
- export interface EmbeddedSpreadsheetOptions {
1111
-
1112
- /** containing HTML element */
1113
- container?: string | HTMLElement;
1114
-
1115
- /** allow drag-and-drop files */
1116
- dnd?: boolean;
1117
-
1118
- /** expandable grid */
1119
- expand?: boolean;
1120
-
1121
- /** key in localStorage for persisting document */
1122
- storage_key?: string;
1123
-
1124
- /** don't load immediately (?) */
1125
- toll_initial_load?: boolean;
1126
-
1127
- /** show formula bar */
1128
- formula_bar?: boolean;
1129
-
1130
- /** expand formula bar */
1131
- expand_formula_button?: boolean;
1132
-
1133
- /** scroll to cell on load */
1134
- scroll?: string | ICellAddress;
1135
-
1136
- /** sheet to show on load, overrides anything in the model */
1137
- sheet?: string;
1138
-
1139
- /** add resizable wrapper */
1140
- resizable?: boolean;
1141
-
1142
- /** export to xlsx, now optional */
1143
- export?: boolean;
1144
-
1145
- /** fill container */
1146
- auto_size?: boolean;
1147
-
1148
- /** popout icon */
1149
- popout?: boolean;
1150
-
1151
- /** fetch network document (URI) */
1152
- network_document?: string;
1153
-
1154
- /**
1155
- * load this document if the storage document isn't found (fallback)
1156
- *
1157
- * @deprecated - this is superfluous, using network_document with
1158
- * storage_key is sufficient for this pattern.
1159
- */
1160
- alternate_document?: string;
1161
-
1162
- /** freeze rows */
1163
- freeze_rows?: number;
1164
-
1165
- /** freeze columns */
1166
- freeze_columns?: number;
1167
-
1168
- /** row/column headers */
1169
- headers?: boolean;
1170
-
1171
- /** recalculate on load */
1172
- recalculate?: boolean;
1173
-
1174
- /** show scrollbars */
1175
- scrollbars?: boolean;
1176
-
1177
- /** show tab bar (multi sheet) */
1178
- tab_bar?: boolean | 'auto';
1179
-
1180
- /** allow add tab */
1181
- add_tab?: boolean;
1182
-
1183
- /** show delete tab */
1184
- delete_tab?: boolean;
1185
-
1186
- /** set a reference in global (self) */
1187
- global_name?: string;
1188
-
1189
- /** support undo */
1190
- undo?: boolean;
1191
-
1192
- /** support in-cell editor */
1193
- in_cell_editor?: boolean;
1194
-
1195
- /** prompt "you have unsaved changes" */
1196
- prompt_save?: boolean;
1197
-
1198
- /**
1199
- * toolbar display option
1200
- */
1201
- toolbar?: boolean | 'show' | 'narrow' | 'show-narrow';
1202
-
1203
- /** file options in the toolbar */
1204
- file_menu?: boolean;
1205
-
1206
- /** font size in the toolbar */
1207
- font_scale?: boolean;
1208
-
1209
- /** show insert/remove table button in toolbar */
1210
- table_button?: boolean;
1211
-
1212
- /** chart menu in the toolbar */
1213
- chart_menu?: boolean;
1214
-
1215
- /** recalculate button in the toolbar */
1216
- toolbar_recalculate_button?: boolean;
1217
-
1218
- /** new option, better support for headless operations (default false) */
1219
- headless?: boolean;
1220
-
1221
- /** max size for image, in bytes */
1222
- max_file_size?: number;
1223
-
1224
- /** initial scale */
1225
- scale?: number;
1226
-
1227
- /** show scale buttons */
1228
- scale_control?: boolean;
1229
-
1230
- /** show stats panel */
1231
- stats?: boolean;
1232
-
1233
- /** save/load scale. this can optionally have a string key to disambiguate */
1234
- persist_scale?: boolean | string;
1235
-
1236
- /** target window for hyperlinks (default _blank); set false to disable hyperlinks altogether */
1237
- hyperlinks?: string | false;
1238
-
1239
- /**
1240
- * enable handling complex numbers in function calculation. turning this
1241
- * off doesn't actually disable complex numbers. it means that functions
1242
- * will not return complex numbers unless one of the arguments is complex.
1243
- *
1244
- * for example, if complex numbers are off, `=SQRT(-1)` will return `#VALUE`.
1245
- * if complex numbers are on, `=SQRT(-1)` will return `i`.
1246
- *
1247
- * even if complex numbers are off, however, `=SQRT(-1 + 0i)` will return
1248
- * `i` because the argument is complex.
1249
- *
1250
- * currently this behavior applies to `SQRT`, `POWER` and the exponentiation
1251
- * operator `^`.
1252
- *
1253
- * in version 22, this defaults to `off`.
1254
- */
1255
- complex?: 'on' | 'off';
1256
-
1257
- /**
1258
- * for rendering the imaginary number. this is intended to support
1259
- * switching to a different character for rendering, or adding a leading
1260
- * space/half-space/hair-space.
1261
- */
1262
- imaginary_value?: string;
1263
-
1264
- /** support MD formatting for text */
1265
- markdown?: boolean;
1266
-
1267
- /** show tinted colors in toolbar color dropdowns */
1268
- tint_theme_colors?: boolean;
1269
-
1270
- /** show a spinner for long-running operations */
1271
- spinner?: boolean;
1272
-
1273
- /** collapsed: start sidebar closed */
1274
- collapsed?: boolean;
1275
-
1276
- /**
1277
- * show the revert button. see the Revert method.
1278
- */
1279
- revert?: boolean;
1280
- }
1281
-
1282
1290
  /**
1283
1291
  * options for the evaluate function
1284
1292
  */
1285
1293
  export interface EvaluateOptions {
1286
1294
 
1287
1295
  /**
1288
- * By default, the Evaluate function will evaluate the expression in the
1289
- * current locale, meaning it will use the current locale's decimal separator
1290
- * and argument separator.
1291
- *
1292
- * If you do not want that behavior, set the argument separator explicitly.
1293
- * That will force evaluation using either comma (,) or semicolon (;) as the
1294
- * argument separator.
1295
- *
1296
- * Decimal separator is implied by the argument separator. If you set the
1297
- * argument separator to comma, the decimal separator will be dot (.). If you
1298
- * set the argument separator to semicolon, the decimal separator will be
1299
- * comma (,). You cannot mix-and-match these characters.
1300
- *
1301
- * Since you may not know where the code is being executed at run-time,
1302
- * using consistent argument and decimal separators makes sense. However we
1303
- * are leaving the original behavior as default for backwards compatibility.
1296
+ * argument separator to use when parsing input. set this option to
1297
+ * use a consistent argument separator independent of current locale.
1304
1298
  */
1305
1299
  argument_separator?: ',' | ';';
1306
1300
 
1307
1301
  /**
1308
1302
  * allow R1C1-style references. the Evaluate function cannot use
1309
- * offset references (e.g. R[-1]C[0]), so those will always fail.
1303
+ * relative references (e.g. R[-1]C[0]), so those will always fail.
1310
1304
  * however it may be useful to use direct R1C1 references (e.g. R3C4),
1311
1305
  * so we optionally support that behind this flag.
1312
1306
  */