@nfdi4plants/arctrl 1.0.0-alpha9 → 1.0.0-beta.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.
Files changed (76) hide show
  1. package/ARC.js +5 -6
  2. package/ISA/ISA/ArcTypes/ArcTables.js +275 -271
  3. package/ISA/ISA/ArcTypes/ArcTypes.js +29 -313
  4. package/ISA/ISA.Spreadsheet/AnnotationTable/ArcTable.js +15 -13
  5. package/ISA/ISA.Spreadsheet/AnnotationTable/CompositeCell.js +2 -2
  6. package/ISA/ISA.Spreadsheet/AnnotationTable/CompositeColumn.js +4 -4
  7. package/ISA/ISA.Spreadsheet/AnnotationTable/CompositeHeader.js +6 -6
  8. package/ISA/ISA.Spreadsheet/ArcAssay.js +6 -9
  9. package/ISA/ISA.Spreadsheet/ArcInvestigation.js +4 -4
  10. package/ISA/ISA.Spreadsheet/ArcStudy.js +5 -5
  11. package/ISA/ISA.Spreadsheet/Metadata/SparseTable.js +9 -9
  12. package/README.md +3 -0
  13. package/Templates/Template.Json.js +5 -2
  14. package/Templates/Template.Spreadsheet.js +23 -7
  15. package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/Cells/FsCell.fs +85 -36
  16. package/fable_modules/FsSpreadsheet.5.0.0/Cells/FsCell.fs.js +272 -0
  17. package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/DSL/CellBuilder.fs +1 -0
  18. package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/DSL/CellBuilder.fs.js +18 -18
  19. package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/DSL/Transform.fs +1 -1
  20. package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/DSL/Transform.fs.js +2 -1
  21. package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/DSL/Types.fs +1 -1
  22. package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/DSL/Types.fs.js +4 -4
  23. package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/FsColumn.fs +3 -1
  24. package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/FsRow.fs +2 -0
  25. package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/FsWorksheet.fs +10 -1
  26. package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/FsWorksheet.fs.js +5 -0
  27. package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/SheetBuilder.fs +4 -4
  28. package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/SheetBuilder.fs.js +3 -3
  29. package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/Tables/FsTable.fs +20 -4
  30. package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/Tables/FsTable.fs.js +26 -6
  31. package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/obj/Release/netstandard2.0/FsSpreadsheet.AssemblyInfo.fs +3 -3
  32. package/fable_modules/project_cracked.json +1 -1
  33. package/package.json +1 -1
  34. package/fable_modules/FsSpreadsheet.4.1.0/Cells/FsCell.fs.js +0 -240
  35. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/Cells/FsCellsCollection.fs +0 -0
  36. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/Cells/FsCellsCollection.fs.js +0 -0
  37. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/DSL/ColumnBuilder.fs +0 -0
  38. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/DSL/ColumnBuilder.fs.js +0 -0
  39. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/DSL/DSL.fs +0 -0
  40. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/DSL/DSL.fs.js +0 -0
  41. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/DSL/Expression.fs +0 -0
  42. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/DSL/Expression.fs.js +0 -0
  43. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/DSL/Operators.fs +0 -0
  44. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/DSL/Operators.fs.js +0 -0
  45. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/DSL/RowBuilder.fs +0 -0
  46. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/DSL/RowBuilder.fs.js +0 -0
  47. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/DSL/SheetBuilder.fs +0 -0
  48. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/DSL/SheetBuilder.fs.js +0 -0
  49. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/DSL/TableBuilder.fs +0 -0
  50. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/DSL/TableBuilder.fs.js +0 -0
  51. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/DSL/WorkbookBuilder.fs +0 -0
  52. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/DSL/WorkbookBuilder.fs.js +0 -0
  53. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/FsAddress.fs +0 -0
  54. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/FsAddress.fs.js +0 -0
  55. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/FsColumn.fs.js +0 -0
  56. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/FsRow.fs.js +0 -0
  57. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/FsSpreadsheet.fableproj +0 -0
  58. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/FsWorkbook.fs +0 -0
  59. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/FsWorkbook.fs.js +0 -0
  60. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/Ranges/FsRange.fs +0 -0
  61. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/Ranges/FsRange.fs.js +0 -0
  62. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/Ranges/FsRangeAddress.fs +0 -0
  63. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/Ranges/FsRangeAddress.fs.js +0 -0
  64. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/Ranges/FsRangeBase.fs +0 -0
  65. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/Ranges/FsRangeBase.fs.js +0 -0
  66. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/Ranges/FsRangeColumn.fs +0 -0
  67. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/Ranges/FsRangeColumn.fs.js +0 -0
  68. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/Ranges/FsRangeRow.fs +0 -0
  69. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/Ranges/FsRangeRow.fs.js +0 -0
  70. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/Tables/FsTableField.fs +0 -0
  71. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/Tables/FsTableField.fs.js +0 -0
  72. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/Tables/FsTableRow.fs +0 -0
  73. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/Tables/FsTableRow.fs.js +0 -0
  74. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +0 -0
  75. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/obj/Debug/netstandard2.0/FsSpreadsheet.AssemblyInfo.fs +0 -0
  76. /package/fable_modules/{FsSpreadsheet.4.1.0 → FsSpreadsheet.5.0.0}/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +0 -0
