@trebco/treb 23.2.4 → 23.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/treb.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /*! API v23.2. Copyright 2018-2023 trebco, llc. All rights reserved. LGPL: https://treb.app/license */
1
+ /*! API v23.4. Copyright 2018-2023 trebco, llc. All rights reserved. LGPL: https://treb.app/license */
2
2
 
3
3
  /**
4
4
  * Global instance. In the base script, this object will be created as an
@@ -184,6 +184,16 @@ export declare class EmbeddedSpreadsheet {
184
184
  */
185
185
  GetSheetID(sheet: string | number): number | undefined;
186
186
 
187
+ /**
188
+ * insert a table in the given range. optionally include a totals row.
189
+ * this method does not make any changes to content or layout. it just
190
+ * converts the range to a table.
191
+ *
192
+ * @param reference
193
+ */
194
+ InsertTable(range?: RangeReference, options?: InsertTableOptions): void;
195
+ RemoveTable(range?: RangeReference): void;
196
+
187
197
  /**
188
198
  * Add a sheet, optionally named.
189
199
  */
@@ -737,6 +747,9 @@ export interface SerializeOptions {
737
747
  * drop them from cells. but you can leave them in if that's useful.
738
748
  */
739
749
  tables?: boolean;
750
+
751
+ /** share resources (images, for now) to prevent writing data URIs more than once */
752
+ share_resources?: boolean;
740
753
  }
741
754
 
742
755
  /**
@@ -965,6 +978,78 @@ export interface TableSortOptions {
965
978
  asc: boolean;
966
979
  }
967
980
  export type TableSortType = 'text' | 'numeric' | 'auto';
981
+ export declare type LoadSource = "drag-and-drop" | "local-file" | "network-file" | "local-storage" | "undo";
982
+
983
+ /**
984
+ * EmbeddedSheetEvent is a discriminated union. Switch on the `type` field
985
+ * of the event.
986
+ */
987
+ export type EmbeddedSheetEvent = DocumentChangeEvent | DocumentResetEvent | DocumentLoadEvent | DataChangeEvent | SelectionEvent | ResizeEvent;
988
+
989
+ /**
990
+ * options when inserting a table into a sheet
991
+ */
992
+ export interface InsertTableOptions {
993
+
994
+ /**
995
+ * include a totals/summation row. this impacts the layout and styling:
996
+ * totals row have a unique style and are not included when sorting.
997
+ */
998
+ totals_row?: boolean;
999
+
1000
+ /**
1001
+ * show a sort button in table headers. defaults to true.
1002
+ */
1003
+ sortable?: boolean;
1004
+ }
1005
+ export interface ResizeEvent {
1006
+ type: 'resize';
1007
+ }
1008
+ export declare type LoadType = "treb" | "csv" | "xlsx";
1009
+
1010
+ /**
1011
+ * This event is sent when a document is loaded, and also on undo. The
1012
+ * source field can help determine if it was triggered by an undo operation.
1013
+ */
1014
+ export interface DocumentLoadEvent {
1015
+ type: 'load';
1016
+ source?: LoadSource;
1017
+ file_type?: LoadType;
1018
+ }
1019
+
1020
+ /**
1021
+ * This event is sent when the document is reset.
1022
+ *
1023
+ **/
1024
+ export interface DocumentResetEvent {
1025
+ type: 'reset';
1026
+ }
1027
+
1028
+ /**
1029
+ * This event is sent when data in the spreadsheet changes, but there are
1030
+ * no structural or cell changes. For example, the `RAND` function returns
1031
+ * a new value on every calculation, but the function itself does not change.
1032
+ */
1033
+ export interface DataChangeEvent {
1034
+ type: 'data';
1035
+ }
1036
+
1037
+ /**
1038
+ * This event is sent when the value of a cell changes, or when the document
1039
+ * structure chages. Structure changes might be inserting/deleting rows or
1040
+ * columns, or adding/removing a sheet.
1041
+ */
1042
+ export interface DocumentChangeEvent {
1043
+ type: 'document-change';
1044
+ }
1045
+
1046
+ /**
1047
+ * This event is sent when the spreadsheet selection changes. Use the
1048
+ * `GetSelection` method to get the address of the current selection.
1049
+ */
1050
+ export interface SelectionEvent {
1051
+ type: 'selection';
1052
+ }
968
1053
 
969
1054
  /**
970
1055
  * options for exporting CSV/TSV
@@ -1155,61 +1240,6 @@ export interface EmbeddedSpreadsheetOptions {
1155
1240
  */
1156
1241
  revert?: boolean;
1157
1242
  }
1158
- export declare type LoadSource = "drag-and-drop" | "local-file" | "network-file" | "local-storage" | "undo";
1159
-
1160
- /**
1161
- * EmbeddedSheetEvent is a discriminated union. Switch on the `type` field
1162
- * of the event.
1163
- */
1164
- export type EmbeddedSheetEvent = DocumentChangeEvent | DocumentResetEvent | DocumentLoadEvent | DataChangeEvent | SelectionEvent | ResizeEvent;
1165
- export interface ResizeEvent {
1166
- type: 'resize';
1167
- }
1168
- export declare type LoadType = "treb" | "csv" | "xlsx";
1169
-
1170
- /**
1171
- * This event is sent when a document is loaded, and also on undo. The
1172
- * source field can help determine if it was triggered by an undo operation.
1173
- */
1174
- export interface DocumentLoadEvent {
1175
- type: 'load';
1176
- source?: LoadSource;
1177
- file_type?: LoadType;
1178
- }
1179
-
1180
- /**
1181
- * This event is sent when the document is reset.
1182
- *
1183
- **/
1184
- export interface DocumentResetEvent {
1185
- type: 'reset';
1186
- }
1187
-
1188
- /**
1189
- * This event is sent when data in the spreadsheet changes, but there are
1190
- * no structural or cell changes. For example, the `RAND` function returns
1191
- * a new value on every calculation, but the function itself does not change.
1192
- */
1193
- export interface DataChangeEvent {
1194
- type: 'data';
1195
- }
1196
-
1197
- /**
1198
- * This event is sent when the value of a cell changes, or when the document
1199
- * structure chages. Structure changes might be inserting/deleting rows or
1200
- * columns, or adding/removing a sheet.
1201
- */
1202
- export interface DocumentChangeEvent {
1203
- type: 'document-change';
1204
- }
1205
-
1206
- /**
1207
- * This event is sent when the spreadsheet selection changes. Use the
1208
- * `GetSelection` method to get the address of the current selection.
1209
- */
1210
- export interface SelectionEvent {
1211
- type: 'selection';
1212
- }
1213
1243
 
1214
1244
  /**
1215
1245
  * options for the evaluate function