@nfdi4plants/arctrl 2.0.0-beta.1 → 2.0.0-beta.8
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/ARC.js +12 -8
- package/Contract/ArcAssay.js +4 -4
- package/Contract/ArcStudy.js +3 -3
- package/Contract/Datamap.js +1 -1
- package/Contract/ValidationPackagesConfig.js +95 -0
- package/Core/ArcTypes.js +4 -4
- package/Core/Conversion.js +13 -13
- package/Core/DataContext.js +53 -6
- package/Core/{Table/DataMap.js → DataMap.js} +34 -22
- package/Core/Process/Component.js +15 -5
- package/Core/Process/FactorValue.js +14 -5
- package/Core/Process/MaterialAttributeValue.js +14 -5
- package/Core/Process/ProcessParameterValue.js +11 -2
- package/Core/Table/CompositeCell.js +12 -23
- package/Core/{Process/Value.js → Value.js} +9 -9
- package/Json/Assay.js +10 -9
- package/Json/{Process/Data.js → Data.js} +17 -17
- package/Json/{Process/DataFile.js → DataFile.js} +9 -9
- package/Json/DataMap/DataContext.js +30 -0
- package/Json/DataMap/DataMap.js +25 -0
- package/Json/Encode.js +10 -1
- package/Json/Process/Component.js +1 -1
- package/Json/Process/FactorValue.js +1 -1
- package/Json/Process/MaterialAttributeValue.js +1 -1
- package/Json/Process/ProcessInput.js +1 -1
- package/Json/Process/ProcessOutput.js +1 -1
- package/Json/Process/ProcessParameterValue.js +2 -2
- package/Json/Process/Value.js +3 -3
- package/Json/{Process/PropertyValue.js → PropertyValue.js} +30 -21
- package/Json/Study.js +9 -8
- package/Json/Table/CompositeCell.js +1 -1
- package/Json/context/rocrate/isa_data_context.js +2 -2
- package/Json/context/rocrate/isa_investigation_context.js +1 -1
- package/Json/context/rocrate/property_value_context.js +1 -1
- package/Spreadsheet/AnnotationTable/ArcTable.js +5 -5
- package/Spreadsheet/AnnotationTable/CompositeColumn.js +10 -8
- package/Spreadsheet/ArcAssay.js +32 -16
- package/Spreadsheet/ArcInvestigation.js +2 -2
- package/Spreadsheet/ArcStudy.js +26 -10
- package/Spreadsheet/DataMap.js +2 -2
- package/Spreadsheet/DataMapTable/DataMapColumn.js +1 -1
- package/Spreadsheet/DataMapTable/DataMapHeader.js +1 -1
- package/Spreadsheet/DataMapTable/DataMapTable.js +8 -8
- package/Spreadsheet/Metadata/SparseTable.js +7 -7
- package/Spreadsheet/Template.js +2 -2
- package/ValidationPackages/ValidationPackage.js +54 -0
- package/ValidationPackages/ValidationPackagesConfig.js +55 -0
- package/Xlsx.js +9 -9
- package/Yaml/Encode.js +8 -0
- package/Yaml/ValidationPackage.js +47 -0
- package/Yaml/ValidationPackagesConfig.js +48 -0
- package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/FsSpreadsheet.fableproj +1 -0
- package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/FsWorksheet.fs +4 -0
- package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/FsWorksheet.fs.js +9 -1
- package/fable_modules/FsSpreadsheet.6.2.0/Json/Cell.fs +45 -0
- package/fable_modules/FsSpreadsheet.6.2.0/Json/Cell.fs.js +38 -0
- package/fable_modules/FsSpreadsheet.6.2.0/Json/Column.fs +28 -0
- package/fable_modules/FsSpreadsheet.6.2.0/Json/Column.fs.js +24 -0
- package/fable_modules/FsSpreadsheet.6.2.0/Json/Row.fs +28 -0
- package/fable_modules/FsSpreadsheet.6.2.0/Json/Row.fs.js +24 -0
- package/fable_modules/FsSpreadsheet.6.2.0/Json/Workbook.fs +33 -0
- package/fable_modules/FsSpreadsheet.6.2.0/Json/Workbook.fs.js +35 -0
- package/fable_modules/FsSpreadsheet.6.2.0/Json/Worksheet.fs +148 -0
- package/fable_modules/FsSpreadsheet.6.2.0/Json/Worksheet.fs.js +109 -0
- package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/obj/Release/netstandard2.0/FsSpreadsheet.AssemblyInfo.fs +3 -3
- package/fable_modules/YAMLicious.0.0.1/Decode.fs +374 -0
- package/fable_modules/YAMLicious.0.0.1/Decode.fs.js +1684 -0
- package/fable_modules/YAMLicious.0.0.1/Encode.fs +148 -0
- package/fable_modules/YAMLicious.0.0.1/Encode.fs.js +74 -0
- package/fable_modules/YAMLicious.0.0.1/Interop/JsInterop.fs +14 -0
- package/fable_modules/YAMLicious.0.0.1/Interop/JsInterop.fs.js +11 -0
- package/fable_modules/YAMLicious.0.0.1/Interop/PyInterop.fs +9 -0
- package/fable_modules/YAMLicious.0.0.1/Library.fs +138 -0
- package/fable_modules/YAMLicious.0.0.1/Library.fs.js +7 -0
- package/fable_modules/YAMLicious.0.0.1/Persil.fs +86 -0
- package/fable_modules/YAMLicious.0.0.1/Persil.fs.js +49 -0
- package/fable_modules/YAMLicious.0.0.1/Preprocessing.fs +59 -0
- package/fable_modules/YAMLicious.0.0.1/Preprocessing.fs.js +102 -0
- package/fable_modules/YAMLicious.0.0.1/Reader.fs +295 -0
- package/fable_modules/YAMLicious.0.0.1/Reader.fs.js +530 -0
- package/fable_modules/YAMLicious.0.0.1/Regex.fs +108 -0
- package/fable_modules/YAMLicious.0.0.1/Regex.fs.js +19 -0
- package/fable_modules/YAMLicious.0.0.1/RegexActivePatterns.fs +166 -0
- package/fable_modules/YAMLicious.0.0.1/RegexActivePatterns.fs.js +225 -0
- package/fable_modules/YAMLicious.0.0.1/Writer.fs +84 -0
- package/fable_modules/YAMLicious.0.0.1/Writer.fs.js +161 -0
- package/fable_modules/YAMLicious.0.0.1/YAMLicious.fableproj +39 -0
- package/fable_modules/YAMLicious.0.0.1/YAMLiciousTypes.fs +82 -0
- package/fable_modules/YAMLicious.0.0.1/YAMLiciousTypes.fs.js +130 -0
- package/fable_modules/YAMLicious.0.0.1/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +3 -0
- package/fable_modules/YAMLicious.0.0.1/obj/Debug/netstandard2.0/YAMLicious.AssemblyInfo.fs +19 -0
- package/fable_modules/YAMLicious.0.0.1/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +3 -0
- package/fable_modules/YAMLicious.0.0.1/obj/Release/netstandard2.0/YAMLicious.AssemblyInfo.fs +19 -0
- package/fable_modules/project_cracked.json +1 -1
- package/index.js +1 -0
- package/package.json +1 -1
- package/fable_modules/FsSpreadsheet.6.1.2/Json/Cell.fs +0 -23
- package/fable_modules/FsSpreadsheet.6.1.2/Json/Cell.fs.js +0 -21
- package/fable_modules/FsSpreadsheet.6.1.2/Json/Row.fs +0 -23
- package/fable_modules/FsSpreadsheet.6.1.2/Json/Row.fs.js +0 -19
- package/fable_modules/FsSpreadsheet.6.1.2/Json/Workbook.fs +0 -20
- package/fable_modules/FsSpreadsheet.6.1.2/Json/Workbook.fs.js +0 -21
- package/fable_modules/FsSpreadsheet.6.1.2/Json/Worksheet.fs +0 -49
- package/fable_modules/FsSpreadsheet.6.1.2/Json/Worksheet.fs.js +0 -44
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/Cells/FsCell.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/Cells/FsCell.fs.js +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/Cells/FsCellsCollection.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/Cells/FsCellsCollection.fs.js +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/DSL/CellBuilder.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/DSL/CellBuilder.fs.js +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/DSL/ColumnBuilder.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/DSL/ColumnBuilder.fs.js +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/DSL/DSL.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/DSL/DSL.fs.js +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/DSL/Expression.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/DSL/Expression.fs.js +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/DSL/Operators.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/DSL/Operators.fs.js +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/DSL/RowBuilder.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/DSL/RowBuilder.fs.js +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/DSL/SheetBuilder.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/DSL/SheetBuilder.fs.js +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/DSL/TableBuilder.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/DSL/TableBuilder.fs.js +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/DSL/Transform.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/DSL/Transform.fs.js +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/DSL/Types.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/DSL/Types.fs.js +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/DSL/WorkbookBuilder.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/DSL/WorkbookBuilder.fs.js +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/FsAddress.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/FsAddress.fs.js +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/FsColumn.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/FsColumn.fs.js +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/FsRow.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/FsRow.fs.js +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/FsWorkbook.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/FsWorkbook.fs.js +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/Json/Table.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/Json/Table.fs.js +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/Json/Value.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/Json/Value.fs.js +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/Ranges/FsRange.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/Ranges/FsRange.fs.js +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/Ranges/FsRangeAddress.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/Ranges/FsRangeAddress.fs.js +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/Ranges/FsRangeBase.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/Ranges/FsRangeBase.fs.js +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/Ranges/FsRangeColumn.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/Ranges/FsRangeColumn.fs.js +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/Ranges/FsRangeRow.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/Ranges/FsRangeRow.fs.js +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/SheetBuilder.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/SheetBuilder.fs.js +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/Tables/FsTable.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/Tables/FsTable.fs.js +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/Tables/FsTableField.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/Tables/FsTableField.fs.js +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/Tables/FsTableRow.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/Tables/FsTableRow.fs.js +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/obj/Debug/netstandard2.0/FsSpreadsheet.AssemblyInfo.fs +0 -0
- /package/fable_modules/{FsSpreadsheet.6.1.2 → FsSpreadsheet.6.2.0}/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +0 -0
package/Xlsx.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { toFsWorkbook, fromFsWorkbook } from "./Spreadsheet/DataMap.js";
|
|
2
2
|
import { class_type } from "./fable_modules/fable-library-js.4.16.0/Reflection.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { map
|
|
3
|
+
import { ARCtrl_ArcAssay__ArcAssay_toFsWorkbook_Static_Z2508BE4F, ARCtrl_ArcAssay__ArcAssay_fromFsWorkbook_Static_32154C9D } from "./Spreadsheet/ArcAssay.js";
|
|
4
|
+
import { ARCtrl_ArcStudy__ArcStudy_toFsWorkbook_Static_Z4CEFA522, ARCtrl_ArcStudy__ArcStudy_fromFsWorkbook_Static_32154C9D } from "./Spreadsheet/ArcStudy.js";
|
|
5
|
+
import { map } from "./fable_modules/fable-library-js.4.16.0/Option.js";
|
|
6
6
|
import { ofSeq } from "./fable_modules/fable-library-js.4.16.0/List.js";
|
|
7
|
-
import { toFsWorkbook as
|
|
7
|
+
import { toFsWorkbook as toFsWorkbook_1, fromFsWorkbook as fromFsWorkbook_1 } from "./Spreadsheet/ArcInvestigation.js";
|
|
8
8
|
|
|
9
9
|
export class XlsxHelper_DatamapXlsx {
|
|
10
10
|
constructor() {
|
|
@@ -29,10 +29,10 @@ export class XlsxHelper_AssayXlsx {
|
|
|
29
29
|
constructor() {
|
|
30
30
|
}
|
|
31
31
|
fromFsWorkbook(fswb) {
|
|
32
|
-
return
|
|
32
|
+
return ARCtrl_ArcAssay__ArcAssay_fromFsWorkbook_Static_32154C9D(fswb);
|
|
33
33
|
}
|
|
34
34
|
toFsWorkbook(assay) {
|
|
35
|
-
return
|
|
35
|
+
return ARCtrl_ArcAssay__ArcAssay_toFsWorkbook_Static_Z2508BE4F(assay);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -51,7 +51,7 @@ export class XlsxHelper_StudyXlsx {
|
|
|
51
51
|
return ARCtrl_ArcStudy__ArcStudy_fromFsWorkbook_Static_32154C9D(fswb);
|
|
52
52
|
}
|
|
53
53
|
toFsWorkbook(study, assays) {
|
|
54
|
-
return
|
|
54
|
+
return ARCtrl_ArcStudy__ArcStudy_toFsWorkbook_Static_Z4CEFA522(study, map(ofSeq, assays));
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
|
|
@@ -67,10 +67,10 @@ export class XlsxHelper_InvestigationXlsx {
|
|
|
67
67
|
constructor() {
|
|
68
68
|
}
|
|
69
69
|
fromFsWorkbook(fswb) {
|
|
70
|
-
return
|
|
70
|
+
return fromFsWorkbook_1(fswb);
|
|
71
71
|
}
|
|
72
72
|
toFsWorkbook(investigation) {
|
|
73
|
-
return
|
|
73
|
+
return toFsWorkbook_1(investigation);
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
|
package/Yaml/Encode.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ofArray, choose } from "../fable_modules/fable-library-js.4.16.0/List.js";
|
|
2
|
+
import { equals } from "../fable_modules/fable-library-js.4.16.0/Util.js";
|
|
3
|
+
import { Config, YAMLElement } from "../fable_modules/YAMLicious.0.0.1/YAMLiciousTypes.fs.js";
|
|
4
|
+
import { tryInclude, string } from "../fable_modules/YAMLicious.0.0.1/Encode.fs.js";
|
|
5
|
+
import { singleton, collect, delay, toList } from "../fable_modules/fable-library-js.4.16.0/Seq.js";
|
|
6
|
+
import { YAMLContent_create_27AED5E3 } from "../fable_modules/YAMLicious.0.0.1/YAMLiciousTypes.fs.js";
|
|
7
|
+
import { string as string_1, object } from "../fable_modules/YAMLicious.0.0.1/Decode.fs.js";
|
|
8
|
+
import { ValidationPackage } from "../ValidationPackages/ValidationPackage.js";
|
|
9
|
+
import { unwrap } from "../fable_modules/fable-library-js.4.16.0/Option.js";
|
|
10
|
+
import { read } from "../fable_modules/YAMLicious.0.0.1/Reader.fs.js";
|
|
11
|
+
import { defaultWhitespace } from "./Encode.js";
|
|
12
|
+
import { write } from "../fable_modules/YAMLicious.0.0.1/Writer.fs.js";
|
|
13
|
+
|
|
14
|
+
export function ValidationPackage_encoder(validationpackage) {
|
|
15
|
+
const objSeq = choose((tupledArg) => {
|
|
16
|
+
const v = tupledArg[1];
|
|
17
|
+
if (equals(v, new YAMLElement(5, []))) {
|
|
18
|
+
return void 0;
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
return [tupledArg[0], v];
|
|
22
|
+
}
|
|
23
|
+
}, ofArray([["name", string(validationpackage.Name)], tryInclude("version", string, validationpackage.Version)]));
|
|
24
|
+
return new YAMLElement(3, [toList(delay(() => collect((matchValue) => singleton(new YAMLElement(0, [YAMLContent_create_27AED5E3(matchValue[0]), matchValue[1]])), objSeq)))]);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const ValidationPackage_decoder = (value_2) => object((get$) => {
|
|
28
|
+
let objectArg, objectArg_1;
|
|
29
|
+
return new ValidationPackage((objectArg = get$.Required, objectArg.Field("name", string_1)), unwrap((objectArg_1 = get$.Optional, objectArg_1.Field("version", string_1))));
|
|
30
|
+
}, value_2);
|
|
31
|
+
|
|
32
|
+
export function ARCtrl_ValidationPackages_ValidationPackage__ValidationPackage_fromYamlString_Static_Z721C83C5(s) {
|
|
33
|
+
return ValidationPackage_decoder(read(s));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function ARCtrl_ValidationPackages_ValidationPackage__ValidationPackage_toYamlString_Static_71136F3F(whitespace) {
|
|
37
|
+
return (vp) => {
|
|
38
|
+
const element = ValidationPackage_encoder(vp);
|
|
39
|
+
const whitespace_1 = defaultWhitespace(whitespace) | 0;
|
|
40
|
+
return write(element, (c) => (new Config(whitespace_1, c.Level)));
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function ARCtrl_ValidationPackages_ValidationPackage__ValidationPackage_toYamlString_71136F3F(this$, whitespace) {
|
|
45
|
+
return ARCtrl_ValidationPackages_ValidationPackage__ValidationPackage_toYamlString_Static_71136F3F(unwrap(whitespace))(this$);
|
|
46
|
+
}
|
|
47
|
+
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ofArray, choose } from "../fable_modules/fable-library-js.4.16.0/List.js";
|
|
2
|
+
import { equals } from "../fable_modules/fable-library-js.4.16.0/Util.js";
|
|
3
|
+
import { Config, YAMLElement } from "../fable_modules/YAMLicious.0.0.1/YAMLiciousTypes.fs.js";
|
|
4
|
+
import { string, tryInclude, resizearray } from "../fable_modules/YAMLicious.0.0.1/Encode.fs.js";
|
|
5
|
+
import { ValidationPackage_decoder, ValidationPackage_encoder } from "./ValidationPackage.js";
|
|
6
|
+
import { singleton, collect, delay, toList } from "../fable_modules/fable-library-js.4.16.0/Seq.js";
|
|
7
|
+
import { YAMLContent_create_27AED5E3 } from "../fable_modules/YAMLicious.0.0.1/YAMLiciousTypes.fs.js";
|
|
8
|
+
import { string as string_1, resizearray as resizearray_1, object } from "../fable_modules/YAMLicious.0.0.1/Decode.fs.js";
|
|
9
|
+
import { ValidationPackagesConfig } from "../ValidationPackages/ValidationPackagesConfig.js";
|
|
10
|
+
import { unwrap } from "../fable_modules/fable-library-js.4.16.0/Option.js";
|
|
11
|
+
import { read } from "../fable_modules/YAMLicious.0.0.1/Reader.fs.js";
|
|
12
|
+
import { defaultWhitespace } from "./Encode.js";
|
|
13
|
+
import { write } from "../fable_modules/YAMLicious.0.0.1/Writer.fs.js";
|
|
14
|
+
|
|
15
|
+
export function ValidationPackagesConfig_encoder(validationpackage) {
|
|
16
|
+
const objSeq = choose((tupledArg) => {
|
|
17
|
+
const v = tupledArg[1];
|
|
18
|
+
if (equals(v, new YAMLElement(5, []))) {
|
|
19
|
+
return void 0;
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
return [tupledArg[0], v];
|
|
23
|
+
}
|
|
24
|
+
}, ofArray([["validation_packages", resizearray(ValidationPackage_encoder, validationpackage.ValidationPackages)], tryInclude("arc_specification", string, validationpackage.ARCSpecification)]));
|
|
25
|
+
return new YAMLElement(3, [toList(delay(() => collect((matchValue) => singleton(new YAMLElement(0, [YAMLContent_create_27AED5E3(matchValue[0]), matchValue[1]])), objSeq)))]);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const ValidationPackagesConfig_decoder = (value_2) => object((get$) => {
|
|
29
|
+
let objectArg, objectArg_1;
|
|
30
|
+
return new ValidationPackagesConfig((objectArg = get$.Required, objectArg.Field("validation_packages", (value) => resizearray_1(ValidationPackage_decoder, value))), unwrap((objectArg_1 = get$.Optional, objectArg_1.Field("arc_specification", string_1))));
|
|
31
|
+
}, value_2);
|
|
32
|
+
|
|
33
|
+
export function ARCtrl_ValidationPackages_ValidationPackagesConfig__ValidationPackagesConfig_fromYamlString_Static_Z721C83C5(s) {
|
|
34
|
+
return ValidationPackagesConfig_decoder(read(s));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function ARCtrl_ValidationPackages_ValidationPackagesConfig__ValidationPackagesConfig_toYamlString_Static_71136F3F(whitespace) {
|
|
38
|
+
return (vp) => {
|
|
39
|
+
const element = ValidationPackagesConfig_encoder(vp);
|
|
40
|
+
const whitespace_1 = defaultWhitespace(whitespace) | 0;
|
|
41
|
+
return write(element, (c) => (new Config(whitespace_1, c.Level)));
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function ARCtrl_ValidationPackages_ValidationPackagesConfig__ValidationPackagesConfig_toYamlString_71136F3F(this$, whitespace) {
|
|
46
|
+
return ARCtrl_ValidationPackages_ValidationPackagesConfig__ValidationPackagesConfig_toYamlString_Static_71136F3F(unwrap(whitespace))(this$);
|
|
47
|
+
}
|
|
48
|
+
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
<Compile Include="Json\Value.fs" />
|
|
37
37
|
<Compile Include="Json\Cell.fs" />
|
|
38
38
|
<Compile Include="Json\Row.fs" />
|
|
39
|
+
<Compile Include="Json\Column.fs" />
|
|
39
40
|
<Compile Include="Json\Table.fs" />
|
|
40
41
|
<Compile Include="Json\Worksheet.fs" />
|
|
41
42
|
<Compile Include="Json\Workbook.fs" />
|
|
@@ -81,6 +81,10 @@ type FsWorksheet (name, ?fsRows, ?fsTables, ?fsCellsCollection) =
|
|
|
81
81
|
FsColumn(newRange,self.CellCollection)
|
|
82
82
|
)
|
|
83
83
|
|
|
84
|
+
member this.MaxRowIndex = this.CellCollection.MaxRowNumber
|
|
85
|
+
|
|
86
|
+
member this.MaxColumnIndex = this.CellCollection.MaxColumnNumber
|
|
87
|
+
|
|
84
88
|
// -------
|
|
85
89
|
// METHODS
|
|
86
90
|
// -------
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FsCellsCollection__RemoveValueAt_Z37302880, FsCellsCollection__TryRemoveValueAt_Z37302880, FsCellsCollection__RemoveCellAt_Z37302880, FsCellsCollection__Add_2E78CE33, FsCellsCollection__Add_Z21F271A4, FsCellsCollection__Add_Z334DF64D, FsCellsCollection__TryGetCell_Z37302880, FsCellsCollection__Copy, FsCellsCollection__GetCells, FsCellsCollection_$ctor } from "./Cells/FsCellsCollection.fs.js";
|
|
1
|
+
import { FsCellsCollection__RemoveValueAt_Z37302880, FsCellsCollection__TryRemoveValueAt_Z37302880, FsCellsCollection__RemoveCellAt_Z37302880, FsCellsCollection__Add_2E78CE33, FsCellsCollection__Add_Z21F271A4, FsCellsCollection__Add_Z334DF64D, FsCellsCollection__TryGetCell_Z37302880, FsCellsCollection__Copy, FsCellsCollection__get_MaxColumnNumber, FsCellsCollection__get_MaxRowNumber, FsCellsCollection__GetCells, FsCellsCollection_$ctor } from "./Cells/FsCellsCollection.fs.js";
|
|
2
2
|
import { empty, maxBy, filter, exists, find, tryFind, iterate, last, head, sortBy, map } from "../fable-library-js.4.16.0/Seq.js";
|
|
3
3
|
import { FsColumn } from "./FsColumn.fs.js";
|
|
4
4
|
import { clear, safeHash, equals, disposeSafe, getEnumerator, numberHash, comparePrimitives } from "../fable-library-js.4.16.0/Util.js";
|
|
@@ -60,6 +60,14 @@ export class FsWorksheet {
|
|
|
60
60
|
GetHashCode: numberHash,
|
|
61
61
|
}));
|
|
62
62
|
}
|
|
63
|
+
get MaxRowIndex() {
|
|
64
|
+
const this$ = this;
|
|
65
|
+
return FsCellsCollection__get_MaxRowNumber(this$.CellCollection) | 0;
|
|
66
|
+
}
|
|
67
|
+
get MaxColumnIndex() {
|
|
68
|
+
const this$ = this;
|
|
69
|
+
return FsCellsCollection__get_MaxColumnNumber(this$.CellCollection) | 0;
|
|
70
|
+
}
|
|
63
71
|
Copy() {
|
|
64
72
|
let n, n_1;
|
|
65
73
|
const self = this;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
module FsSpreadsheet.Json.Cell
|
|
2
|
+
|
|
3
|
+
open FsSpreadsheet
|
|
4
|
+
open Thoth.Json.Core
|
|
5
|
+
|
|
6
|
+
[<Literal>]
|
|
7
|
+
let column = "column"
|
|
8
|
+
|
|
9
|
+
[<Literal>]
|
|
10
|
+
let row = "row"
|
|
11
|
+
|
|
12
|
+
[<Literal>]
|
|
13
|
+
let value = "value"
|
|
14
|
+
|
|
15
|
+
let encodeNoNumber (cell:FsCell) =
|
|
16
|
+
Encode.object [
|
|
17
|
+
value, Value.encode cell.Value
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
let encodeRows (cell:FsCell) =
|
|
21
|
+
Encode.object [
|
|
22
|
+
column, Encode.int cell.ColumnNumber
|
|
23
|
+
value, Value.encode cell.Value
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
let decodeRows rowNumber : Decoder<FsCell> =
|
|
27
|
+
Decode.object (fun builder ->
|
|
28
|
+
let v,dt = builder.Optional.Field value (Value.decode) |> Option.defaultValue ("", DataType.Empty)
|
|
29
|
+
let c = builder.Optional.Field column Decode.int |> Option.defaultValue 0
|
|
30
|
+
new FsCell(v,dt,FsAddress(Option.defaultValue 0 rowNumber,c))
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
let encodeCols (cell:FsCell) =
|
|
35
|
+
Encode.object [
|
|
36
|
+
row, Encode.int cell.RowNumber
|
|
37
|
+
value, Value.encode cell.Value
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
let decodeCols colNumber : Decoder<FsCell> =
|
|
41
|
+
Decode.object (fun builder ->
|
|
42
|
+
let v,dt = builder.Optional.Field value (Value.decode) |> Option.defaultValue ("", DataType.Empty)
|
|
43
|
+
let r = builder.Optional.Field row Decode.int |> Option.defaultValue 0
|
|
44
|
+
new FsCell(v,dt,FsAddress(r,Option.defaultValue 0 colNumber))
|
|
45
|
+
)
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { decode, encode } from "./Value.fs.js";
|
|
2
|
+
import { Json } from "../../Thoth.Json.Core.0.2.1/Types.fs.js";
|
|
3
|
+
import { int, object } from "../../Thoth.Json.Core.0.2.1/Decode.fs.js";
|
|
4
|
+
import { defaultArg } from "../../fable-library-js.4.16.0/Option.js";
|
|
5
|
+
import { FsCell, DataType } from "../Cells/FsCell.fs.js";
|
|
6
|
+
import { FsAddress_$ctor_Z37302880 } from "../FsAddress.fs.js";
|
|
7
|
+
|
|
8
|
+
export function encodeNoNumber(cell) {
|
|
9
|
+
return new Json(5, [[["value", encode(cell.Value)]]]);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function encodeRows(cell) {
|
|
13
|
+
let value_1;
|
|
14
|
+
return new Json(5, [[["column", (value_1 = (cell.ColumnNumber | 0), new Json(7, [value_1 >>> 0]))], ["value", encode(cell.Value)]]]);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function decodeRows(rowNumber) {
|
|
18
|
+
return object((builder) => {
|
|
19
|
+
let objectArg, objectArg_1;
|
|
20
|
+
const patternInput = defaultArg((objectArg = builder.Optional, objectArg.Field("value", decode)), ["", new DataType(4, [])]);
|
|
21
|
+
const c = defaultArg((objectArg_1 = builder.Optional, objectArg_1.Field("column", int)), 0) | 0;
|
|
22
|
+
return new FsCell(patternInput[0], patternInput[1], FsAddress_$ctor_Z37302880(defaultArg(rowNumber, 0), c));
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function encodeCols(cell) {
|
|
27
|
+
let value_1;
|
|
28
|
+
return new Json(5, [[["row", (value_1 = (cell.RowNumber | 0), new Json(7, [value_1 >>> 0]))], ["value", encode(cell.Value)]]]);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function decodeCols(colNumber) {
|
|
32
|
+
return object((builder) => {
|
|
33
|
+
let objectArg, objectArg_1;
|
|
34
|
+
const patternInput = defaultArg((objectArg = builder.Optional, objectArg.Field("value", decode)), ["", new DataType(4, [])]);
|
|
35
|
+
return new FsCell(patternInput[0], patternInput[1], FsAddress_$ctor_Z37302880(defaultArg((objectArg_1 = builder.Optional, objectArg_1.Field("row", int)), 0), defaultArg(colNumber, 0)));
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module FsSpreadsheet.Json.Column
|
|
2
|
+
|
|
3
|
+
open FsSpreadsheet
|
|
4
|
+
open Thoth.Json.Core
|
|
5
|
+
|
|
6
|
+
[<Literal>]
|
|
7
|
+
let cells = "cells"
|
|
8
|
+
|
|
9
|
+
[<Literal>]
|
|
10
|
+
let number = "number"
|
|
11
|
+
|
|
12
|
+
let encode (col:FsColumn) =
|
|
13
|
+
Encode.object [
|
|
14
|
+
number, Encode.int col.Index
|
|
15
|
+
cells, Encode.seq (col.Cells |> Seq.map Cell.encodeCols)
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
let encodeNoNumbers (col: FsCell seq) =
|
|
19
|
+
Encode.object [
|
|
20
|
+
cells, Encode.seq (col |> Seq.map Cell.encodeNoNumber)
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
let decode : Decoder<int option*FsCell seq> =
|
|
24
|
+
Decode.object (fun builder ->
|
|
25
|
+
let n = builder.Optional.Field number Decode.int
|
|
26
|
+
let cs = builder.Optional.Field cells (Decode.seq (Cell.decodeCols n)) |> Option.defaultValue Seq.empty
|
|
27
|
+
n,cs
|
|
28
|
+
)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Json } from "../../Thoth.Json.Core.0.2.1/Types.fs.js";
|
|
2
|
+
import { seq } from "../../Thoth.Json.Core.0.2.1/Encode.fs.js";
|
|
3
|
+
import { empty, map } from "../../fable-library-js.4.16.0/Seq.js";
|
|
4
|
+
import { decodeCols, encodeNoNumber, encodeCols } from "./Cell.fs.js";
|
|
5
|
+
import { seq as seq_1, int, object } from "../../Thoth.Json.Core.0.2.1/Decode.fs.js";
|
|
6
|
+
import { defaultArg } from "../../fable-library-js.4.16.0/Option.js";
|
|
7
|
+
|
|
8
|
+
export function encode(col) {
|
|
9
|
+
let value;
|
|
10
|
+
return new Json(5, [[["number", (value = (col.Index | 0), new Json(7, [value >>> 0]))], ["cells", seq(map(encodeCols, col.Cells))]]]);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function encodeNoNumbers(col) {
|
|
14
|
+
return new Json(5, [[["cells", seq(map(encodeNoNumber, col))]]]);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const decode = object((builder) => {
|
|
18
|
+
let arg_3, objectArg_1;
|
|
19
|
+
let n;
|
|
20
|
+
const objectArg = builder.Optional;
|
|
21
|
+
n = objectArg.Field("number", int);
|
|
22
|
+
return [n, defaultArg((arg_3 = seq_1(decodeCols(n)), (objectArg_1 = builder.Optional, objectArg_1.Field("cells", arg_3))), empty())];
|
|
23
|
+
});
|
|
24
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module FsSpreadsheet.Json.Row
|
|
2
|
+
|
|
3
|
+
open FsSpreadsheet
|
|
4
|
+
open Thoth.Json.Core
|
|
5
|
+
|
|
6
|
+
[<Literal>]
|
|
7
|
+
let cells = "cells"
|
|
8
|
+
|
|
9
|
+
[<Literal>]
|
|
10
|
+
let number = "number"
|
|
11
|
+
|
|
12
|
+
let encode (row:FsRow) =
|
|
13
|
+
Encode.object [
|
|
14
|
+
number, Encode.int row.Index
|
|
15
|
+
cells, Encode.seq (row.Cells |> Seq.map Cell.encodeRows)
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
let encodeNoNumbers (row: FsCell seq) =
|
|
19
|
+
Encode.object [
|
|
20
|
+
cells, Encode.seq (row |> Seq.map Cell.encodeNoNumber)
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
let decode : Decoder<int option*FsCell seq> =
|
|
24
|
+
Decode.object (fun builder ->
|
|
25
|
+
let n = builder.Optional.Field number Decode.int
|
|
26
|
+
let cs = builder.Optional.Field cells (Decode.seq (Cell.decodeRows n)) |> Option.defaultValue Seq.empty
|
|
27
|
+
n,cs
|
|
28
|
+
)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Json } from "../../Thoth.Json.Core.0.2.1/Types.fs.js";
|
|
2
|
+
import { seq } from "../../Thoth.Json.Core.0.2.1/Encode.fs.js";
|
|
3
|
+
import { empty, map } from "../../fable-library-js.4.16.0/Seq.js";
|
|
4
|
+
import { decodeRows, encodeNoNumber, encodeRows } from "./Cell.fs.js";
|
|
5
|
+
import { seq as seq_1, int, object } from "../../Thoth.Json.Core.0.2.1/Decode.fs.js";
|
|
6
|
+
import { defaultArg } from "../../fable-library-js.4.16.0/Option.js";
|
|
7
|
+
|
|
8
|
+
export function encode(row) {
|
|
9
|
+
let value;
|
|
10
|
+
return new Json(5, [[["number", (value = (row.Index | 0), new Json(7, [value >>> 0]))], ["cells", seq(map(encodeRows, row.Cells))]]]);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function encodeNoNumbers(row) {
|
|
14
|
+
return new Json(5, [[["cells", seq(map(encodeNoNumber, row))]]]);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const decode = object((builder) => {
|
|
18
|
+
let arg_3, objectArg_1;
|
|
19
|
+
let n;
|
|
20
|
+
const objectArg = builder.Optional;
|
|
21
|
+
n = objectArg.Field("number", int);
|
|
22
|
+
return [n, defaultArg((arg_3 = seq_1(decodeRows(n)), (objectArg_1 = builder.Optional, objectArg_1.Field("cells", arg_3))), empty())];
|
|
23
|
+
});
|
|
24
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module FsSpreadsheet.Json.Workbook
|
|
2
|
+
|
|
3
|
+
open FsSpreadsheet
|
|
4
|
+
open Thoth.Json.Core
|
|
5
|
+
|
|
6
|
+
[<Literal>]
|
|
7
|
+
let sheets = "sheets"
|
|
8
|
+
|
|
9
|
+
let encodeRows noNumbering (wb:FsWorkbook) =
|
|
10
|
+
Encode.object [
|
|
11
|
+
sheets, Encode.seq (wb.GetWorksheets() |> Seq.map (Worksheet.encodeRows noNumbering))
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
let decodeRows : Decoder<FsWorkbook> =
|
|
15
|
+
Decode.object (fun builder ->
|
|
16
|
+
let wb = new FsWorkbook()
|
|
17
|
+
let ws = builder.Required.Field sheets (Decode.seq Worksheet.decodeRows)
|
|
18
|
+
wb.AddWorksheets(ws)
|
|
19
|
+
wb
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
let encodeColumns noNumbering (wb:FsWorkbook) =
|
|
23
|
+
Encode.object [
|
|
24
|
+
sheets, Encode.seq (wb.GetWorksheets() |> Seq.map (Worksheet.encodeColumns noNumbering))
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
let decodeColumns : Decoder<FsWorkbook> =
|
|
28
|
+
Decode.object (fun builder ->
|
|
29
|
+
let wb = new FsWorkbook()
|
|
30
|
+
let ws = builder.Required.Field sheets (Decode.seq Worksheet.decodeColumns)
|
|
31
|
+
wb.AddWorksheets(ws)
|
|
32
|
+
wb
|
|
33
|
+
)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { seq } from "../../Thoth.Json.Core.0.2.1/Encode.fs.js";
|
|
2
|
+
import { map } from "../../fable-library-js.4.16.0/Seq.js";
|
|
3
|
+
import { decodeColumns as decodeColumns_1, encodeColumns as encodeColumns_1, decodeRows as decodeRows_1, encodeRows as encodeRows_1 } from "./Worksheet.fs.js";
|
|
4
|
+
import { Json } from "../../Thoth.Json.Core.0.2.1/Types.fs.js";
|
|
5
|
+
import { seq as seq_1, object } from "../../Thoth.Json.Core.0.2.1/Decode.fs.js";
|
|
6
|
+
import { FsWorkbook } from "../FsWorkbook.fs.js";
|
|
7
|
+
|
|
8
|
+
export function encodeRows(noNumbering, wb) {
|
|
9
|
+
return new Json(5, [[["sheets", seq(map((sheet) => encodeRows_1(noNumbering, sheet), wb.GetWorksheets()))]]]);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const decodeRows = object((builder) => {
|
|
13
|
+
const wb = new FsWorkbook();
|
|
14
|
+
let ws;
|
|
15
|
+
const arg_1 = seq_1(decodeRows_1);
|
|
16
|
+
const objectArg = builder.Required;
|
|
17
|
+
ws = objectArg.Field("sheets", arg_1);
|
|
18
|
+
wb.AddWorksheets(ws);
|
|
19
|
+
return wb;
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export function encodeColumns(noNumbering, wb) {
|
|
23
|
+
return new Json(5, [[["sheets", seq(map((sheet) => encodeColumns_1(noNumbering, sheet), wb.GetWorksheets()))]]]);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const decodeColumns = object((builder) => {
|
|
27
|
+
const wb = new FsWorkbook();
|
|
28
|
+
let ws;
|
|
29
|
+
const arg_1 = seq_1(decodeColumns_1);
|
|
30
|
+
const objectArg = builder.Required;
|
|
31
|
+
ws = objectArg.Field("sheets", arg_1);
|
|
32
|
+
wb.AddWorksheets(ws);
|
|
33
|
+
return wb;
|
|
34
|
+
});
|
|
35
|
+
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
module FsSpreadsheet.Json.Worksheet
|
|
2
|
+
|
|
3
|
+
open FsSpreadsheet
|
|
4
|
+
open Thoth.Json.Core
|
|
5
|
+
|
|
6
|
+
[<Literal>]
|
|
7
|
+
let name = "name"
|
|
8
|
+
|
|
9
|
+
[<Literal>]
|
|
10
|
+
let rows = "rows"
|
|
11
|
+
|
|
12
|
+
[<Literal>]
|
|
13
|
+
let columns = "columns"
|
|
14
|
+
|
|
15
|
+
[<Literal>]
|
|
16
|
+
let tables = "tables"
|
|
17
|
+
|
|
18
|
+
let encodeRows noNumbering (sheet:FsWorksheet) =
|
|
19
|
+
|
|
20
|
+
sheet.RescanRows()
|
|
21
|
+
let jRows =
|
|
22
|
+
if noNumbering then
|
|
23
|
+
[
|
|
24
|
+
for r = 1 to sheet.MaxRowIndex do
|
|
25
|
+
[
|
|
26
|
+
for c = 1 to sheet.MaxColumnIndex do
|
|
27
|
+
match sheet.CellCollection.TryGetCell(r,c) with
|
|
28
|
+
| Some cell -> cell
|
|
29
|
+
| None -> new FsCell("")
|
|
30
|
+
|
|
31
|
+
]
|
|
32
|
+
|> Row.encodeNoNumbers
|
|
33
|
+
]
|
|
34
|
+
|> Encode.seq
|
|
35
|
+
else
|
|
36
|
+
Encode.seq (sheet.Rows |> Seq.map Row.encode)
|
|
37
|
+
|
|
38
|
+
Encode.object [
|
|
39
|
+
name, Encode.string sheet.Name
|
|
40
|
+
if Seq.isEmpty sheet.Tables |> not then
|
|
41
|
+
tables, Encode.seq (sheet.Tables |> Seq.map Table.encode)
|
|
42
|
+
rows, jRows
|
|
43
|
+
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
let decodeRows : Decoder<FsWorksheet> =
|
|
47
|
+
Decode.object (fun builder ->
|
|
48
|
+
let mutable rowIndex = 0
|
|
49
|
+
|
|
50
|
+
let n = builder.Required.Field name Decode.string
|
|
51
|
+
let ts = builder.Optional.Field tables (Decode.seq Table.decode)
|
|
52
|
+
let rs = builder.Optional.Field rows (Decode.seq Row.decode) |> Option.defaultValue Seq.empty
|
|
53
|
+
let sheet = new FsWorksheet(n)
|
|
54
|
+
rs
|
|
55
|
+
|> Seq.iter (fun (rowI,cells) ->
|
|
56
|
+
let mutable colIndex = 0
|
|
57
|
+
let rowI =
|
|
58
|
+
match rowI with
|
|
59
|
+
| Some i -> i
|
|
60
|
+
| None -> rowIndex + 1
|
|
61
|
+
rowIndex <- rowI
|
|
62
|
+
let r = sheet.Row(rowI)
|
|
63
|
+
cells
|
|
64
|
+
|> Seq.iter (fun cell ->
|
|
65
|
+
let colI =
|
|
66
|
+
match cell.ColumnNumber with
|
|
67
|
+
| 0 -> colIndex + 1
|
|
68
|
+
| i -> i
|
|
69
|
+
colIndex <- colI
|
|
70
|
+
let c = r[colI]
|
|
71
|
+
c.Value <- cell.Value
|
|
72
|
+
c.DataType <- cell.DataType
|
|
73
|
+
)
|
|
74
|
+
)
|
|
75
|
+
match ts with
|
|
76
|
+
| Some ts ->
|
|
77
|
+
ts
|
|
78
|
+
|> Seq.iter (fun t ->
|
|
79
|
+
sheet.AddTable(t) |> ignore
|
|
80
|
+
)
|
|
81
|
+
| None -> ()
|
|
82
|
+
sheet
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
let encodeColumns noNumbering (sheet:FsWorksheet) =
|
|
86
|
+
sheet.RescanRows()
|
|
87
|
+
|
|
88
|
+
let jColumns =
|
|
89
|
+
if noNumbering then
|
|
90
|
+
[
|
|
91
|
+
for c = 1 to sheet.MaxColumnIndex do
|
|
92
|
+
[
|
|
93
|
+
for r = 1 to sheet.MaxRowIndex do
|
|
94
|
+
match sheet.CellCollection.TryGetCell(r,c) with
|
|
95
|
+
| Some cell -> cell
|
|
96
|
+
| None -> new FsCell("")
|
|
97
|
+
|
|
98
|
+
]
|
|
99
|
+
|> Column.encodeNoNumbers
|
|
100
|
+
]
|
|
101
|
+
|> Encode.seq
|
|
102
|
+
else
|
|
103
|
+
Encode.seq (sheet.Columns |> Seq.map Column.encode)
|
|
104
|
+
|
|
105
|
+
Encode.object [
|
|
106
|
+
name, Encode.string sheet.Name
|
|
107
|
+
if Seq.isEmpty sheet.Tables |> not then
|
|
108
|
+
tables, Encode.seq (sheet.Tables |> Seq.map Table.encode)
|
|
109
|
+
columns, jColumns
|
|
110
|
+
]
|
|
111
|
+
|
|
112
|
+
let decodeColumns : Decoder<FsWorksheet> =
|
|
113
|
+
Decode.object (fun builder ->
|
|
114
|
+
let mutable colIndex = 0
|
|
115
|
+
let n = builder.Required.Field name Decode.string
|
|
116
|
+
let ts = builder.Optional.Field tables (Decode.seq Table.decode)
|
|
117
|
+
let cs = builder.Required.Field columns (Decode.seq Column.decode)
|
|
118
|
+
let sheet = new FsWorksheet(n)
|
|
119
|
+
cs
|
|
120
|
+
|> Seq.iter (fun (colI,cells) ->
|
|
121
|
+
let mutable rowIndex = 0
|
|
122
|
+
let colI =
|
|
123
|
+
match colI with
|
|
124
|
+
| Some i -> i
|
|
125
|
+
| None -> colIndex + 1
|
|
126
|
+
colIndex <- colI
|
|
127
|
+
let col = sheet.Column(colI)
|
|
128
|
+
cells
|
|
129
|
+
|> Seq.iter (fun cell ->
|
|
130
|
+
let rowI =
|
|
131
|
+
match cell.RowNumber with
|
|
132
|
+
| 0 -> rowIndex + 1
|
|
133
|
+
| i -> i
|
|
134
|
+
rowIndex <- rowI
|
|
135
|
+
let c = col[rowIndex]
|
|
136
|
+
c.Value <- cell.Value
|
|
137
|
+
c.DataType <- cell.DataType
|
|
138
|
+
)
|
|
139
|
+
)
|
|
140
|
+
match ts with
|
|
141
|
+
| Some ts ->
|
|
142
|
+
ts
|
|
143
|
+
|> Seq.iter (fun t ->
|
|
144
|
+
sheet.AddTable(t) |> ignore
|
|
145
|
+
)
|
|
146
|
+
| None -> ()
|
|
147
|
+
sheet
|
|
148
|
+
)
|