@@ -4,6 +4,15 @@ open System
4
4
 
5
5
  open Fable.Core
6
6
 
7
+ //type Hyperlink = {
8
+ // Text: string
9
+ // Hyperlink: string
10
+ //} with
11
+ // static member create(text, hyperlink) = {
12
+ // Text = text
13
+ // Hyperlink = hyperlink
14
+ // }
15
+
7
16
  /// <summary>
8
17
  /// Possible DataTypes used in a FsCell.
9
18
  /// </summary>
@@ -12,6 +21,7 @@ type DataType =
12
21
  | Boolean
13
22
  | Number
14
23
  | Date
24
+ //| Hyperlink
15
25
  | Empty
16
26
 
17
27
  /// <summary>
@@ -20,34 +30,40 @@ type DataType =
20
30
  static member inline InferCellValue (value : 'T) =
21
31
  let value = box value
22
32
  match value with
23
- | :? char as c -> DataType.String,c.ToString()
24
- | :? bool as true -> DataType.Boolean, "True"
25
- | :? bool as false -> DataType.Boolean, "False"
26
- | :? byte as i -> DataType.Number,i.ToString()
27
- | :? sbyte as i -> DataType.Number,i.ToString()
28
- | :? int as i -> DataType.Number,i.ToString()
29
- | :? int16 as i -> DataType.Number,i.ToString()
30
- | :? int64 as i -> DataType.Number,i.ToString()
31
- | :? uint as i -> DataType.Number,i.ToString()
32
- | :? uint16 as i -> DataType.Number,i.ToString()
33
- | :? uint64 as i -> DataType.Number,i.ToString()
34
- | :? single as i -> DataType.Number,i.ToString()
35
- | :? float as i -> DataType.Number,i.ToString()
36
- | :? decimal as i -> DataType.Number,i.ToString()
37
- | :? System.DateTime as d -> DataType.Date,d.ToString()
38
- | :? string as s -> DataType.String,s.ToString()
39
- | _ -> DataType.String,value.ToString()
33
+ //| :? Hyperlink as hpl -> DataType.Hyperlink, value
34
+ | :? char as c -> DataType.String, value
35
+ | :? bool as true -> DataType.Boolean, true
36
+ | :? bool as false -> DataType.Boolean, false
37
+ | :? byte as i -> DataType.Number, value
38
+ | :? sbyte as i -> DataType.Number, value
39
+ | :? int as i -> DataType.Number, value
40
+ | :? int16 as i -> DataType.Number, value
41
+ | :? int64 as i -> DataType.Number, value
42
+ | :? uint as i -> DataType.Number, value
43
+ | :? uint16 as i -> DataType.Number,value
44
+ | :? uint64 as i -> DataType.Number,value
45
+ | :? single as i -> DataType.Number,value
46
+ | :? float as i -> DataType.Number,value
47
+ | :? decimal as i -> DataType.Number,value
48
+ | :? System.DateTime as d -> DataType.Date,value
49
+ | :? string as s -> DataType.String,value
50
+ | _ -> DataType.String,value
40
51
 
41
52
  // Type based on the type XLCell used in ClosedXml
42
53
  /// <summary>
43
54
  /// Creates an FsCell of `DataType` dataType, with value of type `string`, and `FsAddress` address.
44
55
  /// </summary>
45
56
 
57
+ module FsCellAux =
58
+
59
+ let boolConverter (bool:bool) =
60
+ match bool with | true -> "1" | false -> "0"
61
+
46
62
  [<AttachMembers>]
47
- type FsCell (value : IConvertible, ?dataType : DataType, ?address : FsAddress) =
63
+ type FsCell (value : obj, ?dataType : DataType, ?address : FsAddress) =
48
64
 
49
65
  // TODO: Maybe save as IConvertible
50
- let mutable _cellValue = string value
66
+ let mutable _cellValue : obj = value
51
67
  let mutable _dataType = dataType |> Option.defaultValue DataType.String
52
68
  let mutable _comment = ""
53
69
  let mutable _hyperlink = ""
@@ -58,9 +74,9 @@ type FsCell (value : IConvertible, ?dataType : DataType, ?address : FsAddress) =
58
74
  let mutable _rowIndex : int = address |> Option.map (fun a -> a.RowNumber) |> Option.defaultValue 0
59
75
  let mutable _columnIndex : int = address |> Option.map (fun a -> a.ColumnNumber) |> Option.defaultValue 0
60
76
 
61
-
77
+ new(value: IConvertible, ?dataType : DataType, ?address : FsAddress) = FsCell(box value, ?dataType = dataType, ?address = address)
62
78
  /// Creates an empty FsCell, set at row 0, column 0 (1-based).
63
- static member empty () = FsCell ("", DataType.Empty, FsAddress(0,0))
79
+ static member inline empty () = FsCell ("", DataType.Empty, FsAddress(0,0))
64
80
 
65
81
  ///// Creates an FsCell of `DataType` `Number`, with the given value, set at row 1, column 1 (1-based).
66
82
  //new (value : int) = FsCell (string value, DataType.Number, FsAddress(0,0))
@@ -158,8 +174,8 @@ type FsCell (value : IConvertible, ?dataType : DataType, ?address : FsAddress) =
158
174
  /// <summary>
159
175
  /// Creates an FsCell with the given DataType, rowNumber, colNumber, and value.
160
176
  /// </summary>
161
- static member createWithDataType (dataType : DataType) (rowNumber : int) (colNumber : int) value =
162
- FsCell(value, dataType, FsAddress(rowNumber, colNumber))
177
+ static member createWithDataType (dataType : DataType) (rowNumber : int) (colNumber : int) (value: obj) =
178
+ FsCell(value, dataType, FsAddress(rowNumber, colNumber))
163
179
 
164
180
  //how 2:
165
181
  //return (format.ToUpper()) switch
@@ -222,8 +238,17 @@ type FsCell (value : IConvertible, ?dataType : DataType, ?address : FsAddress) =
222
238
  /// <summary>
223
239
  /// Gets the value as string
224
240
  /// </summary>
225
- member self.ValueAsString() =
226
- self.Value
241
+ member self.ValueAsString() : string =
242
+ let v = self.Value
243
+ match self.DataType with
244
+ | DataType.String | DataType.Date | DataType.Boolean | DataType.Empty ->
245
+ v.ToString()
246
+ | Number ->
247
+ // Example: 4.123:
248
+ // - (4.123)ToString() will parse floats in germany to "4,123" which is not allowed by Excel.
249
+ // - string(4.123) will parse floats in germany to "4.123" which is allowed by Excel.
250
+ // TODO: Maybe swap to (90.213).ToString(new Globalization.CultureInfo("en-US") ) // val it: string = "90.213"
251
+ string v
227
252
 
228
253
  /// <summary>
229
254
  /// Gets the value as string
@@ -235,7 +260,10 @@ type FsCell (value : IConvertible, ?dataType : DataType, ?address : FsAddress) =
235
260
  /// Gets the value as bool
236
261
  /// </summary>
237
262
  member self.ValueAsBool() =
238
- bool.Parse (self.Value)
263
+ match (string self.Value).ToLower() with
264
+ | "1" | "true" | "true()" -> true
265
+ | "0" | "false" | "false()" -> false
266
+ | anyElse -> raise (System.FormatException($"String '{anyElse}' was not recognized as a valid Boolean"))
239
267
 
240
268
  /// <summary>
241
269
  /// Gets the value as bool
@@ -247,7 +275,7 @@ type FsCell (value : IConvertible, ?dataType : DataType, ?address : FsAddress) =
247
275
  /// Gets the value as float
248
276
  /// </summary>
249
277
  member self.ValueAsFloat() =
250
- Double.Parse (self.Value)
278
+ Double.Parse (string self.Value)
251
279
 
252
280
  /// <summary>
253
281
  /// Gets the value as float
@@ -259,7 +287,7 @@ type FsCell (value : IConvertible, ?dataType : DataType, ?address : FsAddress) =
259
287
  /// Gets the value as int
260
288
  /// </summary>
261
289
  member self.ValueAsInt() =
262
- Int32.Parse (self.Value)
290
+ Int32.Parse (string self.Value)
263
291
 
264
292
  /// <summary>
265
293
  /// Gets the value as int
@@ -271,7 +299,7 @@ type FsCell (value : IConvertible, ?dataType : DataType, ?address : FsAddress) =
271
299
  /// Gets the value as uint
272
300
  /// </summary>
273
301
  member self.ValueAsUInt() =
274
- UInt32.Parse (self.Value)
302
+ UInt32.Parse (string self.Value)
275
303
 
276
304
  /// <summary>
277
305
  /// Gets the value as uint
@@ -283,7 +311,7 @@ type FsCell (value : IConvertible, ?dataType : DataType, ?address : FsAddress) =
283
311
  /// Gets the value as long
284
312
  /// </summary>
285
313
  member self.ValueAsLong() =
286
- Int64.Parse (self.Value)
314
+ Int64.Parse (string self.Value)
287
315
 
288
316
  /// <summary>
289
317
  /// Gets the value as long
@@ -295,7 +323,7 @@ type FsCell (value : IConvertible, ?dataType : DataType, ?address : FsAddress) =
295
323
  /// Gets the value as ulong
296
324
  /// </summary>
297
325
  member self.ValueAsULong() =
298
- UInt64.Parse (self.Value)
326
+ UInt64.Parse (string self.Value)
299
327
 
300
328
  /// <summary>
301
329
  /// Gets the value as ulong
@@ -307,7 +335,7 @@ type FsCell (value : IConvertible, ?dataType : DataType, ?address : FsAddress) =
307
335
  /// Gets the value as double
308
336
  /// </summary>
309
337
  member self.ValueAsDouble() =
310
- Double.Parse (self.Value)
338
+ Double.Parse (string self.Value)
311
339
 
312
340
  /// <summary>
313
341
  /// Gets the value as double
@@ -319,7 +347,7 @@ type FsCell (value : IConvertible, ?dataType : DataType, ?address : FsAddress) =
319
347
  /// Gets the value as decimal
320
348
  /// </summary>
321
349
  member self.ValueAsDecimal() =
322
- Decimal.Parse (self.Value)
350
+ Decimal.Parse (string self.Value)
323
351
 
324
352
  /// <summary>
325
353
  /// Gets the value as decimal
@@ -331,7 +359,7 @@ type FsCell (value : IConvertible, ?dataType : DataType, ?address : FsAddress) =
331
359
  /// Gets the value as DateTime
332
360
  /// </summary>
333
361
  member self.ValueAsDateTime() =
334
- DateTime.Parse (self.Value)
362
+ DateTime.Parse (string self.Value)
335
363
 
336
364
  /// <summary>
337
365
  /// Gets the value as DateTime
@@ -343,7 +371,7 @@ type FsCell (value : IConvertible, ?dataType : DataType, ?address : FsAddress) =
343
371
  /// Gets the value as Guid
344
372
  /// </summary>
345
373
  member self.ValueAsGuid() =
346
- Guid.Parse (self.Value)
374
+ Guid.Parse (string self.Value)
347
375
 
348
376
  /// <summary>
349
377
  /// Gets the value as Guid
@@ -355,7 +383,7 @@ type FsCell (value : IConvertible, ?dataType : DataType, ?address : FsAddress) =
355
383
  /// Gets the value as char
356
384
  /// </summary>
357
385
  member self.ValueAsChar() =
358
- Char.Parse (self.Value)
386
+ Char.Parse (string self.Value)
359
387
 
360
388
  /// <summary>
361
389
  /// Gets the value as char
@@ -385,3 +413,24 @@ type FsCell (value : IConvertible, ?dataType : DataType, ?address : FsAddress) =
385
413
  static member setValueAs<'T> value (cell : FsCell)=
386
414
  cell.SetValueAs<'T>(value)
387
415
  cell
416
+
417
+ member this.StructurallyEquals (other: FsCell) =
418
+ let r =
419
+ [|
420
+ this.Value = other.Value
421
+ this.DataType = other.DataType
422
+ [|
423
+ this.Address.Address = other.Address.Address
424
+ this.Address.ColumnNumber = other.Address.ColumnNumber
425
+ this.Address.RowNumber = other.Address.RowNumber
426
+ this.Address.FixedColumn = other.Address.FixedColumn
427
+ this.Address.FixedRow = other.Address.FixedRow
428
+ |]
429
+ |> Seq.forall (fun x -> x=true)
430
+ this.ColumnNumber = other.ColumnNumber
431
+ this.RowNumber = other.RowNumber
432
+ |]
433
+ |> Seq.forall (fun x -> x=true)
434
+ r
435
+
436
+
@@ -0,0 +1,272 @@
1
+ import { toString, Union } from "../../fable-library.4.1.4/Types.js";
2
+ import { class_type, union_type } from "../../fable-library.4.1.4/Reflection.js";
3
+ import { map, defaultArg, unwrap } from "../../fable-library.4.1.4/Option.js";
4
+ import { FsAddress__get_FixedRow, FsAddress__get_FixedColumn, FsAddress__get_Address, FsAddress__Copy, CellReference_indexToColAdress, FsAddress__get_ColumnNumber, FsAddress__get_RowNumber, FsAddress_$ctor_Z37302880 } from "../FsAddress.fs.js";
5
+ import { parse as parse_3 } from "../../fable-library.4.1.4/Decimal.js";
6
+ import Decimal from "../../fable-library.4.1.4/Decimal.js";
7
+ import { parse } from "../../fable-library.4.1.4/Double.js";
8
+ import { parse as parse_1 } from "../../fable-library.4.1.4/Int32.js";
9
+ import { toUInt64, toInt64 } from "../../fable-library.4.1.4/BigInt.js";
10
+ import { parse as parse_2 } from "../../fable-library.4.1.4/Long.js";
11
+ import { parse as parse_4 } from "../../fable-library.4.1.4/Date.js";
12
+ import { parse as parse_5 } from "../../fable-library.4.1.4/Guid.js";
13
+ import { parse as parse_6 } from "../../fable-library.4.1.4/Char.js";
14
+ import { forAll } from "../../fable-library.4.1.4/Seq.js";
15
+ import { equals } from "../../fable-library.4.1.4/Util.js";
16
+
17
+ export class DataType extends Union {
18
+ constructor(tag, fields) {
19
+ super();
20
+ this.tag = tag;
21
+ this.fields = fields;
22
+ }
23
+ cases() {
24
+ return ["String", "Boolean", "Number", "Date", "Empty"];
25
+ }
26
+ }
27
+
28
+ export function DataType_$reflection() {
29
+ return union_type("FsSpreadsheet.DataType", [], DataType, () => [[], [], [], [], []]);
30
+ }
31
+
32
+ export function FsCellAux_boolConverter(bool) {
33
+ if (bool) {
34
+ return "1";
35
+ }
36
+ else {
37
+ return "0";
38
+ }
39
+ }
40
+
41
+ export class FsCell {
42
+ constructor(value, dataType, address) {
43
+ this._cellValue = value;
44
+ this._dataType = defaultArg(dataType, new DataType(0, []));
45
+ this._comment = "";
46
+ this._hyperlink = "";
47
+ this._richText = "";
48
+ this._formulaA1 = "";
49
+ this._formulaR1C1 = "";
50
+ this._rowIndex = (defaultArg(map(FsAddress__get_RowNumber, address), 0) | 0);
51
+ this._columnIndex = (defaultArg(map(FsAddress__get_ColumnNumber, address), 0) | 0);
52
+ }
53
+ static ".ctor"(value, dataType, address) {
54
+ return new FsCell(value, unwrap(dataType), unwrap(address));
55
+ }
56
+ get Value() {
57
+ const self = this;
58
+ return self._cellValue;
59
+ }
60
+ set Value(value) {
61
+ const self = this;
62
+ self._cellValue = value;
63
+ }
64
+ get DataType() {
65
+ const self = this;
66
+ return self._dataType;
67
+ }
68
+ set DataType(dataType) {
69
+ const self = this;
70
+ self._dataType = dataType;
71
+ }
72
+ get ColumnNumber() {
73
+ const self = this;
74
+ return self._columnIndex | 0;
75
+ }
76
+ set ColumnNumber(colI) {
77
+ const self = this;
78
+ self._columnIndex = (colI | 0);
79
+ }
80
+ get RowNumber() {
81
+ const self = this;
82
+ return self._rowIndex | 0;
83
+ }
84
+ set RowNumber(rowI) {
85
+ const self = this;
86
+ self._rowIndex = (rowI | 0);
87
+ }
88
+ get Address() {
89
+ const self = this;
90
+ return FsAddress_$ctor_Z37302880(self._rowIndex, self._columnIndex);
91
+ }
92
+ set Address(address) {
93
+ const self = this;
94
+ self._rowIndex = (FsAddress__get_RowNumber(address) | 0);
95
+ self._columnIndex = (FsAddress__get_ColumnNumber(address) | 0);
96
+ }
97
+ static create(rowNumber, colNumber, value) {
98
+ let patternInput;
99
+ const value_1_1 = value;
100
+ 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] : ((typeof value_1_1 === "number") ? [new DataType(2, []), value_1_1] : ((typeof value_1_1 === "number") ? [new DataType(2, []), value_1_1] : ((typeof value_1_1 === "number") ? [new DataType(2, []), value_1_1] : ((typeof value_1_1 === "bigint") ? [new DataType(2, []), value_1_1] : ((typeof value_1_1 === "number") ? [new DataType(2, []), value_1_1] : ((typeof value_1_1 === "number") ? [new DataType(2, []), value_1_1] : ((typeof value_1_1 === "bigint") ? [new DataType(2, []), value_1_1] : ((typeof value_1_1 === "number") ? [new DataType(2, []), value_1_1] : ((typeof value_1_1 === "number") ? [new DataType(2, []), value_1_1] : ((value_1_1 instanceof Decimal) ? [new DataType(2, []), value_1_1] : ((value_1_1 instanceof Date) ? [new DataType(3, []), value_1_1] : ((typeof value_1_1 === "string") ? [new DataType(0, []), value_1_1] : [new DataType(0, []), value_1_1])))))))))))))));
101
+ return new FsCell(patternInput[1], patternInput[0], FsAddress_$ctor_Z37302880(rowNumber, colNumber));
102
+ }
103
+ static createEmpty() {
104
+ return new FsCell("", new DataType(4, []), FsAddress_$ctor_Z37302880(0, 0));
105
+ }
106
+ static createWithAdress(adress, value) {
107
+ let patternInput;
108
+ const value_1_1 = value;
109
+ 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] : ((typeof value_1_1 === "number") ? [new DataType(2, []), value_1_1] : ((typeof value_1_1 === "number") ? [new DataType(2, []), value_1_1] : ((typeof value_1_1 === "number") ? [new DataType(2, []), value_1_1] : ((typeof value_1_1 === "bigint") ? [new DataType(2, []), value_1_1] : ((typeof value_1_1 === "number") ? [new DataType(2, []), value_1_1] : ((typeof value_1_1 === "number") ? [new DataType(2, []), value_1_1] : ((typeof value_1_1 === "bigint") ? [new DataType(2, []), value_1_1] : ((typeof value_1_1 === "number") ? [new DataType(2, []), value_1_1] : ((typeof value_1_1 === "number") ? [new DataType(2, []), value_1_1] : ((value_1_1 instanceof Decimal) ? [new DataType(2, []), value_1_1] : ((value_1_1 instanceof Date) ? [new DataType(3, []), value_1_1] : ((typeof value_1_1 === "string") ? [new DataType(0, []), value_1_1] : [new DataType(0, []), value_1_1])))))))))))))));
110
+ return new FsCell(patternInput[1], patternInput[0], adress);
111
+ }
112
+ static createEmptyWithAdress(adress) {
113
+ return new FsCell("", new DataType(4, []), adress);
114
+ }
115
+ static createWithDataType(dataType, rowNumber, colNumber, value) {
116
+ return new FsCell(value, dataType, FsAddress_$ctor_Z37302880(rowNumber, colNumber));
117
+ }
118
+ toString() {
119
+ const self = this;
120
+ return `${CellReference_indexToColAdress(self.ColumnNumber >>> 0)}${self.RowNumber} : ${self.Value} | ${self.DataType}`;
121
+ }
122
+ CopyFrom(otherCell) {
123
+ const self = this;
124
+ self.DataType = otherCell.DataType;
125
+ self.Value = otherCell.Value;
126
+ }
127
+ CopyTo(target) {
128
+ const self = this;
129
+ target.DataType = self.DataType;
130
+ target.Value = self.Value;
131
+ }
132
+ static copyFromTo(sourceCell, targetCell) {
133
+ targetCell.DataType = sourceCell.DataType;
134
+ targetCell.Value = sourceCell.Value;
135
+ return targetCell;
136
+ }
137
+ Copy() {
138
+ const self = this;
139
+ return new FsCell(self.Value, self.DataType, FsAddress__Copy(self.Address));
140
+ }
141
+ static copy(cell) {
142
+ return cell.Copy();
143
+ }
144
+ ValueAsString() {
145
+ const self = this;
146
+ const v = self.Value;
147
+ const matchValue = self.DataType;
148
+ switch (matchValue.tag) {
149
+ case 2:
150
+ return toString(v);
151
+ default:
152
+ return toString(v);
153
+ }
154
+ }
155
+ static getValueAsString(cell) {
156
+ return cell.ValueAsString();
157
+ }
158
+ ValueAsBool() {
159
+ const self = this;
160
+ const matchValue = toString(self.Value).toLocaleLowerCase();
161
+ switch (matchValue) {
162
+ case "1":
163
+ case "true":
164
+ case "true()":
165
+ return true;
166
+ case "0":
167
+ case "false":
168
+ case "false()":
169
+ return false;
170
+ default:
171
+ throw new Error(`String '${matchValue}' was not recognized as a valid Boolean`);
172
+ }
173
+ }
174
+ static getValueAsBool(cell) {
175
+ return cell.ValueAsBool();
176
+ }
177
+ ValueAsFloat() {
178
+ const self = this;
179
+ return parse(toString(self.Value));
180
+ }
181
+ static getValueAsFloat(cell) {
182
+ return cell.ValueAsFloat();
183
+ }
184
+ ValueAsInt() {
185
+ const self = this;
186
+ return parse_1(toString(self.Value), 511, false, 32) | 0;
187
+ }
188
+ static getValueAsInt(cell) {
189
+ return cell.ValueAsInt();
190
+ }
191
+ ValueAsUInt() {
192
+ const self = this;
193
+ return parse_1(toString(self.Value), 511, true, 32);
194
+ }
195
+ static getValueAsUInt(cell) {
196
+ return cell.ValueAsUInt();
197
+ }
198
+ ValueAsLong() {
199
+ const self = this;
200
+ return toInt64(parse_2(toString(self.Value), 511, false, 64));
201
+ }
202
+ static getValueAsLong(cell) {
203
+ return cell.ValueAsLong();
204
+ }
205
+ ValueAsULong() {
206
+ const self = this;
207
+ return toUInt64(parse_2(toString(self.Value), 511, true, 64));
208
+ }
209
+ static getValueAsULong(cell) {
210
+ return cell.ValueAsULong();
211
+ }
212
+ ValueAsDouble() {
213
+ const self = this;
214
+ return parse(toString(self.Value));
215
+ }
216
+ static getValueAsDouble(cell) {
217
+ return cell.ValueAsDouble();
218
+ }
219
+ ValueAsDecimal() {
220
+ const self = this;
221
+ return parse_3(toString(self.Value));
222
+ }
223
+ static getValueAsDecimal(cell) {
224
+ return cell.ValueAsDecimal();
225
+ }
226
+ ValueAsDateTime() {
227
+ const self = this;
228
+ return parse_4(toString(self.Value));
229
+ }
230
+ static getValueAsDateTime(cell) {
231
+ return cell.ValueAsDateTime();
232
+ }
233
+ ValueAsGuid() {
234
+ const self = this;
235
+ return parse_5(toString(self.Value));
236
+ }
237
+ static getValueAsGuid(cell) {
238
+ return cell.ValueAsGuid();
239
+ }
240
+ ValueAsChar() {
241
+ const self = this;
242
+ return parse_6(toString(self.Value));
243
+ }
244
+ static getValueAsChar(cell) {
245
+ return cell.ValueAsChar();
246
+ }
247
+ SetValueAs(value) {
248
+ const self = this;
249
+ let patternInput;
250
+ const value_1_1 = value;
251
+ 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] : ((typeof value_1_1 === "number") ? [new DataType(2, []), value_1_1] : ((typeof value_1_1 === "number") ? [new DataType(2, []), value_1_1] : ((typeof value_1_1 === "number") ? [new DataType(2, []), value_1_1] : ((typeof value_1_1 === "bigint") ? [new DataType(2, []), value_1_1] : ((typeof value_1_1 === "number") ? [new DataType(2, []), value_1_1] : ((typeof value_1_1 === "number") ? [new DataType(2, []), value_1_1] : ((typeof value_1_1 === "bigint") ? [new DataType(2, []), value_1_1] : ((typeof value_1_1 === "number") ? [new DataType(2, []), value_1_1] : ((typeof value_1_1 === "number") ? [new DataType(2, []), value_1_1] : ((value_1_1 instanceof Decimal) ? [new DataType(2, []), value_1_1] : ((value_1_1 instanceof Date) ? [new DataType(3, []), value_1_1] : ((typeof value_1_1 === "string") ? [new DataType(0, []), value_1_1] : [new DataType(0, []), value_1_1])))))))))))))));
252
+ self._dataType = patternInput[0];
253
+ self._cellValue = patternInput[1];
254
+ }
255
+ static setValueAs(value, cell) {
256
+ cell.SetValueAs(value);
257
+ return cell;
258
+ }
259
+ StructurallyEquals(other) {
260
+ const this$ = this;
261
+ return forAll((x_1) => (x_1 === true), [equals(this$.Value, other.Value), equals(this$.DataType, other.DataType), forAll((x) => (x === true), [FsAddress__get_Address(this$.Address) === FsAddress__get_Address(other.Address), FsAddress__get_ColumnNumber(this$.Address) === FsAddress__get_ColumnNumber(other.Address), FsAddress__get_RowNumber(this$.Address) === FsAddress__get_RowNumber(other.Address), FsAddress__get_FixedColumn(this$.Address) === FsAddress__get_FixedColumn(other.Address), FsAddress__get_FixedRow(this$.Address) === FsAddress__get_FixedRow(other.Address)]), this$.ColumnNumber === other.ColumnNumber, this$.RowNumber === other.RowNumber]);
262
+ }
263
+ }
264
+
265
+ export function FsCell_$reflection() {
266
+ return class_type("FsSpreadsheet.FsCell", void 0, FsCell);
267
+ }
268
+
269
+ export function FsCell_$ctor_2BEF9BB0(value, dataType, address) {
270
+ return new FsCell(value, dataType, address);
271
+ }
272
+
@@ -14,6 +14,7 @@ type ReduceOperation =
14
14
  values
