@trebco/treb 23.3.3 → 23.5.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/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.5. 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,111 @@ 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
+ /**
1006
+ * base theme color, or a set of styles for the table. useful values for
1007
+ * theme color are accent colors 4 (the default), 5, 7 and 9.
1008
+ */
1009
+ theme?: number | TableTheme;
1010
+ }
1011
+ export interface ResizeEvent {
1012
+ type: 'resize';
1013
+ }
1014
+ export declare type LoadType = "treb" | "csv" | "xlsx";
1015
+
1016
+ /**
1017
+ * This event is sent when a document is loaded, and also on undo. The
1018
+ * source field can help determine if it was triggered by an undo operation.
1019
+ */
1020
+ export interface DocumentLoadEvent {
1021
+ type: 'load';
1022
+ source?: LoadSource;
1023
+ file_type?: LoadType;
1024
+ }
1025
+
1026
+ /**
1027
+ * This event is sent when the document is reset.
1028
+ *
1029
+ **/
1030
+ export interface DocumentResetEvent {
1031
+ type: 'reset';
1032
+ }
1033
+
1034
+ /**
1035
+ * This event is sent when data in the spreadsheet changes, but there are
1036
+ * no structural or cell changes. For example, the `RAND` function returns
1037
+ * a new value on every calculation, but the function itself does not change.
1038
+ */
1039
+ export interface DataChangeEvent {
1040
+ type: 'data';
1041
+ }
1042
+
1043
+ /**
1044
+ * This event is sent when the value of a cell changes, or when the document
1045
+ * structure chages. Structure changes might be inserting/deleting rows or
1046
+ * columns, or adding/removing a sheet.
1047
+ */
1048
+ export interface DocumentChangeEvent {
1049
+ type: 'document-change';
1050
+ }
1051
+
1052
+ /**
1053
+ * This event is sent when the spreadsheet selection changes. Use the
1054
+ * `GetSelection` method to get the address of the current selection.
1055
+ */
1056
+ export interface SelectionEvent {
1057
+ type: 'selection';
1058
+ }
1059
+
1060
+ /**
1061
+ * composite styling for tables.
1062
+ *
1063
+ **/
1064
+ export interface TableTheme {
1065
+
1066
+ /** the first row in a table, showing column titles. */
1067
+ header?: Style.Properties;
1068
+
1069
+ /**
1070
+ * odd rows in the table. we count the title row as zero, so
1071
+ * the first row in the table containing data is 1, hence odd.
1072
+ */
1073
+ odd?: Style.Properties;
1074
+
1075
+ /**
1076
+ * even rows in the table.
1077
+ */
1078
+ even?: Style.Properties;
1079
+
1080
+ /**
1081
+ * styling for the totals row, if included. this will be the last
1082
+ * row in the table.
1083
+ */
1084
+ total?: Style.Properties;
1085
+ }
971
1086
 
972
1087
  /**
973
1088
  * options for exporting CSV/TSV
@@ -1158,61 +1273,6 @@ export interface EmbeddedSpreadsheetOptions {
1158
1273
  */
1159
1274
  revert?: boolean;
1160
1275
  }
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
1276
 
1217
1277
  /**
1218
1278
  * options for the evaluate function