@trebco/treb 23.3.3 → 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.3. 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
  */
@@ -968,6 +978,78 @@ export interface TableSortOptions {
968
978
  asc: boolean;
969
979
  }
970
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
+ }
971
1053
 
972
1054
  /**
973
1055
  * options for exporting CSV/TSV
@@ -1158,61 +1240,6 @@ export interface EmbeddedSpreadsheetOptions {
1158
1240
  */
1159
1241
  revert?: boolean;
1160
1242
  }
1161
- export declare type LoadSource = "drag-and-drop" | "local-file" | "network-file" | "local-storage" | "undo";
1162
-
1163
- /**
1164
- * EmbeddedSheetEvent is a discriminated union. Switch on the `type` field
1165
- * of the event.
1166
- */
1167
- export type EmbeddedSheetEvent = DocumentChangeEvent | DocumentResetEvent | DocumentLoadEvent | DataChangeEvent | SelectionEvent | ResizeEvent;
1168
- export interface ResizeEvent {
1169
- type: 'resize';
1170
- }
1171
- export declare type LoadType = "treb" | "csv" | "xlsx";
1172
-
1173
- /**
1174
- * This event is sent when a document is loaded, and also on undo. The
1175
- * source field can help determine if it was triggered by an undo operation.
1176
- */
1177
- export interface DocumentLoadEvent {
1178
- type: 'load';
1179
- source?: LoadSource;
1180
- file_type?: LoadType;
1181
- }
1182
-
1183
- /**
1184
- * This event is sent when the document is reset.
1185
- *
1186
- **/
1187
- export interface DocumentResetEvent {
1188
- type: 'reset';
1189
- }
1190
-
1191
- /**
1192
- * This event is sent when data in the spreadsheet changes, but there are
1193
- * no structural or cell changes. For example, the `RAND` function returns
1194
- * a new value on every calculation, but the function itself does not change.
1195
- */
1196
- export interface DataChangeEvent {
1197
- type: 'data';
1198
- }
1199
-
1200
- /**
1201
- * This event is sent when the value of a cell changes, or when the document
1202
- * structure chages. Structure changes might be inserting/deleting rows or
1203
- * columns, or adding/removing a sheet.
1204
- */
1205
- export interface DocumentChangeEvent {
1206
- type: 'document-change';
1207
- }
1208
-
1209
- /**
1210
- * This event is sent when the spreadsheet selection changes. Use the
1211
- * `GetSelection` method to get the address of the current selection.
1212
- */
1213
- export interface SelectionEvent {
1214
- type: 'selection';
1215
- }
1216
1243
 
1217
1244
  /**
1218
1245
  * options for the evaluate function