15
15
  |> List.map (snd >> string)
16
16
  |> List.reduce (fun a b -> $"{a}{separator}{b}")
17
+ |> box
17
18
 
18
19
  type CellBuilder() =
19
20
 
@@ -1,4 +1,4 @@
1
- import { Union } from "../../fable-library.4.1.4/Types.js";
1
+ import { toString, Union } from "../../fable-library.4.1.4/Types.js";
2
2
  import { class_type, union_type, char_type } from "../../fable-library.4.1.4/Reflection.js";
3
3
  import { DataType } from "../Cells/FsCell.fs.js";
4
4
  import { head, tail, isEmpty, append, empty, map, reduce } from "../../fable-library.4.1.4/List.js";
@@ -21,8 +21,8 @@ export function ReduceOperation_$reflection() {
21
21
  return union_type("FsSpreadsheet.DSL.ReduceOperation", [], ReduceOperation, () => [[["Item", char_type]]]);
22
22
  }
23
23
 
24
- export function ReduceOperation__Reduce_Z26A4E3C2(this$, values) {
25
- return [new DataType(0, []), reduce((a, b) => (`${a}${this$.fields[0]}${b}`), map((arg) => arg[1], values))];
24
+ export function ReduceOperation__Reduce_70D1A69E(this$, values) {
25
+ return [new DataType(0, []), reduce((a, b) => (`${a}${this$.fields[0]}${b}`), map((arg) => toString(arg[1]), values))];
26
26
  }
27
27
 
28
28
  export class CellBuilder {
@@ -55,7 +55,7 @@ export function CellBuilder__Yield_36B9E420(this$, ro) {
55
55
  return new SheetEntity$1(1, [empty()]);
56
56
  }
57
57
 
58
- export function CellBuilder__Combine_4F8B6A0(this$, wx1, wx2) {
58
+ export function CellBuilder__Combine_F07E260(this$, wx1, wx2) {
59
59
  let matchResult, l1, l2, messages1, messages2, messages2_1, messages1_1, f1, messages1_2, messages2_2, f2, messages1_3, messages2_3, messages1_4, messages2_4;
60
60
  switch (wx1.tag) {
61
61
  case 2: {
@@ -130,39 +130,39 @@ export function CellBuilder__Combine_4F8B6A0(this$, wx1, wx2) {
130
130
  }
131
131
  }
132
132
 
133
- export function CellBuilder__Combine_2C6C5E1E(this$, wx1, wx2) {
133
+ export function CellBuilder__Combine_4BCE267E(this$, wx1, wx2) {
134
134
  return RequiredSource$1_$ctor_2B595(wx2);
135
135
  }
136
136
 
137
- export function CellBuilder__Combine_Z40A4EDE2(this$, wx1, wx2) {
137
+ export function CellBuilder__Combine_Z2CF9C142(this$, wx1, wx2) {
138
138
  return RequiredSource$1_$ctor_2B595(wx1);
139
139
  }
140
140
 
141
- export function CellBuilder__Combine_3F9D1279(this$, wx1, wx2) {
141
+ export function CellBuilder__Combine_583F6A19(this$, wx1, wx2) {
142
142
  return OptionalSource$1_$ctor_2B595(wx2);
143
143
  }
144
144
 
145
- export function CellBuilder__Combine_7AD05659(this$, wx1, wx2) {
145
+ export function CellBuilder__Combine_168D7AF9(this$, wx1, wx2) {
146
146
  return OptionalSource$1_$ctor_2B595(wx1);
147
147
  }
148
148
 
149
- export function CellBuilder__Combine_Z674DE191(this$, wx1, wx2) {
150
- return RequiredSource$1_$ctor_2B595(CellBuilder__Combine_4F8B6A0(this$, RequiredSource$1__get_Source(wx1), wx2));
149
+ export function CellBuilder__Combine_32507AAF(this$, wx1, wx2) {
150
+ return RequiredSource$1_$ctor_2B595(CellBuilder__Combine_F07E260(this$, RequiredSource$1__get_Source(wx1), wx2));
151
151
  }
152
152
 
153
- export function CellBuilder__Combine_1F389C8F(this$, wx1, wx2) {
154
- return RequiredSource$1_$ctor_2B595(CellBuilder__Combine_4F8B6A0(this$, wx1, RequiredSource$1__get_Source(wx2)));
153
+ export function CellBuilder__Combine_Z3ABF6771(this$, wx1, wx2) {
154
+ return RequiredSource$1_$ctor_2B595(CellBuilder__Combine_F07E260(this$, wx1, RequiredSource$1__get_Source(wx2)));
155
155
  }
156
156
 
157
- export function CellBuilder__Combine_512E85C8(this$, wx1, wx2) {
158
- return OptionalSource$1_$ctor_2B595(CellBuilder__Combine_4F8B6A0(this$, OptionalSource$1__get_Source(wx1), wx2));
157
+ export function CellBuilder__Combine_Z2BFC83F8(this$, wx1, wx2) {
158
+ return OptionalSource$1_$ctor_2B595(CellBuilder__Combine_F07E260(this$, OptionalSource$1__get_Source(wx1), wx2));
159
159
  }
160
160
 
161
- export function CellBuilder__Combine_6390E688(this$, wx1, wx2) {
162
- return OptionalSource$1_$ctor_2B595(CellBuilder__Combine_4F8B6A0(this$, wx1, OptionalSource$1__get_Source(wx2)));
161
+ export function CellBuilder__Combine_245D6C8(this$, wx1, wx2) {
162
+ return OptionalSource$1_$ctor_2B595(CellBuilder__Combine_F07E260(this$, wx1, OptionalSource$1__get_Source(wx2)));
163
163
  }
164
164
 
165
- export function CellBuilder__AsCellElement_825BA8D(this$, children) {
165
+ export function CellBuilder__AsCellElement_6F87C2ED(this$, children) {
166
166
  let matchResult, messages, v, messages_1, vals, messages_2, messages_3;
167
167
  switch (children.tag) {
168
168
  case 2: {
@@ -198,7 +198,7 @@ export function CellBuilder__AsCellElement_825BA8D(this$, children) {
198
198
  case 0:
199
199
  return new SheetEntity$1(0, [[v, void 0], messages]);
200
200
  case 1:
201
- return new SheetEntity$1(0, [[ReduceOperation__Reduce_Z26A4E3C2(this$.reducer, vals), void 0], messages_1]);
201
+ return new SheetEntity$1(0, [[ReduceOperation__Reduce_70D1A69E(this$.reducer, vals), void 0], messages_1]);
202
202
  case 2:
203
203
  return new SheetEntity$1(2, [messages_2]);
204
204
  default:
@@ -72,7 +72,7 @@ module Transform =
72
72
  match col with
73
73
  | [] -> failwith "Empty column"
74
74
  | header :: fields ->
75
- let field = table.Field(snd header, cellCollection)
75
+ let field = table.Field(snd >> string <| header, cellCollection)
76
76
  fields
77
77
  |> List.iteri (fun i (dataType,value) ->
78
78
  let cell = field.Column.Cell(i + 2,cellCollection)
@@ -1,5 +1,6 @@
1
1
  import { choose, transpose, map, iterateIndexed, iterate, ofArrayWithTail, empty, reverse, singleton, tail as tail_25, cons, head, isEmpty } from "../../fable-library.4.1.4/List.js";
2
2
  import { RowIndex__get_Index, ColumnIndex__get_Index, TableElement__get_IsColumn, SheetElement } from "./Types.fs.js";
3
+ import { toString } from "../../fable-library.4.1.4/Types.js";
3
4
  import { FsRangeColumn__Cell_Z4232C216 } from "../Ranges/FsRangeColumn.fs.js";
4
5
  import { FsTableField__get_Column } from "../Tables/FsTableField.fs.js";
5
6
  import { add, FSharpSet__Contains, ofSeq } from "../../fable-library.4.1.4/Set.js";
@@ -166,7 +167,7 @@ export function splitRowsAndColumns(els) {
166
167
  export function FsSpreadsheet_DSL_Workbook__Workbook_parseTable_Static(cellCollection, table, els) {
167
168
  iterate((col_2) => {
168
169
  if (!isEmpty(col_2)) {
169
- const field = table.Field(head(col_2)[1], cellCollection);
170
+ const field = table.Field(toString(head(col_2)[1]), cellCollection);
170
171
  iterateIndexed((i, tupledArg) => {
171
172
  const cell_4 = FsRangeColumn__Cell_Z4232C216(FsTableField__get_Column(field), i + 2, cellCollection);
172
173
  cell_4.DataType = tupledArg[0];
@@ -95,7 +95,7 @@ module SheetEntityExtensions =
95
95
  failwith $"SheetEntity of type {typeof<'T>.Name} does not contain Value: \n\t{appendedMessages}"
96
96
  #endif
97
97
 
98
- type Value = DataType * string
98
+ type Value = DataType * obj
99
99
 
100
100
  type CellElement = Value * int option
101
101