@trebco/treb 22.8.0 → 22.13.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 v22.8. Copyright 2018-2022 trebco, llc. All rights reserved. LGPL: https://treb.app/license */
1
+ /*! API v22.13. Copyright 2018-2022 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
@@ -68,24 +68,6 @@ export interface GetRangeOptions {
68
68
  type?: 'formatted' | 'formula';
69
69
  }
70
70
 
71
- /**
72
- * options for the SetRange method
73
- */
74
- export interface SetRangeOptions {
75
-
76
- /** transpose rectangular array before inserting */
77
- transpose?: boolean;
78
-
79
- /** recycle values (R-style) */
80
- recycle?: boolean;
81
-
82
- /** apply as an array (as if you pressed ctrl+shift+enter) */
83
- array?: boolean;
84
-
85
- /** spill over */
86
- spill?: boolean;
87
- }
88
-
89
71
  /**
90
72
  * options for the ScrollTo method.
91
73
  *
@@ -203,13 +185,17 @@ export declare class EmbeddedSpreadsheet {
203
185
  AddSheet(name?: string): void;
204
186
 
205
187
  /**
206
- * Insert an annotation node. Usually this means inserting a chart.
188
+ * Insert an annotation node. Usually this means inserting a chart. Regarding
189
+ * the argument separator, see the Evaluate function.
207
190
  *
208
191
  * @param formula - annotation formula. For charts, the chart formula.
209
192
  * @param type - annotation type. Defaults to `treb-chart`.
210
193
  * @param rect - coordinates, or a range reference for layout.
194
+ *
195
+ * @param argument_separator - the argument separator to use when evaluating
196
+ * the function. defaults to current locale.
211
197
  */
212
- InsertAnnotation(formula: string, type?: string, rect?: IRectangle | RangeReference): void;
198
+ InsertAnnotation(formula: string, type?: string, rect?: IRectangle | RangeReference, argument_separator?: ',' | ';'): void;
213
199
 
214
200
  /**
215
201
  * Insert an image. This method will open a file chooser and (if an image
@@ -545,9 +531,12 @@ export declare class EmbeddedSpreadsheet {
545
531
  * use sheet names when referring to cells, to avoid ambiguity. Otherwise
546
532
  * cell references will resolve to the active sheet.
547
533
  *
534
+ * @param expression - an expression in spreadsheet language
535
+ * @param options - options for parsing the passed function
536
+ *
548
537
  * @public
549
538
  */
550
- Evaluate(expression: string): CellValue | CellValue[][];
539
+ Evaluate(expression: string, options?: EvaluateOptions): CellValue | CellValue[][];
551
540
 
552
541
  /**
553
542
  * Returns the current selection, as a string address or range.
@@ -639,7 +628,8 @@ export declare class EmbeddedSpreadsheet {
639
628
  SetLink(address?: AddressReference, target?: string): void;
640
629
 
641
630
  /**
642
- * Select a range.
631
+ * Select a range. This function will change sheets if your reference
632
+ * refers to a different sheet.
643
633
  *
644
634
  * @public
645
635
  */
@@ -712,6 +702,45 @@ export interface SerializeOptions {
712
702
  shrink?: boolean;
713
703
  }
714
704
 
705
+ /**
706
+ * options for the SetRange method
707
+ */
708
+ export interface SetRangeOptions {
709
+
710
+ /** transpose rectangular array before inserting */
711
+ transpose?: boolean;
712
+
713
+ /** recycle values (R-style) */
714
+ recycle?: boolean;
715
+
716
+ /** apply as an array (as if you pressed ctrl+shift+enter) */
717
+ array?: boolean;
718
+
719
+ /** spill over */
720
+ spill?: boolean;
721
+
722
+ /**
723
+ * argument separator to use when parsing the input formula. by default,
724
+ * parsing uses the current locale. that is not optimal, because you
725
+ * do not necessarily know ahead of time where a spreadsheet may be viewed.
726
+ *
727
+ * set this option to call SetRange with a consistent argument separator.
728
+ * the decimal separator is implied; if the argument separator is set to
729
+ * comma (',') the decimal mark will be a dot ('.'); and if the argument
730
+ * separator is set to semicolon (';') the decimal mark will be set to
731
+ * comma (','). you cannot mix and match these values.
732
+ *
733
+ * @see EvaluateOptions for more discussion of this option.
734
+ */
735
+ argument_separator?: ',' | ';';
736
+
737
+ /**
738
+ * allow R1C1-style references; these can be either
739
+ * direct (e.g. R2C4) or offset (e.g. R[-3]C[0]).
740
+ */
741
+ r1c1?: boolean;
742
+ }
743
+
715
744
  /**
716
745
  * Structure represents a cell address. Note that row and column are 0-based.
717
746
  */
@@ -1106,3 +1135,37 @@ export interface DocumentChangeEvent {
1106
1135
  export interface SelectionEvent {
1107
1136
  type: 'selection';
1108
1137
  }
1138
+
1139
+ /**
1140
+ * options for the evaluate function
1141
+ */
1142
+ export interface EvaluateOptions {
1143
+
1144
+ /**
1145
+ * By default, the Evaluate function will evaluate the expression in the
1146
+ * current locale, meaning it will use the current locale's decimal separator
1147
+ * and argument separator.
1148
+ *
1149
+ * If you do not want that behavior, set the argument separator explicitly.
1150
+ * That will force evaluation using either comma (,) or semicolon (;) as the
1151
+ * argument separator.
1152
+ *
1153
+ * Decimal separator is implied by the argument separator. If you set the
1154
+ * argument separator to comma, the decimal separator will be dot (.). If you
1155
+ * set the argument separator to semicolon, the decimal separator will be
1156
+ * comma (,). You cannot mix-and-match these characters.
1157
+ *
1158
+ * Since you may not know where the code is being executed at run-time,
1159
+ * using consistent argument and decimal separators makes sense. However we
1160
+ * are leaving the original behavior as default for backwards compatibility.
1161
+ */
1162
+ argument_separator?: ',' | ';';
1163
+
1164
+ /**
1165
+ * allow R1C1-style references. the Evaluate function cannot use
1166
+ * offset references (e.g. R[-1]C[0]), so those will always fail.
1167
+ * however it may be useful to use direct R1C1 references (e.g. R3C4),
1168
+ * so we optionally support that behind this flag.
1169
+ */
1170
+ r1c1?: boolean;
1171
+ }