@trebco/treb 27.0.1 → 27.1.2

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/dist/treb.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- /*! API v27.0. Copyright 2018-2023 trebco, llc. All rights reserved. LGPL: https://treb.app/license */
1
+ /*! API v27.1. Copyright 2018-2023 trebco, llc. All rights reserved. LGPL: https://treb.app/license */
2
2
 
3
3
  /**
4
4
  * add our tag to the map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trebco/treb",
3
- "version": "27.0.1",
3
+ "version": "27.1.2",
4
4
  "license": "LGPL-3.0-or-later",
5
5
  "homepage": "https://treb.app",
6
6
  "repository": {
@@ -13,8 +13,8 @@
13
13
  "devDependencies": {
14
14
  "@types/html-minifier": "^4.0.2",
15
15
  "@types/node": "^20.4.0",
16
- "@typescript-eslint/eslint-plugin": "^5.30.4",
17
- "@typescript-eslint/parser": "^5.30.4",
16
+ "@typescript-eslint/eslint-plugin": "^6.1.0",
17
+ "@typescript-eslint/parser": "^6.1.0",
18
18
  "archiver": "^5.3.0",
19
19
  "cssnano": "^6.0.0",
20
20
  "esbuild": "^0.18.11",
@@ -811,6 +811,33 @@ export class Calculator extends Graph {
811
811
  },
812
812
  },
813
813
 
814
+
815
+ /** not sure when this one appeared, but it's what I was looking for */
816
+ FormulaText: {
817
+ description: 'Returns a formula as a string',
818
+ arguments: [
819
+ { name: 'reference', description: 'Cell reference', metadata: true, },
820
+ ],
821
+ fn: Utilities.ApplyAsArray((reference: UnionValue): UnionValue => {
822
+
823
+ if (!UnionIsMetadata(reference)) {
824
+ return ReferenceError();
825
+ }
826
+
827
+ const sheet = this.model.sheets.Find(reference.value?.address?.sheet_id || 0);
828
+ if (sheet) {
829
+ const cell = sheet.cells.GetCell(reference.value.address, false);
830
+ return {
831
+ type: ValueType.string,
832
+ value: cell?.value?.toString() || '',
833
+ };
834
+ }
835
+
836
+ return ReferenceError();
837
+
838
+ }),
839
+ },
840
+
814
841
  /**
815
842
  * this should be in the 'information' library but it needs reference
816
843
  * to the underlying cell (unresolved)
@@ -887,6 +887,9 @@ export class EmbeddedSpreadsheet {
887
887
  if (data) {
888
888
  this.LoadDocument(data as TREBDocument, { recalculate: !!this.options.recalculate, source});
889
889
  }
890
+ else {
891
+ this.UpdateDocumentStyles();
892
+ }
890
893
  }
891
894
  else if (!network_document) {
892
895
 
@@ -894,6 +897,7 @@ export class EmbeddedSpreadsheet {
894
897
  // and the calculator, which would otherwise happen on document load
895
898
 
896
899
  this.calculator.RebuildClean(true);
900
+ this.UpdateDocumentStyles();
897
901
 
898
902
  }
899
903
 
@@ -2410,17 +2414,7 @@ export class EmbeddedSpreadsheet {
2410
2414
  }
2411
2415
 
2412
2416
  if (blob) {
2413
-
2414
- /*
2415
- const a = document.createElement('a');
2416
- a.href = URL.createObjectURL(blob);
2417
- a.download = filename + '.xlsx';
2418
- a.click();
2419
- URL.revokeObjectURL(a.href);
2420
- // FileSaver.saveAs(blob, filename + '.xlsx', { autoBom: false });
2421
- */
2422
2417
  this.SaveAs(blob, filename + '.xlsx');
2423
-
2424
2418
  this.last_save_version = this.file_version; // even though it's an export, consider it clean
2425
2419
  }
2426
2420