Skip to content

Commit

Permalink
Fix Async/Promises and fsspreadsheet readin 🎉
Browse files Browse the repository at this point in the history
  • Loading branch information
Freymaurer committed Aug 1, 2023
1 parent caf21db commit d14448e
Show file tree
Hide file tree
Showing 48 changed files with 5,020 additions and 48 deletions.
8 changes: 8 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
### 3.2.2+caf21db (Released 2023-8-1)

### 3.2.1+caf21db (Released 2023-8-1)
* Additions:
* [[#cb35186](https://github.com/CSBiology/FsSpreadsheet/commit/cb3518609e9fe42e05789441906dc148a4b8d53e)] Update and clean up RELEASE_NOTES.md
* [[#489f6b7](https://github.com/CSBiology/FsSpreadsheet/commit/489f6b77789cca13840382d5c2dd03dc973b65df)] Add logo to Exceljs project file
* [[#caf21db](https://github.com/CSBiology/FsSpreadsheet/commit/caf21db25490908a61381fd229fdaf5cc9a66ab2)] INcrease package.json version together with fake task.

### 3.2.0+e47262b (Released 2023-7-31)
* Additions:
* [[#2b9c7fa](https://github.com/CSBiology/FsSpreadsheet/commit/2b9c7fa2c3fccfb6a5956b2e244a557fda4e0793)] Add some tests for exceljs
Expand Down
2 changes: 1 addition & 1 deletion build/ReleaseNotesTasks.fs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ let updateReleaseNotes = BuildTask.createFn "ReleaseNotes" [] (fun config ->
|> fun x -> x.SemVer.AsString

// Update Version in src/Nfdi4Plants.Fornax.Template/package.json
let p = "src/Nfdi4Plants.Fornax.Template/content/package.json"
let p = "package.json"
let t = System.IO.File.ReadAllText p
let tNew = System.Text.RegularExpressions.Regex.Replace(t, """\"version\": \".*\",""", sprintf "\"version\": \"%s\"," semVer )
System.IO.File.WriteAllText(p, tNew)
Expand Down
38 changes: 38 additions & 0 deletions dist/FsExtensions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { Xlsx } from "./Xlsx.js";

export function FsSpreadsheet_FsWorkbook__FsWorkbook_fromXlsxFile_Static_Z721C83C5(path) {
return Xlsx.fromXlsxFile(path);
}

export function FsSpreadsheet_FsWorkbook__FsWorkbook_fromXlsxStream_Static_4D976C1A(stream) {
return Xlsx.fromXlsxStream(stream);
}

export function FsSpreadsheet_FsWorkbook__FsWorkbook_fromBytes_Static_Z3F6BC7B1(bytes) {
return Xlsx.fromBytes(bytes);
}

export function FsSpreadsheet_FsWorkbook__FsWorkbook_toFile_Static(path, wb) {
return Xlsx.toFile(path, wb);
}

export function FsSpreadsheet_FsWorkbook__FsWorkbook_toStream_Static(stream, wb) {
return Xlsx.toStream(stream, wb);
}

export function FsSpreadsheet_FsWorkbook__FsWorkbook_toBytes_Static_32154C9D(wb) {
return Xlsx.toBytes(wb);
}

export function FsSpreadsheet_FsWorkbook__FsWorkbook_ToFile_Z721C83C5(this$, path) {
return FsSpreadsheet_FsWorkbook__FsWorkbook_toFile_Static(path, this$);
}

export function FsSpreadsheet_FsWorkbook__FsWorkbook_ToStream_4D976C1A(this$, stream) {
return FsSpreadsheet_FsWorkbook__FsWorkbook_toStream_Static(stream, this$);
}

export function FsSpreadsheet_FsWorkbook__FsWorkbook_ToBytes(this$) {
return FsSpreadsheet_FsWorkbook__FsWorkbook_toBytes_Static_32154C9D(this$);
}

240 changes: 240 additions & 0 deletions dist/FsSpreadsheet/Cells/FsCell.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,240 @@
import { toString as toString_1, Union } from "../../fable_modules/fable-library.4.1.3/Types.js";
import { class_type, union_type } from "../../fable_modules/fable-library.4.1.3/Reflection.js";
import { FsAddress__Copy, CellReference_indexToColAdress, FsAddress__get_ColumnNumber, FsAddress__get_RowNumber, FsAddress_$ctor_Z37302880 } from "../FsAddress.js";
import { int64ToString, int16ToString, int32ToString } from "../../fable_modules/fable-library.4.1.3/Util.js";
import { parse as parse_4, toString } from "../../fable_modules/fable-library.4.1.3/Decimal.js";
import Decimal from "../../fable_modules/fable-library.4.1.3/Decimal.js";
import { parse } from "../../fable_modules/fable-library.4.1.3/Boolean.js";
import { parse as parse_1 } from "../../fable_modules/fable-library.4.1.3/Double.js";
import { parse as parse_2 } from "../../fable_modules/fable-library.4.1.3/Int32.js";
import { toUInt64, toInt64 } from "../../fable_modules/fable-library.4.1.3/BigInt.js";
import { parse as parse_3 } from "../../fable_modules/fable-library.4.1.3/Long.js";
import { parse as parse_5 } from "../../fable_modules/fable-library.4.1.3/Date.js";
import { parse as parse_6 } from "../../fable_modules/fable-library.4.1.3/Guid.js";
import { parse as parse_7 } from "../../fable_modules/fable-library.4.1.3/Char.js";
import { map, defaultArg } from "../../fable_modules/fable-library.4.1.3/Option.js";

export class DataType extends Union {
constructor(tag, fields) {
super();
this.tag = tag;
this.fields = fields;
}
cases() {
return ["String", "Boolean", "Number", "Date", "Empty"];
}
}

export function DataType_$reflection() {
return union_type("FsSpreadsheet.DataType", [], DataType, () => [[], [], [], [], []]);
}

export class FsCell {
constructor(value, dataType, address) {
this._cellValue = toString_1(value);
this._dataType = defaultArg(dataType, new DataType(0, []));
this._comment = "";
this._hyperlink = "";
this._richText = "";
this._formulaA1 = "";
this._formulaR1C1 = "";
this._rowIndex = (defaultArg(map(FsAddress__get_RowNumber, address), 0) | 0);
this._columnIndex = (defaultArg(map(FsAddress__get_ColumnNumber, address), 0) | 0);
}
static empty() {
return new FsCell("", new DataType(4, []), FsAddress_$ctor_Z37302880(0, 0));
}
get Value() {
const self = this;
return self._cellValue;
}
set Value(value) {
const self = this;
self._cellValue = value;
}
get DataType() {
const self = this;
return self._dataType;
}
set DataType(dataType) {
const self = this;
self._dataType = dataType;
}
get ColumnNumber() {
const self = this;
return self._columnIndex | 0;
}
set ColumnNumber(colI) {
const self = this;
self._columnIndex = (colI | 0);
}
get RowNumber() {
const self = this;
return self._rowIndex | 0;
}
set RowNumber(rowI) {
const self = this;
self._rowIndex = (rowI | 0);
}
get Address() {
const self = this;
return FsAddress_$ctor_Z37302880(self._rowIndex, self._columnIndex);
}
set Address(address) {
const self = this;
self._rowIndex = (FsAddress__get_RowNumber(address) | 0);
self._columnIndex = (FsAddress__get_ColumnNumber(address) | 0);
}
static create(rowNumber, colNumber, value) {
let patternInput;
const value_1_1 = value;
patternInput = ((typeof value_1_1 === "string") ? [new DataType(0, []), value_1_1] : ((typeof value_1_1 === "boolean") ? (value_1_1 ? [new DataType(1, []), "True"] : [new DataType(1, []), "False"]) : ((typeof value_1_1 === "number") ? [new DataType(2, []), value_1_1.toString()] : ((typeof value_1_1 === "number") ? [new DataType(2, []), value_1_1.toString()] : ((typeof value_1_1 === "number") ? [new DataType(2, []), int32ToString(value_1_1)] : ((typeof value_1_1 === "number") ? [new DataType(2, []), int16ToString(value_1_1)] : ((typeof value_1_1 === "bigint") ? [new DataType(2, []), int64ToString(value_1_1)] : ((typeof value_1_1 === "number") ? [new DataType(2, []), value_1_1.toString()] : ((typeof value_1_1 === "number") ? [new DataType(2, []), value_1_1.toString()] : ((typeof value_1_1 === "bigint") ? [new DataType(2, []), value_1_1.toString()] : ((typeof value_1_1 === "number") ? [new DataType(2, []), value_1_1.toString()] : ((typeof value_1_1 === "number") ? [new DataType(2, []), value_1_1.toString()] : ((value_1_1 instanceof Decimal) ? [new DataType(2, []), toString(value_1_1)] : ((value_1_1 instanceof Date) ? [new DataType(3, []), toString_1(value_1_1)] : ((typeof value_1_1 === "string") ? [new DataType(0, []), value_1_1] : [new DataType(0, []), toString_1(value_1_1)])))))))))))))));
return new FsCell(patternInput[1], patternInput[0], FsAddress_$ctor_Z37302880(rowNumber, colNumber));
}
static createEmpty() {
return new FsCell("", new DataType(4, []), FsAddress_$ctor_Z37302880(0, 0));
}
static createWithAdress(adress, value) {
let patternInput;
const value_1_1 = value;
patternInput = ((typeof value_1_1 === "string") ? [new DataType(0, []), value_1_1] : ((typeof value_1_1 === "boolean") ? (value_1_1 ? [new DataType(1, []), "True"] : [new DataType(1, []), "False"]) : ((typeof value_1_1 === "number") ? [new DataType(2, []), value_1_1.toString()] : ((typeof value_1_1 === "number") ? [new DataType(2, []), value_1_1.toString()] : ((typeof value_1_1 === "number") ? [new DataType(2, []), int32ToString(value_1_1)] : ((typeof value_1_1 === "number") ? [new DataType(2, []), int16ToString(value_1_1)] : ((typeof value_1_1 === "bigint") ? [new DataType(2, []), int64ToString(value_1_1)] : ((typeof value_1_1 === "number") ? [new DataType(2, []), value_1_1.toString()] : ((typeof value_1_1 === "number") ? [new DataType(2, []), value_1_1.toString()] : ((typeof value_1_1 === "bigint") ? [new DataType(2, []), value_1_1.toString()] : ((typeof value_1_1 === "number") ? [new DataType(2, []), value_1_1.toString()] : ((typeof value_1_1 === "number") ? [new DataType(2, []), value_1_1.toString()] : ((value_1_1 instanceof Decimal) ? [new DataType(2, []), toString(value_1_1)] : ((value_1_1 instanceof Date) ? [new DataType(3, []), toString_1(value_1_1)] : ((typeof value_1_1 === "string") ? [new DataType(0, []), value_1_1] : [new DataType(0, []), toString_1(value_1_1)])))))))))))))));
return new FsCell(patternInput[1], patternInput[0], adress);
}
static createEmptyWithAdress(adress) {
return new FsCell("", new DataType(4, []), adress);
}
static createWithDataType(dataType, rowNumber, colNumber, value) {
return new FsCell(value, dataType, FsAddress_$ctor_Z37302880(rowNumber, colNumber));
}
toString() {
const self = this;
return `${CellReference_indexToColAdress(self.ColumnNumber >>> 0)}${self.RowNumber} : ${self.Value} | ${self.DataType}`;
}
CopyFrom(otherCell) {
const self = this;
self.DataType = otherCell.DataType;
self.Value = otherCell.Value;
}
CopyTo(target) {
const self = this;
target.DataType = self.DataType;
target.Value = self.Value;
}
static copyFromTo(sourceCell, targetCell) {
targetCell.DataType = sourceCell.DataType;
targetCell.Value = sourceCell.Value;
return targetCell;
}
Copy() {
const self = this;
return new FsCell(self.Value, self.DataType, FsAddress__Copy(self.Address));
}
static copy(cell) {
return cell.Copy();
}
ValueAsString() {
const self = this;
return self.Value;
}
static getValueAsString(cell) {
return cell.ValueAsString();
}
ValueAsBool() {
const self = this;
return parse(self.Value);
}
static getValueAsBool(cell) {
return cell.ValueAsBool();
}
ValueAsFloat() {
const self = this;
return parse_1(self.Value);
}
static getValueAsFloat(cell) {
return cell.ValueAsFloat();
}
ValueAsInt() {
const self = this;
return parse_2(self.Value, 511, false, 32) | 0;
}
static getValueAsInt(cell) {
return cell.ValueAsInt();
}
ValueAsUInt() {
const self = this;
return parse_2(self.Value, 511, true, 32);
}
static getValueAsUInt(cell) {
return cell.ValueAsUInt();
}
ValueAsLong() {
const self = this;
return toInt64(parse_3(self.Value, 511, false, 64));
}
static getValueAsLong(cell) {
return cell.ValueAsLong();
}
ValueAsULong() {
const self = this;
return toUInt64(parse_3(self.Value, 511, true, 64));
}
static getValueAsULong(cell) {
return cell.ValueAsULong();
}
ValueAsDouble() {
const self = this;
return parse_1(self.Value);
}
static getValueAsDouble(cell) {
return cell.ValueAsDouble();
}
ValueAsDecimal() {
const self = this;
return parse_4(self.Value);
}
static getValueAsDecimal(cell) {
return cell.ValueAsDecimal();
}
ValueAsDateTime() {
const self = this;
return parse_5(self.Value);
}
static getValueAsDateTime(cell) {
return cell.ValueAsDateTime();
}
ValueAsGuid() {
const self = this;
return parse_6(self.Value);
}
static getValueAsGuid(cell) {
return cell.ValueAsGuid();
}
ValueAsChar() {
const self = this;
return parse_7(self.Value);
}
static getValueAsChar(cell) {
return cell.ValueAsChar();
}
SetValueAs(value) {
const self = this;
let patternInput;
const value_1_1 = value;
patternInput = ((typeof value_1_1 === "string") ? [new DataType(0, []), value_1_1] : ((typeof value_1_1 === "boolean") ? (value_1_1 ? [new DataType(1, []), "True"] : [new DataType(1, []), "False"]) : ((typeof value_1_1 === "number") ? [new DataType(2, []), value_1_1.toString()] : ((typeof value_1_1 === "number") ? [new DataType(2, []), value_1_1.toString()] : ((typeof value_1_1 === "number") ? [new DataType(2, []), int32ToString(value_1_1)] : ((typeof value_1_1 === "number") ? [new DataType(2, []), int16ToString(value_1_1)] : ((typeof value_1_1 === "bigint") ? [new DataType(2, []), int64ToString(value_1_1)] : ((typeof value_1_1 === "number") ? [new DataType(2, []), value_1_1.toString()] : ((typeof value_1_1 === "number") ? [new DataType(2, []), value_1_1.toString()] : ((typeof value_1_1 === "bigint") ? [new DataType(2, []), value_1_1.toString()] : ((typeof value_1_1 === "number") ? [new DataType(2, []), value_1_1.toString()] : ((typeof value_1_1 === "number") ? [new DataType(2, []), value_1_1.toString()] : ((value_1_1 instanceof Decimal) ? [new DataType(2, []), toString(value_1_1)] : ((value_1_1 instanceof Date) ? [new DataType(3, []), toString_1(value_1_1)] : ((typeof value_1_1 === "string") ? [new DataType(0, []), value_1_1] : [new DataType(0, []), toString_1(value_1_1)])))))))))))))));
self._dataType = patternInput[0];
self._cellValue = patternInput[1];
}
static setValueAs(value, cell) {
cell.SetValueAs(value);
return cell;
}
}

export function FsCell_$reflection() {
return class_type("FsSpreadsheet.FsCell", void 0, FsCell);
}

export function FsCell_$ctor_Z44506C7(value, dataType, address) {
return new FsCell(value, dataType, address);
}

Loading

0 comments on commit d14448e

Please sign in to comment.