@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,455 @@
|
|
|
1
|
+
namespace FsSpreadsheet
|
|
2
|
+
|
|
3
|
+
open System.Collections.Generic
|
|
4
|
+
|
|
5
|
+
open Fable.Core
|
|
6
|
+
|
|
7
|
+
/// <summary>
|
|
8
|
+
/// Creates an FsTable from the given name and FsRangeAddres, with totals row shown and header row shown or not, accordingly.
|
|
9
|
+
/// </summary>
|
|
10
|
+
[<AttachMembers>]
|
|
11
|
+
type FsTable (name : string, rangeAddress : FsRangeAddress, ?showTotalsRow : bool, ?showHeaderRow : bool) =
|
|
12
|
+
|
|
13
|
+
inherit FsRangeBase(rangeAddress)
|
|
14
|
+
|
|
15
|
+
let mutable _name = name.Trim().Replace(" ","_")
|
|
16
|
+
|
|
17
|
+
let mutable _lastRangeAddress = rangeAddress
|
|
18
|
+
let mutable _showTotalsRow : bool = Option.defaultValue false showTotalsRow
|
|
19
|
+
let mutable _showHeaderRow : bool = Option.defaultValue true showHeaderRow
|
|
20
|
+
|
|
21
|
+
let mutable _fieldNames : Dictionary<string,FsTableField> = Dictionary()
|
|
22
|
+
let _uniqueNames : HashSet<string> = HashSet()
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
/// <summary>
|
|
26
|
+
/// The name of the FsTable.
|
|
27
|
+
/// </summary>
|
|
28
|
+
member this.Name
|
|
29
|
+
with get() = _name
|
|
30
|
+
|
|
31
|
+
/// <summary>
|
|
32
|
+
/// Returns all fieldnames as `fieldname*FsTableField` dictionary.
|
|
33
|
+
/// </summary>
|
|
34
|
+
member this.GetFieldNames (cellsCollection : FsCellsCollection) =
|
|
35
|
+
if (_fieldNames <> null && _lastRangeAddress <> null && _lastRangeAddress.Equals(this.RangeAddress)) then
|
|
36
|
+
_fieldNames;
|
|
37
|
+
else
|
|
38
|
+
_lastRangeAddress <- this.RangeAddress
|
|
39
|
+
|
|
40
|
+
//this.RescanFieldNames(cellsCollection)
|
|
41
|
+
|
|
42
|
+
_fieldNames;
|
|
43
|
+
|
|
44
|
+
/// <summary>
|
|
45
|
+
/// The FsTableFields of this FsTable.
|
|
46
|
+
/// </summary>
|
|
47
|
+
member this.GetFields (cellsCollection : FsCellsCollection) =
|
|
48
|
+
let columnCount = base.ColumnCount()
|
|
49
|
+
//let offset = base.RangeAddress.FirstAddress.ColumnNumber
|
|
50
|
+
Seq.init columnCount (fun i -> this.GetFieldAt(i, cellsCollection))
|
|
51
|
+
|
|
52
|
+
/// <summary>
|
|
53
|
+
/// Gets or sets if the header row is shown.
|
|
54
|
+
/// </summary>
|
|
55
|
+
member this.ShowHeaderRow
|
|
56
|
+
with get () = _showHeaderRow
|
|
57
|
+
and set(showHeaderRow) = _showHeaderRow <- showHeaderRow
|
|
58
|
+
|
|
59
|
+
/// <summary>
|
|
60
|
+
/// Returns the header row as FsRangeRow. Scans for new fieldnames.
|
|
61
|
+
/// </summary>
|
|
62
|
+
member this.HeadersRow() =
|
|
63
|
+
if (not this.ShowHeaderRow) then null;
|
|
64
|
+
else
|
|
65
|
+
FsRange(base.RangeAddress).FirstRow();
|
|
66
|
+
|
|
67
|
+
/// <summary>
|
|
68
|
+
/// Returns the FsColumns from the FsTable.
|
|
69
|
+
/// </summary>
|
|
70
|
+
/// <param name="cellsCollection">The FsCellsCollection associated with this FsTable.</param>
|
|
71
|
+
member this.GetColumns(cellsCollection : FsCellsCollection) =
|
|
72
|
+
seq {
|
|
73
|
+
for i = this.RangeAddress.FirstAddress.ColumnNumber to this.RangeAddress.LastAddress.ColumnNumber do
|
|
74
|
+
let firstAddress = FsAddress(this.RangeAddress.FirstAddress.RowNumber, i)
|
|
75
|
+
let lastAddress = FsAddress(this.RangeAddress.LastAddress.RowNumber, i)
|
|
76
|
+
let range = FsRangeAddress (firstAddress, lastAddress)
|
|
77
|
+
FsColumn(range, cellsCollection)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/// <summary>
|
|
81
|
+
/// Returns the FsRows from the FsTable.
|
|
82
|
+
/// </summary>
|
|
83
|
+
/// <param name="cellsCollection">The FsCellsCollection associated with this FsTable.</param>
|
|
84
|
+
member this.GetRows(cellsCollection : FsCellsCollection) =
|
|
85
|
+
seq {
|
|
86
|
+
for i = this.RangeAddress.FirstAddress.RowNumber to this.RangeAddress.LastAddress.RowNumber do
|
|
87
|
+
let firstAddress = FsAddress(i, this.RangeAddress.FirstAddress.ColumnNumber)
|
|
88
|
+
let lastAddress = FsAddress(i, this.RangeAddress.LastAddress.ColumnNumber)
|
|
89
|
+
let range = FsRangeAddress (firstAddress, lastAddress)
|
|
90
|
+
FsRow(range, cellsCollection)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/// <summary>
|
|
94
|
+
/// Updates the FsRangeAddress of the FsTable according to the FsTableFields associated.
|
|
95
|
+
/// </summary>
|
|
96
|
+
member this.RescanRange() =
|
|
97
|
+
let rangeAddress =
|
|
98
|
+
_fieldNames.Values
|
|
99
|
+
|> Seq.map (fun v -> v.Column.RangeAddress)
|
|
100
|
+
|> Seq.reduce (fun r1 r2 -> r1.Union(r2))
|
|
101
|
+
base.RangeAddress <- rangeAddress
|
|
102
|
+
|
|
103
|
+
/// <summary>
|
|
104
|
+
/// Updates the FsRangeAddress of a given FsTable according to the FsTableFields associated.
|
|
105
|
+
/// </summary>
|
|
106
|
+
static member rescanRange (table : FsTable) =
|
|
107
|
+
table.RescanRange()
|
|
108
|
+
table
|
|
109
|
+
|
|
110
|
+
/// <summary>
|
|
111
|
+
/// Returns a unique name consisting of the original name and an initial offset that is raised
|
|
112
|
+
/// if the original name with that offset is already present.
|
|
113
|
+
/// </summary>
|
|
114
|
+
/// <param name="originalName">Header name that was tried to be used.</param>
|
|
115
|
+
/// <param name="initialOffset">First number that together with the originalName, leads to a unique column header.</param>
|
|
116
|
+
/// <param name="enforceOffset">If true, the initial offset is always applied.</param>
|
|
117
|
+
member this.GetUniqueName(originalName : string, initialOffset : int32, enforceOffset : bool) =
|
|
118
|
+
let mutable name = originalName + if enforceOffset then string initialOffset else ""
|
|
119
|
+
if _uniqueNames.Contains(name) then
|
|
120
|
+
|
|
121
|
+
let mutable i = initialOffset
|
|
122
|
+
name <- originalName + string i
|
|
123
|
+
while _uniqueNames.Contains(name) do
|
|
124
|
+
|
|
125
|
+
i <- i + 1
|
|
126
|
+
name <- originalName + string i
|
|
127
|
+
|
|
128
|
+
_uniqueNames.Add name |> ignore
|
|
129
|
+
name
|
|
130
|
+
|
|
131
|
+
/// <summary>
|
|
132
|
+
/// Returns a unique name consisting of the original name and an initial offset that is raised
|
|
133
|
+
/// if the original name with that offset is already present.
|
|
134
|
+
/// </summary>
|
|
135
|
+
/// <param name="originalName">Header name that was tried to be used.</param>
|
|
136
|
+
/// <param name="initialOffset">First number that together with the originalName, leads to a unique column header.</param>
|
|
137
|
+
/// <param name="enforceOffset">If true, the initial offset is always applied.</param>
|
|
138
|
+
/// <param name="table">The FsTable on which this function is called.</param>
|
|
139
|
+
static member getUniqueNames originalName initialOffset enforceOffset (table : FsTable) =
|
|
140
|
+
table.GetUniqueName(originalName, initialOffset, enforceOffset)
|
|
141
|
+
|
|
142
|
+
/// <summary>
|
|
143
|
+
/// Creates and adds FsTableFields from a sequence of field names to the FsTable.
|
|
144
|
+
/// </summary>
|
|
145
|
+
member this.InitFields(fieldNames : seq<string>) =
|
|
146
|
+
// _fieldNames = new Dictionary<String, IXLTableField>(); // let's _not_ do it this way.
|
|
147
|
+
//let rangeCols = FsRangeAddress.toRangeColumns base.RangeAddress
|
|
148
|
+
fieldNames
|
|
149
|
+
|> Seq.iteri (
|
|
150
|
+
fun i fn ->
|
|
151
|
+
let tableField = FsTableField(fn, i, FsRangeColumn i)
|
|
152
|
+
_fieldNames.Add(fn, tableField)
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
/// <summary>
|
|
156
|
+
/// Creates and adds FsTableFields from a sequence of field names to a given FsTable.
|
|
157
|
+
/// </summary>
|
|
158
|
+
static member initFields (fieldNames : seq<string>) (table : FsTable) =
|
|
159
|
+
table.InitFields fieldNames
|
|
160
|
+
table
|
|
161
|
+
|
|
162
|
+
/// <summary>
|
|
163
|
+
/// Adds a sequence of FsTableFields to the FsTable.
|
|
164
|
+
/// </summary>
|
|
165
|
+
member this.AddFields(tableFields : seq<FsTableField>) =
|
|
166
|
+
tableFields
|
|
167
|
+
|> Seq.iter (
|
|
168
|
+
fun tf -> _fieldNames.Add(tf.Name, tf)
|
|
169
|
+
)
|
|
170
|
+
|
|
171
|
+
/// <summary>
|
|
172
|
+
/// Adds a sequence of FsTableFields to a given FsTable.
|
|
173
|
+
/// </summary>
|
|
174
|
+
static member addFields (tableFields : seq<FsTableField>) (table : FsTable) =
|
|
175
|
+
table.AddFields tableFields
|
|
176
|
+
table
|
|
177
|
+
|
|
178
|
+
/// <summary>
|
|
179
|
+
/// Returns the FsTableField with given name. If an FsTableField does not exist under this name in the FsTable, adds it.
|
|
180
|
+
/// </summary>
|
|
181
|
+
member this.Field(name : string, cellsCollection : FsCellsCollection) =
|
|
182
|
+
match Dictionary.tryGet name _fieldNames with
|
|
183
|
+
| Some field ->
|
|
184
|
+
field
|
|
185
|
+
| None ->
|
|
186
|
+
let maxIndex =
|
|
187
|
+
_fieldNames.Values
|
|
188
|
+
|> Seq.map (fun v -> v.Index)
|
|
189
|
+
|> fun s ->
|
|
190
|
+
if Seq.length s = 0 then 0 else Seq.max s
|
|
191
|
+
let range =
|
|
192
|
+
let offset = _fieldNames.Count
|
|
193
|
+
let firstAddress = FsAddress(this.RangeAddress.FirstAddress.RowNumber,this.RangeAddress.FirstAddress.ColumnNumber + offset)
|
|
194
|
+
let lastAddress = FsAddress(this.RangeAddress.LastAddress.RowNumber,this.RangeAddress.FirstAddress.ColumnNumber + offset)
|
|
195
|
+
FsRangeAddress(firstAddress,lastAddress)
|
|
196
|
+
let column = FsRangeColumn(range)
|
|
197
|
+
let newField = FsTableField(name,maxIndex + 1,column,null,null)
|
|
198
|
+
if this.ShowHeaderRow then
|
|
199
|
+
newField.HeaderCell(cellsCollection,true).SetValueAs name |> ignore
|
|
200
|
+
_fieldNames.Add(name,newField)
|
|
201
|
+
this.RescanRange()
|
|
202
|
+
newField
|
|
203
|
+
|
|
204
|
+
/// <summary>
|
|
205
|
+
/// Takes a name of an FsTableField and an FsCellsCollection (belonging to the FsWorksheet of this
|
|
206
|
+
/// FsTable) and returns the respective FsTableField.
|
|
207
|
+
/// </summary>
|
|
208
|
+
/// <exception cref="System.ArgumentException">if the header row has no field with the given name.</exception>
|
|
209
|
+
member this.GetField(name : string, cellsCollection : FsCellsCollection) =
|
|
210
|
+
let name = name.Replace("\r\n", "\n")
|
|
211
|
+
try this.GetFieldNames(cellsCollection).Item name
|
|
212
|
+
with _ -> failwith <| "The header row doesn't contain field name '" + name + "'."
|
|
213
|
+
|
|
214
|
+
/// <summary>
|
|
215
|
+
/// Takes a name of an FsTableField and an FsCellsCollection (belonging to the FsWorksheet of this
|
|
216
|
+
/// FsTable) and returns the respective FsTableField.
|
|
217
|
+
/// </summary>
|
|
218
|
+
/// <exception cref="System.ArgumentException">if the header row has no field with the given name.</exception>
|
|
219
|
+
static member getField (name : string) (cellsCollection : FsCellsCollection) (table : FsTable) =
|
|
220
|
+
table.GetField(name, cellsCollection)
|
|
221
|
+
|
|
222
|
+
/// <summary>
|
|
223
|
+
/// Takes the index of an FsTableField and an FsCellsCollection (belonging to the FsWorksheet of
|
|
224
|
+
/// this FsTable) and returns the respective FsTableField.
|
|
225
|
+
/// </summary>
|
|
226
|
+
/// <exception cref="System.ArgumentException">if the FsTable has no FsTableField with the given index.</exception>
|
|
227
|
+
member this.GetFieldAt(index, cellsCollection) =
|
|
228
|
+
try
|
|
229
|
+
this.GetFieldNames(cellsCollection).Values
|
|
230
|
+
|> Seq.find (fun ftf -> ftf.Index = index)
|
|
231
|
+
with _ -> failwith $"FsTableField with index {index} does not exist in the FsTable."
|
|
232
|
+
|
|
233
|
+
/// <summary>
|
|
234
|
+
/// Takes a name of an FsTableField and an FsCellsCollection (belonging to the FsWorksheet of
|
|
235
|
+
/// this FsTable) and returns the index of the respective FsTableField.
|
|
236
|
+
/// </summary>
|
|
237
|
+
/// <exception cref="System.ArgumentException">if the header row has no field with the given name.</exception>
|
|
238
|
+
member this.GetFieldIndex(name : string, cellsCollection) =
|
|
239
|
+
this.GetField(name, cellsCollection).Index
|
|
240
|
+
|
|
241
|
+
/// <summary>
|
|
242
|
+
/// Renames a fieldname of the FsTable if it exists. Else fails.
|
|
243
|
+
/// </summary>
|
|
244
|
+
/// <exception cref="System.ArgumentException">if the FsTableField does not exist in the FsTable.</exception>
|
|
245
|
+
member this.RenameField(oldName : string, newName : string) =
|
|
246
|
+
match Dictionary.tryGet oldName _fieldNames with
|
|
247
|
+
| Some field ->
|
|
248
|
+
_fieldNames.Remove(oldName) |> ignore
|
|
249
|
+
_fieldNames.Add(newName, field)
|
|
250
|
+
| None ->
|
|
251
|
+
raise (System.ArgumentException("The FsTabelField does not exist in this FsTable", "oldName"))
|
|
252
|
+
|
|
253
|
+
/// <summary>
|
|
254
|
+
/// Renames a fieldname of the FsTable if it exists. Else fails.
|
|
255
|
+
/// </summary>
|
|
256
|
+
/// <exception cref="System.ArgumentException">if the FsTableField does not exist in the FsTable.</exception>
|
|
257
|
+
static member renameField oldName newName (table : FsTable) =
|
|
258
|
+
table.RenameField(oldName, newName)
|
|
259
|
+
table
|
|
260
|
+
|
|
261
|
+
/// <summary>
|
|
262
|
+
/// Returns the header cell from a given FsCellsCollection with the given colum index if the cell exists. Else returns None.
|
|
263
|
+
/// </summary>
|
|
264
|
+
member this.TryGetHeaderCellOfColumnAt(cellsCollection : FsCellsCollection, colIndex : int) =
|
|
265
|
+
let fstRowIndex = this.RangeAddress.FirstAddress.RowNumber
|
|
266
|
+
cellsCollection.GetCellsInColumn colIndex
|
|
267
|
+
|> Seq.tryFind (fun c -> c.RowNumber = fstRowIndex)
|
|
268
|
+
|
|
269
|
+
/// <summary>
|
|
270
|
+
/// Returns the header cell from a given FsCellsCollection with the given column index in a given FsTable if the cell exists. Else
|
|
271
|
+
/// returns None.
|
|
272
|
+
/// </summary>
|
|
273
|
+
static member tryGetHeaderCellOfColumnIndexAt cellsCollection (colIndex : int) (table : FsTable) =
|
|
274
|
+
table.TryGetHeaderCellOfColumnAt(cellsCollection, colIndex)
|
|
275
|
+
|
|
276
|
+
/// <summary>
|
|
277
|
+
/// Returns the header cell of a given FsRangeColumn from a given FsCellsCollection if the cell exists. Else returns None.
|
|
278
|
+
/// </summary>
|
|
279
|
+
member this.TryGetHeaderCellOfColumn(cellsCollection : FsCellsCollection, column : FsRangeColumn) =
|
|
280
|
+
this.TryGetHeaderCellOfColumnAt(cellsCollection, column.Index)
|
|
281
|
+
|
|
282
|
+
/// <summary>
|
|
283
|
+
/// Returns the header cell of a given FsRangeColumn from a given FsCellsCollection in a given FsTable if the cell exists.
|
|
284
|
+
/// Else returns None.
|
|
285
|
+
/// </summary>
|
|
286
|
+
static member tryGetHeaderCellOfColumn cellsCollection (column : FsRangeColumn) (table : FsTable) =
|
|
287
|
+
table.TryGetHeaderCellOfColumn(cellsCollection, column)
|
|
288
|
+
|
|
289
|
+
/// <summary>
|
|
290
|
+
/// Returns the header cell from a given FsCellsCollection with the given colum index.
|
|
291
|
+
/// </summary>
|
|
292
|
+
/// <exception cref="System.NullReferenceException">if the FsCell cannot be found.</exception>
|
|
293
|
+
member this.GetHeaderCellOfColumnAt(cellsCollection, colIndex : int) =
|
|
294
|
+
this.TryGetHeaderCellOfColumnAt(cellsCollection, colIndex).Value
|
|
295
|
+
|
|
296
|
+
/// <summary>
|
|
297
|
+
/// Returns the header cell from a given FsCellsCollection with the given colum index in a given FsTable.
|
|
298
|
+
/// </summary>
|
|
299
|
+
/// <exception cref="System.NullReferenceException">if the FsCell cannot be found.</exception>
|
|
300
|
+
static member getHeaderCellOfColumnIndexAt cellsCollection (colIndex : int) (table : FsTable) =
|
|
301
|
+
table.GetHeaderCellOfColumnAt(cellsCollection, colIndex)
|
|
302
|
+
|
|
303
|
+
/// <summary>
|
|
304
|
+
/// Returns the header cell of a given FsRangeColumn from a given FsCellsCollection.
|
|
305
|
+
/// </summary>
|
|
306
|
+
/// <exception cref="System.NullReferenceException">if the FsCell cannot be found.</exception>
|
|
307
|
+
member this.GetHeaderCellOfColumn(cellsCollection : FsCellsCollection, column : FsRangeColumn) =
|
|
308
|
+
this.TryGetHeaderCellOfColumn(cellsCollection, column).Value
|
|
309
|
+
|
|
310
|
+
/// <summary>
|
|
311
|
+
/// Returns the header cell of a given FsRangeColumn from a given FsCellsCollection in a given FsTable.
|
|
312
|
+
/// </summary>
|
|
313
|
+
/// <exception cref="System.NullReferenceException">if the FsCell cannot be found.</exception>
|
|
314
|
+
static member getHeaderCellOfColumn cellsCollection (column : FsRangeColumn) (table : FsTable) =
|
|
315
|
+
table.GetHeaderCellOfColumn(cellsCollection, column)
|
|
316
|
+
|
|
317
|
+
/// <summary>
|
|
318
|
+
/// Returns the header cell of a given FsTableField from a given FsCellsCollection.
|
|
319
|
+
/// </summary>
|
|
320
|
+
member this.GetHeaderCellOfTableField(cellsCollection, tableField : FsTableField) =
|
|
321
|
+
tableField.HeaderCell(cellsCollection, this.ShowHeaderRow)
|
|
322
|
+
|
|
323
|
+
/// <summary>
|
|
324
|
+
/// Returns the header cell of a given FsTableField from a given FsCellsCollection in a given FsTable.
|
|
325
|
+
/// </summary>
|
|
326
|
+
static member getHeaderCellOfTableField cellsCollection (tableField : FsTableField) (table : FsTable) =
|
|
327
|
+
table.GetHeaderCellOfTableField(cellsCollection, tableField)
|
|
328
|
+
|
|
329
|
+
/// <summary>
|
|
330
|
+
/// Returns the header cell from an FsTableField with the given index using a given FsCellsCollection if the cell exists.
|
|
331
|
+
/// Else returns None.
|
|
332
|
+
/// </summary>
|
|
333
|
+
member this.TryGetHeaderCellOfTableFieldAt(cellsCollection, tableFieldIndex : int) =
|
|
334
|
+
_fieldNames.Values
|
|
335
|
+
|> Seq.tryPick (
|
|
336
|
+
fun tf ->
|
|
337
|
+
if tf.Index = tableFieldIndex then
|
|
338
|
+
Some (tf.HeaderCell(cellsCollection, this.ShowHeaderRow))
|
|
339
|
+
else None
|
|
340
|
+
)
|
|
341
|
+
|
|
342
|
+
/// <summary>
|
|
343
|
+
/// Returns the header cell from an FsTableField with the given index using a given FsCellsCollection if the cell exists
|
|
344
|
+
/// in a given FsTable. Else returns None.
|
|
345
|
+
/// </summary>
|
|
346
|
+
static member tryGetHeaderCellOfTableFieldIndexAt cellsCollection (tableFieldIndex : int) (table : FsTable) =
|
|
347
|
+
table.TryGetHeaderCellOfTableFieldAt(cellsCollection, tableFieldIndex)
|
|
348
|
+
|
|
349
|
+
/// <summary>
|
|
350
|
+
/// Returns the header cell from an FsTableField with the given index using a given FsCellsCollection.
|
|
351
|
+
/// </summary>
|
|
352
|
+
/// <exception cref="System.NullReferenceException">if the FsCell cannot be found.</exception>
|
|
353
|
+
member this.GetHeaderCellOfTableFieldAt(cellsCollection, tableFieldIndex : int) =
|
|
354
|
+
this.TryGetHeaderCellOfTableFieldAt(cellsCollection, tableFieldIndex).Value
|
|
355
|
+
|
|
356
|
+
/// <summary>
|
|
357
|
+
/// Returns the header cell from an FsTableField with the given index using a given FsCellsCollection in a given FsTable.
|
|
358
|
+
/// </summary>
|
|
359
|
+
/// <exception cref="System.NullReferenceException">if the FsCell cannot be found.</exception>
|
|
360
|
+
static member getHeaderCellOfTableFieldIndexAt cellsCollection (tableFieldIndex : int) (table : FsTable) =
|
|
361
|
+
table.GetHeaderCellOfTableFieldAt(cellsCollection, tableFieldIndex)
|
|
362
|
+
|
|
363
|
+
/// <summary>
|
|
364
|
+
/// Returns the header cell from an FsTableField with the given name using an FsCellsCollection in the FsTable if the cell exists.
|
|
365
|
+
/// Else returns None.
|
|
366
|
+
/// </summary>
|
|
367
|
+
member this.TryGetHeaderCellByFieldName(cellsCollection, fieldName : string) =
|
|
368
|
+
match Dictionary.tryGet fieldName _fieldNames with
|
|
369
|
+
| Some tf -> Some (tf.HeaderCell(cellsCollection, this.ShowHeaderRow))
|
|
370
|
+
| None -> None
|
|
371
|
+
|
|
372
|
+
/// <summary>
|
|
373
|
+
/// Returns the header cell from an FsTableField with the given name using an FsCellsCollection in a given FsTable if the cell exists.
|
|
374
|
+
/// Else returns None.
|
|
375
|
+
/// </summary>
|
|
376
|
+
static member tryGetHeaderCellByFieldName cellsCollection (fieldName : string) (table : FsTable) =
|
|
377
|
+
table.TryGetHeaderCellByFieldName(cellsCollection, fieldName)
|
|
378
|
+
|
|
379
|
+
/// <summary>
|
|
380
|
+
/// Returns the data cells from a given FsCellsCollection with the given colum index.
|
|
381
|
+
/// </summary>
|
|
382
|
+
/// <remarks>Column index must fit the FsCellsCollection, not the FsTable!</remarks>
|
|
383
|
+
member this.GetDataCellsOfColumnAt(cellsCollection : FsCellsCollection, colIndex) =
|
|
384
|
+
let fstRowIndex = this.RangeAddress.FirstAddress.RowNumber
|
|
385
|
+
let lstRowIndex = this.RangeAddress.LastAddress.RowNumber
|
|
386
|
+
[fstRowIndex + 1 .. lstRowIndex]
|
|
387
|
+
|> Seq.choose (
|
|
388
|
+
fun ri -> cellsCollection.TryGetCell(ri, colIndex)
|
|
389
|
+
)
|
|
390
|
+
|
|
391
|
+
/// <summary>
|
|
392
|
+
/// Returns the data cells from a given FsCellsCollection with the given colum index in a given FsTable.
|
|
393
|
+
/// </summary>
|
|
394
|
+
/// <remarks>Column index must fit the FsCellsCollection, not the FsTable!</remarks>
|
|
395
|
+
static member getDataCellsOfColumnIndexAt cellsCollection (colIndex : int) (table : FsTable) =
|
|
396
|
+
table.GetDataCellsOfColumnAt(cellsCollection, colIndex)
|
|
397
|
+
|
|
398
|
+
// TO DO: add equivalents of the other methods regarding header cell for data cells.
|
|
399
|
+
|
|
400
|
+
/// <summary>
|
|
401
|
+
/// Creates a deep copy of this FsTable.
|
|
402
|
+
/// </summary>
|
|
403
|
+
member this.Copy() =
|
|
404
|
+
let ra = this.RangeAddress.Copy()
|
|
405
|
+
let nam = this.Name
|
|
406
|
+
let shr = this.ShowHeaderRow
|
|
407
|
+
FsTable(nam, ra, false, shr)
|
|
408
|
+
|
|
409
|
+
/// <summary>
|
|
410
|
+
/// Returns a deep copy of a given FsTable.
|
|
411
|
+
/// </summary>
|
|
412
|
+
static member copy (table : FsTable) =
|
|
413
|
+
table.Copy()
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
/// Updates the TableFields according to the range of the table and the underlying cellcollection.
|
|
417
|
+
///
|
|
418
|
+
/// For this, maps over the range of the table and sets the header of the table fields to the value of the cell. If no cell value is set, the header value and the underlying cell value are set to a default value.
|
|
419
|
+
member this.RescanFieldNames(cellsCollection : FsCellsCollection) =
|
|
420
|
+
if this.ShowHeaderRow then
|
|
421
|
+
let oldFieldNames = _fieldNames
|
|
422
|
+
_fieldNames <- new Dictionary<string, FsTableField>()
|
|
423
|
+
let headersRow = this.HeadersRow();
|
|
424
|
+
let mutable cellPos = 0
|
|
425
|
+
for cell in headersRow.Cells(cellsCollection) do
|
|
426
|
+
let mutable name = cell.Value //GetString();
|
|
427
|
+
match Dictionary.tryGet name oldFieldNames with
|
|
428
|
+
| Some tableField ->
|
|
429
|
+
tableField.Index <- cellPos
|
|
430
|
+
_fieldNames.Add(name,tableField)
|
|
431
|
+
cellPos <- cellPos + 1
|
|
432
|
+
| None ->
|
|
433
|
+
|
|
434
|
+
// Be careful here. Fields names may actually be whitespace, but not empty
|
|
435
|
+
if (name = null) <> (name = "") then // TO DO: ask: shouldn't this be XOR?
|
|
436
|
+
|
|
437
|
+
name <- this.GetUniqueName("Column", cellPos + 1, true)
|
|
438
|
+
cell.SetValueAs(name) |> ignore
|
|
439
|
+
cell.DataType <- DataType.String
|
|
440
|
+
|
|
441
|
+
if (_fieldNames.ContainsKey(name)) then
|
|
442
|
+
raise (System.ArgumentException("The header row contains more than one field name '" + name + "'."))
|
|
443
|
+
|
|
444
|
+
_fieldNames.Add(name, new FsTableField(name, cellPos))
|
|
445
|
+
cellPos <- cellPos + 1
|
|
446
|
+
else
|
|
447
|
+
|
|
448
|
+
let colCount = base.ColumnCount();
|
|
449
|
+
for i = 1 to colCount do
|
|
450
|
+
|
|
451
|
+
if _fieldNames.Values |> Seq.exists (fun v -> v.Index = i - 1) |> not then
|
|
452
|
+
|
|
453
|
+
let name = "Column" + string i;
|
|
454
|
+
|
|
455
|
+
_fieldNames.Add(name, new FsTableField(name, i - 1));
|