@nfdi4plants/arctrl 1.0.0-alpha6
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/ARCtrl.js +257 -0
- package/Contract/Contract.js +95 -0
- package/Contracts/Contracts.ARCtrl.js +35 -0
- package/Contracts/Contracts.ArcAssay.js +65 -0
- package/Contracts/Contracts.ArcInvestigation.js +58 -0
- package/Contracts/Contracts.ArcStudy.js +65 -0
- package/Contracts/Contracts.Git.js +91 -0
- package/FileSystem/Commit.js +18 -0
- package/FileSystem/DefaultGitignore.js +3 -0
- package/FileSystem/FileSystem.js +53 -0
- package/FileSystem/FileSystemTree.js +223 -0
- package/FileSystem/Path.js +38 -0
- package/FileSystemTree.js +51 -0
- package/ISA/ISA/ArcTypes/ArcTable.js +744 -0
- package/ISA/ISA/ArcTypes/ArcTableAux.js +1142 -0
- package/ISA/ISA/ArcTypes/ArcTables.js +380 -0
- package/ISA/ISA/ArcTypes/ArcTypes.js +2018 -0
- package/ISA/ISA/ArcTypes/CompositeCell.js +180 -0
- package/ISA/ISA/ArcTypes/CompositeColumn.js +42 -0
- package/ISA/ISA/ArcTypes/CompositeHeader.js +358 -0
- package/ISA/ISA/ArcTypes/CompositeRow.js +111 -0
- package/ISA/ISA/ArcTypes/IdentifierSetters.js +26 -0
- package/ISA/ISA/Builder/Types.js +243 -0
- package/ISA/ISA/Fable.js +50 -0
- package/ISA/ISA/Helper.js +326 -0
- package/ISA/ISA/Identifier.js +76 -0
- package/ISA/ISA/JsonTypes/AnnotationValue.js +56 -0
- package/ISA/ISA/JsonTypes/Assay.js +620 -0
- package/ISA/ISA/JsonTypes/AssayMaterials.js +39 -0
- package/ISA/ISA/JsonTypes/ColumnIndex.js +246 -0
- package/ISA/ISA/JsonTypes/Comment.js +58 -0
- package/ISA/ISA/JsonTypes/CommentList.js +139 -0
- package/ISA/ISA/JsonTypes/Component.js +158 -0
- package/ISA/ISA/JsonTypes/Data.js +55 -0
- package/ISA/ISA/JsonTypes/DataFile.js +68 -0
- package/ISA/ISA/JsonTypes/Factor.js +128 -0
- package/ISA/ISA/JsonTypes/FactorValue.js +109 -0
- package/ISA/ISA/JsonTypes/Investigation.js +204 -0
- package/ISA/ISA/JsonTypes/Material.js +66 -0
- package/ISA/ISA/JsonTypes/MaterialAttribute.js +101 -0
- package/ISA/ISA/JsonTypes/MaterialAttributeValue.js +126 -0
- package/ISA/ISA/JsonTypes/MaterialType.js +41 -0
- package/ISA/ISA/JsonTypes/OntologyAnnotation.js +219 -0
- package/ISA/ISA/JsonTypes/OntologySourceReference.js +85 -0
- package/ISA/ISA/JsonTypes/Person.js +137 -0
- package/ISA/ISA/JsonTypes/Process.js +401 -0
- package/ISA/ISA/JsonTypes/ProcessInput.js +297 -0
- package/ISA/ISA/JsonTypes/ProcessOutput.js +263 -0
- package/ISA/ISA/JsonTypes/ProcessParameterValue.js +129 -0
- package/ISA/ISA/JsonTypes/ProcessSequence.js +255 -0
- package/ISA/ISA/JsonTypes/Protocol.js +277 -0
- package/ISA/ISA/JsonTypes/ProtocolParameter.js +101 -0
- package/ISA/ISA/JsonTypes/Publication.js +105 -0
- package/ISA/ISA/JsonTypes/Sample.js +71 -0
- package/ISA/ISA/JsonTypes/Source.js +54 -0
- package/ISA/ISA/JsonTypes/Study.js +942 -0
- package/ISA/ISA/JsonTypes/StudyMaterials.js +45 -0
- package/ISA/ISA/JsonTypes/URI.js +19 -0
- package/ISA/ISA/JsonTypes/Value.js +210 -0
- package/ISA/ISA/Regex.js +588 -0
- package/ISA/ISA.Json/Assay.js +123 -0
- package/ISA/ISA.Json/Comment.js +84 -0
- package/ISA/ISA.Json/ConverterOptions.js +33 -0
- package/ISA/ISA.Json/Data.js +271 -0
- package/ISA/ISA.Json/Decode.js +46 -0
- package/ISA/ISA.Json/Factor.js +194 -0
- package/ISA/ISA.Json/GEncode.js +15 -0
- package/ISA/ISA.Json/Investigation.js +132 -0
- package/ISA/ISA.Json/Material.js +233 -0
- package/ISA/ISA.Json/Ontology.js +204 -0
- package/ISA/ISA.Json/Person.js +204 -0
- package/ISA/ISA.Json/Process.js +291 -0
- package/ISA/ISA.Json/Protocol.js +242 -0
- package/ISA/ISA.Json/Publication.js +92 -0
- package/ISA/ISA.Json/Study.js +230 -0
- package/ISA/ISA.Json/Validation/Fable.js +69 -0
- package/ISA/ISA.Json/Validation/JsonSchemaValidation.js +88 -0
- package/ISA/ISA.Json/Validation/ValidationResult.js +45 -0
- package/ISA/ISA.Spreadsheet/AnnotationTable/ArcTable.js +137 -0
- package/ISA/ISA.Spreadsheet/AnnotationTable/CompositeCell.js +78 -0
- package/ISA/ISA.Spreadsheet/AnnotationTable/CompositeColumn.js +59 -0
- package/ISA/ISA.Spreadsheet/AnnotationTable/CompositeHeader.js +478 -0
- package/ISA/ISA.Spreadsheet/ArcAssay.js +150 -0
- package/ISA/ISA.Spreadsheet/ArcInvestigation.js +314 -0
- package/ISA/ISA.Spreadsheet/ArcStudy.js +67 -0
- package/ISA/ISA.Spreadsheet/CollectionAux.js +128 -0
- package/ISA/ISA.Spreadsheet/Metadata/Assays.js +81 -0
- package/ISA/ISA.Spreadsheet/Metadata/Comment.js +60 -0
- package/ISA/ISA.Spreadsheet/Metadata/Contacts.js +104 -0
- package/ISA/ISA.Spreadsheet/Metadata/Conversions.js +180 -0
- package/ISA/ISA.Spreadsheet/Metadata/DesignDescriptors.js +27 -0
- package/ISA/ISA.Spreadsheet/Metadata/Factors.js +85 -0
- package/ISA/ISA.Spreadsheet/Metadata/OntologyAnnotation.js +65 -0
- package/ISA/ISA.Spreadsheet/Metadata/OntologySourceReference.js +73 -0
- package/ISA/ISA.Spreadsheet/Metadata/Protocols.js +116 -0
- package/ISA/ISA.Spreadsheet/Metadata/Publication.js +96 -0
- package/ISA/ISA.Spreadsheet/Metadata/SparseTable.js +451 -0
- package/ISA/ISA.Spreadsheet/Metadata/Study.js +260 -0
- package/README.md +277 -0
- package/SemVer.js +60 -0
- package/Templates/Templates.Json.js +40 -0
- package/Templates/Templates.Spreadsheet.js +315 -0
- package/Templates/Templates.js +179 -0
- package/fable_modules/FsSpreadsheet.4.1.0/Cells/FsCell.fs +387 -0
- package/fable_modules/FsSpreadsheet.4.1.0/Cells/FsCell.fs.js +240 -0
- package/fable_modules/FsSpreadsheet.4.1.0/Cells/FsCellsCollection.fs +725 -0
- package/fable_modules/FsSpreadsheet.4.1.0/Cells/FsCellsCollection.fs.js +522 -0
- package/fable_modules/FsSpreadsheet.4.1.0/DSL/CellBuilder.fs +195 -0
- package/fable_modules/FsSpreadsheet.4.1.0/DSL/CellBuilder.fs.js +208 -0
- package/fable_modules/FsSpreadsheet.4.1.0/DSL/ColumnBuilder.fs +209 -0
- package/fable_modules/FsSpreadsheet.4.1.0/DSL/ColumnBuilder.fs.js +137 -0
- package/fable_modules/FsSpreadsheet.4.1.0/DSL/DSL.fs +61 -0
- package/fable_modules/FsSpreadsheet.4.1.0/DSL/DSL.fs.js +62 -0
- package/fable_modules/FsSpreadsheet.4.1.0/DSL/Expression.fs +24 -0
- package/fable_modules/FsSpreadsheet.4.1.0/DSL/Expression.fs.js +56 -0
- package/fable_modules/FsSpreadsheet.4.1.0/DSL/Operators.fs +102 -0
- package/fable_modules/FsSpreadsheet.4.1.0/DSL/Operators.fs.js +6 -0
- package/fable_modules/FsSpreadsheet.4.1.0/DSL/RowBuilder.fs +200 -0
- package/fable_modules/FsSpreadsheet.4.1.0/DSL/RowBuilder.fs.js +137 -0
- package/fable_modules/FsSpreadsheet.4.1.0/DSL/SheetBuilder.fs +139 -0
- package/fable_modules/FsSpreadsheet.4.1.0/DSL/SheetBuilder.fs.js +116 -0
- package/fable_modules/FsSpreadsheet.4.1.0/DSL/TableBuilder.fs +120 -0
- package/fable_modules/FsSpreadsheet.4.1.0/DSL/TableBuilder.fs.js +120 -0
- package/fable_modules/FsSpreadsheet.4.1.0/DSL/Transform.fs +229 -0
- package/fable_modules/FsSpreadsheet.4.1.0/DSL/Transform.fs.js +421 -0
- package/fable_modules/FsSpreadsheet.4.1.0/DSL/Types.fs +151 -0
- package/fable_modules/FsSpreadsheet.4.1.0/DSL/Types.fs.js +277 -0
- package/fable_modules/FsSpreadsheet.4.1.0/DSL/WorkbookBuilder.fs +114 -0
- package/fable_modules/FsSpreadsheet.4.1.0/DSL/WorkbookBuilder.fs.js +104 -0
- package/fable_modules/FsSpreadsheet.4.1.0/FsAddress.fs +177 -0
- package/fable_modules/FsSpreadsheet.4.1.0/FsAddress.fs.js +249 -0
- package/fable_modules/FsSpreadsheet.4.1.0/FsColumn.fs +200 -0
- package/fable_modules/FsSpreadsheet.4.1.0/FsColumn.fs.js +125 -0
- package/fable_modules/FsSpreadsheet.4.1.0/FsRow.fs +202 -0
- package/fable_modules/FsSpreadsheet.4.1.0/FsRow.fs.js +135 -0
- package/fable_modules/FsSpreadsheet.4.1.0/FsSpreadsheet.fableproj +58 -0
- package/fable_modules/FsSpreadsheet.4.1.0/FsWorkbook.fs +183 -0
- package/fable_modules/FsSpreadsheet.4.1.0/FsWorkbook.fs.js +138 -0
- package/fable_modules/FsSpreadsheet.4.1.0/FsWorksheet.fs +628 -0
- package/fable_modules/FsSpreadsheet.4.1.0/FsWorksheet.fs.js +398 -0
- package/fable_modules/FsSpreadsheet.4.1.0/Ranges/FsRange.fs +19 -0
- package/fable_modules/FsSpreadsheet.4.1.0/Ranges/FsRange.fs.js +41 -0
- package/fable_modules/FsSpreadsheet.4.1.0/Ranges/FsRangeAddress.fs +222 -0
- package/fable_modules/FsSpreadsheet.4.1.0/Ranges/FsRangeAddress.fs.js +235 -0
- package/fable_modules/FsSpreadsheet.4.1.0/Ranges/FsRangeBase.fs +93 -0
- package/fable_modules/FsSpreadsheet.4.1.0/Ranges/FsRangeBase.fs.js +91 -0
- package/fable_modules/FsSpreadsheet.4.1.0/Ranges/FsRangeColumn.fs +65 -0
- package/fable_modules/FsSpreadsheet.4.1.0/Ranges/FsRangeColumn.fs.js +74 -0
- package/fable_modules/FsSpreadsheet.4.1.0/Ranges/FsRangeRow.fs +22 -0
- package/fable_modules/FsSpreadsheet.4.1.0/Ranges/FsRangeRow.fs.js +40 -0
- package/fable_modules/FsSpreadsheet.4.1.0/SheetBuilder.fs +249 -0
- package/fable_modules/FsSpreadsheet.4.1.0/SheetBuilder.fs.js +325 -0
- package/fable_modules/FsSpreadsheet.4.1.0/Tables/FsTable.fs +455 -0
- package/fable_modules/FsSpreadsheet.4.1.0/Tables/FsTable.fs.js +310 -0
- package/fable_modules/FsSpreadsheet.4.1.0/Tables/FsTableField.fs +140 -0
- package/fable_modules/FsSpreadsheet.4.1.0/Tables/FsTableField.fs.js +173 -0
- package/fable_modules/FsSpreadsheet.4.1.0/Tables/FsTableRow.fs +6 -0
- package/fable_modules/FsSpreadsheet.4.1.0/Tables/FsTableRow.fs.js +17 -0
- package/fable_modules/FsSpreadsheet.4.1.0/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +3 -0
- package/fable_modules/FsSpreadsheet.4.1.0/obj/Debug/netstandard2.0/FsSpreadsheet.AssemblyInfo.fs +19 -0
- package/fable_modules/FsSpreadsheet.4.1.0/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +3 -0
- package/fable_modules/FsSpreadsheet.4.1.0/obj/Release/netstandard2.0/FsSpreadsheet.AssemblyInfo.fs +19 -0
- package/fable_modules/Thoth.Json.10.1.0/Decode.fs +1366 -0
- package/fable_modules/Thoth.Json.10.1.0/Decode.fs.js +1798 -0
- package/fable_modules/Thoth.Json.10.1.0/Encode.fs +621 -0
- package/fable_modules/Thoth.Json.10.1.0/Encode.fs.js +472 -0
- package/fable_modules/Thoth.Json.10.1.0/Extra.fs +31 -0
- package/fable_modules/Thoth.Json.10.1.0/Extra.fs.js +8 -0
- package/fable_modules/Thoth.Json.10.1.0/Thoth.Json.fableproj +30 -0
- package/fable_modules/Thoth.Json.10.1.0/Types.fs +59 -0
- package/fable_modules/Thoth.Json.10.1.0/Types.fs.js +98 -0
- package/fable_modules/Thoth.Json.10.1.0/obj/Release/netstandard2.0/Thoth.Json.AssemblyInfo.fs +19 -0
- package/fable_modules/Thoth.Json.10.1.0/package.json +5 -0
- package/fable_modules/fable-library.4.1.4/Array.d.ts +120 -0
- package/fable_modules/fable-library.4.1.4/Array.js +1204 -0
- package/fable_modules/fable-library.4.1.4/Async.d.ts +32 -0
- package/fable_modules/fable-library.4.1.4/Async.js +158 -0
- package/fable_modules/fable-library.4.1.4/AsyncBuilder.d.ts +59 -0
- package/fable_modules/fable-library.4.1.4/AsyncBuilder.js +183 -0
- package/fable_modules/fable-library.4.1.4/BigInt.d.ts +115 -0
- package/fable_modules/fable-library.4.1.4/BigInt.js +282 -0
- package/fable_modules/fable-library.4.1.4/BitConverter.d.ts +27 -0
- package/fable_modules/fable-library.4.1.4/BitConverter.js +138 -0
- package/fable_modules/fable-library.4.1.4/Boolean.d.ts +3 -0
- package/fable_modules/fable-library.4.1.4/Boolean.js +21 -0
- package/fable_modules/fable-library.4.1.4/Char.d.ts +65 -0
- package/fable_modules/fable-library.4.1.4/Char.js +169 -0
- package/fable_modules/fable-library.4.1.4/Choice.d.ts +138 -0
- package/fable_modules/fable-library.4.1.4/Choice.js +227 -0
- package/fable_modules/fable-library.4.1.4/Date.d.ts +70 -0
- package/fable_modules/fable-library.4.1.4/Date.js +451 -0
- package/fable_modules/fable-library.4.1.4/DateOffset.d.ts +63 -0
- package/fable_modules/fable-library.4.1.4/DateOffset.js +268 -0
- package/fable_modules/fable-library.4.1.4/DateOnly.d.ts +18 -0
- package/fable_modules/fable-library.4.1.4/DateOnly.js +124 -0
- package/fable_modules/fable-library.4.1.4/Decimal.d.ts +45 -0
- package/fable_modules/fable-library.4.1.4/Decimal.js +212 -0
- package/fable_modules/fable-library.4.1.4/Double.d.ts +11 -0
- package/fable_modules/fable-library.4.1.4/Double.js +46 -0
- package/fable_modules/fable-library.4.1.4/Encoding.d.ts +12 -0
- package/fable_modules/fable-library.4.1.4/Encoding.js +173 -0
- package/fable_modules/fable-library.4.1.4/Event.d.ts +31 -0
- package/fable_modules/fable-library.4.1.4/Event.js +93 -0
- package/fable_modules/fable-library.4.1.4/FSharp.Collections.d.ts +7 -0
- package/fable_modules/fable-library.4.1.4/FSharp.Collections.js +27 -0
- package/fable_modules/fable-library.4.1.4/FSharp.Core.d.ts +17 -0
- package/fable_modules/fable-library.4.1.4/FSharp.Core.js +69 -0
- package/fable_modules/fable-library.4.1.4/Global.d.ts +24 -0
- package/fable_modules/fable-library.4.1.4/Global.js +8 -0
- package/fable_modules/fable-library.4.1.4/Guid.d.ts +10 -0
- package/fable_modules/fable-library.4.1.4/Guid.js +142 -0
- package/fable_modules/fable-library.4.1.4/Int32.d.ts +28 -0
- package/fable_modules/fable-library.4.1.4/Int32.js +135 -0
- package/fable_modules/fable-library.4.1.4/List.d.ts +143 -0
- package/fable_modules/fable-library.4.1.4/List.js +1273 -0
- package/fable_modules/fable-library.4.1.4/Long.d.ts +3 -0
- package/fable_modules/fable-library.4.1.4/Long.js +46 -0
- package/fable_modules/fable-library.4.1.4/MailboxProcessor.d.ts +25 -0
- package/fable_modules/fable-library.4.1.4/MailboxProcessor.js +93 -0
- package/fable_modules/fable-library.4.1.4/Map.d.ts +178 -0
- package/fable_modules/fable-library.4.1.4/Map.js +1396 -0
- package/fable_modules/fable-library.4.1.4/MapUtil.d.ts +10 -0
- package/fable_modules/fable-library.4.1.4/MapUtil.js +112 -0
- package/fable_modules/fable-library.4.1.4/MutableMap.d.ts +52 -0
- package/fable_modules/fable-library.4.1.4/MutableMap.js +326 -0
- package/fable_modules/fable-library.4.1.4/MutableSet.d.ts +39 -0
- package/fable_modules/fable-library.4.1.4/MutableSet.js +232 -0
- package/fable_modules/fable-library.4.1.4/Native.d.ts +2 -0
- package/fable_modules/fable-library.4.1.4/Native.js +8 -0
- package/fable_modules/fable-library.4.1.4/Numeric.d.ts +19 -0
- package/fable_modules/fable-library.4.1.4/Numeric.js +71 -0
- package/fable_modules/fable-library.4.1.4/Observable.d.ts +32 -0
- package/fable_modules/fable-library.4.1.4/Observable.js +113 -0
- package/fable_modules/fable-library.4.1.4/Option.d.ts +28 -0
- package/fable_modules/fable-library.4.1.4/Option.js +96 -0
- package/fable_modules/fable-library.4.1.4/README.md +3 -0
- package/fable_modules/fable-library.4.1.4/Random.d.ts +37 -0
- package/fable_modules/fable-library.4.1.4/Random.js +170 -0
- package/fable_modules/fable-library.4.1.4/Range.d.ts +12 -0
- package/fable_modules/fable-library.4.1.4/Range.js +45 -0
- package/fable_modules/fable-library.4.1.4/Reflection.d.ts +119 -0
- package/fable_modules/fable-library.4.1.4/Reflection.js +461 -0
- package/fable_modules/fable-library.4.1.4/RegExp.d.ts +10 -0
- package/fable_modules/fable-library.4.1.4/RegExp.js +132 -0
- package/fable_modules/fable-library.4.1.4/Seq.d.ts +165 -0
- package/fable_modules/fable-library.4.1.4/Seq.js +1379 -0
- package/fable_modules/fable-library.4.1.4/Seq2.d.ts +18 -0
- package/fable_modules/fable-library.4.1.4/Seq2.js +111 -0
- package/fable_modules/fable-library.4.1.4/Set.d.ts +190 -0
- package/fable_modules/fable-library.4.1.4/Set.js +1789 -0
- package/fable_modules/fable-library.4.1.4/String.d.ts +49 -0
- package/fable_modules/fable-library.4.1.4/String.js +540 -0
- package/fable_modules/fable-library.4.1.4/System.Collections.Generic.d.ts +71 -0
- package/fable_modules/fable-library.4.1.4/System.Collections.Generic.js +307 -0
- package/fable_modules/fable-library.4.1.4/System.Text.d.ts +30 -0
- package/fable_modules/fable-library.4.1.4/System.Text.js +110 -0
- package/fable_modules/fable-library.4.1.4/SystemException.d.ts +5 -0
- package/fable_modules/fable-library.4.1.4/SystemException.js +5 -0
- package/fable_modules/fable-library.4.1.4/TimeOnly.d.ts +15 -0
- package/fable_modules/fable-library.4.1.4/TimeOnly.js +122 -0
- package/fable_modules/fable-library.4.1.4/TimeSpan.d.ts +34 -0
- package/fable_modules/fable-library.4.1.4/TimeSpan.js +177 -0
- package/fable_modules/fable-library.4.1.4/Timer.d.ts +19 -0
- package/fable_modules/fable-library.4.1.4/Timer.js +67 -0
- package/fable_modules/fable-library.4.1.4/Types.d.ts +58 -0
- package/fable_modules/fable-library.4.1.4/Types.js +208 -0
- package/fable_modules/fable-library.4.1.4/Unicode.13.0.0.d.ts +2 -0
- package/fable_modules/fable-library.4.1.4/Unicode.13.0.0.js +4 -0
- package/fable_modules/fable-library.4.1.4/Uri.d.ts +29 -0
- package/fable_modules/fable-library.4.1.4/Uri.js +142 -0
- package/fable_modules/fable-library.4.1.4/Util.d.ts +187 -0
- package/fable_modules/fable-library.4.1.4/Util.js +662 -0
- package/fable_modules/fable-library.4.1.4/lib/big.d.ts +338 -0
- package/fable_modules/fable-library.4.1.4/lib/big.js +826 -0
- package/fable_modules/fable-library.4.1.4/package.json +23 -0
- package/fable_modules/project_cracked.json +1 -0
- package/package.json +22 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
namespace FsSpreadsheet
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
/// Module containing functions to work with "A1" style excel cell references.
|
|
5
|
+
module CellReference =
|
|
6
|
+
|
|
7
|
+
/// Transforms excel column string indices (e.g. A, B, Z, AA, CD) to index number (starting with A = 1).
|
|
8
|
+
let colAdressToIndex (columnAdress : string) =
|
|
9
|
+
let length = columnAdress.Length
|
|
10
|
+
let mutable sum = 0u
|
|
11
|
+
for i=0 to length-1 do
|
|
12
|
+
let c = columnAdress.[length-1-i] |> System.Char.ToUpper
|
|
13
|
+
let factor = 26. ** (float i) |> uint
|
|
14
|
+
sum <- sum + ((uint c - 64u) * factor)
|
|
15
|
+
sum
|
|
16
|
+
|
|
17
|
+
/// Transforms number index to excel column string indices (e.g. A, B, Z, AA, CD) (starting with A = 1).
|
|
18
|
+
let indexToColAdress i =
|
|
19
|
+
// Cannot use StringBuilder, as it is not compatible with Fable
|
|
20
|
+
let rec loop index acc =
|
|
21
|
+
match index with
|
|
22
|
+
| 0u -> acc
|
|
23
|
+
| _ ->
|
|
24
|
+
let mod26 = (index - 1u) % 26u
|
|
25
|
+
let nextChar = char (uint 'A' + mod26)
|
|
26
|
+
loop ((index - 1u) / 26u) (string nextChar + acc)
|
|
27
|
+
loop i ""
|
|
28
|
+
|
|
29
|
+
/// Maps 1 based column and row indices to "A1" style reference.
|
|
30
|
+
let ofIndices column (row : uint32) =
|
|
31
|
+
sprintf "%s%i" (indexToColAdress column) row
|
|
32
|
+
|
|
33
|
+
/// Maps a "A1" style excel cell reference to a column * row index tuple (1 Based indices).
|
|
34
|
+
let toIndices (reference : string) =
|
|
35
|
+
let inp = reference.ToUpper()
|
|
36
|
+
let pattern = "([A-Z]*)(\d*)"
|
|
37
|
+
let regex = System.Text.RegularExpressions.Regex.Match(inp,pattern)
|
|
38
|
+
|
|
39
|
+
if regex.Success then
|
|
40
|
+
regex.Groups
|
|
41
|
+
|> fun a -> colAdressToIndex a.[1].Value, uint32 a.[2].Value
|
|
42
|
+
else
|
|
43
|
+
failwithf "Reference %s does not match Excel A1-style" reference
|
|
44
|
+
|
|
45
|
+
/// Maps a "A1" style excel cell reference to a column (1 Based indices).
|
|
46
|
+
let toColIndex (reference : string) =
|
|
47
|
+
reference |> toIndices |> fst
|
|
48
|
+
|
|
49
|
+
/// Maps a "A1" style excel cell reference to a row (1 Based indices).
|
|
50
|
+
let toRowIndex (reference : string) =
|
|
51
|
+
reference |> toIndices |> snd
|
|
52
|
+
|
|
53
|
+
/// Sets the column index (1 Based indices) of a "A1" style excel cell reference.
|
|
54
|
+
let setColIndex colI (reference : string) =
|
|
55
|
+
reference |> toIndices |> fun (_,r) -> ofIndices colI r
|
|
56
|
+
|
|
57
|
+
/// Sets the row index (1 Based indices) of a "A1" style excel cell reference.
|
|
58
|
+
let setRowIndex rowI (reference : string) =
|
|
59
|
+
reference |> toIndices |> fun (c,_) -> ofIndices c rowI
|
|
60
|
+
|
|
61
|
+
/// Changes the column portion of a "A1"-style reference by the given amount (positive amount = increase and vice versa).
|
|
62
|
+
let moveHorizontal amount reference =
|
|
63
|
+
reference
|
|
64
|
+
|> toIndices
|
|
65
|
+
|> fun (c,r) -> (int64 c) + (int64 amount) |> uint32, r
|
|
66
|
+
||> ofIndices
|
|
67
|
+
|
|
68
|
+
/// Changes the row portion of a "A1"-style reference by the given amount (positive amount = increase and vice versa).
|
|
69
|
+
let moveVertical amount reference =
|
|
70
|
+
reference
|
|
71
|
+
|> toIndices
|
|
72
|
+
|> fun (c,r) -> c, (int64 r) + (int64 amount) |> uint32
|
|
73
|
+
||> ofIndices
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
type FsAddress(rowNumber : int, columnNumber : int, fixedRow : bool, fixedColumn : bool) =
|
|
77
|
+
|
|
78
|
+
let mutable _fixedRow = fixedRow
|
|
79
|
+
let mutable _fixedColumn = fixedColumn
|
|
80
|
+
let mutable _rowNumber = rowNumber
|
|
81
|
+
let mutable _columnNumber = columnNumber
|
|
82
|
+
|
|
83
|
+
let mutable _trimmedAddress = ""
|
|
84
|
+
|
|
85
|
+
// ----------------------
|
|
86
|
+
// ALTERNATE CONSTRUCTORS
|
|
87
|
+
// ----------------------
|
|
88
|
+
|
|
89
|
+
new (rowNumber : int, columnLetter : string, fixedRow : bool, fixedColumn : bool) =
|
|
90
|
+
FsAddress(rowNumber,CellReference.colAdressToIndex columnLetter |> int,fixedRow,fixedColumn)
|
|
91
|
+
|
|
92
|
+
new (rowNumber : int, columnNumber : int) =
|
|
93
|
+
FsAddress(rowNumber,columnNumber,false,false)
|
|
94
|
+
|
|
95
|
+
new (cellAddressString : string) =
|
|
96
|
+
let colIndex,rowIndex = CellReference.toIndices cellAddressString
|
|
97
|
+
FsAddress(int rowIndex,int colIndex)
|
|
98
|
+
|
|
99
|
+
// ----------
|
|
100
|
+
// PROPERTIES
|
|
101
|
+
// ----------
|
|
102
|
+
|
|
103
|
+
member self.ColumnNumber
|
|
104
|
+
with get() = _columnNumber
|
|
105
|
+
and set(colI) = _columnNumber <- colI
|
|
106
|
+
|
|
107
|
+
member self.RowNumber
|
|
108
|
+
with get() = _rowNumber
|
|
109
|
+
and set(rowI) = _rowNumber <- rowI
|
|
110
|
+
|
|
111
|
+
member self.Address
|
|
112
|
+
with get() = CellReference.ofIndices (uint32 _columnNumber) (uint32 _rowNumber)
|
|
113
|
+
and set(address) =
|
|
114
|
+
let column,row = CellReference.toIndices address
|
|
115
|
+
_rowNumber <- int row
|
|
116
|
+
_columnNumber <- int column
|
|
117
|
+
|
|
118
|
+
member self.FixedRow = false
|
|
119
|
+
member self.FixedColumn = false
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
// -------
|
|
123
|
+
// METHODS
|
|
124
|
+
// -------
|
|
125
|
+
//let mutable _address = address
|
|
126
|
+
|
|
127
|
+
/// <summary>
|
|
128
|
+
/// Creates a deep copy of the FsAddress.
|
|
129
|
+
/// </summary>
|
|
130
|
+
member this.Copy() =
|
|
131
|
+
let colNo = this.ColumnNumber
|
|
132
|
+
let rowNo = this.RowNumber
|
|
133
|
+
let fixRow = this.FixedRow
|
|
134
|
+
let fixedCol = this.FixedColumn
|
|
135
|
+
FsAddress(rowNo, colNo, fixRow, fixedCol)
|
|
136
|
+
|
|
137
|
+
/// <summary>
|
|
138
|
+
/// Returns a deep copy of the given FsAddress.
|
|
139
|
+
/// </summary>
|
|
140
|
+
static member copy (address : FsAddress) =
|
|
141
|
+
address.Copy()
|
|
142
|
+
|
|
143
|
+
/// <summary>
|
|
144
|
+
/// Updates the row- and columnIndex respective to the given indices.
|
|
145
|
+
/// </summary>
|
|
146
|
+
member self.UpdateIndices(rowIndex,colIndex) =
|
|
147
|
+
_columnNumber <- colIndex
|
|
148
|
+
_rowNumber <- rowIndex
|
|
149
|
+
|
|
150
|
+
/// <summary>
|
|
151
|
+
/// Updates the row- and columnIndex of a given FsAddress respective to the given indices.
|
|
152
|
+
/// </summary>
|
|
153
|
+
static member updateIndices rowIndex colIndex (address : FsAddress) =
|
|
154
|
+
address.UpdateIndices(rowIndex, colIndex)
|
|
155
|
+
address
|
|
156
|
+
|
|
157
|
+
/// <summary>Returns the row- and the columnIndex of the FsAddress.</summary>
|
|
158
|
+
/// <returns>A tuple consisting of the rowIndex (fst) and the columnIndex (snd).</returns>
|
|
159
|
+
member self.ToIndices() = _rowNumber,_columnNumber
|
|
160
|
+
|
|
161
|
+
/// <summary>Returns the row- and the columnIndex of a given FsAddress.</summary>
|
|
162
|
+
/// <returns>A tuple consisting of the rowIndex (fst) and the columnIndex (snd).</returns>
|
|
163
|
+
static member toIndices (address : FsAddress) =
|
|
164
|
+
address.ToIndices()
|
|
165
|
+
|
|
166
|
+
/// <summary>Compares the FsAddress with a given other one.</summary>
|
|
167
|
+
/// <returns>Returns true if both FsAddresses are equal.</returns>
|
|
168
|
+
member self.Compare(address : FsAddress) =
|
|
169
|
+
self.Address = address.Address &&
|
|
170
|
+
self.ColumnNumber = address.ColumnNumber &&
|
|
171
|
+
self.RowNumber = address.RowNumber &&
|
|
172
|
+
self.FixedColumn = address.FixedColumn &&
|
|
173
|
+
self.FixedRow = address.FixedRow
|
|
174
|
+
|
|
175
|
+
/// <summary>Checks if 2 FsAddresses are equal.</summary>
|
|
176
|
+
static member compare (address1 : FsAddress) (address2 : FsAddress) =
|
|
177
|
+
address1.Compare address2
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { toFail, printf, toText } from "../fable-library.4.1.4/String.js";
|
|
2
|
+
import { create, match } from "../fable-library.4.1.4/RegExp.js";
|
|
3
|
+
import { parse } from "../fable-library.4.1.4/Int32.js";
|
|
4
|
+
import { toUInt32, fromInt32, fromUInt32, op_Addition, toInt64 } from "../fable-library.4.1.4/BigInt.js";
|
|
5
|
+
import { class_type } from "../fable-library.4.1.4/Reflection.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Transforms excel column string indices (e.g. A, B, Z, AA, CD) to index number (starting with A = 1).
|
|
9
|
+
*/
|
|
10
|
+
export function CellReference_colAdressToIndex(columnAdress) {
|
|
11
|
+
const length = columnAdress.length | 0;
|
|
12
|
+
let sum = 0;
|
|
13
|
+
for (let i = 0; i <= (length - 1); i++) {
|
|
14
|
+
let c;
|
|
15
|
+
const arg = columnAdress[(length - 1) - i];
|
|
16
|
+
c = arg.toLocaleUpperCase();
|
|
17
|
+
let factor;
|
|
18
|
+
const value = Math.pow(26, i);
|
|
19
|
+
factor = (value >>> 0);
|
|
20
|
+
sum = (sum + ((c.charCodeAt(0) - 64) * factor));
|
|
21
|
+
}
|
|
22
|
+
return sum;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Transforms number index to excel column string indices (e.g. A, B, Z, AA, CD) (starting with A = 1).
|
|
27
|
+
*/
|
|
28
|
+
export function CellReference_indexToColAdress(i) {
|
|
29
|
+
const loop = (index_mut, acc_mut) => {
|
|
30
|
+
loop:
|
|
31
|
+
while (true) {
|
|
32
|
+
const index = index_mut, acc = acc_mut;
|
|
33
|
+
if (index === 0) {
|
|
34
|
+
return acc;
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
const mod26 = (index - 1) % 26;
|
|
38
|
+
index_mut = ~~((index - 1) / 26);
|
|
39
|
+
acc_mut = (String.fromCharCode(65 + mod26) + acc);
|
|
40
|
+
continue loop;
|
|
41
|
+
}
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
return loop(i, "");
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Maps 1 based column and row indices to "A1" style reference.
|
|
50
|
+
*/
|
|
51
|
+
export function CellReference_ofIndices(column, row) {
|
|
52
|
+
const arg = CellReference_indexToColAdress(column);
|
|
53
|
+
return toText(printf("%s%i"))(arg)(row);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Maps a "A1" style excel cell reference to a column * row index tuple (1 Based indices).
|
|
58
|
+
*/
|
|
59
|
+
export function CellReference_toIndices(reference) {
|
|
60
|
+
const inp = reference.toLocaleUpperCase();
|
|
61
|
+
const regex = match(create("([A-Z]*)(\\d*)"), inp);
|
|
62
|
+
if (regex != null) {
|
|
63
|
+
const a = regex;
|
|
64
|
+
return [CellReference_colAdressToIndex(a[1] || ""), parse(a[2] || "", 511, true, 32)];
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
return toFail(printf("Reference %s does not match Excel A1-style"))(reference);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Maps a "A1" style excel cell reference to a column (1 Based indices).
|
|
73
|
+
*/
|
|
74
|
+
export function CellReference_toColIndex(reference) {
|
|
75
|
+
return CellReference_toIndices(reference)[0];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Maps a "A1" style excel cell reference to a row (1 Based indices).
|
|
80
|
+
*/
|
|
81
|
+
export function CellReference_toRowIndex(reference) {
|
|
82
|
+
return CellReference_toIndices(reference)[1];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Sets the column index (1 Based indices) of a "A1" style excel cell reference.
|
|
87
|
+
*/
|
|
88
|
+
export function CellReference_setColIndex(colI, reference) {
|
|
89
|
+
return CellReference_ofIndices(colI, CellReference_toIndices(reference)[1]);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Sets the row index (1 Based indices) of a "A1" style excel cell reference.
|
|
94
|
+
*/
|
|
95
|
+
export function CellReference_setRowIndex(rowI, reference) {
|
|
96
|
+
return CellReference_ofIndices(CellReference_toIndices(reference)[0], rowI);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Changes the column portion of a "A1"-style reference by the given amount (positive amount = increase and vice versa).
|
|
101
|
+
*/
|
|
102
|
+
export function CellReference_moveHorizontal(amount, reference) {
|
|
103
|
+
let value;
|
|
104
|
+
let tupledArg_1;
|
|
105
|
+
const tupledArg = CellReference_toIndices(reference);
|
|
106
|
+
tupledArg_1 = [(value = toInt64(op_Addition(toInt64(fromUInt32(tupledArg[0])), toInt64(fromInt32(amount)))), toUInt32(value) >>> 0), tupledArg[1]];
|
|
107
|
+
return CellReference_ofIndices(tupledArg_1[0], tupledArg_1[1]);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Changes the row portion of a "A1"-style reference by the given amount (positive amount = increase and vice versa).
|
|
112
|
+
*/
|
|
113
|
+
export function CellReference_moveVertical(amount, reference) {
|
|
114
|
+
let value;
|
|
115
|
+
let tupledArg_1;
|
|
116
|
+
const tupledArg = CellReference_toIndices(reference);
|
|
117
|
+
tupledArg_1 = [tupledArg[0], (value = toInt64(op_Addition(toInt64(fromUInt32(tupledArg[1])), toInt64(fromInt32(amount)))), toUInt32(value) >>> 0)];
|
|
118
|
+
return CellReference_ofIndices(tupledArg_1[0], tupledArg_1[1]);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export class FsAddress {
|
|
122
|
+
constructor(rowNumber, columnNumber, fixedRow, fixedColumn) {
|
|
123
|
+
this._fixedRow = fixedRow;
|
|
124
|
+
this._fixedColumn = fixedColumn;
|
|
125
|
+
this._rowNumber = (rowNumber | 0);
|
|
126
|
+
this._columnNumber = (columnNumber | 0);
|
|
127
|
+
this._trimmedAddress = "";
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export function FsAddress_$reflection() {
|
|
132
|
+
return class_type("FsSpreadsheet.FsAddress", void 0, FsAddress);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export function FsAddress_$ctor_Z4C746FC0(rowNumber, columnNumber, fixedRow, fixedColumn) {
|
|
136
|
+
return new FsAddress(rowNumber, columnNumber, fixedRow, fixedColumn);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export function FsAddress_$ctor_Z668C30D9(rowNumber, columnLetter, fixedRow, fixedColumn) {
|
|
140
|
+
return FsAddress_$ctor_Z4C746FC0(rowNumber, ~~CellReference_colAdressToIndex(columnLetter), fixedRow, fixedColumn);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export function FsAddress_$ctor_Z37302880(rowNumber, columnNumber) {
|
|
144
|
+
return FsAddress_$ctor_Z4C746FC0(rowNumber, columnNumber, false, false);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export function FsAddress_$ctor_Z721C83C5(cellAddressString) {
|
|
148
|
+
const patternInput = CellReference_toIndices(cellAddressString);
|
|
149
|
+
return FsAddress_$ctor_Z37302880(~~patternInput[1], ~~patternInput[0]);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export function FsAddress__get_ColumnNumber(self) {
|
|
153
|
+
return self._columnNumber;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export function FsAddress__set_ColumnNumber_Z524259A4(self, colI) {
|
|
157
|
+
self._columnNumber = (colI | 0);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export function FsAddress__get_RowNumber(self) {
|
|
161
|
+
return self._rowNumber;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export function FsAddress__set_RowNumber_Z524259A4(self, rowI) {
|
|
165
|
+
self._rowNumber = (rowI | 0);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export function FsAddress__get_Address(self) {
|
|
169
|
+
return CellReference_ofIndices(self._columnNumber >>> 0, self._rowNumber >>> 0);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export function FsAddress__set_Address_Z721C83C5(self, address) {
|
|
173
|
+
const patternInput = CellReference_toIndices(address);
|
|
174
|
+
self._rowNumber = (~~patternInput[1] | 0);
|
|
175
|
+
self._columnNumber = (~~patternInput[0] | 0);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export function FsAddress__get_FixedRow(self) {
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export function FsAddress__get_FixedColumn(self) {
|
|
183
|
+
return false;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Creates a deep copy of the FsAddress.
|
|
188
|
+
*/
|
|
189
|
+
export function FsAddress__Copy(this$) {
|
|
190
|
+
const colNo = FsAddress__get_ColumnNumber(this$) | 0;
|
|
191
|
+
return FsAddress_$ctor_Z4C746FC0(FsAddress__get_RowNumber(this$), colNo, FsAddress__get_FixedRow(this$), FsAddress__get_FixedColumn(this$));
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Returns a deep copy of the given FsAddress.
|
|
196
|
+
*/
|
|
197
|
+
export function FsAddress_copy_6D30B323(address) {
|
|
198
|
+
return FsAddress__Copy(address);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Updates the row- and columnIndex respective to the given indices.
|
|
203
|
+
*/
|
|
204
|
+
export function FsAddress__UpdateIndices_Z37302880(self, rowIndex, colIndex) {
|
|
205
|
+
self._columnNumber = (colIndex | 0);
|
|
206
|
+
self._rowNumber = (rowIndex | 0);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Updates the row- and columnIndex of a given FsAddress respective to the given indices.
|
|
211
|
+
*/
|
|
212
|
+
export function FsAddress_updateIndices(rowIndex, colIndex, address) {
|
|
213
|
+
FsAddress__UpdateIndices_Z37302880(address, rowIndex, colIndex);
|
|
214
|
+
return address;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Returns the row- and the columnIndex of the FsAddress.
|
|
219
|
+
*/
|
|
220
|
+
export function FsAddress__ToIndices(self) {
|
|
221
|
+
return [self._rowNumber, self._columnNumber];
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Returns the row- and the columnIndex of a given FsAddress.
|
|
226
|
+
*/
|
|
227
|
+
export function FsAddress_toIndices_6D30B323(address) {
|
|
228
|
+
return FsAddress__ToIndices(address);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Compares the FsAddress with a given other one.
|
|
233
|
+
*/
|
|
234
|
+
export function FsAddress__Compare_6D30B323(self, address) {
|
|
235
|
+
if ((((FsAddress__get_Address(self) === FsAddress__get_Address(address)) && (FsAddress__get_ColumnNumber(self) === FsAddress__get_ColumnNumber(address))) && (FsAddress__get_RowNumber(self) === FsAddress__get_RowNumber(address))) && (FsAddress__get_FixedColumn(self) === FsAddress__get_FixedColumn(address))) {
|
|
236
|
+
return FsAddress__get_FixedRow(self) === FsAddress__get_FixedRow(address);
|
|
237
|
+
}
|
|
238
|
+
else {
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Checks if 2 FsAddresses are equal.
|
|
245
|
+
*/
|
|
246
|
+
export function FsAddress_compare(address1, address2) {
|
|
247
|
+
return FsAddress__Compare_6D30B323(address1, address2);
|
|
248
|
+
}
|
|
249
|
+
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
namespace FsSpreadsheet
|
|
2
|
+
|
|
3
|
+
open System.Collections.Generic
|
|
4
|
+
open System.Collections
|
|
5
|
+
|
|
6
|
+
open Fable.Core
|
|
7
|
+
// Type based on the type XLRow used in ClosedXml
|
|
8
|
+
/// <summary>
|
|
9
|
+
/// Creates an FsColumn from the given FsRangeAddress, consisting of FsCells within a given FsCellsCollection, and a styleValue.
|
|
10
|
+
/// </summary>
|
|
11
|
+
/// <remarks>The FsCellsCollection must only cover 1 column!</remarks>
|
|
12
|
+
/// <exception cref="System.Exception">if given FsCellsCollection has more than 1 column.</exception>
|
|
13
|
+
[<AttachMembers>]
|
|
14
|
+
type FsColumn (rangeAddress : FsRangeAddress, cells : FsCellsCollection)=
|
|
15
|
+
|
|
16
|
+
inherit FsRangeBase(rangeAddress)
|
|
17
|
+
|
|
18
|
+
let cells = cells
|
|
19
|
+
|
|
20
|
+
// ----------
|
|
21
|
+
// Creation
|
|
22
|
+
// ----------
|
|
23
|
+
|
|
24
|
+
/// Creates an empty FsColumn, ranging from row 0, column 0 to row 0, column (1-based).
|
|
25
|
+
static member empty() = FsColumn (FsRangeAddress(FsAddress(0,0), FsAddress(0,0)), FsCellsCollection())
|
|
26
|
+
|
|
27
|
+
/// <summary>
|
|
28
|
+
/// Create an FsColumn from a given FsCellsCollection and an columnColumn.
|
|
29
|
+
/// </summary>
|
|
30
|
+
/// <remarks>The appropriate range of the cells (i.e. minimum colIndex and maximum colIndex) is derived from the FsCells with the matching rowIndex.</remarks>
|
|
31
|
+
static member createAt(index : int32, (cells : FsCellsCollection)) =
|
|
32
|
+
let getIndexBy (f : (FsCell -> int) -> seq<FsCell> -> FsCell) =
|
|
33
|
+
match cells.GetCellsInColumn index |> Seq.length with
|
|
34
|
+
| 0 -> 1
|
|
35
|
+
| _ ->
|
|
36
|
+
(
|
|
37
|
+
cells.GetCellsInColumn index
|
|
38
|
+
|> f (fun c -> c.Address.RowNumber)
|
|
39
|
+
).Address.RowNumber
|
|
40
|
+
let minRowIndex = getIndexBy Seq.minBy
|
|
41
|
+
let maxRowIndex = getIndexBy Seq.maxBy
|
|
42
|
+
FsColumn (FsRangeAddress(FsAddress(minRowIndex, index), FsAddress(maxRowIndex, index)), cells)
|
|
43
|
+
|
|
44
|
+
interface IEnumerable<FsCell> with
|
|
45
|
+
member this.GetEnumerator() : System.Collections.Generic.IEnumerator<FsCell> = this.Cells.GetEnumerator()
|
|
46
|
+
|
|
47
|
+
interface IEnumerable with
|
|
48
|
+
member this.GetEnumerator() = (this :> IEnumerable<FsCell>).GetEnumerator() :> IEnumerator
|
|
49
|
+
|
|
50
|
+
// ----------
|
|
51
|
+
// PROPERTIES
|
|
52
|
+
// ----------
|
|
53
|
+
|
|
54
|
+
/// The associated FsCells.
|
|
55
|
+
member this.Cells =
|
|
56
|
+
base.Cells(cells)
|
|
57
|
+
|
|
58
|
+
/// <summary>
|
|
59
|
+
/// The index of the FsColumn.
|
|
60
|
+
/// </summary>
|
|
61
|
+
member this.Index
|
|
62
|
+
with get() = this.RangeAddress.FirstAddress.ColumnNumber
|
|
63
|
+
and set(i) =
|
|
64
|
+
this.RangeAddress.FirstAddress.ColumnNumber <- i
|
|
65
|
+
this.RangeAddress.LastAddress.ColumnNumber <- i
|
|
66
|
+
|
|
67
|
+
/// <summary>
|
|
68
|
+
/// The number of the lowest row index of the FsColumn where an FsCell exists.
|
|
69
|
+
/// </summary>
|
|
70
|
+
member this.MinRowIndex
|
|
71
|
+
with get() = this.RangeAddress.FirstAddress.RowNumber
|
|
72
|
+
|
|
73
|
+
/// <summary>
|
|
74
|
+
/// The number of the highest row index of the FsColumn where an FsCell exists.
|
|
75
|
+
/// </summary>
|
|
76
|
+
member this.MaxRowIndex
|
|
77
|
+
with get() = this.RangeAddress.LastAddress.RowNumber
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
// -------
|
|
81
|
+
// METHODS
|
|
82
|
+
// -------
|
|
83
|
+
|
|
84
|
+
/// <summary>
|
|
85
|
+
/// Creates a deep copy of this FsColumn.
|
|
86
|
+
/// </summary>
|
|
87
|
+
member this.Copy() =
|
|
88
|
+
let ra = this.RangeAddress.Copy()
|
|
89
|
+
let cells = this.Cells |> Seq.map (fun c -> c.Copy())
|
|
90
|
+
let fcc = FsCellsCollection()
|
|
91
|
+
fcc.Add cells
|
|
92
|
+
FsColumn(ra, fcc)
|
|
93
|
+
|
|
94
|
+
/// <summary>
|
|
95
|
+
/// Returns a deep copy of a given FsColumn.
|
|
96
|
+
/// </summary>
|
|
97
|
+
static member copy (column : FsColumn) =
|
|
98
|
+
column.Copy()
|
|
99
|
+
|
|
100
|
+
/// <summary>
|
|
101
|
+
/// Returns the index of the given FsColumn.
|
|
102
|
+
/// </summary>
|
|
103
|
+
static member getIndex (column : FsColumn) =
|
|
104
|
+
column.Index
|
|
105
|
+
|
|
106
|
+
/// <summary>
|
|
107
|
+
/// Checks if there is an FsCell at given row index.
|
|
108
|
+
/// </summary>
|
|
109
|
+
/// <param name="rowIndex">The number of the row where the presence of an FsCell shall be checked.</param>
|
|
110
|
+
member this.HasCellAt(rowIndex) =
|
|
111
|
+
this.Cells
|
|
112
|
+
|> Seq.exists (fun c -> c.RowNumber = rowIndex)
|
|
113
|
+
|
|
114
|
+
/// <summary>
|
|
115
|
+
/// Checks if there is an FsCell at given row index of a given FsColumn.
|
|
116
|
+
/// </summary>
|
|
117
|
+
/// <param name="colIndex">The number of the row where the presence of an FsCell shall be checked.</param>
|
|
118
|
+
static member hasCellAt rowIndex (column : FsColumn) =
|
|
119
|
+
column.HasCellAt rowIndex
|
|
120
|
+
|
|
121
|
+
/// <summary>
|
|
122
|
+
/// Returns the FsCell at rowIndex.
|
|
123
|
+
/// </summary>
|
|
124
|
+
member this.Item (rowIndex) =
|
|
125
|
+
// use FsRangeBase call with colindex 1
|
|
126
|
+
base.Cell(FsAddress(rowIndex, 1), cells)
|
|
127
|
+
|
|
128
|
+
/// <summary>
|
|
129
|
+
/// Returns the FsCell at the given rowIndex from an FsColumn.
|
|
130
|
+
/// </summary>
|
|
131
|
+
static member item rowIndex (column : FsColumn) =
|
|
132
|
+
column.Item(rowIndex)
|
|
133
|
+
|
|
134
|
+
/// <summary>
|
|
135
|
+
/// Returns the FsCell at the given rowIndex if it exists. Else returns None.
|
|
136
|
+
/// </summary>
|
|
137
|
+
/// <param name="rowIndex">The number of the column where the FsCell shall be retrieved.</param>
|
|
138
|
+
member this.TryItem(rowIndex) =
|
|
139
|
+
if this.HasCellAt rowIndex then Some this[rowIndex]
|
|
140
|
+
else None
|
|
141
|
+
|
|
142
|
+
/// <summary>
|
|
143
|
+
/// Returns the FsCell at the given rowIndex if it exists in the given FsColumn. Else returns None.
|
|
144
|
+
/// </summary>
|
|
145
|
+
/// <param name="rowIndex">The number of the column where the FsCell shall be retrieved.</param>
|
|
146
|
+
static member tryItem rowIndex (column : FsColumn) =
|
|
147
|
+
column.TryItem rowIndex
|
|
148
|
+
|
|
149
|
+
///// <summary>
|
|
150
|
+
///// Inserts the value at columnIndex as an FsCell. If there is an FsCell at the position, this FsCells and all the ones /right /to it are shifted to the right.
|
|
151
|
+
///// </summary>
|
|
152
|
+
//member this.InsertValueAt(colIndex, (value : 'a)) =
|
|
153
|
+
// let cell = FsCell(value)
|
|
154
|
+
// cells.Add(int32 this.Index, int32 colIndex, cell)
|
|
155
|
+
|
|
156
|
+
///// <summary>
|
|
157
|
+
///// Adds a value at the given row- and columnIndex to FsRow using.
|
|
158
|
+
/////
|
|
159
|
+
///// If a cell exists in the given position, shoves it to the right.
|
|
160
|
+
///// </summary>
|
|
161
|
+
//static member insertValueAt colIndex value (row : FsRow) =
|
|
162
|
+
// row.InsertValueAt(colIndex, value) |> ignore
|
|
163
|
+
// row
|
|
164
|
+
|
|
165
|
+
//member this.SortCells() = _cells <- _cells |> List.sortBy (fun c -> c.WorksheetColumn)
|
|
166
|
+
|
|
167
|
+
// TO DO (later)
|
|
168
|
+
///// Takes an FsCellsCollection and creates an FsRow from the given rowIndex and the cells in the FsCellsCollection that share the same rowIndex.
|
|
169
|
+
//static member fromCellsCollection rowIndex (cellsCollection : FsCellsCollection) =
|
|
170
|
+
|
|
171
|
+
/// <summary>
|
|
172
|
+
/// Transforms the FsColumn into a dense FsColumn.
|
|
173
|
+
///
|
|
174
|
+
/// FsColumns are sparse by default. This means there are no FsCells present between positions with that are filled with FsCells. In dense FsColumns, such "empty positions" are then filled with empty FsCells.
|
|
175
|
+
/// </summary>
|
|
176
|
+
member this.ToDenseColumn() =
|
|
177
|
+
for i = this.MinRowIndex to this.MaxRowIndex do
|
|
178
|
+
ignore this[i]
|
|
179
|
+
|
|
180
|
+
/// <summary>
|
|
181
|
+
/// Transforms the given FsColumn into a dense FsColumn.
|
|
182
|
+
///
|
|
183
|
+
/// FsColumns are sparse by default. This means there are no FsCells present between positions with that are filled with FsCells. In dense FsColumns, such "empty positions" are then filled with empty FsCells.
|
|
184
|
+
/// </summary>
|
|
185
|
+
/// <param name="column">The FsColumn that gets transformed into a dense FsColumn.</param>
|
|
186
|
+
/// <remarks>This is an in-place operation.</remarks>
|
|
187
|
+
static member toDenseColumn (column : FsColumn) =
|
|
188
|
+
column.ToDenseColumn()
|
|
189
|
+
column
|
|
190
|
+
|
|
191
|
+
/// <summary>
|
|
192
|
+
/// Takes a given FsColumn and returns a new dense FsColumn from it.
|
|
193
|
+
///
|
|
194
|
+
/// FsColumns are sparse by default. This means there are no FsCells present between positions with that are filled with FsCells. In dense FsColumns, such "empty positions" are then filled with empty FsCells.
|
|
195
|
+
/// </summary>
|
|
196
|
+
/// <param name="column">The FsColumn that whose copy gets transformed into a dense FsColumn.</param>
|
|
197
|
+
static member createDenseColumnOf (column : FsColumn) =
|
|
198
|
+
let newColumn = column.Copy()
|
|
199
|
+
newColumn.ToDenseColumn()
|
|
200
|
+
newColumn
|