@trebco/treb 22.12.1 → 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.12. 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
  *
@@ -549,29 +531,12 @@ export declare class EmbeddedSpreadsheet {
549
531
  * use sheet names when referring to cells, to avoid ambiguity. Otherwise
550
532
  * cell references will resolve to the active sheet.
551
533
  *
552
- * By default, this function will evaluate the expression in the current
553
- * locale, meaning it will use the current locale's decimal separator and
554
- * argument separator.
555
- *
556
- * If you do not want that behavior, set the argument separator explicitly.
557
- * That will force evaluation using either comma (,) or semicolon (;) as the
558
- * argument separator.
559
- *
560
- * Decimal separator is implied by the argument separator. If you set the
561
- * argument separator to comma, the decimal separator will be dot (.). If you
562
- * set the argument separator to semicolon, the decimal separator will be
563
- * comma (,). You cannot mix-and-match these characters.
564
- *
565
- * Since you may not know where the code is being executed at run-time,
566
- * using consistent argument and decimal separators makes sense. However we
567
- * are leaving the original behavior as default for backwards compatibility.
568
- *
569
534
  * @param expression - an expression in spreadsheet language
570
- * @param argument_separator - comma or semicolon, or leave undefined to use current locale
535
+ * @param options - options for parsing the passed function
571
536
  *
572
537
  * @public
573
538
  */
574
- Evaluate(expression: string, argument_separator?: ',' | ';'): CellValue | CellValue[][];
539
+ Evaluate(expression: string, options?: EvaluateOptions): CellValue | CellValue[][];
575
540
 
576
541
  /**
577
542
  * Returns the current selection, as a string address or range.
@@ -737,6 +702,45 @@ export interface SerializeOptions {
737
702
  shrink?: boolean;
738
703
  }
739
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
+
740
744
  /**
741
745
  * Structure represents a cell address. Note that row and column are 0-based.
742
746
  */
@@ -1131,3 +1135,37 @@ export interface DocumentChangeEvent {
1131
1135
  export interface SelectionEvent {
1132
1136
  type: 'selection';
1133
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
+ }