@trebco/treb 23.6.5 → 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} +285 -269
  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 */
@@ -784,25 +987,9 @@ export interface SetRangeOptions {
784
987
  r1c1?: boolean;
785
988
  }
786
989
 
787
- /**
788
- * Structure represents a cell address. Note that row and column are 0-based.
789
- */
790
- export interface ICellAddress {
791
-
792
- /** 0-based row */
793
- row: number;
794
-
795
- /** 0-based column */
796
- column: number;
797
- absolute_row?: boolean;
798
- absolute_column?: boolean;
799
- sheet_id?: number;
800
- }
801
-
802
990
  /**
803
991
  * Structure represents a 2d range of cells.
804
- *
805
- **/
992
+ */
806
993
  export interface IArea {
807
994
  start: ICellAddress;
808
995
  end: ICellAddress;
@@ -827,8 +1014,7 @@ export declare namespace Style {
827
1014
 
828
1015
  /**
829
1016
  * vertical align constants
830
- *
831
- **/ type VerticalAlign = "" | "top" | "bottom" | "middle";
1017
+ */ type VerticalAlign = "" | "top" | "bottom" | "middle";
832
1018
 
833
1019
  /** composite font size */
834
1020
  interface FontSize {
@@ -838,8 +1024,7 @@ export declare namespace Style {
838
1024
 
839
1025
  /**
840
1026
  * color is either a theme color (theme index plus tint), or CSS text
841
- *
842
- **/
1027
+ */
843
1028
  interface Color {
844
1029
  theme?: number;
845
1030
  tint?: number;
@@ -942,8 +1127,7 @@ export interface DimensionedQuantity {
942
1127
 
943
1128
  /**
944
1129
  * composite styling for tables.
945
- *
946
- **/
1130
+ */
947
1131
  export interface TableTheme {
948
1132
 
949
1133
  /** the first row in a table, showing column titles. */
@@ -1004,7 +1188,7 @@ export declare type LoadSource = "drag-and-drop" | "local-file" | "network-file"
1004
1188
  * EmbeddedSheetEvent is a discriminated union. Switch on the `type` field
1005
1189
  * of the event.
1006
1190
  */
1007
- export type EmbeddedSheetEvent = DocumentChangeEvent | DocumentResetEvent | DocumentLoadEvent | DataChangeEvent | SelectionEvent | ResizeEvent;
1191
+ export type EmbeddedSheetEvent = DocumentChangeEvent | DocumentResetEvent | DocumentLoadEvent | DataChangeEvent | FocusViewEvent | SelectionEvent | ResizeEvent;
1008
1192
 
1009
1193
  /**
1010
1194
  * options when inserting a table into a sheet
@@ -1046,8 +1230,7 @@ export interface DocumentLoadEvent {
1046
1230
 
1047
1231
  /**
1048
1232
  * This event is sent when the document is reset.
1049
- *
1050
- **/
1233
+ */
1051
1234
  export interface DocumentResetEvent {
1052
1235
  type: 'reset';
1053
1236
  }
@@ -1078,6 +1261,14 @@ export interface SelectionEvent {
1078
1261
  type: 'selection';
1079
1262
  }
1080
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
+
1081
1272
  /**
1082
1273
  * options for exporting CSV/TSV
1083
1274
  */
@@ -1096,181 +1287,6 @@ export interface ExportOptions {
1096
1287
  formatted?: boolean;
1097
1288
  }
1098
1289
 
1099
- /**
1100
- * options for creating spreadsheet
1101
- */
1102
- export interface EmbeddedSpreadsheetOptions {
1103
-
1104
- /** containing HTML element */
1105
- container?: string | HTMLElement;
1106
-
1107
- /** allow drag-and-drop files */
1108
- dnd?: boolean;
1109
-
1110
- /** expandable grid */
1111
- expand?: boolean;
1112
-
1113
- /** key in localStorage for persisting document */
1114
- storage_key?: string;
1115
-
1116
- /** don't load immediately (?) */
1117
- toll_initial_load?: boolean;
1118
-
1119
- /** show formula bar */
1120
- formula_bar?: boolean;
1121
-
1122
- /** expand formula bar */
1123
- expand_formula_button?: boolean;
1124
-
1125
- /** scroll to cell on load */
1126
- scroll?: string | ICellAddress;
1127
-
1128
- /** sheet to show on load, overrides anything in the model */
1129
- sheet?: string;
1130
-
1131
- /** add resizable wrapper */
1132
- resizable?: boolean;
1133
-
1134
- /** export to xlsx, now optional */
1135
- export?: boolean;
1136
-
1137
- /** fill container */
1138
- auto_size?: boolean;
1139
-
1140
- /** popout icon */
1141
- popout?: boolean;
1142
-
1143
- /** fetch network document (URI) */
1144
- network_document?: string;
1145
-
1146
- /**
1147
- * load this document if the storage document isn't found (fallback)
1148
- *
1149
- * @deprecated - this is superfluous, using network_document with
1150
- * storage_key is sufficient for this pattern.
1151
- */
1152
- alternate_document?: string;
1153
-
1154
- /** freeze rows */
1155
- freeze_rows?: number;
1156
-
1157
- /** freeze columns */
1158
- freeze_columns?: number;
1159
-
1160
- /** row/column headers */
1161
- headers?: boolean;
1162
-
1163
- /** recalculate on load */
1164
- recalculate?: boolean;
1165
-
1166
- /** show scrollbars */
1167
- scrollbars?: boolean;
1168
-
1169
- /** show tab bar (multi sheet) */
1170
- tab_bar?: boolean | 'auto';
1171
-
1172
- /** allow add tab */
1173
- add_tab?: boolean;
1174
-
1175
- /** show delete tab */
1176
- delete_tab?: boolean;
1177
-
1178
- /** set a reference in global (self) */
1179
- global_name?: string;
1180
-
1181
- /** support undo */
1182
- undo?: boolean;
1183
-
1184
- /** support in-cell editor */
1185
- in_cell_editor?: boolean;
1186
-
1187
- /** prompt "you have unsaved changes" */
1188
- prompt_save?: boolean;
1189
-
1190
- /**
1191
- * toolbar display option
1192
- */
1193
- toolbar?: boolean | 'show' | 'narrow' | 'show-narrow';
1194
-
1195
- /** file options in the toolbar */
1196
- file_menu?: boolean;
1197
-
1198
- /** font size in the toolbar */
1199
- font_scale?: boolean;
1200
-
1201
- /** show insert/remove table button in toolbar */
1202
- table_button?: boolean;
1203
-
1204
- /** chart menu in the toolbar */
1205
- chart_menu?: boolean;
1206
-
1207
- /** recalculate button in the toolbar */
1208
- toolbar_recalculate_button?: boolean;
1209
-
1210
- /** new option, better support for headless operations (default false) */
1211
- headless?: boolean;
1212
-
1213
- /** max size for image, in bytes */
1214
- max_file_size?: number;
1215
-
1216
- /** initial scale */
1217
- scale?: number;
1218
-
1219
- /** show scale buttons */
1220
- scale_control?: boolean;
1221
-
1222
- /** show stats panel */
1223
- stats?: boolean;
1224
-
1225
- /** save/load scale. this can optionally have a string key to disambiguate */
1226
- persist_scale?: boolean | string;
1227
-
1228
- /** target window for hyperlinks (default _blank); set false to disable hyperlinks altogether */
1229
- hyperlinks?: string | false;
1230
-
1231
- /**
1232
- * enable handling complex numbers in function calculation. turning this
1233
- * off doesn't actually disable complex numbers. it means that functions
1234
- * will not return complex numbers unless one of the arguments is complex.
1235
- *
1236
- * for example, if complex numbers are off, `=SQRT(-1)` will return `#VALUE`.
1237
- * if complex numbers are on, `=SQRT(-1)` will return `i`.
1238
- *
1239
- * even if complex numbers are off, however, `=SQRT(-1 + 0i)` will return
1240
- * `i` because the argument is complex.
1241
- *
1242
- * currently this behavior applies to `SQRT`, `POWER` and the exponentiation
1243
- * operator `^`.
1244
- *
1245
- * in version 22, this defaults to `off`.
1246
- */
1247
- complex?: 'on' | 'off';
1248
-
1249
- /**
1250
- * for rendering the imaginary number. this is intended to support
1251
- * switching to a different character for rendering, or adding a leading
1252
- * space/half-space/hair-space.
1253
- */
1254
- imaginary_value?: string;
1255
-
1256
- /** support MD formatting for text */
1257
- markdown?: boolean;
1258
-
1259
- /** show tinted colors in toolbar color dropdowns */
1260
- tint_theme_colors?: boolean;
1261
-
1262
- /** show a spinner for long-running operations */
1263
- spinner?: boolean;
1264
-
1265
- /** collapsed: start sidebar closed */
1266
- collapsed?: boolean;
1267
-
1268
- /**
1269
- * show the revert button. see the Revert method.
1270
- */
1271
- revert?: boolean;
1272
- }
1273
-
1274
1290
  /**
1275
1291
  * options for the evaluate function
1276
1292
  */